Vergleich inc/class_datacache.php - 1.2.4 - 1.2.7

  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 2671 2007-01-26 07:11:42Z chris $

 * $Id: class_datacache.php 3006 2007-04-11 06:14:56Z Tikitiki $

 */

class datacache

 */

class datacache

Zeile 295Zeile 295
	}

/**

	}

/**

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

 
	}

/**

	}

/**