Alliance forum fixes part 4

+Public forums can now be created by MH only
+Public forums can only be edited by MH only (every MH)
+Fixed BBCode in forum posts
+Removed 8 unused columns from the database
+Removed about 150 lines of unused code in forum.tpl
+Minor improvements and bug fixing
This commit is contained in:
iopietro
2018-05-20 16:50:26 +02:00
parent cbcc9b5262
commit 34c8000e44
14 changed files with 128 additions and 380 deletions
+5 -2
View File
@@ -9,6 +9,9 @@ if($session->access == BANNED){
header("Location: banned.php");
exit;
}
if($session->access != ADMIN && ($session->alliance == 0 || ($session->alliance > 0 && !$opt['opt5']))) $alliance->redirect($_GET);
?>
<script language="JavaScript" type="text/javascript">
@@ -131,10 +134,10 @@ function showCheckList() {
<tr>
<th>Forum type</th>
<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>
<td><select class="dropdown" id="bid" name="bid" onchange="showCheckList();"><?php if($session->access == ADMIN){ ?><option value="1">Public Forum</option><?php }else{ ?><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>
<?php if($session->alliance > 0 && $opt['opt5'] == 1){ ?>
<?php if($session->access != ADMIN){ ?>
<table cellpadding="1" cellspacing="1" id="ally_list"><thead>
<tr>
+4 -12
View File
@@ -24,21 +24,13 @@ 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'];
}
?>
<form method="post" name="post"
action="allianz.php?s=2&fid2=<?php echo $topics['cat']; ?>&tid=<?php echo $topics['id']; ?>">
<input type="hidden" name="s" value="2"> <input type="hidden"
name="pod" value="<?php echo $_GET['pod']; ?>"> <input type="hidden"
name="alliance0" value="<?php echo $alliance0; ?>"> <input
type="hidden" name="player0" value="<?php echo $player0; ?>"> <input
type="hidden" name="coor0" value="<?php echo $coor0; ?>"> <input
type="hidden" name="report0" value="<?php echo $report0; ?>"> <input
type="hidden" name="editpost" value="1">
<table cellpadding="1" cellspacing="1" id="edit_post">
<thead>
@@ -66,14 +58,14 @@ foreach($posts as $pos){
</a> <a href="javascript:void(0);" bbType="d" bbTag="u">
<div title="underlined" alt="underlined"
class="bbButton bbUnderscore"></div>
</a> <a href="javascript:void(0);" bbType="d" bbTag="alliance0">
</a> <a href="javascript:void(0);" bbType="d" bbTag="alliance">
<div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div>
</a> <a href="javascript:void(0);" bbType="d" bbTag="player0">
</a> <a href="javascript:void(0);" bbType="d" bbTag="player">
<div title="Player" alt="Player" class="bbButton bbPlayer"></div>
</a> <a href="javascript:void(0);" bbType="d" bbTag="coor0">
</a> <a href="javascript:void(0);" bbType="d" bbTag="coor">
<div title="Coordinates" alt="Coordinates"
class="bbButton bbCoordinate"></div>
</a> <a href="javascript:void(0);" bbType="d" bbTag="report0">
</a> <a href="javascript:void(0);" bbType="d" bbTag="report">
<div title="Report" alt="Report" class="bbButton bbReport"></div>
</a> <a href="javascript:void(0);" bbWin="resources"
id="text_resourceButton">
+2 -2
View File
@@ -94,8 +94,8 @@ foreach($forumcat as $arr){
<?php } ?>
<p>
<?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){
if(isset($opt['opt5']) && $opt['opt5'] == 1 || $session->access == ADMIN){
echo '<a href="allianz.php?s=2&admin=newforum"><img id="fbtn_newforum" class="dynamic_img" src="img/x.gif" alt="New forum" /></a>';
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>';
}
?>
+10 -3
View File
@@ -14,10 +14,14 @@ $topicID = $_GET['idt'];
$showTopic = reset($database->ShowTopic($topicID));
$forumData = reset($database->ForumCatEdit($showTopic['cat']));
$title = stripslashes($showTopic['title']);
$canBeMoved = $forumData['forum_area'] == 1 && $session->access == 9;
?>
<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; ?>">
<?php if(!$canBeMoved){ ?>
<input type="hidden" name="fid" value="<?php echo $showTopic['cat']; ?>">
<?php } ?>
<input type="hidden" name="edittopic" value="1">
<table cellpadding="1" cellspacing="1" id="edit_topic"><thead>
<tr>
@@ -28,21 +32,24 @@ $title = stripslashes($showTopic['title']);
<th>Thread</th>
<td><input class="text" type="Text" name="thema" value="<?php echo $title; ?>" maxlength="35"></td>
</tr>
<?php if($canBeMoved){?>
<tr>
<td>Move topic</td>
<td><select class="dropdown" name="fid">
<?php
$show_cat = $database->ForumCat($forumData['alliance']);
if($canBeMoved) $show_cat = array_merge($show_cat, $database->ForumCat($session->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($session->access == 9 && $cats['owner'] != $session->uid) 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>';
}
?>
</select></td>
</tr>
<?php } ?>
</tbody></table>
<p class="btn"><button id="fbtn_ok" value="ok" name="s1" class="trav_buttons"> OK </button></p></form>
+1 -1
View File
@@ -84,7 +84,7 @@ echo '<tr>
</tbody></table><p>
<a href="allianz.php?s=2&pid=<?php echo $aid; ?>&fid=<?php echo $cat_id; ?>&ac=newtopic"><img id="fbtn_post" class="dynamic_img" src="img/x.gif" alt="Post new thread" /></a>
<?php
if(isset($opt['opt5']) && $opt['opt5']== 1){
if((isset($opt['opt5']) && $opt['opt5']== 1) || $session->access == ADMIN){
echo '<a href="allianz.php?s=2&fid='.$cat_id.((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>';
}
?>
+4 -4
View File
@@ -39,10 +39,10 @@ if($session->access == BANNED){
<a href="javascript:void(0);" bbType="d" bbTag="b" ><div title="bold" alt="bold" class="bbButton bbBold"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="i" ><div title="italic" alt="italic" class="bbButton bbItalic"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="u" ><div title="underlined" alt="underlined" class="bbButton bbUnderscore"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance0" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player0" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor0" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report0" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbWin="resources" id="text_resourceButton"><div title="Resources" alt="Resources" class="bbButton bbResource"></div></a>
<a href="javascript:void(0);" bbWin="smilies" id="text_smilieButton"><div title="Smilies" alt="Smilies" class="bbButton bbSmilie"></div></a>
+1 -2
View File
@@ -11,7 +11,6 @@ if($session->access == BANNED){
}
$tid = $_GET['tid'];
$opt = $database->getAlliPermissions($session->uid, $aid);
$topics = $database->ShowTopic($tid);
//Check if we're viewing a valid thread
@@ -186,7 +185,7 @@ foreach($posts as $po){
if(empty($arr['close'])){
echo '<a href="allianz.php?s=2&tid='.$arr['id'].'&ac=newpost"><img id="fbtn_reply" class="dynamic_img"src="img/x.gif" alt="Replies" /></a>';
}
if($opt['opt5'] == 1){
if($opt['opt5'] == 1 || $session->access == ADMIN){
echo '<a href="allianz.php?s=2&tid='.$arr['id'].((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>';
}
?>
+4 -4
View File
@@ -42,10 +42,10 @@ $title = stripslashes($topic['title']);
<a href="javascript:void(0);" bbType="d" bbTag="b" ><div title="bold" alt="bold" class="bbButton bbBold"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="i" ><div title="italic" alt="italic" class="bbButton bbItalic"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="u" ><div title="underlined" alt="underlined" class="bbButton bbUnderscore"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance0" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player0" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor0" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report0" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbWin="resources" id="text_resourceButton"><div title="Resources" alt="Resources" class="bbButton bbResource"></div></a>
<a href="javascript:void(0);" bbWin="smilies" id="text_smilieButton"><div title="Smilies" alt="Smilies" class="bbButton bbSmilie"></div></a>
+4 -3
View File
@@ -11,8 +11,9 @@ if($session->access == BANNED){
}
$forumData = reset($database->ForumCatEdit($_GET['idf']));
if(empty($forumData) || ($forumData['alliance'] > 0 && ($forumData['alliance'] != $session->alliance || !$opt['opt5'])) ||
($forumData['alliance'] == 0 && $forumData['owner'] != $session->uid)) $alliance->redirect($_GET);
if(empty($forumData) || ($session->alliance == 0 && $session->access != ADMIN) ||
($forumData['alliance'] > 0 && ($forumData['alliance'] != $session->alliance ||
(!$opt['opt5'] && $session->access != ADMIN)))) $alliance->redirect($_GET);
$users = $alliances = [];
@@ -21,7 +22,7 @@ $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">
<script type="text/javascript">
function addRow(element_id) {
// element_id: user_list, ally_list
+4 -12
View File
@@ -21,19 +21,11 @@ foreach($topics as $top) {
$ans = stripslashes($top['post']);
$ans = preg_replace('/\[message\]/', '', $ans);
$ans = preg_replace('/\[\/message\]/', '', $ans);
$alliance0 = $top['alliance0'];
$player0 = $top['player0'];
$coor0 = $top['coor0'];
$report0 = $top['report0'];
}
?>
<form method="post" name="post" action="allianz.php?s=2&fid2=<?php echo $_GET['fid2']; ?>&tid=<?php echo $_GET['idt']; ?>">
<input type="hidden" name="s" value="2">
<input type="hidden" name="tid" value="<?php echo $_GET['idt']; ?>">
<input type="hidden" name="alliance0" value="<?php echo $alliance0; ?>">
<input type="hidden" name="player0" value="<?php echo $player0; ?>">
<input type="hidden" name="coor0" value="<?php echo $coor0; ?>">
<input type="hidden" name="report0" value="<?php echo $report0; ?>">
<input type="hidden" name="editans" value="1">
<table cellpadding="1" cellspacing="1" id="edit_post"><thead>
<tr>
@@ -53,10 +45,10 @@ foreach($topics as $top) {
<a href="javascript:void(0);" bbType="d" bbTag="b" ><div title="bold" alt="bold" class="bbButton bbBold"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="i" ><div title="italic" alt="italic" class="bbButton bbItalic"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="u" ><div title="underlined" alt="underlined" class="bbButton bbUnderscore"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance0" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player0" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor0" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report0" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="alliance" ><div title="Alliance" alt="Alliance" class="bbButton bbAlliance"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="player" ><div title="Player" alt="Player" class="bbButton bbPlayer"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="coor" ><div title="Coordinates" alt="Coordinates" class="bbButton bbCoordinate"></div></a>
<a href="javascript:void(0);" bbType="d" bbTag="report" ><div title="Report" alt="Report" class="bbButton bbReport"></div></a>
<a href="javascript:void(0);" bbWin="resources" id="text_resourceButton"><div title="Resources" alt="Resources" class="bbButton bbResource"></div></a>
<a href="javascript:void(0);" bbWin="smilies" id="text_smilieButton"><div title="Smilies" alt="Smilies" class="bbButton bbSmilie"></div></a>
<a href="javascript:void(0);" bbWin="troops" id="text_troopButton"><div title="Troops" alt="Troops" class="bbButton bbTroop"></div></a>