| [ Index ] |
PHP Cross Reference of MyBB 1.6.7 |
[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: misc.php 5714 2011-12-08 16:07:00Z Tomm $ 10 */ 11 12 define("IN_MYBB", 1); 13 define('THIS_SCRIPT', 'misc.php'); 14 15 $templatelist = "redirect_markallread,redirect_markforumread"; 16 $templatelist .= ",misc_buddypopup,misc_buddypopup_user_online,misc_buddypopup_user_offline,misc_buddypopup_user_sendpm"; 17 $templatelist .= ",misc_smilies,misc_smilies_smilie,misc_help_section_bit,misc_help_section,misc_help"; 18 require_once "./global.php"; 19 require_once MYBB_ROOT."inc/functions_post.php"; 20 21 // Load global language phrases 22 $lang->load("misc"); 23 24 $plugins->run_hooks("misc_start"); 25 26 if($mybb->input['action'] == "dstswitch" && $mybb->request_method == "post" && $mybb->user['uid'] > 0) 27 { 28 if($mybb->user['dstcorrection'] == 2) 29 { 30 if($mybb->user['dst'] == 1) 31 { 32 $update_array = array("dst" => 0); 33 } 34 else 35 { 36 $update_array = array("dst" => 1); 37 } 38 } 39 $db->update_query("users", $update_array, "uid='{$mybb->user['uid']}'"); 40 if(!$mybb->input['ajax']) 41 { 42 redirect("index.php", $lang->dst_settings_updated); 43 } 44 else 45 { 46 echo "done"; 47 exit; 48 } 49 } 50 if($mybb->input['action'] == "markread") 51 { 52 if($mybb->user['uid'] && verify_post_check($mybb->input['my_post_key'], true) !== true) 53 { 54 // Protect our user's unread forums from CSRF 55 error($lang->invalid_post_code); 56 } 57 58 if($mybb->input['fid']) 59 { 60 $mybb->input['fid'] = intval($mybb->input['fid']); 61 $validforum = get_forum($mybb->input['fid']); 62 if(!$validforum) 63 { 64 if(!$mybb->input['ajax']) 65 { 66 error($lang->error_invalidforum); 67 } 68 else 69 { 70 echo 0; 71 exit; 72 } 73 } 74 75 require_once MYBB_ROOT."/inc/functions_indicators.php"; 76 mark_forum_read($mybb->input['fid']); 77 78 $plugins->run_hooks("misc_markread_forum"); 79 80 if(!$mybb->input['ajax']) 81 { 82 redirect(get_forum_link($mybb->input['fid']), $lang->redirect_markforumread); 83 } 84 else 85 { 86 echo 1; 87 exit; 88 } 89 } 90 else 91 { 92 93 $plugins->run_hooks("misc_markread_end"); 94 require_once MYBB_ROOT."/inc/functions_indicators.php"; 95 mark_all_forums_read(); 96 redirect("index.php", $lang->redirect_markforumsread); 97 } 98 } 99 elseif($mybb->input['action'] == "clearpass") 100 { 101 $plugins->run_hooks("misc_clearpass"); 102 103 if($mybb->input['fid']) 104 { 105 if(!verify_post_check($mybb->input['my_post_key'])) 106 { 107 error($lang->invalid_post_code); 108 } 109 110 my_unsetcookie("forumpass[".intval($mybb->input['fid'])."]"); 111 redirect("index.php", $lang->redirect_forumpasscleared); 112 } 113 } 114 elseif($mybb->input['action'] == "rules") 115 { 116 if($mybb->input['fid']) 117 { 118 $plugins->run_hooks("misc_rules_start"); 119 120 $query = $db->simple_select("forums", "*", "fid='".intval($mybb->input['fid'])."' AND active!=0"); 121 $forum = $db->fetch_array($query); 122 123 $forumpermissions = forum_permissions($forum['fid']); 124 125 if($forum['type'] != "f" || $forum['rules'] == '') 126 { 127 error($lang->error_invalidforum); 128 } 129 if($forumpermissions['canview'] != 1) 130 { 131 error_no_permission(); 132 } 133 if(!$forum['rulestitle']) 134 { 135 $forum['rulestitle'] = $lang->sprintf($lang->forum_rules, $forum['name']); 136 } 137 138 require_once MYBB_ROOT."inc/class_parser.php"; 139 $parser = new postParser(); 140 $parser_options = array( 141 "allow_html" => 1, 142 "allow_mycode" => 1, 143 "allow_smilies" => 1, 144 "allow_imgcode" => 1, 145 "filter_badwords" => 1 146 ); 147 148 $forum['rules'] = $parser->parse_message($forum['rules'], $parser_options); 149 150 // Make navigation 151 build_forum_breadcrumb($mybb->input['fid']); 152 add_breadcrumb($forum['rulestitle']); 153 154 $plugins->run_hooks("misc_rules_end"); 155 156 eval("\$rules = \"".$templates->get("misc_rules_forum")."\";"); 157 output_page($rules); 158 } 159 160 } 161 elseif($mybb->input['action'] == "help") 162 { 163 $lang->load("helpdocs"); 164 $lang->load("helpsections"); 165 $lang->load("customhelpdocs"); 166 $lang->load("customhelpsections"); 167 168 add_breadcrumb($lang->nav_helpdocs, "misc.php?action=help"); 169 170 $query = $db->query(" 171 SELECT h.*, s.enabled AS section 172 FROM ".TABLE_PREFIX."helpdocs h 173 LEFT JOIN ".TABLE_PREFIX."helpsections s ON (s.sid=h.sid) 174 WHERE h.hid='".intval($mybb->input['hid'])."' 175 "); 176 $helpdoc = $db->fetch_array($query); 177 if($helpdoc['hid']) 178 { 179 if($helpdoc['section'] != 0 && $helpdoc['enabled'] != 0) 180 { 181 $plugins->run_hooks("misc_help_helpdoc_start"); 182 183 if($helpdoc['usetranslation'] == 1) 184 { 185 $langnamevar = "d".$helpdoc['hid']."_name"; 186 $langdescvar = "d".$helpdoc['hid']."_desc"; 187 $langdocvar = "d".$helpdoc['hid']."_document"; 188 if($lang->$langnamevar) 189 { 190 $helpdoc['name'] = $lang->$langnamevar; 191 } 192 if($lang->$langdescvar) 193 { 194 $helpdoc['description'] = $lang->$langdescvar; 195 } 196 if($lang->$langdocvar) 197 { 198 $helpdoc['document'] = $lang->$langdocvar; 199 200 if($langdocvar == "d3_document") 201 { 202 $helpdoc['document'] = $lang->sprintf($helpdoc['document'], $mybb->user['logoutkey']); 203 } 204 } 205 } 206 add_breadcrumb($helpdoc['name']); 207 208 $plugins->run_hooks("misc_help_helpdoc_end"); 209 210 eval("\$helppage = \"".$templates->get("misc_help_helpdoc")."\";"); 211 output_page($helppage); 212 } 213 else 214 { 215 error($lang->error_invalidhelpdoc); 216 } 217 } 218 else 219 { 220 $plugins->run_hooks("misc_help_section_start"); 221 222 $query = $db->simple_select("helpdocs", "*", "", array('order_by' => 'sid, disporder')); 223 while($helpdoc = $db->fetch_array($query)) 224 { 225 $helpdocs[$helpdoc['sid']][$helpdoc['disporder']][$helpdoc['hid']] = $helpdoc; 226 } 227 unset($helpdoc); 228 $sections = ''; 229 $query = $db->simple_select("helpsections", "*", "enabled != 0", array('order_by' => 'disporder')); 230 while($section = $db->fetch_array($query)) 231 { 232 if($section['usetranslation'] == 1) 233 { 234 $langnamevar = "s".$section['sid']."_name"; 235 $langdescvar = "s".$section['sid']."_desc"; 236 if($lang->$langnamevar) 237 { 238 $section['name'] = $lang->$langnamevar; 239 } 240 if($lang->$langdescvar) 241 { 242 $section['description'] = $lang->$langdescvar; 243 } 244 } 245 if(is_array($helpdocs[$section['sid']])) 246 { 247 $helpbits = ''; 248 // Expand (or Collapse) forums 249 if($mybb->input['action'] == "expand") 250 { 251 my_setcookie("fcollapse[{$section['sid']}]", ''); 252 $scollapse[$section['sid']] = ''; 253 } 254 elseif($mybb->input['action'] == "collapse") 255 { 256 my_setcookie("fcollapse[{$section['sid']}]", "y"); 257 $scollapse[$section['sid']] = "y"; 258 } 259 foreach($helpdocs[$section['sid']] as $key => $bit) 260 { 261 foreach($bit as $key => $helpdoc) 262 { 263 if($helpdoc['enabled'] != 0) 264 { 265 if($helpdoc['usetranslation'] == 1) 266 { 267 $langnamevar = "d".$helpdoc['hid'].'_name'; 268 $langdescvar = "d".$helpdoc['hid'].'_desc'; 269 if($lang->$langnamevar) 270 { 271 $helpdoc['name'] = $lang->$langnamevar; 272 } 273 if($lang->$langdescvar) 274 { 275 $helpdoc['description'] = $lang->$langdescvar; 276 } 277 } 278 $altbg = alt_trow(); 279 eval("\$helpbits .= \"".$templates->get("misc_help_section_bit")."\";"); 280 } 281 } 282 $expdisplay = ''; 283 $sname = "sid_".$section['sid']."_c"; 284 if($collapsed[$sname] == "display: show;") 285 { 286 $expcolimage = "collapse_collapsed.gif"; 287 $expdisplay = "display: none;"; 288 } 289 else 290 { 291 $expcolimage = "collapse.gif"; 292 } 293 } 294 eval("\$sections .= \"".$templates->get("misc_help_section")."\";"); 295 } 296 } 297 298 $plugins->run_hooks("misc_help_section_end"); 299 300 eval("\$help = \"".$templates->get("misc_help")."\";"); 301 output_page($help); 302 } 303 } 304 elseif($mybb->input['action'] == "buddypopup") 305 { 306 $plugins->run_hooks("misc_buddypopup_start"); 307 308 if($mybb->user['uid'] == 0) 309 { 310 error_no_permission(); 311 } 312 if($mybb->input['removebuddy'] && verify_post_check($mybb->input['my_post_key'])) 313 { 314 $buddies = $mybb->user['buddylist']; 315 $namesarray = explode(",",$buddies); 316 if(is_array($namesarray)) 317 { 318 foreach($namesarray as $key => $buddyid) 319 { 320 if($buddyid == $mybb->input['removebuddy']) 321 { 322 unset($namesarray[$key]); 323 } 324 } 325 $buddylist = implode(',', $namesarray); 326 $db->update_query("users", array('buddylist' => $buddylist), "uid='".$mybb->user['uid']."'"); 327 $mybb->user['buddylist'] = $buddylist; 328 } 329 } 330 // Load Buddies 331 if($mybb->user['buddylist'] != "") 332 { 333 $timecut = TIME_NOW - $mybb->settings['wolcutoff']; 334 $query = $db->simple_select("users", "*", "uid IN ({$mybb->user['buddylist']})", array('order_by' => 'lastactive')); 335 336 while($buddy = $db->fetch_array($query)) 337 { 338 $buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']); 339 $profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank', 'if(window.opener) { window.opener.location = this.href; return false; }'); 340 341 if($mybb->user['receivepms'] != 0 && $buddy['receivepms'] != 0 && $groupscache[$buddy['usergroup']]['canusepms'] != 0) 342 { 343 eval("\$send_pm = \"".$templates->get("misc_buddypopup_user_sendpm")."\";"); 344 } 345 else 346 { 347 $send_pm = ''; 348 } 349 if($buddy['lastactive']) 350 { 351 $last_active = $lang->sprintf($lang->last_active, my_date($mybb->settings['dateformat'], $buddy['lastactive']).", ".my_date($mybb->settings['timeformat'], $buddy['lastactive'])); 352 } 353 else 354 { 355 $last_active = $lang->sprintf($lang->last_active, $lang->never); 356 } 357 358 if($buddy['avatar']) 359 { 360 $buddy['avatar'] = htmlspecialchars_uni($buddy['avatar']); 361 if($buddy['avatardimensions']) 362 { 363 require_once MYBB_ROOT."inc/functions_image.php"; 364 list($width, $height) = explode("|", $buddy['avatardimensions']); 365 $scaled_dimensions = scale_image($width, $height, 44, 44); 366 } 367 else 368 { 369 $scaled_dimensions = array( 370 "width" => 44, 371 "height" => 44 372 ); 373 } 374 } 375 else 376 { 377 $buddy['avatar'] = $theme['imgdir'] . "/default_avatar.gif"; 378 $scaled_dimensions = array( 379 "width" => 44, 380 "height" => 44 381 ); 382 } 383 $margin_top = ceil((50-$scaled_dimensions['height'])/2); 384 if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive']) 385 { 386 eval("\$buddys['online'] .= \"".$templates->get("misc_buddypopup_user_online")."\";"); 387 } 388 else 389 { 390 eval("\$buddys['offline'] .= \"".$templates->get("misc_buddypopup_user_offline")."\";"); 391 } 392 } 393 } 394 else 395 { 396 // No buddies? :( 397 $buddys['offline'] = $lang->no_buddies; 398 } 399 400 $plugins->run_hooks("misc_buddypopup_end"); 401 402 eval("\$buddylist = \"".$templates->get("misc_buddypopup")."\";"); 403 output_page($buddylist); 404 } 405 elseif($mybb->input['action'] == "whoposted") 406 { 407 $numposts = 0; 408 $altbg = alt_trow(); 409 $whoposted = ''; 410 $tid = intval($mybb->input['tid']); 411 $thread = get_thread($tid); 412 413 if(is_moderator($thread['fid'])) 414 { 415 $ismod = true; 416 $show_posts = "(p.visible = '1' OR p.visible = '0')"; 417 } 418 else 419 { 420 $ismod = false; 421 $show_posts = "p.visible = '1'"; 422 } 423 424 // Make sure we are looking at a real thread here. 425 if(!$thread['tid'] || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true)) 426 { 427 error($lang->error_invalidthread); 428 } 429 // Does the thread belong to a valid forum? 430 $forum = get_forum($thread['fid']); 431 if(!$forum || $forum['type'] != "f") 432 { 433 error($lang->error_invalidforum); 434 } 435 436 // Does the user have permission to view this thread? 437 $forumpermissions = forum_permissions($forum['fid']); 438 439 if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1) 440 { 441 error_no_permission(); 442 } 443 444 // Check if this forum is password protected and we have a valid password 445 check_forum_password($forum['fid']); 446 447 if($mybb->input['sort'] != 'username') 448 { 449 $sortsql = ' ORDER BY posts DESC'; 450 } 451 else 452 { 453 $sortsql = ' ORDER BY p.username ASC'; 454 } 455 $query = $db->query(" 456 SELECT COUNT(p.pid) AS posts, p.username AS postusername, u.uid, u.username, u.usergroup, u.displaygroup 457 FROM ".TABLE_PREFIX."posts p 458 LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) 459 WHERE tid='".$tid."' AND $show_posts 460 GROUP BY u.uid, p.username, u.uid, u.username, u.usergroup, u.displaygroup 461 ".$sortsql." 462 "); 463 while($poster = $db->fetch_array($query)) 464 { 465 if($poster['username'] == '') 466 { 467 $poster['username'] = $poster['postusername']; 468 } 469 $poster_name = format_name($poster['username'], $poster['usergroup'], $poster['displaygroup']); 470 if($poster['uid']) 471 { 472 $onclick = "opener.location.href='".get_profile_link($poster['uid'])."'; return false;"; 473 } 474 $profile_link = build_profile_link($poster_name, $poster['uid'], '_blank', $onclick); 475 $numposts += $poster['posts']; 476 eval("\$whoposted .= \"".$templates->get("misc_whoposted_poster")."\";"); 477 $altbg = alt_trow(); 478 } 479 $numposts = my_number_format($numposts); 480 eval("\$whop = \"".$templates->get("misc_whoposted")."\";"); 481 output_page($whop); 482 } 483 elseif($mybb->input['action'] == "smilies") 484 { 485 $smilies = ''; 486 if($mybb->input['popup']) 487 { // make small popup list of smilies 488 $editor = addslashes(htmlentities($mybb->input['editor'])); 489 $e = 1; 490 $class = "trow1"; 491 $smilies = "<tr>"; 492 $query = $db->simple_select("smilies", "*", "", array('order_by' => 'disporder')); 493 while($smilie = $db->fetch_array($query)) 494 { 495 $smilie['insert'] = addslashes($smilie['find']); 496 $smilie['find'] = htmlspecialchars_uni($smilie['find']); 497 eval("\$smilies .= \"".$templates->get("misc_smilies_popup_smilie")."\";"); 498 if($e == 2) 499 { 500 $smilies .= "</tr><tr>"; 501 $e = 1; 502 $class = alt_trow(); 503 } 504 else 505 { 506 $e = 2; 507 } 508 } 509 if($e == 2) 510 { 511 $smilies .= "<td colspan=\"2\" class=\"$class\"> </td>"; 512 } 513 eval("\$smiliespage = \"".$templates->get("misc_smilies_popup")."\";"); 514 output_page($smiliespage); 515 } 516 else 517 { 518 add_breadcrumb($lang->nav_smilies); 519 $class = "trow1"; 520 $query = $db->simple_select("smilies", "*", "", array('order_by' => 'disporder')); 521 while($smilie = $db->fetch_array($query)) 522 { 523 $smilie['find'] = htmlspecialchars_uni($smilie['find']); 524 eval("\$smilies .= \"".$templates->get("misc_smilies_smilie")."\";"); 525 $class = alt_trow(); 526 } 527 eval("\$smiliespage = \"".$templates->get("misc_smilies")."\";"); 528 output_page($smiliespage); 529 } 530 } 531 elseif($mybb->input['action'] == "imcenter") 532 { 533 if($mybb->input['imtype'] != "aim" && $mybb->input['imtype'] != "msn" && $mybb->input['imtype'] != "yahoo") 534 { 535 error($lang->error_invalidimtype); 536 } 537 $uid = $mybb->input['uid']; 538 $user = get_user($uid); 539 540 if(!$user['username']) 541 { 542 error($lang->error_invaliduser); 543 } 544 if(!$user[$mybb->input['imtype']]) 545 { 546 error($lang->error_invalidimtype); 547 } 548 549 // build im navigation bar 550 $navigationbar = $navsep = ''; 551 if($user['aim']) 552 { 553 $navigationbar .= "<a href=\"misc.php?action=imcenter&imtype=aim&uid=$uid\">$lang->aol_im</a>"; 554 $navsep = ' - '; 555 } 556 if($user['msn']) 557 { 558 $navigationbar .= "$navsep<a href=\"misc.php?action=imcenter&imtype=msn&uid=$uid\">$lang->msn</a>"; 559 $navsep = ' - '; 560 } 561 if($user['yahoo']) 562 { 563 $navigationbar .= "$navsep<a href=\"misc.php?action=imcenter&imtype=yahoo&uid=$uid\">$lang->yahoo_im</a>"; 564 } 565 $lang->msn_address_is = $lang->sprintf($lang->msn_address_is, $user['username']); 566 $lang->send_y_message = $lang->sprintf($lang->send_y_message, $user['username']); 567 $lang->view_y_profile = $lang->sprintf($lang->view_y_profile, $user['username']); 568 569 $imtemplate = "misc_imcenter_".$mybb->input['imtype']; 570 eval("\$imcenter = \"".$templates->get($imtemplate)."\";"); 571 output_page($imcenter); 572 } 573 elseif($mybb->input['action'] == "syndication") 574 { 575 $plugins->run_hooks("misc_syndication_start"); 576 577 $fid = $mybb->input['fid']; 578 $version = $mybb->input['version']; 579 $limit = $mybb->input['limit']; 580 $forums = $mybb->input['forums']; 581 582 add_breadcrumb($lang->nav_syndication); 583 $unviewable = get_unviewable_forums(); 584 if(is_array($forums)) 585 { 586 $unexp = explode(",", $unviewable); 587 foreach($unexp as $fid) 588 { 589 $unview[$fid] = 1; 590 } 591 $syndicate = ''; 592 $comma = ''; 593 foreach($forums as $fid) 594 { 595 if($fid == "all") 596 { 597 $all = 1; 598 break; 599 } 600 elseif(is_numeric($fid)) 601 { 602 if(!$unview[$fid]) 603 { 604 $syndicate .= $comma.$fid; 605 $comma = ","; 606 $flist[$fid] = 1; 607 } 608 } 609 } 610 $url = $mybb->settings['bburl']."/syndication.php"; 611 if(!$all) 612 { 613 $url .= "?fid=$syndicate"; 614 $add = 1; 615 } 616 617 // If the version is not RSS2.0, set the type to Atom1.0. 618 if($version != "rss2.0") 619 { 620 if(!$add) 621 { 622 $url .= "?"; 623 } 624 else 625 { 626 $url .= "&"; 627 } 628 $url .= "type=atom1.0"; 629 $add = 1; 630 } 631 if(intval($limit) > 0) 632 { 633 if($limit > 100) 634 { 635 $limit = 100; 636 } 637 if(!$add) 638 { 639 $url .= "?"; 640 } 641 else 642 { 643 $url .= "&"; 644 } 645 if(is_numeric($limit)) 646 { 647 $url .= "limit=$limit"; 648 } 649 } 650 $limit = intval($_POST['limit']); 651 eval("\$feedurl = \"".$templates->get("misc_syndication_feedurl")."\";"); 652 } 653 unset($GLOBALS['forumcache']); 654 if(!$limit || !is_numeric($limit)) 655 { 656 $limit = 15; 657 } 658 659 // If there is no version in the input, check the default (RSS2.0). 660 if($version == "atom1.0") 661 { 662 $atom1check = "checked=\"checked\""; 663 $rss2check = ''; 664 } 665 else 666 { 667 $atom1check = ''; 668 $rss2check = "checked=\"checked\""; 669 } 670 $forumselect = makesyndicateforums("", $blah); 671 672 $plugins->run_hooks("misc_syndication_end"); 673 674 eval("\$syndication = \"".$templates->get("misc_syndication")."\";"); 675 output_page($syndication); 676 } 677 678 679 if($mybb->input['action'] == "clearcookies") 680 { 681 $plugins->run_hooks("misc_clearcookies"); 682 683 if($mybb->input['key'] != $mybb->user['logoutkey']) 684 { 685 error($lang->error_invalidkey); 686 } 687 688 $remove_cookies = array('mybb', 'mybbuser', 'mybb[password]', 'mybb[lastvisit]', 'mybb[lastactive]', 'collapsed', 'mybb[forumread]', 'mybb[threadsread]', 'mybbadmin'); 689 690 if($mybb->settings['cookiedomain']) 691 { 692 foreach($remove_cookies as $name) 693 { 694 @my_setcookie($name, '', TIME_NOW-1, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']); 695 } 696 } 697 else 698 { 699 foreach($remove_cookies as $name) 700 { 701 @my_setcookie($name, '', TIME_NOW-1, $mybb->settings['cookiepath']); 702 } 703 } 704 redirect("index.php", $lang->redirect_cookiescleared); 705 } 706 707 function makesyndicateforums($pid="0", $selitem="", $addselect="1", $depth="", $permissions="") 708 { 709 global $db, $forumcache, $permissioncache, $mybb, $selecteddone, $forumlist, $forumlistbits, $theme, $templates, $flist, $lang, $unviewable; 710 static $unviewableforums; 711 712 $pid = intval($pid); 713 if(!$permissions) 714 { 715 $permissions = $mybb->usergroup; 716 } 717 718 if(!is_array($forumcache)) 719 { 720 // Get Forums 721 $query = $db->simple_select("forums", "*", "linkto = '' AND active!=0", array('order_by' => 'pid, disporder')); 722 while($forum = $db->fetch_array($query)) 723 { 724 $forumcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; 725 } 726 } 727 728 if(!is_array($permissioncache)) 729 { 730 $permissioncache = forum_permissions(); 731 } 732 733 if(!$unviewableforums) 734 { 735 // Save our unviewable forums in an array 736 $unviewableforums = explode(",", str_replace("'", "", $unviewable)); 737 } 738 739 if(is_array($forumcache[$pid])) 740 { 741 foreach($forumcache[$pid] as $key => $main) 742 { 743 foreach($main as $key => $forum) 744 { 745 $perms = $permissioncache[$forum['fid']]; 746 if($perms['canview'] == 1 || $mybb->settings['hideprivateforums'] == 0) 747 { 748 if($flist[$forum['fid']]) 749 { 750 $optionselected = "selected=\"selected\""; 751 $selecteddone = "1"; 752 } 753 else 754 { 755 $optionselected = ''; 756 } 757 758 if($forum['password'] == '' && !in_array($forum['fid'], $unviewableforums) || $forum['password'] && $mybb->cookies['forumpass'][$forum['fid']] == md5($mybb->user['uid'].$forum['password'])) 759 { 760 $forumlistbits .= "<option value=\"{$forum['fid']}\" $optionselected>$depth {$forum['name']}</option>\n"; 761 } 762 763 if($forumcache[$forum['fid']]) 764 { 765 $newdepth = $depth." "; 766 $forumlistbits .= makesyndicateforums($forum['fid'], $selitem, 0, $newdepth, $perms); 767 } 768 } 769 } 770 } 771 } 772 if($addselect) 773 { 774 if(!$selecteddone) 775 { 776 $addsel = " selected=\"selected\""; 777 } 778 $forumlist = "<select name=\"forums[]\" size=\"10\" multiple=\"multiple\">\n<option value=\"all\" $addsel>$lang->syndicate_all_forums</option>\n<option value=\"all\">----------------------</option>\n$forumlistbits\n</select>"; 779 } 780 return $forumlist; 781 } 782 783 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Mar 31 17:55:03 2012 | Cross-referenced by PHPXref 0.7.1 |