4 define(
'MAX_64BIT_INTEGER',
'18446744073709551615');
133 'oxlinks',
'oxvoucherseries',
'oxmanufacturers',
137 'oxselectlist',
'oxwrapping',
138 'oxdeliveryset',
'oxdelivery',
'oxvendor',
'oxobject2category');
302 if (defined(
'OXID_PHP_UNIT')) {
303 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
304 $sValue = modConfig::$unitMOD->getModConfigParam($sName);
305 if ($sValue !== null) {
313 if (isset ($this->_aConfigParams[$sName])) {
314 return $this->_aConfigParams[$sName];
317 if (isset($this->$sName)) {
318 return $this->$sName;
330 if (isset($this->$sName)) {
331 $this->$sName = $sValue;
333 $this->_aConfigParams[$sName] = $sValue;
344 oxNew(
'oxSeoDecoder')->processSeoCall();
358 if ($this->_blInit) {
361 $this->_blInit =
true;
365 include getShopBasePath() .
'core/oxconfk.php';
369 global $ADODB_SESS_LIFE;
370 $ADODB_SESS_LIFE = 1;
381 if (empty($sShopID) || !$blConfigLoaded) {
384 $oEx->setMessage(
"Unable to load shop config values from database");
409 if (defined(
'OX_ADMIN_DIR')) {
416 $this->_oStart =
new oxStart();
417 $this->_oStart->appInit();
431 include getShopBasePath() .
'/config.inc.php';
501 $sCustConfig = getShopBasePath() .
'/cust_config.inc.php';
502 if (is_readable($sCustConfig)) {
503 include $sCustConfig;
520 $sModuleSql = $sModule ?
" oxmodule LIKE " . $oDb->quote($sModule .
"%") :
" oxmodule='' ";
526 where oxshopid = '$sShopID' and " . $sModuleSql . $sOnlyVarsSql;
528 $aResult = $oDb->getAll($sSelect);
530 foreach ($aResult as $aValue) {
531 $sVarName = $aValue[0];
532 $sVarType = $aValue[1];
533 $sVarVal = $aValue[2];
539 $this->_aThemeConfigParams[$sVarName] = $sModule;
543 return (
bool) count($aResult);
556 if (is_array($aVars) && !empty($aVars)) {
557 foreach ($aVars as &$sField) {
558 $sField =
'"' . $sField .
'"';
560 $sSelect =
' and oxvarname in ( ' . implode(
', ', $aVars) .
' ) ';
578 if (($sVarName ==
'sShopURL' || $sVarName ==
'sSSLShopURL') &&
579 (!$sVarVal || $this->
isAdmin() ===
true)
590 $this->
setConfigParam($sVarName, ($sVarVal ==
'true' || $sVarVal ==
'1'));
610 return $this->_oStart->pageClose();
626 if (defined(
'OXID_PHP_UNIT')) {
627 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
632 $blIsAdmin = modConfig::getInstance()->isAdmin() || modSession::getInstance()->getVariable(
"blIsAdmin");
633 if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
646 if (isset($_POST[$sName])) {
647 $sValue = $_POST[$sName];
648 } elseif (isset($_GET[$sName])) {
649 $sValue = $_GET[$sName];
654 if ($sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
670 return $_FILES[$sParamName];
681 $this->_aGlobalParams[$sName] = $sValue;
693 if (isset($this->_aGlobalParams[$sName])) {
694 return $this->_aGlobalParams[$sName];
711 if (is_object($sValue)) {
715 if (is_array($sValue)) {
717 foreach ($sValue as $sKey => $sVal) {
719 if (!$aRaw || !in_array($sKey, $aRaw)) {
722 if ($sValidKey != $sKey) {
723 unset ($sValue[$sKey]);
726 $newValue[$sValidKey] = $sVal;
729 } elseif (is_string($sValue)) {
730 $sValue = str_replace(
731 array(
'&',
'<',
'>',
'"',
"'", chr(0),
'\\',
"\n",
"\r"),
732 array(
'&',
'<',
'>',
'"',
''',
'',
'\',
' ',
' '),
750 $this->
getSession()->setVariable(
'actshop', $sShopId);
751 $this->_iShopId = $sShopId;
761 if ($this->_iShopId !== null) {
768 $this->
getSession()->setVariable(
'actshop', $this->_iShopId);
783 $this->_blIsSsl = $blIsSsl;
792 $aServerVars = $myUtilsServer->getServerVar();
793 $aHttpsServerVar = $myUtilsServer->getServerVar(
'HTTPS');
796 if (isset($aHttpsServerVar) && ($aHttpsServerVar ===
'on' || $aHttpsServerVar ===
'ON' || $aHttpsServerVar ==
'1')) {
799 if ($this->
isAdmin() && !$this->_blIsSsl) {
806 if (isset($aServerVars[
'HTTP_X_FORWARDED_SERVER']) &&
807 (strpos($aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'ssl') !==
false ||
808 strpos($aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'secure-online-shopping.de') !==
false)
822 if (is_null($this->_blIsSsl)) {
839 if (!$sURL || (strpos($sURL,
"http") !== 0)) {
856 if (!$sURL || (strpos($sURL,
"http") !== 0)) {
860 return (strpos($sURL,
"https:") === 0) == $this->
isSsl();
874 $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
945 if ($blAdmin === null) {
949 if ($this->
isSsl()) {
974 if ($this->
isSsl()) {
975 $sURL = $this->getSSLShopURL($iLang);
977 $sURL = $this->getShopURL($iLang);
980 return oxRegistry::get(
"oxUtilsUrl")->processUrl($sURL .
'index.php',
false);
1008 return oxRegistry::get(
'oxUtilsUrl')->processUrl($sUrl .
'widget.php',
false);
1031 $iCurr = $this->
getSession()->getVariable(
'currency');
1035 return (
int) $iCurr;
1047 if (!defined(
'OXID_PHP_UNIT')) {
1048 if (!is_null($this->_oActCurrencyObject)) {
1055 if (!isset($aCurrencies[$iCur])) {
1056 return $this->_oActCurrencyObject = reset($aCurrencies);
1059 return $this->_oActCurrencyObject = $aCurrencies[$iCur];
1070 if (isset($aCurrencies[$iCur])) {
1071 $this->
getSession()->setVariable(
'currency', $iCur);
1072 $this->_oActCurrencyObject = null;
1086 return $this->
getConfigParam(
'sShopDir') . $this->_sOutDir .
'/';
1088 return $this->_sOutDir .
'/';
1104 return 'application/views/';
1120 $sPath .=
'application/translations/';
1121 if (is_readable($sPath . $sDir .
'/' . $sFile)) {
1122 return $sPath . $sDir .
'/' . $sFile;
1140 return 'application/';
1153 public function getOutUrl($blSSL = null, $blAdmin = null, $blNativeImg =
false)
1155 $blSSL = is_null($blSSL) ? $this->
isSsl() : $blSSL;
1156 $blAdmin = is_null($blAdmin) ? $this->
isAdmin() : $blAdmin;
1159 if ($blNativeImg && !$blAdmin) {
1163 if (!$sUrl && $blAdmin) {
1171 return $sUrl . $this->_sOutDir .
'/';
1188 public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute =
true, $blIgnoreCust =
false)
1190 if (is_null($sTheme)) {
1198 if ($sDir != $this->_sTemplateDir) {
1208 if ($iLang !==
false) {
1211 if (is_null($iLang)) {
1212 $iLang = $oLang->getEditLanguage();
1215 $sLang = $oLang->getLanguageAbbr($iLang);
1218 if (is_null($iShop)) {
1223 $sPath =
"{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
1224 $sCacheKey = $sPath .
"_{$blIgnoreCust}{$blAbsolute}";
1234 if (!$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
1235 $sReturn = $this->
getDir($sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute);
1239 if (!$sReturn && !$blAdmin && is_readable($sAbsBase . $sPath)) {
1240 $sReturn = $sBase . $sPath;
1244 $sPath =
"$sTheme/$iShop/$sDir/$sFile";
1245 if (!$sReturn && !$blAdmin && is_readable($sAbsBase . $sPath)) {
1246 $sReturn = $sBase . $sPath;
1251 $sPath =
"$sTheme/$sLang/$sDir/$sFile";
1252 if (!$sReturn && $iLang !==
false && is_readable($sAbsBase . $sPath)) {
1253 $sReturn = $sBase . $sPath;
1257 $sPath =
"$sTheme/$sDir/$sFile";
1258 if (!$sReturn && is_readable($sAbsBase . $sPath)) {
1259 $sReturn = $sBase . $sPath;
1263 $sPath =
"$sLang/$sDir/$sFile";
1264 if (!$sReturn && $iLang !==
false && is_readable($sAbsBase . $sPath)) {
1265 $sReturn = $sBase . $sPath;
1269 $sPath =
"$sDir/$sFile";
1270 if (!$sReturn && is_readable($sAbsBase . $sPath)) {
1271 $sReturn = $sBase . $sPath;
1298 public function getUrl($sFile, $sDir, $blAdmin = null, $blSSL = null, $blNativeImg =
false, $iLang = null, $iShop = null, $sTheme = null)
1300 $sUrl = str_replace(
1302 $this->
getOutUrl($blSSL, $blAdmin, $blNativeImg),
1303 $this->
getDir($sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme)
1319 return $this->
getDir($sFile, $this->_sImageDir, $blAdmin);
1332 public function getImageUrl($blAdmin =
false, $blSSL = null, $blNativeImg = null, $sFile = null)
1334 $blNativeImg = is_null($blNativeImg) ? $this->
getConfigParam(
'blNativeImages') : $blNativeImg;
1336 return $this->
getUrl($sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg);
1348 return $this->
getDir(null, $this->_sImageDir, $blAdmin);
1362 public function getPicturePath($sFile, $blAdmin =
false, $iLang = null, $iShop = null, $sTheme = null)
1364 return $this->
getDir($sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme);
1376 return $this->
getDir(null, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin);
1389 return $this->
getDir($sFile, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin);
1404 public function getPictureUrl($sFile, $blAdmin =
false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic =
"master/nopic.jpg")
1406 if ($sAltUrl =
oxRegistry::get(
"oxPictureHandler")->getAltImageUrl(
'/', $sFile, $blSSL)) {
1411 $sUrl = $this->
getUrl($sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
1414 if (!$sUrl && $sDefPic) {
1415 $sUrl = $this->
getUrl($sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId);
1430 return $this->
getDir(null, $this->_sPictureDir, $blAdmin);
1443 $sTemplatePath = $this->
getDir($sFile, $this->_sTemplateDir, $blAdmin);
1445 if (!$sTemplatePath) {
1446 $sBasePath = getShopBasePath();
1449 $oModulelist =
oxNew(
'oxmodulelist');
1450 $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
1451 if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
1452 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
1453 if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
1454 $sPath = $aTemplates[$sFile];
1455 $sPath = $sBasePath .
'modules/' . $sPath;
1456 if (is_file($sPath) && is_readable($sPath)) {
1457 $sTemplatePath = $sPath;
1464 return $sTemplatePath;
1476 return $this->
getDir(null, $this->_sTemplateDir, $blAdmin);
1489 public function getTemplateUrl($sFile = null, $blAdmin =
false, $blSSL = null, $iLang = null)
1491 return $this->
getShopMainUrl() . $this->
getDir($sFile, $this->_sTemplateDir, $blAdmin, $iLang, null, null,
false);
1504 return str_replace($this->_sTemplateDir .
'/',
'', $this->
getDir(null, $this->_sTemplateDir, $blAdmin, null, null, null,
false));
1517 return $this->
getDir($sFile, $this->_sResourceDir, $blAdmin);
1530 return $this->
getConfigParam(
'sShopDir') . $this->_sModulesDir .
'/';
1532 return $this->_sModulesDir .
'/';
1546 public function getResourceUrl($sFile =
'', $blAdmin =
false, $blSSL = null, $iLang = null)
1550 return $this->
getUrl($sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang);
1562 return $this->
getDir(null, $this->_sResourceDir, $blAdmin);
1575 if (!is_array($aConfCurrencies)) {
1579 if (defined(
'OXID_PHP_UNIT')) {
1580 if (isset(modConfig::$unitMOD) && is_object(modConfig::$unitMOD)) {
1582 $aAltCurrencies = modConfig::getInstance()->getConfigParam(
'modaCurrencies');
1583 if (isset($aAltCurrencies)) {
1584 $aConfCurrencies = $aAltCurrencies;
1593 $aCurrencies = array();
1594 reset($aConfCurrencies);
1595 while (list($key, $val) = each($aConfCurrencies)) {
1597 $oCur =
new stdClass();
1599 $sCur = explode(
'@', $val);
1600 $oCur->name = trim($sCur[0]);
1601 $oCur->rate = trim($sCur[1]);
1602 $oCur->dec = trim($sCur[2]);
1603 $oCur->thousand = trim($sCur[3]);
1604 $oCur->sign = trim($sCur[4]);
1605 $oCur->decimal = trim($sCur[5]);
1608 if (isset($sCur[6])) {
1609 $oCur->side = trim($sCur[6]);
1612 if (isset($iCurrency) && $key == $iCurrency) {
1613 $oCur->selected = 1;
1615 $oCur->selected = 0;
1617 $aCurrencies[$key] = $oCur;
1626 return $aCurrencies;
1639 foreach ($aSearch as $oCur) {
1640 if ($oCur->name == $sName) {
1679 if ($sEdition ==
"CE") {
1680 return "Community Edition";
1695 $sVersion = $this->
getActiveShop()->oxshops__oxversion->value;
1708 $sRev = trim(@file_get_contents($sFileName));
1725 $sRev = @file_get_contents($sFileName);
1726 $sRev = str_replace(
"\n",
"<br>", $sRev);
1784 public function saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule =
'')
1786 switch ($sVarType) {
1789 $sValue = serialize($sVarVal);
1793 $sVarVal = (($sVarVal ==
'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal,
"false"));
1795 $sValue = $sVarVal ?
"1" :
"";
1817 $sShopIdQuoted = $oDb->quote($sShopId);
1818 $sModuleQuoted = $oDb->quote($sModule);
1819 $sVarNameQuoted = $oDb->quote($sVarName);
1820 $sVarTypeQuoted = $oDb->quote($sVarType);
1821 $sVarValueQuoted = $oDb->quote($sValue);
1822 $sConfigKeyQuoted = $oDb->quote($this->
getConfigParam(
'sConfigKey'));
1825 $sQ =
"delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
1828 $sQ =
"insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
1829 values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
1853 if ($sVarValue !== null) {
1860 $sQ =
"select oxvartype, " . $this->
getDecodeValueQuery() .
" as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = " . $oDb->quote($sVarName);
1861 $oRs = $oDb->select($sQ);
1864 if ($oRs !=
false && $oRs->recordCount() > 0) {
1865 $sValue = $this->
decodeValue($oRs->fields[
'oxvartype'], $oRs->fields[
'oxvarvalue']);
1881 $sValue = $mOrigValue;
1885 $sValue = unserialize($mOrigValue);
1888 $sValue = ($mOrigValue ==
'true' || $mOrigValue ==
'1');
1904 return " DECODE( {$sFieldName}, '" . $this->
getConfigParam(
'sConfigKey') .
"') ";
1915 if (!isset($blProductive)) {
1916 $sQ =
'select oxproductive from oxshops where oxid = "' . $this->
getShopId() .
'"';
1917 $blProductive = ( bool )
oxDb::getDb()->getOne($sQ);
1921 return $blProductive;
1934 return 'oxbaseshop';
1944 if ($this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
1950 $this->_oActShop =
oxNew(
'oxshop');
1951 $this->_oActShop->load($this->
getShopId());
1963 if (count($this->_aActiveViews)) {
1964 $oActView = end($this->_aActiveViews);
1966 if (!isset($oActView) || $oActView == null) {
1967 $oActView =
oxNew(
'oxubase');
1968 $this->_aActiveViews[] = $oActView;
1981 if (count($this->_aActiveViews)) {
1982 return reset($this->_aActiveViews);
2005 $this->_aActiveViews[] = $oView;
2013 array_pop($this->_aActiveViews);
2023 return (count($this->_aActiveViews) > 1);
2037 $aNames[] = $oView->getClassName();
2073 return (
bool) isset($this->_aThemeConfigParams[$sName]);
2117 $aModuleArray = array();
2119 if (is_array($aModules)) {
2120 foreach ($aModules as $sClass => $sModuleChain) {
2121 if (strstr($sModuleChain,
'&')) {
2122 $aModuleChain = explode(
'&', $sModuleChain);
2124 $aModuleChain = array($sModuleChain);
2126 $aModuleArray[$sClass] = $aModuleChain;
2130 return $aModuleArray;
2140 return oxDb::getDb()->getCol(
"SELECT `oxid` FROM `oxshops`");
2154 $sLanguageUrl = null;
2155 $sConfigParameter = $blSSL ?
'aLanguageSSLURLs' :
'aLanguageURLs';
2158 if (isset($iLang) && isset($aLanguageURLs[$iLang]) && !empty($aLanguageURLs[$iLang])) {
2160 $sLanguageUrl = $aLanguageURLs[$iLang];
2163 return $sLanguageUrl;
2176 $sConfigParameter = $blSSL ?
'sMallSSLShopURL' :
'sMallShopURL';
2178 if ($sMallShopURL) {
2180 $sUrl = $sMallShopURL;
2196 if (defined(
'OXID_PHP_UNIT')) {
2198 } elseif (0 != $this->
iDebug) {
2201 header(
"HTTP/1.1 500 Internal Server Error");
2202 header(
"Location: offline.html");
2203 header(
"Connection: close");