本文整理汇总了PHP中call_integration_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP call_integration_hook函数的具体用法?PHP call_integration_hook怎么用?PHP call_integration_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_integration_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activateAccount
function activateAccount($memID)
{
global $sourcedir, $context, $user_profile, $modSettings;
isAllowedTo('moderate_forum');
if (isset($_REQUEST['save']) && isset($user_profile[$memID]['is_activated']) && $user_profile[$memID]['is_activated'] != 1) {
// If we are approving the deletion of an account, we do something special ;)
if ($user_profile[$memID]['is_activated'] == 4) {
require_once $sourcedir . '/Subs-Members.php';
deleteMembers($context['id_member']);
redirectexit();
}
// Let the integrations know of the activation.
call_integration_hook('integrate_activate', array($user_profile[$memID]['member_name']));
// Actually update this member now, as it guarantees the unapproved count can't get corrupted.
updateMemberData($context['id_member'], array('is_activated' => $user_profile[$memID]['is_activated'] >= 10 ? 11 : 1, 'validation_code' => ''));
// If we are doing approval, update the stats for the member just in case.
if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 13, 14))) {
updateSettings(array('unapprovedMembers' => $modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0));
}
// Make sure we update the stats too.
updateStats('member', false);
}
// Leave it be...
redirectexit('action=profile;u=' . $memID . ';area=summary');
}
示例2: action_suggest
/**
* This keeps track of all registered handling functions for auto suggest
* functionality and passes execution to them.
* Accessed by action=suggest.
* @uses Xml template
*/
public function action_suggest()
{
global $context;
// These are all registered types.
$searchTypes = array('member' => array('file' => SUBSDIR . '/Suggest.class.php', 'class' => 'Suggest', 'function' => 'member'));
call_integration_hook('integrate_autosuggest', array(&$searchTypes));
checkSession('get');
loadTemplate('Xml');
// Any parameters?
$context['search_param'] = isset($_REQUEST['search_param']) ? unserialize(base64_decode($_REQUEST['search_param'])) : array();
if (isset($_REQUEST['suggest_type'], $_REQUEST['search']) && isset($searchTypes[$_REQUEST['suggest_type']])) {
// Shortcut
$currentSearch = $searchTypes[$_REQUEST['suggest_type']];
// Do we have a file to include?
if (!empty($currentSearch['file']) && file_exists($currentSearch['file'])) {
require_once $currentSearch['file'];
}
// If it is a class, let's instantiate it
if (!empty($currentSearch['class']) && class_exists($currentSearch['class'])) {
$suggest = new $currentSearch['class']();
// Okay, let's at least assume the method exists... *rolleyes*
$context['xml_data'] = $suggest->{$currentSearch}['function']();
} elseif (function_exists('action_suggest_' . $currentSearch['function'])) {
$function = 'action_suggest_' . $searchTypes[$_REQUEST['suggest_type']];
$context['xml_data'] = $function();
}
if (!empty($context['xml_data'])) {
$context['sub_template'] = 'generic_xml';
}
}
}
示例3: BoardIndex
/**
* This function shows the board index.
* It uses the BoardIndex template, and main sub template.
* It may use the boardindex subtemplate for wireless support.
* It updates the most online statistics.
* It is accessed by ?action=boardindex.
*/
function BoardIndex()
{
global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl;
// For wireless, we use the Wireless template...
if (WIRELESS) {
$context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex';
} else {
loadTemplate('BoardIndex');
}
// Set a canonical URL for this page.
$context['canonical_url'] = $scripturl;
// Do not let search engines index anything if there is a random thing in $_GET.
if (!empty($_GET)) {
$context['robot_no_index'] = true;
}
// Retrieve the categories and boards.
require_once $sourcedir . '/Subs-BoardIndex.php';
$boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts']));
$context['categories'] = getBoardIndex($boardIndexOptions);
// Get the user online list.
require_once $sourcedir . '/Subs-MembersOnline.php';
$membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true);
$context += getMembersOnlineStats($membersOnlineOptions);
$context['show_buddies'] = !empty($user_info['buddies']);
// Are we showing all membergroups on the board index?
if (!empty($settings['show_group_key'])) {
$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());
}
// Track most online statistics? (Subs-MembersOnline.php)
if (!empty($modSettings['trackStats'])) {
trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);
}
// Retrieve the latest posts if the theme settings require it.
if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) {
$latestPostOptions = array('number_posts' => $settings['number_recent_posts']);
$context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
}
$settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0;
$settings['show_member_bar'] &= allowedTo('view_mlist');
$context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
$context['show_member_list'] = allowedTo('view_mlist');
$context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']);
// Load the calendar?
if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) {
// Retrieve the calendar data (events, birthdays, holidays).
$eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']);
$context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
// Whether one or multiple days are shown on the board index.
$context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1;
// This is used to show the "how-do-I-edit" help.
$context['calendar_can_edit'] = allowedTo('calendar_edit_any');
} else {
$context['show_calendar'] = false;
}
$context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
// Mark read button
$context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']));
// Allow mods to add additional buttons here
call_integration_hook('integrate_mark_read_button');
}
示例4: ModifyKarmaSettings
/**
* Config array for chaning the karma settings
* Accessed from ?action=admin;area=featuresettings;sa=karma;
*
* @param $return_config
*/
function ModifyKarmaSettings($return_config = false)
{
global $txt, $scripturl, $context, $modSettings;
loadLanguage('Karma+ManageKarma');
if (empty($modSettings['karmaMode'])) {
$config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options'])));
} else {
$config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options'])), '', array('int', 'karmaMinPosts', 6, 'postinput' => strtolower($txt['posts'])), array('float', 'karmaWaitTime', 6, 'postinput' => $txt['hours']), array('check', 'karmaTimeRestrictAdmins'));
}
call_integration_hook('integrate_karma_settings', array(&$config_vars));
if ($return_config) {
return $config_vars;
}
// Saving?
if (isset($_GET['save'])) {
checkSession();
call_integration_hook('integrate_save_karma_settings');
saveDBSettings($config_vars);
$_SESSION['adm-save'] = true;
redirectexit('action=admin;area=featuresettings;sa=karma');
}
$context['post_url'] = $scripturl . '?action=admin;area=featuresettings;save;sa=karma';
$context['settings_title'] = $txt['karma'];
loadLanguage('ManageKarma');
prepareDBSettingContext($config_vars);
}
示例5: loadVerificationControls
/**
* Simple function that loads and returns all the verification controls known to Elk
*/
function loadVerificationControls()
{
$known_verifications = array('captcha', 'questions', 'emptyfield');
// Let integration add some more controls
call_integration_hook('integrate_control_verification', array(&$known_verifications));
return $known_verifications;
}
示例6: testCallHooks
/**
* We want to see if they are called
*/
function testCallHooks()
{
$call = call_integration_hook($this->_hook_name);
foreach ($this->_tests as $test) {
$this->assertTrue($this->_is_hook_called($call, $test['call'] . (!empty($test['file']) ? '|' . $test['file'] : '')));
}
}
示例7: loadSession
/**
* Attempt to start the session, unless it already has been.
*/
function loadSession()
{
global $HTTP_SESSION_VARS, $modSettings, $boardurl, $sc;
// Attempt to change a few PHP settings.
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&');
if (!empty($modSettings['globalCookies'])) {
$parsed_url = parse_url($boardurl);
if (preg_match('~^\\d{1,3}(\\.\\d{1,3}){3}$~', $parsed_url['host']) == 0 && preg_match('~(?:[^\\.]+\\.)?([^\\.]{2,}\\..+)\\z~i', $parsed_url['host'], $parts) == 1) {
@ini_set('session.cookie_domain', '.' . $parts[1]);
}
}
// @todo Set the session cookie path?
// If it's already been started... probably best to skip this.
if (ini_get('session.auto_start') == 1 && !empty($modSettings['databaseSession_enable']) || session_id() == '') {
// Attempt to end the already-started session.
if (ini_get('session.auto_start') == 1) {
session_write_close();
}
// This is here to stop people from using bad junky PHPSESSIDs.
if (isset($_REQUEST[session_name()]) && preg_match('~^[A-Za-z0-9,-]{16,64}$~', $_REQUEST[session_name()]) == 0 && !isset($_COOKIE[session_name()])) {
$session_id = md5(md5('smf_sess_' . time()) . mt_rand());
$_REQUEST[session_name()] = $session_id;
$_GET[session_name()] = $session_id;
$_POST[session_name()] = $session_id;
}
// Use database sessions? (they don't work in 4.1.x!)
if (!empty($modSettings['databaseSession_enable'])) {
session_set_save_handler('sessionOpen', 'sessionClose', 'sessionRead', 'sessionWrite', 'sessionDestroy', 'sessionGC');
@ini_set('session.gc_probability', '1');
} elseif (ini_get('session.gc_maxlifetime') <= 1440 && !empty($modSettings['databaseSession_lifetime'])) {
@ini_set('session.gc_maxlifetime', max($modSettings['databaseSession_lifetime'], 60));
}
// Use cache setting sessions?
if (empty($modSettings['databaseSession_enable']) && !empty($modSettings['cache_enable']) && php_sapi_name() != 'cli') {
call_integration_hook('integrate_session_handlers');
// @todo move these to a plugin.
if (function_exists('mmcache_set_session_handlers')) {
mmcache_set_session_handlers();
} elseif (function_exists('eaccelerator_set_session_handlers')) {
eaccelerator_set_session_handlers();
}
}
session_start();
// Change it so the cache settings are a little looser than default.
if (!empty($modSettings['databaseSession_loose'])) {
header('Cache-Control: private');
}
}
// Set the randomly generated code.
if (!isset($_SESSION['session_var'])) {
$_SESSION['session_value'] = md5(session_id() . mt_rand());
$_SESSION['session_var'] = substr(preg_replace('~^\\d+~', '', sha1(mt_rand() . session_id() . mt_rand())), 0, rand(7, 12));
}
$sc = $_SESSION['session_value'];
}
示例8: shd_load_role_templates
/**
* Provides a list of the known role/permission templates for the system.
*
* @since 2.0
*/
function shd_load_role_templates()
{
global $context, $modSettings;
// UNDER PAIN OF DEATH
// Do not add anything other than ROLEPERM_ALLOW rules here.
$context['shd_permissions']['roles'] = array(ROLE_USER => array('description' => 'shd_permrole_user', 'icon' => 'user.png', 'permissions' => array('access_helpdesk' => ROLEPERM_ALLOW, 'shd_view_ticket_own' => ROLEPERM_ALLOW, 'shd_view_ticket_private_own' => ROLEPERM_ALLOW, 'shd_view_closed_own' => ROLEPERM_ALLOW, 'shd_new_ticket' => ROLEPERM_ALLOW, 'shd_edit_ticket_own' => ROLEPERM_ALLOW, 'shd_reply_ticket_own' => ROLEPERM_ALLOW, 'shd_edit_reply_own' => ROLEPERM_ALLOW, 'shd_view_attachment' => ROLEPERM_ALLOW, 'shd_post_attachment' => ROLEPERM_ALLOW, 'shd_resolve_ticket_own' => ROLEPERM_ALLOW, 'shd_unresolve_ticket_own' => ROLEPERM_ALLOW, 'shd_view_ticket_logs_own' => ROLEPERM_ALLOW, 'shd_view_profile_own' => ROLEPERM_ALLOW, 'shd_view_profile_log_own' => ROLEPERM_ALLOW, 'shd_view_preferences_own' => ROLEPERM_ALLOW, 'shd_view_relationships' => ROLEPERM_ALLOW, 'shd_delete_ticket_own' => ROLEPERM_ALLOW, 'shd_delete_reply_own' => ROLEPERM_ALLOW)), ROLE_STAFF => array('description' => 'shd_permrole_staff', 'icon' => 'staff.png', 'permissions' => array('access_helpdesk' => ROLEPERM_ALLOW, 'shd_staff' => ROLEPERM_ALLOW, 'shd_view_ticket_any' => ROLEPERM_ALLOW, 'shd_view_ticket_private_any' => ROLEPERM_ALLOW, 'shd_view_closed_any' => ROLEPERM_ALLOW, 'shd_view_ip_own' => ROLEPERM_ALLOW, 'shd_search' => ROLEPERM_ALLOW, 'shd_new_ticket' => ROLEPERM_ALLOW, 'shd_edit_ticket_any' => ROLEPERM_ALLOW, 'shd_reply_ticket_any' => ROLEPERM_ALLOW, 'shd_edit_reply_any' => ROLEPERM_ALLOW, 'shd_post_proxy' => ROLEPERM_ALLOW, 'shd_monitor_ticket_any' => ROLEPERM_ALLOW, 'shd_singleton_email' => ROLEPERM_ALLOW, 'shd_ignore_ticket_own' => ROLEPERM_ALLOW, 'shd_silent_update' => ROLEPERM_ALLOW, 'shd_view_attachment' => ROLEPERM_ALLOW, 'shd_post_attachment' => ROLEPERM_ALLOW, 'shd_resolve_ticket_any' => ROLEPERM_ALLOW, 'shd_unresolve_ticket_any' => ROLEPERM_ALLOW, 'shd_view_ticket_logs_any' => ROLEPERM_ALLOW, 'shd_alter_urgency_any' => ROLEPERM_ALLOW, 'shd_alter_privacy_any' => ROLEPERM_ALLOW, 'shd_assign_ticket_own' => ROLEPERM_ALLOW, 'shd_view_profile_any' => ROLEPERM_ALLOW, 'shd_view_profile_log_any' => ROLEPERM_ALLOW, 'shd_view_preferences_own' => ROLEPERM_ALLOW, 'shd_view_relationships' => ROLEPERM_ALLOW, 'shd_create_relationships' => ROLEPERM_ALLOW, 'shd_delete_relationships' => ROLEPERM_ALLOW, 'shd_access_recyclebin' => ROLEPERM_ALLOW, 'shd_delete_ticket_any' => ROLEPERM_ALLOW, 'shd_delete_reply_any' => ROLEPERM_ALLOW, 'shd_restore_ticket_any' => ROLEPERM_ALLOW, 'shd_restore_reply_any' => ROLEPERM_ALLOW, 'shd_ticket_to_topic' => ROLEPERM_ALLOW, 'shd_topic_to_ticket' => ROLEPERM_ALLOW, 'shd_move_dept_own' => ROLEPERM_ALLOW)), ROLE_ADMIN => array('description' => 'shd_permrole_admin', 'icon' => 'admin.png', 'permissions' => array('access_helpdesk' => ROLEPERM_ALLOW, 'shd_staff' => ROLEPERM_ALLOW, 'admin_helpdesk' => ROLEPERM_ALLOW, 'shd_view_ticket_any' => ROLEPERM_ALLOW, 'shd_view_ticket_private_any' => ROLEPERM_ALLOW, 'shd_view_closed_any' => ROLEPERM_ALLOW, 'shd_view_ip_any' => ROLEPERM_ALLOW, 'shd_search' => ROLEPERM_ALLOW, 'shd_new_ticket' => ROLEPERM_ALLOW, 'shd_edit_ticket_any' => ROLEPERM_ALLOW, 'shd_reply_ticket_any' => ROLEPERM_ALLOW, 'shd_edit_reply_any' => ROLEPERM_ALLOW, 'shd_post_proxy' => ROLEPERM_ALLOW, 'shd_override_cf' => ROLEPERM_ALLOW, 'shd_monitor_ticket_any' => ROLEPERM_ALLOW, 'shd_singleton_email' => ROLEPERM_ALLOW, 'shd_ignore_ticket_any' => ROLEPERM_ALLOW, 'shd_silent_update' => ROLEPERM_ALLOW, 'shd_view_attachment' => ROLEPERM_ALLOW, 'shd_post_attachment' => ROLEPERM_ALLOW, 'shd_delete_attachment' => ROLEPERM_ALLOW, 'shd_resolve_ticket_any' => ROLEPERM_ALLOW, 'shd_unresolve_ticket_any' => ROLEPERM_ALLOW, 'shd_view_ticket_logs_any' => ROLEPERM_ALLOW, 'shd_alter_urgency_any' => ROLEPERM_ALLOW, 'shd_alter_urgency_higher_any' => ROLEPERM_ALLOW, 'shd_alter_privacy_any' => ROLEPERM_ALLOW, 'shd_assign_ticket_any' => ROLEPERM_ALLOW, 'shd_view_profile_any' => ROLEPERM_ALLOW, 'shd_view_profile_log_any' => ROLEPERM_ALLOW, 'shd_view_preferences_any' => ROLEPERM_ALLOW, 'shd_view_relationships' => ROLEPERM_ALLOW, 'shd_create_relationships' => ROLEPERM_ALLOW, 'shd_delete_relationships' => ROLEPERM_ALLOW, 'shd_access_recyclebin' => ROLEPERM_ALLOW, 'shd_delete_ticket_any' => ROLEPERM_ALLOW, 'shd_delete_reply_any' => ROLEPERM_ALLOW, 'shd_restore_ticket_any' => ROLEPERM_ALLOW, 'shd_restore_reply_any' => ROLEPERM_ALLOW, 'shd_ticket_to_topic' => ROLEPERM_ALLOW, 'shd_topic_to_ticket' => ROLEPERM_ALLOW, 'shd_move_dept_any' => ROLEPERM_ALLOW)));
call_integration_hook('shd_hook_permstemplate');
}
示例9: __construct
public function __construct()
{
// Commented only for testing purposes
//require_once(SUBSDIR . '/Attachments.subs.php');
$empty_tags = $this->empty_tags;
$closable_tags = $this->closable_tags;
call_integration_hook('integrate_html_parser_load', array(&$empty_tags, &$closable_tags));
$this->empty_tags = $empty_tags;
$this->closable_tags = $closable_tags;
}
示例10: XMLhttpMain
function XMLhttpMain()
{
loadTemplate('Xml');
$sub_actions = array('jumpto' => array('function' => 'GetJumpTo'), 'messageicons' => array('function' => 'ListMessageIcons'), 'corefeatures' => array('function' => 'EnableCoreFeatures'), 'previews' => array('function' => 'RetrievePreview'));
// Easy adding of sub actions
call_integration_hook('integrate_xmlhttp', array(&$sub_actions));
if (!isset($_REQUEST['sa'], $sub_actions[$_REQUEST['sa']])) {
fatal_lang_error('no_access', false);
}
$sub_actions[$_REQUEST['sa']]['function']();
}
示例11: Ban
/**
* Ban center. The main entrance point for all ban center functions.
* It is accesssed by ?action=admin;area=ban.
* It choses a function based on the 'sa' parameter, like many others.
* The default sub-action is BanList().
* It requires the ban_members permission.
* It initializes the admin tabs.
*
* @uses ManageBans template.
*/
function Ban()
{
global $context, $txt, $scripturl;
isAllowedTo('manage_bans');
loadTemplate('ManageBans');
$subActions = array('add' => 'BanEdit', 'browse' => 'BanBrowseTriggers', 'edittrigger' => 'BanEditTrigger', 'edit' => 'BanEdit', 'list' => 'BanList', 'log' => 'BanLog');
call_integration_hook('integrate_manage_bans', array(&$subActions));
// Default the sub-action to 'view ban list'.
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
$context['page_title'] = $txt['ban_title'];
$context['sub_action'] = $_REQUEST['sa'];
// Tabs for browsing the different ban functions.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['ban_title'], 'help' => 'ban_members', 'description' => $txt['ban_description'], 'tabs' => array('list' => array('description' => $txt['ban_description'], 'href' => $scripturl . '?action=admin;area=ban;sa=list', 'is_selected' => $_REQUEST['sa'] == 'list' || $_REQUEST['sa'] == 'edit' || $_REQUEST['sa'] == 'edittrigger'), 'add' => array('description' => $txt['ban_description'], 'href' => $scripturl . '?action=admin;area=ban;sa=add', 'is_selected' => $_REQUEST['sa'] == 'add'), 'browse' => array('description' => $txt['ban_trigger_browse_description'], 'href' => $scripturl . '?action=admin;area=ban;sa=browse', 'is_selected' => $_REQUEST['sa'] == 'browse'), 'log' => array('description' => $txt['ban_log_description'], 'href' => $scripturl . '?action=admin;area=ban;sa=log', 'is_selected' => $_REQUEST['sa'] == 'log', 'is_last' => true)));
// Call the right function for this sub-acton.
$subActions[$_REQUEST['sa']]();
}
示例12: Memberlist
/**
* Shows a listing of registered members.
* - If a subaction is not specified, lists all registered members.
* - It allows searching for members with the 'search' sub action.
* - It calls MLAll or MLSearch depending on the sub action.
* - Requires the view_mlist permission.
* - Accessed via ?action=mlist.
*
* @uses Memberlist template, main sub template.
*/
function Memberlist()
{
global $scripturl, $txt, $modSettings, $context, $settings, $modSettings;
// Make sure they can view the memberlist.
isAllowedTo('view_mlist');
loadTemplate('Memberlist');
$context['listing_by'] = !empty($_GET['sa']) ? $_GET['sa'] : 'all';
// $subActions array format:
// 'subaction' => array('label', 'function', 'is_selected')
$subActions = array('all' => array($txt['view_all_members'], 'MLAll', $context['listing_by'] == 'all'), 'search' => array($txt['mlist_search'], 'MLSearch', $context['listing_by'] == 'search'));
// Set up the sort links.
$context['sort_links'] = array();
foreach ($subActions as $act => $text) {
$context['sort_links'][] = array('label' => $text[0], 'action' => $act, 'selected' => $text[2]);
}
$context['num_members'] = $modSettings['totalMembers'];
// Set up the columns...
$context['columns'] = array('is_online' => array('label' => $txt['status'], 'width' => 60, 'class' => 'first_th', 'sort' => array('down' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) ASC, real_name ASC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END ASC, real_name ASC', 'up' => allowedTo('moderate_forum') ? 'IFNULL(lo.log_time, 1) DESC, real_name DESC' : 'CASE WHEN mem.show_online THEN IFNULL(lo.log_time, 1) ELSE 1 END DESC, real_name DESC')), 'real_name' => array('label' => $txt['username'], 'sort' => array('down' => 'mem.real_name DESC', 'up' => 'mem.real_name ASC')), 'email_address' => array('label' => $txt['email'], 'width' => 25, 'sort' => array('down' => allowedTo('moderate_forum') ? 'mem.email_address DESC' : 'mem.hide_email DESC, mem.email_address DESC', 'up' => allowedTo('moderate_forum') ? 'mem.email_address ASC' : 'mem.hide_email ASC, mem.email_address ASC')), 'website_url' => array('label' => $txt['website'], 'width' => 70, 'link_with' => 'website', 'sort' => array('down' => 'LENGTH(mem.website_url) > 0 ASC, IFNULL(mem.website_url, 1=1) DESC, mem.website_url DESC', 'up' => 'LENGTH(mem.website_url) > 0 DESC, IFNULL(mem.website_url, 1=1) ASC, mem.website_url ASC')), 'icq' => array('label' => $txt['icq'], 'width' => 30, 'sort' => array('down' => 'LENGTH(mem.icq) > 0 ASC, mem.icq = 0 DESC, mem.icq DESC', 'up' => 'LENGTH(mem.icq) > 0 DESC, mem.icq = 0 ASC, mem.icq ASC')), 'aim' => array('label' => $txt['aim'], 'width' => 30, 'sort' => array('down' => 'LENGTH(mem.aim) > 0 ASC, IFNULL(mem.aim, 1=1) DESC, mem.aim DESC', 'up' => 'LENGTH(mem.aim) > 0 DESC, IFNULL(mem.aim, 1=1) ASC, mem.aim ASC')), 'yim' => array('label' => $txt['yim'], 'width' => 30, 'sort' => array('down' => 'LENGTH(mem.yim) > 0 ASC, IFNULL(mem.yim, 1=1) DESC, mem.yim DESC', 'up' => 'LENGTH(mem.yim) > 0 DESC, IFNULL(mem.yim, 1=1) ASC, mem.yim ASC')), 'msn' => array('label' => $txt['msn'], 'width' => 30, 'sort' => array('down' => 'LENGTH(mem.msn) > 0 ASC, IFNULL(mem.msn, 1=1) DESC, mem.msn DESC', 'up' => 'LENGTH(mem.msn) > 0 DESC, IFNULL(mem.msn, 1=1) ASC, mem.msn ASC')), 'id_group' => array('label' => $txt['position'], 'sort' => array('down' => 'IFNULL(mg.group_name, 1=1) DESC, mg.group_name DESC', 'up' => 'IFNULL(mg.group_name, 1=1) ASC, mg.group_name ASC')), 'registered' => array('label' => $txt['date_registered'], 'sort' => array('down' => 'mem.date_registered DESC', 'up' => 'mem.date_registered ASC')), 'posts' => array('label' => $txt['posts'], 'width' => 115, 'colspan' => 2, 'default_sort_rev' => true, 'sort' => array('down' => 'mem.posts DESC', 'up' => 'mem.posts ASC')));
$context['colspan'] = 0;
$context['disabled_fields'] = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
foreach ($context['columns'] as $key => $column) {
if (isset($context['disabled_fields'][$key]) || isset($column['link_with']) && isset($context['disabled_fields'][$column['link_with']])) {
unset($context['columns'][$key]);
continue;
}
$context['colspan'] += isset($column['colspan']) ? $column['colspan'] : 1;
}
// Aesthetic stuff.
end($context['columns']);
$context['columns'][key($context['columns'])]['class'] = 'last_th';
$context['linktree'][] = array('url' => $scripturl . '?action=mlist', 'name' => $txt['members_list']);
$context['can_send_pm'] = allowedTo('pm_send');
$context['can_send_email'] = allowedTo('send_email_to_members');
// Build the memberlist button array.
$context['memberlist_buttons'] = array('view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active' => true), 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search'));
// Allow mods to add additional buttons here
call_integration_hook('integrate_memberlist_buttons');
// Jump to the sub action.
if (isset($subActions[$context['listing_by']])) {
$subActions[$context['listing_by']][1]();
} else {
$subActions['all'][1]();
}
}
示例13: ReportsMain
/**
* Handling function for generating reports.
* Requires the admin_forum permission.
* Loads the Reports template and language files.
* Decides which type of report to generate, if this isn't passed
* through the querystring it will set the report_type sub-template to
* force the user to choose which type.
* When generating a report chooses which sub_template to use.
* Depends on the cal_enabled setting, and many of the other cal_
* settings.
* Will call the relevant report generation function.
* If generating report will call finishTables before returning.
* Accessed through ?action=admin;area=reports.
*/
function ReportsMain()
{
global $txt, $modSettings, $context, $scripturl;
// Only admins, only EVER admins!
isAllowedTo('admin_forum');
// Let's get our things running...
loadTemplate('Reports');
loadLanguage('Reports');
$context['page_title'] = $txt['generate_reports'];
// These are the types of reports which exist - and the functions to generate them.
$context['report_types'] = array('boards' => 'BoardReport', 'board_perms' => 'BoardPermissionsReport', 'member_groups' => 'MemberGroupsReport', 'group_perms' => 'GroupPermissionsReport', 'staff' => 'StaffReport');
call_integration_hook('integrate_report_types');
$is_first = 0;
foreach ($context['report_types'] as $k => $temp) {
$context['report_types'][$k] = array('id' => $k, 'title' => isset($txt['gr_type_' . $k]) ? $txt['gr_type_' . $k] : $type['id'], 'description' => isset($txt['gr_type_desc_' . $k]) ? $txt['gr_type_desc_' . $k] : null, 'function' => $temp, 'is_first' => $is_first++ == 0);
}
// If they haven't choosen a report type which is valid, send them off to the report type chooser!
if (empty($_REQUEST['rt']) || !isset($context['report_types'][$_REQUEST['rt']])) {
$context['sub_template'] = 'report_type';
return;
}
$context['report_type'] = $_REQUEST['rt'];
// What are valid templates for showing reports?
$reportTemplates = array('main' => array('layers' => null), 'print' => array('layers' => array('print')));
// Specific template? Use that instead of main!
if (isset($_REQUEST['st']) && isset($reportTemplates[$_REQUEST['st']])) {
$context['sub_template'] = $_REQUEST['st'];
// Are we disabling the other layers - print friendly for example?
if ($reportTemplates[$_REQUEST['st']]['layers'] !== null) {
$context['template_layers'] = $reportTemplates[$_REQUEST['st']]['layers'];
}
}
// Make the page title more descriptive.
$context['page_title'] .= ' - ' . (isset($txt['gr_type_' . $context['report_type']]) ? $txt['gr_type_' . $context['report_type']] : $context['report_type']);
// Build the reports button array.
$context['report_buttons'] = array('generate_reports' => array('text' => 'generate_reports', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports', 'active' => true), 'print' => array('text' => 'print', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type'] . ';st=print', 'custom' => 'target="_blank"'));
// Allow mods to add additional buttons here
call_integration_hook('integrate_report_buttons');
// Now generate the data.
$context['report_types'][$context['report_type']]['function']();
// Finish the tables before exiting - this is to help the templates a little more.
finishTables();
}
示例14: action_quickhelp
/**
* Show boxes with more detailed help on items, when the user clicks on their help icon.
* It handles both administrative or user help.
* Data: $_GET['help'] parameter, it holds what string to display
* and where to get the string from. ($helptxt or $txt)
* It is accessed via ?action=quickhelp;help=?.
*
* @uses ManagePermissions language file, if the help starts with permissionhelp.
* @uses Help template, 'popup' sub-template.
*/
public function action_quickhelp()
{
global $txt, $helptxt, $context, $scripturl;
if (!isset($_GET['help']) || !is_string($_GET['help'])) {
fatal_lang_error('no_access', false);
}
if (!isset($helptxt)) {
$helptxt = array();
}
$help_str = Util::htmlspecialchars($_GET['help']);
// Load the admin help language file and template.
loadLanguage('Help');
// Load permission specific help
if (substr($help_str, 0, 14) == 'permissionhelp') {
loadLanguage('ManagePermissions');
}
// Load our template
loadTemplate('Help');
// Allow addons to load their own language file here.
call_integration_hook('integrate_quickhelp');
// Set the page title to something relevant.
$context['page_title'] = $context['forum_name'] . ' - ' . $txt['help'];
// Only show the 'popup' sub-template, no layers.
Template_Layers::getInstance()->removeAll();
$context['sub_template'] = 'popup';
$helps = explode('+', $help_str);
$context['help_text'] = '';
// Find what to display: the string will be in $helptxt['help'] or in $txt['help]
foreach ($helps as $help) {
if (isset($helptxt[$help])) {
$context['help_text'] .= $helptxt[$help];
} elseif (isset($txt[$help])) {
$context['help_text'] .= $txt[$help];
} else {
// nothing :(
$context['help_text'] .= $help;
}
}
// Link to the forum URL, and include session id.
if (preg_match('~%([0-9]+\\$)?s\\?~', $context['help_text'], $match)) {
$context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);
}
}
示例15: ManageScheduledTasks
/**
* Scheduled tasks management dispatcher. This function checks permissions and delegates
* to the appropriate function based on the sub-action.
* Everything here requires adin_forum permission.
*
* @uses ManageScheduledTasks template file
* @uses ManageScheduledTasks language file
*/
function ManageScheduledTasks()
{
global $context, $txt, $modSettings;
isAllowedTo('admin_forum');
loadLanguage('ManageScheduledTasks');
loadTemplate('ManageScheduledTasks');
$subActions = array('taskedit' => 'EditTask', 'tasklog' => 'TaskLog', 'tasks' => 'ScheduledTasks');
call_integration_hook('integrate_manage_scheduled_tasks', array(&$subActions));
// We need to find what's the action.
if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) {
$context['sub_action'] = $_REQUEST['sa'];
} else {
$context['sub_action'] = 'tasks';
}
// Now for the lovely tabs. That we all love.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['scheduled_tasks_title'], 'help' => '', 'description' => $txt['maintain_info'], 'tabs' => array('tasks' => array('description' => $txt['maintain_tasks_desc']), 'tasklog' => array('description' => $txt['scheduled_log_desc'])));
// Call it.
$subActions[$context['sub_action']]();
}