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('status', 'delete_mail_success'); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } else {
} $Admin->updateEMail($Info); $fixedaliases = $Admin->fixAliases($_REQUEST['new_email'], $_REQUEST['prevemail']); $smarty->assign('fixedaliases', $fixedaliases); $smarty->assign('email', $Info['email']); $smarty->assign('status', 'editsuccess'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } } elseif ($_REQUEST['action'] == 'retr_info') { $MySQL = new iacMySQL(); $Converter = new MirConvert(); $MySQL->Execute("SELECT * FROM users WHERE id = '{$_REQUEST['user']}'"); $email_info = $MySQL->FetchOne(); $MySQL->Execute("SELECT * FROM departments ORDER BY deptid ASC"); $departments = $MySQL->FetchAll(); $MySQL->Execute("SELECT * FROM domains ORDER BY id ASC"); $Domains = $MySQL->FetchAll(); $departments = make_select_array($departments, 'deptid', 'department'); $Domains = make_select_array($Domains, 'id', 'domain'); $emailparts = split("@", $email_info['email']); $MySQL->Execute("SELECT id FROM domains WHERE domain = '{$emailparts[1]}'"); $Domain = $MySQL->FetchOne(); $smarty->assign('userid', $email_info['id']); $smarty->assign('departments', $departments); $smarty->assign('Domains', $Domains); $smarty->assign('Domain', $Domain['id']); $smarty->assign('email', $emailparts[0]); $smarty->assign('user_name', $email_info['user_name']);
$smarty->assign('errors', $errors); $smarty->assign('domaininfo', $domaininfo); $smarty->assign('step', 'edit_domain'); $smarty->assign('form', 'editdomain'); $smarty->display('home.tpl'); } else { $smarty->assign('status', 'edit_domain_success'); $MySQL = new iacMySQL(); $Stats = new HomePageStats($MySQL); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } } } elseif ($_REQUEST['action'] == 'retr_domain_info') { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM domains WHERE id = '{$_REQUEST['domain']}'"); $domaininfo = $MySQL->FetchOne(); $smarty->assign('domaininfo', $domaininfo); $smarty->assign('step', 'edit_domain'); $smarty->assign('form', 'editdomain'); $smarty->display('home.tpl'); } else { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT id, domain FROM domains"); $domains = $MySQL->FetchAll(); $domains = make_select_array($domains, 'id', 'domain'); $smarty->assign('domains', $domains); $smarty->assign('step', 'select_domain'); $smarty->assign('form', 'editdomain'); $smarty->display('home.tpl'); }
$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); $smarty->assign('HomePageStats', $Stats->GiveAllStats()); $smarty->display('home.tpl'); } } } elseif ($_REQUEST['action'] == 'retr_department_info') { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT deptid, department FROM departments WHERE deptid = '{$_REQUEST['department']}'"); $departmentinfo = $MySQL->FetchOne(); $smarty->assign('departmentinfo', $departmentinfo); $smarty->assign('step', 'edit_department'); $smarty->assign('form', 'editdepartment'); $smarty->display('home.tpl'); } else { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM departments ORDER BY deptid ASC"); $departments = $MySQL->FetchAll(); $departments = make_select_array($departments, 'deptid', 'department'); $smarty->assign('departments', $departments); $smarty->assign('step', 'select_department'); $smarty->assign('form', 'editdepartment'); $smarty->display('home.tpl'); }
} if ($_REQUEST['action'] == 'submit_new') { $errors = array(); if (!$_REQUEST['user_name']) { $errors[] = "Please Input a Valid User Name."; } if (!$_REQUEST['user_surname']) { $errors[] = "Please Input a Valid User Surname."; } if (!$_REQUEST['new_email']) { $errors[] = "Please input a Valid E-Mail Address."; } if ($_REQUEST['new_email']) { $MySQL = new iacMySQL(); $MySQL->Execute("SELECT * FROM domains WHERE id = {$_REQUEST['domain']}"); $Dom = $MySQL->FetchOne(); $_REQUEST['new_email'] = $_REQUEST['new_email'] . "@" . $Dom['domain']; if (!checkEmail($_REQUEST['new_email'])) { $errors[] = "The E-Mail Address provided is not valid. Please Supply a Valid E-Mail Address."; } } if (!$_REQUEST['password']) { $errors[] = "Please Input a Valid Password"; } if (!$_REQUEST['password_confirm']) { $errors[] = "Please Input a Confirmation Password"; } if ($_REQUEST['password'] && $_REQUEST['password_confirm']) { if ($_REQUEST['password'] != $_REQUEST['password_confirm']) { $errors[] = "Passwords Do Not Match. Please try again."; }
function deleteDepartment($deptid) { $MySQL = new iacMySQL(); $MySQL->esc($deptid); $MySQL->Execute("SELECT deptid FROM departments WHERE department = 'Default'"); $defaultid = $MySQL->FetchOne(); //var_dump($defaultid); $user_upd_statement = "UPDATE users SET\r\n\t\t\t\t\t\t\t\t\t\t\t\tdeptid = '{$defaultid['deptid']}'\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tdeptid = '{$deptid}'\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t"; $del_statement = "DELETE FROM departments WHERE deptid = '{$deptid}'"; return $MySQL->Execute($user_upd_statement) && $MySQL->Execute($del_statement); }
$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 { if ($_REQUEST['alias_type'] == 'external_alias') { //Insert 'External' EMail Alias... $domain = $MySQL->esc($_REQUEST['domain']); $MySQL->Execute("SELECT domain FROM domains WHERE id = {$domain}"); $domain = $MySQL->FetchOne(); $new_alias = $_REQUEST['new_alias'] . "@" . $domain['domain']; if (!checkEmail($new_alias)) { $errors[] = "The Provided E-Mail Address is not valid. Please Provide a Valid E-Mail Alias."; } if (!$_REQUEST['email_address']) { $errors[] = 'No Destination E-Mail Address Provided. Please Provide a valid destination E-Mail Address.'; } if (!checkEmail($_REQUEST['email_address'])) { $errors = 'Provided Destination E-Mail Address was invalid. Please Provide a Valid Destination E-Mail Address.'; } if (count($errors) != 0) { $smarty->assign('new_alias', $_REQUEST['new_alias']); $smarty->assign('domain', $_REQUEST['domain']); $smarty->assign('email', $_REQUEST['email_address']); $MySQL->Execute("SELECT * FROM domains");