Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* $Id: functions.php 2191 2006-09-03 12:11:04Z chris $
| * $Id: functions.php 2459 2006-11-29 09:09:55Z chris $
|
*/
/**
| */
/**
|
Zeile 79 | Zeile 79 |
---|
$plugins->run_hooks("post_output_page");
// If the use shutdown functionality is turned off, run any shutdown related items now.
|
$plugins->run_hooks("post_output_page");
// If the use shutdown functionality is turned off, run any shutdown related items now.
|
if($mybb->settings['useshutdownfunc'] == "no" && $mybb->use_shutdown == true)
| if(($mybb->settings['useshutdownfunc'] == "no" || phpversion() >= '5.0.5') && $mybb->use_shutdown != true)
|
{ run_shutdown(); }
| { run_shutdown(); }
|
Zeile 106 | Zeile 106 |
---|
*/ function run_shutdown() {
|
*/ function run_shutdown() {
|
global $db, $cache, $shutdown_functions;
| global $db, $cache, $plugins, $shutdown_functions, $done_shutdown; if($done_shutdown == true) { return; } // If our DB has been deconstructed already (bad PHP 5.2.0), reconstruct if(!is_object($db)) { require MYBB_ROOT."inc/config.php"; if(isset($config)) { require_once MYBB_ROOT."inc/db_".$config['dbtype'].".php"; $db = new databaseEngine; $db->connect($config['hostname'], $config['username'], $config['password']); $db->select_db($config['database']); } } // Cache object deconstructed? reconstruct if(!is_object($cache)) { require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache; } // And finaly.. we have the PHP developers to thank for this "hack" which fixes a problem THEY created if(!is_object($plugins) && !defined("NO_PLUGINS")) { require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem; $plugins->load(); }
|
// We have some shutdown queries needing to be run if(is_array($db->shutdown_queries))
| // We have some shutdown queries needing to be run if(is_array($db->shutdown_queries))
|
Zeile 115 | Zeile 148 |
---|
foreach($db->shutdown_queries as $query) { $db->query($query);
|
foreach($db->shutdown_queries as $query) { $db->query($query);
|
} }
| } }
|
// Run any shutdown functions if we have them if(is_array($shutdown_functions))
| // Run any shutdown functions if we have them if(is_array($shutdown_functions))
|
Zeile 126 | Zeile 159 |
---|
$function(); } }
|
$function(); } }
|
| $done_shutdown = true;
|
}
/**
| }
/**
|
Zeile 136 | Zeile 170 |
---|
function send_mail_queue($count=10) { global $db, $cache, $plugins;
|
function send_mail_queue($count=10) { global $db, $cache, $plugins;
|
|
|
$plugins->run_hooks("send_mail_queue_start");
// Check to see if the mail queue has messages needing to be sent
| $plugins->run_hooks("send_mail_queue_start");
// Check to see if the mail queue has messages needing to be sent
|
Zeile 145 | Zeile 179 |
---|
{ // Lock the queue so no other messages can be sent whilst these are (for popular boards) $cache->updatemailqueue(0, time());
|
{ // Lock the queue so no other messages can be sent whilst these are (for popular boards) $cache->updatemailqueue(0, time());
|
|
|
// Fetch emails for this page view - and send them $query = $db->simple_select(TABLE_PREFIX."mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));
|
// Fetch emails for this page view - and send them $query = $db->simple_select(TABLE_PREFIX."mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));
|
| $plugins->run_hooks_by_ref("send_mail_queue_mail", $query);
|
while($email = $db->fetch_array($query)) {
|
while($email = $db->fetch_array($query)) {
|
$plugins->run_hooks("send_mail_queue_mail");
| |
// Delete the message from the queue $db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");
| // Delete the message from the queue $db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");
|
Zeile 185 | Zeile 220 |
---|
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents; } if($lang->settings['rtl'] == 1)
|
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents; } if($lang->settings['rtl'] == 1)
|
{
| {
|
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents); } if($lang->settings['htmllang'])
| $contents = str_replace("<html", "<html dir=\"rtl\"", $contents); } if($lang->settings['htmllang'])
|
Zeile 262 | Zeile 297 |
---|
if($todaysdate == $date) { $date = $lang->today;
|
if($todaysdate == $date) { $date = $lang->today;
|
}
| }
|
elseif($yesterdaysdate == $date) { $date = $lang->yesterday; }
|
elseif($yesterdaysdate == $date) { $date = $lang->yesterday; }
|
}
| }
|
|
|
$plugins->run_hooks("my_date");
| $plugins->run_hooks_by_ref("my_date", $date);
|
return $date; }
|
return $date; }
|
|
|
/** * Sends an email using PHP's mail function, formatting it appropriately. *
| /** * Sends an email using PHP's mail function, formatting it appropriately. *
|
Zeile 288 | Zeile 323 |
---|
global $db, $mybb, $lang;
if(empty($charset))
|
global $db, $mybb, $lang;
if(empty($charset))
|
{
| {
|
$charset = $lang->settings['charset']; }
| $charset = $lang->settings['charset']; }
|
Zeile 302 | Zeile 337 |
---|
if($_SERVER['SERVER_NAME']) { $http_host = $_SERVER['SERVER_NAME'];
|
if($_SERVER['SERVER_NAME']) { $http_host = $_SERVER['SERVER_NAME'];
|
}
| }
|
else if($_SERVER['HTTP_HOST']) { $http_host = $_SERVER['HTTP_HOST'];
| else if($_SERVER['HTTP_HOST']) { $http_host = $_SERVER['HTTP_HOST'];
|
Zeile 380 | Zeile 415 |
---|
$builtlist = "("; $sep = ''; foreach($parentsexploded as $key => $val)
|
$builtlist = "("; $sep = ''; foreach($parentsexploded as $key => $val)
|
{
| {
|
$builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
| $builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
|
Zeile 390 | Zeile 425 |
---|
/** * Load the forum cache in to memory
|
/** * Load the forum cache in to memory
|
*/
| */
|
function cache_forums() { global $forum_cache, $db, $cache;
| function cache_forums() { global $forum_cache, $db, $cache;
|
Zeile 418 | Zeile 453 |
---|
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb;
if(!$error)
|
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb;
if(!$error)
|
{
| {
|
$error = $lang->unknown_error; } if(!$title)
| $error = $lang->unknown_error; } if(!$title)
|
Zeile 448 | Zeile 483 |
---|
$title = $lang->please_correct_errors; } if(!is_array($errors))
|
$title = $lang->please_correct_errors; } if(!is_array($errors))
|
{
| {
|
$errors = array($errors); } foreach($errors as $error)
| $errors = array($errors); } foreach($errors as $error)
|
Zeile 457 | Zeile 492 |
---|
} eval("\$errors = \"".$templates->get("error_inline")."\";"); return $errors;
|
} eval("\$errors = \"".$templates->get("error_inline")."\";"); return $errors;
|
}
| }
|
/** * Presents the user with a "no permission" page
| /** * Presents the user with a "no permission" page
|
Zeile 498 | Zeile 533 |
---|
{ global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
|
{ global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
|
| $loadpmpopup = false;
|
if(!$message) { $message = $lang->redirect;
| if(!$message) { $message = $lang->redirect;
|
Zeile 511 | Zeile 547 |
---|
if($mybb->settings['redirects'] == "on" && $mybb->user['showredirect'] != "no") { $url = str_replace("&", "&", $url);
|
if($mybb->settings['redirects'] == "on" && $mybb->user['showredirect'] != "no") { $url = str_replace("&", "&", $url);
|
$url = str_replace("&", "&", $url);
| $url = htmlspecialchars($url);
|
eval("\$redirectpage = \"".$templates->get("redirect")."\";"); output_page($redirectpage); }
| eval("\$redirectpage = \"".$templates->get("redirect")."\";"); output_page($redirectpage); }
|
Zeile 691 | Zeile 727 |
---|
/** * Fetch the display group properties for a specific display group
|
/** * Fetch the display group properties for a specific display group
|
*
| *
|
* @param int The group ID to fetch the display properties for * @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
* @param int The group ID to fetch the display properties for * @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
{
| {
|
global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
| global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
|
Zeile 706 | Zeile 742 |
---|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field)
|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field)
|
{
| {
|
$displaygroup[$field] = $group[$field]; } return $displaygroup;
| $displaygroup[$field] = $group[$field]; } return $displaygroup;
|
Zeile 729 | Zeile 765 |
---|
$uid = $mybb->user['uid']; } if(!$gid || $gid == 0) // If no group, we need to fetch it
|
$uid = $mybb->user['uid']; } if(!$gid || $gid == 0) // If no group, we need to fetch it
|
{
| {
|
if($uid != $mybb->user['uid']) { if($usercache[$uid])
| if($uid != $mybb->user['uid']) { if($usercache[$uid])
|
Zeile 739 | Zeile 775 |
---|
} $gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups']; $groupperms = usergroup_permissions($gid);
|
} $gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups']; $groupperms = usergroup_permissions($gid);
|
}
| }
|
else { $gid = $mybb->user['usergroup'];
| else { $gid = $mybb->user['usergroup'];
|
Zeile 748 | Zeile 784 |
---|
$gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
$gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
} }
| } }
|
if(!is_array($forum_cache)) {
|
if(!is_array($forum_cache)) {
|
cache_forums(); } if(!is_array($fpermcache)) {
| $forum_cache = cache_forums(); if(!$forum_cache) { return false; } } if(!is_array($fpermcache)) {
|
$fpermcache = $cache->read("forumpermissions"); } if($fid) // Fetch the permissions for a single forum
|
$fpermcache = $cache->read("forumpermissions"); } if($fid) // Fetch the permissions for a single forum
|
{
| {
|
$permissions = fetch_forum_permissions($fid, $gid, $groupperms); } else
| $permissions = fetch_forum_permissions($fid, $gid, $groupperms); } else
|
Zeile 767 | Zeile 807 |
---|
foreach($forum_cache as $forum) { $permissions[$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
|
foreach($forum_cache as $forum) { $permissions[$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
|
} }
| } }
|
return $permissions; }
| return $permissions; }
|
Zeile 788 | Zeile 828 |
---|
if(!$fpermcache[$fid]) // This forum has no custom or inherited permisssions so lets just return the group permissions { return $groupperms;
|
if(!$fpermcache[$fid]) // This forum has no custom or inherited permisssions so lets just return the group permissions { return $groupperms;
|
}
| }
|
// The fix here for better working inheritance was provided by tinywizard - http://windizupdate.com/ // Many thanks. foreach($fpermfields as $perm)
| // The fix here for better working inheritance was provided by tinywizard - http://windizupdate.com/ // Many thanks. foreach($fpermfields as $perm)
|
Zeile 800 | Zeile 840 |
---|
{ if($gid && $groupscache[$gid]) {
|
{ if($gid && $groupscache[$gid]) {
|
$p = is_array($fpermcache[$fid][$gid]) ? $fpermcache[$fid][$gid] : $groupperms;
| if(is_array($fpermcache[$fid][$gid])) { $p = $fpermcache[$fid][$gid]; } else { $p = $groupperms; }
|
if($p == NULL) { foreach($forumpermissions as $k => $v) { $forumpermissions[$k] = 'yes'; // no inherited group, assume one has access
|
if($p == NULL) { foreach($forumpermissions as $k => $v) { $forumpermissions[$k] = 'yes'; // no inherited group, assume one has access
|
} } else
| } } else
|
{ foreach($p as $perm => $access) {
| { foreach($p as $perm => $access) {
|
Zeile 840 | Zeile 888 |
---|
{ if($password == $mybb->input['pwverify']) {
|
{ if($password == $mybb->input['pwverify']) {
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']));
| my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
|
$showform = 0; } else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = 0; } else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = 1; }
| $showform = 1; }
|
} else {
| } else {
|
Zeile 1019 | Zeile 1067 |
---|
* @param string The cookie identifier. * @param string The cookie value. * @param int The timestamp of the expiry date.
|
* @param string The cookie identifier. * @param string The cookie value. * @param int The timestamp of the expiry date.
|
| * @param boolean True if setting a HttpOnly cookie (supported by IE, Opera 9, Konqueror)
|
*/
|
*/
|
function my_setcookie($name, $value="", $expires="")
| function my_setcookie($name, $value="", $expires="", $httponly=false)
|
{
|
{
|
global $mybb, $sent_header; if($sent_header) { return false; }
| global $mybb;
|
if(!$mybb->settings['cookiepath'])
|
if(!$mybb->settings['cookiepath'])
|
{
| {
|
$mybb->settings['cookiepath'] = "/";
|
$mybb->settings['cookiepath'] = "/";
|
}
| }
|
if($expires == -1) { $expires = 0; }
|
if($expires == -1) { $expires = 0; }
|
else
| else if($expires == "" || $expires == null)
|
{ if($mybb->user['remember'] == "no") { $expires = 0;
|
{ if($mybb->user['remember'] == "no") { $expires = 0;
|
} else
| } else
|
{ $expires = time() + (60*60*24*365); // Make the cookie expire in a years time }
|
{ $expires = time() + (60*60*24*365); // Make the cookie expire in a years time }
|
} if($mybb->settings['cookiedomain']) { setcookie($name, $value, $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);
| |
} else {
|
} else {
|
setcookie($name, $value, $expires, $mybb->settings['cookiepath']);
| $expires = time() + intval($expires);
|
}
|
}
|
| $mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']); $mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);
// Versions of PHP prior to 5.2 do not support HttpOnly cookies and IE is buggy when specifying a blank domain so set the cookie manually $cookie = "Set-Cookie: {$name}=".urlencode($value); if($expires > 0) { $cookie .= "; expires=".gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires); } if(!empty($mybb->settings['cookiepath'])) { $cookie .= "; path={$mybb->settings['cookiepath']}"; } if(!empty($mybb->settings['cookiedomain'])) { $cookie .= "; domain={$mybb->settings['cookiedomain']}"; } if($httponly == true) { $cookie .= "; HttpOnly"; } header($cookie, false); }
/** * Unset a cookie set by MyBB. * * @param string The cookie identifier. */ function my_unsetcookie($name) { global $mybb; $expires = -3600; my_setcookie($name, "", $expires);
|
}
/**
|
}
/**
|
* Unset a cookie set by MyBB.
| * Get the contents from a serialised cookie array.
|
* * @param string The cookie identifier.
|
* * @param string The cookie identifier.
|
| * @param int The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent.
|
*/
|
*/
|
function my_unsetcookie($name) { global $mybb, $sent_header; if($sent_header) { return false; }
$expires = time()-3600; if(!$mybb->settings['cookiepath']) { $mybb->settings['cookiepath'] = "/"; }
if($mybb->settings['cookiedomain']) { @setcookie($name, "", $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']); } else { @setcookie($name, "", $expires, $mybb->settings['cookiepath']); } }
/** * Get the contents from a serialised cookie array. * * @param string The cookie identifier. * @param int The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id)
| function my_get_array_cookie($name, $id)
|
{ if(!isset($_COOKIE['mybb'][$name])) {
| { if(!isset($_COOKIE['mybb'][$name])) {
|
Zeile 1285 | Zeile 1330 |
---|
WHERE tid='$tid' AND visible='0' "); $nounposts = $db->fetch_field($query, "totunposts");
|
WHERE tid='$tid' AND visible='0' "); $nounposts = $db->fetch_field($query, "totunposts");
|
|
|
// Update the attachment count for this thread update_thread_attachment_count($tid);
|
// Update the attachment count for this thread update_thread_attachment_count($tid);
|
$db->query(" UPDATE ".TABLE_PREFIX."threads SET username='".$firstpost['username']."', uid='".intval($firstpost['uid'])."', lastpost='".$lastpost['dateline']."', lastposter='".$lastpost['username']."', lastposteruid='".intval($lastpost['uid'])."', replies='$treplies', unapprovedposts='$nounposts' WHERE tid='$tid' "); }
| $db->query(" UPDATE ".TABLE_PREFIX."threads SET username='".$firstpost['username']."', uid='".intval($firstpost['uid'])."', lastpost='".intval($lastpost['dateline'])."', lastposter='".$lastpost['username']."', lastposteruid='".intval($lastpost['uid'])."', replies='$treplies', unapprovedposts='$nounposts' WHERE tid='$tid' "); }
|
/** * Updates the number of attachments for a specific thread
|
/** * Updates the number of attachments for a specific thread
|
* * @param int The thread ID */
| * * @param int The thread ID */
|
function update_thread_attachment_count($tid) { global $db;
| function update_thread_attachment_count($tid) { global $db;
|
Zeile 1322 | Zeile 1367 |
---|
* @param int The thread ID */ function delete_thread($tid)
|
* @param int The thread ID */ function delete_thread($tid)
|
{ global $moderation; if(!is_object($moderation))
| { global $moderation; if(!is_object($moderation))
|
{ require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
| { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
Zeile 1334 | Zeile 1379 |
---|
/** * Deletes a post from the database
|
/** * Deletes a post from the database
|
*
| *
|
* @param int The thread ID */ function delete_post($pid, $tid="")
| * @param int The thread ID */ function delete_post($pid, $tid="")
|
Zeile 1363 | Zeile 1408 |
---|
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") { global $db, $forum_cache, $fjumpcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") { global $db, $forum_cache, $fjumpcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
|
|
$pid = intval($pid); if($permissions) {
| $pid = intval($pid); if($permissions) {
|
Zeile 1761 | Zeile 1806 |
---|
function get_reputation($reputation, $uid=0) { global $theme;
|
function get_reputation($reputation, $uid=0) { global $theme;
|
|
|
if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
| if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
|
Zeile 1813 | Zeile 1858 |
---|
if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP'];
|
if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP'];
|
} else {
| } else {
|
$ip = $_SERVER['REMOTE_ADDR']; } }
| $ip = $_SERVER['REMOTE_ADDR']; } }
|
Zeile 1833 | Zeile 1878 |
---|
global $lang;
if($size >= 1073741824)
|
global $lang;
if($size >= 1073741824)
|
{
| {
|
$size = round(($size / 1073741824), 2) . " " . $lang->size_gb; } elseif($size >= 1048576)
| $size = round(($size / 1073741824), 2) . " " . $lang->size_gb; } elseif($size >= 1048576)
|
Zeile 1843 | Zeile 1888 |
---|
elseif($size >= 1024) { $size = round(($size / 1024), 2) . " " . $lang->size_kb;
|
elseif($size >= 1024) { $size = round(($size / 1024), 2) . " " . $lang->size_kb;
|
}
| }
|
elseif($size == 0) { $size = "0 ".$lang->size_bytes;
| elseif($size == 0) { $size = "0 ".$lang->size_bytes;
|
Zeile 1980 | Zeile 2025 |
---|
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";"); eval("\$donenav = \"".$templates->get("nav")."\";"); return $donenav;
|
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";"); eval("\$donenav = \"".$templates->get("nav")."\";"); return $donenav;
|
}
/**
| }
/**
|
* Add a breadcrumb menu item to the list. * * @param string The name of the item to add
| * Add a breadcrumb menu item to the list. * * @param string The name of the item to add
|
Zeile 2035 | Zeile 2080 |
---|
// Set up link to forum in breadcrumb. if($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c') {
|
// Set up link to forum in breadcrumb. if($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c') {
|
$navbits[$navsize]['url'] = "{$base_url}/forum-".$forumnav['fid'].".html";
| $navbits[$navsize]['url'] = "{$base_url}forum-".$forumnav['fid'].".html";
|
} else {
| } else {
|
Zeile 2568 | Zeile 2613 |
---|
function build_theme_select($name, $selected="", $tid=0, $depth="", $usergroup_override=0) { global $db, $themeselect, $tcache, $lang, $mybb;
|
function build_theme_select($name, $selected="", $tid=0, $depth="", $usergroup_override=0) { global $db, $themeselect, $tcache, $lang, $mybb;
|
| |
if($tid == 0) { $themeselect = "<select name=\"$name\">";
| if($tid == 0) { $themeselect = "<select name=\"$name\">";
|
Zeile 2576 | Zeile 2620 |
---|
$themeselect .= "<option value=\"0\">-----------</option>\n"; } if(!is_array($tcache))
|
$themeselect .= "<option value=\"0\">-----------</option>\n"; } if(!is_array($tcache))
|
{
| {
|
$query = $db->query(" SELECT name, pid, tid, allowedgroups FROM ".TABLE_PREFIX."themes
|
$query = $db->query(" SELECT name, pid, tid, allowedgroups FROM ".TABLE_PREFIX."themes
|
| WHERE pid != 0
|
ORDER BY pid, name "); while($theme = $db->fetch_array($query)) {
|
ORDER BY pid, name "); while($theme = $db->fetch_array($query)) {
|
$tcache[$theme['pid']][$theme['tid']] = $theme;
| $tcache[$theme['pid']][] = $theme;
|
} }
|
} }
|
if(is_array($tcache[$tid]))
| if(is_array($tcache))
|
{ // Figure out what groups this user is in
|
{ // Figure out what groups this user is in
|
$in_groups = explode(",", $mybb->user['additionalgroups']);
| if($mybb->user['additionalgroups']) { $in_groups = explode(",", $mybb->user['additionalgroups']); }
|
$in_groups[] = $mybb->user['usergroup'];
|
$in_groups[] = $mybb->user['usergroup'];
|
foreach($tcache[$tid] as $theme)
| foreach($tcache as $misc)
|
{
|
{
|
$sel = ""; // Make theme allowed groups into array $is_allowed = false; if($theme['allowedgroups'] != "all")
| foreach($misc as $theme)
|
{
|
{
|
$allowed_groups = explode(",", $theme['allowedgroups']); // See if groups user is in is allowed foreach($allowed_groups as $agid) { if(in_array($agid, $in_groups)) { $is_allowed = true; break; } } } // Show theme if allowed, or if override is on if($is_allowed || $theme['allowedgroups'] == "all" || $usergroup_override == 1) { if($theme['tid'] == $selected) { $sel = "selected=\"selected\"";
| $sel = ""; // Make theme allowed groups into array $is_allowed = false; if($theme['allowedgroups'] != "all" && $theme['allowedgroups'] != "") { $allowed_groups = explode(",", $theme['allowedgroups']); // See if groups user is in is allowed foreach($allowed_groups as $agid) { if(in_array($agid, $in_groups)) { $is_allowed = true; break; } }
|
}
|
}
|
if($theme['pid'] != 0)
| // Show theme if allowed, or if override is on if($is_allowed || $theme['allowedgroups'] == "all" || $usergroup_override == 1)
|
{
|
{
|
$themeselect .= "<option value=\"".$theme['tid']."\" $sel>".$depth.$theme['name']."</option>"; $depthit = $depth."--"; } if(is_array($tcache[$theme['tid']])) { build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override);
| if($theme['tid'] == $selected) { $sel = " selected=\"selected\""; } if($theme['pid'] != 0) { $themeselect .= "<option value=\"".$theme['tid']."\"$sel>".$depth.$theme['name']."</option>"; $depthit = $depth."--"; } if(array_key_exists($theme['tid'], $tcache)) { build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override); }
|
} } }
| } } }
|
Zeile 3165 | Zeile 3216 |
---|
$inactive[] = $fid; foreach($forum_cache as $fid1 => $forum1) {
|
$inactive[] = $fid; foreach($forum_cache as $fid1 => $forum1) {
|
if(strpos(",".$forum1['parentlist'].",", ",".$fid.",") !== false)
| if(strpos(",".$forum1['parentlist'].",", ",".$fid.",") !== false && !in_array($fid1, $inactive))
|
{
|
{
|
$inactive[] = $fid;
| $inactive[] = $fid1;
|
} } }
| } } }
|