4 define(
'MAX_64BIT_INTEGER',
'18446744073709551615' );
132 'oxlinks',
'oxvoucherseries',
'oxmanufacturers',
133 'oxnews',
'oxselectlist',
'oxwrapping',
134 'oxdeliveryset',
'oxdelivery',
'oxvendor',
'oxobject2category');
306 if ( defined(
'OXID_PHP_UNIT' ) ) {
307 if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
308 $sValue = modConfig::$unitMOD->getModConfigParam( $sName );
309 if ( $sValue !== null ) {
317 if ( isset ( $this->_aConfigParams[$sName] ) ) {
318 return $this->_aConfigParams[$sName];
321 if ( isset( $this->$sName ) ) {
322 return $this->$sName;
337 if ( isset( $this->$sName ) ) {
338 $this->$sName = $sValue;
340 $this->_aConfigParams[$sName] = $sValue;
353 oxNew(
'oxSeoDecoder')->processSeoCall();
367 if ($this->_blInit) {
370 $this->_blInit =
true;
374 include getShopBasePath().
'core/oxconfk.php';
377 global $ADODB_SESS_LIFE;
378 $ADODB_SESS_LIFE = 1;
388 if ( empty($sShopID) || !$blConfigLoaded ) {
390 $oEx =
oxNew(
"oxConnectionException" );
391 $oEx->setMessage(
"Unable to load shop config values from database" );
416 if ( defined(
'OX_ADMIN_DIR') ) {
423 $this->_oStart =
new oxStart();
424 $this->_oStart->appInit();
452 include getShopBasePath().
'/config.inc.php';
481 $blLogChangesInAdmin = $this->
getConfigParam(
'blLogChangesInAdmin' );
482 if( !isset( $blLogChangesInAdmin ) )
486 if( !isset( $blCheckTemplates ) )
489 $blAllowArticlesubclass = $this->
getConfigParam(
'blAllowArticlesubclass' );
490 if( !isset( $blAllowArticlesubclass ) )
494 if( !isset( $iAdminListSize ) )
499 if ( !isset( $iPicCount ) )
503 if ( !isset( $iZoomPicCount ) )
508 if ( !isset( $iDBCacheLifeTime ) )
522 $sCustConfig = getShopBasePath().
'/cust_config.inc.php';
523 if ( is_readable( $sCustConfig ) ) {
524 include $sCustConfig;
541 if ( !empty($sModule) ) {
542 $sModuleSql =
" oxmodule LIKE " . $oDb->quote($sModule.
"%");
544 $sModuleSql =
" oxmodule='' ";
547 $sQ =
"select oxvarname, oxvartype, ".$this->getDecodeValueQuery().
" as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
549 if ( $aOnlyVars !== null ) {
552 foreach ( $aOnlyVars as $sField ) {
556 $sIn .=
'"'.$sField.
'"';
559 $sQ .=
' and oxvarname in ( '.$sIn.
' ) ';
561 $oRs = $oDb->select( $sQ );
563 if ( $oRs !=
false && $oRs->recordCount() > 0 ) {
564 while ( !$oRs->EOF ) {
565 $sVarName = $oRs->fields[0];
566 $sVarType = $oRs->fields[1];
567 $sVarVal = $oRs->fields[2];
570 if ( ( $sVarName ==
'sShopURL' || $sVarName ==
'sSSLShopURL' ) &&
571 ( !$sVarVal || $this->
isAdmin() === true ) ) {
579 if ( $sModule !=
'' ) {
580 $this->_aThemeConfigParams[$sVarName] = $sModule;
603 switch ( $sVarType ) {
609 $this->
setConfigParam( $sVarName, ( $sVarVal ==
'true' || $sVarVal ==
'1' ) );
629 return $this->_oStart->pageClose();
662 if ( defined(
'OXID_PHP_UNIT' ) ) {
663 if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
669 if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
682 if ( isset( $_POST[$sName] ) ) {
683 $sValue = $_POST[$sName];
684 } elseif ( isset( $_GET[$sName] ) ) {
685 $sValue = $_GET[$sName];
689 $blIsAdmin = $this->
isAdmin() && $this->
getSession()->getVariable(
"blIsAdmin" );
690 if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
706 return $_FILES[$sParamName];
719 $this->_aGlobalParams[$sName] = $sValue;
731 if ( isset( $this->_aGlobalParams[$sName] ) ) {
732 return $this->_aGlobalParams[$sName];
765 if ( is_object( $sValue ) ) {
769 if ( is_array( $sValue ) ) {
771 foreach ( $sValue as $sKey => $sVal ) {
773 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
776 if ($sValidKey != $sKey) {
777 unset ($sValue[$sKey]);
780 $newValue[$sValidKey] = $sVal;
783 } elseif ( is_string( $sValue ) ) {
784 $sValue = str_replace( array(
'&',
'<',
'>',
'"',
"'", chr(0),
'\\',
"\n",
"\r" ),
785 array(
'&',
'<',
'>',
'"',
''',
'',
'\',
' ',
' ' ),
798 if ( $this->_iShopId !== null )
804 $this->
getSession()->setVariable(
'actshop', $this->_iShopId );
818 $this->
getSession()->setVariable(
'actshop', $sShopId );
819 $this->_iShopId = $sShopId;
833 $this->_blIsSsl = $blIsSsl;
844 $aServerVars = $myUtilsServer->getServerVar();
845 $aHttpsServerVar = $myUtilsServer->getServerVar(
'HTTPS' );
848 if (isset( $aHttpsServerVar ) && ($aHttpsServerVar ===
'on' || $aHttpsServerVar ===
'ON' || $aHttpsServerVar ==
'1' )) {
851 if ($this->
isAdmin() && !$this->_blIsSsl) {
858 if ( isset( $aServerVars[
'HTTP_X_FORWARDED_SERVER'] ) &&
859 ( strpos( $aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'ssl' ) !==
false ||
860 strpos( $aServerVars[
'HTTP_X_FORWARDED_SERVER'],
'secure-online-shopping.de' ) !==
false ) ) {
874 if ( is_null( $this->_blIsSsl ) ) {
890 if ( !$sURL || (strpos( $sURL,
"http" ) !== 0)) {
907 if ( !$sURL || (strpos( $sURL,
"http" ) !== 0)) {
911 return (strpos( $sURL,
"https:" ) === 0) == $this->
isSsl();
925 $blAdmin = isset($blAdmin) ? $blAdmin : $this->
isAdmin();
996 if ($blAdmin===null) {
1000 if ($this->
isSsl()) {
1024 if ( $this->
isSsl() ) {
1025 $sURL = $this->getSSLShopURL( $iLang );
1027 $sURL = $this->getShopURL( $iLang );
1030 return oxRegistry::get(
"oxUtilsUrl")->processUrl( $sURL.
'index.php',
false );
1058 return oxRegistry::get(
'oxUtilsUrl')->processUrl($sUrl.
'widget.php',
false);
1081 $iCurr = $this->
getSession()->getVariable(
'currency' );
1084 return (
int) $iCurr;
1096 if ( !defined(
'OXID_PHP_UNIT' ) ) {
1097 if (!is_null($this->_oActCurrencyObject)) {
1104 if ( !isset( $aCurrencies[$iCur] ) ) {
1105 return $this->_oActCurrencyObject = reset( $aCurrencies );
1108 return $this->_oActCurrencyObject = $aCurrencies[$iCur];
1121 if ( isset( $aCurrencies[$iCur] ) ) {
1122 $this->
getSession()->setVariable(
'currency', $iCur );
1123 $this->_oActCurrencyObject = null;
1139 return $this->_sOutDir.
'/';
1155 return 'application/views/';
1171 $sPath .=
'application/translations/';
1172 if ( is_readable( $sPath. $sDir.
'/'. $sFile ) ) {
1173 return $sPath. $sDir.
'/'. $sFile;
1190 return 'application/';
1203 public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg =
false )
1205 $blSSL = is_null($blSSL)?$this->
isSsl():$blSSL;
1206 $blAdmin = is_null($blAdmin)?$this->
isAdmin():$blAdmin;
1209 if ($blNativeImg && !$blAdmin) {
1213 if (!$sUrl && $blAdmin) {
1221 return $sUrl.$this->_sOutDir.
'/';
1238 public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute =
true, $blIgnoreCust =
false )
1240 if ( is_null($sTheme) ) {
1248 if ( $sDir != $this->_sTemplateDir ) {
1249 $sBase = $this->
getOutDir( $blAbsolute );
1258 if ( $iLang !==
false ) {
1261 if ( is_null( $iLang ) ) {
1262 $iLang = $oLang->getEditLanguage();
1265 $sLang = $oLang->getLanguageAbbr( $iLang );
1268 if ( is_null($iShop) ) {
1273 $sPath =
"{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
1274 $sCacheKey = $sPath .
"_{$blIgnoreCust}{$blAbsolute}";
1284 if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
1285 $sReturn = $this->
getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
1289 if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
1290 $sReturn = $sBase . $sPath;
1294 $sPath =
"$sTheme/$iShop/$sDir/$sFile";
1295 if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
1296 $sReturn = $sBase . $sPath;
1301 $sPath =
"$sTheme/$sLang/$sDir/$sFile";
1302 if ( !$sReturn && $iLang !==
false && is_readable( $sAbsBase.$sPath ) ) {
1303 $sReturn = $sBase . $sPath;
1307 $sPath =
"$sTheme/$sDir/$sFile";
1308 if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
1309 $sReturn = $sBase . $sPath;
1313 $sPath =
"$sLang/$sDir/$sFile";
1314 if ( !$sReturn && $iLang !==
false && is_readable( $sAbsBase.$sPath ) ) {
1315 $sReturn = $sBase . $sPath;
1319 $sPath =
"$sDir/$sFile";
1320 if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
1321 $sReturn = $sBase . $sPath;
1348 public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg =
false, $iLang = null , $iShop = null , $sTheme = null )
1350 $sUrl = str_replace(
1352 $this->
getOutUrl($blSSL, $blAdmin, $blNativeImg),
1353 $this->
getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
1369 return $this->
getDir( $sFile, $this->_sImageDir, $blAdmin );
1382 public function getImageUrl( $blAdmin =
false, $blSSL = null, $blNativeImg = null, $sFile = null )
1384 $blNativeImg = is_null($blNativeImg)?$this->
getConfigParam(
'blNativeImages' ):$blNativeImg;
1385 return $this->
getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
1397 return $this->
getDir( null, $this->_sImageDir, $blAdmin );
1411 public function getPicturePath($sFile, $blAdmin =
false, $iLang = null , $iShop = null , $sTheme = null)
1413 return $this->
getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
1425 return $this->
getDir( null, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin );
1438 return $this->
getDir( $sFile, $this->_sPictureDir .
"/" . $this->_sMasterPictureDir, $blAdmin );
1453 public function getPictureUrl( $sFile, $blAdmin =
false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic =
"master/nopic.jpg" )
1455 if ( $sAltUrl =
oxRegistry::get(
"oxPictureHandler")->getAltImageUrl(
'/', $sFile, $blSSL) ) {
1460 $sUrl = $this->
getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
1463 if ( !$sUrl && $sDefPic ) {
1464 $sUrl = $this->
getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
1478 return $this->
getDir( null, $this->_sPictureDir, $blAdmin );
1491 $sTemplatePath = $this->
getDir( $sFile, $this->_sTemplateDir, $blAdmin );
1493 if (!$sTemplatePath) {
1494 $sBasePath = getShopBasePath();
1497 $oModulelist =
oxNew(
'oxmodulelist');
1498 $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
1499 if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
1500 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
1501 if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
1502 $sPath = $aTemplates[$sFile];
1503 $sPath = $sBasePath.
'modules/'. $sPath;
1504 if (is_file($sPath) && is_readable($sPath)) {
1505 $sTemplatePath = $sPath;
1512 return $sTemplatePath;
1524 return $this->
getDir( null, $this->_sTemplateDir, $blAdmin );
1537 public function getTemplateUrl( $sFile = null, $blAdmin =
false, $blSSL = null , $iLang = null )
1539 return $this->
getShopMainUrl() . $this->
getDir( $sFile, $this->_sTemplateDir, $blAdmin, $iLang, null, null,
false );
1552 return str_replace( $this->_sTemplateDir.
'/',
'', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null,
false ));
1565 return $this->
getDir( $sFile, $this->_sResourceDir, $blAdmin );
1578 return $this->
getConfigParam(
'sShopDir') . $this->_sModulesDir .
'/';
1580 return $this->_sModulesDir .
'/';
1594 public function getResourceUrl( $sFile =
'', $blAdmin =
false , $blSSL = null , $iLang = null )
1597 return $this->
getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
1609 return $this->
getDir( null, $this->_sResourceDir, $blAdmin );
1622 if ( !is_array( $aConfCurrencies ) ) {
1626 if ( defined(
'OXID_PHP_UNIT' ) ) {
1627 if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
1630 if ( isset( $aAltCurrencies ) ) {
1631 $aConfCurrencies = $aAltCurrencies;
1640 $aCurrencies = array();
1641 reset( $aConfCurrencies );
1642 while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
1644 $oCur =
new stdClass();
1646 $sCur = explode(
'@', $val);
1647 $oCur->name = trim( $sCur[0] );
1648 $oCur->rate = trim( $sCur[1] );
1649 $oCur->dec = trim( $sCur[2] );
1650 $oCur->thousand = trim( $sCur[3] );
1651 $oCur->sign = trim( $sCur[4] );
1652 $oCur->decimal = trim( $sCur[5] );
1655 if ( isset( $sCur[6] ) ) {
1656 $oCur->side = trim($sCur[6]);
1659 if ( isset( $iCurrency) && $key == $iCurrency ) {
1660 $oCur->selected = 1;
1662 $oCur->selected = 0;
1664 $aCurrencies[$key]= $oCur;
1672 return $aCurrencies;
1685 foreach ( $aSearch as $oCur ) {
1686 if ( $oCur->name == $sName ) {
1725 if ($sEdition ==
"CE") {
1726 return "Community Edition";
1741 $sVersion = $this->
getActiveShop()->oxshops__oxversion->value;
1753 $sRev = trim(@file_get_contents($sFileName));
1770 $sRev = @file_get_contents($sFileName);
1771 $sRev = str_replace(
"\n",
"<br>", $sRev);
1819 public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule =
'' )
1821 switch ( $sVarType ) {
1824 $sValue = serialize( $sVarVal );
1828 $sVarVal = (( $sVarVal ==
'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal,
"false"));
1830 $sValue = $sVarVal?
"1":
"";
1853 $sShopIdQuoted = $oDb->quote($sShopId);
1854 $sModuleQuoted = $oDb->quote($sModule);
1855 $sVarNameQuoted = $oDb->quote($sVarName);
1856 $sVarTypeQuoted = $oDb->quote($sVarType);
1857 $sVarValueQuoted = $oDb->quote($sValue);
1858 $sConfigKeyQuoted = $oDb->quote($this->
getConfigParam(
'sConfigKey'));
1861 $sQ =
"delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
1862 $oDb->execute( $sQ );
1864 $sQ =
"insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
1865 values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
1866 $oDb->execute( $sQ );
1890 if ( $sVarValue !== null ) {
1897 $sQ =
"select oxvartype, ".$this->getDecodeValueQuery().
" as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
1898 $oRs = $oDb->select( $sQ );
1901 if ( $oRs !=
false && $oRs->recordCount() > 0 ) {
1902 $sValue = $this->
decodeValue( $oRs->fields[
'oxvartype'], $oRs->fields[
'oxvarvalue'] );
1917 $sValue = $mOrigValue;
1921 $sValue = unserialize( $mOrigValue );
1924 $sValue = ( $mOrigValue ==
'true' || $mOrigValue ==
'1' );
1940 return " DECODE( {$sFieldName}, '".$this->getConfigParam(
'sConfigKey' ).
"') ";
1950 $blProductive =
false;
1953 if ( !isset( $blProductive ) ) {
1954 $sQ =
'select oxproductive from oxshops where oxid = "'.$this->getShopId().
'"';
1955 $blProductive = ( bool )
oxDb::getDb()->getOne( $sQ );
1959 return $blProductive;
1972 return 'oxbaseshop';
1982 if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
1987 $this->_oActShop =
oxNew(
'oxshop' );
1988 $this->_oActShop->load( $this->
getShopId() );
1999 if ( count( $this->_aActiveViews ) ) {
2000 $oActView = end( $this->_aActiveViews );
2002 if ( $oActView == null ) {
2003 $oActView =
oxNew(
'oxubase' );
2004 $this->_aActiveViews[] = $oActView;
2017 if ( count( $this->_aActiveViews ) ) {
2018 return reset( $this->_aActiveViews );
2043 $this->_aActiveViews[] = $oView;
2053 array_pop( $this->_aActiveViews );
2063 return ( count( $this->_aActiveViews ) > 1 );
2077 $aNames[] = $oView->getClassName();
2113 return (
bool) isset( $this->_aThemeConfigParams[$sName] );
2145 $aModuleArray = array();
2147 if (is_array($aModules)) {
2148 foreach ($aModules as $sClass => $sModuleChain) {
2149 if (strstr($sModuleChain,
'&')) {
2150 $aModuleChain = explode(
'&', $sModuleChain);
2152 $aModuleChain = array($sModuleChain);
2154 $aModuleArray[$sClass] = $aModuleChain;
2158 return $aModuleArray;
2168 return oxDb::getDb()->getCol(
"SELECT `oxid` FROM `oxshops`" );
2182 $sLanguageUrl = null;
2183 $sConfigParameter = $blSSL ?
'aLanguageSSLURLs' :
'aLanguageURLs';
2186 if (isset($iLang) && isset($aLanguageURLs[$iLang]) && !empty($aLanguageURLs[$iLang])) {
2188 $sLanguageUrl = $aLanguageURLs[$iLang];
2191 return $sLanguageUrl;
2204 $sConfigParameter = $blSSL ?
'sMallSSLShopURL' :
'sMallShopURL';
2206 if ($sMallShopURL) {
2208 $sUrl = $sMallShopURL;
2223 if ( defined(
'OXID_PHP_UNIT' ) ) {
2225 } elseif ( 0 != $this->
iDebug ) {
2228 header(
"HTTP/1.1 500 Internal Server Error");
2229 header(
"Location: offline.html");
2230 header(
"Connection: close");