some fixed and new features

* added outfit shower, in characters, online, and highscores
* updated database to version 2
* fixed item images (now using item-images.ots.me host by default)
* fixed news ticket and posting long newses
(https://otland.net/threads/myaac-v0-0-1.251454/page-5#post-2442026)
* news body limit increased to 65535 (mysql text field)
* removed some unused code from my old server
* added spells & monsters to kathrine template
This commit is contained in:
slawkens1 2017-05-13 19:16:03 +02:00
parent 1a7dbec4c5
commit 449ce31ab4
17 changed files with 156 additions and 186 deletions

View File

@ -28,7 +28,7 @@ session_start();
define('MYAAC', true); define('MYAAC', true);
define('MYAAC_VERSION', '0.1.3'); define('MYAAC_VERSION', '0.1.3');
define('DATABASE_VERSION', 1); define('DATABASE_VERSION', 2);
define('TABLE_PREFIX', 'myaac_'); define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : 'LINUX'); define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : 'LINUX');

View File

@ -75,6 +75,10 @@ $config = array(
//'2' => 'Your Second World Name' //'2' => 'Your Second World Name'
), ),
// items
'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
// account // account
'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager) 'account_management' => true, // disable if you're using other method to manage users (fe. tfs account manager)
'account_mail_verify' => false, // force users to confirm their email addresses when registering account 'account_mail_verify' => false, // force users to confirm their email addresses when registering account
@ -86,6 +90,7 @@ $config = array(
'account_country' => true, // user will be able to set country of origin when registering account, this information will be viewable in others places aswell 'account_country' => true, // user will be able to set country of origin when registering account, this information will be viewable in others places aswell
'account_change_character_name' => false, // can user change their character name for premium points? 'account_change_character_name' => false, // can user change their character name for premium points?
'account_change_character_name_points' => 30, // cost of name change 'account_change_character_name_points' => 30, // cost of name change
'characters_per_account' => 10, // max. number of characters per account
// mail // mail
'mail_enabled' => false, // is aac maker configured to send e-mails? 'mail_enabled' => false, // is aac maker configured to send e-mails?
@ -133,8 +138,6 @@ $config = array(
1 => 'Sample town' 1 => 'Sample town'
), ),
'characters_per_account' => 10, // max. number of characters per account
// guilds // guilds
'guild_management' => true, // enable guild management system on the site? 'guild_management' => true, // enable guild management system on the site?
'guild_need_level' => 1, // min. level to form a guild 'guild_need_level' => 1, // min. level to form a guild
@ -155,6 +158,7 @@ $config = array(
'online_vocations' => false, // display vocation statistics? 'online_vocations' => false, // display vocation statistics?
'online_vocations_images' => false, // display vocation images? 'online_vocations_images' => false, // display vocation images?
'online_skulls' => false, // display skull images 'online_skulls' => false, // display skull images
'online_outfit' => true,
'online_afk' => false, 'online_afk' => false,
// support list page // support list page
@ -171,6 +175,7 @@ $config = array(
'highscores_vocation_box' => true, // show 'Choose a vocation' box on the highscores (allowing peoples to sort highscores by vocation)? 'highscores_vocation_box' => true, // show 'Choose a vocation' box on the highscores (allowing peoples to sort highscores by vocation)?
'highscores_vocation' => true, // show player vocation under his nickname? 'highscores_vocation' => true, // show player vocation under his nickname?
'highscores_frags' => false, // show 'Frags' tab (best fraggers on the server)? Only 0.3 'highscores_frags' => false, // show 'Frags' tab (best fraggers on the server)? Only 0.3
'highscores_outfit' => true, // show player outfit?
'highscores_country_box' => false, // doesnt work yet! (not implemented) 'highscores_country_box' => false, // doesnt work yet! (not implemented)
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores 'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
@ -181,6 +186,7 @@ $config = array(
'magic_level' => false, 'magic_level' => false,
'balance' => false, 'balance' => false,
'marriage_info' => true, // only 0.3 'marriage_info' => true, // only 0.3
'outfit' => true,
'creation_date' => true, 'creation_date' => true,
'quests' => true, 'quests' => true,
'skills' => true, 'skills' => true,

View File

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 569 B

View File

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 906 B

View File

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 904 B

View File

@ -217,10 +217,10 @@ if($load_it)
} }
ob_start(); ob_start();
$hooks->trigger(HOOK_BEFORE_PAGE); if($hooks->trigger(HOOK_BEFORE_PAGE)) {
if(!$ignore)
if(!$ignore) require($file);
require($file); }
if($config['backward_support'] && isset($main_content[0])) if($config['backward_support'] && isset($main_content[0]))
$content .= $main_content; $content .= $main_content;

View File

@ -146,8 +146,8 @@ CREATE TABLE `myaac_movies`
CREATE TABLE `myaac_news` CREATE TABLE `myaac_news`
( (
`id` INT(11) NOT NULL AUTO_INCREMENT, `id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(50) NOT NULL, `title` VARCHAR(100) NOT NULL,
`body` VARCHAR(10000) NOT NULL, `body` TEXT NOT NULL,
`type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticket, 3 - article', `type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - news, 2 - ticket, 3 - article',
`date` INT(11) NOT NULL DEFAULT 0, `date` INT(11) NOT NULL DEFAULT 0,
`category` TINYINT(1) NOT NULL DEFAULT 0, `category` TINYINT(1) NOT NULL DEFAULT 0,

View File

@ -148,7 +148,7 @@ function getItemImage($id, $count = 1)
$file_name .= '-' . $count; $file_name .= '-' . $count;
global $config; global $config;
return '<img src="images/items/' . $file_name . '.gif" width="32" height="32" border="0" alt=" ' .$id . '" />'; return '<img src="' . $config['item_images_url'] . $file_name . '.gif" width="32" height="32" border="0" alt=" ' .$id . '" />';
} }
function getFlagImage($country) function getFlagImage($country)

View File

@ -51,7 +51,7 @@ class Hook
require(BASE . $this->_file); require(BASE . $this->_file);
} }
return false; return true;
} }
public function name() {return $this->_name;} public function name() {return $this->_name;}

View File

@ -916,6 +916,9 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if($ip == NULL)
$ip = '0';
return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($ip) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($ip) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')');
} }

6
system/migrations/2.php Normal file
View File

@ -0,0 +1,6 @@
<?php
$db->query("ALTER TABLE `" . TABLE_PREFIX . "faq` MODIFY `answer` VARCHAR(1020) NOT NULL DEFAULT '';");
$db->query("ALTER TABLE `" . TABLE_PREFIX . "movies` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `body` TEXT NOT NULL DEFAULT '';");
?>

View File

@ -60,29 +60,46 @@ function generate_player_lookup($player)
$player_eq[$i] = $empty_slots[$i]; $player_eq[$i] = $empty_slots[$i];
} }
//for($i = 1; $i < 11; $i++) if(PHP_VERSION_ID == NULL || PHP_VERSION_ID < 70000) {
//{ for($i = 1; $i < 11; $i++)
//if(!itemImageExists($player_eq[$i])) {
// Items::generate($player_eq[$i]); if(!itemImageExists($player_eq[$i]))
//} Items::generate($player_eq[$i]);
}
}
for($i = 1; $i < 11; $i++)
{
if(check_number($player_eq[$i]))
$player_eq[$i] = getItemImage($player_eq[$i]);
else
$player_eq[$i] = '<img src="images/items/' . $player_eq[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $player_eq[$i] . '" />';
}
$skulls = array(
1 => 'skull_yellow',
2 => 'skull_green',
3 => 'skull_white',
4 => 'skull_red',
5 => 'skull_black'
);
return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;"> return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
<tr> <tr>
<td> <td>
<table cellspacing="0" style="background: #292929;"> <table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[2]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[6]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[9]).'</td></tr> <tr><td style="border:1px solid #808080;">'.$player_eq[2].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[6].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[9].'</td></tr>
<tr height="11px"><td>'.($player->getSkull() > 0 ? '<img src="images/red_skull.gif">' : '').'</td></tr> <tr height="11px"><td>'.($player->getSkullTime() > 0 && ($player->getSkull() == 4 || $player->getSkull() == 5) ? '<img src="images/' . $skulls[$player->getSkull()] . '.gif">' : '').'</td></tr>
</table> </table>
</td> </td>
<td> <td>
<table cellspacing="0" style="background: #292929;"> <table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[1]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[4]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[7]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[8]).'</td></tr> <tr><td style="border:1px solid #808080;">'.$player_eq[1].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[4].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[7].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[8].'</td></tr>
</table> </table>
</td> </td>
<td> <td>
<table cellspacing="0" style="background: #292929;"> <table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[3]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[5]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[10]).'</td></tr> <tr><td style="border:1px solid #808080;">'.$player_eq[3].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[5].'</td></tr><tr><td style="border:1px solid #808080;">'.$player_eq[10].'</td></tr>
</table> </table>
</td> </td>
</tr> </tr>
@ -148,6 +165,9 @@ if($player->isLoaded() && !$player->isDeleted())
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td> <td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
<td> <td>
<table border="0" cellspacing="1" cellpadding="4" width="100%"> <table border="0" cellspacing="1" cellpadding="4" width="100%">
<?php if($config['characters']['outfit']): ?>
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:<?php echo (in_array($player->getLookType(), array(75, 266, 302)) ? '-0px;margin-top:-0px;width:64px;height:64px;' : '-60px;margin-top:-60px;width:128px;height:128px;'); ?>" src="<?php echo $config['outfit_images_url'] . '?id=' . $player->getLookType() . '&addons=' . $player->getLookAddons() . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet() . '"';?>></div>
<?php endif; ?>
<tr bgcolor="<?php echo $config['vdarkborder']; ?>"> <tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td colspan="2" class="white"><b>Character Information</b></td> <td colspan="2" class="white"><b>Character Information</b></td>
</tr> </tr>

View File

@ -99,6 +99,10 @@ $deleted = 'deleted';
if(fieldExist('deletion', 'players')) if(fieldExist('deletion', 'players'))
$deleted = 'deletion'; $deleted = 'deletion';
$outfit = '';
if($config['highscores_outfit'])
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons';
$offset = $_page * 100; $offset = $_page * 100;
if($skill <= POT::SKILL_LAST) { // skills if($skill <= POT::SKILL_LAST) { // skills
if(fieldExist('skill_fist', 'players')) {// tfs 1.0 if(fieldExist('skill_fist', 'players')) {// tfs 1.0
@ -112,14 +116,14 @@ if($skill <= POT::SKILL_LAST) { // skills
POT::SKILL_FISH => 'skill_fishing', POT::SKILL_FISH => 'skill_fishing',
); );
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset);
} }
else else
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . ' FROM accounts,players,player_skills WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
} }
else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
{ {
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ',COUNT(`player_killers`.`player_id`) as value' . $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ',COUNT(`player_killers`.`player_id`) as value' .
' FROM `accounts`, `players`, `player_killers` ' . ' FROM `accounts`, `players`, `player_killers` ' .
' WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' . ' WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
' GROUP BY `player_id`' . ' GROUP BY `player_id`' .
@ -129,10 +133,10 @@ else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
else else
{ {
if($skill == POT::SKILL__MAGLEVEL) { if($skill == POT::SKILL__MAGLEVEL) {
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
} }
else { // level else { // level
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset); $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
$list = 'experience'; $list = 'experience';
} }
} }
@ -150,6 +154,9 @@ else
<td width="11px" class="white">#</td> <td width="11px" class="white">#</td>
<?php endif; ?> <?php endif; ?>
<td width="10%" class="white"><b>Rank</b></td> <td width="10%" class="white"><b>Rank</b></td>
<?php if($config['highscores_outfit']): ?>
<td class="white"><b>Outfit</b></td>
<?php endif; ?>
<td width="75%" class="white"><b>Name</b></td> <td width="75%" class="white"><b>Name</b></td>
<td width="15%" class="white"><b><?php echo ($skill != 666 ? 'Level' : 'Frags'); ?></b></td> <td width="15%" class="white"><b><?php echo ($skill != 666 ? 'Level' : 'Frags'); ?></b></td>
<?php if($skill == POT::SKILL__LEVEL): ?> <?php if($skill == POT::SKILL__LEVEL): ?>
@ -177,15 +184,18 @@ foreach($skills as $player)
{ {
if($skill == POT::SKILL__MAGIC) if($skill == POT::SKILL__MAGIC)
$player['value'] = $player['maglevel']; $player['value'] = $player['maglevel'];
else if($skill == POT::SKILL__LEVEL)
if($skill == POT::SKILL__LEVEL)
$player['value'] = $player['level']; $player['value'] = $player['level'];
echo ' echo '
<tr bgcolor="' . getStyle($i) . '">'; <tr bgcolor="' . getStyle($i) . '">';
if($config['account_country']) if($config['account_country'])
echo '<td>' . getFlagImage($player['country']) . '</td>'; echo '<td>' . getFlagImage($player['country']) . '</td>';
echo ' echo '
<td>' . ($offset + $i) . '.</td> <td>' . ($offset + $i) . '.</td>';
if($config['highscores_outfit'])
echo '<td><img style="position:absolute;margin-top:-45px;margin-left:-25px;" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . '&addons=' . $player['lookaddons'] . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
echo '
<td> <td>
<a href="' . getPlayerLink($player['name'], false) . '"> <a href="' . getPlayerLink($player['name'], false) . '">
<font color="' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</font> <font color="' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</font>

View File

@ -98,7 +98,8 @@ define('NEWS', 1);
define('TICKET', 2); define('TICKET', 2);
define('ARTICLE', 3); define('ARTICLE', 3);
define('BODY_LIMIT', 10000); // maximum news body length define('TITLE_LIMIT', 100);
define('BODY_LIMIT', 65535); // maximum news body length
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin(); $canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
if($canEdit) if($canEdit)
@ -143,9 +144,10 @@ if($canEdit)
$player_id = $news['player_id']; $player_id = $news['player_id'];
} }
else { else {
News::update($id, $p_title, $body, $type, $category, $player_id, $comments); if(News::update($id, $p_title, $body, $type, $category, $player_id, $comments, $errors)) {
$action = $p_title = $body = $comments = ''; $action = $p_title = $body = $comments = '';
$type = $category = $player_id = 0; $type = $category = $player_id = 0;
}
} }
} }
else if($action == 'hide') { else if($action == 'hide') {
@ -214,7 +216,7 @@ if(!$news_cached)
<span class="NewsTickerDate">'.date("j M Y", $news['date']).' -</span> <span class="NewsTickerDate">'.date("j M Y", $news['date']).' -</span>
<div id="TickerEntry-'.$rows.'-ShortText" class="NewsTickerShortText">'; <div id="TickerEntry-'.$rows.'-ShortText" class="NewsTickerShortText">';
//if admin show button to delete (hide) ticker //if admin show button to delete (hide) ticker
$tickers_to_add .= short_text($news['body'], 60).'</div> $tickers_to_add .= short_text(strip_tags($news['body']), 100).'</div>
<div id="TickerEntry-'.$rows.'-FullText" class="NewsTickerFullText">'; <div id="TickerEntry-'.$rows.'-FullText" class="NewsTickerFullText">';
//if admin show button to delete (hide) ticker //if admin show button to delete (hide) ticker
$tickers_to_add .= $news['body'] . $admin_options . '</div> $tickers_to_add .= $news['body'] . $admin_options . '</div>
@ -300,7 +302,7 @@ if(!$news_cached)
<tr bgcolor="<?php echo getStyle($rows++); ?>"> <tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Title:</b></td> <td><b>Title:</b></td>
<td><input name="title" value="<?php echo (isset($p_title) ? $p_title : ''); ?>" size="50" maxlength="50"/></td> <td><input name="title" value="<?php echo (isset($p_title) ? $p_title : ''); ?>" size="50" maxlength="100"/></td>
</tr> </tr>
<tr bgcolor="<?php echo getStyle($rows++); ?>"> <tr bgcolor="<?php echo getStyle($rows++); ?>">
@ -456,28 +458,41 @@ if(!$news_cached)
if($cache->enabled() && !$canEdit) if($cache->enabled() && !$canEdit)
$cache->set('news_' . $template_name . '_' . NEWS, $tmp_content, 120); $cache->set('news_' . $template_name . '_' . NEWS, $tmp_content, 120);
echo $tmp_content; echo $tmp_content;
} }
else else
echo $news_cached; echo $news_cached;
class News class News
{ {
static public function verify($title, $body, &$errors)
{
if(!isset($title[0]) || !isset($body[0])) {
$errors[] = 'Please fill all inputs.';
return false;
}
if(strlen($title) > TITLE_LIMIT) {
$errors[] = 'News title cannot be longer than ' . TITLE_LIMIT . ' characters.';
return false;
}
if(strlen($body) > BODY_LIMIT) {
$errors[] = 'News content cannot be longer than ' . BODY_LIMIT . ' characters.';
return false;
}
return true;
}
static public function add($title, $body, $type, $category, $player_id, $comments, &$errors) static public function add($title, $body, $type, $category, $player_id, $comments, &$errors)
{ {
global $db; global $db;
if(strlen($body) <= BODY_LIMIT) if(!News::verify($title, $body, $errors))
{ return false;
if(isset($title[0]) && isset($body[0])) {
$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));
}
else
$errors[] = 'Please fill all inputs.';
}
else
$errors[] = 'News content cannot be longer than ' . BODY_LIMIT . ' characters.';
return !count($errors); $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));
return true;
} }
static public function get($id) { static public function get($id) {
@ -485,9 +500,14 @@ class News
return $db->select(TABLE_PREFIX . 'news', array('id' => $id)); return $db->select(TABLE_PREFIX . 'news', array('id' => $id));
} }
static public function update($id, $title, $body, $type, $category, $player_id, $comments) { static public function update($id, $title, $body, $type, $category, $player_id, $comments, &$errors)
{
global $db; global $db;
if(!News::verify($title, $body, $errors))
return false;
$db->update(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'category' => $category, 'last_modified_by' => isset($player_id) ? $player_id : 0, 'last_modified_date' => time(), 'comments' => $comments), array('id' => $id)); $db->update(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'category' => $category, 'last_modified_by' => isset($player_id) ? $player_id : 0, 'last_modified_date' => time(), 'comments' => $comments), array('id' => $id));
return true;
} }
static public function delete($id, &$errors) static public function delete($id, &$errors)

View File

@ -42,11 +42,15 @@ if(fieldExist('skull_time', 'players')) {
$skull_time = 'skull_time'; $skull_time = 'skull_time';
} }
$outfit = '';
if($config['online_outfit'])
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons';
$vocs = array(0, 0, 0, 0, 0); $vocs = array(0, 0, 0, 0, 0);
if(tableExist('players_online')) // tfs 1.0 if(tableExist('players_online')) // tfs 1.0
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order); $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
else else
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order); $playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$players = 0; $players = 0;
$data = ''; $data = '';
@ -72,6 +76,9 @@ foreach($playersOnline as $player)
if($config['account_country']) if($config['account_country'])
$data .= '<td>' . getFlagImage($player['country']) . '</td>'; $data .= '<td>' . getFlagImage($player['country']) . '</td>';
if($config['online_outfit'])
$data .= '<TD WIDTH=5%><img style="position:absolute;margin-top:' . (in_array($player['looktype'], array(75, 266, 302)) ? '-20px;margin-left:-0px;' : '-45px;margin-left:-25px;') . '" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . '&addons=' . $player['lookaddons'] . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
$data .= '<td>' . getPlayerLink($player['name']) . $skull . '</td> $data .= '<td>' . getPlayerLink($player['name']) . $skull . '</td>
<td>'.$player['level'].'</td> <td>'.$player['level'].'</td>
<td>'.$config['vocations'][$player['vocation']].'</td> <td>'.$config['vocations'][$player['vocation']].'</td>
@ -195,6 +202,9 @@ if($config['online_skulls']): ?>
<?php if($config['account_country']): ?> <?php if($config['account_country']): ?>
<td width="11px"><a href="?subtopic=online&order=country" class="white">#</A></td> <td width="11px"><a href="?subtopic=online&order=country" class="white">#</A></td>
<?php endif; ?> <?php endif; ?>
<?php if($config['online_outfit']): ?>
<td class="white"><b>Outfit</b></td>
<?php endif; ?>
<td width="60%"><a href="?subtopic=online&order=name" class="white">Name</A></td> <td width="60%"><a href="?subtopic=online&order=name" class="white">Name</A></td>
<td width="20%"><a href="?subtopic=online&order=level" class="white">Level</A></td> <td width="20%"><a href="?subtopic=online&order=level" class="white">Level</A></td>
<td width="20%"><a href="?subtopic=online&order=vocation" class="white">Vocation</td> <td width="20%"><a href="?subtopic=online&order=vocation" class="white">Vocation</td>
@ -205,7 +215,31 @@ if($config['online_skulls']): ?>
endif; endif;
//search bar //search bar
echo '<BR><FORM ACTION="?subtopic=characters" METHOD=post> <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>'; echo '<br/>
<FORM ACTION="?subtopic=characters" METHOD=post>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR>
<TD BGCOLOR="'.$config['vdarkborder'].'" class="white">
<B>Search Character</B>
</TD>
</TR>
<TR>
<TD BGCOLOR="'.$config['darkborder'].'">
<TABLE BORDER=0 CELLPADDING=1>
<TR>
<TD>Name:</TD>
<TD>
<INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29>
</TD>
<TD>
<INPUT TYPE=image NAME="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FORM>';
/* temporary disable it - shows server offline /* temporary disable it - shows server offline
// update online players counter // update online players counter

View File

@ -12,10 +12,10 @@ defined('MYAAC') or die('Direct access not allowed!');
var category = '<?php var category = '<?php
if(in_array(PAGE, array('news', 'newsarchive'))) if(in_array(PAGE, array('news', 'newsarchive')))
echo 'news'; echo 'news';
elseif(in_array(PAGE, array('creatures', 'spells', 'online', 'serverinfo', 'downloads', 'commands', elseif(in_array(PAGE, array('creatures', 'spells', 'serverinfo', 'downloads', 'commands',
'movies', 'screenshots', 'experiencetable', 'faq'))) 'movies', 'screenshots', 'experiencetable', 'faq')))
echo 'library'; echo 'library';
elseif(in_array(PAGE, array('characters', 'guilds', 'highscores', 'wars', 'lastkills', 'houses', 'bans', elseif(in_array(PAGE, array('online', 'characters', 'guilds', 'highscores', 'wars', 'lastkills', 'houses', 'bans',
'forum', 'team'))) 'forum', 'team')))
echo 'community'; echo 'community';
elseif(in_array(PAGE, array('account', 'accountmanagement', 'createaccount', 'lostaccount', 'rules'))) elseif(in_array(PAGE, array('account', 'accountmanagement', 'createaccount', 'lostaccount', 'rules')))
@ -84,6 +84,8 @@ defined('MYAAC') or die('Direct access not allowed!');
</div> </div>
<div id="community-submenu"> <div id="community-submenu">
<a href="<?php echo $template['link_online']; ?>">Who is Online?</a>
<span class="separator"></span>
<a href="<?php echo $template['link_characters']; ?>">Characters</a> <a href="<?php echo $template['link_characters']; ?>">Characters</a>
<span class="separator"></span> <span class="separator"></span>
<a href="<?php echo $template['link_guilds']; ?>">Guilds</a> <a href="<?php echo $template['link_guilds']; ?>">Guilds</a>
@ -116,11 +118,9 @@ defined('MYAAC') or die('Direct access not allowed!');
</div> </div>
<div id="library-submenu"> <div id="library-submenu">
<!--a href="<?php echo $template['link_creatures']; ?>">Monsters</a> <a href="<?php echo $template['link_creatures']; ?>">Monsters</a>
<span class="separator"></span> <span class="separator"></span>
<a href="<?php echo $template['link_spells']; ?>">Spells</a> <a href="<?php echo $template['link_spells']; ?>">Spells</a>
<span class="separator"></span-->
<a href="<?php echo $template['link_online']; ?>">Who is Online?</a>
<span class="separator"></span> <span class="separator"></span>
<a href="<?php echo $template['link_serverInfo']; ?>">Server Info</a> <a href="<?php echo $template['link_serverInfo']; ?>">Server Info</a>
<span class="separator"></span> <span class="separator"></span>

View File

@ -696,137 +696,8 @@ echo "</div>";
<img class="Title" src="<?php echo $headline; ?>" alt="Contentbox headline" /> <img class="Title" src="<?php echo $headline; ?>" alt="Contentbox headline" />
<div class="Border_2"> <div class="Border_2">
<div class="Border_3"> <div class="Border_3">
<?php <?php $hooks->trigger(HOOK_TIBIACOM_BORDER_3); ?>
if(PAGE == 'news' && $config['lua']['serverName'] == "SlaskiOTS" && !isset($_GET['archive']) && !isset($_GET['id']))
{
?>
<div style="background-image:url(<?php echo $template_path; ?>/images/content/scroll.gif);">
<table style="clear:both; font-family: Verdana, Arial, Times New Roman, sans-serif;font-size: 10pt; padding: 8px" border=0 cellpadding=0 cellspacing=0 width="100%">
<tr><td>
Witaj na Śląskim serwerze.<br>Przed rozpoczęciem gry zapoznaj z podstroną <a href="<?php echo internalLayoutLink('serverInfo')?>">Server Info</a>.<br>
O pomoc w grze zawsze możesz poprosić na kanale <b>Help</b>.<br><br>
Ostatnio zarejestrował się:
<?php
$newestMember = $db->query('SELECT `name` FROM `players` ORDER BY `id` DESC LIMIT 1');
$newestMember = $newestMember->fetch();
echo getPlayerLink($newestMember['name']) . '. Witamy!';
?>
</td></tr>
</table>
</div>
<?php
if(tableExist('wodz_exphistory'))
{
$top_enabled = true;
function write_top($name, $list, $colspan = 2)
{
global $config;
echo '
<TD WIDTH=' . ($colspan == 2 ? '30' : '40') . '% VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=' . $colspan . ' class="white"><B>TOP 5 - ' . $name . '</B></TD>
</TR>';
$i = 1;
foreach($list as $str)
echo '<TR BGCOLOR='.getStyle($i++).'>' . $str . '</TR>';
echo
'</TABLE>
</TD>';
}
?>
<div class="BoxContent" style="background-image:url(<?php echo $template_path; ?>/images/content/scroll.gif);"> <div class="BoxContent" style="background-image:url(<?php echo $template_path; ?>/images/content/scroll.gif);">
<TABLE BORDER=0 WIDTH=100%>
<tr>
<?php
$vocation_name_short = array(
array(
1 => 'S',
2 => 'D',
3 => 'P',
4 => 'K'
),
array(
1 => 'MS',
2 => 'ED',
3 => 'RP',
4 => 'EK'
)
);
//players
$top_array = array();
$top_players_query = $db->query(
'SELECT `name`, `level`, `experience`, `vocation`, `promotion`, `online` FROM `players`' .
' WHERE players.deleted = 0 AND players.group_id < '.$config['highscores_groups_hidden'] .
' ORDER BY `experience` DESC' .
' LIMIT 5');
$i = 0;
foreach($top_players_query as $player)
{
$top_array[$i++] =
'<TD>' . $i . '.</TD>
<TD VALIGN=top>
<a href="' . getPlayerLink($player['name'], false) . '">'.($player['online']>0 ? "<font color=\"green\">".$player['name']."</font>" : "<font color=\"red\">".$player['name']."</font>").'</a>
<small>('.$player['level'].' '.$vocation_name_short[$player['promotion']][$player['vocation']].')</small>
</TD>';
}
write_top('<a href="' . internalLayoutLink('highscores') . '" class="white">Players</a>', $top_array);
//powergamers
$top_array = array();
$today = getZeroDay();
$top_powergamers_query = $db->query(
'SELECT `wodz_exphistory`.`exp_change` as exp_change, `name`, `players`.`level`, `players`.`experience`, `vocation`, `promotion`, `online`' .
' FROM `wodz_exphistory`, `players`' .
' WHERE players.id = wodz_exphistory.player_id AND `date` = ' . $today . ' ORDER BY `exp_change` DESC LIMIT 5');
$i = 0;
foreach($top_powergamers_query as $player)
{
$top_array[$i++] =
'<TD>' . $i . '.</TD>
<TD VALIGN=top>
<a href="' . getPlayerLink($player['name'], false) . '">'.($player['online']>0 ? "<font color=\"green\">".$player['name']."</font>" : "<font color=\"red\">".$player['name']."</font>").'</a>
<small>('.$player['level'].' '.$vocation_name_short[$player['promotion']][$player['vocation']].')</small>
</TD>
<TD><small>' . formatExperience($player['exp_change']) . '</small></TD>';
}
write_top('<a href="' . internalLayoutLink('powergamers') . '" class="white">Powergamers</a> (Today)', $top_array, 3);
//guilds
$top_array = array();
$top_guilds_query = $db->query(
'SELECT `name`, `total_level`' .
' FROM `guilds`' .
' ORDER BY `total_level` DESC' .
' LIMIT 5');
$i = 0;
foreach($top_guilds_query as $guild)
{
$top_array[$i++] =
'<TD>' . $i . '.</TD>
<TD>' . getGuildLink($guild['name']) . '</TD>
<TD><small>' . $guild['total_level'] . '</small></TD>';
}
write_top('<a href="' . internalLayoutLink('guilds') . '" class="white">Guilds</a>', $top_array, 3);
?>
</tr>
</table>
<?php
}
}
else
{
?>
<div class="BoxContent" style="background-image:url(<?php echo $template_path; ?>/images/content/scroll.gif);">
<?php
}
?>
<?php echo template_place_holder('center_top') . $content; ?> <?php echo template_place_holder('center_top') . $content; ?>
</div> </div>
</div> </div>