mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6e221fe469 | ||
![]() |
679e08ec11 | ||
![]() |
603495ca97 | ||
![]() |
4c6af13574 | ||
![]() |
3fcbd42445 | ||
![]() |
e6d2e363d5 | ||
![]() |
0a067577a3 | ||
![]() |
a5b599088a | ||
![]() |
51ba514d2a |
13
CHANGELOG
13
CHANGELOG
@ -1,3 +1,16 @@
|
||||
[0.7.5 - 04.01.2017]
|
||||
* fixed bug on othire with config.account_premium_days
|
||||
* fixed bug on TFS 1.x when online_afk is enabled
|
||||
* warning about leaving news page with changes
|
||||
* added player status to tibiacom top 5 highscores box
|
||||
* save detected country on create account in session
|
||||
* fixed getPremDays and isPremium functions (newest 11.x engines are bugged when it comes to PACC, its not fault of MyAAC)
|
||||
* fix when there are no changelogs or highscores yet
|
||||
* small fix regarding getTopPlayers function which was ignoring $limit variable
|
||||
* fixed news adding when type != ARTICLE
|
||||
* fixed template path finding
|
||||
* fixed displaying article_text when it was empty saved
|
||||
|
||||
[0.7.4 - 24.12.2017]
|
||||
* fixed mysql fatal error on tibiacom template - top 5 box
|
||||
* fixed displaying of level percent bar on tibian signature
|
||||
|
@ -26,7 +26,7 @@
|
||||
session_start();
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.7.4');
|
||||
define('MYAAC_VERSION', '0.7.5');
|
||||
define('DATABASE_VERSION', 20);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
define('START_TIME', microtime(true));
|
||||
|
@ -75,7 +75,7 @@ $config = array(
|
||||
|
||||
// images
|
||||
'outfit_images_url' => 'http://outfit-images.ots.me/outfit.php', // set to animoutfit.php for animated outfit
|
||||
'item_images_url' => 'http://item-images.ots.me/960/', // set to images/items if you host your own items in images folder
|
||||
'item_images_url' => 'http://item-images.ots.me/1092/', // set to images/items if you host your own items in images folder
|
||||
|
||||
// account
|
||||
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
|
||||
|
@ -51,7 +51,7 @@ if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
||||
include(TOOLS . 'signature/index.php');
|
||||
exit();
|
||||
}
|
||||
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz)$/i", $_SERVER['REQUEST_URI'])) {
|
||||
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
@ -970,9 +970,17 @@ function getTopPlayers($limit = 5) {
|
||||
$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 `id` NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT 5')->fetchAll();
|
||||
|
||||
|
||||
$is_tfs10 = tableExist('players_online');
|
||||
$players = $db->query('SELECT `id`, `name`, `level`, `experience`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `id` NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll();
|
||||
|
||||
if($is_tfs10) {
|
||||
foreach($players as &$player) {
|
||||
$query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
|
||||
$player['online'] = ($query->rowCount() > 0 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach($players as &$player) {
|
||||
$player['rank'] = ++$i;
|
||||
|
@ -14,8 +14,7 @@ if(file_exists(BASE . 'config.local.php')) // user customizations
|
||||
require(BASE . 'config.local.php');
|
||||
|
||||
if(!isset($config['installed']) || !$config['installed']) {
|
||||
header('Location: ' . BASE_URL);
|
||||
die('AAC has not been installed yet or there was error during installation. Please install again.');
|
||||
die('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||
}
|
||||
|
||||
date_default_timezone_set($config['date_timezone']);
|
||||
|
@ -170,7 +170,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
public function load($id)
|
||||
{
|
||||
// SELECT query on database
|
||||
$this->data = $this->db->query('SELECT `id`, ' . (fieldExist('name', 'accounts') ? '`name`,' : '') . '`password`, `email`, ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('web_flags') . ', ' . (fieldExist('premdays', 'accounts') ? $this->db->fieldName('premdays') . ',' : '') . (fieldExist('lastday', 'accounts') ? $this->db->fieldName('lastday') . ',' : (fieldExist('premend', 'accounts') ? $this->db->fieldName('premend') . ' as `lastday`,' : '')) . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();
|
||||
$this->data = $this->db->query('SELECT `id`, ' . (fieldExist('name', 'accounts') ? '`name`,' : '') . '`password`, `email`, ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('web_flags') . ', ' . (fieldExist('premdays', 'accounts') ? $this->db->fieldName('premdays') . ',' : '') . (fieldExist('lastday', 'accounts') ? $this->db->fieldName('lastday') . ',' : (fieldExist('premend', 'accounts') ? $this->db->fieldName('premend') . ',' : '')) . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,9 +252,14 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
$lastday = 'lastday';
|
||||
if(fieldExist('premend', 'accounts'))
|
||||
$lastday = 'premend';
|
||||
|
||||
$field = 'lastday';
|
||||
if(isset($this->data['premend'])) { // othire
|
||||
$field = 'premend';
|
||||
}
|
||||
|
||||
// UPDATE query on database
|
||||
$this->db->query('UPDATE `accounts` SET ' . (fieldExist('name', 'accounts') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . (fieldExist('premdays', 'accounts') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $lastday . '` = ' . (int) $this->data['lastday'] . ' WHERE `id` = ' . $this->data['id']);
|
||||
$this->db->query('UPDATE `accounts` SET ' . (fieldExist('name', 'accounts') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . (fieldExist('premdays', 'accounts') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,22 +332,18 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
return $this->hasFlag(FLAG_SUPER_ADMIN);
|
||||
}
|
||||
|
||||
public function getPremDays()
|
||||
{
|
||||
if( !isset($this->data['lastday']) )
|
||||
{
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
public function getPremDays()
|
||||
{
|
||||
if(!isset($this->data['lastday']) && !isset($this->data['premend'])) {
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
if(fieldExist('premdays', 'accounts'))
|
||||
return $this->data['premdays'];
|
||||
|
||||
if($this->data['lastday'] == 0)
|
||||
return 0;
|
||||
|
||||
return round(($this->data['lastday'] - time()) / (24 * 60 * 60), 3);
|
||||
//return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
|
||||
}
|
||||
if(isset($this->data['premend'])) {
|
||||
return round(($this->data['premend'] - time()) / (24 * 60 * 60), 2);
|
||||
}
|
||||
|
||||
return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
|
||||
}
|
||||
|
||||
public function getLastLogin()
|
||||
{
|
||||
@ -358,12 +359,13 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
{
|
||||
global $config;
|
||||
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return true;
|
||||
if(fieldExist('premdays', 'accounts'))
|
||||
return $this->data['premdays'] > 0;
|
||||
|
||||
return $this->data['lastday'] > time();
|
||||
//return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);
|
||||
}
|
||||
|
||||
if(isset($this->data['premend'])) {
|
||||
return $this->data['premend'] > time();
|
||||
}
|
||||
|
||||
return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);
|
||||
}
|
||||
|
||||
public function getCreated()
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ $errors = array();
|
||||
$players = array();
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
$account_players->orderBy('id');
|
||||
|
||||
|
||||
echo $twig->render('account.management.html.twig', array(
|
||||
'welcome_message' => $welcome_message,
|
||||
'recovery_key' => $recovery_key,
|
||||
|
@ -144,8 +144,13 @@ if($save)
|
||||
}
|
||||
|
||||
if($config['account_premium_days'] && $config['account_premium_days'] > 0) {
|
||||
$new_account->setCustomField('premdays', $config['account_premium_days']);
|
||||
$new_account->setCustomField('lastday', time());
|
||||
if(fieldExist('premend', 'accounts')) { // othire
|
||||
$new_account->setCustomField('premend', time() + $config['account_premium_days'] * 86400);
|
||||
}
|
||||
else { // rest
|
||||
$new_account->setCustomField('premdays', $config['account_premium_days']);
|
||||
$new_account->setCustomField('lastday', time());
|
||||
}
|
||||
}
|
||||
|
||||
if($config['account_premium_points']) {
|
||||
@ -208,36 +213,43 @@ if($save)
|
||||
}
|
||||
}
|
||||
|
||||
$country_recognized = null;
|
||||
if($config['account_country_recognize']) {
|
||||
$country_recognized = null;
|
||||
if($config['account_country_recognize']) {
|
||||
$country_session = getSession('country');
|
||||
if($country_session !== false) { // get from session
|
||||
$country_recognized = $country_session;
|
||||
}
|
||||
else {
|
||||
$info = json_decode(@file_get_contents('http://ipinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true);
|
||||
if(isset($info['country'])) {
|
||||
$country_recognized = strtolower($info['country']);
|
||||
setSession('country', $country_recognized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
if(!empty($errors))
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
if($config['account_country']) {
|
||||
$countries = array();
|
||||
foreach (array('pl', 'se', 'br', 'us', 'gb') as $c)
|
||||
$countries[$c] = $config['countries'][$c];
|
||||
|
||||
$countries['--'] = '----------';
|
||||
foreach ($config['countries'] as $code => $c)
|
||||
$countries[$code] = $c;
|
||||
}
|
||||
if($config['account_country']) {
|
||||
$countries = array();
|
||||
foreach (array('pl', 'se', 'br', 'us', 'gb') as $c)
|
||||
$countries[$c] = $config['countries'][$c];
|
||||
|
||||
$countries['--'] = '----------';
|
||||
foreach ($config['countries'] as $code => $c)
|
||||
$countries[$code] = $c;
|
||||
}
|
||||
|
||||
echo $twig->render('account.create.js.html.twig');
|
||||
echo $twig->render('account.create.html.twig', array(
|
||||
'account' => isset($_POST['account']) ? $_POST['account'] : '',
|
||||
'email' => isset($_POST['email']) ? $_POST['email'] : '',
|
||||
'countries' => isset($countries) ? $countries : null,
|
||||
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false,
|
||||
'country_recognized' => $country_recognized,
|
||||
'country' => isset($country) ? $country : null,
|
||||
'errors' => $errors,
|
||||
'save' => $save
|
||||
));
|
||||
echo $twig->render('account.create.js.html.twig');
|
||||
echo $twig->render('account.create.html.twig', array(
|
||||
'account' => isset($_POST['account']) ? $_POST['account'] : '',
|
||||
'email' => isset($_POST['email']) ? $_POST['email'] : '',
|
||||
'countries' => isset($countries) ? $countries : null,
|
||||
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false,
|
||||
'country_recognized' => $country_recognized,
|
||||
'country' => isset($country) ? $country : null,
|
||||
'errors' => $errors,
|
||||
'save' => $save
|
||||
));
|
||||
?>
|
@ -228,8 +228,10 @@ echo '
|
||||
$show_link_to_next_page = true;
|
||||
}
|
||||
|
||||
if(!$i)
|
||||
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 : 4) . '">No records yet.</td></tr>';
|
||||
if(!$i) {
|
||||
$extra = ($config['highscores_outfit'] ? 1 : 0);
|
||||
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 + $extra : 4 + $extra) . '">No records yet.</td></tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
@ -387,7 +387,7 @@ class News
|
||||
if(!self::verify($title, $body, $article_text, $article_image, $errors))
|
||||
return false;
|
||||
|
||||
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => $article_text, 'article_image' => $article_image));
|
||||
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => ($type == 3 ? $article_text : ''), 'article_image' => ($type == 3 ? $article_image : '')));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,13 @@ if(isset($config['lua']['statustimeout']))
|
||||
// get status timeout from server config
|
||||
$status_timeout = eval('return ' . $config['lua']['statusTimeout'] . ';') / 1000 + 1;
|
||||
|
||||
if($status['lastCheck'] + $status_timeout < time())
|
||||
{
|
||||
if($status['lastCheck'] + $status_timeout < time()) {
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
function updateStatus() {
|
||||
global $db, $cache, $config, $status, $status_ip, $status_port;
|
||||
|
||||
// get server status and save it to database
|
||||
$serverInfo = new OTS_ServerInfo($status_ip, $status_port);
|
||||
$serverStatus = $serverInfo->status();
|
||||
@ -98,9 +103,14 @@ if($status['lastCheck'] + $status_timeout < time())
|
||||
if($config['online_afk'])
|
||||
{
|
||||
// get amount of players that are currently logged in-game, including disconnected clients (exited)
|
||||
$query = $db->query('SELECT COUNT(' . $db->fieldName('id') . ') AS playersTotal FROM ' . $db->tableName('players') .
|
||||
' WHERE ' . $db->fieldName('online') . ' > 0');
|
||||
|
||||
if(tableExist('players_online')) { // tfs 1.x
|
||||
$query = $db->query('SELECT COUNT(`player_id`) AS `playersTotal` FROM `players`;');
|
||||
}
|
||||
else {
|
||||
$query = $db->query('SELECT COUNT(`id`) AS `playersTotal` FROM `players` WHERE `online` > 0');
|
||||
}
|
||||
|
||||
$status['playersTotal'] = 0;
|
||||
if($query->rowCount() > 0)
|
||||
{
|
||||
$query = $query->fetch();
|
||||
@ -132,5 +142,4 @@ if($status['lastCheck'] + $status_timeout < time())
|
||||
foreach($status as $key => $value) {
|
||||
updateDatabaseConfig('status_' . $key, $value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
@ -15,42 +15,38 @@ if($config['template_allow_change'])
|
||||
{
|
||||
if(isset($_GET['template']))
|
||||
{
|
||||
$template_name = $_GET['template'];
|
||||
if(!preg_match("/[^A-z0-9_\-]/", $template_name)) { // validate template
|
||||
//setcookie('template', $template_name, 0, BASE_DIR . '/', $_SERVER["SERVER_NAME"]);
|
||||
$template_name = $_GET['template'];
|
||||
setSession('template', $template_name);
|
||||
header('Location:' . getSession('last_uri'));
|
||||
}
|
||||
else
|
||||
$template_name = $config['template'];
|
||||
}
|
||||
else {
|
||||
$template_session = getSession('template');
|
||||
if ($template_session !== false) {
|
||||
if (!preg_match("/[^A-z0-9_\-]/", $template_session)) {
|
||||
$template_name = $template_session;
|
||||
} else {
|
||||
$template_name = $config['template'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$template_path = 'templates/' . $template_name;
|
||||
|
||||
if(!file_exists($template_path . '/index.php') &&
|
||||
!file_exists($template_path . '/template.php') &&
|
||||
!file_exists($template_path . '/layout.php'))
|
||||
if(!file_exists(BASE . $template_path . '/index.php') &&
|
||||
!file_exists(BASE . $template_path . '/template.php') &&
|
||||
!file_exists(BASE . $template_path . '/layout.php'))
|
||||
{
|
||||
$template_name = 'kathrine';
|
||||
$template_path = TEMPLATES . $template_name;
|
||||
$template_path = 'templates/' . $template_name;
|
||||
}
|
||||
|
||||
$file = $template_path . '/config.ini';
|
||||
$file = BASE . $template_path . '/config.ini';
|
||||
$exists = file_exists($file);
|
||||
if($exists || ($config['backward_support'] && file_exists($template_path . '/layout_config.ini')))
|
||||
if($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini')))
|
||||
{
|
||||
if(!$exists)
|
||||
$file = $template_path . '/layout_config.ini';
|
||||
$file = BASE . $template_path . '/layout_config.ini';
|
||||
|
||||
if($cache->enabled())
|
||||
{
|
||||
@ -69,8 +65,8 @@ if($exists || ($config['backward_support'] && file_exists($template_path . '/lay
|
||||
foreach($template_ini as $key => $value)
|
||||
$config[$key] = $value;
|
||||
}
|
||||
else if(file_exists($template_path . '/config.php'))
|
||||
require($template_path . '/config.php');
|
||||
else if(file_exists(BASE . $template_path . '/config.php'))
|
||||
require(BASE . $template_path . '/config.php');
|
||||
|
||||
$template = array();
|
||||
$template['link_account_manage'] = getLink('account/manage');
|
||||
|
@ -23,7 +23,7 @@
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td bgcolor="{{ config.lightborder }}">There are no change logs for the moment.</td>
|
||||
<td colspan="4" bgcolor="{{ config.darkborder }}">There are no changelogs for the moment.</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
<td colspan="2" style="cursor: pointer;" onclick="toggleVisibility('faq_{{ i }}'); return false;">
|
||||
<b>{{ faq.question }}</b>
|
||||
<b>{{ faq.question|raw }}</b>
|
||||
|
||||
<div id="faq_{{ i }}" style="display: none;">{{ faq.answer }}</div>
|
||||
<div id="faq_{{ i }}" style="display: none;">{{ faq.answer|raw }}</div>
|
||||
</td>
|
||||
{% if canEdit %}
|
||||
<td>
|
||||
|
@ -1,17 +1,7 @@
|
||||
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinymce.init({
|
||||
selector : "#body",
|
||||
theme : "modern",
|
||||
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code',
|
||||
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
|
||||
image_advtab: true
|
||||
});
|
||||
</script>
|
||||
{% if action != 'edit' %}
|
||||
<a id="news-button" href="#">Add news</a>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ news_link_form }}">
|
||||
<form method="post" action="{{ news_link_form }}" id="news-edit-form">
|
||||
{% if action == 'edit' %}
|
||||
<input type="hidden" name="id" value="{{ news_id }}" />
|
||||
{% endif %}
|
||||
@ -47,7 +37,7 @@
|
||||
</tr>
|
||||
|
||||
{% set rows = rows + 1 %}
|
||||
<tr id="article-text" bgcolor="{{ getStyle(rows) }}"{% if article_text is empty %} style="display: none;"{% endif %}>
|
||||
<tr id="article-text" bgcolor="{{ getStyle(rows) }}"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
|
||||
<td><b>Article short text:<br/>This will be displayed on news page.<br/>Rest will be available on "read more" page.</b></td>
|
||||
<td>
|
||||
<textarea name="article_text">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea>
|
||||
@ -55,7 +45,7 @@
|
||||
</tr>
|
||||
|
||||
{% set rows = rows + 1 %}
|
||||
<tr id="article-image" bgcolor="{{ getStyle(rows) }}"{% if article_image is empty %} style="display: none;"{% endif %}>
|
||||
<tr id="article-image" bgcolor="{{ getStyle(rows) }}"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
|
||||
<td><b>Article image:</b></td>
|
||||
<td>
|
||||
<input type="text" name="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}" />
|
||||
@ -121,7 +111,7 @@
|
||||
<input type="submit" value="Submit"/>
|
||||
</td>
|
||||
<td align="left">
|
||||
<input type="button" onclick="window.location = '{{ news_link }}';" value="Cancel"/>
|
||||
<input id="cancel" type="button" value="Cancel"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -150,4 +140,49 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var unsaved = false;
|
||||
var lastContent = '';
|
||||
|
||||
tinymce.init({
|
||||
selector : "#body",
|
||||
theme : "modern",
|
||||
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code',
|
||||
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
|
||||
image_advtab: true,
|
||||
setup: function(ed){
|
||||
ed.on('NodeChange', function(e) {
|
||||
if(ed.getContent() != lastContent) {
|
||||
unsaved = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$(":input").change(function(){ //trigers change in all input fields including text type
|
||||
unsaved = true;
|
||||
});
|
||||
|
||||
$("#cancel").click(function( event ) {
|
||||
unsaved = false;
|
||||
window.location = '{{ news_link }}';
|
||||
});
|
||||
|
||||
$("#news-edit-form").submit(function( event ) {
|
||||
unsaved = false;
|
||||
});
|
||||
|
||||
lastContent = $("#body").val();
|
||||
});
|
||||
|
||||
function unloadPage(){
|
||||
if(unsaved){
|
||||
return "You have unsaved changes on this page. Do you want to leave this page and discard your changes or stay on this page?";
|
||||
}
|
||||
}
|
||||
|
||||
window.onbeforeunload = unloadPage;
|
||||
</script>
|
@ -26,12 +26,17 @@
|
||||
|
||||
#Topbar a {
|
||||
text-decoration: none;
|
||||
cursor: auto;
|
||||
}
|
||||
.online {
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
.offline {
|
||||
color: #FF0000;
|
||||
}
|
||||
a.topfont {
|
||||
font-family: Verdana, Arial, Helvetica;
|
||||
font-size: 11px;
|
||||
color: #FF0000;
|
||||
text-decoration: none
|
||||
}
|
||||
a:hover.topfont {
|
||||
@ -47,7 +52,7 @@
|
||||
<?php
|
||||
|
||||
foreach(getTopPlayers(5) as $player) {
|
||||
echo '<div align="left"><a href="'.getPlayerLink($player['name'], false).'" class="topfont">
|
||||
echo '<div align="left"><a href="'.getPlayerLink($player['name'], false).'" class="topfont ' . ($player['online'] == 1 ? 'online' : 'offline') . '">
|
||||
<font color="#CCC"> '.$player['rank'].' - </font>'.$player['name'].'
|
||||
<br>
|
||||
<small><font color="white"> Level: ('.$player['level'].')</font></small>
|
||||
|
Loading…
x
Reference in New Issue
Block a user