28 'OXSELECTLIST' =>
'OXIDENT');
94 protected $_aInfoMap = array(
"php_version" =>
"PHP_version_at_least_5.2.10",
95 "lib_xml2" =>
"LIB_XML2",
97 "open_ssl" =>
"OpenSSL",
101 "tokenizer" =>
"Tokenizer",
102 "mysql_connect" =>
"MySQL_client_connector_for_MySQL_5",
103 "gd_info" =>
"GDlib_v2_.5Bv1.5D_incl._JPEG_support",
104 "mb_string" =>
"mbstring",
105 "bc_math" =>
"BCMath",
106 "allow_url_fopen" =>
"allow_url_fopen_or_fsockopen_to_port_80",
107 "php4_compat" =>
"Zend_compatibility_mode_must_be_off",
108 "request_uri" =>
"REQUEST_URI_set",
109 "ini_set" =>
"ini_set_allowed",
110 "register_globals" =>
"register_globals_must_be_off",
111 "memory_limit" =>
"PHP_Memory_limit_.28min._14MB.2C_30MB_recommended.29",
112 "unicode_support" =>
"UTF-8_support",
113 "file_uploads" =>
"file_uploads_on",
114 "mod_rewrite" =>
"apache_mod_rewrite_module",
115 "server_permissions" =>
"Files_.26_Folder_Permission_Setup",
116 "zend_optimizer" =>
"Zend_Optimizer",
117 "bug53632" =>
"Not_recommended_PHP_versions",
118 "session_autostart" =>
"session.auto_start_must_be_off",
152 public function __call( $sMethod, $aArgs )
154 if ( defined(
'OXID_PHP_UNIT' ) ) {
155 if ( substr( $sMethod, 0, 4) ==
"UNIT" ) {
156 $sMethod = str_replace(
"UNIT",
"_", $sMethod );
158 if ( method_exists( $this, $sMethod)) {
159 return call_user_func_array( array( & $this, $sMethod ), $aArgs );
163 throw new oxSystemComponentException(
"Function '$sMethod' does not exist or is not accessible! (" . get_class($this) .
")".PHP_EOL);
193 if ( $this->_aRequiredModules == null ) {
194 $aRequiredPHPExtensions = array(
210 $aRequiredPHPConfigs = array(
222 $aRequiredServerConfigs = array(
224 'server_permissions',
230 $aRequiredServerConfigs[] =
'mysql_version';
232 $this->_aRequiredModules = array_fill_keys( $aRequiredPHPExtensions,
'php_extennsions' ) +
233 array_fill_keys( $aRequiredPHPConfigs,
'php_config' ) +
234 array_fill_keys( $aRequiredServerConfigs,
'server_config' );
254 if ( version_compare( PHP_VERSION,
"5.3",
">=" ) ) {
255 if ( version_compare( PHP_VERSION,
"5.3.5",
">=" ) && version_compare( PHP_VERSION,
"5.3.7",
"!=" ) ) {
258 } elseif ( version_compare( PHP_VERSION,
'5.2',
">=" ) ) {
259 $iState = version_compare( PHP_VERSION,
"5.2.17",
">=" ) ? 2 : $iState;
271 return extension_loaded(
'curl' ) ? 2 : 1;
281 return extension_loaded(
'mbstring' ) ? 2 : 1;
297 $sPath = $sPath ? $sPath : getShopBasePath();
300 $sFullPath = $sPath .
"config.inc.php";
301 if ( !is_readable( $sFullPath ) ||
302 ( $this->
isAdmin() && is_writable( $sFullPath ) ) ||
303 ( !$this->
isAdmin() && !is_writable( $sFullPath ) )
308 $sTmp =
"$sPath/tmp$sVerPrefix/";
309 if (class_exists(
'oxConfig')) {
310 $sCfgTmp = $this->
getConfig()->getConfigParam(
'sCompileDir');
311 if (strpos($sCfgTmp,
'<sCompileDir_') ===
false) {
316 $aPathsToCheck = array(
317 $sPath.
"out/pictures{$sVerPrefix}/promo/",
318 $sPath.
"out/pictures{$sVerPrefix}/master/",
319 $sPath.
"out/pictures{$sVerPrefix}/generated/",
320 $sPath.
"out/pictures{$sVerPrefix}/media/",
326 $sPathToCheck = reset( $aPathsToCheck );
327 while ( $sPathToCheck ) {
329 if ( !file_exists( $sPathToCheck ) ) {
334 if ( is_dir( $sPathToCheck ) ) {
336 $aSubF = glob( $sPathToCheck.
"*", GLOB_ONLYDIR );
337 if (is_array($aSubF)) {
338 foreach ( $aSubF as $sNewFolder ) {
339 $aPathsToCheck[] = $sNewFolder .
"/";
346 if ( !is_readable( $sPathToCheck ) || !is_writable( $sPathToCheck ) ) {
351 $sPathToCheck = next( $aPathsToCheck );
365 $sShopURL = $this->
getConfig()->getConfigParam(
'sShopURL' );
366 if (preg_match(
'#^(https?://)?([^/:]+)(:([0-9]+))?(/.*)?$#i', $sShopURL, $m)) {
369 $blSsl = (strtolower($m[1])==
'https://');
371 $iPort = $blSsl?443:80;
373 $sScript = rtrim($m[5],
'/').
'/';
393 $sSSLShopURL = $this->
getConfig()->getConfigParam(
'sSSLShopURL' );
394 if (preg_match(
'#^(https?://)?([^/:]+)(:([0-9]+))?(/.*)?$#i', $sSSLShopURL, $m)) {
397 $blSsl = (strtolower($m[1])==
'https://');
399 $iPort = $blSsl?443:80;
401 $sScript = rtrim($m[5],
'/').
'/';
421 $sScript = $_SERVER[
'SCRIPT_NAME'];
422 $iPort = (int) $_SERVER[
'SERVER_PORT'];
423 $blSsl = (isset($_SERVER[
'HTTPS']) && ($_SERVER[
'HTTPS'] ==
'on'));
425 $iPort = $blSsl?443:80;
427 $sScript = rtrim(dirname(dirname( $sScript )),
'/').
'/';
429 'host'=>$_SERVER[
'HTTP_HOST'],
478 if ( 0 != $iModStat && $aSSLHostInfo ) {
482 if ( 0 == $iSSLModStat ) {
484 } elseif ( 1 == $iSSLModStat || 1 == $iModStat ) {
488 return min( $iModStat, $iSSLModStat );
504 if ( $rFp = @fsockopen( ($aHostInfo[
'ssl']?
'ssl://':
'').$aHostInfo[
'host'], $aHostInfo[
'port'], $iErrNo, $sErrStr, 10 ) ) {
505 $sReq =
"POST {$aHostInfo['dir']}oxseo.php?mod_rewrite_module_is=off HTTP/1.1\r\n";
506 $sReq .=
"Host: {$aHostInfo['host']}\r\n";
507 $sReq .=
"User-Agent: OXID eShop setup\r\n";
508 $sReq .=
"Content-Type: application/x-www-form-urlencoded\r\n";
509 $sReq .=
"Content-Length: 0\r\n";
510 $sReq .=
"Connection: close\r\n\r\n";
513 fwrite( $rFp, $sReq );
514 while ( !feof( $rFp ) ) {
515 $sOut .= fgets( $rFp, 100 );
519 $iModStat = ( strpos( $sOut,
'mod_rewrite_on' ) !== false ) ? 2 : 0;
521 if ( function_exists(
'apache_get_modules' ) ) {
523 $iModStat = in_array(
'mod_rewrite', apache_get_modules() ) ? 1 : 0;
538 $iModStat = @ini_get(
'allow_url_fopen');
539 $iModStat = ( $iModStat && strcasecmp(
'1', $iModStat ) ) ? 2 : 1;
540 if ( $iModStat == 1 ) {
543 if ( $oRes = @fsockopen(
'www.example.com', 80, $iErrNo, $sErrStr, 10 ) ) {
548 $iModStat = ( !$iModStat ) ? 1 : $iModStat;
560 $sZendStatus = ( strtolower( (
string) @ini_get(
'zend.ze1_compatibility_mode' ) ) );
561 return in_array( $sZendStatus, array(
'on',
'1' ) ) ? 0 : 2;
574 $iModStat = ( version_compare( PHP_VERSION,
'5.2',
'<' ) ) ? 0 :
false;
575 $iModStat = ( $iModStat !== false ) ? $iModStat : ( (version_compare( PHP_VERSION,
'5.2.0',
'>=' ) && version_compare( PHP_VERSION,
'5.2.10',
'<' )) ? 1 :
false );
576 $iModStat = ( $iModStat !== false ) ? $iModStat : ( version_compare( PHP_VERSION,
'5.2.10',
'>=' ) ? 2 : 1 );
587 return ( isset( $_SERVER[
'REQUEST_URI'] ) || isset( $_SERVER[
'SCRIPT_URI'] ) ) ? 2 : 0;
597 return class_exists(
'DOMDocument' ) ? 2 : 0;
607 return class_exists(
'DOMDocument' ) ? 2 : 0;
617 return extension_loaded(
'json' ) ? 2 : 0;
627 return extension_loaded(
'iconv' ) ? 2 : 0;
637 return extension_loaded(
'tokenizer' ) ? 2 : 0;
647 return extension_loaded(
'bcmath' ) ? 2 : 1;
657 return extension_loaded(
'openssl' ) ? 2 : 1;
667 return extension_loaded(
'soap' ) ? 2 : 1;
678 $iModStat = ( extension_loaded(
'mysql' ) || extension_loaded(
'mysqli' ) || extension_loaded(
'pdo_mysql' ) ) ? 2 : 0;
682 $sClientVersion = mysql_get_client_info();
683 if (version_compare( $sClientVersion,
'5',
'<' )) {
685 if (version_compare( $sClientVersion,
'4',
'<' )) {
688 } elseif (version_compare($sClientVersion,
'5.0.36',
'>=') && version_compare($sClientVersion,
'5.0.38',
'<')) {
691 } elseif (version_compare($sClientVersion,
'5.0.40',
'>') && version_compare($sClientVersion,
'5.0.42',
'<')) {
695 if ( strpos($sClientVersion,
'mysqlnd') !==
false ) {
712 if ( $sVersion === null ) {
713 $aRez =
oxDb::getDb()->getAll(
"SHOW VARIABLES LIKE 'version'" );
714 foreach ( $aRez as $aRecord ) {
715 $sVersion = $aRecord[1];
721 if ( version_compare( $sVersion,
'5.0.3',
'>=' ) && version_compare( $sVersion,
'5.0.37',
'<>' ) ) {
735 $iModStat = extension_loaded(
'gd' ) ? 1 : 0;
736 $iModStat = function_exists(
'imagecreatetruecolor' ) ? 2 : $iModStat;
737 $iModStat = function_exists(
'imagecreatefromjpeg' ) ? $iModStat : 0;
748 return ( @ini_set(
'session.name',
'sid' ) !==
false ) ? 2 : 0;
758 $sGlobStatus = ( strtolower( (
string) @ini_get(
'register_globals' ) ) );
759 return in_array( $sGlobStatus, array(
'on',
'1' ) ) ? 0 : 2;
769 if ( $sMemLimit = @ini_get(
'memory_limit') ) {
775 $iMemLimit = $this->
_getBytes( $sMemLimit );
776 $iModStat = ( $iMemLimit >= $this->
_getBytes( $sDefLimit ) ) ? 1 : 0;
777 $iModStat = $iModStat ? ( ( $iMemLimit >= $this->
_getBytes( $sRecLimit ) ) ? 2 : $iModStat ) : $iModStat;
806 if (function_exists(
'output_cache_get' )) {
809 if (function_exists(
'zend_disk_cache_fetch' )) {
812 if (function_exists(
'zend_shm_cache_fetch' )) {
826 foreach ( $this->_aException as $sTable => $sColumn ) {
827 $sSelect .=
'and ( t.TABLE_NAME != "'.$sTable.
'" and c.COLUMN_NAME != "'.$sColumn.
'" ) ';
841 $aCollations = array();
844 $sSelect =
'select t.TABLE_NAME, c.COLUMN_NAME, c.COLLATION_NAME from INFORMATION_SCHEMA.tables t ' .
845 'LEFT JOIN INFORMATION_SCHEMA.columns c ON t.TABLE_NAME = c.TABLE_NAME ' .
846 'where t.TABLE_SCHEMA = "'.$myConfig->getConfigParam(
'dbName' ).
'" ' .
847 'and c.TABLE_SCHEMA = "'.$myConfig->getConfigParam(
'dbName' ).
'" ' .
848 'and c.COLUMN_NAME in ("'.implode(
'", "', $this->_aColumns).
'") ' . $this->
_getAdditionalCheck() .
849 ' ORDER BY (t.TABLE_NAME = "oxarticles") DESC';
851 foreach ( $aRez as $aRetTable ) {
852 if ( !$sCollation ) {
853 $sCollation = $aRetTable[2];
855 if ( $aRetTable[2] && $sCollation != $aRetTable[2]) {
856 $aCollations[$aRetTable[0]][$aRetTable[1]] = $aRetTable[2];
861 if ( $this->_blSysReqStatus === null ) {
862 $this->_blSysReqStatus =
true;
864 if ( count($aCollations) > 0 ) {
865 $this->_blSysReqStatus =
false;
887 return (@preg_match(
'/\pL/u',
'a') == 1) ? 2 : 1;
898 $sFileUploads = @ini_get(
'file_uploads');
899 if ( $sFileUploads !==
false ) {
900 if ( $sFileUploads && ( $sFileUploads ==
'1' || strtolower($sFileUploads) ==
'on') ) {
916 if ( $this->_blSysReqStatus == null ) {
917 $this->_blSysReqStatus =
true;
942 $this->_blSysReqStatus =
true;
943 foreach ( $aRequiredModules as $sModule => $sGroup ) {
944 if ( isset($aSysInfo[$sGroup]) && !$aSysInfo[$sGroup] ) {
945 $aSysInfo[$sGroup] = array();
948 $aSysInfo[$sGroup][$sModule] = $iModuleState;
949 $this->_blSysReqStatus = $this->_blSysReqStatus && ( bool ) abs( $iModuleState );
965 $sCheckFunction =
"check".str_replace(
" ",
"", ucwords(str_replace(
"_",
" ", $sModule)));
966 $iModStat = $this->$sCheckFunction();
985 if ( isset( $aInfoMap[$sIdent] ) ) {
986 $sUrl .=
"#".$aInfoMap[$sIdent];
1001 $sBytes = trim( $sBytes );
1002 $sLast = strtolower($sBytes[strlen($sBytes)-1]);
1029 $sTplFile = $this->
getConfig()->getTemplatePath($sTemplate,
false);
1030 if (!$sTplFile || !file_exists($sTplFile)) {
1032 $sTplFile = $this->
getConfig()->getTemplatePath($sTemplate,
true);
1033 if (!$sTplFile || !file_exists($sTplFile)) {
1038 $sFile = file_get_contents($sTplFile);
1039 $sBlockNameQuoted = preg_quote($sBlockName,
'/');
1040 return (
bool)preg_match(
'/\[\{\s*block\s+name\s*=\s*([\'"])'.$sBlockNameQuoted.
'\1\s*\}\]/is', $sFile);
1058 $sShpIdParam = $oDb->quote($oConfig->getShopId());
1059 $sSql =
"select * from oxtplblocks where oxactive=1 and oxshopid=$sShpIdParam";
1060 $rs = $oDb->execute($sSql);
1064 if ($rs !=
false && $rs->recordCount() > 0) {
1067 if (isset($aCache[$rs->fields[
'OXTEMPLATE']]) && isset($aCache[$rs->fields[
'OXTEMPLATE']][$rs->fields[
'OXBLOCKNAME']])) {
1068 $blStatus = $aCache[$rs->fields[
'OXTEMPLATE']][$rs->fields[
'OXBLOCKNAME']];
1070 $blStatus = $this->
_checkTemplateBlock($rs->fields[
'OXTEMPLATE'], $rs->fields[
'OXBLOCKNAME']);
1071 $aCache[$rs->fields[
'OXTEMPLATE']][$rs->fields[
'OXBLOCKNAME']] = $blStatus;
1076 'module' => $rs->fields[
'OXMODULE'],
1077 'block' => $rs->fields[
'OXBLOCKNAME'],
1078 'template' => $rs->fields[
'OXTEMPLATE'],
1095 $sStatus = ( strtolower( (
string) @ini_get(
'session.auto_start' ) ) );
1096 return in_array( $sStatus, array(
'on',
'1' ) ) ? 0 : 2;