示例#1
0
文件: blog.php 项目: archweb/nprotein
 function my_sort_div_blogs($data, $parent = 0, $lev = -1)
 {
     $arr = $data[$parent];
     usort($arr, 'compareblogs');
     $lev = $lev + 1;
     for ($i = 0; $i < count($arr); $i++) {
         $arr[$i]['level'] = $lev;
         $z[] = $arr[$i];
         $z[count($z) - 1]['flag_start'] = 1;
         $z[count($z) - 1]['flag_end'] = 0;
         if (isset($data[$arr[$i]['blog_id']])) {
             $m = my_sort_div_blogs($data, $arr[$i]['blog_id'], $lev);
             $z = array_merge($z, $m);
         }
         //isset($data[$arr[$i]['blog_id']])
         if (isset($z[count($z) - 1]['flag_end'])) {
             $z[count($z) - 1]['flag_end']++;
         } else {
             $z[count($z) - 1]['flag_end'] = 1;
         }
     }
     //$i = 0; $i < count($arr); $i++
     return $z;
 }
示例#2
0
文件: blog.php 项目: BulatSa/Ctex
 public function index($arg)
 {
     $ver = VERSION;
     if (!defined('SCP_VERSION')) {
         define('SCP_VERSION', $ver[0]);
     }
     $loader_old = $this->registry->get('load');
     $this->load->library('agoo/loader');
     $agooloader = new agooLoader($this->registry);
     $this->registry->set('load', $agooloader);
     $cacher_old = $this->registry->get('cache');
     $this->load->library('agoo/cache');
     $cacher = new agooCache($this->registry);
     $this->registry->set('cache', $cacher);
     $ajax_file_cached = false;
     $this->router();
     $this->language->load('module/blog');
     $this->language->load('record/blog');
     if (isset($this->request->post['ajax_file'])) {
         $this->request->get['ajax_file'] = $this->request->post['ajax_file'];
     }
     if (isset($this->request->post['ajax'])) {
         $this->request->get['ajax'] = $this->request->post['ajax'];
     }
     if (isset($this->request->post['cmswidget'])) {
         $this->request->get['cmswidget'] = $this->request->post['cmswidget'];
     }
     $this->config->set("blog_work", true);
     $html = "";
     if (!isset($this->data['settings_general']['colorbox_theme'])) {
         $this->data['settings_general']['colorbox_theme'] = 0;
     }
     if (isset($this->data['settings_general']['get_pagination'])) {
         $get_pagination = $this->data['settings_general']['get_pagination'];
     } else {
         $get_pagination = 'tracking';
     }
     $this->data['config_language_id'] = $this->config->get('config_language_id');
     $this->data['config_template'] = $this->config->get('config_template');
     $this->data['theme_stars'] = $this->getThemeStars('image/blogstars-1.png');
     $this->data['http_image'] = getHttpImage($this);
     $this->data = $this->ColorboxLoader($this->data['settings_general']['colorbox_theme'], $this->data);
     $this->load->model('setting/setting');
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_https_admin_path');
     } else {
         $settings_admin = $this->model_setting_setting->getSetting('ascp_admin', 'ascp_admin_http_admin_path');
     }
     foreach ($settings_admin as $key => $value) {
         $this->data['admin_path'] = $value;
     }
     if (SCP_VERSION > 1) {
         $arg['position'] = $this->registry->get('blog_position');
     }
     $position_widget_block = $this->data['position'] = $arg['position'];
     $this->language->load('module/blog');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['text_limit'] = $this->language->get('text_limit');
     $this->data['text_sort'] = $this->language->get('text_sort');
     $template = '/template/agootemplates/widgets/blogs/blog.tpl';
     if (isset($this->request->get['blog_id'])) {
         $parts = explode('_', (string) $this->request->get['blog_id']);
         $this->data['blog_path'] = $this->request->get['blog_id'];
     } else {
         $parts = array();
         $this->data['blog_path'] = 0;
     }
     if (isset($parts[0])) {
         $this->data['blog_id'] = $parts[0];
     } else {
         $this->data['blog_id'] = 0;
     }
     if (isset($parts[1])) {
         $this->data['child_id'] = $parts[1];
     } else {
         $this->data['child_id'] = 0;
     }
     if (isset($this->request->get['route'])) {
         $this->data['route'] = $route = $this->request->get['route'];
     } else {
         $this->data['route'] = $route = 'common/home';
     }
     $this->load->model('catalog/category');
     $this->load->model('catalog/product');
     $this->load->model('catalog/information');
     $this->load->model('design/bloglayout');
     $layout_id = false;
     if ($route == 'product/category' && isset($this->request->get['path'])) {
         $path = explode('_', (string) $this->request->get['path']);
         $category_id = end($path);
         $layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
     }
     if ($route == 'product/product' && isset($this->request->get['product_id'])) {
         $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
     }
     if ($route == 'information/information' && isset($this->request->get['information_id'])) {
         $layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
     }
     if ($route == 'record/blog' && isset($this->request->get['blog_id'])) {
         $path = explode('_', (string) $this->request->get['blog_id']);
         $layout_id = $this->model_design_bloglayout->getBlogLayoutId(end($path));
     }
     if ($route == 'record/record' && isset($this->request->get['record_id'])) {
         $layout_id = $this->model_design_bloglayout->getRecordLayoutId($this->request->get['record_id']);
     }
     if (!$layout_id) {
         $layout_id = $this->model_design_layout->getLayout($route);
     }
     if (!$layout_id) {
         $layout_id = $this->config->get('config_layout_id');
     }
     $this->data['lang_code'] = $this->config->get('config_language');
     if (!$this->registry->has('blog_position_' . $position_widget_block)) {
         $this->registry->set('blog_position_' . $position_widget_block, 0);
     } else {
         $pos = $this->registry->get('blog_position_' . $position_widget_block);
         $this->registry->set('blog_position_' . $position_widget_block, $pos + 1);
     }
     $position_widget = $this->registry->get('blog_position_' . $position_widget_block);
     $this->data['position'] = $position_widget;
     $this->data['layout_id'] = $layout_id;
     $module_data = array();
     if (SCP_VERSION < 2) {
         $this->load->model('setting/extension');
         $extensions = $this->model_setting_extension->getExtensions('module');
     }
     foreach ($extensions as $extension) {
         $modules = $this->config->get($extension['code'] . '_module');
         if ($modules) {
             foreach ($modules as $num => $module) {
                 if (isset($module['layout_id']) && $module['layout_id'] == $layout_id && $extension['code'] == 'blog' && $module['position'] == $position_widget_block && $module['status']) {
                     if ($extension['code'] != '') {
                         $module_data[] = array('code' => $extension['code'], 'setting' => $module, 'sort_order' => $module['sort_order']);
                     }
                 }
             }
         }
     }
     if (isset($module_data) && is_array($module_data)) {
         usort($module_data, 'commd');
     }
     $type = "none";
     $this->data['heading_title'] = '';
     $this->data['categories_blogs'] = array();
     $this->data['ascp_widgets'] = $this->config->get('ascp_widgets');
     /*  for older version opencart
     		if (!class_exists('User')) {
     			require_once(DIR_SYSTEM . 'library/user.php');
     			$this->registry->set('user', new User($this->registry));
     		}
     		*/
     $this->load->library('user');
     $this->user = new User($this->registry);
     if ($this->user->isLogged()) {
         $this->data['userLogged'] = true;
         $this->data['token'] = $this->session->data['token'];
     } else {
         $this->data['userLogged'] = false;
     }
     if (!isset($module_data[$position_widget])) {
         $this->registry->set('blog_position_' . $position_widget_block, 0);
         $position_widget = 0;
     }
     $url_end = "";
     $this->data['request_get'] = array();
     $this->data['get_original'] = $get = $this->request->get;
     foreach ($get as $get_key => $get_val) {
         if (is_array($get_val)) {
             unset($get[$get_key]);
         } else {
             if ($get_key != 'route' && $get_key != 'prefix' && $get_key != '_route_' && $get_key != 'wpage' && $get_key != 'wsort' && $get_key != 'worder' && $get_key != 'ajax_file' && $get_key != 'wlimit' && $get_key != 'cmswidget' && $get_key != $get_pagination) {
                 $url_end .= "&" . $get_key . "=" . $get_val;
             }
         }
     }
     if (isset($this->request->get[$get_pagination])) {
         $tracking = $this->request->get[$get_pagination];
     } else {
         $tracking = '';
     }
     if ($tracking != '') {
         $parts = explode('_', trim(utf8_strtolower($tracking)));
         foreach ($parts as $num => $val) {
             if (strpos($val, '-') === false) {
                 $getquery = $val;
                 $getpar = $val;
             } else {
                 list($getquery, $getpar) = explode("-", $val);
             }
             $this->data['request_get'][$getquery] = $getpar;
         }
     }
     if (isset($this->data['request_get']['wpage']) && isset($this->data['request_get']['cmswidget']) && $this->data['request_get']['cmswidget'] == $module_data[$position_widget]['setting']['what']) {
         $page = $this->data['request_get']['wpage'];
         if ($page > 1) {
             $paging = " " . $this->language->get('text_blog_page') . " " . $page;
         } else {
             $paging = '';
         }
         $title_page = $this->document->getTitle();
         $this->document->setTitle($title_page . $paging);
         $description_page = $this->document->getDescription();
         $this->document->setDescription($description_page . $paging);
     } else {
         $page = 1;
     }
     $this->data['url'] = $this->url->link($route, $url_end);
     if (isset($module_data[$position_widget]['setting']['what'])) {
         $this->data['type'] = $type = $this->data['ascp_widgets'][$module_data[$position_widget]['setting']['what']]['type'];
     }
     if (isset($module_data[$position_widget]['setting']['what']) && isset($this->data['ascp_widgets'][$module_data[$position_widget]['setting']['what']])) {
         $thislist = $this->data['ascp_widgets'][$module_data[$position_widget]['setting']['what']];
     } else {
         $thislist = null;
     }
     $this->data['thislist'] = $thislist;
     $this->data['settings'] = $thislist;
     $this->data['settings_widget'] = $this->data['settings'];
     if (isset($this->data['settings_widget']['anchor']) && $this->data['settings_widget']['anchor'] != '') {
         $this->data['settings_widget']['anchor'] = html_entity_decode($this->data['settings_widget']['anchor'], ENT_QUOTES, 'UTF-8');
     }
     $this->registry->set('thislist', serialize($this->data['settings']));
     if (isset($module_data[$position_widget])) {
         $this->registry->set('ascp_widgets_position', $module_data[$position_widget]['setting']['what']);
     }
     $this->data = $this->customer_groups($this->data);
     if (!isset($this->data['thislist']['customer_groups'])) {
         $this->data['thislist']['customer_groups'] = array();
     }
     $this->data['customer_intersect'] = array_intersect($this->data['thislist']['customer_groups'], $this->data['customer_groups']);
     $this->data = $this->avatar_customer($this->data);
     if (isset($this->data['thislist']['store']) && in_array($this->config->get('config_store_id'), $this->data['thislist']['store'])) {
         if (isset($this->data['thislist']['customer_groups']) && !empty($this->data['customer_intersect'])) {
             if (isset($this->data['thislist']['visual_editor']) && isset($this->data['thislist']['comment_must']) && $this->data['thislist']['comment_must'] && $this->data['thislist']['visual_editor'] || !isset($this->data['thislist']['visual_editor'])) {
                 $this->data['visual_editor'] = true;
                 $this->document->addScript('catalog/view/javascript/wysibb/jquery.wysibb.min.js');
                 if ($this->config->get('config_language') == "en") {
                     //$this->document->addScript('catalog/view/javascript/wysibb/lang/en.js');
                 } else {
                     $scriptfile = 'view/javascript/wysibb/lang/' . $this->config->get('config_language') . '.js';
                     if (file_exists(DIR_APPLICATION . $scriptfile)) {
                         $this->document->addScript('catalog/' . $scriptfile);
                     }
                 }
                 $this->document->addStyle('catalog/view/javascript/wysibb/theme/default/wbbtheme.css');
                 $this->document->addScript('catalog/view/javascript/blog/blog.bbimage.js');
                 $this->document->addScript('catalog/view/javascript/blog/rating/jquery.rating.js');
                 $this->document->addStyle('catalog/view/javascript/blog/rating/jquery.rating.css');
             } else {
                 $this->data['visual_editor'] = false;
             }
             if (SCP_VERSION > 1) {
                 $get_Customer_GroupId = 'getGroupId';
             } else {
                 $get_Customer_GroupId = 'getCustomerGroupId';
             }
             if (isset($this->data['settings_general']['cache_widgets']) && $this->data['settings_general']['cache_widgets']) {
                 $hasha = md5(serialize($this->data['thislist']) . serialize($layout_id) . serialize($this->data['userLogged']) . serialize($this->config->get('config_language_id')) . serialize($this->config->get('config_store_id')));
                 $hash_cache = md5(serialize($this->data['thislist']) . serialize($layout_id) . serialize($this->data['userLogged']) . serialize($this->config->get('config_language_id')) . serialize($this->config->get('config_store_id')) . serialize($this->request->get) . serialize($this->request->post) . $this->data['customer_id']);
                 $cache_name = 'blog.module.view.' . $type . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $this->config->get('config_language_id') . (int) $this->customer->{$get_Customer_GroupId}() . '.' . $hasha;
                 $module_view_cache = $this->cache->get($cache_name);
             } else {
                 $hash_cache = 0;
             }
             if (isset($module_data[$position_widget])) {
                 $cmswidget = $this->data['cmswidget'] = $module_data[$position_widget]['setting']['what'];
             } else {
                 $cmswidget = false;
             }
             $this->data['prefix'] = 'ascpw' . $this->data['cmswidget'];
             //if (!empty($module_data) && ($type == 'treecomments' || $type == 'forms')) {
             //for all pages - may be call ajax function from
             $this->document->addScript('catalog/view/javascript/blog/blog.comment.js');
             //}
             require_once DIR_SYSTEM . 'library/iblog.php';
             $this->data['agoo_widgets'] = iBlog::searchdir(DIR_APPLICATION . "controller/agoo", 'DIRS');
             /**************** PRE loading customer widgets ******************************/
             foreach ($this->data['agoo_widgets'] as $nm => $agoo_widget) {
                 if (!empty($module_data) && $type == $agoo_widget) {
                     if (file_exists(DIR_APPLICATION . "controller/agoo/" . $agoo_widget . "/" . $agoo_widget . ".php")) {
                         $this->cont('agoo/' . $agoo_widget . '/' . $agoo_widget);
                         $controller_agoo = 'controller_agoo_' . $agoo_widget . '_' . $agoo_widget;
                         if (method_exists($this->registry->get($controller_agoo), 'loading')) {
                             $this->data = $this->{$controller_agoo}->loading($this->data);
                         }
                     }
                 }
             }
             /**************** PRE loading customer widgets ******************************/
             if (isset($this->request->get['ajax_file']) && $this->request->get['ajax_file'] != '' && $this->data['cmswidget'] != $this->request->get['cmswidget']) {
                 return;
             }
             if (isset($this->request->get['ajax_file']) && $this->request->get['ajax_file'] != '' && $this->data['cmswidget'] == $this->request->get['cmswidget']) {
                 $ajax_file_cached = $this->ajax_file();
             }
             if (isset($this->request->get['ajax']) && $this->request->get['ajax'] == 1 || isset($this->request->post['ajax']) && $this->request->post['ajax'] == 1) {
                 if (isset($this->request->get['cmswidget']) && $this->data['cmswidget'] == $this->request->get['cmswidget']) {
                     $this->data['cmswidget'] = $this->request->get['cmswidget'];
                 }
                 if (isset($this->request->post['cmswidget']) && $this->data['cmswidget'] == $this->request->post['cmswidget']) {
                     $this->data['cmswidget'] = $this->request->post['cmswidget'];
                 }
                 $this->data['ajax'] = true;
             } else {
                 $this->data['ajax'] = false;
             }
             /**************** BEGIN ******************************/
             if (!isset($module_view_cache[$hash_cache]) || isset($this->data['settings_widget']['cached']) && $this->data['settings_widget']['cached'] == 0 || $ajax_file_cached) {
                 $this->data['type'] = false;
                 /**************** loading customer widgets ******************************/
                 foreach ($this->data['agoo_widgets'] as $nm => $agoo_widget) {
                     if (!empty($module_data) && $type == $agoo_widget) {
                         if (file_exists(DIR_APPLICATION . "controller/agoo/" . $agoo_widget . "/" . $agoo_widget . ".php")) {
                             $this->cont('agoo/' . $agoo_widget . '/' . $agoo_widget);
                             $controller_agoo = 'controller_agoo_' . $agoo_widget . '_' . $agoo_widget;
                             $this->data = $this->{$controller_agoo}->index($this->data);
                             if (isset($this->data[$agoo_widget . '_template'])) {
                                 $template = $this->data[$agoo_widget . '_template'];
                             }
                         }
                     }
                 }
                 /**************** loading customer widgets ******************************/
                 if (!empty($module_data) && ($type == 'blogsall' || $type == 'blogs')) {
                     $this->data['type'] = $type;
                     if (isset($this->data['settings']['title_list_latest'][$this->config->get('config_language_id')])) {
                         $this->data['heading_title'] = $this->data['settings']['title_list_latest'][$this->config->get('config_language_id')];
                     }
                     $this->load->model('catalog/record');
                     $this->load->model('tool/image');
                     $this->data['blogies'] = array();
                     if ($type == 'blogs' || $type == 'blogsall') {
                         $this->data['type'] = $type;
                         $this->data['blog_link'] = $this->url->link('record/blog', 'blog_id=' . $this->data['blog_path']);
                         $blogs = $this->model_catalog_blog->getBlogs();
                         if ($type == 'blogs' && isset($this->data['settings']['blogs'])) {
                             if (count($this->data['settings']['blogs']) != count($blogs)) {
                                 foreach ($this->data['settings']['blogs'] as $num => $blog_id) {
                                     $blogies[] = $this->model_catalog_blog->getBlog($blog_id);
                                 }
                             } else {
                                 $blogies = $this->model_catalog_blog->getBlogs();
                             }
                         }
                         if ($type == 'blogsall') {
                             $blogies = $blogs;
                         }
                         if (isset($blogies) && count($blogies) > 0) {
                             foreach ($blogies as $blog) {
                                 if (isset($blog['blog_id'])) {
                                     $blog_info = $this->model_catalog_blog->getBlog($blog['blog_id']);
                                     $this->load->model('tool/image');
                                     if ($blog_info) {
                                         if ($blog_info['image']) {
                                             if (isset($this->data['settings']['avatar']['width']) && isset($this->data['settings']['avatar']['height']) && $this->data['settings']['avatar']['width'] != "" && $this->data['settings']['avatar']['height'] != "") {
                                                 $thumb = $this->model_tool_image->resize($blog_info['image'], $this->data['settings']['avatar']['width'], $this->data['settings']['avatar']['height']);
                                             } else {
                                                 $thumb = $this->model_tool_image->resize($blog_info['image'], 150, 150);
                                             }
                                         } else {
                                             $thumb = '';
                                         }
                                     } else {
                                         $thumb = '';
                                     }
                                     $data = array('filter_blog_id' => $blog['blog_id'], 'filter_sub_blog' => false);
                                     $record_total = false;
                                     if (isset($this->data['settings']['counting']) && $this->data['settings']['counting'] || !isset($this->data['settings']['counting'])) {
                                         $record_total = $this->model_catalog_record->getTotalRecords($data);
                                     }
                                     $blog_href = $this->model_catalog_blog->getPathByblog($blog['blog_id']);
                                     $active = false;
                                     if (isset($this->request->get['blog_id']) && !isset($this->request->get['record_id'])) {
                                         $blog_id_path_array = explode('_', (string) $this->request->get['blog_id']);
                                         $blog_id_path = end($blog_id_path_array);
                                         if ($blog['blog_id'] == $blog_id_path) {
                                             $active = true;
                                         }
                                     }
                                     $this->data['blogs'][] = array('blog_id' => $blog['blog_id'], 'parent_id' => $blog['parent_id'], 'sort' => $blog['sort_order'], 'blog_design' => unserialize($blog_info['design']), 'name' => $blog['name'], 'count' => $record_total, 'meta' => $blog['meta_description'], 'thumb' => $thumb, 'href' => $this->url->link('record/blog', 'blog_id=' . $blog_href['path']), 'path' => $blog_href['path'], 'display' => true, 'active' => 'none', 'act' => $active);
                                 }
                             }
                         }
                         if (isset($this->data['blogs']) && count($this->data['blogs']) > 0) {
                             $aparent = array();
                             $ablog = array();
                             foreach ($this->data['blogs'] as $num => $data) {
                                 $aparent[$data['parent_id']] = true;
                                 $ablog[$data['blog_id']] = true;
                             }
                             reset($this->data['blogs']);
                             foreach ($this->data['blogs'] as $num => $data) {
                                 if (!isset($ablog[$data['parent_id']])) {
                                     $this->data['blogs'][$num]['parent_id'] = 0;
                                 }
                             }
                             reset($this->data['blogs']);
                             for ($i = 0, $c = count($this->data['blogs']); $i < $c; $i++) {
                                 $new_arr[$this->data['blogs'][$i]['parent_id']][] = $this->data['blogs'][$i];
                             }
                             $this->data['new_arr'] = $new_arr;
                             $this->data['categories_blogs'] = my_sort_div_blogs($new_arr, 0);
                             $lv = 0;
                             $alv = 0;
                             foreach ($this->data['categories_blogs'] as $num => $mblogs) {
                                 $path_parts = explode('_', (string) $this->data['blog_path']);
                                 $blog_parts = explode('_', (string) $mblogs['path']);
                                 $iarr = array_intersect($path_parts, $blog_parts);
                                 $active = 'none';
                                 $display = false;
                                 if (count($iarr) == 0) {
                                     $active = 'none';
                                     if ($mblogs['level'] == 0) {
                                         $display = true;
                                     }
                                 }
                                 if ($mblogs['level'] == $alv) {
                                     $display = true;
                                 } else {
                                     $alv = 0;
                                 }
                                 if (count($iarr) == count($path_parts) && count($iarr) == count($blog_parts)) {
                                     $display = true;
                                     $active = 'active';
                                     $alv = $mblogs['level'] + 1;
                                 }
                                 if (count($iarr) > 0 && $mblogs['level'] <= count($iarr) && $active != 'active') {
                                     $display = true;
                                     if ($mblogs['level'] != count($iarr)) {
                                         $active = 'pass';
                                         $lv = $mblogs['level'] + 1;
                                     }
                                 }
                                 if ($display) {
                                     $display = true;
                                 } else {
                                     if ($mblogs['level'] > $lv) {
                                         $lv = 0;
                                         $display = false;
                                     }
                                 }
                                 $this->data['categories_blogs'][$num]['active'] = $active;
                                 $this->data['categories_blogs'][$num]['display'] = $display;
                             }
                         }
                         //$this->data['thislist'] = $thislist;
                         if (isset($this->data['settings']['template']) && $this->data['settings']['template'] != '') {
                             $template = '/template/agootemplates/widgets/blogs/' . $this->data['settings']['template'];
                         } else {
                             $template = '/template/agootemplates/widgets/blogs/blog.tpl';
                         }
                     }
                 }
                 if (!empty($module_data) && ($type == 'latest' || $type == 'records' || $type == 'reviews' || $type == 'related')) {
                     $sort = "sort";
                     $order = "DESC";
                     if (isset($this->data['settings']['order'])) {
                         $sort = $this->data['settings']['order'];
                     }
                     if (isset($this->data['settings']['order_ad'])) {
                         $order = $this->data['settings']['order_ad'];
                     }
                     if (isset($this->data['request_get']['wsort']) && isset($this->data['request_get']['cmswidget']) && $this->data['request_get']['cmswidget'] == $module_data[$position_widget]['setting']['what']) {
                         $sort = $this->data['request_get']['wsort'];
                     } else {
                     }
                     if (isset($this->data['request_get']['worder']) && isset($this->data['request_get']['cmswidget']) && $this->data['request_get']['cmswidget'] == $module_data[$position_widget]['setting']['what']) {
                         $order = $this->data['request_get']['worder'];
                     } else {
                     }
                     $this->data['wpage'] = $page;
                     $thislist = $this->data['settings'];
                     if (!isset($this->data['settings']['number_per_widget']) || $this->data['settings']['number_per_widget'] == '') {
                         $thislist['number_per_widget'] = 5;
                     }
                     if (isset($this->data['request_get']['wlimit']) && isset($this->data['request_get']['cmswidget']) && $this->data['request_get']['cmswidget'] == $module_data[$position_widget]['setting']['what']) {
                         $thislist['number_per_widget'] = $this->data['request_get']['wlimit'];
                     }
                     $thislist['paging'] = $this->data['settings']['paging'] = array('start' => ($page - 1) * $thislist['number_per_widget']);
                     $limit = $thislist['number_per_widget'];
                 }
                 /****************************************************************/
                 if (!empty($module_data) && ($type == 'latest' || $type == 'records' || $type == 'related')) {
                     $this->data['type'] = $type;
                     $data_records = $this->getBlogsRecords($this->data['settings'], $type);
                     $this->data = array_merge($this->data, $data_records);
                     $cmswidget_end = '';
                     $url_end = "";
                     foreach ($this->data['request_get'] as $get_key => $get_val) {
                         if (is_array($get_val)) {
                             unset($get[$get_key]);
                         } else {
                             if ($get_key != 'route' && $get_key != 'ajax_file' && $get_key != 'prefix' && $get_key != '_route_' && $get_key != 'wpage' && $get_key != 'wsort' && $get_key != 'worder' && $get_key != 'wlimit' && $get_key != 'cmswidget' && $get_key != $get_pagination) {
                                 $url_end .= "&" . (string) $get_key . "=" . (string) $get_val;
                             }
                             if ($get_key == 'wsort' || $get_key == 'worder' || $get_key == 'wlimit') {
                                 $cmswidget_end .= "_" . (string) $get_key . "-" . (string) $get_val;
                             }
                         }
                     }
                     $link_end_string = $get_pagination . '=cmswidget-' . $cmswidget . '_wpage-{page}' . $cmswidget_end . '#cmswidget-' . $cmswidget;
                     $link_url = $this->url->link($route, $url_end);
                     // For seo_pro on main page (seo_pro remove get. why?)
                     $url_razdel = '&amp;';
                     if (strpos($link_url, '?') === false) {
                         $url_razdel = '?';
                     }
                     $link_url .= urldecode($url_razdel . $link_end_string);
                     if (!isset($this->data['total'])) {
                         $this->data['total'] = 0;
                     }
                     if (isset($thislist['pagination']) && $thislist['pagination']) {
                         $pagination = new Pagination();
                         $pagination->total = $this->data['total'];
                         $pagination->page = $page;
                         $pagination->limit = $limit;
                         $pagination->text = $this->language->get('text_pagination');
                         $pagination->url = $link_url;
                         $this->data['pagination'] = $pagination->render();
                     }
                     /********************************************/
                     if (isset($thislist['sort']) && $thislist['sort']) {
                         $this->data['sorts'] = array();
                         $this->data['sorts'][] = array('text' => $this->language->get('text_sort_asc'), 'value' => 'sort-asc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-sort_worder-ASC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_sort_desc'), 'value' => 'sort-desc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-sort_worder-DESC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_date_added_asc'), 'value' => 'latest-asc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-latest_worder-ASC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_date_added_desc'), 'value' => 'latest-desc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-latest_worder-DESC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-desc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-rating_worder-DESC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-asc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-rating_worder-ASC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_comments_desc'), 'value' => 'comments-desc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-comments_worder-DESC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_comments_asc'), 'value' => 'comments-asc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-comments_worder-ASC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_popular_desc'), 'value' => 'popular-desc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-popular_worder-DESC' . '#cmswidget-' . $cmswidget));
                         $this->data['sorts'][] = array('text' => $this->language->get('text_popular_asc'), 'value' => 'popular-asc', 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wsort-popular_worder-ASC' . '#cmswidget-' . $cmswidget));
                         $this->data['sort'] = $sort;
                         $this->data['order'] = $order;
                     }
                     if (isset($thislist['limit']) && $thislist['limit']) {
                         $this->data['limits'] = array();
                         $this->data['limits'][] = array('text' => $limit, 'value' => $limit, 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . $cmswidget_end . '#cmswidget-' . $cmswidget));
                         $this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . $cmswidget_end . '_wlimit-25' . '#cmswidget-' . $cmswidget));
                         $this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . $cmswidget_end . '_wlimit-50' . '#cmswidget-' . $cmswidget));
                         $this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . $cmswidget_end . '_wlimit-100' . '#cmswidget-' . $cmswidget));
                         $this->data['limit'] = $limit;
                     }
                     if (isset($thislist['template']) && $thislist['template'] != '') {
                         $template = '/template/agootemplates/widgets/records/' . $thislist['template'];
                     } else {
                         if ($type == 'latest' || $type == 'related') {
                             $template = '/template/agootemplates/widgets/records/adaptive.tpl';
                         }
                         if ($type == 'records') {
                             $template = '/template/agootemplates/widgets/records/adaptive.tpl';
                         }
                     }
                 }
                 if (!empty($module_data) && $type == 'reviews') {
                     $this->data['type'] = $type;
                     $data_reviews = $this->getBlogsReviews($this->data['settings'], $type);
                     $this->data = array_merge($this->data, $data_reviews);
                     $url_end = "";
                     foreach ($this->request->get as $get_key => $get_val) {
                         if ($get_key != 'route' && $get_key != 'ajax_file' && $get_key != 'prefix' && $get_key != '_route_' && $get_key != 'wpage' && $get_key != 'cmswidget' && $get_key != $get_pagination) {
                             $url_end .= "&" . (string) $get_key . "=" . (string) $get_val;
                         }
                     }
                     $link_url = $this->url->link($route, $url_end . '&' . $get_pagination . '=cmswidget-' . $cmswidget . '_wpage-{page}' . '#cmswidget-' . $cmswidget);
                     if (!isset($this->data['comment_total'])) {
                         $this->data['comment_total'] = 0;
                     }
                     $pagination = new Pagination();
                     $pagination->total = $this->data['comment_total'];
                     $pagination->page = $page;
                     $pagination->limit = $thislist['number_per_widget'];
                     $pagination->text = $this->language->get('text_pagination');
                     $pagination->url = $link_url;
                     $this->data['pagination'] = $pagination->render();
                     if (isset($thislist['template']) && $thislist['template'] != '') {
                         $template = '/template/agootemplates/widgets/reviews/' . $thislist['template'];
                     } else {
                         if ($type == 'reviews') {
                             $template = '/template/agootemplates/widgets/reviews/reviews_adaptive.tpl';
                         }
                     }
                 }
                 if (!empty($module_data) && ($type == 'treecomments' || $type == 'forms')) {
                     $this->data['mark'] = false;
                     $this->data['comment_status'] = true;
                     $this->load->model('catalog/record');
                     $this->load->model('catalog/blog');
                     $this->load->model('catalog/treecomments');
                     $this->load->model('catalog/product');
                     $this->load->model('catalog/fields');
                     if (isset($this->request->get['product_id'])) {
                         $thislist['product_id'] = $this->request->get['product_id'];
                         $this->data['mark_id'] = $this->request->get['product_id'];
                         $this->data['mark'] = 'product_id';
                         $route = 'product/product';
                         $mark_info = $this->model_catalog_product->getProduct($this->data['mark_id']);
                         $this->data['comment_status'] = $this->config->get('config_review_status');
                         $b_path = $this->model_catalog_treecomments->getPathByProduct($this->data['mark_id']);
                         $this->data['mark_info'] = $mark_info;
                     } else {
                         $thislist['product_id'] = false;
                     }
                     if (isset($this->request->get['record_id'])) {
                         $thislist['record_id'] = $this->request->get['record_id'];
                         $this->data['mark_id'] = $this->request->get['record_id'];
                         $this->data['mark'] = 'record_id';
                         $route = 'record/record';
                         $mark_info = $record_info = $this->model_catalog_record->getRecord($this->data['mark_id']);
                         $comment_setting = unserialize($mark_info['comment']);
                         $this->data['comment_status'] = $comment_setting['status'];
                         $this->data['mark_info'] = $record_info;
                         $this->load->model('catalog/blog');
                         $b_path = $this->model_catalog_blog->getPathByRecord($this->data['mark_id']);
                     } else {
                         $thislist['record_id'] = false;
                     }
                     if ($this->data['comment_status']) {
                         if (isset($this->data['thislist']['recordid']) && $this->data['thislist']['recordid'] != '') {
                             $thislist['record_id'] = $this->data['thislist']['recordid'];
                             $this->data['mark_id'] = $this->data['thislist']['recordid'];
                             $this->data['mark'] = 'record_id';
                             $route = 'record/record';
                             $this->data['record'] = $mark_info = $record_info = $this->model_catalog_record->getRecord($this->data['mark_id']);
                             $this->data['mark_info'] = $record_info;
                             $this->load->model('catalog/blog');
                             $b_path = $this->model_catalog_blog->getPathByRecord($this->data['mark_id']);
                         } else {
                             $this->data['record'] = '';
                         }
                         $this->language->load('account/login');
                         $this->language->load('record/signer');
                         if (isset($this->data['thislist']['langfile']) && $this->data['thislist']['langfile'] != '') {
                             $this->language->load($this->data['thislist']['langfile']);
                         }
                         /*
                         				$this->data['prefix'] = false;
                         				$prefix_str           = str_replace("_", "", $this->data['mark']);
                         				$prefix_array         = preg_split('//', $prefix_str, -1, PREG_SPLIT_NO_EMPTY);
                         				shuffle($prefix_array);
                         				$this->data['prefix'] = implode($prefix_array) . "_";
                         */
                         $this->data['prefix'] = 'ascpw' . $this->data['cmswidget'] . "_";
                         $this->registry->set("prefix", $this->data['prefix']);
                         if ($this->data['mark']) {
                             $this->data['type'] = $type;
                             $this->data['href'] = $this->url->link($route, $this->data['mark'] . '=' . $thislist[$this->data['mark']]);
                             if ($this->customer->isLogged()) {
                                 $this->data['text_login'] = $this->customer->getFirstName() . " " . $this->customer->getLastName();
                                 $this->data['captcha_status'] = false;
                                 $this->data['customer_id'] = $this->customer->getId();
                             } else {
                                 $this->data['text_login'] = $this->language->get('text_anonymus');
                                 $this->data['captcha_status'] = true;
                                 $this->data['customer_id'] = false;
                                 $this->data['signer_code'] = 'customer_id';
                                 $this->data['text_new_customer'] = $this->language->get('text_new_customer');
                                 $this->data['text_register'] = $this->language->get('text_register');
                                 $this->data['text_register_account'] = $this->language->get('text_register_account');
                                 $this->data['text_returning_customer'] = $this->language->get('text_returning_customer');
                                 $this->data['text_i_am_returning_customer'] = $this->language->get('text_i_am_returning_customer');
                                 $this->data['text_forgotten'] = $this->language->get('text_forgotten');
                                 $this->data['entry_email'] = $this->language->get('entry_email');
                                 $this->data['entry_password'] = $this->language->get('entry_password');
                                 $this->data['button_continue'] = $this->language->get('button_continue');
                                 $this->data['button_login'] = $this->language->get('button_login');
                                 $this->data['hide_block'] = $this->language->get('hide_block');
                                 $this->data['error_register'] = $this->language->get('error_register');
                                 if (isset($this->error['warning'])) {
                                     $this->data['error_warning'] = $this->error['warning'];
                                 } else {
                                     $this->data['error_warning'] = '';
                                 }
                                 if (isset($this->session->data['success'])) {
                                     $this->data['success'] = $this->session->data['success'];
                                     unset($this->session->data['success']);
                                 } else {
                                     $this->data['success'] = '';
                                 }
                                 if (isset($this->request->post['email'])) {
                                     $this->data['email'] = $this->request->post['email'];
                                 } else {
                                     $this->data['email'] = '';
                                 }
                                 if (isset($this->request->post['password'])) {
                                     $this->data['password'] = $this->request->post['password'];
                                 } else {
                                     $this->data['password'] = '';
                                 }
                                 $this->data['action'] = $this->url->link('account/login', '', 'SSL');
                                 $this->data['register'] = $this->url->link('account/register', '', 'SSL');
                                 $this->data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL');
                                 if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], $this->config->get('config_url')) !== false || strpos($this->request->post['redirect'], $this->config->get('config_ssl')) !== false)) {
                                     $this->data['redirect'] = $this->request->post['redirect'];
                                 } elseif (isset($this->session->data['redirect'])) {
                                     $this->data['redirect'] = $this->session->data['redirect'];
                                     unset($this->session->data['redirect']);
                                 } else {
                                     $this->data['redirect'] = $this->data['href'];
                                 }
                             }
                             if ($thislist[$this->data['mark']] && isset($this->data['customer_id'])) {
                             }
                             $this->load->model('agoo/signer/signer');
                             if (isset($_COOKIE['email_subscribe_' . $this->data['mark']])) {
                                 $email_subscribe = unserialize(base64_decode($_COOKIE['email_subscribe_' . $this->data['mark']]));
                                 if (isset($email_subscribe[$this->data['mark_id']])) {
                                     $email_subscribe = $email_subscribe[$this->data['mark_id']];
                                 } else {
                                     $email_subscribe = false;
                                 }
                             } else {
                                 $email_subscribe = false;
                             }
                             $this->data['signer_status'] = $this->model_agoo_signer_signer->getStatus($thislist[$this->data['mark']], $this->data['customer_id'], $this->data['mark'], $email_subscribe);
                             $this->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $this->url->link('account/register', '', 'SSL'));
                             $this->data['text_wait'] = $this->language->get('text_wait');
                             $this->cont('record/treecomments');
                             $mark = $this->data['mark'];
                             $this->data = $this->getMarkReviews($thislist, $type, $this->data['mark']);
                             $this->data['mark'] = $mark;
                             $this->data['html_comment'] = $this->controller_record_treecomments->comment($this->data['cmswidget']);
                             if (isset($thislist['view_captcha']) && $thislist['view_captcha'] == 0) {
                                 $this->data['captcha_status'] = false;
                             }
                             if (isset($this->data['thislist']['visual_editor']) && isset($this->data['thislist']['comment_must']) && $this->data['thislist']['comment_must'] && $this->data['thislist']['visual_editor'] || !isset($this->data['thislist']['visual_editor'])) {
                                 $this->data['visual_editor'] = true;
                             } else {
                                 $this->data['visual_editor'] = false;
                             }
                             if (isset($thislist['fields_view'])) {
                                 $this->data['fields_view'] = $thislist['fields_view'];
                             } else {
                                 $this->data['fields_view'] = 0;
                             }
                             if (isset($thislist['addfields'])) {
                                 usort($thislist['addfields'], 'comp_field');
                                 $this->data['fields'] = $thislist['addfields'];
                             } else {
                                 $this->data['fields'] = array();
                             }
                             $fields_db = $this->model_catalog_fields->getFieldsDBlang();
                             foreach ($this->data['fields'] as $num => $field) {
                                 foreach ($fields_db as $num_db => $field_db) {
                                     if ($field['field_name'] == $field_db['field_name']) {
                                         foreach ($field_db as $num_1 => $field_1) {
                                             if (!isset($this->data['fields'][$num][$num_1]) || $field_db[$num_1] == '') {
                                                 $this->data['fields'][$num][$num_1] = $field_1;
                                             } else {
                                             }
                                         }
                                     }
                                 }
                             }
                             usort($this->data['fields'], 'comp_field');
                             $this->data['text_signer_answer'] = $this->language->get('text_signer_answer');
                             $this->data['text_signer_answer_email'] = $this->language->get('text_signer_answer_email');
                             $this->data['text_signer'] = $this->language->get('text_signer');
                             $this->data['text_write_review'] = $this->language->get('text_write_review');
                             $this->data['text_write'] = $this->language->get('text_write');
                             $this->data['hide_block'] = $this->language->get('hide_block');
                             $this->data['error_register'] = $this->language->get('error_register');
                             $this->data['entry_name'] = $this->language->get('entry_name');
                             $this->data['text_customer_enter'] = $this->language->get('text_customer_enter');
                             $this->data['entry_comment'] = $this->language->get('entry_comment');
                             $this->data['text_note'] = $this->language->get('text_note');
                             $this->data['entry_rating_review'] = $this->language->get('entry_rating_review');
                             $this->data['entry_bad'] = $this->language->get('entry_bad');
                             $this->data['entry_good'] = $this->language->get('entry_good');
                             $this->data['entry_captcha_title'] = $this->language->get('entry_captcha_title');
                             $this->data['entry_captcha'] = $this->language->get('entry_captcha');
                             $this->data['text_voted_blog_plus'] = $this->language->get('text_voted_blog_plus');
                             $this->data['text_voted_blog_minus'] = $this->language->get('text_voted_blog_minus');
                             $this->data['text_vote_will_reg'] = $this->language->get('text_vote_will_reg');
                             $this->data['text_vote_blog_plus'] = $this->language->get('text_vote_blog_plus');
                             $this->data['text_vote_blog_minus'] = $this->language->get('text_vote_blog_minus');
                             $this->data['text_review_yes'] = $this->language->get('text_review_yes');
                             $this->data['text_review_no'] = $this->language->get('text_review_no');
                             $this->data['text_review_karma'] = $this->language->get('text_review_karma');
                             $this->data['tab_review'] = $this->language->get('tab_review');
                             $this->data['text_all'] = $this->language->get('text_all');
                             $this->data['text_admin'] = $this->language->get('text_admin');
                             $this->data['text_buyproduct'] = $this->language->get('text_buyproduct');
                             $this->data['text_buy'] = $this->language->get('text_buy');
                             $this->data['text_registered'] = $this->language->get('text_registered');
                             $this->data['text_buy_ghost'] = $this->language->get('text_buy_ghost');
                             $this->data['button_write'] = $this->language->get('button_write');
                             $this->data['thislist'] = $this->data['cmswidget'];
                         }
                     }
                     if (isset($thislist['template']) && $thislist['template'] != '') {
                         if ($type == 'treecomments') {
                             $template = '/template/agootemplates/widgets/treecomments/' . $thislist['template'];
                         }
                         if ($type == 'forms') {
                             $template = '/template/agootemplates/widgets/forms/' . $thislist['template'];
                         }
                     } else {
                         if ($type == 'treecomments') {
                             $template = '/template/agootemplates/widgets/treecomments/rozetka.tpl';
                         }
                         if ($type == 'forms') {
                             $template = '/template/agootemplates/widgets/forms/rozetka.tpl';
                         }
                     }
                 }
                 if (!empty($module_data) && $type == 'hook') {
                     $this->data['type'] = $type;
                     $class_widget = $type . '_widget';
                     $this->data = $this->{$class_widget}($this->data);
                     $template = $this->data['template'];
                 }
                 if (!empty($module_data) && $type == 'avatar') {
                     $this->data['type'] = $type;
                     $class_widget = $type . '_widget';
                     $this->data = $this->{$class_widget}($this->data);
                     $template = $this->data['template'];
                 }
                 if (isset($this->data['settings']['further'][$this->config->get('config_language_id')]) && $this->data['settings']['further'][$this->config->get('config_language_id')] != '') {
                     $this->data['settings_general']['further'][$this->config->get('config_language_id')] = $this->data['settings']['further'][$this->config->get('config_language_id')];
                 }
                 if (!isset($this->data['request_get']['cmswidget'])) {
                     $this->data['request_get']['cmswidget'] = $this->data['cmswidget'];
                 }
                 if (isset($this->data['settings']['box_begin']) && $this->data['settings']['box_begin'] != '') {
                     $this->data['box_begin'] = html_entity_decode($this->data['settings']['box_begin']);
                 } else {
                     $this->data['box_begin'] = html_entity_decode($this->data['settings_general']['box_begin']);
                 }
                 if ($this->data['heading_title'] != '') {
                     $this->data['box_begin'] = str_replace('{TITLE}', $this->data['heading_title'], $this->data['box_begin']);
                 } else {
                     $this->data['box_begin'] = str_replace('{TITLE}', '', $this->data['box_begin']);
                 }
                 if (isset($this->data['cmswidget'])) {
                     $this->data['box_begin'] = str_replace('{CMSWIDGET}', $this->data['cmswidget'], $this->data['box_begin']);
                 } else {
                     $this->data['box_begin'] = str_replace('{CMSWIDGET}', '', $this->data['box_begin']);
                 }
                 if (isset($this->data['settings']['box_end']) && $this->data['settings']['box_end'] != '') {
                     $this->data['box_end'] = html_entity_decode($this->data['settings']['box_end']);
                 } else {
                     $this->data['box_end'] = html_entity_decode($this->data['settings_general']['box_end']);
                 }
                 if ($this->data['heading_title'] != '') {
                     $this->data['box_end'] = str_replace('{TITLE}', $this->data['heading_title'], $this->data['box_end']);
                 } else {
                     $this->data['box_end'] = str_replace('{TITLE}', '', $this->data['box_end']);
                 }
                 if (isset($this->data['settings_general']['box_share_list']) && $this->data['settings_general']['box_share_list'] != '') {
                     $this->data['box_share_list'] = html_entity_decode($this->data['settings_general']['box_share_list']);
                 } else {
                     $this->data['box_share_list'] = '';
                 }
                 if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
                     $config_url = substr($this->config->get('config_ssl'), 0, strpos_offset('/', $this->config->get('config_ssl'), 3) + 1);
                 } else {
                     $config_url = substr($this->config->get('config_url'), 0, strpos_offset('/', $this->config->get('config_url'), 3) + 1);
                 }
                 $url = str_replace('&amp;', '&', ltrim($this->request->server['REQUEST_URI'], '/'));
                 $this->data['href_url'] = $config_url . $url;
                 if (!empty($module_data) && $type != '') {
                     if ($this->data['type']) {
                         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template) && is_file(DIR_TEMPLATE . $this->config->get('config_template') . $template)) {
                             $this->template = $this->config->get('config_template') . $template;
                         } else {
                             if (file_exists(DIR_TEMPLATE . 'default' . $template) && is_file(DIR_TEMPLATE . 'default' . $template)) {
                                 $this->template = 'default' . $template;
                             } else {
                                 $this->template = '';
                             }
                         }
                         $this->data['theme'] = $this->config->get('config_template');
                         $this->data['language'] = $this->language;
                         $this->data['request'] = $this->request;
                         $this->data['document'] = $this->document;
                         if ($this->template != '') {
                             if (SCP_VERSION < 2) {
                                 $html = $this->render();
                             }
                             if (isset($this->data['settings']['ajax']) && $this->data['settings']['ajax']) {
                                 $this->data['html'] = $html;
                                 $this->data = $this->ajax_write($this->data);
                                 $html = $this->data['html'];
                                 $ajax_file_new = $this->data['ajax_file'];
                             }
                             //}
                             if (isset($this->data['settings_general']['cache_widgets']) && $this->data['settings_general']['cache_widgets']) {
                                 $module_view_cache[$hash_cache] = base64_encode($html);
                                 $this->cache->set($cache_name, $module_view_cache);
                             }
                         }
                     }
                 }
             } else {
                 $html = base64_decode($module_view_cache[$hash_cache]);
             }
             $this->registry->set('load', $loader_old);
             $this->registry->set('cache', $cacher_old);
             $this->output = $html;
             $this->config->set("blog_work", false);
             if (isset($this->request->get['ajax_file']) && $this->request->get['ajax_file'] != '') {
                 if (isset($ajax_file_new) && $this->data['cmswidget'] == $this->request->get['cmswidget']) {
                     $this->request->get['ajax_file'] = base64_encode($ajax_file_new);
                     $this->ajax_file();
                 }
             } else {
                 if ($this->data['ajax']) {
                     $this->data['header'] = '';
                     $this->data['column_left'] = '';
                     $this->data['column_right'] = '';
                     $this->data['content_top'] = '';
                     $this->data['content_bottom'] = '';
                     $this->data['footer'] = '';
                     if (SCP_VERSION < 2) {
                         $html = $this->render();
                     }
                     $this->registry->set("blog_output", 1);
                     $this->response->setOutput($html);
                     $this->response->output();
                     $this->registry->set("fblogwork", 0);
                     exit;
                 }
                 if (SCP_VERSION > 1) {
                     return $html;
                 } else {
                     return $this->response->setOutput($html);
                 }
             }
         }
     }
 }