<?php
session_start();
/*
asaancart - easy shopping cart solution
---------------------------------------
Copyright 2009 Nasir Ahmad Khan
Email: hide@address.com
This file is part of asaancart - open source easy shopping cart solution.
asaancart is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
asaancart is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with asaancart. If not, see <http://www.gnu.org/licenses/>.
*/
include("../config/config.php");
include("includes/chk_login_status_inc.php");
$smarty->assign('title','Modules');
$module_id = $_POST['module_id'];
if($module_id==""){
$module_id = $_GET['module_id'];
}
$module_name = $_GET['module_name'];
$module_description = $_GET['module_description'];
$class_name = $_GET['class_name'];
$module_enable = $_GET['module_enable'];
if($_GET['mode']=="install"){
$sql = "UPDATE modules SET module_enable='yes' WHERE module_id=".$module_id;
$results = mysql_query($sql);
//$smarty->assign('msg', "<span>Done, successfully upadated</span>");
$update_list=1;
}elseif($_GET['mode']=="uninstall")
{
$sql = "UPDATE modules SET module_enable='no' WHERE module_id=".$module_id;
$results = mysql_query($sql);
//$smarty->assign('msg', "<span>Done, successfully upadated</span>");
$update_list=1;
}
if($_GET['mode']=="save")
{
$sql = "UPDATE modules SET module_name='$module_name', module_description='$module_description' WHERE module_id=$module_id";
$results = mysql_query($sql);
$smarty->assign('msg', "<span>Done, saved successfully</span>");
$update_list=1;
}
/*
if($_GET['mode']=="add")
{
$sql = "INSERT INTO shipping_method (shipping_name, shipping_description, email_text, module_id, sort_order) VALUES ('$shipping_name', '$shipping_description', '$email_text', $module_id, 0)";
$results = mysql_query($sql);
$smarty->assign('msg', "<span>Done, settings added successfully</span>");
$update_list=1;
}
if($_GET['mode']=="delete")
{
$sql = "DELETE FROM shipping_method WHERE shipping_id=".$shipping_id;
$results = mysql_query($sql);
$smarty->assign('msg', "<span>Done, deleted successfully</span>");
$update_list=1;
}
$sql = "SELECT * FROM shipping_method";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$list_shipping_methods[] = $row;
}
$smarty->assign('list_shipping_methods', $list_shipping_methods);
*/
$sql = "SELECT * FROM modules ORDER BY module_category";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results) )
{
$list_modules[] = $row;
}
$smarty->assign('list_modules', $list_modules);
if($update_list==1){
$smarty->display('modules_form.tpl');
}else{
$smarty->display('modules.tpl');
}
?>