diff --git a/GameEngine/Alliance.php b/GameEngine/Alliance.php index 0197ae4a..d83b601d 100755 --- a/GameEngine/Alliance.php +++ b/GameEngine/Alliance.php @@ -41,22 +41,23 @@ if (!$autoloader_found) { class Alliance { public $gotInvite = false; - public $inviteArray = array(); - public $allianceArray = array(); - public $userPermArray = array(); + public $inviteArray = []; + public $allianceArray = []; + public $userPermArray = []; public function procAlliance($get) { global $session, $database; - if($session->alliance != 0) { + if($session->alliance > 0) { $this->allianceArray = $database->getAlliance($session->alliance); // Permissions Array // [id] => id [uid] => uid [alliance] => alliance [opt1] => X [opt2] => X [opt3] => X [opt4] => X [opt5] => X [opt6] => X [opt7] => X [opt8] => X $this->userPermArray = $database->getAlliPermissions($session->uid, $session->alliance); } else { $this->inviteArray = $database->getInvitation($session->uid); - $this->gotInvite = count($this->inviteArray) == 0 ? false : true; + $this->gotInvite = count($this->inviteArray) > 0; } + if(isset($get['a'])) { switch($get['a']) { case 2: @@ -65,8 +66,6 @@ class Alliance { case 3: $this->acceptInvite($get); break; - default: - break; } } if(isset($get['o'])) { @@ -74,20 +73,37 @@ class Alliance { case 4: $this->delInvite($get); break; - default: - break; } } } /** - * Redirects to the option menu if some errors were generated + * Determines if a player can act with the forum (edit/delete/create things, etc.) + * + * @param array $datas The array which contains: [aid, alliance, forum_perm, admin, owner] + * @return bool Returns true if you are able to act, false otherwise */ - public function redirect() + public static function canAct($datas, $mode = 0){ + global $database, $session; + + return ($database->CheckEditRes($datas['aid']) == 1 && ((($database->isAllianceOwner($session->uid) == $datas['alliance'] || + ($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance'])) && + ($mode || (isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin"))) || + $datas['owner'] == $session->uid)); + } + + /** + * Redirects to the forum selection + * + * @param array $get Contains the values of a GET request + */ + + public function redirect($get) { - header("location: allianz.php?s=5"); - exit; + header("Location: allianz.php?s=2".(isset($get['fid']) && !empty($get['fid']) ? "&fid=".$get['fid']."" : ""). + (isset($get['admin']) && !empty($get['admin']) ? "&admin=switch_admin" : "")); + exit; } public function procAlliForm($post) { @@ -99,27 +115,20 @@ class Alliance { } } - if(isset($post['dipl']) && isset($post['a_name'])) { - $this->changediplomacy($post); - } + + if(isset($post['dipl']) && isset($post['a_name'])) $this->changediplomacy($post); if(isset($post['s'])) { if(isset($post['o'])) { switch($post['o']) { case 1: - if(isset($_POST['a'])) { - $this->changeUserPermissions($post); - } + if(isset($_POST['a'])) $this->changeUserPermissions($post); break; case 2: - if(isset($_POST['a_user'])) { - $this->kickAlliUser($post); - } + if(isset($_POST['a_user'])) $this->kickAlliUser($post); break; case 4: - if(isset($_POST['a']) && $_POST['a'] == 4) { - $this->sendInvite($post); - } + if(isset($_POST['a']) && $_POST['a'] == 4) $this->sendInvite($post); break; case 3: $this->updateAlliProfile($post); @@ -446,16 +455,16 @@ class Alliance { public function Vote($post) { global $database, $session; if($session->access != BANNED){ - if($database->checkSurvey($post['tid']) && !$database->checkVote($post['tid'], $session->uid)){ - $survey = $database->getSurvey($post['tid']); - $text = ''.$survey['voted'].','.$session->uid.','; - $database->Vote($post['tid'], $post['vote'], $text); - } - header("Location: allianz.php?s=2&fid2=".$post['fid2']."&pid=".$post['pid']."&tid=".$post['tid']); - exit; + if($database->checkSurvey($post['tid']) && !$database->checkVote($post['tid'], $session->uid)){ + $survey = $database->getSurvey($post['tid']); + $text = ''.$survey['voted'].','.$session->uid.','; + $database->Vote($post['tid'], $post['vote'], $text); + } + header("Location: allianz.php?s=2&fid2=".$post['fid2']."&tid=".$post['tid']); + exit; }else{ - header("Location: banned.php"); - exit; + header("Location: banned.php"); + exit; } } /***************************************** diff --git a/GameEngine/Database.php b/GameEngine/Database.php index c57efa4a..f064b404 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -2373,7 +2373,7 @@ class MYSQLi_DB implements IDbConnection { function ForumCat($id) { list($id) = $this->escape_input($id); - $q = "SELECT * from " . TB_PREFIX . "forum_cat where alliance = '$id' ORDER BY id"; + $q = "SELECT * from " . TB_PREFIX . "forum_cat where alliance = '$id' ORDER BY sorting DESC, id"; $result = mysqli_query($this->dblink,$q); return $this->mysqli_fetch_all($result); } @@ -2413,11 +2413,7 @@ class MYSQLi_DB implements IDbConnection { $q = "SELECT Count(*) as Total from " . TB_PREFIX . "forum_topic where cat = $id"; $result = mysqli_fetch_array(mysqli_query($this->dblink,$q), MYSQLI_ASSOC); - if ($result['Total']) { - return true; - } else { - return false; - } + return $result['Total'] > 0; } // no need to cache this method @@ -2426,11 +2422,7 @@ class MYSQLi_DB implements IDbConnection { $q = "SELECT Count(*) as Total from " . TB_PREFIX . "forum_edit where alliance = $alli"; $result = mysqli_fetch_array(mysqli_query($this->dblink,$q), MYSQLI_ASSOC); - if ($result['Total']) { - return true; - } else { - return false; - } + return $result['Total'] > 0; } // no need to cache this method @@ -2510,6 +2502,18 @@ class MYSQLi_DB implements IDbConnection { } } + function MoveForum($id, $area, $ally, $mode){ + list($id, $area, $ally, $mode) = $this->escape_input((int) $id, (int) $area, (int) $ally, $mode); + + $q = "UPDATE + ".TB_PREFIX."forum_cat + SET + sorting = (SELECT * FROM(SELECT ".(!$mode ? "MIN" : "MAX")."(sorting) FROM ".TB_PREFIX."forum_cat WHERE forum_area = $area AND alliance = $ally AND id != $id) f) ".(!$mode ? "-" : "+")." 1 + WHERE + id = $id"; + return mysqli_query($this->dblink, $q); + } + function UpdateEditTopic($id, $title, $cat) { list($id, $title, $cat) = $this->escape_input((int) $id, $title, $cat); @@ -2517,17 +2521,17 @@ class MYSQLi_DB implements IDbConnection { return mysqli_query($this->dblink,$q); } - function UpdateEditForum($id, $name, $des) { - list($id, $name, $des) = $this->escape_input((int) $id, $name, $des); + function UpdateEditForum($id, $name, $des, $ally) { + list($id, $name, $des, $ally) = $this->escape_input((int) $id, $name, $des, (int) $ally); - $q = "UPDATE " . TB_PREFIX . "forum_cat set forum_name = '$name', forum_des = '$des' where id = $id"; + $q = "UPDATE " . TB_PREFIX . "forum_cat SET forum_name = '$name', forum_des = '$des' WHERE id = $id AND alliance = $ally"; return mysqli_query($this->dblink,$q); } function StickTopic($id, $mode) { - list($id, $mode) = $this->escape_input((int) $id, $mode); + list($id, $mode) = $this->escape_input((int) $id, (int) $mode); - $q = "UPDATE " . TB_PREFIX . "forum_topic set stick = '$mode' where id = $id"; + $q = "UPDATE " . TB_PREFIX . "forum_topic SET stick = $mode WHERE id = $id"; return mysqli_query($this->dblink,$q); } @@ -2579,7 +2583,7 @@ class MYSQLi_DB implements IDbConnection { function CreatForum($owner, $alli, $name, $des, $area) { list($owner, $alli, $name, $des, $area) = $this->escape_input($owner, $alli, $name, $des, $area); - $q = "INSERT into " . TB_PREFIX . "forum_cat values (0,'$owner','$alli','$name','$des','$area')"; + $q = "INSERT into " . TB_PREFIX . "forum_cat values (0, 0,'$owner','$alli','$name','$des','$area')"; mysqli_query($this->dblink,$q); return mysqli_insert_id($this->dblink); } @@ -2719,7 +2723,8 @@ class MYSQLi_DB implements IDbConnection { list($id, $post, $alliance, $player, $coor, $report) = $this->escape_input((int) $id, $post, (int) $alliance, (int) $player, (int) $coor, (int) $report); $q = "UPDATE " . TB_PREFIX . "forum_topic set post = '$post', alliance0 = $alliance, player0 = $player, coor0 = $coor, report0 = $report where id = $id"; - return mysqli_query($this->dblink,$q); + + return mysqli_query($this->dblink, $q); } function EditUpdatePost($id, $post, $alliance, $player, $coor, $report) { @@ -2840,9 +2845,8 @@ class MYSQLi_DB implements IDbConnection { if(mysqli_num_rows($result)) { $result = mysqli_fetch_assoc($result); $result = $result['id']; - } else { - $result = false; - } + } + else $result = false; self::$allianceOwnerCheckCache[$id] = $result; return self::$allianceOwnerCheckCache[$id]; diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index f16472c9..0520c8e3 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -88,6 +88,7 @@ define("OFFERED_CONFED_TO","offered a confederation to"); define("ALLY_TOO_MUCH_PACTS","Either You cannot offer more pacts of this kind or this alliance has reached the limit for this kind of patcs"); define("ALLY_PERMISSIONS_UPDATED","Permissions updated"); define("ALLY_FORUM_LINK_UPDATED", "Forum link updated"); +define("NO_FORUMS_YET","There are no forums yet."); define("ALLY_USER_KICKED"," has been kicked from the alliance"); define("NOT_OPENED_YET","Server not started yet."); define("REGISTER_CLOSED","The register is closed. You can't register to this server."); diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl index 612c7f56..b0e477b5 100644 --- a/Templates/Alliance/Forum/forum_10.tpl +++ b/Templates/Alliance/Forum/forum_10.tpl @@ -1,386 +1,322 @@ access!=BANNED) { - $topic_id = $_GET['pod']; - $post_id = $_GET['pod']; - $topics = $database->ShowTopic( $topic_id ); - $posts = $database->ShowPostEdit( $post_id ); - foreach ( $topics as $top ) { - $title = stripslashes( $top['title'] ); - } - foreach ( $posts as $pos ) { - $poss = stripslashes( $pos['post'] ); - $poss = preg_replace( '/\[message\]/', '', $poss ); - $poss = preg_replace( '/\[\/message\]/', '', $poss ); - $alliance0 = $pos['alliance0']; - $player0 = $pos['player0']; - $owner = $pos['owner']; - $coor0 = $pos['coor0']; - $report0 = $pos['report0']; - } +// ########################################################### +// # DO NOT REMOVE THIS NOTICE ## +// # MADE BY TTMTT ## +// # FIX BY RONIX ## +// # TRAVIANZ ## +// ########################################################### +if($session->access == BANNED){ + header("Location: banned.php"); + exit(); +} - if ( $owner == $session->uid ) { - ?> -
- - - - - - - - - - - - - - - - - +$topic_id = $_GET['tid']; +$post_id = $_GET['pod']; +$topics = reset($database->ShowTopic($topic_id)); +$posts = $database->ShowPostEdit($post_id); - +//Check if we're modifying a valid post +if(empty($topics) || empty($posts)) $alliance->redirect($_GET); - - - + + +
Edit answer
Thread
- +$title = stripslashes($topics['title']); -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
+foreach($posts as $pos){ + $poss = stripslashes($pos['post']); + $poss = preg_replace('/\[message\]/', '', $poss); + $poss = preg_replace('/\[\/message\]/', '', $poss); + $alliance0 = $pos['alliance0']; + $player0 = $pos['player0']; + $owner = $pos['owner']; + $coor0 = $pos['coor0']; + $report0 = $pos['report0']; +} + ?> + + + + + + + + + + + + -
-
-
- Wood - Clay - Iron - Crop -
-
*aha**angry**cool**cry**cute**depressed**eek**ehem**emotional*:D:)*hit**hmm**hmpf**hrhr**huh**lazy**love**nocomment**noemotion**notamused**pout**redface**rolleyes*:(*shy**smile**tongue**veryangry**veryhappy*;)
-
LegionnairePraetorianImperianEquites LegatiEquites ImperatorisEquites CaesarisRamFire CatapultSenatorSettlerMacemanSpearmanAxemanScoutPaladinTeutonic KnightRamCatapultChieftainSettlerPhalanxSwordsmanPathfinderTheutates ThunderDruidriderHaeduanBattering RamTrebuchetChiefSettlerRatSpiderSnakeBatWild BoarWolfBearCrocodileTigerElephantPikemanThorned WarriorGuardsmanBirds of PreyAxeriderNatarian KnightWar ElephantBallistaNatarian EmperorSettlerHero -
-
- -
+ - -
- + + + - - -
Edit answer
Thread
- -
+
-

- Warning: you can't use the values [message] or [/message] in your post because it can cause problem with bbcode system. - \ No newline at end of file +

+ + + +

+Warning: you can't use the values [message] + or [/message] in your post because it can cause problem with + bbcode system. \ No newline at end of file diff --git a/Templates/Alliance/Forum/forum_2.tpl b/Templates/Alliance/Forum/forum_2.tpl index 55237888..978f0dc9 100644 --- a/Templates/Alliance/Forum/forum_2.tpl +++ b/Templates/Alliance/Forum/forum_2.tpl @@ -1,27 +1,32 @@ access!=BANNED){ -$displayarray = $database->getUserArray($session->uid,1); +// ########################################################### +// # DO NOT REMOVE THIS NOTICE ## +// # MADE BY TTMTT ## +// # FIX BY RONIX ## +// # TRAVIANZ ## +// ########################################################### +if($session->access == BANNED){ + header("Location: banned.php"); + exit(); +} + +$opt = $database->getAlliPermissions($session->uid, $aid); +$displayarray = $database->getUserArray($session->uid, 1); $forumcat = $database->ForumCat(htmlspecialchars($displayarray['alliance'])); $ally = $session->alliance; -$public = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 1"), MYSQLI_ASSOC); -$public1 = $public['Total']; -$cofederation = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 2"), MYSQLI_ASSOC); -$cofederation1 = $cofederation['Total']; -$alliance = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 0"), MYSQLI_ASSOC); -$alliance1 = $alliance['Total']; -$closed = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 3"), MYSQLI_ASSOC); -$closed1 = $closed['Total']; -if($public1 != 0){ +$public = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 1"), MYSQLI_ASSOC); +$confederation = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 2"), MYSQLI_ASSOC); +$alliance = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 0"), MYSQLI_ASSOC); +$closed = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT Count(*) as Total FROM ".TB_PREFIX."forum_cat WHERE alliance = $ally AND forum_area = 3"), MYSQLI_ASSOC); +$countArray = [$alliance['Total'], $public['Total'], $confederation['Total'], $closed['Total']]; +$forumArea = ["Alliance Forum", "Public Forum", "Confederation Forum", "Closed Forum"]; + +foreach($countArray as $index => $count){ ?> - +
+ - + @@ -29,232 +34,67 @@ if($public1 != 0){ - + + + CountCat($arr['id']); - $lpost = ""; - $owner = ""; - if ($countop>0) { - $ltopic = $database->LastTopic($arr['id']); - foreach($ltopic as $las){} - $lpos = $database->LastPost($las['id']); - foreach($lpos as $pos){} - if($database->CheckLastTopic($arr['id'])){ - if($database->CheckLastPost($las['id'])){ - $lpost = date('m/d/y H:i a',$pos['date']); - $owner = $database->getUserArray($pos['owner'],1); - }else{ - $lpost = date('m/d/y H:i a',$las['date']); - $owner = $database->getUserArray($las['owner'],1); +if($count == 0) echo ""; + +foreach($forumcat as $arr){ + if($arr['forum_area'] != $index) continue; + + $countop = $database->CountCat($arr['id']); + $lpost = $owner = ""; + if($countop > 0){ + $ltopic = $database->LastTopic($arr['id']); + foreach($ltopic as $las){ + $lpos = $database->LastPost($las['id']); + if($database->CheckLastTopic($arr['id'])){ + //If there are no posts yet, show the topic + if($database->CheckLastPost($las['id']) == 0){ + $lpost = date('m/d/y H:i a', $las['date']); + $owner = $database->getUserArray($las['owner'], 1); + }else{ + foreach($lpos as $pos){ + $lpost = date('m/d/y H:i a', $pos['date']); + $owner = $database->getUserArray($pos['owner'], 1); } - } - } - echo ' - '; - + if(!empty($owner)){ + echo ''.$owner['username'].'Show last post'; } -} -?> -
Public Forum
Forum name  Threads   Last post 
".NO_FORUMS_YET."
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arr['id'] || $arr['owner'] == $session->uid)){ - echo ' + } + } + } + } + + echo '
'; + if($database->CheckEditRes($aid) == 1 && ($database->isAllianceOwner($session->uid) == $arr['alliance'] || $opt['opt5'] == 1) && isset($_GET['admin']) && !empty($_GET['admin']) && $_GET['admin'] == "switch_admin"){ + echo ' To top edit
- + To bottom delete'; - }else{ - echo 'Thread without new posts'; - } - echo '
+ } + else echo 'Thread without new posts'; + + echo ' '.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).'
'.$countop.' '.$lpost.'
'; - if ($owner!="") { - echo ''.$owner['username'].' Show last post'; - } - echo '
- - - - - - - - - - - - -CountCat($arr['id']); - $lpost = ""; - $owner = ""; - if ($countop>0) { - $ltopic = $database->LastTopic($arr['id']); - foreach($ltopic as $las){} - $lpos = $database->LastPost($las['id']); - foreach($lpos as $pos){} - if($database->CheckLastTopic($arr['id'])){ - if($database->CheckLastPost($las['id'])){ - $lpost = date('m/d/y H:i a',$pos['date']); - $owner = $database->getUserArray($pos['owner'],1); - }else{ - $lpost = date('m/d/y H:i a',$las['date']); - $owner = $database->getUserArray($las['owner'],1); - } - } - } - echo ' - - + echo ''; - - } } ?> -
Confederation Forum
Forum name Threads  Last post 
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arr['id'] || $arr['owner'] == $session->uid)){ - echo 'To topedit
To bottomdelete'; - }else{ - echo 'Thread without new posts'; - } - echo '
- '.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).'
'.$countop.''.$lpost.'
'; - if ($owner!="") { - echo ''.$owner['username'].' Show last post'; - } - echo '
- - - - - - - - - - - - -CountCat($arr['id']); - $lpost = ""; - $owner = ""; - if ($countop>0) { - $ltopic = $database->LastTopic($arr['id']); - foreach($ltopic as $las){} - $lpos = $database->LastPost($las['id']); - foreach($lpos as $pos){} - if($database->CheckLastTopic($arr['id'])){ - if($database->CheckLastPost($las['id'])){ - $lpost = date('m/d/y H:i a',$pos['date']); - $owner = $database->getUserArray($pos['owner'],1); - }else{ - $lpost = date('m/d/y H:i a',$las['date']); - $owner = $database->getUserArray($las['owner'],1); - } - } - } - echo ' - - - '; - - } - } -?> -
Alliance Forum
Forum name Threads  Last post 
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arr['id'] || $arr['owner'] == $session->uid)){ - echo 'To topedit
To bottomdelete'; - }else{ - echo 'Thread without new posts'; - } - echo '
'.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).'
'.$countop.''.$lpost.'
'; - if ($owner!="") { - echo ''.$owner['username'].' Show last post'; - } - echo '
- - - - - - - - - - - - -CountCat($arr['id']); - $lpost = ""; - $owner = ""; - if ($countop>0) { - $ltopic = $database->LastTopic($arr['id']); - foreach($ltopic as $las){} - $lpos = $database->LastPost($las['id']); - foreach($lpos as $pos){} - if($database->CheckLastTopic($arr['id'])){ - if($database->CheckLastPost($las['id'])){ - $lpost = date('m/d/y H:i a',$pos['date']); - $owner = $database->getUserArray($pos['owner'],1); - }else{ - $lpost = date('m/d/y H:i a',$las['date']); - $owner = $database->getUserArray($las['owner'],1); - } - } - } - echo ' - - - '; - - } -} -?> -
Closed Forum
Forum name Threads  Last post 
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arr['id'] || $arr['owner'] == $session->uid)){ - echo 'To topedit
To bottomdelete'; - }else{ - echo 'Thread without new posts'; - } - echo '
'.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).'
'.$countop.''.$lpost.'
'; - if ($owner!="") { - echo ''.$owner['username'].' Show last post'; - } - echo '
+ + + +

New forum + Toggle Admin mode'; } ?> -

- getAlliPermissions($session->uid, $aid); - if($opt['opt5'] == 1){ - echo 'New forum - Toggle Admin mode'; - } - ?> -

- \ No newline at end of file +

\ No newline at end of file diff --git a/Templates/Alliance/Forum/forum_3.tpl b/Templates/Alliance/Forum/forum_3.tpl index 0fc302a3..bd3649c9 100644 --- a/Templates/Alliance/Forum/forum_3.tpl +++ b/Templates/Alliance/Forum/forum_3.tpl @@ -5,48 +5,41 @@ ## FIX BY RONIX ## ## TRAVIANZ ## ############################################################ -if($session->access!=BANNED){ -$topic_id = $_GET['idt']; -$show_topic = $database->ShowTopic($topic_id); -foreach($show_topic as $topi) { - $title = stripslashes($topi['title']); +if($session->access == BANNED){ + header("Location: banned.php"); + exit; } + +$topicID = $_GET['idt']; +$showTopic = reset($database->ShowTopic($topicID)); +$title = stripslashes($showTopic['title']); ?> -
+ - + - - -
Edit topic + Edit topic
Thread
Move topic + Move topic
-

- +

diff --git a/Templates/Alliance/Forum/forum_4.tpl b/Templates/Alliance/Forum/forum_4.tpl index c7bba026..893042bc 100644 --- a/Templates/Alliance/Forum/forum_4.tpl +++ b/Templates/Alliance/Forum/forum_4.tpl @@ -5,14 +5,22 @@ ## FIX BY RONIX ## ## TRAVIANZ ## ############################################################ -if($session->access!=BANNED){ +if($session->access == BANNED){ + header("Location: banned.php"); + exit; +} + $cat_id = $_GET['fid']; $CatName = stripslashes($database->ForumCatName($cat_id)); + +//Check if we're viewing a valid forum +if(empty($CatName)) $alliance->redirect($_GET); + +$opt = $database->getAlliPermissions($session->uid, $aid); $ChckTopic = $database->CheckCatTopic($cat_id); -$Topics = $database->ForumCatTopic($cat_id); -$TopicsStick = $database->ForumCatTopicStick($cat_id); +$Topics = array_merge($database->ForumCatTopic($cat_id), $database->ForumCatTopicStick($cat_id)); ?> -

Alliance ->

+

Alliance ->

@@ -24,7 +32,10 @@ $TopicsStick = $database->ForumCatTopicStick($cat_id); $aid, 'alliance' => $arrs['alliance'], 'forum_perm' => $opt['opt5'], + 'owner' => $arrs['owner'], 'admin' => $_GET['admin']]; + $CountPosts = $database->CountPost($arrs['id']); $lposts = $database->LastPost($arrs['id']); foreach($lposts as $post) { @@ -38,56 +49,28 @@ if($ChckTopic){ } echo ' - - - '; - - } - - foreach($Topics as $arr) { - $CountPost = $database->CountPost($arr['id']); - $lpost = $database->LastPost($arr['id']); - foreach($lpost as $pos) { - } - if($database->CheckLastPost($arr['id'])){ - $post_date = date('m/d/y, H:i a',$pos['date']); - $owner_topic = $database->getUserArray($pos['owner'],1); - }else{ - $post_date = date('m/d/y, H:i a',$arr['date']); - $owner_topic = $database->getUserArray($arr['owner'],1); - } - - echo ' - - - + + '; } @@ -100,14 +83,8 @@ echo '
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arrs['id'] || $arrs['owner'] == $session->uid)){ + if(Alliance::canAct($checkArray)) + { if($database->CheckCloseTopic($arrs['id']) == 1){ $locks = 'open topic'; }else{ $locks = 'close topic'; } - echo ''.$locks.'edit
stick topicdelete'; - }elseif($arrs['close']=="1"){ - echo 'Closed Thread without new posts'; - }else{ - echo 'Important Thread without new posts'; - } - echo '
'.stripslashes($arrs['title']).'
'.$CountPosts.''.$post_dates.'
'.$owner_topics['username'].' Show last post -
'; - if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $arr['id'] || $arr['owner'] == $session->uid)){ - if($database->CheckCloseTopic($arr['id']) == 1){ - $lock = 'open topic'; + if($arrs['stick'] == 1){ + $pin = 'Unstick topic'; }else{ - $lock = 'close topic'; + $pin = 'Stick topic'; } - echo ''.$lock.'edit
stick topicdelete'; - }elseif($arr['close']=="1"){ - echo 'Closed Thread without new posts'; + echo $locks.'edit
'.$pin.'delete'; + }elseif($arrs['close'] == 1){ + echo 'Closed Thread without new posts'; }else{ - echo 'Thread without new posts'; + echo ''.($arrs['stick'] == 1 ? 'Important ' : '').'Thread without new posts'; } echo '
'.stripslashes($arr['title']).'
'.$CountPost.''.$post_date.'
'.$owner_topic['username'].' Show last post +
'.stripslashes($arrs['title']).'
'.$CountPosts.''.$post_dates.'
'.$owner_topics['username'].' Show last post

Post new thread getAlliPermissions($session->uid, $aid); if(isset($opt['opt5']) && $opt['opt5']== 1){ - echo 'Toggle Admin mode'; + echo 'Toggle Admin mode'; } ?> -

- \ No newline at end of file +

\ No newline at end of file diff --git a/Templates/Alliance/Forum/forum_5.tpl b/Templates/Alliance/Forum/forum_5.tpl index 27dde5f1..c8394eb5 100644 --- a/Templates/Alliance/Forum/forum_5.tpl +++ b/Templates/Alliance/Forum/forum_5.tpl @@ -5,11 +5,14 @@ ## FIX BY RONIX ## ## TRAVIANZ ## ############################################################ -if($session->access!=BANNED){ +if($session->access == BANNED){ + header("Location: banned.php"); + exit; +} + ?> -
+ - @@ -108,7 +111,7 @@ Option 8: ends on -