Vergleich inc/functions.php - 1.2.11 - 1.2.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: functions.php 3508 2007-11-23 16:10:16Z Tikitiki $

 * $Id: functions.php 3596 2008-01-20 08:27:39Z Tikitiki $

 */

/**

 */

/**

Zeile 378Zeile 378
	}

mail($to, $subject, $message, $headers);

	}

mail($to, $subject, $message, $headers);

 
}

/**
* Generates a unique code for POST requests to prevent XSS/CSRF attacks
*
* @return string The generated code
*/
function generate_post_check()
{
global $mybb;
if($mybb->user['uid'])
{
return md5($mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']);
}
// Guests get a special string
else
{
return md5($mybb->config['hostname'].$mybb->config['username'].$mybb->config['password']);
}
}

/**
* Verifies a POST check code is valid, if not shows an error (silently returns false on silent parameter)
*
* @param string The incoming POST check code
* @param boolean Silent mode or not (silent mode will not show the error to the user but returns false)
*/
function verify_post_check($code, $silent=false)
{
global $lang;
if(generate_post_check() != $code)
{
if($silent == true)
{
return false;
}
else
{
error($lang->invalid_post_code);
}
}
else
{
return true;
}

}

/**

}

/**

Zeile 542Zeile 587

/**
* Redirect the user to a given URL with a given message


/**
* Redirect the user to a given URL with a given message

 *

 *

 * @param string The URL to redirect the user to
* @param string The redirection message to be shown
*/

 * @param string The URL to redirect the user to
* @param string The redirection message to be shown
*/

Zeile 663Zeile 708
		if($user_cache[$uid]['permissions'])
{
return $user_cache[$uid]['permissions'];

		if($user_cache[$uid]['permissions'])
{
return $user_cache[$uid]['permissions'];

		}

		}


// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])


// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])

		{

		{

			$user_cache[$uid] = get_user($uid);
}


			$user_cache[$uid] = get_user($uid);
}


Zeile 685Zeile 730
	}
// This user is the current user, return their permissions
else

	}
// This user is the current user, return their permissions
else

	{

	{

		return $mybb->usergroup;
}
}

		return $mybb->usergroup;
}
}





/**
* Fetch the usergroup permissions for a specic group or series of groups combined
*

/**
* Fetch the usergroup permissions for a specic group or series of groups combined
*

Zeile 700Zeile 745
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


	if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}


	if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}


	$groups = explode(",", $gid);
if(count($groups) == 1)
{

	$groups = explode(",", $gid);
if(count($groups) == 1)
{

Zeile 783Zeile 828
{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;
static $cached_forum_permissions;

{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;
static $cached_forum_permissions;

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

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

	}
if(!$gid || $gid == 0) // If no group, we need to fetch it
{

	}
if(!$gid || $gid == 0) // If no group, we need to fetch it
{

Zeile 865Zeile 910
	$current_permissions = array();

foreach($groups as $gid)

	$current_permissions = array();

foreach($groups as $gid)

	{

	{

		if($groupscache[$gid])
{
// If this forum has permissions set

		if($groupscache[$gid])
{
// If this forum has permissions set

Zeile 881Zeile 926
				}
}
}

				}
}
}

	}

	}

	
if(count($current_permissions) == 0)
{

	
if(count($current_permissions) == 0)
{

Zeile 906Zeile 951
	{
$forum_cache = cache_forums();
if(!$forum_cache)

	{
$forum_cache = cache_forums();
if(!$forum_cache)

		{

		{

			return false;
}
}

			return false;
}
}

Zeile 986Zeile 1031
	static $modpermscache;

if($uid < 1)

	static $modpermscache;

if($uid < 1)

	{

	{

		$uid = $mybb->user['uid'];
}


		$uid = $mybb->user['uid'];
}


Zeile 1005Zeile 1050
	else
{
$perms = $modpermscache[$fid][$uid];

	else
{
$perms = $modpermscache[$fid][$uid];

	}

	}

	
return $perms;
}

	
return $perms;
}

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

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

	}


	}


	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == "yes")

	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == "yes")

	{

	{

		return "yes";
}
else

		return "yes";
}
else

Zeile 1039Zeile 1084
			$query = $db->simple_select(TABLE_PREFIX.'moderators', 'COUNT(*) as count', "uid={$uid}", array('limit' => 1));
$modcheck = $db->fetch_array($query);
if($modcheck['count'] > 0)

			$query = $db->simple_select(TABLE_PREFIX.'moderators', 'COUNT(*) as count', "uid={$uid}", array('limit' => 1));
$modcheck = $db->fetch_array($query);
if($modcheck['count'] > 0)

			{
return "yes";
}
else
{

			{
return "yes";
}
else
{

				return "no";
}
}

				return "no";
}
}

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

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

			}

			}

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

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

Zeile 1063Zeile 1108
				else
{
return "no";

				else
{
return "no";

				}
}
}
}
}

				}
}
}
}
}


/**
* Generate a list of the posticons.


/**
* Generate a list of the posticons.

Zeile 1265Zeile 1310
			if(!is_array($serverload))
{
return $lang->unknown;

			if(!is_array($serverload))
{
return $lang->unknown;

			}
}
}
else
{

			}
}
}
else
{

		return $lang->unknown;
}


		return $lang->unknown;
}


Zeile 1349Zeile 1394
	// Fetch above counters for this forum
$query = $db->simple_select(TABLE_PREFIX."forums", implode(",", $counters), "fid='{$fid}'");
$forum = $db->fetch_array($query);

	// Fetch above counters for this forum
$query = $db->simple_select(TABLE_PREFIX."forums", implode(",", $counters), "fid='{$fid}'");
$forum = $db->fetch_array($query);





	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))

	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))

		{

		{

			// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

			// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

			}

			}

			else
{
$update_query[$counter] = $changes[$counter];

			else
{
$update_query[$counter] = $changes[$counter];

Zeile 1367Zeile 1412
			if($update_query[$counter] < 0)
{
$update_query[$counter] = 0;

			if($update_query[$counter] < 0)
{
$update_query[$counter] = 0;

			}

			}

		}
}


		}
}


Zeile 1388Zeile 1433
			{
$new_stats['numthreads'] = "+{$threads_diff}";
}

			{
$new_stats['numthreads'] = "+{$threads_diff}";
}

			else
{
$new_stats['numthreads'] = "{$threads_diff}";
}

			else
{
$new_stats['numthreads'] = "{$threads_diff}";
}

		}
if(array_key_exists('posts', $update_query))
{

		}
if(array_key_exists('posts', $update_query))
{

Zeile 1429Zeile 1474
		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
ORDER BY lastpost DESC
LIMIT 0, 1

		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
ORDER BY lastpost DESC
LIMIT 0, 1

	");
$lastpost = $db->fetch_array($query);

	");
$lastpost = $db->fetch_array($query);


$updated_forum = array(
"lastpost" => intval($lastpost['lastpost']),


$updated_forum = array(
"lastpost" => intval($lastpost['lastpost']),

Zeile 1471Zeile 1516
				$update_query[$counter] = $thread[$counter] + $changes[$counter];
}
else

				$update_query[$counter] = $thread[$counter] + $changes[$counter];
}
else

			{

			{

				$update_query[$counter] = $changes[$counter];
}
// Less than 0? That's bad

				$update_query[$counter] = $changes[$counter];
}
// Less than 0? That's bad

Zeile 1632Zeile 1677
	if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	}

	}

	if(is_array($jumpfcache[$pid]))
{
foreach($jumpfcache[$pid] as $main)

	if(is_array($jumpfcache[$pid]))
{
foreach($jumpfcache[$pid] as $main)

Zeile 1647Zeile 1692
					{
$optionselected = "selected=\"selected\"";
$selecteddone = 1;

					{
$optionselected = "selected=\"selected\"";
$selecteddone = 1;

					}

					}

					
$forum['name'] = htmlspecialchars_uni($forum['name']);


					
$forum['name'] = htmlspecialchars_uni($forum['name']);


Zeile 1672Zeile 1717
			$jumpsel[$selitem] = "selected";
}
if($showextras == 0)

			$jumpsel[$selitem] = "selected";
}
if($showextras == 0)

		{

		{

			$template = "special";
}
else

			$template = "special";
}
else

Zeile 2965Zeile 3010

if($mybb->settings['wordwrap'] > 0)
{


if($mybb->settings['wordwrap'] > 0)
{

		$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message);








		if($mybb->config['db_encoding'] == "utf8")
{
$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#u", "$0 ", $message);
}
else
{
$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message);
}

	}
return $message;
}

	}
return $message;
}