Reports refactor #1

-Removed 29 files from the "Templates/Notice" folder, there were a lot
of duplicated/very similar kinds of report. Now, there are only 6 kinds
of report (9.tpl isn't counted)
+Changed a lot of codes in some .tpl reports, into a foreach

Automation.php:

+Modified report data, for the refactored report system
+Some clean-up

Battle.php:

+Fixed catapults and rams, they weren't able to destroy completely a building
+Fixed a possible division by 0 error
This commit is contained in:
iopietro
2018-04-19 20:14:54 +02:00
parent 06fc62752a
commit 882215cd2a
41 changed files with 426 additions and 9017 deletions
+17 -40
View File
@@ -93,50 +93,27 @@ if(isset($_GET['newdid'])) {
?>
</div>
<?php
if ( isset( $_GET['aid'] ) ) {
if ( $_GET['aid'] != 0 ) {
if ( $session->alliance == $_GET['aid'] ) {
if ( isset( $_GET['id'] ) ) {
$ally = $database->getNotice2( preg_replace( "/[^a-zA-Z0-9_-]/", "", $_GET['id'] ), 'ally' );
if ( $session->alliance == $ally ) {
$type = $database->getNotice2( preg_replace( "/[^a-zA-Z0-9_-]/", "", $_GET['id'] ), 'ntype' );
if ( $type != 10 or $type != 11 or $type != 12 or $type != 13 or $type != 14 or $type != 15 or $type != 16 or $type != 17 ) {
include( "Templates/Notice/" . $type . "x.tpl" );
}
}
}
}
if (isset($_GET['id']))
{
if (isset($_GET['aid']) && $_GET['aid'] > 0 && $_GET['aid'] == $session->alliance)
{
$type = $database->getNotice2($_GET['id'], 'ntype');
if ($type >= 10 && $type <= 17) unset($type);
}
} else if ( isset( $_GET['vill'] ) ) {
if ( isset( $_GET['id'] ) ) {
$ally = $database->getNotice2( $_GET['id'], 'ally' );
if ( $database->getNotice2( preg_replace( "/[^a-zA-Z0-9_-]/", "", $_GET['id'] ), 'uid' ) == $session->uid ) {
$type = ( $message->readingNotice['ntype'] == 9 ) ? $message->readingNotice['archive'] : $message->readingNotice['ntype'];
include( "Templates/Notice/" . $type . ".tpl" );
} else if ( $session->alliance == $ally ) {
$type = $database->getNotice2( $_GET['id'], 'ntype' );
if ( $type != 10 or $type != 11 or $type != 12 or $type != 13 or $type != 14 or $type != 15 or $type != 16 or $type != 17 ) {
include( "Templates/Notice/" . $type . "x.tpl" );
}
}
elseif(isset($_GET['vill']) && $database->getNotice2($_GET['id'], 'ally') == $session->alliance)
{
$type = $database->getNotice2($_GET['id'], 'ntype');
if ($type >= 10 && $type <= 17) unset($type);
}
} else if ( isset( $_GET['id'] ) ) {
if ( $database->getNotice2( preg_replace( "/[^a-zA-Z0-9_-]/", "", $_GET['id'] ), 'uid' ) == $session->uid ) {
$type = ( $message->readingNotice['ntype'] == 9 ) ? $message->readingNotice['archive'] : $message->readingNotice['ntype'];
include( "Templates/Notice/" . $type . ".tpl" );
elseif($database->getNotice2(preg_replace("/[^a-zA-Z0-9_-]/", "", $_GET['id']), 'uid') == $session->uid)
{
$type = ($message->readingNotice['ntype'] == 9) ? $message->readingNotice['archive'] : $message->readingNotice['ntype'];
}
} else {
include( "Templates/Notice/all.tpl" );
if(isset($type)) include("Templates/Notice/".$message->getReportType($type).".tpl");
unset($type);
}
else include("Templates/Notice/all.tpl");
?>
</div>