public function init() { Controller::initParams(); // this method is called when the module is being created // you may place code here to customize the module or the application Yii::app()->setComponent('bootstrap', array('class' => 'ext.bootstrap.components.Bootstrap', 'responsiveCss' => true)); Yii::setPathOfAlias('bootstrap', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../extensions/bootstrap'); Yii::app()->bootstrap->init(); // import the module-level models and components $this->setImport(array('admin.models.*', 'admin.components.*')); Yii::app()->setComponents(array('user' => array('class' => 'AdminUser', 'loginUrl' => Yii::app()->createAbsoluteUrl('admin/login'), 'allowAutoLogin' => true)), true); $this->layout = 'application.modules.admin.views.layouts.column1'; if (Yii::app()->params['STORE_OFFLINE'] == '-1') { die('Admin Panel unavailable due to account suspension.'); } if (isset($_POST['url']) && isset($_POST['password'])) { $model = new LoginForm(); if ($model->loginLightspeed($_POST['user'], $_POST['password'])) { Yii::app()->getRequest()->redirect(Yii::app()->createUrl("/admin")); } else { die("You have an invalid password set in your eCommerce options. Cannot continue."); } } if (!Yii::app()->user->isGuest) { if (Yii::app()->user->shouldLogOut()) { Yii::app()->user->logout(false); } } _xls_set_conf('ADMIN_PANEL', date("Y-m-d H:i:s")); parent::init(); }
/** * Removes image with ids specified in post request. * On success returns 'OK' */ public function actionSet() { $id = $_POST['id']; $photo = GalleryPhoto::model()->findByPk($id); $p = $photo->file_name; $path = mb_pathinfo($p); $ext = $path['extension']; if (Yii::app()->params['LIGHTSPEED_MT'] == '1') { $prefix = "//lightspeedwebstore.s3.amazonaws.com/" . Yii::app()->params['LIGHTSPEED_HOSTING_LIGHTSPEED_URL'] . '/gallery'; } else { $prefix = '/images/gallery'; } $file = $prefix . '/' . $photo->gallery_id . '/' . $photo->id . "." . $photo->thumb_ext; _xls_set_conf('HEADER_IMAGE', $file); echo 'OK'; }
/** * Load anything we need globally, such as items we're going to use in our main.php template. * If you create init() in any other controller, you need to run parent::init() too or this * will be skipped. If you run your own init() and don't call this, you must call Controller::initParams(); * or nothing will work. */ public function init() { self::initParams(); if (isset($_GET['nosni'])) { Yii::app()->user->setFlash('warning', Yii::t('global', 'NOTE: Your older operating system does not support certain security features this site uses. You have been redirected to {link} for your session which will ensure your information is properly protected.', array('{link}' => "<b>" . Yii::app()->params['LIGHTSPEED_HOSTING_LIGHTSPEED_URL'] . "</b>"))); } $filename = Yii::getPathOfAlias('webroot.themes') . DIRECTORY_SEPARATOR . DEFAULT_THEME; if (!file_exists($filename) && _xls_get_conf('LIGHTSPEED_MT', 0) == '0') { if (!downloadTheme(DEFAULT_THEME)) { die("missing " . DEFAULT_THEME); } else { $this->redirect(Yii::app()->createUrl("site/index")); } } if (!Yii::app()->theme) { if (_xls_get_conf('THEME')) { //We can't find our theme for some reason, switch back to default _xls_set_conf('THEME', DEFAULT_THEME); _xls_set_conf('CHILD_THEME', 'light'); Yii::log("Couldn't find our theme, switched back to " . DEFAULT_THEME . " for emergency", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); $this->redirect(Yii::app()->createUrl('site/index')); } else { die("you have no theme set"); } } if (isset($_GET['theme']) && isset($_GET['themekey'])) { $strTheme = CHtml::encode($_GET['theme']); $strThemeKey = CHtml::encode($_GET['themekey']); if ($this->verifyPreviewThemeKey($strTheme, $strThemeKey)) { Yii::app()->theme = $strTheme; $this->registerPreviewThemeScript($strTheme, $strThemeKey); } else { Yii::log("Invalid theme preview link for" . $strTheme . ". Navigate to Admin Panel to generate a new link.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } $strViewset = Yii::app()->theme->info->viewset; if (!empty($strViewset)) { Yii::app()->setViewPath(Yii::getPathOfAlias('application') . "/views-" . $strViewset); } }
public function actionIndex() { if (_xls_get_conf('INSTALLED', 0) == 1) { _xls_404(); } $this->layout = "license"; $this->editSectionInstructions = ""; $this->license = $this->renderPartial("license", null, true, false); $model = new InstallForm(); $getpage = "getPage" . $model->page; $model->scenario = "page1"; $model->setScenario($this->cloudMtScenario($model->getScenario())); $formDefinition = $model->{$getpage}(); if (isset($_POST['InstallForm'])) { $model->scenario = "page" . $_POST['InstallForm']['page']; if (isset($_POST['buttonSkip']) && $_POST['InstallForm']['page'] == 4) { $model->scenario = "page-skip" . $_POST['InstallForm']['page']; } $model->setScenario($this->cloudMtScenario($model->getScenario())); $model->attributes = $_POST['InstallForm']; if ($model->validate()) { switch ($model->page) { case 1: $model->page = 2; break; case 2: $model->savePage(2); $model->page = 3; break; case 3: $model->savePage(3); $model->page = 4; break; case 4: $model->savePage(4); _xls_set_conf('INSTALLED', 1); $this->redirect($this->createUrl('license/end')); break; } if (_xls_get_conf('LIGHTSPEED_CLOUD', 0) > 0 && $model->page == 2) { $model->scenario = "page" . $model->page . "-cld"; } else { if (_xls_get_conf('LIGHTSPEED_CLOUD', 0) == 0 && _xls_get_conf('LIGHTSPEED_MT', 0) > 0 && $model->page == 2) { $model->scenario = "page" . $model->page . "-mt"; } else { $model->scenario = "page" . $model->page; } } $model->attributes = $model->readFromSession($model->page); } else { Yii::log("Install Wizard " . $model->scenario . " error " . print_r($model->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } //Possibly after submit, refetch these items $getpage = "getPage" . $model->page; $formDefinition = $model->{$getpage}(); } foreach ($formDefinition['elements'] as $key => $value) { if ($key != "iagree") { $formDefinition['elements'][$key]['layout'] = '<div class="span3 optionlabel">{label}</div><div class="span4 optionvalue">{input}</div>{error}<div class="span2 maxhint">{hint}</div>'; } } $this->render('index', array('model' => $model, 'form' => new CForm($formDefinition, $model))); }
public function savePage($page) { switch ($page) { case 2: if (!_xls_get_conf('LIGHTSPEED_CLOUD', 0) > 0) { _xls_set_conf('LSKEY', strtolower(md5($this->LSKEY))); } _xls_set_conf('TIMEZONE', $this->TIMEZONE); Configuration::exportKeys($this->encryptionKey, $this->encryptionSalt); //Now that we have encryption keys written, save the account if we have it if (!empty($this->loginemail) && !empty($this->loginpassword)) { $objCustomer = Customer::LoadByEmail($this->loginemail); if (!$objCustomer instanceof Customer) { $objCustomer = new Customer(); $objCustomer->first_name = "Admin"; $objCustomer->last_name = "User"; $objCustomer->record_type = 1; $objCustomer->pricing_level = 1; $objCustomer->preferred_language = "en"; $objCustomer->currency = "USD"; $objCustomer->email = $this->loginemail; $objCustomer->mainphone = _xls_get_conf('STORE_PHONE'); } $objCustomer->password = _xls_encrypt($this->loginpassword); $objCustomer->allow_login = 2; $objCustomer->save(); } break; case 3: _xls_set_conf('STORE_NAME', $this->STORE_NAME); _xls_set_conf('EMAIL_FROM', $this->EMAIL_FROM); _xls_set_conf('STORE_ADDRESS1', $this->STORE_ADDRESS1); _xls_set_conf('STORE_ADDRESS2', $this->STORE_ADDRESS2); _xls_set_conf('STORE_CITY', $this->STORE_CITY); _xls_set_conf('STORE_STATE', $this->STORE_STATE); _xls_set_conf('STORE_COUNTRY', $this->STORE_COUNTRY); _xls_set_conf('STORE_ZIP', $this->STORE_ZIP); _xls_set_conf('STORE_HOURS', $this->STORE_HOURS); _xls_set_conf('STORE_PHONE', $this->STORE_PHONE); break; case 4: if (is_null($this->EMAIL_SMTP_SERVER)) { $this->EMAIL_SMTP_SERVER = ''; } if (is_null($this->EMAIL_SMTP_PORT)) { $this->EMAIL_SMTP_PORT = ''; } if (is_null($this->EMAIL_SMTP_USERNAME)) { $this->EMAIL_SMTP_USERNAME = ''; } if (is_null($this->EMAIL_SMTP_PASSWORD)) { $this->EMAIL_SMTP_PASSWORD = ''; } _xls_set_conf('EMAIL_SMTP_SERVER', $this->EMAIL_SMTP_SERVER); _xls_set_conf('EMAIL_SMTP_PORT', $this->EMAIL_SMTP_PORT); _xls_set_conf('EMAIL_SMTP_USERNAME', $this->EMAIL_SMTP_USERNAME); _xls_set_conf('EMAIL_SMTP_PASSWORD', _xls_encrypt($this->EMAIL_SMTP_PASSWORD)); _xls_set_conf('EMAIL_SMTP_SECURITY_MODE', $this->EMAIL_SMTP_SECURITY_MODE); break; } }
protected function loadDefaults($strTheme) { $arrKeys = array(); $objComponent = Yii::app()->getComponent('wstheme'); $model = $objComponent->getAdminModel($strTheme); if ($model) { $formname = $strTheme . "AdminForm"; $arrKeys = get_class_vars($formname); $form = new $formname(); $themeVersion = $form->version; } else { //If we don't have a CForm definition, we have to go old school //(that means look for config.xml for backwards compatibility) $fnOptions = self::getConfigFile($strTheme); if (file_exists($fnOptions)) { $strXml = file_get_contents($fnOptions); // Parse xml for response values $oXML = new SimpleXMLElement($strXml); if ($oXML->defaults) { foreach ($oXML->defaults->{'configuration'} as $item) { $keyname = (string) $item->key_name; $keyvalue = (string) $item->key_value; $arrKeys[$keyname] = $keyvalue; } } $themeVersion = $oXML->version; } } //Now we have an array of keys no matter which method foreach ($arrKeys as $keyname => $keyvalue) { $objKey = Configuration::model()->findByAttributes(array('key_name' => $keyname)); if ($objKey) { _xls_set_conf($keyname, $keyvalue); Configuration::model()->updateByPk($objKey->id, array('template_specific' => '1')); } } return array($arrKeys, $themeVersion); }
/** * Update an existing item(s). * * @return void */ public function actionUpdate() { self::_checkApiKey(); switch ($_GET['model']) { case 'configuration': //Configuration keys are handled a bit differently than normal records $boolUpdate = false; $arrBadKeys = array(); $json = file_get_contents('php://input'); $obj = json_decode($json); foreach ($obj as $var => $value) { if (in_array($var, $this->arrExposedConfigKeys)) { _xls_set_conf($var, $value); $boolUpdate = true; } else { $arrBadKeys[] = $var; } } break; // Get an instance of the respective model // Get an instance of the respective model default: $this->_sendResponse(501, sprintf('Mode <b>update</b> is not implemented for model <b>%s</b>', $_GET['model'])); exit; } if (!empty($arrBadKeys)) { $this->_sendResponse($boolUpdate ? 200 : 400, json_encode(array('badkeys' => implode(',', $arrBadKeys), 'message' => 'You have included keys that are either invalid or not exposed at this time.'))); } else { $this->_sendResponse(200, json_encode(array('status' => 'success'))); } }
public function actionVerifyWriteAccess() { $oXML = $this->loadXml(); $blnError = false; //Step 1 - Preflight check, are all the critical files we will replace unmodified and writeable foreach ($oXML->item as $v) { $strUpgradeFileName = str_replace("./", YiiBase::getPathOfAlias('webroot') . "/", $v->filename); $path_parts = pathinfo(substr($v->filename, 2, 999)); $strPathToCreate = $path_parts['dirname']; if (($v->action == 'replace' || $v->action == 'delete') && $v->status == 'critical' && file_exists($strUpgradeFileName)) { if (!isset($v->ignore)) { $blnError = 1; foreach ($v->original_hash as $hash) { if (md5_file($v->filename) == $hash) { if (isset($_GET['check'])) { echo $v->filename . " matched on hash " . $hash . "<br>"; } $blnError = 0; } } //If one of our hashes matches, clear errorflag if ($blnError == 1) { $arrErrors[] = $v->filename . " (" . $v->status . ") " . $v->original_hash . " has been modified, cannot be upgraded"; } } //Even if we ignore changed files, we still have to be able to write critical files if ($v->action == 'replace' && file_exists($v->filename) && !is_writable($v->filename)) { $blnError = 1; $arrErrors[] = $v->filename . " (" . $v->status . ") doesn't have permission to write, cannot be upgraded"; } if ($v->action == 'replace' && !file_exists($v->filename) && file_exists($strPathToCreate) && !is_writable($strPathToCreate)) { $blnError = 1; $arrErrors[] = $v->filename . " (" . $v->status . ") doesn't have permission to write, cannot be upgraded"; } } if (!file_exists($strPathToCreate)) { if (!mkdir($strPathToCreate, 0775, true)) { $arrErrors[] = $v->filename . " Error attempting to create folder " . $strPathToCreate; $blnError = 1; } } } if ($blnError) { Yii::log("Auto upgrade errors " . print_r($arrErrors, true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); _xls_set_conf('AUTO_UPDATE', 0); echo json_encode(array('result' => 'Auto-updating has failed due to write access problems updating certain files. Errors have been logged in the System Log and you should contact technical support. We have disabled Auto-updating for now until this can be resolved. Your original version is still active.', 'makeline' => 0, 'tag' => 'Error upgrading.', 'total' => 100)); } else { echo json_encode(array('result' => "success", 'makeline' => 40, 'tag' => 'Moving upgraded files into place', 'total' => 100)); } }
/** * update passkey * * @param string $passkey * @param string $newpasskey * @return string */ public function update_passkey($passkey, $newpasskey) { if (!$this->check_passkey($passkey)) { return self::FAIL_AUTH; } $conf = Configuration::LoadByKey('LSKEY'); if (!$conf) { Yii::log("SOAP ERROR : Auth key LSKEY not found for updating password in configuration!", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); return self::UNKNOWN_ERROR; } _xls_set_conf('LSKEY', strtolower(md5($newpasskey))); return self::OK; }
/** * Short Description. * * @param $lang * @return void */ protected function updateLanguages($lang) { // Remove extraneous spaces from the language string. $lang = str_replace(' ', '', $lang); $arr = explode(',', $lang); $data = array(); foreach ($arr as $language) { if (file_exists(Yii::app()->LocaleDataPath . '/' . $language . '.php')) { $settings = (include Yii::app()->LocaleDataPath . '/' . $language . '.php'); if (isset($settings['languages'][$language])) { $data[] = $language . ":" . $settings['languages'][$language]; } else { Yii::app()->user->setFlash('error', Yii::t('global', 'Language code {lang} not found.', array('{lang}' => $language))); } } } _xls_set_conf('LANG_OPTIONS', implode(',', $data)); }
/** * Load anything we need globally, such as items we're going to use in our main.php template. * If you create init() in any other controller, you need to run parent::init() too or this * will be skipped. If you run your own init() and don't call this, you must call Controller::initParams(); * or nothing will work. */ public function init() { self::initParams(); if (isset($_GET['nosni'])) { Yii::app()->user->setFlash('warning', Yii::t('global', 'NOTE: Your older operating system does not support certain security features this site uses. You have been redirected to {link} for your session which will ensure your information is properly protected.', array('{link}' => "<b>" . Yii::app()->params['LIGHTSPEED_HOSTING_LIGHTSPEED_URL'] . "</b>"))); } $filename = Yii::getPathOfAlias('webroot.themes') . DIRECTORY_SEPARATOR . DEFAULT_THEME; if (!file_exists($filename) && _xls_get_conf('LIGHTSPEED_MT', 0) == '0') { if (!downloadTheme(DEFAULT_THEME)) { die("missing " . DEFAULT_THEME); } else { $this->redirect(Yii::app()->createUrl("site/index")); } } if (!Yii::app()->theme) { if (_xls_get_conf('THEME')) { //We can't find our theme for some reason, switch back to default _xls_set_conf('THEME', DEFAULT_THEME); _xls_set_conf('CHILD_THEME', 'light'); Yii::log("Couldn't find our theme, switched back to " . DEFAULT_THEME . " for emergency", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); $this->redirect(Yii::app()->createUrl('site/index')); } else { die("you have no theme set"); } } if (isset($_GET['theme']) && isset($_GET['themekey'])) { $strTheme = CHtml::encode($_GET['theme']); $strThemeKey = CHtml::encode($_GET['themekey']); if ($this->verifyPreviewThemeKey($strTheme, $strThemeKey)) { Yii::app()->theme = $strTheme; $this->registerPreviewThemeScript($strTheme, $strThemeKey); } else { Yii::log("Invalid theme preview link for" . $strTheme . ". Navigate to Admin Panel to generate a new link.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } $this->buildBootstrap(); if (_xls_facebook_login()) { $this->setFacebookComponent(); } if (Yii::app()->params['STORE_OFFLINE'] != '0' || Yii::app()->params['INSTALLED'] != '1') { if (isset($_GET['offline'])) { Yii::app()->session['STORE_OFFLINE'] = _xls_number_only($_GET['offline']); } //If uninstalled on a new Multitenant store, direct to license acceptance to get going if (Yii::app()->params['INSTALLED'] != '1' && Yii::app()->params['LIGHTSPEED_MT'] == '1') { $url = Yii::app()->createUrl("admin/license"); $url = str_replace("https:", "http:", $url); $this->redirect($url, true); } if (Yii::app()->session['STORE_OFFLINE'] != Yii::app()->params['STORE_OFFLINE'] || Yii::app()->params['INSTALLED'] != '1') { $this->render('/site/offline'); Yii::app()->end(); } } $this->logoutUrl = $this->createUrl("site/logout"); $strViewset = Yii::app()->theme->info->viewset; if (!empty($strViewset)) { Yii::app()->setViewPath(Yii::getPathOfAlias('application') . "/views-" . $strViewset); } $strLayoutFile = Yii::app()->theme->config->layoutFile; if (empty($strLayoutFile)) { $strLayoutFile = "column2"; //This is for backwards compatibility only } if (Yii::app()->theme && file_exists('webroot.themes.' . Yii::app()->theme->name . '.layouts.' . $strLayoutFile)) { $this->layout = 'webroot.themes.' . Yii::app()->theme->name . '.layouts.' . $strLayoutFile; } else { $this->layout = $strLayoutFile; } //Set defaults $this->getUserLanguage(); $this->pageTitle = Yii::app()->name . " : " . Yii::app()->params['STORE_TAGLINE']; $this->pageCanonicalUrl = $this->getCanonicalUrl(); $this->pageDescription = Yii::app()->params['STORE_TAGLINE']; $this->pageImageUrl = ''; $pageHeaderImage = Yii::app()->params['HEADER_IMAGE']; if (substr($pageHeaderImage, 0, 4) != "http") { if (substr($pageHeaderImage, 0, 2) != "//") { $this->pageAbsoluteHeaderImage = Yii::app()->createAbsoluteUrl($pageHeaderImage, array(), Yii::app()->params['ENABLE_SSL'] ? 'https' : 'http'); // we prefix with baseUrl to handle instances where Web Store is installed in a sub folder $this->pageHeaderImage = Yii::app()->baseUrl . $pageHeaderImage; } else { $this->pageAbsoluteHeaderImage = Yii::app()->params['ENABLE_SSL'] ? 'https:' . $pageHeaderImage : 'http:' . $pageHeaderImage; $this->pageHeaderImage = $pageHeaderImage; } } else { $this->pageAbsoluteHeaderImage = $pageHeaderImage; $this->pageHeaderImage = $pageHeaderImage; } Yii::app()->shoppingcart->updateMissingProducts(); Yii::app()->shoppingcart->revalidatePromoCode(); //Run other functions to create some data we always need $this->buildGoogle(); $this->buildSidebars(); if (_xls_get_conf('SHOW_SHARING', 0)) { $this->buildSharing(); } $this->buildAccessWarning(); $this->gridProductsPerRow = _xls_get_conf('PRODUCTS_PER_ROW', 3); Yii::app()->clientScript->registerMetaTag("Lightspeed Web Store " . XLSWS_VERSION, 'generator', null, array(), 'generator'); }
/** * 8 Rename modules, load google */ protected function actionConvertModules() { //Change country to ID instead of text string based on xlsws_countries $strCountry = _xls_get_conf('DEFAULT_COUNTRY'); $objCountry = Country::LoadByCode($strCountry); if ($objCountry) { _xls_set_conf('DEFAULT_COUNTRY', $objCountry->id); } _dbx("update xlsws_modules set module = replace(module, '.php', '')"); $arrModuleRename = array('authorize_dot_net_aim' => 'authorizedotnetaim', 'authorize_dot_net_sim' => 'authorizedotnetsim', 'axia' => 'axia', 'beanstream_aim' => 'beanstreamaim', 'beanstream_sim' => 'beanstreamsim', 'cheque' => 'cheque', 'eway_cvn_aus' => 'ewayaim', 'merchantware' => 'merchantware', 'paypal_webpayments_pro' => 'paypalpro', 'paypal' => 'paypal', 'phone_order' => 'phoneorder', 'purchase_order' => 'purchaseorder', 'worldpay' => 'worldpaysim', 'xlsws_class_payment' => 'cashondelivery'); foreach ($arrModuleRename as $key => $value) { $objModule = Modules::model()->findByAttributes(array('category' => 'payment', 'module' => $key)); if ($objModule instanceof Modules) { $objModule->module = $value; $objModule->save(); } } $arrModuleRename = array('australiapost' => 'australiapost', 'canadapost' => 'canadapost', 'destination_table' => 'destinationshipping', 'fedex' => 'fedex', 'flat_rate' => 'flatrate', 'free_shipping' => 'freeshipping', 'intershipper' => 'intershipper', 'iups' => 'iups', 'store_pickup' => 'storepickup', 'tier_table' => 'tieredshipping', 'ups' => 'ups', 'usps' => 'usps'); foreach ($arrModuleRename as $key => $value) { $objModule = Modules::model()->findByAttributes(array('category' => 'shipping', 'module' => $key)); if ($objModule instanceof Modules) { $objModule->module = $value; $objModule->save(); } } $arrModuleRename = array('xlsws_class_sidebar' => 'wsbsidebar', 'sidebar_wishlist' => 'wsbwishlist', 'sidebar_order_lookup' => 'wsborderlookup'); foreach ($arrModuleRename as $key => $value) { $objModule = Modules::model()->findByAttributes(array('category' => 'sidebar', 'module' => $key)); if ($objModule instanceof Modules) { $objModule->module = $value; $objModule->save(); } } //fix for bad 2.5.2 configuration string $objModule = Modules::model()->findByAttributes(array('module' => 'storepickup')); if ($objModule instanceof Modules) { $conf = $objModule->configuration; $conf = str_replace('s:12"Store Pickup"', 's:12:"Store Pickup"', $conf); $objModule->configuration = $conf; $objModule->save(); } _dbx("INSERT INTO `xlsws_modules` (`active`, `module`, `category`, `version`, `name`, `sort_order`, `configuration`, `modified`, `created`)\nVALUES\t(0, 'wsmailchimp', 'CEventCustomer', 1, 'MailChimp', 1, 'a:2:{s:7:\"api_key\";s:0:\"\";s:4:\"list\";s:9:\"Web Store\";}', CURRENT_TIMESTAMP, NULL);"); $arrKeys = array('SEO_PRODUCT_TITLE', 'SEO_PRODUCT_DESCRIPTION', 'SEO_CATEGORY_TITLE', 'SEO_CUSTOMPAGE_TITLE', 'EMAIL_SUBJECT_CART', 'EMAIL_SUBJECT_WISHLIST', 'EMAIL_SUBJECT_CUSTOMER', 'EMAIL_SUBJECT_OWNER'); foreach ($arrKeys as $key) { $obj = Configuration::LoadByKey($key); $obj->key_value = str_replace("%storename%", "{storename}", $obj->key_value); $obj->key_value = str_replace("%name%", "{name}", $obj->key_value); $obj->key_value = str_replace("%description%", "{description}", $obj->key_value); $obj->key_value = str_replace("%shortdescription%", "{shortdescription}", $obj->key_value); $obj->key_value = str_replace("%longdescription%", "{longdescription}", $obj->key_value); $obj->key_value = str_replace("%shortdescription%", "{shortdescription}", $obj->key_value); $obj->key_value = str_replace("%keyword1%", "", $obj->key_value); $obj->key_value = str_replace("%keyword2%", "", $obj->key_value); $obj->key_value = str_replace("%keyword3%", "", $obj->key_value); $obj->key_value = str_replace("%price%", "{price}", $obj->key_value); $obj->key_value = str_replace("%family%", "{family}", $obj->key_value); $obj->key_value = str_replace("%class%", "{class}", $obj->key_value); $obj->key_value = str_replace("%crumbtrail%", "{crumbtrail}", $obj->key_value); $obj->key_value = str_replace("%rcrumbtrail%", "{rcrumbtrail}", $obj->key_value); $obj->key_value = str_replace("%orderid%", "{orderid}", $obj->key_value); $obj->key_value = str_replace("%customername%", "{customername}", $obj->key_value); $obj->save(); } $obj = Configuration::LoadByKey('LANGUAGES'); $obj->key_value = strtolower($obj->key_value); $obj->save(); return array('result' => "success", 'makeline' => 14, 'tag' => 'Converting tags', 'total' => 50); }
function _upload_default_header_to_s3() { Gallery::LoadGallery(1); $d = dir(YiiBase::getPathOfAlias('webroot') . "/images/header"); while (false !== ($filename = $d->read())) { if ($filename == "defaultheader.png") { $model = new GalleryPhoto(); $model->gallery_id = 1; $model->file_name = $filename; $model->name = ''; $model->description = ''; $model->thumb_ext = 'png'; $model->save(); $arrImages["/images/header/" . $filename] = CHtml::image(Yii::app()->request->baseUrl . "/images/header/" . $filename); $src = YiiBase::getPathOfAlias('webroot') . "/images/header/" . $filename; $fileinfo = mb_pathinfo($filename); $imageFile = new CUploadedFile($filename, $src, "image/" . $fileinfo['extension'], getimagesize($src), null); if (Yii::app()->params['LIGHTSPEED_MT'] == '1') { $model->setS3Image($imageFile); } _xls_set_conf('HEADER_IMAGE', "//lightspeedwebstore.s3.amazonaws.com/" . _xls_get_conf('LIGHTSPEED_HOSTING_LIGHTSPEED_URL') . "/gallery/1/" . $model->id . ".png"); } } }
/** * Show release notes (pulls from live site using a formatted URL). * * Customer can view this by using the menu option, and they are shown * automatically following an upgrade. * * @return void */ public function actionReleasenotes() { //Turn off flag now that we've seen release notes _xls_set_conf('LIGHTSPEED_SHOW_RELEASENOTES', 0); $strDashVersion = str_replace('.', '-', XLSWS_VERSION); $url = '//www.lightspeedretail.com/release-notes/webstore/web-store-' . $strDashVersion . '/?hide=yes'; $this->render("releasenotes", array('url' => $url)); }