mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
General fixes
+Fixed a bug that permitted to create threads and post in closed forums (only who have the permission to manage the forum can do that) +Fixed a bug that permitted to write posts to closed threads +Fixed a bug that permitted to view not shared forums under certain circumnstances
This commit is contained in:
@@ -2268,8 +2268,8 @@ class MYSQLi_DB implements IDbConnection {
|
||||
'%$alliance,%'
|
||||
OR
|
||||
display_to_alliances
|
||||
LIKE
|
||||
'%$alliance%'
|
||||
=
|
||||
'$alliance'
|
||||
OR
|
||||
display_to_users
|
||||
LIKE
|
||||
@@ -2284,8 +2284,8 @@ class MYSQLi_DB implements IDbConnection {
|
||||
'%$uid,%'
|
||||
OR
|
||||
display_to_users
|
||||
LIKE
|
||||
'%$uid%'
|
||||
=
|
||||
'$uid'
|
||||
";
|
||||
$result = mysqli_query($this->dblink, $q);
|
||||
if(!empty($result)){
|
||||
@@ -2472,7 +2472,7 @@ class MYSQLi_DB implements IDbConnection {
|
||||
list($id) = $this->escape_input($id);
|
||||
|
||||
$q = "SELECT alliance from " . TB_PREFIX . "forum_cat where id = $id LIMIT 1";
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
$result = mysqli_query($this->dblink, $q);
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
return $dbarray['alliance'];
|
||||
}
|
||||
|
||||
@@ -84,8 +84,12 @@ echo '<tr>
|
||||
}
|
||||
?>
|
||||
</tbody></table><p>
|
||||
<?php
|
||||
if($forumData['forum_area'] != 3 || ($forumData['forum_area'] == 3 && $opt['opt5'] == 1)){
|
||||
?>
|
||||
<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
|
||||
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>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
@@ -10,6 +10,12 @@ if($session->access == BANNED){
|
||||
exit;
|
||||
}
|
||||
|
||||
$cat_id = $_GET['fid'];
|
||||
$forumData = reset($database->ForumCatEdit($cat_id));
|
||||
|
||||
//Check if we can create the thread or not
|
||||
if($forumData['forum_area'] == 3 && !$opt['opt5']) $alliance->redirect($_GET);
|
||||
|
||||
?>
|
||||
<form method="post" name="post" action="allianz.php?s=2&fid=<?php echo $_GET['fid']; ?>">
|
||||
<input type="hidden" name="newtopic" value="1">
|
||||
|
||||
@@ -182,7 +182,7 @@ foreach($posts as $po){
|
||||
</table>
|
||||
<div style="margin-top: 15px;">
|
||||
<?php
|
||||
if(empty($arr['close'])){
|
||||
if(!$arr['close'] && ($forumData['forum_area'] != 3 || ($forumData['forum_area'] == 3 && $opt['opt5'] == 1))){
|
||||
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>';
|
||||
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>';
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@ if($session->access == BANNED){
|
||||
|
||||
$tid = $_GET['tid'];
|
||||
$topic = reset($database->ShowTopic($tid));
|
||||
$forumData = reset($database->ForumCatEdit($topic['cat']));
|
||||
|
||||
//Check if we're creating a post for a valid topic
|
||||
if(empty($topic)) $alliance->redirect($_GET);
|
||||
if(empty($topic) || $topic['close'] == 1 || ($forumData['forum_area'] == 3 && !$opt['opt5'])) $alliance->redirect($_GET);
|
||||
|
||||
$title = stripslashes($topic['title']);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// # FIX BY RONIX ##
|
||||
// # TRAVIANZ ##
|
||||
// ###########################################################
|
||||
|
||||
//TODO: Rework the whole code of this section...
|
||||
if(!isset($aid)){
|
||||
if(isset($_GET['fid']) && !empty($_GET['fid'])) $aid = $database->ForumCatAlliance($_GET['fid']);
|
||||
else if(isset($_GET['fid2']) && !empty($_GET['fid2'])) $aid = $database->ForumCatAlliance($_GET['fid2']);
|
||||
@@ -83,8 +83,9 @@ if(isset($_POST['editforum']) &&
|
||||
|
||||
if(isset($_POST['newtopic']) && isset($_POST['thema']) && isset($_POST['text']) && isset($_POST['fid'])
|
||||
&& !empty($_POST['thema']) && !empty($_POST['text']) && !empty($_POST['fid']) &&
|
||||
(($forumData = reset($database->ForumCatEdit($_POST['fid'])))['alliance'] == $session->alliance ||
|
||||
$forumData['forum_area'] == 1 || $alliance->isForumAccessible($_POST['fid'])))
|
||||
((($forumData = reset($database->ForumCatEdit($_POST['fid'])))['alliance'] == $session->alliance ||
|
||||
$forumData['forum_area'] == 1 || $alliance->isForumAccessible($_POST['fid'])) &&
|
||||
($forumData['forum_area'] != 3 || ($forumData['forum_area'] == 3 && $opt['opt5'] == 1))))
|
||||
{
|
||||
$title = $_POST['thema'];
|
||||
$text = $_POST['text'];
|
||||
@@ -117,8 +118,10 @@ if(isset($_POST['newtopic']) && isset($_POST['thema']) && isset($_POST['text'])
|
||||
if(isset($_POST['newpost']) && isset($_POST['text']) && !empty($_POST['text']) &&
|
||||
isset($_POST['tid']) && !empty($_POST['tid']) &&
|
||||
isset($_POST['fid2']) && !empty($_POST['fid2']) &&
|
||||
(($forumData = reset($database->ForumCatEdit($_POST['fid2'])))['alliance'] == $session->alliance ||
|
||||
$forumData['forum_area'] == 1 || $alliance->isForumAccessible($_POST['fid2'])))
|
||||
((($forumData = reset($database->ForumCatEdit($_POST['fid2'])))['alliance'] == $session->alliance ||
|
||||
$forumData['forum_area'] == 1 || $alliance->isForumAccessible($_POST['fid2'])) &&
|
||||
(($forumData['forum_area'] != 3 && !reset($database->ShowTopic($_POST['tid']))['close'])
|
||||
|| ($forumData['forum_area'] == 3 && $opt['opt5'] == 1))))
|
||||
{
|
||||
$text = $_POST['text'];
|
||||
$tids = $_POST['tid'];
|
||||
|
||||
Reference in New Issue
Block a user