public function save() { $path = 'modules/shoplocator/marker'; if ($_FILES['myfile']['size'] > 0) { oxUtilsFile::getInstance()->processFile('myfile', $path); } //$filename = oxUtilsFile::getInstance()->processFile('myfile', $path); $this->resetContentCache(); $soxIdQuery = 'SELECT OXID FROM `stores_settings` '; $soxId = oxDb::getDb()->getOne($soxIdQuery, false, false); $aParams = oxConfig::getParameter("editval"); if ($aParams['stores_settings__streetview_active'] == 'yes') { $aParams['stores_settings__streetview_active'] = 1; } if ($aParams['stores_settings__directions_active'] == 'yes') { $aParams['stores_settings__directions_active'] = 1; } $oShoplocator_Settings = oxNew("shoplocator_settings"); $oShoplocator_Settings->assign($aParams); $oShoplocator_Settings->save(); }
/** * Saves (uploads) pictures to server. * * @return mixed */ public function save() { $myConfig = $this->getConfig(); if ($myConfig->isDemoShop()) { // disabling uploading pictures if this is demo shop $oEx = oxNew("oxExceptionToDisplay"); $oEx->setMessage('ARTICLE_PICTURES_UPLOADISDISABLED'); oxUtilsView::getInstance()->addErrorToDisplay($oEx, false); return; } parent::save(); $oArticle = oxNew("oxarticle"); if ($oArticle->load($this->getEditObjectId())) { $oArticle->assign(oxConfig::getParameter("editval")); oxUtilsFile::getInstance()->processFiles($oArticle); // Show that no new image added if (oxUtilsFile::getInstance()->getNewFilesCounter() == 0) { $oEx = oxNew("oxExceptionToDisplay"); $oEx->setMessage('NO_PICTURES_CHANGES'); oxUtilsView::getInstance()->addErrorToDisplay($oEx, false); } $oArticle->save(); } }
/** * Saves selection list parameters changes in different language (eg. english). * * @return mixed */ public function saveinnlang() { $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); if (!isset($aParams['oxmanufacturers__oxactive'])) { $aParams['oxmanufacturers__oxactive'] = 0; } // shopid $sShopID = oxSession::getVar("actshop"); $aParams['oxmanufacturers__oxshopid'] = $sShopID; $oManufacturer = oxNew("oxmanufacturer"); if ($soxId != "-1") { $oManufacturer->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxmanufacturers__oxid'] = null; } //$aParams = $oManufacturer->ConvertNameArray2Idx( $aParams); $oManufacturer->setLanguage(0); $oManufacturer->assign($aParams); $oManufacturer->setLanguage($this->_iEditLang); $oManufacturer = oxUtilsFile::getInstance()->processFiles($oManufacturer); $oManufacturer->save(); // set oxid if inserted $this->setEditObjectId($oManufacturer->getId()); }
/** * Saves Promotions * * @return mixed */ public function save() { $myConfig = $this->getConfig(); parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); $oPromotion = oxNew("oxactions"); if ($soxId != "-1") { $oPromotion->load($soxId); oxUtilsPic::getInstance()->overwritePic($oPromotion, 'oxactions', 'oxpic', 'PROMO', oxUtilsFile::PROMO_PICTURE_DIR, $aParams, $myConfig->getPictureDir(false)); } else { $aParams['oxactions__oxid'] = null; } if (!$aParams['oxactions__oxactive']) { $aParams['oxactions__oxactive'] = 0; } $oPromotion->setLanguage(0); $oPromotion->assign($aParams); $oPromotion->setLanguage($this->_iEditLang); $oPromotion = oxUtilsFile::getInstance()->processFiles($oPromotion); $oPromotion->save(); // set oxid if inserted $this->setEditObjectId($oPromotion->getId()); }
/** * Saves modified extended article parameters. * * @return mixed */ public function save() { parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // checkbox handling if (!isset($aParams['oxarticles__oxissearch'])) { $aParams['oxarticles__oxissearch'] = 0; } if (!isset($aParams['oxarticles__oxblfixedprice'])) { $aParams['oxarticles__oxblfixedprice'] = 0; } // new way of handling bundled articles //#1517C - remove posibility to add Bundled Product //$this->setBundleId($aParams, $soxId); // default values $aParams = $this->addDefaultValues($aParams); $oArticle = oxNew("oxarticle"); $oArticle->loadInLang($this->_iEditLang, $soxId); if ($aParams['oxarticles__oxtprice'] != $oArticle->oxarticles__oxtprice->value && $aParams['oxarticles__oxtprice'] && $aParams['oxarticles__oxtprice'] <= $oArticle->oxarticles__oxprice->value) { //$aParams['oxarticles__oxtprice'] = $oArticle->oxarticles__oxtprice->value; $this->_aViewData["errorsavingtprice"] = 1; } //$aParams = $oArticle->ConvertNameArray2Idx( $aParams); $oArticle->setLanguage(0); $oArticle->assign($aParams); $oArticle->setLanguage($this->_iEditLang); $oArticle = oxUtilsFile::getInstance()->processFiles($oArticle); $oArticle->save(); //saving media file $sMediaUrl = oxConfig::getParameter("mediaUrl"); $sMediaDesc = oxConfig::getParameter("mediaDesc"); $aMediaFile = $this->getConfig()->getUploadedFile("mediaFile"); if ($sMediaUrl && $sMediaUrl != 'http://' || $aMediaFile['name'] || $sMediaDesc) { if (!$sMediaDesc) { return oxUtilsView::getInstance()->addErrorToDisplay('EXCEPTION_NODESCRIPTIONADDED'); } if ((!$sMediaUrl || $sMediaUrl == 'http://') && !$aMediaFile['name']) { return oxUtilsView::getInstance()->addErrorToDisplay('EXCEPTION_NOMEDIAADDED'); } $oMediaUrl = oxNew("oxMediaUrl"); $oMediaUrl->setLanguage($this->_iEditLang); $oMediaUrl->oxmediaurls__oxisuploaded = new oxField(0, oxField::T_RAW); //handle uploaded file if ($aMediaFile['name']) { try { $sMediaUrl = oxUtilsFile::getInstance()->processFile('mediaFile', 'out/media/'); $oMediaUrl->oxmediaurls__oxisuploaded = new oxField(1, oxField::T_RAW); } catch (Exception $e) { return oxUtilsView::getInstance()->addErrorToDisplay($e->getMessage()); } } //save media url $oMediaUrl->oxmediaurls__oxobjectid = new oxField($soxId, oxField::T_RAW); $oMediaUrl->oxmediaurls__oxurl = new oxField($sMediaUrl, oxField::T_RAW); $oMediaUrl->oxmediaurls__oxdesc = new oxField($sMediaDesc, oxField::T_RAW); $oMediaUrl->save(); } }
/** * Saves article category data. * * @return mixed */ public function save() { parent::save(); $myConfig = $this->getConfig(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // checkbox handling if (!isset($aParams['oxcategories__oxactive'])) { $aParams['oxcategories__oxactive'] = 0; } if (!isset($aParams['oxcategories__oxhidden'])) { $aParams['oxcategories__oxhidden'] = 0; } if (!isset($aParams['oxcategories__oxdefsortmode'])) { $aParams['oxcategories__oxdefsortmode'] = 0; } // null values if ($aParams['oxcategories__oxvat'] === '') { $aParams['oxcategories__oxvat'] = null; } // shopid $aParams['oxcategories__oxshopid'] = oxSession::getVar("actshop"); $oCategory = oxNew("oxcategory"); if ($soxId != "-1") { $this->resetCounter("catArticle", $soxId); $oCategory->load($soxId); $oCategory->loadInLang($this->_iEditLang, $soxId); $myUtilsPic = oxUtilsPic::getInstance(); // #1173M - not all pic are deleted, after article is removed $myUtilsPic->overwritePic($oCategory, 'oxcategories', 'oxthumb', 'TC', '0', $aParams, $myConfig->getPictureDir(false)); $myUtilsPic->overwritePic($oCategory, 'oxcategories', 'oxicon', 'CICO', 'icon', $aParams, $myConfig->getPictureDir(false)); $myUtilsPic->overwritePic($oCategory, 'oxcategories', 'oxpromoicon', 'PICO', 'icon', $aParams, $myConfig->getPictureDir(false)); } else { //#550A - if new category is made then is must be default activ //#4051: Impossible to create inactive category //$aParams['oxcategories__oxactive'] = 1; $aParams['oxcategories__oxid'] = null; } $oCategory->setLanguage(0); if (isset($aParams["oxcategories__oxlongdesc"])) { $aParams["oxcategories__oxlongdesc"] = $this->_processLongDesc($aParams["oxcategories__oxlongdesc"]); } $oCategory->assign($aParams); $oCategory->setLanguage($this->_iEditLang); $oCategory = oxUtilsFile::getInstance()->processFiles($oCategory); $oCategory->save(); $this->setEditObjectId($oCategory->getId()); }
/** * Saves changes of article parameters. * * @return null */ public function save() { parent::save(); $myConfig = $this->getConfig(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // checkbox handling if (!isset($aParams['oxarticles__oxactive'])) { $aParams['oxarticles__oxactive'] = 0; } // default values $aParams = $this->addDefaultValues($aParams); // null values if ($aParams['oxarticles__oxvat'] === '') { $aParams['oxarticles__oxvat'] = null; } // varianthandling $soxparentId = oxConfig::getParameter("oxparentid"); if (isset($soxparentId) && $soxparentId && $soxparentId != "-1") { $aParams['oxarticles__oxparentid'] = $soxparentId; } else { unset($aParams['oxarticles__oxparentid']); } $oArticle = oxNew("oxarticle"); $oArticle->setLanguage($this->_iEditLang); if ($soxId != "-1") { $oArticle->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxarticles__oxid'] = null; $aParams['oxarticles__oxissearch'] = 1; $aParams['oxarticles__oxstockflag'] = 1; // shopid $aParams['oxarticles__oxshopid'] = oxSession::getVar("actshop"); } //article number handling, warns for artnum dublicates if (isset($aParams['oxarticles__oxartnum']) && strlen($aParams['oxarticles__oxartnum']) > 0 && $myConfig->getConfigParam('blWarnOnSameArtNums') && $oArticle->oxarticles__oxartnum->value != $aParams['oxarticles__oxartnum']) { $sSelect = "select oxid from " . getViewName('oxarticles'); $sSelect .= " where oxartnum = '" . $aParams['oxarticles__oxartnum'] . "'"; $sSelect .= " and oxid != '" . $aParams['oxarticles__oxid'] . "'"; if ($oArticle->assignRecord($sSelect)) { $this->_aViewData["errorsavingatricle"] = 1; } } // #905A resetting article count in price categories if price has been changed if (isset($aParams["oxarticles__oxprice"]) && $aParams["oxarticles__oxprice"] != $oArticle->oxarticles__oxprice->value) { $this->resetCounter("priceCatArticle", $oArticle->oxarticles__oxprice->value); } $aResetIds = array(); if ($aParams['oxarticles__oxactive'] != $oArticle->oxarticles__oxactive->value) { $oDb = oxDb::getDb(); //check categories $sQ = "select oxcatnid from oxobject2category where oxobjectid = " . $oDb->quote($oArticle->oxarticles__oxid->value); $oRs = $oDb->execute($sQ); if ($oRs !== false && $oRs->recordCount() > 0) { while (!$oRs->EOF) { $this->resetCounter("catArticle", $oRs->fields[0]); $oRs->moveNext(); } } // vendors $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1; $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1; } // vendors if (isset($aParams['oxarticles__oxvendorid']) && $aParams['oxarticles__oxvendorid'] != $oArticle->oxarticles__oxvendorid->value) { $aResetIds['vendor'][$aParams['oxarticles__oxvendorid']] = 1; $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1; } // manufacturers if (isset($aParams['oxarticles__oxmanufacturerid']) && $aParams['oxarticles__oxmanufacturerid'] != $oArticle->oxarticles__oxmanufacturerid->value) { $aResetIds['manufacturer'][$aParams['oxarticles__oxmanufacturerid']] = 1; $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1; } // resetting counts $this->_resetCounts($aResetIds); $oArticle->setLanguage(0); //triming spaces from article title (M:876) $aParams['oxarticles__oxtitle'] = trim($aParams['oxarticles__oxtitle']); $oArticle->assign($aParams); $oArticle->setArticleLongDesc($this->_processLongDesc($aParams['oxarticles__oxlongdesc'])); $oArticle->setLanguage($this->_iEditLang); $oArticle = oxUtilsFile::getInstance()->processFiles($oArticle); $oArticle->save(); // set oxid if inserted if ($soxId == "-1") { $sFastCat = oxConfig::getParameter("art_category"); if ($sFastCat != "-1") { $this->addToCategory($sFastCat, $oArticle->getId()); } } //saving tags $sTags = $aParams['tags']; if (!trim($sTags)) { $sTags = $oArticle->oxarticles__oxsearchkeys->value; } $oArticle->saveTags($sTags); $this->setEditObjectId($oArticle->getId()); }
/** * Checks for external images and embeds them to email message if possible * * @param string $sImageDir Images directory url * @param string $sImageDirNoSSL Images directory url (no SSL) * @param string $sDynImageDir Path to Dyn images * @param string $sAbsImageDir Absolute path to images * @param string $sAbsDynImageDir Absolute path to Dyn images * * @return null */ protected function _includeImages($sImageDir = null, $sImageDirNoSSL = null, $sDynImageDir = null, $sAbsImageDir = null, $sAbsDynImageDir = null) { $sBody = $this->getBody(); if (preg_match_all('/<\\s*img\\s+[^>]*?src[\\s]*=[\\s]*[\'"]?([^[\'">]]+|.*?)?[\'">]/i', $sBody, $matches, PREG_SET_ORDER)) { $oFileUtils = oxUtilsFile::getInstance(); $blReSetBody = false; // preparing imput $sDynImageDir = $oFileUtils->normalizeDir($sDynImageDir); $sImageDir = $oFileUtils->normalizeDir($sImageDir); $sImageDirNoSSL = $oFileUtils->normalizeDir($sImageDirNoSSL); if (is_array($matches) && count($matches)) { $aImageCache = array(); $myUtils = oxUtils::getInstance(); $myUtilsObject = oxUtilsObject::getInstance(); $oImgGenerator = oxNew("oxDynImgGenerator"); foreach ($matches as $aImage) { $image = $aImage[1]; $sFileName = ''; if (strpos($image, $sDynImageDir) === 0) { $sFileName = $oFileUtils->normalizeDir($sAbsDynImageDir) . str_replace($sDynImageDir, '', $image); } elseif (strpos($image, $sImageDir) === 0) { $sFileName = $oFileUtils->normalizeDir($sAbsImageDir) . str_replace($sImageDir, '', $image); } elseif (strpos($image, $sImageDirNoSSL) === 0) { $sFileName = $oFileUtils->normalizeDir($sAbsImageDir) . str_replace($sImageDirNoSSL, '', $image); } if ($sFileName && !@is_readable($sFileName)) { $sFileName = $oImgGenerator->getImagePath($sFileName); } if ($sFileName) { $sCId = ''; if (isset($aImageCache[$sFileName]) && $aImageCache[$sFileName]) { $sCId = $aImageCache[$sFileName]; } else { $sCId = $myUtilsObject->generateUID(); $sMIME = $myUtils->oxMimeContentType($sFileName); if ($sMIME == 'image/jpeg' || $sMIME == 'image/gif' || $sMIME == 'image/png') { if ($this->addEmbeddedImage($sFileName, $sCId, "image", "base64", $sMIME)) { $aImageCache[$sFileName] = $sCId; } else { $sCId = ''; } } } if ($sCId && $sCId == $aImageCache[$sFileName]) { if ($sReplTag = str_replace($image, 'cid:' . $sCId, $aImage[0])) { $sBody = str_replace($aImage[0], $sReplTag, $sBody); $blReSetBody = true; } } } } } if ($blReSetBody) { $this->setBody($sBody); } } }
/** * Deletes custom zoom picture, which name is specified in oxzoom field. * * @param oxArticle $oObject article object * @param int $iIndex zoom picture index * * @return null */ public function deleteZoomPicture($oObject, $iIndex) { // checking if oxzoom field exists $oDbHandler = oxNew("oxDbMetaDataHandler"); $iZoomPicCount = (int) $this->getConfig()->getConfigParam('iZoomPicCount'); if ($iIndex > $iZoomPicCount || !$oDbHandler->fieldExists("oxzoom" . $iIndex, "oxarticles")) { if ($sZoomPicName = $this->getZoomName($oObject->{"oxarticles__oxpic" . $iIndex}->value, $iIndex)) { $sFieldToCheck = "oxpic" . $iIndex; } else { return; } } else { $sZoomPicName = basename($oObject->{"oxarticles__oxzoom" . $iIndex}->value); $sFieldToCheck = "oxzoom" . $iIndex; } if ($sZoomPicName && $sZoomPicName != "nopic.jpg") { // deleting zoom picture $sPath = $this->getConfig()->getPictureDir(false) . oxUtilsFile::getInstance()->getImageDirByType("Z" . $iIndex); oxUtilsPic::getInstance()->safePictureDelete($sZoomPicName, $sPath, "oxarticles", $sFieldToCheck); } }
/** * Saves main wrapping parameters. * * @return null */ public function saveinnlang() { $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // checkbox handling if (!isset($aParams['oxwrapping__oxactive'])) { $aParams['oxwrapping__oxactive'] = 0; } // shopid $aParams['oxwrapping__oxshopid'] = oxSession::getVar("actshop"); $oWrapping = oxNew("oxwrapping"); if ($soxId != "-1") { $oWrapping->load($soxId); } else { $aParams['oxwrapping__oxid'] = null; } //$aParams = $oWrapping->ConvertNameArray2Idx( $aParams); $oWrapping->setLanguage(0); $oWrapping->assign($aParams); $oWrapping->setLanguage($this->_iEditLang); $oWrapping = oxUtilsFile::getInstance()->processFiles($oWrapping); $oWrapping->save(); // set oxid if inserted $this->setEditObjectId($oWrapping->getId()); }
/** * Saves selection list parameters changes in different language (eg. english). * * @return mixed */ public function saveinnlang() { $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); if (!isset($aParams['oxvendor__oxactive'])) { $aParams['oxvendor__oxactive'] = 0; } // shopid $aParams['oxvendor__oxshopid'] = oxSession::getVar("actshop"); $oVendor = oxNew("oxvendor"); if ($soxId != "-1") { $oVendor->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxvendor__oxid'] = null; } $oVendor->setLanguage(0); $oVendor->assign($aParams); $oVendor->setLanguage($this->_iEditLang); $oVendor = oxUtilsFile::getInstance()->processFiles($oVendor); $oVendor->save(); // set oxid if inserted $this->setEditObjectId($oVendor->getId()); }
/** * Saves selection list parameters changes. * * @return mixed */ public function save() { $myConfig = $this->getConfig(); parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); if (!isset($aParams['oxcountry__oxactive'])) { $aParams['oxcountry__oxactive'] = 0; } $oCountry = oxNew("oxcountry"); if ($soxId != "-1") { $oCountry->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxcountry__oxid'] = null; } //$aParams = $oCountry->ConvertNameArray2Idx( $aParams); $oCountry->setLanguage(0); $oCountry->assign($aParams); $oCountry->setLanguage($this->_iEditLang); $oCountry = oxUtilsFile::getInstance()->processFiles($oCountry); $oCountry->save(); // set oxid if inserted $this->setEditObjectId($oCountry->getId()); }
/** * Adds to element DynTabs * * @param object $oDom dom element to add links * * @return null */ protected function _addDynLinks($oDom) { $myConfig = $this->getConfig(); $myUtilsFile = oxUtilsFile::getInstance(); $sURL = 'index.php?'; // session parameters will be included later (after cache processor) $oXPath = new DomXPath($oDom); $oNodeList = $oXPath->query("//OXMENU[@type='dyn']/MAINMENU/SUBMENU"); foreach ($oNodeList as $oNode) { // fetching class $sCl = $oNode->getAttribute('cl'); $sCl = "cl=dynscreen&menu={$sCl}"; // fetching params $sParam = $oNode->getAttribute('clparam'); $sParam = $sParam ? "&{$sParam}" : ''; // setting list node if its is not set yet if (!$oNode->getAttribute('list')) { $oNode->setAttribute('list', 'dynscreen_list'); $oNode->setAttribute('listparam', 'menu=' . $oNode->getAttribute('cl')); } // setting link $oNode->setAttribute('link', "{$sURL}{$sCl}{$sParam}"); // setting id $oNode->parentNode->setAttribute('id', 'dyn_menu'); // setting id to its parent // fetching class $sFile = $oNode->getAttribute('cl'); // always display the "about" tab no matter what licence if ($myUtilsFile->checkFile("{$this->_sDynIncludeUrl}pages/{$sFile}_about.php")) { $oTabElem = new DOMElement('TAB'); $oNode->appendChild($oTabElem); $oTabElem->setAttribute('external', 'true'); $oTabElem->setAttribute('location', "{$this->_sDynIncludeUrl}pages/{$sFile}_about.php"); $oTabElem->setAttribute('id', 'dyn_about'); } // checking for technics page if ($myUtilsFile->checkFile("{$this->_sDynIncludeUrl}pages/{$sFile}_technics.php")) { $oTabElem = new DOMElement('TAB'); $oNode->appendChild($oTabElem); $oTabElem->setAttribute('external', 'true'); $oTabElem->setAttribute('location', "{$this->_sDynIncludeUrl}pages/{$sFile}_technics.php"); $oTabElem->setAttribute('id', 'dyn_interface'); } // checking for setup page if (file_exists($myConfig->getConfigParam('sShopDir') . $myConfig->getConfigParam('sAdminDir') . "/{$sFile}.php")) { $oTabElem = new DOMElement('TAB'); $oNode->appendChild($oTabElem); $oTabElem->setAttribute('id', 'dyn_interface'); $oTabElem->setAttribute('cl', $sFile); } } }
/** * Saves article attributes. * * @return mixed */ public function save() { parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // shopid $aParams['oxattribute__oxshopid'] = oxSession::getVar("actshop"); $oAttr = oxNew("oxattribute"); if ($soxId != "-1") { $oAttr->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxattribute__oxid'] = null; } //$aParams = $oAttr->ConvertNameArray2Idx( $aParams); $oAttr->setLanguage(0); $oAttr->assign($aParams); $oAttr->setLanguage($this->_iEditLang); $oAttr = oxUtilsFile::getInstance()->processFiles($oAttr); $oAttr->save(); $this->setEditObjectId($oAttr->getId()); }
/** * Returns the OXID file utilities object. * * @return oxUtilsFile */ public function getUtilsFile() { return oxUtilsFile::getInstance(); }
/** * Returns assigned banner article picture url * * @return string */ public function getBannerPictureUrl() { if (isset($this->oxactions__oxpic) && $this->oxactions__oxpic->value) { $sPromoDir = oxUtilsFile::getInstance()->normalizeDir(oxUtilsFile::PROMO_PICTURE_DIR); return $this->getConfig()->getPictureUrl($sPromoDir . $this->oxactions__oxpic->value, false); } }
/** * Starts session manager * * @return null */ public function init() { include getShopBasePath() . 'config.inc.php'; include getShopBasePath() . 'core/oxconfk.php'; //adding trailing slashes $oFileUtils = oxUtilsFile::getInstance(); $this->sShopDir = $oFileUtils->normalizeDir($this->sShopDir); $this->sCompileDir = $oFileUtils->normalizeDir($this->sCompileDir); $this->sShopURL = $oFileUtils->normalizeDir($this->sShopURL); $this->sSSLShopURL = $oFileUtils->normalizeDir($this->sSSLShopURL); $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL); // some important defaults if (!$this->getConfigParam('sDefaultLang')) { $this->setConfigParam('sDefaultLang', 0); } $this->setConfigParam('sTheme', 'basic'); $blLogChangesInAdmin = $this->getConfigParam('blLogChangesInAdmin'); if (!isset($blLogChangesInAdmin)) { $this->setConfigParam('blLogChangesInAdmin', false); } $blCheckTemplates = $this->getConfigParam('blCheckTemplates'); if (!isset($blCheckTemplates)) { $this->setConfigParam('blCheckTemplates', false); } $blAllowArticlesubclass = $this->getConfigParam('blAllowArticlesubclass'); if (!isset($blAllowArticlesubclass)) { $this->setConfigParam('blAllowArticlesubclass', false); } $iAdminListSize = $this->getConfigParam('iAdminListSize'); if (!isset($iAdminListSize)) { $this->setConfigParam('iAdminListSize', 9); } // #1173M for EE - not all pic are deleted $iPicCount = $this->getConfigParam('iPicCount'); if (!isset($iPicCount)) { $this->setConfigParam('iPicCount', 7); } $iZoomPicCount = $this->getConfigParam('iZoomPicCount'); if (!isset($iZoomPicCount)) { $this->setConfigParam('iZoomPicCount', 4); } //max shop id default value $iMaxShopId = $this->getConfigParam('iMaxShopId'); if (!isset($iMaxShopId)) { $this->setConfigParam('iMaxShopId', 64); } // disabling caching according to DODGER #655 : disable Caching as it doesnt work good enought $this->setConfigParam('blTemplateCaching', false); //setting ADODB timeout global $ADODB_SESS_LIFE; $ADODB_SESS_LIFE = 1; // ADODB cachelifetime $iDBCacheLifeTime = $this->getConfigParam('iDBCacheLifeTime'); if (!isset($iDBCacheLifeTime)) { $this->setConfigParam('iDBCacheLifeTime', 3600); } // 1 hour $sCoreDir = $this->getConfigParam('sShopDir'); $this->setConfigParam('sCoreDir', $sCoreDir . '/core/'); try { $sShopID = $this->getShopId(); $blConfigLoaded = $this->_loadVarsFromDb($sShopID); // load now if (empty($sShopID) || !$blConfigLoaded) { // if no config values where loaded (some problmems with DB), throwing an exception $oEx = oxNew("oxConnectionException"); $oEx->setMessage("Unable to load shop config values from database"); throw $oEx; } // loading theme config options $this->_loadVarsFromDb($sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme')); // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362) if ($this->getConfigParam('sCustomTheme')) { $this->_loadVarsFromDb($sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme')); } $this->_processSeoCall(); //starting up the session $this->getSession()->start(); } catch (oxConnectionException $oEx) { $oEx->debugOut(); if (defined('OXID_PHP_UNIT')) { return false; } elseif (0 != $this->iDebug) { oxUtils::getInstance()->showMessageAndExit($oEx->getString()); } else { header("HTTP/1.1 500 Internal Server Error"); header("Location: offline.html"); header("Connection: close"); } } catch (oxCookieException $oEx) { $this->_processSeoCall(); //starting up the session $this->getSession()->start(); // redirect to start page and display the error oxUtilsView::getInstance()->addErrorToDisplay($oEx); oxUtils::getInstance()->redirect($this->getShopHomeURL() . 'cl=start', true, 302); } //application initialization $this->_oStart = new oxStart(); $this->_oStart->appInit(); }
/** * Checks if newer shop version available. If true - returns message * * @return string */ protected function _checkVersion() { $sVersion = 'CE'; $sQuery = 'http://admin.oxid-esales.com/' . $sVersion . '/onlinecheck.php?getlatestversion'; if ($sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString($sQuery)) { // current version is older .. if (version_compare($this->getConfig()->getVersion(), $sVersion) == '-1') { return sprintf(oxLang::getInstance()->translateString('NAVIGATION_NEWVERSIONAVAILABLE'), $sVersion); } } }
/** * Saves deliveryset information changes. * * @return mixed */ public function save() { parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // shopid $sShopID = oxSession::getVar("actshop"); $aParams['oxdeliveryset__oxshopid'] = $sShopID; $oDelSet = oxNew("oxdeliveryset"); if ($soxId != "-1") { $oDelSet->loadInLang($this->_iEditLang, $soxId); } else { $aParams['oxdeliveryset__oxid'] = null; } // checkbox handling if (!isset($aParams['oxdeliveryset__oxactive'])) { $aParams['oxdeliveryset__oxactive'] = 0; } //$aParams = $oDelSet->ConvertNameArray2Idx( $aParams); $oDelSet->setLanguage(0); $oDelSet->assign($aParams); $oDelSet->setLanguage($this->_iEditLang); $oDelSet = oxUtilsFile::getInstance()->processFiles($oDelSet); $oDelSet->save(); // set oxid if inserted $this->setEditObjectId($oDelSet->getId()); }
/** * Saves article Inventori information changes. * * @return mixed */ public function save() { parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxConfig::getParameter("editval"); // checkbox handling if (!isset($aParams['oxarticles__oxremindactive'])) { $aParams['oxarticles__oxremindactive'] = 0; } // shopid $sShopID = oxSession::getVar("actshop"); $aParams['oxarticles__oxshopid'] = $sShopID; $oArticle = oxNew("oxarticle"); $oArticle->loadInLang($this->_iEditLang, $soxId); $oArticle->setLanguage(0); $oArticle->assign($aParams); //tells to article to save in different language $oArticle->setLanguage($this->_iEditLang); $oArticle = oxUtilsFile::getInstance()->processFiles($oArticle); if ($oArticle->oxarticles__oxremindactive->value && $oArticle->oxarticles__oxremindamount->value <= $oArticle->oxarticles__oxstock->value) { $oArticle->oxarticles__oxremindactive->value = 1; } $oArticle->save(); }