Example #1
0
 function __construct()
 {
     $model = new Market();
     //header("Content-type:text/xml");
     View::$layout = 'empty';
     View::render('market/list', $model->getList());
 }
Example #2
0
    function forgot()
    {
        if ($_POST) {
            DB::escapePost();
            $sql = '
				SELECT * FROM {{users}} WHERE login=\'' . $_POST['login'] . '\'
			';
            $return = DB::getRow($sql);
            if ($return) {
                $pass = Funcs::generate_password(8);
                $sql = '
					UPDATE {{users}}
					SET pass=MD5(\'' . $pass . '\')
					WHERE login=\'' . $_POST['login'] . '\'
				';
                DB::exec($sql);
                $text = '
					Здравствуйте, ' . $return["login"] . '.<br />
					Ваш новый пароль ' . $pass . '.<br />
					Сменить пароль Вы можете в личном кабинете. 
				';
                $mail = new Email();
                $mail->To($return['email']);
                $mail->Subject('Восстановление пароля на сайте www.' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
                $mail->Text($text);
                $mail->Send();
            }
            $this->redirect('/');
        } else {
            View::$layout = 'empty';
            View::render('site/forgot');
        }
    }
Example #3
0
 private function home()
 {
     $data = array();
     $data['title'] = "View demo";
     View::layout('master');
     View::render('home.view.php', $data);
 }
Example #4
0
 function __construct()
 {
     if (News::tryDelSubscribers()) {
         News::delSubscribers();
         View::$layout = 'empty';
         View::render('site/redirect', array('text' => 'Вы успешно отписаны от рассылки', 'href' => '/'));
     }
 }
Example #5
0
 public static function debugAndLayout()
 {
     if (!self::hasDebug()) {
         return;
     }
     Core::$debug = true;
     View::$layout = true;
 }
Example #6
0
 public function getsearch()
 {
     if (trim($_POST['q'])) {
         $model = new Tree();
         $tree = $model->getSearch();
         View::$layout = 'empty';
         View::render('tree/search', array('tree' => $tree));
     }
 }
Example #7
0
 public function upload()
 {
     if ($_SESSION['iuser']['id']) {
         if ($_POST['act'] == 'step1') {
             $model = new Upload();
             $model->step1();
             $this->redirect('/fotobook/upload/step2/');
         } elseif ($_POST['act'] == 'step2') {
             $model = new Upload();
             $model->step2();
             $this->redirect('/fotobook/upload/step3/');
         } elseif ($_POST['act'] == 'step3') {
             $model = new Upload();
             $model->step3();
             View::$layout = 'empty';
             View::render('fotobook/upload/step3done');
         } elseif ($_POST['act'] == 'step3return') {
             $model = new Upload();
             $model->step3return();
             //$this->redirect('/fotobook/upload/step4/');
         } elseif ($_POST['act'] == 'step4') {
             $model = new Upload();
             $data = $model->step4();
             $this->redirect('/fotobook/upload/thanks/', $data);
         } elseif (Funcs::$uri[2] == '') {
             $this->redirect('/fotobook/upload/step1/');
         } elseif (Funcs::$uri[2] == 'step1') {
             $tree = Tree::getTreeByUrl('wide');
             Funcs::setMeta($tree);
             View::render('fotobook/upload/step1', $tree);
         } elseif (Funcs::$uri[2] == 'step2') {
             $tree = Tree::getTreeByUrl('wide');
             Funcs::setMeta($tree);
             View::render('fotobook/upload/step2', $tree);
         } elseif (Funcs::$uri[2] == 'step3') {
             $tree = Tree::getTreeByUrl('wide');
             Funcs::setMeta($tree);
             View::render('fotobook/upload/step3', $tree);
         } elseif (Funcs::$uri[2] == 'step3show') {
             View::$layout = 'empty';
             View::render('fotobook/upload/step3show');
         } elseif (Funcs::$uri[2] == 'step4') {
             $tree = Tree::getTreeByUrl('wide');
             Funcs::setMeta($tree);
             View::render('fotobook/upload/step4', $tree);
         } elseif (Funcs::$uri[2] == 'thanks') {
             $tree = Tree::getTreeByUrl('wide');
             Funcs::setMeta($tree);
             View::render('fotobook/upload/thanks', $tree);
         }
     } else {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         View::render('fotobook/upload/page', $tree);
     }
 }
 static function relyFile()
 {
     $styles_arr = array('core.Bracket.style#default', 'core.Bracket.bootstrap#min', 'core.Bracket.bootstrap-override', 'core.Bracket.weather-icons#min', 'core.Bracket.animate#delay', 'core.Bracket.select2', 'core.Bracket.toggles', 'core.Bracket.animate#min', 'core.Bracket.lato', 'core.Bracket.roboto', 'core.Bracket.jquery-ui-1#10#3', 'core.Bracket.font-awesome#min', 'core.Bracket.search-slide');
     //   core.Bracket.
     $scripts_arr = array('core.Bracket.jquery-1#11#1#min', 'core.Bracket.jquery-migrate-1#2#1#min', 'core.Bracket.jquery-ui-1#10#3#min', 'core.Bracket.jquery#cookies', 'core.Bracket.bootstrap#min', 'core.Bracket.modernizr#min', 'core.Bracket.jquery#sparkline#min', 'core.Bracket.toggles#min', 'core.Bracket.retina#min', 'core.Bracket.custom', 'core.Bracket.search-slide', 'core.Bracket.message');
     View::assign('scriptTml', '<script>jQuery(document).ready(function (){%s})</script>');
     View::l_assign('styles', $styles_arr, 1);
     View::assign('scripts', $scripts_arr, 1);
     return View::layout('core.Html5.baseRelyFile');
 }
Example #9
0
 public function getOne($id)
 {
     if ($_POST) {
         if (Spage::send($id)) {
             View::$layout = 'empty';
             View::render('site/redirect', array('href' => '/vacancy/', 'text' => 'Заявка принята!\\nМы свяжемся с Вами в ближайшее время'));
         }
     }
     $field = Fields::getFieldsByTree($id, 'wide');
     return $field;
 }
Example #10
0
 public function basket()
 {
     $model = new Orders();
     if (isset($_POST['q'])) {
         View::$layout = 'empty';
         View::plugin('basketgoods', array('items' => Orders::getBasket(), 'id' => $_POST['id']));
     } else {
         View::$layout = 'empty';
         View::plugin('basket');
     }
 }
Example #11
0
 public static function sendAllOrder($id)
 {
     $data = Orders::getOrderById($id);
     View::$layout = 'empty';
     $text = View::getRenderFullEmpty('email/order', $data);
     $mail = new Email();
     $mail->mailTo($data['email']);
     $mail->Subject('Статус заказа №' . (str_repeat('0', 6 - strlen($id)) . $id) . ' на сайте ' . $_SERVER['HTTP_HOST'] . ' изменен');
     $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
     $mail->Text($text);
     $mail->Send();
 }
Example #12
0
 function run()
 {
     $id = 1;
     if (is_numeric(Funcs::$uri[2])) {
         $id = Funcs::$uri[2];
     } elseif (is_numeric($_GET['parent'])) {
         $id = $_GET['parent'];
     } elseif (is_numeric($_GET['id'])) {
         $sql = 'SELECT parent FROM {{tree}} WHERE id=' . $_GET['id'];
         $id = DB::getOne($sql);
     }
     View::$layout = 'empty';
     View::render('tree/tree', array('tree' => TreeWidget::getTree($id)));
 }
Example #13
0
 public function sendMailback()
 {
     DB::escapePost();
     $text .= '<b>Имя:</b> ' . $_POST['name'] . '<br />';
     $text .= '<b>Телефон:</b> ' . $_POST['phone'] . '<br />';
     $text .= '<b>Email:</b> ' . $_POST['email'] . '<br />';
     $text .= '<b>Сообщение:</b> ' . nl2br($_POST['message']) . '<br />';
     View::$layout = 'empty';
     $text = View::getRender('email/callback', array('text' => $text));
     $mail = new Email();
     $mail->mailTo(Funcs::$conf['email']['callback']);
     $mail->Subject('Обратная связь на сайте ' . $_SERVER['HTTP_HOST']);
     $mail->Text($text);
     $mail->Send();
 }
Example #14
0
 /**
  * Runs the context.
  *
  * @param render If true the context will print the output to php://stdout and exit. Defaults to true.
  *
  * @returns A string of data. Dig it?
  */
 public function execute()
 {
     $document = new Document();
     $controller = Request::$controller . '_Controller';
     $controller = new $controller($document);
     // See if this is a valid context for this controller
     $valid_context = in_array('*', $controller->context_availability);
     if (in_array(Request::$context, $controller->context_availability)) {
         $valid_context = true;
     } else {
         if (array_key_exists(Request::$method, $controller->context_availability) and (in_array(Request::$context, $controller->context_availability[Request::$method]) or in_array('*', $controller->context_availability[Request::$method]))) {
             $valid_context = true;
         }
     }
     // Check exclusion list...
     if (array_key_exists(Request::$method, $controller->context_exclusion) and (in_array(Request::$context, $controller->context_exclusion[Request::$method]) or in_array('*', $controller->context_exclusion[Request::$method]))) {
         $valid_context = false;
     }
     if (!$valid_context) {
         die("Invalid Context!");
     }
     // Try context specific method first...
     if (is_callable(array($controller, Request::$method . '_' . Request::$context))) {
         if (false === call_user_func_array(array(&$controller, Request::$method . '_' . Request::$context), Request::$arguments)) {
             die("Error Calling Method for " . Request::$controller . ": " . Request::$method . '_' . Request::$context);
         }
     } else {
         if (!is_callable(array($controller, Request::$method))) {
             die("Bad Method for " . Request::$controller . ": " . Request::$method);
         }
         if (false === call_user_func_array(array(&$controller, Request::$method), Request::$arguments)) {
             die("Error Calling Method for " . Request::$controller . ": " . Request::$method);
         }
     }
     $layout = View::layout(Request::$context);
     $output = $layout->render($document);
     return $output;
 }
Example #15
0
 protected function _import_options($options)
 {
     if (is_array($options)) {
         foreach ($options as $option => $value) {
             switch ($option) {
                 case 'partial':
                     $this->_is_partial = TRUE;
                     /* no break, follows down */
                 /* no break, follows down */
                 case 'action':
                 case 'template':
                 case 'file':
                     $file = $this->_origfile = strtolower((string) $value);
                     break;
                 case 'inline':
                 case 'haml':
                     $this->_is_inline = TRUE;
                     $this->_inline_haml = (string) $value;
                     $this->_viewfile = '';
                     break;
                 case 'locals':
                     if (is_array($value) || $value instanceof Traversable) {
                         $this->set($value);
                     }
                     break;
                 case 'format':
                     $this->_format = strtolower($value);
                     break;
                 case 'basedir':
                     $this->_basedir = static::$_last_basedir = strtolower(rtrim((string) $value, '/') . '/');
                     break;
                 case 'layout':
                     View::layout($value);
                     break;
             }
         }
     } else {
         $file = $this->_origfile = (string) $options;
     }
     if (isset($file)) {
         $this->_viewfile = $this->prepare_view_filename($file);
     }
 }
Example #16
0
 function toOrder($iuserId = 0, $id = '', $send = true)
 {
     if ($id == '') {
         $id = $this->saveBasket();
     }
     View::$layout = 'empty';
     $data = $this->getOrder();
     $data['id'] = $id;
     $data['hits'] = Index::getHits();
     $text = View::getRender('basket/mail', $data);
     $textadmin = View::getRender('basket/mailadmin', $data);
     $info = View::getRender('basket/mailinfo');
     $code = '';
     /*if($info!='Наличными'){
     			$_SESSION['code']=rand(1,9999);
     			$code='<br /><br /><b>Код подтверждения:<b/> '.$_SESSION['code'];
     		}*/
     $this->saveBasket($id, $text, $data, $info, $iuserId);
     if ($send) {
         $mail = new Email();
         $mail->Text($textadmin);
         $mail->Subject('Поступил заказ с сайта www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
         $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
         $mail->To(Funcs::$conf['email']['order']);
         $mail->Send();
         if ($_SESSION['mydata']['email']) {
             $data['client'] = 1;
             $text = View::getRender('basket/mail', $data);
             $info = View::getRender('basket/mailinfo');
             $mail = new Email();
             $mail->Text($text);
             $mail->Subject('Вы оставили заказ на сайте www.' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
             $mail->From('robot@' . str_replace('www.', '', $_SERVER["HTTP_HOST"]));
             $mail->mailTo($_SESSION['mydata']['email']);
             $mail->Send();
         }
     }
     if (SMSuser) {
         file_get_contents('http://sms.spb.su/sms.cgi?user='******'&pass='******'&phone=' . Funcs::$conf['additional']['sms'] . '&flash=0&message=' . urlencode(iconv('utf-8', 'windows-1251', 'Заказ ' . $id . ' ' . $_SESSION['mydata']['name'] . ' ' . $_SESSION['mydata']['phone'])) . '&from=' . $_SERVER['HTTP_HOST'] . '');
     }
     $_SESSION['mydata'] = array();
     $_SESSION['goods'] = array();
     $_SESSION['orderId'] = $id;
 }
Example #17
0
 function __construct()
 {
     if (Funcs::$uri[0] == '') {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         //$tree['hits']=Index::getHits();
         //$tree['mainbanner']=Index::getMainBanner();
         //$id=Tree::getIdTreeByModule('news');
         //$tree['news']=News::getList($id,2);
         //$tree['banners']=Index::getBanners();
         /*$tree['about']=Fields::getFieldsByTree(8,'wide');
         		$tree['examples']=Index::getExamples();
         		$tree['forum']=Forum::getIndex();*/
         View::render('site/index', $tree);
     } elseif (Funcs::$uri[0] == 'sitemap') {
         //$tree=Tree::getTreeByUrl('wide');
         //Funcs::setMeta($tree);
         $model = new Tree();
         $tree['sitemap'] = $model->getSitemap();
         View::render('site/sitemap', $tree);
     } elseif (Funcs::$uri[0] == 'rss') {
         View::$layout = "empty";
         View::render('news/rss', News::getRSS());
     } elseif (Funcs::$uri[0] == 'contacts' && Funcs::$uri[1] == '') {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         View::render('site/contacts', $tree);
     } elseif (Funcs::$uri[0] == 'viewed') {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['list'] = Catalog::getViewed();
         $tree['recommended'] = Catalog::getRecommended();
         View::render('favorite/viewed', $tree);
     } elseif (Funcs::$uri[0] == 'customer' && Funcs::$uri[1] == 'partners' && Funcs::$uri[2] == 'anketa' && Funcs::$uri[3] == '') {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         View::render('site/anketa', $tree);
     } else {
         $tree = Tree::getTreeByUrl();
         Funcs::setMeta($tree);
         if ($tree['info']['type'] == 'spage') {
             $class = strtoupper(substr($tree['info']['path'], 0, 1)) . substr($tree['info']['path'], 1, strlen($tree['info']['path']));
             if (class_exists($class)) {
                 if ($tree['info']['id2'] == 0) {
                     eval('$tree[\'list\']=' . $class . '::getList($tree[\'id\']);');
                     View::render($tree['info']['path'] . '/list', $tree);
                 } else {
                     eval('$tree[\'fields\']=' . $class . '::getOne($tree[\'id\']);');
                     if (isset($_GET['print'])) {
                         View::$layout = 'empty';
                         View::render($tree['info']['path'] . '/print', $tree);
                     } else {
                         View::render($tree['info']['path'] . '/one', $tree);
                     }
                 }
             } else {
                 if ($tree['info']['id2'] == 0) {
                     $tree['list'] = Spage::getList($tree['id']);
                     View::render($tree['info']['path'] . '/list', $tree);
                 } else {
                     $tree['fields'] = Spage::getOne($tree['id']);
                     if (isset($_GET['print'])) {
                         View::$layout = 'empty';
                         View::render($tree['info']['path'] . '/print', $tree);
                     } else {
                         View::render($tree['info']['path'] . '/one', $tree);
                     }
                 }
             }
         } else {
             View::render('site/page', $tree);
         }
     }
 }
Example #18
0
 private function disableDebugAndLayout()
 {
     Settings::$debugShowDebug = false;
     View::$layout = false;
 }
Example #19
0
 function run()
 {
     $model = new Tree();
     View::$layout = 'empty';
     View::render('tree/tree', array('tree' => $model->getTree()));
 }
 function social()
 {
     $model = new User();
     $model->setSocial();
     View::$layout = 'popup';
     View::render('popup/close');
 }
Example #21
0
    public static function setSubscribers()
    {
        DB::escapePost();
        $sql = 'SELECT email FROM {{subscribers}} WHERE email=\'' . $_POST["email"] . '\'';
        $email = DB::getOne($sql);
        if ($email) {
            $text .= '<b>Здравствуйте!</b><br />Вы уже зарегистрированы на подписку<br /><br />';
            $text .= 'Для отказа от подписки пройдите по ссылке <a href="http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '">http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '</a><br />';
        } else {
            $sql = '
				INSERT INTO {{subscribers}}
				SET 
					email=\'' . $_POST["email"] . '\',
					create_date=NOW()
			';
            DB::exec($sql);
            $text .= '<b>Здравствуйте!</b><br />Вы успешно зарегистрированы на подписку на сайте <a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a><br /><br />';
            $text .= 'Для отказа от подписки пройдите по ссылке <a href="http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '">http://' . $_SERVER['HTTP_HOST'] . '/confirm/' . md5(News::$delsalt . $email) . '</a><br />';
        }
        View::$layout = 'empty';
        $text = View::getRender('email/newssubscribe', array('text' => $text));
        $mail = new Email();
        $mail->To($_POST["email"]);
        $mail->Subject('Подписка на новости на сайте ' . $_SERVER['HTTP_HOST']);
        $mail->Text($text);
        $mail->Send();
    }
Example #22
0
 public function finish()
 {
     $tree['seo_title'] = $tree['seo_keywords'] = $tree['seo_description'] = 'Подтверждение';
     Funcs::setMeta($tree);
     $basket = new Basket();
     $data = $basket->getConfirm($_SESSION['orderId']);
     if (isset($_GET['print'])) {
         View::$layout = 'empty';
         View::render('basket/print', $data);
     } else {
         View::render('basket/finish', $data);
     }
 }
Example #23
0
    public function setAnketa()
    {
        Funcs::escapePost();
        $data = array();
        $text = '';
        foreach (OneSSA::$iuserStandartAdds as $title => $items) {
            $text .= '<h3>' . $title . ':</h3>';
            foreach ($items as $key => $item) {
                if ($item['type'] == 'bool') {
                    $data[$key] = $_POST[$key] == 1 ? '1' : '0';
                    $_POST[$key] = $_POST[$key] == 1 ? 'Да' : 'Нет';
                } else {
                    if ($item['main'] != 1) {
                        $data[$key] = $_POST[$key];
                    }
                }
                $text .= '<b>' . $item['name'] . ':</b> ' . $_POST[$key] . '<br />';
            }
        }
        $pass = Funcs::generate_password(8);
        $address = array();
        foreach (OneSSA::$iuserStandartAdds['1.2 Фактический адрес'] as $key => $item) {
            if ($_POST[$key] != '') {
                $address[] = $_POST[$key];
            }
        }
        if (count($address) > 0) {
            $address = implode(', ', $address);
        } else {
            $address = '';
        }
        $sql = '
			INSERT INTO {{iusers}}
			SET name=\'' . $_POST['name'] . '\',
				phone=\'' . $_POST['phone'] . '\',
				email=\'' . $_POST['email'] . '\',
				pass=\'' . md5($pass) . '\',
				address=\'' . $address . '\',
				visible=0,
				cdate=NOW()
		';
        $id = DB::exec($sql);
        $text .= '<b>Пароль:</b> ' . $pass . '<br />';
        $text .= '<b>Пользователь:</b> ' . $id . '<br />';
        foreach ($data as $key => $item) {
            $sql = '
				INSERT INTO {{iusers_adds}}
				SET iuser='******',
					name=\'' . $key . '\',
					string_value=\'' . $_POST[$key] . '\'
			';
            DB::exec($sql);
        }
        $mail = new Email();
        $mail->mailTo(Funcs::$conf['email']['anketa']);
        $mail->Subject('Новая анкета партнера на сайте ' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
        View::$layout = 'empty';
        $text = View::getRender('email/anketa', array('text' => $text));
        $mail->Text($text);
        $mail->Send();
    }
Example #24
0
 public static function error($sql, $backtrace)
 {
     if (DEBUG == 0 && Funcs::$uri[0] != ONESSA_DIR) {
         header("HTTP/1.0 404 Not Found");
         DB::$error = true;
         View::$layout = 'main';
         View::render('site/error404');
     } elseif (DEBUG != 0 && Funcs::$uri[0] != ONESSA_DIR) {
         header("HTTP/1.0 404 Not Found");
         print View::getRenderEmpty('site/error', array('sql' => $sql, 'backtrace' => $backtrace));
     } else {
         print View::getRenderOneSSAEmpty('site/error', array('sql' => $sql, 'backtrace' => $backtrace));
     }
 }
Example #25
0
 function addfield()
 {
     View::$layout = 'empty';
     View::render('work/addfield', array('modules' => array()));
 }
 public function layout($tpl = '')
 {
     return View::layout($tpl);
 }
 public function before()
 {
     $directory = $this->request->directory();
     $controller = $this->request->controller();
     $action = $this->request->action();
     $format = $this->_detect_response_format();
     $mime = File::mime_by_ext($format) ?: 'text/html';
     $this->response->view(['basedir' => $controller, 'directory' => $directory, 'action' => $action, 'format' => $format]);
     $this->response->view->set(['basedir' => $controller, 'directory' => $directory, 'controller' => $controller, 'action' => $action, 'format' => $format, 'request' => $this->request, 'method' => $this->request->method(), 'secure' => $this->request->secure(), 'route' => $this->request->route(), 'route_name' => Route::name($this->request->route()), 'params' => $this->request->param(), 'query' => $this->request->query()]);
     $this->format = $format;
     if ($this->_layout === NULL) {
         $layout = strtolower($controller);
         if ($this->response->view->viewfile_exists($layout, 'layouts')) {
             $this->_layout = $layout;
         } else {
             if ($this->response->view->viewfile_exists($this->_default_layout, 'layouts')) {
                 $this->_layout = $this->_default_layout;
             }
         }
     }
     $this->response->headers('Content-Type', $mime . '; charset=' . Kohana::$charset);
     if ($this->_layout) {
         View::layout($this->_layout);
     }
     $this->_before_action && $this->_call_method_for_action($this->_before_action);
 }
Example #28
0
 public function pageDenied()
 {
     View::$layout = 'empty';
     View::render('site/pagedenied');
     die;
 }
Example #29
0
 function notification()
 {
     if ($_POST) {
         $model = new Cabinet();
         $model->saveNotification();
         View::$layout = 'empty';
         View::render('site/redirect', array('text' => 'Данные успешно сохранены', 'href' => '/cabinet/notification/'));
     } else {
         $model = new Cabinet();
         $data = $model->getNotification();
         View::render('cabinet/notification', $data);
     }
 }
Example #30
0
 function sendmessage()
 {
     if ($_SESSION['iuser']) {
         Funcs::escapePost();
         Message::addMessage($_POST['touser'], $_POST['message']);
         View::$layout = 'popup';
         View::render('popup/loginclose');
     }
 }