Zeile 163 | Zeile 163 |
---|
// Fetch from database $query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'"); $cache_data = $db->fetch_array($query);
|
// Fetch from database $query = $db->simple_select("datacache", "title,cache", "title='".$db->escape_string($name)."'"); $cache_data = $db->fetch_array($query);
|
$data = unserialize($cache_data['cache']);
| $data = my_unserialize($cache_data['cache']);
|
// Update cache for handler get_execution_time();
| // Update cache for handler get_execution_time();
|
Zeile 181 | Zeile 181 |
---|
} } // Else, using internal database cache
|
} } // Else, using internal database cache
|
else
| else
|
{ $query = $db->simple_select("datacache", "title,cache", "title='$name'"); $cache_data = $db->fetch_array($query);
| { $query = $db->simple_select("datacache", "title,cache", "title='$name'"); $cache_data = $db->fetch_array($query);
|
Zeile 213 | Zeile 213 |
---|
* Update cache contents. * * @param string $name The cache content identifier.
|
* Update cache contents. * * @param string $name The cache content identifier.
|
* @param string $contents The cache content.
| * @param mixed $contents The cache content.
|
*/ function update($name, $contents) {
| */ function update($name, $contents) {
|
Zeile 222 | Zeile 222 |
---|
$this->cache[$name] = $contents;
// We ALWAYS keep a running copy in the db just incase we need it
|
$this->cache[$name] = $contents;
// We ALWAYS keep a running copy in the db just incase we need it
|
$dbcontents = $db->escape_string(serialize($contents));
| $dbcontents = $db->escape_string(my_serialize($contents));
|
$replace_array = array( "title" => $db->escape_string($name),
| $replace_array = array( "title" => $db->escape_string($name),
|
Zeile 231 | Zeile 231 |
---|
$db->replace_query("datacache", $replace_array, "", false);
// Do we have a cache handler we're using?
|
$db->replace_query("datacache", $replace_array, "", false);
// Do we have a cache handler we're using?
|
if($this->handler instanceof CacheHandlerInterface) { get_execution_time();
$hit = $this->handler->put($name, $contents);
$call_time = get_execution_time(); $this->call_time += $call_time;
| if($this->handler instanceof CacheHandlerInterface) { get_execution_time();
$hit = $this->handler->put($name, $contents);
$call_time = get_execution_time(); $this->call_time += $call_time;
|
$this->call_count++;
if($mybb->debug_mode)
| $this->call_count++;
if($mybb->debug_mode)
|
Zeile 258 | Zeile 258 |
---|
*/ function delete($name, $greedy = false) {
|
*/ function delete($name, $greedy = false) {
|
global $db, $mybb, $cache;
| global $db, $mybb, $cache;
|
// Prepare for database query. $dbname = $db->escape_string($name);
| // Prepare for database query. $dbname = $db->escape_string($name);
|
Zeile 276 | Zeile 276 |
---|
$this->call_count++;
if($mybb->debug_mode)
|
$this->call_count++;
if($mybb->debug_mode)
|
{
| {
|
$this->debug_call('delete:'.$name, $call_time, $hit); } }
| $this->debug_call('delete:'.$name, $call_time, $hit); } }
|
Zeile 313 | Zeile 313 |
---|
while($row = $db->fetch_array($query)) { $names[$row['title']] = 0;
|
while($row = $db->fetch_array($query)) { $names[$row['title']] = 0;
|
}
| }
|
// ...from the filesystem... $start = strlen(MYBB_ROOT."cache/"); foreach((array)@glob(MYBB_ROOT."cache/{$name}*.php") as $filename)
|
// ...from the filesystem... $start = strlen(MYBB_ROOT."cache/"); foreach((array)@glob(MYBB_ROOT."cache/{$name}*.php") as $filename)
|
{
| {
|
if($filename) { $filename = substr($filename, $start, strlen($filename)-4-$start);
| if($filename) { $filename = substr($filename, $start, strlen($filename)-4-$start);
|
Zeile 331 | Zeile 331 |
---|
get_execution_time();
$hit = $this->handler->delete($key);
|
get_execution_time();
$hit = $this->handler->delete($key);
|
|
|
$call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
| $call_time = get_execution_time(); $this->call_time += $call_time; $this->call_count++;
|
Zeile 420 | Zeile 420 |
---|
return $db->fetch_size("datacache"); } }
|
return $db->fetch_size("datacache"); } }
|
else { return $size; } }
| else { return $size; } }
|
// Using MySQL as cache else {
| // Using MySQL as cache else {
|
Zeile 438 | Zeile 438 |
---|
return $db->fetch_size("datacache"); } }
|
return $db->fetch_size("datacache"); } }
|
}
| }
|
/** * Update the MyBB version in the cache.
|
/** * Update the MyBB version in the cache.
|
*
| *
|
*/ function update_version() {
| */ function update_version() {
|
Zeile 458 | Zeile 458 |
---|
/** * Update the attachment type cache.
|
/** * Update the attachment type cache.
|
* */
| * */
|
function update_attachtypes() { global $db;
| function update_attachtypes() { global $db;
|
Zeile 478 | Zeile 478 |
---|
/** * Update the smilies cache.
|
/** * Update the smilies cache.
|
*
| *
|
*/ function update_smilies() {
| */ function update_smilies() {
|
Zeile 512 | Zeile 512 |
---|
}
$this->update("posticons", $icons);
|
}
$this->update("posticons", $icons);
|
}
/**
| }
/**
|
* Update the badwords cache. * */ function update_badwords() { global $db;
|
* Update the badwords cache. * */ function update_badwords() { global $db;
|
|
|
$badwords = array();
|
$badwords = array();
|
|
|
$query = $db->simple_select("badwords", "*"); while($badword = $db->fetch_array($query)) {
| $query = $db->simple_select("badwords", "*"); while($badword = $db->fetch_array($query)) {
|
Zeile 531 | Zeile 531 |
---|
}
$this->update("badwords", $badwords);
|
}
$this->update("badwords", $badwords);
|
}
| }
|
/** * Update the usergroups cache. *
| /** * Update the usergroups cache. *
|
Zeile 541 | Zeile 541 |
---|
{ global $db;
|
{ global $db;
|
$query = $db->simple_select("usergroups");
| $query = $db->simple_select("usergroups");
|
$gs = array(); while($g = $db->fetch_array($query)) {
| $gs = array(); while($g = $db->fetch_array($query)) {
|
Zeile 550 | Zeile 550 |
---|
}
$this->update("usergroups", $gs);
|
}
$this->update("usergroups", $gs);
|
}
| }
|
/** * Update the forum permissions cache. *
| /** * Update the forum permissions cache. *
|
Zeile 568 | Zeile 568 |
---|
if(!is_array($forum_cache)) { return false;
|
if(!is_array($forum_cache)) { return false;
|
}
| }
|
reset($forum_cache); $fcache = array();
| reset($forum_cache); $fcache = array();
|
Zeile 605 | Zeile 605 |
---|
* @access private * @param array $permissions An optional permissions array. * @param int $pid An optional permission id.
|
* @access private * @param array $permissions An optional permissions array. * @param int $pid An optional permission id.
|
*/
| */
|
private function build_forum_permissions($permissions=array(), $pid=0) { $usergroups = array_keys($this->read("usergroups", true));
| private function build_forum_permissions($permissions=array(), $pid=0) { $usergroups = array_keys($this->read("usergroups", true));
|
Zeile 672 | Zeile 672 |
---|
LEFT JOIN {$db->table_prefix}users u ON (p.uid=u.uid) WHERE p.dateline > {$timesearch} AND p.visible=1 GROUP BY {$group_by}
|
LEFT JOIN {$db->table_prefix}users u ON (p.uid=u.uid) WHERE p.dateline > {$timesearch} AND p.visible=1 GROUP BY {$group_by}
|
ORDER BY NULL DESC
| ORDER BY poststoday DESC
|
");
$most_posts = 0;
| ");
$most_posts = 0;
|
Zeile 697 | Zeile 697 |
---|
$this->update('statistics', $statistics); }
|
$this->update('statistics', $statistics); }
|
|
|
/** * Update the moderators cache. *
| /** * Update the moderators cache. *
|
Zeile 714 | Zeile 714 |
---|
if(!is_array($forum_cache)) { return false;
|
if(!is_array($forum_cache)) { return false;
|
}
| }
|
reset($forum_cache); $fcache = array();
|
reset($forum_cache); $fcache = array();
|
|
|
// Resort in to the structure we require foreach($forum_cache as $fid => $forum) { $this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
// Resort in to the structure we require foreach($forum_cache as $fid => $forum) { $this->moderators_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
}
| }
|
// Sort children foreach($fcache as $pid => $value) {
| // Sort children foreach($fcache as $pid => $value) {
|
Zeile 733 | Zeile 733 |
---|
ksort($fcache);
$this->moderators = array();
|
ksort($fcache);
$this->moderators = array();
|
|
|
// Fetch moderators from the database $query = $db->query(" SELECT m.*, u.username, u.usergroup, u.displaygroup
| // Fetch moderators from the database $query = $db->query(" SELECT m.*, u.username, u.usergroup, u.displaygroup
|
Zeile 752 | Zeile 752 |
---|
function sort_moderators_by_usernames($a, $b) { return strcasecmp($a['username'], $b['username']);
|
function sort_moderators_by_usernames($a, $b) { return strcasecmp($a['username'], $b['username']);
|
}
| }
|
}
//Fetch moderating usergroups from the database
| }
//Fetch moderating usergroups from the database
|
Zeile 1045 | Zeile 1045 |
---|
/** * Updates the search engine spiders cache
|
/** * Updates the search engine spiders cache
|
*/
| */
|
function update_spiders()
|
function update_spiders()
|
{
| {
|
global $db;
|
global $db;
|
|
|
$spiders = array(); $query = $db->simple_select("spiders", "sid, name, useragent, usergroup", "", array("order_by" => "LENGTH(useragent)", "order_dir" => "DESC")); while($spider = $db->fetch_array($query))
| $spiders = array(); $query = $db->simple_select("spiders", "sid, name, useragent, usergroup", "", array("order_by" => "LENGTH(useragent)", "order_dir" => "DESC")); while($spider = $db->fetch_array($query))
|
Zeile 1058 | Zeile 1058 |
---|
} $this->update("spiders", $spiders); }
|
} $this->update("spiders", $spiders); }
|
|
|
function update_most_replied_threads()
|
function update_most_replied_threads()
|
{ global $db, $mybb;
$threads = array();
| { global $db, $mybb;
$threads = array();
|
$query = $db->simple_select("threads", "tid, subject, replies, fid, uid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); while($thread = $db->fetch_array($query))
| $query = $db->simple_select("threads", "tid, subject, replies, fid, uid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit'])); while($thread = $db->fetch_array($query))
|
Zeile 1099 | Zeile 1099 |
---|
while($ban = $db->fetch_array($query)) { $bans[$ban['uid']] = $ban;
|
while($ban = $db->fetch_array($query)) { $bans[$ban['uid']] = $ban;
|
}
| }
|
$this->update("banned", $bans); }
| $this->update("banned", $bans); }
|
Zeile 1134 | Zeile 1134 |
---|
unset($bday['birthdayprivacy']);
$birthdays[$bday['bday']]['users'][] = $bday;
|
unset($bday['birthdayprivacy']);
$birthdays[$bday['bday']]['users'][] = $bday;
|
}
| }
|
$this->update("birthdays", $birthdays); }
|
$this->update("birthdays", $birthdays); }
|
|
|
function update_groupleaders() { global $db;
|
function update_groupleaders() { global $db;
|
$groupleaders = array();
| $groupleaders = array();
|
$query = $db->simple_select("groupleaders"); while($groupleader = $db->fetch_array($query)) {
| $query = $db->simple_select("groupleaders"); while($groupleader = $db->fetch_array($query)) {
|
Zeile 1152 | Zeile 1152 |
---|
}
$this->update("groupleaders", $groupleaders);
|
}
$this->update("groupleaders", $groupleaders);
|
}
| }
|
function update_threadprefixes() { global $db;
| function update_threadprefixes() { global $db;
|
Zeile 1190 | Zeile 1190 |
---|
}
// Do we have any mod tools to use in our forums?
|
}
// Do we have any mod tools to use in our forums?
|
$query = $db->simple_select("modtools", "forums, tid", '', array("order_by" => "tid"));
| $query = $db->simple_select("modtools", "forums, tid", '', array("order_by" => "tid"));
|
if($db->num_rows($query)) { unset($forum);
| if($db->num_rows($query)) { unset($forum);
|
Zeile 1210 | Zeile 1210 |
---|
{ $fd_statistics[$forum]['modtools'] = 1; }
|
{ $fd_statistics[$forum]['modtools'] = 1; }
|
}
| }
|
} }
$this->update("forumsdisplay", $fd_statistics); }
|
} }
$this->update("forumsdisplay", $fd_statistics); }
|
|
|
/** * Update profile fields cache. *
| /** * Update profile fields cache. *
|
Zeile 1228 | Zeile 1228 |
---|
$fields = array(); $query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder')); while($field = $db->fetch_array($query))
|
$fields = array(); $query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder')); while($field = $db->fetch_array($query))
|
{
| {
|
$fields[] = $field; }
| $fields[] = $field; }
|
Zeile 1258 | Zeile 1258 |
---|
if($reason['appliesto'] == 'all') { foreach($content_types as $content)
|
if($reason['appliesto'] == 'all') { foreach($content_types as $content)
|
{ $reasons[$content][] = array( 'rid' => $reason['rid'], 'title' => $reason['title'], 'extra' => $reason['extra'], ); }
| { $reasons[$content][] = array( 'rid' => $reason['rid'], 'title' => $reason['title'], 'extra' => $reason['extra'], ); }
|
} elseif($reason['appliesto'] != '') {
| } elseif($reason['appliesto'] != '') {
|
Zeile 1301 | Zeile 1301 |
---|
}
function reload_last_backup()
|
}
function reload_last_backup()
|
{ global $db;
| { global $db;
|
$query = $db->simple_select("datacache", "title,cache", "title='last_backup'"); $this->update("last_backup", unserialize($db->fetch_field($query, "cache")));
|
$query = $db->simple_select("datacache", "title,cache", "title='last_backup'"); $this->update("last_backup", unserialize($db->fetch_field($query, "cache")));
|
}
| }
|
function reload_internal_settings()
|
function reload_internal_settings()
|
{ global $db;
| { global $db;
|
$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'"); $this->update("internal_settings", unserialize($db->fetch_field($query, "cache"))); }
function reload_version_history()
|
$query = $db->simple_select("datacache", "title,cache", "title='internal_settings'"); $this->update("internal_settings", unserialize($db->fetch_field($query, "cache"))); }
function reload_version_history()
|
{ global $db;
| { global $db;
|
$query = $db->simple_select("datacache", "title,cache", "title='version_history'"); $this->update("version_history", unserialize($db->fetch_field($query, "cache")));
|
$query = $db->simple_select("datacache", "title,cache", "title='version_history'"); $this->update("version_history", unserialize($db->fetch_field($query, "cache")));
|
}
| }
|
function reload_modnotes()
|
function reload_modnotes()
|
{ global $db;
| { global $db;
|
$query = $db->simple_select("datacache", "title,cache", "title='modnotes'"); $this->update("modnotes", unserialize($db->fetch_field($query, "cache")));
|
$query = $db->simple_select("datacache", "title,cache", "title='modnotes'"); $this->update("modnotes", unserialize($db->fetch_field($query, "cache")));
|
}
| }
|
function reload_adminnotes()
|
function reload_adminnotes()
|
{
| {
|
global $db;
|
global $db;
|
|
|
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'"); $this->update("adminnotes", unserialize($db->fetch_field($query, "cache")));
|
$query = $db->simple_select("datacache", "title,cache", "title='adminnotes'"); $this->update("adminnotes", unserialize($db->fetch_field($query, "cache")));
|
}
function reload_mybb_credits() { admin_redirect('index.php?module=home-credits&fetch_new=-2');
| |
} }
| } }
|