Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed deprecated code and inserting precount and foreach loops for …

…performance.
  • Loading branch information...
commit e12413e86f1131bad829398510a828b34036dde3 1 parent 5453045
acidvertigo acidvertigo authored
4 catalog/install/install.php
@@ -14,8 +14,8 @@
14 14
15 15 $page_contents = 'install.php';
16 16
17   - if (isset($HTTP_GET_VARS['step']) && is_numeric($HTTP_GET_VARS['step'])) {
18   - switch ($HTTP_GET_VARS['step']) {
  17 + if (isset($_GET['step']) && is_numeric($_GET['step'])) {
  18 + switch ($_GET['step']) {
19 19 case '2':
20 20 $page_contents = 'install_2.php';
21 21 break;
20 catalog/install/rpc.php
@@ -17,13 +17,13 @@
17 17
18 18 $dir_fs_www_root = dirname(__FILE__);
19 19
20   - if (isset($HTTP_GET_VARS['action']) && !empty($HTTP_GET_VARS['action'])) {
21   - switch ($HTTP_GET_VARS['action']) {
  20 + if (isset($_GET['action']) && !empty($_GET['action'])) {
  21 + switch ($_GET['action']) {
22 22 case 'dbCheck':
23   - $db = array('DB_SERVER' => trim(rawurldecode($HTTP_GET_VARS['server'])),
24   - 'DB_SERVER_USERNAME' => trim(rawurldecode($HTTP_GET_VARS['username'])),
25   - 'DB_SERVER_PASSWORD' => trim(rawurldecode($HTTP_GET_VARS['password'])),
26   - 'DB_DATABASE' => trim(rawurldecode($HTTP_GET_VARS['name']))
  23 + $db = array('DB_SERVER' => trim(rawurldecode($_GET['server'])),
  24 + 'DB_SERVER_USERNAME' => trim(rawurldecode($_GET['username'])),
  25 + 'DB_SERVER_PASSWORD' => trim(rawurldecode($_GET['password'])),
  26 + 'DB_DATABASE' => trim(rawurldecode($_GET['name']))
27 27 );
28 28
29 29 $db_error = false;
@@ -45,10 +45,10 @@
45 45 break;
46 46
47 47 case 'dbImport':
48   - $db = array('DB_SERVER' => trim(rawurldecode($HTTP_GET_VARS['server'])),
49   - 'DB_SERVER_USERNAME' => trim(rawurldecode($HTTP_GET_VARS['username'])),
50   - 'DB_SERVER_PASSWORD' => trim(rawurldecode($HTTP_GET_VARS['password'])),
51   - 'DB_DATABASE' => trim(rawurldecode($HTTP_GET_VARS['name'])),
  48 + $db = array('DB_SERVER' => trim(rawurldecode($_GET['server'])),
  49 + 'DB_SERVER_USERNAME' => trim(rawurldecode($_GET['username'])),
  50 + 'DB_SERVER_PASSWORD' => trim(rawurldecode($_GET['password'])),
  51 + 'DB_DATABASE' => trim(rawurldecode($_GET['name'])),
52 52 );
53 53
54 54 osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
6 catalog/install/templates/pages/install_2.php
@@ -67,11 +67,11 @@
67 67 <p align="right"><input type="image" src="images/button_continue.gif" border="0" alt="Continue" id="inputButton" />&nbsp;&nbsp;<a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel" /></a></p>
68 68
69 69 <?php
70   - reset($HTTP_POST_VARS);
71   - while (list($key, $value) = each($HTTP_POST_VARS)) {
  70 + foreach($_POST as $key => $value) {
72 71 if (($key != 'x') && ($key != 'y')) {
73 72 if (is_array($value)) {
74   - for ($i=0, $n=sizeof($value); $i<$n; $i++) {
  73 + $n=sizeof($value);
  74 + for ($i=0; $i<$n; $i++) {
75 75 echo osc_draw_hidden_field($key . '[]', $value[$i]);
76 76 }
77 77 } else {
9 catalog/install/templates/pages/install_3.php
@@ -10,7 +10,7 @@
10 10 Released under the GNU General Public License
11 11 */
12 12
13   - $dir_fs_document_root = $HTTP_POST_VARS['DIR_FS_DOCUMENT_ROOT'];
  13 + $dir_fs_document_root = $_POST['DIR_FS_DOCUMENT_ROOT'];
14 14 if ((substr($dir_fs_document_root, -1) != '\\') && (substr($dir_fs_document_root, -1) != '/')) {
15 15 if (strrpos($dir_fs_document_root, '\\') !== false) {
16 16 $dir_fs_document_root .= '\\';
@@ -89,11 +89,12 @@
89 89 <p align="right"><input type="image" src="images/button_continue.gif" border="0" alt="Continue" id="inputButton" />&nbsp;&nbsp;<a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel" /></a></p>
90 90
91 91 <?php
92   - reset($HTTP_POST_VARS);
93   - while (list($key, $value) = each($HTTP_POST_VARS)) {
  92 + reset($_POST);
  93 + foreach($_POST as $key => $value) {
94 94 if (($key != 'x') && ($key != 'y')) {
95 95 if (is_array($value)) {
96   - for ($i=0, $n=sizeof($value); $i<$n; $i++) {
  96 + $n=sizeof($value);
  97 + for ($i=0; $i<$n; $i++) {
97 98 echo osc_draw_hidden_field($key . '[]', $value[$i]);
98 99 }
99 100 } else {
48 catalog/install/templates/pages/install_4.php
@@ -12,28 +12,28 @@
12 12
13 13 require('../includes/database_tables.php');
14 14
15   - osc_db_connect(trim($HTTP_POST_VARS['DB_SERVER']), trim($HTTP_POST_VARS['DB_SERVER_USERNAME']), trim($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
16   - osc_db_select_db(trim($HTTP_POST_VARS['DB_DATABASE']));
  15 + osc_db_connect(trim($_POST['DB_SERVER']), trim($_POST['DB_SERVER_USERNAME']), trim($_POST['DB_SERVER_PASSWORD']));
  16 + osc_db_select_db(trim($_POST['DB_DATABASE']));
17 17
18   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_NAME']) . '" where configuration_key = "STORE_NAME"');
19   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) . '" where configuration_key = "STORE_OWNER"');
20   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "STORE_OWNER_EMAIL_ADDRESS"');
  18 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_NAME']) . '" where configuration_key = "STORE_NAME"');
  19 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_NAME']) . '" where configuration_key = "STORE_OWNER"');
  20 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "STORE_OWNER_EMAIL_ADDRESS"');
21 21
22   - if (!empty($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) && !empty($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS'])) {
23   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "\"' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) . '\" <' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '>" where configuration_key = "EMAIL_FROM"');
  22 + if (!empty($_POST['CFG_STORE_OWNER_NAME']) && !empty($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS'])) {
  23 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "\"' . trim($_POST['CFG_STORE_OWNER_NAME']) . '\" <' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '>" where configuration_key = "EMAIL_FROM"');
24 24 } else {
25   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "EMAIL_FROM"');
  25 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "EMAIL_FROM"');
26 26 }
27 27
28   - $check_query = osc_db_query('select user_name from ' . TABLE_ADMINISTRATORS . ' where user_name = "' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '"');
  28 + $check_query = osc_db_query('select user_name from ' . TABLE_ADMINISTRATORS . ' where user_name = "' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '"');
29 29
30 30 if (osc_db_num_rows($check_query)) {
31   - osc_db_query('update ' . TABLE_ADMINISTRATORS . ' set user_password = "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '" where user_name = "' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '"');
  31 + osc_db_query('update ' . TABLE_ADMINISTRATORS . ' set user_password = "' . osc_encrypt_string(trim($_POST['CFG_ADMINISTRATOR_PASSWORD'])) . '" where user_name = "' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '"');
32 32 } else {
33   - osc_db_query('insert into ' . TABLE_ADMINISTRATORS . ' (user_name, user_password) values ("' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '", "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '")');
  33 + osc_db_query('insert into ' . TABLE_ADMINISTRATORS . ' (user_name, user_password) values ("' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '", "' . osc_encrypt_string(trim($_POST['CFG_ADMINISTRATOR_PASSWORD'])) . '")');
34 34 }
35 35
36   - osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT"');
  36 + osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT"');
37 37 ?>
38 38
39 39 <div class="mainBlock">
@@ -67,7 +67,7 @@
67 67 <h2>Finished!</h2>
68 68
69 69 <?php
70   - $dir_fs_document_root = $HTTP_POST_VARS['DIR_FS_DOCUMENT_ROOT'];
  70 + $dir_fs_document_root = $_POST['DIR_FS_DOCUMENT_ROOT'];
71 71 if ((substr($dir_fs_document_root, -1) != '\\') && (substr($dir_fs_document_root, -1) != '/')) {
72 72 if (strrpos($dir_fs_document_root, '\\') !== false) {
73 73 $dir_fs_document_root .= '\\';
@@ -89,7 +89,7 @@
89 89 closedir($handle);
90 90 }
91 91
92   - $http_url = parse_url($HTTP_POST_VARS['HTTP_WWW_ADDRESS']);
  92 + $http_url = parse_url($_POST['HTTP_WWW_ADDRESS']);
93 93 $http_server = $http_url['scheme'] . '://' . $http_url['host'];
94 94 $http_catalog = $http_url['path'];
95 95 if (isset($http_url['port']) && !empty($http_url['port'])) {
@@ -101,8 +101,8 @@
101 101 }
102 102
103 103 $admin_folder = 'admin';
104   - if (isset($HTTP_POST_VARS['CFG_ADMIN_DIRECTORY']) && !empty($HTTP_POST_VARS['CFG_ADMIN_DIRECTORY']) && osc_is_writable($dir_fs_document_root) && osc_is_writable($dir_fs_document_root . 'admin')) {
105   - $admin_folder = preg_replace('/[^a-zA-Z0-9]/', '', trim($HTTP_POST_VARS['CFG_ADMIN_DIRECTORY']));
  104 + if (isset($_POST['CFG_ADMIN_DIRECTORY']) && !empty($_POST['CFG_ADMIN_DIRECTORY']) && osc_is_writable($dir_fs_document_root) && osc_is_writable($dir_fs_document_root . 'admin')) {
  105 + $admin_folder = preg_replace('/[^a-zA-Z0-9]/', '', trim($_POST['CFG_ADMIN_DIRECTORY']));
106 106
107 107 if (empty($admin_folder)) {
108 108 $admin_folder = 'admin';
@@ -131,10 +131,10 @@
131 131 ' define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\');' . "\n" .
132 132 ' define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" .
133 133 ' define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n\n" .
134   - ' define(\'DB_SERVER\', \'' . trim($HTTP_POST_VARS['DB_SERVER']) . '\');' . "\n" .
135   - ' define(\'DB_SERVER_USERNAME\', \'' . trim($HTTP_POST_VARS['DB_SERVER_USERNAME']) . '\');' . "\n" .
136   - ' define(\'DB_SERVER_PASSWORD\', \'' . trim($HTTP_POST_VARS['DB_SERVER_PASSWORD']) . '\');' . "\n" .
137   - ' define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" .
  134 + ' define(\'DB_SERVER\', \'' . trim($_POST['DB_SERVER']) . '\');' . "\n" .
  135 + ' define(\'DB_SERVER_USERNAME\', \'' . trim($_POST['DB_SERVER_USERNAME']) . '\');' . "\n" .
  136 + ' define(\'DB_SERVER_PASSWORD\', \'' . trim($_POST['DB_SERVER_PASSWORD']) . '\');' . "\n" .
  137 + ' define(\'DB_DATABASE\', \'' . trim($_POST['DB_DATABASE']) . '\');' . "\n" .
138 138 ' define(\'USE_PCONNECT\', \'false\');' . "\n" .
139 139 ' define(\'STORE_SESSIONS\', \'mysql\');' . "\n" .
140 140 '?>';
@@ -171,10 +171,10 @@
171 171 ' define(\'DIR_FS_BACKUP\', DIR_FS_ADMIN . \'backups/\');' . "\n" .
172 172 ' define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" .
173 173 ' define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n\n" .
174   - ' define(\'DB_SERVER\', \'' . trim($HTTP_POST_VARS['DB_SERVER']) . '\');' . "\n" .
175   - ' define(\'DB_SERVER_USERNAME\', \'' . trim($HTTP_POST_VARS['DB_SERVER_USERNAME']) . '\');' . "\n" .
176   - ' define(\'DB_SERVER_PASSWORD\', \'' . trim($HTTP_POST_VARS['DB_SERVER_PASSWORD']) . '\');' . "\n" .
177   - ' define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" .
  174 + ' define(\'DB_SERVER\', \'' . trim($_POST['DB_SERVER']) . '\');' . "\n" .
  175 + ' define(\'DB_SERVER_USERNAME\', \'' . trim($_POST['DB_SERVER_USERNAME']) . '\');' . "\n" .
  176 + ' define(\'DB_SERVER_PASSWORD\', \'' . trim($_POST['DB_SERVER_PASSWORD']) . '\');' . "\n" .
  177 + ' define(\'DB_DATABASE\', \'' . trim($_POST['DB_DATABASE']) . '\');' . "\n" .
178 178 ' define(\'USE_PCONNECT\', \'false\');' . "\n" .
179 179 ' define(\'STORE_SESSIONS\', \'mysql\');' . "\n" .
180 180 '?>';

0 comments on commit e12413e

Please sign in to comment.
Something went wrong with that request. Please try again.