* moved characters.php html code to Twig template

* moved news.php to Twig news.html template
* fixed some duplicated code in signature generators
* always check if name parameter is set when generating signatures
This commit is contained in:
slawkens
2017-09-01 17:00:29 +02:00
parent 37502c5562
commit d50fb7a291
14 changed files with 1139 additions and 1093 deletions

View File

@@ -66,18 +66,39 @@ Here you can tell other players about yourself. This information will be display
</tr>
{% endif %}
</table>
</div> </table></div></td></tr><br/>
</div>
</td>
</tr>
</table>
</div>
<br/>
<table width="100%">
<tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" ><tr>
<td style="border:0px;" >
<input type="hidden" name="changeinfosave" value="1" >
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="{{ template_path }}/images/buttons/_sbutton_submit.gif" ></div></div>
</td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" >
<form action="?subtopic=accountmanagement" method="post" >
<tr><td style="border:0px;" ><div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Back" alt="Back" src="{{ template_path }}/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></td></tr></table>
<tr align="center">
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td style="border:0px;" >
<input type="hidden" name="changeinfosave" value="1">
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)"><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="{{ template_path }}/images/buttons/_sbutton_submit.gif" ></div>
</div>
</td>
</tr>
</table>
</td>
<td>
</form>
<table border="0" cellspacing="0" cellpadding="0" >
<form action="?subtopic=accountmanagement" method="post" >
<tr>
<td style="border:0px;" >
<div class="BigButton" style="background-image:url({{ template_path }}/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);"><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/buttons/sbutton_over.gif);"></div><input class="ButtonText" type="image" name="Back" alt="Back" src="{{ template_path }}/images/buttons/_sbutton_back.gif" ></div>
</div>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,351 @@
{% set rows = 0 %}
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td><img src="<{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
{% 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:{% if player.getLookType() in [75, 266, 302] %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ outfit }}"></div>
{% endif %}
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Character Information</b></td>
</tr>
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Name:</td>
<td>{{ flag|raw }} <font color="{% if player.isOnline() %}green{% else %}red{% endif %}"><b>{{ player.getName() }}</b></font>{{ oldName }}</td>
</tr>
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Sex:</td>
<td>{{ sex }}</td>
</tr>
{% if marriage_enabled %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Marital status:</td>
<td>{{ marital_status }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Profession:</td>
<td>{{ vocation }}</td>
</tr>
{% if config.characters.level %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Level:</td>
<td>{{ player.getLevel() }}</td>
</tr>
{% endif %}
{% if config.characters.experience %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Experience:</td>
<td>{{ player.getExperience() }}</td>
</tr>
{% endif %}
{% if config.characters.magic_level %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Magic Level:</td>
<td>{{ player.getMagLevel() }}</td>
</tr>
{% endif %}
{% if frags_enabled %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Frags:</td>
<td>{{ frags_count }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Residence:</td>
<td>{{ town }}</td>
</tr>
{% if config.characters.balance %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Balance:</td>
<td>{{ player.getBalance() }} Gold Coins.</td>
</tr>
{% endif %}
{% if house.found %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>House:</td>
<td>
<table border="0">
<tr>
<td>{{ house.name ~ house.town ~ house.add }}</td>
<td>
<form action="?subtopic=houses&page=view" method="post">
<input type="hidden" name="house" value="{{ house.name }}">
<input type="image" name="View" alt="View" src="{{ template_path }}/images/buttons/sbutton_view.gif" border="0" width="120">
</form>
</td>
</tr>
</table>
</td>
</tr>
{% endif %}
{% if guild.rank is not null %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Guild membership:</td>
<td>{{ guild.rank }} of the {{ guild.link|raw }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Last login:</td>
<td>{% if player.getLastLogin() == 0 %}Never logged in.{% else %}{{ player.getLastLogin()|date("M d Y, H:i:s") }} CEST{% endif %}</td>
</tr>
{% if config.characters.creation_date %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Created:</td>
<td>{{ player.getCreated()|date("M d Y, H:i:s") }} CEST</td>
</tr>
{% endif %}
{% if comment is not null %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td valign="top">Comment:</td>
<td>{{ comment|raw }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Account Status:</td>
<td>{% if account.isPremium() %}Premium Account{% else %}Free Account{% endif %}</td>
</tr>
</table>
<br/>
<table border="0" width="100%">
<tr>
{% if config.characters.skills %}
<td width="30%" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><B>Skills</b></td>
</tr>
{% set i = 0 %}
{% for skill in skills %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td valign="top">{{ skill.name }}</td>
<td>{{ skill.value }}</td>
</tr>
{% endfor %}
</table>
</td>
{% endif %}
{% if quests_enabled %}
<td width="40%" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Quests</b></td>
</tr>
{% set i = 0 %}
{% for name, done in quests %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td valign="top">{{ name }}</TD>
<td><img src="images/{% if done %}true{% else %}false{% endif %}.png" border="0"/></td>
</tr>
{% endfor %}
</table>
</td>
{% endif %}
{% if config.characters.equipment %}
<td width="100" valign="top">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder}}">
<td colspan="2" class="white"><b>Equipment</b></td>
</tr>
<tr bgcolor="{{ getStyle(1) }}">
<td>
<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
<tr>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[2]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[6]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[9]|raw }}</td></tr>
<tr height="11px"><td>{% if skull is not null %}<img src="images/{{ skull }}.gif">{% endif %}</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[1]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[4]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[7]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[8]|raw }}</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">{{ equipment[3]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[5]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[10]|raw }}</td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
{% endif %}
</tr>
</table>
{{ deaths|raw }}
{{ frags|raw }}
{% if config.signature_enabled %}
<script type="text/javascript">
function showSignLinks()
{
if(document.getElementById('signLinks').style.display == "none")
{
document.getElementById('signLinks').style.display = "inline";
document.getElementById('signText').innerHTML = "Hide links";
}
else
{
document.getElementById('signLinks').style.display = "none";
document.getElementById('signText').innerHTML = "Show links";
}
}
</script>
<br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%"><tr bgcolor="{{ config.vdarkborder }}"><td colspan=2 class="white"><b>Signature</b></td></tr>
<tr bgcolor="{{ config.lightborder }}"><td align="center" valign="top">
<img src="{{ signature_url }}" alt="Signature for player {{ player.getName() }}">
<br/>
<b><a href="#" onclick="showSignLinks(); return false;" id="signText">Show links</a></b>
<br/>
<table id="signLinks" style="display: none;">
<tr>
<td>Website:</td>
<td><input type="text" value="<a href=&quot;{{ player_link }}&quot;><img src=&quot;{{ signature_url }}&quot;></a>" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Forum::</td>
<td><input type="text" value="[URL={{ player_link }}][IMG]{{ signature_url }}[/IMG][/URL]" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Direct link::</td>
<td><input type="text" value="{{ signature_url }}" style="width: 400px;" onclick="this.select()"></td>
</tr>
</table>
</td></tr>
</table>
{% endif %}
{% if hidden != 1 %}
{% set rows = 0 %}
<br/><br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan="2" class="white"><b>Account Information</b></td>
</tr>
{% set realName = account.getCustomField('rlname') %}
{% if realName is not empty %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Real name:</td>
<td>{{ realName }}</td>
</tr>
{% endif %}
{% set group = player.getGroup() %}
{% if group.isLoaded() and group.getId() != 1 %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td>Position:</td>
<td>{{ group.getName()|capitalize }}</td>
</tr>
{% endif %}
{% set realLocation = account.getCustomField('location') %}
{% if realLocation is not empty %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Location:</td>
<td>{{ realLocation }}</td>
</tr>
{% endif %}
{% set rows = rows + 1 %}
<tr bgcolor="{{ getStyle(rows) }}">
<td width="20%">Created:</td>
<td>{{ account.getCustomField("created")|date("j F Y, g:i a") ~bannedUntil }}</td>
</tr>
</table>
<br/><br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}">
<td colspan=4 class="white"><b>Characters</b></td>
</tr>
<tr bgcolor="{{ config.darkborder }}">
<td width="62%"><B>Name</b></td>
<td width="30%"><B>Level</b></td>
<td width="8%"><b>Status</b></td>
<td><b>&#160;</b></td>
</tr>
{% set i = 0 %}
{% for player in account_players %}
{% if not player.isHidden() %}
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td>
<nobr>{{ i }}.&#160;{{ player.getName() }}{% if player.isDeleted() %}<font color="red"> [DELETED]</font>{% endif %}</nobr>
</td>
{% set vocation = 'Unknown' %}
{% if config.vocations[player.getVocation()] is defined %}
{% set vocation = config.vocations[player.getVocation()] %}
{% endif %}
<td>{{ player.getLevel() }} {{ vocation }}</td>
<td>{% if player.isOnline() %}<b><font color="green">Online</font></b>{% endif %}</td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ characters_link }}" method=post>
<tr>
<td>
<input type="hidden" name="name" value="{{ player.getName() }}"/>
<input type="image" name="View {{ player.getName() }}" alt="View {{ player.getName() }}" src="{{ template_path }}/images/buttons/sbutton_view.gif" border="0" width="120" height="18"/>
</td>
</tr>
</form>
</table>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% endif %}
</td>
<td>
<img src="{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0">
</td>
</tr>
</table>
<br/><br/>{{ search_form|raw }}

View File

@@ -0,0 +1,23 @@
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url({{ template_path }}/images/news/newsheadline_background.gif)">
<img src="{{ template_path }}/images/news/icon_{{ icon }}.gif" class="NewsHeadlineIcon" />
<div class="NewsHeadlineDate">{{ date|date(news_date_format) }} - </div>
<div class="NewsHeadlineText">{{ title }}</div>
{% if author is not empty %}
<div class="NewsHeadlineAuthor"><b>Author: </b><i>{{ author }}</i></div>
{% endif %}
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >{{ content|raw }}</td>
</tr>
{% if comments is not null %}
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="{{ comments }}">» Comment on this news</a></div>
</td>
</tr>
{% endif %}
</table>
<br/>

View File

@@ -1,34 +0,0 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
function news_parse($title, $content, $date, $icon = 0, $author = '', $comments = '')
{
global $template_path, $config;
//$tmp = $template_path.'/images/letters/'.$content[0].'.gif';
//if(file_exists($tmp)) {
// $firstLetter = '<img src="' . $tmp . '" alt="'.$content[0].'" BORDER=0 ALIGN=bottom>';
//$content[0] = '';
//}
return '
<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $template_path . '/images/news/newsheadline_background.gif)">
<img src="' . $template_path . '/images/news/icon_' . $icon . '.gif" class=\'NewsHeadlineIcon\' />
<div class="NewsHeadlineDate">' . date($config['news_date_format'], $date) . ' - </div>
<div class="NewsHeadlineText">' . stripslashes($title) . '</div>
' . (isset($author[0]) ? '
<div class="NewsHeadlineAuthor"><b>Author: </b><i>' . $author . '</i></div>' : '') . '
</div>
</div>
<table style="clear:both" border=0 cellpadding=0 cellspacing=0 width="100%" >
<tr>
<td style="padding-left:10px;padding-right:10px;" >' . $content . '</td>
</tr>'
. (isset($comments[0]) ? '
<tr>
<td>
<div style="text-align: right; margin-right: 10px;"><a href="' . $comments . '">» Comment on this news</a></div>
</td>
</tr>' : '') .
'</table><br/>';
}
?>