/** * The main administration section. * It prepares all the data necessary for the administration front page. * It uses the Admin template along with the admin sub template. * It requires the moderate_forum, manage_membergroups, manage_bans, * admin_forum, manage_permissions, manage_attachments, manage_smileys, * manage_boards, edit_news, or send_mail permission. * It uses the index administrative area. * It can be found by going to ?action=admin. */ function AdminHome() { global $sourcedir, $forum_version, $txt, $scripturl, $context, $user_info, $boardurl, $modSettings, $smcFunc; // You have to be able to do at least one of the below to see this page. isAllowedTo(array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments')); // Find all of this forum's administrators... require_once $sourcedir . '/Subs-Membergroups.php'; if (listMembergroupMembers_Href($context['administrators'], 1, 32) && allowedTo('manage_membergroups')) { // Add a 'more'-link if there are more than 32. $context['more_admins_link'] = '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=1">' . $txt['more'] . '</a>'; } // Load the credits stuff. require_once $sourcedir . '/Who.php'; Credits(true); // This makes it easier to get the latest news with your time format. $context['time_format'] = urlencode($user_info['time_format']); $context['forum_version'] = $forum_version; // Get a list of current server versions. require_once $sourcedir . '/Subs-Admin.php'; $checkFor = array('gd', 'imagick', 'db_server', 'mmcache', 'eaccelerator', 'phpa', 'apc', 'memcache', 'xcache', 'php', 'server'); $context['current_versions'] = getServerVersions($checkFor); $context['can_admin'] = allowedTo('admin_forum'); $context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin'; $context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center']; // The format of this array is: permission, action, title, description, icon. $quick_admin_tasks = array(array('', 'credits', 'support_credits_title', 'support_credits_info', 'support_and_credits.png'), array('admin_forum', 'featuresettings', 'modSettings_title', 'modSettings_info', 'features_and_options.png'), array('admin_forum', 'maintain', 'maintain_title', 'maintain_info', 'forum_maintenance.png'), array('manage_permissions', 'permissions', 'edit_permissions', 'edit_permissions_info', 'permissions_lg.png'), array('admin_forum', 'theme;sa=admin;' . $context['session_var'] . '=' . $context['session_id'], 'theme_admin', 'theme_admin_info', 'themes_and_layout.png'), array('admin_forum', 'packages', 'package', 'package_info', 'packages_lg.png'), array('manage_smileys', 'smileys', 'smileys_manage', 'smileys_manage_info', 'smilies_and_messageicons.png'), array('moderate_forum', 'viewmembers', 'admin_users', 'member_center_info', 'members_lg.png')); $context['quick_admin_tasks'] = array(); foreach ($quick_admin_tasks as $task) { if (!empty($task[0]) && !allowedTo($task[0])) { continue; } $context['quick_admin_tasks'][] = array('href' => $scripturl . '?action=admin;area=' . $task[1], 'link' => '<a href="' . $scripturl . '?action=admin;area=' . $task[1] . '">' . $txt[$task[2]] . '</a>', 'title' => $txt[$task[2]], 'description' => $txt[$task[3]], 'icon' => $task[4], 'is_last' => false); } if (count($context['quick_admin_tasks']) % 2 == 1) { $context['quick_admin_tasks'][] = array('href' => '', 'link' => '', 'title' => '', 'description' => '', 'is_last' => true); $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 2]['is_last'] = true; } elseif (count($context['quick_admin_tasks']) != 0) { $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 1]['is_last'] = true; $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 2]['is_last'] = true; } // Lastly, fill in the blanks in the support resources paragraphs. $txt['support_resources_p1'] = sprintf($txt['support_resources_p1'], 'http://wiki.simplemachines.org/', 'http://wiki.simplemachines.org/smf/features2', 'http://wiki.simplemachines.org/smf/options2', 'http://wiki.simplemachines.org/smf/themes2', 'http://wiki.simplemachines.org/smf/packages2'); $txt['support_resources_p2'] = sprintf($txt['support_resources_p2'], 'http://www.simplemachines.org/community/', 'http://www.simplemachines.org/redirect/english_support', 'http://www.simplemachines.org/redirect/international_support_boards', 'http://www.simplemachines.org/redirect/smf_support', 'http://www.simplemachines.org/redirect/customize_support'); }
function AdminHome() { global $sourcedir, $forum_version, $txt, $scripturl, $context, $user_info, $boardurl, $modSettings, $smcFunc; // You have to be able to do at least one of the below to see this page. isAllowedTo(array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_awards', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments')); // Find all of this forum's administrators... require_once $sourcedir . '/Subs-Membergroups.php'; if (listMembergroupMembers_Href($context['administrators'], 1, 32) && allowedTo('manage_membergroups')) { // Add a 'more'-link if there are more than 32. $context['more_admins_link'] = '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=1">' . $txt['more'] . '</a>'; } // Load the credits stuff. require_once $sourcedir . '/Who.php'; Credits(true); // Fill in the blanks in the support resources paragraphs. $txt['support_resources_p1'] = sprintf($txt['support_resources_p1'], 'http://docs.simplemachines.org/', 'http://docs.simplemachines.org/redirect/features', 'http://docs.simplemachines.org/redirect/settings', 'http://docs.simplemachines.org/redirect/themes', 'http://docs.simplemachines.org/redirect/packages'); $txt['support_resources_p2'] = sprintf($txt['support_resources_p2'], 'http://www.simplemachines.org/community/', 'http://www.simplemachines.org/redirect/english_support', 'http://www.simplemachines.org/redirect/international_support_boards', 'http://www.simplemachines.org/redirect/smf_support', 'http://www.simplemachines.org/redirect/customize_support'); // Copyright? if (!empty($modSettings['copy_settings']) || !empty($modSettings['copyright_key'])) { if (empty($modSettings['copy_settings'])) { $modSettings['copy_settings'] = 'a,0'; } // Not done it yet... if (empty($_SESSION['copy_expire'])) { list($key, $expires) = explode(',', $modSettings['copy_settings']); // Get the expired date. require_once $sourcedir . '/Subs-Package.php'; $return_data = fetch_web_data('http://www.simplemachines.org/smf/copyright/check_copyright.php?site=' . base64_encode($boardurl) . '&key=' . $key . '&version=' . base64_encode($forum_version)); // Get the expire date. $return_data = substr($return_data, strpos($return_data, 'STARTCOPY') + 9); $return_data = trim(substr($return_data, 0, strpos($return_data, 'ENDCOPY'))); $deletekeys = true; if ($return_data != 'void') { list($_SESSION['copy_expire'], $copyright_key) = explode('|', $return_data); $_SESSION['copy_key'] = $key; if ($_SESSION['copy_expire'] > time()) { $deletekeys = false; $copy_settings = $key . ',' . (int) $_SESSION['copy_expire']; updateSettings(array('copy_settings' => $copy_settings, 'copyright_key' => $copyright_key)); } } if ($deletekeys) { $_SESSION['copy_expire'] = ''; $smcFunc['db_query']('', ' DELETE FROM {db_prefix}settings WHERE variable = {string:copy_settings} OR variable = {string:copyright_key}', array('copy_settings' => 'copy_settings', 'copyright_key' => 'copyright_key')); } } if (isset($_SESSION['copy_expire']) && $_SESSION['copy_expire'] > time()) { $context['copyright_expires'] = (int) (($_SESSION['copy_expire'] - time()) / 3600 / 24); $context['copyright_key'] = $_SESSION['copy_key']; } } // This makes it easier to get the latest news with your time format. $context['time_format'] = urlencode($user_info['time_format']); $context['current_versions'] = array('php' => array('title' => $txt['support_versions_php'], 'version' => PHP_VERSION), 'db' => array('title' => sprintf($txt['support_versions_db'], $smcFunc['db_title']), 'version' => ''), 'server' => array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE'])); $context['forum_version'] = $forum_version; // Get a list of current server versions. require_once $sourcedir . '/Subs-Admin.php'; $checkFor = array('gd', 'db_server', 'mmcache', 'eaccelerator', 'phpa', 'apc', 'memcache', 'xcache', 'php', 'server'); $context['current_versions'] = getServerVersions($checkFor); $context['can_admin'] = allowedTo('admin_forum'); $context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin'; $context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center']; // The format of this array is: permission, action, title, description, icon. $quick_admin_tasks = array(array('', 'credits', 'support_credits_title', 'support_credits_info', 'support_and_credits.png'), array('admin_forum', 'featuresettings', 'modSettings_title', 'modSettings_info', 'features_and_options.png'), array('admin_forum', 'maintain', 'maintain_title', 'maintain_info', 'forum_maintenance.png'), array('manage_permissions', 'permissions', 'edit_permissions', 'edit_permissions_info', 'permissions.png'), array('admin_forum', 'theme;sa=admin;' . $context['session_var'] . '=' . $context['session_id'], 'theme_admin', 'theme_admin_info', 'themes_and_layout.png'), array('admin_forum', 'packages', 'package', 'package_info', 'packages.png'), array('manage_smileys', 'smileys', 'smileys_manage', 'smileys_manage_info', 'smilies_and_messageicons.png'), array('moderate_forum', 'viewmembers', 'admin_users', 'member_center_info', 'members.png')); $context['quick_admin_tasks'] = array(); foreach ($quick_admin_tasks as $task) { if (!empty($task[0]) && !allowedTo($task[0])) { continue; } $context['quick_admin_tasks'][] = array('href' => $scripturl . '?action=admin;area=' . $task[1], 'link' => '<a href="' . $scripturl . '?action=admin;area=' . $task[1] . '">' . $txt[$task[2]] . '</a>', 'title' => $txt[$task[2]], 'description' => $txt[$task[3]], 'icon' => $task[4], 'is_last' => false); } if (count($context['quick_admin_tasks']) % 2 == 1) { $context['quick_admin_tasks'][] = array('href' => '', 'link' => '', 'title' => '', 'description' => '', 'is_last' => true); $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 2]['is_last'] = true; } elseif (count($context['quick_admin_tasks']) != 0) { $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 1]['is_last'] = true; $context['quick_admin_tasks'][count($context['quick_admin_tasks']) - 2]['is_last'] = true; } }