Vergleich inc/class_datacache.php - 1.8.7 - 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 442Zeile 442

/**
* Update the MyBB version in the cache.


/**
* Update the MyBB version in the cache.

	 *
*/

	 *
*/

	function update_version()
{
global $mybb;

	function update_version()
{
global $mybb;





		$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code
);

		$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code
);





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

/**
* Update the attachment type cache.

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

/**
* Update the attachment type cache.

	 *

	 *

	 */
function update_attachtypes()
{
global $db;


	 */
function update_attachtypes()
{
global $db;


		$types = array();

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

		$types = array();

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

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

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





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

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

	}

/**

	}

/**

	 * Update the smilies cache.
*
*/
function update_smilies()
{
global $db;

	 * Update the smilies cache.
*
*/
function update_smilies()
{
global $db;





		$smilies = array();

		$smilies = array();





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

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

Zeile 493Zeile 493
		}

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

		}

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

	}


	}


	/**
* Update the posticon cache.
*

	/**
* Update the posticon cache.
*

Zeile 502Zeile 502
	function update_posticons()
{
global $db;

	function update_posticons()
{
global $db;





		$icons = array();

$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))
{
$icons[$icon['iid']] = $icon;

		$icons = array();

$query = $db->simple_select("icons", "iid, name, path");
while($icon = $db->fetch_array($query))
{
$icons[$icon['iid']] = $icon;

		}

		}


$this->update("posticons", $icons);
}


$this->update("posticons", $icons);
}





	/**
* Update the badwords cache.
*

	/**
* Update the badwords cache.
*

Zeile 521Zeile 521
	function update_badwords()
{
global $db;

	function update_badwords()
{
global $db;





		$badwords = array();

$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))

		$badwords = array();

$query = $db->simple_select("badwords", "*");
while($badword = $db->fetch_array($query))

		{

		{

			$badwords[$badword['bid']] = $badword;
}


			$badwords[$badword['bid']] = $badword;
}


Zeile 560Zeile 560
	function update_forumpermissions()
{
global $forum_cache, $db;

	function update_forumpermissions()
{
global $forum_cache, $db;





		$this->built_forum_permissions = array(0);

		$this->built_forum_permissions = array(0);





		// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))

		// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))

		{

		{

			return false;

			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->forum_permissions_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		// Resort in to the structure we require
foreach($forum_cache as $fid => $forum)
{
$this->forum_permissions_forum_cache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		}

// Sort children
foreach($fcache as $pid => $value)
{
ksort($fcache[$pid]);
}

		}

// Sort children
foreach($fcache as $pid => $value)
{
ksort($fcache[$pid]);
}

		ksort($fcache);

// Fetch forum permissions from the database

		ksort($fcache);

// Fetch forum permissions from the database

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 poststoday 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 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 872Zeile 881
		$usertitles = array();
$query = $db->simple_select("usertitles", "utid, posts, title, stars, starimage", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))

		$usertitles = array();
$query = $db->simple_select("usertitles", "utid, posts, title, stars, starimage", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))

		{

		{

			$usertitles[] = $usertitle;
}


			$usertitles[] = $usertitle;
}


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

	}

/**

	}

/**

	 * Update mycode cache.
*
*/
function update_mycode()
{
global $db;

	 * Update mycode cache.
*
*/
function update_mycode()
{
global $db;





		$mycodes = array();
$query = $db->simple_select("mycode", "regex, replacement", "active=1", array('order_by' => 'parseorder'));
while($mycode = $db->fetch_array($query))

		$mycodes = array();
$query = $db->simple_select("mycode", "regex, replacement", "active=1", array('order_by' => 'parseorder'));
while($mycode = $db->fetch_array($query))

Zeile 936Zeile 930
		}

$this->update("mycode", $mycodes);

		}

$this->update("mycode", $mycodes);

	}


	}


	/**
* Update the mailqueue cache
*

	/**
* Update the mailqueue cache
*

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['queue_size'] = $queue_size;

			$mailqueue = array();
}
$mailqueue['queue_size'] = $queue_size;

Zeile 1002Zeile 996

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


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

		{

		{

			$task_cache = array();

			$task_cache = array();

		}

		}

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

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





		if(!$task_cache['nextrun'])
{
$task_cache['nextrun'] = TIME_NOW+3600;

		if(!$task_cache['nextrun'])
{
$task_cache['nextrun'] = TIME_NOW+3600;

Zeile 1019Zeile 1013
	 * Updates the banned IPs cache
*/
function update_bannedips()

	 * Updates the banned IPs cache
*/
function update_bannedips()

	{

	{

		global $db;

$banned_ips = array();

		global $db;

$banned_ips = array();

Zeile 1071Zeile 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 1086Zeile 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 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) */

Zeile 1248Zeile 1290

$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
$this->update("mostonline", unserialize($db->fetch_field($query, "cache")));


$query = $db->simple_select("datacache", "title,cache", "title='mostonline'");
$this->update("mostonline", unserialize($db->fetch_field($query, "cache")));

	}

	}


function reload_plugins()
{


function reload_plugins()
{

Zeile 1267Zeile 1309
	}

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")));
}

function reload_modnotes()

		$query = $db->simple_select("datacache", "title,cache", "title='version_history'");
$this->update("version_history", unserialize($db->fetch_field($query, "cache")));
}

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

Zeile 1296Zeile 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');

 
	}
}

	}
}