Vergleich inc/functions.php - 1.01 - 1.02

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 13Zeile 13
   technical support
*/


   technical support
*/


$mybboard['internalver'] = "1.01";
$mybboard['vercode'] = "100.08";

$mybboard['internalver'] = "1.02";
$mybboard['vercode'] = "100.09";


//
// Outputs the contents of a page rendering variables


//
// Outputs the contents of a page rendering variables

Zeile 315Zeile 315
		$title = $mybb->settings['bbname'];
}
if($mybb->settings['redirects'] == "on")

		$title = $mybb->settings['bbname'];
}
if($mybb->settings['redirects'] == "on")

	{	

	{

		eval("\$redirectpage = \"".$templates->get("redirect")."\";");
outputpage($redirectpage);

		eval("\$redirectpage = \"".$templates->get("redirect")."\";");
outputpage($redirectpage);

	}

	}

	else
{
$url = str_replace("#", "&#", $url);

	else
{
$url = str_replace("#", "&#", $url);

Zeile 338Zeile 338
	{
$pages = $count / $perpage;
$pages = ceil($pages);

	{
$pages = $count / $perpage;
$pages = ceil($pages);





		if($page > 1)
{
$prev = $page - 1;

		if($page > 1)
{
$prev = $page - 1;

Zeile 380Zeile 380
		eval("\$end = \"".$templates->get("multipage_end")."\";");
eval("\$multipage = \"".$templates->get("multipage")."\";");
return $multipage;

		eval("\$end = \"".$templates->get("multipage_end")."\";");
eval("\$multipage = \"".$templates->get("multipage")."\";");
return $multipage;

	}
}

//

	}
}

//

// Check if a certain forum by id exists
//
function validateforum($fid)

// Check if a certain forum by id exists
//
function validateforum($fid)

Zeile 394Zeile 394
	return (($fid=$validforum['fid'])? true:false);
}


	return (($fid=$validforum['fid'])? true:false);
}


//





























// Build the usergroup permissions for a specific user
//
function user_permissions($uid=0)
{
global $mybb, $cache, $groupscache, $usercache;

if($uid == 0)
{
$uid = $mybb->user['uid'];
}

if($uid != $mybb->user['uid'])
{
if($usercache[$uid])
{
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);
}
$gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups'];
$groupperms = usergroup_permissions($gid);
}
else
{
$groupperms = $mybb->usergroup;
}
return $groupperms;
}

//

// Build the usergroup permissions for a user in group(s)
//
function usergroup_permissions($gid=0)

// Build the usergroup permissions for a user in group(s)
//
function usergroup_permissions($gid=0)

Zeile 405Zeile 433
		$groupscache = $cache->read("usergroups");
}
$groups = explode(",", $gid);

		$groupscache = $cache->read("usergroups");
}
$groups = explode(",", $gid);

	if(count($groups) == 1)

	if(count($groups) == 1)

	{
return $groupscache[$gid];
}

	{
return $groupscache[$gid];
}

Zeile 420Zeile 448
			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

				{

				{

					$permbit = $usergroup[$perm];
}
else

					$permbit = $usergroup[$perm];
}
else

Zeile 428Zeile 456
					$permbit = "";
}
if(in_array($perm, $groupzerogreater))

					$permbit = "";
}
if(in_array($perm, $groupzerogreater))

				{

				{

					if($access == 0)
{
$usergroup[$perm] = 0;
$zerogreater = 1;
}

					if($access == 0)
{
$usergroup[$perm] = 0;
$zerogreater = 1;
}

				}

				}

				if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
{
$usergroup[$perm] = $access;

				if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
{
$usergroup[$perm] = $access;

Zeile 450Zeile 478
// Build the display group details for the given group
//
function usergroup_displaygroup($gid)

// Build the display group details for the given group
//
function usergroup_displaygroup($gid)

{

{

	global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
{

	global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
{

Zeile 496Zeile 524
	if(!is_array($forumcache))
{
cacheforums();

	if(!is_array($forumcache))
{
cacheforums();

	}
if(!is_array($forumcache))

	}
if(!is_array($forumcache))

	{
return false;
}

	{
return false;
}

Zeile 539Zeile 567
				if(!is_array($fpermcache[$fid][$gid]))
{
continue;

				if(!is_array($fpermcache[$fid][$gid]))
{
continue;

				} 

				}

				foreach($fpermcache[$fid][$gid] as $perm => $access)
{
if($perm != "fid" && $perm != "gid" && $perm != "pid")

				foreach($fpermcache[$fid][$gid] as $perm => $access)
{
if($perm != "fid" && $perm != "gid" && $perm != "pid")

Zeile 559Zeile 587
		$forumpermissions = $groupperms;
}
return $forumpermissions;

		$forumpermissions = $groupperms;
}
return $forumpermissions;

}

//
// REDUNDANT CODE - TO BE REMOVED
//
function getpermissions($fid=0, $uid=0, $gid="", $parentslist="")
{
die("USING OLD CODE - getpmerissions");
global $db, $mybb, $mybbuser, $usercache, $permscache, $usergroups, $mybbgroup, $groupscache, $cache;
if(!$groupscache)
{
$groupscache = $cache->read("usergroups");
}
$uid = (!$uid) ? $mybb->user['uid'] : $uid;
if(!$gid)
{
if($uid == 0)
{
$gid = 1;
}
else
{
$usercache[$uid]=($uid==$mybb->user['uid'])?$mybbuser:$uid;
$usercache[$uid]=($uid==$mybb->user['uid'])?$mybb:$uid;
if(!$usercache[$uid])
{
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$user = $db->fetch_array($query);
$usercache[$user['uid']] = $user;
$gid = $user['usergroup'];
}
$gid = ($usercache[$uid]) ? $usercache[$uid]['usergroup'] : $gid;
}
}
if(!$permissioncache[$gid][$fid])
{
if(!$fid)
{
if(!$usergroups[$gid])
{
if($mybb->user['uid'] && $gid == $mybbuser['usergroup'])
{
$usergroups[$gid] = $mybbgroup;
}
else
{
$usergroups[$gid] = $groupscache[$gid];
}
}
return $usergroups[$gid];
}
else
{
$parentslist=(!$parentslist)?getparentlist($fid):$parentslist;
$sql = buildparentlist($fid, "fid", "OR", $parentslist);
$query = $db->query("SELECT *, INSTR(',$parentslist,', CONCAT(',', fid, ',') ) AS useperm FROM ".TABLE_PREFIX."forumpermissions WHERE gid='$gid' AND $sql ORDER BY useperm LIMIT 1");
$perms = $db->fetch_array($query);
if(!$perms['pid'])
{
if(!$usergroups[$gid])
{
if($gid == $mybbuser['usergroup'])
{
$usergroups[$gid] = $mybbgroup;
}
else
{
//$perms=$db->fetch_array($db->query("SELECT * FROM usergroups WHERE gid='$gid'"));
$usergroups[$gid] = $groupscache[$gid];
}
$perms = $usergroups[$gid];

}
else
{
$perms = $usergroups[$gid];
}
}
}
$permscache[$gid][$fid] = $perms;
}
else
{
return $permscache[$gid][$fid];
}
return $perms;

 
}

//

}

//

Zeile 656Zeile 598
	if($uid == $mybb->user['uid'])
{
$gid = $mybb->user['usergroup'];

	if($uid == $mybb->user['uid'])
{
$gid = $mybb->user['usergroup'];

	}
else
{

	}
else
{

		if($uid)
{
if($usercache[$uid])

		if($uid)
{
if($usercache[$uid])

Zeile 732Zeile 674
	static $modpermscache;
$uid=(!$uid)?$mybb->user[$uid]:$uid;
if(!$modpermscache[$uid][$fid])

	static $modpermscache;
$uid=(!$uid)?$mybb->user[$uid]:$uid;
if(!$modpermscache[$uid][$fid])

	{

	{

		$parentslist=(!$parentslist)?getparentlist($fid):$parentslist;
$sql = buildparentlist($fid, "fid", "OR", $parentslist);
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."moderators WHERE uid='$uid' AND $sql");

		$parentslist=(!$parentslist)?getparentlist($fid):$parentslist;
$sql = buildparentlist($fid, "fid", "OR", $parentslist);
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."moderators WHERE uid='$uid' AND $sql");

Zeile 781Zeile 723
			if(!$action && $modperms)
{
return "yes";

			if(!$action && $modperms)
{
return "yes";

			}

			}

			else
{
if($modperms[$action] == "yes")
{
return "yes";
}

			else
{
if($modperms[$action] == "yes")
{
return "yes";
}

				else 

				else

				{
return "no";
}

				{
return "no";
}

Zeile 845Zeile 787
		if($mybb->user['rememberme'] == "no")
{
$expires = "";

		if($mybb->user['rememberme'] == "no")
{
$expires = "";

		}
else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time
}
}

		}
else
{
$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

	if($mybb->settings['cookiedomain'])
{
setcookie($name, $value, $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);
}
else

	{

	{

		setcookie($name, $value, $expires, $mybb->settings['cookiepath']);
}
}

		setcookie($name, $value, $expires, $mybb->settings['cookiepath']);
}
}

Zeile 873Zeile 815
	if($mybb->settings['cookiedomain'])
{
@setcookie($name, "", $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);

	if($mybb->settings['cookiedomain'])
{
@setcookie($name, "", $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);

	}
else
{

	}
else
{

		@setcookie($name, "", $expires, $mybb->settings['cookiepath']);

		@setcookie($name, "", $expires, $mybb->settings['cookiepath']);

	}
}

	}
}


function mygetarraycookie($name, $id)
{


function mygetarraycookie($name, $id)
{

Zeile 888Zeile 830
	$my = $_COOKIE['mybb'];
$cookie = unserialize($my[$name]);
if($cookie[$id])

	$my = $_COOKIE['mybb'];
$cookie = unserialize($my[$name]);
if($cookie[$id])

	{

	{

		return $cookie[$id];
}
else
{
return 0;

		return $cookie[$id];
}
else
{
return 0;

	}
}


	}
}


function mysetarraycookie($name, $id, $value) {
global $_COOKIE;
$my = $_COOKIE['mybb'];

function mysetarraycookie($name, $id, $value) {
global $_COOKIE;
$my = $_COOKIE['mybb'];

Zeile 966Zeile 908
		$lp['lastposter'] = addslashes($lp['lastposter']);
$lpadd = ",lastpost='".$lp['lastpost']."', lastposter='".$lp['lastposter']."', lastposttid='".$lp['tid']."'";
}

		$lp['lastposter'] = addslashes($lp['lastposter']);
$lpadd = ",lastpost='".$lp['lastpost']."', lastposter='".$lp['lastposter']."', lastposttid='".$lp['tid']."'";
}

	



	// Get the post counters for this forum and its children
$query = $db->query("SELECT COUNT(*) AS totthreads, SUM(replies) AS totreplies FROM ".TABLE_PREFIX."threads WHERE fid='$fid' AND visible='1' AND closed NOT LIKE 'moved|%'");
$posts2 = $db->fetch_array($query);

	// Get the post counters for this forum and its children
$query = $db->query("SELECT COUNT(*) AS totthreads, SUM(replies) AS totreplies FROM ".TABLE_PREFIX."threads WHERE fid='$fid' AND visible='1' AND closed NOT LIKE 'moved|%'");
$posts2 = $db->fetch_array($query);

Zeile 1178Zeile 1120
	}

if($displaygroup != 0)

	}

if($displaygroup != 0)

	{

	{

		$usergroup = $displaygroup;
}
$ugroup = $groupscache[$usergroup];

		$usergroup = $displaygroup;
}
$ugroup = $groupscache[$usergroup];

Zeile 1210Zeile 1152
		if(!$smiliecache)
{
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."smilies WHERE showclickable!='no' ORDER BY disporder");

		if(!$smiliecache)
{
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."smilies WHERE showclickable!='no' ORDER BY disporder");





			while($smilie = $db->fetch_array($query))
{
$smiliecache[$smilie['find']] = $smilie['image'];

			while($smilie = $db->fetch_array($query))
{
$smiliecache[$smilie['find']] = $smilie['image'];

Zeile 1309Zeile 1251
function logmod($data, $action="")
{
global $mybb, $mybbuser, $db, $session;

function logmod($data, $action="")
{
global $mybb, $mybbuser, $db, $session;

	



	$time = time();
$db->query("INSERT INTO ".TABLE_PREFIX."moderatorlog (uid,dateline,fid,tid,action,ipaddress) VALUES ('".$mybb->user['uid']."','$time','".$data['fid']."','".$data['tid']."','$action','".$session->ipaddress."')");
}

	$time = time();
$db->query("INSERT INTO ".TABLE_PREFIX."moderatorlog (uid,dateline,fid,tid,action,ipaddress) VALUES ('".$mybb->user['uid']."','$time','".$data['fid']."','".$data['tid']."','$action','".$session->ipaddress."')");
}

Zeile 1574Zeile 1516
	$newnav[0]['url'] = $navbits[0]['url'];
unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;

	$newnav[0]['url'] = $navbits[0]['url'];
unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;

}


}


function debugpage() {
global $db, $querytime, $debug, $templatecache, $templatelist, $htmldoctype, $mybb, $mybbuser, $maintimer, $globaltime, $settings, $mybbgroup, $lang, $ptimer, $parsetime;
$totaltime = $maintimer->totaltime;

function debugpage() {
global $db, $querytime, $debug, $templatecache, $templatelist, $htmldoctype, $mybb, $mybbuser, $maintimer, $globaltime, $settings, $mybbgroup, $lang, $ptimer, $parsetime;
$totaltime = $maintimer->totaltime;

Zeile 1588Zeile 1530
	if(strstr(getenv("REQUEST_URI"), "?"))
{
$debuglink = getenv("REQUEST_URI") . "&debug=1";

	if(strstr(getenv("REQUEST_URI"), "?"))
{
$debuglink = getenv("REQUEST_URI") . "&debug=1";

	}

	}

	else
{
$debuglink = getenv("REQUEST_URI") . "?debug=1";

	else
{
$debuglink = getenv("REQUEST_URI") . "?debug=1";

Zeile 1600Zeile 1542
	else
{
$gzipen = "Disabled";

	else
{
$gzipen = "Disabled";

	}

	}

	echo "<h1>MyBB Debug Information</h1>";
echo "<h2>Page Generation</h2>";
echo "<table bgcolor=\"#666666\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">";

	echo "<h1>MyBB Debug Information</h1>";
echo "<h2>Page Generation</h2>";
echo "<table bgcolor=\"#666666\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">";

Zeile 1624Zeile 1566
	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$parsetime seconds</font></b></td>";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$globaltime seconds</font></b></td>";

	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$parsetime seconds</font></b></td>";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$globaltime seconds</font></b></td>";

	echo "</tr>";
echo "<tr>";

	echo "</tr>";
echo "<tr>";

	echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Version:</font></b></td>";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phpversion</font></b></td>";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Server Load:</font></b></td>";

	echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Version:</font></b></td>";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phpversion</font></b></td>";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Server Load:</font></b></td>";

Zeile 1699Zeile 1641
}

function markreports($id, $type="post")

}

function markreports($id, $type="post")

{

{

	global $db, $cache, $plugins;
switch($type)
{
case "posts":

	global $db, $cache, $plugins;
switch($type)
{
case "posts":

			if(is_array($id))
{

			if(is_array($id))
{

				$rids = implode($id, "','");
$rids = "'0','$rids'";
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE pid IN($rids) AND reportstatus='0'");

				$rids = implode($id, "','");
$rids = "'0','$rids'";
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE pid IN($rids) AND reportstatus='0'");

Zeile 1724Zeile 1666
			break;
case "thread":
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE tid='$id' AND reportstatus='0'");

			break;
case "thread":
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE tid='$id' AND reportstatus='0'");

			break;

			break;

		case "forum":
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE fid='$id' AND reportstatus='0'");
break;

		case "forum":
$db->query("UPDATE ".TABLE_PREFIX."reportedposts SET reportstatus='1' WHERE fid='$id' AND reportstatus='0'");
break;

Zeile 1773Zeile 1715
	if($months == 1)
{
$nicetime['months'] = "1 ".$lang->month;

	if($months == 1)
{
$nicetime['months'] = "1 ".$lang->month;

	}

	}

	elseif($months > 1)
{
$nicetime['months'] = $months." ".$lang->months;

	elseif($months > 1)
{
$nicetime['months'] = $months." ".$lang->months;

Zeile 1822Zeile 1764
	elseif($seconds > 1)
{
$nicetime['seconds'] = $seconds." ".$lang->seconds;

	elseif($seconds > 1)
{
$nicetime['seconds'] = $seconds." ".$lang->seconds;

	}

	}

	if(is_array($nicetime))
{
return implode(", ", $nicetime);

	if(is_array($nicetime))
{
return implode(", ", $nicetime);

	}

	}

}

if(!function_exists("file_get_contents"))

}

if(!function_exists("file_get_contents"))

Zeile 1847Zeile 1789
}

function alt_trow($reset=0)

}

function alt_trow($reset=0)

{

{

	global $alttrow;
if($alttrow == "trow1" || $reset)

	global $alttrow;
if($alttrow == "trow1" || $reset)

	{

	{

		$trow = "trow2";

		$trow = "trow2";

	}
else

	}
else

	{
$trow = "trow1";

	{
$trow = "trow1";

	}

	}

	$alttrow = $trow;
return $trow;
}

	$alttrow = $trow;
return $trow;
}

Zeile 1865Zeile 1807
{
global $db, $mybbuser;
if($uid == $mybbuser['uid'])

{
global $db, $mybbuser;
if($uid == $mybbuser['uid'])

	{

	{

		$user = $mybbuser;
}
else
{
$query = $db->query("SELECT additionalgroups, usergroup FROM ".TABLE_PREFIX."users WHERE uid='$uid'");

		$user = $mybbuser;
}
else
{
$query = $db->query("SELECT additionalgroups, usergroup FROM ".TABLE_PREFIX."users WHERE uid='$uid'");

		$user = $db->fetch_array($query);

		$user = $db->fetch_array($query);

	}

// Build the new list of additional groups for this user and make sure they're in the right format

	}

// Build the new list of additional groups for this user and make sure they're in the right format

Zeile 1920Zeile 1862
				$comma = ",";
$donegroup[$gid] = 1;
}

				$comma = ",";
$donegroup[$gid] = 1;
}

		}
}

		}
}

	if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

	if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

Zeile 1971Zeile 1913
			$location = "?".$_ENV['QUERY_STRING'];
}
}

			$location = "?".$_ENV['QUERY_STRING'];
}
}

	



	if($_SERVER['REQUEST_METHOD'] == "POST" || $_ENV['REQUEST_METHOD'] == "POST")
{
if($_POST['action'])

	if($_SERVER['REQUEST_METHOD'] == "POST" || $_ENV['REQUEST_METHOD'] == "POST")
{
if($_POST['action'])