Vergleich inc/class_datacache.php - 1.8.7 - 1.8.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 466Zeile 466

$types = array();



$types = array();


		$query = $db->simple_select("attachtypes", "*");

		$query = $db->simple_select('attachtypes', '*', 'enabled=1');

		while($type = $db->fetch_array($query))
{
$type['extension'] = my_strtolower($type['extension']);

		while($type = $db->fetch_array($query))
{
$type['extension'] = my_strtolower($type['extension']);

Zeile 666Zeile 666
				break;
}


				break;
}


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










		$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 NULL DESC
");

$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 709Zeile 718

reset($forum_cache);
$fcache = array();


reset($forum_cache);
$fcache = array();





		// Resort in to the structure we require
foreach($forum_cache as $fid => $forum)
{

		// Resort in to the structure we require
foreach($forum_cache as $fid => $forum)
{

Zeile 718Zeile 727

// Sort children
foreach($fcache as $pid => $value)


// Sort children
foreach($fcache as $pid => $value)

		{

		{

			ksort($fcache[$pid]);
}
ksort($fcache);

			ksort($fcache[$pid]);
}
ksort($fcache);

Zeile 743Zeile 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 787Zeile 796

$data = array(
'users' => $awaitingusers,


$data = array(
'users' => $awaitingusers,

			'time'	=> TIME_NOW 

			'time'	=> TIME_NOW

		);

$this->update('awaitingactivation', $data);

		);

$this->update('awaitingactivation', $data);

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 895Zeile 904

$query = $db->simple_select("reportedcontent", "dateline", "reportstatus='0'", array('order_by' => 'dateline', 'order_dir' => 'DESC'));
$latest = $db->fetch_array($query);


$query = $db->simple_select("reportedcontent", "dateline", "reportstatus='0'", array('order_by' => 'dateline', 'order_dir' => 'DESC'));
$latest = $db->fetch_array($query);


$reasons = array();

if(!empty($mybb->settings['reportreasons']))
{
$options = $mybb->settings['reportreasons'];
$options = explode("\n", $options);

foreach($options as $option)
{
$option = explode("=", $option);
$reasons[$option[0]] = $option[1];
}
}

 

$reports = array(
"unread" => $num['unreadcount'],
"total" => $total['reportcount'],


$reports = array(
"unread" => $num['unreadcount'],
"total" => $total['reportcount'],

			"lastdateline" => $latest['dateline'],
"reasons" => $reasons

			"lastdateline" => $latest['dateline']


		);

$this->update("reportedcontent", $reports);

		);

$this->update("reportedcontent", $reports);

Zeile 922Zeile 916

/**
* Update mycode cache.


/**
* Update mycode cache.

	 *
*/

	 *
*/

	function update_mycode()
{
global $db;

	function update_mycode()
{
global $db;

Zeile 947Zeile 941
	function update_mailqueue($last_run=0, $lock_time=0)
{
global $db;

	function update_mailqueue($last_run=0, $lock_time=0)
{
global $db;





		$query = $db->simple_select("mailqueue", "COUNT(*) AS queue_size");
$queue_size = $db->fetch_field($query, "queue_size");

$mailqueue = $this->read("mailqueue");
if(!is_array($mailqueue))

		$query = $db->simple_select("mailqueue", "COUNT(*) AS queue_size");
$queue_size = $db->fetch_field($query, "queue_size");

$mailqueue = $this->read("mailqueue");
if(!is_array($mailqueue))

		{

		{

			$mailqueue = array();

			$mailqueue = array();

		}

		}

		$mailqueue['queue_size'] = $queue_size;
if($last_run > 0)
{
$mailqueue['last_run'] = $last_run;

		$mailqueue['queue_size'] = $queue_size;
if($last_run > 0)
{
$mailqueue['last_run'] = $last_run;

		}

		}

		$mailqueue['locked'] = $lock_time;

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

		$mailqueue['locked'] = $lock_time;

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

Zeile 976Zeile 970
		);

$this->update("update_check", $update_cache);

		);

$this->update("update_check", $update_cache);

	}

/**

	}

/**

	 * Update default_theme cache
*/
function update_default_theme()

	 * Update default_theme cache
*/
function update_default_theme()

Zeile 994Zeile 988
	 * Updates the tasks cache saving the next run time
*/
function update_tasks()

	 * Updates the tasks cache saving the next run time
*/
function update_tasks()

	{
global $db;

	{
global $db;


$query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
$next_task = $db->fetch_array($query);


$query = $db->simple_select("tasks", "nextrun", "enabled=1", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
$next_task = $db->fetch_array($query);

Zeile 1004Zeile 998
		if(!is_array($task_cache))
{
$task_cache = array();

		if(!is_array($task_cache))
{
$task_cache = array();

		}

		}

		$task_cache['nextrun'] = $next_task['nextrun'];

if(!$task_cache['nextrun'])

		$task_cache['nextrun'] = $next_task['nextrun'];

if(!$task_cache['nextrun'])

Zeile 1029Zeile 1023
			$banned_ips[$banned_ip['fid']] = $banned_ip;
}
$this->update("bannedips", $banned_ips);

			$banned_ips[$banned_ip['fid']] = $banned_ip;
}
$this->update("bannedips", $banned_ips);

	}


	}


	/**
* Updates the banned emails cache
*/
function update_bannedemails()

	/**
* Updates the banned emails cache
*/
function update_bannedemails()

	{
global $db;


	{
global $db;


		$banned_emails = array();
$query = $db->simple_select("banfilters", "fid, filter", "type = '3'");

while($banned_email = $db->fetch_array($query))
{
$banned_emails[$banned_email['fid']] = $banned_email;

		$banned_emails = array();
$query = $db->simple_select("banfilters", "fid, filter", "type = '3'");

while($banned_email = $db->fetch_array($query))
{
$banned_emails[$banned_email['fid']] = $banned_email;

		}


		}


		$this->update("bannedemails", $banned_emails);
}


		$this->update("bannedemails", $banned_emails);
}


Zeile 1053Zeile 1047
	 * Updates the search engine spiders cache
*/
function update_spiders()

	 * Updates the search engine spiders cache
*/
function update_spiders()

	{

	{

		global $db;

$spiders = array();

		global $db;

$spiders = array();

Zeile 1061Zeile 1055
		while($spider = $db->fetch_array($query))
{
$spiders[$spider['sid']] = $spider;

		while($spider = $db->fetch_array($query))
{
$spiders[$spider['sid']] = $spider;

		}

		}

		$this->update("spiders", $spiders);
}


		$this->update("spiders", $spiders);
}


	function update_most_replied_threads()
{
global $db, $mybb;

$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']));
while($thread = $db->fetch_array($query))
{
$threads[] = $thread;
}

$this->update("most_replied_threads", $threads);
}

function update_most_viewed_threads()

	function update_most_replied_threads()
















	{
global $db, $mybb;

$threads = array();


	{
global $db, $mybb;

$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, 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;
}


		$this->update("most_viewed_threads", $threads);

		$this->update("most_replied_threads", $threads);

	}


	}


	function update_banned()

	function update_most_viewed_threads()

	{

	{

		global $db;



		global $db, $mybb;

$threads = array();





		$bans = array();














		$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;
}

$this->update("most_viewed_threads", $threads);
}

function update_banned()
{
global $db;

$bans = array();


$query = $db->simple_select("banned");
while($ban = $db->fetch_array($query))


$query = $db->simple_select("banned");
while($ban = $db->fetch_array($query))

Zeile 1239Zeile 1233
		}

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

		}

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

 
	}

/**
* Update the report reasons cache.
*
*/
function update_reportreasons($no_plugins = false)
{
global $db;

$content_types = array('post', 'profile', 'reputation');
if(!$no_plugins)
{
global $plugins;
$content_types = $plugins->run_hooks("report_content_types", $content_types);
}

$reasons = array();

$query = $db->simple_select("reportreasons", "*", "", array('order_by' => 'disporder'));
while($reason = $db->fetch_array($query))
{
if($reason['appliesto'] == 'all')
{
foreach($content_types as $content)
{
$reasons[$content][] = array(
'rid' => $reason['rid'],
'title' => $reason['title'],
'extra' => $reason['extra'],
);
}
}
elseif($reason['appliesto'] != '')
{
$appliesto = explode(",", $reason['appliesto']);
foreach($appliesto as $content)
{
$reasons[$content][] = array(
'rid' => $reason['rid'],
'title' => $reason['title'],
'extra' => $reason['extra'],
);
}
}
}

$this->update("reportreasons", $reasons);

	}

/* Other, extra functions for reloading caches if we just changed to another cache extension (i.e. from db -> xcache) */

	}

/* Other, extra functions for reloading caches if we just changed to another cache extension (i.e. from db -> xcache) */