[ Index ] |
PHP Cross Reference of MyBB 1.8.38 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybb.com 7 * License: http://www.mybb.com/about/license 8 * 9 */ 10 11 // If archive mode does not work, uncomment the line below and try again 12 // define("ARCHIVE_QUERY_STRINGS", 1); 13 14 // Lets pretend we're a level higher 15 chdir('./../'); 16 17 require_once dirname(dirname(__FILE__))."/inc/init.php"; 18 19 require_once MYBB_ROOT."inc/functions_archive.php"; 20 require_once MYBB_ROOT."inc/class_session.php"; 21 require_once MYBB_ROOT."inc/class_parser.php"; 22 $parser = new postParser; 23 24 $shutdown_queries = $shutdown_functions = array(); 25 26 $groupscache = $cache->read("usergroups"); 27 if(!is_array($groupscache)) 28 { 29 $cache->update_usergroups(); 30 $groupscache = $cache->read("usergroups"); 31 } 32 $fpermissioncache = $cache->read("forumpermissions"); 33 34 // Send headers before anything else. 35 send_page_headers(); 36 37 // If the installer has not been removed and no lock exists, die. 38 if(is_dir(MYBB_ROOT."install") && !file_exists(MYBB_ROOT."install/lock")) 39 { 40 echo "Please remove the install directory from your server, or create a file called 'lock' in the install directory. Until you do so, your board will remain unaccessable"; 41 exit; 42 } 43 44 // If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings - DIRECTORY_SEPARATOR checks if running windows 45 //if((DIRECTORY_SEPARATOR != '\\' && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') == false) || stripos(SAPI_NAME, 'cgi') !== false || defined("ARCHIVE_QUERY_STRINGS")) 46 // http://dev.mybb.com/issues/1489 - remove automatic detection and rely on users to set the right option here 47 if($mybb->settings['seourls_archive'] == 1) 48 { 49 if($_SERVER['REQUEST_URI']) 50 { 51 $url = $_SERVER['REQUEST_URI']; 52 } 53 elseif($_SERVER['REDIRECT_URL']) 54 { 55 $url = $_SERVER['REDIRECT_URL']; 56 } 57 elseif($_SERVER['PATH_INFO']) 58 { 59 $url = $_SERVER['PATH_INFO']; 60 } 61 else 62 { 63 $url = $_SERVER['PHP_SELF']; 64 } 65 $base_url = $mybb->settings['bburl']."/archive/index.php/"; 66 $endpart = my_substr(strrchr($url, "/"), 1); 67 } 68 else 69 { 70 $url = $_SERVER['QUERY_STRING']; 71 $base_url = $mybb->settings['bburl']."/archive/index.php?"; 72 $endpart = $url; 73 } 74 75 $action = "index"; 76 77 // This seems to work the same as the block below except without the css bugs O_o 78 $archiveurl = $mybb->settings['bburl'].'/archive'; 79 80 if($endpart != "index.php") 81 { 82 $endpart = str_replace(".html", "", $endpart); 83 $todo = explode("-", $endpart, 3); 84 if($todo[0]) 85 { 86 $action = $action2 = $todo[0]; 87 } 88 if(!empty($todo[2])) 89 { 90 $page = (int)$todo[2]; 91 } 92 else 93 { 94 $page = 1; 95 } 96 if(!empty($todo[1])) 97 { 98 $id = (int)$todo[1]; 99 } 100 else 101 { 102 $id = 0; 103 } 104 105 // Get the thread, announcement or forum information. 106 if($action == "announcement") 107 { 108 $time = TIME_NOW; 109 $query = $db->query(" 110 SELECT a.*, u.username 111 FROM ".TABLE_PREFIX."announcements a 112 LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) 113 WHERE a.aid='{$id}' AND startdate < '{$time}' AND (enddate > '{$time}' OR enddate = 0) 114 "); 115 $announcement = $db->fetch_array($query); 116 if(!$announcement) 117 { 118 $action = "404"; 119 } 120 } 121 elseif($action == "thread") 122 { 123 $query = $db->simple_select("threads", "*", "tid='{$id}' AND closed NOT LIKE 'moved|%'"); 124 $thread = $db->fetch_array($query); 125 if(!$thread) 126 { 127 $action = "404"; 128 } 129 } 130 elseif($action == "forum") 131 { 132 $query = $db->simple_select("forums", "*", "fid='{$id}' AND active!=0 AND password=''"); 133 $forum = $db->fetch_array($query); 134 if(!$forum) 135 { 136 $action = "404"; 137 } 138 } 139 elseif($action != 'index') 140 { 141 $action = "404"; 142 } 143 } 144 145 // Define the full MyBB version location of this page. 146 if($action == "thread") 147 { 148 define('MYBB_LOCATION', get_thread_link($id)); 149 } 150 elseif($action == "forum") 151 { 152 define('MYBB_LOCATION', get_forum_link($id)); 153 } 154 elseif($action == "announcement") 155 { 156 define('MYBB_LOCATION', get_announcement_link($id)); 157 } 158 else 159 { 160 define('MYBB_LOCATION', INDEX_URL); 161 } 162 163 // Initialise session 164 $session = new session; 165 $session->init(); 166 167 if(!$mybb->settings['bblanguage']) 168 { 169 $mybb->settings['bblanguage'] = "english"; 170 } 171 $lang->set_language($mybb->settings['bblanguage']); 172 173 // Load global language phrases 174 $lang->load("global"); 175 $lang->load("messages"); 176 $lang->load("archive"); 177 178 // Draw up the basic part of our naviagation 179 $navbits[0]['name'] = $mybb->settings['bbname_orig']; 180 $navbits[0]['url'] = $mybb->settings['bburl']."/archive/index.php"; 181 182 // Check banned ip addresses 183 if(is_banned_ip($session->ipaddress)) 184 { 185 archive_error($lang->error_banned); 186 } 187 188 // If our board is closed.. 189 if($mybb->settings['boardclosed'] == 1) 190 { 191 if($mybb->usergroup['canviewboardclosed'] != 1) 192 { 193 if(!$mybb->settings['boardclosed_reason']) 194 { 195 $mybb->settings['boardclosed_reason'] = $lang->boardclosed_reason; 196 } 197 198 $lang->error_boardclosed .= "<blockquote>".$mybb->settings['boardclosed_reason']."</blockquote>"; 199 archive_error($lang->error_boardclosed); 200 } 201 } 202 203 // Do we require users to login? 204 if($mybb->settings['forcelogin'] == 1) 205 { 206 if($mybb->user['uid'] == 0) 207 { 208 archive_error($lang->error_mustlogin); 209 } 210 } 211 212 // Load Limiting 213 if($mybb->usergroup['cancp'] != 1 && $mybb->settings['load'] > 0 && ($load = get_server_load()) && $load != $lang->unknown && $load > $mybb->settings['load']) 214 { 215 // User is not an administrator and the load limit is higher than the limit, show an error 216 archive_error($lang->error_loadlimit); 217 } 218 219 if($mybb->usergroup['canview'] == 0) 220 { 221 archive_error_no_permission(); 222 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |