Vergleich inc/class_datacache.php - 1.2.2 - 1.2.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: class_datacache.php 2163 2006-08-30 05:53:05Z chris $

 * $Id: class_datacache.php 3124 2007-06-06 04:56:26Z chris $

 */

class datacache

 */

class datacache

Zeile 59Zeile 59
		global $db, $mybb;
if($mybb->config['cache_store'] == "files")
{

		global $db, $mybb;
if($mybb->config['cache_store'] == "files")
{

			if($hard)

			if(!isset($this->cache[$name]) || $hard)

			{
@include(MYBB_ROOT."inc/cache/".$name.".php");

			{
@include(MYBB_ROOT."inc/cache/".$name.".php");

			}
else
{
@include_once(MYBB_ROOT."inc/cache/".$name.".php");
}
$this->cache[$name] = $$name;
unset($$name);
}

				$this->cache[$name] = $$name;
}
}






		else
{
if($hard)

		else
{
if($hard)

Zeile 78Zeile 73
				$data = $db->fetch_array($query);
$this->cache[$data['title']] = unserialize($data['cache']);
}

				$data = $db->fetch_array($query);
$this->cache[$data['title']] = unserialize($data['cache']);
}

		}


		}


		if(isset($this->cache[$name]))
{
return $this->cache[$name];

		if(isset($this->cache[$name]))
{
return $this->cache[$name];

Zeile 93Zeile 89
	 * @param string The cache content.
*/
function update($name, $contents)

	 * @param string The cache content.
*/
function update($name, $contents)

	{

	{

		global $db, $mybb;
$this->cache[$name] = $contents;


		global $db, $mybb;
$this->cache[$name] = $contents;


Zeile 124Zeile 120
	 *
*/
function updateversion()

	 *
*/
function updateversion()

	{

	{

		global $db, $mybb;
$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code
);
$this->update("version", $version);

		global $db, $mybb;
$version = array(
"version" => $mybb->version,
"version_code" => $mybb->version_code
);
$this->update("version", $version);

	}


	}


	/**
* Update the attachment type cache.

	/**
* Update the attachment type cache.

	 *
*/

	 *
*/

	function updateattachtypes()
{
global $db;

	function updateattachtypes()
{
global $db;

Zeile 154Zeile 150
	 *
*/
function updatesmilies()

	 *
*/
function updatesmilies()

	{

	{

		global $db;
$query = $db->simple_select(TABLE_PREFIX."smilies", "sid, name, find, image, disporder, showclickable", "", array('order_by' => 'LENGTH(find)', 'order_dir' => 'DESC'));
while($smilie = $db->fetch_array($query))

		global $db;
$query = $db->simple_select(TABLE_PREFIX."smilies", "sid, name, find, image, disporder, showclickable", "", array('order_by' => 'LENGTH(find)', 'order_dir' => 'DESC'));
while($smilie = $db->fetch_array($query))

Zeile 184Zeile 180
	 *
*/
function updatebadwords()

	 *
*/
function updatebadwords()

	{
global $db;

	{
global $db;

		$query = $db->simple_select(TABLE_PREFIX."badwords", "bid, badword, replacement");
while($badword = $db->fetch_array($query))
{

		$query = $db->simple_select(TABLE_PREFIX."badwords", "bid, badword, replacement");
while($badword = $db->fetch_array($query))
{

Zeile 234Zeile 230
		}

// Get our forum list

		}

// Get our forum list

		cache_forums();


		cache_forums(true);
$fcache = array();

		if(!is_array($forum_cache))
{
return false;

		if(!is_array($forum_cache))
{
return false;

Zeile 243Zeile 240
		foreach($forum_cache as $fid => $forum)
{
$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

		foreach($forum_cache as $fid => $forum)
{
$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

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

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

		ksort($fcache);

// Fetch forum permissions

		ksort($fcache);

// Fetch forum permissions

Zeile 294Zeile 291
	}

/**

	}

/**

	 * Update the stats cache.

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

	 *
*/
function updatestats()
{
global $db;


	 *
*/
function updatestats()
{
global $db;


		$query = $db->simple_select(TABLE_PREFIX."threads", "COUNT(tid) AS threads", "visible='1' AND closed NOT LIKE 'moved|%'");
$stats['numthreads'] = $db->fetch_field($query, 'threads');
$query = $db->simple_select(TABLE_PREFIX."posts", "COUNT(pid) AS posts", "visible='1'");
$stats['numposts'] = $db->fetch_field($query, 'posts');
$query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);
$stats['lastuid'] = $lastmember['uid'];
$stats['lastusername'] = $lastmember['username'];
$query = $db->simple_select(TABLE_PREFIX."users", "COUNT(uid) AS users");
$stats['numusers'] = $db->fetch_field($query, 'users');
$this->update("stats", $stats);































		require_once MYBB_ROOT."inc/functions_rebuild.php"; 
rebuild_stats();
}

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

// Get our forum list
cache_forums(true);
if(!is_array($forum_cache))
{
return false;
}

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

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

// Fetch moderators from the database
$query = $db->simple_select(TABLE_PREFIX."moderators");
while($moderator = $db->fetch_array($query))
{
$this->moderators[$moderator['fid']][$moderator['uid']] = $moderator;
}

$this->build_moderators();

$this->update("moderators", $this->built_moderators);

	}

/**

	}

/**

	 * Update the moderators cache.

	 * Build the moderators array

	 *

	 *

 
	 * @access private
* @param array An optional moderators array (moderators of the parent forum for example).
* @param int An optional parent ID.

	 */

	 */

	function updatemoderators()

	function build_moderators($moderators=array(), $pid=0)

	{

	{

		global $db;
$query = $db->simple_select(TABLE_PREFIX."moderators", "mid, fid, uid, caneditposts, candeleteposts, canviewips, canopenclosethreads, canmanagethreads");
while($mod = $db->fetch_array($query))

		if($this->moderators_forum_cache[$pid])



		{

		{

			$mods[$mod['fid']][$mod['uid']] = $mod;

























			foreach($this->moderators_forum_cache[$pid] as $main)
{
foreach($main as $forum)
{
$forum_mods = '';
if($moderators)
{
$forum_mods = $moderators;
}
// Append - local settings override that of a parent - array_merge works here
if($this->moderators[$forum['fid']])
{
if(is_array($forum_mods))
{
$forum_mods = array_merge($forum_mods, $this->moderators[$forum['fid']]);
}
else
{
$forum_mods = $this->moderators[$forum['fid']];
}
}
$this->built_moderators[$forum['fid']] = $forum_mods;
$this->build_moderators($forum_mods, $forum['fid']);
}
}

		}

		}

		$this->update("moderators", $mods);

 
	}

/**

	}

/**