Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Apr 19, 12:48 AM

in-portal

Index: branches/5.0.x/core/install/steps_db.xml
===================================================================
--- branches/5.0.x/core/install/steps_db.xml (revision 12203)
+++ branches/5.0.x/core/install/steps_db.xml (revision 12204)
@@ -1,94 +1,137 @@
<steps>
- <step name="clean_db" title="Clean database">
+ <step name="clean_db" title="Clean Database">
<![CDATA[missing step description]]>
</step>
<step name="db_config" title="Database Configuration">
- <![CDATA[Host name (<i>normally "localhost"</i>), Database user name, and database Password.
- These fields are required to connect to the database.</p><p>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 <i>before</i> the names of the tables used by In-Portal. For example, if you enter "inp_"
- into the prefix field, the table named Category will be named inp_Category.</p>]]>
+ <![CDATA[<p><b><i>Database Hostname</i></b> - IP or hostname of your database server (normally <i>"localhost"</i>).</p>
+
+ <p><b><i>Database Name</i></b> - name of the database where In-Portal will be installed.</p>
+ <p><b><i>Database User Name</i></b> - name of the user for selected database.</p>
+ <p><b><i>Database User Password</i></b> - password for selected username.</p>
+ <p><b><i>Database Collation</i></b> - character set used to store data in text fields (normally <i>"utf8_general_ci"</i>).</p>
+ <p><b><i>Prefix for Table Names</i></b> - 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 <i>"inp_"</i>).</p>
+ <p><b><i>Use existing In-Portal installation setup in this Database</i></b> - select <i>"Yes"</i>
+ if you already have In-Portal installed in this database and want to use it. Select <i>"No"</i> in all other cases.</p>
+ ]]>
</step>
<step name="select_license" title="Select License" help_title="License Configuration">
- <![CDATA[<p>A License is required to run In-Portal on a server connected to the Internet.
- You can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.
- If Intechnic has provided you with a license file, upload it here. Otherwise select the first
- option to allow Install to download your license for you.</p><p>If a valid license has been
- detected on your server, you can choose the <i>Use Existing License</i> and continue
- the installation process</p>]]>
+ <![CDATA[<p><b>In-Portal is an Open Source</b> object-oriented framework that is developed in PHP
+ and provides a quick and easy way to build websites and web applications.</p>
+
+ <p>In-Portal is copyrighted and distributed under <a href="http://www.in-portal.net/license" target="_blank">GPLv2 license</a>.</p>
+
+ <p><b><i>GPL / Open Source License</i></b> - by downloading and installing In-Portal
+ under GPLv2 license you understand and agree to all terms of the
+ <a href="http://www.in-portal.net/license" target="_blank">GPLv2 license</a>.</p>
+
+ <p><b><i>Upload License File</i></b> - if you have obtained Commercial
+ <a href="http://www.in-portal.net/in-commerce/products_listing.html" target="_blank">Modules</a>
+ or <a href="http://dev.in-portal.net/support-downloads/customer-support.html" target="_blank">Support</a>
+ from Intechnic you'll be provided with a license file, upload it here.</p>
+ <!--
+ <p><b><i>Download from Intechnic Servers</i></b> - .</p>
+ -->
+ <p><b><i>Use Existing License</i></b> - if a valid license has been detected on your server,
+ you can choose this option and continue the installation process.</p>]]>
</step>
<step name="download_license" title="Download License" help_title="Download License from Intechnic">
- <![CDATA[<p>A License is required to run In-Portal on a server connected to the Internet. You
- can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.</p>
- <p>Here as you have selected download license from Intechnic you have to input your username
- and password of your In-Business account in order to download all your available licenses.</p>]]>
+ <![CDATA[<p><b>In-Portal is an Open Source</b> object-oriented framework that is developed in PHP
+ and provides a quick and easy way to build websites and web applications.</p>
+
+ <p>In-Portal is copyrighted and distributed under <a href="http://www.in-portal.net/license" target="_blank">GPLv2 license</a>.</p>
+
+ <p><b><i>GPL / Open Source License</i></b> - by downloading and installing In-Portal
+ under GPLv2 license you understand and agree to all terms of
+ <a href="http://www.in-portal.net/license" target="_blank">GPLv2 license</a>.</p>
+
+ <p><b><i>Download from Intechnic Servers</i></b> - if you have obtained Commercial
+ <a href="http://www.in-portal.net/in-commerce/products_listing.html" target="_blank">Modules</a>
+ or <a href="http://dev.in-portal.net/support-downloads/customer-support.html" target="_blank">Support</a>
+ from Intechnic you'll be provided with a license, specify your Username and Password in order to download the license.</p>]]>
</step>
<step name="select_domain" title="Select Domain" help_title="Select Licensed Domain">
- <![CDATA[<p>Select the domain you wish to configure In-Portal for. The <i>Other</i> option can be
- used to configure In-Portal for use on a local domain.</p> For local domains, enter the hostname or
- LAN IP Address of the machine running In-Portal.</p>]]>
+ <![CDATA[<p>Select the domain you wish to install In-Portal on.</p>
+
+ <p>The <i>Other</i> option can be used to install In-Portal other custom domains. Note that your web server should match entered domain name.</p>]]>
</step>
<step name="root_password" title="Set Root Password" help_title="Set Admin Root Password">
- <![CDATA[<p>The Root Password is initially required to access the admin sections of In-Portal.
- The root user cannot be used to access the front-end of the system, so it is recommended that you
- create additional users with admin privlidges.</p>]]>
- </step>
- <step name="choose_modules" title="Select Modules to Install">
- <![CDATA[<p>Select the In-Portal modules you wish to install. The modules listed to the right
- are all modules included in this installation that are licensed to run on this server. </p>]]>
+ <![CDATA[<p>The <b>Root Password</b> is initially required to access the Admin Console of In-Portal.
+ The root user can <b>NOT</b> be used to access the Front-end of your In-Portal website.</p>
+
+ <p>Once installation is completed it's highly recommented to create additional users with admin privlidges.</p>]]>
+ </step>
+ <step name="choose_modules" title="Modules to Install">
+ <![CDATA[<p>Please select additional In-Portal Modules you wish to install during this installation.</p>
+
+ <p>These and other Modules can be downloaded and installed later at any time.</p>]]>
</step>
<step name="check_paths" title="Filesystem Check">
<![CDATA[<b>Write</b><br />Shows folder and files, that write permissions should be adjusted
to allow web server to write data into them.]]>
</step>
- <step name="post_config" title="General Site Setup">
- <![CDATA[<p>These options define the general operation of In-Portal. Items listed here are
- required for In-Portal's operation.</p><p>When you have finished, click <i>save</i> to
- continue.</p>]]>
+ <step name="post_config" title="Basic Configuration">
+ <![CDATA[<p>Please adjust Basic Configuration settings here.</p>
+
+ <p>Once your In-Portal is installed you can login into Admin Console to change these and other settings. The Configuration section is located in the main website navigation.</p>]]>
</step>
<step name="select_theme" title="Select Default Theme">
- <![CDATA[<p>This theme will be used whenever a front-end session is started. if you intend to
- upload a new theme and use that as default, you can do so through the admin at a later date.
- A default theme is required for session management.</p>]]>
+ <![CDATA[<p>Selected theme will be used as a default in your In-Portal website.</p>
+ <p>You can manage your themes in Admin Console via Configuration -> Website -> Themes section.</p>]]>
</step>
- <step name="security" title="Security Checks">
- <![CDATA[<p>This step checks security level on your hosting account.</p>]]>
+ <step name="security" title="Security Check">
+ <![CDATA[<p>Final security check for In-Portal performed here.</p>
+
+ <p><b><i>Write Permissions Check</i></b> - checks whether critical In-Portal files are open for the outside world and can be used by hackers to attack your websites. <b>You won't be able to continue until you correctly set these permissions!</b></p>
+
+ <p><b><i>Ability to Execute PHP in Writable Folders</i></b> - checks if hackers can save and execute PHP files in your /system
+ folder used for the uploads. While it's recommened to adjust the settings it's not requored to complete the installation.</p>
+
+ ]]>
</step>
<step name="finish" title="Installation Complete" help_title="Thank You!">
- <![CDATA[<p>Thanks for using In-Portal! Be sure to visit <a target="_new" href="http://www.in-portal.net">www.in-portal.net</a>
- for the latest news, module releases and support. </p>
- <p>*Make sure to clean your browser' cache after upgrading In-portal version</p>]]>
+ <![CDATA[<p>Thanks for downloading and installing In-Portal!</p>
+
+ <p>Be sure to visit <a target="_new" href="http://www.in-portal.net">www.in-portal.net</a> for the latest news, module releases and support.</p>
+ <p><span class="error">*</span> Make sure to clean your browser cache after upgrading to new In-Portal version</p>]]>
</step>
<step name="install_setup" title="Installation Maintenance">
<![CDATA[<p>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 provide the Intechnic
- Username and Password you used when obtaining the license file residing on the server, or your admin Root password.
- <i>(Use Username 'root' if using your root password)</i></p>
- <p>To removing your existing database and start with a fresh installation, select the first option
- provided. Note that this operation cannot be undone and no backups are made! Use at your own risk.</p>
- <p>If you wish to scrap your current installation and install to a new location, choose the second option.
+ In order to work with the maintenance functions provided to the left you must enter your admin Root password.
+ <b><i>(Use Username 'root' if using your root password)</i></b></p>
+
+ <p><b><i>Upgrade In-Portal</i></b> - 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.</p>
+
+ <p><b><i>Reinstall In-Portal</i></b> - cleans out your existing In-Portal database and starts with a fresh installation.
+ <i>Note</i> that this operation cannot be undone and no backups are made! Use at your own risk.</p>
+
+ <p><b><i>Install In-Portal to a New Database</i></b> - 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.</p>
- <p>The <i>Update License Information</i> option is used to update your In-Portal license data. Select this option if you have
- modified your licensing status with Intechnic, or you have received new license data via email</p>
- <p>The <i>Fix Paths</i> option should be used when the location of the In-portal files has changed.
- For example, if you moved them from one folder to another. It will update all settings and ensure the
- program is operational at the new location.</p>]]>
+
+ <p><b><i>Update License Information</i></b> - 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.</p>
+ <p><b><i>Update Database Configuration</i></b> - allows you to update your current database configuration variables such as
+ database server host, username, password and others.</p>
+
+ <p><b><i>Update Installation Paths</i></b> - 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.</p>]]>
</step>
<step name="upgrade_modules" title="Select Modules to Upgrade">
<![CDATA[<p>Select modules from the list, you need to update to the last downloaded version of In-Portal</p>]]>
</step>
- <step name="db_reconfig" title="Change Database Configuration">
+ <step name="db_reconfig" title="Update Database Configuration">
<![CDATA[<p>In-Portal needs to connect to your Database Server. Please provide the database server type*,
host name (<i>normally "localhost"</i>), Database user name, and database Password. These fields are required
to connect to the database.</p><p>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 <i>before</i> the names of the tables used by In-Portal.
For example, if you enter "inp_" into the prefix field, the table named Category will be named inp_Category.</p>]]>
</step>
- <step name="fix_paths" title="Fix Paths">
- <![CDATA[The <i>Fix Paths</i> option should be used when the location of the In-portal files has changed.
+ <step name="fix_paths" title="Update Installation Paths">
+ <![CDATA[The <i>Fix Paths</i> option should be used when the location of the In-Portal files has changed.
For example, if you moved them from one folder to another. It will update all settings and ensure the program
is operational at the new location.]]>
</step>
</steps>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/db_reconfig.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/db_reconfig.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/db_reconfig.tpl (revision 12204)
@@ -1,67 +1,67 @@
<tr class="table-color2">
- <td class="text"><b>Server Type<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Server Type<span class="error">*</span>:</b></td>
<td align="left">
<select name="DBType">
<?php
$options = Array ('mysql' => 'MySQL', /*'mssql' => 'MS-SQL Server', 'pgsql' => 'pgSQL'*/);
$option_tpl = '<option value="%1$s"%2$s>%3$s</option>'."\n";
foreach ($options as $option_key => $option_title) {
$selected = $option_key == $this->toolkit->getSystemConfig('Database', 'DBType') ? ' selected' : '';
echo sprintf($option_tpl, $option_key, $selected, $option_title);
}
?>
</select>
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Hostname<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Hostname <span class="error">*</span>:</b></td>
<td align="left">
<input type="text" name="DBHost" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBHost'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database Name<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Name <span class="error">*</span>:</b></td>
<td align="left">
<input type="text" name="DBName" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBName'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database Collation<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database User Name <span class="error">*</span>:</b></td>
<td align="left">
- <select name="DBCollation" class="text">
- <?php
- $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
- $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
- foreach ($collations as $collation) {
- $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : '';
- echo sprintf($option_tpl, $collation, $selected);
- }
- ?>
- </select>
+ <input type="text" name="DBUser" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUser'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database User Name<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database User Password:</b></td>
<td align="left">
- <input type="text" name="DBUser" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUser'); ?>" />
+ <input type="password" name="DBUserPassword" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUserPassword'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database User Password:</b></td>
+ <td class="text"><b>Database Collation <span class="error">*</span>:</b></td>
<td align="left">
- <input type="password" name="DBUserPassword" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUserPassword'); ?>" />
+ <select name="DBCollation" class="text">
+ <?php
+ $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
+ $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
+ foreach ($collations as $collation) {
+ $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : '';
+ echo sprintf($option_tpl, $collation, $selected);
+ }
+ ?>
+ </select>
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Table Name Prefix:</b></td>
+ <td class="text"><b>Prefix for Table Names:</b></td>
<td align="left">
<input type="text" name="TablePrefix" class="text" maxlength="7" value="<?php echo $this->toolkit->getSystemConfig('Database', 'TablePrefix'); ?>" />
</td>
</tr>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/select_license.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/select_license.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/select_license.tpl (revision 12204)
@@ -1,41 +1,42 @@
<?php
$license_found = $this->toolkit->getSystemConfig('Intechnic', 'License');
$license_source = $this->GetVar('license_source');
- if (($license_source === false) && $license_found) {
+ if ( ($license_source === false) && $license_found ) {
$license_source = 3;
}
- if (!$license_found && $license_source == 3) {
- // when disabled option is selected -> select 1st available
- $license_source = 1;
+ if ( !$license_found && (!$license_source || $license_source == 3) ) {
+ // when disabled option is selected -> select 1st available - open source
+ $license_source = 4;
}
?>
+
<tr class="table-color2">
<td class="text">
- <input type="radio" name="license_source" id="license_source_1" value="1"<?php if ($license_source == 1) echo ' checked'; ?>><label for="license_source_1">Download from Intechnic</label>
+ <input type="radio" name="license_source" id="license_source_4" value="4"<?php if ($license_source == 4) echo ' checked'; ?>><label for="license_source_4">GPL / Open Source License (<a href="http://www.in-portal.net/license" target="_blank">http://www.in-portal.net/license</a>)</label>
</td>
</tr>
<tr class="table-color2">
<td class="text">
<input type="radio" name="license_source" id="license_source_2" value="2"<?php if ($license_source == 2) echo ' checked'; ?>><label for="license_source_2">Upload License File:</label>
<input type="file" class="button" name="license_file" onclick="document.getElementById('license_source_2').checked = true;">
</td>
</tr>
-
+<!--
+<tr class="table-color2">
+ <td class="text">
+ <input type="radio" name="license_source" id="license_source_1" value="1"<?php if ($license_source == 1) echo ' checked'; ?>><label for="license_source_1">Download from Intechnic Servers</label>
+ </td>
+</tr>
+-->
<tr class="table-color2">
<?php
?>
<td class="text">
<input <?php if (!$license_found) echo 'disabled="disabled"'; ?> type="radio" name="license_source" id="license_source_3" value="3"<?php if ($license_source == 3) echo ' checked'; ?>><label for="license_source_3">Use Existing License</label>
</td>
</tr>
-
-<tr class="table-color2">
- <td class="text">
- <input type="radio" name="license_source" id="license_source_4" value="4"<?php if ($license_source == 4) echo ' checked'; ?>><label for="license_source_4">GPL/Open Source License (<a href="http://www.in-portal.net/license" target="_blank">http://www.in-portal.net/license</a>)</label>
- </td>
-</tr>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/install_setup.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/install_setup.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/install_setup.tpl (revision 12204)
@@ -1,55 +1,55 @@
<tr class="table-color2">
<td colspan="2">
- In order to use the installation tool, please provide your Intechnic account information:
+ In order to use this installation tool, please identify yourself using the root password!
</td>
</tr>
<tr class="table-color2">
<td class="text">
- <b>Username<span class="error">*</span>:</b>
+ <b>Username<span class="error"> *</span>:</b>
</td>
<td width="80%">
<input type="text" name="login" value="<?php echo $this->GetVar('login'); ?>" class="text" />
</td>
</tr>
<tr class="table-color2">
<td class="text">
- <b>Password<span class="error">*</span>:</b>
+ <b>Password<span class="error"> *</span>:</b>
</td>
<td>
<input type="password" name="password" class="text" />
</td>
</tr>
<?php
ob_start();
?>
<tr class="%4$s">
<td colspan="2">
<input type="radio" value="%1$s" name="next_preset" id="next_preset_%1$s"%2$s><label for="next_preset_%1$s">%3$s</label></span>
</td>
</tr>
<?php
$option_tpl = ob_get_clean();
$options = Array (
'upgrade' => 'Upgrade In-Portal',
- 'clean_reinstall' => 'Clean out the In-Portal database and reinstall',
- 2 => 'Install to a new database',
+ 'clean_reinstall' => 'Reinstall In-Portal',
+ 2 => 'Install In-Portal to a New Database',
'update_license' => 'Update License Information',
- 'db_reconfig' => 'Change Database Configuration',
- 'fix_paths' => 'Fix Paths',
+ 'db_reconfig' => 'Update Database Configuration',
+ 'fix_paths' => 'Update Installation Paths',
);
$upgradable_modules = $this->GetUpgradableModules();
if (!$upgradable_modules) {
unset($options['upgrade']);
}
$td_class = 'table-color1';
foreach ($options as $option_key => $option_title) {
$checked = $this->GetVar('next_preset') == $option_key ? ' checked' : '';
echo sprintf($option_tpl, $option_key, $checked, $option_title, $td_class);
$td_class = ($td_class == 'table-color1') ? 'table-color2' : 'table-color1';
}
?>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/security.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/security.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/security.tpl (revision 12204)
@@ -1,79 +1,78 @@
<?php
$heading_tpl = '
- <tr class="table-color2">
- <td class="%2$s" colspan="2">%1$s</td>
+ <tr class="subsectiontitle">
+ <td class="%2$s" colspan="2" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000;">%1$s</td>
</tr>';
$error_tpl = '
<tr class="table-color2">
<td class="text">%s</td>
<td align="left">%s</td>
</tr>';
$output = '';
$write_check = true;
$check_paths = Array ('/', '/index.php', '/config.php', ADMIN_DIRECTORY . '/index.php');
foreach ($check_paths as $check_path) {
$path_secure = true;
if ($this->toolkit->checkWritePermissions(FULL_PATH . $check_path)) {
$write_check = $path_secure = false;
}
$status_text = $path_secure ? '<span style="color: green;">Secure</span>' : '<span style="color: red;">Vulnerable</span>';
$output .= sprintf($error_tpl, $check_path, $status_text);
}
$skip_check = $write_check ? '<input type="hidden" name="skip_security_check" value="' . (int)$write_check . '"/>' : '';
$output = sprintf($heading_tpl, '<strong>Write Permissions Check</strong>' . $skip_check, 'text') . $output;
if (!$write_check) {
$output .= ' <tr class="table-color2">
- <td class="error" colspan="2">
- For security reasons it\'s highly recommended to set 755 permissions on above files to prevent hacking attempts.
- </td>
+ <td class="error" colspan="2">
+ For security reasons it\'s highly recommended to set 755 permissions on above files to prevent hackers from attacking your website!<br /><br /></td>
</tr>';
}
// script execute check
if (file_exists(WRITEABLE . '/install_check.php')) {
unlink(WRITEABLE . '/install_check.php');
}
$fp = fopen(WRITEABLE . '/install_check.php', 'w');
fwrite($fp, "<?php\n\techo 'OK';\n");
fclose($fp);
$curl_helper =& $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$result = $curl_helper->Send($this->Application->BaseURL(WRITEBALE_BASE) . 'install_check.php');
unlink(WRITEABLE . '/install_check.php');
$execute_check = ($result !== 'OK');
- $output .= sprintf($heading_tpl, '<br /><strong>Ability to Execute PHP in Writable Folders</strong>', 'text');
+ $output .= sprintf($heading_tpl, '<strong>Ability to Execute PHP in Writable Folders</strong>', 'text');
$status_text = $execute_check ? '<span style="color: green;">Secure</span>' : '<span style="color: red;">Vulnerable</span>';
$output .= sprintf($error_tpl, 'Result of creating and executing PHP file(s) in "/system" (or "/system/images") folder', $status_text);
if (!$execute_check) {
$output .= '<tr class="table-color2">
- <td class="error" colspan="2">
+ <td colspan="2">
For security reasons it\'s highly recommended disable the access (execution) to PHP files within "/system" folder and it\'s subfolders.
</td>
</tr>
<tr class="table-color2">
<td class="text" colspan="2">
You can do this by:<br/><br/>
<ul style="margin: 0px; padding-left: 15px;">
- <li>changing your "httpd.conf" file to deny requests for all "*.php" files;</li>
- <li>renaming ".htaccess-sample" (located in "/system") to ".htaccess" so it overrides default Apache settings.</li>
+ <li>changing your "httpd.conf" file to deny requests for all "*.php" files</li>
+ <li>renaming ".htaccess-sample" (located in "/system") to ".htaccess" so it overrides default Apache settings</li>
</ul>
<br/>Note that "AllowOverride LIMIT" option should be enabled by your hosting provider.
</td>
</tr>';
}
echo $output;
?>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/db_config.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/db_config.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/db_config.tpl (revision 12204)
@@ -1,74 +1,74 @@
<tr class="table-color2">
- <td class="text"><b>Server Type<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Server Type <span class="error">*</span>:</b></td>
<td align="left">
<select name="DBType">
<?php
$options = Array ('mysql' => 'MySQL', /*'mssql' => 'MS-SQL Server', 'pgsql' => 'pgSQL'*/);
$option_tpl = '<option value="%1$s"%2$s>%3$s</option>'."\n";
foreach ($options as $option_key => $option_title) {
$selected = $option_key == $this->toolkit->getSystemConfig('Database', 'DBType') ? ' selected' : '';
echo sprintf($option_tpl, $option_key, $selected, $option_title);
}
?>
</select>
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Hostname<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Hostname <span class="error">*</span>:</b></td>
<td align="left">
<input type="text" name="DBHost" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBHost'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database Name<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database Name <span class="error">*</span>:</b></td>
<td align="left">
<input type="text" name="DBName" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBName'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database Collation<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database User Name <span class="error">*</span>:</b></td>
<td align="left">
- <select name="DBCollation" class="text">
- <?php
- $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
- $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
- foreach ($collations as $collation) {
- $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : '';
- echo sprintf($option_tpl, $collation, $selected);
- }
- ?>
- </select>
+ <input type="text" name="DBUser" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUser'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database User Name<span class="error">*</span>:</b></td>
+ <td class="text"><b>Database User Password:</b></td>
<td align="left">
- <input type="text" name="DBUser" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUser'); ?>" />
+ <input type="password" name="DBUserPassword" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUserPassword'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Database User Password:</b></td>
+ <td class="text"><b>Database Collation <span class="error">*</span>:</b></td>
<td align="left">
- <input type="password" name="DBUserPassword" class="text" value="<?php echo $this->toolkit->getSystemConfig('Database', 'DBUserPassword'); ?>" />
+ <select name="DBCollation" class="text">
+ <?php
+ $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
+ $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
+ foreach ($collations as $collation) {
+ $selected = ($collation == $this->toolkit->getSystemConfig('Database', 'DBCollation')) ? ' selected="selected"' : '';
+ echo sprintf($option_tpl, $collation, $selected);
+ }
+ ?>
+ </select>
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Table Name Prefix:</b></td>
+ <td class="text"><b>Prefix for Table Names:</b></td>
<td align="left">
<input type="text" name="TablePrefix" class="text" maxlength="7" value="<?php echo $this->toolkit->getSystemConfig('Database', 'TablePrefix'); ?>" />
</td>
</tr>
<tr class="table-color2">
- <td class="text"><b>Use existing installation:</b></td>
+ <td class="text" width="55%"><b>Use existing In-Portal installation in this Database:</b></td>
<td align="left">
<input type="radio" name="UseExistingSetup" id="UseExistingSetup_1" value="1"/> <label for="UseExistingSetup_1">Yes</label> <input type="radio" name="UseExistingSetup" id="UseExistingSetup_0" value="0" checked/> <label for="UseExistingSetup_0">No</label>
</td>
</tr>
\ No newline at end of file
Index: branches/5.0.x/core/install/step_templates/post_config.tpl
===================================================================
--- branches/5.0.x/core/install/step_templates/post_config.tpl (revision 12203)
+++ branches/5.0.x/core/install/step_templates/post_config.tpl (revision 12204)
@@ -1,86 +1,107 @@
<?php
ob_start();
?>
<inp2:m_Set module="In-Portal" section="in-portal:configure_general"/>
<inp2:m_include t="incs/config_blocks"/>
<inp2:m_DefineElement name="config_edit_text">
<input type="text" tabindex="<inp2:m_get param='tab_index'/>" name="config[<inp2:Field name='VariableName'/>]" value="<inp2:Field field='$field'/>" <inp2:m_param name='field_params' />/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_select">
<select name="config[<inp2:Field name='VariableName'/>]" tabindex="<inp2:m_get param="tab_index"/>">
<inp2:PredefinedOptions field="$field" block="config_edit_option" selected="selected"/>
</select>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_checkbox" field_class="">
<input type="hidden" id="<inp2:InputName field="$field"/>" name="config[<inp2:Field name='VariableName'/>]" value="<inp2:Field field="$field" db="db"/>">
<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:m_param name="field"/>" name="_cb_<inp2:InputName field="$field"/>" <inp2:Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:InputName field="$field"/>'))">
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_textarea">
<textarea tabindex="<inp2:m_get param='tab_index'/>" name="config[<inp2:Field name='VariableName'/>]" <inp2:m_param name="field_params" />><inp2:Field field="$field" /></textarea>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_radio_item">
<input type="radio" <inp2:m_param name='checked'/> name="config[<inp2:Field name='VariableName'/>]" id="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>"><label for="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_block">
<inp2:m_inc param="tab_index" by="1"/>
<inp2:m_if check="m_ParamEquals" name="show_heading" value="1">
<tr class="subsectiontitle">
<td colspan="3" style="<inp2:m_if check='m_Get' name='first_row' inverse='inverse'>border-top: 1px solid #000000; </inp2:m_if>border-bottom: 1px solid #000000;">
<inp2:Field name="heading" as_label="1"/>
</td>
</tr>
<inp2:m_Set first_row="0"/>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:field field="$IdField"/>" header_label="<inp2:Field name="heading"/>">
<td>
<inp2:Field field="prompt" as_label="1" />
<inp2:m_if check="m_IsDebugMode">
<br><small>[<inp2:Field field="DisplayOrder"/>] <inp2:Field field="VariableName"/></small>
</inp2:m_if>
</td>
<td>
<inp2:ConfigFormElement PrefixSpecial="$PrefixSpecial" field="VariableValue" blocks_prefix="config_edit_" element_type_field="element_type" value_list_field="ValueList"/>
</td>
<td class="error"><inp2:Error id_field="VariableName"/>&nbsp;</td>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_block1">
<inp2:m_inc param="tab_index" by="1"/>
<inp2:m_if check="m_ParamEquals" name="show_heading" value="1">
<tr class="subsectiontitle">
<td colspan="3" style="<inp2:m_if check='m_Get' name='first_row' inverse='inverse'>border-top: 1px solid #000000; </inp2:m_if>border-bottom: 1px solid #000000;">
<inp2:Field name="heading" as_label="1"/>
</td>
</tr>
<inp2:m_Set first_row="0"/>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="$IdField"/>" header_label="<inp2:Field name="heading"/>">
<td>
<inp2:Field field="prompt" as_label="1" />
<inp2:m_if check="m_IsDebugMode">
<br><small>[<inp2:Field field="DisplayOrder"/>] <inp2:Field field="VariableName"/></small>
</inp2:m_if>
</td>
<td>
<nobr><inp2:ConfigFormElement PrefixSpecial="$PrefixSpecial" field="VariableValue" blocks_prefix="config_edit_" element_type_field="element_type" value_list_field="ValueList"/>&nbsp;&nbsp;
</inp2:m_DefineElement>
<inp2:m_Set first_row="1"/>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bordered" id="config_table">
<inp2:conf_PrintList list_name="default" block="config_block" full_block="config_block" half_block1="config_block1" half_block2="config_block2" per_page="-1"/>
+
+
+ <tr class="subsectiontitle">
+ <td colspan="3" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000;">
+ Additional Recommendations
+ </td>
+ </tr>
+ <tr class="table-color1">
+ <td colspan="3">
+ <p><b>1. Use Cron</b> (<a href="http://en.wikipedia.org/wiki/Cron" target="_blank">UNIX/BSD/Linux</a>) or <b>Task Scheduler</b> (<a href="http://en.wikipedia.org/wiki/Task_Scheduler" target="_blank">Windows</a>) to run Regular Events in your In-Portal.<br />
+ It's highly recommended to setup your cron to run <b>every minute</b> 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 <b><i>Configuration -> Website -> Agents</i></b> section.
+ <p>In-Portal <b>cron</b> file is located in <b>/tools/cron.php</b> folder and can be setup using hosting Control Panel or <a href="http://en.wikipedia.org/wiki/Cron" target="_blank">manually</a>. In Plesk or CPanel interfaces use dialog to add a new cron job and specify the following (use correct paths)<br />
+ &nbsp;&nbsp;&nbsp;<b>/absolute/path/to/bin/php -f /absolute/path/to/in-portal/tools/cron.php</b></p>
+
+ <p><b>2. Review and adjust Agents</b><br />
+ As was explained in the previous recommendation there is a <b><i>Configuration -> Website -> Agents</i></b> 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.</p>
+ <p><b>3. Update Mail Server settings</b><br />
+ 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 <b><i>Configuration -> Website -> Advanced</i></b> section.</p>
+ </td>
+ </tr>
+
</table>
<?php
$this->Application->InitParser();
echo '<tr><td colspan="2" style="padding: 0px;">' . $this->Application->Parser->Parse(ob_get_clean(), 'post_config') . '</td></tr>';
?>
\ No newline at end of file
Index: branches/5.0.x/core/install/incs/install.tpl
===================================================================
--- branches/5.0.x/core/install/incs/install.tpl (revision 12203)
+++ branches/5.0.x/core/install/incs/install.tpl (revision 12204)
@@ -1,159 +1,161 @@
<html>
<head>
<title>In-Portal Installation</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<base href="<?php echo $this->baseURL; ?>"/>
<link rel="stylesheet" type="text/css" href="incs/style.css" />
<script type="text/javascript" src="incs/script.js"></script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="height: 100%">
<form enctype="multipart/form-data" id="install_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<!-- header: begin -->
<tr>
<td height="90">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="90">
<tr>
<td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img title="In-portal" src="incs/img/globe.gif" width="84" height="91" border="0" alt="In-Portal"/></a></td>
<td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img title="In-portal" src="incs/img/logo.gif" width="150" height="91" border="0" alt="In-Portal"/></a></td>
<td rowspan="3" width="100%" align="right">&nbsp;</td>
<td width="400"><img title="" src="incs/img/blocks.gif" width="400" height="73" alt="blocks" /></td>
</tr>
<tr><td align="right" background="incs/img/version_bg.gif" class="head_version" valign="top"><img title="" src="incs/img/spacer.gif" width="1" height="14" alt=""/>In-Portal Version <?php echo $this->toolkit->GetMaxModuleVersion('Core'); ?>: English US</td></tr>
<tr><td><img title="" src="incs/img/blocks2.gif" width="400" height="2" alt="blocks2"/><br /></td></tr>
<tr><td bgcolor="black" colspan="4"><img title="" src="incs/img/spacer.gif" width="1" height="1" alt=""/><br /></td></tr>
</table>
</td>
</tr>
<!-- header: end -->
<tr height="100%">
<td valign="top">
<table cellpadding=10 cellspacing=0 border=0 width="100%" height="100%">
<tr valign="top">
<td style="width: 200px; background: #009ff0 url(incs/img/bg_install_menu.gif) no-repeat bottom right; border-right: 1px solid #000">
<img src="incs/img/spacer.gif" width="180" height="1" border="0" alt="" /><br />
<span class="admintitle-white">Installation</span>
<ol class="install-steps">
<?php
echo $this->PrintSteps('<li class="current-step">%s</li>', '<li>%s</li>');
?>
</ol>
</td>
<td>
<img src="incs/img/icon_install.gif" width="46" height="46" alt="" align="absmiddle" />&nbsp;<span class="admintitle"><?php echo $this->GetStepInfo('step_title'); ?></span><br /><br />
<!-- section header: begin -->
<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">
<tr>
<td class="tablenav" width="580" nowrap background="incs/img/tabnav_left.jpg">
<span class="tablenav_link"><?php echo 'Step '.$this->GetStepNumber().' - '.$this->GetStepInfo('step_title'); ?></span>
</td>
<td align="right" class="tablenav" background="incs/img/tabnav_back.jpg" width="100%">
+ <!--
<a class="link" onclick="ShowHelp('in-portal:install');">
<img src="incs/img/blue_bar_help.gif" border="0">
</a>
+ -->
</td>
</tr>
</table>
<!-- section header: end -->
<!-- toolbar: begin -->
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<tr>
<td>
<a href="javascript:continue_install();">
<img border="0" src="incs/img/toolbar/tool_select.gif" id="img_Save" width="32" height="32" border="0" alt="Save" onmouseout="swap_image('img_Save', 'toolbar/tool_select.gif');" onmouseover="swap_image('img_Save','toolbar/tool_select_f2.gif');" /><br />
</a>
</td>
<td>
<img src="incs/img/toolbar/tool_cancel.gif" id="img_Cancel" width="32" height="32" border="0" alt="Cancel" onmouseout="swap_image('img_Cancel', 'toolbar/tool_cancel.gif');" onmouseover="swap_image('img_Cancel','toolbar/tool_cancel_f2.gif');" onclick="history.go(-1);" /><br />
</td>
<td width="100%">&nbsp;</td>
</tr>
</table>
<!-- toolbar: end -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<!-- step body: begin -->
<?php echo $this->GetStepBody(); ?>
<!-- step body: end -->
<?php
if (is_string($this->errorMessage) && $this->errorMessage) {
?>
<!-- step error message: begin -->
<tr class="table-color2">
<td colspan="2">
<p class="error">
<?php echo $this->errorMessage; ?>
</p>
<br/>
</td>
</tr>
<!-- step error message: end -->
<?php
}
?>
<!-- next, prev buttons: begin -->
<tr>
<td colspan="2">
<br />
<input type="submit" name="submit_form" value="Continue" class="button" />
<?php
if ($this->GetStepNumber() > 1 && $this->GetNextStep() != -1) {
echo '<input type="reset" name="cancel" value="Cancel" class="button" onclick="history.go(-1);" />';
}
?>
<input type="hidden" name="step" value="<?php echo $this->currentStep; ?>"/>
<input type="hidden" name="preset" value="<?php echo $this->stepsPreset; ?>"/>
</td>
</tr>
<!-- next, prev buttons: end -->
</table>
</td>
<td width="40%" style="border-left: 1px solid #000; background: #f0f0f0">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="subsectiontitle">
<td style="border-bottom: 1px solid #000000;"><?php echo $this->GetStepInfo('help_title'); ?></td>
</tr>
<tr>
<td class="text"><?php echo $this->GetStepInfo('help_body'); ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
</td>
</tr>
<tr>
<td class="footer">
- Powered by In-portal &copy; 1997-<?php echo date('Y'); ?>, Intechnic Corporation. All rights reserved.
+ Powered by In-Portal, Copyright &copy; 1997-<?php echo date('Y'); ?> Intechnic. All rights reserved.
<br /><img src="incs/img/spacer.gif" width="1" height="10" alt="" />
</td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
Index: branches/5.0.x/core/install/incs/style.css
===================================================================
--- branches/5.0.x/core/install/incs/style.css (revision 12203)
+++ branches/5.0.x/core/install/incs/style.css (revision 12204)
@@ -1,213 +1,217 @@
html, body {
margin: 0;
padding: 0;
background: #FFFFFF;
- color: #333333;
+ color: #333333;
}
ol.install-steps {
font: bold 12px verdana, sans-serif;
color: #fff;
- line-height: 20px
- }
-
+ line-height: 20px;
+}
+
+.install-steps li {
+ padding-bottom: 3px;
+}
+
.install-steps li.current-step {
- color: #005786
+ color: #FF0000;
}
-/*#nav {
- margin-left: -1px;
+/*#nav {
+ margin-left: -1px;
text-align: center;
- float: left
+ float: left
}
-
+
#content {
padding: 10px;
- color: darkblue;
- float: right
+ color: darkblue;
+ float: right
}
#header {
background-color: #fff;
color: #006;
border-bottom: 1px solid #006;
margin-bottom: 0px
}
*/
-
+
.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;
}
/*
.spacer {clear: both}
dd, dt {
font: 0.95em '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-weight: bold;
font-size: 20px;
- color: #009FF0;
+ color: #009FF0;
font-family: verdana, arial;
text-decoration: none;
}
.admintitle-white {
color: #fff
}
.subsectiontitle {
font-weight: bold;
- font-size: 14px;
+ font-size: 14px;
color: white;
font-family: verdana, arial;
background-color: #999999;
- text-decoration: none;
+ text-decoration: none;
height: 24px;
}
.subsectiontitle:hover {
font-weight: bold;
- font-size: 14px;
- color: #ffcc00;
- font-family: verdana, arial;
+ 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;
+ font-size: 12px;
+ font-family: verdana, arial;
text-decoration: none;
}
.toolbar {
border-right: #000000 1px solid;
border-top: #000000 0px solid;
- font-size: 10pt;
+ font-size: 10pt;
border-left: #000000 1px solid;
border-bottom: #000000 1px solid;
font-family: Arial, Helvetica, sans-serif;
background-color: #F0F1EB;
}
.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;
+ 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;
+ 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;
+ color: black;
font-family: verdana, arial;
background-color: #F6F6F6;
text-decoration: none;
}*/
.table-color2 {
- font-weight: normal;
+ font-weight: normal;
font-size: 14px;
color: black;
- font-family: verdana, arial;
+ font-family: verdana, arial;
background-color: #EBEBEB;
text-decoration: none;
}
.error {
font-weight: bold;
font-size: 9pt;
- color: #ff0000;
+ color: #ff0000;
font-family: Arial, Helvetica, sans-serif;
}
.button {
font-weight: normal;
font-size: 12px;
- background: url(img/button_back.gif) #F9EEAE repeat-x;
+ 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;
}
Index: branches/5.0.x/core/install.php
===================================================================
--- branches/5.0.x/core/install.php (revision 12203)
+++ branches/5.0.x/core/install.php (revision 12204)
@@ -1,1379 +1,1379 @@
<?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.net/license/ for copyright notices and details.
*/
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('IS_INSTALL', 1);
define('ADMIN', 1);
define('FULL_PATH', realpath(dirname(__FILE__).'/..') );
define('REL_PATH', '/core');
// run installator
$install_engine = new kInstallator();
$install_engine->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 = '';
/**
* Installtion steps to be done
*
* @var Array
*/
var $steps = Array (
'fresh_install' => Array ('check_paths', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'),
'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', 'download_license', 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish'),
'already_installed' => Array ('check_paths', 'install_setup'),
'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'security', 'finish'),
'update_license' => Array ('check_paths', 'install_setup', 'select_license', 'download_license', 'select_domain', 'security', 'finish'),
'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'),
'fix_paths' => Array ('check_paths', 'install_setup', 'fix_paths', 'security', 'finish'),
);
/**
* Steps, that doesn't required admin to be logged-in to proceed
*
* @var Array
*/
var $skipLoginSteps = Array ('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 ('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/images',
'$1/images/resized',
'$1/images/pending',
'$1/images/pending/resized',
'$1/images/emoticons', // for "In-Bulletin"
'$1/images/manufacturers', // for "In-Commerce"
'$1/images/manufacturers/resized', // for "In-Commerce"
'$1/images/polls', // for "In-Bulletin"
'$1/images/polls/resized', // for "In-Bulletin"
'$1/backupdata',
'$1/export',
'$1/stylesheets',
'$1/user_files',
'$1/cache',
'/themes',
);
/**
* 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;
/**
* Common tools required for installation process
*
* @var kInstallToolkit
*/
var $toolkit = null;
function Init()
{
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[] = '/config.php';
}
else {
$this->writeableFolders[] = '/';
}
if (!$this->toolkit->getSystemConfig('Misc', 'WriteablePath')) {
// set global writable folder when such setting is missing
$this->toolkit->setSystemConfig('Misc', 'WriteablePath', DIRECTORY_SEPARATOR . 'system');
$this->toolkit->SaveConfig(true); // immediately save, because this path will be used in Application later
}
$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;
}
function GetVar($name)
{
return array_key_exists($name, $_REQUEST) ? $_REQUEST[$name] : false;
}
function SetVar($name, $value)
{
$_REQUEST[$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 '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 = 'Install cannot write to specified folder in the root directory of your installation';
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->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':
if (count($this->toolkit->getThemes(true)) == 1) {
// only one theme -> set it as primary
$sql = 'UPDATE ' . $this->Application->getUnitOption('theme', 'TableName') . '
SET Enabled = 1, PrimaryTheme = 1
LIMIT 1';
$this->Conn->Query($sql);
$this->toolkit->rebuildThemes(); // rescan theme to create structure after theme is enabled !!!
$this->currentStep = $this->GetNextStep();
}
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 'install_setup':
$next_preset = $this->Application->GetVar('next_preset');
if ($next_preset !== false) {
if ($this->Application->GetVar('login') == 'root') {
// verify "root" user using configuration settings
$login_event = new kEvent('u.current:OnLogin');
$this->Application->HandleEvent($login_event);
if ($login_event->status != erSUCCESS) {
$user =& $this->Application->recallObject('u.current');
/* @var $user UsersItem */
$this->errorMessage = $user->GetErrorMsg('ValidateLogin') . '. 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( $this->GetVar('login') ),
'password=' . md5( $this->GetVar('password') ),
'action=check',
'license_code=' . base64_encode( $this->toolkit->getSystemConfig('Intechnic', 'LicenseCode') ),
'version=' . '4.3.0',//$this->toolkit->GetMaxModuleVersion('In-Portal'),
'domain=' . base64_encode($_SERVER['HTTP_HOST']),
);
$license_url = GET_LICENSE_URL . '?' . implode('&', $url_params);
$file_data = curl_post($license_url, '', null, 'GET');
if (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_id = -1;
$session =& $this->Application->recallObject('Session');
$session->SetField('PortalUserId', $user_id);
$this->Application->SetVar('u.current_id', $user_id);
$this->Application->StoreVar('user_id', $user_id);
}
}
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', '/config.php', ADMIN_DIRECTORY . '/index.php');
foreach ($check_paths as $check_path) {
if ($this->toolkit->checkWritePermissions(FULL_PATH . $check_path)) {
$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, "<?php\n\techo 'OK';\n");
fclose($fp);
$curl_helper =& $this->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');
if (!$write_check || !$execute_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
if (!in_array('core', $modules)) {
$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
$fields_hash = Array (
'l1_Name' => 'Content', 'Filename' => 'Content', 'AutomaticFilename' => 0,
'l1_Description' => 'Content', 'Status' => 4,
);
$this->Conn->doInsert($fields_hash, $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'Category');
$this->toolkit->SetModuleRootCategory('Core', $this->Conn->getInsertID());
// set module "Core" version after install (based on upgrade scripts)
$this->toolkit->SetModuleVersion('Core');
}
break;
case 'select_license':
$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');
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('In-Portal'),
'domain=' . base64_encode($_SERVER['HTTP_HOST']),
);
$license_url = GET_LICENSE_URL . '?' . implode('&', $url_params);
$file_data = curl_post($license_url, '', null, 'GET');
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('In-Portal'),
'domain=' . base64_encode($_SERVER['HTTP_HOST']),
);
$license_url = GET_LICENSE_URL . '?' . implode('&', $url_params);
$file_data = curl_post($license_url, '', null, 'GET');
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 */
$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
$license_domain = $_SERVER['HTTP_HOST'];
}
$domain = $this->GetVar('domain') == 1 ? $_SERVER['HTTP_HOST'] : str_replace(' ', '', $this->GetVar('other'));
if ($domain != '') {
if (strstr($domain, $license_domain) || $modules_helper->_IsLocalSite($domain)) {
- $this->toolkit->setSystemConfig('Intechnic', 'Domain', $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 'root_password':
// update root password in database
$password = md5( md5($this->Application->GetVar('root_password')) . 'b38');
$config_values = Array (
'RootPass' => $password,
'Site_Path' => BASE_PATH.'/', // set Site_Path (for SSL & old in-portal code)
'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . 'backupdata',
'Smtp_AdminMailFrom' => 'portal@' . $this->toolkit->getSystemConfig('Intechnic', 'Domain')
);
$this->toolkit->saveConfigValues($config_values);
// import base language for core (english)
$this->toolkit->ImportLanguage('/core/install/english');
// 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);
// set module version after install (based on upgrade scripts)
$this->toolkit->SetModuleVersion($module);
}
}
}
// update category cache
$updater =& $this->Application->recallObject('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 !!!
if ($this->Application->isModuleEnabled('In-Portal')) {
// 2. compile theme stylesheets (only In-Portal uses them)
$css_table = $this->Application->getUnitOption('css', 'TableName');
$css_idfield = $this->Application->getUnitOption('css', 'IDField');
$sql = 'SELECT LOWER(Name) AS Name, ' . $css_idfield . '
FROM ' . $css_table;
$css_hash = $this->Conn->GetCol($sql, $css_idfield);
$css_item =& $this->Application->recallObject('css', null, Array('skip_autoload' => true));
/* @var $css_item StyleshetsItem */
foreach ($css_hash as $stylesheet_id => $theme_name) {
$css_item->Load($stylesheet_id);
$css_item->Compile();
$sql = 'UPDATE ' . $theme_table . '
SET StylesheetId = ' . $stylesheet_id . '
WHERE LOWER(Name) = ' . $this->Conn->qstr($theme_name);
$this->Conn->Query($sql);
}
}
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_module = $this->GetVar('continue_from_module');
$start_from_query = $this->GetVar('continue_from_query');
if (!$start_from_query) $start_from_query = 0;
foreach ($modules as $module_name) {
if ($start_from_module && $module_name != $start_from_module) {
continue;
}
else {
$start_from_module = false; //otherwise it will skip all modules after the one we start with!
}
$module_info = $upgrade_data[$module_name];
$upgrades_file = sprintf(UPGRADES_FILE, $module_info['Path'], 'sql');
$sqls = file_get_contents($upgrades_file);
$version_mark = preg_replace('/(\(.*?\))/', $module_info['FromVersion'], 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);
preg_match_all('/'.VERSION_MARK.'/s', $sqls, $regs);
if (!$start_from_module) {
$this->RunUpgrades($module_info['Path'], $regs[1], 'before');
}
if (!$this->toolkit->RunSQLText($sqls, null, null, $start_from_query)) {
$this->errorMessage .= '<input type="hidden" name="continue_from_module" value="'.$module_name.'">';
$this->errorMessage .= '<input type="hidden" name="continue_from_query" value="'.$this->LastQueryNum.'">';
$this->errorMessage .= '<br/>Click Continue button below to skip this query and go further<br/>';
$this->Done();
}
$start_from_query = 0; // so that next module start from the beggining
$this->toolkit->ImportLanguage('/' . $module_info['Path'] . 'install/english', true);
$this->RunUpgrades($module_info['Path'], $regs[1], 'after'); // upgrade script could operate resulting language pack
// after upgrade sqls are executed update version and upgrade language pack
$this->toolkit->SetModuleVersion($module_name, $module_info['ToVersion']);
}
}
break;
case 'fix_paths':
$this->toolkit->saveConfigValues( $this->Application->GetVar('config') );
break;
case 'finish':
// delete cache
$this->toolkit->deleteCache();
// set installation finished mark
if ($this->Application->ConfigValue('InstallFinished') === false) {
$fields_hash = Array (
'VariableName' => 'InstallFinished',
'VariableValue' => 1,
);
$this->Conn->doInsert($fields_hash, TABLE_PREFIX.'ConfigurationValues');
}
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
$this->Application->Redirect('index', null, '', 'index.php');
}
}
/**
* Run upgrade PHP scripts for module with specified path
*
* @param string $module_path
* @param Array $versions
* @param string $mode upgrade mode = {before,after}
*/
function RunUpgrades($module_path, $versions, $mode)
{
static $upgrade_classes = Array ();
$upgrades_file = sprintf(UPGRADES_FILE, $module_path, 'php');
if (!file_exists($upgrades_file) || !$versions) {
return ;
}
if (!isset($upgrade_classes[$module_path])) {
// 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]();
if (method_exists($upgrade_object, 'setToolkit')) {
$upgrade_object->setToolkit($this->toolkit);
}
foreach ($versions as $version) {
$upgrade_method = 'Upgrade_'.str_replace('.', '_', $version);
if (method_exists($upgrade_object, $upgrade_method)) {
$upgrade_object->$upgrade_method($mode);
}
}
}
/**
* 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->Application->Init();
$this->Conn =& $this->Application->GetADODBConnection();
$this->toolkit->Conn =& $this->Application->GetADODBConnection();
}
}
/**
* Show next step screen
*
*/
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->Connect(
$this->toolkit->getSystemConfig('Database', 'DBHost'),
$this->toolkit->getSystemConfig('Database', 'DBUser'),
$this->toolkit->getSystemConfig('Database', 'DBUserPassword'),
$this->toolkit->getSystemConfig('Database', 'DBName')
);
// setup toolkit too
$this->toolkit->Conn =& $this->Conn;
return $this->Conn->errorCode == 0;
}
/**
* Checks if core is already installed
*
* @return bool
*/
function AlreadyInstalled()
{
$table_prefix = $this->toolkit->getSystemConfig('Database', 'TablePrefix');
$sql = 'SELECT VariableValue
FROM ' . $table_prefix . 'ConfigurationValues
WHERE VariableName = "InstallFinished"';
return $this->TableExists('ConfigurationValues') && $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
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;
}
}
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)) {
$modules = Array();
$fh = opendir(MODULES_PATH);
- while (($sub_folder = readdir($fh))) {
- $folder_path = MODULES_PATH.'/'.$sub_folder;
+ while ( ($sub_folder = readdir($fh)) ) {
+ $folder_path = MODULES_PATH . '/'.$sub_folder;
if ($sub_folder != '.' && $sub_folder != '..' && is_dir($folder_path)) {
if ($sub_folder == 'core') {
// skip modules here
continue;
}
// this is folder in MODULES_PATH directory
if (file_exists($folder_path.'/install.php') && file_exists($folder_path.'/install/install_schema.sql')) {
$install_order = trim( file_get_contents($folder_path . '/install/install_order.txt') );
$modules[$install_order] = $sub_folder;
}
}
}
}
// allows to control module install order
ksort($modules, SORT_NUMERIC);
return $modules;
}
/**
* 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;
}
$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_recursive2($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: <br />'.htmlspecialchars($sql).'<br />execution result is error:<br />['.$code.'] '.$msg;
return true;
}
/**
* Installation error handler
*
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @param Array $errcontext
*/
function ErrorHandler($errno, $errstr, $errfile = '', $errline = '', $errcontext = '')
{
if ($errno == E_USER_ERROR) {
// only react on user fatal errors
$this->Done($errstr);
}
}
}
?>
\ No newline at end of file

Event Timeline