Beispiel #1
0
 /**
  * 初始化
  */
 public function init()
 {
     parent::init();
     $this->topic = new TopicModel();
     $this->referer = isset($_SERVER["HTTP_REFERER"]) ? str_replace('http://' . $_SERVER['HTTP_HOST'], '', $_SERVER["HTTP_REFERER"]) : '/admin/index/index';
     //设置白名单(在白名单内不需要tid,否则需要提供tid
     //这样可以避免在专题相关的控制器和方法中再次判断 用户对专题权限
     $url_arr = array("/admin/topic/index", "/admin/topic/index/", "/admin/topicdata/index", "/admin/topicdata/index/", "/admin/topic/add/", "/admin/topic/add", "/admin/topicdata/trashindex", "/admin/topicdata/trashindex/");
     if (!in_array($_SERVER['REQUEST_URI'], $url_arr)) {
         $tid = $this->getRequest()->getQuery("tid");
         //如果不存在tid 非法请求
         if (!$tid) {
             Alert::danger("非法请求");
             Yaf_Controller_Abstract::redirect("/admin/topic/index/");
             exit;
         }
         //根据tid查询当前用户是否是管理员或者是该专题的所有者,如果不是则提示权限不足
         if (!$this->checkrole($tid)) {
             Alert::danger("权限不足");
             Yaf_Controller_Abstract::redirect("/admin/topic/index/");
             exit;
         }
     }
     //判断是否是管理员 并赋值给模板
     $this->getView()->assign("is_admin", $this->is_admin());
 }
Beispiel #2
0
 /**
  初始化
  @param void
  @return void
 */
 function init()
 {
     parent::init();
     $this->referer = isset($_SERVER["HTTP_REFERER"]) ? str_replace('http://' . $_SERVER['HTTP_HOST'], '', $_SERVER["HTTP_REFERER"]) : '/admin/index/index';
     //db 实例化
     $this->db_config = new ConfigModel();
 }
 public function init()
 {
     parent::init();
     AuthController::requireLogin();
     AuthController::requireShopSession();
     $this->setSmarty();
 }
Beispiel #4
0
 function init()
 {
     parent::init();
     if (true !== YII_DEBUG) {
         exit('access deny!');
     }
 }
 /**
  * AdminController::init() override
  * @see AdminController::init()
  */
 public function init()
 {
     if (Tools::isSubmit('submitFilterorders')) {
         $this->list_id = 'orders';
     } elseif (Tools::isSubmit('submitFiltertemplates')) {
         $this->list_id = 'templates';
     }
     parent::init();
     if (Tools::isSubmit('addsupply_order') || Tools::isSubmit('submitAddsupply_order') || Tools::isSubmit('updatesupply_order') && Tools::isSubmit('id_supply_order')) {
         // override table, lang, className and identifier for the current controller
         $this->table = 'supply_order';
         $this->className = 'SupplyOrder';
         $this->identifier = 'id_supply_order';
         $this->lang = false;
         $this->action = 'new';
         $this->display = 'add';
         if (Tools::isSubmit('updatesupply_order')) {
             if ($this->tabAccess['edit'] === '1') {
                 $this->display = 'edit';
             } else {
                 $this->errors[] = Tools::displayError('You do not have permission to edit this.');
             }
         }
     }
     if (Tools::isSubmit('update_receipt') && Tools::isSubmit('id_supply_order')) {
         // change the display type in order to add specific actions to
         $this->display = 'update_receipt';
         // display correct toolBar
         $this->initToolbar();
     }
 }
Beispiel #6
0
 /**
  初始化
  @param void
  @return void
 */
 function init()
 {
     parent::init();
     //db 实例化
     $this->category = new CategoryModel();
     $this->modeldata = new ModeldataModel();
 }
 public function init()
 {
     parent::init();
     // context->shop is set in the init() function, so we move the _category instanciation after that
     if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') {
         $this->_category = new Category($id_category);
     } else {
         if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
             $this->_category = new Category($this->context->shop->id_category);
         } else {
             if (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) {
                 $this->_category = Category::getTopCategory();
             } else {
                 $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY'));
             }
         }
     }
     // if we are not in a shop context, we remove the position column
     if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
         unset($this->fields_list['position']);
     }
     // shop restriction : if category is not available for current shop, we redirect to the list from default category
     if (!$this->_category->isAssociatedToShop() && Shop::getContext() == Shop::CONTEXT_SHOP) {
         $this->redirect_after = self::$currentIndex . '&id_category=' . (int) $this->context->shop->getCategory() . '&token=' . $this->token;
         $this->redirect();
     }
 }
 function init()
 {
     parent::init();
     Requirements::css(Director::protocol() . "code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css");
     Requirements::css('news/code/ui/frontend/css/news.admin.css');
     Requirements::javascript(Director::protocol() . "code.jquery.com/ui/1.10.4/jquery-ui.min.js");
     Requirements::javascript('news/code/ui/frontend/js/news.admin.js');
 }
    public function init()
    {
        parent::init();
        $this->fields_list = array('id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Currency')), 'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 80), 'iso_code_num' => array('title' => $this->l('ISO code number'), 'align' => 'center', 'width' => 120), 'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false), 'conversion_rate' => array('title' => $this->l('Conversion rate'), 'type' => 'float', 'align' => 'center', 'width' => 130, 'search' => false), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
        $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')), 'enableSelection' => array('text' => $this->l('Enable selection')), 'disableSelection' => array('text' => $this->l('Disable selection')));
        $this->fields_options = array('change' => array('title' => $this->l('Currency rates'), 'image' => '../img/admin/exchangesrate.gif', 'description' => $this->l('Use PrestaShop\'s webservice to update your currency exchange rates. Please use caution, rates are provided as-is.'), 'submit' => array('title' => $this->l('Update currency rates'), 'class' => 'button', 'name' => 'SubmitExchangesRates')), 'cron' => array('title' => $this->l('Automatically update currency rates'), 'image' => '../img/admin/tab-tools.gif', 'info' => $this->l('Use PrestaShop\'s webservice to update your currency exchange rates. Please use caution, rates are provided as-is. Place this URL in crontab or access it manually daily') . ':<br />
					<b>' . Tools::getShopDomain(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME')) . '</b></p>'));
    }
Beispiel #10
0
 public function init()
 {
     parent::init();
     $this->navItemIconBaseUrlPath = $this->rootUrl . '/images/admin/icon1';
     $this->componentFastpostIconBaseUrlPath = $this->rootUrl . '/images/admin/icon2';
     $this->componentDiscoverIconBaseUrlPath = $this->rootUrl . '/images/admin/icon3';
     $this->componentTopbarIconBaseUrlPath = $this->rootUrl . '/images/admin/topbar';
 }
Beispiel #11
0
 function init()
 {
     parent::init();
     $this->db_role = new RoleModel();
     $this->db_user = new UserModel();
     $this->db_privilege = new PrivilegeModel();
     $this->db_document = new DocumentModel();
 }
Beispiel #12
0
 function init()
 {
     parent::init();
     if (!$this->_config['mlanguage']) {
         flash('error', __('please open muit language support'));
         $this->redirect(url('admin/default/index'));
     }
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_formtemplate_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('Form Templates Manager'));
     $this->title[] = at('Form Templates Manager');
 }
Beispiel #14
0
 function init()
 {
     parent::init();
     $this->getid = (int) $_GET['fid'];
     $this->active = 'node-' . $this->getid;
     $model = NodeContent::model()->findByPk($this->getid);
     $this->table = "field_" . trim($model->name);
     $this->title = __($model->discription) ?: __($model->name);
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_blog_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('Blog Manager'));
     $this->title[] = at('Blog Posts Manager');
 }
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_logs_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('Logs'));
     $this->title[] = at('Logs');
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_usercustomfields_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('User Custom Fields'));
     $this->title[] = at('User Custom Fields Manager');
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_uscities_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('US Cities Manager'));
     $this->title[] = at('US Cities Manager');
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_helptopics_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('Help Topics Manager'));
     $this->title[] = at('Help Topics Manager');
 }
 /**
  * init
  */
 public function init()
 {
     parent::init();
     // Check Access
     checkAccessThrowException('op_personalmessages_view');
     // Add Breadcrumb
     $this->addBreadCrumb(at('Personal Messages Manager'));
     $this->title[] = at('Personal Messages Manager');
 }
 public function init()
 {
     // No cache for auto-refresh uploaded logo
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     parent::init();
     $this->can_display_themes = !Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP ? true : false;
     $this->fields_options = array('theme' => array('title' => sprintf($this->l('Select theme for shop %s'), $this->context->shop->name), 'description' => !$this->can_display_themes ? $this->l('You must select a shop from the above list if you want to select a theme') : '', 'fields' => array('theme_for_shop' => array('type' => 'theme', 'themes' => Theme::getThemes(), 'id_theme' => $this->context->shop->id_theme, 'can_display_themes' => $this->can_display_themes, 'no_multishop_checkbox' => true))), 'appearance' => array('title' => $this->l('Appearance'), 'icon' => 'email', 'fields' => array('PS_LOGO' => array('title' => $this->l('Header logo'), 'desc' => $this->l('Will appear on main page'), 'type' => 'file', 'thumb' => _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_LOGO_MAIL' => array('title' => $this->l('Mail logo'), 'desc' => (Configuration::get('PS_LOGO_MAIL') === false ? '<span class="light-warning">' . $this->l('Warning: No e-mail logo defined, the header logo is used instead.') . '</span><br />' : '') . $this->l('Will appear on e-mail headers. If undefined, the Header logo will be used'), 'type' => 'file', 'thumb' => Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL')) ? _PS_IMG_ . Configuration::get('PS_LOGO_MAIL') . '?date=' . time() : _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_LOGO_INVOICE' => array('title' => $this->l('Invoice logo'), 'desc' => (Configuration::get('PS_LOGO_INVOICE') === false ? '<span class="light-warning">' . $this->l('Warning: No invoice logo defined, the header logo is used instead.') . '</span><br />' : '') . $this->l('Will appear on invoice headers. If undefined, the Header logo will be used'), 'type' => 'file', 'thumb' => Configuration::get('PS_LOGO_INVOICE') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE')) ? _PS_IMG_ . Configuration::get('PS_LOGO_INVOICE') . '?date=' . time() : _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_FAVICON' => array('title' => $this->l('Favicon'), 'hint' => $this->l('Only ICO format allowed'), 'desc' => $this->l('Will appear in the address bar of your web browser'), 'type' => 'file', 'thumb' => _PS_IMG_ . Configuration::get('PS_FAVICON') . '?date=' . time()), 'PS_STORES_ICON' => array('title' => $this->l('Store icon'), 'hint' => $this->l('Only GIF format allowed'), 'desc' => $this->l('Will appear on the store locator (inside Google Maps)') . '<br />' . $this->l('Suggested size: 30x30, Transparent GIF'), 'type' => 'file', 'thumb' => _PS_IMG_ . Configuration::get('PS_STORES_ICON') . '?date=' . time()), 'PS_NAVIGATION_PIPE' => array('title' => $this->l('Navigation pipe'), 'desc' => $this->l('Used for navigation path inside categories/product'), 'cast' => 'strval', 'type' => 'text', 'size' => 20), 'PS_ALLOW_MOBILE_DEVICE' => array('title' => $this->l('Enable mobile theme'), 'desc' => $this->l('Allows visitors browsing on a mobile device or on a touchpad, to have a light version of website'), 'type' => 'radio', 'required' => true, 'validation' => 'isGenericName', 'choices' => array(0 => $this->l('I want to disable it'), 1 => $this->l('I want to enable it only on mobiles devices'), 2 => $this->l('I want to enable it only on touchpads'), 3 => $this->l('I want to enable it on mobile and touchpad devices')))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')));
     $this->fields_list = array('id_theme' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20), 'name' => array('title' => $this->l('Name'), 'width' => 'auto'), 'directory' => array('title' => $this->l('Directory'), 'width' => 'auto'));
 }
 public function init()
 {
     // No cache for auto-refresh uploaded logo
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     parent::init();
     $this->can_display_themes = !Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP ? true : false;
     $this->fields_options = array('theme' => array('title' => sprintf($this->l('Select a theme for shop %s'), $this->context->shop->name), 'description' => !$this->can_display_themes ? $this->l('You must select a shop from the above list if you wish to choose a theme.') : '', 'fields' => array('theme_for_shop' => array('type' => 'theme', 'themes' => Theme::getThemes(), 'id_theme' => $this->context->shop->id_theme, 'can_display_themes' => $this->can_display_themes, 'no_multishop_checkbox' => true)), 'submit' => array('title' => $this->l('Save'))), 'appearance' => array('title' => $this->l('Appearance'), 'icon' => 'icon-html5', 'fields' => array('PS_LOGO' => array('title' => $this->l('Header logo'), 'hint' => $this->l('Will appear on main page. Recommended height: 52px. Maximum height on default theme: 65px.'), 'type' => 'file', 'name' => 'PS_LOGO', 'thumb' => _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_LOGO_MOBILE' => array('title' => $this->l('Header logo for mobile'), 'desc' => (Configuration::get('PS_LOGO_MOBILE') === false ? '<span class="light-warning">' . $this->l('Warning: No mobile logo has been defined. The header logo will be used instead.') . '</span><br />' : '') . $this->l('Will appear on the main page of your mobile template. If left undefined, the header logo will be used.'), 'type' => 'file', 'name' => 'PS_LOGO_MOBILE', 'thumb' => Configuration::get('PS_LOGO_MOBILE') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE')) ? _PS_IMG_ . Configuration::get('PS_LOGO_MOBILE') . '?date=' . time() : _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_LOGO_MAIL' => array('title' => $this->l('Mail logo'), 'desc' => (Configuration::get('PS_LOGO_MAIL') === false ? '<span class="light-warning">' . $this->l('Warning: No email logo has been indentified. The header logo will be used instead.') . '</span><br />' : '') . $this->l('Will appear on email headers. If undefined, the header logo will be used.'), 'type' => 'file', 'name' => 'PS_LOGO_MAIL', 'thumb' => Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL')) ? _PS_IMG_ . Configuration::get('PS_LOGO_MAIL') . '?date=' . time() : _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_LOGO_INVOICE' => array('title' => $this->l('Invoice logo'), 'desc' => (Configuration::get('PS_LOGO_INVOICE') === false ? '<span class="light-warning">' . $this->l('Warning: No invoice logo has been defined. The header logo will be used instead.') . '</span><br />' : '') . $this->l('Will appear on invoice headers.') . ' ' . $this->l('Warning: you can use a PNG file for transparency, but it can take up to 1 second per page for processing. Please consider using JPG instead.'), 'type' => 'file', 'name' => 'PS_LOGO_INVOICE', 'thumb' => Configuration::get('PS_LOGO_INVOICE') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE')) ? _PS_IMG_ . Configuration::get('PS_LOGO_INVOICE') . '?date=' . time() : _PS_IMG_ . Configuration::get('PS_LOGO') . '?date=' . time()), 'PS_FAVICON' => array('title' => $this->l('Favicon'), 'hint' => $this->l('Only ICO format allowed'), 'hint' => $this->l('Will appear in the address bar of your web browser.'), 'type' => 'file', 'name' => 'PS_FAVICON', 'thumb' => _PS_IMG_ . Configuration::get('PS_FAVICON') . '?date=' . time()), 'PS_STORES_ICON' => array('title' => $this->l('Store icon'), 'hint' => $this->l('Only GIF format allowed.'), 'hint' => $this->l('Will appear on the store locator (inside Google Maps).') . '<br />' . $this->l('Suggested size: 30x30, transparent GIF.'), 'type' => 'file', 'name' => 'PS_STORES_ICON', 'thumb' => _PS_IMG_ . Configuration::get('PS_STORES_ICON') . '?date=' . time()), 'PS_NAVIGATION_PIPE' => array('title' => $this->l('Navigation pipe'), 'hint' => $this->l('Used for the navigation path: Store Name > Category Name > Product Name.'), 'cast' => 'strval', 'type' => 'text', 'size' => 20), 'PS_ALLOW_MOBILE_DEVICE' => array('title' => $this->l('Enable the mobile theme.'), 'hint' => $this->l('Allows visitors browsing on mobile devices to view a lighter version of your website.'), 'type' => 'radio', 'required' => true, 'validation' => 'isGenericName', 'choices' => array(0 => $this->l('I\'d like to disable it, please. '), 1 => $this->l('I\'d like to enable it only on smart phones.'), 2 => $this->l('I\'d like to enable it only on tablets.'), 3 => $this->l('I\'d like to enable it on both smart phones and tablets.'))), 'PS_MAIL_COLOR' => array('title' => $this->l('Mail color'), 'hint' => $this->l('Your mail will be highlighted in this color. HTML colors only, please (e.g. "lightblue", "#CC6600").'), 'type' => 'color', 'name' => 'PS_MAIL_COLOR', 'size' => 30, 'value' => Configuration::get('PS_MAIL_COLOR'))), 'submit' => array('title' => $this->l('Save'))));
     $this->fields_list = array('id_theme' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Name')), 'directory' => array('title' => $this->l('Directory')), 'responsive' => array('title' => $this->l('Responsive'), 'type' => 'bool', 'active' => 'responsive', 'align' => 'center', 'class' => 'fixed-width-xs'), 'default_left_column' => array('title' => $this->l('Default left column'), 'type' => 'bool', 'active' => 'default_left_column', 'align' => 'center', 'class' => 'fixed-width-xs'), 'default_right_column' => array('title' => $this->l('Default right column'), 'type' => 'bool', 'active' => 'default_right_column', 'align' => 'center', 'class' => 'fixed-width-xs'));
 }
 public function init()
 {
     if (Tools::isSubmit('addorder_return_state')) {
         $this->display = 'add';
     }
     if (Tools::isSubmit('updateorder_return_state')) {
         $this->display = 'edit';
     }
     return parent::init();
 }
 public function init()
 {
     // if we are managing the second list (i.e. supply order status)
     if (Tools::isSubmit('submitAddsupply_order_state') || Tools::isSubmit('addsupply_order_state') || Tools::isSubmit('updatesupply_order_state') || Tools::isSubmit('deletesupply_order_state')) {
         $this->table = 'supply_order_state';
         $this->className = 'SupplyOrderState';
         $this->identifier = 'id_supply_order_state';
         $this->display = 'edit';
     }
     parent::init();
 }
Beispiel #25
0
 /**
  初始化
  @param void
  @return void
 */
 function init()
 {
     parent::init();
     //db 实例化
     $this->db_document = new DocumentModel();
     $this->db_category = new CategoryModel();
     $this->db_user = new UserModel();
     $this->db_modelFields = new ModelfieldsModel();
     $this->db_modelData = new ModeldataModel();
     $this->db_admin = new AdminModel();
 }
Beispiel #26
0
 public function init()
 {
     parent::init();
     $dir = Yii::app()->basePath . DIRECTORY_SEPARATOR . "extensions" . DIRECTORY_SEPARATOR . "elrte";
     $this->_exturl = Yii::app()->getAssetManager()->publish($dir, false, -1, YII_DEBUG);
     $ClientScript = Yii::app()->getClientScript();
     $ClientScript->registerCssFile("{$this->_exturl}/css/smoothness/jquery-ui-1.8.13.custom.css");
     $ClientScript->registerCssFile("{$this->_exturl}/css/elfinder.css");
     $ClientScript->registerScriptFile("{$this->_exturl}/js/jquery-ui-183.min.js");
     $ClientScript->registerScriptFile("{$this->_exturl}/js/elfinder.full.js");
     $this->pageTitle = Yii::t("main", "Media Manager");
 }
 public function init()
 {
     parent::init();
     // context->shop is set in the init() function, so we move the _category instanciation after that
     if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') {
         $this->_category = new Category($id_category);
     } else {
         if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
             $this->_category = new Category($this->context->shop->id_category);
         } elseif (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) {
             $this->_category = Category::getTopCategory();
         } else {
             $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY'));
         }
     }
     $count_categories_without_parent = count(Category::getCategoriesWithoutParent());
     $top_category = Category::getTopCategory();
     if (Tools::isSubmit('id_category')) {
         $id_parent = $this->_category->id;
     } elseif (!Shop::isFeatureActive() && $count_categories_without_parent > 1) {
         $id_parent = $top_category->id;
     } elseif (Shop::isFeatureActive() && $count_categories_without_parent == 1) {
         $id_parent = Configuration::get('PS_HOME_CATEGORY');
     } elseif (Shop::isFeatureActive() && $count_categories_without_parent > 1 && Shop::getContext() != Shop::CONTEXT_SHOP) {
         if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) == 1) {
             $id_parent = $this->context->shop->id_category;
         } else {
             $id_parent = $top_category->id;
         }
     } else {
         $id_parent = $this->context->shop->id_category;
     }
     $this->_select = 'sa.position position';
     $this->_filter .= ' AND `id_parent` = ' . (int) $id_parent . ' ';
     if (Shop::getContext() == Shop::CONTEXT_SHOP) {
         $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = ' . (int) $this->context->shop->id . ') ';
     } else {
         $this->_join .= ' LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = a.id_shop_default) ';
     }
     // we add restriction for shop
     if (Shop::getContext() == Shop::CONTEXT_SHOP && Shop::isFeatureActive()) {
         $this->_where = ' AND sa.`id_shop` = ' . (int) Context::getContext()->shop->id;
     }
     // if we are not in a shop context, we remove the position column
     if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
         unset($this->fields_list['position']);
     }
     // shop restriction : if category is not available for current shop, we redirect to the list from default category
     if (!$this->_category->isAssociatedToShop() && Shop::getContext() == Shop::CONTEXT_SHOP) {
         $this->redirect_after = self::$currentIndex . '&id_category=' . (int) $this->context->shop->getCategory() . '&token=' . $this->token;
         $this->redirect();
     }
 }
 /**
  * init
  */
 public function init()
 {
     // Check Access
     checkAccessThrowException('op_media_view');
     // Make sure uploads directory is set
     if (!getParam('uploads_dir')) {
         throw new CHttpException(500, Yii::t('media', 'Sorry, You must set the uploads directory first. From the top menu Go to Tools -> Settings -> Missing Settings.'));
     }
     parent::init();
     // Add Breadcrumb
     $this->addBreadCrumb(at('Media Manager'));
     $this->title[] = at('Media Manager');
 }
 public function init()
 {
     // No cache for auto-refresh uploaded logo
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     parent::init();
     $this->can_display_themes = !Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP;
     if (Tools::getValue('display') == 'configureLayouts') {
         $this->initConfigureLayouts();
     } elseif (Tools::getValue('action') == 'importtheme') {
         $this->display = 'importtheme';
     }
     libxml_use_internal_errors(true);
 }
Beispiel #30
0
 function init()
 {
     parent::init();
     if (true !== YII_DEBUG) {
         exit('access deny!');
     }
     $list = scandir(Yii::getPathOfAlias('application.fields'));
     foreach ($list as $v) {
         $ext = substr($v, -4);
         if ($ext == '.php') {
             $n = trim(substr($v, 0, -4));
             $this->type[$n] = $n;
         }
     }
 }