mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-19 08:37:18 +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:
@@ -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>
|
||||
Reference in New Issue
Block a user