Vergleich inc/class_datacache.php - 1.8.11 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 163Zeile 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 213Zeile 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 222Zeile 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 258Zeile 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 454Zeile 454
		);

$this->update("version", $version);

		);

$this->update("version", $version);

	}

	}


/**
* Update the attachment type cache.


/**
* Update the attachment type cache.

Zeile 471Zeile 471
		{
$type['extension'] = my_strtolower($type['extension']);
$types[$type['extension']] = $type;

		{
$type['extension'] = my_strtolower($type['extension']);
$types[$type['extension']] = $type;

		}

		}


$this->update("attachtypes", $types);
}


$this->update("attachtypes", $types);
}





	/**
* Update the smilies cache.
*

	/**
* Update the smilies cache.
*

Zeile 483Zeile 483
	function update_smilies()
{
global $db;

	function update_smilies()
{
global $db;





		$smilies = array();

$query = $db->simple_select("smilies", "*", "", array('order_by' => 'disporder', 'order_dir' => 'ASC'));
while($smilie = $db->fetch_array($query))

		$smilies = array();

$query = $db->simple_select("smilies", "*", "", array('order_by' => 'disporder', 'order_dir' => 'ASC'));
while($smilie = $db->fetch_array($query))

		{

		{

			$smilies[$smilie['sid']] = $smilie;
}


			$smilies[$smilie['sid']] = $smilie;
}


Zeile 519Zeile 519
	 *
*/
function update_badwords()

	 *
*/
function update_badwords()

	{
global $db;

$badwords = array();


	{
global $db;

$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 540Zeile 540
	function update_usergroups()
{
global $db;

	function update_usergroups()
{
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 594Zeile 594
		}

$this->build_forum_permissions();

		}

$this->build_forum_permissions();

		$this->update("forumpermissions", $this->built_forum_permissions);

return true;
}


		$this->update("forumpermissions", $this->built_forum_permissions);

return true;
}


	/**
* Build the forum permissions array
*

	/**
* Build the forum permissions array
*

Zeile 607Zeile 607
	 * @param int $pid An optional permission id.
*/
private function build_forum_permissions($permissions=array(), $pid=0)

	 * @param int $pid An optional permission id.
*/
private function build_forum_permissions($permissions=array(), $pid=0)

	{

	{

		$usergroups = array_keys($this->read("usergroups", true));
if($this->forum_permissions_forum_cache[$pid])
{

		$usergroups = array_keys($this->read("usergroups", true));
if($this->forum_permissions_forum_cache[$pid])
{

Zeile 630Zeile 630
					}
$this->build_forum_permissions($perms, $forum['fid']);
}

					}
$this->build_forum_permissions($perms, $forum['fid']);
}

			}
}
}

			}
}
}


/**
* Update the stats cache (kept for the sake of being able to rebuild this cache via the cache interface)


/**
* Update the stats cache (kept for the sake of being able to rebuild this cache via the cache interface)

Zeile 657Zeile 657

$timesearch = TIME_NOW - 86400;
switch($db->type)


$timesearch = TIME_NOW - 86400;
switch($db->type)

		{

		{

			case 'pgsql':
$group_by = $db->build_fields_string('users', 'u.');

			case 'pgsql':
$group_by = $db->build_fields_string('users', 'u.');

				break;

				break;

			default:
$group_by = 'p.uid';
break;

			default:
$group_by = 'p.uid';
break;

		}










		}

$query = $db->query("
SELECT u.uid, u.username, COUNT(*) AS poststoday
FROM {$db->table_prefix}posts p
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 poststoday DESC
");





		$query = $db->query('
SELECT u.uid, u.username, COUNT(pid) AS poststoday
FROM '.TABLE_PREFIX.'posts p
LEFT JOIN '.TABLE_PREFIX.'users u ON (p.uid=u.uid)
WHERE p.dateline>'.$timesearch.'
GROUP BY '.$group_by.' ORDER BY poststoday DESC
LIMIT 1
');
$topposter = $db->fetch_array($query);

		$most_posts = 0;
while($user = $db->fetch_array($query))
{
if($user['poststoday'] > $most_posts)
{
$most_posts = $user['poststoday'];
$topposter = $user;
}
}


$query = $db->simple_select('users', 'COUNT(uid) AS posters', 'postnum>0');
$posters = $db->fetch_field($query, 'posters');


$query = $db->simple_select('users', 'COUNT(uid) AS posters', 'postnum>0');
$posters = $db->fetch_field($query, 'posters');

Zeile 808Zeile 817
			{
foreach($main as $forum)
{

			{
foreach($main as $forum)
{

					$forum_mods = '';

					$forum_mods = array();

					if(count($moderators))
{
$forum_mods = $moderators;

					if(count($moderators))
{
$forum_mods = $moderators;

Zeile 1056Zeile 1065

$threads = array();



$threads = array();


		$query = $db->simple_select("threads", "tid, subject, replies, fid", "visible='1'", array('order_by' => 'replies', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));

		$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))
{
$threads[] = $thread;

		while($thread = $db->fetch_array($query))
{
$threads[] = $thread;

Zeile 1071Zeile 1080

$threads = array();



$threads = array();


		$query = $db->simple_select("threads", "tid, subject, views, fid", "visible='1'", array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));

		$query = $db->simple_select("threads", "tid, subject, views, fid, uid", "visible='1'", array('order_by' => 'views', 'order_dir' => 'DESC', 'limit_start' => 0, 'limit' => $mybb->settings['statslimit']));

		while($thread = $db->fetch_array($query))
{
$threads[] = $thread;

		while($thread = $db->fetch_array($query))
{
$threads[] = $thread;

Zeile 1187Zeile 1196
		{
unset($forum);
while($tool = $db->fetch_array($query))

		{
unset($forum);
while($tool = $db->fetch_array($query))

			{

			{

				$forums = explode(",", $tool['forums']);

				$forums = explode(",", $tool['forums']);





				foreach($forums as $forum)
{
if(!$forum)
{
$forum = -1;

				foreach($forums as $forum)
{
if(!$forum)
{
$forum = -1;

					}


					}


					if(!isset($fd_statistics[$forum]['modtools']))
{
$fd_statistics[$forum]['modtools'] = 1;
}

					if(!isset($fd_statistics[$forum]['modtools']))
{
$fd_statistics[$forum]['modtools'] = 1;
}

				}
}
}


				}
}
}


		$this->update("forumsdisplay", $fd_statistics);
}

		$this->update("forumsdisplay", $fd_statistics);
}





	/**
* Update profile fields cache.
*

	/**
* Update profile fields cache.
*

Zeile 1221Zeile 1230
		while($field = $db->fetch_array($query))
{
$fields[] = $field;

		while($field = $db->fetch_array($query))
{
$fields[] = $field;

		}


		}


		$this->update("profilefields", $fields);
}

		$this->update("profilefields", $fields);
}





	/**
* Update the report reasons cache.
*

	/**
* Update the report reasons cache.
*

Zeile 1239Zeile 1248
		{
global $plugins;
$content_types = $plugins->run_hooks("report_content_types", $content_types);

		{
global $plugins;
$content_types = $plugins->run_hooks("report_content_types", $content_types);

		}


		}


		$reasons = array();

$query = $db->simple_select("reportreasons", "*", "", array('order_by' => 'disporder'));

		$reasons = array();

$query = $db->simple_select("reportreasons", "*", "", array('order_by' => 'disporder'));

Zeile 1292Zeile 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")));

Zeile 1329Zeile 1338

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

 
	}
}

	}
}