public function __construct($data = array()) { parent::__construct(); $this->entityType = 'bundle'; if (!empty($data['id'])) { $CMS = new CMS(); $this->id = $data['id']; $this->populate_object($CMS->get_entity_data($this)); } $this->populate_object($data); }
public function addInDB() { $cms = new CMS(); foreach (Language::getLanguages() as $lang) { $cms->meta_title[$lang['id_lang']] = $this->title; $cms->meta_description[$lang['id_lang']] = $this->title; $cms->meta_keywords[$lang['id_lang']] = ''; $cms->content[$lang['id_lang']] = $this->content; $cms->link_rewrite[$lang['id_lang']] = pSQL(preg_replace('/-(-)+/', '', preg_replace('/([^a-z\\-])+/', '', str_replace(' ', '-', Tools::strtolower($this->title))))); } $cms->id_cms_category = 1; $cms->indexation = 1; $cms->active = 1; $cms->add(); }
function __construct() { parent::Controller(); $this->load->model('Events_model'); $this->Events_model->set_config(self::EVENTS_URL, true); $this->data['menu_highlight'] = "Events"; }
/** * Duplicate one product and return model * * @param ShopProduct $model * @return ShopProduct */ public function duplicateProduct(ShopProduct $model) { $product = new ShopProduct(null); // Add "null" by PANIX $product->attributes = $model->attributes; $behaviors = $model->behaviors(); foreach ($behaviors['TranslateBehavior']['translateAttributes'] as $attr) { $product->{$attr} = $model->{$attr}; } $product->name .= $this->getSuffix(); $product->seo_alias .= CMS::translit($this->getSuffix()) . '-' . time(); if ($product->validate()) { if ($product->save(false, false)) { foreach ($this->duplicate as $feature) { $method_name = 'copy' . ucfirst($feature); if (method_exists($this, $method_name)) { $this->{$method_name}($model, $product); } } return $product; } else { die(__FUNCTION__ . ': Error save'); return false; } } else { // print_r($product->getErrors());die; } }
public function displayMain() { global $smarty; $posts = $this->entity->getThisTags(); $smarty->assign(array('posts' => CMS::resetCMS($posts['posts']), 'total' => $posts['total'])); return $smarty->fetch('cms_list.tpl'); }
public function __construct() { global $cookie; $this->className = 'Configuration'; $this->table = 'configuration'; $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $upload_mb = min($max_upload, $max_post); $timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone'); $taxes[] = array('id' => 0, 'name' => $this->l('None')); foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) { $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']); } $order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout'))); $round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical'))); $cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None'))); foreach (CMS::listCms($cookie->id_lang) as $cms_file) { $cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']); } $this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'maintenance_ip', 'size' => 30, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use of CMS page'), 'desc' => $this->l('Choose the Conditions of use of CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrap pricing'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Maximum attachment size'), 'desc' => $this->l('Set the maximum size of attached files (in Megabytes ).') . ' ' . $this->l('Maximum:') . ' ' . ((int) str_replace('M', '', ini_get('post_max_size')) > (int) str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Save cart content and re-display it at login'), 'desc' => $this->l('Recall and display contents of shopping cart following customer login'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_LIMIT_UPLOAD_FILE_VALUE' => array('title' => $this->l('Limit upload file value'), 'desc' => $this->l('Define the limit upload for a downloadable product, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'), 'PS_LIMIT_UPLOAD_IMAGE_VALUE' => array('title' => $this->l('Limit upload image value'), 'desc' => $this->l('Define the limit upload for an image, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1')); if (function_exists('date_default_timezone_set')) { $this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name'); } // No HTTPS activation if you haven't already. if (!Tools::usingSecureMode() && !_PS_SSL_ENABLED_) { $this->_fieldsGeneral['PS_SSL_ENABLED']['type'] = 'disabled'; $this->_fieldsGeneral['PS_SSL_ENABLED']['disabled'] = '<a href="https://' . Tools::getShopDomainSsl() . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">' . $this->l('Please click here to use HTTPS protocol before enabling SSL.') . '</a>'; } parent::__construct(); }
public function renderForm() { $fields_form = array('form' => array('legend' => array('title' => $this->l('Homepage categories'), 'icon' => ''), 'input' => array(array('type' => 'cms_choice', 'label' => '', 'name' => 'cats')), 'submit' => array('name' => 'submitBlockshortcms', 'title' => $this->l('Save')))); $lang = $this->context->language; if ($selectedItems = Configuration::get('MOD_BLOCKHOMECMS_ITEMS')) { $selectedItems = explode(',', $selectedItems); foreach ($selectedItems as $index => $id_cms) { $selectedItems[$index] = new CMS($id_cms, $this->context->language->id); } } else { $selectedItems = null; } $helper = new HelperForm(); $helper->show_toolbar = false; $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->module = $this; $helper->identifier = 'id_blocklink'; $helper->submit_action = 'submit'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->fields_value = array('text' => 'text'); $categories = current(CMSCategory::getCategories($this->context->language->id)); $allCms = CMS::getCMSPages($this->context->language->id); $helper->tpl_vars = array('categories' => current(CMSCategory::getCategories($this->context->language->id)), 'allCms' => CMS::getCMSPages($this->context->language->id), 'selectedCms' => $selectedItems); return $helper->generateForm(array($fields_form)); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->check()) { return new RedirectResponse(url(\CMS::backendPath())); } return $next($request); }
public function getContent() { $html = ' <h2>' . $this->l('Payment logo.') . '</h2> '; if (Tools::isSubmit('submitConfiguration')) { if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int) Tools::getValue('id_cms')); $this->_clearCache('blockpaymentlogo.tpl'); $html .= $this->displayConfirmation($this->l('The settings have been updated.')); } } $cmss = CMS::listCms($this->context->language->id); if (!count($cmss)) { $html .= $this->displayError($this->l('No CMS page is available.')); } else { $html .= ' <form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post"> <fieldset> <legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend> <label>' . $this->l('Page CMS for link') . ':</label> <div class="margin-form"> <select name="id_cms"><option value="0">(' . $this->l('Select a page') . ')</option>'; foreach ($cmss as $cms) { $html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>'; } $html .= '</select> </div> <p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p> </fieldset> </form> '; } return $html; }
public function install() { if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('rightColumn') || !$this->registerHook('header') || !$this->registerHook('footer') || !$this->registerHook('actionObjectCmsUpdateAfter') || !$this->registerHook('actionObjectCmsDeleteAfter') || !$this->registerHook('actionShopDataDuplication') || !$this->registerHook('actionAdminStoresControllerUpdate_optionsAfter') || !BlockCMSModel::createTables() || !Configuration::updateValue('FOOTER_CMS', '') || !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) || !Configuration::updateValue('FOOTER_POWEREDBY', 1) || !Configuration::updateValue('FOOTER_PRICE-DROP', 1) || !Configuration::updateValue('FOOTER_NEW-PRODUCTS', 1) || !Configuration::updateValue('FOOTER_BEST-SALES', 1) || !Configuration::updateValue('FOOTER_CONTACT', 1) || !Configuration::updateValue('FOOTER_SITEMAP', 1)) { return false; } $this->_clearCache('blockcms.tpl'); // Install fixtures for blockcms $default = Db::getInstance()->insert('cms_block', array('id_cms_category' => 1, 'location' => 0, 'position' => 0)); if (!$default) { return false; } $result = true; $id_cms_block = Db::getInstance()->Insert_ID(); $shops = Shop::getShops(true, null, true); foreach ($shops as $shop) { $result &= Db::getInstance()->insert('cms_block_shop', array('id_cms_block' => $id_cms_block, 'id_shop' => $shop)); } $languages = Language::getLanguages(false); foreach ($languages as $lang) { $result &= Db::getInstance()->insert('cms_block_lang', array('id_cms_block' => $id_cms_block, 'id_lang' => $lang['id_lang'], 'name' => $this->l('Information'))); } $pages = CMS::getCMSPages(null, 1); foreach ($pages as $cms) { $result &= Db::getInstance()->insert('cms_block_page', array('id_cms_block' => $id_cms_block, 'id_cms' => $cms['id_cms'], 'is_category' => 0)); } return $result; }
/** * @param string $service * @param string $id * @param array $options * @return string */ public function map($t, $service, $map_id, $name, $options = array(), $path_to_template = '../tao/views/helpers/maps') { if (!is_array($options)) { $options = (array) $options; } $json_string = json_encode($options); $lang = 'ru'; if ($options['properties']['lang'] != null) { $lang = $options['properties']['lang']; } if ($service == null) { $service = 'google'; } switch ($service) { case 'google': $t->use_script('https://maps.google.com/maps/api/js?sensor=false&language=' . $lang, array('type' => 'lib', 'weight' => -21)); $t->use_script('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble-compiled.js', array('type' => 'lib', 'weight' => -20)); break; case 'yandex': $t->use_script('http://api-maps.yandex.ru/2.0/?load=package.full&lang=' . $lang, array('type' => 'lib', 'weight' => -21)); break; default: return; } $t->use_script(CMS::stdfile_url('scripts/maps.js'), array('type' => 'lib', 'weight' => -19)); return $t->partial($path_to_template, array('json_string' => $json_string, 'map' => $service . '_maps', 'name' => $name, 'map_id' => $map_id)); }
public function displayMain() { global $smarty; $posts = CMS::getCMS(true, 1, 20); $smarty->assign(array('posts' => $posts['cmss'], 'total' => $posts['total'])); return $smarty->fetch('blog.tpl'); }
public function delete_url($name) { if (trim($name) == '') { return '#'; } return CMS::admin_path("vars/delete/id-{$name}/"); }
public function getContent() { global $cookie; $html = ' <h2>' . $this->l('Payment logo') . '</h2> '; if (Tools::isSubmit('submitConfiguration')) { if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', intval(Tools::getValue('id_cms'))); $html .= $this->displayConfirmation($this->l('Settings are updated')); } } $cmss = CMS::listCms(intval($cookie->id_lang)); if (!sizeof($cmss)) { $html .= $this->displayError($this->l('No CMS page is available')); } else { $html .= ' <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <fieldset> <legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend> <label>' . $this->l('Page CMS for link') . ':</label> <div class="margin-form"> <select name="id_cms">'; foreach ($cmss as $cms) { $html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>'; } $html .= '</select> </div> <p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p> </fieldset> </form> '; } return $html; }
public function authenticate() { $record = User::model()->with('group')->findByAttributes(array('login' => $this->username)); if ($record === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if ($record->banned === '1') { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { if ($record->password !== User::encodePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $record->id; $this->_login = $record->login; $record->last_login = date('Y-m-d H:i:s'); $record->login_ip = CMS::getip(); $record->save(false, false, false); $this->setState('id', $record->id); $this->setState('username', $record->login); $this->setState('roles', $record->group->alias); $this->errorCode = self::ERROR_NONE; } } } return !$this->errorCode; }
protected function _prepareHook($params) { $languages = Language::getLanguages(true, $this->context->shop->id); if (!count($languages)) { return false; } $link = new Link(); if ((int) Configuration::get('PS_REWRITING_SETTINGS')) { $default_rewrite = array(); if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) { $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product); foreach ($rewrite_infos as $infos) { $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']); } } if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) { $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category); foreach ($rewrite_infos as $infos) { $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']); } } if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) { $rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category); foreach ($rewrite_infos as $infos) { $arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']); $default_rewrite[$infos['id_lang']] = $arr_link; } } $this->smarty->assign('lang_rewrite_urls', $default_rewrite); } return true; }
public function install() { if (!parent::install() || !$this->registerHooks() || !BlockCMSModel::createTables() || !Configuration::updateValue('FOOTER_CMS', '') || !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1) || !Configuration::updateValue('FOOTER_POWEREDBY', 1)) { return false; } // Install fixtures for blockcms $default = Db::getInstance()->insert('cms_block', array('id_cms_category' => 1, 'location' => 0, 'position' => 0)); if (!$default) { return false; } $result = true; $id_cms_block = Db::getInstance()->Insert_ID(); $shops = Shop::getShops(true, null, true); foreach ($shops as $shop) { $result &= Db::getInstance()->insert('cms_block_shop', array('id_cms_block' => $id_cms_block, 'id_shop' => $shop)); } $languages = Language::getLanguages(false); foreach ($languages as $lang) { $result &= Db::getInstance()->insert('cms_block_lang', array('id_cms_block' => $id_cms_block, 'id_lang' => $lang['id_lang'], 'name' => $this->l('Information'))); } $pages = CMS::getCMSPages(null, 1); foreach ($pages as $cms) { $result &= Db::getInstance()->insert('cms_block_page', array('id_cms_block' => $id_cms_block, 'id_cms' => $cms['id_cms'], 'is_category' => 0)); } return $result; }
public function afterFind() { parent::afterFind(); if (CMS::time() >= strtotime($this->date_end)) { $this->switch = 0; $this->save(false); } }
public function preview() { CMS::layout_view()->use_scripts('/tao/scripts/admin/vars/image.js'); Core::load('CMS.Images'); $url = CMS_Images::modified_image('./' . $this['image'], '150x150'); $id = 'container-' . md5($this['image']); return "<span class='var-image-preview' data-image='{$url}' data-container='{$id}'>[Image]</span>"; }
public static function timeLink($array, $key) { $tu = ""; foreach ($array[$key] as $rw) { $tu .= $rw[0] . " <a target=_blank href=" . $rw[1] . ">" . CMS::truncate($rw[1], 20) . "</a><br>"; } return $tu; }
/** Fill collection with data */ public function fill() { // Perform CMS request to get tours if (CMS::getMaterialsByStructures($this->structures, $this->collection, $this->entityName, $this->outerDBHandlers, array(), $this->innerDBHandlers)) { // Handle success result } return $this->collection; }
protected function setup() { $this->parent->table(self::table_from($this)); $this->parent->classname($this->options['classname']); $this->parent->component(CMS::component_for($this)); $this->parent->configure(); parent::setup(); }
public function test($object, Validation_Errors $errors, $array_access = false) { $value = trim($this->value_of_attribute($object, $this->attribute, $array_access)); $parsed = CMS::parse_parms($value); if (is_string($parsed)) { $errors->reject_value($this->attribute, $parsed); } }
function page_edit() { $nav_item_id = $this->node->arg('nav_item_id'); $nav_info = $this->db->from('cms_nav_item')->where('nav_item_id', $nav_item_id)->join('cms_nav_item_name', 'nav_item_id')->where('language_id', Lang::getCurrent())->fetchRow(); $page_id = $this->db->from('cms_nav_item')->select('page_id')->where('nav_item_id', $nav_item_id)->fetchScalar(); $this->node->setArgument('page_id', $page_id); $page_meta = $this->db->from('cms_page')->where('page_id', $page_id)->join('cms_page_meta', 'page_id')->where('language_id', Lang::getCurrent())->fetchRow(); $cms = new CMS($this->context); $config = $cms->getConfig($page_meta['template']); if (isset($config['node'])) { $parts = explode('/', $config['node']); if ($parts[0] == '') { array_shift($parts); } $this->admin->modules[$parts[0]]->{$parts[1]}(); } }
public function action_prefix($name, $data, $item = false, $fields = array()) { $id = (int) WS::env()->request['id']; $item = CMS::vars()->db()->find($id); if ($item) { return $item->full_code . '.'; } return ''; }
public function value() { $value = parent::value(); if (empty($value)) { return ''; } $value = (string) CMS::lang($value); return $value; }
private function checkUserType() { $user = Yii::app()->getComponent('user', false); if ($user->isGuest) { return CMS::isBot() ? 3 : 0; } else { return $user->isSuperuser ? 2 : 1; } }
public function getAvailableTemplates() { $template = \CMS::getTemplatePath(); $files = \File::files('../app/views/templates/' . $template . '/pages'); foreach ($files as $index => $file) { $files[$index] = str_replace('../app/views/templates/' . $template . '/', '', $file); } return $files; }
protected function render_tree() { $fform = $this->create_filters_form(); $filters_form_fields = $this->prepare_filter_forms(); $t = $this->render('tree', array('c' => $this, 'title' => $this->title_list(), 'count' => $this->get_tree_count(), 'message_norows' => $this->message_norows(), 'can_add' => $this->access_add(), 'add_url' => $this->action_url('add', $this->page), 'add_button_caption' => $this->button_add(), 'filters_form' => $fform, 'filters_form_fields' => $filters_form_fields)); if ($this->enable_checkcolumn) { $t->use_scripts(CMS::stdfile_url('scripts/extjs/CheckColumn.js'))->use_styles(CMS::stdfile_url('styles/extjs/CheckHeader.css')); } return $t; }
public static function getDateCMS($date_query, $p = 1, $m = 50) { $result = Db::getInstance()->getAll(' SELECT * FROM `' . DB_PREFIX . 'cms` WHERE active = 1 AND FROM_UNIXTIME(UNIX_TIMESTAMP(add_date),"%Y-%m")="' . pSQL($date_query) . '" ORDER BY `add_date` DESC LIMIT ' . ($p - 1) . ',' . (int) $m); return CMS::resetCMS($result); }