Пример #1
0
/**
 * The main dispatcher.
 * This delegates to each area.
 */
function elk_main()
{
    global $modSettings, $user_info, $topic, $board_info, $context;
    // Special case: session keep-alive, output a transparent pixel.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        header('Content-Type: image/gif');
        die("GIF89a€!ù,D;");
    }
    // We should set our security headers now.
    frameOptionsHeader();
    securityOptionsHeader();
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current user's permissions.
    loadPermissions();
    // Load BadBehavior before we go much further
    loadBadBehavior();
    // Attachments don't require the entire theme to be loaded.
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest'])) {
        detectBrowser();
    } else {
        loadTheme();
    }
    // Check if the user should be disallowed access.
    is_not_banned();
    // If we are in a topic and don't have permission to approve it then duck out now.
    if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
        fatal_lang_error('not_a_topic', false);
    }
    $no_stat_actions = array('dlattach', 'findmember', 'jsoption', 'requestmembers', 'jslocale', 'xmlpreview', 'suggest', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewadminfile');
    call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
    // Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $no_stat_actions)) {
        // I see you!
        writeLog();
        // Track forum statistics and hits...?
        if (!empty($modSettings['hitStats'])) {
            trackStats(array('hits' => '+'));
        }
    }
    unset($no_stat_actions);
    // What shall we do?
    require_once SOURCEDIR . '/SiteDispatcher.class.php';
    $dispatcher = new Site_Dispatcher();
    // Show where we came from, and go
    $context['site_action'] = $dispatcher->site_action();
    $context['site_action'] = !empty($context['site_action']) ? $context['site_action'] : (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');
    $dispatcher->dispatch();
}
Пример #2
0
function smf_main()
{
    global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir;
    // Special case: session keep-alive, output a transparent pixel.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        header('Content-Type: image/gif');
        die("GIF89a€!ù,D;");
    }
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current user's permissions.
    loadPermissions();
    // Attachments don't require the entire theme to be loaded.
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest'])) {
        detectBrowser();
    } else {
        loadTheme();
    }
    // Check if the user should be disallowed access.
    is_not_banned();
    // If we are in a topic and don't have permission to approve it then duck out now.
    if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
        fatal_lang_error('not_a_topic', false);
    }
    // Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'))) {
        // Log this user as online.
        writeLog();
        // Don't track stats of portal xml actions.
        if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'portal' || !isset($_GET['xml'])) {
            // Track forum statistics and hits...?
            if (!empty($modSettings['hitStats'])) {
                trackStats(array('hits' => '+'));
            }
        }
    }
    // Load SimplePortal.
    sportal_init();
    // Is the forum in maintenance mode? (doesn't apply to administrators.)
    if (!empty($maintenance) && !allowedTo('admin_forum')) {
        // You can only login.... otherwise, you're getting the "maintenance mode" display.
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout')) {
            require_once $sourcedir . '/LogInOut.php';
            return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
        } else {
            require_once $sourcedir . '/Subs-Auth.php';
            return 'InMaintenance';
        }
    } elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn')))) {
        require_once $sourcedir . '/Subs-Auth.php';
        return 'KickGuest';
    } elseif (empty($_REQUEST['action'])) {
        // Go catch it boy! Catch it!
        $sp_action = sportal_catch_action();
        if ($sp_action) {
            return $sp_action;
        }
        // Action and board are both empty... BoardIndex!
        if (empty($board) && empty($topic)) {
            require_once $sourcedir . '/BoardIndex.php';
            return 'BoardIndex';
        } elseif (empty($topic)) {
            require_once $sourcedir . '/MessageIndex.php';
            return 'MessageIndex';
        } else {
            require_once $sourcedir . '/Display.php';
            return 'Display';
        }
    }
    // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
    $actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'AdminMain'), 'announce' => array('Post.php', 'AnnounceTopic'), 'attachapprove' => array('ManageAttachments.php', 'ApproveAttach'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'clock' => array('Calendar.php', 'clock'), 'collapse' => array('BoardIndex.php', 'CollapseCategory'), 'coppa' => array('Register.php', 'CoppaForm'), 'credits' => array('Who.php', 'Credits'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'emailuser' => array('SendTopic.php', 'EmailUser'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'forum' => array('BoardIndex.php', 'BoardIndex'), 'portal' => array('PortalMain.php', 'sportal_main'), 'groups' => array('Groups.php', 'Groups'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jseditor' => array('Subs-Editor.php', 'EditorMain'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockvoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'moderate' => array('ModerationCenter.php', 'ModerationMain'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'openidreturn' => array('Subs-OpenID.php', 'smf_openID_return'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('MessageIndex.php', 'QuickModeration'), 'quickmod2' => array('Display.php', 'QuickInTopicModeration'), 'recent' => array('Recent.php', 'RecentPosts'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'EmailUser'), 'smstats' => array('Stats.php', 'SMStats'), 'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile-View.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'viewsmfile' => array('Admin.php', 'DisplayAdminFile'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'), 'xmlhttp' => array('Xml.php', 'XMLhttpMain'));
    // Allow modifying $actionArray easily.
    call_integration_hook('integrate_actions', array(&$actionArray));
    if (!empty($context['disable_sp'])) {
        unset($actionArray['portal'], $actionArray['forum']);
    }
    // Get the function and file to include - if it's not there, do the board index.
    if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
        // Catch the action with the theme?
        if (!empty($settings['catch_action'])) {
            require_once $sourcedir . '/Themes.php';
            return 'WrapAction';
        }
        // Fall through to the board index then...
        require_once $sourcedir . '/BoardIndex.php';
        return 'BoardIndex';
    }
    // Otherwise, it was set - so let's go to that action.
    require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
    return $actionArray[$_REQUEST['action']][1];
}
Пример #3
0
    function settings($scripturl)
    {
        if (isset($_GET['save'])) {
            $charid = $_POST["tea_charid"];
            $userid = $_POST["tea_userid"];
            $api = $_POST["tea_api"];
        } else {
            $charid = $this->modSettings["tea_charid"];
            $userid = $this->modSettings["tea_userid"];
            $api = $this->modSettings["tea_api"];
        }
        $chars = $this->tea->get_characters($userid, $api);
        $charlist = array();
        if (!empty($chars)) {
            foreach ($chars as $char) {
                $charlist[$char['charid']] = $char['name'];
                if ($charid == $char['charid']) {
                    $corp = $char['corpid'];
                    $alliance = $char['allianceid'];
                }
            }
        }
        $groups2 = $this->tea->MemberGroups(TRUE);
        $groups[-1] = '-';
        foreach ($groups2 as $i => $g) {
            $groups[$i] = $g;
        }
        $options = '';
        if (!empty($charlist)) {
            foreach ($charlist as $i => $c) {
                $options .= '<option value="' . $i . '"';
                if ($this->tea->modSettings["tea_charid"] == $i) {
                    $options .= ' selected="selected"';
                }
                $options .= '>' . $c . '</option>
				';
            }
        }
        if (!empty($this->tea->modSettings['tea_ts_host'])) {
            require_once $this->sourcedir . '/TS3_Class/TeamSpeak3.php';
            $tslv = TeamSpeak3::LIB_VERSION;
            TeamSpeak3::init();
            try {
                $ts3 = TeamSpeak3::factory("serverquery://" . $this->modSettings["tea_ts_username"] . ":" . $this->modSettings["tea_ts_password"] . "@" . $this->modSettings["tea_ts_host"] . ":" . $this->modSettings["tea_ts_qport"] . "/?server_port=" . $this->modSettings["tea_ts_port"] . "&blocking=0");
                $sg = $ts3->serverGroupList();
                $gl[0] = '-';
                foreach ($sg as $n) {
                    if ((int) $n->type == 1 && (string) $n->name != 'Guest') {
                        //	$gl['s'.(int)$n -> sgid] = 'Server - '.(string)$n -> name;
                        $gl['s' . (int) $n->sgid] = (string) $n->name;
                    }
                }
                //		$cg = $ts3 -> channelGroupList();
                //		foreach($cg as $i => $n)
                //		{
                //			if((int)$n -> type == 1)
                //				$gl['c'.$i] = 'Channel - '.(string)$n -> name;
                //		}
            } catch (Exception $e) {
                echo "[ERROR] " . $e->getMessage() . "\n";
            }
        }
        $cgq = $this->smcFunc['db_query']('', "SELECT id, value FROM {db_prefix}tea_ts_groups ORDER BY id");
        $cgq = $this->tea->select($cgq);
        if (!empty($cgq)) {
            foreach ($cgq as $cgqs) {
                $cg[$cgqs[0]] = $cgqs[1];
            }
        }
        $groupcheck = '<dt>' . $this->txt['tea_groupmon'] . '
		<table><tr><td>Name</td><td>Checked</td></tr>';
        foreach ($gl as $id => $g) {
            if ($id != '0') {
                $check = '';
                if ($cg[$id] == 1) {
                    $check = 'checked';
                }
                $groupcheck .= '<tr><td>' . $g . '</td><td><input type="checkbox" name="group[' . $id . ']" value="main" ' . $check . ' /></td><td></tr>';
            }
        }
        $groupcheck .= '<tr><td>
			</td></tr></table></dt>';
        $config_vars = array('</form>
			<form name="miniform" method="post" action="">
				<input type="hidden" name="minitype" value="" />
				<input type="hidden" name="value" value="" />
			</form>
			<form action="' . $scripturl . '?action=admin;area=tea;sa=ts;save" method="post" accept-charset="ISO-8859-1" name="tea_ts_settings">', array('check', 'tea_ts_enable'), '', $groupcheck, '', array('text', 'tea_ts_host', 30), array('int', 'tea_ts_qport', 6), array('int', 'tea_ts_port', 6), array('text', 'tea_ts_username', 15), array('text', 'tea_ts_password', 15), array('text', 'tea_ts_nf', 15), '<dt>TeamSpeak Info (HTML) will display on TS area of profile</dt>', '<dt><textarea name="tea_ts_info" cols=120 rows=6>' . $this->modSettings['tea_ts_info'] . '</textarea></dt>', '', $this->txt['tea_ts_db_need'], array('text', 'tea_ts_db_host', 15), array('text', 'tea_ts_db_user', 15), array('text', 'tea_ts_db_pw', 15), array('text', 'tea_ts_db_pre', 15), array('int', 'tea_ts_dbid', 3), array('check', 'tea_ts_method_online'), array('check', 'tea_ts_method_create'), '', array('int', 'tea_ts_warnm', 4), array('int', 'tea_ts_kickm', 4), '');
        $rules = $this->smcFunc['db_query']('', "SELECT id, smf, ts, tst, nf FROM {db_prefix}tea_ts_rules ORDER BY id");
        $rules = $this->tea->select($rules);
        $ro = '<table border="1"><tr><td>Rule ID</td><td>SMF Group</td><td>TS Group</td><td>Name Format</td></tr>';
        $ids['new'] = 'new';
        if (!empty($rules)) {
            $first = TRUE;
            foreach ($rules as $i => $r) {
                $ids[$r[0]] = $r[0];
                $ro .= '<tr><td>' . $r[0] . '</td><td>' . $groups[$r[1]] . '</td><td>' . $gl[$r[3] . $r[2]] . '</td><td>' . $r[4] . '</td>';
                $ro .= '<td>';
                if (!$first) {
                    $ro .= '<a href="javascript:move(' . $r[0] . ', \'up\')"><img src="' . $this->settings['images_url'] . '/sort_up.gif"></a>';
                }
                if ($i != count($rules) - 1) {
                    $ro .= '<a href="javascript:move(' . $r[0] . ', \'down\')"><img src="' . $this->settings['images_url'] . '/sort_down.gif"></a>';
                }
                $ro .= '<a href="javascript:edit(' . $r[0] . ', ' . $r[1] . ', \'' . $r[3] . $r[2] . '\', \'' . $r[4] . '\')"><img src="' . $this->settings['images_url'] . '/icons/config_sm.gif"></a>
				<a href="javascript: delrule(' . $r[0] . ')"><img src="' . $this->settings['images_url'] . '/icons/quick_remove.gif"></a></td></tr>';
                $first = FALSE;
            }
        }
        $config_vars[] = '<dt>' . $ro . '</table></dt>';
        $config_vars[] = '';
        $config_vars[100] = array('select', 'tea_ts_addrule_id', $ids, 'Rule ID');
        $config_vars[101] = array('select', 'tea_ts_addrule_group', $groups);
        $config_vars[102] = array('select', 'tea_ts_addrule_tsg', $gl);
        $config_vars[103] = array('text', 'tea_ts_addrule_nf', 15);
        //$config_vars[103] = array('hidden', 'tea_ts_editrule_id');
        $config_vars[] = '
<script type="text/javascript">
function edit(id, smf, ts, nf)
{
	document.tea_ts_settings.tea_ts_addrule_id.value=id;
	document.tea_ts_settings.tea_ts_addrule_group.value=smf;
	document.tea_ts_settings.tea_ts_addrule_tsg.value=ts;
	document.tea_ts_settings.tea_ts_addrule_nf.value=nf;
}
function delrule(value)
{
	if (confirm("\\nAre you sure you want Delete rule "+value+"?"))
		subform(\'delrule\', value);
}
function subform(type, value)
{
	document.miniform.minitype.value=type;
	document.miniform.value.value=value;
	document.miniform.submit();
}
function move(id, value)
{
	subform(value, id);
}
</script>';
        //	if(isset($_POST['tea_useapiabove']))
        //	{
        //		$_POST['tea_corpid'] = $corp;
        //		$_POST['tea_allianceid'] = $alliance;
        //		unset($_POST['tea_useapiabove']);
        //	}
        //	if(!empty($_POST['tea_ts_delrule']
        if ($_POST['minitype'] == 'delrule') {
            if (!is_numeric($_POST['value'])) {
                die("delete value must be number");
            }
            $this->tea->query("DELETE FROM {db_prefix}tea_ts_rules WHERE id = " . $_POST['value']);
            redirectexit('action=admin;area=tea;sa=ts');
        } elseif ($_POST['minitype'] == 'up' || $_POST['minitype'] == 'down') {
            $id = $_POST['value'];
            if (!is_numeric($id)) {
                die("move id must be number");
            }
            $rules = $this->smcFunc['db_query']('', "SELECT id FROM {db_prefix}tea_ts_rules ORDER BY id");
            $rules = $this->tea->select($rules);
            if (!empty($rules)) {
                //	foreach($rules as $rule)
                //	{
                //		$rl[$rule[1]][$rule[0]] = $rule[0];
                //		if($rule[0] == $id)
                //			$main = $rule[1];
                //	}
                //	if(isset($main))
                //	{
                //		$rules = $rl[$main];
                //		sort($rules);
                foreach ($rules as $i => $rule) {
                    if ($rule[0] == $id) {
                        if ($_POST['minitype'] == 'up') {
                            $move = $rules[$i - 1][0];
                        } elseif ($_POST['minitype'] == 'down') {
                            $move = $rules[$i + 1][0];
                        }
                        $this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = -1 WHERE id = " . $move);
                        $this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = {$move} WHERE id = " . $id);
                        $this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = {$id} WHERE id = -1");
                        break;
                    }
                }
            }
            redirectexit('action=admin;area=tea;sa=ts');
        }
        if (isset($_POST['group'])) {
            $this->tea->query("DELETE FROM {db_prefix}tea_ts_groups");
            foreach ($_POST['group'] as $g => $v) {
                $this->tea->query("\n\t\t\t\t\t\tINSERT INTO {db_prefix}tea_ts_groups\n\t\t\t\t\t\t\t(id, value)\n\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t\t({string:id}, {int:value})", array('id' => $g, 'value' => '1'));
            }
        }
        // Saving?
        if (isset($_GET['save'])) {
            if ($_POST['tea_ts_addrule_group'] > -1 && !empty($_POST['tea_ts_addrule_tsg'])) {
                if (!is_numeric($_POST['tea_ts_addrule_group'])) {
                    die('Group must be Number');
                }
                $l = $_POST['tea_ts_addrule_tsg'][0];
                $_POST['tea_ts_addrule_tsg'] = substr($_POST['tea_ts_addrule_tsg'], 1);
                if (!is_numeric($_POST['tea_ts_addrule_tsg'])) {
                    die('Group must be Number');
                }
                if ($l != 's' && $l != 'c') {
                    die('Channel must be s or c');
                }
                if ($_POST['tea_ts_addrule_id'] == 'new') {
                    $this->tea->query('INSERT INTO {db_prefix}tea_ts_rules (smf, ts, tst, nf) VALUES (' . $_POST['tea_ts_addrule_group'] . ', ' . $_POST['tea_ts_addrule_tsg'] . ', \'' . $l . '\', \'' . mysql_real_escape_string($_POST['tea_ts_addrule_nf']) . '\')');
                } else {
                    if (!is_numeric($_POST['tea_ts_addrule_id'])) {
                        die('ID must be Number or new');
                    }
                    $this->tea->query("UPDATE {db_prefix}tea_ts_rules SET smf = " . $_POST['tea_ts_addrule_group'] . ", ts = " . $_POST['tea_ts_addrule_tsg'] . ", tst = '" . $l . "', nf = '" . mysql_real_escape_string($_POST['tea_ts_addrule_nf']) . "' WHERE id = " . $_POST['tea_ts_addrule_id']);
                }
            }
            unset($config_vars[100], $config_vars[101], $config_vars[102], $config_vars[103]);
            $config_vars[] = array('select', 'tea_charid', $charlist);
            $config_vars[] = array('text', 'tea_ts_info');
            saveDBSettings($config_vars);
            redirectexit('action=admin;area=tea;sa=ts');
            loadUserSettings();
            writeLog();
        }
        $this->context['post_url'] = $scripturl . '?action=admin;area=tea;sa=ts;save';
        //	$context['settings_title'] = $txt['tea_tea'];
        //	$context['settings_message'] = $txt['tea_settings_message'];
        prepareDBSettingContext($config_vars);
    }
Пример #4
0
<?php

/** @var modX $modx */
/** @var MODX_SMF $MODX_SMF */
if (defined('MODX_API_MODE')) {
    return;
}
$basePath = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
global $modx, $MODX_SMF;
define('MODX_API_MODE', true);
require $basePath . '/index.php';
$modx->getService('error', 'error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
$modx->setLogTarget('FILE');
$MODX_SMF = $modx->getService('modx_smf', 'MODX_SMF', $modx->getOption('smf_core_path', null, $modx->getOption('core_path') . 'components/smf/') . 'model/');
// integrate_profile_save hack for 2.0
if (!empty($_GET['action']) && preg_match('#^profile;area=account;u=(\\d+);save#', $_GET['action'], $matches) && !empty($_POST['u'])) {
    global $modSettings, $user_info;
    loadUserSettings();
    if ($user_info['id'] == $matches[1] && $user_info['id'] == $_POST['u']) {
        $data = array('name' => 'real_name', 'email' => 'email_address');
        foreach ($data as $k => $v) {
            if (isset($_POST[$v]) && $user_info[$k] != $_POST[$v]) {
                $MODX_SMF::smfOnUserUpdate(array($user_info['username']), $v, $_POST[$v]);
            }
        }
    }
}
Пример #5
0
function profileSendActivation()
{
    global $sourcedir, $profile_vars, $txt, $context, $scripturl, $smcFunc, $cookiename, $cur_profile, $language, $modSettings;
    require_once $sourcedir . '/Subs-Post.php';
    // Shouldn't happen but just in case.
    if (empty($profile_vars['email_address'])) {
        return;
    }
    $replacements = array('ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $context['id_member'] . ';code=' . $profile_vars['validation_code'], 'ACTIVATIONCODE' => $profile_vars['validation_code'], 'ACTIVATIONLINKWITHOUTCODE' => $scripturl . '?action=activate;u=' . $context['id_member']);
    // Send off the email.
    $emaildata = loadEmailTemplate('activate_reactivate', $replacements, empty($cur_profile['lngfile']) || empty($modSettings['userLanguage']) ? $language : $cur_profile['lngfile']);
    sendmail($profile_vars['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 0);
    // Log the user out.
    $smcFunc['db_query']('', '
		DELETE FROM {db_prefix}log_online
		WHERE id_member = {int:selected_member}', array('selected_member' => $context['id_member']));
    $_SESSION['log_time'] = 0;
    $_SESSION['login_' . $cookiename] = serialize(array(0, '', 0));
    if (isset($_COOKIE[$cookiename])) {
        $_COOKIE[$cookiename] = '';
    }
    loadUserSettings();
    $context['user']['is_logged'] = false;
    $context['user']['is_guest'] = true;
    // Send them to the done-with-registration-login screen.
    loadTemplate('Register');
    $context['page_title'] = $txt['profile'];
    $context['sub_template'] = 'after';
    $context['title'] = $txt['activate_changed_email_title'];
    $context['description'] = $txt['activate_changed_email_desc'];
    // We're gone!
    obExit();
}
Пример #6
0
function ModifyProfile2()
{
    global $txt, $modSettings;
    global $cookiename, $context;
    global $sourcedir, $scripturl, $db_prefix;
    global $ID_MEMBER, $user_info;
    global $context, $newpassemail, $user_profile, $validationCode;
    loadLanguage('Profile');
    /* Set allowed sub-actions.
    
    	 The format of $sa_allowed is as follows:
    
    	$sa_allowed = array(
    		'sub-action' => array(permission_array_for_editing_OWN_profile, permission_array_for_editing_ANY_profile, session_validation_method[, require_password]),
    		...
    	);
    
    	*/
    $sa_allowed = array('account' => array(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'), array('manage_membergroups', 'profile_identity_any'), 'post', true), 'forumProfile' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'), 'theme' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'), 'notification' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'), 'pmprefs' => array(array('profile_extra_any', 'profile_extra_own'), array('profile_extra_any'), 'post'), 'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any'), 'post', true), 'activateAccount' => array(array(), array('moderate_forum'), 'get'));
    // Is the current sub-action allowed?
    if (empty($_REQUEST['sa']) || !isset($sa_allowed[$_REQUEST['sa']])) {
        fatal_lang_error(453, false);
    }
    checkSession($sa_allowed[$_REQUEST['sa']][2]);
    // Start with no updates and no errors.
    $profile_vars = array();
    $post_errors = array();
    // Normally, don't send an email.
    $newpassemail = false;
    // Clean up the POST variables.
    $_POST = htmltrim__recursive($_POST);
    $_POST = stripslashes__recursive($_POST);
    $_POST = htmlspecialchars__recursive($_POST);
    $_POST = addslashes__recursive($_POST);
    // Search for the member being edited and put the information in $user_profile.
    $memberResult = loadMemberData((int) $_REQUEST['userID'], false, 'profile');
    if (!is_array($memberResult)) {
        fatal_lang_error(453, false);
    }
    list($memID) = $memberResult;
    // Are you modifying your own, or someone else's?
    if ($ID_MEMBER == $memID) {
        $context['user']['is_owner'] = true;
    } else {
        $context['user']['is_owner'] = false;
        validateSession();
    }
    // Check profile editing permissions.
    isAllowedTo($sa_allowed[$_REQUEST['sa']][$context['user']['is_owner'] ? 0 : 1]);
    // If this is yours, check the password.
    if ($context['user']['is_owner'] && !empty($sa_allowed[$_REQUEST['sa']][3])) {
        // 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'] = addslashes(un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])));
        // Does the integration want to check passwords?
        $good_password = false;
        if (isset($modSettings['integrate_verify_password']) && function_exists($modSettings['integrate_verify_password'])) {
            if (call_user_func($modSettings['integrate_verify_password'], $user_profile[$memID]['memberName'], $_POST['oldpasswrd'], false) === true) {
                $good_password = true;
            }
        }
        // Bad password!!!
        if (!$good_password && $user_info['passwd'] != sha1(strtolower($user_profile[$memID]['memberName']) . $_POST['oldpasswrd'])) {
            $post_errors[] = 'bad_password';
        }
    }
    // No need for the sub action array.
    unset($sa_allowed);
    // If the user is an admin - see if they are resetting someones username.
    if ($user_info['is_admin'] && isset($_POST['memberName'])) {
        // We'll need this...
        require_once $sourcedir . '/Subs-Auth.php';
        // Do the reset... this will send them an email too.
        resetPassword($memID, $_POST['memberName']);
    }
    // Change the IP address in the database.
    if ($context['user']['is_owner']) {
        $profile_vars['memberIP'] = "'{$user_info['ip']}'";
    }
    // Now call the sub-action function...
    if (isset($_POST['sa']) && $_POST['sa'] == 'deleteAccount') {
        deleteAccount2($profile_vars, $post_errors, $memID);
        if (empty($post_errors)) {
            redirectexit();
        }
    } else {
        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;
        $_REQUEST['sa'] = $_POST['sa'];
        $_REQUEST['u'] = $memID;
        return ModifyProfile($post_errors);
    }
    if (!empty($profile_vars)) {
        // If we've changed the password, notify any integration that may be listening in.
        if (isset($profile_vars['passwd']) && isset($modSettings['integrate_reset_pass']) && function_exists($modSettings['integrate_reset_pass'])) {
            call_user_func($modSettings['integrate_reset_pass'], $user_profile[$memID]['memberName'], $user_profile[$memID]['memberName'], $_POST['passwrd1']);
        }
        updateMemberData($memID, $profile_vars);
    }
    // What if this is the newest member?
    if ($modSettings['latestMember'] == $memID) {
        updateStats('member');
    } elseif (isset($profile_vars['realName'])) {
        updateSettings(array('memberlist_updated' => time()));
    }
    // If the member changed his/her birthdate, update calendar statistics.
    if (isset($profile_vars['birthdate']) || isset($profile_vars['realName'])) {
        updateStats('calendar');
    }
    // Send an email?
    if ($newpassemail) {
        require_once $sourcedir . '/Subs-Post.php';
        // Send off the email.
        sendmail($_POST['emailAddress'], $txt['activate_reactivate_title'] . ' ' . $context['forum_name'], "{$txt['activate_reactivate_mail']}\n\n" . "{$scripturl}?action=activate;u={$memID};code={$validationCode}\n\n" . "{$txt['activate_code']}: {$validationCode}\n\n" . $txt[130]);
        // Log the user out.
        db_query("\n\t\t\tDELETE FROM {$db_prefix}log_online\n\t\t\tWHERE ID_MEMBER = {$memID}", __FILE__, __LINE__);
        $_SESSION['log_time'] = 0;
        $_SESSION['login_' . $cookiename] = serialize(array(0, '', 0));
        if (isset($_COOKIE[$cookiename])) {
            $_COOKIE[$cookiename] = '';
        }
        loadUserSettings();
        $context['user']['is_logged'] = false;
        $context['user']['is_guest'] = true;
        // Send them to the done-with-registration-login screen.
        loadTemplate('Register');
        $context += array('page_title' => &$txt[79], 'sub_template' => 'after', 'description' => &$txt['activate_changed_email']);
        return;
    } elseif ($context['user']['is_owner']) {
        // Log them back in.
        if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '') {
            require_once $sourcedir . '/Subs-Auth.php';
            setLoginCookie(60 * $modSettings['cookieTime'], $memID, sha1(sha1(strtolower($user_profile[$memID]['memberName']) . un_htmlspecialchars(stripslashes($_POST['passwrd1']))) . $user_profile[$memID]['passwordSalt']));
        }
        loadUserSettings();
        writeLog();
    }
    // Back to same subaction page..
    redirectexit('action=profile;u=' . $memID . ';sa=' . $_REQUEST['sa'], isset($_POST['passwrd1']) && $context['server']['needs_login_fix'] || $context['browser']['is_ie'] && isset($_FILES['attachment']));
}
Пример #7
0
/**
 * Reload a users settings.
 */
function profileReloadUser()
{
    global $modSettings, $context, $cur_profile;
    // Log them back in - using the verify password as they must have matched and this one doesn't get changed by anyone!
    if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') {
        require_once SUBSDIR . '/Auth.subs.php';
        setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash('sha256', Util::strtolower($cur_profile['member_name']) . un_htmlspecialchars($_POST['passwrd2']) . $cur_profile['password_salt']));
    }
    loadUserSettings();
    writeLog();
}
Пример #8
0
function smf_main()
{
    global $modSettings, $settings, $user_info, $board, $topic, $maintenance, $sourcedir;
    // Special case: session keep-alive.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        die;
    }
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
    loadTheme();
    // Check if the user should be disallowed access.
    //	is_not_banned();
    // Load the current user's permissions.
    loadPermissions();
    // Do some logging, unless this is an attachment, avatar, theme option or XML feed.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml'))) {
        // Log this user as online.
        writeLog();
        // Track forum statistics and hits...?
        if (!empty($modSettings['hitStats'])) {
            trackStats(array('hits' => '+'));
        }
    }
    // Is the forum in maintenance mode? (doesn't apply to administrators.)
    if (!empty($maintenance) && !allowedTo('admin_forum')) {
        // You can only login.... otherwise, you're getting the "maintenance mode" display.
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout')) {
            require_once $sourcedir . '/LogInOut.php';
            return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
        } else {
            require_once $sourcedir . '/Subs-Auth.php';
            return 'InMaintenance';
        }
    } elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', 'verificationcode')))) {
        require_once $sourcedir . '/Subs-Auth.php';
        return 'KickGuest';
    } elseif (empty($_REQUEST['action'])) {
        // Action and board are both empty... BoardIndex!
        if (empty($board) && empty($topic)) {
            require_once $sourcedir . '/BoardIndex.php';
            return 'BoardIndex';
        } elseif (empty($topic)) {
            require_once $sourcedir . '/MessageIndex.php';
            return 'MessageIndex';
        } else {
            require_once $sourcedir . '/Display.php';
            return 'Display';
        }
    }
    // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
    $actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'Admin'), 'announce' => array('Post.php', 'AnnounceTopic'), 'ban' => array('ManageBans.php', 'Ban'), 'boardrecount' => array('Admin.php', 'AdminBoardRecount'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'cleanperms' => array('Admin.php', 'CleanupPermissions'), 'collapse' => array('Subs-Boards.php', 'CollapseCategory'), 'convertentities' => array('Admin.php', 'ConvertEntities'), 'convertutf8' => array('Admin.php', 'ConvertUtf8'), 'coppa' => array('Register.php', 'CoppaForm'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'detailedversion' => array('Admin.php', 'VersionDetail'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'dumpdb' => array('DumpDatabase.php', 'DumpDatabase2'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'featuresettings' => array('ModSettings.php', 'ModifyFeatureSettings'), 'featuresettings2' => array('ModSettings.php', 'ModifyFeatureSettings2'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockVoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'maintain' => array('Admin.php', 'Maintenance'), 'manageattachments' => array('ManageAttachments.php', 'ManageAttachments'), 'manageboards' => array('ManageBoards.php', 'ManageBoards'), 'managecalendar' => array('ManageCalendar.php', 'ManageCalendar'), 'managesearch' => array('ManageSearch.php', 'ManageSearch'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'membergroups' => array('ManageMembergroups.php', 'ModifyMembergroups'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'modlog' => array('Modlog.php', 'ViewModlog'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'news' => array('ManageNews.php', 'ManageNews'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'optimizetables' => array('Admin.php', 'OptimizeTables'), 'packageget' => array('PackageGet.php', 'PackageGet'), 'packages' => array('Packages.php', 'Packages'), 'permissions' => array('ManagePermissions.php', 'ModifyPermissions'), 'pgdownload' => array('PackageGet.php', 'PackageGet'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'postsettings' => array('ManagePosts.php', 'ManagePostSettings'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'profile2' => array('Profile.php', 'ModifyProfile2'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('Subs-Boards.php', 'QuickModeration'), 'quickmod2' => array('Subs-Boards.php', 'QuickModeration2'), 'recent' => array('Recent.php', 'RecentPosts'), 'regcenter' => array('ManageRegistration.php', 'RegCenter'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'removeoldtopics2' => array('RemoveTopic.php', 'RemoveOldTopics2'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'repairboards' => array('RepairBoards.php', 'RepairBoards'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'reports' => array('Reports.php', 'ReportsMain'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'SendTopic'), 'serversettings' => array('ManageServer.php', 'ModifySettings'), 'serversettings2' => array('ManageServer.php', 'ModifySettings2'), 'smileys' => array('ManageSmileys.php', 'ManageSmileys'), 'smstats' => array('Stats.php', 'SMStats'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'viewErrorLog' => array('ManageErrors.php', 'ViewErrorLog'), 'viewmembers' => array('ManageMembers.php', 'ViewMembers'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'));
    // Get the function and file to include - if it's not there, do the board index.
    if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
        // Catch the action with the theme?
        if (!empty($settings['catch_action'])) {
            require_once $sourcedir . '/Themes.php';
            return 'WrapAction';
        }
        // Fall through to the board index then...
        require_once $sourcedir . '/BoardIndex.php';
        return 'BoardIndex';
    }
    // Otherwise, it was set - so let's go to that action.
    require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
    return $actionArray[$_REQUEST['action']][1];
}
Пример #9
0
function ModifyLayoutSettings()
{
    global $txt, $scripturl, $context, $settings, $sc;
    $config_vars = array(array('check', 'compactTopicPagesEnable'), array('int', 'compactTopicPagesContiguous', null, $txt['smf235'] . '<div class="smalltext">' . str_replace(' ', '&nbsp;', '"3" ' . $txt['smf236'] . ': <b>1 ... 4 [5] 6 ... 9</b>') . '<br />' . str_replace(' ', '&nbsp;', '"5" ' . $txt['smf236'] . ': <b>1 ... 3 4 [5] 6 7 ... 9</b>') . '</div>'), '', array('select', 'todayMod', array(&$txt['smf290'], &$txt['smf291'], &$txt['smf292'])), array('check', 'topbottomEnable'), array('check', 'onlineEnable'), array('check', 'enableVBStyleLogin'), '', array('int', 'defaultMaxMembers'), '', array('check', 'timeLoadPageEnable'), array('check', 'disableHostnameLookup'), '', array('check', 'who_enabled'));
    // Saving?
    if (isset($_GET['save'])) {
        saveDBSettings($config_vars);
        redirectexit('action=featuresettings;sa=layout');
        loadUserSettings();
        writeLog();
    }
    $context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=layout';
    $context['settings_title'] = $txt['mods_cat_layout'];
    prepareDBSettingContext($config_vars);
}
Пример #10
0
 function EveApi($txt, $scripturl, &$context, $settings, $sc)
 {
     // old settings mod?
     die("old function?");
     if (!$this->modSettings["tea_enable"]) {
         return;
     }
     $config_vars = array('', array('check', 'tea_enable'), '', array('int', 'tea_userid', 10), array('text', 'tea_api', 64), '');
     // Saving?
     if (isset($_GET['save'])) {
         saveDBSettings($config_vars);
         redirectexit('action=featuresettings;sa=tea');
         loadUserSettings();
         writeLog();
     }
     $context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=tea';
     $context['settings_title'] = $this->txt['mods_cat_layout'];
     $context['settings_message'] = $this->txt['tea_settings_message'];
     //	prepareDBSettingContext($config_vars);
 }
Пример #11
0
function smf_main()
{
    global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir, $request_name, $txt, $user_settings, $mobiquo_config, $topic_per_page, $limit_num;
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current user's permissions.
    loadPermissions();
    // Attachments don't require the entire theme to be loaded.
    loadTheme();
    header('Mobiquo_is_login:'******'context']['user']['is_logged'] ? 'true' : 'false'));
    // Check if the user should be disallowed access.
    if (!in_array($request_name, array('get_config', 'login'))) {
        is_not_banned();
    }
    // If we are in a topic and don't have permission to approve it then duck out now.
    if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
        //fatal_lang_error('not_a_topic', false);
        get_error('The topic is not approved');
    }
    // Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'))) {
        // Log this user as online.
        writeLog();
        // Track forum statistics and hits...?
        if (!empty($modSettings['hitStats'])) {
            trackStats(array('hits' => '+'));
        }
    }
    // Is the forum in maintenance mode? (doesn't apply to administrators.)
    if (!empty($maintenance) && !allowedTo('admin_forum')) {
        if ($request_name != 'get_config' && $request_name != 'login') {
            get_error($txt['maintain_mode_on']);
        }
    } elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('push_content_check', 'user_subscription', 'set_api_key', 'reset_push_slug', 'prefetch_account', 'update_password', 'forget_password', 'sign_in', 'coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn')))) {
        if ($request_name != 'get_config' && $request_name != 'prefetch_account') {
            loadLanguage('Login');
            get_error($txt['only_members_can_access']);
            //require_once($sourcedir . '/Subs-Auth.php');
            //return 'KickGuest';
        }
    }
    //-------------transform input data to local character set if needed
    utf8_to_local();
    //-------------change some setting for tapatalk display
    $settings['message_index_preview'] = 1;
    $modSettings['todayMod_bak'] = $modSettings['todayMod'];
    $modSettings['todayMod'] = 0;
    $user_settings['pm_prefs'] = 0;
    $user_info['user_time_format'] = $user_info['time_format'];
    $user_info['time_format'] = '%Y%m%dT%H:%M:%S+00:00';
    $modSettings['disableCustomPerPage'] = 1;
    $modSettings['disableCheckUA'] = 1;
    $modSettings['defaultMaxMessages'] = isset($limit_num) ? $limit_num : 20;
    $modSettings['defaultMaxMembers'] = 100;
    $modSettings['search_results_per_page'] = isset($topic_per_page) && $topic_per_page > 0 ? $topic_per_page : 20;
    $modSettings['defaultMaxTopics'] = isset($topic_per_page) && $topic_per_page > 0 ? $topic_per_page : 20;
    $modSettings['disable_pm_verification'] = $mobiquo_config['disable_pm_verification'];
    //-------------do something before action--------------
    if (function_exists('before_action_' . $request_name)) {
        call_user_func('before_action_' . $request_name);
    }
    if (empty($_REQUEST['action']) && !empty($board)) {
        if (empty($topic)) {
            require_once 'include/MessageIndex.php';
            return 'MessageIndex';
        } else {
            require_once 'include/Display.php';
            return 'Display';
        }
    }
    // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
    $actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'AdminMain'), 'announce' => array('Post.php', 'AnnounceTopic'), 'attachapprove' => array('ManageAttachments.php', 'ApproveAttach'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'clock' => array('Calendar.php', 'clock'), 'collapse' => array('BoardIndex.php', 'CollapseCategory'), 'coppa' => array('Register.php', 'CoppaForm'), 'credits' => array('Who.php', 'Credits'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'emailuser' => array('SendTopic.php', 'EmailUser'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'groups' => array('Groups.php', 'Groups'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jseditor' => array('Subs-Editor.php', 'EditorMain'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockvoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'moderate' => array('ModerationCenter.php', 'ModerationMain'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'openidreturn' => array('Subs-OpenID.php', 'smf_openID_return'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('MessageIndex.php', 'QuickModeration'), 'quickmod2' => array('Display.php', 'QuickInTopicModeration'), 'recent' => array('Recent.php', 'RecentPosts'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'EmailUser'), 'smstats' => array('Stats.php', 'SMStats'), 'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile-View.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'viewsmfile' => array('Admin.php', 'DisplayAdminFile'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'), 'xmlhttp' => array('Xml.php', 'XMLhttpMain'));
    // Allow modifying $actionArray easily.
    call_integration_hook('integrate_actions', array(&$actionArray));
    //error_log($request_name.'-'.$_REQUEST['action']);   //for debugging
    // Get the function and file to include - if it's not there, do the board index.
    if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
        if (function_exists('action_' . $request_name)) {
            return 'action_' . $request_name;
        } else {
            get_error('Invalid action');
        }
    }
    $local_action = array('login2', 'post', 'post2', 'who', 'profile', 'notify', 'notifyboard', 'markasread', 'unread', 'search2', 'pm', 'logout');
    // Otherwise, it was set - so let's go to that action.
    if (in_array($_REQUEST['action'], $local_action)) {
        if (file_exists(TT_ROOT . 'include/' . $actionArray[$_REQUEST['action']][0])) {
            require_once TT_ROOT . 'include/' . $actionArray[$_REQUEST['action']][0];
        } else {
            if (file_exists($sourcedir . '/' . $actionArray[$_REQUEST['action']][0])) {
                require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
            }
        }
    } else {
        if (file_exists($sourcedir . '/' . $actionArray[$_REQUEST['action']][0])) {
            require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
        }
    }
    return $actionArray[$_REQUEST['action']][1];
}