function invite() { global $context, $scripturl, $txt, $sourcedir, $user_info, $modSettings; if ($user_info['is_guest']) { redirectexit(); } // Let's set up the template and language. require_once $sourcedir . '/ManageServer.php'; require_once $sourcedir . '/Subs-Menu.php'; loadLanguage('Admin'); loadLanguage('Modifications'); loadLanguage('ManageSettings'); loadTemplate('Invite'); // Invite areas. $areas = array('manage' => 'ManageInviteKeys', 'generate' => 'GenerateInviteKey', 'email' => 'EmailKey'); // Default the area to the manage keys page. $_REQUEST['area'] = isset($_REQUEST['area']) && isset($areas[$_REQUEST['area']]) ? $_REQUEST['area'] : 'manage'; // Declare the page title, duh =P $context['page_title'] = $txt['invite_system']; $invite_areas = array('manage' => array('title' => $txt['invite_manage'], 'areas' => array('manage' => array('label' => $txt['invite_manage'], 'file' => 'Invite.php', 'function' => 'ManageInviteKeys'))), 'generate' => array('title' => $txt['invite_generate'], 'areas' => array('generate' => array('label' => $txt['invite_generate'], 'file' => 'Invite.php', 'function' => 'GenerateInviteKey')))); if ($modSettings['invite_email'] || allowedTo('admin_forum')) { $invite_areas['email'] = array('title' => $txt['invite_email_send'], 'areas' => array('email' => array('label' => $txt['invite_email_member'], 'file' => 'Invite.php', 'function' => 'EmailKey'))); } $menuOptions = array('disable_url_session_check' => true, 'current_area' => $_REQUEST['area']); createMenu($invite_areas, $menuOptions); // And finally, the Link Tree. $context['linktree'][] = array('url' => $scripturl . '?action=invite;area=' . $_REQUEST['area'], 'name' => $txt['invite_' . $_REQUEST['area']]); // Call the right function for this area. $areas[$_REQUEST['area']](); }
function AdminMain() { global $txt, $context, $scripturl, $modSettings, $settings, $sourcedir, $options, $boarddir, $backend_subdir; // Load the language and templates.... loadLanguage('Admin'); loadAdminTemplate('Admin'); $context['robot_no_index'] = true; require_once $sourcedir . '/lib/Subs-Menu.php'; // Some preferences. $context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array(); // Define all the menu structure - see Subs-Menu.php for details! $admin_areas = array('forum' => array('title' => $txt['admin_main'], 'permission' => array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments'), 'areas' => array('index' => array('label' => $txt['admin_center'], 'function' => 'AdminHome', 'icon' => 'administration.gif'), 'credits' => array('label' => $txt['support_credits_title'], 'function' => 'AdminHome', 'icon' => 'support.gif'), 'news' => array('label' => $txt['news_title'], 'file' => $backend_subdir . '/ManageNews.php', 'function' => 'ManageNews', 'icon' => 'news.gif', 'permission' => array('edit_news', 'send_mail', 'admin_forum'), 'subsections' => array('editnews' => array($txt['admin_edit_news'], 'edit_news'), 'mailingmembers' => array($txt['admin_newsletters'], 'send_mail'), 'settings' => array($txt['settings'], 'admin_forum'))), 'packages' => array('label' => $txt['package'], 'file' => $backend_subdir . '/Packages.php', 'function' => 'Packages', 'permission' => array('admin_forum'), 'icon' => 'packages.gif', 'subsections' => array('browse' => array($txt['browse_packages']), 'packageget' => array($txt['download_packages'], 'url' => $scripturl . '?action=admin;area=packages;sa=packageget;get'), 'installed' => array($txt['installed_packages']), 'perms' => array($txt['package_file_perms']), 'options' => array($txt['package_settings']))), 'plugins' => array('label' => $txt['plugins_title'], 'file' => $backend_subdir . '/Plugins.php', 'function' => 'PluginsMain', 'permission' => array('admin_forum'), 'icon' => 'packages.gif', 'subsections' => array('browse' => array($txt['browse_plugins']), 'hooks' => array($txt['browse_hooks']))), 'search' => array('function' => 'AdminSearch', 'permission' => array('admin_forum'), 'select' => 'index'))), 'config' => array('title' => $txt['admin_config'], 'permission' => array('admin_forum'), 'areas' => array('corefeatures' => array('label' => $txt['core_settings_title'], 'file' => $backend_subdir . '/ManageSettings.php', 'function' => 'ModifyCoreFeatures', 'icon' => 'corefeatures.gif'), 'featuresettings' => array('label' => $txt['modSettings_title'], 'file' => $backend_subdir . '/ManageSettings.php', 'function' => 'ModifyFeatureSettings', 'icon' => 'features.gif', 'subsections' => array('basic' => array($txt['mods_cat_features']), 'layout' => array($txt['mods_cat_layout']), 'sig' => array($txt['signature_settings_short']), 'profile' => array($txt['custom_profile_shorttitle'], 'enabled' => in_array('cp', $context['admin_features'])))), 'securitysettings' => array('label' => $txt['admin_security_moderation'], 'file' => $backend_subdir . '/ManageSettings.php', 'function' => 'ModifySecuritySettings', 'icon' => 'security.gif', 'subsections' => array('general' => array($txt['mods_cat_security_general']), 'spam' => array($txt['antispam_title']), 'moderation' => array($txt['moderation_settings_short'], 'enabled' => substr($modSettings['warning_settings'], 0, 1) == 1))), 'languages' => array('label' => $txt['language_configuration'], 'file' => $backend_subdir . '/ManageServer.php', 'function' => 'ManageLanguages', 'icon' => 'languages.gif', 'subsections' => array('edit' => array($txt['language_edit']), 'add' => array($txt['language_add']), 'settings' => array($txt['language_settings']))), 'serversettings' => array('label' => $txt['admin_server_settings'], 'file' => $backend_subdir . '/ManageServer.php', 'function' => 'ModifySettings', 'icon' => 'server.gif', 'subsections' => array('general' => array($txt['general_settings']), 'database' => array($txt['database_paths_settings']), 'cookie' => array($txt['cookies_sessions_settings']), 'cache' => array($txt['caching_settings']), 'loads' => array($txt['load_balancing_settings']))), 'relatedtopics' => array('label' => $txt['admin_related_topic'], 'file' => $backend_subdir . '/RelatedTopics.php', 'function' => 'RelatedTopicsAdmin', 'subsections' => array('settings' => array($txt['admin_related_topics_settings']), 'methods' => array($txt['admin_related_topics_methods']))), 'current_theme' => array('label' => $txt['theme_current_settings'], 'file' => $backend_subdir . '/Themes.php', 'function' => 'ThemesMain', 'custom_url' => $scripturl . '?action=admin;area=theme;sa=settings;th=' . $settings['theme_id'], 'icon' => 'current_theme.gif'), 'theme' => array('label' => $txt['theme_admin'], 'file' => $backend_subdir . '/Themes.php', 'function' => 'ThemesMain', 'custom_url' => $scripturl . '?action=admin;area=theme;sa=admin', 'icon' => 'themes.gif', 'subsections' => array('admin' => array($txt['themeadmin_admin_title']), 'list' => array($txt['themeadmin_list_title']), 'reset' => array($txt['themeadmin_reset_title']), 'edit' => array($txt['themeadmin_edit_title']))), 'modsettings' => array('label' => $txt['admin_modifications'], 'file' => $backend_subdir . '/ManageSettings.php', 'function' => 'ModifyModSettings', 'icon' => 'modifications.gif', 'related' => array($txt['admin_related_topic']), 'subsections' => array('general' => array($txt['mods_cat_modifications_misc']))), 'socialsettings' => array('label' => $txt['admin_social'], 'file' => $backend_subdir . '/ManageSettings.php', 'function' => 'ModifySocialSettings', 'subsections' => array('general' => array($txt['socialsettings_general']), 'astream' => array($txt['socialsettings_astream']))))), 'layout' => array('title' => $txt['layout_controls'], 'permission' => array('manage_boards', 'admin_forum', 'manage_smileys', 'manage_attachments', 'moderate_forum'), 'areas' => array('manageboards' => array('label' => $txt['admin_boards'], 'file' => $backend_subdir . '/ManageBoards.php', 'function' => 'ManageBoards', 'icon' => 'boards.gif', 'permission' => array('manage_boards'), 'subsections' => array('main' => array($txt['boardsEdit']), 'newcat' => array($txt['mboards_new_cat']), 'settings' => array($txt['settings'], 'admin_forum'))), 'postsettings' => array('label' => $txt['manageposts'], 'file' => $backend_subdir . '/ManagePosts.php', 'function' => 'ManagePostSettings', 'permission' => array('admin_forum'), 'icon' => 'posts.gif', 'subsections' => array('posts' => array($txt['manageposts_settings']), 'bbc' => array($txt['manageposts_bbc_settings']), 'censor' => array($txt['admin_censored_words']), 'topics' => array($txt['manageposts_topic_settings']), 'prefixes' => array($txt['manageposts_prefix_settings']), 'tags' => array($txt['manageposts_tag_settings']), 'ratings' => array($txt['karma']))), 'managecalendar' => array('label' => $txt['manage_calendar'], 'file' => $backend_subdir . '/ManageCalendar.php', 'function' => 'ManageCalendar', 'icon' => 'calendar.gif', 'permission' => array('admin_forum'), 'enabled' => in_array('cd', $context['admin_features']), 'subsections' => array('holidays' => array($txt['manage_holidays'], 'admin_forum', 'enabled' => !empty($modSettings['cal_enabled'])), 'settings' => array($txt['calendar_settings'], 'admin_forum'))), 'managesearch' => array('label' => $txt['manage_search'], 'file' => $backend_subdir . '/ManageSearch.php', 'function' => 'ManageSearch', 'icon' => 'search.gif', 'permission' => array('admin_forum'), 'subsections' => array('weights' => array($txt['search_weights']), 'method' => array($txt['search_method']), 'settings' => array($txt['settings']), 'managesphinx' => array($txt['search_managesphinx']))), 'smileys' => array('label' => $txt['smileys_manage'], 'file' => $backend_subdir . '/ManageSmileys.php', 'function' => 'ManageSmileys', 'icon' => 'smiley.gif', 'permission' => array('manage_smileys'), 'subsections' => array('editsets' => array($txt['smiley_sets']), 'addsmiley' => array($txt['smileys_add'], 'enabled' => !empty($modSettings['smiley_enable'])), 'editsmileys' => array($txt['smileys_edit'], 'enabled' => !empty($modSettings['smiley_enable'])), 'setorder' => array($txt['smileys_set_order'], 'enabled' => !empty($modSettings['smiley_enable'])), 'editicons' => array($txt['icons_edit_message_icons'], 'enabled' => !empty($modSettings['messageIcons_enable'])), 'settings' => array($txt['settings']))), 'manageattachments' => array('label' => $txt['attachments_avatars'], 'file' => $backend_subdir . '/ManageAttachments.php', 'function' => 'ManageAttachments', 'icon' => 'attachment.gif', 'permission' => array('manage_attachments'), 'subsections' => array('browse' => array($txt['attachment_manager_browse']), 'attachments' => array($txt['attachment_manager_settings']), 'avatars' => array($txt['attachment_manager_avatar_settings']), 'maintenance' => array($txt['attachment_manager_maintenance']))))), 'members' => array('title' => $txt['admin_manage_members'], 'permission' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'manage_permissions', 'admin_forum'), 'areas' => array('viewmembers' => array('label' => $txt['admin_users'], 'file' => $backend_subdir . '/ManageMembers.php', 'function' => 'ViewMembers', 'icon' => 'members.gif', 'permission' => array('moderate_forum'), 'subsections' => array('all' => array($txt['view_all_members']), 'search' => array($txt['mlist_search']))), 'membergroups' => array('label' => $txt['admin_groups'], 'file' => $backend_subdir . '/ManageMembergroups.php', 'function' => 'ModifyMembergroups', 'icon' => 'membergroups.gif', 'permission' => array('manage_membergroups'), 'subsections' => array('index' => array($txt['membergroups_edit_groups'], 'manage_membergroups'), 'add' => array($txt['membergroups_new_group'], 'manage_membergroups'), 'settings' => array($txt['settings'], 'admin_forum'))), 'permissions' => array('label' => $txt['edit_permissions'], 'file' => $backend_subdir . '/ManagePermissions.php', 'function' => 'ModifyPermissions', 'icon' => 'permissions.gif', 'permission' => array('manage_permissions'), 'subsections' => array('index' => array($txt['permissions_groups'], 'manage_permissions'), 'board' => array($txt['permissions_boards'], 'manage_permissions'), 'profiles' => array($txt['permissions_profiles'], 'manage_permissions'), 'postmod' => array($txt['permissions_post_moderation'], 'manage_permissions', 'enabled' => $modSettings['postmod_active']), 'settings' => array($txt['settings'], 'admin_forum'))), 'regcenter' => array('label' => $txt['registration_center'], 'file' => $backend_subdir . '/ManageRegistration.php', 'function' => 'RegCenter', 'icon' => 'regcenter.gif', 'permission' => array('admin_forum', 'moderate_forum'), 'subsections' => array('register' => array($txt['admin_browse_register_new'], 'moderate_forum'), 'agreement' => array($txt['registration_agreement'], 'admin_forum'), 'reservednames' => array($txt['admin_reserved_set'], 'admin_forum'), 'settings' => array($txt['settings'], 'admin_forum'))), 'ban' => array('label' => $txt['ban_title'], 'file' => $backend_subdir . '/ManageBans.php', 'function' => 'Ban', 'icon' => 'ban.gif', 'permission' => 'manage_bans', 'subsections' => array('list' => array($txt['ban_edit_list']), 'add' => array($txt['ban_add_new']), 'browse' => array($txt['ban_trigger_browse']), 'log' => array($txt['ban_log']))), 'paidsubscribe' => array('label' => $txt['paid_subscriptions'], 'enabled' => in_array('ps', $context['admin_features']), 'file' => $backend_subdir . '/ManagePaid.php', 'icon' => 'paid.gif', 'function' => 'ManagePaidSubscriptions', 'permission' => 'admin_forum', 'subsections' => array('view' => array($txt['paid_subs_view']), 'settings' => array($txt['settings']))), 'sengines' => array('label' => $txt['search_engines'], 'enabled' => in_array('sp', $context['admin_features']), 'file' => $backend_subdir . '/ManageSearchEngines.php', 'icon' => 'engines.gif', 'function' => 'SearchEngines', 'permission' => 'admin_forum', 'subsections' => array('stats' => array($txt['spider_stats']), 'logs' => array($txt['spider_logs']), 'spiders' => array($txt['spiders']), 'settings' => array($txt['settings']))))), 'maintenance' => array('title' => $txt['admin_maintenance'], 'permission' => array('admin_forum'), 'areas' => array('maintain' => array('label' => $txt['maintain_title'], 'file' => $backend_subdir . '/ManageMaintenance.php', 'icon' => 'maintain.gif', 'function' => 'ManageMaintenance', 'subsections' => array('routine' => array($txt['maintain_sub_routine'], 'admin_forum'), 'database' => array($txt['maintain_sub_database'], 'admin_forum'), 'members' => array($txt['maintain_sub_members'], 'admin_forum'), 'topics' => array($txt['maintain_sub_topics'], 'admin_forum'))), 'scheduledtasks' => array('label' => $txt['maintain_tasks'], 'file' => $backend_subdir . '/ManageScheduledTasks.php', 'icon' => 'scheduled.gif', 'function' => 'ManageScheduledTasks', 'subsections' => array('tasks' => array($txt['maintain_tasks'], 'admin_forum'), 'tasklog' => array($txt['scheduled_log'], 'admin_forum'))), 'mailqueue' => array('label' => $txt['mailqueue_title'], 'file' => $backend_subdir . '/ManageMail.php', 'function' => 'ManageMail', 'icon' => 'mail.gif', 'subsections' => array('browse' => array($txt['mailqueue_browse'], 'admin_forum'), 'settings' => array($txt['mailqueue_settings'], 'admin_forum'))), 'reports' => array('enabled' => in_array('rg', $context['admin_features']), 'label' => $txt['generate_reports'], 'file' => 'Reports.php', 'function' => 'ReportsMain', 'icon' => 'reports.gif'), 'logs' => array('label' => $txt['logs'], 'function' => 'AdminLogs', 'icon' => 'logs.gif', 'subsections' => array('errorlog' => array($txt['errlog'], 'admin_forum', 'enabled' => !empty($modSettings['enableErrorLogging']), 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc'), 'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])), 'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])), 'banlog' => array($txt['ban_log'], 'manage_bans'), 'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => in_array('sp', $context['admin_features'])), 'tasklog' => array($txt['scheduled_log'], 'admin_forum'), 'pruning' => array($txt['pruning_title'], 'admin_forum'))), 'repairboards' => array('label' => $txt['admin_repair'], 'file' => $backend_subdir . '/RepairBoards.php', 'function' => 'RepairBoards', 'select' => 'maintain', 'hidden' => true)))); if (!$modSettings['tags_active']) { unset($admin_areas['layout']['areas']['postsettings']['subsections']['tags']); } if (empty($modSettings['karmaMode'])) { unset($admin_areas['layout']['areas']['postsettings']['subsections']['ratings']); } // Any files to include for administration? if (!empty($modSettings['integrate_admin_include'])) { $admin_includes = explode(',', $modSettings['integrate_admin_include']); foreach ($admin_includes as $include) { $include = strtr(trim($include), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); if (file_exists($include)) { require_once $include; } } } // Let them modify admin areas easily. HookAPI::callHook('integrate_admin_areas', array(&$admin_areas)); SimpleSEF::adminAreas($admin_areas); // Make sure the administrator has a valid session... validateSession(); // Actually create the menu! $admin_include_data = createMenu($admin_areas); unset($admin_areas); // Nothing valid? if ($admin_include_data == false) { fatal_lang_error('no_access', false); } // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=admin', 'name' => $txt['admin_center']); if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'name' => $admin_include_data['label']); } if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0]); } // Make a note of the Unique ID for this menu. $context['admin_menu_id'] = $context['max_menu_id']; $context['admin_menu_name'] = 'menu_data_' . $context['admin_menu_id']; // Why on the admin are we? $context['admin_area'] = $admin_include_data['current_area']; // Now - finally - call the right place! if (isset($admin_include_data['file'])) { require_once $sourcedir . '/' . $admin_include_data['file']; } $admin_include_data['function'](); }
function ModerationMain($dont_call = false) { global $txt, $context, $scripturl, $sc, $modSettings, $user_info, $settings, $sourcedir, $options, $smcFunc; // Don't run this twice... and don't conflict with the admin bar. if (isset($context['admin_area'])) { return; } //Standard Member Color Link Varibale if (empty($context['MemberColor_ID_MEMBER'])) { $context['MemberColor_ID_MEMBER'] = array(); } // Everyone using this area must be allowed here! if ($user_info['mod_cache']['gq'] == '0=1' && $user_info['mod_cache']['bq'] == '0=1' && !allowedTo('manage_membergroups')) { isAllowedTo('access_mod_center'); } // We're gonna want a menu of some kind. require_once $sourcedir . '/Subs-Menu.php'; // Load the language, and the template. loadLanguage('ModerationCenter'); loadTemplate(false, 'admin'); $context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array(); $context['robot_no_index'] = true; // Can they approve any posts? if ($modSettings['postmod_active']) { $approve_boards = boardsAllowedTo('approve_posts'); } // This is the menu structure - refer to Subs-Menu.php for the details. $moderation_areas = array('main' => array('title' => $txt['mc_main'], 'areas' => array('index' => array('label' => $txt['moderation_center'], 'function' => 'ModerationHome'), 'modlog' => array('enabled' => !empty($modSettings['modlog_enabled']), 'label' => $txt['modlog_view'], 'file' => 'Modlog.php', 'function' => 'ViewModlog'), 'notice' => array('file' => 'ModerationCenter.php', 'function' => 'ShowNotice', 'select' => 'index'), 'warnings' => array('label' => $txt['mc_warnings'], 'enabled' => in_array('w', $context['admin_features']) && $modSettings['warning_settings'][0] == 1, 'function' => 'ViewWarnings', 'subsections' => array('log' => array($txt['mc_warning_log']), 'templates' => array($txt['mc_warning_templates'], 'issue_warning'))), 'userwatch' => array('label' => $txt['mc_watched_users_title'], 'function' => 'ViewWatchedUsers', 'subsections' => array('member' => array($txt['mc_watched_users_member']), 'post' => array($txt['mc_watched_users_post']))))), 'posts' => array('title' => $txt['mc_posts'], 'enabled' => $user_info['mod_cache']['bq'] != '0=1' || !empty($approve_boards), 'areas' => array('postmod' => array('label' => $txt['mc_unapproved_posts'], 'enabled' => $modSettings['postmod_active'], 'file' => 'PostModeration.php', 'function' => 'PostModerationMain', 'custom_url' => $scripturl . '?action=moderate;area=postmod;sa=posts', 'subsections' => array('posts' => array($txt['mc_unapproved_replies']), 'topics' => array($txt['mc_unapproved_topics']))), 'attachmod' => array('label' => $txt['mc_unapproved_attachments'], 'enabled' => $modSettings['postmod_active'], 'file' => 'PostModeration.php', 'function' => 'PostModerationMain', 'custom_url' => $scripturl . '?action=moderate;area=attachmod;sa=attachments'), 'reports' => array('label' => $txt['mc_reported_posts'], 'enabled' => $user_info['mod_cache']['bq'] != '0=1', 'file' => 'ModerationCenter.php', 'function' => 'ReportedPosts', 'subsections' => array('open' => array($txt['mc_reportedp_active']), 'closed' => array($txt['mc_reportedp_closed']))))), 'groups' => array('title' => $txt['mc_groups'], 'enabled' => $user_info['mod_cache']['gq'] != '0=1' || allowedTo('manage_membergroups'), 'areas' => array('groups' => array('label' => $txt['mc_group_requests'], 'file' => 'Groups.php', 'function' => 'Groups', 'custom_url' => $scripturl . '?action=moderate;area=groups;sa=requests'), 'viewgroups' => array('label' => $txt['mc_view_groups'], 'file' => 'Groups.php', 'function' => 'Groups'))), 'prefs' => array('title' => $txt['mc_prefs'], 'areas' => array('settings' => array('label' => $txt['mc_settings'], 'function' => 'ModerationSettings')))); // I don't know where we're going - I don't know where we've been... $menuOptions = array('action' => 'moderate'); $mod_include_data = createMenu($moderation_areas, $menuOptions); unset($moderation_areas); // We got something - didn't we? DIDN'T WE! if ($mod_include_data == false) { fatal_lang_error('no_access', false); } // Retain the ID information in case required by a subaction. $context['moderation_menu_id'] = $context['max_menu_id']; $context['moderation_menu_name'] = 'menu_data_' . $context['moderation_menu_id']; // What a pleasant shortcut - even tho we're not *really* on the admin screen who cares... $context['admin_area'] = $mod_include_data['current_area']; // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=moderate', 'name' => $txt['moderation_center']); if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') { $context['linktree'][] = array('url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'], 'name' => $mod_include_data['label']); } if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'], 'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0]); } // Now - finally - the bit before the encore - the main performance of course! if (!$dont_call) { if (isset($mod_include_data['file'])) { require_once $sourcedir . '/' . $mod_include_data['file']; } $mod_include_data['function'](); } }
/** * Prepare menu, make checks, load files, and create moderation menu. * This can be called from the class, or from outside, to * set up moderation menu. */ public function prepareModcenter() { global $txt, $context, $scripturl, $modSettings, $user_info, $options; // Don't run this twice... and don't conflict with the admin bar. if (isset($context['admin_area'])) { return; } $context['can_moderate_boards'] = $user_info['mod_cache']['bq'] != '0=1'; $context['can_moderate_groups'] = $user_info['mod_cache']['gq'] != '0=1'; $context['can_moderate_approvals'] = $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']); // Everyone using this area must be allowed here! if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals']) { isAllowedTo('access_mod_center'); } // We're gonna want a menu of some kind. require_once SUBSDIR . '/Menu.subs.php'; // Load the language, and the template. loadLanguage('ModerationCenter'); loadTemplate(false, 'admin'); $context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array(); $context['robot_no_index'] = true; // Moderation counts for things that this moderator can take care of require_once SUBSDIR . '/Moderation.subs.php'; $mod_counts = loadModeratorMenuCounts(); // This is the menu structure - refer to subs/Menu.subs.php for the details. $moderation_areas = array('main' => array('title' => $txt['mc_main'], 'areas' => array('index' => array('label' => $txt['moderation_center'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_moderationHome', 'icon' => 'transparent.png', 'class' => 'admin_img_home'), 'settings' => array('label' => $txt['mc_settings'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_moderationSettings', 'icon' => 'transparent.png', 'class' => 'admin_img_features'), 'modlogoff' => array('label' => $txt['mc_logoff'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_modEndSession', 'enabled' => empty($modSettings['securityDisable_moderate']), 'icon' => 'transparent.png', 'class' => 'admin_img_exit'), 'notice' => array('controller' => 'ModerationCenter_Controller', 'function' => 'action_showNotice', 'select' => 'index', 'icon' => 'transparent.png', 'class' => 'admin_img_news'))), 'logs' => array('title' => $txt['mc_logs'], 'areas' => array('modlog' => array('label' => $txt['modlog_view'], 'enabled' => !empty($modSettings['modlog_enabled']) && $context['can_moderate_boards'], 'file' => 'Modlog.controller.php', 'dir' => ADMINDIR, 'controller' => 'Modlog_Controller', 'function' => 'action_log', 'icon' => 'transparent.png', 'class' => 'admin_img_logs'), 'warnings' => array('label' => $txt['mc_warnings'], 'enabled' => in_array('w', $context['admin_features']) && !empty($modSettings['warning_enable']) && $context['can_moderate_boards'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_viewWarnings', 'icon' => 'transparent.png', 'class' => 'admin_img_reports', 'subsections' => array('log' => array($txt['mc_warning_log']), 'templates' => array($txt['mc_warning_templates'], 'issue_warning'))))), 'posts' => array('title' => $txt['mc_posts'] . (!empty($mod_counts['pt_total']) ? ' [' . $mod_counts['pt_total'] . ']' : ''), 'enabled' => $context['can_moderate_boards'] || $context['can_moderate_approvals'], 'areas' => array('postmod' => array('label' => $txt['mc_unapproved_posts'] . (!empty($mod_counts['postmod']) ? ' [' . $mod_counts['postmod'] . ']' : ''), 'enabled' => $context['can_moderate_approvals'], 'file' => 'PostModeration.controller.php', 'controller' => 'PostModeration_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_posts', 'custom_url' => $scripturl . '?action=moderate;area=postmod', 'subsections' => array('posts' => array($txt['mc_unapproved_replies']), 'topics' => array($txt['mc_unapproved_topics']))), 'emailmod' => array('label' => $txt['mc_emailerror'] . (!empty($mod_counts['emailmod']) ? ' [' . $mod_counts['emailmod'] . ']' : ''), 'enabled' => !empty($modSettings['maillist_enabled']) && allowedTo('approve_emails'), 'file' => 'ManageMaillist.controller.php', 'dir' => ADMINDIR, 'function' => 'UnapprovedEmails', 'icon' => 'transparent.png', 'class' => 'admin_img_mail', 'custom_url' => $scripturl . '?action=admin;area=maillist;sa=emaillist'), 'attachmod' => array('label' => $txt['mc_unapproved_attachments'] . (!empty($mod_counts['attachments']) ? ' [' . $mod_counts['attachments'] . ']' : ''), 'enabled' => $context['can_moderate_approvals'], 'file' => 'PostModeration.controller.php', 'controller' => 'PostModeration_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_attachment', 'custom_url' => $scripturl . '?action=moderate;area=attachmod;sa=attachments'), 'reports' => array('label' => $txt['mc_reported_posts'] . (!empty($mod_counts['reports']) ? ' [' . $mod_counts['reports'] . ']' : ''), 'enabled' => $context['can_moderate_boards'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_reportedPosts', 'icon' => 'transparent.png', 'class' => 'admin_img_reports', 'subsections' => array('open' => array($txt['mc_reportedp_active'] . (!empty($mod_counts['reports']) ? ' [' . $mod_counts['reports'] . ']' : '')), 'closed' => array($txt['mc_reportedp_closed']))))), 'groups' => array('title' => $txt['mc_groups'] . (!empty($mod_counts['mg_total']) ? ' [' . $mod_counts['mg_total'] . ']' : ''), 'enabled' => $context['can_moderate_groups'], 'areas' => array('userwatch' => array('label' => $txt['mc_watched_users_title'], 'enabled' => in_array('w', $context['admin_features']) && !empty($modSettings['warning_enable']) && $context['can_moderate_boards'], 'controller' => 'ModerationCenter_Controller', 'function' => 'action_viewWatchedUsers', 'icon' => 'transparent.png', 'class' => 'admin_img_permissions', 'subsections' => array('member' => array($txt['mc_watched_users_member']), 'post' => array($txt['mc_watched_users_post']))), 'groups' => array('label' => $txt['mc_group_requests'] . (!empty($mod_counts['groupreq']) ? ' [' . $mod_counts['groupreq'] . ']' : ''), 'file' => 'Groups.controller.php', 'controller' => 'Groups_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_regcenter', 'custom_url' => $scripturl . '?action=moderate;area=groups;sa=requests'), 'members' => array('enabled' => allowedTo('moderate_forum'), 'label' => $txt['mc_member_requests'] . (!empty($mod_counts['memberreq']) ? ' [' . $mod_counts['memberreq'] . ']' : ''), 'file' => 'ManageMembers.controller.php', 'controller' => 'ManageMembers_Controller', 'function' => 'action_approve', 'icon' => 'transparent.png', 'class' => 'admin_img_members', 'custom_url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=approve'), 'viewgroups' => array('label' => $txt['mc_view_groups'], 'file' => 'Groups.controller.php', 'controller' => 'Groups_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_membergroups')))); // Make sure the administrator has a valid session... validateSession('moderate'); // I don't know where we're going - I don't know where we've been... $menuOptions = array('action' => 'moderate', 'hook' => 'moderation', 'disable_url_session_check' => true, 'default_include_dir' => CONTROLLERDIR); $mod_include_data = createMenu($moderation_areas, $menuOptions); unset($moderation_areas); // We got something - didn't we? DIDN'T WE! if ($mod_include_data == false) { fatal_lang_error('no_access', false); } // Retain the ID information in case required by a subaction. $context['moderation_menu_id'] = $context['max_menu_id']; $context['moderation_menu_name'] = 'menu_data_' . $context['moderation_menu_id']; $context[$context['moderation_menu_name']]['tab_data'] = array('title' => $txt['moderation_center'], 'help' => '', 'description' => sprintf($txt['mc_description'], $context['user']['name'], $scripturl . '?action=moderate;area=settings')); // What a pleasant shortcut - even tho we're not *really* on the admin screen who cares... $context['admin_area'] = $mod_include_data['current_area']; // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=moderate', 'name' => $txt['moderation_center']); if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') { $context['linktree'][] = array('url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'], 'name' => $mod_include_data['label']); } if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'], 'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0]); } // Finally, store this, so that if we're called from the class, it can use it. $this->_mod_include_data = $mod_include_data; }
function createMenu($dir) { if (is_dir($dir)) { echo "<li><a class='load-dir' data-file='{$dir}' href='#'>" . basename($dir) . "</a><ul>"; foreach (glob("{$dir}/*") as $path) { createMenu($path); } echo "</ul></li>"; } else { $extension = pathinfo($dir); $extension = $extension['extension']; echo "<li><a class='load-file' data-file='{$dir}' href='{$dir}' >" . basename($dir, "." . $extension) . "</a></li>"; } }
/** * The main admin handling function. * * What it does: * - It initialises all the basic context required for the admin center. * - It passes execution onto the relevant admin section. * - If the passed section is not found it shows the admin home page. * - Accessed by ?action=admin. */ public function action_index() { global $txt, $context, $scripturl, $modSettings, $settings; // Make sure the administrator has a valid session... validateSession(); // Load the language and templates.... loadLanguage('Admin'); loadTemplate('Admin', 'admin'); loadJavascriptFile('admin.js', array(), 'admin_script'); // The Admin functions require Jquery UI .... $modSettings['jquery_include_ui'] = true; // No indexing evil stuff. $context['robot_no_index'] = true; // Need these to do much require_once SUBSDIR . '/Menu.subs.php'; require_once SUBSDIR . '/Action.class.php'; // Define the menu structure - see subs/Menu.subs.php for details! $admin_areas = array('forum' => array('title' => $txt['admin_main'], 'permission' => array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments'), 'areas' => array('index' => array('label' => $txt['admin_center'], 'controller' => 'Admin_Controller', 'function' => 'action_home', 'icon' => 'transparent.png', 'class' => 'admin_img_administration'), 'credits' => array('label' => $txt['support_credits_title'], 'controller' => 'Admin_Controller', 'function' => 'action_credits', 'icon' => 'transparent.png', 'class' => 'admin_img_support'), 'maillist' => array('label' => $txt['mail_center'], 'file' => 'ManageMaillist.controller.php', 'controller' => 'ManageMaillist_Controller', 'function' => 'action_index', 'icon' => 'mail.png', 'class' => 'admin_img_mail', 'permission' => array('approve_emails', 'admin_forum'), 'enabled' => in_array('pe', $context['admin_features']), 'subsections' => array('emaillist' => array($txt['mm_emailerror'], 'approve_emails'), 'emailfilters' => array($txt['mm_emailfilters'], 'admin_forum'), 'emailparser' => array($txt['mm_emailparsers'], 'admin_forum'), 'emailtemplates' => array($txt['mm_emailtemplates'], 'approve_emails'), 'emailsettings' => array($txt['mm_emailsettings'], 'admin_forum'))), 'news' => array('label' => $txt['news_title'], 'file' => 'ManageNews.controller.php', 'controller' => 'ManageNews_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_news', 'permission' => array('edit_news', 'send_mail', 'admin_forum'), 'subsections' => array('editnews' => array($txt['admin_edit_news'], 'edit_news'), 'mailingmembers' => array($txt['admin_newsletters'], 'send_mail'), 'settings' => array($txt['settings'], 'admin_forum'))), 'packages' => array('label' => $txt['package'], 'file' => 'Packages.controller.php', 'controller' => 'Packages_Controller', 'function' => 'action_index', 'permission' => array('admin_forum'), 'icon' => 'transparent.png', 'class' => 'admin_img_packages', 'subsections' => array('browse' => array($txt['browse_packages']), 'installed' => array($txt['installed_packages']), 'perms' => array($txt['package_file_perms']), 'options' => array($txt['package_settings']), 'servers' => array($txt['download_packages']), 'upload' => array($txt['upload_packages']))), 'packageservers' => array('label' => $txt['package_servers'], 'file' => 'PackageServers.controller.php', 'controller' => 'PackageServers_Controller', 'function' => 'action_index', 'permission' => array('admin_forum'), 'icon' => 'transparent.png', 'class' => 'admin_img_packages', 'hidden' => true), 'search' => array('controller' => 'Admin_Controller', 'function' => 'action_search', 'permission' => array('admin_forum'), 'select' => 'index'), 'adminlogoff' => array('controller' => 'Admin_Controller', 'function' => 'action_endsession', 'label' => $txt['admin_logoff'], 'enabled' => empty($modSettings['securityDisable']), 'icon' => 'transparent.png', 'class' => 'admin_img_exit'))), 'config' => array('title' => $txt['admin_config'], 'permission' => array('admin_forum'), 'areas' => array('corefeatures' => array('label' => $txt['core_settings_title'], 'file' => 'CoreFeatures.controller.php', 'controller' => 'CoreFeatures_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_corefeatures'), 'featuresettings' => array('label' => $txt['modSettings_title'], 'file' => 'ManageFeatures.controller.php', 'controller' => 'ManageFeatures_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_features', 'subsections' => array('basic' => array($txt['mods_cat_features']), 'layout' => array($txt['mods_cat_layout']), 'pmsettings' => array($txt['personal_messages']), 'karma' => array($txt['karma'], 'enabled' => in_array('k', $context['admin_features'])), 'likes' => array($txt['likes'], 'enabled' => in_array('l', $context['admin_features'])), 'mention' => array($txt['mention']), 'sig' => array($txt['signature_settings_short']), 'profile' => array($txt['custom_profile_shorttitle'], 'enabled' => in_array('cp', $context['admin_features'])))), 'serversettings' => array('label' => $txt['admin_server_settings'], 'file' => 'ManageServer.controller.php', 'controller' => 'ManageServer_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_server', 'subsections' => array('general' => array($txt['general_settings']), 'database' => array($txt['database_paths_settings']), 'cookie' => array($txt['cookies_sessions_settings']), 'cache' => array($txt['caching_settings']), 'loads' => array($txt['load_balancing_settings']), 'phpinfo' => array($txt['phpinfo_settings']))), 'securitysettings' => array('label' => $txt['admin_security_moderation'], 'file' => 'ManageSecurity.controller.php', 'controller' => 'ManageSecurity_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_security', 'subsections' => array('general' => array($txt['mods_cat_security_general']), 'spam' => array($txt['antispam_title']), 'badbehavior' => array($txt['badbehavior_title']), 'moderation' => array($txt['moderation_settings_short'], 'enabled' => !empty($modSettings['warning_enable'])))), 'theme' => array('label' => $txt['theme_admin'], 'file' => 'ManageThemes.controller.php', 'controller' => 'ManageThemes_Controller', 'function' => 'action_index', 'custom_url' => $scripturl . '?action=admin;area=theme', 'icon' => 'transparent.png', 'class' => 'admin_img_themes', 'subsections' => array('admin' => array($txt['themeadmin_admin_title']), 'list' => array($txt['themeadmin_list_title']), 'reset' => array($txt['themeadmin_reset_title']), 'themelist' => array($txt['themeadmin_edit_title'], 'active' => array('edit', 'browse')), 'edit' => array($txt['themeadmin_edit_title'], 'enabled' => false), 'browse' => array($txt['themeadmin_edit_title'], 'enabled' => false))), 'current_theme' => array('label' => $txt['theme_current_settings'], 'file' => 'ManageThemes.controller.php', 'controller' => 'ManageThemes_Controller', 'function' => 'action_index', 'custom_url' => $scripturl . '?action=admin;area=theme;sa=list;th=' . $settings['theme_id'], 'icon' => 'transparent.png', 'class' => 'admin_img_current_theme'), 'languages' => array('label' => $txt['language_configuration'], 'file' => 'ManageLanguages.controller.php', 'controller' => 'ManageLanguages_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_languages', 'subsections' => array('edit' => array($txt['language_edit']), 'settings' => array($txt['language_settings']))), 'addonsettings' => array('label' => $txt['admin_modifications'], 'file' => 'AddonSettings.controller.php', 'controller' => 'AddonSettings_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_modifications', 'subsections' => array('general' => array($txt['mods_cat_modifications_misc']))))), 'layout' => array('title' => $txt['layout_controls'], 'permission' => array('manage_boards', 'admin_forum', 'manage_smileys', 'manage_attachments', 'moderate_forum'), 'areas' => array('manageboards' => array('label' => $txt['admin_boards'], 'file' => 'ManageBoards.controller.php', 'controller' => 'ManageBoards_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_boards', 'permission' => array('manage_boards'), 'subsections' => array('main' => array($txt['boardsEdit']), 'newcat' => array($txt['mboards_new_cat']), 'settings' => array($txt['settings'], 'admin_forum'))), 'postsettings' => array('label' => $txt['manageposts'], 'file' => 'ManagePosts.controller.php', 'controller' => 'ManagePosts_Controller', 'function' => 'action_index', 'permission' => array('admin_forum'), 'icon' => 'transparent.png', 'class' => 'admin_img_posts', 'subsections' => array('posts' => array($txt['manageposts_settings']), 'bbc' => array($txt['manageposts_bbc_settings']), 'censor' => array($txt['admin_censored_words']), 'topics' => array($txt['manageposts_topic_settings']))), 'smileys' => array('label' => $txt['smileys_manage'], 'file' => 'ManageSmileys.controller.php', 'controller' => 'ManageSmileys_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_smiley', 'permission' => array('manage_smileys'), 'subsections' => array('editsets' => array($txt['smiley_sets']), 'addsmiley' => array($txt['smileys_add'], 'enabled' => !empty($modSettings['smiley_enable'])), 'editsmileys' => array($txt['smileys_edit'], 'enabled' => !empty($modSettings['smiley_enable'])), 'setorder' => array($txt['smileys_set_order'], 'enabled' => !empty($modSettings['smiley_enable'])), 'editicons' => array($txt['icons_edit_message_icons'], 'enabled' => !empty($modSettings['messageIcons_enable'])), 'settings' => array($txt['settings']))), 'manageattachments' => array('label' => $txt['attachments_avatars'], 'file' => 'ManageAttachments.controller.php', 'controller' => 'ManageAttachments_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_attachment', 'permission' => array('manage_attachments'), 'subsections' => array('browse' => array($txt['attachment_manager_browse']), 'attachments' => array($txt['attachment_manager_settings']), 'avatars' => array($txt['attachment_manager_avatar_settings']), 'attachpaths' => array($txt['attach_directories']), 'maintenance' => array($txt['attachment_manager_maintenance']))), 'managesearch' => array('label' => $txt['manage_search'], 'file' => 'ManageSearch.controller.php', 'controller' => 'ManageSearch_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_search', 'permission' => array('admin_forum'), 'subsections' => array('weights' => array($txt['search_weights']), 'method' => array($txt['search_method']), 'managesphinx' => array($txt['search_sphinx']), 'settings' => array($txt['settings']))), 'managecalendar' => array('label' => $txt['manage_calendar'], 'file' => 'ManageCalendar.controller.php', 'controller' => 'ManageCalendar_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_calendar', 'permission' => array('admin_forum'), 'enabled' => in_array('cd', $context['admin_features']), 'subsections' => array('holidays' => array($txt['manage_holidays'], 'admin_forum', 'enabled' => !empty($modSettings['cal_enabled'])), 'settings' => array($txt['calendar_settings'], 'admin_forum'))), 'managedrafts' => array('label' => $txt['manage_drafts'], 'file' => 'ManageDrafts.controller.php', 'controller' => 'ManageDrafts_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_logs', 'permission' => array('admin_forum'), 'enabled' => in_array('dr', $context['admin_features'])))), 'members' => array('title' => $txt['admin_manage_members'], 'permission' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'manage_permissions', 'admin_forum'), 'areas' => array('viewmembers' => array('label' => $txt['admin_users'], 'file' => 'ManageMembers.controller.php', 'controller' => 'ManageMembers_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_members', 'permission' => array('moderate_forum'), 'subsections' => array('all' => array($txt['view_all_members']), 'search' => array($txt['mlist_search']))), 'membergroups' => array('label' => $txt['admin_groups'], 'file' => 'ManageMembergroups.controller.php', 'controller' => 'ManageMembergroups_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_membergroups', 'permission' => array('manage_membergroups'), 'subsections' => array('index' => array($txt['membergroups_edit_groups'], 'manage_membergroups'), 'add' => array($txt['membergroups_new_group'], 'manage_membergroups'), 'settings' => array($txt['settings'], 'admin_forum'))), 'permissions' => array('label' => $txt['edit_permissions'], 'file' => 'ManagePermissions.controller.php', 'controller' => 'ManagePermissions_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_permissions', 'permission' => array('manage_permissions'), 'subsections' => array('index' => array($txt['permissions_groups'], 'manage_permissions'), 'board' => array($txt['permissions_boards'], 'manage_permissions'), 'profiles' => array($txt['permissions_profiles'], 'manage_permissions'), 'postmod' => array($txt['permissions_post_moderation'], 'manage_permissions', 'enabled' => $modSettings['postmod_active']), 'settings' => array($txt['settings'], 'admin_forum'))), 'ban' => array('label' => $txt['ban_title'], 'file' => 'ManageBans.controller.php', 'controller' => 'ManageBans_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_ban', 'permission' => 'manage_bans', 'subsections' => array('list' => array($txt['ban_edit_list']), 'add' => array($txt['ban_add_new']), 'browse' => array($txt['ban_trigger_browse']), 'log' => array($txt['ban_log']))), 'regcenter' => array('label' => $txt['registration_center'], 'file' => 'ManageRegistration.controller.php', 'controller' => 'ManageRegistration_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_regcenter', 'permission' => array('admin_forum', 'moderate_forum'), 'subsections' => array('register' => array($txt['admin_browse_register_new'], 'moderate_forum'), 'agreement' => array($txt['registration_agreement'], 'admin_forum'), 'reservednames' => array($txt['admin_reserved_set'], 'admin_forum'), 'settings' => array($txt['settings'], 'admin_forum'))), 'sengines' => array('label' => $txt['search_engines'], 'enabled' => in_array('sp', $context['admin_features']), 'file' => 'ManageSearchEngines.controller.php', 'controller' => 'ManageSearchEngines_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_engines', 'permission' => 'admin_forum', 'subsections' => array('stats' => array($txt['spider_stats']), 'logs' => array($txt['spider_logs']), 'spiders' => array($txt['spiders']), 'settings' => array($txt['settings']))), 'paidsubscribe' => array('label' => $txt['paid_subscriptions'], 'enabled' => in_array('ps', $context['admin_features']), 'file' => 'ManagePaid.controller.php', 'controller' => 'ManagePaid_Controller', 'icon' => 'transparent.png', 'class' => 'admin_img_paid', 'function' => 'action_index', 'permission' => 'admin_forum', 'subsections' => array('view' => array($txt['paid_subs_view']), 'settings' => array($txt['settings']))))), 'maintenance' => array('title' => $txt['admin_maintenance'], 'permission' => array('admin_forum'), 'areas' => array('maintain' => array('label' => $txt['maintain_title'], 'file' => 'Maintenance.controller.php', 'controller' => 'Maintenance_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_maintain', 'subsections' => array('routine' => array($txt['maintain_sub_routine'], 'admin_forum'), 'database' => array($txt['maintain_sub_database'], 'admin_forum'), 'members' => array($txt['maintain_sub_members'], 'admin_forum'), 'topics' => array($txt['maintain_sub_topics'], 'admin_forum'), 'hooks' => array($txt['maintain_sub_hooks_list'], 'admin_forum'), 'attachments' => array($txt['maintain_sub_attachments'], 'admin_forum'))), 'logs' => array('label' => $txt['logs'], 'file' => 'AdminLog.controller.php', 'controller' => 'AdminLog_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_logs', 'subsections' => array('errorlog' => array($txt['errlog'], 'admin_forum', 'enabled' => !empty($modSettings['enableErrorLogging']), 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc'), 'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])), 'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])), 'banlog' => array($txt['ban_log'], 'manage_bans'), 'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => in_array('sp', $context['admin_features'])), 'tasklog' => array($txt['scheduled_log'], 'admin_forum'), 'badbehaviorlog' => array($txt['badbehavior_log'], 'admin_forum', 'enabled' => !empty($modSettings['badbehavior_enabled']), 'url' => $scripturl . '?action=admin;area=logs;sa=badbehaviorlog;desc'), 'pruning' => array($txt['pruning_title'], 'admin_forum'))), 'scheduledtasks' => array('label' => $txt['maintain_tasks'], 'file' => 'ManageScheduledTasks.controller.php', 'controller' => 'ManageScheduledTasks_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_scheduled', 'subsections' => array('tasks' => array($txt['maintain_tasks'], 'admin_forum'), 'tasklog' => array($txt['scheduled_log'], 'admin_forum'))), 'mailqueue' => array('label' => $txt['mailqueue_title'], 'file' => 'ManageMail.controller.php', 'controller' => 'ManageMail_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_mail', 'subsections' => array('browse' => array($txt['mailqueue_browse'], 'admin_forum'), 'settings' => array($txt['mailqueue_settings'], 'admin_forum'))), 'reports' => array('enabled' => in_array('rg', $context['admin_features']), 'label' => $txt['generate_reports'], 'file' => 'Reports.controller.php', 'controller' => 'Reports_Controller', 'function' => 'action_index', 'icon' => 'transparent.png', 'class' => 'admin_img_reports'), 'repairboards' => array('label' => $txt['admin_repair'], 'file' => 'RepairBoards.controller.php', 'controller' => 'RepairBoards_Controller', 'function' => 'action_repairboards', 'select' => 'maintain', 'hidden' => true)))); // Any files to include for administration? call_integration_include_hook('integrate_admin_include'); $menuOptions = array('hook' => 'admin', 'default_include_dir' => ADMINDIR); // Actually create the menu! $admin_include_data = createMenu($admin_areas, $menuOptions); unset($admin_areas); // Nothing valid? if ($admin_include_data == false) { fatal_lang_error('no_access', false); } // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=admin', 'name' => $txt['admin_center']); if (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index') { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'name' => $admin_include_data['label']); } if (!empty($admin_include_data['current_subsection']) && $admin_include_data['subsections'][$admin_include_data['current_subsection']][0] != $admin_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $admin_include_data['current_area'] . ';sa=' . $admin_include_data['current_subsection'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']][0]); } // Make a note of the Unique ID for this menu. $context['admin_menu_id'] = $context['max_menu_id']; $context['admin_menu_name'] = 'menu_data_' . $context['admin_menu_id']; // Where in the admin are we? $context['admin_area'] = $admin_include_data['current_area']; // Now - finally - call the right place! if (isset($admin_include_data['file'])) { require_once $admin_include_data['file']; } callMenu($admin_include_data); }
function ShowHelp() { global $settings, $user_info, $language, $context, $txt, $sourcedir, $options, $scripturl; loadTemplate('Help'); loadLanguage('Manual'); $manual_areas = array('getting_started' => array('title' => $txt['manual_category_getting_started'], 'description' => '', 'areas' => array('introduction' => array('label' => $txt['manual_section_intro'], 'template' => 'manual_intro'), 'main_menu' => array('label' => $txt['manual_section_main_menu'], 'template' => 'manual_main_menu'), 'board_index' => array('label' => $txt['manual_section_board_index'], 'template' => 'manual_board_index'), 'message_view' => array('label' => $txt['manual_section_message_view'], 'template' => 'manual_message_view'), 'topic_view' => array('label' => $txt['manual_section_topic_view'], 'template' => 'manual_topic_view'))), 'registering' => array('title' => $txt['manual_category_registering'], 'description' => '', 'areas' => array('when_how' => array('label' => $txt['manual_section_when_how_register'], 'template' => 'manual_when_how_register'), 'registration_screen' => array('label' => $txt['manual_section_registration_screen'], 'template' => 'manual_registration_screen'), 'activating_account' => array('label' => $txt['manual_section_activating_account'], 'template' => 'manual_activating_account'), 'logging_in' => array('label' => $txt['manual_section_logging_in_out'], 'template' => 'manual_logging_in_out'), 'password_reminders' => array('label' => $txt['manual_section_password_reminders'], 'template' => 'manual_password_reminders'))), 'profile_features' => array('title' => $txt['manual_category_profile_features'], 'description' => '', 'areas' => array('profile_info' => array('label' => $txt['manual_section_profile_info'], 'template' => 'manual_profile_info_summary', 'description' => $txt['manual_entry_profile_info_desc'], 'subsections' => array('summary' => array($txt['manual_entry_profile_info_summary'], 'template' => 'manual_profile_info_summary'), 'posts' => array($txt['manual_entry_profile_info_posts'], 'template' => 'manual_profile_info_posts'), 'stats' => array($txt['manual_entry_profile_info_stats'], 'template' => 'manual_profile_info_stats'))), 'modify_profile' => array('label' => $txt['manual_section_modify_profile'], 'template' => 'manual_modify_profile_settings', 'description' => $txt['manual_entry_modify_profile_desc'], 'subsections' => array('settings' => array($txt['manual_entry_modify_profile_settings'], 'template' => 'manual_modify_profile_settings'), 'forum' => array($txt['manual_entry_modify_profile_forum'], 'template' => 'manual_modify_profile_forum'), 'look' => array($txt['manual_entry_modify_profile_look'], 'template' => 'manual_modify_profile_look'), 'auth' => array($txt['manual_entry_modify_profile_auth'], 'template' => 'manual_modify_profile_auth'), 'notify' => array($txt['manual_entry_modify_profile_notify'], 'template' => 'manual_modify_profile_notify'), 'pm' => array($txt['manual_entry_modify_profile_pm'], 'template' => 'manual_modify_profile_pm'), 'buddies' => array($txt['manual_entry_modify_profile_buddies'], 'template' => 'manual_modify_profile_buddies'), 'groups' => array($txt['manual_entry_modify_profile_groups'], 'template' => 'manual_modify_profile_groups'))), 'actions' => array('label' => $txt['manual_section_profile_actions'], 'template' => 'manual_profile_actions_subscriptions', 'description' => $txt['manual_entry_modify_profile_desc'], 'subsections' => array('subscriptions' => array($txt['manual_entry_profile_actions_subscriptions'], 'template' => 'manual_profile_actions_subscriptions'), 'delete' => array($txt['manual_entry_profile_actions_delete'], 'template' => 'manual_profile_actions_delete'))))), 'posting_basics' => array('title' => $txt['manual_category_posting_basics'], 'description' => '', 'areas' => array('posting_topics' => array('label' => $txt['manual_section_posting_topics'], 'template' => 'manual_posting_topics'), 'smileys' => array('label' => $txt['manual_section_smileys'], 'template' => 'manual_smileys'), 'bbcode' => array('label' => $txt['manual_section_bbcode'], 'template' => 'manual_bbcode'))), 'personal_messages' => array('title' => $txt['manual_category_personal_messages'], 'description' => '', 'areas' => array('messages' => array('label' => $txt['manual_section_pm_messages'], 'template' => 'manual_pm_messages'))), 'forum_tools' => array('title' => $txt['manual_category_forum_tools'], 'description' => '', 'areas' => array('searching' => array('label' => $txt['manual_section_searching'], 'template' => 'manual_searching')))); // Set a few options for the menu. $menu_options = array('disable_url_session_check' => true); require_once $sourcedir . '/Subs-Menu.php'; $manual_area_data = createMenu($manual_areas, $menu_options); unset($manual_areas); // Make a note of the Unique ID for this menu. $context['manual_menu_id'] = $context['max_menu_id']; $context['manual_menu_name'] = 'menu_data_' . $context['manual_menu_id']; // Get the selected item. $context['manual_area_data'] = $manual_area_data; $context['menu_item_selected'] = $manual_area_data['current_area']; // Set a title and description for the tab strip if subsections are present. if (isset($context['manual_area_data']['subsections'])) { $context[$context['manual_menu_name']]['tab_data'] = array('title' => $manual_area_data['label'], 'description' => isset($manual_area_data['description']) ? $manual_area_data['description'] : ''); } // Bring it on! $context['sub_template'] = isset($manual_area_data['current_subsection'], $manual_area_data['subsections'][$manual_area_data['current_subsection']]['template']) ? $manual_area_data['subsections'][$manual_area_data['current_subsection']]['template'] : $manual_area_data['template']; $context['page_title'] = $manual_area_data['label'] . ' - ' . $txt['manual_smf_user_help']; // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=help', 'name' => $txt['help']); if (isset($manual_area_data['current_area']) && $manual_area_data['current_area'] != 'index') { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $manual_area_data['current_area'], 'name' => $manual_area_data['label']); } if (!empty($manual_area_data['current_subsection']) && $manual_area_data['subsections'][$manual_area_data['current_subsection']][0] != $manual_area_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=admin;area=' . $manual_area_data['current_area'] . ';sa=' . $manual_area_data['current_subsection'], 'name' => $manual_area_data['subsections'][$manual_area_data['current_subsection']][0]); } // We actually need a special style sheet for help ;) $context['template_layers'][] = 'manual'; // The smiley info page needs some cheesy information. if ($manual_area_data['current_area'] == 'smileys') { ShowSmileyHelp(); } }
function createQuestion($atom) { // choose a random key from the atom array $question = array_rand($atom); ?> <fieldset> <legend>Your challenge</legend> <form method="get"> <h3>What is the symbol for <?php echo $atom[$question]; ?> ?</h3> <input type="hidden" name="question" value="<?php echo $question; ?> "/> <?php createMenu($atom, "answer"); ?> <input class="right" name="go" type="submit" value="I got this!"/> </form> </fieldset> <?php }
/** * A menu to easily access different areas of the PM section * * @param string $area */ function messageIndexBar($area) { global $txt, $context, $scripturl, $modSettings, $user_info; require_once SUBSDIR . '/Menu.subs.php'; $pm_areas = array('folders' => array('title' => $txt['pm_messages'], 'counter' => 'unread_messages', 'areas' => array('inbox' => array('label' => $txt['inbox'], 'custom_url' => $scripturl . '?action=pm', 'counter' => 'unread_messages'), 'send' => array('label' => $txt['new_message'], 'custom_url' => $scripturl . '?action=pm;sa=send', 'permission' => 'pm_send'), 'sent' => array('label' => $txt['sent_items'], 'custom_url' => $scripturl . '?action=pm;f=sent'), 'drafts' => array('label' => $txt['drafts_show'], 'custom_url' => $scripturl . '?action=pm;sa=showpmdrafts', 'permission' => 'pm_draft', 'enabled' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled'])))), 'labels' => array('title' => $txt['pm_labels'], 'counter' => 'labels_unread_total', 'areas' => array()), 'actions' => array('title' => $txt['pm_actions'], 'areas' => array('search' => array('label' => $txt['pm_search_bar_title'], 'custom_url' => $scripturl . '?action=pm;sa=search'), 'prune' => array('label' => $txt['pm_prune'], 'custom_url' => $scripturl . '?action=pm;sa=prune'))), 'pref' => array('title' => $txt['pm_preferences'], 'areas' => array('manlabels' => array('label' => $txt['pm_manage_labels'], 'custom_url' => $scripturl . '?action=pm;sa=manlabels'), 'manrules' => array('label' => $txt['pm_manage_rules'], 'custom_url' => $scripturl . '?action=pm;sa=manrules'), 'settings' => array('label' => $txt['pm_settings'], 'custom_url' => $scripturl . '?action=pm;sa=settings')))); // Handle labels. $label_counters = array('unread_messages' => $context['labels'][-1]['unread_messages']); if (empty($context['currently_using_labels'])) { unset($pm_areas['labels']); } else { // Note we send labels by id as it will have less problems in the querystring. $label_counters['labels_unread_total'] = 0; foreach ($context['labels'] as $label) { if ($label['id'] == -1) { continue; } // Count the amount of unread items in labels. $label_counters['labels_unread_total'] += $label['unread_messages']; // Add the label to the menu. $pm_areas['labels']['areas']['label' . $label['id']] = array('label' => $label['name'], 'custom_url' => $scripturl . '?action=pm;l=' . $label['id'], 'counter' => 'label' . $label['id'], 'messages' => $label['messages']); $label_counters['label' . $label['id']] = $label['unread_messages']; } } // Do we have a limit on the amount of messages we can keep? if (!empty($context['message_limit'])) { $bar = round($user_info['messages'] * 100 / $context['message_limit'], 1); $context['limit_bar'] = array('messages' => $user_info['messages'], 'allowed' => $context['message_limit'], 'percent' => $bar, 'bar' => $bar > 100 ? 100 : (int) $bar, 'text' => sprintf($txt['pm_currently_using'], $user_info['messages'], $bar)); } // Set a few options for the menu. $menuOptions = array('current_area' => $area, 'hook' => 'pm', 'disable_url_session_check' => true, 'counters' => !empty($label_counters) ? $label_counters : 0, 'default_include_dir' => CONTROLLERDIR); // Actually create the menu! $pm_include_data = createMenu($pm_areas, $menuOptions); unset($pm_areas); // No menu means no access. if (!$pm_include_data && (!$user_info['is_guest'] || validateSession())) { fatal_lang_error('no_access', false); } // Make a note of the Unique ID for this menu. $context['pm_menu_id'] = $context['max_menu_id']; $context['pm_menu_name'] = 'menu_data_' . $context['pm_menu_id']; // Set the selected item. $context['menu_item_selected'] = $pm_include_data['current_area']; // Grab the file needed for this action if (isset($pm_include_data['file'])) { require_once $pm_include_data['file']; } // Set the template for this area and add the profile layer. if (!isset($_REQUEST['xml'])) { $template_layers = Template_Layers::getInstance(); $template_layers->add('pm'); } }
function createMenu($parent = 0, $level = 0) { if ($level >= 3) { return false; } // toma el listado de páginas $pages = get_pages(array('parent' => $parent, 'sort_order' => 'ASC', 'sort_column' => 'menu_order')); $len = count($pages); if ($len > 0) { // dibuja la lista del menu ?> <ul class="<?php echo 'level_' . $level; ?> "><?php $last_index = $len - 1; // indice del último elemento del nivel $active_id = get_the_ID(); // id de la página activa $i = 0; // recorre la lista de páginas foreach ($pages as $page) { // tova las variables configurables de cáda págia $vars = get_post_custom($page->ID); // agrega las clases de estilo $clases = array(); $clases[] = 'level_' . $level; $clases[] = $i == 0 ? 'first' : ($i == $last_index ? 'last' : 'middle'); //$clases[]= ($i%2)==0? 'par': 'non'; if ($active_id == $page->ID) { $clases[] = 'active'; } if (isset($vars['link-class'])) { $clases[] = implode(' ', $vars['link-class']); } // dirección final $href = isset($vars['link-href']) ? current($vars['link-href']) : get_permalink($page->ID); $target = isset($vars['link-target']) ? current($vars['link-target']) : '_self'; // dibuja la liga ?> <li class="<?php echo implode(' ', $clases); ?> "> <a href="<?php echo $href; ?> " target="<?php echo $target; ?> "><span><?php echo isset($vars['link-title']) ? $vars['link-title'][0] : $page->post_title; ?> </span></a><?php // dubuja los hijos createMenu($page->ID, $level + 1); ?> </li><?php $i++; // incremente i, para llevar la relacion de primero y ultimo, par y non } // dibuja el fin del menu ?> <li class="clearboth"></li> </ul><?php } }
<aside class="sidebar col-sm-3" role="complementary"> <ul id="folder-nav" class="nav sidebar "> <?php createMenu($dir); ?> </ul> </aside> <div class="col-md-8"> <div id="fileTitle"></div> <div id="content"> <h1>Lucid IT Solutions</h1> <h2>Knowledgebase</h2> <p>This template has a responsive menu toggling system. The menu will appear collapsed on smaller screens, and will appear non-collapsed on larger screens. When toggled using the button below, the menu will appear/disappear. On small screens, the page content will be pushed off canvas.</p>
createMenu($fullcsv, $tempJSONMenuObject, $navAppend, $listPageObjectArray); $tempFileForWrite = fopen(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_HONEYMOON, 'w') or die("can't open file"); $outputJSON = trimJSONMenuObject($json->encode($tempJSONMenuObject)); fwrite($tempFileForWrite, $outputJSON); chmod(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_HONEYMOON, 0777); if (!DEBUG_MODE && FTP_ENABLED) { ftp_to_deployment_site(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_HONEYMOON, REMOTE_INSTALL_FULL_PATH . MENU_AJAX_JSON_DIR_NAME); } if (isset($statusFile)) { fwrite($statusFile, "Finished " . MENU_FILE_NAME_HONEYMOON . "<br>"); } //End honeymoon menu //Start adults menu $tempJSONMenuObject = new MenuJSONObject("Adults Only"); $navAppend = "a"; createMenu($fullcsv, $tempJSONMenuObject, $navAppend, $listPageObjectArray); $tempFileForWrite = fopen(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_ADULTS, 'w') or die("can't open file"); $outputJSON = trimJSONMenuObject($json->encode($tempJSONMenuObject)); fwrite($tempFileForWrite, $outputJSON); chmod(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_ADULTS, 0777); if (!DEBUG_MODE && FTP_ENABLED) { ftp_to_deployment_site(PROGRAM_INSTALL_PATH . MENU_AJAX_JSON_DIR_NAME . MENU_FILE_NAME_ADULTS, REMOTE_INSTALL_FULL_PATH . MENU_AJAX_JSON_DIR_NAME); } if (isset($statusFile)) { fwrite($statusFile, "Finished " . MENU_FILE_NAME_ADULTS . "<br>"); } //End adults menu //echo $outputJSON; if (isset($statusFile)) { fwrite($statusFile, "Finished generate-js-left-nav.php<br>"); }
function ModifyProfile($post_errors = array()) { global $txt, $scripturl, $user_info, $context, $sourcedir, $user_profile, $cur_profile; global $modSettings, $memberContext, $profile_vars, $smcFunc, $post_errors, $options, $user_settings; // Don't reload this as we may have processed error strings. if (empty($post_errors)) { loadLanguage('Profile'); } loadTemplate('Profile'); require_once $sourcedir . '/Subs-Menu.php'; // Did we get the user by name... if (isset($_REQUEST['user'])) { $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); } elseif (!empty($_REQUEST['u'])) { $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); } else { $memberResult = loadMemberData($user_info['id'], false, 'profile'); } // Check if loadMemberData() has returned a valid result. if (!is_array($memberResult)) { fatal_lang_error('not_a_user', false); } // If all went well, we have a valid member ID! list($memID) = $memberResult; $context['id_member'] = $memID; $cur_profile = $user_profile[$memID]; // Let's have some information about this member ready, too. loadMemberContext($memID); $context['member'] = $memberContext[$memID]; // Is this the profile of the user himself or herself? $context['user']['is_owner'] = $memID == $user_info['id']; /* Define all the sections within the profile area! We start by defining the permission required - then SMF takes this and turns it into the relevant context ;) Possible fields: For Section: string $title: Section title. array $areas: Array of areas within this section. For Areas: string $label: Text string that will be used to show the area in the menu. string $file: Optional text string that may contain a file name that's needed for inclusion in order to display the area properly. string $custom_url: Optional href for area. string $function: Function to execute for this section. bool $enabled: Should area be shown? string $sc: Session check validation to do on save - note without this save will get unset - if set. bool $hidden: Does this not actually appear on the menu? bool $password: Whether to require the user's password in order to save the data in the area. array $subsections: Array of subsections, in order of appearance. array $permission: Array of permissions to determine who can access this area. Should contain arrays $own and $any. */ $profile_areas = array('info' => array('title' => $txt['profileInfo'], 'areas' => array('summary' => array('label' => $txt['summary'], 'file' => 'Profile-View.php', 'function' => 'summary', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'statistics' => array('label' => $txt['statPanel'], 'file' => 'Profile-View.php', 'function' => 'statPanel', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'showposts' => array('label' => $txt['showPosts'], 'file' => 'Profile-View.php', 'function' => 'showPosts', 'subsections' => array('messages' => array($txt['showMessages'], array('profile_view_own', 'profile_view_any')), 'topics' => array($txt['showTopics'], array('profile_view_own', 'profile_view_any')), 'attach' => array($txt['showAttachments'], array('profile_view_own', 'profile_view_any'))), 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'permissions' => array('label' => $txt['showPermissions'], 'file' => 'Profile-View.php', 'function' => 'showPermissions', 'permission' => array('own' => 'manage_permissions', 'any' => 'manage_permissions')), 'tracking' => array('label' => $txt['trackUser'], 'file' => 'Profile-View.php', 'function' => 'tracking', 'subsections' => array('activity' => array($txt['trackActivity'], 'moderate_forum'), 'ip' => array($txt['trackIP'], 'moderate_forum'), 'edits' => array($txt['trackEdits'], 'moderate_forum')), 'permission' => array('own' => 'moderate_forum', 'any' => 'moderate_forum')), 'viewwarning' => array('label' => $txt['profile_view_warnings'], 'enabled' => in_array('w', $context['admin_features']) && $modSettings['warning_settings'][0] == 1 && $cur_profile['warning'] && $context['user']['is_owner'] && !empty($modSettings['warning_show']), 'file' => 'Profile-View.php', 'function' => 'viewWarning', 'permission' => array('own' => 'profile_view_own', 'any' => 'issue_warning')))), 'edit_profile' => array('title' => $txt['profileEdit'], 'areas' => array('account' => array('label' => $txt['account'], 'file' => 'Profile-Modify.php', 'function' => 'account', 'enabled' => $context['user']['is_admin'] || $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'sc' => 'post', 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own', 'manage_membergroups'), 'any' => array('profile_identity_any', 'manage_membergroups'))), 'forumprofile' => array('label' => $txt['forumprofile'], 'file' => 'Profile-Modify.php', 'function' => 'forumProfile', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own', 'profile_title_own', 'profile_title_any'), 'any' => array('profile_extra_any', 'profile_title_any'))), 'theme' => array('label' => $txt['theme'], 'file' => 'Profile-Modify.php', 'function' => 'theme', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'authentication' => array('label' => $txt['authentication'], 'file' => 'Profile-Modify.php', 'function' => 'authentication', 'enabled' => !empty($modSettings['enableOpenID']) || !empty($cur_profile['openid_uri']), 'sc' => 'post', 'hidden' => empty($modSettings['enableOpenID']) && empty($cur_profile['openid_uri']), 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own'), 'any' => array('profile_identity_any'))), 'notification' => array('label' => $txt['notification'], 'file' => 'Profile-Modify.php', 'function' => 'notification', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'pmprefs' => array('label' => $txt['pmprefs'], 'file' => 'Profile-Modify.php', 'function' => 'pmprefs', 'enabled' => allowedTo(array('profile_extra_own', 'profile_extra_any')), 'sc' => 'post', 'permission' => array('own' => array('pm_read'), 'any' => array('profile_extra_any'))), 'ignoreboards' => array('label' => $txt['ignoreboards'], 'file' => 'Profile-Modify.php', 'function' => 'ignoreboards', 'enabled' => !empty($modSettings['allow_ignore_boards']), 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'lists' => array('label' => $txt['editBuddyIgnoreLists'], 'file' => 'Profile-Modify.php', 'function' => 'editBuddyIgnoreLists', 'enabled' => !empty($modSettings['enable_buddylist']) && $context['user']['is_owner'], 'sc' => 'post', 'subsections' => array('buddies' => array($txt['editBuddies']), 'ignore' => array($txt['editIgnoreList'])), 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array())), 'groupmembership' => array('label' => $txt['groupmembership'], 'file' => 'Profile-Modify.php', 'function' => 'groupMembership', 'enabled' => !empty($modSettings['show_group_membership']) && $context['user']['is_owner'], 'sc' => 'request', 'permission' => array('own' => array('profile_view_own'), 'any' => array('manage_membergroups'))))), 'profile_action' => array('title' => $txt['profileAction'], 'areas' => array('sendpm' => array('label' => $txt['profileSendIm'], 'custom_url' => $scripturl . '?action=pm;sa=send', 'permission' => array('own' => array(), 'any' => array('pm_send'))), 'issuewarning' => array('label' => $txt['profile_issue_warning'], 'enabled' => in_array('w', $context['admin_features']) && $modSettings['warning_settings'][0] == 1 && (!$context['user']['is_owner'] || $context['user']['is_admin']), 'file' => 'Profile-Actions.php', 'function' => 'issueWarning', 'permission' => array('own' => array('issue_warning'), 'any' => array('issue_warning'))), 'banuser' => array('label' => $txt['profileBanUser'], 'custom_url' => $scripturl . '?action=admin;area=ban;sa=add', 'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'permission' => array('own' => array(), 'any' => array('manage_bans'))), 'subscriptions' => array('label' => $txt['subscriptions'], 'file' => 'Profile-Actions.php', 'function' => 'subscriptions', 'enabled' => !empty($modSettings['paid_enabled']), 'permission' => array('own' => array('profile_view_own'), 'any' => array('moderate_forum'))), 'deleteaccount' => array('label' => $txt['deleteAccount'], 'file' => 'Profile-Actions.php', 'function' => 'deleteAccount', 'sc' => 'post', 'password' => true, 'permission' => array('own' => array('profile_remove_any', 'profile_remove_own'), 'any' => array('profile_remove_any'))), 'activateaccount' => array('file' => 'Profile-Actions.php', 'function' => 'activateAccount', 'sc' => 'get', 'permission' => array('own' => array(), 'any' => array('moderate_forum')))))); // Let them modify profile areas easily. call_integration_hook('integrate_profile_areas', array(&$profile_areas)); // Do some cleaning ready for the menu function. $context['password_areas'] = array(); $current_area = isset($_REQUEST['area']) ? $_REQUEST['area'] : ''; foreach ($profile_areas as $section_id => $section) { // Do a bit of spring cleaning so to speak. foreach ($section['areas'] as $area_id => $area) { // If it said no permissions that meant it wasn't valid! if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) { $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; } else { $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; } // Password required - only if not on OpenID. if (!empty($area['password'])) { $context['password_areas'][] = $area_id; } } } // Is there an updated message to show? if (isset($_GET['updated'])) { $context['profile_updated'] = $txt['profile_updated_own']; } // Set a few options for the menu. $menuOptions = array('disable_url_session_check' => true, 'current_area' => $current_area, 'extra_url_parameters' => array('u' => $context['id_member'])); // Actually create the menu! $profile_include_data = createMenu($profile_areas, $menuOptions); // No menu means no access. if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) { fatal_lang_error('no_access', false); } // Make a note of the Unique ID for this menu. $context['profile_menu_id'] = $context['max_menu_id']; $context['profile_menu_name'] = 'menu_data_' . $context['profile_menu_id']; // Set the selected item - now it's been validated. $current_area = $profile_include_data['current_area']; $context['menu_item_selected'] = $current_area; // Before we go any further, let's work on the area we've said is valid. Note this is done here just in case we every compromise the menu function in error! $context['completed_save'] = false; $security_checks = array(); $found_area = false; foreach ($profile_areas as $section_id => $section) { // Do a bit of spring cleaning so to speak. foreach ($section['areas'] as $area_id => $area) { // Is this our area? if ($current_area == $area_id) { // This can't happen - but is a security check. if (isset($section['enabled']) && $section['enabled'] == false || isset($area['enabled']) && $area['enabled'] == false) { fatal_lang_error('no_access', false); } // Are we saving data in a valid area? if (isset($area['sc']) && isset($_REQUEST['save'])) { $security_checks['session'] = $area['sc']; $context['completed_save'] = true; } // Does this require session validating? if (!empty($area['validate'])) { $security_checks['validate'] = true; } // Permissions for good measure. if (!empty($profile_include_data['permission'])) { $security_checks['permission'] = $profile_include_data['permission']; } // Either way got something. $found_area = true; } } } // Oh dear, some serious security lapse is going on here... we'll put a stop to that! if (!$found_area) { fatal_lang_error('no_access', false); } // Release this now. unset($profile_areas); // Now the context is setup have we got any security checks to carry out additional to that above? if (isset($security_checks['session'])) { checkSession($security_checks['session']); } if (isset($security_checks['validate'])) { validateSession(); } if (isset($security_checks['permission'])) { isAllowedTo($security_checks['permission']); } // File to include? if (isset($profile_include_data['file'])) { require_once $sourcedir . '/' . $profile_include_data['file']; } // Make sure that the area function does exist! if (!isset($profile_include_data['function']) || !function_exists($profile_include_data['function'])) { destroyMenu(); fatal_lang_error('no_access', false); } // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : ''), 'name' => sprintf($txt['profile_of_username'], $context['member']['name'])); if (!empty($profile_include_data['label'])) { $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], 'name' => $profile_include_data['label']); } if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0]); } // Set the template for this area and add the profile layer. $context['sub_template'] = $profile_include_data['function']; $context['template_layers'][] = 'profile'; // All the subactions that require a user password in order to validate. $check_password = $context['user']['is_owner'] && in_array($profile_include_data['current_area'], $context['password_areas']); $context['require_password'] = $check_password && empty($user_settings['openid_uri']); // If we're in wireless then we have a cut down template... if (WIRELESS && $context['sub_template'] == 'summary' && WIRELESS_PROTOCOL != 'wap') { $context['sub_template'] = WIRELESS_PROTOCOL . '_profile'; } // These will get populated soon! $post_errors = array(); $profile_vars = array(); // Right - are we saving - if so let's save the old data first. if ($context['completed_save']) { // If it's someone elses profile then validate the session. if (!$context['user']['is_owner']) { validateSession(); } // Clean up the POST variables. $_POST = htmltrim__recursive($_POST); $_POST = htmlspecialchars__recursive($_POST); if ($check_password) { // If we're using OpenID try to revalidate. if (!empty($user_settings['openid_uri'])) { require_once $sourcedir . '/Subs-OpenID.php'; smf_openID_revalidate(); } else { // You didn't even enter a password! if (trim($_POST['oldpasswrd']) == '') { $post_errors[] = 'no_password'; } // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); // Does the integration want to check passwords? $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); // Bad password!!! if (!$good_password && $user_info['passwd'] != sha1(strtolower($cur_profile['member_name']) . $_POST['oldpasswrd'])) { $post_errors[] = 'bad_password'; } // Warn other elements not to jump the gun and do custom changes! if (in_array('bad_password', $post_errors)) { $context['password_auth_failed'] = true; } } } // Change the IP address in the database. if ($context['user']['is_owner']) { $profile_vars['member_ip'] = $user_info['ip']; } // Now call the sub-action function... if ($current_area == 'activateaccount') { if (empty($post_errors)) { activateAccount($memID); } } elseif ($current_area == 'deleteaccount') { if (empty($post_errors)) { deleteAccount2($profile_vars, $post_errors, $memID); redirectexit(); } } elseif ($current_area == 'groupmembership' && empty($post_errors)) { $msg = groupMembership2($profile_vars, $post_errors, $memID); // Whatever we've done, we have nothing else to do here... redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : '')); } elseif ($current_area == 'authentication') { authentication($memID, true); } elseif (in_array($current_area, array('account', 'forumprofile', 'theme', 'pmprefs'))) { saveProfileFields(); } else { $force_redirect = true; // Ensure we include this. require_once $sourcedir . '/Profile-Modify.php'; saveProfileChanges($profile_vars, $post_errors, $memID); } // There was a problem, let them try to re-enter. if (!empty($post_errors)) { // Load the language file so we can give a nice explanation of the errors. loadLanguage('Errors'); $context['post_errors'] = $post_errors; } elseif (!empty($profile_vars)) { // If we've changed the password, notify any integration that may be listening in. if (isset($profile_vars['passwd'])) { call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); } updateMemberData($memID, $profile_vars); // What if this is the newest member? if ($modSettings['latestMember'] == $memID) { updateStats('member'); } elseif (isset($profile_vars['real_name'])) { updateSettings(array('memberlist_updated' => time())); } // If the member changed his/her birthdate, update calendar statistics. if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { updateSettings(array('calendar_updated' => time())); } // Anything worth logging? if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) { $log_changes = array(); foreach ($context['log_changes'] as $k => $v) { $log_changes[] = array('action' => $k, 'id_log' => 2, 'log_time' => time(), 'id_member' => $memID, 'ip' => $user_info['ip'], 'extra' => serialize(array_merge($v, array('applicator' => $user_info['id'])))); } $smcFunc['db_insert']('', '{db_prefix}log_actions', array('action' => 'string', 'id_log' => 'int', 'log_time' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'extra' => 'string-65534'), $log_changes, array('id_action')); } // Have we got any post save functions to execute? if (!empty($context['profile_execute_on_save'])) { foreach ($context['profile_execute_on_save'] as $saveFunc) { $saveFunc(); } } // Let them know it worked! $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); // Invalidate any cached data. cache_put_data('member_data-profile-' . $memID, null, 0); } } // Have some errors for some reason? if (!empty($post_errors)) { // Set all the errors so the template knows what went wrong. foreach ($post_errors as $error_type) { $context['modify_error'][$error_type] = true; } } elseif (!empty($profile_vars) && $context['user']['is_owner']) { redirectexit('action=profile;area=' . $current_area . ';updated'); } elseif (!empty($force_redirect)) { redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); } // Call the appropriate subaction function. $profile_include_data['function']($memID); // Set the page title if it's not already set... if (!isset($context['page_title'])) { $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); } }
<?php header("Content-type: text/html; charset=utf-8"); define("APPID", "wx3558953cf2ade643"); define("APPSECRET", "009253937b0d48367326c50423251127"); $action = isset($_GET['action']) ? $_GET['action'] : ''; //创建菜单 if ($action == "create") { echo createMenu($data); //创建菜单 } //删除菜单 if ($action == "delete") { $access_token = access_token(); echo file_get_contents("https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" . $access_token); } //获取ACCESS_TOKEN function access_token() { $access_html = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . APPID . "&secret=" . APPSECRET); $access_html = json_decode($access_html); return $access_html->access_token; } //创建菜单 function createMenu($data) { $access_token = access_token(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $access_token); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
/** * Allow the change or view of profiles. * Loads the profile menu. * * @see Action_Controller::action_index() */ public function action_index() { global $txt, $scripturl, $user_info, $context, $user_profile, $cur_profile; global $modSettings, $memberContext, $profile_vars, $post_errors, $user_settings; // Don't reload this as we may have processed error strings. if (empty($post_errors)) { loadLanguage('Profile+Drafts'); } loadTemplate('Profile'); require_once SUBSDIR . '/Menu.subs.php'; require_once SUBSDIR . '/Profile.subs.php'; $memID = currentMemberID(); $context['id_member'] = $memID; $cur_profile = $user_profile[$memID]; // Let's have some information about this member ready, too. loadMemberContext($memID); $context['member'] = $memberContext[$memID]; // Is this the profile of the user himself or herself? $context['user']['is_owner'] = $memID == $user_info['id']; /** * Define all the sections within the profile area! * We start by defining the permission required - then we take this and turn * it into the relevant context ;) * * Possible fields: * For Section: * - string $title: Section title. * - array $areas: Array of areas within this section. * * For Areas: * - string $label: Text string that will be used to show the area in the menu. * - string $file: Optional text string that may contain a file name that's needed for inclusion in order to display the area properly. * - string $custom_url: Optional href for area. * - string $function: Function to execute for this section. * - bool $enabled: Should area be shown? * - string $sc: Session check validation to do on save - note without this save will get unset - if set. * - bool $hidden: Does this not actually appear on the menu? * - bool $password: Whether to require the user's password in order to save the data in the area. * - array $subsections: Array of subsections, in order of appearance. * - array $permission: Array of permissions to determine who can access this area. Should contain arrays $own and $any. */ $profile_areas = array('info' => array('title' => $txt['profileInfo'], 'areas' => array('summary' => array('label' => $txt['summary'], 'file' => 'ProfileInfo.controller.php', 'controller' => 'ProfileInfo_Controller', 'function' => 'action_summary', 'token' => 'profile-aa%u', 'token_type' => 'get', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'statistics' => array('label' => $txt['statPanel'], 'file' => 'ProfileInfo.controller.php', 'controller' => 'ProfileInfo_Controller', 'function' => 'action_statPanel', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'showposts' => array('label' => $txt['showPosts'], 'file' => 'ProfileInfo.controller.php', 'controller' => 'ProfileInfo_Controller', 'function' => 'action_showPosts', 'subsections' => array('messages' => array($txt['showMessages'], array('profile_view_own', 'profile_view_any')), 'topics' => array($txt['showTopics'], array('profile_view_own', 'profile_view_any')), 'unwatchedtopics' => array($txt['showUnwatched'], array('profile_view_own', 'profile_view_any'), 'enabled' => $modSettings['enable_unwatch'] && $context['user']['is_owner']), 'attach' => array($txt['showAttachments'], array('profile_view_own', 'profile_view_any'))), 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'showdrafts' => array('label' => $txt['drafts_show'], 'file' => 'Draft.controller.php', 'controller' => 'Draft_Controller', 'function' => 'action_showProfileDrafts', 'enabled' => !empty($modSettings['drafts_enabled']) && $context['user']['is_owner'], 'permission' => array('own' => 'profile_view_own', 'any' => array())), 'showlikes' => array('label' => $txt['likes_show'], 'file' => 'Likes.controller.php', 'controller' => 'Likes_Controller', 'function' => 'action_showProfileLikes', 'enabled' => !empty($modSettings['likes_enabled']) && $context['user']['is_owner'], 'subsections' => array('given' => array($txt['likes_given'], array('profile_view_own')), 'received' => array($txt['likes_received'], array('profile_view_own'))), 'permission' => array('own' => 'profile_view_own', 'any' => array())), 'permissions' => array('label' => $txt['showPermissions'], 'file' => 'ProfileInfo.controller.php', 'controller' => 'ProfileInfo_Controller', 'function' => 'action_showPermissions', 'permission' => array('own' => 'manage_permissions', 'any' => 'manage_permissions')), 'history' => array('label' => $txt['history'], 'file' => 'ProfileHistory.controller.php', 'controller' => 'ProfileHistory_Controller', 'function' => 'action_index', 'subsections' => array('activity' => array($txt['trackActivity'], 'moderate_forum'), 'ip' => array($txt['trackIP'], 'moderate_forum'), 'edits' => array($txt['trackEdits'], 'moderate_forum'), 'logins' => array($txt['trackLogins'], array('profile_view_own', 'moderate_forum'))), 'permission' => array('own' => 'moderate_forum', 'any' => 'moderate_forum')), 'viewwarning' => array('label' => $txt['profile_view_warnings'], 'enabled' => in_array('w', $context['admin_features']) && !empty($modSettings['warning_enable']) && $cur_profile['warning'] && (!empty($modSettings['warning_show']) && ($context['user']['is_owner'] || $modSettings['warning_show'] == 2)), 'file' => 'ProfileInfo.controller.php', 'controller' => 'ProfileInfo_Controller', 'function' => 'action_viewWarning', 'permission' => array('own' => 'profile_view_own', 'any' => 'issue_warning')))), 'edit_profile' => array('title' => $txt['profileEdit'], 'areas' => array('account' => array('label' => $txt['account'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_account', 'enabled' => $context['user']['is_admin'] || $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'sc' => 'post', 'token' => 'profile-ac%u', 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own', 'manage_membergroups'), 'any' => array('profile_identity_any', 'manage_membergroups'))), 'forumprofile' => array('label' => $txt['forumprofile'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_forumProfile', 'sc' => 'post', 'token' => 'profile-fp%u', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own', 'profile_title_own', 'profile_title_any'), 'any' => array('profile_extra_any', 'profile_title_any'))), 'theme' => array('label' => $txt['theme'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_themepick', 'sc' => 'post', 'token' => 'profile-th%u', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'authentication' => array('label' => $txt['authentication'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_authentication', 'enabled' => !empty($modSettings['enableOpenID']) || !empty($cur_profile['openid_uri']), 'sc' => 'post', 'token' => 'profile-au%u', 'hidden' => empty($modSettings['enableOpenID']) && empty($cur_profile['openid_uri']), 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own'), 'any' => array('profile_identity_any'))), 'notification' => array('label' => $txt['notifications'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_notification', 'sc' => 'post', 'token' => 'profile-nt%u', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'contactprefs' => array('label' => $txt['contactprefs'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_pmprefs', 'enabled' => allowedTo(array('profile_extra_own', 'profile_extra_any')), 'sc' => 'post', 'token' => 'profile-pm%u', 'permission' => array('own' => array('pm_read'), 'any' => array('profile_extra_any'))), 'ignoreboards' => array('label' => $txt['ignoreboards'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_ignoreboards', 'enabled' => !empty($modSettings['allow_ignore_boards']), 'sc' => 'post', 'token' => 'profile-ib%u', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'lists' => array('label' => $txt['editBuddyIgnoreLists'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_editBuddyIgnoreLists', 'enabled' => !empty($modSettings['enable_buddylist']) && $context['user']['is_owner'], 'sc' => 'post', 'token' => 'profile-bl%u', 'subsections' => array('buddies' => array($txt['editBuddies']), 'ignore' => array($txt['editIgnoreList'])), 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array())), 'groupmembership' => array('label' => $txt['groupmembership'], 'file' => 'ProfileOptions.controller.php', 'controller' => 'ProfileOptions_Controller', 'function' => 'action_groupMembership', 'enabled' => !empty($modSettings['show_group_membership']) && $context['user']['is_owner'], 'sc' => 'request', 'token' => 'profile-gm%u', 'token_type' => 'request', 'permission' => array('own' => array('profile_view_own'), 'any' => array('manage_membergroups'))))), 'profile_action' => array('title' => $txt['profileAction'], 'areas' => array('sendpm' => array('label' => $txt['profileSendIm'], 'custom_url' => $scripturl . '?action=pm;sa=send', 'permission' => array('own' => array(), 'any' => array('pm_send'))), 'issuewarning' => array('label' => $txt['profile_issue_warning'], 'enabled' => in_array('w', $context['admin_features']) && !empty($modSettings['warning_enable']) && (!$context['user']['is_owner'] || $context['user']['is_admin']), 'file' => 'ProfileAccount.controller.php', 'controller' => 'ProfileAccount_Controller', 'function' => 'action_issuewarning', 'token' => 'profile-iw%u', 'permission' => array('own' => array(), 'any' => array('issue_warning'))), 'banuser' => array('label' => $txt['profileBanUser'], 'custom_url' => $scripturl . '?action=admin;area=ban;sa=add', 'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'permission' => array('own' => array(), 'any' => array('manage_bans'))), 'subscriptions' => array('label' => $txt['subscriptions'], 'file' => 'ProfileSubscriptions.controller.php', 'controller' => 'ProfileSubscriptions_Controller', 'function' => 'action_subscriptions', 'enabled' => !empty($modSettings['paid_enabled']), 'permission' => array('own' => array('profile_view_own'), 'any' => array('moderate_forum'))), 'deleteaccount' => array('label' => $txt['deleteAccount'], 'file' => 'ProfileAccount.controller.php', 'controller' => 'ProfileAccount_Controller', 'function' => 'action_deleteaccount', 'sc' => 'post', 'token' => 'profile-da%u', 'password' => true, 'permission' => array('own' => array('profile_remove_any', 'profile_remove_own'), 'any' => array('profile_remove_any'))), 'activateaccount' => array('file' => 'ProfileAccount.controller.php', 'controller' => 'ProfileAccount_Controller', 'function' => 'action_activateaccount', 'sc' => 'get', 'token' => 'profile-aa%u', 'permission' => array('own' => array(), 'any' => array('moderate_forum')))))); // Is there an updated message to show? if (isset($_GET['updated'])) { $context['profile_updated'] = $txt['profile_updated_own']; } // Set a few options for the menu. $menuOptions = array('disable_url_session_check' => true, 'hook' => 'profile', 'extra_url_parameters' => array('u' => $context['id_member']), 'default_include_dir' => CONTROLLERDIR); // Actually create the menu! $profile_include_data = createMenu($profile_areas, $menuOptions); unset($profile_areas); // If it said no permissions that meant it wasn't valid! if ($profile_include_data && empty($profile_include_data['permission'])) { $profile_include_data['enabled'] = false; } // No menu and guest? A warm welcome to register if (!$profile_include_data && $user_info['is_guest']) { is_not_guest(); } // No menu means no access. if (!$profile_include_data || isset($profile_include_data['enabled']) && $profile_include_data['enabled'] === false) { fatal_lang_error('no_access', false); } // Make a note of the Unique ID for this menu. $context['profile_menu_id'] = $context['max_menu_id']; $context['profile_menu_name'] = 'menu_data_' . $context['profile_menu_id']; // Set the selected item - now it's been validated. $current_area = $profile_include_data['current_area']; $context['menu_item_selected'] = $current_area; // Before we go any further, let's work on the area we've said is valid. // Note this is done here just in case we ever compromise the menu function in error! $this->_completed_save = false; $context['do_preview'] = isset($_REQUEST['preview_signature']); // Are we saving data in a valid area? if (isset($profile_include_data['sc']) && (isset($_REQUEST['save']) || $context['do_preview'])) { checkSession($profile_include_data['sc']); $this->_completed_save = true; } // Does this require session validating? if (!empty($area['validate']) || isset($_REQUEST['save']) && !$context['user']['is_owner']) { validateSession(); } // Do we need to perform a token check? if (!empty($profile_include_data['token'])) { if ($profile_include_data['token'] !== true) { $token_name = str_replace('%u', $context['id_member'], $profile_include_data['token']); } else { $token_name = 'profile-u' . $context['id_member']; } if (isset($profile_include_data['token_type']) && in_array($profile_include_data['token_type'], array('request', 'post', 'get'))) { $token_type = $profile_include_data['token_type']; } else { $token_type = 'post'; } if (isset($_REQUEST['save'])) { validateToken($token_name, $token_type); } } // Permissions for good measure. if (!empty($profile_include_data['permission'])) { isAllowedTo($profile_include_data['permission'][$context['user']['is_owner'] ? 'own' : 'any']); } // Create a token if needed. if (!empty($profile_include_data['token'])) { createToken($token_name, $token_type); $context['token_check'] = $token_name; } // Build the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : ''), 'name' => sprintf($txt['profile_of_username'], $context['member']['name'])); if (!empty($profile_include_data['label'])) { $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], 'name' => $profile_include_data['label']); } if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) { $context['linktree'][] = array('url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0]); } // Set the template for this area... if you still can :P // and add the profile layer. $context['sub_template'] = $profile_include_data['function']; Template_Layers::getInstance()->add('profile'); loadJavascriptFile('profile.js'); // All the subactions that require a user password in order to validate. $check_password = $context['user']['is_owner'] && !empty($profile_include_data['password']); $context['require_password'] = $check_password && empty($user_settings['openid_uri']); // These will get populated soon! $post_errors = array(); $profile_vars = array(); // Right - are we saving - if so let's save the old data first. if ($this->_completed_save) { // Clean up the POST variables. $_POST = htmltrim__recursive($_POST); $_POST = htmlspecialchars__recursive($_POST); if ($check_password) { // If we're using OpenID try to revalidate. if (!empty($user_settings['openid_uri'])) { require_once SUBSDIR . '/OpenID.subs.php'; $openID = new OpenID(); $openID->revalidate(); } else { // You didn't even enter a password! if (trim($_POST['oldpasswrd']) == '') { $post_errors[] = 'no_password'; } // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); // Does the integration want to check passwords? $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); // Start up the password checker, we have work to do require_once SUBSDIR . '/Auth.subs.php'; // Bad password!!! if (!$good_password && !validateLoginPassword($_POST['oldpasswrd'], $user_info['passwd'], $user_profile[$memID]['member_name'])) { $post_errors[] = 'bad_password'; } // Warn other elements not to jump the gun and do custom changes! if (in_array('bad_password', $post_errors)) { $context['password_auth_failed'] = true; } } } // Change the IP address in the database. if ($context['user']['is_owner']) { $profile_vars['member_ip'] = $user_info['ip']; } // Now call the sub-action function... if ($current_area == 'activateaccount') { if (empty($post_errors)) { require_once CONTROLLERDIR . '/ProfileAccount.controller.php'; $controller = new ProfileAccount_Controller(); $controller->action_activateaccount(); } } elseif ($current_area == 'deleteaccount') { if (empty($post_errors)) { require_once CONTROLLERDIR . '/ProfileAccount.controller.php'; $controller = new ProfileAccount_Controller(); $controller->action_deleteaccount2(); redirectexit(); } } elseif ($current_area == 'groupmembership' && empty($post_errors)) { require_once CONTROLLERDIR . '/ProfileOptions.controller.php'; $controller = new Profileoptions_Controller(); $msg = $controller->action_groupMembership2(); // Whatever we've done, we have nothing else to do here... redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : '')); } elseif ($current_area == 'authentication') { require_once CONTROLLERDIR . '/ProfileOptions.controller.php'; $controller = new ProfileOptions_Controller(); $controller->action_authentication(true); } elseif (in_array($current_area, array('account', 'forumprofile', 'theme', 'contactprefs'))) { saveProfileFields(); } else { $force_redirect = true; saveProfileChanges($profile_vars, $memID); } call_integration_hook('integrate_profile_save', array(&$profile_vars, &$post_errors, $memID)); // There was a problem, let them try to re-enter. if (!empty($post_errors)) { // Load the language file so we can give a nice explanation of the errors. loadLanguage('Errors'); $context['post_errors'] = $post_errors; } elseif (!empty($profile_vars)) { // If we've changed the password, notify any integration that may be listening in. if (isset($profile_vars['passwd'])) { call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); } updateMemberData($memID, $profile_vars); // What if this is the newest member? if ($modSettings['latestMember'] == $memID) { updateStats('member'); } elseif (isset($profile_vars['real_name'])) { updateSettings(array('memberlist_updated' => time())); } // If the member changed his/her birthdate, update calendar statistics. if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { updateSettings(array('calendar_updated' => time())); } // Anything worth logging? if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) { $log_changes = array(); foreach ($context['log_changes'] as $k => $v) { $log_changes[] = array('action' => $k, 'log_type' => 'user', 'extra' => array_merge($v, array('applicator' => $user_info['id'], 'member_affected' => $memID))); } logActions($log_changes); } // Have we got any post save functions to execute? if (!empty($context['profile_execute_on_save'])) { foreach ($context['profile_execute_on_save'] as $saveFunc) { $saveFunc(); } } // Let them know it worked! $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); // Invalidate any cached data. cache_put_data('member_data-profile-' . $memID, null, 0); } } // Have some errors for some reason? if (!empty($post_errors)) { // Set all the errors so the template knows what went wrong. foreach ($post_errors as $error_type) { $context['modify_error'][$error_type] = true; } } elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) { redirectexit('action=profile;area=' . $current_area . ';updated'); } elseif (!empty($force_redirect)) { redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); } // Let go to the right place if (isset($profile_include_data['file'])) { require_once $profile_include_data['file']; } callMenu($profile_include_data); // Set the page title if it's not already set... if (!isset($context['page_title'])) { $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); } }
if (isset($_POST['sectionCount'])) { $sectionCount = $_POST['sectionCount']; $menu = []; for ($idx = 0; $idx < $sectionCount; $idx++) { $subMenu = []; for ($idy = 0; $idy < 5; $idy++) { if (!empty($_POST[$idx . '_subName_' . $idy]) && $_POST[$idx . '_subName_' . $idy] != 'none') { $subMenu[$idy] = getCorrectSubmenu($idx, $idy); } } if (!empty($_POST[$idx . '_menu'])) { $menu[$idx] = getCorrectMainMenu($idx, $subMenu); } } $menuData = urldecode(json_encode(array('button' => $menu))); createMenu($menuData); } function createMenu($menu) { global $token; $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $token; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $menu); $res = curl_exec($ch); curl_close($ch); return $res; } function getCorrectSubmenu($idx, $idy)
<tr> <td style="padding-left:10px;padding-top:10px;vertical-align:top;"> <?php boxStart('Gruppenauswahl', 'N/A'); echo '<form action=index.php name=selectGroup style="padding:0px;margin:0px;">'; echo '<table cellpadding=0 cellspacing=0 border=0 style="width:290px;">'; //echo '<tr><td style="width:145px;text-align:left;"><div class=text-bf>Gruppenfilter:</div></td><td style="width:145px;text-align:right;"><input class=basicInput type=text name=groupfilter '; // if($this->namefilter != null) echo 'value='.$this->groupfilter; // echo '></td></tr>'; echo '<tr><td style="width:145px;text-align:left;vertical-align:middle;"><span class=text-bf>Direktauswahl</span></td><td align=right style="width:145px;height:20px;">'; if ($this->groupSelect != null) { $activeGroup = $this->groupSelect; } else { $activeGroup = ''; } createMenu('dropdown-search', 'directSelect', $this->groupList, $activeGroup, '', 100); echo '</td></tr>'; if ($this->status != null and $this->statusMsg != null) { if ($this->status == 'ok') { echo '<tr><td colspan=3><div class=apply>' . $this->statusMsg . '</div></td></tr>'; } elseif ($this->status == 'warning') { echo '<tr><td colspan=3><div class=warning>' . $this->statusMsg . '</div></td></tr>'; } } echo '<tr><td colspan=2 style="text-align:right;"><button class=basicButton name=lookUp value=true onclick="javascript:document.selectGroup.submit();">lookUp</button></td></tr>'; echo '</table>'; echo '<input type=hidden name=cmd value=lookUp>'; echo '</form>'; boxEnd(); ?> </td>
function KB_Menu() { global $total_report, $total_approvecom, $total_approve, $txt, $sourcedir, $smcFunc, $scripturl, $sc, $user_info, $modSettings, $context, $kb_menutype; //Get approve, approve comments, report counts KB_approvecounts(); KB_approvecomcounts(); KB_reportcounts(); //Add them all together $mcounts = $total_report + $total_approvecom + $total_approve; //Are we on an article? if (isset($_REQUEST['cont']) || isset($_GET['aid'])) { if (($context['knowmini'] = cache_get_data('kb_articles_menuinfo' . (isset($_GET['cont']) ? $_GET['cont'] : $_GET['aid']) . '', 3600)) === null) { //Guess so lets get some info on this article $result = $smcFunc['db_query']('', ' SELECT k.kbnid,k.id_cat,k.approved,id_member FROM {db_prefix}kb_articles AS k WHERE kbnid = {int:kbnid}', array('kbnid' => isset($_GET['cont']) ? (int) $_GET['cont'] : (int) $_GET['aid'])); $context['knowmini'] = array(); while ($row = $smcFunc['db_fetch_assoc']($result)) { $context['knowmini']['kbid'] = $row['kbnid']; $context['knowmini']['approved'] = $row['approved']; $context['knowmini']['id_cat'] = $row['id_cat']; $context['knowmini']['id_member'] = $row['id_member']; } $smcFunc['db_free_result']($result); cache_put_data('kb_articles_menuinfo' . (isset($_GET['cont']) ? $_GET['cont'] : $_GET['aid']) . '', $context['knowmini'], 3600); } } //Some menu Vars to use in menu $memid = !empty($context['knowmini']['id_member']) ? $context['knowmini']['id_member'] : 0; $category = !empty($_REQUEST['cat']) ? $_REQUEST['cat'] : 0; $category1 = !empty($context['knowmini']['id_cat']) ? $context['knowmini']['id_cat'] : 0; $cont = !empty($context['knowmini']['kbid']) ? $context['knowmini']['kbid'] : 0; $approved = !empty($context['knowmini']['approved']) ? 1 : 0; $categorynew = $category1 ? $category1 : $category; if (isset($_REQUEST['area'])) { $searchtab = $_REQUEST['area'] == 'searchmain' ? 'searchmain' : 'search'; $editcattab = $_REQUEST['area'] == 'listcat' ? 'listcat' : 'permcat'; } else { $searchtab = ''; $editcattab = ''; } //menu areas array $menuAreas = array('kb' => array('title' => $txt['kb_manage_main'], 'areas' => array('main' => array('label' => $txt['knowledgebase'], 'custom_url' => $scripturl . '?action=kb'), $searchtab => array('label' => $txt['kb_searchforform'], 'enabled' => allowedTo('search_kb') && !empty($modSettings['kb_esearch']), 'custom_url' => $scripturl . '?action=kb;area=searchmain'))), 'tools' => array('title' => $txt['kb_tool_main'], 'areas' => array('addknow' => array('label' => $txt['knowledgebasecataddedit1'], 'enabled' => KBAllowedto($categorynew, 'addarticle') || allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;area=addknow;cat=' . $categorynew), 'reporta' => array('label' => $txt['kb_reports22'], 'enabled' => allowedTo('rparticle_kb') && isset($_GET['cont']), 'custom_url' => $scripturl . '?action=kb;area=reporta;aid=' . $cont), 'unapprove' => array('label' => $txt['kb_alist2'], 'enabled' => allowedTo('manage_kb') && isset($_GET['cont']) && $approved == 1, 'custom_url' => $scripturl . '?action=kb;area=article;unapprove;inap=' . $cont . ';sesc=' . $sc . ''), 'approve' => array('label' => $txt['kb_alist1'], 'enabled' => allowedTo('manage_kb') && isset($_GET['cont']) && $approved == 0, 'custom_url' => $scripturl . '?action=kb;area=article;approve;aid=' . $cont . ';sesc=' . $sc . ''), 'delete' => array('label' => $txt['knowledgebase_del'], 'enabled' => KBAllowedto($category1, 'delanyarticle') && isset($_GET['cont']) || KBAllowedto($category1, 'delarticle') && $memid == $user_info['id'] && isset($_GET['cont']), 'custom_url' => $scripturl . '?action=kb;area=del;et=' . $cont . ';sesc=' . $sc . '" onclick="return confirm(\'' . $txt['knowledgebaseeditedsure'] . '\'); '), 'edit' => array('label' => $txt['knowledgebase_edit'], 'enabled' => KBAllowedto($category1, 'editanyarticle') && isset($_GET['cont']) || KBAllowedto($category1, 'editarticle') && $memid == $user_info['id'] && isset($_GET['cont']), 'custom_url' => $scripturl . '?action=kb;area=edit;aid=' . $cont), 'print' => array('label' => $txt['kb_print'], 'enabled' => isset($_GET['cont']), 'custom_url' => $scripturl . '?action=kb;area=article;cont=' . $cont . ';print'))), 'manage' => array('title' => $txt['kb_manage1'], 'areas' => array('admin' => array('label' => $txt['admin'], 'enabled' => allowedTo('admin_forum'), 'custom_url' => $scripturl . '?action=admin;area=kb'), 'manage' => array('label' => $txt['kb_manage1'] . ' (' . $mcounts . ')', 'enabled' => allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;area=manage'), 'catadd' => array('label' => $txt['knowledgebasecatadd'], 'enabled' => allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;area=catadd'), $editcattab => array('label' => $txt['knowledgebasecataddedit'], 'enabled' => allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;area=listcat'), 'cache' => array('label' => $txt['kb_menu_cache'], 'enabled' => allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;cache_clean'), 'recounta' => array('label' => $txt['kb_menu_ra'], 'enabled' => allowedTo('manage_kb'), 'custom_url' => $scripturl . '?action=kb;article_recount'), 'recountc' => array('label' => $txt['kb_menu_rc'], 'enabled' => allowedTo('manage_kb') && !empty($modSettings['kb_ecom']), 'custom_url' => $scripturl . '?action=kb;comment_recount')))); if (!allowedTo('manage_kb')) { unset($menuAreas['manage']); } //Work out the current area $current_area = isset($_REQUEST['area']) ? $_REQUEST['area'] : 'main'; //These are needed when using toggle button if (isset($_GET['cat']) && $current_area == 'cats') { $context['current_get'] = ';cat=' . $_GET['cat']; } elseif (isset($_GET['cont']) && $current_area == 'article') { $context['current_get'] = ';cont=' . $_GET['cont']; } elseif (isset($_GET['aid']) && $current_area == 'reporta') { $context['current_get'] = ';aid=' . $_GET['aid']; } elseif (isset($_GET['cat']) && isset($_GET['aid']) && $current_area == 'edit') { $context['current_get'] = ';aid=' . $_GET['aid'] . ';cat=' . $_GET['cat']; } elseif (isset($_GET['aid']) && $current_area == 'edit') { $context['current_get'] = ';aid=' . $_GET['aid']; } elseif (isset($_GET['cat']) && $current_area == 'addknow') { $context['current_get'] = ';cat=' . $_GET['cat']; } elseif (isset($_GET['perm']) && $current_area == 'permcat') { $context['current_get'] = ';perm=' . $_GET['perm']; } elseif (isset($_GET['edit']) && $current_area == 'listcat') { $context['current_get'] = ';edit=' . $_GET['edit']; } elseif ($current_area == 'search' && isset($_REQUEST['search'])) { $context['current_get'] = ';q=' . (!empty($_SESSION['kb_search_query_encoded']) ? $_SESSION['kb_search_query_encoded'] : '') . ';sesc=' . $sc . ''; } elseif ($current_area == 'search' && isset($_REQUEST['q'])) { $context['current_get'] = ';q=' . (!empty($_SESSION['kb_search_query_encoded']) ? $_SESSION['kb_search_query_encoded'] : '') . ';sesc=' . $sc . ''; } else { $context['current_get'] = ''; } //Define our menu type $menu_type = empty($modSettings['kb_menutype']) ? '_dropdown' : '_sidebar'; //menu options array $menuOptions = array('menu_type' => $menu_type, 'disable_url_session_check' => true, 'toggle_redirect_url' => $scripturl . '?action=kb;area=' . $current_area . '' . $context['current_get'], 'toggle_url' => $scripturl . '?action=kb;area=' . $current_area . '' . $context['current_get'] . ';togglebar'); //Member Choice if ($modSettings['kb_menutype'] == 2) { unset($menuOptions['menu_type']); } require_once $sourcedir . '/Subs-Menu.php'; $kbmod_data = createMenu($menuAreas, $menuOptions); }
/** * This file is a part of administrator wechat request * to receive the data from wechat server * * @file /lib/weixin/admin/request.php * @author KavMors(kavmors@163.com) * @version 2015-2-5 */ require 'config.php'; require 'response.php'; if (isset($_GET["echostr"])) { $echoStr = $_GET["echostr"]; if (checkSignature()) { echo $echoStr; createMenu(); } } else { doPost(); } function checkSignature() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = ADMIN_TOKEN; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr); if ($tmpStr == $signature) {
<li> <span>全局</span> <ul> <?php createMenu('基本设置', './?m=site&a=Index'); createMenu('高级设置', './?m=site&a=Advanced'); createMenu('内容替换', './?m=site&a=Replace'); ?> </ul> </li> <li> <span>自定义页面</span> <ul> <?php createMenu('自定义页面', './?m=page&a=Index'); createMenu('添加自定义页面', './?m=page&a=Edit'); ?> </ul> </li> <!-- <li> <span>页面映射</span> </li> <li> <span>帮助</span> </li> --> </ul> <a id="collapsible" href="#" style="height: 300px;"> </a> </div> </div>
<div class="easyui-panel"> <div class="container"> <div id="myNavigationBar" class="row"> <div class="col-xs-9"> <div class="navbar-header"> <a class="navbar-brand" href="#" style="height:20px;padding-top:4px;padding-bottom:5px;padding-left:0px;padding-right:5px;"> <img src="images/garuda-1502x1600.png" alt="kugi" style="height:20px;width:20px"></img> </a> </div> <a href="index.php" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon icon-color icon-home'" style="padding-left:5px;padding-right:5px"><!-- ABDP CSS --> Home </a> <?php echo createMenu(); ?> <a href="#" class="easyui-menubutton" data-options="menu:'#mm1'" style="padding-left:5px;padding-right:5px"> KUGI </a> <div id="mm1"> <div data-options="iconCls:'icon icon-color icon-bullet-on'" onclick="javascript:window.location='index.php?p=URL'"> Cari </div> <div data-options="iconCls:'icon icon-color icon-bullet-on'" onclick="javascript:window.location='index.php?p=URL'"> Browse </div>
if ($counter % 2 == 0) { echo '<tr><td style="width:20px;vertical-align:middle;text-align:center;background-color:#ffffff;padding:0px;margin:0px;"><input class=basicCheckbox id=user_' . $counter . ' type=checkbox name=name' . $counter . ' value=' . $key . '></td><td style="width:100px;text-align:left;background-color:#ffffff;"><div class=searchResultItem><a href=#>' . $key . '</a></div></td><td class=text style="width:170px;background-color:#ffffff;">' . $value . '</td></tr>'; } else { echo '<tr><td style="width:20px;vertical-align:middle;text-align:center;background-color:#d7d7ff;padding:0px;margin:0px;"><input class=basicCheckbox id=user_' . $counter . ' type=checkbox name=name' . $counter . ' value=' . $key . '></td><td style="width:100px;text-align:left;background-color:#d7d7ff;"><div class=searchResultItem><a href=#>' . $key . '</a></div></td><td class=text style="width:170px;background-color:#d7d7ff;">' . $value . '</td></tr>'; } $counter++; } unset($counter); echo '<tr><td colspan=3 style=""><img src="img/one.gif" width="1" height="5"></td></tr>'; echo '<tr><td style="width:20px;vertical-align:middle;text-align:center;"><input class=basicCheckbox type=checkbox id=mainMarker onclick="javascript:markAll(' . count($this->memberlist) . ', \'user\');"></td><td style="text-align:left;"><div class=searchResultItem>alle markieren</div></td>'; echo '<tr><td colspan=3><img src="img/one.gif" width="1" height="10"></td></tr>'; echo '<tr><td colspan=2 style="text-align:left;"><div class=text-bf>Aktion wählen:</div></td><td style="width:170px;text-align:right;"><select class=basicInput style="width:165px;" name=actionSelect size=1 onclick="javascript:setVisibleMode(document.memberOrgForm.actionSelect.options[document.memberOrgForm.actionSelect.selectedIndex].value);"><option value=remove>aus Gruppe entfernen</option><option value=add>zu Gruppe hinzufügen</option><option value=move>in Gruppe verschieben</option></select></td></tr>'; //echo '<tr><td colspan=2 style="width:145px;text-align:left;"><div class=text-bf>Aktion wählen:</div></td><td style="width:145px;text-align:right;"><select class=basicInput name=actionSelect size=1><option value=remove onclick="javascript:setVisibleMode(\'remove\');">aus Gruppe entfernen</option><option value=add onclick="javascript:setVisibleMode(\'add\');">neuer Gruppe hinzufügen</option><option value=move onclick="javascript:setVisibleMode(\'move\');">verschieben</option></select></td></tr>'; echo '<tr><td colspan=3 style=""><img src="img/one.gif" width="1" height="5"></td></tr>'; echo '<tr><td colspan=2 style="text-align:left;vertical-align:middle;"><span id=moveOrAddLabel style="display:none;" class=text-bf>Gruppenauswahl:</span></td><td align=right style="text-align:right;width:145px;height:20px;"><div id=moveOrAddSelector style="display:none;">'; createMenu('dropdown-groupAction', 'targetGroup', $this->targetGroupList, '', '', 100, 160); echo '</div></td></tr>'; /* echo '<tr><td colspan=2 style="width:145px;text-align:left;"><div id=kenny1 class=text-bf style="display:none;">Zu welcher Gruppe hinzufügen?</div></td><td style="width:145px;text-align:right;"><div id=kenny2 style="display:none;"><select class=basicInput name=newGroup size=1>'; if ($this->targetGroupList != null) {foreach ($this->targetGroupList as $groupName) {echo '<option value='.$groupName.'>'.$groupName.'</option>';}} echo '</select></div></td></tr>'; echo '<tr><td colspan=2 style="width:145px;text-align:left;"><div id=kenny3 class=text-bf style="display:none;">In welche Gruppe verschieben?</div></td><td style="width:145px;text-align:right;"><div id=kenny4 style="display:none;"><select class=basicInput name=moveTarget size=1>'; if ($this->targetGroupList != null) {foreach ($this->targetGroupList as $groupName) {echo '<option value='.$groupName.'>'.$groupName.'</option>';}} echo '</select></div></td></tr>'; if ($this->status != null AND $this->statusMsg != null) { if($this->status == 'ok') echo '<tr><td colspan=3><div class=apply>'.$this->statusMsg.'</div></td></tr>'; if($this->status == 'warning') echo '<tr><td colspan=3><div class=warning>'.$this->statusMsg.'</div></td></tr>'; } */ echo '<tr><td colspan=3 style="text-align:right"><button class=basicButton name=performAction value=true onclick="javascript:document.memberOrgForm.submit();">ausführen</button></td></tr>'; echo '</table>';
function createMenu($parent = 0, $level = 0, $nm = "", $href = "#", $trgt = "_self", $a_active = "") { if ($level >= 3) { return false; } // toma el listado de páginas $pages = get_pages(array('parent' => $parent, 'sort_order' => 'ASC', 'sort_column' => 'menu_order')); $len = count($pages); if ($len > 0) { ob_start(); // dibuja la lista del menu ?> <ul class="<?php echo 'level_' . $level; ?> "> <?php if ($level > 0) { ?> <li class='back'><a href='javascript:void(0)'><span>Regresar</span></a></li> <li class='anchor <?php print $a_active; ?> '><a href="<?php print $href; ?> " target="<?php print $trgt; ?> "><span><?php echo $nm; ?> </span></a></li> <?php } $last_index = $len - 1; // indice del último elemento del nivel $active_id = get_the_ID(); // id de la página activa $i = 0; // recorre la lista de páginas foreach ($pages as $page) { // tova las variables configurables de cáda págia $vars = get_post_custom($page->ID); // agrega las clases de estilo $clases = array(); $clases[] = 'level_' . $level; $clases[] = $i == 0 ? 'first' : ($i == $last_index ? 'last' : 'middle'); //$clases[]= ($i%2)==0? 'par': 'non'; if ($active_id == $page->ID) { $clases[] = 'active'; } if (isset($vars['link-class'])) { $clases[] = implode(' ', $vars['link-class']); } // dirección final $href = isset($vars['link-href']) ? current($vars['link-href']) : get_permalink($page->ID); $target = isset($vars['link-target']) ? current($vars['link-target']) : '_self'; // dibuja la liga ?> <?php $str_tmp = trim(createMenu($page->ID, $level + 1, $page->post_title, $href, $target, $active_id == $page->ID ? "active" : "")); if (strpos($str_tmp, 'active') != false) { $clases[] = 'active'; } if ($str_tmp == "" || $page->post_title == "Cuerpo docente") { ?> <li class="<?php echo implode(' ', $clases); ?> anchor"> <a href="<?php echo $href; ?> " target="<?php echo $target; ?> "><span><?php echo isset($vars['link-mobileTitle']) ? $vars['link-mobileTitle'][0] : $page->post_title; ?> </span></a> </li> <?php // dubuja los hijos } else { ?> <li class="<?php echo implode(' ', $clases); ?> dropdown"> <a href="javascript:void(0)"><span><?php echo isset($vars['link-mobileTitle']) ? $vars['link-mobileTitle'][0] : $page->post_title; ?> </span></a> <?php print $str_tmp; ?> </li><?php } $i++; // incremente i, para llevar la relacion de primero y ultimo, par y non } // dibuja el fin del menu ?> <li class="clearboth"></li> </ul><?php $out_str = ob_get_contents(); ob_end_clean(); return $out_str; } else { return ""; } }
// We must create menu. Let's go ) $menus = $_POST['menu']; $links = $_POST['link']; $isCreated = $_POST['created']; CModule::IncludeModule('fileman'); foreach ($menus as $menuIndex => $file) { $aMenuLinks = array(); if (isset($isCreated[$menuIndex])) { foreach ($isCreated[$menuIndex] as $linkIndex => $on) { $url = $links[$menuIndex][$linkIndex]; $res = CFileman::ParseFileContent($APPLICATION->GetFileContent($_SERVER['DOCUMENT_ROOT'] . $url)); $aMenuLinks[] = array($res['TITLE'], $url, array(), array(), ""); } } // CFileman::SaveMenu($_SERVER['DOCUMENT_ROOT'].$file, $aMenuLinks); createMenu($file, $aMenuLinks); } $arResult['CREATED_OK'] = true; } function getDir($path, $filter, $recursive, &$result, $ignore) { foreach (glob($path . '/*', GLOB_ONLYDIR) as $dir) { if ($dir == '.' | $dir == '..' | ignored($dir, $ignore)) { continue; } foreach (glob($dir . '/' . $filter) as $file) { if (ignored($file, $ignore)) { continue; } $f[] = slash(str_replace($_SERVER['DOCUMENT_ROOT'], '/', $file), false); }
</tr> <tr> <td><label for="mdp">Mot de passe</label></td> <td><input id="mdp" type="password" name="mdp" value=""/></td> </tr> <tr> <td><label for="vmdp">Vérification mot de passe</label></td> <td><input id="vmdp" type="password" name="vmdp" value=""/></td> </tr> <tr> <td><label for="cg"><a href="static/CGU/CGU.pdf" target="_blank">Condition Générales</a></label></td> <td><input id="cg" type="checkbox" name="gc" value="checked"/></td> </tr> <tr> <td><label for="bds"></label></td> <td><input id="bds" type="submit" name="action" value="Submit"/></td> </tr> </table> </form> </div> <?php $liens[] = '../index.php'; $noms[] = 'accueil'; $images[] = 'static/images/favicon.svg'; createMenu($liens, $noms, $images); foot();
}, { "type":"view", "name":"合作加盟", "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx35be6cdc6a0b2ece&redirect_uri=http://www.wstreet.cn/weixin/can.php?type=9&response_type=code&scope=snsapi_base&state=1&connect_redirect=1#wechat_redirect" }, { "type":"view", "name":"关于我们", "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx35be6cdc6a0b2ece&redirect_uri=http://www.wstreet.cn/weixin/can.php?type=10&response_type=code&scope=snsapi_base&state=1&connect_redirect=1#wechat_redirect" }] }] } '; var_dump(createMenu($s)); function createMenu($data, $url = '') { $ch = curl_init(); if ($url == '') { curl_setopt($ch, CURLOPT_URL, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . ACCESS_TOKEN); } else { curl_setopt($ch, CURLOPT_URL, $url); } curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
<?php boxStart('Nach Benutzernamen suchen', 'Falls Sie den genauen Benutzernamen nicht kennen, können Sie hier eine Suche starten.'); echo '<form action=index.php name=chooseUser style="padding:0px;margin:0px;">'; echo '<table cellpadding=0 cellspacing=0 border=0 style="width:290px;">'; echo '<tr><td style="width:145px;text-align:left;"><div class=text-bf>Namensfilter:</div></td><td style="width:145px;text-align:right;"><input class=basicInput type=text name=namefilter '; if ($this->namefilter != null) { echo 'value=' . $this->namefilter; } echo '></td></tr>'; echo '<tr><td style="width:145px;text-align:left;vertical-align:middle;"><span class=text-bf>Gruppenfilter:</span></td><td align=right style="width:145px;height:20px;">'; if ($this->groupSelect != null) { $activeGroup = $this->groupSelect; } else { $activeGroup = ''; } createMenu('dropdown-search', 'groupSelect', $this->groupList, $activeGroup, array(0 => 'Gruppenlos', 1 => 'Alle_Gruppen'), 100); echo '</td></tr>'; /* echo '<tr><td style="width:145px;text-align:left;"><div class=text-bf>Gruppenfilter:</div></td><td style="width:145px;text-align:right;"><select class=basicInput name=groupSelect size=1>'; if ($this->groupList != null) { foreach ($this->groupList as $groupName) { if($this->groupSelect != null AND $this->groupSelect == $groupName) echo '<option selected>'.$groupName.'</option>'; else echo '<option>'.$groupName.'</option>'; } } echo '</select></td></tr>'; */ echo '<tr><td colspan=2 style="text-align:right;"><button class=basicButton name=userSearch value=true onclick="javascript:document.chooseUser.submit();">suchen</button></td></tr>'; echo '</table>';
function text($data) { if ($data['Content'] == '功能演示') { // replyText("这是文本消息处理钩子里设置的文本回复"); } if ($data['Content'] == '微捐赠') { // replyText('weijuanz'); } if ($data['Content'] == 'jssdk' || $data['Content'] == 'demo' || $data['Content'] == '功能演示') { $params['token'] = get_token(); $jump_url = addons_url('Example://Example/demo', $params); replyText('<a href="' . $jump_url . '">功能演示</a>'); } if ($data['Content'] == '获取消息数组') { $revData = getRevData(); replyText('消息数组:' . json_encode($revData)); } if ($data['Content'] == '获取用户ID') { $revFrom = getRevFrom(); replyText('用户id是:' . $revFrom); } if ($data['Content'] == '获取公众号ID') { $revTo = getRevTo(); replyText('公众号id是:' . $revTo); } if ($data['Content'] == '获取消息类型') { $revType = getRevType(); replyText('你发送的消息类型是:' . $revType); } if ($data['Content'] == '获取消息ID') { $revId = getRevId(); replyText('你发送的消息ID是:' . $revId); } if ($data['Content'] == '获取消息发送时间') { $revCtime = getRevCtime(); replyText('你发送的消息发送时间是:' . $revCtime); } if ($data['Content'] == '获取消息内容') { $revContent = getRevContent(); replyText('你发送的消息内容是:' . $revContent); } if ($data['Content'] == '回复文本') { replyText("这是文本回复"); } if ($data['Content'] == '回复单图文') { $articles[0] = array('Title' => '单图文消息标题', 'Description' => '单图文消息描述', 'PicUrl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'Url' => 'http://idouly.com/wenda/'); replyNews($articles); } if ($data['Content'] == '回复多图文') { $articles[0] = array('Title' => '单图文消息标题1', 'Description' => '单图文消息描述1', 'PicUrl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'Url' => 'http://idouly.com/wenda/'); $articles[1] = array('Title' => '单图文消息标题2', 'Description' => '单图文消息描述2', 'PicUrl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'Url' => 'http://idouly.com/wenda/'); $articles[2] = array('Title' => '单图文消息标题3', 'Description' => '单图文消息描述3', 'PicUrl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'Url' => 'http://idouly.com/wenda/'); $articles[3] = array('Title' => '单图文消息标题4', 'Description' => '单图文消息描述4', 'PicUrl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'Url' => 'http://idouly.com/wenda/'); replyNews($articles); } if ($data['Content'] == '回复音乐') { replyMusic('我的歌声里', '曲婉婷', 'http://yinyueshiting.baidu.com/data2/music/5a5631832313a6007da895d12994e311/255967781/255704757248400128.mp3?xcode=67dd7bdbf2d520d5bd5cc648288db746'); } if ($data['Content'] == '转接客服') { transferCustomerService(); } if ($data['Content'] == '获取菜单') { $menu = getMenu(); replyText(json_encode($menu)); } if ($data['Content'] == '删除菜单') { if (deleteMenu()) { replyText('删除菜单成功'); } } if ($data['Content'] == '创建菜单') { $btn1 = array('name' => 'button1', 'type' => 'click', 'key' => 'button1_key'); $data['button'][0] = $btn1; if (createMenu($data)) { replyText('创建菜单成功'); } else { replyText('创建菜单失败'); } } if ($data['Content'] == '发送模板消息') { $temp_data['touser'] = getRevFrom(); $temp_data['template_id'] = 'A93dk7bWn9W4oSvM7UcXm95X-WehNeLeegRq4RaKF8g'; $temp_data['url'] = 'http://idouly.com/wenda/'; $temp_data['topcolor'] = '#44b549'; $temp_data['data']['first']['value'] = '有新的用户捐赠,请注意查收'; $temp_data['data']['first']['color'] = '#da4224'; $temp_data['data']['keyword1']['value'] = '用户捐赠通知'; $temp_data['data']['keyword1']['color'] = '#0baae4'; $temp_data['data']['keyword2']['value'] = '2015年1月7日'; $temp_data['data']['keyword2']['color'] = '#0baae4'; $temp_data['data']['remark']['value'] = '用户昵称:艾逗笔,捐赠额:66元'; $temp_data['data']['remark']['color'] = '#333'; //replyText(json_encode($temp_data)); sendTemplateMessage($temp_data); // replyText(json_encode($temp_data)); exit; } if ($data['Content'] == '发送文本客服消息') { $kf_data['touser'] = getRevFrom(); $kf_data['msgtype'] = 'text'; $kf_data['text']['content'] = '你好啊,亲~'; //replyText(json_encode($kf_data)); sendCustomMessage($kf_data); exit; } if ($data['Content'] == '发送图文客服消息') { $articles[0] = array('title' => '单图文消息标题1', 'description' => '单图文消息描述1', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'url' => 'http://idouly.com/wenda/'); $articles[1] = array('title' => '单图文消息标题2', 'description' => '单图文消息描述2', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'url' => 'http://idouly.com/wenda/'); $articles[2] = array('title' => '单图文消息标题3', 'description' => '单图文消息描述3', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'url' => 'http://idouly.com/wenda/'); $articles[3] = array('title' => '单图文消息标题4', 'description' => '单图文消息描述4', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/bcPR8rBzAQhibbpsMEC1WOYIaD1l85XJRWCoricvUnfricBXO9eIuPEJgB2EsucewMYWjE3dLxohzINoxoaD6R6aA/0?wx_fmt=jpeg', 'url' => 'http://idouly.com/wenda/'); $kf_data['touser'] = getRevFrom(); $kf_data['msgtype'] = 'news'; $kf_data['news']['articles'] = $articles; //replyText(json_encode($kf_data)); sendCustomMessage($kf_data); exit; } if ($data['Content'] == '获取二维码') { $qrCode = getQRCode(88, 2); replyText(json_encode($qrCode)); } }
/** * A menu to easily access different areas of the PM section * * @param string $area */ function messageIndexBar($area) { global $txt, $context, $scripturl, $sourcedir, $sc, $modSettings, $settings, $user_info, $options; $pm_areas = array('folders' => array('title' => $txt['pm_messages'], 'areas' => array('send' => array('label' => $txt['new_message'], 'custom_url' => $scripturl . '?action=pm;sa=send', 'permission' => allowedTo('pm_send')), 'inbox' => array('label' => $txt['inbox'], 'custom_url' => $scripturl . '?action=pm'), 'sent' => array('label' => $txt['sent_items'], 'custom_url' => $scripturl . '?action=pm;f=sent'), 'drafts' => array('label' => $txt['drafts_show'], 'custom_url' => $scripturl . '?action=pm;sa=showpmdrafts', 'permission' => allowedTo('pm_draft'), 'enabled' => !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_pm_enabled'])))), 'labels' => array('title' => $txt['pm_labels'], 'areas' => array()), 'actions' => array('title' => $txt['pm_actions'], 'areas' => array('search' => array('label' => $txt['pm_search_bar_title'], 'custom_url' => $scripturl . '?action=pm;sa=search'), 'prune' => array('label' => $txt['pm_prune'], 'custom_url' => $scripturl . '?action=pm;sa=prune'))), 'pref' => array('title' => $txt['pm_preferences'], 'areas' => array('manlabels' => array('label' => $txt['pm_manage_labels'], 'custom_url' => $scripturl . '?action=pm;sa=manlabels'), 'manrules' => array('label' => $txt['pm_manage_rules'], 'custom_url' => $scripturl . '?action=pm;sa=manrules'), 'settings' => array('label' => $txt['pm_settings'], 'custom_url' => $scripturl . '?action=pm;sa=settings')))); // Handle labels. if (empty($context['currently_using_labels'])) { unset($pm_areas['labels']); } else { // Note we send labels by id as it will have less problems in the querystring. $unread_in_labels = 0; foreach ($context['labels'] as $label) { if ($label['id'] == -1) { continue; } // Count the amount of unread items in labels. $unread_in_labels += $label['unread_messages']; // Add the label to the menu. $pm_areas['labels']['areas']['label' . $label['id']] = array('label' => $label['name'] . (!empty($label['unread_messages']) ? ' (<strong>' . $label['unread_messages'] . '</strong>)' : ''), 'custom_url' => $scripturl . '?action=pm;l=' . $label['id'], 'unread_messages' => $label['unread_messages'], 'messages' => $label['messages']); } if (!empty($unread_in_labels)) { $pm_areas['labels']['title'] .= ' (' . $unread_in_labels . ')'; } } $pm_areas['folders']['areas']['inbox']['unread_messages'] =& $context['labels'][-1]['unread_messages']; $pm_areas['folders']['areas']['inbox']['messages'] =& $context['labels'][-1]['messages']; if (!empty($context['labels'][-1]['unread_messages'])) { $pm_areas['folders']['areas']['inbox']['label'] .= ' (<strong>' . $context['labels'][-1]['unread_messages'] . '</strong>)'; $pm_areas['folders']['title'] .= ' (' . $context['labels'][-1]['unread_messages'] . ')'; } // Do we have a limit on the amount of messages we can keep? if (!empty($context['message_limit'])) { $bar = round($user_info['messages'] * 100 / $context['message_limit'], 1); $context['limit_bar'] = array('messages' => $user_info['messages'], 'allowed' => $context['message_limit'], 'percent' => $bar, 'bar' => $bar > 100 ? 100 : (int) $bar, 'text' => sprintf($txt['pm_currently_using'], $user_info['messages'], $bar)); } require_once $sourcedir . '/Subs-Menu.php'; // What page is this, again? $current_page = $scripturl . '?action=pm' . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '') . (!empty($context['folder']) ? ';f=' . $context['folder'] : '') . (!empty($context['current_label_id']) ? ';l=' . $context['current_label_id'] : ''); // Set a few options for the menu. $menuOptions = array('current_area' => $area, 'disable_url_session_check' => true); // Actually create the menu! $pm_include_data = createMenu($pm_areas, $menuOptions); unset($pm_areas); // No menu means no access. if (!$pm_include_data && (!$user_info['is_guest'] || validateSession())) { fatal_lang_error('no_access', false); } // Make a note of the Unique ID for this menu. $context['pm_menu_id'] = $context['max_menu_id']; $context['pm_menu_name'] = 'menu_data_' . $context['pm_menu_id']; // Set the selected item. $current_area = $pm_include_data['current_area']; $context['menu_item_selected'] = $current_area; // Set the template for this area and add the profile layer. if (!WIRELESS && !isset($_REQUEST['xml'])) { $context['template_layers'][] = 'pm'; } }
<table class="contentMainTable" cellpadding="0" cellspacing="0" border="0"> <tr> <td style="padding-left:10px;padding-top:10px;vertical-align:top;"> <table cellpadding="0" cellspacing="0" border="0"> <tr><td> <?php boxStart('Gruppe auswählen', 'Wählen Sie hier diejenige Gruppe aus, der Sie neue Benutzer hinzufügen wollen.'); echo '<form method=get action=index.php name=chooseGroupForm style="padding:0px;margin:0px;">'; echo '<table cellpadding=0 cellspacing=0 border=0 style="width:290px;">'; echo '<tr><td style="width:145px;text-align:left;vertical-align:middle;"><span class=text-bf>Gruppenauswahl:</span></td><td align=right style="width:145px;height:20px;">'; if ($this->groupSelect != null) { $activeGroup = $this->groupSelect; } else { $activeGroup = ''; } createMenu('dropdown-search', 'groupSelect', $this->groupList, $activeGroup, array('Gruppenlos'), 101); echo '</td></tr>'; echo '<tr><td colspan=2 style="text-align:right;"><button class=basicButton name=chooseGroup value=true onclick="javascript:document.chooseGroupForm.submit();">auswählen</button></td></tr>'; echo '</table>'; echo '<input type=hidden name=cmd value=ultimateMembershipOrganisation>'; echo '</form>'; boxEnd(); ?> </td></tr> <tr><td><img src="img/one.gif" width=1 height=10></td></tr> <tr><td> <?php boxStart('Benutzer hinzufügen', 'Um einen Benutzer der gewählten Gruppe hinzuzufügen, geben Sie hier den entsprechenden Benutzernamen ein, und bestätigen Sie ihre Eingabe.'); if ($this->groupSelect != null) { echo '<form name=changeDataForm style="padding:0px;margin:0px;">'; echo '<table cellpadding=0 cellspacing=0 border=0 style="width:290px;">';