[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id$ 10 */ 11 12 $working_dir = dirname(__FILE__); 13 if(!$working_dir) 14 { 15 $working_dir = '.'; 16 } 17 18 // Load main MyBB core file which begins all of the magic 19 require_once $working_dir."/inc/init.php"; 20 21 $shutdown_queries = array(); 22 23 // Read the usergroups cache as well as the moderators cache 24 $groupscache = $cache->read("usergroups"); 25 26 // If the groups cache doesn't exist, update it and re-read it 27 if(!is_array($groupscache)) 28 { 29 $cache->update_usergroups(); 30 $groupscache = $cache->read("usergroups"); 31 } 32 33 if(!defined('THIS_SCRIPT')) 34 { 35 define('THIS_SCRIPT', ''); 36 } 37 38 $current_page = my_strtolower(basename(THIS_SCRIPT)); 39 40 // Send page headers - don't send no-cache headers for attachment.php 41 if($current_page != "attachment.php") 42 { 43 send_page_headers(); 44 } 45 46 // Do not use session system for defined pages 47 if((@isset($mybb->input['action']) && @isset($nosession[$mybb->input['action']])) || (@isset($mybb->input['thumbnail']) && $current_page == 'attachment.php')) 48 { 49 define("NO_ONLINE", 1); 50 } 51 52 // Create session for this user 53 require_once MYBB_ROOT."inc/class_session.php"; 54 $session = new session; 55 $session->init(); 56 $mybb->session = &$session; 57 58 $mybb->user['ismoderator'] = is_moderator("", "", $mybb->user['uid']); 59 60 // Set our POST validation code here 61 $mybb->post_code = generate_post_check(); 62 63 // Set and load the language 64 if(!empty($mybb->input['language']) && $lang->language_exists($mybb->input['language']) && verify_post_check($mybb->input['my_post_key'], true)) 65 { 66 $mybb->settings['bblanguage'] = $mybb->input['language']; 67 // If user is logged in, update their language selection with the new one 68 if($mybb->user['uid']) 69 { 70 if($mybb->cookies['mybblang']) 71 { 72 my_unsetcookie("mybblang"); 73 } 74 75 $db->update_query("users", array("language" => $db->escape_string($mybb->settings['bblanguage'])), "uid='{$mybb->user['uid']}'"); 76 } 77 // Guest = cookie 78 else 79 { 80 my_setcookie("mybblang", $mybb->settings['bblanguage']); 81 } 82 $mybb->user['language'] = $mybb->settings['bblanguage']; 83 } 84 // Cookied language! 85 else if(!$mybb->user['uid'] && !empty($mybb->cookies['mybblang']) && $lang->language_exists($mybb->cookies['mybblang'])) 86 { 87 $mybb->settings['bblanguage'] = $mybb->cookies['mybblang']; 88 } 89 else if(!isset($mybb->settings['bblanguage'])) 90 { 91 $mybb->settings['bblanguage'] = "english"; 92 } 93 94 // Load language 95 $lang->set_language($mybb->settings['bblanguage']); 96 $lang->load("global"); 97 $lang->load("messages"); 98 $newpmmsg = ''; 99 100 // Run global_start plugin hook now that the basics are set up 101 $plugins->run_hooks("global_start"); 102 103 if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset'])) 104 { 105 @mb_internal_encoding($lang->settings['charset']); 106 } 107 108 // Select the board theme to use. 109 $loadstyle = ''; 110 $load_from_forum = 0; 111 $style = array(); 112 113 // This user has a custom theme set in their profile 114 if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0) 115 { 116 $loadstyle = "tid='".$mybb->user['style']."'"; 117 } 118 119 $valid = array( 120 "showthread.php", 121 "forumdisplay.php", 122 "newthread.php", 123 "newreply.php", 124 "ratethread.php", 125 "editpost.php", 126 "polls.php", 127 "sendthread.php", 128 "printthread.php", 129 "moderation.php" 130 ); 131 132 if(in_array($current_page, $valid)) 133 { 134 cache_forums(); 135 136 // If we're accessing a post, fetch the forum theme for it and if we're overriding it 137 if(!empty($mybb->input['pid'])) 138 { 139 $query = $db->simple_select("posts", "fid", "pid = '".intval($mybb->input['pid'])."'", array("limit" => 1)); 140 $fid = $db->fetch_field($query, "fid"); 141 142 if($fid) 143 { 144 $style = $forum_cache[$fid]; 145 $load_from_forum = 1; 146 } 147 } 148 // We have a thread id and a forum id, we can easily fetch the theme for this forum 149 else if(!empty($mybb->input['tid'])) 150 { 151 $query = $db->simple_select("threads", "fid", "tid = '".intval($mybb->input['tid'])."'", array("limit" => 1)); 152 $fid = $db->fetch_field($query, "fid"); 153 154 if($fid) 155 { 156 $style = $forum_cache[$fid]; 157 $load_from_forum = 1; 158 } 159 } 160 161 // We have a forum id - simply load the theme from it 162 else if($mybb->input['fid']) 163 { 164 $style = $forum_cache[intval($mybb->input['fid'])]; 165 $load_from_forum = 1; 166 } 167 } 168 unset($valid); 169 170 // From all of the above, a theme was found 171 if(isset($style['style']) && $style['style'] > 0) 172 { 173 // This theme is forced upon the user, overriding their selection 174 if($style['overridestyle'] == 1 || !isset($mybb->user['style'])) 175 { 176 $loadstyle = "tid='".intval($style['style'])."'"; 177 } 178 } 179 180 // After all of that no theme? Load the board default 181 if(empty($loadstyle)) 182 { 183 $loadstyle = "def='1'"; 184 } 185 186 // Fetch the theme to load from the database 187 $query = $db->simple_select("themes", "name, tid, properties, stylesheets", $loadstyle, array('limit' => 1)); 188 $theme = $db->fetch_array($query); 189 190 // No theme was found - we attempt to load the master or any other theme 191 if(!$theme['tid']) 192 { 193 // Missing theme was from a forum, run a query to set any forums using the theme to the default 194 if($load_from_forum == 1) 195 { 196 $db->update_query("forums", array("style" => 0), "style='{$style['style']}'"); 197 } 198 // Missing theme was from a user, run a query to set any users using the theme to the default 199 else if($load_from_user == 1) 200 { 201 $db->update_query("users", array("style" => 0), "style='{$style['style']}'"); 202 } 203 // Attempt to load the master or any other theme if the master is not available 204 $query = $db->simple_select("themes", "name, tid, properties, stylesheets", "", array("order_by" => "tid", "limit" => 1)); 205 $theme = $db->fetch_array($query); 206 } 207 $theme = @array_merge($theme, unserialize($theme['properties'])); 208 209 // Fetch all necessary stylesheets 210 $stylesheets = ''; 211 $theme['stylesheets'] = unserialize($theme['stylesheets']); 212 $stylesheet_scripts = array("global", basename($_SERVER['PHP_SELF'])); 213 foreach($stylesheet_scripts as $stylesheet_script) 214 { 215 $stylesheet_actions = array("global"); 216 if(!empty($mybb->input['action'])) 217 { 218 $stylesheet_actions[] = $mybb->input['action']; 219 } 220 // Load stylesheets for global actions and the current action 221 foreach($stylesheet_actions as $stylesheet_action) 222 { 223 if(!$stylesheet_action) 224 { 225 continue; 226 } 227 228 if(!empty($theme['stylesheets'][$stylesheet_script][$stylesheet_action])) 229 { 230 // Actually add the stylesheets to the list 231 foreach($theme['stylesheets'][$stylesheet_script][$stylesheet_action] as $page_stylesheet) 232 { 233 if(!empty($already_loaded[$page_stylesheet])) 234 { 235 continue; 236 } 237 $stylesheets .= "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$mybb->settings['bburl']}/{$page_stylesheet}\" />\n"; 238 $already_loaded[$page_stylesheet] = 1; 239 } 240 } 241 } 242 } 243 244 // Are we linking to a remote theme server? 245 if(substr($theme['imgdir'], 0, 7) == "http://" || substr($theme['imgdir'], 0, 8) == "https://") 246 { 247 // If a language directory for the current language exists within the theme - we use it 248 if(!empty($mybb->user['language'])) 249 { 250 $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language']; 251 } 252 else 253 { 254 // Check if a custom language directory exists for this theme 255 if(!empty($mybb->settings['bblanguage'])) 256 { 257 $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; 258 } 259 // Otherwise, the image language directory is the same as the language directory for the theme 260 else 261 { 262 $theme['imglangdir'] = $theme['imgdir']; 263 } 264 } 265 } 266 else 267 { 268 if(!@is_dir($theme['imgdir'])) 269 { 270 $theme['imgdir'] = "images"; 271 } 272 273 // If a language directory for the current language exists within the theme - we use it 274 if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language'])) 275 { 276 $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language']; 277 } 278 else 279 { 280 // Check if a custom language directory exists for this theme 281 if(is_dir($theme['imgdir'].'/'.$mybb->settings['bblanguage'])) 282 { 283 $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; 284 } 285 // Otherwise, the image language directory is the same as the language directory for the theme 286 else 287 { 288 $theme['imglangdir'] = $theme['imgdir']; 289 } 290 } 291 } 292 293 // Theme logo - is it a relative URL to the forum root? Append bburl 294 if(!preg_match("#^(\.\.?(/|$)|([a-z0-9]+)://)#i", $theme['logo']) && substr($theme['logo'], 0, 1) != "/") 295 { 296 $theme['logo'] = $mybb->settings['bburl']."/".$theme['logo']; 297 } 298 299 // Load Main Templates and Cached Templates 300 if(isset($templatelist)) 301 { 302 $templatelist .= ','; 303 } 304 $templatelist .= "headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin,global_pm_alert,global_unreadreports"; 305 $templatelist .= ",global_pending_joinrequests,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,header_welcomeblock_member_moderator,redirect,error"; 306 $templatelist .= ",global_boardclosed_warning,global_bannedwarning,error_inline,error_nopermission_loggedin,error_nopermission"; 307 $templates->cache($db->escape_string($templatelist)); 308 309 // Set the current date and time now 310 $datenow = my_date($mybb->settings['dateformat'], TIME_NOW, '', false); 311 $timenow = my_date($mybb->settings['timeformat'], TIME_NOW); 312 $lang->welcome_current_time = $lang->sprintf($lang->welcome_current_time, $datenow . $lang->comma . $timenow); 313 314 // Format the last visit date of this user appropriately 315 if(isset($mybb->user['lastvisit'])) 316 { 317 $lastvisit = my_date($mybb->settings['dateformat'], $mybb->user['lastvisit']) . $lang->comma . my_date($mybb->settings['timeformat'], $mybb->user['lastvisit']); 318 } 319 320 // Otherwise, they've never visited before 321 else 322 { 323 $lastvisit = $lang->lastvisit_never; 324 } 325 326 // If the board is closed and we have an Administrator, show board closed warning 327 $bbclosedwarning = ''; 328 if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['cancp'] == 1) 329 { 330 eval("\$bbclosedwarning = \"".$templates->get("global_boardclosed_warning")."\";"); 331 } 332 333 // Prepare the main templates for use 334 unset($admincplink); 335 336 // Load appropriate welcome block for the current logged in user 337 if($mybb->user['uid'] != 0) 338 { 339 // User can access the admin cp and we're not hiding admin cp links, fetch it 340 if($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1) 341 { 342 $admin_dir = $config['admin_dir']; 343 eval("\$admincplink = \"".$templates->get("header_welcomeblock_member_admin")."\";"); 344 } 345 346 if($mybb->usergroup['canmodcp'] == 1) 347 { 348 eval("\$modcplink = \"".$templates->get("header_welcomeblock_member_moderator")."\";"); 349 } 350 351 // Format the welcome back message 352 $lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit); 353 354 // Tell the user their PM usage 355 $lang->welcome_pms_usage = $lang->sprintf($lang->welcome_pms_usage, my_number_format($mybb->user['pms_unread']), my_number_format($mybb->user['pms_total'])); 356 eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_member")."\";"); 357 } 358 // Otherwise, we have a guest 359 else 360 { 361 switch($mybb->settings['username_method']) 362 { 363 case 0: 364 $login_username = $lang->login_username; 365 break; 366 case 1: 367 $login_username = $lang->login_username1; 368 break; 369 case 2: 370 $login_username = $lang->login_username2; 371 break; 372 default: 373 $login_username = $lang->login_username; 374 break; 375 } 376 eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_guest")."\";"); 377 } 378 379 $pending_joinrequests = ''; 380 381 // Read the group leaders cache 382 $groupleaders = $cache->read("groupleaders"); 383 if($mybb->user['uid'] != 0 && is_array($groupleaders) && array_key_exists($mybb->user['uid'], $groupleaders)) 384 { 385 $groupleader = $groupleaders[$mybb->user['uid']]; 386 387 $gids = ""; 388 foreach($groupleader as $user) 389 { 390 if($user['canmanagerequests'] != 1) 391 { 392 continue; 393 } 394 395 $gids .= ",{$user['gid']}"; 396 } 397 398 $query = $db->simple_select("joinrequests", "COUNT(uid) as total", "gid IN (0{$gids})"); 399 $total_joinrequests = $db->fetch_field($query, "total"); 400 401 $pending_joinrequests = ""; 402 if($total_joinrequests > 0) 403 { 404 if($total_joinrequests == 1) 405 { 406 $lang->pending_joinrequests = $lang->pending_joinrequest; 407 } 408 else 409 { 410 $lang->pending_joinrequests = $lang->sprintf($lang->pending_joinrequests, $total_joinrequests); 411 } 412 eval("\$pending_joinrequests = \"".$templates->get("global_pending_joinrequests")."\";"); 413 } 414 } 415 416 $unreadreports = ''; 417 // This user is a moderator, super moderator or administrator 418 if($mybb->usergroup['cancp'] == 1 || $mybb->user['ismoderator'] && $mybb->usergroup['canmodcp']) 419 { 420 // Read the reported posts cache 421 $reported = $cache->read("reportedposts"); 422 423 // 0 or more reported posts currently exist 424 if($reported['unread'] > 0) 425 { 426 if($reported['unread'] == 1) 427 { 428 $lang->unread_reports = $lang->unread_report; 429 } 430 else 431 { 432 $lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']); 433 } 434 eval("\$unreadreports = \"".$templates->get("global_unreadreports")."\";"); 435 } 436 } 437 438 // Got a character set? 439 if($lang->settings['charset']) 440 { 441 $charset = $lang->settings['charset']; 442 } 443 // If not, revert to UTF-8 444 else 445 { 446 $charset = "UTF-8"; 447 } 448 449 // Is this user apart of a banned group? 450 $bannedwarning = ''; 451 if($mybb->usergroup['isbannedgroup'] == 1) 452 { 453 // Fetch details on their ban 454 $query = $db->simple_select("banned", "*", "uid='{$mybb->user['uid']}'", array('limit' => 1)); 455 $ban = $db->fetch_array($query); 456 if($ban['uid']) 457 { 458 // Format their ban lift date and reason appropriately 459 if($ban['lifted'] > 0) 460 { 461 $banlift = my_date($mybb->settings['dateformat'], $ban['lifted']) . ", " . my_date($mybb->settings['timeformat'], $ban['lifted']); 462 } 463 else 464 { 465 $banlift = $lang->banned_lifted_never; 466 } 467 $reason = htmlspecialchars_uni($ban['reason']); 468 } 469 if(empty($reason)) 470 { 471 $reason = $lang->unknown; 472 } 473 if(empty($banlift)) 474 { 475 $banlift = $lang->unknown; 476 } 477 // Display a nice warning to the user 478 eval("\$bannedwarning = \"".$templates->get("global_bannedwarning")."\";"); 479 } 480 481 $lang->ajax_loading = str_replace("'", "\\'", $lang->ajax_loading); 482 483 // Check if this user has a new private message. 484 $pm_notice = ''; 485 if(isset($mybb->user['pmnotice']) && $mybb->user['pmnotice'] == 2 && $mybb->user['pms_unread'] > 0 && $mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->usergroup['canview'] != 0 && ($current_page != "private.php" || $mybb->input['action'] != "read")) 486 { 487 if(!$parser) 488 { 489 require_once MYBB_ROOT.'inc/class_parser.php'; 490 $parser = new postParser; 491 } 492 493 $query = $db->query(" 494 SELECT pm.subject, pm.pmid, fu.username AS fromusername, fu.uid AS fromuid 495 FROM ".TABLE_PREFIX."privatemessages pm 496 LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid) 497 WHERE pm.folder='1' AND pm.uid='{$mybb->user['uid']}' AND pm.status='0' 498 ORDER BY pm.dateline DESC 499 LIMIT 1 500 "); 501 502 $pm = $db->fetch_array($query); 503 $pm['subject'] = $parser->parse_badwords($pm['subject']); 504 505 if($pm['fromuid'] == 0) 506 { 507 $pm['fromusername'] = $lang->mybb_engine; 508 $user_text = $pm['fromusername']; 509 } 510 else 511 { 512 $user_text = build_profile_link($pm['fromusername'], $pm['fromuid']); 513 } 514 515 if($mybb->user['pms_unread'] == 1) 516 { 517 $privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject'])); 518 } 519 else 520 { 521 $privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject'])); 522 } 523 eval("\$pm_notice = \"".$templates->get("global_pm_alert")."\";"); 524 } 525 526 // Set up some of the default templates 527 eval("\$headerinclude = \"".$templates->get("headerinclude")."\";"); 528 eval("\$gobutton = \"".$templates->get("gobutton")."\";"); 529 eval("\$htmldoctype = \"".$templates->get("htmldoctype", 1, 0)."\";"); 530 eval("\$header = \"".$templates->get("header")."\";"); 531 532 $copy_year = my_date("Y", TIME_NOW); 533 534 // Are we showing version numbers in the footer? 535 if($mybb->settings['showvernum'] == 1) 536 { 537 $mybbversion = ' '.$mybb->version; 538 } 539 else 540 { 541 $mybbversion = ''; 542 } 543 544 // Check to see if we have any tasks to run 545 $task_cache = $cache->read("tasks"); 546 if(!$task_cache['nextrun']) 547 { 548 $task_cache['nextrun'] = TIME_NOW; 549 } 550 if($task_cache['nextrun'] <= TIME_NOW) 551 { 552 $task_image = "<img src=\"{$mybb->settings['bburl']}/task.php\" border=\"0\" width=\"1\" height=\"1\" alt=\"\" />"; 553 } 554 else 555 { 556 $task_image = ''; 557 } 558 559 // Are we showing the quick language selection box? 560 $lang_select = $lang_options = ''; 561 if($mybb->settings['showlanguageselect'] != 0) 562 { 563 $languages = $lang->get_languages(); 564 foreach($languages as $key => $language) 565 { 566 $language = htmlspecialchars_uni($language); 567 // Current language matches 568 if($lang->language == $key) 569 { 570 $lang_options .= "<option value=\"{$key}\" selected=\"selected\"> {$language}</option>\n"; 571 } 572 else 573 { 574 $lang_options .= "<option value=\"{$key}\"> {$language}</option>\n"; 575 } 576 } 577 578 $lang_redirect_url = get_current_location(true, 'language'); 579 580 eval("\$lang_select = \"".$templates->get("footer_languageselect")."\";"); 581 } 582 583 // DST Auto detection enabled? 584 $auto_dst_detection = ''; 585 if($mybb->user['uid'] > 0 && $mybb->user['dstcorrection'] == 2) 586 { 587 $auto_dst_detection = "<script type=\"text/javascript\">if(MyBB) { Event.observe(window, 'load', function() { MyBB.detectDSTChange('".($mybb->user['timezone']+$mybb->user['dst'])."'); }); }</script>\n"; 588 } 589 590 eval("\$footer = \"".$templates->get("footer")."\";"); 591 592 // Add our main parts to the navigation 593 $navbits = array(); 594 $navbits[0]['name'] = $mybb->settings['bbname_orig']; 595 $navbits[0]['url'] = $mybb->settings['bburl']."/index.php"; 596 597 // Set the link to the archive. 598 $archive_url = $mybb->settings['bburl']."/archive/index.php"; 599 600 // Check banned ip addresses 601 if(is_banned_ip($session->ipaddress, true)) 602 { 603 if ($mybb->user['uid']) 604 { 605 $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' OR uid='{$mybb->user['uid']}'"); 606 } 607 else 608 { 609 $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."'"); 610 } 611 error($lang->error_banned); 612 } 613 614 $closed_bypass = array( 615 "member.php" => array( 616 "login", 617 "do_login", 618 "logout", 619 ), 620 "captcha.php", 621 ); 622 623 // If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message 624 if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['cancp'] != 1 && !in_array($current_page, $closed_bypass) && (!is_array($closed_bypass[$current_page]) || !in_array($mybb->input['action'], $closed_bypass[$current_page]))) 625 { 626 // Show error 627 $lang->error_boardclosed .= "<blockquote>{$mybb->settings['boardclosed_reason']}</blockquote>"; 628 error($lang->error_boardclosed); 629 exit; 630 } 631 632 // Load Limiting 633 if($mybb->usergroup['cancp'] != 1 && $mybb->settings['load'] > 0 && ($load = get_server_load()) && $load != $lang->unknown && $load > $mybb->settings['load']) 634 { 635 // User is not an administrator and the load limit is higher than the limit, show an error 636 error($lang->error_loadlimit); 637 } 638 639 // If there is a valid referrer in the URL, cookie it 640 if(!$mybb->user['uid'] && $mybb->settings['usereferrals'] == 1 && (isset($mybb->input['referrer']) || isset($mybb->input['referrername']))) 641 { 642 if(isset($mybb->input['referrername'])) 643 { 644 $condition = "username='".$db->escape_string($mybb->input['referrername'])."'"; 645 } 646 else 647 { 648 $condition = "uid='".intval($mybb->input['referrer'])."'"; 649 } 650 $query = $db->simple_select("users", "uid", $condition, array('limit' => 1)); 651 $referrer = $db->fetch_array($query); 652 if($referrer['uid']) 653 { 654 my_setcookie("mybb[referrer]", $referrer['uid']); 655 } 656 } 657 658 if($mybb->usergroup['canview'] != 1) 659 { 660 // Check pages allowable even when not allowed to view board 661 if(defined("ALLOWABLE_PAGE")) 662 { 663 if(is_string(ALLOWABLE_PAGE)) 664 { 665 $allowable_actions = explode(',', ALLOWABLE_PAGE); 666 667 if(!in_array($mybb->input['action'], $allowable_actions)) 668 { 669 error_no_permission(); 670 } 671 672 unset($allowable_actions); 673 } 674 else if(ALLOWABLE_PAGE !== 1) 675 { 676 error_no_permission(); 677 } 678 } 679 else 680 { 681 error_no_permission(); 682 } 683 } 684 685 // Find out if this user of ours is using a banned email address. 686 // If they are, redirect them to change it 687 if($mybb->user['uid'] && is_banned_email($mybb->user['email']) && $mybb->settings['emailkeep'] != 1) 688 { 689 if(THIS_SCRIPT != "usercp.php" || THIS_SCRIPT == "usercp.php" && $mybb->input['action'] != "email" && $mybb->input['action'] != "do_email") 690 { 691 redirect("usercp.php?action=email"); 692 } 693 else if($mybb->request_method != "post") 694 { 695 $banned_email_error = inline_error(array($lang->banned_email_warning)); 696 } 697 } 698 699 // work out which items the user has collapsed 700 $colcookie = empty($mybb->cookies['collapsed']) ? false : $mybb->cookies['collapsed']; 701 702 // set up collapsable items (to automatically show them us expanded) 703 $collapsed = array('boardstats' => '', 'boardstats_e' => '', 'quickreply' => '', 'quickreply_e' => ''); 704 $collapsedimg = $collapsed; 705 706 if($colcookie) 707 { 708 $col = explode("|", $colcookie); 709 if(!is_array($col)) 710 { 711 $col[0] = $colcookie; // only one item 712 } 713 unset($collapsed); 714 foreach($col as $key => $val) 715 { 716 $ex = $val."_e"; 717 $co = $val."_c"; 718 $collapsed[$co] = "display: show;"; 719 $collapsed[$ex] = "display: none;"; 720 $collapsedimg[$val] = "_collapsed"; 721 } 722 } 723 724 // Run hooks for end of global.php 725 $plugins->run_hooks("global_end"); 726 727 $globaltime = $maintimer->getTime(); 728 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |