<?php session_start(); if (Login::isLogged(Login::$_login_front)) { Helper::redirect(Login::$_dashboard_front); } $objForm = new Form(); $objValid = new Validation($objForm); $objUser = new User(); // login form if ($objForm->isPost('login_email')) { if ($objUser->isUser($objForm->getPost('login_email'), $objForm->getPost('login_password'))) { Login::loginFront($objUser->_id, Url::getReferrerUrl()); } else { $objValid->add2Errors('login'); } } // registration form if ($objForm->isPost('first_name')) { $objValid->_expected = array('first_name', 'last_name', 'address_1', 'address_2', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password'); $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email', 'password', 'confirm_password'); $objValid->_special = array('email' => 'email'); $objValid->_post_remove = array('confirm_password'); $objValid->_post_format = array('password' => 'password'); // validate password $pass_1 = $objForm->getPost('password'); $pass_2 = $objForm->getPost('confirm_password'); if (!empty($pass_1) && !empty($pass_2) && $pass_1 != $pass_2) { $objValid->add2Errors('password_mismatch'); } $email = $objForm->getPost('email');
$id = Url::getParam('id'); if (!empty($id)) { $objUser = new User(); $user = $objUser->getUser($id); if (!empty($user)) { $objForm = new Form(); $objValid = new Validation($objForm); if ($objForm->isPost('first_name')) { $objValid->_expected = array('first_name', 'last_name', 'address_1', 'address_2', 'town', 'county', 'post_code', 'country', 'email'); $objValid->_required = array('first_name', 'last_name', 'address_1', 'town', 'county', 'post_code', 'country', 'email'); $objValid->_special = array('email' => 'email'); $email = $objForm->getPost('email'); $duplicate = $objUser->getByEmail($email); if (!empty($duplicate) && $duplicate['id'] != $user['id']) { $objValid->add2Errors('email_duplicate'); } if ($objValid->isValid()) { if ($objUser->updateUser($objValid->_post, $user['id'])) { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited'); } else { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed'); } } } require_once 'template/_header.php'; ?> <h1>Clients :: Edit</h1> <form action="" method="post">
<?php $id = Url::getParam('id'); if (!empty($id)) { $objCatalogue = new Catalogue(); $category = $objCatalogue->getCategory($id); if (!empty($category)) { $objForm = new Form(); $objValid = new Validation($objForm); if ($objForm->isPost('name')) { $objValid->_expected = array('name'); $objValid->_required = array('name'); $name = $objForm->getPost('name'); if ($objCatalogue->duplicateCategory($name, $id)) { $objValid->add2Errors('name_duplicate'); } if ($objValid->isValid()) { if ($objCatalogue->updateCategory($name, $id)) { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited'); } else { Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed'); } } } require_once 'template/_header.php'; ?> <h1>Categories :: Edit</h1> <form action="" method="post">
<?php $this->addScript('/admin/js/ckeditor/ckeditor.js'); $this->addScript('/admin/js/ckeditor/adapters/jquery.js'); $objPage = new Page($this->objLanguage); $objForm = new Form($this->objUrl); $objValidation = new Validation($this->objLanguage); $expected = array('name', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'identity'); $required = array('name', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'identity'); if (isset($_POST['name'])) { $array = $objForm->post2Array($expected, 'content', array('identity' => 'sanitise')); if (array_key_exists('identity', $array) && !empty($array['identity']) && $objPage->duplicate($array['identity'])) { $objValidation->add2Errors('identity', 'identity_taken'); } if ($objValidation->isValid($array, $required)) { if ($objPage->add($array)) { Helper::redirect($this->objUrl->getCurrent(array('a', 'id')) . '/a/index'); } } } require_once 'header.php'; ?> <h1><?php echo $this->objLanguage->labels[9]; ?> </h1> <form method="post"> <table class="tbl_insert"> <tr>
<?php if (Login::isLogged(Login::$_login_admin)) { Helper::redirect(Login::$_dashboard_admin); } $objForm = new Form(); $objValid = new Validation($objForm); if ($objForm->isPost('login_email')) { $objAdmin = new Admin(); if ($objAdmin->isUser($objForm->getPost('login_email'), $objForm->getPost('login_password'))) { Login::loginAdmin($objAdmin->_id, Url::getReferrerUrl()); } else { $objValid->add2Errors('login'); } } require_once 'template/_header.php'; ?> <h1>Login</h1> <form action="" method="post"> <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert"> <tr> <th><label for="login_email">Login:</label></th> <td> <?php echo $objValid->validate('login'); ?> <input type="text" name="login_email" id="login_email"
<?php $objForm = new Form(); $objValid = new Validation($objForm); if ($objForm->isPost('name')) { $objValid->_expected = array('name', 'new', 'retype'); $objValid->_required = array('name', 'new', 'retype'); $new = $objForm->getPost('new'); $retype = $objForm->getPost('retype'); if ($new != '' && $retype != '' && $new != $retype) { $objValid->add2Errors('new_mismatch'); } $id = $objForm->getPost('id'); if ($objValid->isValid()) { $encoded = Login::hash($new); if ($objMember->updateMember(array('password' => $encoded), $id)) { $success = true; } else { $success = false; } } } require_once '_header.php'; ?> <h1>Member :: Reset Pasword</h1> <?php if (!isset($success)) { ?> <form action="" method="post"> <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert"> <tr>
$objForm = new Form(); $objValid = new Validation($objForm); $objSchool = new School(); $result = null; $objValid->_expected = array('name', 'gender', 'day', 'month', 'year', 'personal_email', 'phone', 'skype', 'facebook', 'high_school', 'grad_year_h', 'uni', 'grad_year_u'); $objValid->_required = array('name', 'gender', 'personal_email'); //var_dump($objValid->_required); $objValid->_special = array(array('field' => 'personal_email', 'case_type' => 'check_is_email')); if ($objForm->isPost('name')) { $high_school = $objForm->getPost('high_school'); $grad_year_h = $objForm->getPost('grad_year_h'); $uni = $objForm->getPost('uni'); $grad_year_u = $objForm->getPost('grad_year_u'); $email = $objForm->getPost('personal_email'); if (empty($high_school) && !empty($grad_year_h)) { $objValid->add2Errors('high_school'); } if (!empty($high_school) && empty($grad_year_h)) { $objValid->add2Errors('grad_year_h'); } if (empty($uni) && !empty($grad_year_u)) { $objValid->add2Errors('uni'); } if (!empty($uni) && empty($grad_year_u)) { $objValid->add2Errors('grad_year_u'); } if ($objMember->isDuplicateEmail($email)) { $objValid->add2Errors('duplicate_email'); } $params = $objValid->objForm->getPostArray($objValid->_expected); if (!empty($high_school)) {
<?php if (Login::isLogged(Login::$_login_admin_id)) { Helper::redirect(SITE_URL . Login::$_dashboard_admin); } $objForm = new Form(); $objValidation = new Validation($objForm); if ($objForm->isPost('login_user')) { $objAdmin = new Admin(); $objValidation->_required = array('login_user', 'login_password'); if ($objAdmin->isUser($objForm->getPost('login_user'), $objForm->getPost('login_password'))) { $result = Login::loginAdmin($objAdmin->_user, Url::getReferrerUrl()); } else { $objValidation->add2Errors('login'); } if ($objValidation->isValid()) { } } ?> <html> <head> <title>XBook Management System</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/Core.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="../css/bootstrap.min.css"> <link rel="stylesheet" href="../css/bootstrap-theme.min.css"> <link rel="stylesheet" href="../css/bootstrap-select.min.css">
if ($this->admin['access'] != 1) { Helper::redirect('/panel/content/c/pages/a/index'); } $id = $this->objUrl->get('id'); if (!empty($id)) { $admin = $this->objAdmin->getOne($id); if (!empty($admin)) { $objForm = new Form($this->objUrl); $objValidation = new Validation($this->objLanguage); $expected = array('access', 'first_name', 'last_name', 'email', 'password'); $required = array('access', 'first_name', 'last_name', 'email'); if (isset($_POST['access'])) { $array = $objForm->post2Array($expected); if (array_key_exists('email', $array) && !empty($array['email']) && $this->objAdmin->duplicate($array['email'], $id)) { $objValidation->add2Errors('email', 'email_taken'); } if ($objValidation->isValid($array, $required)) { if ($this->objAdmin->update($array, $admin)) { Helper::redirect($this->objUrl->getCurrent(array('a', 'id')) . '/a/index'); } } } $access = $this->objAdmin->getAccess(); require_once 'header.php'; ?> <h1><?php echo $this->objLanguage->labels[90]; ?> </h1>
$objValid->_special = array(array('field' => 'personal_email', 'case_type' => 'check_is_email')); } if (!empty($member['phone']) && empty($phone)) { $objValid->_required[] = 'phone'; } if (!empty($member['facebook']) && empty($facebook)) { $objValid->_required[] = 'facebook'; } if (!empty($member['high_school']) && empty($high_school)) { $objValid->_required[] = 'high_school'; } if (!empty($member['uni']) && empty($uni)) { $objValid->_required[] = 'uni'; } if (empty($high_school) && !empty($grad_year_h)) { $objValid->add2Errors('high_school'); } if (!empty($high_school) && empty($grad_year_h)) { $objValid->add2Errors('grad_year_h'); } $email = $objForm->getPost('personal_email'); $facebook = $objForm->getPost('facebook'); if ($objMember->isDuplicateEmail($email, $id)) { $objValid->add2Errors('duplicate_email'); } $params = $objValid->objForm->getPostArray($objValid->_expected); if (!empty($high_school)) { $get_high_school = $objSchool->getSchoolByName(trim($high_school), true); if (!empty($get_high_school)) { $high_school_id = $get_high_school['id']; $params['high_school'] = $high_school_id;