Zeile 6 | Zeile 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 3177 2007-06-29 07:51:12Z chris $
| * $Id: functions.php 3596 2008-01-20 08:27:39Z Tikitiki $
|
*/
/**
| */
/**
|
Zeile 18 | Zeile 18 |
---|
{ global $db, $lang, $theme, $plugins, $mybb; global $querytime, $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
{ global $db, $lang, $theme, $plugins, $mybb; global $querytime, $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
| |
$contents = parse_page($contents); $totaltime = $maintimer->stop(); if($mybb->usergroup['cancp'] == "yes")
| $contents = parse_page($contents); $totaltime = $maintimer->stop(); if($mybb->usergroup['cancp'] == "yes")
|
Zeile 75 | Zeile 74 |
---|
} }
|
} }
|
header("Content-type: text/html; charset={$lang->settings['charset']}");
| @header("Content-type: text/html; charset={$lang->settings['charset']}");
|
echo $contents;
| echo $contents;
|
Zeile 105 | Zeile 104 |
---|
/** * Runs the shutdown items after the page has been sent to the browser.
|
/** * Runs the shutdown items after the page has been sent to the browser.
|
* */
| * */
|
function run_shutdown() { global $db, $cache, $plugins, $shutdown_functions, $done_shutdown;
| function run_shutdown() { global $db, $cache, $plugins, $shutdown_functions, $done_shutdown;
|
Zeile 194 | Zeile 193 |
---|
$db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);
|
$db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);
|
}
| }
|
// Update the mailqueue cache and remove the lock $cache->updatemailqueue(time(), 0); } $plugins->run_hooks("send_mail_queue_end"); }
|
// Update the mailqueue cache and remove the lock $cache->updatemailqueue(time(), 0); } $plugins->run_hooks("send_mail_queue_end"); }
|
|
|
/** * Parses the contents of a page before outputting it. *
| /** * Parses the contents of a page before outputting it. *
|
Zeile 222 | Zeile 221 |
---|
{ $contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents; }
|
{ $contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents; }
|
| $contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);
|
if($lang->settings['rtl'] == 1) { $contents = str_replace("<html", "<html dir=\"rtl\"", $contents); } if($lang->settings['htmllang'])
|
if($lang->settings['rtl'] == 1) { $contents = str_replace("<html", "<html dir=\"rtl\"", $contents); } if($lang->settings['htmllang'])
|
{ $contents = str_replace("<html", "<html lang=\"".$lang->settings['htmllang']."\"", $contents);
| { $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents);
|
}
if($loadpmpopup)
| }
if($loadpmpopup)
|
Zeile 239 | Zeile 241 |
---|
} } return $contents;
|
} } return $contents;
|
}
| }
|
/** * Turn a unix timestamp in to a "friendly" date/time format for the user.
| /** * Turn a unix timestamp in to a "friendly" date/time format for the user.
|
Zeile 356 | Zeile 358 |
---|
$headers .= "X-Priority: 3\n"; $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Mailer: MyBB\n";
|
$headers .= "X-Priority: 3\n"; $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Mailer: MyBB\n";
|
| if(defined("IN_ADMINCP")) { $_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']); }
|
$headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";
|
$headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";
|
|
|
// For some reason sendmail/qmail doesn't like \r\n $sendmail = @ini_get('sendmail_path'); if($sendmail)
|
// For some reason sendmail/qmail doesn't like \r\n $sendmail = @ini_get('sendmail_path'); if($sendmail)
|
{
| {
|
$headers = preg_replace("#(\r\n|\r|\n)#s", "\n", $headers); $message = preg_replace("#(\r\n|\r|\n)#s", "\n", $message);
|
$headers = preg_replace("#(\r\n|\r|\n)#s", "\n", $headers); $message = preg_replace("#(\r\n|\r|\n)#s", "\n", $message);
|
} else
| } else
|
{ $headers = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $headers); $message = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $message);
|
{ $headers = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $headers); $message = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $message);
|
}
| }
|
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 520 | Zeile 571 |
---|
"location1" => 0, "location2" => 0 );
|
"location1" => 0, "location2" => 0 );
|
$db->update_query(TABLE_PREFIX."sessions", $noperm_array, "sid='".$session->sid."'");
| $db->update_query(TABLE_PREFIX."sessions", $noperm_array, "sid='".$session->sid."'", 1);
|
$url = htmlspecialchars_uni($_SERVER['REQUEST_URI']); if($mybb->user['uid']) {
| $url = htmlspecialchars_uni($_SERVER['REQUEST_URI']); if($mybb->user['uid']) {
|
Zeile 722 | Zeile 773 |
---|
{ $permbit = ""; }
|
{ $permbit = ""; }
|
$zerogreater = 0;
|
|
if(in_array($perm, $groupzerogreater)) { if($access == 0) { $usergroup[$perm] = 0;
|
if(in_array($perm, $groupzerogreater)) { if($access == 0) { $usergroup[$perm] = 0;
|
| continue;
|
}
|
}
|
$zerogreater = 1;
| |
}
|
}
|
if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
| if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit)
|
{ $usergroup[$perm] = $access; }
| { $usergroup[$perm] = $access; }
|
Zeile 754 | Zeile 806 |
---|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field)
|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field)
|
{
| {
|
$displaygroup[$field] = $group[$field]; } return $displaygroup;
| $displaygroup[$field] = $group[$field]; } return $displaygroup;
|
Zeile 783 | Zeile 835 |
---|
if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != $mybb->user['uid'])
|
if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != $mybb->user['uid'])
|
{
| {
|
if($usercache[$uid]) { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
| if($usercache[$uid]) { $query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
|
Zeile 793 | Zeile 845 |
---|
$groupperms = usergroup_permissions($gid); } else
|
$groupperms = usergroup_permissions($gid); } else
|
{
| {
|
$gid = $mybb->user['usergroup']; if(isset($mybb->user['additionalgroups'])) { $gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
$gid = $mybb->user['usergroup']; if(isset($mybb->user['additionalgroups'])) { $gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
}
| }
|
} if(!is_array($forum_cache))
|
} if(!is_array($forum_cache))
|
{
| {
|
$forum_cache = cache_forums(); if(!$forum_cache) {
| $forum_cache = cache_forums(); if(!$forum_cache) {
|
Zeile 811 | Zeile 863 |
---|
} } 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(!$cached_forum_permissions[$gid][$fid])
| if($fid) // Fetch the permissions for a single forum { if(!$cached_forum_permissions[$gid][$fid])
|
Zeile 887 | Zeile 939 |
---|
* Check the password given on a certain forum for validity * * @param int The forum ID
|
* Check the password given on a certain forum for validity * * @param int The forum ID
|
* @param string The plain text password for the forum
| * @param boolean The Parent ID
|
*/
|
*/
|
function check_forum_password($fid, $password="")
| function check_forum_password($fid, $pid=0)
|
{
|
{
|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang; $showform = 1;
| global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache; $showform = true; if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache) { return false; } }
|
|
|
| // Loop through each of parent forums to ensure we have a password for them too $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); if(!empty($parents)) { foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid) { continue; } if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid); } } } $password = $forum_cache[$fid]['password'];
|
if($password) { if($mybb->input['pwverify']) { if($password == $mybb->input['pwverify'])
|
if($password) { if($mybb->input['pwverify']) { if($password == $mybb->input['pwverify'])
|
{
| {
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
|
$showform = 0;
| $showform = false;
|
} else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
} else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = 1; }
| $showform = true; }
|
} else { if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))
|
} else { if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))
|
{ $showform = 1; }
| { $showform = true; }
|
else {
|
else {
|
$showform = 0;
| $showform = false;
|
} }
|
} }
|
}
| }
|
else {
|
else {
|
$showform = 0;
| $showform = false;
|
}
|
}
|
|
|
if($showform) { $_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
| if($showform) { $_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
|
Zeile 967 | Zeile 1050 |
---|
else { $perms = $modpermscache[$fid][$uid];
|
else { $perms = $modpermscache[$fid][$uid];
|
}
| }
|
return $perms; }
| return $perms; }
|
Zeile 1001 | Zeile 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"; }
| { return "yes"; }
|
else { return "no";
| else { return "no";
|
Zeile 1025 | Zeile 1108 |
---|
else { return "no";
|
else { return "no";
|
} } }
| } } }
|
} }
| } }
|
Zeile 1143 | Zeile 1226 |
---|
global $mybb; $expires = -3600; my_setcookie($name, "", $expires);
|
global $mybb; $expires = -3600; my_setcookie($name, "", $expires);
|
}
| }
|
/** * Get the contents from a serialised cookie array. *
| /** * Get the contents from a serialised cookie array. *
|
Zeile 1202 | Zeile 1285 |
---|
{ $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4);
|
{ $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4);
|
}
| }
|
if(!$serverload) {
|
if(!$serverload) {
|
| // Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist')) { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; } } // PHP disabled functions? if($func_blacklist = @ini_get('disabled_functions')) { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; } }
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
| $load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
Zeile 1228 | Zeile 1327 |
---|
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
|
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
|
* @param array Array of items being updated (numthreads,numposts,numusers)
| * @param array Array of items being updated (numthreads,numposts,numusers,lastuser)
|
*/ function update_stats($changes=array()) {
| */ function update_stats($changes=array()) {
|
Zeile 1236 | Zeile 1335 |
---|
$stats = $cache->read("stats");
|
$stats = $cache->read("stats");
|
$counters = array('numthreads','numposts','numusers');
| $counters = array('numthreads', 'numposts', 'numusers');
|
$update = array(); foreach($counters as $counter) {
| $update = array(); foreach($counters as $counter) {
|
Zeile 1260 | Zeile 1359 |
---|
}
// Fetch latest user if the user count is changing
|
}
// Fetch latest user if the user count is changing
|
if(array_key_exists('numusers', $changes))
| if(array_key_exists('numusers', $changes) || array_key_exists('lastuser', $changes))
|
{ $query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query);
| { $query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query);
|
Zeile 1321 | Zeile 1420 |
---|
if(count($update_query) > 0) { $db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'");
|
if(count($update_query) > 0) { $db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'");
|
}
| }
|
// Guess we should update the statistics too?
|
// Guess we should update the statistics too?
|
if($update_query['threads'] || $update_query['posts'])
| if(isset($update_query['threads']) || isset($update_query['posts']))
|
{ $new_stats = array(); if(array_key_exists('threads', $update_query)) { $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1)
|
{ $new_stats = array(); if(array_key_exists('threads', $update_query)) { $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1)
|
{
| {
|
$new_stats['numthreads'] = "+{$threads_diff}";
|
$new_stats['numthreads'] = "+{$threads_diff}";
|
} else {
| } else {
|
$new_stats['numthreads'] = "{$threads_diff}"; } }
| $new_stats['numthreads'] = "{$threads_diff}"; } }
|
Zeile 1350 | Zeile 1449 |
---|
{ $new_stats['numposts'] = "{$posts_diff}"; }
|
{ $new_stats['numposts'] = "{$posts_diff}"; }
|
}
| }
|
update_stats($new_stats); }
|
update_stats($new_stats); }
|
|
|
// Update last post info update_forum_lastpost($fid); }
| // Update last post info update_forum_lastpost($fid); }
|
Zeile 1438 | Zeile 1538 |
---|
/** * Update the first post and lastpost data for a specific thread
|
/** * Update the first post and lastpost data for a specific thread
|
* * @param int The thread ID */
| * * @param int The thread ID */
|
function update_thread_data($tid) { global $db;
| function update_thread_data($tid) { global $db;
|
Zeile 1553 | Zeile 1653 |
---|
*/ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") {
|
*/ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") {
|
global $db, $forum_cache, $fjumpcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
| global $db, $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
$pid = intval($pid); if($permissions)
| $pid = intval($pid); if($permissions)
|
Zeile 1593 | Zeile 1693 |
---|
$optionselected = "selected=\"selected\""; $selecteddone = 1; }
|
$optionselected = "selected=\"selected\""; $selecteddone = 1; }
|
| $forum['name'] = htmlspecialchars_uni($forum['name']);
|
eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";"); if($forum_cache[$forum['fid']]) {
| eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";"); if($forum_cache[$forum['fid']]) {
|
Zeile 2063 | Zeile 2166 |
---|
{ $attachtypes = $cache->read("attachtypes"); }
|
{ $attachtypes = $cache->read("attachtypes"); }
|
| $directory = ""; if(defined("IN_PORTAL")) { global $change_dir; $directory = $change_dir."/"; }
|
$ext = strtolower($ext); if($attachtypes[$ext]['icon']) {
|
$ext = strtolower($ext); if($attachtypes[$ext]['icon']) {
|
return "<img src=\"".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";
| return "<img src=\"{$directory}".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";
|
} else {
|
} else {
|
return "<img src=\"images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";
| return "<img src=\"{$directory}images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";
|
} }
| } }
|
Zeile 2319 | Zeile 2431 |
---|
$gzipen = "Disabled"; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
$gzipen = "Disabled"; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
echo "<html lang=\"en\">";
| echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
|
echo "<head>"; echo "<title>MyBB Debug Information</title>"; echo "</head>";
| echo "<head>"; echo "<title>MyBB Debug Information</title>"; echo "</head>";
|
Zeile 2847 | Zeile 2959 |
---|
*/ function htmlspecialchars_uni($message) {
|
*/ function htmlspecialchars_uni($message) {
|
$message = preg_replace("#&([^\#])(?![a-z1-4]{1,10};)#i", "&$1", $message); // Fix & but allow unicode
| $message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // Fix & but allow unicode
|
$message = str_replace("<","<",$message); $message = str_replace(">",">",$message); $message = str_replace("\"",""",$message);
| $message = str_replace("<","<",$message); $message = str_replace(">",">",$message); $message = str_replace("\"",""",$message);
|
Zeile 2898 | Zeile 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; }
|
Zeile 3056 | Zeile 3175 |
---|
/** * Cuts a string at a specified point, mb strings accounted for
|
/** * Cuts a string at a specified point, mb strings accounted for
|
*
| *
|
* @param string The string to cut. * @param int Where to cut * @param int (optional) How much to cut
| * @param string The string to cut. * @param int Where to cut * @param int (optional) How much to cut
|
Zeile 3073 | Zeile 3192 |
---|
else { $cut_string = mb_substr($string, $start);
|
else { $cut_string = mb_substr($string, $start);
|
} }
| } }
|
else { if($length != "") { $cut_string = substr($string, $start, $length);
|
else { if($length != "") { $cut_string = substr($string, $start, $length);
|
}
| }
|
else { $cut_string = substr($string, $start); }
|
else { $cut_string = substr($string, $start); }
|
}
| }
|
return $cut_string; }
| return $cut_string; }
|
Zeile 3105 | Zeile 3224 |
---|
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 3213 | Zeile 3332 |
---|
/** * Get the profile link.
|
/** * 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 3302 | Zeile 3421 |
---|
}
/**
|
}
/**
|
* Get the username of a user id.
| * Get the user data of a user id.
|
* * @param int The user id of the user.
|
* * @param int The user id of the user.
|
* @return string The username of the user.
| * @return array The user data.
|
*/ function get_user($uid) {
| */ function get_user($uid) {
|
Zeile 3318 | Zeile 3437 |
---|
} elseif(isset($user_cache[$uid])) {
|
} elseif(isset($user_cache[$uid])) {
|
return $user_cache[$uid]; } else {
| return $user_cache[$uid]; } else {
|
$query = $db->query(" SELECT * FROM ".TABLE_PREFIX."users
| $query = $db->query(" SELECT * FROM ".TABLE_PREFIX."users
|
Zeile 3547 | Zeile 3666 |
---|
return false; } // Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html
|
return false; } // Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html
|
return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^?=\/]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email);
| return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email);
|
}
/**
| }
/**
|
Zeile 3614 | Zeile 3733 |
---|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0x10ffff)
|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0x10ffff)
|
{
| {
|
$dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f));
| $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f));
|
Zeile 3644 | Zeile 3763 |
---|
/** * Checks if a username has been disallowed for registration/use.
|
/** * Checks if a username has been disallowed for registration/use.
|
*
| *
|
* @param string The username * @return boolean True if banned, false if not banned */
| * @param string The username * @return boolean True if banned, false if not banned */
|
Zeile 3673 | Zeile 3792 |
---|
$banned_emails = array_map("trim", $banned_emails); $banned_emails = array_map("strtolower", $banned_emails); return $banned_emails;
|
$banned_emails = array_map("trim", $banned_emails); $banned_emails = array_map("strtolower", $banned_emails); return $banned_emails;
|
}
| }
|
/** * Check if a specific email address has been banned.
| /** * Check if a specific email address has been banned.
|
Zeile 3790 | Zeile 3909 |
---|
{ return @implode("", @file($url)); }
|
{ return @implode("", @file($url)); }
|
| }
/** * 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; }
|
}
/**
| }
/**
|