* added featured article to tibiacom template (you can add them with add news button)

* added networks (facebook and twitter) and highscores (top 5) boxes to tibiacom template, configurable in templates/tibiacom/config.php
* fixed polls box in tibiacom template
* (internal) moved tibiacom boxes to separate directory
* (internal) renamed constant TICKET -> TICKER
This commit is contained in:
slawkens
2017-10-26 15:35:22 +02:00
parent 5e414ebda8
commit 583f3394fc
29 changed files with 795 additions and 121 deletions

View File

@@ -414,11 +414,11 @@ function short_text($text, $limit)
function tickers()
{
global $tickers_content;
global $tickers_content, $featured_article;
if(PAGE == 'news') {
if(isset($tickers_content))
return $tickers_content;
return $tickers_content . $featured_article;
}
return '';
@@ -949,6 +949,40 @@ function unsetSession($key) {
unset($_SESSION[$config['session_prefix'] . $key]);
}
function getTopPlayers($limit = 5) {
global $cache, $config, $db;
$fetch_from_db = true;
if($cache->enabled())
{
$tmp = '';
if($cache->fetch('top_' . $limit . '_level', $tmp))
{
$players = unserialize($tmp);
$fetch_from_db = false;
}
}
if($fetch_from_db)
{
$deleted = 'deleted';
if(fieldExist('deletion', 'players'))
$deleted = 'deletion';
$players = $db->query('SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `' . $deleted . '` = 0 AND account_id != 1 ORDER BY `experience` DESC LIMIT 5')->fetchAll();
$i = 0;
foreach($players as &$player) {
$player['rank'] = ++$i;
}
if($cache->enabled())
$cache->set('top_' . $limit . '_level', serialize($players), 120);
}
return $players;
}
// validator functions
require_once(LIBS . 'validator.php');
require_once(SYSTEM . 'compat.php');