Files
TravianZ/Templates/Alliance/Forum/forum_8.tpl
T
iopietro e5d823cda0 Alliance forum fixes part 1
Fixed the majority of security issues:

+Fixed a bug that permitted to edit, delete and create a forum in any
alliance, without any permissions
+Fixed a bug that permitted to edit, create and delete any kind of
thread, with any kind of permission
+Fixed a bug that permitted to edit, modify and delete every kind of
post, without any kind of permission
+Fixed a bug that din't permit to create posts and threads
+Fixed a bug that permitted to create forum and threads with empty
name/topic
+Fixed a bug that permitted to move a thread to an invalid forum
+Fixed a bug that permitted to create an invalid type of forum
+Fixed a bug that didn't permit to move forums, to the top and the
bottom of their forum type (in reality, it wasn't even coded)
+Added a sorting column for supporting the "move to top/bottom"
functionality
+Minor improvements and bug fixing/code indentation/removal of redundant
code

NOTE: For playing this version, you HAVE to add a new column to the table "s1_forum_cat", you can simply do that by running this query (where "s1_" is the prefix of your server): ALTER TABLE s1_forum_cat ADD `sorting` int(11) NOT NULL AFTER `id`
2018-05-18 00:28:48 +02:00

116 lines
4.2 KiB
Smarty

<?php
############################################################
## DO NOT REMOVE THIS NOTICE ##
## MADE BY TTMTT ##
## FIX BY RONIX ##
## TRAVIANZ ##
############################################################
if($session->access == BANNED){
header("Location: banned.php");
exit;
}
$forumData = reset($database->ForumCatEdit($_GET['idf']));
if(empty($forumData) || $forumData['alliance'] != $session->alliance) $alliance->redirect($_GET);
$cat_name = stripslashes($forumData['forum_name']);
$cat_des = stripslashes($forumData['forum_des']);
?>
<script language="JavaScript" type="text/javascript">
function addRow(element_id) {
// element_id: user_list, ally_list
liste = document.getElementById(element_id);
liste = liste.getElementsByTagName('tbody')[0];
var anzahl_trs = liste.getElementsByTagName('tr').length;
var num_fields = anzahl_trs;
var num_last_tr = anzahl_trs -1;
lastTR = liste.getElementsByTagName('tr')[num_last_tr];
lastTD = lastTR.getElementsByTagName('td')[2];
lastIMG = lastTD.getElementsByTagName('img')[0];
lastTD.removeChild(lastIMG);
newTR = document.createElement('tr');
newTD1 = document.createElement('td');
newTD2 = document.createElement('td');
newTD3 = document.createElement('td');
newTR.appendChild(newTD1);
newTR.appendChild(newTD2);
newTR.appendChild(newTD3);
liste.appendChild(newTR);
var html_input_1 = '<input class="text" type="text" ';
if(element_id == 'ally_list') {
newTD1.className = 'ally';
newTD2.className = 'tag';
newTD3.className = 'ad';
newTD1.innerHTML = html_input_1 + 'id="allys_by_id_'+num_fields+'" class="text" maxlength="8" name="allys_by_id['+num_fields+']" onkeyup="checkInputs('+num_fields+',\'allys\')">';
newTD2.innerHTML = html_input_1 + 'id="allys_by_name_'+num_fields+'" class="text" maxlength="8" name="allys_by_name['+num_fields+']" onkeyup="checkInputs('+num_fields+',\'allys\')">';
}
if(element_id == 'user_list') {
newTD1.className = 'id';
newTD2.className = 'pla';
newTD3.className = 'ad';
newTD1.innerHTML = html_input_1 + 'id="users_by_id_'+num_fields+'" class="text" maxlength="8" name="users_by_id['+num_fields+']" onkeyup="checkInputs('+num_fields+',\'users\')">';
newTD2.innerHTML = html_input_1 + 'id="users_by_name_'+num_fields+'" class="text" maxlength="15" name="users_by_name['+num_fields+']" onkeyup="checkInputs('+num_fields+',\'users\')">';
}
newTD3.innerHTML = '<img class="add" src="img/x.gif" title="add" alt="add" onclick="addRow(\''+element_id+'\')">';
}
</script>
<script language="JavaScript" type="text/javascript">
function checkInputs(id, typ) {
id_field = document.getElementById(typ+'_by_id_'+id);
name_field = document.getElementById(typ+'_by_name_'+id);
//alert(id_field.value);
//alert(name_field.value);
if (id_field.value != '' && id_field.disabled == false) {
name_field.disabled = true;
name_field.style.border = '1px solid #999';
}
else {
name_field.disabled = false;
name_field.style.border = '1px solid #71D000';
}
if (name_field.value != '' && name_field.disabled == false) {
id_field.disabled = true;
id_field.style.border = '1px solid #999';
}
else {
id_field.disabled = false;
id_field.style.border = '1px solid #71D000';
}
}
</script><form method="post" action="allianz.php?s=2">
<input type="hidden" name="s" value="2">
<input type="hidden" name="fid" value="<?php echo $_GET['idf']; ?>">
<input type="hidden" name="editforum" value="1">
<table cellpadding="1" cellspacing="1" id="edit_forum"><thead>
<tr>
<th colspan="2">edit forum</th>
</tr>
</thead><tbody>
<tr>
<th>Forum name</th>
<td><input class="text" type="text" name="u1" value="<?php echo $cat_name; ?>" maxlength="30"></td>
</tr>
<tr>
<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>