Exemplo n.º 1
0
 function installSQL()
 {
     $ver = $this->request('version');
     if ($ver and $this->request('hash') == $this->hash()) {
         $update = rad_update::getInstance();
         $update->setUrl($this->_url);
         $update->setCurrentVersion($ver);
         if ($update->checkUpdates()) {
             $response = $update->getUpdatesList();
             if (!empty($response->sql)) {
                 $vars = array('RAD' => RAD);
                 foreach ($response->sql as $sql) {
                     $update->execSQL($sql->sql, $vars);
                     if (!empty($sql->inserted_id)) {
                         $vars[$sql->inserted_id] = rad_dbpdo::lastInsertId();
                     }
                 }
             }
             die('Done!');
         } else {
             die('Have no updates!');
         }
     } else {
         $this->redirect('404');
     }
 }
Exemplo n.º 2
0
 /**
  * Parse al functions!
  */
 public static function parseController()
 {
     header(base64_decode('WC1wb3dlcmVkLWJ5OiBUYWJlcm5hIGVDb21tZXJjZSBDTVM='));
     header(base64_decode('WC1wb3dlcmVkLXZlcnNpb246IA==') . json_encode(rad_update::getInstance()->getVersions()));
     header(base64_decode('WC1wb3dlcmVkLXNpdGU6IGh0dHA6Ly90YWJlcm5hY21zLmNvbQ=='));
     ob_start();
     foreach (self::$_alias->includes as $id) {
         if (strlen($id->controller)) {
             rad_instances::setCurrentController($id->controller);
             if ($id->params_presonal and strlen($id->params_hash)) {
                 rad_instances::setParamsFor($id->controller, new rad_paramsobject($id->params_hash));
             } elseif (!$id->params_presonal and strlen($id->original_params)) {
                 rad_instances::setParamsFor($id->controller, new rad_paramsobject($id->original_params));
             }
             self::$_controllerResults[$id->incinal_id] = new $id->controller();
         } else {
             self::$_controllerResults[$id->incinal_id] = null;
         }
     }
     ob_end_flush();
 }
Exemplo n.º 3
0
 function __construct()
 {
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_showPages = $params->_get('showpages', $this->_showPages, $this->getCurrentLangID());
         $this->_treePages = $params->_get('treepages', $this->_treePages, $this->getCurrentLangID());
         $this->_showArticles = $params->_get('showarticles', $this->_showArticles, $this->getCurrentLangID());
         $this->_treeArticles = $params->_get('treearticles', $this->_treeArticles, $this->getCurrentLangID());
         $this->_showNews = $params->_get('shownews', $this->_showNews, $this->getCurrentLangID());
         $this->_treeNews = $params->_get('treenews', $this->_treeNews, $this->getCurrentLangID());
         $this->_showCatalog = $params->_get('showcatalog', $this->_showCatalog);
         $this->_treeCatalog = $params->_get('treecatalog', $this->_treeCatalog, $this->getCurrentLangID());
         $this->_exportSite = $params->_get('export', $this->_exportSite);
         $this->_shopName = $params->_get('shopname', $this->_shopName, $this->getCurrentLangID());
         $this->_shopCompany = $params->_get('shopcompany', $this->_shopCompany, $this->getCurrentLangID());
         $this->_shopAgency = $params->_get('shopagency', $this->_shopAgency, $this->getCurrentLangID());
         $this->setVar('params', $params);
     }
     switch ($this->_exportSite) {
         case 'sitemap':
             if ($this->_showPages) {
                 $pagesTree = rad_instances::get('model_coremenus_tree')->setState('active', 1)->setState('pid', $this->_treePages)->setState('lang', $this->getCurrentLangID())->getItems(true);
                 if (!empty($pagesTree)) {
                     rad_instances::get('model_corearticles_pages')->getPagesForTree($pagesTree, $this->getCurrentLangID());
                     $this->setVar('pagesTree', $pagesTree);
                 }
             }
             if ($this->_showArticles) {
                 $articlesTree = rad_instances::get('model_coremenus_tree')->setState('active', 1)->setState('pid', $this->_treeArticles)->setState('lang', $this->getCurrentLangID())->getItems(true);
                 if (!empty($articlesTree)) {
                     rad_instances::get('model_corearticles_articles')->getArticlessForTree($articlesTree, $this->getCurrentLangID());
                     $this->setVar('articlesTree', $articlesTree);
                 }
                 $this->setVar('articles', $articlesTree);
             }
             if ($this->_showNews) {
                 $newsTree = rad_instances::get('model_coremenus_tree')->setState('active', 1)->setState('pid', $this->_treeNews)->setState('lang', $this->getCurrentLangID())->getItems(true);
                 if (!empty($newsTree)) {
                     rad_instances::get('model_corearticles_news')->getNewsForTree($newsTree, $this->getCurrentLangID());
                     $this->setVar('newsTree', $newsTree);
                 }
             }
             //Show News
             if ($this->_showCatalog) {
                 $catalogTree = rad_instances::get('model_coremenus_tree')->setState('active', 1)->setState('pid', $this->_treeCatalog)->setState('lang', $this->getCurrentLangID())->getItems(true);
                 $modelCatalog = rad_instances::get('model_corecatalog_catalog')->setState('active', 1)->setState('join.mainimage', true)->setState('join.tree', true)->setState('lang', $this->getCurrentLangID())->setSTate('currency', model_corecatalog_currcalc::getDefaultCurrencyId());
                 $products = $modelCatalog->getItems();
                 if (!empty($products)) {
                     foreach ($products as $product) {
                         $this->_catRecursy($catalogTree, $product);
                     }
                 }
                 $this->setVar('catalog', $catalogTree);
             }
             break;
         case 'yandex.yml':
             header("Content-Type: text/xml");
             $this->setVar('nowdate', date("Y-m-d H:i"));
             $this->setVar('shop_name', mb_strlen($this->_shopName, 'utf-8') >= 20 ? mb_substr($this->_shopName, 0, 17, 'utf-8') . '...' : $this->_shopName);
             //Короткое название магазина — название, которое выводится в списке найденных на Яндекс. Маркете товаров. Оно не должно содержать более 20 символов.
             $this->setVar('shop_company', $this->_shopCompany);
             //Полное наименование компании, владеющей магазином. Не публикуется, используется для внутренней идентификации
             $this->setVar('shop_url', $this->config('url'));
             //URL главной страницы магазина.
             $this->setVar('shop_platform', 'Taberna');
             //CMS, на основе которой работает магазин.
             $this->setVar('shop_version', rad_update::getInstance()->getCurrentVersion());
             //Версия CMS.
             $this->setVar('shop_agency', $this->_shopAgency);
             //Наименование агентства, которое оказывает техническую поддержку магазину и отвечает за работоспособность сайта.
             $this->setVar('shop_email', $this->config('system.mail'));
             //Контактный адрес разработчиков CMS или агентства, осуществляющего техподдержку.
             //    Show currencies
             $currencies = rad_instances::get('model_corecatalog_currency')->getItems();
             $this->setVar('currencies', $currencies);
             //    Show categries & offers
             $this->setVar('showCatalog', $this->_showCatalog);
             if ($this->_showCatalog) {
                 $catalogTree = rad_instances::get('model_coremenus_tree')->setState('active', 1)->setState('pid', $this->_treeCatalog)->setState('lang', $this->getCurrentLangID())->getItems(true);
                 $modelCatalog = rad_instances::get('model_corecatalog_catalog')->setState('active', 1)->setState('join.mainimage', true)->setState('join.tree', true)->setState('lang', $this->getCurrentLangID())->setSTate('currency', model_corecatalog_currcalc::getDefaultCurrencyId());
                 $products = $modelCatalog->getItems();
                 if (!empty($products)) {
                     $modelCatalog->getValValues($products);
                     foreach ($products as $product) {
                         //    Params
                         if (count($product->type_vl_link)) {
                             foreach ($product->type_vl_link as $tvlkey => $tvl) {
                                 if ($product->type_vl_link[$tvlkey]->vl_measurement_id) {
                                     $mesId = $product->type_vl_link[$tvlkey]->vl_measurement_id;
                                     $mes = new struct_corecatalog_measurement(array('ms_id' => $mesId));
                                     $mes->load();
                                     $product->type_vl_link[$tvlkey]->ms_value = trim($mes->ms_value);
                                 }
                             }
                         }
                         //    Pictures
                         $model_images = rad_instances::get('model_core_image');
                         $model_images->setState('cat_id', $product->cat_id);
                         $product->images_link = $model_images->getItems();
                         //    Name
                         if (mb_strlen($product->cat_name, 'utf-8') >= 255) {
                             $product->cat_shortdesc = mb_substr($product->cat_name, 0, 252, 'utf-8') . '...';
                         }
                         //    Desctiption
                         $product->cat_shortdesc = strip_tags($product->cat_shortdesc);
                         if (mb_strlen($product->cat_shortdesc, 'utf-8') >= 512) {
                             $product->cat_shortdesc = mb_substr($product->cat_shortdesc, 0, 509, 'utf-8') . '...';
                         }
                         $this->_catRecursy($catalogTree, $product);
                     }
                 }
                 $this->setVar('catalog', $catalogTree);
             }
     }
 }