Exemple #1
0
 function __construct()
 {
     if ($_POST) {
         DB::escapePost();
         News::setSubscribers();
         if ($_SERVER['HTTP_REFERER']) {
             $this->redirect($_SERVER['HTTP_REFERER']);
         } else {
             $this->redirect('/media/news/');
         }
     } else {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         if (Funcs::$uri[2] == '') {
             $tree['pic'] = $tree['fields']['files_gal1'][0]['path'];
             $tree['list'] = News::getList($tree['id']);
             //$tree['tags']=News::getTagList($tree['id']);
             View::render('news/list', $tree);
         } else {
             //$tree['tags']=News::getTags($tree['id']);
             $tree['next'] = News::getNext($tree['id'], $tree['parent'], $tree['udate']);
             $tree['prev'] = News::getPrev($tree['id'], $tree['parent'], $tree['udate']);
             if (isset($_GET['print'])) {
                 View::render('news/print', $tree);
             } else {
                 View::render('news/one', $tree);
             }
         }
     }
 }
Exemple #2
0
    public static function getValuesNumber($path)
    {
        $data = array();
        $tree = Tree::getTreeByUrl();
        $ids[] = $tree['id'];
        $ids = array_merge($ids, Tree::getChilds($tree['id']));
        $sql = '
			SELECT DISTINCT type FROM {{data}}
			WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
		';
        $type = DB::getOne($sql);
        if ($type) {
            $sql = '
				SELECT MAX(' . Fields::$fieldsName[$type] . ') AS maxv, MIN(' . Fields::$fieldsName[$type] . ') AS minv FROM {{data}}
				WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
			';
            $data = DB::getRow($sql);
            $data['type'] = substr($type, 0, 1);
        }
        if ($data['maxv'] > 0) {
            return $data;
        } else {
            return array();
        }
    }
 function __construct()
 {
     $tree = Tree::getTreeByUrl();
     Funcs::setMeta($tree);
     $list = Search::getResult();
     View::render('site/search', array('list' => $list));
 }
Exemple #4
0
 public function SubMenu()
 {
     $list = array();
     $data = array();
     if (Funcs::$uri[0] == 'about') {
         $tree = Tree::getTreeByUrl('', array(Funcs::$uri[0]));
         $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $tree['id'] . ' AND menu=1 AND visible=1 ORDER BY num';
         $data = DB::getAll($sql);
     } elseif (Funcs::$uri[3] != '') {
         $uri = Funcs::$uri;
         unset($uri[4]);
         $tree = Tree::getTreeByUrl('', $uri);
         $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $tree['id'] . ' AND menu=1 AND visible=1 ORDER BY num';
         $data = DB::getAll($sql);
     }
     $num = ceil(count($data) / 2);
     foreach ($data as $i => $item) {
         $item['path'] = Tree::getPathToTree($item['id']);
         $item['selected'] = '';
         if (strpos($_SERVER['REQUEST_URI'], $item['path']) !== false) {
             $item['selected'] = 'selected';
         }
         if ($i < $num) {
             $list[0][] = $item;
         } else {
             $list[1][] = $item;
         }
     }
     View::widget('menu/sub', array('list' => $list));
 }
 function __construct()
 {
     if (Funcs::$uri[1] == '') {
         $tree = Tree::getTreeByUrl(Funcs::$uri[0]);
         Funcs::setMeta($tree);
         $tree['list'] = Compare::getCompare();
         View::render('compare/list', $tree);
     }
 }
 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);
     }
 }
 function __construct()
 {
     if (Funcs::$uri[1] == '') {
         $tree = Tree::getTreeByUrl(Funcs::$uri[0]);
         Funcs::setMeta($tree);
         $tree['list'] = Catalog::getFavorite();
         //$tree['recommended']=Catalog::getRecommended();
         View::render('favorite/list', $tree);
     }
 }
 function __construct()
 {
     if (!in_array(Funcs::$uri[2], $this->getFuncs(__CLASS__))) {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['list'] = Faq::getList($tree['id']);
         View::render('cards/index', $tree);
     } elseif (!$_SESSION['iuser']) {
         View::render('site/redirect', array('text' => 'Доступ запрещен', 'href' => '/services/cards/'));
     }
 }
 public function message()
 {
     if ($_POST) {
         $error = Feedback::sendMessage();
         if ($error) {
             View::render('faq/list', $tree);
         } else {
             $this->redirect('/feedback/message/?done');
         }
     } else {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         View::render('feedback/message', $tree);
     }
 }
 function __construct()
 {
     $tree = Tree::getTreeByUrl('wide');
     Funcs::setMeta($tree);
     if ($_POST) {
         if (Online::send($tree['id'])) {
             $this->redirect('/online/thanks/');
         }
     }
     if (Funcs::$uri[1] == '') {
         View::render('online/form', $tree);
     } else {
         View::render('site/page', $tree);
     }
 }
 function __construct()
 {
     $tree = Tree::getTreeByUrl('gal');
     Funcs::setMeta($tree);
     if (Funcs::$uri[2] == '') {
         $tree['list'] = Specials::getList($tree['id']);
         View::render('specials/list', $tree);
     } else {
         //$parents=Tree::getParents($tree['id']);
         //$parentTree=Tree::getTreeById($parents[count($parents)-3],'gal');
         //$tree['pic']=$parentTree['fields']['files_gal1'][0]['path'];
         $tree = Specials::getOne($tree['id']);
         //$tree['tags']=Articles::getTags($tree['id']);
         View::render('specials/one', $tree);
     }
 }
Exemple #12
0
 function __construct()
 {
     if (!in_array(Funcs::$uri[1], get_class_methods(__CLASS__))) {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['list'] = Faq::getList($tree['id']);
         if ($_POST) {
             $error = Faq::ask($tree['id']);
             if ($error) {
                 View::render('faq/list', $tree);
             } else {
                 $this->redirect('/help/faq/');
             }
         } else {
             View::render('faq/list', $tree);
         }
     }
 }
Exemple #13
0
 function __construct()
 {
     if ($_GET['act'] == 'del') {
         Forum::del();
         $this->redirect('/' . implode('/', Funcs::$uri) . '/');
     }
     if (Funcs::$uri[2] == '') {
         $tree = Tree::getTreeByUrl('wide', array('help', 'forum'));
         Funcs::setMeta($tree);
         $tree['list'] = Forum::getForum();
         View::render('forum/forum', $tree);
     } elseif (Funcs::$uri[3] == '') {
         if ($_POST) {
             $error = Forum::add();
             if ($error) {
                 $tree = Forum::getItems();
                 Funcs::setMeta($tree);
                 View::render('forum/items', $tree);
             } else {
                 $this->redirect('/' . Funcs::$uri[0] . '/' . Funcs::$uri[1] . '/' . Funcs::$uri[2] . '/');
             }
         } else {
             $tree = Forum::getItems();
             Funcs::setMeta($tree);
             View::render('forum/items', $tree);
         }
     } else {
         if ($_POST) {
             $error = Forum::add();
             if ($error) {
                 $tree = Forum::getList();
                 Funcs::setMeta($tree);
                 View::render('forum/list', $tree);
             } else {
                 $this->redirect('/' . Funcs::$uri[0] . '/' . Funcs::$uri[1] . '/' . Funcs::$uri[2] . '/' . Funcs::$uri[3] . '/');
             }
         } else {
             $tree = Forum::getList();
             Funcs::setMeta($tree);
             View::render('forum/list', $tree);
         }
     }
 }
 function __construct()
 {
     if (Funcs::$uri[1] == '') {
         $tree = Tree::getTreeByUrl();
         Funcs::setMeta($tree);
         $basket = new Basket();
         $tree['order'] = $basket->getOrder();
         if ($tree['order']['count'] > 0) {
             /*if($_SESSION['iuser']){
             			$adds=$_SESSION['iuser']['options']['address'];
             			if($_POST['adds'])$adds=$_POST['adds'];
             			if(is_numeric($adds)){
             				$tree['reg']=Cabinet::getOneAdds($adds);
             			}
             			$tree['adds']=$adds;
             		}*/
             $accessories = array();
             $salegoods = array();
             foreach ($tree['order']['goods'] as $key => $item) {
                 $accessories[] = Catalog::getAdditionalgood($key, 'accessories');
             }
             foreach ($accessories as $i => $items) {
                 foreach ($items as $ii => $item) {
                     $salegoods[] = $item['tree'];
                     if (key_exists($item['tree'], $tree['order']['goods'])) {
                         unset($accessories[$i][$ii]);
                     }
                 }
             }
             $tree['order']['accessories'] = $accessories;
             $tree['order']['salegoods'] = $salegoods;
             View::render('basket/basket', $tree);
         } else {
             View::render('basket/empty', $tree);
         }
     } elseif (count($_SESSION['goods']) == 0 && Funcs::$uri[1] != 'addtobasket' && $_SESSION['orderId'] == '' && Funcs::$uri[1] != 'addlisttobasket' && Funcs::$uri[1] != 'getneworder' && Funcs::$uri[1] != 'success' && Funcs::$uri[1] != 'fail') {
         $this->redirect('/basket/');
     }
 }
Exemple #15
0
    public static function getPrev()
    {
        $tree = Tree::getTreeByUrl();
        $parent = ' parent=' . $tree['parent'] . ' AND ';
        if ($_GET['ids']) {
            $parent = ' id IN (' . $_GET['ids'] . ') AND ';
        }
        $sql = 'SELECT count(*) FROM {{tree}} WHERE ' . $parent . ' visible=1 AND id<>' . $tree['id'] . '';
        if (DB::getOne($sql) > 0) {
            $sql = '
				SELECT id FROM {{tree}}	
				WHERE ' . $parent . ' visible=1 AND id<>' . $tree['id'] . ' AND num<=\'' . $tree['num'] . '\'
				ORDER BY num
			';
            $id = DB::getOne($sql);
            if ($id) {
                return Tree::getPathToTree($id) . ($_GET['ids'] != '' ? '?ids=' . $_GET['ids'] : '');
            } else {
                return Video::getNext();
            }
        }
    }
Exemple #16
0
 function thanks()
 {
     $tree = Tree::getTreeByUrl('wide');
     Funcs::setMeta($tree);
     View::render('faq/thanks', $tree);
 }
 function __construct()
 {
     if ($_POST) {
         DB::escapePost();
         if (isset($_POST['report'])) {
             $tree = Tree::getTreeByUrl();
             $href = Catalog::getPathToTree($tree['id']);
             Catalog::setReport($tree['id']);
             View::$layout = 'empty';
             View::render('site/redirect', array('href' => $href, 'text' => 'Отзыв успешно добавлен!'));
             die;
         }
         if (isset($_POST['subscribe'])) {
             $tree = Tree::getTreeByUrl();
             $href = Tree::getPathToTree($tree['id']);
             Catalog::setSubscribe($tree['id']);
             die;
         }
     } else {
         DB::escapeGet();
         if (Funcs::$uri[1] == '' && isset($_GET['hits']) && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl();
             Funcs::setMeta($tree);
             $tree = Catalog::getHitCatalog($tree['id']);
             View::render('catalog/catalog', array('list' => $tree, 'name' => 'Все хиты'));
         } elseif (Funcs::$uri[1] == '' && Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl();
             Funcs::setMeta($tree);
             $tree = Catalog::getPreviewCatalog($tree['id']);
             //View::render('catalog/catalog',array('list'=>$tree));
         } elseif (Funcs::$uri[1] != 'setratingstars' && Funcs::$uri[1] != 'delreport') {
             $tree = Tree::getTreeByUrl(Funcs::$uri[0]);
             if ($tree['info']['type'] == 'struct') {
                 $temp = Catalog::getInnerListPagi($tree['id']);
                 $tree['list'] = $temp['list'];
                 $tree['vendors'] = Catalog::getVendors($tree['id'], $tree['list']);
                 //$tree['options']['available']=array();
                 //$tree['options']['catalog']=Catalog::getType($tree['id'],$tree['parent']);
                 //$tree['options']['vendors']=Catalog::getVendors($tree['id']);
                 if ($_GET['ve']) {
                     $tree['name'] = $tree['seo_description'] = $tree['name'] . ' ' . Funcs::$referenceId['vendor'][$_GET['ve']]['name'];
                     Funcs::setMeta($tree);
                 }
                 $tree['options']['price'] = Catalog::getValuesPrice($tree['id']);
                 $tree['options']['price2'] = Catalog::getLink('pricelink');
                 //$tree['options']['rating']=array();
                 Funcs::setMeta($tree);
                 $tree['quantity'] = $temp['quantity'];
                 if ($_GET['ajax'] == 'act') {
                     print $tree['quantity'];
                     die;
                 } else {
                     View::render('catalog/list', $tree);
                 }
             } else {
                 Funcs::setMeta($tree, 'goods');
                 $id = $tree['id'];
                 $tree = Catalog::getOne($id);
                 Catalog::setPopularity($id);
                 $tree['reports'] = Catalog::getReports($id);
                 Catalog::setViewed($id);
                 $tree['same_price'] = Catalog::getAdditionalgood($id, 'better_for_same_price');
                 $tree['accessories'] = Catalog::getAdditionalgood($id, 'accessories');
                 //$tree['similargoods']=Catalog::getAdditionalgood($id,'similargoods');
                 $tree['similargoods'] = Catalog::getMore($tree['id'], $tree['parent']);
                 $tree['reportme'] = Catalog::getReport($tree['id']);
                 if (isset($_GET['print'])) {
                     View::$layout = 'empty';
                     View::render('catalog/print', $tree);
                     die;
                 } else {
                     View::render('catalog/one', $tree);
                 }
             }
         }
     }
 }
Exemple #18
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);
         }
     }
 }
 function confirm()
 {
     $model = new User();
     $model->setConfirm();
     $tree = Tree::getTreeByUrl();
     Funcs::setMeta($tree);
     View::render('registration/thanks', $tree);
 }
 public function thanks()
 {
     $tree = Tree::getTreeByUrl('wide');
     Funcs::setMeta($tree);
     View::render('site/page', $tree);
 }