public function addAction() { if (!Tools::isPost()) { header('Location: /ruler', true, 302); exit; } $ruler = new Ruler($this->context); $id = $ruler->add(Tools::getValue('background'), Tools::getValue('slider'), Tools::getValue('length'), Tools::getValue('counter'), Tools::getValue('text'), Tools::getValue('color'), Tools::getValue('date_start')); $ruler->updateImage($id); $this->view->breadcrumbs = array(array('url' => '/ruler', 'title' => 'Линейки для форума')); $this->view->setVar('id', $id); $this->view->generate(); }
/** * @param string $url * @param string $url2 */ public function index($url = "", $url2 = "") { if (Tools::isPost('submitDBConfigBtn')) { $db_provider = 'mysql'; $db_host = Tools::post('db_host'); $db_username = Tools::post('db_username'); $db_password = Tools::post('db_password'); $db_name = Tools::post('db_name'); $dbError = false; $DB = NewADOConnection($db_provider); try { $DB->Connect($db_host, $db_username, $db_password, $db_name); } catch (ErrorException $e) { $dbError = true; } $result = $DB->Execute("Show tables;"); $errorMsg = $DB->ErrorMsg(); if ($result === false || $dbError === true || $errorMsg != "") { FlashSession::setFlash('error', $errorMsg); } else { $DB->Close(); $dbAccess = new DBAccess(); $dbAccess->setDbUsername($db_username); $dbAccess->setDbPassword($db_password); $dbAccess->setDbHost($db_host); $dbAccess->setDbName($db_name); Session::set('dbAccess', $dbAccess); Session::set('dbConfigured', true); if ($url != "") { $url = $url2 == "" ? $url2 : $url . "/" . $url2; Tools::redirect($url); } else { Tools::redirect('home'); } } } $this->view->render('dbconfig/index'); }
public function AskAction() { $ask = new Consult($this->context); $expert = $this->db->query(' SELECT cc.id, cc.name, cc.alt_name, ud.FirstName, ud.LastName, ud.UserID FROM UserData as ud, consult_category as cc, consult_user_category as cu WHERE ud.UserID=cu.uid and cc.id=cu.cid')->fetchall(); $category = $this->db->query('select id, name, alt_name, img from consult_category order by id')->fetchall(); $time = date("Y-m-d H:i:s", time()); $email = Tools::getValue('mail'); $name = Tools::getValue('name'); empty(Tools::getValue('q', '')) ? $uri = 0 : ($uri = Tools::getValue('q', '')); if (!empty($_POST['sendRequ'])) { $send_r = 1; } if (Tools::isPost()) { $content = array('title' => 'Вы задали вопрос', 'template' => 'send_to_back', 'data' => array('[year]' => date("Y", time()), '[name]' => $name, '[email]' => $email, '[question]' => Tools::getValue('body'))); } if (!empty($_POST)) { $image = new Securimage(); if ($image->check($_POST['captcha_code']) == true) { $this->db->prepare('insert into consult_questions (title, body, name, email, uid, cid, isRequest, isAnswer, pid, questiondate) values ("' . Tools::getValue('title') . '","' . Tools::getValue('body') . '","' . $name . '","' . $email . '","' . Tools::getValue('setExpName') . '","' . Tools::getValue('setCatName') . '","' . $send_r . '","1","' . $uri . '","' . $time . '")')->execute(); if (!empty($_POST['copyTo'])) { Mailer::send($email, $content, 'Вы задали вопрос', null, null); } return AddAlertMessage('success', 'Ваш вопрос был сохранен, ожидайте ответа.!', '/consult/'); } else { return AddAlertMessage('warning', 'Вы неверно указали код с картинки', $_SERVER['REQUEST_URI']); } } $this->view->breadcrumbs = array(array('url' => '/', 'title' => 'Главная'), array('url' => '/consult/', 'title' => 'Консультации'), array('url' => '../consult/ask', 'title' => 'Задать вопрос')); $this->view->setVars(array('category' => $category, 'expert' => $expert)); unset($_SESSION['captcha_keystring']); $this->view->generate(); }
public function pdf() { if (Tools::isPost('submitExportPDF')) { if ($this->checkExportPDFForm()) { $this->model->exportPDFTable(); } } if (Session::get('dbConfigured')) { $this->view->tableList = $this->model->getTablesList(); $this->view->render('export/pdf/index'); } else { FlashSession::setFlash('error', 'You must configure your Database before Exporting tables'); Tools::redirect('dbconfig/index/export/pdf'); } }
public function contactusAction() { $email = Tools::getValue('email'); $name = Tools::getValue('name'); $subject = Tools::getValue('subject'); $question = Tools::getValue('question'); if (empty($name)) { $name = $email; } if (Tools::isPost()) { if (isset($_SESSION['auth'])) { $vUserID = $_SESSION['auth']['id']; $vUnknownUserGUID = "null"; } else { $vUserID = "null"; $vUnknownUserGUID = "'" . (string) GetUnknownUserGUID() . "'"; } $RecordID = DBInsertRecord($this->db, "ContactUs"); $sql = "update ContactUs " . "set StateID = 1, " . "UserID = {$vUserID}, " . "UnknownUserGUID = {$vUnknownUserGUID}, " . "CreateDate = '" . GetLocalDateTimeAsSQLStr() . "', " . "UserName = '******', " . "UserEmail = '{$email}', " . "MessageSubject = '{$subject}', " . "MessageText = '{$question}' " . "where (ID = {$RecordID});"; $this->db->exec($sql); $content = array('title' => $subject, 'template' => 'contactus', 'data' => array('[year]' => date("Y", time()), '[name]' => $name, '[email]' => $email, '[question]' => $question, '[ticketlink]' => URL . "admincp/index.php?mod=ContactUsItem&id=" . $RecordID)); //$vSendResult = Mailer::send('*****@*****.**', $content, $subject, null, $email); $vSendResult = SendEmailSMTP($email, $name, '*****@*****.**', $content, null, SMTP_CC); if ($vSendResult !== true) { return AddAlertMessage('danger', 'Ошибка при отправке письма!', '/'); } else { return AddAlertMessage('success', 'Ваше сообщение было отправлено!', '/'); } } $this->view->breadcrumbs = array(array('url' => '/auth/contactus', 'title' => 'Свяжитесь с нами')); $this->view->meta = array('meta_title' => 'Свяжитесь с нами', 'meta_description' => 'Свяжитесь с нами', 'meta_keywords' => ''); $this->view->generate(); }
public function excel() { if (Tools::isPost('submitImportTable')) { if ($this->checkImportExcelForm()) { /** @var Import_Model $this->model */ $this->import->importExcelTable(); } } if (Session::get('dbConfigured')) { $this->view->tableList = $this->import->getTablesList(); $this->load->view('import/excel/index'); } else { FlashSession::setFlash('error', 'You must configure your Database before Importing tables'); Tools::redirect('dbconfig/index/import/excel'); } }