当前位置: 首页>>代码示例>>PHP>>正文


PHP collapse_1d_complexity函数代码示例

本文整理汇总了PHP中collapse_1d_complexity函数的典型用法代码示例。如果您正苦于以下问题:PHP collapse_1d_complexity函数的具体用法?PHP collapse_1d_complexity怎么用?PHP collapse_1d_complexity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了collapse_1d_complexity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ocf_get_all_default_groups

/**
 * Get a list of the default usergroups (the usergroups a member is put in when they join).
 *
 * @param  boolean	Whether to include the default primary (at the end of the list).
 * @param  boolean	The functionality does not usually consider configured default groups [unless there's just one], because this is a layer of uncertainity (the user PICKS one of these). If you want to return all configured default groups, set this parameter to true.
 * @return array 		The list of default IDs.
 */
function ocf_get_all_default_groups($include_primary = false, $include_all_configured_default_groups = false)
{
    if (!$include_primary && $include_all_configured_default_groups) {
        warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    global $ALL_DEFAULT_GROUPS;
    if (array_key_exists($include_primary ? 1 : 0, $ALL_DEFAULT_GROUPS)) {
        return $ALL_DEFAULT_GROUPS[$include_primary ? 1 : 0];
    }
    $rows = $GLOBALS['FORUM_DB']->query_select('f_groups', array('id'), array('g_is_default' => 1, 'g_is_presented_at_install' => 0), 'ORDER BY g_order');
    $groups = collapse_1d_complexity('id', $rows);
    if ($include_primary) {
        $rows = $GLOBALS['FORUM_DB']->query_select('f_groups', array('id'), array('g_is_presented_at_install' => 1), 'ORDER BY g_order');
        if ($include_all_configured_default_groups || count($rows) == 1 || get_option('show_first_join_page') == '0') {
            $groups = array_merge($groups, collapse_1d_complexity('id', $rows));
        }
        if (count($rows) == 0) {
            $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups', 'id', array('id' => db_get_first_id() + 8));
            if (!is_null($test)) {
                $groups[] = db_get_first_id() + 8;
            }
        }
    }
    $ALL_DEFAULT_GROUPS[$include_primary ? 1 : 0] = $groups;
    return $groups;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:ocf_groups.php

示例2: action

 /**
  * Standard interface stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function action()
 {
     require_code('database_action');
     $class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
     $title = get_page_title('OCGIFTS_TITLE');
     require_code('form_templates');
     $map = NULL;
     $category = either_param('category', '');
     if ($category != '') {
         $map = array('category' => $category);
     }
     $max_rows = $GLOBALS['SITE_DB']->query_value('ocgifts', 'COUNT(*)', $map);
     $max = get_param_integer('max', 20);
     $start = get_param_integer('start', 0);
     require_code('templates_results_browser');
     $results_browser = results_browser(do_lang_tempcode('OCGIFTS_TITLE'), get_param('id'), $start, 'start', $max, 'max', $max_rows, NULL, NULL, true, true);
     $rows = $GLOBALS['SITE_DB']->query_select('ocgifts g', array('*', '(SELECT COUNT(*) FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'members_gifts m WHERE m.gift_id=g.id) AS popularity'), $map, 'ORDER BY popularity DESC', $max, $start);
     $username = get_param('username', '');
     $gifts = array();
     foreach ($rows as $gift) {
         $gift_url = build_url(array('page' => 'pointstore', 'type' => 'action_done', 'id' => 'ocgifts', 'gift' => $gift['id'], 'username' => $username), '_SEARCH');
         $image_url = '';
         if (is_file(get_custom_file_base() . '/' . rawurldecode($gift['image']))) {
             $image_url = get_custom_base_url() . '/' . $gift['image'];
         }
         $gifts[] = array('NAME' => $gift['name'], 'PRICE' => integer_format($gift['price']), 'POPULARITY' => integer_format($gift['popularity']), 'GIFT_URL' => $gift_url, 'IMAGE_URL' => $image_url);
     }
     $categories = collapse_1d_complexity('category', $GLOBALS['SITE_DB']->query_select('ocgifts', array('DISTINCT category'), NULL, 'ORDER BY category'));
     return do_template('POINTSTORE_OCGIFTS_GIFTS', array('TITLE' => $title, 'GIFTS' => $gifts, 'RESULTS_BROWSER' => $results_browser, 'CATEGORY' => $category, 'CATEGORIES' => $categories));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:ocgifts.php

示例3: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (get_value('implicit_usergroup_sync') === '1') {
         $last = get_value('last_implicit_sync');
         if (is_null($last) || intval($last) < time() - 60 * 60) {
             $hooks = find_all_hooks('systems', 'ocf_implicit_usergroups');
             foreach (array_keys($hooks) as $hook) {
                 require_code('hooks/systems/ocf_implicit_usergroups/' . $hook);
                 $ob = object_factory('Hook_implicit_usergroups_' . $hook);
                 $group_id = $ob->get_bound_group_id();
                 $GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_group_id' => $group_id));
                 $list = $ob->get_member_list();
                 if (!is_null($list)) {
                     foreach ($list as $member_row) {
                         $GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_row['id'], 'gm_validated' => 1));
                     }
                 } else {
                     $start = 0;
                     do {
                         $members = collapse_1d_complexity('id', $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 400, $start));
                         foreach ($members as $member_id) {
                             if ($ob->is_member_within($member_id)) {
                                 $GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_id, 'gm_validated' => 1));
                             }
                         }
                         $start += 400;
                     } while (count($members) == 400);
                 }
             }
             set_value('last_implicit_sync', strval(time()));
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:implicit_usergroup_sync.php

示例4: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('leader_board');
     require_code('points');
     require_css('points');
     $title = get_page_title('POINT_LEADERBOARD');
     $start_date = intval(get_option('leaderboard_start_date'));
     $weeks = $GLOBALS['SITE_DB']->query('SELECT DISTINCT date_and_time FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'leader_board WHERE date_and_time>=' . strval($start_date) . ' ORDER BY date_and_time DESC');
     if (count($weeks) == 0) {
         warn_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $first_week = $weeks[count($weeks) - 1]['date_and_time'];
     $weeks = collapse_1d_complexity('date_and_time', $weeks);
     $out = new ocp_tempcode();
     foreach ($weeks as $week) {
         $rows = collapse_2d_complexity('lb_member', 'lb_points', $GLOBALS['SITE_DB']->query_select('leader_board', array('lb_member', 'lb_points'), array('date_and_time' => $week)));
         $week_tpl = new ocp_tempcode();
         foreach ($rows as $member => $points) {
             $points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $member), get_module_zone('points'));
             $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, false, true);
             $name = $GLOBALS['FORUM_DRIVER']->get_username($member);
             if (is_null($name)) {
                 $name = do_lang('UNKNOWN');
             }
             $week_tpl->attach(do_template('POINTS_LEADERBOARD_ROW', array('_GUID' => '6d323b4b5abea0e82a14cb4745c4af4f', 'POINTS_URL' => $points_url, 'PROFILE_URL' => $profile_url, 'POINTS' => integer_format($points), 'NAME' => $name, 'ID' => strval($member))));
         }
         $nice_week = intval(($week - $first_week) / (7 * 24 * 60 * 60) + 1);
         $out->attach(do_template('POINTS_LEADERBOARD_WEEK', array('_GUID' => '3a0f71bf20f9098e5711e85cf25f6549', 'WEEK' => integer_format($nice_week), 'ROWS' => $week_tpl)));
     }
     return do_template('POINTS_LEADERBOARD_SCREEN', array('_GUID' => 'bab5f7b661435b83800532d3eebd0d54', 'TITLE' => $title, 'WEEKS' => $out));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:leader_board.php

示例5: ticket_type_interface

 /**
  * The UI to choose a ticket type to edit, or to add a ticket.
  *
  * @return tempcode		The UI
  */
 function ticket_type_interface()
 {
     $title = get_page_title('MANAGE_TICKET_TYPES');
     require_lang('permissions');
     $list = new ocp_tempcode();
     require_code('form_templates');
     $ticket_types = collapse_1d_complexity('ticket_type', $GLOBALS['SITE_DB']->query_select('ticket_types', array('*'), NULL, 'ORDER BY ticket_type'));
     foreach ($ticket_types as $ticket_type) {
         $list->attach(form_input_list_entry(strval($ticket_type), false, get_translated_text($ticket_type)));
     }
     if (!$list->is_empty()) {
         $edit_url = build_url(array('page' => '_SELF', 'type' => 'edit'), '_SELF', NULL, false, true);
         $submit_name = do_lang_tempcode('CHOOSE');
         $fields = form_input_list(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TICKET_TYPE'), 'ticket_type', $list);
         $tpl = do_template('FORM', array('TABINDEX' => strval(get_form_field_tabindex()), 'GET' => true, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $edit_url, 'SUBMIT_NAME' => $submit_name));
     } else {
         $tpl = new ocp_tempcode();
     }
     // Do a form so people can add
     $post_url = build_url(array('page' => '_SELF', 'type' => 'add'), '_SELF');
     $submit_name = do_lang_tempcode('ADD_TICKET_TYPE');
     $fields = form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TICKET_TYPE'), 'ticket_type_2', '', false);
     $fields->attach(form_input_tick(do_lang_tempcode('TICKET_GUEST_EMAILS_MANDATORY'), do_lang_tempcode('DESCRIPTION_TICKET_GUEST_EMAILS_MANDATORY'), 'guest_emails_mandatory', false));
     $fields->attach(form_input_tick(do_lang_tempcode('TICKET_SEARCH_FAQ'), do_lang_tempcode('DESCRIPTION_TICKET_SEARCH_FAQ'), 'search_faq', false));
     // Permissions
     $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
     $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
     foreach ($groups as $id => $group_name) {
         if (in_array($id, $admin_groups)) {
             continue;
         }
         $fields->attach(form_input_tick(do_lang_tempcode('ACCESS_FOR', escape_html($group_name)), do_lang_tempcode('DESCRIPTION_ACCESS_FOR', escape_html($group_name)), 'access_' . strval($id), true));
     }
     $add_form = do_template('FORM', array('_GUID' => '382f6fab6c563d81303ecb26495e76ec', 'TABINDEX' => strval(get_form_field_tabindex()), 'SECONDARY_FORM' => true, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_TICKET_TYPES'))));
     return do_template('SUPPORT_TICKET_TYPE_SCREEN', array('_GUID' => '28645dc4a86086fa865ec7e166b84bb6', 'TITLE' => $title, 'TPL' => $tpl, 'ADD_FORM' => $add_form));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:admin_tickets.php

示例6: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     $this_birthday_day = date('d/m/Y');
     if (get_long_value('last_birthday_day') !== $this_birthday_day) {
         set_long_value('last_birthday_day', $this_birthday_day);
         require_lang('ocf');
         require_code('ocf_general');
         $_birthdays = ocf_find_birthdays();
         $birthdays = new ocp_tempcode();
         foreach ($_birthdays as $_birthday) {
             $member_url = $GLOBALS['OCF_DRIVER']->member_profile_url($_birthday['id'], false, true);
             $username = $_birthday['username'];
             $birthday_url = build_url(array('page' => 'topics', 'type' => 'birthday', 'id' => $_birthday['username']), get_module_zone('topics'));
             require_code('notifications');
             $subject = do_lang('BIRTHDAY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username);
             $mail = do_lang('BIRTHDAY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array($member_url->evaluate(), $birthday_url->evaluate()));
             if (addon_installed('chat')) {
                 $friends = $GLOBALS['SITE_DB']->query_select('chat_buddies', array('member_likes'), array('member_liked' => $_birthday['id']));
                 dispatch_notification('ocf_friend_birthday', NULL, $subject, $mail, collapse_1d_complexity('member_likes', $friends));
             }
             dispatch_notification('ocf_birthday', NULL, $subject, $mail);
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:27,代码来源:ocf_birthdays.php

示例7: _all_staff_who_have_enabled

 /**
  * Get a list of staff members who have enabled this notification (i.e. have permission to AND have chosen to or are defaulted to).
  *
  * @param  ID_TEXT		Notification code
  * @param  ?SHORT_TEXT	The category within the notification code (NULL: none)
  * @param  ?array			List of member IDs we are restricting to (NULL: no restriction). This effectively works as a intersection set operator against those who have enabled.
  * @param  integer		Start position (for pagination)
  * @param  integer		Maximum (for pagination)
  * @return array			A pair: Map of members to their notification setting, and whether there may be more
  */
 function _all_staff_who_have_enabled($only_if_enabled_on__notification_code, $only_if_enabled_on__category, $to_member_ids, $start, $max)
 {
     $initial_setting = $this->get_initial_setting($only_if_enabled_on__notification_code, $only_if_enabled_on__category);
     $db = substr($only_if_enabled_on__notification_code, 0, 4) == 'ocf_' ? $GLOBALS['FORUM_DB'] : $GLOBALS['SITE_DB'];
     $admin_groups = array_merge($GLOBALS['FORUM_DRIVER']->get_super_admin_groups(), collapse_1d_complexity('group_id', $db->query_select('gsp', array('group_id'), array('specific_permission' => 'may_enable_staff_notifications'))));
     $rows = $GLOBALS['FORUM_DRIVER']->member_group_query($admin_groups, $max, $start);
     $possibly_has_more = count($rows) >= $max;
     if (!is_null($to_member_ids)) {
         $new_rows = array();
         foreach ($rows as $row) {
             if (in_array($GLOBALS['FORUM_DRIVER']->pname_id($row), $to_member_ids)) {
                 $new_rows[] = $row;
             }
         }
         $rows = $new_rows;
     }
     $new_rows = array();
     foreach ($rows as $row) {
         $test = notifications_setting($only_if_enabled_on__notification_code, $only_if_enabled_on__category, $GLOBALS['FORUM_DRIVER']->pname_id($row));
         if ($test != A_NA) {
             $new_rows[$GLOBALS['FORUM_DRIVER']->pname_id($row)] = $test;
         }
     }
     return array($new_rows, $possibly_has_more);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:notifications.php

示例8: substr

    $FILE_BASE = substr($FILE_BASE, 0, $a > $b ? $a : $b);
} else {
    $RELATIVE_PATH = '';
}
@chdir($FILE_BASE);
global $NON_PAGE_SCRIPT;
$NON_PAGE_SCRIPT = 1;
global $FORCE_INVISIBLE_GUEST;
$FORCE_INVISIBLE_GUEST = 0;
if (!is_file($FILE_BASE . '/sources/global.php')) {
    exit('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . chr(10) . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"><head><title>Critical startup error</title></head><body><h1>ocPortal startup error</h1><p>The second most basic ocPortal startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the ocPortal system, so please check all files are uploaded correctly.</p><p>Once all ocPortal files are in place, ocPortal must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.</p><p>ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://ocportal.com">ocPortal website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.</p><hr /><p style="font-size: 0.8em">ocPortal is a website engine created by ocProducts.</p></body></html>');
}
require $FILE_BASE . '/sources/global.php';
if (uninstall_check_master_password(post_param('given_password', ''))) {
    $uninstalled = do_template('BASIC_HTML_WRAP', array('_GUID' => '5614c65c4f388fd47aabb24b9624ce65', 'TITLE' => do_lang_tempcode('UNINSTALL'), 'CONTENT' => do_lang_tempcode('UNINSTALLED')));
    $tables = collapse_1d_complexity('m_table', $GLOBALS['SITE_DB']->query_select('db_meta', array('DISTINCT m_table')));
    foreach ($tables as $table) {
        $GLOBALS['SITE_DB']->drop_if_exists($table);
    }
    $GLOBALS['SITE_DB']->drop_if_exists('db_meta_indices');
    $GLOBALS['SITE_DB']->drop_if_exists('db_meta');
    $uninstalled->evaluate_echo();
} else {
    $echo = do_template('BASIC_HTML_WRAP', array('_GUID' => '009e7517e7df76167b4d13ca77308704', 'NOFOLLOW' => true, 'TITLE' => do_lang_tempcode('UNINSTALL'), 'CONTENT' => do_template('UNINSTALL_SCREEN')));
    $echo->evaluate_echo();
}
/**
 * Check the given master password is valid.
 *
 * @param  SHORT_TEXT	Given master password
 * @return boolean		Whether it is valid
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:uninstall.php

示例9: import_ocf_polls_and_votes

 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_polls_and_votes($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'poll_questions');
     foreach ($rows as $row) {
         if (import_check_if_imported('poll', strval($row['poll_id']))) {
             continue;
         }
         $topic_id = import_id_remap_get('topic', strval($row['topic_id']), true);
         if (is_null($topic_id)) {
             import_id_remap_put('poll', strval($row['poll_id']), -1);
             continue;
         }
         $is_open = $row['poll_ends'] < time();
         $rows2 = $db->query('SELECT * FROM ' . $table_prefix . 'poll_options WHERE poll_id=' . strval((int) $row['poll_id']) . ' ORDER BY poll_option_id');
         $answers = array();
         $answer_map = array();
         foreach ($rows2 as $answer) {
             $answer_map[$answer['poll_option_id']] = count($answers);
             $answers[] = $answer['option_text'];
         }
         $maximum = $row['multiple_choice'] == 1 ? count($answers) : 1;
         $rows2 = $db->query('SELECT * FROM ' . $table_prefix . 'vote_votes WHERE poll_id=' . $row['poll_id']);
         foreach ($rows2 as $row2) {
             $row2['user_id'] = import_id_remap_get('member', strval($row2['user_id']), true);
         }
         $id_new = ocf_make_poll($topic_id, $row['question'], 0, $is_open ? 1 : 0, 1, $maximum, 0, $answers, false);
         $answers = collapse_1d_complexity('id', $GLOBALS['FORUM_DB']->query_select('f_poll_answers', array('id'), array('pa_poll_id' => $id_new)));
         // Effectively, a remapping from IPB vote number to ocP vote number
         foreach ($rows2 as $row2) {
             $member_id = $row2['user_id'];
             if (!is_null($member_id) && $member_id != 0) {
                 if ($row2['poll_option_id'] == 0) {
                     $answer = -1;
                 } else {
                     $answer = $answers[$answer_map[$row2['poll_option_id']]];
                 }
                 $GLOBALS['FORUM_DB']->query_insert('f_poll_votes', array('pv_poll_id' => $id_new, 'pv_member_id' => $member_id, 'pv_answer_id' => $answer));
             }
         }
         import_id_remap_put('poll', strval($row['poll_id']), $id_new);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:49,代码来源:wowbb.php

示例10: _get_moderator_groups

 /**
  * Get the ids of the moderator usergroups.
  * It should not be assumed that a member only has one usergroup - this depends upon the forum the driver works for. It also does not take the staff site filter into account.
  *
  * @return array			The moderator usergroup ids
  */
 function _get_moderator_groups()
 {
     return collapse_1d_complexity('id', $this->connection->query_select('f_groups', array('id'), array('g_is_super_moderator' => 1)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:ocf.php

示例11: get_tester_list

 /**
  * Get a list to choose a tester.
  *
  * @param  ?MEMBER		The member to select by default (NULL: Select N/A)
  * @return tempcode		The list
  */
 function get_tester_list($it)
 {
     $tester_groups = collapse_1d_complexity('group_id', $GLOBALS['SITE_DB']->query_select('gsp', array('group_id'), array('specific_permission' => 'perform_tests')));
     $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
     $moderator_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups();
     $groups = array_unique(array_merge($tester_groups, $admin_groups, $moderator_groups));
     $members = $GLOBALS['FORUM_DRIVER']->member_group_query($groups, 2000);
     $list = form_input_list_entry('-1', is_null($it), do_lang_tempcode('NA_EM'));
     foreach ($members as $member => $details) {
         $username = $GLOBALS['FORUM_DRIVER']->pname_name($details);
         $list->attach(form_input_list_entry(strval($member), $member == $it, $username));
     }
     return $list;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:20,代码来源:tester.php

示例12: ocf_send_topic_notification

/**
 * Send out a notification, as a topic just got a new post.
 *
 * @param  URLPATH		The URL to view the new post.
 * @param  AUTO_LINK		The ID of the topic that got posted in.
 * @param  ?AUTO_LINK	The forum that the topic is in (NULL: find out from the DB).
 * @param  MEMBER			The member that made the post triggering this tracking notification.
 * @param  boolean		Whether the post started a new topic.
 * @param  LONG_TEXT		The post, in Comcode format.
 * @param  SHORT_TEXT	The topic title (blank: look it up from the $topic_id). If non-blank we must use it as it is implying the database might not have the correct value yet.
 * @param  ?MEMBER		Only send the notification to this member (NULL: no such limit).
 * @param  boolean		Whether this is for a Private Topic.
 * @param  ?ID_TEXT		DO NOT send notifications to: The notification code (NULL: no restriction)
 * @param  ?SHORT_TEXT	DO NOT send notifications to: The category within the notification code (NULL: none / no restriction)
 */
function ocf_send_topic_notification($url, $topic_id, $forum_id, $sender_member_id, $is_starter, $post, $topic_title, $_limit_to = NULL, $is_pt = false, $no_notify_for__notification_code = NULL, $no_notify_for__code_category = NULL)
{
    if (is_null($forum_id) && $is_starter) {
        return;
    }
    if ($topic_title == '') {
        $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('t_pt_to', 't_pt_from', 't_cache_first_title'), array('id' => $topic_id), '', 1);
        if (!array_key_exists(0, $topic_info)) {
            return;
        }
        // Topic's gone missing somehow (e.g. race condition)
        $topic_title = $topic_info[0]['t_cache_first_title'];
    }
    $sender_username = $GLOBALS['FORUM_DRIVER']->get_username($sender_member_id);
    $subject = do_lang($is_starter ? 'TOPIC_NOTIFICATION_MAIL_SUBJECT' : 'POST_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $topic_title);
    $mail = do_lang($is_starter ? 'TOPIC_NOTIFICATION_MAIL' : 'POST_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($url), array(comcode_escape($sender_username), $post, $topic_title));
    $limit_to = is_null($_limit_to) ? array() : array($_limit_to);
    if ($is_pt) {
        $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('t_pt_to', 't_pt_from', 't_cache_first_title'), array('id' => $topic_id), '', 1);
        if (!array_key_exists(0, $topic_info)) {
            return;
        }
        // Topic's gone missing somehow (e.g. race condition)
        $limit_to[] = $topic_info[0]['t_pt_to'];
        $limit_to[] = $topic_info[0]['t_pt_from'];
        $limit_to = array_merge($limit_to, collapse_1d_complexity('s_member_id', $GLOBALS['FORUM_DB']->query_select('f_special_pt_access', array('s_member_id'), array('s_topic_id' => $topic_id))));
    }
    require_code('notifications');
    dispatch_notification('ocf_topic', strval($topic_id), $subject, $mail, count($limit_to) == 0 ? NULL : $limit_to, $sender_member_id, 3, false, false, $no_notify_for__notification_code, $no_notify_for__code_category);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:ocf_posts_action2.php

示例13: member_blocked

/**
 * Find if a member is blocked by a member.
 *
 * @param  MEMBER				The member being checked
 * @param  ?MEMBER			The member who may be blocking (NULL: current member)
 * @return boolean			Whether the member is blocked
 */
function member_blocked($member_id, $member_blocker = NULL)
{
    if (!addon_installed('chat')) {
        return false;
    }
    if (is_null($member_blocker)) {
        $member_blocker = get_member();
    }
    if ($member_blocker == $member_id) {
        return false;
    }
    if (is_guest($member_id)) {
        return false;
    }
    if (is_guest($member_blocker)) {
        return false;
    }
    if ($member_id == get_member()) {
        global $MEMBERS_BLOCKING_US;
        if (is_null($MEMBERS_BLOCKING_US)) {
            $rows = $GLOBALS['SITE_DB']->query_select('chat_blocking', array('member_blocker'), array('member_blocked' => get_member()), '', NULL, NULL, true);
            if (is_null($rows)) {
                $MEMBERS_BLOCKING_US = array();
                return false;
            }
            $MEMBERS_BLOCKING_US = collapse_1d_complexity('member_blocker', $rows);
        }
        return in_array($member_blocker, $MEMBERS_BLOCKING_US);
    }
    global $MEMBERS_BLOCKED;
    if (is_null($MEMBERS_BLOCKED)) {
        $rows = $GLOBALS['SITE_DB']->query_select('chat_blocking', array('member_blocked'), array('member_blocker' => get_member()), '', NULL, NULL, true);
        if (is_null($rows)) {
            $MEMBERS_BLOCKED = array();
            return false;
        }
        $MEMBERS_BLOCKED = collapse_1d_complexity('member_blocked', $rows);
    }
    return in_array($member_id, $MEMBERS_BLOCKED);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:47,代码来源:users.php

示例14: import_news_and_categories

 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_news_and_categories($db, $table_prefix, $old_base_dir)
 {
     require_code('news');
     $fields = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('id'), array('c_name' => 'news')));
     $categories = $db->query("SELECT id,title,description,image FROM " . $table_prefix . "sections WHERE title='News'");
     foreach ($categories as $category) {
         $title = $category['title'];
         $cat_id = $GLOBALS['SITE_DB']->query_select('news_categories', array('id'), array('nc_title' => $title), '', 1);
         if (count($cat_id) == 0) {
             $cat_title = $category['title'];
             $category_id = $GLOBALS['SITE_DB']->query("SELECT N.id FROM " . $GLOBALS['SITE_DB']->get_table_prefix() . "translate  AS T INNER JOIN  " . $GLOBALS['SITE_DB']->get_table_prefix() . "news_categories AS N ON T.id=N.nc_title AND " . db_string_equal_to('T.text_original', $cat_title));
             if (count($category_id) == 0) {
                 $desc = html_to_comcode($category['description']);
                 $id = add_news_category($category['title'], $category['image'], $desc, NULL, NULL);
             } else {
                 $id = $category_id[0]['id'];
             }
         } else {
             $id = $cat_id[0]['id'];
         }
         $rows = $db->query('SELECT * FROM ' . $table_prefix . 'content WHERE sectionid=' . strval($category['id']));
         foreach ($rows as $row) {
             $val = $row['title'];
             $news_id = $GLOBALS['SITE_DB']->query("SELECT N.id FROM " . $GLOBALS['SITE_DB']->get_table_prefix() . "translate  AS T INNER JOIN  " . $GLOBALS['SITE_DB']->get_table_prefix() . "news AS N ON T.id=N.title AND " . db_string_equal_to('T.text_original', $val) . " AND news_category=" . strval($id) . " AND news_category<>''");
             if (count($news_id) == 0) {
                 $title = $row['title'];
                 $news = html_to_comcode($row['introtext']);
                 $author = $db->query_value_null_ok('users', 'name', array('id' => $row['created_by']));
                 if (is_null($author)) {
                     $author = do_lang('UNKNOWN');
                 }
                 $access = $row['access'];
                 if ($access == 0) {
                     $validated = 1;
                 } else {
                     $validated = 0;
                 }
                 $allow_rating = 1;
                 $allow_comments = 1;
                 $allow_trackbacks = 1;
                 $notes = '';
                 $news_article = '';
                 $main_news_category = $id;
                 $news_category = NULL;
                 $datetimearr = explode(' ', $row['created']);
                 $datearr = explode('-', $datetimearr[0]);
                 $timearr = explode(':', $datetimearr[1]);
                 $date = intval($datearr[2]);
                 $month = intval($datearr[1]);
                 $year = intval($datearr[0]);
                 $hour = intval($timearr[0]);
                 $min = intval($timearr[1]);
                 $sec = intval($timearr[2]);
                 $time = mktime($hour, $min, $sec, $month, $date, $year);
                 $submitter = import_id_remap_get('member', strval($row['created_by']));
                 $views = $row['hits'];
                 $datetimearr = explode(' ', $row['modified']);
                 $datearr = explode('-', $datetimearr[0]);
                 $timearr = explode(':', $datetimearr[1]);
                 $date = intval($datearr[2]);
                 $month = intval($datearr[1]);
                 $year = intval($datearr[0]);
                 $hour = intval($timearr[0]);
                 $min = intval($timearr[1]);
                 $sec = intval($timearr[2]);
                 $edit_date = mktime($hour, $min, $sec, $month, $date, $year);
                 $nid = NULL;
                 $image = 'newscats/' . preg_replace('#\\..*$#', '', $row['images']);
                 @mkdir(get_custom_file_base() . '/themes/default/images_custom/newscats', 0777);
                 fix_permissions(get_custom_file_base() . '/themes/default/images_custom/newscats', 0777);
                 sync_file(get_custom_file_base() . '/themes/default/images_custom/newscats');
                 $newimagepath = get_custom_file_base() . '/themes/default/images_custom/newscats/' . rawurldecode($row['images']);
                 $oldimagepath = $old_base_dir . "/images/stories/" . rawurldecode($row['images']);
                 @copy($oldimagepath, $newimagepath);
                 fix_permissions($newimagepath);
                 sync_file($newimagepath);
                 add_news($title, $news, $author, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, $news_article, $main_news_category, $news_category, $time, $submitter, $views, $edit_date, $nid, $image);
             }
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:88,代码来源:joomla.php

示例15: set_specific_permissions

 /**
  * The actualiser to set privileges.
  *
  * @return tempcode		The UI
  */
 function set_specific_permissions()
 {
     require_all_lang();
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/privileges';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_permissions';
     if (count($_POST) == 0 && strtolower(ocp_srv('REQUEST_METHOD')) != 'post') {
         warn_exit(do_lang_tempcode('PERMISSION_TRAGEDY_PREVENTED'));
     }
     $title = get_page_title('SPECIFIC_PERMISSIONS');
     $p_section = get_param('id');
     $_sections = $this->_get_ordered_sections();
     $array_keys = array_keys($_sections);
     $next_section = $array_keys[0];
     $counter = 0;
     foreach ($_sections as $s) {
         if (is_null($s)) {
             continue;
         }
         if ($counter > array_search($p_section, $array_keys)) {
             $next_section = $s['p_section'];
             break;
         }
         $counter++;
     }
     $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
     $permissions = collapse_1d_complexity('the_name', $GLOBALS['SITE_DB']->query_select('sp_list', array('the_name'), array('p_section' => $p_section)));
     $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
     foreach ($permissions as $permission) {
         foreach (array_keys($groups) as $id) {
             if (in_array($id, $admin_groups)) {
                 continue;
             }
             $val = post_param_integer($permission . '__' . strval($id), 0);
             // Delete to cleanup
             $GLOBALS['SITE_DB']->query_delete('gsp', array('specific_permission' => $permission, 'group_id' => $id, 'the_page' => '', 'module_the_name' => '', 'category_name' => ''), '', 1);
             if ($val == 1) {
                 $GLOBALS['SITE_DB']->query_insert('gsp', array('specific_permission' => $permission, 'group_id' => $id, 'the_page' => '', 'module_the_name' => '', 'category_name' => '', 'the_value' => 1));
             }
         }
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:specific', do_lang_tempcode('CHOOSE'))));
     decache('main_sitemap');
     $GLOBALS['SITE_DB']->query_delete('cache');
     if (function_exists('persistant_cache_empty')) {
         persistant_cache_empty();
     }
     // Show it worked / Refresh
     $url = build_url(array('page' => '_SELF', 'type' => 'specific', 'id' => $next_section), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS_NOW_NEXT_SCREEN'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:55,代码来源:admin_permissions.php


注:本文中的collapse_1d_complexity函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。