123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <?php
- $forum_version = 'SMF 2.1 Alpha 1';
- define('SMF', 1);
- if (function_exists('set_magic_quotes_runtime'))
- @set_magic_quotes_runtime(0);
- error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
- $time_start = microtime();
- ob_start();
- foreach (array('db_character_set', 'cachedir') as $variable)
- if (isset($GLOBALS[$variable]))
- unset($GLOBALS[$variable], $GLOBALS[$variable]);
- require_once(dirname(__FILE__) . '/Settings.php');
- if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
- $cachedir = $boarddir . '/cache';
- require_once($sourcedir . '/QueryString.php');
- require_once($sourcedir . '/Session.php');
- require_once($sourcedir . '/Subs.php');
- require_once($sourcedir . '/Errors.php');
- require_once($sourcedir . '/Logging.php');
- require_once($sourcedir . '/Load.php');
- require_once($sourcedir . '/Security.php');
- require_once($sourcedir . '/Class-BrowserDetect.php');
- if (version_compare(PHP_VERSION, '5.1', '<'))
- require_once($sourcedir . '/Subs-Compat.php');
- if (!empty($maintenance) && $maintenance == 2)
- display_maintenance_message();
- $smcFunc = array();
- loadDatabase();
- reloadSettings();
- cleanRequest();
- $context = array();
- if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
- smf_seed_generator();
- if (isset($_GET['scheduled']))
- {
- require_once($sourcedir . '/ScheduledTasks.php');
- AutoTask();
- }
- if (!empty($modSettings['enableCompressedOutput']) && !headers_sent())
- {
-
- if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler')
- $modSettings['enableCompressedOutput'] = '0';
- else
- {
- ob_end_clean();
- ob_start('ob_gzhandler');
- }
- }
- set_error_handler('error_handler');
- loadSession();
- if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
- unset($_SESSION['nowap']);
- elseif (isset($_REQUEST['nowap']))
- $_SESSION['nowap'] = true;
- elseif (!isset($_SESSION['nowap']))
- {
- if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
- $_REQUEST['wap2'] = 1;
- elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
- {
- if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
- $_REQUEST['imode'] = 1;
- else
- $_REQUEST['wap'] = 1;
- }
- }
- if (!defined('WIRELESS'))
- define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));
- if (WIRELESS)
- {
- define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' : '')));
-
-
- $modSettings['enableCompressedOutput'] = '0';
-
- $modSettings['defaultMaxMessages'] = 5;
- $modSettings['defaultMaxTopics'] = 9;
-
- if (WIRELESS_PROTOCOL == 'wap')
- header('Content-Type: text/vnd.wap.wml');
- }
- if (isset($_GET['openid_restore_post']) && !empty($_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]['post']) && empty($_POST))
- {
- $_POST = $_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]['post'];
- unset($_SESSION['openid']['saved_data'][$_GET['openid_restore_post']]);
- }
- call_user_func(smf_main());
- obExit(null, null, true);
- function smf_main()
- {
- global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir;
-
- if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
- {
- header('Content-Type: image/gif');
- die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
- }
-
- loadUserSettings();
-
- loadBoard();
-
- loadPermissions();
-
- if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest']))
- detectBrowser();
-
- else
- loadTheme();
-
- is_not_banned();
-
- 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', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
- call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
-
- if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $no_stat_actions))
- {
-
- writeLog();
-
- if (!empty($modSettings['hitStats']))
- trackStats(array('hits' => '+'));
- }
- unset($no_stat_actions);
-
- if (!empty($maintenance) && !allowedTo('admin_forum'))
- {
-
- 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']))
- {
-
- if (empty($board) && empty($topic))
- {
- $call = '';
- call_integration_hook('integrate_default_action', array(&$call));
- $call = strpos($call, '::') !== false ? explode('::', $call) : $call;
- if (!empty($call) && is_callable($call))
- return $call;
- 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';
- }
- }
-
- $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'),
- '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'),
- 'jsmodify' => array('Post.php', 'JavaScriptModify'),
- 'jsoption' => array('Themes.php', 'SetJavaScript'),
- 'loadeditorlocale' => array('Subs-Editor.php', 'loadLocale'),
- 'lock' => array('Topic.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('Topic.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'),
- );
-
- call_integration_hook('integrate_actions', array(&$actionArray));
-
- if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']]))
- {
-
- if (!empty($settings['catch_action']))
- {
- require_once($sourcedir . '/Themes.php');
- return 'WrapAction';
- }
-
- require_once($sourcedir . '/BoardIndex.php');
- return 'BoardIndex';
- }
-
- require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]);
- return $actionArray[$_REQUEST['action']][1];
- }
- ?>
|