Vergleich inc/class_datacache.php - 1.8.13 - 1.8.22

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

	function update_attachtypes()
{
global $db;





		$types = array();

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

		$types = array();

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

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
*
* @access private

	 * Build the forum permissions array
*
* @access private

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.' AND p.visible=1
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 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');

 
	}
}

	}
}