mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Alliance forum fixes part 2
+Added the "Forum" link to the game menu (above Game Rules), player without an alliance, will be able to access to public forums only +All players can now open public forums (even without an alliance), post to them, edit and delete them +Added the possility to add alliances and players to the "Who can view this forum" list, the graphic was present but there wasn't the database and code support (conditions aren't coded yet) +General fixes NOTE: To play this version without reinstalling the server, you have to run this simple query: ALTER TABLE s1_forum_cat ADD (`display_to_alliances` text, `display_to_users` text)
This commit is contained in:
+45
-3
@@ -80,7 +80,7 @@ class Alliance {
|
||||
/**
|
||||
* 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]
|
||||
* @param array $datas The array which contains: [aid, alliance, forum_perm, admin, owner, forum_owner]
|
||||
* @return bool Returns true if you are able to act, false otherwise
|
||||
*/
|
||||
|
||||
@@ -88,9 +88,51 @@ class Alliance {
|
||||
global $database, $session;
|
||||
|
||||
return (/*$database->CheckEditRes($datas['aid']) == 1 && */((($database->isAllianceOwner($session->uid) == $datas['alliance'] ||
|
||||
($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance'])) &&
|
||||
($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance'])) && $session->alliance > 0 &&
|
||||
($mode || (isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin"))) ||
|
||||
$datas['owner'] == $session->uid));
|
||||
$datas['owner'] == $session->uid) || ($datas['forum_owner'] == $session->uid && $datas['alliance'] == 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create two string, representing alliances ID and users ID which can see a specific forum
|
||||
*
|
||||
* @param int $alliancesID A list of alliances ID
|
||||
* @param int $alliancesName A list of alliances Name
|
||||
* @param int $usersID A list of users ID
|
||||
* @param int $usersName A list of users name
|
||||
* @return array Returns the two string, composed by alliances ID and users ID
|
||||
*/
|
||||
|
||||
public function createForumVisiblity($alliancesID, $alliancesName, $usersID, $usersName){
|
||||
global $database, $session;
|
||||
|
||||
$alliances = $users = [];
|
||||
|
||||
//Deduplicate alliances
|
||||
if(!empty($alliancesID)){
|
||||
foreach($alliancesID as $alliance){
|
||||
if(!empty($alliance) && is_numeric($alliance) && $database->aExist($alliance, 'id') && $alliance != $session->alliance) $alliances[$alliance] = true;
|
||||
}
|
||||
}
|
||||
if(!empty($alliancesName)){
|
||||
foreach($alliancesName as $alliance){
|
||||
if(!empty($alliance) && !empty($allianceID = $database->getAllianceID($alliance)) && $allianceID != $session->alliance) $alliances[$allianceID] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Deduplicate users
|
||||
if(!empty($usersID)){
|
||||
foreach($usersID as $user) {
|
||||
if(!empty($user) && is_numeric($user) && ($userAlly = $database->getUserAllianceID($user)) > 0 && $userAlly != $session->alliance && $database->getUserField($user, 'username', 0) != "[?]" && $user != $session->uid) $users[$user] = true;
|
||||
}
|
||||
}
|
||||
if(!empty($usersName)){
|
||||
foreach($usersName as $user){
|
||||
if(!empty($user) && !empty($userID = $database->getUserField($user, 'id', 1)) && $userID != $session->uid && ($userAlly = $database->getUserAllianceID($userID)) > 0 && $userAlly != $session->alliance) $users[$userID] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ['alliances' => implode(',', array_keys($alliances)), 'users' => implode(',', array_keys($users))];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-11
@@ -2517,10 +2517,10 @@ class MYSQLi_DB implements IDbConnection {
|
||||
return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
|
||||
function UpdateEditForum($id, $name, $des, $ally) {
|
||||
list($id, $name, $des, $ally) = $this->escape_input((int) $id, $name, $des, (int) $ally);
|
||||
function UpdateEditForum($id, $name, $des, $ally, $alliances, $users) {
|
||||
list($id, $name, $des, $ally, $alliances, $users) = $this->escape_input((int) $id, $name, $des, (int) $ally, $alliances, $users);
|
||||
|
||||
$q = "UPDATE " . TB_PREFIX . "forum_cat SET forum_name = '$name', forum_des = '$des' WHERE id = $id AND alliance = $ally";
|
||||
$q = "UPDATE " . TB_PREFIX . "forum_cat SET forum_name = '$name', forum_des = '$des', display_to_alliances = '$alliances', display_to_users = '$users' WHERE id = $id AND alliance = $ally";
|
||||
return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
|
||||
@@ -2576,10 +2576,10 @@ class MYSQLi_DB implements IDbConnection {
|
||||
return $this->mysqli_fetch_all($result);
|
||||
}
|
||||
|
||||
function CreatForum($owner, $alli, $name, $des, $area) {
|
||||
list($owner, $alli, $name, $des, $area) = $this->escape_input($owner, $alli, $name, $des, $area);
|
||||
function CreatForum($owner, $alli, $name, $des, $area, $alliances, $users) {
|
||||
list($owner, $alli, $name, $des, $area, $alliances, $users) = $this->escape_input($owner, $alli, $name, $des, $area, $alliances, $users);
|
||||
|
||||
$q = "INSERT into " . TB_PREFIX . "forum_cat values (0, 0,'$owner','$alli','$name','$des','$area')";
|
||||
$q = "INSERT into " . TB_PREFIX . "forum_cat values (0, 0,'$owner','$alli','$name','$des','$area','$alliances','$users')";
|
||||
mysqli_query($this->dblink,$q);
|
||||
return mysqli_insert_id($this->dblink);
|
||||
}
|
||||
@@ -2870,11 +2870,7 @@ class MYSQLi_DB implements IDbConnection {
|
||||
|
||||
$q = "SELECT $type FROM " . TB_PREFIX . "alidata where $type = '$ref'";
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
if(mysqli_num_rows($result)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return mysqli_num_rows($result);
|
||||
}
|
||||
|
||||
function modifyPoints($aid, $points, $amt) {
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access!=BANNED){
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
@@ -128,9 +131,11 @@ function showCheckList() {
|
||||
|
||||
<tr>
|
||||
<th>Forum type</th>
|
||||
<td><select class="dropdown" id="bid" name="bid" onchange="showCheckList();"><option value="1">Public Forum</option><option value="2">Confederation Forum</option><option value="0"selected>Alliance Forum</option><option value="3">Closed Forum</option></select></td>
|
||||
<td><select class="dropdown" id="bid" name="bid" onchange="showCheckList();"><option value="1">Public Forum</option><?php if($session->alliance == 0 && $opt['opt5'] == 1) { ?><option value="2">Confederation Forum</option><option value="0" selected>Alliance Forum</option><option value="3">Closed Forum</option><?php } ?></select></td>
|
||||
</tr>
|
||||
</tbody></table><table cellpadding="1" cellspacing="1" id="ally_list"><thead>
|
||||
</tbody></table>
|
||||
<?php if($session->alliance > 0 && $opt['opt5'] == 1){ ?>
|
||||
<table cellpadding="1" cellspacing="1" id="ally_list"><thead>
|
||||
<tr>
|
||||
|
||||
<th colspan="3">Open for more alliances</th>
|
||||
@@ -178,15 +183,9 @@ function showCheckList() {
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
showCheckList();
|
||||
|
||||
</script>
|
||||
|
||||
<p class="btn"><input type="image" id="fbtn_ok" value="ok" name="s1" class="dynamic_img" src="img/x.gif" alt="OK" /></p></form>
|
||||
<?php }else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
<p class="btn"><input type="image" id="fbtn_ok" value="ok" name="s1" class="dynamic_img" src="img/x.gif" alt="OK" /></p></form>
|
||||
@@ -19,9 +19,10 @@ $confederation = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT Coun
|
||||
$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"];
|
||||
$forumArea = ["Alliance Forum(s)", "Public Forum(s)", "Confederation Forum(s)", "Closed Forum(s)"];
|
||||
|
||||
foreach($countArray as $index => $count){
|
||||
if($session->alliance > 0 || ($session->alliance == 0 && $index == 1)){
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="public">
|
||||
<thead>
|
||||
@@ -36,15 +37,15 @@ foreach($countArray as $index => $count){
|
||||
<td> Last post </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody>
|
||||
<?php
|
||||
if($count == 0) echo "<tr><td colspan=\"4\" style=\"text-align: center\">".NO_FORUMS_YET."</td></tr>";
|
||||
|
||||
if($count == 0) echo "<tr><td colspan=\"4\" style=\"text-align: center\">".NO_FORUMS_YET."</td></tr>";
|
||||
}
|
||||
foreach($forumcat as $arr){
|
||||
if($arr['forum_area'] != $index) continue;
|
||||
if($arr['forum_area'] != $index || ($session->alliance == 0 && $arr['forum_area'] != 1)) continue;
|
||||
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $arr['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => 0, 'admin' => $_GET['admin']];
|
||||
'owner' => $arr['owner'], 'admin' => $_GET['admin'], 'forum_owner' => $arr['owner']];
|
||||
|
||||
$countop = $database->CountCat($arr['id']);
|
||||
$lpost = $owner = "";
|
||||
@@ -92,10 +93,10 @@ foreach($forumcat as $arr){
|
||||
</table>
|
||||
<?php } ?>
|
||||
<p>
|
||||
<?php
|
||||
if(isset($opt['opt5']) && $opt['opt5'] == 1){
|
||||
echo '<a href="allianz.php?s=2&admin=newforum"><img id="fbtn_newforum" class="dynamic_img" src="img/x.gif" alt="New forum" /></a>
|
||||
<a href="allianz.php?s='.$ids.((isset($_GET['admin']) && !empty($_GET['admin']) && $_GET['admin'] == "switch_admin") ? "" : "&admin=switch_admin").'" title="Toggle Admin mode"><img class="switch_admin dynamic_img" src="img/x.gif" alt="Toggle Admin mode" /></a>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
echo '<a href="allianz.php?s=2&admin=newforum"><img id="fbtn_newforum" class="dynamic_img" src="img/x.gif" alt="New forum" /></a>';
|
||||
if(isset($opt['opt5']) && $opt['opt5'] == 1){
|
||||
echo '<a href="allianz.php?s='.$ids.((isset($_GET['admin']) && !empty($_GET['admin']) && $_GET['admin'] == "switch_admin") ? "" : "&admin=switch_admin").'" title="Toggle Admin mode"><img class="switch_admin dynamic_img" src="img/x.gif" alt="Toggle Admin mode" /></a>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
@@ -12,13 +12,13 @@ if($session->access == BANNED){
|
||||
|
||||
$topicID = $_GET['idt'];
|
||||
$showTopic = reset($database->ShowTopic($topicID));
|
||||
$forumData = reset($database->ForumCatEdit($showTopic['cat']));
|
||||
$title = stripslashes($showTopic['title']);
|
||||
?>
|
||||
<form method="post" action="allianz.php?s=2&fid=<?php echo $_GET['fid']; ?>">
|
||||
<input type="hidden" name="s" value="2">
|
||||
<input type="hidden" name="tid" value="<?php echo $topicID; ?>">
|
||||
<input type="hidden" name="edittopic" value="1">
|
||||
|
||||
<table cellpadding="1" cellspacing="1" id="edit_topic"><thead>
|
||||
<tr>
|
||||
<td colspan="2">Edit topic</td>
|
||||
@@ -32,8 +32,11 @@ $title = stripslashes($showTopic['title']);
|
||||
<td>Move topic</td>
|
||||
<td><select class="dropdown" name="fid">
|
||||
<?php
|
||||
$show_cat = $database->ForumCat($session->alliance);
|
||||
$show_cat = $database->ForumCat($forumData['alliance']);
|
||||
foreach($show_cat as $cats) {
|
||||
//If the forum has no alliance, show only his public forums
|
||||
if($forumData['alliance'] == 0 && $forumData['owner'] != $cats['owner']) continue;
|
||||
|
||||
if($cats['id'] == $_GET['fid']) echo '<option value="'.$cats['id'].'" selected>'.stripslashes($cats['forum_name']).'</option>';
|
||||
else echo '<option value="'.$cats['id'].'">'.stripslashes($cats['forum_name']).'</option>';
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ if($session->access == BANNED){
|
||||
}
|
||||
|
||||
$cat_id = $_GET['fid'];
|
||||
$CatName = stripslashes($database->ForumCatName($cat_id));
|
||||
$forumData = reset($database->ForumCatEdit($cat_id));
|
||||
$CatName = stripslashes($forumData['forum_name']);
|
||||
|
||||
//Check if we're viewing a valid forum
|
||||
if(empty($CatName)) $alliance->redirect($_GET);
|
||||
@@ -34,7 +35,7 @@ $Topics = array_merge($database->ForumCatTopic($cat_id), $database->ForumCatTopi
|
||||
if($ChckTopic){
|
||||
foreach($Topics as $arrs) {
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $arrs['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => $arrs['owner'], 'admin' => $_GET['admin']];
|
||||
'owner' => $arrs['owner'], 'admin' => $_GET['admin'], 'forum_owner' => $forumData['owner']];
|
||||
|
||||
$CountPosts = $database->CountPost($arrs['id']);
|
||||
$lposts = $database->LastPost($arrs['id']);
|
||||
|
||||
@@ -21,7 +21,8 @@ $posts = $database->ShowPost($tid);
|
||||
foreach($topics as $arr){
|
||||
$cat_id = $arr['cat'];
|
||||
$owner = $database->getUserArray($arr['owner'], 1);
|
||||
$CatName = stripslashes($database->ForumCatName($cat_id));
|
||||
$forumData = reset($database->ForumCatEdit($cat_id));
|
||||
$CatName = stripslashes($forumData['forum_name']);
|
||||
$allianceinfo = $database->getAlliance($owner['alliance']);
|
||||
}
|
||||
$date = date('m/d/y H:i a', $arr['date']);
|
||||
@@ -68,7 +69,7 @@ $bbcode_topic = stripslashes(nl2br($bbcoded));
|
||||
<td class="pcontent"><div class="posted">created: <?php echo $date; ?></div>
|
||||
<?php
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $arr['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => $arr['owner'], 'admin' => $_GET['admin']];
|
||||
'owner' => $arr['owner'], 'admin' => $_GET['admin'], 'forum_owner' => $forumData['owner']];
|
||||
|
||||
if(Alliance::canAct($checkArray)){
|
||||
echo '<div class="admin"><a class="edit" href="allianz.php?s=2&idt='.$arr['id'].'&admin=editans"><img src="img/x.gif" title="edit" alt="edit" /></a><a class="fdel" href="?s=2&fid='.$arr['cat'].'&idt='.$arr['id'].'&admin=deltopic" onClick="return confirm(\'confirm delete?\');"><img src="img/x.gif" title="delete" alt="delete" /></a></div><br />';
|
||||
@@ -146,7 +147,7 @@ if($database->checkSurvey($arr['id'])){
|
||||
foreach($posts as $po){
|
||||
$topic = reset($database->ShowTopic($po['topic']));
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $topic['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => $po['owner'], 'admin' => $_GET['admin']];
|
||||
'owner' => $po['owner'], 'admin' => $_GET['admin'], 'forum_owner' => $forumData['owner']];
|
||||
|
||||
$date = date('m/d/y H:i a', $po['date']);
|
||||
$countAu = $database->CountTopic($po['owner']);
|
||||
|
||||
@@ -11,11 +11,15 @@ if($session->access == BANNED){
|
||||
}
|
||||
|
||||
$forumData = reset($database->ForumCatEdit($_GET['idf']));
|
||||
if(empty($forumData) || $forumData['alliance'] != $session->alliance) $alliance->redirect($_GET);
|
||||
if(empty($forumData) || ($forumData['alliance'] > 0 && ($forumData['alliance'] != $session->alliance || !$opt['opt5'])) ||
|
||||
($forumData['alliance'] == 0 && $forumData['owner'] != $session->uid)) $alliance->redirect($_GET);
|
||||
|
||||
$users = $alliances = [];
|
||||
|
||||
$cat_name = stripslashes($forumData['forum_name']);
|
||||
$cat_des = stripslashes($forumData['forum_des']);
|
||||
|
||||
if(!empty($forumData['display_to_alliances'])) $alliances = explode(',', $forumData['display_to_alliances']);
|
||||
if(!empty($forumData['display_to_users'])) $users = explode(',', $forumData['display_to_users']);
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
@@ -113,4 +117,80 @@ $cat_des = stripslashes($forumData['forum_des']);
|
||||
<th>Description</th>
|
||||
<td><input class="text" type="text" name="u2" value="<?php echo $cat_des; ?>" maxlength="38"></td>
|
||||
</tr>
|
||||
</table><p class="btn"><input type="image" value="ok" name="s1" id="fbtn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></form></p>
|
||||
</table>
|
||||
<?php if($forumData['forum_area'] != 1){ ?>
|
||||
<table cellpadding="1" cellspacing="1" id="ally_list"><thead>
|
||||
<tr>
|
||||
|
||||
<th colspan="3">Open for more alliances</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alliance ID</td>
|
||||
<td>Tag:</td>
|
||||
<td>Add</td>
|
||||
</tr>
|
||||
|
||||
</thead><tbody>
|
||||
<?php for($i = 0; $i < count($alliances); $i++){?>
|
||||
<tr>
|
||||
<td class="ally">
|
||||
<input class="text" type="text" id="allys_by_id_<?php echo $i; ?>" disabled="disabled" maxlength="15" name="allys_by_id[<?php echo $i; ?>]" onkeyup="checkInputs(<?php echo $i; ?>,'allys');" />
|
||||
</td>
|
||||
<td class="tag">
|
||||
<input class="text" type="text" id="allys_by_name_<?php echo $i; ?>" value="<?php echo $database->getAlliance($alliances[$i])['tag']; ?>" maxlength="15" name="allys_by_name[<?php echo $i; ?>]" onkeyup="checkInputs(<?php echo $i; ?>,'allys');" />
|
||||
</td>
|
||||
<td class="ad"></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td class="ally">
|
||||
<input class="text" type="text" id="allys_by_id_<?php echo $i; ?>" name="allys_by_id[<?php echo $i; ?>]" maxlength="15" onkeyup="checkInputs(<?php echo $i; ?>,'allys');" />
|
||||
</td>
|
||||
<td class="tag">
|
||||
<input class="text" type="text" id="allys_by_name_<?php echo $i; ?>" name="allys_by_name[<?php echo $i; ?>]" maxlength="15" onkeyup="checkInputs(<?php echo $i; ?>,'allys');" />
|
||||
</td>
|
||||
<td class="ad">
|
||||
<img class="add" src="img/x.gif" title="add" alt="add" onclick="addRow('ally_list')" />
|
||||
</td>
|
||||
</tr>
|
||||
</table><table cellpadding="1" cellspacing="1" id="user_list"><thead>
|
||||
<tr>
|
||||
<th colspan="3">Open forum for the following players</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>User ID</td>
|
||||
<td>Name:</td>
|
||||
<td>Add</td>
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
<?php for($i = 0; $i < count($users); $i++){?>
|
||||
<tr>
|
||||
<td class="id">
|
||||
<input class="text" type="text" id="users_by_id_<?php echo $i; ?>" disabled="disabled" name="users_by_id[<?php echo $i; ?>]" maxlength="15" onkeyup="checkInputs(<?php echo $i; ?>,'users');" />
|
||||
</td>
|
||||
|
||||
<td class="pla">
|
||||
<input class="text" type="text" id="users_by_name_<?php echo $i; ?>" value="<?php echo $database->getUserField($users[$i], 'username', 0); ?>" name="users_by_name[<?php echo $i; ?>]" maxlength="50" onkeyup="checkInputs(<?php echo $i; ?>,'users');" />
|
||||
</td>
|
||||
<td class="ad"></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td class="id">
|
||||
<input class="text" type="text" id="users_by_id_<?php echo $i; ?>" maxlength="15" name="users_by_id[<?php echo $i; ?>]" onkeyup="checkInputs(<?php echo $i; ?>,'users');" />
|
||||
</td>
|
||||
|
||||
<td class="pla">
|
||||
<input class="text" type="text" id="users_by_name_<?php echo $i; ?>" maxlength="50" name="users_by_name[<?php echo $i; ?>]" onkeyup="checkInputs(<?php echo $i; ?>,'users');" />
|
||||
</td>
|
||||
<td class="ad">
|
||||
<img class="add" src="img/x.gif" title="add" alt="add" onclick="addRow('user_list')" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
<script type="text/javascript">
|
||||
showCheckList();
|
||||
</script>
|
||||
<?php } ?>
|
||||
<p class="btn"><input type="image" value="ok" name="s1" id="fbtn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></p></form>
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php if($session->alliance == $aid) {
|
||||
<?php if($session->alliance == $aid && $session->alliance > 0) {
|
||||
?>
|
||||
<div id="textmenu">
|
||||
<a href="allianz.php" <?php if(!isset($_GET['s']) && !isset($_POST['s'])) { echo "class=\"selected\""; } ?>>Overview</a>
|
||||
|
||||
@@ -14,20 +14,32 @@ if(!isset($aid)){
|
||||
|
||||
$allianceinfo = $database->getAlliance($aid);
|
||||
$opt = $database->getAlliPermissions($session->uid, $aid);
|
||||
echo "<h1>".$allianceinfo['tag']." - ".$allianceinfo['name']."</h1>";
|
||||
echo $aid > 0 ? "<h1>".$allianceinfo['tag']." - ".$allianceinfo['name']."</h1>" : "<h1>Forum</h1>";
|
||||
include ("alli_menu.tpl");
|
||||
$ids = $_GET['s'];
|
||||
|
||||
if(isset($_POST['new']) && $opt['opt5'] == 1 &&
|
||||
if(isset($_POST['new']) &&
|
||||
isset($_POST['u1']) && !empty($_POST['u1']) &&
|
||||
isset($_POST['u2']) && !empty($_POST['u2']) &&
|
||||
isset($_POST['bid']) && $_POST['bid'] >= 0 && $_POST['bid'] <= 3)
|
||||
{
|
||||
//Initialization
|
||||
$forumViewable['alliances'] = $forumViewable['users'] = "";
|
||||
|
||||
//Check if the user has admin permissions or not
|
||||
$cantEdit = $session->alliance == 0 || !$opt['opt5'];
|
||||
if($cantEdit && $_POST['bid'] != 1) $_POST['bid'] = 1;
|
||||
|
||||
//Ignore it if the forum is public
|
||||
if($_POST['bid'] != 1) {
|
||||
$forumViewable = $alliance->createForumVisiblity($_POST['allys_by_id'], $_POST['allys_by_name'], $_POST['users_by_id'], $_POST['users_by_name']);
|
||||
}
|
||||
|
||||
$forum_name = $_POST['u1'];
|
||||
$forum_des = $_POST['u2'];
|
||||
$forum_owner = $session->uid;
|
||||
$forum_area = $_POST['bid'];
|
||||
$database->CreatForum($forum_owner, $aid, $forum_name, $forum_des, $forum_area);
|
||||
$database->CreatForum($forum_owner, $cantEdit ? 0 : $session->alliance, $forum_name, $forum_des, $forum_area, $forumViewable['alliances'], $forumViewable['users']);
|
||||
}
|
||||
|
||||
if(isset($_POST['edittopic']) &&
|
||||
@@ -35,27 +47,40 @@ if(isset($_POST['edittopic']) &&
|
||||
isset($_POST['tid']) && !empty($_POST['tid']) &&
|
||||
isset($_POST['thema']) && !empty($_POST['thema']) &&
|
||||
Alliance::canAct(['aid' => $aid, 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'],
|
||||
'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $topic['owner']], 1) &&
|
||||
(($forumData = reset($database->ForumCatEdit($_POST['fid'])))['alliance'] == $session->alliance || $forumData['forum_area'] == 1))
|
||||
'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $topic['owner'],
|
||||
'forum_owner' => ($forumData = reset($database->ForumCatEdit($_POST['fid'])))['owner']], 1) &&
|
||||
($forumData['alliance'] == $session->alliance || $forumData['forum_area'] == 1))
|
||||
{
|
||||
//Additional security checks
|
||||
$oldForumData = reset($database->ForumCatEdit($topic['cat']));
|
||||
if($oldForumData['alliance'] == 0 && $oldForumData['owner'] != $forumData['owner']) $_POST['fid'] = $oldForumData['id'];
|
||||
|
||||
$topic_name = $_POST['thema'];
|
||||
$topic_cat = $_POST['fid'];
|
||||
$topic_id = $_POST['tid'];
|
||||
$database->UpdateEditTopic($topic_id, $topic_name, $topic_cat);
|
||||
}
|
||||
|
||||
if(isset($_POST['editforum']) && $opt['opt5'] == 1 &&
|
||||
if(isset($_POST['editforum']) &&
|
||||
isset($_POST['fid']) && !empty($_POST['fid']) &&
|
||||
isset($_POST['u1']) && !empty($_POST['u1']) &&
|
||||
isset($_POST['u2']) && !empty($_POST['u2']) &&
|
||||
$database->ForumCatAlliance($_POST['fid']) == $session->alliance)
|
||||
(($database->ForumCatAlliance($_POST['fid']) == $session->alliance && $opt['opt5'] == 1) ||
|
||||
($forumData = reset($database->ForumCatEdit($_POST['fid'])))['owner'] == $session->uid && $forumData['alliance'] == 0))
|
||||
{
|
||||
$forumViewable['alliances'] = $forumViewable['users'] = "";
|
||||
|
||||
//Ignore it if the forum is public
|
||||
if($forumData['forum_area'] != 1) {
|
||||
$forumViewable = $alliance->createForumVisiblity($_POST['allys_by_id'], $_POST['allys_by_name'], $_POST['users_by_id'], $_POST['users_by_name']);
|
||||
}
|
||||
|
||||
$forum_name = $_POST['u1'];
|
||||
$forum_name = htmlspecialchars($forum_name);
|
||||
$forum_des = $_POST['u2'];
|
||||
$forum_des = htmlspecialchars($forum_des);
|
||||
$forum_id = $_POST['fid'];
|
||||
$database->UpdateEditForum($forum_id, $forum_name, $forum_des, $session->alliance);
|
||||
$database->UpdateEditForum($forum_id, $forum_name, $forum_des, $session->alliance, $forumViewable['alliances'], $forumViewable['users']);
|
||||
}
|
||||
|
||||
if(isset($_POST['newtopic']) && isset($_POST['thema']) && isset($_POST['text']) && isset($_POST['fid'])
|
||||
@@ -214,96 +239,99 @@ if(isset($_POST['newpost']) && isset($_POST['text']) && !empty($_POST['text']) &
|
||||
|
||||
if(isset($_POST['editans']) && isset($_POST['text']) && !empty($_POST['text'])
|
||||
&& isset($_POST['tid']) && !empty($_POST['tid']) &&
|
||||
Alliance::canAct(['aid' => $aid, 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'],
|
||||
'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $topic['owner']], 1)){
|
||||
|
||||
$text = $_POST['text'];
|
||||
Alliance::canAct(['aid' => $aid, 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'],
|
||||
'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $topic['owner'],
|
||||
'forum_owner' => reset($database->ForumCatEdit($topic['cat']))['owner']], 1))
|
||||
{
|
||||
$text = $_POST['text'];
|
||||
$topic_id = $_POST['tid'];
|
||||
|
||||
|
||||
$text = preg_replace('/\[message\]/', '', $text);
|
||||
$text = preg_replace('/\[\/message\]/', '', $text);
|
||||
for($i = 0; $i <= $_POST['alliance0']; $i++){
|
||||
$text = preg_replace('/\[alliance'.$i.'\]/', '[alliance0]', $text);
|
||||
$text = preg_replace('/\[\/alliance'.$i.'\]/', '[/alliance0]', $text);
|
||||
$text = preg_replace('/\[alliance' . $i . '\]/', '[alliance0]', $text);
|
||||
$text = preg_replace('/\[\/alliance' . $i . '\]/', '[/alliance0]', $text);
|
||||
}
|
||||
for($i = 0; $i <= $_POST['player0']; $i++){
|
||||
$text = preg_replace('/\[player'.$i.'\]/', '[player0]', $text);
|
||||
$text = preg_replace('/\[\/player'.$i.'\]/', '[/player0]', $text);
|
||||
$text = preg_replace('/\[player' . $i . '\]/', '[player0]', $text);
|
||||
$text = preg_replace('/\[\/player' . $i . '\]/', '[/player0]', $text);
|
||||
}
|
||||
for($i = 0; $i <= $_POST['coor0']; $i++){
|
||||
$text = preg_replace('/\[coor'.$i.'\]/', '[coor0]', $text);
|
||||
$text = preg_replace('/\[\/coor'.$i.'\]/', '[/coor0]', $text);
|
||||
$text = preg_replace('/\[coor' . $i . '\]/', '[coor0]', $text);
|
||||
$text = preg_replace('/\[\/coor' . $i . '\]/', '[/coor0]', $text);
|
||||
}
|
||||
for($i = 0; $i <= $_POST['report0']; $i++){
|
||||
$text = preg_replace('/\[report'.$i.'\]/', '[report0]', $text);
|
||||
$text = preg_replace('/\[\/report'.$i.'\]/', '[/report0]', $text);
|
||||
$text = preg_replace('/\[report' . $i . '\]/', '[report0]', $text);
|
||||
$text = preg_replace('/\[\/report' . $i . '\]/', '[/report0]', $text);
|
||||
}
|
||||
|
||||
|
||||
if(!preg_match('/\[message\]/', $text) && !preg_match('/\[\/message\]/', $text)){
|
||||
$text = "[message]".$text."[/message]";
|
||||
$text = "[message]" . $text . "[/message]";
|
||||
$alliances = $player = $coor = $report = 0;
|
||||
for($i = 0; $i <= $alliances; $i++){
|
||||
if(preg_match('/\[alliance'.$i.'\]/', $text) && preg_match('/\[\/alliance'.$i.'\]/', $text)){
|
||||
$alliance1 = preg_replace('/\[message\](.*?)\[\/alliance'.$i.'\]/is', '', $text);
|
||||
if(preg_match('/\[alliance'.$i.'\]/', $alliance1) && preg_match('/\[\/alliance'.$i.'\]/', $alliance1)){
|
||||
if(preg_match('/\[alliance' . $i . '\]/', $text) && preg_match('/\[\/alliance' . $i . '\]/', $text)){
|
||||
$alliance1 = preg_replace('/\[message\](.*?)\[\/alliance' . $i . '\]/is', '', $text);
|
||||
if(preg_match('/\[alliance' . $i . '\]/', $alliance1) && preg_match('/\[\/alliance' . $i . '\]/', $alliance1)){
|
||||
$j = $i + 1;
|
||||
$alliance2 = preg_replace('/\[\/alliance'.$i.'\](.*?)\[\/message\]/is', '', $text);
|
||||
$alliance1 = preg_replace('/\[alliance'.$i.'\]/', '[alliance'.$j.']', $alliance1);
|
||||
$alliance1 = preg_replace('/\[\/alliance'.$i.'\]/', '[/alliance'.$j.']', $alliance1);
|
||||
$text = $alliance2."[/alliance".$i."]".$alliance1;
|
||||
$alliance2 = preg_replace('/\[\/alliance' . $i . '\](.*?)\[\/message\]/is', '', $text);
|
||||
$alliance1 = preg_replace('/\[alliance' . $i . '\]/', '[alliance' . $j . ']', $alliance1);
|
||||
$alliance1 = preg_replace('/\[\/alliance' . $i . '\]/', '[/alliance' . $j . ']', $alliance1);
|
||||
$text = $alliance2 . "[/alliance" . $i . "]" . $alliance1;
|
||||
$alliances += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for($i = 0; $i <= $player; $i++){
|
||||
if(preg_match('/\[player'.$i.'\]/', $text) && preg_match('/\[\/player'.$i.'\]/', $text)){
|
||||
$player1 = preg_replace('/\[message\](.*?)\[\/player'.$i.'\]/is', '', $text);
|
||||
if(preg_match('/\[player'.$i.'\]/', $player1) && preg_match('/\[\/player'.$i.'\]/', $player1)){
|
||||
if(preg_match('/\[player' . $i . '\]/', $text) && preg_match('/\[\/player' . $i . '\]/', $text)){
|
||||
$player1 = preg_replace('/\[message\](.*?)\[\/player' . $i . '\]/is', '', $text);
|
||||
if(preg_match('/\[player' . $i . '\]/', $player1) && preg_match('/\[\/player' . $i . '\]/', $player1)){
|
||||
$j = $i + 1;
|
||||
$player2 = preg_replace('/\[\/player'.$i.'\](.*?)\[\/message\]/is', '', $text);
|
||||
$player1 = preg_replace('/\[player'.$i.'\]/', '[player'.$j.']', $player1);
|
||||
$player1 = preg_replace('/\[\/player'.$i.'\]/', '[/player'.$j.']', $player1);
|
||||
$text = $player2."[/player".$i."]".$player1;
|
||||
$player2 = preg_replace('/\[\/player' . $i . '\](.*?)\[\/message\]/is', '', $text);
|
||||
$player1 = preg_replace('/\[player' . $i . '\]/', '[player' . $j . ']', $player1);
|
||||
$player1 = preg_replace('/\[\/player' . $i . '\]/', '[/player' . $j . ']', $player1);
|
||||
$text = $player2 . "[/player" . $i . "]" . $player1;
|
||||
$player += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for($i = 0; $i <= $coor; $i++){
|
||||
if(preg_match('/\[coor'.$i.'\]/', $text) && preg_match('/\[\/coor'.$i.'\]/', $text)){
|
||||
$coor1 = preg_replace('/\[message\](.*?)\[\/coor'.$i.'\]/is', '', $text);
|
||||
if(preg_match('/\[coor'.$i.'\]/', $coor1) && preg_match('/\[\/coor'.$i.'\]/', $coor1)){
|
||||
if(preg_match('/\[coor' . $i . '\]/', $text) && preg_match('/\[\/coor' . $i . '\]/', $text)){
|
||||
$coor1 = preg_replace('/\[message\](.*?)\[\/coor' . $i . '\]/is', '', $text);
|
||||
if(preg_match('/\[coor' . $i . '\]/', $coor1) && preg_match('/\[\/coor' . $i . '\]/', $coor1)){
|
||||
$j = $i + 1;
|
||||
$coor2 = preg_replace('/\[\/coor'.$i.'\](.*?)\[\/message\]/is', '', $text);
|
||||
$coor1 = preg_replace('/\[coor'.$i.'\]/', '[coor'.$j.']', $coor1);
|
||||
$coor1 = preg_replace('/\[\/coor'.$i.'\]/', '[/coor'.$j.']', $coor1);
|
||||
$text = $coor2."[/coor".$i."]".$coor1;
|
||||
$coor2 = preg_replace('/\[\/coor' . $i . '\](.*?)\[\/message\]/is', '', $text);
|
||||
$coor1 = preg_replace('/\[coor' . $i . '\]/', '[coor' . $j . ']', $coor1);
|
||||
$coor1 = preg_replace('/\[\/coor' . $i . '\]/', '[/coor' . $j . ']', $coor1);
|
||||
$text = $coor2 . "[/coor" . $i . "]" . $coor1;
|
||||
$coor += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for($i = 0; $i <= $report; $i++){
|
||||
if(preg_match('/\[report'.$i.'\]/', $text) && preg_match('/\[\/report'.$i.'\]/', $text)){
|
||||
$report1 = preg_replace('/\[message\](.*?)\[\/report'.$i.'\]/is', '', $text);
|
||||
if(preg_match('/\[report'.$i.'\]/', $report1) && preg_match('/\[\/report'.$i.'\]/', $report1)){
|
||||
if(preg_match('/\[report' . $i . '\]/', $text) && preg_match('/\[\/report' . $i . '\]/', $text)){
|
||||
$report1 = preg_replace('/\[message\](.*?)\[\/report' . $i . '\]/is', '', $text);
|
||||
if(preg_match('/\[report' . $i . '\]/', $report1) && preg_match('/\[\/report' . $i . '\]/', $report1)){
|
||||
$j = $i + 1;
|
||||
$report2 = preg_replace('/\[\/report'.$i.'\](.*?)\[\/message\]/is', '', $text);
|
||||
$report1 = preg_replace('/\[report'.$i.'\]/', '[report'.$j.']', $report1);
|
||||
$report1 = preg_replace('/\[\/report'.$i.'\]/', '[/report'.$j.']', $report1);
|
||||
$text = $report2."[/report".$i."]".$report1;
|
||||
$report2 = preg_replace('/\[\/report' . $i . '\](.*?)\[\/message\]/is', '', $text);
|
||||
$report1 = preg_replace('/\[report' . $i . '\]/', '[report' . $j . ']', $report1);
|
||||
$report1 = preg_replace('/\[\/report' . $i . '\]/', '[/report' . $j . ']', $report1);
|
||||
$text = $report2 . "[/report" . $i . "]" . $report1;
|
||||
$report += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$database->EditUpdateTopic($topic_id, $text, $alliances, $player, $coor, $report);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['editpost']) && isset($_POST['text']) && !empty($_POST['text']) &&
|
||||
isset($_POST['pod']) && !empty($_POST['pod']) &&
|
||||
Alliance::canAct(['aid' => $aid,
|
||||
'alliance' => reset($database->ShowTopic(($post = reset($database->ShowPostEdit($_POST['pod'])))['topic']))['alliance'],
|
||||
'forum_perm' => $opt['opt5'], 'owner' => $post['owner'], 'admin' => $_GET['admin']], 1))
|
||||
'alliance' => ($topic = reset($database->ShowTopic(($post = reset($database->ShowPostEdit($_POST['pod'])))['topic'])))['alliance'],
|
||||
'forum_perm' => $opt['opt5'], 'owner' => $post['owner'], 'admin' => $_GET['admin'],
|
||||
'forum_owner' => ($forumData = reset($database->ForumCatEdit($topic['cat'])))['owner']], 1))
|
||||
{
|
||||
|
||||
$text = $_POST['text'];
|
||||
@@ -401,18 +429,20 @@ if($_GET['admin'] == "switch_admin"){
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['admin'] == "pos" && isset($_GET['res']) && isset($_GET['fid']) && !empty($_GET['fid']) && $opt['opt5'] == 1 &&
|
||||
($forumData = reset($database->ForumCatEdit($_GET['fid'])))['alliance'] == $session->alliance)
|
||||
if($_GET['admin'] == "pos" && isset($_GET['res']) && isset($_GET['fid']) && !empty($_GET['fid']) &&
|
||||
(($database->ForumCatAlliance($_GET['fid']) == $session->alliance && $opt['opt5'] == 1) ||
|
||||
($forumData = reset($database->ForumCatEdit($_GET['fid'])))['owner'] == $session->uid && $forumData['alliance'] == 0))
|
||||
{
|
||||
$database->moveForum($_GET['fid'], $forumData['forum_area'], $session->alliance, $_GET['res']); //Move the forum to the top/bottom of the list
|
||||
$alliance->redirect($_GET);
|
||||
}
|
||||
elseif(isset($_GET['admin']) && !empty($_GET['admin']) && isset($_GET['idt']) && !empty($_GET['idt'])){
|
||||
elseif(isset($_GET['idt']) && !empty($_GET['idt'])){
|
||||
|
||||
//Get the post informations
|
||||
$topicID = $_GET['idt'];
|
||||
$post = reset($database->ShowTopic($topicID));
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $post['alliance'], 'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $post['owner']];
|
||||
$checkArray = ['aid' => $aid, 'alliance' => $post['alliance'], 'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'],
|
||||
'owner' => $post['owner'], 'forum_owner' => reset($database->ForumCatEdit($post['cat']))['owner']];
|
||||
|
||||
//Exit if we've the rights to modify it
|
||||
if(!Alliance::canAct($checkArray, 1)) $alliance->redirect($_GET);
|
||||
@@ -451,9 +481,9 @@ elseif(isset($_GET['admin']) && !empty($_GET['admin']) && isset($_GET['idt']) &&
|
||||
|
||||
if($_GET['admin'] != "edittopic" && $_GET['admin'] != "editans") $alliance->redirect($_GET);
|
||||
}
|
||||
elseif($_GET['admin'] == "delforum" && $opt['opt5'] == 1 &&
|
||||
!empty($catToDelete = reset($database->ForumCatEdit($_GET['idf']))) &&
|
||||
$catToDelete['alliance'] == $session->alliance)
|
||||
elseif($_GET['admin'] == "delforum" && isset($_GET['idf']) && !empty($_GET['idf']) &&
|
||||
(($database->ForumCatAlliance($_GET['idf']) == $session->alliance && $opt['opt5'] == 1) ||
|
||||
($forumData = reset($database->ForumCatEdit($_GET['idf'])))['owner'] == $session->uid && $forumData['alliance'] == 0))
|
||||
{
|
||||
$database->DeleteCat($_GET['idf']); // delete forum
|
||||
$alliance->redirect($_GET);
|
||||
@@ -462,18 +492,20 @@ elseif($_GET['admin'] == "delpost" && isset($_GET['pod']) && !empty($_GET['pod']
|
||||
isset($_GET['tid']) && !empty($_GET['tid']) &&
|
||||
isset($_GET['fid2']) && !empty($_GET['fid2']) &&
|
||||
Alliance::canAct(['aid' => $aid, 'alliance' => reset($database->ShowTopic($_GET['tid']))['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'], 'admin' => $_GET['admin']], 1))
|
||||
'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'], 'admin' => $_GET['admin'],
|
||||
'forum_owner' => reset($database->ForumCatEdit($_GET['fid2']))['owner']], 1))
|
||||
{
|
||||
$database->DeletePost($_GET['pod']); //Delete post
|
||||
header("Location: allianz.php?s=2&fid2=".$_GET['fid2']."&tid=".$_GET['tid']);
|
||||
exit;
|
||||
}
|
||||
elseif($_GET['admin'] == "newforum" && $opt['opt5'] == 1) include("Forum/forum_1.tpl"); // new forum
|
||||
elseif($_GET['admin'] == "newforum") include("Forum/forum_1.tpl"); //New forum
|
||||
elseif($_GET['admin'] == "editpost" && isset($_GET['pod']) && !empty($_GET['pod']) &&
|
||||
isset($_GET['tid']) && !empty($_GET['tid']) &&
|
||||
isset($_GET['fid']) && !empty($_GET['fid']) &&
|
||||
Alliance::canAct(['aid' => $aid, 'alliance' => reset($database->ShowTopic($_GET['tid']))['alliance'], 'forum_perm' => $opt['opt5'],
|
||||
'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'], 'admin' => $_GET['admin']], 1)) //Edit post
|
||||
'owner' => reset($database->ShowPostEdit($_GET['pod']))['owner'], 'admin' => $_GET['admin'],
|
||||
'forum_owner' => reset($database->ForumCatEdit($_GET['fid']))['owner']], 1)) //Edit post
|
||||
{
|
||||
include("Forum/forum_10.tpl");
|
||||
}
|
||||
@@ -481,10 +513,10 @@ elseif(isset($_GET['fid'])){
|
||||
if(isset($_GET['ac'])) include("Forum/forum_5.tpl"); //New topic
|
||||
else include("Forum/forum_4.tpl"); //Show topics
|
||||
}
|
||||
elseif($_GET['admin'] == "editforum" && $opt['opt5'] == 1) include("Forum/forum_8.tpl"); // edit forum
|
||||
elseif($_GET['admin'] == "editforum") include("Forum/forum_8.tpl"); //Edit forum
|
||||
elseif(isset($_GET['tid'])){
|
||||
if(isset($_GET['ac'])) include ("Forum/forum_7.tpl"); //New post
|
||||
else include ("Forum/forum_6.tpl"); //Showtopic
|
||||
else include ("Forum/forum_6.tpl"); //Show topic
|
||||
}
|
||||
else include("Forum/forum_2.tpl");
|
||||
?>
|
||||
@@ -57,6 +57,7 @@ div.c1 {text-align: center}
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<a href="allianz.php?s=2"><b><?php echo FORUM;?></b></a>
|
||||
<a href="rules.php"><b><?php echo GAME_RULES;?></b></a>
|
||||
<?php
|
||||
// no support for support :-D
|
||||
|
||||
+122
-122
@@ -43,40 +43,40 @@ if(isset($_GET['fid']) || isset($_GET['fid2'])){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_GET['aid']) || isset($_GET['fid']) || isset($_GET['fid2']) || $session->alliance > 0){
|
||||
if(isset($_GET['aid']) || isset($_GET['fid']) || isset($_GET['fid2']) ||
|
||||
$session->alliance > 0 || ($session->alliance == 0 && isset($_GET['s']) && $_GET['s'] == 2)){
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title><?php
|
||||
|
||||
echo SERVER_NAME . ' » » » Alliance ';
|
||||
|
||||
if (!empty($_GET['s'])) {
|
||||
switch ($_GET['s']) {
|
||||
case '2':
|
||||
echo 'Forum ('.$alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'].')';
|
||||
break;
|
||||
|
||||
case '6':
|
||||
echo 'Chat ('.$alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'].')';
|
||||
break;
|
||||
|
||||
case '3':
|
||||
echo 'Attacks ('.$alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'].')';
|
||||
break;
|
||||
|
||||
case '4':
|
||||
echo 'News ('.$alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'].')';
|
||||
break;
|
||||
|
||||
case '5':
|
||||
echo 'Options ('.$alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'].')';
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'];
|
||||
}
|
||||
echo SERVER_NAME . ' » » » Alliance ';
|
||||
|
||||
if(!empty($_GET['s'])){
|
||||
switch($_GET['s']){
|
||||
case '2' :
|
||||
if($session->alliance == 0) echo 'Forum (No alliance)';
|
||||
else echo 'Forum (' . $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'] . ')';
|
||||
break;
|
||||
|
||||
case '6' :
|
||||
echo 'Chat (' . $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'] . ')';
|
||||
break;
|
||||
|
||||
case '3' :
|
||||
echo 'Attacks (' . $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'] . ')';
|
||||
break;
|
||||
|
||||
case '4' :
|
||||
echo 'News (' . $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'] . ')';
|
||||
break;
|
||||
|
||||
case '5' :
|
||||
echo 'Options (' . $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'] . ')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else echo $alliance->allianceArray['tag'] . ' - ' . $alliance->allianceArray['name'];
|
||||
|
||||
?></title>
|
||||
<link rel="shortcut icon" href="favicon.ico"/>
|
||||
@@ -174,112 +174,113 @@ if(isset($_GET['aid']) || isset($_GET['fid']) || isset($_GET['fid2']) || $sessio
|
||||
<div id="mid">
|
||||
<?php
|
||||
$userPermissions = $database->getAlliPermissions($session->uid, $session->alliance, 0);
|
||||
include ("Templates/menu.tpl");
|
||||
|
||||
if(isset($_GET['s']) && $_GET['s'] == 2) echo '<div id="content" class="forum">';
|
||||
else echo '<div id="content" class="alliance">';
|
||||
|
||||
if(isset($_GET['s'])) {
|
||||
if($_GET['s'] != 5 || $session->sit == 0){
|
||||
switch($_GET['s']) {
|
||||
case 2:
|
||||
if(isset($_POST['vote'])) $alliance->Vote($_POST);
|
||||
include ("Templates/Alliance/forum.tpl");
|
||||
break;
|
||||
case 3:
|
||||
include ("Templates/Alliance/attacks.tpl");
|
||||
break;
|
||||
case 4:
|
||||
include ("Templates/Alliance/news.tpl");
|
||||
break;
|
||||
case 5:
|
||||
include ("Templates/Alliance/option.tpl");
|
||||
break;
|
||||
case 6:
|
||||
include ("Templates/Alliance/chat.tpl");
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
include ("Templates/Alliance/overview.tpl");
|
||||
break;
|
||||
include ("Templates/menu.tpl");
|
||||
|
||||
if(isset($_GET['s']) && $_GET['s'] == 2) echo '<div id="content" class="forum">';
|
||||
else echo '<div id="content" class="alliance">';
|
||||
|
||||
if(isset($_GET['s'])){
|
||||
if($_GET['s'] != 5 || $session->sit == 0){
|
||||
switch($_GET['s']){
|
||||
case 2 :
|
||||
if(isset($_POST['vote'])) $alliance->Vote($_POST);
|
||||
include("Templates/Alliance/forum.tpl");
|
||||
break;
|
||||
case 3:
|
||||
include("Templates/Alliance/attacks.tpl");
|
||||
break;
|
||||
case 4:
|
||||
include("Templates/Alliance/news.tpl");
|
||||
break;
|
||||
case 5:
|
||||
include("Templates/Alliance/option.tpl");
|
||||
break;
|
||||
case 6:
|
||||
include("Templates/Alliance/chat.tpl");
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
include("Templates/Alliance/overview.tpl");
|
||||
break;
|
||||
}
|
||||
// Options
|
||||
}else{
|
||||
header("Location: " . $_SERVER['PHP_SELF']);
|
||||
exit();
|
||||
}
|
||||
// Options
|
||||
}else{
|
||||
header("Location: ".$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}}else if(isset($_GET['delinvite'])){
|
||||
if($userPermissions['opt4'] == 0) $alliance->redirect();
|
||||
}else if(isset($_GET['delinvite'])){
|
||||
if($userPermissions['opt4'] == 0) $alliance->redirect();
|
||||
include ("Templates/Alliance/invite.tpl");
|
||||
} elseif(isset($_POST['o'])) {
|
||||
switch($_POST['o']) {
|
||||
case 1:
|
||||
if($userPermissions['opt1'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a_user'])){
|
||||
$alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/changepos.tpl");
|
||||
}
|
||||
else include("Templates/Alliance/assignpos.tpl");
|
||||
}elseif(isset($_POST['o'])){
|
||||
switch($_POST['o']){
|
||||
case 1 :
|
||||
if($userPermissions['opt1'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a_user'])){
|
||||
$alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/changepos.tpl");
|
||||
}
|
||||
else include("Templates/Alliance/assignpos.tpl");
|
||||
break;
|
||||
case 2:
|
||||
if($userPermissions['opt2'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 2) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/kick.tpl");
|
||||
case 2 :
|
||||
if($userPermissions['opt2'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 2) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/kick.tpl");
|
||||
break;
|
||||
case 3:
|
||||
if($userPermissions['opt3'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 3) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/allidesc.tpl");
|
||||
case 3 :
|
||||
if($userPermissions['opt3'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 3) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/allidesc.tpl");
|
||||
break;
|
||||
case 4:
|
||||
if($userPermissions['opt4'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 4) $alliance->procAlliForm($_POST);
|
||||
case 4 :
|
||||
if($userPermissions['opt4'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 4) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/invite.tpl");
|
||||
break;
|
||||
case 5:
|
||||
if($userPermissions['opt5'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['f_link'])) $alliance->setForumLink($_POST);
|
||||
include("Templates/Alliance/linkforum.tpl");
|
||||
case 5 :
|
||||
if($userPermissions['opt5'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['f_link'])) $alliance->setForumLink($_POST);
|
||||
include("Templates/Alliance/linkforum.tpl");
|
||||
break;
|
||||
case 6:
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['dipl']) && isset($_POST['a_name'])) $alliance->procAlliForm($_POST);
|
||||
case 6 :
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['dipl']) && isset($_POST['a_name'])) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/chgdiplo.tpl");
|
||||
break;
|
||||
case 11:
|
||||
case 11 :
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 11) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/quitalli.tpl");
|
||||
break;
|
||||
case 100:
|
||||
if($userPermissions['opt3'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 100) $alliance->procAlliForm($_POST);
|
||||
include ("Templates/Alliance/changename.tpl");
|
||||
case 100 :
|
||||
if($userPermissions['opt3'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['s']) == 5 && isset($_POST['a']) == 100) $alliance->procAlliForm($_POST);
|
||||
include("Templates/Alliance/changename.tpl");
|
||||
break;
|
||||
case 101:
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyCancelOffer($_POST['id'], $session->alliance);
|
||||
include ("Templates/Alliance/chgdiplo.tpl");
|
||||
case 101 :
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyCancelOffer($_POST['id'], $session->alliance);
|
||||
include("Templates/Alliance/chgdiplo.tpl");
|
||||
break;
|
||||
case 102:
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyInviteDenied($_POST['id'], $session->alliance);
|
||||
include ("Templates/Alliance/chgdiplo.tpl");
|
||||
case 102 :
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyInviteDenied($_POST['id'], $session->alliance);
|
||||
include("Templates/Alliance/chgdiplo.tpl");
|
||||
break;
|
||||
case 103:
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyInviteAccept($_POST['id'], $session->alliance);
|
||||
include ("Templates/Alliance/chgdiplo.tpl");
|
||||
case 103 :
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyInviteAccept($_POST['id'], $session->alliance);
|
||||
include("Templates/Alliance/chgdiplo.tpl");
|
||||
break;
|
||||
case 104:
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyCancelExistingRelationship($_POST['id'], $session->alliance);
|
||||
include ("Templates/Alliance/chgdiplo.tpl");
|
||||
case 104 :
|
||||
if($userPermissions['opt6'] == 0) $alliance->redirect();
|
||||
if(isset($_POST['id'])) $database->diplomacyCancelExistingRelationship($_POST['id'], $session->alliance);
|
||||
include("Templates/Alliance/chgdiplo.tpl");
|
||||
break;
|
||||
default :
|
||||
include("Templates/Alliance/option.tpl");
|
||||
break;
|
||||
default:
|
||||
include("Templates/Alliance/option.tpl");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else include ("Templates/Alliance/overview.tpl");
|
||||
}
|
||||
else include("Templates/Alliance/overview.tpl");
|
||||
?>
|
||||
</div>
|
||||
<br /><br /><br /><br /><div id="side_info">
|
||||
@@ -295,11 +296,10 @@ include("Templates/news.tpl");
|
||||
<div class="clear"></div>
|
||||
|
||||
<?php
|
||||
|
||||
include ("Templates/footer.tpl");
|
||||
include ("Templates/res.tpl");
|
||||
|
||||
include("Templates/footer.tpl");
|
||||
include("Templates/res.tpl");
|
||||
?>
|
||||
|
||||
<div id="stime">
|
||||
<div id="ltime">
|
||||
<div id="ltimeWrap">
|
||||
@@ -331,7 +331,7 @@ include("Templates/news.tpl");
|
||||
</html>
|
||||
<?php
|
||||
}else{
|
||||
header("Location: spieler.php?uid=".$session->uid);
|
||||
exit;
|
||||
header("Location: spieler.php?uid=".$session->uid);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,3 +1,6 @@
|
||||
-- 19.05.2018 -> added two new columns
|
||||
ALTER TABLE s1_forum_cat ADD (`display_to_alliances` text, `display_to_users` text)
|
||||
|
||||
-- 18.05.2018 -> added a new column
|
||||
ALTER TABLE s1_forum_cat ADD `sorting` int(11) NOT NULL AFTER `id`
|
||||
|
||||
|
||||
@@ -751,6 +751,8 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%forum_cat` (
|
||||
`forum_name` varchar(255) DEFAULT NULL,
|
||||
`forum_des` text,
|
||||
`forum_area` varchar(255) DEFAULT NULL,
|
||||
`display_to_alliances` text,
|
||||
`display_to_users` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `alliance-forum_area` (`alliance`,`forum_area`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
Reference in New Issue
Block a user