<?php
/* +--------------------------------------------
* |
* | Product: PHPEchoCMS
* | Author: Anas Husseini
* | License: GPL
* | Last updated: 26.02.07
* | For version: 1.6
* | Desc: Module for working with files module
* |
* +--------------------------------------------
*/
if( !ADMIN_LOAD )
{
die( "Base not loaded!" );
}
$mlang = $core->getlang("admin_modulemanage");
if (@$_POST['id'] && $_POST['action'])
{
switch ($_POST['action'])
{
case 'off':
$q = "update `".PREFIX."modules` set `status`='OFF' where `id`=".addslashes($_POST['id']);
break;
case 'on':
$q = "update `".PREFIX."modules` set `status`='ON' where `id`=".addslashes($_POST['id']);
break;
case 'delete':
$q = "delete from `".PREFIX."modules` where id=".addslashes($_POST['id']);
break;
default:
break;
}
query ($q, 1);
echo $mlang['006'];
redirect ("index.php?module=admin&act=modulemanage");
}
elseif (@$_GET['id'])
{
// Editing the status of a selected Module
$module = query ("select * from `".PREFIX."modules` where `id`=".addslashes($_GET['id']), 4);
if ($module['id'] == addslashes($_GET['id']))
{
echo "<form action='index.php?module=admin&act=modulemanage' method='post'>";
echo "<input type=hidden name='id' value=".$module['id']."><br>";
echo "<table width='60%' class='title'><tr><td width='80%' class='title'>".$module['display_name']."</td>";
echo "<td class='title'><select name='action'>";
echo "<option value='on'>ON</option>";
echo "<option value='off'>OFF</option>";
echo "<option value='delete'>".$mlang['005']."</option>";
echo "</select></td></tr></table><br>";
echo "<input type=submit value='".$mlang['004']."'></form>";
}
else
echo $mlang['003'];
}
else
{
// Display the modules and their status
$modules = query ("select * from `".PREFIX."modules` where `show_menu`='1'", 1);
echo "<br><table width='100%'>";
echo "<tr><td width='5%' class='title'><center>#</center></td>";
echo "<td width='80%' class='title'> ".$mlang['001']."</td>";
echo "<td width='15%' class='title'><center>".$mlang['002']."</center></td></tr>";
while ($module = mysql_fetch_array ($modules) )
{
echo "<tr><td width='5%' class='border'><center>".$module['id']."</center></td>";
echo "<td width='80%' class='border'> <a href='index.php?module=admin&act=modulemanage&id="
.$module['id']."'>".$module['display_name']."</a></td>";
echo "<td width='15%' class='border'><center>".$module['status']."</center></td></tr>";
}
echo "</table><br>";
}
?>