Vergleich inc/functions.php - 1.00 - 1.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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$

 * $Id: functions.php 966 2005-12-12 23:33:28Z chris $

 */

/* Do not change the following line if you wish to receive
technical support
*/


 */

/* Do not change the following line if you wish to receive
technical support
*/


$mybboard['internalver'] = "1.00";
$mybboard['vercode'] = "100.07";

$mybboard['internalver'] = "1.1.5";
$mybboard['vercode'] = "115";


//
// 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 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
//
function validateforum($fid)

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

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

	$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 400Zeile 429
function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;

function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;

	if(!is_array($groupscache))
{

	if(!is_array($groupscache))
{

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

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

Zeile 432Zeile 461
					if($access == 0)
{
$usergroup[$perm] = 0;

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

 
						$zerogreater = 1;

					}
}

					}
}

				elseif($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit)

				if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)

				{
$usergroup[$perm] = $access;
}

				{
$usergroup[$perm] = $access;
}



				$zerogreater = 0;

			}
}
}
return $usergroup;

			}
}
}
return $usergroup;

}

//

}

//

// 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)

Zeile 488Zeile 518
		}
else
{

		}
else
{

			$gid = $mybb->user['usergroup'].",".$mybbuser['additionalgroups'];

			$gid = $mybb->user['usergroup'].",".$mybb->user['additionalgroups'];

			$groupperms = $mybbgroup;

			$groupperms = $mybbgroup;

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

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

		return false;
}
if(!is_array($fpermcache))

		return false;
}
if(!is_array($fpermcache))

	{

	{

		$fpermcache = $cache->read("forumpermissions");
}
if($fid) // Fetch the permissions for a single forum
{
$permissions = fetch_forum_permissions($fid, $gid, $groupperms);

		$fpermcache = $cache->read("forumpermissions");
}
if($fid) // Fetch the permissions for a single forum
{
$permissions = fetch_forum_permissions($fid, $gid, $groupperms);

	}

	}

	else
{
foreach($forumcache as $forum)

	else
{
foreach($forumcache as $forum)

Zeile 522Zeile 552
// Perform inheritance scheme for forum permissions
//
function fetch_forum_permissions($fid, $gid, $groupperms)

// Perform inheritance scheme for forum permissions
//
function fetch_forum_permissions($fid, $gid, $groupperms)

{
global $groupscache, $forumcache, $fpermcache;

{
global $groupscache, $forumcache, $fpermcache, $mybb;

	$groups = explode(",", $gid);
if(!$fpermcache[$fid]) // This forum has no custom or inherited permisssions so lets just return the group permissions

	$groups = explode(",", $gid);
if(!$fpermcache[$fid]) // This forum has no custom or inherited permisssions so lets just return the group permissions

	{

	{

		return $groupperms;
}
else // Okay, we'll do it the hard way because this forum must have some custom or inherited permissions

		return $groupperms;
}
else // Okay, we'll do it the hard way because this forum must have some custom or inherited permissions

Zeile 538Zeile 568
				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 558Zeile 588
		$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 682Zeile 626
{
global $mybb, $mybbuser, $toplinks, $header, $settings, $footer, $css, $headerinclude, $theme, $_SERVER, $breadcrumb, $templates, $lang;
$showform = 1;

{
global $mybb, $mybbuser, $toplinks, $header, $settings, $footer, $css, $headerinclude, $theme, $_SERVER, $breadcrumb, $templates, $lang;
$showform = 1;





	if($password)
{
if($mybb->input['pwverify'])
{
if($password == $mybb->input['pwverify'])

	if($password)
{
if($mybb->input['pwverify'])
{
if($password == $mybb->input['pwverify'])

			{

			{

				mysetcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']));

				mysetcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']));

				$showform = 0;
}

				$showform = 0;
}

			else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

			else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

Zeile 703Zeile 647
			if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))
{
$showform = 1;

			if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))
{
$showform = 1;

			}

			}

			else
{
$showform = 0;

			else
{
$showform = 0;

			}

			}

		}

		}

	}

	}

	else
{
$showform = 0;
}
if($showform)

	else
{
$showform = 0;
}
if($showform)

	{

	{

		eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
outputpage($pwform);
exit;

		eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
outputpage($pwform);
exit;

Zeile 731Zeile 675
	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 780Zeile 724
			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 801Zeile 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']."\">";

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

		}
else
{

		}
else
{

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

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

Zeile 841Zeile 785
	}
else
{

	}
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'])

	{

	{

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

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

	}

	}

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

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

Zeile 867Zeile 811
	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

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

	}


	}


	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']);

Zeile 965Zeile 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 988Zeile 932
			if($val && $val != $fid)
{
updateforumcount($val);

			if($val && $val != $fid)
{
updateforumcount($val);

			}
}
}

			}
}
}

}

function updatethreadcount($tid)

}

function updatethreadcount($tid)

Zeile 1308Zeile 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 1372Zeile 1316
			$ip = $_SERVER['REMOTE_ADDR'];
}
}

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

	return $ip;

	return addslashes($ip);

}

function getfriendlysize($size)

}

function getfriendlysize($size)

Zeile 1451Zeile 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 1655Zeile 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 1970Zeile 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'])