<?php
////////////////////////////////////////////////////////////////////////////////
// Copyright (c), 2002, Sadri Sahraoui <hide@address.com> //
// Hosting App - A web based hosting management system //
// http://sf.net/projetcs/hostingapp/ //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of the GNU General Public License //
// //
// This program 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 GNU General Public License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
/**
*
* @version v1.1, 19/09/2002
*
*/
session_start();
define('MX_GENERAL_PATH', 'config/'); // path to Mxconf.php
define('MX_ERROR_PATH', 'modules/Mx/'); // path to ErrorManager.php
require("./config/config.inc.php");
$tpl = new ModeliXe("admin/main.mxt", session_name()."=".session_id()); // Instantiation of Modelixe Class
$tpl -> SetModeliXe();
$tpl -> SetMxLang("./lang/index.lang.".$lang); //set default langage
$tpl -> MxText('title', $app_name." ".$app_version); // Title
$tpl -> MxBloc('header', 'modify', './tpl/admin/header.mxt'); //header
$tpl -> MxBloc('body', 'modify', './tpl/admin/body.mxt'); //body
if (isset($HTTP_GET_VARS['what'])) {
switch($HTTP_GET_VARS['what']){ // defining which form must be dispalyed
case "product":
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.products.mxt'); // build sub menu
$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/add_product.mxt'); // product form
$tpl -> MxText('body.main_bloc.form_url', "add.php");
build_subProducts(& $tpl); // display Url's based on user permission
break;
case "user":
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.users.mxt');
$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/add_user.mxt'); // user form
$tpl -> MxText('body.main_bloc.form_url', "add.php");
build_subUsers(& $tpl);
break;
case "domain":
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.domains.mxt');
$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/add_domain.mxt'); // domain form
//$tpl -> MxText('body.main_bloc.form_url', "add.php?".$HTTP_ENV_VARS['QUERY_STRING']);
build_subDomains(& $tpl);
get_domain_admin(); // print domain admin
get_packs(); //print packs to sell
break;
case "email":
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.emails.mxt');
$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/bloc_mail.mxt'); // user form
$tpl -> MxText('body.main_bloc.form_url', "add.php?".$HTTP_ENV_VARS['QUERY_STRING']);
build_subEmails(& $tpl);
get_domains();
$tpl -> MxFormField('body.main_bloc.mail.email', "text", "email", '');
$tpl -> MxFormField('body.main_bloc.mail.password', "text", "password", '');
$tpl -> MxHidden('body.main_bloc.what', "what=email");
$tpl -> MxHidden('body.main_bloc.form', "form=1");
break;
} // switch
} elseif (isset($HTTP_POST_VARS['form'])) { // process form info
switch($HTTP_POST_VARS['what']){
case "product":
// product form
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.products.mxt');
build_subProducts(& $tpl);
$add = validate_product_data ($HTTP_POST_VARS['pack_name'], $HTTP_POST_VARS['space'],$HTTP_POST_VARS['num_mail'], $HTTP_POST_VARS['hits'], $HTTP_POST_VARS['bandwidth'], 'add');
break;
case "user":
// user form
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.users.mxt');
build_subUsers(& $tpl);
validate_user_data ($HTTP_POST_VARS['first'], $HTTP_POST_VARS['last'], $HTTP_POST_VARS['email'], $HTTP_POST_VARS['login'] , $HTTP_POST_VARS['password'] , $HTTP_POST_VARS['company'], $HTTP_POST_VARS['address'], $HTTP_POST_VARS['city'], $HTTP_POST_VARS['zip'], $HTTP_POST_VARS['phone'], 'add');
break;
case "domain":
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.domains.mxt');
build_subDomains(& $tpl);
validate_domain ($HTTP_POST_VARS['domain'], $HTTP_POST_VARS['domain_admin'], $HTTP_POST_VARS['products'], $HTTP_POST_VARS['create_mail'], 'add');
$tpl -> MxText('body.main_bloc.form_url', "add.php");
break;
case "email":
// email form
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.emails.mxt');
build_subEmails(& $tpl);
validate_email ($HTTP_POST_VARS['email']);
add_email($HTTP_POST_VARS['domain'], $HTTP_POST_VARS['email'][$i], $HTTP_POST_VARS['password'][$i]);
break;
} // switch
}else{
if ($HTTP_POST_VARS['form_mail']) {
for ($i=0; $i < sizeof($HTTP_POST_VARS['email']); $i++){
validate_email ($HTTP_POST_VARS['email'][$i]);
$add = add_email($HTTP_POST_VARS['id'], $HTTP_POST_VARS['email'][$i], $HTTP_POST_VARS['password'][$i]);
}
$tpl -> MxBloc('body.main_bloc', 'modify', './tpl/admin/add_domain.mxt');
$tpl -> MxBloc('sub_menu', 'modify', './tpl/admin/sub.domains.mxt');
$tpl -> MxText('body.main_bloc.feedback',"Email's Added Successfully");
build_subDomains(& $tpl);
}
}
switch($HTTP_SERVER_VARS['REQUEST_METHOD']){
case "GET":
$tpl -> MxImage('body.cat_img', "img/".$HTTP_GET_VARS['what']."s.1.gif");
break;
case "POST":
$tpl -> MxImage('body.cat_img', "img/".$HTTP_POST_VARS['what']."s.1.gif");
break;
default:
$tpl -> MxImage('body.cat_img', "img/".$HTTP_GET_VARS['what']."s.1.gif");
} // switch
$tpl -> MxBloc('footer', 'modify', './tpl/admin/footer.mxt');
$tpl -> MxWrite();
?>