Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727118
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 7:02 AM
Size
11 KB
Mime Type
text/x-diff
Expires
Wed, Jan 8, 7:02 AM (2 d, 35 m ago)
Engine
blob
Format
Raw Data
Handle
537180
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/5.2.x/core/install/prerequisites.php
===================================================================
--- branches/5.2.x/core/install/prerequisites.php (revision 15619)
+++ branches/5.2.x/core/install/prerequisites.php (revision 15620)
@@ -1,233 +1,241 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$prerequisite_class = 'InPortalPrerequisites';
/**
* Class, that holds all prerequisite scripts for "In-Portal" module
*
*/
class InPortalPrerequisites {
/**
* Install toolkit instance
*
* @var kInstallToolkit
*/
var $_toolkit = null;
/**
* Connection to database
*
* @var kDBConnection
* @access protected
*/
protected $Conn = null;
/**
* Version upgrade rules
*
* @var array
* @access private
*/
private $upgradeRules = Array (
'5.0.0' => Array ('from' => '5.0.0-B1', 'to' => '5.1.0-B1'),
'5.1.0' => Array ('from' => '5.1.0-B1', 'to' => '5.2.0-B1'),
'5.2.0' => Array ('from' => '5.2.0-B1', 'to' => '5.3.0-B1'),
);
/**
* Sets common instance of installator toolkit
*
* @param kInstallToolkit $instance
*/
function setToolkit(&$instance)
{
$this->_toolkit =& $instance;
}
/**
* Checks minimal version, that could be upgradeable
*
* @return kDBConnection
*/
function getConnection()
{
return $this->_toolkit->Conn;
}
/**
* Checks minimal version, that could be upgradeable
*
* @param Array $versions
* @param string $mode when called mode {install, upgrade, standalone)
* @return Array
*/
function CheckPrerequisites($versions, $mode)
{
$errors = Array ();
if ( $mode == 'upgrade' ) {
$sql = 'SELECT Version
FROM ' . TABLE_PREFIX . 'Modules
WHERE Name = "In-Portal"';
$inportal_version = $this->getConnection()->GetOne($sql);
if ( $inportal_version === false ) {
// only, when In-Portal was installed (below 4.3.x)
return $errors;
}
$min_version = '4.3.1'; // K4-based installator was created, that no longer maintained old upgrade scripts
if ( version_compare($inportal_version, $min_version, '<') ) {
$errors[] = 'Please upgrade "In-Portal" to version ' . $min_version . ' first';
}
// example: to upgrade to 5.1.0-B1 or more you at least need to have 5.0.0 installed
foreach ($this->upgradeRules as $min_version => $version_rules) {
if ( version_compare($versions[0], $version_rules['from'], '<') && version_compare($versions[1], $version_rules['to'], '>=') ) {
$errors[] = 'Please upgrade "In-Portal" to version ' . $min_version . ' first';
break;
}
}
}
return $errors;
}
/**
* Returns information about system requirements
*
* @return array
*/
function CheckSystemRequirements()
{
$ret = Array ();
$ret['php_version'] = version_compare(PHP_VERSION, '5.2.0', '>=');
- $ret['url_rewriting'] = function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules());
+
+ if ( function_exists('apache_get_modules') ) {
+ $mod_rewrite = in_array('mod_rewrite', apache_get_modules());
+ }
+ else {
+ $mod_rewrite = getenv('HTTP_MOD_REWRITE') == 'On';
+ }
+
+ $ret['url_rewriting'] = $mod_rewrite;
$ret['memcache'] = class_exists('Memcache');
$ret['curl'] = function_exists('curl_init');
$ret['simplexml'] = function_exists('simplexml_load_string');
$ret['spl'] = function_exists('spl_autoload_register');
$ret['freetype'] = function_exists('imagettfbbox');
$ret['gd_version'] = false;
if ( function_exists('gd_info') ) {
$gd_info = gd_info();
$gd_version = preg_replace('/[^\d.]/', '', $gd_info['GD Version']);
$ret['gd_version'] = version_compare($gd_version, '1.8', '>=');
}
$ret['jpeg'] = function_exists('imagecreatefromjpeg');
$ret['mysql'] = function_exists('mysql_connect');
$ret['json'] = function_exists('json_encode');
$output = shell_exec('java -version 2>&1');
$ret['java'] = stripos($output, 'java version') !== false;
$ret['memory_limit'] = $this->isPhpSettingChangeable('memory_limit', '33M');
$ret['display_errors'] = $this->isPhpSettingChangeable('display_errors', '1');
$ret['error_reporting'] = $this->canChangeErrorReporting();
$ret['date.timezone'] = ini_get('date.timezone') != '';
$ret['variables_order'] = $this->_hasLetters(ini_get('variables_order'), Array ('G', 'P', 'C', 'S'));
$output_buffering = strtolower(ini_get('output_buffering'));
$ret['output_buffering'] = $output_buffering == 'on' || $output_buffering > 0;
return $ret;
}
/**
* Determines of a setting string has all given letters (ignoring order) in it
*
* @param string $setting
* @param Array $search_letters
* @return bool
* @access protected
*/
protected function _hasLetters($setting, $search_letters)
{
$setting = preg_replace('/(' . implode('|', $search_letters) . ')/', '*', $setting);
return substr_count($setting, '*') == count($search_letters);
}
/**
* Detects if error reporting can be changed at runtime
*
* @return bool
* @access protected
*/
protected function canChangeErrorReporting()
{
$old_value = error_reporting(E_PARSE);
$new_value = error_reporting();
if ( $new_value == E_PARSE ) {
error_reporting($old_value);
return true;
}
return false;
}
/**
* Detects if setting of php.ini can be changed
*
* @param string $setting_name
* @param string $new_value
* @return bool
*/
protected function isPhpSettingChangeable($setting_name, $new_value)
{
$old_value = ini_get($setting_name);
if ( ini_set($setting_name, $new_value) === false ) {
return false;
}
ini_set($setting_name, $old_value);
return true;
}
/**
* Returns information about DB requirements
*
* @return array
*/
function CheckDBRequirements()
{
// check PHP version 5.2+
$ret = Array();
$sql = 'SELECT VERSION()';
$conn = $this->getConnection();
$db_version = preg_replace('/[^\d.]/', '', $conn->GetOne($sql));
$ret['version'] = version_compare($db_version, '5.0', '>=');
$sql = 'SHOW VARIABLES LIKE "max_allowed_packet"';
$db_variables = $conn->Query($sql, 'Variable_name');
$ret['packet_size'] = $db_variables['max_allowed_packet']['Value'] >= 1048576;
return $ret;
}
}
\ No newline at end of file
Index: branches/5.2.x/.htaccess
===================================================================
--- branches/5.2.x/.htaccess (revision 15619)
+++ branches/5.2.x/.htaccess (revision 15620)
@@ -1,66 +1,71 @@
### File security
# Exclude direct access to tpl, tpl.xml, inc.php, sql extensions
#
<FilesMatch "\.(tpl|tpl.xml|inc.php|sql)$">
order allow,deny
deny from all
satisfy all
</FilesMatch>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/icon "access plus 1 month"
</IfModule>
-## Enable mod-rewrite
-RewriteEngine On
-
-###### Rewrite rule to force 'www.' prefix. Use only if needed
-# If your site can be accessed both with and without the 'www.' prefix,
-# use the following setting to redirect all users to access the site with the 'www.'
-# when they access without 'www.'. Uncomment and MAKE sure to adapt for your domain name
-#
-# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
-# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
-
-###### Rewrite rules to block common hacks
-## If you experience problems comment out the operations listed below
-## Block out any script trying to base64_encode crap to send via URL
-RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
-## Block out any script that includes a <script> tag in URL
-RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
-## Block out any script trying to set a PHP GLOBALS variable via URL
-RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
-## Block out any script trying to modify a _REQUEST variable via URL
-RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
-## Send all blocked request to homepage with 403 Forbidden error!
-RewriteRule ^(.*)$ index.php [F,L]
-
-## Uncomment line below if FollowSymLinks option is not enabled
-## by default in server configuration
-#
-# Options +FollowSymLinks
-
-## Uncomment following line if your webserver's URL
-## is not directly related to physical file paths.
-## Update Your In-Portal Directory (just / for root)
-#
-# RewriteBase /
-
-## In-Portal SEF URLs
-#
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME}/ !-f
-RewriteCond %{REQUEST_FILENAME}/index.php !-f
-RewriteCond %{REQUEST_FILENAME}/index.html !-f
-RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|bmp|js|css|ico|swf)$ [NC]
-RewriteRule ^(.*) index.php?rewrite=on&_mod_rw_url_=$1 [QSA]
+<IfModule mod_rewrite.c>
+ ## Tell PHP that the mod_rewrite module is ENABLED.
+ SetEnv HTTP_MOD_REWRITE On
+
+ ## Enable mod-rewrite
+ RewriteEngine On
+
+ ###### Rewrite rule to force 'www.' prefix. Use only if needed
+ # If your site can be accessed both with and without the 'www.' prefix,
+ # use the following setting to redirect all users to access the site with the 'www.'
+ # when they access without 'www.'. Uncomment and MAKE sure to adapt for your domain name
+ #
+ # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
+ # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
+
+ ###### Rewrite rules to block common hacks
+ ## If you experience problems comment out the operations listed below
+ ## Block out any script trying to base64_encode crap to send via URL
+ RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
+ ## Block out any script that includes a <script> tag in URL
+ RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
+ ## Block out any script trying to set a PHP GLOBALS variable via URL
+ RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
+ ## Block out any script trying to modify a _REQUEST variable via URL
+ RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
+ ## Send all blocked request to homepage with 403 Forbidden error!
+ RewriteRule ^(.*)$ index.php [F,L]
+
+ ## Uncomment line below if FollowSymLinks option is not enabled
+ ## by default in server configuration
+ #
+ # Options +FollowSymLinks
+
+ ## Uncomment following line if your webserver's URL
+ ## is not directly related to physical file paths.
+ ## Update Your In-Portal Directory (just / for root)
+ #
+ # RewriteBase /
+
+ ## In-Portal SEF URLs
+ #
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME}/ !-f
+ RewriteCond %{REQUEST_FILENAME}/index.php !-f
+ RewriteCond %{REQUEST_FILENAME}/index.html !-f
+ RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|bmp|js|css|ico|swf)$ [NC]
+ RewriteRule ^(.*) index.php?rewrite=on&_mod_rw_url_=$1 [QSA]
+</IfModule>
RedirectMatch 404 /(\.svn|CVS)(/|$)
\ No newline at end of file
Event Timeline
Log In to Comment