/** * @author Charl J Loubser * @copyright 2009 */ require 'includes/include.inc.php'; if (!$_SESSION['login']) { $smarty->display('index.tpl'); die; } if (!array_key_exists('action', $_REQUEST)) { $_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'delete') { $errors = array(); $Admin = new vMailAdmin(); if (!$Admin->deleteAlias($_REQUEST['alias'])) { $errors[] = "The Alias could not be deleted. Please try again."; $smarty->assign('errors', $errors); $MySQL = new iacMySQL(); $MySQL->Execute("SELECT forwardings.id, CONCAT(forwardings.source, ' (', users.user_name, ' ', users.user_surname,')') AS user FROM users, forwardings WHERE users.email = forwardings.destination"); $users = $MySQL->FetchAll(); $users = make_select_array($users, 'id', 'user'); $MySQL->Execute("SELECT id, source FROM forwardings"); $allaliases = $MySQL->FetchAll(); $allaliases = make_select_array($allaliases, 'id', 'source'); $smarty->assign('allaliases', $allaliases); $smarty->assign('users', $users); $smarty->assign('step', 'select_user'); $smarty->assign('form', 'deletealias'); $smarty->display('home.tpl');
/** * @author Charl J Loubser * @copyright 2009 */ require 'includes/include.inc.php'; if (!$_SESSION['login']) { $smarty->display('index.tpl'); die; } if (!array_key_exists('action', $_REQUEST)) { $_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'delete') { $errors = array(); $Admin = new vMailAdmin(); $MySQL = new iacMySQL(); foreach ($_REQUEST['users'] as $id) { if (!$Admin->deleteUser($id)) { $MySQL->Execute("SELECT email FROM users WHERE id = '{$id}'"); $email = $MySQL->FetchOne(); $errors[] = "The EMail Address {$email['email']} could not be Deleted. Please Ensure that everything is in order."; } } if (count($errors) != 0) { $amount_mails = count($_REQUEST['users']); $amount_errors = count($errors); $successful_amount = $amount_mails - $amount_errors; $smarty->assign('amount_errors', $amount_errors); $smarty->assign('successful', $successful_amount); $smarty->assign('errors', $errors);
$smarty->assign('user_surname', $_REQUEST['user_surname']); $smarty->assign('userid', $_REQUEST['userid']); $smarty->assign('email', $_REQUEST['new_email']); $smarty->assign('password', $_REQUEST['password']); $smarty->assign('password_confirm', $_REQUEST['password_confirm']); $smarty->assign('quota', $_REQUEST['quota']); $smarty->assign('department', $_REQUEST['department']); $smarty->assign('admin', $_REQUEST['admin']); $smarty->assign('admin_password', $_REQUEST['admin_password']); $smarty->assign('admin_password_confirm', $_REQUEST['admin_password_confirm']); $smarty->assign('previousmail', $_REQUEST['prevemail']); $smarty->assign('errors', $errors); $smarty->assign('form', 'editmail'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $Info = array(); $MySQL->Execute("SELECT domain FROM domains WHERE id = {$_REQUEST['domain']}"); $Info['domain'] = $MySQL->FetchOne(); $Info['email'] = $_REQUEST['new_email'] . "@" . $Info['domain']['domain']; $Info['id'] = $_REQUEST['userid']; $Info['user_name'] = $_REQUEST['user_name']; $Info['user_surname'] = $_REQUEST['user_surname']; if ($_REQUEST['password']) { $Info['password'] = $_REQUEST['password']; } $Converter = new MirConvert(); $Info['user_quota'] = $Converter->MBtoBytes($_REQUEST['user_quota']); $Info['department'] = $_REQUEST['department']; if ($_REQUEST['admin']) { $Info['admin_password'] = $_REQUEST['admin_password'];
} if (!array_key_exists('action', $_REQUEST)) { $_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'submit_new') { $errors = array(); if (!$_REQUEST['new_department']) { $errors[] = "No Department Specified. Please Enter a Department Name."; } if (count($errors) != 0) { $smarty->assign('new_department', $_REQUEST['new_department']); $smarty->assign('errors', $errors); $smarty->assign('form', 'newdepartment'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $Info = array(); $Info['department'] = $_REQUEST['new_department']; $duplicates = $Admin->checkDupDepartments($Info); if ($duplicates) { $errors = array(); $errors[] = "A Duplicate Department Already Exists."; $smarty->assign('new_department', $Info['department']); $smarty->assign('errors', $errors); $smarty->assign('form', 'newdepartment'); $smarty->display('home.tpl'); } else { if (!$Admin->addDepartment($Info)) { $errors = array(); $errors[] = "The Specified Department Could not be added to the database. Please ensure that all daa has been entered correctly and that the Department Does not exist in the Database."; $smarty->assign('new_department', $Info['department']);
$errors = array(); if (!$_REQUEST['domain']) { $errors[] = "No Domain Provided. Please Provide a Valid Domain."; } if (count($errors) != 0) { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM domains WHERE id = '{$_REQUEST['domain']}'"); $domaininfo = $MySQL->FetchOne(); $smarty->assign('domain', $_REQUEST['domain']); $smarty->assign('errors', $errors); $smarty->assign('domaininfo', $domaininfo); $smarty->assign('step', 'edit_domain'); $smarty->assign('form', 'editdomain'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $Info = array(); $Info['domain'] = $_REQUEST['domain']; $Info['domainid'] = $_REQUEST['domainid']; if (!$Admin->updateDomain($Info)) { $errors[] = "The Domain Could Not Be Updated. Please Ensure that All Information has been entered correctly."; $MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM domains WHERE id = '{$_REQUEST['domain']}'"); $domaininfo = $MySQL->FetchOne(); $smarty->assign('domain', $_REQUEST['domain']); $smarty->assign('errors', $errors); $smarty->assign('domaininfo', $domaininfo); $smarty->assign('step', 'edit_domain'); $smarty->assign('form', 'editdomain'); $smarty->display('home.tpl'); } else {
$MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM departments ORDER BY deptid ASC"); $depts = $MySQL->FetchAll(); $MySQL->Execute("SELECT * FROM domains ORDER BY id ASC"); $Domains = $MySQL->FetchAll(); $departments = make_select_array($depts, 'deptid', 'department'); $Domains = make_select_array($Domains, 'id', 'domain'); $smarty->assign('departments', $departments); $smarty->assign('Domains', $Domains); $smarty->assign('departments', $departments); $smarty->assign('errors', $errors); $smarty->assign('form', 'newmail'); $smarty->display('home.tpl'); } else { $Info = array(); $Admin = new vMailAdmin(); $Info['email'] = $_REQUEST['new_email']; $Info['user_department'] = $_REQUEST['department']; $Info['password'] = $_REQUEST['password']; if ($_REQUEST['user_quota']) { $Converter = new MirConvert(); $Info['quota'] = $Converter->MBtoBytes($_REQUEST['user_quota']); } else { $Info['quota'] = 10240; } $Info['user_name'] = $_REQUEST['user_name']; $Info['user_surname'] = $_REQUEST['user_surname']; if ($_REQUEST['admin']) { $Info['admin_password'] = $_REQUEST['admin_password']; } $eMailWelcomeMSG['Welcome_MessageHTML'] = $Welcome_MessageHTML;
$_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'update') { $errors = array(); if (!$_REQUEST['department']) { $errors[] = "No Department Name Specified. Please Specify a Valid Department Name."; } if (count($errors) != 0) { $smarty->assign('departmentid', $_REQUEST['deptid']); $smarty->assign('errors', $errors); $smarty->assign('department', $_REQUEST['department']); $smarty->assign('step', 'edit_department'); $smarty->assign('form', 'editdepartment'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $Info = array(); $Info['department'] = $_REQUEST['department']; $Info['deptid'] = $_REQUEST['deptid']; if (!$Admin->updateDepartment($Info)) { $errors[] = "The Department Could not be Edited. Please Ensure that all Information was entered correctly and try again."; $smarty->assign('departmentid', $_REQUEST['deptid']); $smarty->assign('errors', $errors); $smarty->assign('department', $_REQUEST['department']); $smarty->assign('step', 'edit_department'); $smarty->assign('form', 'editdepartment'); $smarty->display('home.tpl'); } else { $smarty->assign('status', 'edit_department_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL);
} if (!array_key_exists('action', $_REQUEST)) { $_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'submit_new') { $errors = array(); if (!$_REQUEST['new_domain']) { $errors[] = "Please Provide a Domain to add to the Database."; } if (count($errors) != 0) { $smarty->assign('errors', $errors); $smarty->assign('new_domain', $_REQUEST['new_domain']); $smarty->assign('form', 'newdomain'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $Info = array(); $Info['domain'] = $_REQUEST['new_domain']; if (!$Admin->addDomain($Info)) { $errors = array(); $errors[] = "Unable to add Domain '{$_REQUEST['new_domain']}' to the Database. Please ensure that the domain is not already added to the Database and that all infomation was entered correctly."; $smarty->assign('new_domain', $_REQUEST['new_domain']); $smarty->assign('errors', $errors); $smarty->assign('form', 'newdomain'); $smarty->display('home.tpl'); } else { $smarty->assign('status', 'domain_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl');
$domains = make_select_array($domains, 'id', 'domain'); $MySQL->Execute("Select id FROM users WHERE email = '{$aliasinfo['destination']}'"); $email_id = $MySQL->FetchOne(); $smarty->assign('errors', $errors); $smarty->assign('emailinfo', $emailinfo); $smarty->assign('aliasinfo', $aliasinfo); $smarty->assign('alias', $_REQUEST['alias']); $smarty->assign('email_id', $_REQUEST['email']); $smarty->assign('aliasid', $_REQUEST['aliasid']); $smarty->assign('domains', $domains); $smarty->assign('email_id', $email_id); $smarty->assign('step', 'edit_alias'); $smarty->assign('form', 'editalias'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); $MySQL->Execute("SELECT email FROM users WHERE id = '{$_REQUEST['email']}'"); $email = $MySQL->FetchOne(); $Info = array(); $Info['alias'] = $_REQUEST['alias']; $Info['aliasid'] = $_REQUEST['aliasid']; if ($_REQUEST['alias_type'] == 'internal_alias') { $Info['email'] = $email['email']; if (!$Admin->updateAlias($Info)) { $errors[] = "There was a Problem updating the Alias. Please ensure that all data was entered correctly."; $MySQL->Execute("SELECT id, email FROM users"); $emailinfo = $MySQL->FetchAll(); $emailinfo = make_select_array($emailinfo, 'id', 'email'); $smarty->assign('errors', $errors); $smarty->assign('emailinfo', $emailinfo); $smarty->assign('alias', $_REQUEST['alias']);
$smarty->assign('email', $_REQUEST['email_address']); $MySQL->Execute("SELECT * FROM domains"); $domains = $MySQL->FetchAll(); $domains = make_select_array($domains, 'id', 'domain'); $smarty->assign('domains', $domains); $MySQL->Execute("SELECT email, id FROM users"); $emails = $MySQL->FetchAll(); $emails = make_select_array($emails, 'id', 'email'); $smarty->assign('emails', $emails); $smarty->assign('form', 'newalias'); $smarty->assign('errors', $errors); $smarty->display('home.tpl'); } else { //Submit the damn thing ;) $MySQL = new iacMySQL(); $Admin = new vMailAdmin(); $Info = array(); $Info['source'] = $new_alias; $Info['destination'] = $_REQUEST['email_address']; if ($Admin->addAlias($Info)) { $smarty->assign('status', 'new_alias_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } else { $errors = array(); $errors[] = "The E-Mail Alias Could not be added.<br />\r\n\t\t\t\t\t\t\t\t\tPlease Double Check All Entries, as well as Ensure That the E-Mail Alias does not exist."; $smarty->assign('new_alias', $_REQUEST['new_alias']); $smarty->assign('domain', $_REQUEST['domain']); $smarty->assign('email', $_REQUEST['email']);
if ($_REQUEST['action'] == 'delete') { $errors = array(); if ($_REQUEST['deptid'] == 0) { $errors[] = "Cannot Delete the Default Department. Please Select a Department and Try again."; } if (count($errors) != 0) { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT deptid, department FROM departments ORDER BY deptid ASC"); $departments = $MySQL->FetchAll(); $departments = make_select_array($departments, 'deptid', 'department'); $smarty->assign('errors', $errors); $smarty->assign('departments', $departments); $smarty->assign('form', 'deletedepartment'); $smarty->display('home.tpl'); } else { $Admin = new vMailAdmin(); if (!$Admin->deleteDepartment($_REQUEST['deptid'])) { $errors[] = "The Department could not be deleted. Please Select the Correct Department and Try again."; $MySQL = new iacMySQL(); $MySQL->Execute("SELECT deptid, department FROM departments ORDER BY deptid ASC"); $departments = $MySQL->FetchAll(); $departments = make_select_array($departments, 'deptid', 'department'); $smarty->assign('deptid', $_REQUEST['deptid']); $smarty->assign('errors', $errors); $smarty->assign('departments', $departments); $smarty->assign('form', 'deletedepartment'); $smarty->display('home.tpl'); } else { $smarty->assign('status', 'delete_department_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL);
/** * @author Charl J Loubser * @copyright 2009 */ require 'includes/include.inc.php'; if (!$_SESSION['login']) { $smarty->display('index.tpl'); die; } if (!array_key_exists('action', $_REQUEST)) { $_REQUEST['action'] = ''; } if ($_REQUEST['action'] == 'delete') { $errors = array(); $Admin = new vMailAdmin(); if ($Admin->deleteDomain($_REQUEST['domain'])) { $smarty->assign('status', 'delete_domain_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } else { $errors[] = "The Domain could not be deleted from the database."; $MySQL = new iacMySQL(); $MySQL->Execute("SELECT id, domain FROM domains"); $domains = $MySQL->FetchAll(); $domains = make_select_array($domains, 'id', 'domain'); $smarty->assign('errors', $errors); $smarty->assign('domains', $domains); $smarty->assign('form', 'deletedomain');