|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 define('HEADING_TITLE','SQL Query Executor'); 00013 define('HEADING_WARNING','BE SURE TO DO A FULL DATABASE BACKUP BEFORE RUNNING SCRIPTS HERE'); 00014 define('HEADING_WARNING2','If you are installing 3rd-party contributions, note that you do so at your own risk.<br />Zen Cart® makes no warranty as to the safety of scripts supplied by 3rd-party contributors. Test before using on your live database!'); 00015 define('HEADING_WARNING_INSTALLSCRIPTS', 'NOTE: Zen Cart database-upgrade scripts should NOT be run from this page.<br />Please upload the new <strong>zc_install</strong> folder and run the upgrade from there instead for better reliability.'); 00016 define('TEXT_QUERY_RESULTS','Query Results:'); 00017 define('TEXT_ENTER_QUERY_STRING','Enter the query <br />to be executed: <br /><br />Be sure to<br />end with ;'); 00018 define('TEXT_QUERY_FILENAME','Upload file:'); 00019 define('ERROR_NOTHING_TO_DO','Error: Nothing to do - no query or query-file specified.'); 00020 define('TEXT_CLOSE_WINDOW', '[ close window ]'); 00021 define('SQLPATCH_HELP_TEXT','The SQLPATCH tool lets you install system patches by pasting SQL code directly into the textarea '. 00022 'field here, or by uploading a supplied script (.SQL) file.<br />' . 00023 'When preparing scripts to be used by this tool, DO NOT include a table prefix, as this tool will ' . 00024 'automatically insert the required prefix for the active database, based on settings in the store\'s ' . 00025 'admin/includes/configure.php file (DB_PREFIX definition).<br /><br />' . 00026 'The commands entered or uploaded may only begin with the following statements, and MUST be in UPPERCASE:'. 00027 '<br /><ul><li>DROP TABLE IF EXISTS</li><li>CREATE TABLE</li><li>INSERT INTO</li><li>INSERT IGNORE INTO</li><li>ALTER TABLE</li>' . 00028 '<li>UPDATE (just a single table)</li><li>UPDATE IGNORE (just a single table)</li><li>DELETE FROM</li><li>DROP INDEX</li><li>CREATE INDEX</li>' . 00029 '<br /><li>SELECT </li></ul>' . 00030 '<h2>Advanced Methods</h2>The following methods can be used to issue more complex statements as necessary:<br /> 00031 To run some blocks of code together so that they are treated as one command by MySQL, you need the "<code>#NEXT_X_ROWS_AS_ONE_COMMAND:xxx</code>" value set. The parser will then treat X number of commands as one.<br /> 00032 If you are running this file thru phpMyAdmin or equivalent, the "#NEXT..." comment is ignored, and the script will process fine.<br /> 00033 <br /><strong>NOTE: </strong>SELECT.... FROM... and LEFT JOIN statements need the "FROM" or "LEFT JOIN" to be on a line by itself in order for the parse script to add the table prefix.<br /><br /> 00034 <em><strong>Examples:</strong></em> 00035 <ul><li><code>#NEXT_X_ROWS_AS_ONE_COMMAND:4<br /> 00036 SET @t1=0;<br /> 00037 SELECT (@t1:=configuration_value) as t1 <br /> 00038 FROM configuration <br /> 00039 WHERE configuration_key = \'KEY_NAME_HERE\';<br /> 00040 UPDATE product_type_layout SET configuration_value = @t1 WHERE configuration_key = \'KEY_NAME_TO_CHECK_HERE\';<br /> 00041 DELETE FROM configuration WHERE configuration_key = \'KEY_NAME_HERE\';<br /> </li> 00042 00043 <li>#NEXT_X_ROWS_AS_ONE_COMMAND:1<br /> 00044 INSERT INTO tablename <br /> 00045 (col1, col2, col3, col4)<br /> 00046 SELECT col_a, col_b, col_3, col_4<br /> 00047 FROM table2;<br /> </li> 00048 00049 <li>#NEXT_X_ROWS_AS_ONE_COMMAND:1<br /> 00050 INSERT INTO table1 <br /> 00051 (col1, col2, col3, col4 )<br /> 00052 SELECT p.othercol_a, p.othercol_b, po.othercol_c, pm.othercol_d<br /> 00053 FROM table2 p, table3 pm<br /> 00054 LEFT JOIN othercol_f po<br /> 00055 ON p.othercol_f = po.othercol_f<br /> 00056 WHERE p.othercol_f = pm.othercol_f;</li> 00057 </ul></code>' ); 00058 if (!defined('DB_PREFIX')) define('DB_PREFIX',''); 00059 if (!defined('TABLE_UPGRADE_EXCEPTIONS')) define('TABLE_UPGRADE_EXCEPTIONS', DB_PREFIX . 'upgrade_exceptions'); 00060 define('REASON_TABLE_ALREADY_EXISTS','Cannot create table %s because it already exists'); 00061 define('REASON_TABLE_DOESNT_EXIST','Cannot drop table %s because it does not exist.'); 00062 define('REASON_TABLE_NOT_FOUND','Cannot execute because table %s does not exist.'); 00063 define('REASON_CONFIG_KEY_ALREADY_EXISTS','Cannot insert configuration_key "%s" because it already exists'); 00064 define('REASON_COLUMN_ALREADY_EXISTS','Cannot ADD column %s because it already exists.'); 00065 define('REASON_COLUMN_DOESNT_EXIST_TO_DROP','Cannot DROP column %s because it does not exist.'); 00066 define('REASON_COLUMN_DOESNT_EXIST_TO_CHANGE','Cannot CHANGE column %s because it does not exist.'); 00067 define('REASON_PRODUCT_TYPE_LAYOUT_KEY_ALREADY_EXISTS','Cannot insert prod-type-layout configuration_key "%s" because it already exists'); 00068 define('REASON_INDEX_DOESNT_EXIST_TO_DROP','Cannot drop index %s on table %s because it does not exist.'); 00069 define('REASON_PRIMARY_KEY_DOESNT_EXIST_TO_DROP','Cannot drop primary key on table %s because it does not exist.'); 00070 define('REASON_INDEX_ALREADY_EXISTS','Cannot add index %s to table %s because it already exists.'); 00071 define('REASON_PRIMARY_KEY_ALREADY_EXISTS','Cannot add primary key to table %s because a primary key already exists.'); 00072 define('REASON_NO_PRIVILEGES','User '.DB_SERVER_USERNAME.'@'.DB_SERVER.' does not have %s privileges to database '.DB_DATABASE.'.'); 00073 if (isset($_GET['debug']) && $_GET['debug']=='ON') $debug=true; 00074 if (!isset($_GET['debug']) && !zen_not_null($_POST['debug']) && $debug!=true) define('ZC_UPG_DEBUG',false); 00075 if (!isset($_GET['debug2']) && !zen_not_null($_POST['debug2']) && $debug!=true) define('ZC_UPG_DEBUG2',false); 00076 if (!isset($_GET['debug3']) && !zen_not_null($_POST['debug3']) && $debug!=true) define('ZC_UPG_DEBUG3',false); 00077 00078 $keepslashes = (isset($_GET['keepslashes']) && ($_GET['keepslashes']=='1' || $_GET['keepslashes']=='true')) ? true : false; 00079 00080 00081 //NOTE: THIS IS INTENTIONALLY ON 2 LINES: 00082 $linebreak = ' 00083 '; 00084 // NOTE: this line break is intentional!!!! 00085 00086 function executeSql($lines, $database, $table_prefix = '') { 00087 if (version_compare(PHP_VERSION, 5.4, '>=') || !get_cfg_var('safe_mode')) { 00088 @set_time_limit(1200); 00089 } 00090 global $db, $debug, $messageStack; 00091 $sql_file='SQLPATCH'; 00092 $newline = ''; 00093 $saveline = ''; 00094 $ignored_count=0; 00095 $return_output=array(); 00096 $errors = array(); 00097 00098 foreach ($lines as $line) { 00099 if ($_GET['debug']=='ON') echo $line . '<br />'; 00100 00101 00102 $line = trim($line); 00103 $line = str_replace('`','',$line); //remove backquotes 00104 $line = $saveline . $line; 00105 $keep_together = 1; // count of number of lines to treat as a single command 00106 00107 // split the line into words ... starts at $param[0] and so on. Also remove the ';' from end of last param if exists 00108 $param=explode(" ",(substr($line,-1)==';') ? substr($line,0,strlen($line)-1) : $line); 00109 00110 // The following command checks to see if we're asking for a block of commands to be run at once. 00111 // Syntax: #NEXT_X_ROWS_AS_ONE_COMMAND:6 for running the next 6 commands together (commands denoted by a ;) 00112 if (substr($line,0,28) == '#NEXT_X_ROWS_AS_ONE_COMMAND:') $keep_together = substr($line,28); 00113 if (substr($line,0,1) != '#' && substr($line,0,1) != '-' && $line != '') { 00114 // if ($table_prefix != -1) { 00115 //echo '*}'.$line.'<br>'; 00116 00117 $line_upper=strtoupper($line); 00118 switch (true) { 00119 case (substr($line_upper, 0, 21) == 'DROP TABLE IF EXISTS '): 00120 // if (!$checkprivs = zen_check_database_privs('DROP')) return sprintf(REASON_NO_PRIVILEGES,'DROP'); 00121 $line = 'DROP TABLE IF EXISTS ' . $table_prefix . substr($line, 21); 00122 break; 00123 case (substr($line_upper, 0, 11) == 'DROP TABLE ' && $param[2] != 'IF'): 00124 if (!$checkprivs = zen_check_database_privs('DROP')) $result=sprintf(REASON_NO_PRIVILEGES,'DROP'); 00125 if (!zen_table_exists($param[2]) || zen_not_null($result)) { 00126 zen_write_to_upgrade_exceptions_table($line, (zen_not_null($result) ? $result : sprintf(REASON_TABLE_DOESNT_EXIST,$param[2])), $sql_file); 00127 $ignore_line=true; 00128 $result=(zen_not_null($result) ? $result : sprintf(REASON_TABLE_DOESNT_EXIST,$param[2])); //duplicated here for on-screen error-reporting 00129 break; 00130 } else { 00131 $line = 'DROP TABLE ' . $table_prefix . substr($line, 11); 00132 } 00133 break; 00134 case (substr($line_upper, 0, 13) == 'CREATE TABLE '): 00135 // check to see if table exists 00136 $table = (strtoupper($param[2].' '.$param[3].' '.$param[4]) == 'IF NOT EXISTS') ? $param[5] : $param[2]; 00137 $result=zen_table_exists($table); 00138 if ($result==true) { 00139 zen_write_to_upgrade_exceptions_table($line, sprintf(REASON_TABLE_ALREADY_EXISTS,$table), $sql_file); 00140 $ignore_line=true; 00141 $result=sprintf(REASON_TABLE_ALREADY_EXISTS,$table); //duplicated here for on-screen error-reporting 00142 break; 00143 } else { 00144 $line = (strtoupper($param[2].' '.$param[3].' '.$param[4]) == 'IF NOT EXISTS') ? 'CREATE TABLE IF NOT EXISTS ' . $table_prefix . substr($line, 27) : 'CREATE TABLE ' . $table_prefix . substr($line, 13); 00145 } 00146 break; 00147 case (substr($line_upper, 0, 15) == 'TRUNCATE TABLE '): 00148 // check to see if TRUNCATE command may be safely executed 00149 if (!$tbl_exists = zen_table_exists($param[2])) { 00150 $result=sprintf(REASON_TABLE_NOT_FOUND,$param[2]).' CHECK PREFIXES!' . $param[2]; 00151 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00152 $ignore_line=true; 00153 break; 00154 } else { 00155 $line = 'TRUNCATE TABLE ' . $table_prefix . substr($line, 15); 00156 } 00157 break; 00158 case (substr($line_upper, 0, 13) == 'REPLACE INTO '): 00159 //check to see if table prefix is going to match 00160 if (!$tbl_exists = zen_table_exists($param[2])) $result=sprintf(REASON_TABLE_NOT_FOUND,$param[2]).' CHECK PREFIXES!'; 00161 // check to see if INSERT command may be safely executed for "configuration" or "product_type_layout" tables 00162 if (($param[2]=='configuration' && ($result=zen_check_config_key($line))) or 00163 ($param[2]=='product_type_layout' && ($result=zen_check_product_type_layout_key($line))) or 00164 (!$tbl_exists) ) { 00165 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00166 $ignore_line=true; 00167 break; 00168 } else { 00169 $line = 'REPLACE INTO ' . $table_prefix . substr($line, 13); 00170 } 00171 break; 00172 case (substr($line_upper, 0, 12) == 'INSERT INTO '): 00173 //check to see if table prefix is going to match 00174 if (!$tbl_exists = zen_table_exists($param[2])) $result=sprintf(REASON_TABLE_NOT_FOUND,$param[2]).' CHECK PREFIXES!'; 00175 // check to see if INSERT command may be safely executed for "configuration" or "product_type_layout" tables 00176 if (($param[2]=='configuration' && ($result=zen_check_config_key($line))) or 00177 ($param[2]=='product_type_layout' && ($result=zen_check_product_type_layout_key($line))) or 00178 (!$tbl_exists) ) { 00179 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00180 $ignore_line=true; 00181 break; 00182 } else { 00183 $line = 'INSERT INTO ' . $table_prefix . substr($line, 12); 00184 } 00185 break; 00186 case (substr($line_upper, 0, 19) == 'INSERT IGNORE INTO '): 00187 //check to see if table prefix is going to match 00188 if (!$tbl_exists = zen_table_exists($param[3])) { 00189 $result=sprintf(REASON_TABLE_NOT_FOUND,$param[3]).' CHECK PREFIXES!'; 00190 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00191 $ignore_line=true; 00192 break; 00193 } else { 00194 $line = 'INSERT IGNORE INTO ' . $table_prefix . substr($line, 19); 00195 } 00196 break; 00197 case (substr($line_upper, 0, 12) == 'ALTER TABLE '): 00198 // check to see if ALTER command may be safely executed 00199 if ($result=zen_check_alter_command($param)) { 00200 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00201 $ignore_line=true; 00202 break; 00203 } else { 00204 $line = 'ALTER TABLE ' . $table_prefix . substr($line, 12); 00205 } 00206 break; 00207 case (substr($line_upper, 0, 13) == 'RENAME TABLE '): 00208 // RENAME TABLE command cannot be parsed to insert table prefixes, so skip if zen is using prefixes 00209 if (zen_not_null(DB_PREFIX)) { 00210 zen_write_to_upgrade_exceptions_table($line, 'RENAME TABLE command not supported by upgrader. Please use phpMyAdmin instead.', $sql_file); 00211 $messageStack->add('RENAME TABLE command not supported by upgrader. Please use phpMyAdmin instead.', 'caution'); 00212 00213 $ignore_line=true; 00214 } 00215 break; 00216 case (substr($line_upper, 0, 7) == 'UPDATE '): 00217 //check to see if table prefix is going to match 00218 if (!$tbl_exists = zen_table_exists($param[1])) { 00219 zen_write_to_upgrade_exceptions_table($line, sprintf(REASON_TABLE_NOT_FOUND,$param[1]).' CHECK PREFIXES!', $sql_file); 00220 $result=sprintf(REASON_TABLE_NOT_FOUND,$param[1]).' CHECK PREFIXES!'; 00221 $ignore_line=true; 00222 break; 00223 } else { 00224 $line = 'UPDATE ' . $table_prefix . substr($line, 7); 00225 } 00226 break; 00227 case (substr($line_upper, 0, 14) == 'UPDATE IGNORE '): 00228 //check to see if table prefix is going to match 00229 if (!$tbl_exists = zen_table_exists($param[2])) { 00230 zen_write_to_upgrade_exceptions_table($line, sprintf(REASON_TABLE_NOT_FOUND,$param[2]).' CHECK PREFIXES!', $sql_file); 00231 $result=sprintf(REASON_TABLE_NOT_FOUND,$param[2]).' CHECK PREFIXES!'; 00232 $ignore_line=true; 00233 break; 00234 } else { 00235 $line = 'UPDATE IGNORE ' . $table_prefix . substr($line, 14); 00236 } 00237 break; 00238 case (substr($line_upper, 0, 12) == 'DELETE FROM '): 00239 $line = 'DELETE FROM ' . $table_prefix . substr($line, 12); 00240 break; 00241 case (substr($line_upper, 0, 11) == 'DROP INDEX '): 00242 // check to see if DROP INDEX command may be safely executed 00243 if ($result=zen_drop_index_command($param)) { 00244 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00245 $ignore_line=true; 00246 break; 00247 } else { 00248 $line = 'DROP INDEX ' . $param[2] . ' ON ' . $table_prefix . $param[4]; 00249 } 00250 break; 00251 case (substr($line_upper, 0, 13) == 'CREATE INDEX ' || (strtoupper($param[0])=='CREATE' && strtoupper($param[2])=='INDEX')): 00252 // check to see if CREATE INDEX command may be safely executed 00253 if ($result=zen_create_index_command($param)) { 00254 zen_write_to_upgrade_exceptions_table($line, $result, $sql_file); 00255 $ignore_line=true; 00256 break; 00257 } else { 00258 if (strtoupper($param[1])=='INDEX') { 00259 $line = trim('CREATE INDEX ' . $param[2] .' ON '. $table_prefix . implode(' ',array($param[4],$param[5],$param[6],$param[7],$param[8],$param[9],$param[10],$param[11],$param[12],$param[13])) ).';'; // add the ';' back since it was removed from $param at start 00260 } else { 00261 $line = trim('CREATE '. $param[1] .' INDEX ' .$param[3]. ' ON '. $table_prefix . implode(' ',array($param[5],$param[6],$param[7],$param[8],$param[9],$param[10],$param[11],$param[12],$param[13])) ); // add the ';' back since it was removed from $param at start 00262 } 00263 } 00264 break; 00265 case (substr($line_upper, 0, 7) == 'SELECT ' && substr_count($line,'FROM ')>0): 00266 $line = str_replace('FROM ','FROM '. $table_prefix, $line); 00267 break; 00268 case (substr($line_upper, 0, 10) == 'LEFT JOIN '): 00269 $line = 'LEFT JOIN ' . $table_prefix . substr($line, 10); 00270 break; 00271 case (substr($line_upper, 0, 5) == 'FROM '): 00272 if (substr_count($line,',')>0) { // contains FROM and a comma, thus must parse for multiple tablenames 00273 $tbl_list = explode(',',substr($line,5)); 00274 $line = 'FROM '; 00275 foreach($tbl_list as $val) { 00276 $line .= $table_prefix . trim($val) . ','; // add prefix and comma 00277 } //end foreach 00278 if (substr($line,-1)==',') $line = substr($line,0,(strlen($line)-1)); // remove trailing ',' 00279 } else { //didn't have a comma, but starts with "FROM ", so insert table prefix 00280 $line = str_replace('FROM ', 'FROM '.$table_prefix, $line); 00281 }//endif substr_count(,) 00282 break; 00283 default: 00284 break; 00285 } //end switch 00286 // } // endif $table_prefix 00287 $newline .= $line . ' '; 00288 00289 if ( substr($line,-1) == ';') { 00290 //found a semicolon, so treat it as a full command, incrementing counter of rows to process at once 00291 if (substr($newline,-1)==' ') $newline = substr($newline,0,(strlen($newline)-1)); 00292 $lines_to_keep_together_counter++; 00293 if ($lines_to_keep_together_counter == $keep_together) { // if all grouped rows have been loaded, go to execute. 00294 $complete_line = true; 00295 $lines_to_keep_together_counter=0; 00296 } else { 00297 $complete_line = false; 00298 } 00299 } //endif found ';' 00300 00301 if ($complete_line) { 00302 if ($debug==true) echo ((!$ignore_line) ? '<br />About to execute.': 'Ignoring statement. This command WILL NOT be executed.').'<br />Debug info:<br>$ line='.$line.'<br>$ complete_line='.$complete_line.'<br>$ keep_together='.$keep_together.'<br>SQL='.$newline.'<br><br>'; 00303 if (version_compare(PHP_VERSION, 5.4, '<') && @get_magic_quotes_runtime() > 0 && $keepslashes != true ) $newline=stripslashes($newline); 00304 if (trim(str_replace(';','',$newline)) != '' && !$ignore_line) $output=$db->Execute($newline); 00305 $results++; 00306 $string .= $newline.'<br />'; 00307 $return_output[]=$output; 00308 if (zen_not_null($result)) $errors[]=$result; 00309 // reset var's 00310 $newline = ''; 00311 $keep_together=1; 00312 $complete_line = false; 00313 if ($ignore_line) $ignored_count++; 00314 $ignore_line=false; 00315 00316 // show progress bar 00317 global $zc_show_progress; 00318 if ($zc_show_progress=='yes') { 00319 $counter++; 00320 if ($counter/5 == (int)($counter/5)) echo '~ '; 00321 if ($counter>200) { 00322 echo '<br /><br />'; 00323 $counter=0; 00324 } 00325 @ob_flush(); 00326 @flush(); 00327 } 00328 00329 } //endif $complete_line 00330 00331 } //endif ! # or - 00332 } // end foreach $lines 00333 return array('queries'=> $results, 'string'=>$string, 'output'=>$return_output, 'ignored'=>($ignored_count), 'errors'=>$errors); 00334 } //end function 00335 00336 function zen_table_exists($tablename, $pre_install=false) { 00337 global $db; 00338 $tables = $db->Execute("SHOW TABLES like '" . DB_PREFIX . $tablename . "'"); 00339 if (ZC_UPG_DEBUG3==true) echo 'Table check ('.$tablename.') = '. $tables->RecordCount() .'<br>'; 00340 if ($tables->RecordCount() > 0) { 00341 return true; 00342 } else { 00343 return false; 00344 } 00345 } 00346 00347 function zen_check_database_privs($priv='',$table='',$show_privs=false) { 00348 // bypass until future version 00349 return true; 00350 // end bypass 00351 global $zdb_server, $zdb_user, $zdb_name; 00352 if (isset($_GET['nogrants'])) return true; // bypass if flag set 00353 if (isset($_POST['nogrants'])) return true; // bypass if flag set 00354 //Display permissions, or check for suitable permissions to carry out a particular task 00355 //possible outputs: 00356 //GRANT ALL PRIVILEGES ON *.* TO 'xyz'@'localhost' WITH GRANT OPTION 00357 //GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, FILE, INDEX, ALTER ON *.* TO 'xyz'@'localhost' IDENTIFIED BY PASSWORD '2344' 00358 //GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `db1`.* TO 'xyz'@'localhost' 00359 //GRANT SELECT (id) ON db1.tablename TO 'xyz'@'localhost 00360 global $db; 00361 global $db_test; 00362 $granted_privs_list=''; 00363 if (ZC_UPG_DEBUG3==true) echo '<br />Checking for priv: ['.(zen_not_null($priv) ? $priv : 'none specified').']<br />'; 00364 if (!defined('DB_SERVER')) define('DB_SERVER',$zdb_server); 00365 if (!defined('DB_SERVER_USERNAME')) define('DB_SERVER_USERNAME',$zdb_user); 00366 if (!defined('DB_DATABASE')) define('DB_DATABASE',$zdb_name); 00367 $user = DB_SERVER_USERNAME."@".DB_SERVER; 00368 if ($user == 'DB_SERVER_USERNAME@DB_SERVER' || DB_DATABASE=='DB_DATABASE') return true; // bypass if constants not set properly 00369 $sql = "show grants for ".$user; 00370 if (ZC_UPG_DEBUG3==true) echo $sql.'<br />'; 00371 $result = $db->Execute($sql); 00372 while (!$result->EOF) { 00373 if (ZC_UPG_DEBUG3==true) echo $result->fields['Grants for '.$user].'<br />'; 00374 $grant_syntax = $result->fields['Grants for '.$user] . ' '; 00375 $granted_privs = str_replace('GRANT ','',$grant_syntax); // remove "GRANT" keyword 00376 $granted_privs = substr($granted_privs,0,strpos($granted_privs,' TO ')); //remove anything after the "TO" keyword 00377 $granted_db = str_replace(array('`','\\'),'',substr($granted_privs,strpos($granted_privs,' ON ')+4) ); //remove backquote and find "ON" string 00378 if (ZC_UPG_DEBUG3==true) echo 'privs_list = '.$granted_privs.'<br />'; 00379 if (ZC_UPG_DEBUG3==true) echo 'granted_db = '.$granted_db.'<br />'; 00380 $db_priv_ok += ($granted_db == '*.*' || $granted_db==DB_DATABASE.'.*' || $granted_db==DB_DATABASE.'.'.$table) ? true : false; 00381 if (ZC_UPG_DEBUG3==true) echo 'db-priv-ok='.$db_priv_ok.'<br />'; 00382 00383 if ($db_priv_ok) { // if the privs list pertains to the current database, or is *.*, carry on 00384 $granted_privs = substr($granted_privs,0,strpos($granted_privs,' ON ')); //remove anything after the "ON" keyword 00385 $granted_privs_list .= ($granted_privs_list=='') ? $granted_privs : ', '.$granted_privs; 00386 00387 $specific_priv_found = (zen_not_null($priv) && substr_count($granted_privs,$priv)==1); 00388 if (ZC_UPG_DEBUG3==true) echo 'specific priv['.$priv.'] found ='.$specific_priv_found.'<br />'; 00389 00390 if (ZC_UPG_DEBUG3==true) echo 'spec+db='.($specific_priv_found && $db_priv_ok == true).' ||| '; 00391 if (ZC_UPG_DEBUG3==true) echo 'all+db='.($granted_privs == 'ALL PRIVILEGES' && $db_priv_ok==true).'<br /><br />'; 00392 00393 if (($specific_priv_found && $db_priv_ok == true) || ($granted_privs == 'ALL PRIVILEGES' && $db_priv_ok==true)) { 00394 return true; // privs found 00395 } 00396 } // endif $db_priv_ok 00397 $result->MoveNext(); 00398 } 00399 if ($show_privs) { 00400 if (ZC_UPG_DEBUG3==true) echo 'LIST OF PRIVS='.$granted_privs_list.'<br />'; 00401 return $db_priv_ok . '|||'. $granted_privs_list; 00402 } else { 00403 return false; // if not found, return false 00404 } 00405 } 00406 00407 function zen_drop_index_command($param) { 00408 if (!$checkprivs = zen_check_database_privs('INDEX')) return sprintf(REASON_NO_PRIVILEGES,'INDEX'); 00409 //this is only slightly different from the ALTER TABLE DROP INDEX command 00410 global $db; 00411 if (!zen_not_null($param)) return "Empty SQL Statement"; 00412 $index = $param[2]; 00413 $sql = "show index from " . DB_PREFIX . $param[4]; 00414 $result = $db->Execute($sql); 00415 while (!$result->EOF) { 00416 if (ZC_UPG_DEBUG3==true) echo $result->fields['Key_name'].'<br />'; 00417 if ($result->fields['Key_name'] == $index) { 00418 // if (!$checkprivs = zen_check_database_privs('INDEX')) return sprintf(REASON_NO_PRIVILEGES,'INDEX'); 00419 return; // if we get here, the index exists, and we have index privileges, so return with no error 00420 } 00421 $result->MoveNext(); 00422 } 00423 // if we get here, then the index didn't exist 00424 return sprintf(REASON_INDEX_DOESNT_EXIST_TO_DROP,$index,$param[4]); 00425 } 00426 00427 function zen_create_index_command($param) { 00428 //this is only slightly different from the ALTER TABLE CREATE INDEX command 00429 if (!$checkprivs = zen_check_database_privs('INDEX')) return sprintf(REASON_NO_PRIVILEGES,'INDEX'); 00430 global $db; 00431 if (!zen_not_null($param)) return "Empty SQL Statement"; 00432 $index = (strtoupper($param[1])=='INDEX') ? $param[2] : $param[3]; 00433 if (in_array('USING',$param)) return 'USING parameter found. Cannot validate syntax. Please run manually in phpMyAdmin.'; 00434 $table = (strtoupper($param[2])=='INDEX' && strtoupper($param[4])=='ON') ? $param[5] : $param[4]; 00435 $sql = "show index from " . DB_PREFIX . $table; 00436 $result = $db->Execute($sql); 00437 while (!$result->EOF) { 00438 if (ZC_UPG_DEBUG3==true) echo $result->fields['Key_name'].'<br />'; 00439 if (strtoupper($result->fields['Key_name']) == strtoupper($index)) { 00440 return sprintf(REASON_INDEX_ALREADY_EXISTS,$index,$table); 00441 } 00442 $result->MoveNext(); 00443 } 00444 /* 00445 * @TODO: verify that individual columns exist, by parsing the index_col_name parameters list 00446 * Structure is (colname(len)), 00447 * or (colname), 00448 */ 00449 } 00450 00451 function zen_check_alter_command($param) { 00452 global $db; 00453 if (!zen_not_null($param)) return "Empty SQL Statement"; 00454 if (!$checkprivs = zen_check_database_privs('ALTER')) return sprintf(REASON_NO_PRIVILEGES,'ALTER'); 00455 switch (strtoupper($param[3])) { 00456 case ("ADD"): 00457 if (strtoupper($param[4]) == 'INDEX') { 00458 // check that the index to be added doesn't already exist 00459 $index = $param[5]; 00460 $sql = "show index from " . DB_PREFIX . $param[2]; 00461 $result = $db->Execute($sql); 00462 while (!$result->EOF) { 00463 if (ZC_UPG_DEBUG3==true) echo 'KEY: '.$result->fields['Key_name'].'<br />'; 00464 if ($result->fields['Key_name'] == $index) { 00465 return sprintf(REASON_INDEX_ALREADY_EXISTS,$index,$param[2]); 00466 } 00467 $result->MoveNext(); 00468 } 00469 } elseif (strtoupper($param[4])=='PRIMARY') { 00470 // check that the primary key to be added doesn't exist 00471 if ($param[5] != 'KEY') return; 00472 $sql = "show index from " . DB_PREFIX . $param[2]; 00473 $result = $db->Execute($sql); 00474 while (!$result->EOF) { 00475 if (ZC_UPG_DEBUG3==true) echo $result->fields['Key_name'].'<br />'; 00476 if ($result->fields['Key_name'] == 'PRIMARY') { 00477 return sprintf(REASON_PRIMARY_KEY_ALREADY_EXISTS,$param[2]); 00478 } 00479 $result->MoveNext(); 00480 } 00481 00482 } elseif (!in_array(strtoupper($param[4]),array('CONSTRAINT','UNIQUE','PRIMARY','FULLTEXT','FOREIGN','SPATIAL') ) ) { 00483 // check that the column to be added does not exist 00484 $colname = ($param[4]=='COLUMN') ? $param[5] : $param[4]; 00485 $sql = "show fields from " . DB_PREFIX . $param[2]; 00486 $result = $db->Execute($sql); 00487 while (!$result->EOF) { 00488 if (ZC_UPG_DEBUG3==true) echo $result->fields['Field'].'<br />'; 00489 if ($result->fields['Field'] == $colname) { 00490 return sprintf(REASON_COLUMN_ALREADY_EXISTS,$colname); 00491 } 00492 $result->MoveNext(); 00493 } 00494 00495 } elseif (strtoupper($param[5])=='AFTER') { 00496 // check that the requested "after" field actually exists 00497 $colname = ($param[6]=='COLUMN') ? $param[7] : $param[6]; 00498 $sql = "show fields from " . DB_PREFIX . $param[2]; 00499 $result = $db->Execute($sql); 00500 while (!$result->EOF) { 00501 if (ZC_UPG_DEBUG3==true) echo $result->fields['Field'].'<br />'; 00502 if ($result->fields['Field'] == $colname) { 00503 return; // exists, so return with no error 00504 } 00505 $result->MoveNext(); 00506 } 00507 00508 } elseif (strtoupper($param[6])=='AFTER') { 00509 // check that the requested "after" field actually exists 00510 $colname = ($param[7]=='COLUMN') ? $param[8] : $param[7]; 00511 $sql = "show fields from " . DB_PREFIX . $param[2]; 00512 $result = $db->Execute($sql); 00513 while (!$result->EOF) { 00514 if (ZC_UPG_DEBUG3==true) echo $result->fields['Field'].'<br />'; 00515 if ($result->fields['Field'] == $colname) { 00516 return; // exists, so return with no error 00517 } 00518 $result->MoveNext(); 00519 } 00520 /* 00521 * @TODO -- add check for FIRST parameter, to check that the FIRST colname specified actually exists 00522 */ 00523 } 00524 break; 00525 case ("DROP"): 00526 if (strtoupper($param[4]) == 'INDEX') { 00527 // check that the index to be dropped exists 00528 $index = $param[5]; 00529 $sql = "show index from " . DB_PREFIX . $param[2]; 00530 $result = $db->Execute($sql); 00531 while (!$result->EOF) { 00532 if (ZC_UPG_DEBUG3==true) echo $result->fields['Key_name'].'<br />'; 00533 if ($result->fields['Key_name'] == $index) { 00534 return; // exists, so return with no error 00535 } 00536 $result->MoveNext(); 00537 } 00538 // if we get here, then the index didn't exist 00539 return sprintf(REASON_INDEX_DOESNT_EXIST_TO_DROP,$index,$param[2]); 00540 00541 } elseif (strtoupper($param[4])=='PRIMARY') { 00542 // check that the primary key to be dropped exists 00543 if ($param[5] != 'KEY') return; 00544 $sql = "show index from " . DB_PREFIX . $param[2]; 00545 $result = $db->Execute($sql); 00546 while (!$result->EOF) { 00547 if (ZC_UPG_DEBUG3==true) echo $result->fields['Key_name'].'<br />'; 00548 if ($result->fields['Key_name'] == 'PRIMARY') { 00549 return; // exists, so return with no error 00550 } 00551 $result->MoveNext(); 00552 } 00553 // if we get here, then the primary key didn't exist 00554 return sprintf(REASON_PRIMARY_KEY_DOESNT_EXIST_TO_DROP,$param[2]); 00555 00556 } elseif (!in_array(strtoupper($param[4]),array('CONSTRAINT','UNIQUE','PRIMARY','FULLTEXT','FOREIGN','SPATIAL'))) { 00557 // check that the column to be dropped exists 00558 $colname = ($param[4]=='COLUMN') ? $param[5] : $param[4]; 00559 $sql = "show fields from " . DB_PREFIX . $param[2]; 00560 $result = $db->Execute($sql); 00561 while (!$result->EOF) { 00562 if (ZC_UPG_DEBUG3==true) echo $result->fields['Field'].'<br />'; 00563 if ($result->fields['Field'] == $colname) { 00564 return; // exists, so return with no error 00565 } 00566 $result->MoveNext(); 00567 } 00568 // if we get here, then the column didn't exist 00569 return sprintf(REASON_COLUMN_DOESNT_EXIST_TO_DROP,$colname); 00570 }//endif 'DROP' 00571 break; 00572 case ("ALTER"): 00573 case ("MODIFY"): 00574 case ("CHANGE"): 00575 // just check that the column to be changed 'exists' 00576 $colname = ($param[4]=='COLUMN') ? $param[5] : $param[4]; 00577 $sql = "show fields from " . DB_PREFIX . $param[2]; 00578 $result = $db->Execute($sql); 00579 while (!$result->EOF) { 00580 if (ZC_UPG_DEBUG3==true) echo $result->fields['Field'].'<br />'; 00581 if ($result->fields['Field'] == $colname) { 00582 return; // exists, so return with no error 00583 } 00584 $result->MoveNext(); 00585 } 00586 // if we get here, then the column didn't exist 00587 return sprintf(REASON_COLUMN_DOESNT_EXIST_TO_CHANGE,$colname); 00588 break; 00589 default: 00590 // if we get here, then we're processing an ALTER command other than what we're checking for, so let it be processed. 00591 return; 00592 break; 00593 } //end switch 00594 } 00595 00596 function zen_check_config_key($line) { 00597 global $db; 00598 $values=array(); 00599 $values=explode("'",$line); 00600 //INSERT INTO configuration blah blah blah VALUES ('title','key', blah blah blah); 00601 //[0]=INSERT INTO..... 00602 //[1]=title 00603 //[2]=, 00604 //[3]=key 00605 //[4]=blah blah 00606 $title = $values[1]; 00607 $key = $values[3]; 00608 $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='".zen_db_input($key)."'"; 00609 $result = $db->Execute($sql); 00610 if ($result->RecordCount() >0 ) return sprintf(REASON_CONFIG_KEY_ALREADY_EXISTS,$key); 00611 } 00612 00613 function zen_check_product_type_layout_key($line) { 00614 global $db; 00615 $values=array(); 00616 $values=explode("'",$line); 00617 $title = $values[1]; 00618 $key = $values[3]; 00619 $sql = "select configuration_title from " . DB_PREFIX . "product_type_layout where configuration_key='".zen_db_input($key)."'"; 00620 $result = $db->Execute($sql); 00621 if ($result->RecordCount() >0 ) return sprintf(REASON_PRODUCT_TYPE_LAYOUT_KEY_ALREADY_EXISTS,$key); 00622 } 00623 00624 function zen_write_to_upgrade_exceptions_table($line, $reason, $sql_file) { 00625 global $db; 00626 zen_create_exceptions_table(); 00627 $sql="INSERT INTO " . DB_PREFIX . TABLE_UPGRADE_EXCEPTIONS . " VALUES (0,'". $sql_file."','".$reason."', now(), '".zen_db_input($line)."')"; 00628 if (ZC_UPG_DEBUG3==true) echo '<br />sql='.$sql.'<br />'; 00629 $result = $db->Execute($sql); 00630 return $result; 00631 } 00632 00633 function zen_purge_exceptions_table() { 00634 global $db; 00635 zen_create_exceptions_table(); 00636 $result = $db->Execute("TRUNCATE TABLE " . DB_PREFIX . TABLE_UPGRADE_EXCEPTIONS ); 00637 return $result; 00638 } 00639 00640 function zen_create_exceptions_table() { 00641 global $db; 00642 if (!zen_table_exists(TABLE_UPGRADE_EXCEPTIONS)) { 00643 $result = $db->Execute("CREATE TABLE " . DB_PREFIX . TABLE_UPGRADE_EXCEPTIONS ." ( 00644 upgrade_exception_id smallint(5) NOT NULL auto_increment, 00645 sql_file varchar(50) default NULL, 00646 reason varchar(200) default NULL, 00647 errordate datetime default '0001-01-01 00:00:00', 00648 sqlstatement text, PRIMARY KEY (upgrade_exception_id) 00649 )"); 00650 return $result; 00651 } 00652 } 00653 00654 //------------------------------------------------------ 00655 // END FUNCTIONS LIST 00656 //------------------------------------------------------ 00657 00658 if (isset($_GET['debug']) && $_GET['debug']=='ON') $debug=true; 00659 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00660 if (zen_not_null($action)) { 00661 switch ($action) { 00662 case 'execute': 00663 if (isset($_POST['query_string']) && $_POST['query_string'] !='' ) { 00664 $query_string = $_POST['query_string']; 00665 if (version_compare(PHP_VERSION, 5.4, '<') && @get_magic_quotes_gpc() > 0) $query_string = stripslashes($query_string); 00666 if ($debug==true) echo $query_string . '<br />'; 00667 $query_string = explode($linebreak, ($query_string)); 00668 $query_results = executeSql($query_string, DB_DATABASE, DB_PREFIX); 00669 if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) { 00670 $messageStack->add($query_results['queries'].' statements processed.', 'success'); 00671 } else { 00672 $messageStack->add('Failed: '.$query_results['queries'], 'error'); 00673 } 00674 if (zen_not_null($query_results['errors'])) { 00675 foreach ($query_results['errors'] as $value) { 00676 $messageStack->add('ERROR: '.$value, 'error'); 00677 } 00678 } 00679 if ($query_results['ignored'] != 0) { 00680 $messageStack->add('Note: '.$query_results['ignored'].' statements ignored. See "upgrade_exceptions" table for additional details.', 'caution'); 00681 } 00682 if (zen_not_null($query_results['output'])) { 00683 foreach ($query_results['output'] as $value) { 00684 if (zen_not_null($value)) $messageStack->add('INFO: '.$value, 'caution'); 00685 } 00686 } 00687 00688 } else { 00689 $messageStack->add(ERROR_NOTHING_TO_DO, 'error'); 00690 } 00691 break; 00692 case 'uploadquery': 00693 $query_string = ''; 00694 if (isset($_FILES['sql_file']) && isset($_FILES['sql_file']['tmp_name']) && $_FILES['sql_file']['tmp_name'] != '') { 00695 $upload_query = file($_FILES['sql_file']['tmp_name']); 00696 $query_string = $upload_query; 00697 } 00698 if (version_compare(PHP_VERSION, 5.4, '<') && @get_magic_quotes_runtime() > 0) $query_string = zen_db_prepare_input($upload_query); 00699 if ($query_string !='') { 00700 $query_results = executeSql($query_string, DB_DATABASE, DB_PREFIX); 00701 if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) { 00702 $messageStack->add($query_results['queries']. ' statements processed.', 'success'); 00703 } else { 00704 $messageStack->add('Failed: '.$query_results['queries'], 'error'); 00705 } 00706 if (zen_not_null($query_results['errors'])) { 00707 foreach ($query_results['errors'] as $value) { 00708 $messageStack->add('ERROR: '.$value, 'error'); 00709 } 00710 } 00711 if ($query_results['ignored'] != 0) { 00712 $messageStack->add('Note: '.$query_results['ignored'].' statements ignored. See "upgrade_exceptions" table for additional details.', 'caution'); 00713 } 00714 if (zen_not_null($query_results['output'])) { 00715 foreach ($query_results['output'] as $value) { 00716 if (zen_not_null($value)) $messageStack->add('ERROR: '.$value, 'error'); 00717 } 00718 } 00719 } else { 00720 $messageStack->add(ERROR_NOTHING_TO_DO, 'error'); 00721 } 00722 break; 00723 case 'help': 00724 break; 00725 default: 00726 break; 00727 } 00728 } 00729 ?> 00730 <?php if ($action != 'help') { ?> 00731 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00732 <html <?php echo HTML_PARAMS; ?>> 00733 <head> 00734 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00735 <title><?php echo TITLE; ?></title> 00736 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00737 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00738 <script language="javascript" src="includes/menu.js"></script> 00739 <script type="text/javascript"> 00740 <!-- 00741 function popupHelpWindow(url) { 00742 window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150') 00743 } 00744 function init() 00745 { 00746 cssjsmenu('navbar'); 00747 if (document.getElementById) 00748 { 00749 var kill = document.getElementById('hoverJS'); 00750 kill.disabled = true; 00751 } 00752 } 00753 // --> 00754 </script> 00755 </head> 00756 <body onLoad="init()" > 00757 <!-- header //--> 00758 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00759 <!-- header_eof //--> 00760 00761 00762 <!-- body //--> 00763 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00764 <tr> 00765 <!-- body_text //--> 00766 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00767 <tr> 00768 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00769 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 00770 </tr> 00771 <tr><td class="alert"><?php echo HEADING_WARNING; ?></td></tr> 00772 <tr> 00773 <td class="alert"><strong><?php echo HEADING_WARNING2; ?></strong></td> 00774 </tr> 00775 </table></td> 00776 </tr> 00777 <?php 00778 if ( $action == 'execute' && $_POST['query_string'] !='' ) { 00779 ?> 00780 <tr> 00781 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00782 <tr> 00783 <td class="smallText"><strong><?php echo TEXT_QUERY_RESULTS; ?></strong></td> 00784 </tr> 00785 <tr> 00786 <td class="smallText"><?php echo $query_results['string']; ?></td> 00787 </tr> 00788 </table></td> 00789 </tr> 00790 <?php 00791 } 00792 ?> 00793 <tr><?php echo zen_draw_form('getquery', FILENAME_SQLPATCH, 'action=execute' . (($debug==true)?'&debug=ON':'') . (($skip_stripslashes==true)?'&keepslashes=1':''),'post', ''); ?> 00794 <td><table border="0" cellpadding="0" cellspacing="2"> 00795 <tr> 00796 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 00797 </tr> 00798 <tr> 00799 <td valign="top" class="main" width="110px"><?php echo TEXT_ENTER_QUERY_STRING; ?></td> 00800 <td><?php echo zen_draw_textarea_field('query_string', 'soft', '80%', '10', '','id="sqlpatchKeyedQuery" class="sqlpatchKeyedQuery"',false); ?></td> 00801 </tr> 00802 <tr> 00803 <td colspan="2" align="right"><?php echo zen_image_submit('button_send.gif', IMAGE_SEND); ?></td> 00804 </tr> 00805 </table></td> 00806 </form></tr> 00807 00808 <tr><td class="alert" colspan="2" style="padding-left:110px;"><?php echo HEADING_WARNING_INSTALLSCRIPTS; ?></td></tr> 00809 00810 <tr><?php echo zen_draw_form('getqueryfile', FILENAME_SQLPATCH, 'action=uploadquery' . (($debug==true)?'&debug=ON':'') . (($skip_stripslashes==true)?'&keepslashes=1':'') ,'post', 'enctype="multipart/form-data"'); ?> 00811 <?php if (isset($_GET['nogrants'])) echo '<input type="hidden" id="nogrants" name="nogrants" value="'.(bool)$_GET['nogrants'].'" />'; ?> 00812 <td><table border="0" cellpadding="0" cellspacing="2"> 00813 <tr> 00814 <td valign="top" class="main" width="110px"> <?php echo TEXT_QUERY_FILENAME; ?> </td> 00815 <td><?php echo zen_draw_file_field('sql_file'); ?> <?php echo zen_image_submit('button_upload.gif', IMAGE_UPLOAD); ?></td> 00816 </tr> 00817 </table></td> 00818 </form></tr> 00819 <tr> 00820 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 00821 </tr> 00822 <tr> 00823 <td width="300" align="right"> 00824 <a href="<?php echo zen_href_link(FILENAME_SQLPATCH, 'action=help'); ?>" target='_blank'><?php echo zen_image_button('button_details.gif', IMAGE_DETAILS); ?></a></td> 00825 </tr> 00826 <!-- body_text_eof //--> 00827 </table> 00828 <!-- body_eof //--> 00829 <!-- footer //--> 00830 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00831 <!-- footer_eof //--> 00832 </body> 00833 </html> 00834 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> 00835 00836 <?php } elseif ($action == 'help') { // endif $action != 'help' ?> 00837 <?php echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">'; ?> 00838 <html <?php echo HTML_PARAMS; ?>> 00839 <head> 00840 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" /> 00841 <title>HELP - <?php echo HEADING_TITLE; ?> - Zen Cart®</title> 00842 </head> 00843 <body id="popup"></body> 00844 <div id="popup_header"> 00845 <h1> 00846 <?php 00847 echo 'Zen Cart® ' . HEADING_TITLE; 00848 echo '<br /><br />'; 00849 ?> 00850 </h1> 00851 </div> 00852 <div id="popup_content"> 00853 <span style=" color: #FF0000; font-weight: bold;"><?php echo HEADING_WARNING; ?></span><br /> 00854 <?php 00855 echo SQLPATCH_HELP_TEXT; 00856 echo '<br /><br />'; 00857 ?> 00858 <span style=" color: #FF0000; font-weight: bold;"><?php echo HEADING_WARNING; ?></span><br /> 00859 <span style=" color: #FF0000; font-weight: bold;"><?php echo HEADING_WARNING2; ?></span><br /> 00860 </div> 00861 <?php 00862 echo '<center>' . '<a href="javascript:window.close()">' . TEXT_CLOSE_WINDOW . '</a></center>'; 00863 ?> 00864 </body> 00865 </html> 00866 <?php } //endif $action = help ?>