4 define(
'MAX_64BIT_INTEGER',
'18446744073709551615');
133 'oxlinks',
'oxvoucherseries',
'oxmanufacturers',
134 'oxnews',
'oxselectlist',
'oxwrapping',
135 'oxdeliveryset',
'oxdelivery',
'oxvendor',
'oxobject2category');
299 if (defined(
'OXID_PHP_UNIT')) {
300 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
301 $sValue = modConfig::$unitMOD->getModConfigParam($sName);
302 if ($sValue !== null) {
310 if (isset ($this->_aConfigParams[$sName])) {
311 return $this->_aConfigParams[$sName];
314 if (isset($this->$sName)) {
315 return $this->$sName;
327 if (isset($this->$sName)) {
328 $this->$sName = $sValue;
330 $this->_aConfigParams[$sName] = $sValue;
341 oxNew(
'oxSeoDecoder')->processSeoCall();
355 if ($this->_blInit) {
358 $this->_blInit =
true;
362 include getShopBasePath() .
'core/oxconfk.php';
365 global $ADODB_SESS_LIFE;
366 $ADODB_SESS_LIFE = 1;
376 if (empty($sShopID) || !$blConfigLoaded) {
379 $oEx->setMessage(
"Unable to load shop config values from database");
404 if (defined(
'OX_ADMIN_DIR')) {
411 $this->_oStart =
new oxStart();
412 $this->_oStart->appInit();
426 include getShopBasePath() .
'/config.inc.php';
494 $sCustConfig = getShopBasePath() .
'/cust_config.inc.php';
495 if (is_readable($sCustConfig)) {
496 include $sCustConfig;
513 $sModuleSql = $sModule ?
" oxmodule LIKE " . $oDb->quote($sModule .
"%") :
" oxmodule='' ";
519 where oxshopid = '$sShopID' and " . $sModuleSql . $sOnlyVarsSql;
521 $aResult = $oDb->getAll($sSelect);
523 foreach ($aResult as $aValue) {
524 $sVarName = $aValue[0];
525 $sVarType = $aValue[1];
526 $sVarVal = $aValue[2];
532 $this->_aThemeConfigParams[$sVarName] = $sModule;
536 return (
bool) count($aResult);
549 if (is_array($aVars) && !empty($aVars)) {
550 foreach ($aVars as &$sField) {
551 $sField =
'"' . $sField .
'"';
553 $sSelect =
' and oxvarname in ( ' . implode(
', ', $aVars) .
' ) ';
571 if (($sVarName ==
'sShopURL' || $sVarName ==
'sSSLShopURL') &&
572 (!$sVarVal || $this->
isAdmin() ===
true)
583 $this->
setConfigParam($sVarName, ($sVarVal ==
'true' || $sVarVal ==
'1'));
603 return $this->_oStart->pageClose();
619 if (defined(
'OXID_PHP_UNIT')) {
620 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
625 $blIsAdmin = modConfig::getInstance()->isAdmin() || modSession::getInstance()->getVariable(
"blIsAdmin");
626 if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
639 if (isset($_POST[$sName])) {
640 $sValue = $_POST[$sName];
641 } elseif (isset($_GET[$sName])) {
642 $sValue = $_GET[$sName];
647 if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
663 return $_FILES[$sParamName];
674 $this->_aGlobalParams[$sName] = $sValue;
686 if (isset($this->_aGlobalParams[$sName])) {
687 return $this->_aGlobalParams[$sName];
704 if (is_object($sValue)) {
708 if (is_array($sValue)) {
710 foreach ($sValue as $sKey => $sVal) {
712 if (!$aRaw || !in_array($sKey, $aRaw)) {
715 if ($sValidKey != $sKey) {
716 unset ($sValue[$sKey]);
719 $newValue[$sValidKey] = $sVal;
722 } elseif (is_string($sValue)) {
723 $sValue = str_replace(
724 array(
'&',
'<',
'>',
'"',
"'", chr(0),
'\\',
"\n",
"\r"),
725 array(
'&',
'<',
'>',
'"',
''',
'',
'\',
' ',
' '),
743 $this->
getSession()->setVariable(
'actshop', $sShopId);
744 $this->_iShopId = $sShopId;
754 if ($this->_iShopId !== null) {
761 $this->
getSession()->setVariable(
'actshop', $this->_iShopId);
776 $this->_blIsSsl = $blIsSsl;
785 $aServerVars = $myUtilsServer->getServerVar();
786 $aHttpsServerVar = $myUtilsServer->getServerVar(
'HTTPS');
789 if (isset($aHttpsServerVar) && ($aHttpsServerVar ===
'on' || $aHttpsServerVar ===
'ON' || $aHttpsServerVar ==
'1')) {
792 if ($this->
isAdmin() && !$this->_blIsSsl) {
799 if (isset($aServerVars[
'HTTP_X_FORWARDED_SERVER']) &&
800 (strpos($aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'ssl') !==
false ||
801 strpos($aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'secure-online-shopping.de') !==
false)
815 if (is_null($this->_blIsSsl)) {
832 if (!$sURL || (strpos($sURL,
"http") !== 0)) {
849 if (!$sURL || (strpos($sURL,
"http") !== 0)) {
853 return (strpos($sURL,
"https:") === 0) == $this->
isSsl();
867 $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
938 if ($blAdmin === null) {
942 if ($this->
isSsl()) {
967 if ($this->
isSsl()) {
968 $sURL = $this->getSSLShopURL($iLang);
970 $sURL = $this->getShopURL($iLang);
973 return oxRegistry::get(
"oxUtilsUrl")->processUrl($sURL .
'index.php',
false);
1001 return oxRegistry::get(
'oxUtilsUrl')->processUrl($sUrl .
'widget.php',
false);
1024 $iCurr = $this->
getSession()->getVariable(
'currency');
1028 return (
int) $iCurr;
1040 if (!defined(
'OXID_PHP_UNIT')) {
1041 if (!is_null($this->_oActCurrencyObject)) {
1048 if (!isset($aCurrencies[$iCur])) {
1049 return $this->_oActCurrencyObject = reset($aCurrencies);
1052 return $this->_oActCurrencyObject = $aCurrencies[$iCur];
1063 if (isset($aCurrencies[$iCur])) {
1064 $this->
getSession()->setVariable(
'currency', $iCur);
1065 $this->_oActCurrencyObject = null;
1079 return $this->
getConfigParam(
'sShopDir') . $this->_sOutDir .
'/';
1081 return $this->_sOutDir .
'/';
1097 return 'application/views/';
1113 $sPath .=
'application/translations/';
1114 if (is_readable($sPath . $sDir .
'/' . $sFile)) {
1115 return $sPath . $sDir .
'/' . $sFile;
1133 return 'application/';
1146 public function getOutUrl($blSSL = null, $blAdmin = null, $blNativeImg =
false)
1148 $blSSL = is_null($blSSL) ? $this->
isSsl() : $blSSL;
1149 $blAdmin = is_null($blAdmin) ? $this->
isAdmin() : $blAdmin;
1152 if ($blNativeImg && !$blAdmin) {
1156 if (!$sUrl && $blAdmin) {
1164 return $sUrl . $this->_sOutDir .
'/';
1181 public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute =
true, $blIgnoreCust =
false)
1183 if (is_null($sTheme)) {
1191 if ($sDir != $this->_sTemplateDir) {
1201 if ($iLang !==
false) {
1204 if (is_null($iLang)) {
1205 $iLang = $oLang->getEditLanguage();
1208 $sLang = $oLang->getLanguageAbbr($iLang);
1211 if (is_null($iShop)) {
1216 $sPath =
"{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
1217 $sCacheKey = $sPath .
"_{$blIgnoreCust}{$blAbsolute}";
1227 if (!$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
1228 $sReturn = $this->
getDir($sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute);
1232 if (!$sReturn && !$blAdmin && is_readable($sAbsBase . $sPath)) {
1233 $sReturn = $sBase . $sPath;
1237 $sPath =
"$sTheme/$iShop/$sDir/$sFile";
1238 if (!$sReturn && !$blAdmin && is_readable($sAbsBase . $sPath)) {
1239 $sReturn = $sBase . $sPath;
1244 $sPath =
"$sTheme/$sLang/$sDir/$sFile";
1245 if (!$sReturn && $iLang !==
false && is_readable($sAbsBase . $sPath)) {
1246 $sReturn = $sBase . $sPath;
1250 $sPath =
"$sTheme/$sDir/$sFile";
1251 if (!$sReturn && is_readable($sAbsBase . $sPath)) {
1252 $sReturn = $sBase . $sPath;
1256 $sPath =
"$sLang/$sDir/$sFile";
1257 if (!$sReturn && $iLang !==
false && is_readable($sAbsBase . $sPath)) {
1258 $sReturn = $sBase . $sPath;
1262 $sPath =
"$sDir/$sFile";
1263 if (!$sReturn && is_readable($sAbsBase . $sPath)) {
1264 $sReturn = $sBase . $sPath;
1291 public function getUrl($sFile, $sDir, $blAdmin = null, $blSSL = null, $blNativeImg =
false, $iLang = null, $iShop = null, $sTheme = null)
1293 $sUrl = str_replace(
1295 $this->
getOutUrl($blSSL, $blAdmin, $blNativeImg),
1296 $this->
getDir($sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme)
1312 return $this->
getDir($sFile, $this->_sImageDir, $blAdmin);
1325 public function getImageUrl($blAdmin =
false, $blSSL = null, $blNativeImg = null, $sFile = null)
1327 $blNativeImg = is_null($blNativeImg) ? $this->
getConfigParam(
'blNativeImages') : $blNativeImg;
1329 return $this->
getUrl($sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg);
1341 return $this->
getDir(null, $this->_sImageDir, $blAdmin);
1355 public function getPicturePath($sFile, $blAdmin =
false, $iLang = null, $iShop = null, $sTheme = null)
1357 return $this->
getDir($sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme);
1369 return $this->
getDir(null, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin);
1382 return $this->
getDir($sFile, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin);
1397 public function getPictureUrl($sFile, $blAdmin =
false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic =
"master/nopic.jpg")
1399 if ($sAltUrl =
oxRegistry::get(
"oxPictureHandler")->getAltImageUrl(
'/', $sFile, $blSSL)) {
1404 $sUrl = $this->
getUrl($sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
1407 if (!$sUrl && $sDefPic) {
1408 $sUrl = $this->
getUrl($sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
1423 return $this->
getDir(null, $this->_sPictureDir, $blAdmin);
1436 $sTemplatePath = $this->
getDir($sFile, $this->_sTemplateDir, $blAdmin);
1438 if (!$sTemplatePath) {
1439 $sBasePath = getShopBasePath();
1442 $oModulelist =
oxNew(
'oxmodulelist');
1443 $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
1444 if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
1445 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
1446 if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
1447 $sPath = $aTemplates[$sFile];
1448 $sPath = $sBasePath .
'modules/' . $sPath;
1449 if (is_file($sPath) && is_readable($sPath)) {
1450 $sTemplatePath = $sPath;
1457 return $sTemplatePath;
1469 return $this->
getDir(null, $this->_sTemplateDir, $blAdmin);
1482 public function getTemplateUrl($sFile = null, $blAdmin =
false, $blSSL = null, $iLang = null)
1484 return $this->
getShopMainUrl() . $this->
getDir($sFile, $this->_sTemplateDir, $blAdmin, $iLang, null, null,
false);
1497 return str_replace($this->_sTemplateDir .
'/',
'', $this->
getDir(null, $this->_sTemplateDir, $blAdmin, null, null, null,
false));
1510 return $this->
getDir($sFile, $this->_sResourceDir, $blAdmin);
1523 return $this->
getConfigParam(
'sShopDir') . $this->_sModulesDir .
'/';
1525 return $this->_sModulesDir .
'/';
1539 public function getResourceUrl($sFile =
'', $blAdmin =
false, $blSSL = null, $iLang = null)
1543 return $this->
getUrl($sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang);
1555 return $this->
getDir(null, $this->_sResourceDir, $blAdmin);
1568 if (!is_array($aConfCurrencies)) {
1572 if (defined(
'OXID_PHP_UNIT')) {
1573 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
1575 $aAltCurrencies = modConfig::getInstance()->getConfigParam(
'modaCurrencies');
1576 if (isset($aAltCurrencies)) {
1577 $aConfCurrencies = $aAltCurrencies;
1586 $aCurrencies = array();
1587 reset($aConfCurrencies);
1588 while (list($key, $val) = each($aConfCurrencies)) {
1590 $oCur =
new stdClass();
1592 $sCur = explode(
'@', $val);
1593 $oCur->name = trim($sCur[0]);
1594 $oCur->rate = trim($sCur[1]);
1595 $oCur->dec = trim($sCur[2]);
1596 $oCur->thousand = trim($sCur[3]);
1597 $oCur->sign = trim($sCur[4]);
1598 $oCur->decimal = trim($sCur[5]);
1601 if (isset($sCur[6])) {
1602 $oCur->side = trim($sCur[6]);
1605 if (isset($iCurrency) && $key == $iCurrency) {
1606 $oCur->selected = 1;
1608 $oCur->selected = 0;
1610 $aCurrencies[$key] = $oCur;
1619 return $aCurrencies;
1632 foreach ($aSearch as $oCur) {
1633 if ($oCur->name == $sName) {
1672 if ($sEdition ==
"CE") {
1673 return "Community Edition";
1688 $sVersion = $this->
getActiveShop()->oxshops__oxversion->value;
1701 $sRev = trim(@file_get_contents($sFileName));
1718 $sRev = @file_get_contents($sFileName);
1719 $sRev = str_replace(
"\n",
"<br>", $sRev);
1777 public function saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule =
'')
1779 switch ($sVarType) {
1782 $sValue = serialize($sVarVal);
1786 $sVarVal = (($sVarVal ==
'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal,
"false"));
1788 $sValue = $sVarVal ?
"1" :
"";
1811 $sShopIdQuoted = $oDb->quote($sShopId);
1812 $sModuleQuoted = $oDb->quote($sModule);
1813 $sVarNameQuoted = $oDb->quote($sVarName);
1814 $sVarTypeQuoted = $oDb->quote($sVarType);
1815 $sVarValueQuoted = $oDb->quote($sValue);
1816 $sConfigKeyQuoted = $oDb->quote($this->
getConfigParam(
'sConfigKey'));
1819 $sQ =
"delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
1822 $sQ =
"insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
1823 values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
1847 if ($sVarValue !== null) {
1854 $sQ =
"select oxvartype, " . $this->
getDecodeValueQuery() .
" as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = " . $oDb->quote($sVarName);
1855 $oRs = $oDb->select($sQ);
1858 if ($oRs !=
false && $oRs->recordCount() > 0) {
1859 $sValue = $this->
decodeValue($oRs->fields[
'oxvartype'], $oRs->fields[
'oxvarvalue']);
1875 $sValue = $mOrigValue;
1879 $sValue = unserialize($mOrigValue);
1882 $sValue = ($mOrigValue ==
'true' || $mOrigValue ==
'1');
1898 return " DECODE( {$sFieldName}, '" . $this->
getConfigParam(
'sConfigKey') .
"') ";
1909 if (!isset($blProductive)) {
1910 $sQ =
'select oxproductive from oxshops where oxid = "' . $this->
getShopId() .
'"';
1911 $blProductive = ( bool )
oxDb::getDb()->getOne($sQ);
1915 return $blProductive;
1928 return 'oxbaseshop';
1938 if ($this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
1944 $this->_oActShop =
oxNew(
'oxshop');
1945 $this->_oActShop->load($this->
getShopId());
1957 if (count($this->_aActiveViews)) {
1958 $oActView = end($this->_aActiveViews);
1960 if (!isset($oActView) || $oActView == null) {
1961 $oActView =
oxNew(
'oxubase');
1962 $this->_aActiveViews[] = $oActView;
1975 if (count($this->_aActiveViews)) {
1976 return reset($this->_aActiveViews);
1999 $this->_aActiveViews[] = $oView;
2007 array_pop($this->_aActiveViews);
2017 return (count($this->_aActiveViews) > 1);
2031 $aNames[] = $oView->getClassName();
2067 return (
bool) isset($this->_aThemeConfigParams[$sName]);
2111 $aModuleArray = array();
2113 if (is_array($aModules)) {
2114 foreach ($aModules as $sClass => $sModuleChain) {
2115 if (strstr($sModuleChain,
'&')) {
2116 $aModuleChain = explode(
'&', $sModuleChain);
2118 $aModuleChain = array($sModuleChain);
2120 $aModuleArray[$sClass] = $aModuleChain;
2124 return $aModuleArray;
2134 return oxDb::getDb()->getCol(
"SELECT `oxid` FROM `oxshops`");
2148 $sLanguageUrl = null;
2149 $sConfigParameter = $blSSL ?
'aLanguageSSLURLs' :
'aLanguageURLs';
2152 if (isset($iLang) && isset($aLanguageURLs[$iLang]) && !empty($aLanguageURLs[$iLang])) {
2154 $sLanguageUrl = $aLanguageURLs[$iLang];
2157 return $sLanguageUrl;
2170 $sConfigParameter = $blSSL ?
'sMallSSLShopURL' :
'sMallShopURL';
2172 if ($sMallShopURL) {
2174 $sUrl = $sMallShopURL;
2190 if (defined(
'OXID_PHP_UNIT')) {
2192 } elseif (0 != $this->
iDebug) {
2195 header(
"HTTP/1.1 500 Internal Server Error");
2196 header(
"Location: offline.html");
2197 header(
"Connection: close");