View file admincp/permissions.php

File size: 8.27Kb
<?php
// YANG HACK JANGAN HILANGKAN LISENSI INI
// HTTP://INDWAP.COM
// DAMAI SELALU TAK PERNAH JAIL KARENA TIDAK BISA APA-APA
// SCRIPT BY ULOKI.COM
// REMODIF BY ANTOQ 
// HTTP://FACEBOOK.COM/WWW.INDWAP.ORG


require("../include/init.php");


if($group[$user->groupid]['type'] < 3)
{
forward("index.php");
}

include "../include/header.php";
?>
<div class="phdr">Permissions</div>
<?php

if($group[$user->groupid]['type'] == 3)
{
err_msg("Admin CP","You dont have this right to perform this section.");
}


if(isset($_GET['do']))
$do=$_GET['do'];
else
$do="";

if($do=="edit")
{
$gid=$_GET['gid'];
$fid=$_GET['fid'];

//$gr=$db->get_row("SELECT * FROM b_groups WHERE groupid='$gid'");
$per=$db->get_row("SELECT * FROM b_permissions p, b_groups g, b_forums f WHERE g.groupid='$gid' AND p.forumid='$fid' AND p.forumid=f.forumid AND p.groupid=g.groupid");


if(isset($_POST['save']))
{

$viewforum=$_POST['viewforum'];
$download=$_POST['download'];
$upload=$_POST['upload'];
$newtopic=$_POST['newtopic'];
$newpost=$_POST['newpost'];
$stickthread=$_POST['stickthread'];
$editpost=$_POST['editpost'];
$editotherpost=$_POST['editotherpost'];
$deletepost=$_POST['deletepost'];
$deleteotherpost=$_POST['deleteotherpost'];
$movethread=$_POST['movethread'];
$lockthread=$_POST['lockthread'];


$db->update_data("UPDATE b_permissions SET view='$viewforum', download='$download', upload='$upload', newtopic='$newtopic', newpost='$newpost', stickthread='$stickthread', editpost='$editpost', editotherpost='$editotherpost', deletepost='$deletepost', deleteotherpost='$deleteotherpost', movethread='$movethread', lockthread='$lockthread' WHERE permissionid='$per->permissionid'") or die(mysql_error());

err_msg("Admin CP","Permission updated. <a href=\"permissions.php\">Click here</a>","</td></tr></table>");

}
else
{

?>

<form action="permissions.php?do=edit&fid=<?php echo $fid;?>&gid=<?php echo $gid; ?>" method="POST">
<table class="smalltable" width="100%">
<tr class="headline"><td>Edit permission =></td><td> Group : <?php echo $group[$gid]['name'];?> <br/> Forum : <?php echo $per->name;?></td></tr>
</table>

<table class="smalltable" width="100%">
<tr class="forumrow2"><td>Can View Forum : </td> <td>
<?php
if($per->view==1)
print "<input type=\"radio\" name=\"viewforum\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"viewforum\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"viewforum\" value=\"1\"/>Yes <input type=\"radio\" name=\"viewforum\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Download File</td><td>";
if($per->download==1)
print "<input type=\"radio\" name=\"download\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"download\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"download\" value=\"1\"/>Yes <input type=\"radio\" name=\"download\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Upload File</td><td>";
if($per->upload==1)
print "<input type=\"radio\" name=\"upload\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"upload\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"upload\" value=\"1\"/>Yes <input type=\"radio\" name=\"upload\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Open Thread</td><td>";
if($per->newtopic==1)
print "<input type=\"radio\" name=\"newtopic\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"newtopic\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"newtopic\" value=\"1\"/>Yes <input type=\"radio\" name=\"newtopic\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Open Stick Thread</td><td>";
if($per->stickthread==1)
print "<input type=\"radio\" name=\"stickthread\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"stickthread\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"stickthread\" value=\"1\"/>Yes <input type=\"radio\" name=\"stickthread\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Post Reply</td><td>";
if($per->newpost==1)
print "<input type=\"radio\" name=\"newpost\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"newpost\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"newpost\" value=\"1\"/>Yes <input type=\"radio\" name=\"newpost\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Edit Own Thread/Post</td><td>";
if($per->editpost==1)
print "<input type=\"radio\" name=\"editpost\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"editpost\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"editpost\" value=\"1\"/>Yes <input type=\"radio\" name=\"editpost\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Edit Other Thread/Post</td><td>";
if($per->editotherpost==1)
print "<input type=\"radio\" name=\"editotherpost\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"editotherpost\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"editotherpost\" value=\"1\"/>Yes <input type=\"radio\" name=\"editotherpost\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Delete Own Thread/Post</td><td>";
if($per->deletepost==1)
print "<input type=\"radio\" name=\"deletepost\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"deletepost\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"deletepost\" value=\"1\"/>Yes <input type=\"radio\" name=\"deletepost\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Delete Others Thread/Post</td><td>";
if($per->deleteotherpost==1)
print "<input type=\"radio\" name=\"deleteotherpost\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"deleteotherpost\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"deleteotherpost\" value=\"1\"/>Yes <input type=\"radio\" name=\"deleteotherpost\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Move Thread</td><td>";
if($per->movethread==1)
print "<input type=\"radio\" name=\"movethread\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"movethread\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"movethread\" value=\"1\"/>Yes <input type=\"radio\" name=\"movethread\" value=\"0\" checked=\"checked\"/>No ";

print "</td></tr><tr class=\"forumrow2\"><td>Can Lock Thread</td><td>";
if($per->lockthread==1)
print "<input type=\"radio\" name=\"lockthread\" value=\"1\" checked=\"checked\"/>Yes <input type=\"radio\" name=\"lockthread\" value=\"0\"/>No ";
else
print "<input type=\"radio\" name=\"lockthread\" value=\"1\"/>Yes <input type=\"radio\" name=\"lockthread\" value=\"0\" checked=\"checked\"/>No ";
print "</td></tr>";

?>

<tr><td></td><td> <input type="submit" name="save" value="Save"/> </td> </tr>
</table>
</form>

<?php
}
}
else
{
?>

<table class="smalltable" width="100%">
<!--	<tr class="headline"><td>Group Name</td><td>Group Type</td><td>Priority</td></tr>-->
<?php

$forumlist=$db->select("SELECT * FROM b_forums WHERE pforum='0' ORDER BY sort ASC");
if($forumlist)
{
foreach($forumlist as $forum)
{

print "<tr style=\"background-color:#dddddd;\"><td>".$forum->name."</td><td>&nbsp;</td></tr>";
print "<tr><td><ul>";
foreach($group as $key => $val)
print "<li><a href=\"permissions.php?do=edit&fid=".$forum->forumid."&gid=".$key."\">Edit</a> - ".$val['name']."</li>";
print "</ul></td></tr>";

$subforumlist=$db->select("SELECT * FROM b_forums WHERE pforum='$forum->forumid' ORDER BY sort ASC");
if($subforumlist)
{
foreach($subforumlist as $subforum)
{
print "<tr style=\"background-color:#dddddd;\"><td>&nbsp;</td><td>".$subforum->name."</td></tr>";
print "<tr><td>&nbsp;</td><td><ul>";
foreach($group as $key => $val)
print "<li><a href=\"permissions.php?do=edit&fid=".$subforum->forumid."&gid=".$key."\">Edit</a> - ".$val['name']."</li>";
print "</ul></td></tr>";
}
}

}
}

?>
</table>
<?php
}
echo '<div class="phdr"><a href="index.php">Admin Panel</a> | <a href="permissions.php">Kembali</a></div>';
include "../include/footer.php"; 
?>