Vergleich inc/functions.php - 1.01 - 1.17

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


   technical support
*/


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

$mybboard['internalver'] = "1.1.8";
$mybboard['vercode'] = "118";


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


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

Zeile 37Zeile 37
		$serverload = serverload();
if(strstr(getenv("REQUEST_URI"), "?"))
{

		$serverload = serverload();
if(strstr(getenv("REQUEST_URI"), "?"))
{

			$debuglink = getenv("REQUEST_URI") . "&debug=1";

			$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "&debug=1";

		}
else
{

		}
else
{

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

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

		}
if($mybb->settings['gzipoutput'] != "no")
{

		}
if($mybb->settings['gzipoutput'] != "no")
{

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);
}

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

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

 
		$url = str_replace(array("\n","\r",";"), "", $url);

		header("Location: $url");
}
exit;

		header("Location: $url");
}
exit;

Zeile 353Zeile 354
		if($page == $pages)
{
$to = $pages;

		if($page == $pages)
{
$to = $pages;

		}

		}

		elseif($page == $pages-1)

		elseif($page == $pages-1)

		{

		{

			$to = $page+1;

			$to = $page+1;

		}

		}

		elseif($page == $pages-2)
{
$to = $page+2;
}
elseif($page == $pages-3)

		elseif($page == $pages-2)
{
$to = $page+2;
}
elseif($page == $pages-3)

		{

		{

			$to = $page+3;
}
else

			$to = $page+3;
}
else

Zeile 380Zeile 381
		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

//
// Check if a certain forum by id exists

//

//

function validateforum($fid)

function validateforum($fid)

{

{

	global $db;
$query = $db->query("SELECT fid FROM ".TABLE_PREFIX."forums WHERE fid='$fid'");
$validforum = $db->fetch_array($query);
return (($fid=$validforum['fid'])? true:false);

	global $db;
$query = $db->query("SELECT fid FROM ".TABLE_PREFIX."forums WHERE fid='$fid'");
$validforum = $db->fetch_array($query);
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;

}

//

}

//

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

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

				} 

				}

				foreach($fpermcache[$fid][$gid] as $perm => $access)

				foreach($fpermcache[$fid][$gid] as $perm => $access)

				{

				{

					if($perm != "fid" && $perm != "gid" && $perm != "pid")

					if($perm != "fid" && $perm != "gid" && $perm != "pid")

					{

					{

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

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

Zeile 553Zeile 582
				}
}
}

				}
}
}

	}
if(!isset($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

	}
if(!isset($forumpermissions))























































































	{

	{

		return $permscache[$gid][$fid];

		$forumpermissions = $groupperms;

	}

	}

	return $perms;

	return $forumpermissions;

}

//

}

//

Zeile 788Zeile 731
				{
return "yes";
}

				{
return "yes";
}

				else 

				else

				{
return "no";
}
}

				{
return "no";
}
}

		}

		}

	}
}


	}
}


Zeile 802Zeile 745
//
function getposticons()
{

//
function getposticons()
{

	global $db, $icon, $settings, $theme, $templates, $lang;
$listed = 0;
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."icons ORDER BY name DESC");
while($dbicon = $db->fetch_array($query))
{
if($icon == $dbicon['iid'])
{

    global $mybb, $db, $icon, $settings, $theme, $templates, $lang;
$listed = 0;
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."icons ORDER BY name DESC");
while($dbicon = $db->fetch_array($query))
{
if($mybb->input['icon'] == $dbicon['iid'])
{

			$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\">";
}
else
{
$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\"> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\">";

			$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\">";
}
else
{
$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\"> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\">";

		}

		}

		$listed++;
if($listed == 9)
{
$iconlist .= "<br />";
$listed = 0;
}

		$listed++;
if($listed == 9)
{
$iconlist .= "<br />";
$listed = 0;
}

	}

	}

	eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
}

	eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
}

Zeile 830Zeile 773
// MyBB setcookie() wrapper
//
function mysetcookie($name, $value="", $expires="")

// MyBB setcookie() wrapper
//
function mysetcookie($name, $value="", $expires="")

{
global $mybb;
if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";
}

{
global $mybb;
if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";
}

	if($expires == -1)

	if($expires == -1)

	{

	{

		$expires = 0;
}
else
{

		$expires = 0;
}
else
{

		if($mybb->user['rememberme'] == "no")
{
$expires = "";
}
else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time
}

        if($mybb->user['rememberme'] == "no")
{
$expires = 0;
}
else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time
}

	}
if($mybb->settings['cookiedomain'])
{

	}
if($mybb->settings['cookiedomain'])
{

Zeile 904Zeile 847
	$newcookie[$id] = $value;
$newcookie = addslashes(serialize($newcookie));
mysetcookie("mybb[$name]", $newcookie);

	$newcookie[$id] = $value;
$newcookie = addslashes(serialize($newcookie));
mysetcookie("mybb[$name]", $newcookie);

}


}



function serverload()
{
global $lang;
if(strtolower(substr(PHP_OS, 0, 3)) === 'win')


function serverload()
{
global $lang;
if(strtolower(substr(PHP_OS, 0, 3)) === 'win')

	{

	{

		return $lang->unknown;

		return $lang->unknown;

	}

	}

	elseif(@file_exists("/proc/loadavg"))
{
$load = @file_get_contents("/proc/loadavg");

	elseif(@file_exists("/proc/loadavg"))
{
$load = @file_get_contents("/proc/loadavg");

Zeile 924Zeile 867
			$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

			$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

		}
}

		}
}

	else
{
$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

	else
{
$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

	}

	}

	$returnload = trim($serverload[0]);
if(!$returnload)
{

	$returnload = trim($serverload[0]);
if(!$returnload)
{

Zeile 946Zeile 889
	while($childforum = $db->fetch_array($query))
{
if($fid == $childforum['fid'])

	while($childforum = $db->fetch_array($query))
{
if($fid == $childforum['fid'])

		{

		{

			$parentlist = $childforum['parentlist'];
$flastpost = $childforum['lastpost'];
}

			$parentlist = $childforum['parentlist'];
$flastpost = $childforum['lastpost'];
}

Zeile 966Zeile 909
		$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 1309Zeile 1252
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 1373Zeile 1316
			$ip = $_SERVER['REMOTE_ADDR'];
}
}

			$ip = $_SERVER['REMOTE_ADDR'];
}
}

	return $ip;

	return addslashes($ip);

}

function getfriendlysize($size)

}

function getfriendlysize($size)

Zeile 1452Zeile 1395
		$pwverified = 1;
if($forum['password'] != "")
{

		$pwverified = 1;
if($forum['password'] != "")
{

			if($forumpass[$forum['fid']] != md5($mybbuser['uid'].$forum['password']))

			if($_COOKIE['forumpass'][$forum['fid']] != md5($mybbuser['uid'].$forum['password']))

			{
$pwverified = 0;
}

			{
$pwverified = 0;
}

Zeile 1656Zeile 1599
}

function pageheaders() {

}

function pageheaders() {

	global $settings;

	global $mybb;

	if($mybb->settings['nocacheheaders'] == "yes" && $mybb->settings['standardheaders'] != "yes")
{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");

	if($mybb->settings['nocacheheaders'] == "yes" && $mybb->settings['standardheaders'] != "yes")
{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");

Zeile 1686Zeile 1629
		$pcache[$pid] = $db->fetch_array($query);
}
return $pcache[$pid];

		$pcache[$pid] = $db->fetch_array($query);
}
return $pcache[$pid];

}

}

function getforum($fid)
{
global $fcache, $db;

function getforum($fid)
{
global $fcache, $db;

Zeile 1760Zeile 1703
	$minutes = floor($stamp/$msecs);
$stamp %= $msecs;
$seconds = $stamp;

	$minutes = floor($stamp/$msecs);
$stamp %= $msecs;
$seconds = $stamp;





	if($years == 1)

	if($years == 1)

	{

	{

		$nicetime['years'] = "1 ".$lang->year;

		$nicetime['years'] = "1 ".$lang->year;

	}

	}

	elseif($years > 1)

	elseif($years > 1)

	{

	{

		$nicetime['years'] = $years." ".$lang->years;
}

if($months == 1)

		$nicetime['years'] = $years." ".$lang->years;
}

if($months == 1)

	{

	{

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

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

	{

	{

		$nicetime['months'] = $months." ".$lang->months;
}


		$nicetime['months'] = $months." ".$lang->months;
}


Zeile 1871Zeile 1814
	else
{
$query = $db->query("SELECT additionalgroups, usergroup FROM ".TABLE_PREFIX."users WHERE uid='$uid'");

	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
$usergroups = "";


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

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

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

		}
}

		}
}

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

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

Zeile 1971Zeile 1914
			$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'])