Index: branches/5.2.x/core/kernel/startup.php =================================================================== --- branches/5.2.x/core/kernel/startup.php (revision 16116) +++ branches/5.2.x/core/kernel/startup.php (revision 16117) @@ -1,204 +1,211 @@ '; echo 'Please use the installation script to fix the problem.

'; $base_path = rtrim(preg_replace('/'.preg_quote(rtrim($admin_directory, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); echo 'Go to installation script

'; flush(); exit; } + if ( !file_exists(FULL_PATH . '/vendor/autoload.php') ) { + echo 'Cannot find an "/vendor/autoload.php" file, have you executed "composer install" command?
'; + flush(); + exit; + } + // variable WebsitePath is auto-detected once during installation/upgrade define('BASE_PATH', $vars['WebsitePath']); define('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication'); define('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php'); if (isset($vars['WriteablePath'])) { define('WRITEABLE', FULL_PATH . $vars['WriteablePath']); define('WRITEBALE_BASE', $vars['WriteablePath']); } if ( isset($vars['RestrictedPath']) ) { define('RESTRICTED', FULL_PATH . $vars['RestrictedPath']); } define('SQL_TYPE', $vars['DBType']); define('SQL_SERVER', $vars['DBHost']); define('SQL_USER', $vars['DBUser']); define('SQL_PASS', $vars['DBUserPassword']); define('SQL_DB', $vars['DBName']); if (isset($vars['DBCollation']) && isset($vars['DBCharset'])) { define('SQL_COLLATION', $vars['DBCollation']); define('SQL_CHARSET', $vars['DBCharset']); } define('TABLE_PREFIX', $vars['TablePrefix']); define('DOMAIN', getArrayValue($vars, 'Domain')); ini_set('memory_limit', '50M'); define('MODULES_PATH', FULL_PATH . DIRECTORY_SEPARATOR . 'modules'); define('EXPORT_BASE_PATH', WRITEBALE_BASE . '/export'); define('EXPORT_PATH', FULL_PATH . EXPORT_BASE_PATH); define('GW_CLASS_PATH', MODULES_PATH . '/in-commerce/units/gateways/gw_classes'); // Payment Gateway Classes Path define('SYNC_CLASS_PATH', FULL_PATH . '/sync'); // path for 3rd party user syncronization scripts define('ENV_VAR_NAME','env'); define('IMAGES_PATH', WRITEBALE_BASE . '/images/'); define('IMAGES_PENDING_PATH', IMAGES_PATH . 'pending/'); define('MAX_UPLOAD_SIZE', min(ini_get('upload_max_filesize'), ini_get('post_max_size'))*1024*1024); define('EDITOR_PATH', isset($vars['EditorPath']) ? $vars['EditorPath'] : '/core/ckeditor/'); // caching types define('CACHING_TYPE_NONE', 0); define('CACHING_TYPE_MEMORY', 1); define('CACHING_TYPE_TEMPORARY', 2); class CacheSettings { static public $unitCacheRebuildTime; static public $structureTreeRebuildTime; static public $cmsMenuRebuildTime; static public $templateMappingRebuildTime; static public $sectionsParsedRebuildTime; static public $domainsParsedRebuildTime; } CacheSettings::$unitCacheRebuildTime = isset($vars['UnitCacheRebuildTime']) ? $vars['UnitCacheRebuildTime'] : 10; CacheSettings::$structureTreeRebuildTime = isset($vars['StructureTreeRebuildTime']) ? $vars['StructureTreeRebuildTime'] : 10; CacheSettings::$cmsMenuRebuildTime = isset($vars['CmsMenuRebuildTime']) ? $vars['CmsMenuRebuildTime'] : 10; CacheSettings::$templateMappingRebuildTime = isset($vars['TemplateMappingRebuildTime']) ? $vars['TemplateMappingRebuildTime'] : 5; CacheSettings::$sectionsParsedRebuildTime = isset($vars['SectionsParsedRebuildTime']) ? $vars['SectionsParsedRebuildTime'] : 10; CacheSettings::$domainsParsedRebuildTime = isset($vars['DomainsParsedRebuildTime']) ? $vars['DomainsParsedRebuildTime'] : 2; class MaintenanceMode { const NONE = 0; const SOFT = 1; const HARD = 2; } unset($vars); // just in case someone will be still using it if (ini_get('safe_mode')) { // safe mode will be removed at all in PHP6 define('SAFE_MODE', 1); } if (file_exists(WRITEABLE . '/debug.php')) { include_once(WRITEABLE . '/debug.php'); if (array_key_exists('DEBUG_MODE', $dbg_options) && $dbg_options['DEBUG_MODE']) { $debugger_start = microtime(true); include_once(KERNEL_PATH . '/utility/debugger.php'); $debugger_end = microtime(true); if (isset($debugger) && kUtil::constOn('DBG_PROFILE_INCLUDES')) { $debugger->profileStart('inc_globals', KERNEL_PATH . '/globals.php', $globals_start); $debugger->profileFinish('inc_globals', KERNEL_PATH . '/globals.php', $globals_end); $debugger->profilerAddTotal('includes', 'inc_globals'); $debugger->profileStart('inc_debugger', KERNEL_PATH . '/utility/debugger.php', $debugger_start); $debugger->profileFinish('inc_debugger', KERNEL_PATH . '/utility/debugger.php', $debugger_end); $debugger->profilerAddTotal('includes', 'inc_debugger'); } } } kUtil::safeDefine('SILENT_LOG', 0); // can be set in "debug.php" too $includes = Array( KERNEL_PATH . "/interfaces/cacheable.php", KERNEL_PATH . '/application.php', FULL_PATH . APPLICATION_PATH, KERNEL_PATH . "/kbase.php", KERNEL_PATH . '/db/db_connection.php', KERNEL_PATH . '/db/db_load_balancer.php', KERNEL_PATH . '/utility/event.php', KERNEL_PATH . '/utility/logger.php', KERNEL_PATH . "/utility/factory.php", KERNEL_PATH . "/languages/phrases_cache.php", KERNEL_PATH . "/db/dblist.php", KERNEL_PATH . "/db/dbitem.php", KERNEL_PATH . "/event_handler.php", KERNEL_PATH . '/db/db_event_handler.php', + FULL_PATH . '/vendor/autoload.php', ); foreach ($includes as $a_file) { kUtil::includeOnce($a_file); } if (defined('DEBUG_MODE') && DEBUG_MODE && isset($debugger)) { $debugger->AttachToApplication(); } if( !function_exists('adodb_mktime') ) { include_once(KERNEL_PATH . '/utility/adodb-time.inc.php'); } // system users define('USER_ROOT', -1); - define('USER_GUEST', -2); \ No newline at end of file + define('USER_GUEST', -2); Index: branches/5.2.x/core/install/step_templates/sys_requirements.tpl =================================================================== --- branches/5.2.x/core/install/step_templates/sys_requirements.tpl (revision 16116) +++ branches/5.2.x/core/install/step_templates/sys_requirements.tpl (revision 16117) @@ -1,78 +1,72 @@ %s '; $error_tpl = ' %s %s '; $check_titles = Array ( - 'php_version' => 'PHP version 5.2.0 or above*', + 'php_version' => 'PHP version 5.3.2 or above*', 'url_rewriting' => 'URL rewriting support', 'java' => 'Java template compression', + 'composer' => 'Dependencies via Composer*', 'sep1' => 'PHP extensions:', 'memcache' => '- Memory caching support', 'curl' => '- Accessing remote resources (via cURL)*', 'simplexml' => '- XML document processing (via SimpleXML)*', 'spl' => '- Standard PHP Library (SPL)*', 'freetype' => '- TrueType font support (via Freetype)*', 'gd_version' => '- GD Graphics Library 1.8 or above*', 'jpeg' => '- JPEG images support*', 'mysql' => '- Database connectivity (via MySQL)*', 'json' => '- JSON processing support*', 'sep2' => 'PHP settings:', 'memory_limit' => "- Memory requirements changing on the fly", 'display_errors' => "- Prevent script errors in production environment", 'error_reporting' => "- Change error detalization level", 'date.timezone' => "- Web server timezone is explicitly set*", 'variables_order' => '- Needed super-global arrays registered', 'output_buffering' => "- Script output buffering enabled*", ); $output = sprintf($heading_tpl, 'Server-side requirements'); $check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckSystemRequirements'); - /*$required_checks = Array ( - 'php_version', 'simplexml', 'curl', 'freetype', 'gd_version', - 'jpeg', 'mysql', 'date.timezone', 'output_buffering', - ); - - $required_checks = array_diff($required_checks, array_keys( array_filter($check_results) ));*/ - foreach ($check_titles AS $key => $title) { if ( substr($key, 0, 3) == 'sep' ) { $check_result = ''; } else { $check_result = $check_results[$key] ? '[PASSED]' : '[FAILED]'; } $output .= sprintf($error_tpl, $title, $check_result); } $output .= sprintf($heading_tpl, 'Client-side requirements', 'text'); $output .= sprintf($error_tpl, 'Cookies enabled', '[FAILED]'); $output .= sprintf($error_tpl, 'JavaScript enabled', '[FAILED]'); $output .= ''; $output .= ''; $output .= ""; echo $output; ?> Index: branches/5.2.x/core/install/prerequisites.php =================================================================== --- branches/5.2.x/core/install/prerequisites.php (revision 16116) +++ branches/5.2.x/core/install/prerequisites.php (revision 16117) @@ -1,241 +1,243 @@ 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['php_version'] = version_compare(PHP_VERSION, '5.3.2', '>='); 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['composer'] = file_exists(FULL_PATH . '/vendor/autoload.php'); + $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/core/install/incs/style.css =================================================================== --- branches/5.2.x/core/install/incs/style.css (revision 16116) +++ branches/5.2.x/core/install/incs/style.css (revision 16117) @@ -1,226 +1,230 @@ html, body { margin: 0; padding: 0; background: #FFFFFF; color: #333333; } ol.install-steps { font: bold 12px verdana, sans-serif; color: #fff; line-height: 20px; } .install-steps li { padding-bottom: 3px; } .install-steps li.current-step { color: #FF0000; } .footer { background-color: #FFFFFF; color: #006; border-top: 1px solid #006; font-size: 11px; text-align: right; padding: 2px 10px 0 0; clear: both; } p { padding: 0; margin-top: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Helvetica, Arial, sans-serif; } +ol li { + font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Helvetica, Arial, sans-serif; +} + .head_version { padding-right: 5px; font-weight: normal; font-size: 10px; color: white; font-family: verdana, arial; text-decoration: none; } .admintitle, .admintitle-white { font-weight: bold; font-size: 20px; color: #009FF0; font-family: verdana, arial; text-decoration: none; } .admintitle-white { color: #fff } .subsectiontitle { font-weight: bold; font-size: 14px; color: white; font-family: verdana, arial; background-color: #999999; text-decoration: none; height: 24px; } .subsectiontitle:hover { font-weight: bold; font-size: 14px; color: #ffcc00; font-family: verdana, arial; background-color: #999999; text-decoration: none; } .text { font-weight: normal; font-size: 12px; font-family: verdana, arial; text-decoration: none; } /* Toolbar */ .toolbar { font-size: 8pt; border: 1px solid #000000; border-width: 0px 1px 1px 1px; background-color: #F0F1EB; border-collapse: collapse; } .toolbar td { height: 100%; } .toolbar-button, .toolbar-button-disabled, .toolbar-button-over { float: left; text-align: center; font-size: 8pt; padding: 5px 5px 5px 5px; vertical-align: middle; color: #006F99; } .toolbar-button-over { color: #000; } .toolbar-button-disabled { color: #444; } .tableborder { border-right: #000000 1px solid; border-top: #000000 0px solid; font-size: 10pt; border-left: #000000 1px solid; border-bottom: #000000 1px solid; font-family: Arial, Helvetica, sans-serif; } .tableborder_full { border-right: #000000 1px solid; border-top: #000000 1px solid; font-size: 10pt; border-left: #000000 1px solid; border-bottom: #000000 1px solid; font-family: Arial, Helvetica, sans-serif; background-image: url(img/tab_middle.gif); background-repeat: repeat-x; } .tablenav { font-weight: bold; font-size: 14px; color: white; font-family: verdana, arial; background-color: #73C4F5; text-decoration: none; } .tablenav_link { font-weight: bold; font-size: 14px; color: white; font-family: verdana, arial; text-decoration: none; } .tablenav_link:hover { font-weight: bold; font-size: 14px; color: #FFCC00; font-family: verdana, arial; text-decoration: none; } /*.table-color1 { font-weight: normal; font-size: 14px; color: black; font-family: verdana, arial; background-color: #F6F6F6; text-decoration: none; }*/ .table-color2 { font-weight: normal; font-size: 14px; color: black; font-family: verdana, arial; background-color: #EBEBEB; text-decoration: none; } .error { font-weight: bold; font-size: 9pt; color: #ff0000; font-family: Arial, Helvetica, sans-serif; } .button { font-weight: normal; font-size: 12px; background: url(img/button_back.gif) #F9EEAE repeat-x; color: black; font-family: Arial, Verdana; text-decoration: none; } td { font-size: 10pt; font-family: Verdana, Helvetica; text-decoration: none; } .link { cursor: pointer; } .hint { font-size: 12px; color: #666666; font-style: normal; font-family: Arial, Helvetica, sans-serif; } /* === Copy from "toolbar-sprite.css" === */ .core-toolbar-sprite { background: url("../../admin_templates/img/toolbar/toolbar-sprite.png") repeat-x scroll 0 0 transparent; border: 0 none; cursor: pointer; padding: 0; } #core-tb-refresh { background-position: -0px -896px; } #core-tb-refresh.hover { background-position: -32px -896px; } #core-tb-refresh.disabled { background-position: -64px -896px; } #core-tb-prev { background-position: -0px -704px; } #core-tb-prev.hover { background-position: -32px -704px; } #core-tb-prev.disabled { background-position: -64px -704px; } #core-tb-next { background-position: -0px -640px; } #core-tb-next.hover { background-position: -32px -640px; } -#core-tb-next.disabled { background-position: -64px -640px; } \ No newline at end of file +#core-tb-next.disabled { background-position: -64px -640px; } Index: branches/5.2.x/core/install/steps_db.xml =================================================================== --- branches/5.2.x/core/install/steps_db.xml (revision 16116) +++ branches/5.2.x/core/install/steps_db.xml (revision 16117) @@ -1,330 +1,339 @@ Database Hostname - IP or hostname of your database server (normally "localhost").

Database Name - name of the database where In-Portal will be installed.

Database User Name - name of the user for selected database.

Database User Password - password for selected username.

Database Collation - character set used to store data in text fields (normally "utf8_general_ci").

Prefix for Table Names - specified when multiple scripts will be run in the same database. Prefix can be any text string allowed in table naming by your database engine (normally "inp_").

Use existing In-Portal installation setup in this Database - select "Yes" if you already have In-Portal installed in this database and want to use it. Select "No" in all other cases.

]]>
In-Portal is an Open Source object-oriented framework that is developed in PHP and provides a quick and easy way to build websites and web applications.

In-Portal is copyrighted and distributed under GPLv2 license.

GPL / Open Source License - by downloading and installing In-Portal under GPLv2 license you understand and agree to all terms of the GPLv2 license.

Upload License File - if you have obtained Commercial Modules or Support from Intechnic you will be provided with a license file, upload it here.

Use Existing License - if a valid license has been detected on your server, you can choose this option and continue the installation process.

]]>
In-Portal is an Open Source object-oriented framework that is developed in PHP and provides a quick and easy way to build websites and web applications.

In-Portal is copyrighted and distributed under GPLv2 license.

GPL / Open Source License - by downloading and installing In-Portal under GPLv2 license you understand and agree to all terms of GPLv2 license.

Download from Intechnic Servers - if you have obtained Commercial Modules or Support from Intechnic you will be provided with a license, specify your Username and Password in order to download the license.

]]>
Select the domain you wish to install In-Portal on.

The Other option can be used to install In-Portal other custom domains. Note that your web server should match entered domain name.

]]>
The Root Password is initially required to access the Admin Console of In-Portal. The root user can NOT be used to access the Front-end of your In-Portal website.

Once installation is completed it's highly recommented to create additional users with admin privlidges.

]]>
Current step lists all In-Portal Modules that were found on your server and can be installed now.

Additional In-Portal Modules can be found and downloaded here.

While In-Portal Community constantly works on improving In-Portal by creating new functionality and releasing new modules we are always looking for new ideas and Your help so we can make In-Portal even better software!

]]>
In-Portal Installer checks through the system folders and files that require write permissions (777) to be set in order to run successfully In-Portal on your website.

In case if you see a Failure notice saying that In-Portal Installation cannot continue until all permissions are set correctly please continue reading below.

Permissions can be set by using FTP program or directly in shell running "chmod" command. Please refer to the following guide to learn how to set permissions using your FTP program. In case if you have access to shell in your account you can simply run fix_perms.sh files located in /tools folder or do

   # chmod -R 777 ../system ../themes ../system/config.php

Security reasons you will be asked to change permissions back to 755 on /system/config.php file and root / folder of In-Portal on the last step of this installation process!

]]>
Adjust Basic Configuration settings on this step.

Once your In-Portal is installed you can login into Admin Console to change these and other settings. The Configuration section is located in main navigation menu.


Additional Recommendations:

1. Use Cron (UNIX/BSD/Linux) or Task Scheduler (Windows) to run Regular Events in your In-Portal.
It's highly recommended to setup your cron to run every minute so all system events that are enabled will run in the background based on their schedule. These events can be managed in Admin Console via Configuration -> Website -> Scheduled Tasks section.

In-Portal cron file is located in /tools/cron.php folder and can be setup using hosting Control Panel or manually. In Plesk or CPanel interfaces use dialog to add a new cron job and specify the following (use correct paths)
   /absolute/path/to/bin/php -f /absolute/path/to/in-portal/tools/cron.php

2. Adjust Scheduled Tasks
As was explained in the previous recommendation there is a Configuration -> Website -> Scheduled Tasks section where you can control Events triggered by the system. These events do their job to cleanup the data, old image files, check the data integrity, RSS feeds and other processes required for your In-Portal to run efficiently. We do recommend to review and enable/disable these events based on your website needs.

3. Set Mail Server
It's recommended to review and adjust your mail server settings once your In-Portal is up and running. This can be done in Admin Console under Configuration -> Website -> Advanced section.

We strongly recommend carefully reviewing and adjusting all settings under Configuration -> Website section!

]]>
These are system advanced settings and must be changed with caution. It's not recommended to change these settings unless you exactly know what you are doing. These settings will be stored in system/config.php file and can be changed manually if needed.


Web Path to Installation - web path to the root of your In-Portal installation. For example, if your In-Portal will be running at http://www.your-website.com, then Web Path to Installation should be left empty since In-Portal is setup in the root of the domain. In case if your In-Portal will be running under http://www.your-website.com/in-portal/, then it should be set to /in-portal (no trailing slash). This setting is auto-detected during the initial installation step, but can be adjusted at Installation Maintenance step.

Path to Writable folder - path to a folder inside your In-Portal installation which can be accessed from the Web and has writable permissions for the web server. This folder will be used to store dynamic content such as uploaded and resized images, cached templates and other types of user files. The default value is /system.

Path to Restricted folder - path to a folder inside or outside your In-Portal installation which will used to store debug files, system logs and other non-public information. This folder must be writable by the web-server and can be located outside of your In-Portal installation if needed. The default value is /system/.restricted .

Path to Admin folder - web path to your In-Portal Admin Console folder. The default value is set to /admin and your Admin Console will be accessible at http://www.your-website.com/admin. In case if you want your Admin Console to be under http://www.your-website.com/secure-admin (or anything else) you'll need to rename original admin folder to secure-admin on your filesystem and then set this path to /secure-admin .

Path to Admin Interface Presets folder - path to a folder inside your In-Portal installation contains Admin Interface Presets. The default value is /admin .

Name of Base Application Class - default value is kApplication and can change very rarely.

Path to Base Application Class file - default value is /core/kernel/application.php and can change very rarely.

Output Caching Engine - provides ability to cache HTML output or other data using various caching engines to lower the database load. The default value is set to None if no available engines detected. Available options are: None (Fake), Memcached (Memcache), XCache (XCache) and Alternative PHP Cache (Apc). Note that only auto-detected caching engines will be available for selection.

Location of Memcache Servers - host or IP address with port where Memcached Server is running. Multiple locations of can be listed separated by semi-colon (;). For example, 192.168.1.1:1121;192.168.1.2:1121;192.168.1.3:1121 .

CSS/JS Compression Engine - provides minification functionality for CSS / Javascript files. The default value is set to PHP-based if no Java is auto-detected on server-side. Available options are: None (empty), YUICompressor (Java) (yui) and PHP-based (php) .

Website Charset - character encoding that will be used across the website. By default this should be set to UTF-8, but can set to other encoding also (see wikipedia.org options). It's highly recommended to have Website Encoding match the Database Encoding (specified on DB step).

Enable "System Log" - "System Log" has capability to record PHP Exceptions, Errors, Warnings, Notices, Database/SQL Errors and Warnings, and User defined messages that happened on your website. It has 3 modes - Enabled (logs everything, including user defined messages), User-only (user defined messages only), and Disabled (don't log anything at all - default setting).

Trust Proxy - whatever to trust information provided by provided by proxy server (if any) located between web server and client browser.


]]>
Selected theme will be used as a default in your In-Portal website.

You can manage your themes in Admin Console under Configuration -> Website -> Themes section.

Additional themes are available on Support & Downloads section on In-Portal.com website

]]>
In-Portal Installer performs final security checks on this step.

1. Write Permissions Check - checks whether critical In-Portal files are open for the outside world and can be used by hackers to attack your websites. You won't be able to continue until you correctly set these permissions!

2. Ability to Execute PHP in Writable Folders - checks if hackers can save and execute PHP files in your /system folder used for the uploads.While it's recommended to adjust these settings you can continue In-Portal Installation without changing them.

3. Webserver PHP Configuration - additional suggestions how to make your website even more secure. While it's recommended to adjust these settings you can continue In-Portal Installation without changing them.

]]>
Thank you for downloading and installing In-Portal Content Management System!

Feel free to visit www.in-portal.com for support, latest news and module updates.

Please make sure to clean your Browser's Cache if you were performing the upgrade.

]]>
A Configuration file has been detected on your system and it appears In-Portal is correctly installed. In order to work with the maintenance functions provided to the left you must enter your admin Root password. (Use Username 'root' if using your root password)

Upgrade In-Portal - available when you upload files from new In-Portal release into your current installation. Upgrade scripts will run and upgrade your current In-Portal database to the uploaded version.

Reinstall In-Portal - cleans out your existing In-Portal database and starts with a fresh installation. Note that this operation cannot be undone and no backups are made! Use at your own risk.

Install In-Portal to a New Database - keeps the existing installation and installs In-Portal to a new database. If this option is selected you will be prompted for new database configuration information.

Update License Information - used to update your In-Portal license data. Select this option if you have modified your licensing status with Intechnic (obtained commercial support or module), or you have received new license data via email.

Update Database Configuration - allows you to update your current database configuration variables such as database server host, username, password and others.

Update Installation Paths - should be used when the location of your In-Portal files has changed. For example, if you moved them from one folder to another. It will update all settings and ensure In-Portal is operational at the new location.

]]>
Select modules from the list, you need to update to the last downloaded version of In-Portal

]]>
Review Administrative Console skin upgrade log.

]]>
In-Portal needs to connect to your Database Server. Please provide the database server type*, host name (normally "localhost"), Database user name, and database Password. These fields are required to connect to the database.

If you would like In-Portal to use a table prefix, enter it in the field provided. This prefix can be any text which can be used in the names of tables on your system. The characters entered in this field are placed before the names of the tables used by In-Portal. For example, if you enter "inp_" into the prefix field, the table named Categories will be named inp_Categories.

]]>
The System Requirements Check option should be used to ensure proper system behavior in the current environment.

- PHP version 5.2.0 or above*
+ PHP version 5.3.2 or above*
Use this PHP version or better to ensure normal website operation on every day basis.

URL rewriting support
Allows to build nice looking SEO urls without specifying "/index.php" in each of them.

Java template compression
When Java is installed on web server, then it's possible to use YUI Compressor to minify HTML, CSS and JavaScript output of website. This allows to make websites, which opens even faster, then before.

+ Dependencies via Composer
+ In-Portal uses Composer to install required 3rd-party libraries. + Please ensure, that:
+

    +
  1. Composer is installed (instructions)
  2. +
  3. Dependencies are installed (instructions)
  4. +
+

+

Memory caching support
When available use Memcached memory object caching system for data caching. Will severely improve website performance under heavy load and page loading speed in general.

Accessing remote resources (via cURL)
Allows to perform data retrieval from other websites (e.g. rss feeds) in background. Data retrieval internally is done using cURL library, that must be installed on web server.

XML document processing (via SimpleXML)*
In-Portal uses XML files to store module/theme meta data. This library is used keep In-Portal code clean as fast even, when processing XML files.

Standard PHP Library (SPL)*
Usage of this library guarantees memory efficient way to manage files and data structures across In-Portal.

TrueType font support (via Freetype)*
This library allows to use TrueType fonts inside produced images. In particular it's used for Captcha code generation.

GD Graphics Library 1.8 or above*
This library is used to perform various manipulations (e.g. resize, crop, etc.) on user-uploaded images.

JPEG images support*
Support image manipulations on user-uploaded images *.jpg and *.jpeg file extensions.

Database connectivity (via MySQL)*
In-Portal uses MySQL database as it's persistent data storage.

JSON processing support*
JSON data format is used to implement AJAX approach and perform complete page reload only, when necessary.

Memory requirements changing on the fly
In-Portal requires at least 16 megabytes of memory to operate normally. However some resource consuming operations (like link validation) might consume more memory, then usual. To ensure, that such operations never fail In-Portal changes maximally allowed memory limit on the fly. See memory_limit setting for more info.

Prevent script errors in production environment
Prevents any errors to be shown on website, that might happen due incorrect web server configuration. See display_errors setting for more info.

Change error detalization level
Ensures, that all error types are shown in development environment and none in production environment. See error_reporting setting for more info.

Web server timezone is explicitly set*
Web server timezone must be set explicitly to ensure correct date/time calculations and display across the website. See date.timezone setting for more info.

Needed super-global arrays registered
Internally In-Portal relies on super-global array (e.g. $_SERVER, $_POST, etc.) presense inside a script. To make that happen variables_order setting must contain following letters: "G", "P", "C", "S".

Script output buffering enabled*
Output buffering is needed to allow usage of GZIP compression of page output. See output_buffering setting for more info.

Cookies enabled
However In-Portal can work without cookies (by adding ?sid=XXXXXXXX into each page url), but it's strongly advised to use cookies-enabled web browser for better user expirience.

JavaScript enabled
JavaScript might not be required on Front-End (depends on used theme), but it must be enabled in web browser during installation and Admin Console usage.

]]>
-
\ No newline at end of file + Index: branches/5.2.x/core/install.php =================================================================== --- branches/5.2.x/core/install.php (revision 16116) +++ branches/5.2.x/core/install.php (revision 16117) @@ -1,1782 +1,1782 @@ Init(); $install_engine->Run(); $install_engine->Done(); class kInstallator { /** * Reference to kApplication class object * * @var kApplication */ var $Application = null; /** * Connection to database * * @var kDBConnection */ var $Conn = null; /** * XML file containing steps information * * @var string */ var $StepDBFile = ''; /** * Step name, that currently being processed * * @var string */ var $currentStep = ''; /** * Steps list (preset) to use for current installation * * @var string */ var $stepsPreset = ''; /** * Installation steps to be done * * @var Array */ var $steps = Array ( 'fresh_install' => Array ('sys_requirements', 'check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'), 'clean_reinstall' => Array ('install_setup', 'sys_requirements', 'check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'), 'already_installed' => Array ('check_paths', 'install_setup'), 'upgrade' => Array ('check_paths', 'install_setup', 'sys_config', 'upgrade_modules', 'skin_upgrade', 'security', 'finish'), 'update_license' => Array ('check_paths', 'install_setup', 'select_license', /*'download_license',*/ 'select_domain', 'security', 'finish'), 'update_config' => Array ('check_paths', 'install_setup', 'sys_config', 'security', 'finish'), 'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'), 'sys_requirements' => Array ('check_paths', 'install_setup', 'sys_requirements', 'security', 'finish') ); /** * Steps, that doesn't required admin to be logged-in to proceed * * @var Array */ var $skipLoginSteps = Array ('sys_requirements', 'check_paths', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish', -1); /** * Steps, on which kApplication should not be initialized, because of missing correct db table structure * * @var Array */ var $skipApplicationSteps = Array ('sys_requirements', 'check_paths', 'clean_db', 'db_config', 'db_reconfig' /*, 'install_setup'*/); // remove install_setup when application will work separately from install /** * Folders that should be writeable to continue installation. $1 - main writeable folder from config.php ("/system" by default) * * @var Array */ var $writeableFolders = Array ( '$1', '$1/.restricted', '$1/images', '$1/images/pending', '$1/images/emoticons', // for "In-Bulletin" '$1/user_files', '$1/cache', ); /** * Contains last error message text * * @var string */ var $errorMessage = ''; /** * Base path for includes in templates * * @var string */ var $baseURL = ''; /** * Holds number of last executed query in the SQL * * @var int */ var $LastQueryNum = 0; /** * Dependencies, that should be used in upgrade process * * @var Array */ var $upgradeDepencies = Array (); /** * Log of upgrade - list of upgraded modules and their versions * * @var Array */ var $upgradeLog = Array (); /** * Common tools required for installation process * * @var kInstallToolkit */ var $toolkit = null; function Init() { include_once(FULL_PATH . REL_PATH . '/kernel/kbase.php'); // required by kDBConnection class include_once(FULL_PATH . REL_PATH . '/kernel/utility/multibyte.php'); // emulating multi-byte php extension require_once(FULL_PATH . REL_PATH . '/install/install_toolkit.php'); // toolkit required for module installations to installator $this->toolkit = new kInstallToolkit(); $this->toolkit->setInstallator($this); $this->StepDBFile = FULL_PATH.'/'.REL_PATH.'/install/steps_db.xml'; $base_path = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); $this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].$base_path.'/core/install/'; set_error_handler( Array(&$this, 'ErrorHandler') ); if (file_exists($this->toolkit->INIFile)) { // if config.php found, then check his write permission too $this->writeableFolders[] = $this->toolkit->defaultWritablePath . '/config.php'; } if ( !$this->toolkit->getSystemConfig('Misc', 'WriteablePath') ) { $this->toolkit->setSystemConfig('Misc', 'WriteablePath', $this->toolkit->defaultWritablePath); } if ( !$this->toolkit->getSystemConfig('Misc', 'RestrictedPath') ) { $this->toolkit->setSystemConfig('Misc', 'RestrictedPath', $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . '.restricted'); } if ( !$this->toolkit->getSystemConfig('Misc', 'WebsitePath') ) { $this->toolkit->setSystemConfig('Misc', 'WebsitePath', $base_path); } if ( $this->toolkit->systemConfigChanged ) { // immediately save, because this paths will be used in kApplication class later $this->toolkit->SaveConfig(true); } $this->currentStep = $this->GetVar('step'); // can't check login on steps where no application present anyways :) $this->skipLoginSteps = array_unique(array_merge($this->skipLoginSteps, $this->skipApplicationSteps)); $this->SelectPreset(); if (!$this->currentStep) { $this->SetFirstStep(); // sets first step of current preset } $this->InitStep(); } function SetFirstStep() { reset($this->steps[$this->stepsPreset]); $this->currentStep = current($this->steps[$this->stepsPreset]); } /** * Selects preset to proceed based on various criteria * */ function SelectPreset() { $preset = $this->GetVar('preset'); if ($this->toolkit->systemConfigFound()) { // only at installation first step $status = $this->CheckDatabase(false); if ($status && $this->AlreadyInstalled()) { // if already installed, then all future actions need login to work $this->skipLoginSteps = Array ('check_paths', -1); if (!$preset) { $preset = 'already_installed'; $this->currentStep = ''; } } } if ($preset === false) { $preset = 'fresh_install'; // default preset } $this->stepsPreset = $preset; } /** * Returns variable from request * * @param string $name * @param mixed $default * @return string|bool * @access private */ private function GetVar($name, $default = false) { if ( array_key_exists($name, $_COOKIE) ) { return $_COOKIE[$name]; } if ( array_key_exists($name, $_POST) ) { return $_POST[$name]; } return array_key_exists($name, $_GET) ? $_GET[$name] : $default; } /** * Sets new value for request variable * * @param string $name * @param mixed $value * @return void * @access private */ private function SetVar($name, $value) { $_POST[$name] = $value; } /** * Performs needed intialization of data, that step requires * */ function InitStep() { $require_login = !in_array($this->currentStep, $this->skipLoginSteps); $this->InitApplication($require_login); if ($require_login) { // step require login to proceed if (!$this->Application->LoggedIn()) { $this->stepsPreset = 'already_installed'; $this->currentStep = 'install_setup'; // manually set 2nd step, because 'check_paths' step doesn't contain login form // $this->SetFirstStep(); } } switch ($this->currentStep) { case 'sys_requirements': $required_checks = Array ( - 'php_version', 'curl', 'simplexml', 'freetype', 'gd_version', + 'php_version', 'composer', 'curl', 'simplexml', 'freetype', 'gd_version', 'jpeg', 'mysql', 'json', 'date.timezone', 'output_buffering', ); $check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckSystemRequirements'); $required_checks = array_diff($required_checks, array_keys( array_filter($check_results) )); if ( $required_checks ) { // php-based checks failed - show error $this->errorMessage = '
Installation can not continue until all required environment parameters are set correctly'; } elseif ( $this->GetVar('js_enabled') === false ) { // can't check JS without form submit - set some fake error, so user stays on this step $this->errorMessage = ' '; } elseif ( !$this->GetVar('js_enabled') || !$this->GetVar('cookies_enabled') ) { // js/cookies disabled $this->errorMessage = '
Installation can not continue until all required environment parameters are set correctly'; } break; case 'check_paths': $writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath'); foreach ($this->writeableFolders as $folder_path) { $file_path = FULL_PATH . str_replace('$1', $writeable_base, $folder_path); if (file_exists($file_path) && !is_writable($file_path)) { $this->errorMessage = '
Installation can not continue until all required permissions are set correctly'; break; } } break; case 'clean_db': // don't use Application, because all tables will be erased and it will crash $sql = 'SELECT Path FROM ' . TABLE_PREFIX . 'Modules'; $modules = $this->Conn->GetCol($sql); foreach ($modules as $module_folder) { $remove_file = '/' . $module_folder . 'install/remove_schema.sql'; if (file_exists(FULL_PATH . $remove_file)) { $this->toolkit->RunSQL($remove_file); } } $this->toolkit->deleteEditTables(); $this->currentStep = $this->GetNextStep(); break; case 'db_config': case 'db_reconfig': $fields = Array ( 'DBType', 'DBHost', 'DBName', 'DBUser', 'DBUserPassword', 'DBCollation', 'TablePrefix' ); // set fields foreach ($fields as $field_name) { $submit_value = $this->GetVar($field_name); if ($submit_value !== false) { $this->toolkit->setSystemConfig('Database', $field_name, $submit_value); } /*else { $this->toolkit->setSystemConfig('Database', $field_name, ''); }*/ } break; case 'download_license': $license_source = $this->GetVar('license_source'); if ($license_source !== false && $license_source != 1) { // previous step was "Select License" and not "Download from Intechnic" option was selected $this->currentStep = $this->GetNextStep(); } break; case 'choose_modules': // if no modules found, then proceed to next step $modules = $this->ScanModules(); if (!$modules) { $this->currentStep = $this->GetNextStep(); } break; case 'select_theme': // put available theme list in database $this->toolkit->rebuildThemes(); break; case 'upgrade_modules': // get installed modules from db and compare their versions to upgrade script $modules = $this->GetUpgradableModules(); if (!$modules) { $this->currentStep = $this->GetNextStep(); } break; case 'skin_upgrade': if ($this->Application->RecallVar('SkinUpgradeLog') === false) { // no errors during skin upgrade -> skip this step $this->currentStep = $this->GetNextStep(); } break; case 'install_setup': if ( $this->Application->TableFound(TABLE_PREFIX . 'UserSession', true) ) { // update to 5.2.0 -> rename session table before using it // don't rename any other table here, since their names could be used in upgrade script $this->Conn->Query('RENAME TABLE ' . TABLE_PREFIX . 'UserSession TO ' . TABLE_PREFIX . 'UserSessions'); $this->Conn->Query('RENAME TABLE ' . TABLE_PREFIX . 'SessionData TO ' . TABLE_PREFIX . 'UserSessionData'); } $next_preset = $this->Application->GetVar('next_preset'); if ($next_preset !== false) { $user_helper = $this->Application->recallObject('UserHelper'); /* @var $user_helper UserHelper */ $username = $this->Application->GetVar('login'); $password = $this->Application->GetVar('password'); if ($username == 'root') { // verify "root" user using configuration settings $login_result = $user_helper->loginUser($username, $password); if ($login_result != LoginResult::OK) { $error_phrase = $login_result == LoginResult::NO_PERMISSION ? 'la_no_permissions' : 'la_invalid_password'; $this->errorMessage = $this->Application->Phrase($error_phrase) . '. If you don\'t know your username or password, contact Intechnic Support'; } } else { // non "root" user -> verify using licensing server $url_params = Array ( 'login' => md5($username), 'password' => md5($password), 'action' => 'check', 'license_code' => base64_encode( $this->toolkit->getSystemConfig('Intechnic', 'LicenseCode') ), 'version' => '4.3.0',//$this->toolkit->GetMaxModuleVersion('core/'), 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ $curl_helper->SetRequestData($url_params); $file_data = $curl_helper->Send(GET_LICENSE_URL); if ( !$curl_helper->isGoodResponseCode() ) { $this->errorMessage = 'In-Portal servers temporarily unavailable. Please contact In-Portal support personnel directly.'; } elseif (substr($file_data, 0, 5) == 'Error') { $this->errorMessage = substr($file_data, 6) . ' If you don\'t know your username or password, contact Intechnic Support'; } if ($this->errorMessage == '') { $user_helper->loginUserById(USER_ROOT); } } if ($this->errorMessage == '') { // processed with redirect to selected step preset if (!isset($this->steps[$next_preset])) { $this->errorMessage = 'Preset "'.$next_preset.'" not yet implemented'; } else { $this->stepsPreset = $next_preset; } } } else { // if preset was not choosen, then raise error $this->errorMessage = 'Please select action to perform'; } break; case 'security': // perform write check if ($this->Application->GetVar('skip_security_check')) { // administrator intensionally skips security checks break; } $write_check = true; $check_paths = Array ('/', '/index.php', $this->toolkit->defaultWritablePath . '/config.php', ADMIN_DIRECTORY . '/index.php'); foreach ($check_paths as $check_path) { $path_check_status = $this->toolkit->checkWritePermissions(FULL_PATH . $check_path); if (is_bool($path_check_status) && $path_check_status) { $write_check = false; break; } } // script execute check if (file_exists(WRITEABLE . '/install_check.php')) { unlink(WRITEABLE . '/install_check.php'); } $fp = fopen(WRITEABLE . '/install_check.php', 'w'); fwrite($fp, "Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ $output = $curl_helper->Send($this->Application->BaseURL(WRITEBALE_BASE) . 'install_check.php'); unlink(WRITEABLE . '/install_check.php'); $execute_check = ($output !== 'OK'); $directive_check = true; $ini_vars = Array ('register_globals' => false, 'open_basedir' => true, 'allow_url_fopen' => false); foreach ($ini_vars as $var_name => $var_value) { $current_value = ini_get($var_name); if (($var_value && !$current_value) || (!$var_value && $current_value)) { $directive_check = false; break; } } if (!$write_check || !$execute_check || !$directive_check) { $this->errorMessage = true; } /*else { $this->currentStep = $this->GetNextStep(); }*/ break; } $this->PerformValidation(); // returns validation status (just in case) } /** * Validates data entered by user * * @return bool */ function PerformValidation() { if ($this->GetVar('step') != $this->currentStep) { // just redirect from previous step, don't validate return true; } $status = true; switch ($this->currentStep) { case 'db_config': case 'db_reconfig': // 1. check if required fields are filled $section_name = 'Database'; $required_fields = Array ('DBType', 'DBHost', 'DBName', 'DBUser', 'DBCollation'); foreach ($required_fields as $required_field) { if (!$this->toolkit->getSystemConfig($section_name, $required_field)) { $status = false; $this->errorMessage = 'Please fill all required fields'; break; } } if ( !$status ) { break; } // 2. check permissions, that use have in this database $status = $this->CheckDatabase(($this->currentStep == 'db_config') && !$this->GetVar('UseExistingSetup')); break; case 'select_license': $license_source = $this->GetVar('license_source'); if ($license_source == 2) { // license from file -> file must be uploaded $upload_error = $_FILES['license_file']['error']; if ($upload_error != UPLOAD_ERR_OK) { $this->errorMessage = 'Missing License File'; } } elseif (!is_numeric($license_source)) { $this->errorMessage = 'Please select license'; } $status = $this->errorMessage == ''; break; case 'root_password': // check, that password & verify password match $password = $this->Application->GetVar('root_password'); $password_verify = $this->Application->GetVar('root_password_verify'); if ($password != $password_verify) { $this->errorMessage = 'Passwords does not match'; } elseif (mb_strlen($password) < 4) { $this->errorMessage = 'Root Password must be at least 4 characters'; } $status = $this->errorMessage == ''; break; case 'choose_modules': break; case 'upgrade_modules': $modules = $this->Application->GetVar('modules'); if (!$modules) { $modules = Array (); $this->errorMessage = 'Please select module(-s) to ' . ($this->currentStep == 'choose_modules' ? 'install' : 'upgrade'); } // check interface module $upgrade_data = $this->GetUpgradableModules(); if (array_key_exists('core', $upgrade_data) && !in_array('core', $modules)) { // core can be upgraded, but isn't selected $this->errorMessage = 'Please select "Core" as interface module'; } $status = $this->errorMessage == ''; break; } return $status; } /** * Perform installation step actions * */ function Run() { if ($this->errorMessage) { // was error during data validation stage return ; } switch ($this->currentStep) { case 'db_config': case 'db_reconfig': // store db configuration $sql = 'SHOW COLLATION LIKE \''.$this->toolkit->getSystemConfig('Database', 'DBCollation').'\''; $collation_info = $this->Conn->Query($sql); if ($collation_info) { $this->toolkit->setSystemConfig('Database', 'DBCharset', $collation_info[0]['Charset']); // database is already connected, that's why set collation on the fly $this->Conn->Query('SET NAMES \''.$this->toolkit->getSystemConfig('Database', 'DBCharset').'\' COLLATE \''.$this->toolkit->getSystemConfig('Database', 'DBCollation').'\''); } $this->toolkit->SaveConfig(); if ($this->currentStep == 'db_config') { if ($this->GetVar('UseExistingSetup')) { // abort clean install and redirect to already_installed $this->stepsPreset = 'already_installed'; break; } // import base data into new database, not for db_reconfig $this->toolkit->RunSQL('/core/install/install_schema.sql'); $this->toolkit->RunSQL('/core/install/install_data.sql'); // create category using sql, because Application is not available here $table_name = $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'IdGenerator'; $this->Conn->Query('UPDATE ' . $table_name . ' SET lastid = lastid + 1'); $resource_id = $this->Conn->GetOne('SELECT lastid FROM ' . $table_name); if ($resource_id === false) { $this->Conn->Query('INSERT INTO '.$table_name.' (lastid) VALUES (2)'); $resource_id = 2; } // can't use USER_ROOT constant, since Application isn't available here $fields_hash = Array ( 'l1_Name' => 'Content', 'l1_MenuTitle' => 'Content', 'Filename' => 'Content', 'AutomaticFilename' => 0, 'CreatedById' => -1, 'CreatedOn' => time(), 'ResourceId' => $resource_id - 1, 'l1_Description' => 'Content', 'Status' => 4, ); $this->Conn->doInsert($fields_hash, $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'Categories'); $this->toolkit->SetModuleRootCategory('Core', $this->Conn->getInsertID()); // set module "Core" version after install (based on upgrade scripts) $this->toolkit->SetModuleVersion('Core', 'core/'); // for now we set "In-Portal" module version to "Core" module version (during clean install) $this->toolkit->SetModuleVersion('In-Portal', 'core/'); } break; case 'select_license': // reset memory cache, when application is first available (on fresh install and clean reinstall steps) $this->Application->HandleEvent(new kEvent('adm:OnResetMemcache')); $license_source = $this->GetVar('license_source'); switch ($license_source) { case 1: // Download from Intechnic break; case 2: // Upload License File $file_data = array_map('trim', file($_FILES['license_file']['tmp_name'])); if ((count($file_data) == 3) && $file_data[1]) { $modules_helper = $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ if ($modules_helper->verifyLicense($file_data[1])) { $this->toolkit->setSystemConfig('Intechnic', 'License', $file_data[1]); $this->toolkit->setSystemConfig('Intechnic', 'LicenseCode', $file_data[2]); $this->toolkit->SaveConfig(); } else { $this->errorMessage = 'Invalid License File'; } } else { $this->errorMessage = 'Invalid License File'; } break; case 3: // Use Existing License $license_hash = $this->toolkit->getSystemConfig('Intechnic', 'License'); if ($license_hash) { $modules_helper = $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ if (!$modules_helper->verifyLicense($license_hash)) { $this->errorMessage = 'Invalid or corrupt license detected'; } } else { // happens, when browser's "Back" button is used $this->errorMessage = 'Missing License File'; } break; case 4: // Skip License (Local Domain Installation) if ($this->toolkit->sectionFound('Intechnic')) { // remove any previous license information $this->toolkit->setSystemConfig('Intechnic', 'License'); $this->toolkit->setSystemConfig('Intechnic', 'LicenseCode'); $this->toolkit->SaveConfig(); } break; } break; case 'download_license': $license_login = $this->GetVar('login'); $license_password = $this->GetVar('password'); $license_id = $this->GetVar('licenses'); $curl_helper = $this->Application->recallObject('CurlHelper'); /* @var $curl_helper kCurlHelper */ if (strlen($license_login) && strlen($license_password) && !$license_id) { // Here we determine weather login is ok & check available licenses $url_params = Array ( 'login' => md5($license_login), 'password' => md5($license_password), 'version' => $this->toolkit->GetMaxModuleVersion('core/'), 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); $curl_helper->SetRequestData($url_params); $file_data = $curl_helper->Send(GET_LICENSE_URL); if (!$file_data) { // error connecting to licensing server $this->errorMessage = 'Unable to connect to the Intechnic server! Please try again later!'; } else { if (substr($file_data, 0, 5) == 'Error') { // after processing data server returned error $this->errorMessage = substr($file_data, 6); } else { // license received if (substr($file_data, 0, 3) == 'SEL') { // we have more, then one license -> let user choose $this->SetVar('license_selection', base64_encode( substr($file_data, 4) )); // we received html with radio buttons with names "licenses" $this->errorMessage = 'Please select which license to use'; } else { // we have one license $this->toolkit->processLicense($file_data); } } } } else if (!$license_id) { // licenses were not queried AND user/password missing $this->errorMessage = 'Incorrect Username or Password. If you don\'t know your username or password, contact Intechnic Support'; } else { // Here we download license $url_params = Array ( 'license_id' => md5($license_id), 'dlog' => md5($license_login), 'dpass' => md5($license_password), 'version' => $this->toolkit->GetMaxModuleVersion('core/'), 'domain' => base64_encode($_SERVER['HTTP_HOST']), ); $curl_helper->SetRequestData($url_params); $file_data = $curl_helper->Send(GET_LICENSE_URL); if (!$file_data) { // error connecting to licensing server $this->errorMessage = 'Unable to connect to the Intechnic server! Please try again later!'; } else { if (substr($file_data, 0, 5) == 'Error') { // after processing data server returned error $this->errorMessage = substr($file_data, 6); } else { $this->toolkit->processLicense($file_data); } } } break; case 'select_domain': $modules_helper = $this->Application->recallObject('ModulesHelper'); /* @var $modules_helper kModulesHelper */ // get domain name as entered by user on the form $domain = $this->GetVar('domain') == 1 ? $_SERVER['HTTP_HOST'] : str_replace(' ', '', $this->GetVar('other')); $license_hash = $this->toolkit->getSystemConfig('Intechnic', 'License'); if ($license_hash) { // when license present, then extract domain from it $license_hash = base64_decode($license_hash); list ( , , $license_keys) = $modules_helper->_ParseLicense($license_hash); $license_domain = $license_keys[0]['domain']; } else { // when license missing, then use current domain or domain entered by user $license_domain = $domain; } if ($domain != '') { if (strstr($domain, $license_domain) || $modules_helper->_IsLocalSite($domain)) { $this->toolkit->setSystemConfig('Misc', 'Domain', $domain); $this->toolkit->SaveConfig(); } else { $this->errorMessage = 'Domain name entered does not match domain name in the license!'; } } else { $this->errorMessage = 'Please enter valid domain!'; } break; case 'sys_config': $config_data = $this->GetVar('system_config'); foreach ($config_data as $section => $section_vars) { foreach ($section_vars as $var_name => $var_value) { $this->toolkit->setSystemConfig($section, $var_name, $var_value); } } $this->toolkit->SaveConfig(); break; case 'root_password': // update root password in database $password_formatter = $this->Application->recallObject('kPasswordFormatter'); /* @var $password_formatter kPasswordFormatter */ $config_values = Array ( 'RootPass' => $password_formatter->hashPassword($this->Application->GetVar('root_password')), 'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . 'backupdata', 'DefaultEmailSender' => 'portal@' . $this->toolkit->getSystemConfig('Misc', 'Domain') ); $site_timezone = date_default_timezone_get(); if ($site_timezone) { $config_values['Config_Site_Time'] = $site_timezone; } $this->toolkit->saveConfigValues($config_values); $user_helper = $this->Application->recallObject('UserHelper'); /* @var $user_helper UserHelper */ // login as "root", when no errors on password screen $user_helper->loginUser('root', $this->Application->GetVar('root_password')); // import base language for core (english) $this->toolkit->ImportLanguage('/core/install/english'); // make sure imported language is set as active in session, created during installation $this->Application->Session->SetField('Language', 1); // set imported language as primary $lang = $this->Application->recallObject('lang.-item', null, Array('skip_autoload' => true)); /* @var $lang LanguagesItem */ $lang->Load(1); // fresh install => ID=1 $lang->setPrimary(true); // for Front-End break; case 'choose_modules': // run module install scripts $modules = $this->Application->GetVar('modules'); if ($modules) { foreach ($modules as $module) { $install_file = MODULES_PATH.'/'.$module.'/install.php'; if (file_exists($install_file)) { include_once($install_file); } } } // update category cache $updater = $this->Application->makeClass('kPermCacheUpdater'); /* @var $updater kPermCacheUpdater */ $updater->OneStepRun(); break; case 'post_config': $this->toolkit->saveConfigValues( $this->GetVar('config') ); break; case 'select_theme': // 1. mark theme, that user is selected $theme_id = $this->GetVar('theme'); $theme_table = $this->Application->getUnitOption('theme', 'TableName'); $theme_idfield = $this->Application->getUnitOption('theme', 'IDField'); $sql = 'UPDATE ' . $theme_table . ' SET Enabled = 1, PrimaryTheme = 1 WHERE ' . $theme_idfield . ' = ' . $theme_id; $this->Conn->Query($sql); $this->toolkit->rebuildThemes(); // rescan theme to create structure after theme is enabled !!! // install theme dependent demo data if ($this->Application->GetVar('install_demo_data')) { $sql = 'SELECT Name FROM ' . $theme_table . ' WHERE ' . $theme_idfield . ' = ' . $theme_id; $theme_name = $this->Conn->GetOne($sql); $site_path = $this->toolkit->getSystemConfig('Misc', 'WebsitePath') . '/'; $file_helper = $this->Application->recallObject('FileHelper'); /* @var $file_helper FileHelper */ foreach ($this->Application->ModuleInfo as $module_name => $module_info) { if ($module_name == 'In-Portal') { continue; } $template_path = '/themes' . '/' . $theme_name . '/' . $module_info['TemplatePath']; $this->toolkit->RunSQL( $template_path . '_install/install_data.sql', Array('{ThemeId}', '{SitePath}'), Array($theme_id, $site_path) ); if ( file_exists(FULL_PATH . $template_path . '_install/images') ) { // copy theme demo images into writable path accessible by FCKEditor $file_helper->copyFolderRecursive(FULL_PATH . $template_path . '_install/images' . DIRECTORY_SEPARATOR, WRITEABLE . '/user_files/Images'); } } } break; case 'upgrade_modules': // get installed modules from db and compare their versions to upgrade script $modules = $this->Application->GetVar('modules'); if ($modules) { $upgrade_data = $this->GetUpgradableModules(); $start_from_query = $this->Application->GetVar('start_from_query'); $this->upgradeDepencies = $this->getUpgradeDependencies($modules, $upgrade_data); if ($start_from_query !== false) { $this->upgradeLog = unserialize( $this->Application->RecallVar('UpgradeLog') ); } else { $start_from_query = 0; $this->upgradeLog = Array ('ModuleVersions' => Array ()); // remember each module version, before upgrade scripts are executed foreach ($modules as $module_name) { $module_info = $upgrade_data[$module_name]; $this->upgradeLog['ModuleVersions'][$module_name] = $module_info['FromVersion']; } $this->Application->RemoveVar('UpgradeLog'); } // 1. perform "php before", "sql", "php after" upgrades foreach ($modules as $module_name) { $module_info = $upgrade_data[$module_name]; /*echo '

Upgrading "' . $module_info['Name'] . '" to "' . $module_info['ToVersion'] . '"

' . "\n"; flush();*/ if (!$this->RunUpgrade($module_info['Name'], $module_info['ToVersion'], $upgrade_data, $start_from_query)) { $this->Application->StoreVar('UpgradeLog', serialize($this->upgradeLog)); $this->Done(); } // restore upgradable module version (makes sense after sql error processing) $upgrade_data[$module_name]['FromVersion'] = $this->upgradeLog['ModuleVersions'][$module_name]; } // 2. import language pack, perform "languagepack" upgrade for all upgraded versions foreach ($modules as $module_name) { $module_info = $upgrade_data[$module_name]; $sqls =& $this->getUpgradeQueriesFromVersion($module_info['Path'], $module_info['FromVersion']); preg_match_all('/' . VERSION_MARK . '/s', $sqls, $regs); // import module language pack $this->toolkit->ImportLanguage('/' . $module_info['Path'] . 'install/english', true); // perform advanced language pack upgrade foreach ($regs[1] as $version) { $this->RunUpgradeScript($module_info['Path'], $version, 'languagepack'); } } // 3. update all theme language packs $themes_helper = $this->Application->recallObject('ThemesHelper'); /* @var $themes_helper kThemesHelper */ $themes_helper->synchronizeModule(false); // 4. upgrade admin skin if (in_array('core', $modules)) { $skin_upgrade_log = $this->toolkit->upgradeSkin($upgrade_data['core']); if ($skin_upgrade_log === true) { $this->Application->RemoveVar('SkinUpgradeLog'); } else { $this->Application->StoreVar('SkinUpgradeLog', serialize($skin_upgrade_log)); } // for now we set "In-Portal" module version to "Core" module version (during upgrade) $this->toolkit->SetModuleVersion('In-Portal', false, $upgrade_data['core']['ToVersion']); } } break; case 'finish': // delete cache $this->toolkit->deleteCache(); $this->toolkit->rebuildThemes(); // compile admin skin, so it will be available in 3 frames at once $skin_helper = $this->Application->recallObject('SkinHelper'); /* @var $skin_helper SkinHelper */ $skin = $this->Application->recallObject('skin', null, Array ('skip_autoload' => true)); /* @var $skin kDBItem */ $skin->Load(1, 'IsPrimary'); $skin_helper->compile($skin); // set installation finished mark if ($this->Application->ConfigValue('InstallFinished') === false) { $fields_hash = Array ( 'VariableName' => 'InstallFinished', 'VariableValue' => 1, ); $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SystemSettings'); } break; } if ($this->errorMessage) { // was error during run stage return ; } $this->currentStep = $this->GetNextStep(); $this->InitStep(); // init next step (that will be shown now) $this->InitApplication(); if ($this->currentStep == -1) { // step after last step -> redirect to admin $user_helper = $this->Application->recallObject('UserHelper'); /* @var $user_helper UserHelper */ $user_helper->logoutUser(); $this->Application->Redirect($user_helper->event->redirect, $user_helper->event->getRedirectParams(), '', 'index.php'); } } function getUpgradeDependencies($modules, &$upgrade_data) { $dependencies = Array (); foreach ($modules as $module_name) { $module_info = $upgrade_data[$module_name]; $upgrade_object =& $this->getUpgradeObject($module_info['Path']); if (!is_object($upgrade_object)) { continue; } foreach ($upgrade_object->dependencies as $dependent_version => $version_dependencies) { if (!$version_dependencies) { // module is independent -> skip continue; } list ($parent_name, $parent_version) = each($version_dependencies); if (!array_key_exists($parent_name, $dependencies)) { // parent module $dependencies[$parent_name] = Array (); } if (!array_key_exists($parent_version, $dependencies[$parent_name])) { // parent module versions, that are required by other module versions $dependencies[$parent_name][$parent_version] = Array (); } $dependencies[$parent_name][$parent_version][] = Array ($module_info['Name'] => $dependent_version); } } return $dependencies; } /** * Returns database queries, that should be executed to perform upgrade from given to lastest version of given module path * * @param string $module_path * @param string $from_version * @return string */ function &getUpgradeQueriesFromVersion($module_path, $from_version) { $upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'sql'); $sqls = file_get_contents($upgrades_file); $version_mark = preg_replace('/(\(.*?\))/', $from_version, VERSION_MARK); // get only sqls from next (relative to current) version to end of file $start_pos = strpos($sqls, $version_mark); $sqls = substr($sqls, $start_pos); return $sqls; } function RunUpgrade($module_name, $to_version, &$upgrade_data, &$start_from_query) { $module_info = $upgrade_data[ strtolower($module_name) ]; $sqls =& $this->getUpgradeQueriesFromVersion($module_info['Path'], $module_info['FromVersion']); preg_match_all('/(' . VERSION_MARK . ')/s', $sqls, $matches, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); foreach ($matches as $index => $match) { // upgrade version $version = $match[2][0]; if ($this->toolkit->ConvertModuleVersion($version) > $this->toolkit->ConvertModuleVersion($to_version)) { // only upgrade to $to_version, not further break; } if (!in_array($module_name . ':' . $version, $this->upgradeLog)) { if ($this->Application->isDebugMode()) { $this->Application->Debugger->appendHTML('Upgrading "' . $module_name . '" to "' . $version . '" version: BEGIN.'); } /*echo 'Upgrading "' . $module_name . '" to "' . $version . '".
' . "\n"; flush();*/ // don't upgrade same version twice $start_pos = $match[0][1] + strlen($match[0][0]); $end_pos = array_key_exists($index + 1, $matches) ? $matches[$index + 1][0][1] : strlen($sqls); $version_sqls = substr($sqls, $start_pos, $end_pos - $start_pos); if ($start_from_query == 0) { $this->RunUpgradeScript($module_info['Path'], $version, 'before'); } if (!$this->toolkit->RunSQLText($version_sqls, null, null, $start_from_query)) { $this->errorMessage .= ''; $this->errorMessage .= '
Module "' . $module_name . '" upgrade to "' . $version . '" failed.'; $this->errorMessage .= '
Click Continue button below to skip this query and go further
'; return false; } else { // reset query counter, when all queries were processed $start_from_query = 0; } $this->RunUpgradeScript($module_info['Path'], $version, 'after'); if ($this->Application->isDebugMode()) { $this->Application->Debugger->appendHTML('Upgrading "' . $module_name . '" to "' . $version . '" version: END.'); } // remember, that we've already upgraded given version $this->upgradeLog[] = $module_name . ':' . $version; } if (array_key_exists($module_name, $this->upgradeDepencies) && array_key_exists($version, $this->upgradeDepencies[$module_name])) { foreach ($this->upgradeDepencies[$module_name][$version] as $dependency_info) { list ($dependent_module, $dependent_version) = each($dependency_info); if (!$this->RunUpgrade($dependent_module, $dependent_version, $upgrade_data, $start_from_query)) { return false; } } } // only mark module as updated, when all it's dependent modules are upgraded $this->toolkit->SetModuleVersion($module_name, false, $version); } return true; } /** * Run upgrade PHP scripts for module with specified path * * @param string $module_path * @param Array $version * @param string $mode upgrade mode = {before,after,languagepack} */ function RunUpgradeScript($module_path, $version, $mode) { $upgrade_object =& $this->getUpgradeObject($module_path); if (!is_object($upgrade_object)) { return ; } $upgrade_method = 'Upgrade_' . str_replace(Array ('.', '-'), '_', $version); if (method_exists($upgrade_object, $upgrade_method)) { $upgrade_object->$upgrade_method($mode); } } /** * Returns upgrade class for given module path * * @param string $module_path * @return kUpgradeHelper */ function &getUpgradeObject($module_path) { static $upgrade_classes = Array (); $upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'php'); if (!file_exists($upgrades_file)) { $false = false; return $false; } if (!isset($upgrade_classes[$module_path])) { require_once(FULL_PATH . REL_PATH . '/install/upgrade_helper.php'); // save class name, because 2nd time (in after call) // $upgrade_class variable will not be present include_once $upgrades_file; $upgrade_classes[$module_path] = $upgrade_class; } $upgrade_object = new $upgrade_classes[$module_path](); /* @var $upgrade_object CoreUpgrades */ $upgrade_object->setToolkit($this->toolkit); return $upgrade_object; } /** * Initialize kApplication * * @param bool $force initialize in any case */ function InitApplication($force = false) { if (($force || !in_array($this->currentStep, $this->skipApplicationSteps)) && !isset($this->Application)) { // step is allowed for application usage & it was not initialized in previous step global $start, $debugger, $dbg_options; include_once(FULL_PATH.'/core/kernel/startup.php'); $this->Application =& kApplication::Instance(); $this->toolkit->Application =& kApplication::Instance(); $this->includeModuleConstants(); $this->Application->Init(); $this->Conn =& $this->Application->GetADODBConnection(); $this->toolkit->Conn =& $this->Application->GetADODBConnection(); } } /** * When no modules installed, then pre-include all modules contants, since they are used in unit configs * */ function includeModuleConstants() { $modules = $this->ScanModules(); foreach ($modules as $module_path) { $constants_file = MODULES_PATH . '/' . $module_path . '/constants.php'; if ( file_exists($constants_file) ) { kUtil::includeOnce($constants_file); } } } /** * Show next step screen * * @param string $error_message * @return void */ function Done($error_message = null) { if ( isset($error_message) ) { $this->errorMessage = $error_message; } include_once (FULL_PATH . '/' . REL_PATH . '/install/incs/install.tpl'); if ( isset($this->Application) ) { $this->Application->Done(); } exit; } function ConnectToDatabase() { include_once FULL_PATH . '/core/kernel/db/db_connection.php'; $required_keys = Array ('DBType', 'DBUser', 'DBName'); foreach ($required_keys as $required_key) { if (!$this->toolkit->getSystemConfig('Database', $required_key)) { // one of required db connection settings missing -> abort connection return false; } } $this->Conn = new kDBConnection($this->toolkit->getSystemConfig('Database', 'DBType'), Array(&$this, 'DBErrorHandler')); $this->Conn->setup( $this->toolkit->systemConfig ); // setup toolkit too $this->toolkit->Conn =& $this->Conn; return !$this->Conn->hasError(); } /** * Checks if core is already installed * * @return bool */ function AlreadyInstalled() { $table_prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix'); $settings_table = $this->TableExists('ConfigurationValues') ? 'ConfigurationValues' : 'SystemSettings'; $sql = 'SELECT VariableValue FROM ' . $table_prefix . $settings_table . ' WHERE VariableName = "InstallFinished"'; return $this->TableExists($settings_table) && $this->Conn->GetOne($sql); } function CheckDatabase($check_installed = true) { // perform various check type to database specified // 1. user is allowed to connect to database // 2. user has all types of permissions in database // 3. database environment settings met minimum requirements if (mb_strlen($this->toolkit->getSystemConfig('Database', 'TablePrefix')) > 7) { $this->errorMessage = 'Table prefix should not be longer than 7 characters'; return false; } // connect to database $status = $this->ConnectToDatabase(); if ($status) { // if connected, then check if all sql statements work $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; $sql_tests[] = 'CREATE TABLE test_table(test_col mediumint(6))'; $sql_tests[] = 'LOCK TABLES test_table WRITE'; $sql_tests[] = 'INSERT INTO test_table(test_col) VALUES (5)'; $sql_tests[] = 'UPDATE test_table SET test_col = 12'; $sql_tests[] = 'UNLOCK TABLES'; $sql_tests[] = 'ALTER TABLE test_table ADD COLUMN new_col varchar(10)'; $sql_tests[] = 'SELECT * FROM test_table'; $sql_tests[] = 'DELETE FROM test_table'; $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; foreach ($sql_tests as $sql_test) { $this->Conn->Query($sql_test); if ($this->Conn->getErrorCode() != 0) { $status = false; break; } } if ($status) { // if statements work & connection made, then check table existance if ($check_installed && $this->AlreadyInstalled()) { $this->errorMessage = 'An In-Portal Database already exists at this location'; return false; } $requirements_error = Array (); $db_check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckDBRequirements'); if ( !$db_check_results['version'] ) { $requirements_error[] = '- MySQL Version is below 5.0'; } if ( !$db_check_results['packet_size'] ) { $requirements_error[] = '- MySQL Packet Size is below 1 MB'; } if ( $requirements_error ) { $this->errorMessage = 'Connection successful, but following system requirements were not met:
' . implode('
', $requirements_error); return false; } } else { // user has insufficient permissions in database specified $this->errorMessage = 'Permission Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg(); return false; } } else { // was error while connecting if (!$this->Conn) return false; $this->errorMessage = 'Connection Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg(); return false; } return true; } /** * Checks if all passed tables exists * * @param string $tables comma separated tables list * @return bool */ function TableExists($tables) { $prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix'); $all_found = true; $tables = explode(',', $tables); foreach ($tables as $table_name) { $sql = 'SHOW TABLES LIKE "'.$prefix.$table_name.'"'; if (count($this->Conn->Query($sql)) == 0) { $all_found = false; break; } } return $all_found; } /** * Returns modules list found in modules folder * * @return Array */ function ScanModules() { static $modules = null; if ( !isset($modules) ) { // use direct include, because it's called before kApplication::Init, that creates class factory kUtil::includeOnce( KERNEL_PATH . kApplication::MODULE_HELPER_PATH ); $modules_helper = new kModulesHelper(); $modules = $modules_helper->getModules(); } return $modules; } /** * Virtually place module under "modules" folder or it won't be recognized during upgrade to 5.1.0 version * * @param string $name * @param string $path * @param string $version * @return string */ function getModulePath($name, $path, $version) { if ($name == 'Core') { // don't transform path for Core module return $path; } if (!preg_match('/^modules\//', $path)) { // upgrade from 5.0.x/1.0.x to 5.1.x/1.1.x return 'modules/' . $path; } return $path; } /** * Returns list of modules, that can be upgraded * */ function GetUpgradableModules() { $ret = Array (); foreach ($this->Application->ModuleInfo as $module_name => $module_info) { if ($module_name == 'In-Portal') { // don't show In-Portal, because it shares upgrade scripts with Core module continue; } $module_info['Path'] = $this->getModulePath($module_name, $module_info['Path'], $module_info['Version']); $upgrades_file = sprintf(UPGRADES_FILE, $module_info['Path'], 'sql'); if (!file_exists($upgrades_file)) { // no upgrade file continue; } $sqls = file_get_contents($upgrades_file); $versions_found = preg_match_all('/'.VERSION_MARK.'/s', $sqls, $regs); if (!$versions_found) { // upgrades file doesn't contain version definitions continue; } $to_version = end($regs[1]); $this_version = $this->toolkit->ConvertModuleVersion($module_info['Version']); if ($this->toolkit->ConvertModuleVersion($to_version) > $this_version) { // destination version is greather then current foreach ($regs[1] as $version) { if ($this->toolkit->ConvertModuleVersion($version) > $this_version) { $from_version = $version; break; } } $version_info = Array ( 'FromVersion' => $from_version, 'ToVersion' => $to_version, ); $ret[ strtolower($module_name) ] = array_merge($module_info, $version_info); } } return $ret; } /** * Returns content to show for current step * * @return string */ function GetStepBody() { $step_template = FULL_PATH.'/core/install/step_templates/'.$this->currentStep.'.tpl'; if (file_exists($step_template)) { ob_start(); include_once ($step_template); return ob_get_clean(); } return '{step template "'.$this->currentStep.'" missing}'; } /** * Parses step information file, cache result for current step ONLY & return it * * @return Array */ function &_getStepInfo() { static $info = Array('help_title' => null, 'step_title' => null, 'help_body' => null, 'queried' => false); if (!$info['queried']) { $fdata = file_get_contents($this->StepDBFile); $parser = xml_parser_create(); xml_parse_into_struct($parser, $fdata, $values, $index); xml_parser_free($parser); foreach ($index['STEP'] as $section_index) { $step_data =& $values[$section_index]; if ($step_data['attributes']['NAME'] == $this->currentStep) { $info['step_title'] = $step_data['attributes']['TITLE']; if (isset($step_data['attributes']['HELP_TITLE'])) { $info['help_title'] = $step_data['attributes']['HELP_TITLE']; } else { // if help title not set, then use step title $info['help_title'] = $step_data['attributes']['TITLE']; } $info['help_body'] = trim($step_data['value']); break; } } $info['queried'] = true; } return $info; } /** * Returns particular information abou current step * * @param string $info_type * @return string */ function GetStepInfo($info_type) { $step_info =& $this->_getStepInfo(); if (isset($step_info[$info_type])) { return $step_info[$info_type]; } return '{step "'.$this->currentStep.'"; param "'.$info_type.'" missing}'; } /** * Returns passed steps titles * * @param Array $steps * @return Array * @see kInstaller:PrintSteps */ function _getStepTitles($steps) { $fdata = file_get_contents($this->StepDBFile); $parser = xml_parser_create(); xml_parse_into_struct($parser, $fdata, $values, $index); xml_parser_free($parser); $ret = Array (); foreach ($index['STEP'] as $section_index) { $step_data =& $values[$section_index]; if (in_array($step_data['attributes']['NAME'], $steps)) { $ret[ $step_data['attributes']['NAME'] ] = $step_data['attributes']['TITLE']; } } return $ret; } /** * Returns current step number in active steps_preset. * Value can't be cached, because same step can have different number in different presets * * @return int */ function GetStepNumber() { return array_search($this->currentStep, $this->steps[$this->stepsPreset]) + 1; } /** * Returns step name to process next * * @return string */ function GetNextStep() { $next_index = $this->GetStepNumber(); if ($next_index > count($this->steps[$this->stepsPreset]) - 1) { return -1; } return $this->steps[$this->stepsPreset][$next_index]; } /** * Returns step name, that was processed before this step * * @return string */ function GetPreviousStep() { $next_index = $this->GetStepNumber() - 1; if ($next_index < 0) { $next_index = 0; } return $this->steps[$this->stepsPreset][$next_index]; } /** * Prints all steps from active steps preset and highlights current step * * @param string $active_tpl * @param string $passive_tpl * @return string */ function PrintSteps($active_tpl, $passive_tpl) { $ret = ''; $step_titles = $this->_getStepTitles($this->steps[$this->stepsPreset]); foreach ($this->steps[$this->stepsPreset] as $step_name) { $template = $step_name == $this->currentStep ? $active_tpl : $passive_tpl; $ret .= sprintf($template, $step_titles[$step_name]); } return $ret; } /** * Installation error handler for sql errors * * @param int $code * @param string $msg * @param string $sql * @return bool * @access private */ function DBErrorHandler($code, $msg, $sql) { $this->errorMessage = 'Query:
'.htmlspecialchars($sql, ENT_QUOTES, 'UTF-8').'
execution result is error:
['.$code.'] '.$msg; return true; } /** * Installation error handler * * @param int $errno * @param string $errstr * @param string $errfile * @param int $errline * @param Array|string $errcontext */ function ErrorHandler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = '') { if ($errno == E_USER_ERROR) { // only react on user fatal errors $this->Done($errstr); } } /** * Checks, that given button should be visible on current installation step * * @param string $name * @return bool */ function buttonVisible($name) { $button_visibility = Array ( 'continue' => $this->GetNextStep() != -1 || ($this->stepsPreset == 'already_installed'), 'refresh' => in_array($this->currentStep, Array ('sys_requirements', 'check_paths', 'security')), 'back' => in_array($this->currentStep, Array (/*'select_license',*/ 'download_license', 'select_domain')), ); if ($name == 'any') { foreach ($button_visibility as $button_name => $button_visible) { if ($button_visible) { return true; } } return false; } return array_key_exists($name, $button_visibility) ? $button_visibility[$name] : true; } } Index: branches/5.2.x/composer.json =================================================================== --- branches/5.2.x/composer.json (revision 0) +++ branches/5.2.x/composer.json (revision 16117) @@ -0,0 +1,5 @@ +{ + "require-dev": { + "aik099/coding-standard": "dev-in-portal" + } +} Index: branches/5.2.x/composer.lock =================================================================== --- branches/5.2.x/composer.lock (revision 0) +++ branches/5.2.x/composer.lock (revision 16117) @@ -0,0 +1,59 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "4c8225aabf36f626240d5615afd5c66b", + "packages": [], + "packages-dev": [ + { + "name": "aik099/coding-standard", + "version": "dev-in-portal", + "source": { + "type": "git", + "url": "https://github.com/aik099/CodingStandard.git", + "reference": "e389596b9b1fc8f67f1cca34a1c8bdd9d85104d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aik099/CodingStandard/zipball/e389596b9b1fc8f67f1cca34a1c8bdd9d85104d0", + "reference": "e389596b9b1fc8f67f1cca34a1c8bdd9d85104d0", + "shasum": "" + }, + "require-dev": { + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Alexander Obuhovich", + "email": "aik.bold@gmail.com" + } + ], + "description": "The PHP_CodeSniffer coding standard I'm using on all of my projects.", + "keywords": [ + "PHP_CodeSniffer", + "codesniffer" + ], + "time": "2014-12-29 12:08:25" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "aik099/coding-standard": 20 + }, + "prefer-stable": false, + "platform": [], + "platform-dev": [] +} Property changes on: branches/5.2.x ___________________________________________________________________ Modified: svn:ignore - testing .buildpath .idea atlassian-ide-plugin.xml .project .settings + testing .buildpath .idea vendor atlassian-ide-plugin.xml .project .settings