Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions.php 5172 2010-08-02 23:13:03Z RyanGordon $
| * $Id: functions.php 5765 2012-03-27 09:52:45Z Tomm $
|
*/
/**
| */
/**
|
Zeile 92 | Zeile 92 |
---|
echo $contents;
$plugins->run_hooks("post_output_page");
|
echo $contents;
$plugins->run_hooks("post_output_page");
|
// If the use shutdown functionality is turned off, run any shutdown related items now. if($mybb->settings['useshutdownfunc'] == 0 && $mybb->use_shutdown != true) { run_shutdown(); }
| |
}
/**
| }
/**
|
Zeile 197 | Zeile 191 |
---|
}
// And finally.. plugins
|
}
// And finally.. plugins
|
if(!is_object($plugins) && !defined("NO_PLUGINS"))
| if(!is_object($plugins) && !defined("NO_PLUGINS") && !($mybb->settings['no_plugins'] == 1))
|
{ require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem;
| { require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem;
|
Zeile 246 | Zeile 240 |
---|
// Fetch emails for this page view - and send them $query = $db->simple_select("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("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)) { // Delete the message from the queue $db->delete_query("mailqueue", "mid='{$email['mid']}'");
|
while($email = $db->fetch_array($query)) { // Delete the message from the queue $db->delete_query("mailqueue", "mid='{$email['mid']}'");
|
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);
| if($db->affected_rows() == 1) { my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']); }
|
} // Update the mailqueue cache and remove the lock $cache->update_mailqueue(TIME_NOW, 0);
| } // Update the mailqueue cache and remove the lock $cache->update_mailqueue(TIME_NOW, 0);
|
Zeile 272 | Zeile 267 |
---|
function parse_page($contents) { global $lang, $theme, $mybb, $htmldoctype, $archive_url, $error_handler;
|
function parse_page($contents) { global $lang, $theme, $mybb, $htmldoctype, $archive_url, $error_handler;
|
|
|
$contents = str_replace('<navigation>', build_breadcrumb(1), $contents); $contents = str_replace('<archive_url>', $archive_url, $contents);
| $contents = str_replace('<navigation>', build_breadcrumb(1), $contents); $contents = str_replace('<archive_url>', $archive_url, $contents);
|
Zeile 293 | Zeile 288 |
---|
}
if($lang->settings['htmllang'])
|
}
if($lang->settings['htmllang'])
|
{
| {
|
$contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents); }
| $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents); }
|
Zeile 357 | Zeile 352 |
---|
if($offset == "-") { $offset = 0;
|
if($offset == "-") { $offset = 0;
|
} if($adodb == true && function_exists('adodb_date'))
| } if($adodb == true && function_exists('adodb_date'))
|
{ $date = adodb_date($format, $stamp + ($offset * 3600)); }
| { $date = adodb_date($format, $stamp + ($offset * 3600)); }
|
Zeile 395 | Zeile 390 |
---|
if(is_object($plugins)) {
|
if(is_object($plugins)) {
|
$plugins->run_hooks_by_ref("my_date", $date);
| $date = $plugins->run_hooks("my_date", $date);
|
}
return $date;
| }
return $date;
|
Zeile 534 | Zeile 529 |
---|
{ cache_forums(); return $forum_cache[$fid]['parentlist'];
|
{ cache_forums(); return $forum_cache[$fid]['parentlist'];
|
} }
| } }
|
/** * Build a parent list of a specific forum, suitable for querying *
| /** * Build a parent list of a specific forum, suitable for querying *
|
Zeile 547 | Zeile 542 |
---|
* @return string The query string generated */ function build_parent_list($fid, $column="fid", $joiner="OR", $parentlist="")
|
* @return string The query string generated */ function build_parent_list($fid, $column="fid", $joiner="OR", $parentlist="")
|
{
| {
|
if(!$parentlist) { $parentlist = get_parent_list($fid); }
|
if(!$parentlist) { $parentlist = get_parent_list($fid); }
|
|
|
$parentsexploded = explode(",", $parentlist); $builtlist = "("; $sep = '';
foreach($parentsexploded as $key => $val)
|
$parentsexploded = explode(",", $parentlist); $builtlist = "("; $sep = '';
foreach($parentsexploded as $key => $val)
|
{
| {
|
$builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
| $builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
|
Zeile 590 | Zeile 585 |
---|
{ $cache->update_forums(); $forum_cache = $cache->read("forums", 1);
|
{ $cache->update_forums(); $forum_cache = $cache->read("forums", 1);
|
} }
| } }
|
return $forum_cache; }
| return $forum_cache; }
|
Zeile 623 | Zeile 618 |
---|
} foreach($forums_by_parent[$fid] as $forum)
|
} foreach($forums_by_parent[$fid] as $forum)
|
{
| {
|
$forums[] = $forum['fid']; $children = get_child_list($forum['fid']); if(is_array($children))
| $forums[] = $forum['fid']; $children = get_child_list($forum['fid']); if(is_array($children))
|
Zeile 644 | Zeile 639 |
---|
{ global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;
|
{ global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;
|
$plugins->run_hooks_by_ref("error", $error);
| $error = $plugins->run_hooks("error", $error);
|
if(!$error) { $error = $lang->unknown_error;
| if(!$error) { $error = $lang->unknown_error;
|
Zeile 732 | Zeile 727 |
---|
);
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'", 1);
|
);
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'", 1);
|
$url = htmlspecialchars_uni("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
| |
if($mybb->input['ajax']) {
| if($mybb->input['ajax']) {
|
Zeile 749 | Zeile 743 |
---|
} else {
|
} else {
|
| // Redirect to where the user came from $redirect_url = $_SERVER['PHP_SELF']; if($_SERVER['QUERY_STRING']) { $redirect_url .= '?'.$_SERVER['QUERY_STRING']; }
$redirect_url = htmlspecialchars_uni($redirect_url); switch($mybb->settings['username_method']) { case 0: $lang_username = $lang->username; break; case 1: $lang_username = $lang->username1; break; case 2: $lang_username = $lang->username2; break; default: $lang_username = $lang->username; break; }
|
eval("\$errorpage = \"".$templates->get("error_nopermission")."\";"); }
| eval("\$errorpage = \"".$templates->get("error_nopermission")."\";"); }
|
Zeile 767 | Zeile 785 |
---|
$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);
|
$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);
|
$plugins->run_hooks_by_ref("redirect", $redirect_args);
| $plugins->run_hooks("redirect", $redirect_args);
|
if($mybb->input['ajax']) {
| if($mybb->input['ajax']) {
|
Zeile 801 | Zeile 819 |
---|
// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
|
// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
|
{
| {
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars($url);
| $url = str_replace("&", "&", $url); $url = htmlspecialchars($url);
|
Zeile 815 | Zeile 833 |
---|
run_shutdown();
|
run_shutdown();
|
if(my_substr($url, 0, 7) !== 'http://')
| if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://')
|
{ header("Location: {$mybb->settings['bburl']}/{$url}"); }
| { header("Location: {$mybb->settings['bburl']}/{$url}"); }
|
Zeile 952 | Zeile 970 |
---|
/** * Generate a page URL for use by the multipage function
|
/** * Generate a page URL for use by the multipage function
|
*
| *
|
* @param string The URL being passed * @param int The page number */
| * @param string The URL being passed * @param int The page number */
|
Zeile 962 | Zeile 980 |
---|
{ $find = array( "-page-{page}",
|
{ $find = array( "-page-{page}",
|
"&page={page}"
| "&page={page}", "{page}"
|
);
// Remove "Page 1" to the defacto URL
|
);
// Remove "Page 1" to the defacto URL
|
$url = str_replace($find, array("", ""), $url);
| $url = str_replace($find, array("", "", $page), $url);
|
return $url; } else if(strpos($url, "{page}") === false)
| return $url; } else if(strpos($url, "{page}") === false)
|
Zeile 990 | Zeile 1009 |
---|
return $url; }
|
return $url; }
|
|
|
/** * Fetch the permissions for a specific user *
| /** * Fetch the permissions for a specific user *
|
Zeile 1000 | Zeile 1019 |
---|
function user_permissions($uid=0) { global $mybb, $cache, $groupscache, $user_cache;
|
function user_permissions($uid=0) { global $mybb, $cache, $groupscache, $user_cache;
|
|
|
// If no user id is specified, assume it is the current user if($uid == 0) {
| // If no user id is specified, assume it is the current user if($uid == 0) {
|
Zeile 1028 | Zeile 1047 |
---|
// Store group permissions in user cache. $user_cache[$uid]['permissions'] = $groupperms;
|
// Store group permissions in user cache. $user_cache[$uid]['permissions'] = $groupperms;
|
return $groupperms; }
| return $groupperms; }
|
// This user is the current user, return their permissions else {
| // This user is the current user, return their permissions else {
|
Zeile 1178 | Zeile 1197 |
---|
}
if(!is_array($fpermcache))
|
}
if(!is_array($fpermcache))
|
{ $fpermcache = $cache->read("forumpermissions");
| { $fpermcache = $cache->read("forumpermissions");
|
}
if($fid) // Fetch the permissions for a single forum
| }
if($fid) // Fetch the permissions for a single forum
|
Zeile 1187 | Zeile 1206 |
---|
if(!$cached_forum_permissions_permissions[$gid][$fid]) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
|
if(!$cached_forum_permissions_permissions[$gid][$fid]) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
|
}
| }
|
return $cached_forum_permissions_permissions[$gid][$fid]; } else
| return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
Zeile 1224 | Zeile 1243 |
---|
} $current_permissions = array();
|
} $current_permissions = array();
|
| $only_view_own_threads = 1;
|
foreach($groups as $gid) {
| foreach($groups as $gid) {
|
Zeile 1252 | Zeile 1272 |
---|
{ $level_permissions = $groupscache[$gid]; }
|
{ $level_permissions = $groupscache[$gid]; }
|
} }
| } }
|
foreach($level_permissions as $permission => $access) { if($access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no") || !$current_permissions[$permission]) { $current_permissions[$permission] = $access; }
|
foreach($level_permissions as $permission => $access) { if($access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no") || !$current_permissions[$permission]) { $current_permissions[$permission] = $access; }
|
} } }
| }
if(!$level_permissions["canonlyviewownthreads"]) { $only_view_own_threads = 0; } } }
// Figure out if we can view more than our own threads if($only_view_own_threads == 0) { $current_permissions["canonlyviewownthreads"] = 0; }
|
if(count($current_permissions) == 0) { $current_permissions = $groupperms;
| if(count($current_permissions) == 0) { $current_permissions = $groupperms;
|
Zeile 1283 | Zeile 1314 |
---|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache; $showform = true;
|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache; $showform = true;
|
|
|
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
| if(!is_array($forum_cache)) { $forum_cache = cache_forums();
|
Zeile 1301 | Zeile 1332 |
---|
foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid)
|
foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid)
|
{
| {
|
continue; }
| continue; }
|
Zeile 1325 | Zeile 1356 |
---|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = true; } } else {
| $showform = true; } } else {
|
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $mybb->cookies['forumpass'][$fid]))
|
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $mybb->cookies['forumpass'][$fid]))
|
{
| {
|
$showform = true; } else { $showform = false;
|
$showform = true; } else { $showform = false;
|
} } }
| } } }
|
else
|
else
|
{
| {
|
$showform = false; }
if($showform) { if($pid)
|
$showform = false; }
if($showform) { if($pid)
|
{
| {
|
header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid)); } else
| header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid)); } else
|
Zeile 1371 | Zeile 1402 |
---|
*/ function get_moderator_permissions($fid, $uid="0", $parentslist="") {
|
*/ function get_moderator_permissions($fid, $uid="0", $parentslist="") {
|
global $mybb, $db;
| global $mybb, $cache, $db;
|
static $modpermscache;
if($uid < 1)
| static $modpermscache;
if($uid < 1)
|
Zeile 1383 | Zeile 1414 |
---|
{ return false; }
|
{ return false; }
|
if(!isset($modpermscache[$fid][$uid])) { if(!$parentslist)
| if(isset($modpermscache[$fid][$uid])) { return $modpermscache[$fid][$uid]; }
if(!$parentslist) { $parentslist = explode(',', get_parent_list($fid)); }
// Get user groups $perms = array(); $user = get_user($uid);
$groups = array($user['usergroup']);
if(!empty($user['additionalgroups'])) { $extra_groups = explode(",", $user['additionalgroups']);
foreach($extra_groups as $extra_group)
|
{
|
{
|
$parentslist = get_parent_list($fid); } // Get user groups $query = $db->simple_select("users", "usergroup,additionalgroups", "uid='{$uid}'"); $usergroups = $db->fetch_array($query); $groups = "'{$usergroups['usergroup']}'"; if(!empty($usergroups['additionalgroups']))
| $groups[] = $extra_group; } }
$mod_cache = $cache->read("moderators");
foreach($mod_cache as $fid => $forum) { if(!is_array($forum) || !in_array($fid, $parentslist))
|
{
|
{
|
$groups .= ",'{$usergroups['additionalgroups']}'";
| // No perms or we're not after this forum continue; }
// User settings override usergroup settings if(is_array($forum['users'][$uid])) { $perm = $forum['users'][$uid]; foreach($perm as $action => $value) { if(strpos($action, "can") === false) { continue; }
// Figure out the user permissions if($value == 0) { // The user doesn't have permission to set this action $perms[$action] = 0; } else { $perms[$action] = max($perm[$action], $perms[$action]); } } }
foreach($groups as $group) { if(!is_array($forum['usergroups'][$group])) { // There are no permissions set for this group continue; }
$perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) { if(strpos($action, "can") === false) { continue; }
$perms[$action] = max($perm[$action], $perms[$action]); }
|
}
|
}
|
$query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND fid='$fid'"); while($results = $db->fetch_array($query)) { $perms['caneditposts'] = max($perms['caneditposts'], $results['caneditposts']); $perms['candeleteposts'] = max($perms['candeleteposts'], $results['candeleteposts']); $perms['canviewips'] = max($perms['canviewips'], $results['canviewips']); $perms['canopenclosethreads'] = max($perms['canopenclosethreads'], $results['canopenclosethreads']); $perms['canmanagethreads'] = max($perms['canmanagethreads'], $results['canmanagethreads']); $perms['canmovetononmodforum'] = max($perms['canmovetononmodforum'], $results['canmovetononmodforum']); } $sql = build_parent_list($fid, "fid", "OR", $parentslist); $query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND {$sql}"); $uperms = $db->fetch_array($query); if(!$uperms && !$perms) { return false; } //Join the group permissions with the user permissions $perms['caneditposts'] = max($perms['caneditposts'], $uperms['caneditposts']); $perms['candeleteposts'] = max($perms['candeleteposts'], $uperms['candeleteposts']); $perms['canviewips'] = max($perms['canviewips'], $uperms['canviewips']); $perms['canopenclosethreads'] = max($perms['canopenclosethreads'], $uperms['canopenclosethreads']); $perms['canmanagethreads'] = max($perms['canmanagethreads'], $uperms['canmanagethreads']); $perms['canmovetononmodforum'] = max($perms['canmovetononmodforum'], $uperms['canmovetononmodforum']); $modpermscache[$fid][$uid] = $perms; } else { $perms = $modpermscache[$fid][$uid];
| |
}
|
}
|
| $modpermscache[$fid][$uid] = $perms;
|
return $perms; }
| return $perms; }
|
Zeile 1537 | Zeile 1600 |
---|
foreach($posticons as $dbicon) {
|
foreach($posticons as $dbicon) {
|
| $dbicon['path'] = htmlspecialchars_uni($dbicon['path']); $dbicon['name'] = htmlspecialchars_uni($dbicon['name']);
|
if($icon == $dbicon['iid']) { $iconlist .= "<label><input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" /></label>";
| if($icon == $dbicon['iid']) { $iconlist .= "<label><input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" /></label>";
|
Zeile 1558 | Zeile 1624 |
---|
eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
|
eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
|
}
| }
|
/** * MyBB setcookie() wrapper.
| /** * MyBB setcookie() wrapper.
|
Zeile 1580 | Zeile 1646 |
---|
if($expires == -1) { $expires = 0;
|
if($expires == -1) { $expires = 0;
|
}
| }
|
elseif($expires == "" || $expires == null) { $expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time
| elseif($expires == "" || $expires == null) { $expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time
|
Zeile 1624 | Zeile 1690 |
---|
/** * Unset a cookie set by MyBB.
|
/** * Unset a cookie set by MyBB.
|
*
| *
|
* @param string The cookie identifier. */ function my_unsetcookie($name)
| * @param string The cookie identifier. */ function my_unsetcookie($name)
|
Zeile 1639 | Zeile 1705 |
---|
/** * Get the contents from a serialised cookie array.
|
/** * 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)
|
* @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)
|
{ global $mybb;
| { global $mybb;
|
if(!isset($mybb->cookies['mybb'][$name])) { return false; }
|
if(!isset($mybb->cookies['mybb'][$name])) { return false; }
|
$cookie = unserialize($mybb->cookies['mybb'][$name]);
| $cookie = my_unserialize($mybb->cookies['mybb'][$name]);
|
if(is_array($cookie) && isset($cookie[$id])) {
| if(is_array($cookie) && isset($cookie[$id])) {
|
Zeile 1662 | Zeile 1728 |
---|
else { return 0;
|
else { return 0;
|
} }
| } }
|
/** * Set a serialised cookie array.
| /** * Set a serialised cookie array.
|
Zeile 1672 | Zeile 1738 |
---|
* @param int The cookie content id. * @param string The value to set the cookie to. */
|
* @param int The cookie content id. * @param string The value to set the cookie to. */
|
function my_set_array_cookie($name, $id, $value)
| function my_set_array_cookie($name, $id, $value, $expires="")
|
{ global $mybb; $cookie = $mybb->cookies['mybb'];
|
{ global $mybb; $cookie = $mybb->cookies['mybb'];
|
$newcookie = unserialize($cookie[$name]);
if(!is_array($newcookie)) { // Burnt / malformed cookie - reset $newcookie = array(); }
| $newcookie = my_unserialize($cookie[$name]);
|
$newcookie[$id] = $value; $newcookie = serialize($newcookie);
|
$newcookie[$id] = $value; $newcookie = serialize($newcookie);
|
my_setcookie("mybb[$name]", addslashes($newcookie));
| my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
| /** * Verifies that data passed is an array * * @param array Data to unserialize * @return array Unserialized data array */ function my_unserialize($data) { $array = unserialize($data);
if(!is_array($array)) { $array = array(); }
return $array; }
|
/** * Returns the serverload of the system.
| /** * Returns the serverload of the system.
|
Zeile 1805 | Zeile 1883 |
---|
$lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid']; $new_stats['lastusername'] = $lastmember['username'];
|
$lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid']; $new_stats['lastusername'] = $lastmember['username'];
|
}
| }
|
if(empty($new_stats))
|
if(empty($new_stats))
|
{
| {
|
return;
|
return;
|
}
| }
|
if(is_array($stats)) { $stats = array_merge($stats, $new_stats);
|
if(is_array($stats)) { $stats = array_merge($stats, $new_stats);
|
}
| }
|
else { $stats = $new_stats;
| else { $stats = $new_stats;
|
Zeile 1846 | Zeile 1924 |
---|
$update_query = array();
$counters = array('threads','unapprovedthreads','posts','unapprovedposts');
|
$update_query = array();
$counters = array('threads','unapprovedthreads','posts','unapprovedposts');
|
|
|
// Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
| // Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
|
Zeile 1857 | Zeile 1935 |
---|
{ // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
{ // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
{
| {
|
$update_query[$counter] = $forum[$counter] + $changes[$counter];
|
$update_query[$counter] = $forum[$counter] + $changes[$counter];
|
}
| }
|
else
|
else
|
{
| {
|
$update_query[$counter] = $changes[$counter]; } // Less than 0? That's bad if(!$update_query[$counter])
|
$update_query[$counter] = $changes[$counter]; } // Less than 0? That's bad if(!$update_query[$counter])
|
{
| {
|
$update_query[$counter] = 0; } }
| $update_query[$counter] = 0; } }
|
Zeile 1889 | Zeile 1967 |
---|
if($threads_diff > -1) { $new_stats['numthreads'] = "+{$threads_diff}";
|
if($threads_diff > -1) { $new_stats['numthreads'] = "+{$threads_diff}";
|
} else { $new_stats['numthreads'] = "{$threads_diff}"; }
| } else { $new_stats['numthreads'] = "{$threads_diff}"; }
|
} if(array_key_exists('unapprovedthreads', $update_query))
| } if(array_key_exists('unapprovedthreads', $update_query))
|
Zeile 1902 | Zeile 1980 |
---|
if($unapprovedthreads_diff > -1) { $new_stats['numunapprovedthreads'] = "+{$unapprovedthreads_diff}";
|
if($unapprovedthreads_diff > -1) { $new_stats['numunapprovedthreads'] = "+{$unapprovedthreads_diff}";
|
} else {
| } else {
|
$new_stats['numunapprovedthreads'] = "{$unapprovedthreads_diff}"; } }
| $new_stats['numunapprovedthreads'] = "{$unapprovedthreads_diff}"; } }
|
Zeile 1915 | Zeile 1993 |
---|
if($posts_diff > -1) { $new_stats['numposts'] = "+{$posts_diff}";
|
if($posts_diff > -1) { $new_stats['numposts'] = "+{$posts_diff}";
|
}
| }
|
else { $new_stats['numposts'] = "{$posts_diff}";
| else { $new_stats['numposts'] = "{$posts_diff}";
|
Zeile 1926 | Zeile 2004 |
---|
{ $unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1)
|
{ $unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1)
|
{
| {
|
$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}"; } else
| $new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}"; } else
|
Zeile 1980 | Zeile 2058 |
---|
* @param array Array of items being updated (replies, unapprovedposts, attachmentcount) and their value (ex, 1, +1, -1) */ function update_thread_counters($tid, $changes=array())
|
* @param array Array of items being updated (replies, unapprovedposts, attachmentcount) and their value (ex, 1, +1, -1) */ function update_thread_counters($tid, $changes=array())
|
{ global $db;
| { global $db;
|
$update_query = array();
| $update_query = array();
|
Zeile 2001 | Zeile 2079 |
---|
$update_query[$counter] = $thread[$counter] + $changes[$counter]; } else
|
$update_query[$counter] = $thread[$counter] + $changes[$counter]; } else
|
{
| {
|
$update_query[$counter] = $changes[$counter]; }
| $update_query[$counter] = $changes[$counter]; }
|
Zeile 2014 | Zeile 2092 |
---|
} $db->free_result($query);
|
} $db->free_result($query);
|
|
|
// Only update if we're actually doing something if(count($update_query) > 0) {
| // Only update if we're actually doing something if(count($update_query) > 0) {
|
Zeile 2034 | Zeile 2112 |
---|
function update_thread_data($tid) { global $db;
|
function update_thread_data($tid) { global $db;
|
| $thread = get_thread($tid);
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false) { return false; }
|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
| $query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
|
Zeile 2156 | Zeile 2243 |
---|
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid") { global $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid") { global $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
|
|
$pid = intval($pid);
if($permissions)
| $pid = intval($pid);
if($permissions)
|
Zeile 2176 | Zeile 2263 |
---|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
} } }
| } } }
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
| if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
|
Zeile 2188 | Zeile 2275 |
---|
if(is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
if(is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
{
| {
|
foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
|
foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
|
|
|
if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true)) { $optionselected = "";
if($selitem == $forum['fid'])
|
if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true)) { $optionselected = "";
if($selitem == $forum['fid'])
|
{
| {
|
$optionselected = "selected=\"selected\""; $selecteddone = 1; }
| $optionselected = "selected=\"selected\""; $selecteddone = 1; }
|
Zeile 2220 | Zeile 2307 |
---|
if($addselect) { if(!$selecteddone)
|
if($addselect) { if(!$selecteddone)
|
{
| {
|
if(!$selitem) { $selitem = "default";
| if(!$selitem) { $selitem = "default";
|
Zeile 2242 | Zeile 2329 |
---|
}
return $forumjump;
|
}
return $forumjump;
|
}
| }
|
/** * Returns the extension of a file. *
| /** * Returns the extension of a file. *
|
Zeile 2347 | Zeile 2434 |
---|
"editor_enter_image", "editor_enter_video_url", "editor_video_dailymotion",
|
"editor_enter_image", "editor_enter_video_url", "editor_video_dailymotion",
|
"editor_video_googlevideo",
| |
"editor_video_metacafe", "editor_video_myspacetv", "editor_video_vimeo",
| "editor_video_metacafe", "editor_video_myspacetv", "editor_video_vimeo",
|
Zeile 2366 | Zeile 2452 |
---|
); $editor_language = "var editor_language = {\n";
|
); $editor_language = "var editor_language = {\n";
|
$plugins->run_hooks_by_ref("mycode_add_codebuttons", $editor_lang_strings);
| $editor_lang_strings = $plugins->run_hooks("mycode_add_codebuttons", $editor_lang_strings);
|
foreach($editor_lang_strings as $key => $lang_string) {
| foreach($editor_lang_strings as $key => $lang_string) {
|
Zeile 2421 | Zeile 2507 |
---|
if(!is_array($smilie_cache)) { $smilie_cache = $cache->read("smilies");
|
if(!is_array($smilie_cache)) { $smilie_cache = $cache->read("smilies");
|
}
| }
|
foreach($smilie_cache as $smilie) { if($smilie['showclickable'] != 0) { $smiliecache[$smilie['find']] = $smilie['image'];
|
foreach($smilie_cache as $smilie) { if($smilie['showclickable'] != 0) { $smiliecache[$smilie['find']] = $smilie['image'];
|
} } }
unset($smilie);
| } } }
unset($smilie);
|
if(is_array($smiliecache)) { reset($smiliecache);
| if(is_array($smiliecache)) { reset($smiliecache);
|
Zeile 2487 | Zeile 2573 |
---|
} } else
|
} } else
|
{
| {
|
$clickablesmilies = ""; }
|
$clickablesmilies = ""; }
|
return $clickablesmilies;
| return $clickablesmilies; }
/** * Builds thread prefixes and returns a selected prefix (or all) * * @param int The prefix ID (0 to return all) * @return array The thread prefix's values (or all thread prefixes) */ function build_prefixes($pid=0) { global $cache; static $prefixes_cache;
if(is_array($prefixes_cache)) { if($pid > 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid]; }
return $prefixes_cache; }
$prefix_cache = $cache->read("threadprefixes");
if(!is_array($prefix_cache)) { // No cache $prefix_cache = $cache->read("threadprefixes", true);
if(!is_array($prefix_cache)) { return array(); } }
$prefixes_cache = array(); foreach($prefix_cache as $prefix) { $prefixes_cache[$prefix['pid']] = $prefix; }
if($pid != 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid]; } else if(!empty($prefixes_cache)) { return $prefixes_cache; }
return false;
|
}
/**
| }
/**
|
Zeile 2503 | Zeile 2641 |
---|
*/ function build_prefix_select($fid, $selected_pid=0, $multiple=0) {
|
*/ function build_prefix_select($fid, $selected_pid=0, $multiple=0) {
|
global $db, $lang, $mybb;
| global $cache, $db, $lang, $mybb;
|
if($fid != 'all') { $fid = intval($fid);
|
if($fid != 'all') { $fid = intval($fid);
|
}
// Does this user have additional groups?
| }
$prefix_cache = build_prefixes(0); if(!$prefix_cache) { return false; // We've got no prefixes to show }
$groups = array($mybb->user['usergroup']);
|
if($mybb->user['additionalgroups'])
|
if($mybb->user['additionalgroups'])
|
{
| {
|
$exp = explode(",", $mybb->user['additionalgroups']);
|
$exp = explode(",", $mybb->user['additionalgroups']);
|
// Because we like apostrophes... $imps = array();
|
|
foreach($exp as $group)
|
foreach($exp as $group)
|
{ $imps[] = "'{$group}'"; }
$additional_groups = implode(",", $imps); $extra_sql = "groups IN ({$additional_groups}) OR "; } else { $extra_sql = '';
| { $groups[] = $group; }
|
}
|
}
|
switch($db->type)
| // Go through each of our prefixes and decide which ones we can use $prefixes = array(); foreach($prefix_cache as $prefix)
|
{
|
{
|
case "pgsql": case "sqlite": $whereforum = ""; if($fid != 'all')
| if($fid != "all" && $prefix['forums'] != "-1") { // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
if(!in_array($fid, $forums)) { // This prefix is not in our forum list continue; } }
if($prefix['groups'] != "-1") { $prefix_groups = explode(",", $prefix['groups']);
foreach($groups as $group)
|
{
|
{
|
$whereforum = " AND (','||forums||',' LIKE '%,{$fid},%' OR ','||forums||',' LIKE '%,-1,%' OR forums='')";
| if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']])) { // Our group can use this prefix! $prefixes[$prefix['pid']] = $prefix; }
|
}
|
}
|
$query = $db->query(" SELECT pid, prefix FROM ".TABLE_PREFIX."threadprefixes WHERE ({$extra_sql}','||groups||',' LIKE '%,{$mybb->user['usergroup']},%' OR ','||groups||',' LIKE '%,-1,%' OR groups='') {$whereforum} "); break; default: $whereforum = ""; if($fid != 'all') { $whereforum = " AND (CONCAT(',',forums,',') LIKE '%,{$fid},%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='')"; } $query = $db->query(" SELECT pid, prefix FROM ".TABLE_PREFIX."threadprefixes WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='') {$whereforum} "); } $prefixselect = ""; if($db->num_rows($query) > 0) { $multipleselect = ""; if($multiple != 0)
| } else
|
{
|
{
|
$multipleselect = " multiple=\"multiple\" size=\"5\"";
| // This prefix is for anybody to use... $prefixes[$prefix['pid']] = $prefix;
|
}
|
}
|
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n"; if($multiple == 1) { $any_selected = ""; if($selected_pid == 'any') { $any_selected = " selected=\"selected\""; } $prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n"; } $default_selected = ""; if((intval($selected_pid) == 0) && $selected_pid != 'any') { $default_selected = " selected=\"selected\""; } $prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n"; while($prefix = $db->fetch_array($query)) { $selected = ""; if($prefix['pid'] == $selected_pid) { $selected = " selected=\"selected\""; } $prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";
| }
if(empty($prefixes)) { return false; }
$prefixselect = ""; $multipleselect = ""; if($multiple != 0) { $multipleselect = " multiple=\"multiple\" size=\"5\""; }
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";
if($multiple == 1) { $any_selected = ""; if($selected_pid == 'any') { $any_selected = " selected=\"selected\""; }
$prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n"; }
$default_selected = ""; if((intval($selected_pid) == 0) && $selected_pid != 'any') { $default_selected = " selected=\"selected\""; }
$prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n";
foreach($prefixes as $prefix) { $selected = ""; if($prefix['pid'] == $selected_pid) { $selected = " selected=\"selected\"";
|
}
|
}
|
$prefixselect .= "</select>\n ";
| $prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";
|
}
|
}
|
| $prefixselect .= "</select>\n ";
|
return $prefixselect; }
| return $prefixselect; }
|
Zeile 2634 | Zeile 2774 |
---|
}
if(my_strpos(" ".$httpaccept_encoding, "gzip"))
|
}
if(my_strpos(" ".$httpaccept_encoding, "gzip"))
|
{
| {
|
$encoding = "gzip"; }
|
$encoding = "gzip"; }
|
|
|
if(isset($encoding)) { header("Content-Encoding: $encoding");
| if(isset($encoding)) { header("Content-Encoding: $encoding");
|
Zeile 2645 | Zeile 2785 |
---|
if(function_exists("gzencode")) { $contents = gzencode($contents, $level);
|
if(function_exists("gzencode")) { $contents = gzencode($contents, $level);
|
}
| }
|
else { $size = strlen($contents);
| else { $size = strlen($contents);
|
Zeile 2787 | Zeile 2927 |
---|
*/ function get_ip() {
|
*/ function get_ip() {
|
if(isset($_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; } elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { if(preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses))
| global $mybb, $plugins;
$ip = 0;
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; }
if($mybb->settings['ip_forwarded_check']) { if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses); } elseif(isset($_SERVER['HTTP_X_REAL_IP'])) { preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_REAL_IP'], $addresses); }
if(is_array($addresses[0]))
|
{ foreach($addresses[0] as $key => $val) {
| { foreach($addresses[0] as $key => $val) {
|
Zeile 2804 | Zeile 2958 |
---|
} } }
|
} } }
|
}
| }
if(!$ip) { if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } }
|
|
|
if(!isset($ip)) { if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = ''; } }
| if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array); }
|
|
|
$ip = preg_replace("#([^.0-9 ]*)#", "", $ip); return $ip;
| return $ip;
|
}
/**
| }
/**
|
Zeile 2917 | Zeile 3072 |
---|
} } elseif(defined("IN_PORTAL"))
|
} } elseif(defined("IN_PORTAL"))
|
{ global $change_dir;
| { global $change_dir;
|
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); } else
| $icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); } else
|
Zeile 2958 | Zeile 3113 |
---|
if(!$permissions) { $permissions = $mybb->usergroup;
|
if(!$permissions) { $permissions = $mybb->usergroup;
|
}
| }
|
if(!is_array($forum_cache)) { cache_forums();
| if(!is_array($forum_cache)) { cache_forums();
|
Zeile 2980 | Zeile 3135 |
---|
else { $perms = $mybb->usergroup;
|
else { $perms = $mybb->usergroup;
|
}
| }
|
$pwverified = 1;
| $pwverified = 1;
|
Zeile 3002 | Zeile 3157 |
---|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] != md5($mybb->user['uid'].$password_forums[$parent])) { $pwverified = 0;
|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] != md5($mybb->user['uid'].$password_forums[$parent])) { $pwverified = 0;
|
} } }
| } } }
|
if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0)) { if($unviewableforums)
| if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0)) { if($unviewableforums)
|
Zeile 3014 | Zeile 3169 |
---|
}
$unviewableforums .= "'".$forum['fid']."'";
|
}
$unviewableforums .= "'".$forum['fid']."'";
|
} }
| } }
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 3060 | Zeile 3215 |
---|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
}
| }
|
else { $sep = "";
| else { $sep = "";
|
Zeile 3078 | Zeile 3233 |
---|
$sep = $multipage_dropdown.$sep; } }
|
$sep = $multipage_dropdown.$sep; } }
|
| // Replace page 1 URLs $navbit['url'] = str_replace("-page-1.html", ".html", $navbit['url']); $navbit['url'] = preg_replace("/&page=1$/", "", $navbit['url']);
|
eval("\$nav .= \"".$templates->get("nav_bit")."\";"); } }
|
eval("\$nav .= \"".$templates->get("nav_bit")."\";"); } }
|
}
| }
|
$navsize = count($navbits); $navbit = $navbits[$navsize-1];
| $navsize = count($navbits); $navbit = $navbits[$navsize-1];
|
Zeile 3093 | Zeile 3252 |
---|
}
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";");
|
}
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";");
|
eval("\$donenav = \"".$templates->get("nav")."\";");
| eval("\$donenav = \"".$templates->get("nav")."\";");
|
return $donenav; }
| return $donenav; }
|
Zeile 3168 | Zeile 3327 |
---|
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']); $navbits[$navsize]['multipage'] = $multipage;
|
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']); $navbits[$navsize]['multipage'] = $multipage;
|
$navbits[$navsize]['multipage']['url'] = get_forum_link($forumnav['fid']);
| $navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED);
|
} else {
| } else {
|
Zeile 3368 | Zeile 3527 |
---|
{ global $mybb;
|
{ global $mybb;
|
if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1)
| if($mybb->settings['nocacheheaders'] == 1)
|
{ header("Expires: Sat, 1 Jan 2000 01:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
| { header("Expires: Sat, 1 Jan 2000 01:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
Zeile 3616 | Zeile 3775 |
---|
// Build the new list of additional groups for this user and make sure they're in the right format $usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup;
|
// Build the new list of additional groups for this user and make sure they're in the right format $usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup;
|
$groupslist = ""; $groups = explode(",", $usergroups);
if(is_array($groups)) { foreach($groups as $gid)
| $groupslist = ""; $groups = explode(",", $usergroups);
if(is_array($groups)) { foreach($groups as $gid)
|
{ if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid]) {
| { if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid]) {
|
Zeile 3637 | Zeile 3796 |
---|
{ $db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'"); return true;
|
{ $db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'"); return true;
|
} else { return false; } }
| } else { return false; } }
|
/** * Remove a user from a specific additional user group *
| /** * Remove a user from a specific additional user group *
|
Zeile 3708 | Zeile 3867 |
---|
function get_current_location($fields=false, $ignore=array()) { if(defined("MYBB_LOCATION"))
|
function get_current_location($fields=false, $ignore=array()) { if(defined("MYBB_LOCATION"))
|
{
| {
|
return MYBB_LOCATION;
|
return MYBB_LOCATION;
|
}
| }
|
if(!empty($_SERVER['PATH_INFO']))
|
if(!empty($_SERVER['PATH_INFO']))
|
{
| {
|
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']); } elseif(!empty($_ENV['PATH_INFO'])) { $location = htmlspecialchars_uni($_ENV['PATH_INFO']);
|
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']); } elseif(!empty($_ENV['PATH_INFO'])) { $location = htmlspecialchars_uni($_ENV['PATH_INFO']);
|
}
| }
|
elseif(!empty($_ENV['PHP_SELF'])) { $location = htmlspecialchars_uni($_ENV['PHP_SELF']);
| elseif(!empty($_ENV['PHP_SELF'])) { $location = htmlspecialchars_uni($_ENV['PHP_SELF']);
|
Zeile 3751 | Zeile 3910 |
---|
} $form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars((string)$name)."\" value=\"".htmlspecialchars((string)$value)."\" />\n";
|
} $form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars((string)$name)."\" value=\"".htmlspecialchars((string)$value)."\" />\n";
|
} }
| } }
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); }
| return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); }
|
Zeile 3763 | Zeile 3922 |
---|
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']); } else if(isset($_ENV['QUERY_STRING']))
|
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']); } else if(isset($_ENV['QUERY_STRING']))
|
{
| {
|
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']); }
| $location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']); }
|
Zeile 3774 | Zeile 3933 |
---|
foreach($post_array as $var) { if(isset($_POST[$var]))
|
foreach($post_array as $var) { if(isset($_POST[$var]))
|
{
| {
|
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]); } }
| $addloc[] = urlencode($var).'='.urlencode($_POST[$var]); } }
|
Zeile 3796 | Zeile 3955 |
---|
if(strlen($location) > 150) { $location = substr($location, 0, 150);
|
if(strlen($location) > 150) { $location = substr($location, 0, 150);
|
}
| }
|
return $location; }
| return $location; }
|
Zeile 3971 | Zeile 4130 |
---|
} if($use_iconv || $use_mb)
|
} if($use_iconv || $use_mb)
|
{
| {
|
if($to) { $from_charset = $lang->settings['charset'];
| if($to) { $from_charset = $lang->settings['charset'];
|
Zeile 4022 | Zeile 4181 |
---|
{ $message = convert_through_utf8($message);
|
{ $message = convert_through_utf8($message);
|
if(!($new_message = @preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#u", "$0​", $message)))
| if(!($new_message = @preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#u", "$0​", $message)))
|
{
|
{
|
$new_message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0​", $message);
| $new_message = preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#", "$0​", $message);
|
} $new_message = convert_through_utf8($new_message, false);
| } $new_message = convert_through_utf8($new_message, false);
|
Zeile 4149 | Zeile 4308 |
---|
'F', 'l', 'M',
|
'F', 'l', 'M',
|
);
| );
$html = array( 'm', 'c', 'D', 'y', 'Y', 'j', 'S', 'F', 'l', 'M', );
|
|
|
| $bdays = str_replace($find, $html, $bdays); $bmonth = str_replace($find, $html, $bmonth);
|
$replace = array( sprintf('%02s', $bm), sprintf('%02s', $bd),
| $replace = array( sprintf('%02s', $bm), sprintf('%02s', $bd),
|
Zeile 4321 | Zeile 4496 |
---|
else { $string = strtolower($string);
|
else { $string = strtolower($string);
|
}
return $string; }
| }
return $string; }
|
/** * Finds a needle in a haystack and returns it position, mb strings accounted for
| /** * Finds a needle in a haystack and returns it position, mb strings accounted for
|
Zeile 4335 | Zeile 4510 |
---|
* @return int false on needle not found, integer position if found */ function my_strpos($haystack, $needle, $offset=0)
|
* @return int false on needle not found, integer position if found */ function my_strpos($haystack, $needle, $offset=0)
|
{
| {
|
if($needle == '')
|
if($needle == '')
|
{
| {
|
return false;
|
return false;
|
}
| }
|
if(function_exists("mb_strpos"))
|
if(function_exists("mb_strpos"))
|
{
| {
|
$position = mb_strpos($haystack, $needle, $offset);
|
$position = mb_strpos($haystack, $needle, $offset);
|
} else {
| } else {
|
$position = strpos($haystack, $needle, $offset); }
| $position = strpos($haystack, $needle, $offset); }
|
Zeile 4401 | Zeile 4576 |
---|
function unichr($c) { if($c <= 0x7F)
|
function unichr($c) { if($c <= 0x7F)
|
{
| {
|
return chr($c);
|
return chr($c);
|
}
| }
|
else if($c <= 0x7FF)
|
else if($c <= 0x7FF)
|
{
| {
|
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); } else if($c <= 0xFFFF) { return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
|
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); } else if($c <= 0xFFFF) { return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
|
. chr(0x80 | $c & 0x3F);
| . chr(0x80 | $c & 0x3F);
|
} else if($c <= 0x10FFFF) {
| } else if($c <= 0x10FFFF) {
|
Zeile 4446 | Zeile 4621 |
---|
*/ function get_event_date($event) {
|
*/ function get_event_date($event) {
|
| global $mybb;
|
$event_date = explode("-", $event['date']); $event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]); $event_date = my_date($mybb->settings['dateformat'], $event_date);
|
$event_date = explode("-", $event['date']); $event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]); $event_date = my_date($mybb->settings['dateformat'], $event_date);
|
|
|
return $event_date; }
/** * Get the profile link.
|
return $event_date; }
/** * Get the profile link.
|
*
| *
|
* @param int The user id of the profile. * @return string The url to the profile. */
| * @param int The user id of the profile. * @return string The url to the profile. */
|
Zeile 4499 | Zeile 4676 |
---|
{ // Return the guest's nickname if user is a guest but has a nickname return $username;
|
{ // Return the guest's nickname if user is a guest but has a nickname return $username;
|
}
| }
|
else { // Build the profile link for the registered user
| else { // Build the profile link for the registered user
|
Zeile 4529 | Zeile 4706 |
---|
if($page > 0) { $link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
|
if($page > 0) { $link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
|
$link = str_replace("{page}", $page, $link); return htmlspecialchars_uni($link); } else
| $link = str_replace("{page}", $page, $link); return htmlspecialchars_uni($link); } else
|
{ $link = str_replace("{fid}", $fid, FORUM_URL); return htmlspecialchars_uni($link);
| { $link = str_replace("{fid}", $fid, FORUM_URL); return htmlspecialchars_uni($link);
|
Zeile 4550 | Zeile 4727 |
---|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
{ if($action) { $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
| { if($action) { $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
|
} else {
| } else {
|
Zeile 4587 | Zeile 4764 |
---|
* @param int The thread id of the post. */ function get_post_link($pid, $tid=0)
|
* @param int The thread id of the post. */ function get_post_link($pid, $tid=0)
|
{
| {
|
if($tid > 0) { $link = str_replace("{tid}", $tid, THREAD_URL_POST);
| if($tid > 0) { $link = str_replace("{tid}", $tid, THREAD_URL_POST);
|
Zeile 4700 | Zeile 4877 |
---|
return $user_cache[$uid]; } }
|
return $user_cache[$uid]; } }
|
| |
/** * Get the forum of a specific forum id.
| /** * Get the forum of a specific forum id.
|
Zeile 4762 | Zeile 4938 |
---|
{ $query = $db->simple_select("threads", "*", "tid='".intval($tid)."'"); $thread = $db->fetch_array($query);
|
{ $query = $db->simple_select("threads", "*", "tid='".intval($tid)."'"); $thread = $db->fetch_array($query);
|
|
|
if($thread)
|
if($thread)
|
{
| {
|
$thread_cache[$tid] = $thread; return $thread;
|
$thread_cache[$tid] = $thread; return $thread;
|
}
| }
|
else { $thread_cache[$tid] = false;
|
else { $thread_cache[$tid] = false;
|
return false; } }
| return false; } }
|
}
/**
| }
/**
|
Zeile 4795 | Zeile 4971 |
---|
{ $query = $db->simple_select("posts", "*", "pid='".intval($pid)."'"); $post = $db->fetch_array($query);
|
{ $query = $db->simple_select("posts", "*", "pid='".intval($pid)."'"); $post = $db->fetch_array($query);
|
|
|
if($post)
|
if($post)
|
{
| {
|
$post_cache[$pid] = $post; return $post; }
| $post_cache[$pid] = $post; return $post; }
|
Zeile 4805 | Zeile 4981 |
---|
{ $post_cache[$pid] = false; return false;
|
{ $post_cache[$pid] = false; return false;
|
} }
| } }
|
}
/**
| }
/**
|
Zeile 4817 | Zeile 4993 |
---|
function get_inactive_forums() { global $forum_cache, $cache, $inactiveforums;
|
function get_inactive_forums() { global $forum_cache, $cache, $inactiveforums;
|
|
|
if(!$forum_cache) { cache_forums();
| if(!$forum_cache) { cache_forums();
|
Zeile 4850 | Zeile 5026 |
---|
* * @param bool (Optional) The function will stop execution if it finds an error with the login. Default is True * @return bool Number of logins when success, false if failed.
|
* * @param bool (Optional) The function will stop execution if it finds an error with the login. Default is True * @return bool Number of logins when success, false if failed.
|
*/
| */
|
function login_attempt_check($fatal = true) { global $mybb, $lang, $session, $db;
| function login_attempt_check($fatal = true) { global $mybb, $lang, $session, $db;
|
Zeile 5050 | Zeile 5226 |
---|
{ $mybb->settings['minsearchword'] = 3; }
|
{ $mybb->settings['minsearchword'] = 3; }
|
| if(is_array($terms)) { $terms = implode(' ', $terms); }
|
// Strip out any characters that shouldn't be included $bad_characters = array(
| // Strip out any characters that shouldn't be included $bad_characters = array(
|
Zeile 5074 | Zeile 5255 |
---|
if($inquote) { $words[] = trim($phrase);
|
if($inquote) { $words[] = trim($phrase);
|
}
| }
|
else { $split_words = preg_split("#\s{1,}#", $phrase, -1); if(!is_array($split_words)) { continue;
|
else { $split_words = preg_split("#\s{1,}#", $phrase, -1); if(!is_array($split_words)) { continue;
|
}
| }
|
foreach($split_words as $word) { if(!$word || strlen($word) < $mybb->settings['minsearchword'])
| foreach($split_words as $word) { if(!$word || strlen($word) < $mybb->settings['minsearchword'])
|
Zeile 5100 | Zeile 5281 |
---|
{ $terms = htmlspecialchars_uni($terms); $split_words = preg_split("#\s{1,}#", $terms, -1);
|
{ $terms = htmlspecialchars_uni($terms); $split_words = preg_split("#\s{1,}#", $terms, -1);
|
if(!is_array($split_words))
| if(is_array($split_words))
|
{
|
{
|
continue; } foreach($split_words as $word) { if(!$word || strlen($word) < $mybb->settings['minsearchword'])
| foreach($split_words as $word)
|
{
|
{
|
continue;
| if(!$word || strlen($word) < $mybb->settings['minsearchword']) { continue; } $words[] = trim($word);
|
}
|
}
|
$words[] = trim($word);
| |
}
|
}
|
| |
}
if(!is_array($words))
|
}
if(!is_array($words))
|
{
| {
|
return false; }
| return false; }
|
Zeile 5138 | Zeile 5317 |
---|
}
// Now make PREG compatible
|
}
// Now make PREG compatible
|
$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";
| $find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui";
|
$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>"; $highlight_cache[$find] = $replacement; }
| $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>"; $highlight_cache[$find] = $replacement; }
|
Zeile 5147 | Zeile 5326 |
---|
}
/**
|
}
/**
|
* Converts a decimal reference of a character to its UTF-8 equivilant
| * Converts a decimal reference of a character to its UTF-8 equivalent
|
* (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references) * * @param string Decimal value of a character reference
| * (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references) * * @param string Decimal value of a character reference
|
Zeile 5181 | Zeile 5360 |
---|
$dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f));
|
$dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f));
|
}
| }
|
else { // Out of range
| else { // Out of range
|
Zeile 5203 | Zeile 5382 |
---|
global $db; $query = $db->simple_select('banfilters', 'filter, fid', "type='2'"); while($banned_username = $db->fetch_array($query))
|
global $db; $query = $db->simple_select('banfilters', 'filter, fid', "type='2'"); while($banned_username = $db->fetch_array($query))
|
{ // Make regular expression * match
| { // Make regular expression * match
|
$banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username)) {
| $banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username)) {
|
Zeile 5212 | Zeile 5391 |
---|
if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
|
if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
|
}
| }
|
return true; } }
| return true; } }
|
Zeile 5228 | Zeile 5407 |
---|
* @return boolean True if banned, false if not banned */ function is_banned_email($email, $update_lastuse=false)
|
* @return boolean True if banned, false if not banned */ function is_banned_email($email, $update_lastuse=false)
|
{ global $db; $query = $db->simple_select("banfilters", "*", "type='3'"); while($banned_email = $db->fetch_array($query)) { // Make regular expression * match $banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#')); if(preg_match("#{$banned_email['filter']}#i", $email))
| { global $cache, $db;
$banned_cache = $cache->read("bannedemails"); if($banned_cache === false) { // Failed to read cache, see if we can rebuild it $cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails"); }
if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
|
{
|
{
|
// Updating last use if($update_lastuse == true)
| // Make regular expression * match $banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));
if(preg_match("#{$banned_email['filter']}#i", $email))
|
{
|
{
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
| // Updating last use if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
|
}
|
}
|
return true;
| |
} }
|
} }
|
|
|
// Still here - good email return false; }
| // Still here - good email return false; }
|
Zeile 5264 | Zeile 5457 |
---|
if(!is_array($banned_ips)) { return false;
|
if(!is_array($banned_ips)) { return false;
|
}
| }
|
foreach($banned_ips as $banned_ip) {
| foreach($banned_ips as $banned_ip) {
|
Zeile 5275 | Zeile 5468 |
---|
// Make regular expression * match $banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));
|
// Make regular expression * match $banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));
|
if(preg_match("#{$banned_ip['filter']}#i", $ip_address))
| if(preg_match("#^{$banned_ip['filter']}$#i", $ip_address))
|
{ // Updating last use if($update_lastuse == true)
| { // Updating last use if($update_lastuse == true)
|
Zeile 5285 | Zeile 5478 |
---|
return true; } }
|
return true; } }
|
|
|
// Still here - good ip return false; }
| // Still here - good ip return false; }
|
Zeile 5377 | Zeile 5571 |
---|
* * @param string The URL of the remote file * @return string The remote file contents.
|
* * @param string The URL of the remote file * @return string The remote file contents.
|
*/
| */
|
function fetch_remote_file($url, $post_data=array()) { $post_body = '';
| function fetch_remote_file($url, $post_data=array()) { $post_body = '';
|
Zeile 5410 | Zeile 5604 |
---|
{ $url = @parse_url($url); if(!$url['host'])
|
{ $url = @parse_url($url); if(!$url['host'])
|
{ return false; }
| { return false; }
|
if(!$url['port']) { $url['port'] = 80;
| if(!$url['port']) { $url['port'] = 80;
|
Zeile 5430 | Zeile 5624 |
---|
if(!$fp) { return false;
|
if(!$fp) { return false;
|
}
| }
|
$headers = array(); if(!empty($post_body))
|
$headers = array(); if(!empty($post_body))
|
{
| {
|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded"; }
|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded"; }
|
else { $headers[] = "GET {$url['path']} HTTP/1.0"; }
| else { $headers[] = "GET {$url['path']} HTTP/1.0"; }
|
$headers[] = "Host: {$url['host']}"; $headers[] = "Connection: Close";
|
$headers[] = "Host: {$url['host']}"; $headers[] = "Connection: Close";
|
$headers[] = "\r\n";
| $headers[] = '';
|
if(!empty($post_body))
|
if(!empty($post_body))
|
{
| {
|
$headers[] = $post_body;
|
$headers[] = $post_body;
|
| } else { // If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts $headers[] = '';
|
} $headers = implode("\r\n", $headers);
| } $headers = implode("\r\n", $headers);
|
Zeile 5561 | Zeile 5760 |
---|
* Fetch an IPv4 long formatted range for searching IPv4 IP addresses. * * @param string The IP address to convert to a range based LONG
|
* Fetch an IPv4 long formatted range for searching IPv4 IP addresses. * * @param string The IP address to convert to a range based LONG
|
* @rturn mixed If a full IP address is provided, the ip2long equivilent, otherwise an array of the upper & lower extremities of the IP
| * @rturn mixed If a full IP address is provided, the ip2long equivalent, otherwise an array of the upper & lower extremities of the IP
|
*/ function fetch_longipv4_range($ip) {
| */ function fetch_longipv4_range($ip) {
|
Zeile 5636 | Zeile 5835 |
---|
"0-0-1" => "1 {$lang->year}", "0-0-2" => "2 {$lang->years}" );
|
"0-0-1" => "1 {$lang->year}", "0-0-2" => "2 {$lang->years}" );
|
$plugins->run_hooks_by_ref("functions_fetch_ban_times", $ban_times);
| $ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);
|
$ban_times['---'] = $lang->permanent; return $ban_times;
| $ban_times['---'] = $lang->permanent; return $ban_times;
|
Zeile 5649 | Zeile 5848 |
---|
* @param string The ban length string * @param int The optional UNIX timestamp, if 0, current time is used. * @return int The UNIX timestamp when the ban will be lifted
|
* @param string The ban length string * @param int The optional UNIX timestamp, if 0, current time is used. * @return int The UNIX timestamp when the ban will be lifted
|
*/
| */
|
function ban_date2timestamp($date, $stamp=0) { if($stamp == 0)
| function ban_date2timestamp($date, $stamp=0) { if($stamp == 0)
|
Zeile 5710 | Zeile 5909 |
---|
); $db->update_query("users", $updated_user, "uid='".intval($uid)."'"); }
|
); $db->update_query("users", $updated_user, "uid='".intval($uid)."'"); }
|
}
/** * Unicode function for php function chr() * * @param string The character * @return mixed The unicoded chr() */ function unicode_chr($c) { if($c <= 0x7F) { return chr($c); } elseif($c <= 0x7FF) { return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); } elseif($c <= 0xFFFF) { return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); } elseif($c <= 0x10FFFF) { return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); } else { return false; }
| |
}
/**
| }
/**
|
Zeile 5757 | Zeile 5923 |
---|
if(substr($mode, 0, 1) != '0' || strlen($mode) !== 4) { return false;
|
if(substr($mode, 0, 1) != '0' || strlen($mode) !== 4) { return false;
|
}
| }
|
$old_umask = umask(0); // We convert the octal string to a decimal number because passing a octal string doesn't work with chmod
| $old_umask = umask(0); // We convert the octal string to a decimal number because passing a octal string doesn't work with chmod
|
Zeile 5765 | Zeile 5931 |
---|
$result = chmod($file, octdec($mode)); umask($old_umask); return $result;
|
$result = chmod($file, octdec($mode)); umask($old_umask); return $result;
|
}
| }
|
/** * Custom rmdir function to loop through an entire directory and delete all files/folders within *
| /** * Custom rmdir function to loop through an entire directory and delete all files/folders within *
|
Zeile 5776 | Zeile 5942 |
---|
function my_rmdir_recursive($path, $ignore=array()) { global $orig_dir;
|
function my_rmdir_recursive($path, $ignore=array()) { global $orig_dir;
|
|
|
if(!isset($orig_dir)) { $orig_dir = $path;
| if(!isset($orig_dir)) { $orig_dir = $path;
|
Zeile 5806 | Zeile 5972 |
---|
} return @unlink($path);
|
} return @unlink($path);
|
}
| }
|
/** * Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
| /** * Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
|
Zeile 5834 | Zeile 6000 |
---|
*/ function my_ip2long($ip) {
|
*/ function my_ip2long($ip) {
|
$ip = ip2long($ip); if($ip >= 2147483648) // Won't occur on 32-bit PHP
| $ip_long = ip2long($ip);
if(!$ip_long) { $ip_long = sprintf("%u", ip2long($ip)); if(!$ip_long) { return 0; } }
if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
|
{
|
{
|
$ip -= 4294967296;
| $ip_long -= 4294967296;
|
}
|
}
|
return $ip;
| return $ip_long;
|
}
/**
| }
/**
|
Zeile 5959 | Zeile 6137 |
---|
* Returns a signed value equal to an integer * * @param int The integer
|
* Returns a signed value equal to an integer * * @param int The integer
|
* @return string The signed equivallent
| * @return string The signed equivalent
|
*/ function signed($int) {
| */ function signed($int) {
|
Zeile 5977 | Zeile 6155 |
---|
* Returns a securely generated seed for PHP's RNG (Random Number Generator) * * @param int Length of the seed bytes (8 is default. Provides good cryptographic variance)
|
* Returns a securely generated seed for PHP's RNG (Random Number Generator) * * @param int Length of the seed bytes (8 is default. Provides good cryptographic variance)
|
* @return int An integer equivilent of a secure hexadecimal seed
| * @return int An integer equivalent of a secure hexadecimal seed
|
*/ function secure_seed_rng($count=8) {
| */ function secure_seed_rng($count=8) {
|
Zeile 6017 | Zeile 6195 |
---|
* @param int Optional lowest value to be returned (default: 0) * @param int Optional highest value to be returned (default: mt_getrandmax()) * @param boolean True forces it to reseed the RNG first
|
* @param int Optional lowest value to be returned (default: 0) * @param int Optional highest value to be returned (default: mt_getrandmax()) * @param boolean True forces it to reseed the RNG first
|
* @return int An integer equivilent of a secure hexadecimal seed
| * @return int An integer equivalent of a secure hexadecimal seed
|
*/ function my_rand($min=null, $max=null, $force_seed=false) {
| */ function my_rand($min=null, $max=null, $force_seed=false) {
|
Zeile 6073 | Zeile 6251 |
---|
0x0A => 1, 0x0D => 1, 0x0B => 1,
|
0x0A => 1, 0x0D => 1, 0x0B => 1,
|
| 0xAD => 1, 0xC2 => array(0xA0 => 1, 0xAD => 1, 0xBF => 1, 0x81 => 1, 0x8D => 1, 0x90 => 1, 0x9D => 1,),
|
0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338} 0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160} 0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}
| 0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338} 0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160} 0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}
|
Zeile 6091 | Zeile 6277 |
---|
0x0A => 1, 0x0D => 1, 0x0B => 1,
|
0x0A => 1, 0x0D => 1, 0x0B => 1,
|
| 0xA0 => array(0xC2 => 1), 0xAD => array(0xC2 => 1), 0xBF => array(0xC2 => 1), 0x81 => array(0xC2 => 1), 0x8D => array(0xC2 => 1), 0x90 => array(0xC2 => 1), 0x9D => array(0xC2 => 1),
|
0xB8 => array(0xCC => 1), // \x{0338} 0xB7 => array(0xCC => 1), // \x{0337} 0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}
| 0xB8 => array(0xCC => 1), // \x{0338} 0xB7 => array(0xCC => 1), // \x{0337} 0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}
|