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
+8 -5
View File
@@ -76,7 +76,7 @@ class Alliance {
}
}
}
/**
* Determines if a player can act with the forum (edit/delete/create things, etc.)
*
@@ -87,10 +87,13 @@ class Alliance {
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'])) && $session->alliance > 0 &&
($mode || (isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin"))) ||
$datas['owner'] == $session->uid) || ($datas['forum_owner'] == $session->uid && $datas['alliance'] == 0));
$hasSwitchedToAdmin = isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin";
return (/*$database->CheckEditRes($datas['aid']) == 1 && */($datas['alliance'] > 0 && (($database->isAllianceOwner($session->uid) == $datas['alliance'] ||
($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance'])) &&
($mode || $hasSwitchedToAdmin)) ||
($datas['owner'] == $session->uid && $session->access != ADMIN)) ||
($session->access == ADMIN && ($mode || $hasSwitchedToAdmin)));
}
/**
+29 -23
View File
@@ -3,7 +3,7 @@
include_once ("config.php");
include_once ("Lang/".LANG.".php");
$pattern = array();
$pattern = [];
$pattern[0] = "/\[b\](.*?)\[\/b\]/is";
$pattern[1] = "/\[i\](.*?)\[\/i\]/is";
$pattern[2] = "/\[u\](.*?)\[\/u\]/is";
@@ -94,7 +94,7 @@ $pattern[86] = "/\*veryangry\*/";
$pattern[87] = "/\*veryhappy\*/";
$pattern[88] = "/\;\)/";
$replace = array();
$replace = [];
$replace[0] = "<b>$1</b>";
$replace[1] = "<i>$1</i>";
$replace[2] = "<u>$1</u>";
@@ -195,12 +195,9 @@ $input = preg_replace_callback(
function($matches) {
global $database;
$aname = $database->getAllianceID($matches[1]);
if ($aname) {
return "<a href=allianz.php?aid=$aname>".$matches[2]."</a>";
} else {
return $matches[2];
}
$aname = $database->getAllianceName($matches[2]);
if (!empty($aname)) return "<a href=allianz.php?aid=$matches[2]>".$aname."</a>";
else return "Alliance not found!";
},
$input);
@@ -210,12 +207,9 @@ $input = preg_replace_callback(
function($matches) {
global $database;
$uname = $database->getUserField((int) $matches[1], "id", 0);
if ($uname) {
return "<a href=spieler.php?uid=$uname>".$matches[2]."</a>";
} else {
return $matches[2];
}
$uname = $database->getUserField((int) $matches[2], "username", 0);
if (!empty($uname) && $uname != "[?]") return "<a href=spieler.php?uid=$matches[2]>".$uname."</a>";
else return "Player not found!";
},
$input);
@@ -224,10 +218,12 @@ $input = preg_replace_callback(
"/\[report(\d{0,20})\]([^\]]*)\[\/report\d{0,20}\]/is",
function($matches) {
global $database;
$report = count($database->getNotice2((int) $matches[1]));
if (count($report)) return "<a href=berichte.php?id=".$matches[1].">".$matches[2]."</a>";
else return $matches[2];
$reportID = $matches[1] > 0 ? $matches[1] : $matches[2];
$report = $database->getNotice2((int) $reportID, null, false);
if (!empty($report)) return "<a href=berichte.php?id=".$reportID.">".$report['topic']."</a>";
else return "Report not found!";
},
$input);
@@ -235,15 +231,25 @@ $input = preg_replace_callback(
$input = preg_replace_callback(
"/\[coor(\d{0,20})\]([^\]]*)\[\/coor\d{0,20}\]/is",
function($matches) {
global $generator;
$cwref = $generator->getMapCheck($matches[1]);
return "<a href=karte.php?d=".$matches[1]."&amp;c=".$cwref.">".$matches[2]."</a>";
global $generator, $database;
$name = "";
$coordinates = explode("|", $matches[2]);
$wRef = $database->getVilWref($coordinates[0], $coordinates[1]);
$cwref = $generator->getMapCheck($wRef);
$state = $database->getVillageType($wRef);
if($state > 0){
if($database->getVillageState($wRef)) $name = $database->getVillageField($wRef, 'name');
else $name = ABANDVALLEY;
}
else $name = $database->getOasisInfo($wRef)['name'];
if(!empty($name)) return "<a href=karte.php?d=".$wRef."&amp;c=".$cwref.">".$name." (".$coordinates[0]."|".$coordinates[1].")"."</a>";
return "Village not found!";
},
$input);
$input = preg_replace('/\[message\]/', '', $input);
$input = preg_replace('/\[\/message\]/', '', $input);
$bbcoded = preg_replace($pattern, $replace, $input);
?>
+15 -15
View File
@@ -2517,10 +2517,10 @@ class MYSQLi_DB implements IDbConnection {
return mysqli_query($this->dblink,$q);
}
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);
function UpdateEditForum($id, $name, $des, $alliances, $users) {
list($id, $name, $des, $alliances, $users) = $this->escape_input((int) $id, $name, $des, $alliances, $users);
$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";
$q = "UPDATE " . TB_PREFIX . "forum_cat SET forum_name = '$name', forum_des = '$des', display_to_alliances = '$alliances', display_to_users = '$users' WHERE id = $id";
return mysqli_query($this->dblink,$q);
}
@@ -2584,11 +2584,11 @@ class MYSQLi_DB implements IDbConnection {
return mysqli_insert_id($this->dblink);
}
function CreatTopic($title, $post, $cat, $owner, $alli, $ends, $alliance, $player, $coor, $report) {
list($title, $post, $cat, $owner, $alli, $ends, $alliance, $player, $coor, $report) = $this->escape_input($title, $post, (int) $cat, (int) $owner, (int) $alli, (int) $ends, (int) $alliance, (int) $player, (int) $coor, (int) $report);
function CreatTopic($title, $post, $cat, $owner, $alli, $ends) {
list($title, $post, $cat, $owner, $alli, $ends) = $this->escape_input($title, $post, (int) $cat, (int) $owner, (int) $alli, (int) $ends);
$date = time();
$q = "INSERT into " . TB_PREFIX . "forum_topic values (0,'$title','$post',$date, $date, $cat, $owner, $alli, $ends, 0, 0, $alliance, $player, $coor, $report)";
$q = "INSERT into " . TB_PREFIX . "forum_topic values (0,'$title','$post',$date, $date, $cat, $owner, $alli, $ends, 0, 0)";
mysqli_query($this->dblink,$q);
return mysqli_insert_id($this->dblink);
}
@@ -2671,12 +2671,12 @@ class MYSQLi_DB implements IDbConnection {
FORUM SUREY
*************************/
function CreatPost($post, $tids, $owner, $alliance, $player, $coor, $report, $fid2 = 0) {
function CreatPost($post, $tids, $owner, $fid2 = 0) {
global $message, $session;
list($post, $tids, $owner, $alliance, $player, $coor, $report, $fid2) = $this->escape_input($post, (int) $tids, $owner, (int) $alliance, (int) $player, (int) $coor, (int) $report, (int) $fid2);
list($post, $tids, $owner, $fid2) = $this->escape_input($post, (int) $tids, $owner, (int) $fid2);
$date = time();
$q = "INSERT into " . TB_PREFIX . "forum_post values (0,'$post',$tids,'$owner','$date',$alliance,$player,$coor,$report)";
$q = "INSERT into " . TB_PREFIX . "forum_post values (0,'$post',$tids,'$owner','$date')";
mysqli_query($this->dblink,$q);
$postID = mysqli_insert_id($this->dblink);
@@ -2715,18 +2715,18 @@ class MYSQLi_DB implements IDbConnection {
return mysqli_query($this->dblink,$q);
}
function EditUpdateTopic($id, $post, $alliance, $player, $coor, $report) {
list($id, $post, $alliance, $player, $coor, $report) = $this->escape_input((int) $id, $post, (int) $alliance, (int) $player, (int) $coor, (int) $report);
function EditUpdateTopic($id, $post) {
list($id, $post) = $this->escape_input((int) $id, $post);
$q = "UPDATE " . TB_PREFIX . "forum_topic set post = '$post', alliance0 = $alliance, player0 = $player, coor0 = $coor, report0 = $report where id = $id";
$q = "UPDATE " . TB_PREFIX . "forum_topic set post = '$post' where id = $id";
return mysqli_query($this->dblink, $q);
}
function EditUpdatePost($id, $post, $alliance, $player, $coor, $report) {
list($id, $post, $alliance, $player, $coor, $report) = $this->escape_input((int) $id, $post, (int) $alliance, (int) $player, (int) $coor, (int) $report);
function EditUpdatePost($id, $post) {
list($id, $post) = $this->escape_input((int) $id, $post);
$q = "UPDATE " . TB_PREFIX . "forum_post set post = '$post', alliance0 = $alliance, player0 = $player, coor0 = $coor, report0 = $report where id = $id";
$q = "UPDATE " . TB_PREFIX . "forum_post set post = '$post' where id = $id";
return mysqli_query($this->dblink,$q);
}
+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>
+37 -292
View File
@@ -21,15 +21,17 @@ $ids = $_GET['s'];
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)
isset($_POST['bid']) && $_POST['bid'] >= 0 && $_POST['bid'] <= 3 &&
($session->access == 9 || ($session->alliance > 0 && $opt['opt5'] == 1)))
{
//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;
//Check if the user is the ADMIN (Multihunter account) or not, if not, it will not be able to create public forum
//ADMIN can only creates public forums
if($session->access != ADMIN && $_POST['bid'] == 1) $_POST['bid'] = 0;
elseif($session->access == ADMIN && $_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']);
@@ -39,7 +41,7 @@ if(isset($_POST['new']) &&
$forum_des = $_POST['u2'];
$forum_owner = $session->uid;
$forum_area = $_POST['bid'];
$database->CreatForum($forum_owner, $cantEdit ? 0 : $session->alliance, $forum_name, $forum_des, $forum_area, $forumViewable['alliances'], $forumViewable['users']);
$database->CreatForum($forum_owner, $session->alliance, $forum_name, $forum_des, $forum_area, $forumViewable['alliances'], $forumViewable['users']);
}
if(isset($_POST['edittopic']) &&
@@ -47,14 +49,11 @@ 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'],
'forum_owner' => ($forumData = reset($database->ForumCatEdit($_POST['fid'])))['owner']], 1) &&
($forumData['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['forum_area'] != 1 && reset($database->ForumCatEdit($topic['cat']))['forum_area'] != 1 && $forumData['alliance'] == $session->alliance) ||
$forumData['id'] == $topic['cat'] || $session->access == ADMIN))
{
//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'];
@@ -65,8 +64,7 @@ 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 && $opt['opt5'] == 1) ||
($forumData = reset($database->ForumCatEdit($_POST['fid'])))['owner'] == $session->uid && $forumData['alliance'] == 0))
(($database->ForumCatAlliance($_POST['fid']) == $session->alliance && $opt['opt5'] == 1) || $session->access == ADMIN))
{
$forumViewable['alliances'] = $forumViewable['users'] = "";
@@ -80,7 +78,7 @@ if(isset($_POST['editforum']) &&
$forum_des = $_POST['u2'];
$forum_des = htmlspecialchars($forum_des);
$forum_id = $_POST['fid'];
$database->UpdateEditForum($forum_id, $forum_name, $forum_des, $session->alliance, $forumViewable['alliances'], $forumViewable['users']);
$database->UpdateEditForum($forum_id, $forum_name, $forum_des, $forumViewable['alliances'], $forumViewable['users']);
}
if(isset($_POST['newtopic']) && isset($_POST['thema']) && isset($_POST['text']) && isset($_POST['fid'])
@@ -92,78 +90,24 @@ if(isset($_POST['newtopic']) && isset($_POST['thema']) && isset($_POST['text'])
$owner = $session->uid;
$alli = $database->ForumCatAlliance($cat);
if(!empty($text)){
if(!preg_match('/\[message\]/', $text) && !preg_match('/\[\/message\]/', $text)){
$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)){
$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;
$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)){
$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;
$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)){
$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;
$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)){
$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;
$report += 1;
}
}
}
$survey = false;
$ends = '';
if(isset($_POST['umfrage'])){
if(isset($_POST['umfrage_ende'])){
$ends_date = $_POST['month']."/".$_POST['day']."/".$_POST['year'];
if($_POST['meridiem'] == 1) $_POST['hour'] += 12;
$ends_time = $_POST['hour'].":".$_POST['minute'];
$ends = strtotime($ends_date) - strtotime(date('d.m.y')) + strtotime($ends_time);
}
for($i = 1; $i <= 8; $i++) if(isset($_POST['option_'.$i]) && !empty($_POST['option_'.$i])) $survey = true;
}
$topic_id = $database->CreatTopic($title, $text, $cat, $owner, $alli, $ends, $alliances, $player, $coor, $report);
if($survey){
$database->createSurvey($topic_id, $_POST['umfrage_thema'], $_POST['option_1'], $_POST['option_2'], $_POST['option_3'], $_POST['option_4'], $_POST['option_5'], $_POST['option_6'], $_POST['option_7'], $_POST['option_8'], $ends);
if(!preg_match('/\[message\]/', $text) && !preg_match('/\[\/message\]/', $text)){
$text = "[message]".$text."[/message]";
$survey = false;
$ends = '';
if(isset($_POST['umfrage'])){
if(isset($_POST['umfrage_ende'])){
$ends_date = $_POST['month']."/".$_POST['day']."/".$_POST['year'];
if($_POST['meridiem'] == 1) $_POST['hour'] += 12;
$ends_time = $_POST['hour'].":".$_POST['minute'];
$ends = strtotime($ends_date) - strtotime(date('d.m.y')) + strtotime($ends_time);
}
for($i = 1; $i <= 8; $i++) if(isset($_POST['option_'.$i]) && !empty($_POST['option_'.$i])) $survey = true;
}
$topic_id = $database->CreatTopic($title, $text, $cat, $owner, $alli, $ends);
if($survey){
$database->createSurvey($topic_id, $_POST['umfrage_thema'], $_POST['option_1'], $_POST['option_2'], $_POST['option_3'], $_POST['option_4'], $_POST['option_5'], $_POST['option_6'], $_POST['option_7'], $_POST['option_8'], $ends);
}
}
}
@@ -179,61 +123,9 @@ if(isset($_POST['newpost']) && isset($_POST['text']) && !empty($_POST['text']) &
$owner = $session->uid;
if(!preg_match('/\[message\]/', $text) && !preg_match('/\[\/message\]/', $text)){
$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)){
$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;
$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)){
$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;
$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)){
$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;
$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)){
$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;
$report += 1;
}
}
}
$database->UpdatePostDate($tids);
$database->CreatPost($text, $tids, $owner, $alliances, $player, $coor, $report, $fid2);
$database->CreatPost($text, $tids, $owner, $fid2);
}
}
@@ -246,82 +138,9 @@ if(isset($_POST['editans']) && isset($_POST['text']) && !empty($_POST['text'])
$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);
}
for($i = 0; $i <= $_POST['player0']; $i++){
$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);
}
for($i = 0; $i <= $_POST['report0']; $i++){
$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]";
$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)){
$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;
$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)){
$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;
$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)){
$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;
$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)){
$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;
$report += 1;
}
}
}
$database->EditUpdateTopic($topic_id, $text, $alliances, $player, $coor, $report);
$database->EditUpdateTopic($topic_id, $text);
}
}
@@ -339,82 +158,8 @@ if(isset($_POST['editpost']) && isset($_POST['text']) && !empty($_POST['text'])
$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);
}
for($i = 0; $i <= $_POST['player0']; $i++){
$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);
}
if(isset($text['report0'])){
for($i = 0; $i <= $text['report0']; $i++){
$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]";
$alliance = $player = $coor = $report = 0;
for($i = 0; $i <= $alliance; $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)){
$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;
$alliance += 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)){
$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;
$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)){
$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;
$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)){
$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;
$report += 1;
}
}
}
$database->EditUpdatePost($posts_id, $text, $alliance, $player, $coor, $report);
}
$database->EditUpdatePost($posts_id, $text);
}
if(!isset($_GET['admin'])) $_GET['admin'] = null;
@@ -431,7 +176,7 @@ if($_GET['admin'] == "switch_admin"){
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))
($forumData = reset($database->ForumCatEdit($_GET['fid'])))['owner'] == $session->uid && $session->access == ADMIN))
{
$database->moveForum($_GET['fid'], $forumData['forum_area'], $session->alliance, $_GET['res']); //Move the forum to the top/bottom of the list
$alliance->redirect($_GET);