Beispiel #1
0
function template_shop_above()
{
    global $txt, $context, $modSettings, $scripturl;
    // Doing nothing? So be it :P
    if (!isset($context['shop_do'])) {
        $context['shop_do'] = '';
    }
    // TODO: Simplify the code (for the links) below?
    echo '
		<!-- The Linktree -->
		<table width="100%" cellpadding="3" cellspacing="0"><tr><td valign="bottom">', theme_linktree(), '</td></tr></table>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" style="padding-top: 1ex;"><tr>
			<td width="180" valign="top" style="width: 26ex; padding-right: 10px; padding-bottom: 10px;">
				<table width="100%" cellpadding="4" cellspacing="1" border="0" class="bordercolor">
					<tr>
						<td class="catbg">', $txt['shop'], ' Stuff</td>
					</tr>
					<tr class="windowbg2">
						<td class="smalltext" style="line-height: 1.3; padding-bottom: 3ex;">
							', $context['shop_do'] == 'main' ? '<b>' : '', '<a href="', $scripturl, '?action=shop">', $txt['shop'], ' Home</a>', $context['shop_do'] == 'main' ? '</b>' : '', '<br />';
    // Allowed to buy stuff?
    if (allowedTo('shop_buy')) {
        echo '
							', ($context['shop_do'] == 'buy' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=buy">' . $txt['shop_buy'] . '</a>' . ($context['shop_do'] == 'buy' ? '</b>' : '') . '<br />';
    }
    // The inventory - Everyone can access this!
    echo '
							', ($context['shop_do'] == 'inv' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=inv">' . $txt['shop_yourinv'] . '</a>' . ($context['shop_do'] == 'inv' ? '</b>' : ''), '<br />';
    // Allowed to send money to other people
    if (allowedTo('shop_sendmoney')) {
        echo '
							', ($context['shop_do'] == 'sendmoney' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=sendmoney">' . $txt['shop_send_money'] . '</a>' . ($context['shop_do'] == 'sendmoney' ? '</b>' : '') . '<br />';
    }
    // Allowed to send items to other people?
    if (allowedTo('shop_senditems')) {
        echo '
							', $context['shop_do'] == 'senditems' ? '<b>' : '', '<a href="' . $scripturl . '?action=shop;do=senditems">' . $txt['shop_send_item'] . '</a>' . ($context['shop_do'] == 'senditems' ? '</b>' : ''), '<br />';
    }
    // Allowed to view inventory of others?
    if (allowedTo('shop_invother')) {
        echo '
							', $context['shop_do'] == 'invother' ? '<b>' : '', '<a href="' . $scripturl . '?action=shop;do=invother">' . $txt['shop_invother'] . '</a>' . ($context['shop_do'] == 'invother' ? '</b>' : ''), '<br />';
    }
    // Allowed to access the bank?
    if (allowedTo('shop_bank')) {
        echo '
							', ($context['shop_do'] == 'bank' ? '<b>' : '') . $modSettings['shopBankEnabled'] ? '<a href="' . $scripturl . '?action=shop;do=bank">' . $txt['shop_bank'] . '</a><br />' : '' . ($context['shop_do'] == 'bank' ? '</b>' : '');
    }
    // Allowed to access the trade centre?
    if (allowedTo('shop_trade')) {
        echo '
							', ($context['shop_do'] == 'trade' ? '<b>' : '') . $modSettings['shopTradeEnabled'] ? '<a href="' . $scripturl . '?action=shop;do=trade">' . $txt['shop_trade'] . '</a><br />' : '', $context['shop_do'] == 'trade' ? '</b>' : '';
    }
    echo '
						</td>
					</tr>
				</table>
			</td>
			<td valign="top">';
}
Beispiel #2
0
function template_profile_above()
{
    global $context, $scripturl, $txt, $settings;
    echo '
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/profile.js"></script>';
    // If an error occurred while trying to save previously, give the user a clue!
    echo template_error_message();
    // If the profile was update successfully, let the user know this.
    if (!empty($context['profile_updated'])) {
        echo '
		<div class="ui-body ui-body-e">
			', $context['profile_updated'], '
		</div>';
    }
    // Profile menu
    if (allowedTo('profile_identity_any')) {
        echo '
		<div data-role="controlgroup">
			<a data-role="button" href="', $scripturl, '?action=profile;area=summary;u=', $context['member']['id'], '">', $txt['profileInfo'], '</a>';
        if (allowedTo('profile_identity_own')) {
            echo '
			<a data-role="button" href="', $scripturl, '?action=profile;area=account;u=', $context['member']['id'], '">', $txt['account'], '</a>';
        }
        if (allowedTo('profile_identity_own')) {
            echo '
			<a data-role="button" href="', $scripturl, '?action=profile;area=forumprofile;u=', $context['member']['id'], '">', $txt['profileEdit'], '</a>';
        }
        echo '
		</div><br />';
    }
}
Beispiel #3
0
function fixp_menu_button(&$buttons)
{
    global $boardurl, $txt, $context;
    fixp_loadLanguage();
    $context['current_action'] = 'fixp';
    $buttons['fixp'] = array('title' => $txt['fixp'], 'show' => allowedTo('admin_forum'), 'href' => $boardurl . '/fix_packages.php', 'active_button' => true, 'sub_buttons' => array());
}
Beispiel #4
0
function gplus_admin_areas(&$admin_areas)
{
    global $scripturl, $txt;
    if (allowedTo('admin_forum')) {
        gplus_array_insert($admin_areas, 'layout', array('sa_gplus' => array('title' => $txt['gp_googplus'], 'areas' => array('gplus' => array('label' => $txt['gp_app_config'], 'file' => 'GPlus/GplusAdmin.php', 'function' => 'gplusa', 'custom_url' => $scripturl . '?action=admin;area=gplus', 'icon' => 'server.gif', 'subsections' => array('gplus' => array($txt['gp_app_config']), 'gplus_logs' => array($txt['gp_app_logs'])))))));
    }
}
Beispiel #5
0
    public function Facebooka()
    {
        global $fb_object, $fb_hook_object, $modSettings, $sourcedir, $context;
        require_once $sourcedir . '/ManageServer.php';
        loadTemplate('FacebookAdmin');
        allowedTo('admin_forum');
        $fb_object = new SAFacebookadmin();
        $context['html_headers'] .= '
		    <script type="text/javascript">
		        function fbLogin() {

					FB.login(function(response) {
                        if (response.authResponse) {
                            alert(\'' . $fb_object->txt['fb_grantperm1'] . '\');
                            window.location = \'https://www.facebook.com/dialog/oauth?client_id=' . $modSettings['fb_app_id'] . '&redirect_uri=' . urlencode($fb_hook_object->scripturl . '') . '&scope=email,publish_actions\';
                        }
						else {
                            alert(\'' . $fb_object->txt['fb_grantperm'] . '\');
                        }
                    }, {scope: \'email,publish_actions\'});

                }
		    </script>';
        $context['page_title'] = $fb_hook_object->txt['fb_main1'];
        $context[$context['admin_menu_name']]['tab_data']['title'] = $fb_hook_object->txt['fb_main1'];
        $context[$context['admin_menu_name']]['tab_data']['description'] = $fb_hook_object->txt['fb_main1'];
        $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($fb_object->subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'facebook';
        call_user_func(array('SAFacebookadmin', $fb_object->subActions[$_REQUEST['sa']]));
    }
Beispiel #6
0
function ManagePostSettings()
{
    global $context, $txt, $scripturl;
    // Boldify "Posts and Topics" on the admin bar.
    adminIndex('posts_and_topics');
    $subActions = array('posts' => array('ModifyPostSettings', 'admin_forum'), 'bbc' => array('ModifyBBCSettings', 'admin_forum'), 'censor' => array('SetCensor', 'moderate_forum'), 'topics' => array('ModifyTopicSettings', 'admin_forum'));
    // Default the sub-action to 'view ban list'.
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('admin_forum') ? 'posts' : 'censor');
    // Make sure you can do this.
    isAllowedTo($subActions[$_REQUEST['sa']][1]);
    $context['page_title'] = $txt['manageposts_title'];
    // Tabs for browsing the different ban functions.
    $context['admin_tabs'] = array('title' => $txt['manageposts_title'], 'help' => 'posts_and_topics', 'description' => $txt['manageposts_description'], 'tabs' => array());
    if (allowedTo('admin_forum')) {
        $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_settings'], 'description' => $txt['manageposts_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=posts', 'is_selected' => $_REQUEST['sa'] == 'posts');
        $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_bbc_settings'], 'description' => $txt['manageposts_bbc_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=bbc', 'is_selected' => $_REQUEST['sa'] == 'bbc');
    }
    if (allowedTo('moderate_forum')) {
        $context['admin_tabs']['tabs'][] = array('title' => $txt[135], 'description' => $txt[141], 'href' => $scripturl . '?action=postsettings;sa=censor', 'is_selected' => $_REQUEST['sa'] == 'censor', 'is_last' => !allowedTo('admin_forum'));
    }
    if (allowedTo('admin_forum')) {
        $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_topic_settings'], 'description' => $txt['manageposts_topic_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=topics', 'is_selected' => $_REQUEST['sa'] == 'topics', 'is_last' => true);
    }
    // Call the right function for this sub-acton.
    $subActions[$_REQUEST['sa']][0]();
}
Beispiel #7
0
/**
 * This function shows the board index.
 * It uses the BoardIndex template, and main sub template.
 * It may use the boardindex subtemplate for wireless support.
 * It updates the most online statistics.
 * It is accessed by ?action=boardindex.
 */
function BoardIndex()
{
    global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl;
    // For wireless, we use the Wireless template...
    if (WIRELESS) {
        $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex';
    } else {
        loadTemplate('BoardIndex');
    }
    // Set a canonical URL for this page.
    $context['canonical_url'] = $scripturl;
    // Do not let search engines index anything if there is a random thing in $_GET.
    if (!empty($_GET)) {
        $context['robot_no_index'] = true;
    }
    // Retrieve the categories and boards.
    require_once $sourcedir . '/Subs-BoardIndex.php';
    $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts']));
    $context['categories'] = getBoardIndex($boardIndexOptions);
    // Get the user online list.
    require_once $sourcedir . '/Subs-MembersOnline.php';
    $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true);
    $context += getMembersOnlineStats($membersOnlineOptions);
    $context['show_buddies'] = !empty($user_info['buddies']);
    // Are we showing all membergroups on the board index?
    if (!empty($settings['show_group_key'])) {
        $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());
    }
    // Track most online statistics? (Subs-MembersOnline.php)
    if (!empty($modSettings['trackStats'])) {
        trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']);
    }
    // Retrieve the latest posts if the theme settings require it.
    if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) {
        $latestPostOptions = array('number_posts' => $settings['number_recent_posts']);
        $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
    }
    $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0;
    $settings['show_member_bar'] &= allowedTo('view_mlist');
    $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
    $context['show_member_list'] = allowedTo('view_mlist');
    $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']);
    // Load the calendar?
    if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) {
        // Retrieve the calendar data (events, birthdays, holidays).
        $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']);
        $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions));
        // Whether one or multiple days are shown on the board index.
        $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1;
        // This is used to show the "how-do-I-edit" help.
        $context['calendar_can_edit'] = allowedTo('calendar_edit_any');
    } else {
        $context['show_calendar'] = false;
    }
    $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
    // Mark read button
    $context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']));
    // Allow mods to add additional buttons here
    call_integration_hook('integrate_mark_read_button');
}
function install_menu_button(&$buttons)
{
    global $boardurl, $context;
    $context['sub_template'] = 'install_script';
    $context['current_action'] = 'install';
    $buttons['install'] = array('title' => 'Installation script', 'show' => allowedTo('admin_forum'), 'href' => $boardurl . '/install.php', 'active_button' => true, 'sub_buttons' => array());
}
Beispiel #9
0
function integrate_chars_admin_actions(&$admin_areas)
{
    global $txt;
    if (allowedTo('admin_forum')) {
        $admin_areas['members']['areas']['membergroups']['subsections']['badges'] = [$txt['badges'], 'admin_forum'];
        $admin_areas['characters'] = ['title' => $txt['chars_menu_title'], 'permission' => ['admin_forum'], 'areas' => ['templates' => ['label' => $txt['char_templates'], 'function' => 'CharacterTemplates', 'icon' => 'quick_edit_button', 'permission' => ['admin_forum'], 'subsections' => []], 'sheets' => ['label' => $txt['char_sheet_admin'], 'function' => 'CharacterSheets', 'icon' => 'package_ops', 'permission' => ['admin_forum'], 'subsections' => []]]];
    }
}
Beispiel #10
0
function bans_menu_button(&$buttons)
{
    global $boardurl, $txt, $context;
    bans_loadLanguage();
    $context['sub_template'] = 'ban_script';
    $context['current_action'] = 'bans';
    $buttons['bans'] = array('title' => $txt['bans'], 'show' => allowedTo('admin_forum'), 'href' => $boardurl . '/ban_script.php', 'active_button' => true, 'sub_buttons' => array());
}
Beispiel #11
0
function Arcade_menu_buttons(&$menu_buttons)
{
    global $context, $modSettings, $scripturl, $txt;
    if (!$context['allow_admin']) {
        $context['allow_admin'] = allowedTo('arcade_admin');
    }
    $context['allow_arcade'] = allowedTo('arcade_view') && !empty($modSettings['arcadeEnabled']);
    arcade_array_insert($menu_buttons, 'search', array('arcade' => array('title' => $txt['arcade'], 'href' => $scripturl . '?action=arcade', 'show' => $context['allow_arcade'], 'active_button' => false, 'sub_buttons' => array())));
}
function PrintTopic()
{
    global $topic, $txt, $scripturl, $context, $user_info;
    global $board_info, $smcFunc, $modSettings;
    // Redirect to the boardindex if no valid topic id is provided.
    if (empty($topic)) {
        redirectexit();
    }
    // Whatever happens don't index this.
    $context['robot_no_index'] = true;
    // Get the topic starter information.
    $request = $smcFunc['db_query']('', '
		SELECT m.poster_time, IFNULL(mem.real_name, m.poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}
		ORDER BY m.id_msg
		LIMIT 1', array('current_topic' => $topic));
    // Redirect to the boardindex if no valid topic id is provided.
    if ($smcFunc['db_num_rows']($request) == 0) {
        redirectexit();
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Lets "output" all that info.
    loadTemplate('Printpage');
    $context['template_layers'] = array('print');
    $context['board_name'] = $board_info['name'];
    $context['category_name'] = $board_info['cat']['name'];
    $context['poster_name'] = $row['poster_name'];
    $context['post_time'] = timeformat($row['poster_time'], false);
    $context['parent_boards'] = array();
    foreach ($board_info['parent_boards'] as $parent) {
        $context['parent_boards'][] = $parent['name'];
    }
    // Split the topics up so we can print them.
    $request = $smcFunc['db_query']('', '
		SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? '
			AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . '
		ORDER BY m.id_msg', array('current_topic' => $topic, 'is_approved' => 1, 'current_member' => $user_info['id']));
    $context['posts'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject and message.
        censorText($row['subject']);
        censorText($row['body']);
        $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['poster_name'], 'time' => timeformat($row['poster_time'], false), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => parse_bbc($row['body'], 'print'));
        if (!isset($context['topic_subject'])) {
            $context['topic_subject'] = $row['subject'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Set a canonical URL for this page.
    $context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0';
}
function shd_stats_hdadmininfo(&$subactions)
{
    global $context, $modSettings, $txt;
    if (!allowedTo('admin_forum') || empty($modSettings['shdp_enable_stats'])) {
        return;
    }
    $subactions['stats'] = array('function' => 'shd_stats_source', 'icon' => '../reports.png', 'title' => $txt['shdp_stats']);
    $context[$context['admin_menu_name']]['tab_data']['tabs']['stats'] = $subactions['stats'];
}
/**
 *	Sets up the profile menu additions.
 *
 *	@param array $profile_areas Current profile_areas.
 *
 *	@since 2.0
*/
function shd_profile_areas(&$profile_areas)
{
    global $sourcedir, $modSettings, $context, $txt;
    static $called = false;
    if ($called) {
        return;
    }
    if (empty($called)) {
        $called = true;
    }
    // SimpleDesk sections. Added here after the initial cleaning is done, so that we can do our own permission checks without arguing with SMF's system (so much)
    if (empty($modSettings['helpdesk_active'])) {
        return;
    }
    shd_load_language('sd_language/SimpleDeskProfile');
    // Put it here so we can reuse it for the left menu a bit
    $context['helpdesk_menu'] = array('title' => $txt['shd_profile_area'], 'areas' => array('hd_profile' => array('label' => $txt['shd_profile_main'], 'file' => 'sd_source/SimpleDesk-Profile.php', 'function' => 'shd_profile_main', 'enabled' => shd_allowed_to('shd_view_profile_any') || $context['user']['is_owner'] && shd_allowed_to('shd_view_profile_own'), 'permission' => array('own' => array('is_not_guest'), 'any' => array('is_not_guest'))), 'hd_prefs' => array('label' => $txt['shd_profile_preferences'], 'file' => 'sd_source/SimpleDesk-Profile.php', 'function' => 'shd_profile_main', 'enabled' => shd_allowed_to('shd_view_preferences_any') || $context['user']['is_owner'] && shd_allowed_to('shd_view_preferences_own'), 'permission' => array('own' => array('shd_view_preferences_own'), 'any' => array('shd_view_preferences_any'))), 'hd_showtickets' => array('label' => $txt['shd_profile_show_tickets'], 'file' => 'sd_source/SimpleDesk-Profile.php', 'function' => 'shd_profile_main', 'enabled' => $context['user']['is_owner'] && shd_allowed_to('shd_view_ticket_own') || shd_allowed_to('shd_view_ticket_any'), 'permission' => array('own' => array('shd_view_ticket_own'), 'any' => array('shd_view_ticket_any'))), 'hd_permissions' => array('label' => $txt['shd_profile_permissions'], 'file' => 'sd_source/SimpleDesk-Profile.php', 'function' => 'shd_profile_main', 'enabled' => shd_allowed_to('admin_helpdesk'), 'permission' => array('own' => array('admin_helpdesk'), 'any' => array('admin_helpdesk'))), 'hd_actionlog' => array('label' => $txt['shd_profile_actionlog'], 'file' => 'sd_source/SimpleDesk-Profile.php', 'function' => 'shd_profile_main', 'enabled' => empty($modSettings['shd_disable_action_log']) && (shd_allowed_to('shd_view_profile_log_any') || $context['user']['is_owner'] && shd_allowed_to('shd_view_profile_log_own')), 'permission' => array('own' => array('shd_view_profile_log_own'), 'any' => array('shd_view_profile_log_any')))));
    // Kill the existing profile menu but save it in a temporary place first.
    $old_profile_areas = $profile_areas;
    $profile_areas = array();
    // Now, where we add this depends very much on what mode we're in. In HD only mode, we want our menu first before anything else.
    if (!empty($modSettings['shd_helpdesk_only'])) {
        require_once $sourcedir . '/Profile-Modify.php';
        // Move some stuff around.
        $context['helpdesk_menu']['areas']['permissions'] = array('label' => $txt['shd_show_forum_permissions'], 'file' => 'Profile-View.php', 'function' => 'showPermissions', 'enabled' => allowedTo('manage_permissions'));
        $context['helpdesk_menu']['areas']['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')), 'enabled' => allowedTo('moderate_forum'));
        $profile_areas['helpdesk'] = $context['helpdesk_menu'];
        $profile_areas += $old_profile_areas;
        unset($profile_areas['info']['areas']['permissions'], $profile_areas['info']['areas']['tracking']);
        $remove = array('info' => array('summary', 'statistics', 'showposts', 'viewwarning'), 'edit_profile' => array('forumprofile', 'ignoreboards', 'lists', 'notification'), 'profile_action' => array('issuewarning'));
        if (!empty($modSettings['shd_disable_pm'])) {
            $remove['profile_action'][] = 'sendpm';
            $remove['edit_profile'][] = 'pmprefs';
        }
        foreach ($remove as $area => $items) {
            foreach ($items as $item) {
                if (!empty($profile_areas[$area]['areas'][$item])) {
                    $profile_areas[$area]['areas'][$item]['enabled'] = false;
                }
            }
        }
        $profile_areas['edit_profile']['areas']['theme']['file'] = 'sd_source/SimpleDesk-Profile.php';
        $profile_areas['edit_profile']['areas']['theme']['function'] = 'shd_profile_theme_wrapper';
    } else {
        foreach ($old_profile_areas as $area => $details) {
            if ($area == 'edit_profile') {
                $profile_areas['helpdesk'] = $context['helpdesk_menu'];
            }
            $profile_areas[$area] = $details;
        }
    }
    // Now engage any hooks.
    call_integration_hook('shd_hook_profilemenu', array(&$profile_areas));
}
Beispiel #15
0
function Twittera()
{
    global $txt, $sourcedir, $context;
    require_once $sourcedir . '/ManageServer.php';
    loadTemplate('TwitterAdmin');
    allowedTo('admin_forum');
    $context['page_title'] = $txt['twittmaina'];
    $context[$context['admin_menu_name']]['tab_data']['title'] = $txt['twittmaina'];
    $context[$context['admin_menu_name']]['tab_data']['description'] = $txt['twittmaina'];
    $subActions = array('twitter' => 'twitadmin', 'twittlog' => 'twitlogs', 'boards' => 'twit_tweet', 'about' => 'twit_about');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'twitter';
    $subActions[$_REQUEST['sa']]();
}
Beispiel #16
0
function gplusa()
{
    global $txt, $sourcedir, $context;
    require_once $sourcedir . '/ManageServer.php';
    allowedTo('admin_forum');
    loadTemplate('GPlus');
    $context['page_title'] = $txt['gp_googplus'];
    $context[$context['admin_menu_name']]['tab_data']['title'] = $txt['gp_googplus'];
    $context[$context['admin_menu_name']]['tab_data']['description'] = $txt['gp_googplus'];
    $subActions = array('gplus' => 'gplus_admin', 'gplus_logs' => 'gplus_logs');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'gplus';
    $subActions[$_REQUEST['sa']]();
}
 /**
  * Function to upload attachements via ajax calls
  *
  * - Currently called by drag drop attachment functionality
  * - Pass the form data with session vars
  * - Responds back with errors or file data
  */
 public function action_ulattach()
 {
     global $context, $modSettings, $txt;
     $resp_data = array();
     loadLanguage('Errors');
     $context['attachments']['can']['post'] = !empty($modSettings['attachmentEnable']) && $modSettings['attachmentEnable'] == 1 && (allowedTo('post_attachment') || $modSettings['postmod_active'] && allowedTo('post_unapproved_attachments'));
     // Set up the template details
     $template_layers = Template_Layers::getInstance();
     $template_layers->removeAll();
     loadTemplate('Json');
     $context['sub_template'] = 'send_json';
     // Make sure the session is still valid
     if (checkSession('request', '', false) != '') {
         $context['json_data'] = array('result' => false, 'data' => $txt['session_timeout_file_upload']);
         return false;
     }
     // We should have files, otherwise why are we here?
     if (isset($_FILES['attachment'])) {
         loadLanguage('Post');
         require_once SOURCEDIR . '/AttachmentErrorContext.class.php';
         $attach_errors = Attachment_Error_Context::context();
         $attach_errors->activate();
         if ($context['attachments']['can']['post'] && empty($_POST['from_qr'])) {
             require_once SUBSDIR . '/Attachments.subs.php';
             if (isset($_REQUEST['msg'])) {
                 processAttachments((int) $_REQUEST['msg']);
             } else {
                 processAttachments();
             }
         }
         // Any mistakes?
         if ($attach_errors->hasErrors()) {
             $errors = $attach_errors->prepareErrors();
             // Bad news for you, the attachments did not process, lets tell them why
             foreach ($errors as $key => $error) {
                 $resp_data[] = $error;
             }
             $context['json_data'] = array('result' => false, 'data' => $resp_data);
         } else {
             foreach ($_SESSION['temp_attachments'] as $attachID => $val) {
                 // We need to grab the name anyhow
                 if (!empty($val['tmp_name'])) {
                     $resp_data = array('name' => $val['name'], 'attachid' => $attachID, 'size' => $val['size']);
                 }
             }
             $context['json_data'] = array('result' => true, 'data' => $resp_data);
         }
     } else {
         $context['json_data'] = array('result' => false, 'data' => $txt['no_files_uploaded']);
     }
 }
Beispiel #18
0
function ManagePostSettings()
{
    global $context, $txt, $scripturl;
    $subActions = array('posts' => array('ModifyPostSettings', 'admin_forum'), 'bbc' => array('ModifyBBCSettings', 'admin_forum'), 'censor' => array('SetCensor', 'moderate_forum'), 'topics' => array('ModifyTopicSettings', 'admin_forum'));
    // Default the sub-action to 'view ban list'.
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('admin_forum') ? 'posts' : 'censor');
    // Make sure you can do this.
    isAllowedTo($subActions[$_REQUEST['sa']][1]);
    $context['page_title'] = $txt['manageposts_title'];
    // Tabs for browsing the different ban functions.
    $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['manageposts_title'], 'help' => 'posts_and_topics', 'description' => $txt['manageposts_description'], 'tabs' => array('posts' => array('description' => $txt['manageposts_settings_description']), 'bbc' => array('description' => $txt['manageposts_bbc_settings_description']), 'censor' => array('description' => $txt['admin_censored_desc']), 'topics' => array('description' => $txt['manageposts_topic_settings_description'])));
    // Call the right function for this sub-acton.
    $subActions[$_REQUEST['sa']][0]();
}
function sportal_admin_articles_main()
{
    global $context, $txt, $scripturl, $sourcedir;
    if (!allowedTo('sp_admin')) {
        isAllowedTo('sp_manage_articles');
    }
    require_once $sourcedir . '/Subs-PortalAdmin.php';
    loadTemplate('PortalAdminArticles');
    $subActions = array('articles' => 'sportal_admin_article_list', 'addarticle' => 'sportal_admin_article_add', 'editarticle' => 'sportal_admin_article_edit', 'deletearticle' => 'sportal_admin_article_delete', 'categories' => 'sportal_admin_category_list', 'addcategory' => 'sportal_admin_category_add', 'editcategory' => 'sportal_admin_category_edit', 'deletecategory' => 'sportal_admin_category_delete', 'statechange' => 'sportal_admin_state_change');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'articles';
    $context['sub_action'] = $_REQUEST['sa'];
    $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp-adminCatTitle'], 'help' => 'sp_ArticlesArea', 'description' => $txt['sp-adminCatDesc'], 'tabs' => array('articles' => array('description' => $txt['sp-adminArticleListDesc']), 'addarticle' => array('description' => $txt['sp-adminArticleAddDesc']), 'categories' => array('description' => $txt['sp-adminCategoryListDesc']), 'addcategory' => array('description' => $txt['sp-adminCategoryAddDesc'])));
    $subActions[$_REQUEST['sa']]();
}
function sportal_admin_pages_main()
{
    global $context, $txt, $scripturl, $sourcedir;
    if (!allowedTo('sp_admin')) {
        isAllowedTo('sp_manage_pages');
    }
    require_once $sourcedir . '/Subs-PortalAdmin.php';
    loadTemplate('PortalAdminPages');
    $subActions = array('list' => 'sportal_admin_page_list', 'add' => 'sportal_admin_page_edit', 'edit' => 'sportal_admin_page_edit', 'delete' => 'sportal_admin_page_delete', 'status' => 'sportal_admin_page_status');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
    $context['sub_action'] = $_REQUEST['sa'];
    $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp_admin_pages_title'], 'help' => 'sp_PagesArea', 'description' => $txt['sp_admin_pages_desc'], 'tabs' => array('list' => array(), 'add' => array()));
    $subActions[$_REQUEST['sa']]();
}
function sportal_admin_config_main()
{
    global $sourcedir, $context, $txt;
    if (!allowedTo('sp_admin')) {
        isAllowedTo('sp_manage_settings');
    }
    require_once $sourcedir . '/Subs-PortalAdmin.php';
    require_once $sourcedir . '/ManageServer.php';
    loadTemplate('PortalAdmin');
    $subActions = array('information' => 'sportal_information', 'generalsettings' => 'sportal_admin_general_settings', 'blocksettings' => 'sportal_admin_block_settings', 'articlesettings' => 'sportal_admin_article_settings');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'information';
    $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp-adminConfiguration'], 'help' => 'sp_ConfigurationArea', 'description' => $txt['sp-adminConfigurationDesc']);
    $subActions[$_REQUEST['sa']]();
}
Beispiel #22
0
function LockTopic()
{
    global $topic, $user_info, $sourcedir, $board;
    // Just quit if there's no topic to lock.
    if (empty($topic)) {
        fatal_lang_error('not_a_topic', false);
    }
    checkSession('get');
    // Get Subs-Post.php for sendNotifications.
    require_once $sourcedir . '/lib/Subs-Post.php';
    // Find out who started the topic - in case User Topic Locking is enabled.
    $request = smf_db_query('
		SELECT id_member_started, locked
		FROM {db_prefix}topics
		WHERE id_topic = {int:current_topic}
		LIMIT 1', array('current_topic' => $topic));
    list($starter, $locked) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Can you lock topics here, mister?
    $user_lock = !allowedTo('lock_any');
    if ($user_lock && $starter == $user_info['id']) {
        isAllowedTo('lock_own');
    } else {
        isAllowedTo('lock_any');
    }
    // Locking with high privileges.
    if ($locked == '0' && !$user_lock) {
        $locked = '1';
    } elseif ($locked == '0') {
        $locked = '2';
    } elseif ($locked == '2' || $locked == '1' && !$user_lock) {
        $locked = '0';
    } else {
        fatal_lang_error('locked_by_admin', 'user');
    }
    // Actually lock the topic in the database with the new value.
    smf_db_query('
		UPDATE {db_prefix}topics
		SET locked = {int:locked}
		WHERE id_topic = {int:current_topic}', array('current_topic' => $topic, 'locked' => $locked));
    // If they are allowed a "moderator" permission, log it in the moderator log.
    if (!$user_lock) {
        logAction($locked ? 'lock' : 'unlock', array('topic' => $topic, 'board' => $board));
    }
    // Notify people that this topic has been locked?
    sendNotifications($topic, empty($locked) ? 'unlock' : 'lock');
    // Back to the topic!
    redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
Beispiel #23
0
function AdminNotepad()
{
    loadLanguage('smfhacks_languages/admin-notepad');
    loadTemplate('smfhacks_templates/admin-notepad', array('smfhacks_css/admin-notepad'));
    if (allowedTo('admin_forum')) {
        global $modSettings, $smcFunc;
        if (isset($_POST['admin_notes'])) {
            if (!empty($modSettings['admin_notes']) && $_POST['admin_notes'] == $modSettings['admin_notes']) {
                return;
            } elseif (empty($modSettings['admin_notes']) && empty($_POST['admin_notes'])) {
                return;
            } else {
                updateSettings(array('admin_notes' => $smcFunc['htmlspecialchars']($_POST['admin_notes'], ENT_QUOTES)));
                redirectexit('action=admin;notes_saved');
            }
        }
    }
}
/**
 * imb_googlemap()
 *
 * Menu Button hook, integrate_menu_buttons, called from subs.php
 * used to add top menu buttons
 *
 * @param mixed[] $buttons
 */
function imb_googlemap(&$buttons)
{
    global $txt, $scripturl, $modSettings;
    loadlanguage('GoogleMap');
    // where do we want to place this new button
    $insert_after = empty($modSettings['googleMap_ButtonLocation']) ? 'calendar' : $modSettings['googleMap_ButtonLocation'];
    $counter = 0;
    // find the location in the buttons array
    foreach ($buttons as $area => $dummy) {
        if (++$counter && $area == $insert_after) {
            break;
        }
    }
    // Define the new menu item(s)
    $new_menu = array('googlemap' => array('title' => $txt['googleMap'], 'href' => $scripturl . '?action=googlemap', 'show' => !empty($modSettings['googleMap_Enable']) && allowedTo('googleMap_view'), 'sub_buttons' => array()));
    // Insert the new items in the existing array with array-a-matic ...it slices, it dices, it puts it back together
    $buttons = array_merge(array_slice($buttons, 0, $counter), array_merge($new_menu, array_slice($buttons, $counter)));
}
Beispiel #25
0
function SavePad()
{
    global $ID_MEMBER, $txt, $user_info, $smcFunc;
    // Get the Member ID
    $id = (int) $_REQUEST['id'];
    // Check if they are allowed to edi th user's personal notepad
    if ($id == $user_info['id'] || allowedTo('admin_forum')) {
        // Make the html safe if used so it does not mess up the page
        $anotes = $smcFunc['htmlspecialchars']($_POST['txtnotes'], ENT_QUOTES);
        // Insert the text into the users personal notepad
        $smcFunc['db_query']('', "REPLACE INTO {db_prefix}themes\n\t\t\t\t(ID_MEMBER, variable, value)\n\t\t\tVALUES ({$id},'notes','{$anotes}')");
        // Redirect to back to the users profile
        redirectexit('action=profile;u=' . $id);
    } else {
        // Give them permission denied error
        fatal_error($txt['mempad_error'], false);
    }
}
Beispiel #26
0
function KBAllowedto($cat = 0, $perm)
{
    global $txt, $smcFunc, $user_info;
    if (allowedTo('admin_forum') || allowedTo('manage_kb')) {
        return true;
    }
    $cat = (int) $cat;
    if (!$user_info['is_guest']) {
        $dbresult = $smcFunc['db_query']('', '
		    SELECT m.id_member, c.delarticle, c.delanyarticle, c.editanyarticle, c.editarticle, c.addarticle, c.view
		    FROM {db_prefix}kb_catperm as c 
			LEFT JOIN {db_prefix}members as m ON (m.id_member = {int:memid})
		    WHERE  c.id_group = m.id_group AND c.id_cat = {int:cat} 
			LIMIT 1', array('memid' => $user_info['id'], 'cat' => $cat));
    } else {
        $dbresult = $smcFunc['db_query']('', '
		    SELECT c.delarticle, c.delanyarticle, c.editanyarticle, c.editarticle, c.addarticle, c.view
		    FROM {db_prefix}kb_catperm as c 
		    WHERE c.id_group = -1 AND c.id_cat = {int:cat} 
			LIMIT 1', array('cat' => $cat));
    }
    if ($smcFunc['db_affected_rows']() == 0) {
        $smcFunc['db_free_result']($dbresult);
    } else {
        $row = $smcFunc['db_fetch_assoc']($dbresult);
        $smcFunc['db_free_result']($dbresult);
        if ($perm == 'addarticle' && $row['addarticle'] != 0) {
            return true;
        }
        if ($perm == 'editanyarticle' && $row['editanyarticle'] != 0) {
            return true;
        }
        if ($perm == 'editarticle' && $row['editarticle'] != 0) {
            return true;
        }
        if ($perm == 'delarticle' && $row['delarticle'] != 0) {
            return true;
        }
        if ($perm == 'delanyarticle' && $row['delanyarticle'] != 0) {
            return true;
        }
    }
}
Beispiel #27
0
/**
 * This function allows the admin to register a new member by hand.
 * It also allows assigning a primary group to the member being registered.
 * Accessed by ?action=admin;area=regcenter;sa=register
 * Requires the moderate_forum permission.
 *
 * @uses Register template, admin_register sub-template.
 */
function AdminRegister()
{
    global $txt, $context, $sourcedir, $scripturl, $smcFunc;
    if (!empty($_POST['regSubmit'])) {
        checkSession();
        validateToken('admin-regc');
        foreach ($_POST as $key => $value) {
            if (!is_array($_POST[$key])) {
                $_POST[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $_POST[$key]));
            }
        }
        $regOptions = array('interface' => 'admin', 'username' => $_POST['user'], 'email' => $_POST['email'], 'password' => $_POST['password'], 'password_check' => $_POST['password'], 'check_reserved_name' => true, 'check_password_strength' => false, 'check_email_ban' => false, 'send_welcome_email' => isset($_POST['emailPassword']) || empty($_POST['password']), 'require' => isset($_POST['emailActivate']) ? 'activation' : 'nothing', 'memberGroup' => empty($_POST['group']) || !allowedTo('manage_membergroups') ? 0 : (int) $_POST['group']);
        require_once $sourcedir . '/Subs-Members.php';
        $memberID = registerMember($regOptions);
        if (!empty($memberID)) {
            $context['new_member'] = array('id' => $memberID, 'name' => $_POST['user'], 'href' => $scripturl . '?action=profile;u=' . $memberID, 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $memberID . '">' . $_POST['user'] . '</a>');
            $context['registration_done'] = sprintf($txt['admin_register_done'], $context['new_member']['link']);
        }
    }
    // Load the assignable member groups.
    if (allowedTo('manage_membergroups')) {
        $request = $smcFunc['db_query']('', '
			SELECT group_name, id_group
			FROM {db_prefix}membergroups
			WHERE id_group != {int:moderator_group}
				AND min_posts = {int:min_posts}' . (allowedTo('admin_forum') ? '' : '
				AND id_group != {int:admin_group}
				AND group_type != {int:is_protected}') . '
				AND hidden != {int:hidden_group}
			ORDER BY min_posts, CASE WHEN id_group < {int:newbie_group} THEN id_group ELSE 4 END, group_name', array('moderator_group' => 3, 'min_posts' => -1, 'admin_group' => 1, 'is_protected' => 1, 'hidden_group' => 2, 'newbie_group' => 4));
        $context['member_groups'] = array(0 => $txt['admin_register_group_none']);
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $context['member_groups'][$row['id_group']] = $row['group_name'];
        }
        $smcFunc['db_free_result']($request);
    } else {
        $context['member_groups'] = array();
    }
    // Basic stuff.
    $context['sub_template'] = 'admin_register';
    $context['page_title'] = $txt['registration_center'];
    createToken('admin-regc');
}
Beispiel #28
0
function AdminNotepad()
{
    if (allowedTo('admin_forum')) {
        global $context, $modSettings, $settings;
        loadLanguage('smfhacks_languages/admin-notepad');
        loadTemplate('smfhacks_templates/admin-notepad');
        $context['html_headers'] .= "\n" . '<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/smfhacks_css/admin-notepad.css" />';
        if (isset($_POST['admin_notes'])) {
            if (!empty($modSettings['admin_notes']) && $_POST['admin_notes'] == $modSettings['admin_notes']) {
                return;
            } elseif (empty($modSettings['admin_notes']) && empty($_POST['admin_notes'])) {
                return;
            } else {
                updateSettings(array('admin_notes' => htmlspecialchars($_POST['admin_notes'], ENT_QUOTES)));
                redirectexit('action=admin;notes_saved');
            }
        }
    }
}
Beispiel #29
0
function LockTopic()
{
    global $db_prefix, $topic, $ID_MEMBER, $sourcedir;
    // Just quit if there's no topic to lock.
    if (empty($topic)) {
        fatal_lang_error(472, false);
    }
    checkSession('get');
    // Get Subs-Post.php for sendNotifications.
    require_once $sourcedir . '/Subs-Post.php';
    // Find out who started the topic - in case User Topic Locking is enabled.
    $request = db_query("\n\t\tSELECT ID_MEMBER_STARTED, locked\n\t\tFROM {$db_prefix}topics\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tLIMIT 1", __FILE__, __LINE__);
    list($starter, $locked) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Can you lock topics here, mister?
    $user_lock = !allowedTo('lock_any');
    if ($user_lock && $starter == $ID_MEMBER) {
        isAllowedTo('lock_own');
    } else {
        isAllowedTo('lock_any');
    }
    // Locking with high privileges.
    if ($locked == '0' && !$user_lock) {
        $locked = '1';
    } elseif ($locked == '0') {
        $locked = '2';
    } elseif ($locked == '2' || $locked == '1' && !$user_lock) {
        $locked = '0';
    } else {
        fatal_lang_error('smf31');
    }
    // Actually lock the topic in the database with the new value.
    db_query("\n\t\tUPDATE {$db_prefix}topics\n\t\tSET locked = {$locked}\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tLIMIT 1", __FILE__, __LINE__);
    // If they are allowed a "moderator" permission, log it in the moderator log.
    if (!$user_lock) {
        logAction('lock', array('topic' => $topic));
    }
    // Notify people that this topic has been locked?
    sendNotifications($topic, empty($locked) ? 'unlock' : 'lock');
    // Back to the topic!
    redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}
/**
 * Fetches all the functions (blocks) in the system
 *
 * - if supplied a name gets just that functions id
 * - returns the functions in the order specified in the table
 * - will not return sp_php to non admins for security
 *
 * @param string|null $function
 */
function getFunctionInfo($function = null)
{
    $db = database();
    $request = $db->query('', '
		SELECT
			id_function, name
		FROM {db_prefix}sp_functions' . (!empty($function) ? '
		WHERE name = {string:function}' : '') . '
		ORDER BY function_order', array('function' => $function));
    $return = array();
    while ($row = $db->fetch_assoc($request)) {
        // You must be an admin to use those functions
        if ($row['name'] == 'sp_php' && !allowedTo('admin_forum')) {
            continue;
        }
        $return[] = array('id' => $row['id_function'], 'function' => $row['name']);
    }
    $db->free_result($request);
    return $return;
}