예제 #1
0
 public function logoutAction()
 {
     K_Auth::logout();
     K_Request::redirect("/admin/auth");
 }
예제 #2
0
 public function price()
 {
     if (!K_Request::isPost()) {
         $this->putAjax('ERROR');
     }
     $nameAccos = array('name' => t('Ваше имя:', "Ваше ім'я:"), 'city' => t('Ваш город:', 'Ваш город:'), 'email' => t('Ваш E-mail*:', 'Ваш E-mail*:'), 'type' => t('Тип конструкции*:', 'Тип конструкції*:'), 'phone' => t('Ваш Телефон*:', 'Ваш Телефон*:'), 'message' => t('Ваше сообщение:', 'Ваше повідомлення:'));
     $data = array('name' => trim($_POST['name']), 'city' => trim($_POST['city']), 'type' => trim($_POST['type']), 'phone' => trim($_POST['phone']), 'email' => trim($_POST['email']), 'message' => trim($_POST['message']));
     $validate = array('name' => array('maxlen' => 255), 'email' => array('required' => true, 'maxlen' => 255, 'notEmpty', 'email'), 'phone' => array('required' => true, 'notEmpty', 'phone'), 'type' => array('required' => true, 'notEmpty', 'enum' => array('Двери из стекла', 'Перегородки из стекла', 'Фасады', 'Козырьки из стекла', 'Лестницы из стекла', 'Стеклянный пол', 'Душевые кабины', 'Автоматика', 'Фурнитура')), 'message' => array('required' => true, 'notEmpty', 'maxlen' => 1500));
     $commentModel = new Admin_Model_Valid();
     if ($commentModel->isValidRow($data, $validate)) {
         $jsonReturn['error'] = false;
         $jsonReturn['msg'] = t("Ваше сообщение было отправлено успешно. Спасибо.", "Ваше повідомлення було відправлено успішно. Спасибі.");
         $jsonReturn['clean'] = true;
         //Send mail
         ///////////////////////////////////////////////////////////////////
         $toMail = trim($_POST['manager_email']);
         $mailText = 'На сайте glassok.ua была заполненна форма "Узнать стоимость" . /r /n';
         $mailText .= 'Имя:' . strip_tags($data['name']) . ' /r /n';
         $mailText .= 'E-mail:' . strip_tags($data['email']) . ' /r /n';
         $mailText .= 'Телефон:' . strip_tags($data['phone']) . ' /r /n';
         $mailText .= 'Тип конструкции:' . strip_tags($data['type']) . ' /r /n';
         $mailText .= 'Сообщение: /r /n' . strip_tags($data['massage']);
         $mailer = new K_mail();
         $mailer->setBody($mailText);
         $mailer->addTo($toMail);
         $mailer->send('*****@*****.**', 'На сайте glassok.ua была заполненна форма "Узнать стоимость"');
         ////////////////////////////////////////////////////////////////
     } else {
         $jsonReturn['error'] = true;
         $jsonReturn['msg'] = $commentModel->getErrorsD($nameAccos);
     }
     if (K_Request::isAjax()) {
         $this->putJSON($jsonReturn);
     } else {
         K_Request::redirect('/');
     }
 }
예제 #3
0
 public static function accessSite($res, $privilege = 'view')
 {
     $access = self::accessSiteCheck($res, $privilege);
     if (!$access) {
         if (isset(self::$lastKnowResourse)) {
             $denyAction = K_Access::acl()->getDeneyAction(self::$lastKnowResourse);
             if ($denyAction) {
                 if ($resourse != $denyAction) {
                     K_Request::redirect($denyAction);
                 }
             } else {
                 if ($resourse != 'default/index/index') {
                     K_Request::redirect('/');
                 }
             }
         } else {
             if ($resourse != 'default/index/index') {
                 K_Request::redirect('/');
             }
         }
     }
 }
예제 #4
0
 public function exporttypeAction()
 {
     $typeId = $this->getParam('typeid');
     $typeModel = new Admin_Model_Type();
     $typeRow = $typeModel->fetchRow(K_Db_Select::create()->where(array('type_id' => $typeId)));
     $typeRow = $typeRow->toArray();
     $typeName = $typeRow['type_name'];
     $configArray = array('typeName' => $typeName);
     $query = new K_Db_Query();
     $typeTable = $query->q('SHOW CREATE TABLE type_' . $typeName . ';');
     $zip = new ZipArchive();
     //создаём папку если такой нет.
     if (!file_exists(ROOT_PATH . '/cache/typestmp/')) {
         mkdir(ROOT_PATH . '/cache/temp/', 0777, true);
     }
     if ($zip->open(ROOT_PATH . '/www/upload/typestmp/' . $typeName . '.zip', ZipArchive::CREATE) === true) {
         // php файлы
         $zip->addFile(ROOT_PATH . '/application/type/model/' . $typeName . '.php', $typeName . '_model.php');
         /// Добавление модели типа
         $zip->addFile(ROOT_PATH . '/application/type/controller/' . $typeName . '.php', $typeName . '_controller.php');
         /// Добавление контроллера типа
         $zip->addFile(ROOT_PATH . '/application/admin/controller/gui/' . $typeName . '.php', $typeName . '_gui.php');
         /// Добавление GUI типа
         // иконка
         $zip->addFile(ROOT_PATH . '/www/adm/img/tree/' . $typeName . '.png', $typeName . '.png');
         /// Добавление иконки типа
         // данные
         $zip->addFromString('config.json', json_encode($configArray));
         // конфигурационный файл
         $zip->addFromString('typerow.json', json_encode($typeRow));
         // строка типа из таблицы типов
         $zip->addFromString('typetable.sql', $typeTable[0]['Create Table']);
         // структура таблицы типа
         $zip->close();
     } else {
         echo 'Не могу создать архив!';
     }
     K_Request::redirect('/upload/typestmp/' . $typeName . '.zip');
 }