@@ -13,11 +13,11 @@ |
||
| 13 | 13 | var $prepend, $langPath; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * @param string text to append before first calendar usage |
|
| 17 | - * @param string path to language file, %s stands for language code |
|
| 18 | - */ |
|
| 16 | + * @param string text to append before first calendar usage |
|
| 17 | + * @param string path to language file, %s stands for language code |
|
| 18 | + */ |
|
| 19 | 19 | function __construct($prepend = "<script type='text/javascript' src='jquery-ui/jquery.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n", $langPath = 'jquery-ui/i18n/jquery.ui.datepicker-%s.js' |
| 20 | - ) { |
|
| 20 | + ) { |
|
| 21 | 21 | $this->prepend = $prepend; |
| 22 | 22 | $this->langPath = $langPath; |
| 23 | 23 | } |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | case 'tables_priv': return array(array('table' => 'user', 'source' => array('Host', 'User'), 'target' => array('Host', 'User'))); |
| 21 | 21 | case 'time_zone_name': return array(array('table' => 'time_zone', 'source' => array('Time_zone_id'), 'target' => array('Time_zone_id'))); |
| 22 | 22 | case 'time_zone_transition': return array(array('table' => 'time_zone', 'source' => array('Time_zone_id'), 'target' => array('Time_zone_id')), array( |
| 23 | - 'table' => 'time_zone_transition_type', 'source' => array('Time_zone_id', 'Transition_type_id'), 'target' => array( |
|
| 24 | - 'Time_zone_id', |
|
| 25 | - 'Transition_type_id' |
|
| 26 | - ))); |
|
| 23 | + 'table' => 'time_zone_transition_type', 'source' => array('Time_zone_id', 'Transition_type_id'), 'target' => array( |
|
| 24 | + 'Time_zone_id', |
|
| 25 | + 'Transition_type_id' |
|
| 26 | + ))); |
|
| 27 | 27 | case 'time_zone_transition_type': return array(array('table' => 'time_zone', 'source' => array('Time_zone_id'), 'target' => array('Time_zone_id'))); |
| 28 | 28 | } |
| 29 | 29 | } elseif (DB == 'information_schema') { |
@@ -44,40 +44,40 @@ discard block |
||
| 44 | 44 | case 'EVENTS': return array_merge(array(array('source' => array('EVENT_CATALOG', 'EVENT_SCHEMA')) + $schemata), $routine_charsets); |
| 45 | 45 | case 'FILES': return array($schemata, $tables); |
| 46 | 46 | case 'KEY_COLUMN_USAGE': return array(array('source' => array('CONSTRAINT_CATALOG', 'CONSTRAINT_SCHEMA')) + $schemata, $schemata, $tables, $columns, array('source' => array('TABLE_CATALOG', 'REFERENCED_TABLE_SCHEMA')) + $schemata, array( |
| 47 | - 'source' => array( |
|
| 48 | - 'TABLE_CATALOG', |
|
| 49 | - 'REFERENCED_TABLE_SCHEMA', |
|
| 50 | - 'REFERENCED_TABLE_NAME' |
|
| 51 | - )) + $tables, array( |
|
| 52 | - 'source' => array( |
|
| 53 | - 'TABLE_CATALOG', |
|
| 54 | - 'REFERENCED_TABLE_SCHEMA', |
|
| 55 | - 'REFERENCED_TABLE_NAME', |
|
| 56 | - 'REFERENCED_COLUMN_NAME' |
|
| 57 | - )) + $columns); |
|
| 47 | + 'source' => array( |
|
| 48 | + 'TABLE_CATALOG', |
|
| 49 | + 'REFERENCED_TABLE_SCHEMA', |
|
| 50 | + 'REFERENCED_TABLE_NAME' |
|
| 51 | + )) + $tables, array( |
|
| 52 | + 'source' => array( |
|
| 53 | + 'TABLE_CATALOG', |
|
| 54 | + 'REFERENCED_TABLE_SCHEMA', |
|
| 55 | + 'REFERENCED_TABLE_NAME', |
|
| 56 | + 'REFERENCED_COLUMN_NAME' |
|
| 57 | + )) + $columns); |
|
| 58 | 58 | case 'PARTITIONS': return array($schemata, $tables); |
| 59 | 59 | case 'REFERENTIAL_CONSTRAINTS': return array(array('source' => array('CONSTRAINT_CATALOG', 'CONSTRAINT_SCHEMA')) + $schemata, array('source' => array('UNIQUE_CONSTRAINT_CATALOG', 'UNIQUE_CONSTRAINT_SCHEMA')) + $schemata, array( |
| 60 | - 'source' => array( |
|
| 61 | - 'CONSTRAINT_CATALOG', |
|
| 62 | - 'CONSTRAINT_SCHEMA', |
|
| 63 | - 'TABLE_NAME' |
|
| 64 | - )) + $tables, array( |
|
| 65 | - 'source' => array( |
|
| 66 | - 'CONSTRAINT_CATALOG', |
|
| 67 | - 'CONSTRAINT_SCHEMA', |
|
| 68 | - 'REFERENCED_TABLE_NAME' |
|
| 69 | - )) + $tables); |
|
| 60 | + 'source' => array( |
|
| 61 | + 'CONSTRAINT_CATALOG', |
|
| 62 | + 'CONSTRAINT_SCHEMA', |
|
| 63 | + 'TABLE_NAME' |
|
| 64 | + )) + $tables, array( |
|
| 65 | + 'source' => array( |
|
| 66 | + 'CONSTRAINT_CATALOG', |
|
| 67 | + 'CONSTRAINT_SCHEMA', |
|
| 68 | + 'REFERENCED_TABLE_NAME' |
|
| 69 | + )) + $tables); |
|
| 70 | 70 | case 'ROUTINES': return array_merge(array(array('source' => array('ROUTINE_CATALOG', 'ROUTINE_SCHEMA')) + $schemata), $routine_charsets); |
| 71 | 71 | case 'SCHEMA_PRIVILEGES': return array($schemata); |
| 72 | 72 | case 'STATISTICS': return array($schemata, $tables, $columns, array('source' => array('TABLE_CATALOG', 'INDEX_SCHEMA')) + $schemata); |
| 73 | 73 | case 'TABLE_CONSTRAINTS': return array(array('source' => array('CONSTRAINT_CATALOG', 'CONSTRAINT_SCHEMA')) + $schemata, array('source' => array('CONSTRAINT_CATALOG', 'TABLE_SCHEMA')) + $schemata, array('source' => array('CONSTRAINT_CATALOG', 'TABLE_SCHEMA', 'TABLE_NAME')) + $tables); |
| 74 | 74 | case 'TABLE_PRIVILEGES': return array($schemata, $tables); |
| 75 | 75 | case 'TRIGGERS': return array_merge(array(array('source' => array('TRIGGER_CATALOG', 'TRIGGER_SCHEMA')) + $schemata, array('source' => array('EVENT_OBJECT_CATALOG', 'EVENT_OBJECT_SCHEMA')) + $schemata, array( |
| 76 | - 'source' => array( |
|
| 77 | - 'EVENT_OBJECT_CATALOG', |
|
| 78 | - 'EVENT_OBJECT_SCHEMA', |
|
| 79 | - 'EVENT_OBJECT_TABLE' |
|
| 80 | - )) + $tables), $routine_charsets); |
|
| 76 | + 'source' => array( |
|
| 77 | + 'EVENT_OBJECT_CATALOG', |
|
| 78 | + 'EVENT_OBJECT_SCHEMA', |
|
| 79 | + 'EVENT_OBJECT_TABLE' |
|
| 80 | + )) + $tables), $routine_charsets); |
|
| 81 | 81 | case 'VIEWS': return array($schemata); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -39,11 +39,11 @@ |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function tableName(&$tableStatus) { |
| 42 | - $tableStatus['Comment'] = $this->_translate($tableStatus['Comment']); |
|
| 42 | + $tableStatus['Comment'] = $this->_translate($tableStatus['Comment']); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | function fieldName(&$field, $order = 0) { |
| 46 | - $field['comment'] = $this->_translate($field['comment']); |
|
| 46 | + $field['comment'] = $this->_translate($field['comment']); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function editVal(&$val, $field) { |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | var $database; |
| 19 | 19 | |
| 20 | 20 | /** Set database of login table |
| 21 | - * @param string |
|
| 22 | - */ |
|
| 21 | + * @param string |
|
| 22 | + */ |
|
| 23 | 23 | function AdminerLoginTable($database) { |
| 24 | 24 | $this->database = $database; |
| 25 | 25 | } |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** Register plugins |
| 21 | - * @param array object instances or null to register all classes starting by 'Adminer' |
|
| 22 | - */ |
|
| 21 | + * @param array object instances or null to register all classes starting by 'Adminer' |
|
| 22 | + */ |
|
| 23 | 23 | function __construct($plugins) { |
| 24 | 24 | if ($plugins === null) { |
| 25 | 25 | $plugins = array(); |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | var $servers, $driver; |
| 12 | 12 | |
| 13 | 13 | /** Set supported servers |
| 14 | - * @param array array($domain) or array($domain => $description) or array($category => array()) |
|
| 15 | - * @param string |
|
| 16 | - */ |
|
| 14 | + * @param array array($domain) or array($domain => $description) or array($category => array()) |
|
| 15 | + * @param string |
|
| 16 | + */ |
|
| 17 | 17 | function __construct($servers, $driver = 'server') { |
| 18 | 18 | $this->servers = $servers; |
| 19 | 19 | $this->driver = $driver; |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | var $uploadPath, $displayPath, $extensions; |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param string prefix for uploading data (create writable subdirectory for each table containing uploadable fields) |
|
| 16 | - * @param string prefix for displaying data, null stands for $uploadPath |
|
| 17 | - * @param string regular expression with allowed file extensions |
|
| 18 | - */ |
|
| 15 | + * @param string prefix for uploading data (create writable subdirectory for each table containing uploadable fields) |
|
| 16 | + * @param string prefix for displaying data, null stands for $uploadPath |
|
| 17 | + * @param string regular expression with allowed file extensions |
|
| 18 | + */ |
|
| 19 | 19 | function __construct($uploadPath = '../static/data/', $displayPath = null, $extensions = '[a-zA-Z0-9]+') { |
| 20 | 20 | $this->uploadPath = $uploadPath; |
| 21 | 21 | $this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $ajax = true; // AJAX mode: import will be done without refreshing the website |
| 56 | 56 | $linespersession = 3000; // Lines to be executed per one import session |
| 57 | 57 | $delaypersession = 0; // You can specify a sleep time in milliseconds after each session |
| 58 | - // Works only if JavaScript is activated. Use to reduce server overrun |
|
| 58 | + // Works only if JavaScript is activated. Use to reduce server overrun |
|
| 59 | 59 | |
| 60 | 60 | // CSV related settings (only if you use a CSV dump) |
| 61 | 61 | |
@@ -353,25 +353,25 @@ discard block |
||
| 353 | 353 | if (!$error && isset($_REQUEST["uploadbutton"])) |
| 354 | 354 | { if (is_uploaded_file($_FILES["dumpfile"]["tmp_name"]) && ($_FILES["dumpfile"]["error"])==0)
|
| 355 | 355 | {
|
| 356 | - $uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]);
|
|
| 357 | - $uploaded_filename=preg_replace("/[^_A-Za-z0-9-\.]/i",'',$uploaded_filename);
|
|
| 358 | - $uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename);
|
|
| 356 | + $uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]);
|
|
| 357 | + $uploaded_filename=preg_replace("/[^_A-Za-z0-9-\.]/i",'',$uploaded_filename);
|
|
| 358 | + $uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename);
|
|
| 359 | 359 | |
| 360 | - do_action('file_uploaded');
|
|
| 360 | + do_action('file_uploaded');
|
|
| 361 | 361 | |
| 362 | - if (file_exists($uploaded_filename)) |
|
| 363 | - { echo ("<p class=\"error\">File $uploaded_filename already exist! Delete and upload again!</p>\n");
|
|
| 364 | - } |
|
| 365 | - else if (!preg_match("/(\.(sql|gz|csv))$/i",$uploaded_filename))
|
|
| 366 | - { echo ("<p class=\"error\">You may only upload .sql .gz or .csv files.</p>\n");
|
|
| 367 | - } |
|
| 368 | - else if (!@move_uploaded_file($_FILES["dumpfile"]["tmp_name"],$uploaded_filepath)) |
|
| 369 | - { echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n");
|
|
| 370 | - echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n");
|
|
| 371 | - } |
|
| 372 | - else |
|
| 373 | - { echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n");
|
|
| 374 | - } |
|
| 362 | + if (file_exists($uploaded_filename)) |
|
| 363 | + { echo ("<p class=\"error\">File $uploaded_filename already exist! Delete and upload again!</p>\n");
|
|
| 364 | + } |
|
| 365 | + else if (!preg_match("/(\.(sql|gz|csv))$/i",$uploaded_filename))
|
|
| 366 | + { echo ("<p class=\"error\">You may only upload .sql .gz or .csv files.</p>\n");
|
|
| 367 | + } |
|
| 368 | + else if (!@move_uploaded_file($_FILES["dumpfile"]["tmp_name"],$uploaded_filepath)) |
|
| 369 | + { echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n");
|
|
| 370 | + echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n");
|
|
| 371 | + } |
|
| 372 | + else |
|
| 373 | + { echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n");
|
|
| 374 | + } |
|
| 375 | 375 | } |
| 376 | 376 | else |
| 377 | 377 | { echo ("<p class=\"error\">Error uploading file ".$_FILES["dumpfile"]["name"]."</p>\n");
|
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | if (!$error && isset($_REQUEST["delete"]) && $_REQUEST["delete"]!=basename($_SERVER["SCRIPT_FILENAME"])) |
| 385 | 385 | { if (preg_match("/(\.(sql|gz|csv))$/i",$_REQUEST["delete"]) && @unlink($upload_dir.'/'.$_REQUEST["delete"]))
|
| 386 | - echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n");
|
|
| 386 | + echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n");
|
|
| 387 | 387 | else |
| 388 | - echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n");
|
|
| 388 | + echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n");
|
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | // Connect to the database, set charset and execute pre-queries |
@@ -395,23 +395,23 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | if (mysqli_connect_error()) |
| 397 | 397 | { echo ("<p class=\"error\">Database connection failed due to ".mysqli_connect_error()."</p>\n");
|
| 398 | - echo ("<p>Edit the database settings in BigDump configuration, or contact your database provider.</p>\n");
|
|
| 399 | - $error=true; |
|
| 398 | + echo ("<p>Edit the database settings in BigDump configuration, or contact your database provider.</p>\n");
|
|
| 399 | + $error=true; |
|
| 400 | 400 | } |
| 401 | 401 | if (!$error && $db_connection_charset!=='') |
| 402 | - $mysqli->query("SET NAMES $db_connection_charset");
|
|
| 402 | + $mysqli->query("SET NAMES $db_connection_charset");
|
|
| 403 | 403 | |
| 404 | 404 | if (!$error && isset ($pre_query) && sizeof ($pre_query)>0) |
| 405 | 405 | { reset($pre_query);
|
| 406 | - foreach ($pre_query as $pre_query_value) |
|
| 407 | - { if (!$mysqli->query($pre_query_value))
|
|
| 408 | - { echo ("<p class=\"error\">Error with pre-query.</p>\n");
|
|
| 409 | - echo ("<p>Query: ".trim(nl2br(htmlentities($pre_query_value)))."</p>\n");
|
|
| 410 | - echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 411 | - $error=true; |
|
| 412 | - break; |
|
| 413 | - } |
|
| 414 | - } |
|
| 406 | + foreach ($pre_query as $pre_query_value) |
|
| 407 | + { if (!$mysqli->query($pre_query_value))
|
|
| 408 | + { echo ("<p class=\"error\">Error with pre-query.</p>\n");
|
|
| 409 | + echo ("<p>Query: ".trim(nl2br(htmlentities($pre_query_value)))."</p>\n");
|
|
| 410 | + echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 411 | + $error=true; |
|
| 412 | + break; |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | else |
@@ -428,50 +428,50 @@ discard block |
||
| 428 | 428 | if (!$error && !isset($_REQUEST["fn"]) && $filename=="") |
| 429 | 429 | { if ($dirhandle = opendir($upload_dir))
|
| 430 | 430 | {
|
| 431 | - $files=array(); |
|
| 432 | - while (false !== ($files[] = readdir($dirhandle))); |
|
| 433 | - closedir($dirhandle); |
|
| 434 | - $dirhead=false; |
|
| 435 | - |
|
| 436 | - if (sizeof($files)>0) |
|
| 437 | - {
|
|
| 438 | - sort($files); |
|
| 439 | - foreach ($files as $dirfile) |
|
| 440 | - {
|
|
| 441 | - if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"]) && preg_match("/\.(sql|gz|csv)$/i",$dirfile))
|
|
| 442 | - { if (!$dirhead)
|
|
| 443 | - { echo ("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\">\n");
|
|
| 444 | - echo ("<tr><th>Filename</th><th>Size</th><th>Date&Time</th><th>Type</th><th> </th><th> </th>\n");
|
|
| 445 | - $dirhead=true; |
|
| 446 | - } |
|
| 447 | - echo ("<tr><td>$dirfile</td><td class=\"right\">".filesize($upload_dir.'/'.$dirfile)."</td><td>".date ("Y-m-d H:i:s", filemtime($upload_dir.'/'.$dirfile))."</td>");
|
|
| 448 | - |
|
| 449 | - if (preg_match("/\.sql$/i",$dirfile))
|
|
| 450 | - echo ("<td>SQL</td>");
|
|
| 451 | - elseif (preg_match("/\.gz$/i",$dirfile))
|
|
| 452 | - echo ("<td>GZip</td>");
|
|
| 453 | - elseif (preg_match("/\.csv$/i",$dirfile))
|
|
| 454 | - echo ("<td>CSV</td>");
|
|
| 455 | - else |
|
| 456 | - echo ("<td>Misc</td>");
|
|
| 457 | - |
|
| 458 | - if ((preg_match("/\.gz$/i",$dirfile) && function_exists("gzopen")) || preg_match("/\.sql$/i",$dirfile) || preg_match("/\.csv$/i",$dirfile))
|
|
| 459 | - echo ("<td><a href=\"".$_SERVER["PHP_SELF"]."?start=1&fn=".urlencode($dirfile)."&foffset=0&totalqueries=0&delimiter=".urlencode($delimiter)."\">Start Import</a> into $db_name at $db_server</td>\n <td><a href=\"".$_SERVER["PHP_SELF"]."?delete=".urlencode($dirfile)."\">Delete file</a></td></tr>\n");
|
|
| 431 | + $files=array(); |
|
| 432 | + while (false !== ($files[] = readdir($dirhandle))); |
|
| 433 | + closedir($dirhandle); |
|
| 434 | + $dirhead=false; |
|
| 435 | + |
|
| 436 | + if (sizeof($files)>0) |
|
| 437 | + {
|
|
| 438 | + sort($files); |
|
| 439 | + foreach ($files as $dirfile) |
|
| 440 | + {
|
|
| 441 | + if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"]) && preg_match("/\.(sql|gz|csv)$/i",$dirfile))
|
|
| 442 | + { if (!$dirhead)
|
|
| 443 | + { echo ("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\">\n");
|
|
| 444 | + echo ("<tr><th>Filename</th><th>Size</th><th>Date&Time</th><th>Type</th><th> </th><th> </th>\n");
|
|
| 445 | + $dirhead=true; |
|
| 446 | + } |
|
| 447 | + echo ("<tr><td>$dirfile</td><td class=\"right\">".filesize($upload_dir.'/'.$dirfile)."</td><td>".date ("Y-m-d H:i:s", filemtime($upload_dir.'/'.$dirfile))."</td>");
|
|
| 448 | + |
|
| 449 | + if (preg_match("/\.sql$/i",$dirfile))
|
|
| 450 | + echo ("<td>SQL</td>");
|
|
| 451 | + elseif (preg_match("/\.gz$/i",$dirfile))
|
|
| 452 | + echo ("<td>GZip</td>");
|
|
| 453 | + elseif (preg_match("/\.csv$/i",$dirfile))
|
|
| 454 | + echo ("<td>CSV</td>");
|
|
| 455 | + else |
|
| 456 | + echo ("<td>Misc</td>");
|
|
| 457 | + |
|
| 458 | + if ((preg_match("/\.gz$/i",$dirfile) && function_exists("gzopen")) || preg_match("/\.sql$/i",$dirfile) || preg_match("/\.csv$/i",$dirfile))
|
|
| 459 | + echo ("<td><a href=\"".$_SERVER["PHP_SELF"]."?start=1&fn=".urlencode($dirfile)."&foffset=0&totalqueries=0&delimiter=".urlencode($delimiter)."\">Start Import</a> into $db_name at $db_server</td>\n <td><a href=\"".$_SERVER["PHP_SELF"]."?delete=".urlencode($dirfile)."\">Delete file</a></td></tr>\n");
|
|
| 460 | 460 | // TODO: echo ("<td><a href=\"".$_SERVER["PHP_SELF"]."?start=1&fn=".urlencode($dirfile)."&foffset=0&totalqueries=0&delimiter=".urlencode($delimiter)."\">Start Import</a></td>\n <td><a href=\"".$_SERVER["PHP_SELF"]."?delete=".urlencode($dirfile)."\">Delete file</a></td></tr>\n");
|
| 461 | - else |
|
| 462 | - echo ("<td> </td>\n <td> </td></tr>\n");
|
|
| 463 | - } |
|
| 464 | - } |
|
| 465 | - } |
|
| 461 | + else |
|
| 462 | + echo ("<td> </td>\n <td> </td></tr>\n");
|
|
| 463 | + } |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - if ($dirhead) |
|
| 468 | - echo ("</table>\n");
|
|
| 469 | - else |
|
| 470 | - echo ("<p>No uploaded SQL, GZ or CSV files found in the working directory</p>\n");
|
|
| 467 | + if ($dirhead) |
|
| 468 | + echo ("</table>\n");
|
|
| 469 | + else |
|
| 470 | + echo ("<p>No uploaded SQL, GZ or CSV files found in the working directory</p>\n");
|
|
| 471 | 471 | } |
| 472 | 472 | else |
| 473 | 473 | { echo ("<p class=\"error\">Error listing directory $upload_dir</p>\n");
|
| 474 | - $error=true; |
|
| 474 | + $error=true; |
|
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
@@ -493,14 +493,14 @@ discard block |
||
| 493 | 493 | do { $tempfilename=$upload_dir.'/'.time().".tmp"; } while (file_exists($tempfilename));
|
| 494 | 494 | if (!($tempfile=@fopen($tempfilename,"w"))) |
| 495 | 495 | { echo ("<p>Upload form disabled. Permissions for the working directory <i>$upload_dir</i> <b>must be set writable for the webserver</b> in order ");
|
| 496 | - echo ("to upload files here. Alternatively you can upload your dump files via FTP.</p>\n");
|
|
| 496 | + echo ("to upload files here. Alternatively you can upload your dump files via FTP.</p>\n");
|
|
| 497 | 497 | } |
| 498 | 498 | else |
| 499 | 499 | { fclose($tempfile);
|
| 500 | - unlink ($tempfilename); |
|
| 500 | + unlink ($tempfilename); |
|
| 501 | 501 | |
| 502 | - echo ("<p>You can now upload your dump file up to $upload_max_filesize bytes (".round ($upload_max_filesize/1024/1024)." Mbytes) ");
|
|
| 503 | - echo ("directly from your browser to the server. Alternatively you can upload your dump files of any size via FTP.</p>\n");
|
|
| 502 | + echo ("<p>You can now upload your dump file up to $upload_max_filesize bytes (".round ($upload_max_filesize/1024/1024)." Mbytes) ");
|
|
| 503 | + echo ("directly from your browser to the server. Alternatively you can upload your dump files of any size via FTP.</p>\n");
|
|
| 504 | 504 | ?> |
| 505 | 505 | <form method="POST" action="<?php echo ($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> |
| 506 | 506 | <input type="hidden" name="MAX_FILE_SIZE" value="$upload_max_filesize"> |
@@ -518,11 +518,11 @@ discard block |
||
| 518 | 518 | $result = $mysqli->query("SHOW VARIABLES LIKE 'character_set_connection';");
|
| 519 | 519 | if ($result) |
| 520 | 520 | { $row = $result->fetch_assoc();
|
| 521 | - if ($row) |
|
| 522 | - { $charset = $row['Value'];
|
|
| 523 | - echo ("<p>Note: The current mySQL connection charset is <i>$charset</i>. Your dump file must be encoded in <i>$charset</i> in order to avoid problems with non-latin characters. You can change the connection charset using the \$db_connection_charset variable in bigdump.php</p>\n");
|
|
| 524 | - } |
|
| 525 | - $result->free(); |
|
| 521 | + if ($row) |
|
| 522 | + { $charset = $row['Value'];
|
|
| 523 | + echo ("<p>Note: The current mySQL connection charset is <i>$charset</i>. Your dump file must be encoded in <i>$charset</i> in order to avoid problems with non-latin characters. You can change the connection charset using the \$db_connection_charset variable in bigdump.php</p>\n");
|
|
| 524 | + } |
|
| 525 | + $result->free(); |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | |
@@ -534,43 +534,43 @@ discard block |
||
| 534 | 534 | // Set current filename ($filename overrides $_REQUEST["fn"] if set) |
| 535 | 535 | |
| 536 | 536 | if ($filename!="") |
| 537 | - $curfilename=$filename; |
|
| 537 | + $curfilename=$filename; |
|
| 538 | 538 | else if (isset($_REQUEST["fn"])) |
| 539 | - $curfilename=urldecode($_REQUEST["fn"]); |
|
| 539 | + $curfilename=urldecode($_REQUEST["fn"]); |
|
| 540 | 540 | else |
| 541 | - $curfilename=""; |
|
| 541 | + $curfilename=""; |
|
| 542 | 542 | |
| 543 | 543 | // Recognize GZip filename |
| 544 | 544 | |
| 545 | 545 | if (preg_match("/\.gz$/i",$curfilename))
|
| 546 | - $gzipmode=true; |
|
| 546 | + $gzipmode=true; |
|
| 547 | 547 | else |
| 548 | - $gzipmode=false; |
|
| 548 | + $gzipmode=false; |
|
| 549 | 549 | |
| 550 | 550 | if ((!$gzipmode && !$file=@fopen($upload_dir.'/'.$curfilename,"r")) || ($gzipmode && !$file=@gzopen($upload_dir.'/'.$curfilename,"r"))) |
| 551 | 551 | { echo ("<p class=\"error\">Can't open ".$curfilename." for import</p>\n");
|
| 552 | - echo ("<p>Please, check that your dump file name contains only alphanumerical characters, and rename it accordingly, for example: $curfilename.".
|
|
| 553 | - "<br>Or, specify \$filename in bigdump.php with the full filename. ". |
|
| 554 | - "<br>Or, you have to upload the $curfilename to the server first.</p>\n"); |
|
| 555 | - $error=true; |
|
| 552 | + echo ("<p>Please, check that your dump file name contains only alphanumerical characters, and rename it accordingly, for example: $curfilename.".
|
|
| 553 | + "<br>Or, specify \$filename in bigdump.php with the full filename. ". |
|
| 554 | + "<br>Or, you have to upload the $curfilename to the server first.</p>\n"); |
|
| 555 | + $error=true; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | // Get the file size (can't do it fast on gzipped files, no idea how) |
| 559 | 559 | |
| 560 | 560 | else if ((!$gzipmode && @fseek($file, 0, SEEK_END)==0) || ($gzipmode && @gzseek($file, 0)==0)) |
| 561 | 561 | { if (!$gzipmode) $filesize = ftell($file);
|
| 562 | - else $filesize = gztell($file); // Always zero, ignore |
|
| 562 | + else $filesize = gztell($file); // Always zero, ignore |
|
| 563 | 563 | } |
| 564 | 564 | else |
| 565 | 565 | { echo ("<p class=\"error\">I can't seek into $curfilename</p>\n");
|
| 566 | - $error=true; |
|
| 566 | + $error=true; |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // Stop if csv file is used, but $csv_insert_table is not set |
| 570 | 570 | |
| 571 | 571 | if (!$error && ($csv_insert_table == "") && (preg_match("/(\.csv)$/i",$curfilename)))
|
| 572 | 572 | { echo ("<p class=\"error\">You have to specify \$csv_insert_table when using a CSV file. </p>\n");
|
| 573 | - $error=true; |
|
| 573 | + $error=true; |
|
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
@@ -588,171 +588,171 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | if (!is_numeric($_REQUEST["start"]) || !is_numeric($_REQUEST["foffset"])) |
| 590 | 590 | { echo ("<p class=\"error\">UNEXPECTED: Non-numeric values for start and foffset</p>\n");
|
| 591 | - $error=true; |
|
| 591 | + $error=true; |
|
| 592 | 592 | } |
| 593 | 593 | else |
| 594 | 594 | { $_REQUEST["start"] = floor($_REQUEST["start"]);
|
| 595 | - $_REQUEST["foffset"] = floor($_REQUEST["foffset"]); |
|
| 595 | + $_REQUEST["foffset"] = floor($_REQUEST["foffset"]); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | // Set the current delimiter if defined |
| 599 | 599 | |
| 600 | 600 | if (isset($_REQUEST["delimiter"])) |
| 601 | - $delimiter = $_REQUEST["delimiter"]; |
|
| 601 | + $delimiter = $_REQUEST["delimiter"]; |
|
| 602 | 602 | |
| 603 | 603 | // Empty CSV table if requested |
| 604 | 604 | |
| 605 | 605 | if (!$error && $_REQUEST["start"]==1 && $csv_insert_table != "" && $csv_preempty_table) |
| 606 | 606 | {
|
| 607 | - $query = "DELETE FROM `$csv_insert_table`"; |
|
| 608 | - if (!TESTMODE && !$mysqli->query(trim($query))) |
|
| 609 | - { echo ("<p class=\"error\">Error when deleting entries from $csv_insert_table.</p>\n");
|
|
| 610 | - echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
|
|
| 611 | - echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 612 | - $error=true; |
|
| 613 | - } |
|
| 607 | + $query = "DELETE FROM `$csv_insert_table`"; |
|
| 608 | + if (!TESTMODE && !$mysqli->query(trim($query))) |
|
| 609 | + { echo ("<p class=\"error\">Error when deleting entries from $csv_insert_table.</p>\n");
|
|
| 610 | + echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
|
|
| 611 | + echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 612 | + $error=true; |
|
| 613 | + } |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | // Print start message |
| 617 | 617 | |
| 618 | 618 | if (!$error) |
| 619 | 619 | { skin_open();
|
| 620 | - if (TESTMODE) |
|
| 621 | - echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n");
|
|
| 622 | - echo ("<p class=\"centr\">Processing file: <b>".$curfilename."</b></p>\n");
|
|
| 623 | - echo ("<p class=\"smlcentr\">Starting from line: ".$_REQUEST["start"]."</p>\n");
|
|
| 624 | - skin_close(); |
|
| 620 | + if (TESTMODE) |
|
| 621 | + echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n");
|
|
| 622 | + echo ("<p class=\"centr\">Processing file: <b>".$curfilename."</b></p>\n");
|
|
| 623 | + echo ("<p class=\"smlcentr\">Starting from line: ".$_REQUEST["start"]."</p>\n");
|
|
| 624 | + skin_close(); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | // Check $_REQUEST["foffset"] upon $filesize (can't do it on gzipped files) |
| 628 | 628 | |
| 629 | 629 | if (!$error && !$gzipmode && $_REQUEST["foffset"]>$filesize) |
| 630 | 630 | { echo ("<p class=\"error\">UNEXPECTED: Can't set file pointer behind the end of file</p>\n");
|
| 631 | - $error=true; |
|
| 631 | + $error=true; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Set file pointer to $_REQUEST["foffset"] |
| 635 | 635 | |
| 636 | 636 | if (!$error && ((!$gzipmode && fseek($file, $_REQUEST["foffset"])!=0) || ($gzipmode && gzseek($file, $_REQUEST["foffset"])!=0))) |
| 637 | 637 | { echo ("<p class=\"error\">UNEXPECTED: Can't set file pointer to offset: ".$_REQUEST["foffset"]."</p>\n");
|
| 638 | - $error=true; |
|
| 638 | + $error=true; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | // Start processing queries from $file |
| 642 | 642 | |
| 643 | 643 | if (!$error) |
| 644 | 644 | { $query="";
|
| 645 | - $queries=0; |
|
| 646 | - $totalqueries=$_REQUEST["totalqueries"]; |
|
| 647 | - $linenumber=$_REQUEST["start"]; |
|
| 648 | - $querylines=0; |
|
| 649 | - $inparents=false; |
|
| 645 | + $queries=0; |
|
| 646 | + $totalqueries=$_REQUEST["totalqueries"]; |
|
| 647 | + $linenumber=$_REQUEST["start"]; |
|
| 648 | + $querylines=0; |
|
| 649 | + $inparents=false; |
|
| 650 | 650 | |
| 651 | 651 | // Stay processing as long as the $linespersession is not reached or the query is still incomplete |
| 652 | 652 | |
| 653 | - while ($linenumber<$_REQUEST["start"]+$linespersession || $query!="") |
|
| 654 | - {
|
|
| 653 | + while ($linenumber<$_REQUEST["start"]+$linespersession || $query!="") |
|
| 654 | + {
|
|
| 655 | 655 | |
| 656 | 656 | // Read the whole next line |
| 657 | 657 | |
| 658 | - $dumpline = ""; |
|
| 659 | - while (!feof($file) && substr ($dumpline, -1) != "\n" && substr ($dumpline, -1) != "\r") |
|
| 660 | - { if (!$gzipmode)
|
|
| 661 | - $dumpline .= fgets($file, DATA_CHUNK_LENGTH); |
|
| 662 | - else |
|
| 663 | - $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); |
|
| 664 | - } |
|
| 665 | - if ($dumpline==="") break; |
|
| 658 | + $dumpline = ""; |
|
| 659 | + while (!feof($file) && substr ($dumpline, -1) != "\n" && substr ($dumpline, -1) != "\r") |
|
| 660 | + { if (!$gzipmode)
|
|
| 661 | + $dumpline .= fgets($file, DATA_CHUNK_LENGTH); |
|
| 662 | + else |
|
| 663 | + $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); |
|
| 664 | + } |
|
| 665 | + if ($dumpline==="") break; |
|
| 666 | 666 | |
| 667 | 667 | // Remove UTF8 Byte Order Mark at the file beginning if any |
| 668 | 668 | |
| 669 | - if ($_REQUEST["foffset"]==0) |
|
| 670 | - $dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline);
|
|
| 669 | + if ($_REQUEST["foffset"]==0) |
|
| 670 | + $dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline);
|
|
| 671 | 671 | |
| 672 | 672 | // Create an SQL query from CSV line |
| 673 | 673 | |
| 674 | - if (($csv_insert_table != "") && (preg_match("/(\.csv)$/i",$curfilename)))
|
|
| 675 | - {
|
|
| 676 | - if ($csv_add_slashes) |
|
| 677 | - $dumpline = addslashes($dumpline); |
|
| 678 | - $dumpline = explode($csv_delimiter,$dumpline); |
|
| 679 | - if ($csv_add_quotes) |
|
| 680 | - $dumpline = "'".implode("','",$dumpline)."'";
|
|
| 681 | - else |
|
| 682 | - $dumpline = implode(",",$dumpline);
|
|
| 683 | - $dumpline = 'INSERT INTO '.$csv_insert_table.' VALUES ('.$dumpline.');';
|
|
| 684 | - } |
|
| 674 | + if (($csv_insert_table != "") && (preg_match("/(\.csv)$/i",$curfilename)))
|
|
| 675 | + {
|
|
| 676 | + if ($csv_add_slashes) |
|
| 677 | + $dumpline = addslashes($dumpline); |
|
| 678 | + $dumpline = explode($csv_delimiter,$dumpline); |
|
| 679 | + if ($csv_add_quotes) |
|
| 680 | + $dumpline = "'".implode("','",$dumpline)."'";
|
|
| 681 | + else |
|
| 682 | + $dumpline = implode(",",$dumpline);
|
|
| 683 | + $dumpline = 'INSERT INTO '.$csv_insert_table.' VALUES ('.$dumpline.');';
|
|
| 684 | + } |
|
| 685 | 685 | |
| 686 | 686 | // Handle DOS and Mac encoded linebreaks (I don't know if it really works on Win32 or Mac Servers) |
| 687 | 687 | |
| 688 | - $dumpline=str_replace("\r\n", "\n", $dumpline);
|
|
| 689 | - $dumpline=str_replace("\r", "\n", $dumpline);
|
|
| 688 | + $dumpline=str_replace("\r\n", "\n", $dumpline);
|
|
| 689 | + $dumpline=str_replace("\r", "\n", $dumpline);
|
|
| 690 | 690 | |
| 691 | 691 | // DIAGNOSTIC |
| 692 | 692 | // echo ("<p>Line $linenumber: $dumpline</p>\n");
|
| 693 | 693 | |
| 694 | 694 | // Recognize delimiter statement |
| 695 | 695 | |
| 696 | - if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0) |
|
| 697 | - $delimiter = str_replace ("DELIMITER ","",trim($dumpline));
|
|
| 696 | + if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0) |
|
| 697 | + $delimiter = str_replace ("DELIMITER ","",trim($dumpline));
|
|
| 698 | 698 | |
| 699 | 699 | // Skip comments and blank lines only if NOT in parents |
| 700 | 700 | |
| 701 | - if (!$inparents) |
|
| 702 | - { $skipline=false;
|
|
| 703 | - reset($comment); |
|
| 704 | - foreach ($comment as $comment_value) |
|
| 705 | - {
|
|
| 701 | + if (!$inparents) |
|
| 702 | + { $skipline=false;
|
|
| 703 | + reset($comment); |
|
| 704 | + foreach ($comment as $comment_value) |
|
| 705 | + {
|
|
| 706 | 706 | |
| 707 | 707 | // DIAGNOSTIC |
| 708 | 708 | // echo ($comment_value); |
| 709 | - if (trim($dumpline)=="" || strpos (trim($dumpline), $comment_value) === 0) |
|
| 710 | - { $skipline=true;
|
|
| 711 | - break; |
|
| 712 | - } |
|
| 713 | - } |
|
| 714 | - if ($skipline) |
|
| 715 | - { $linenumber++;
|
|
| 709 | + if (trim($dumpline)=="" || strpos (trim($dumpline), $comment_value) === 0) |
|
| 710 | + { $skipline=true;
|
|
| 711 | + break; |
|
| 712 | + } |
|
| 713 | + } |
|
| 714 | + if ($skipline) |
|
| 715 | + { $linenumber++;
|
|
| 716 | 716 | |
| 717 | 717 | // DIAGNOSTIC |
| 718 | 718 | // echo ("<p>Comment line skipped</p>\n");
|
| 719 | 719 | |
| 720 | - continue; |
|
| 721 | - } |
|
| 722 | - } |
|
| 720 | + continue; |
|
| 721 | + } |
|
| 722 | + } |
|
| 723 | 723 | |
| 724 | 724 | // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings)
|
| 725 | 725 | |
| 726 | - $dumpline_deslashed = str_replace ("\\\\","",$dumpline);
|
|
| 726 | + $dumpline_deslashed = str_replace ("\\\\","",$dumpline);
|
|
| 727 | 727 | |
| 728 | 728 | // Count ' and \' (or " and \") in the dumpline to avoid query break within a text field ending by $delimiter |
| 729 | 729 | |
| 730 | - $parents=substr_count ($dumpline_deslashed, $string_quotes)-substr_count ($dumpline_deslashed, "\\$string_quotes"); |
|
| 731 | - if ($parents % 2 != 0) |
|
| 732 | - $inparents=!$inparents; |
|
| 730 | + $parents=substr_count ($dumpline_deslashed, $string_quotes)-substr_count ($dumpline_deslashed, "\\$string_quotes"); |
|
| 731 | + if ($parents % 2 != 0) |
|
| 732 | + $inparents=!$inparents; |
|
| 733 | 733 | |
| 734 | 734 | // Add the line to query |
| 735 | 735 | |
| 736 | - $query .= $dumpline; |
|
| 736 | + $query .= $dumpline; |
|
| 737 | 737 | |
| 738 | 738 | // Don't count the line if in parents (text fields may include unlimited linebreaks) |
| 739 | 739 | |
| 740 | - if (!$inparents) |
|
| 741 | - $querylines++; |
|
| 740 | + if (!$inparents) |
|
| 741 | + $querylines++; |
|
| 742 | 742 | |
| 743 | 743 | // Stop if query contains more lines as defined by $max_query_lines |
| 744 | 744 | |
| 745 | - if ($querylines>$max_query_lines) |
|
| 746 | - {
|
|
| 747 | - echo ("<p class=\"error\">Stopped at the line $linenumber. </p>");
|
|
| 748 | - echo ("<p>At this place the current query includes more than ".$max_query_lines." dump lines. That can happen if your dump file was ");
|
|
| 749 | - echo ("created by some tool which doesn't place a semicolon followed by a linebreak at the end of each query, or if your dump contains ");
|
|
| 750 | - echo ("extended inserts or very long procedure definitions. Please read the <a href=\"http://www.ozerov.de/bigdump/usage/\">BigDump usage notes</a> ");
|
|
| 751 | - echo ("for more infos. Ask for our support services ");
|
|
| 752 | - echo ("in order to handle dump files containing extended inserts.</p>\n");
|
|
| 753 | - $error=true; |
|
| 754 | - break; |
|
| 755 | - } |
|
| 745 | + if ($querylines>$max_query_lines) |
|
| 746 | + {
|
|
| 747 | + echo ("<p class=\"error\">Stopped at the line $linenumber. </p>");
|
|
| 748 | + echo ("<p>At this place the current query includes more than ".$max_query_lines." dump lines. That can happen if your dump file was ");
|
|
| 749 | + echo ("created by some tool which doesn't place a semicolon followed by a linebreak at the end of each query, or if your dump contains ");
|
|
| 750 | + echo ("extended inserts or very long procedure definitions. Please read the <a href=\"http://www.ozerov.de/bigdump/usage/\">BigDump usage notes</a> ");
|
|
| 751 | + echo ("for more infos. Ask for our support services ");
|
|
| 752 | + echo ("in order to handle dump files containing extended inserts.</p>\n");
|
|
| 753 | + $error=true; |
|
| 754 | + break; |
|
| 755 | + } |
|
| 756 | 756 | |
| 757 | 757 | // Execute query if end of query detected ($delimiter as last character) AND NOT in parents |
| 758 | 758 | |
@@ -761,43 +761,43 @@ discard block |
||
| 761 | 761 | // echo ("<p>In Parents: ".($inparents?"true":"false")."</p>\n");
|
| 762 | 762 | // echo ("<p>Line: $dumpline</p>\n");
|
| 763 | 763 | |
| 764 | - if ((preg_match('/'.preg_quote($delimiter,'/').'$/',trim($dumpline)) || $delimiter=='') && !$inparents)
|
|
| 765 | - {
|
|
| 764 | + if ((preg_match('/'.preg_quote($delimiter,'/').'$/',trim($dumpline)) || $delimiter=='') && !$inparents)
|
|
| 765 | + {
|
|
| 766 | 766 | |
| 767 | 767 | // Cut off delimiter of the end of the query |
| 768 | 768 | |
| 769 | - $query = substr(trim($query),0,-1*strlen($delimiter)); |
|
| 769 | + $query = substr(trim($query),0,-1*strlen($delimiter)); |
|
| 770 | 770 | |
| 771 | 771 | // DIAGNOSTIC |
| 772 | 772 | // echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
|
| 773 | 773 | |
| 774 | - if (!TESTMODE && !$mysqli->query($query)) |
|
| 775 | - { echo ("<p class=\"error\">Error at the line $linenumber: ". trim($dumpline)."</p>\n");
|
|
| 776 | - echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
|
|
| 777 | - echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 778 | - $error=true; |
|
| 779 | - break; |
|
| 780 | - } |
|
| 781 | - $totalqueries++; |
|
| 782 | - $queries++; |
|
| 783 | - $query=""; |
|
| 784 | - $querylines=0; |
|
| 785 | - } |
|
| 786 | - $linenumber++; |
|
| 787 | - } |
|
| 774 | + if (!TESTMODE && !$mysqli->query($query)) |
|
| 775 | + { echo ("<p class=\"error\">Error at the line $linenumber: ". trim($dumpline)."</p>\n");
|
|
| 776 | + echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
|
|
| 777 | + echo ("<p>MySQL: ".$mysqli->error."</p>\n");
|
|
| 778 | + $error=true; |
|
| 779 | + break; |
|
| 780 | + } |
|
| 781 | + $totalqueries++; |
|
| 782 | + $queries++; |
|
| 783 | + $query=""; |
|
| 784 | + $querylines=0; |
|
| 785 | + } |
|
| 786 | + $linenumber++; |
|
| 787 | + } |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Get the current file position |
| 791 | 791 | |
| 792 | 792 | if (!$error) |
| 793 | 793 | { if (!$gzipmode)
|
| 794 | - $foffset = ftell($file); |
|
| 795 | - else |
|
| 796 | - $foffset = gztell($file); |
|
| 797 | - if (!$foffset) |
|
| 798 | - { echo ("<p class=\"error\">UNEXPECTED: Can't read the file pointer offset</p>\n");
|
|
| 799 | - $error=true; |
|
| 800 | - } |
|
| 794 | + $foffset = ftell($file); |
|
| 795 | + else |
|
| 796 | + $foffset = gztell($file); |
|
| 797 | + if (!$foffset) |
|
| 798 | + { echo ("<p class=\"error\">UNEXPECTED: Can't read the file pointer offset</p>\n");
|
|
| 799 | + $error=true; |
|
| 800 | + } |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | // Print statistics |
@@ -808,63 +808,63 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | if (!$error) |
| 810 | 810 | {
|
| 811 | - $lines_this = $linenumber-$_REQUEST["start"]; |
|
| 812 | - $lines_done = $linenumber-1; |
|
| 813 | - $lines_togo = ' ? '; |
|
| 814 | - $lines_tota = ' ? '; |
|
| 811 | + $lines_this = $linenumber-$_REQUEST["start"]; |
|
| 812 | + $lines_done = $linenumber-1; |
|
| 813 | + $lines_togo = ' ? '; |
|
| 814 | + $lines_tota = ' ? '; |
|
| 815 | 815 | |
| 816 | - $queries_this = $queries; |
|
| 817 | - $queries_done = $totalqueries; |
|
| 818 | - $queries_togo = ' ? '; |
|
| 819 | - $queries_tota = ' ? '; |
|
| 820 | - |
|
| 821 | - $bytes_this = $foffset-$_REQUEST["foffset"]; |
|
| 822 | - $bytes_done = $foffset; |
|
| 823 | - $kbytes_this = round($bytes_this/1024,2); |
|
| 824 | - $kbytes_done = round($bytes_done/1024,2); |
|
| 825 | - $mbytes_this = round($kbytes_this/1024,2); |
|
| 826 | - $mbytes_done = round($kbytes_done/1024,2); |
|
| 816 | + $queries_this = $queries; |
|
| 817 | + $queries_done = $totalqueries; |
|
| 818 | + $queries_togo = ' ? '; |
|
| 819 | + $queries_tota = ' ? '; |
|
| 820 | + |
|
| 821 | + $bytes_this = $foffset-$_REQUEST["foffset"]; |
|
| 822 | + $bytes_done = $foffset; |
|
| 823 | + $kbytes_this = round($bytes_this/1024,2); |
|
| 824 | + $kbytes_done = round($bytes_done/1024,2); |
|
| 825 | + $mbytes_this = round($kbytes_this/1024,2); |
|
| 826 | + $mbytes_done = round($kbytes_done/1024,2); |
|
| 827 | 827 | |
| 828 | - if (!$gzipmode) |
|
| 829 | - {
|
|
| 830 | - $bytes_togo = $filesize-$foffset; |
|
| 831 | - $bytes_tota = $filesize; |
|
| 832 | - $kbytes_togo = round($bytes_togo/1024,2); |
|
| 833 | - $kbytes_tota = round($bytes_tota/1024,2); |
|
| 834 | - $mbytes_togo = round($kbytes_togo/1024,2); |
|
| 835 | - $mbytes_tota = round($kbytes_tota/1024,2); |
|
| 828 | + if (!$gzipmode) |
|
| 829 | + {
|
|
| 830 | + $bytes_togo = $filesize-$foffset; |
|
| 831 | + $bytes_tota = $filesize; |
|
| 832 | + $kbytes_togo = round($bytes_togo/1024,2); |
|
| 833 | + $kbytes_tota = round($bytes_tota/1024,2); |
|
| 834 | + $mbytes_togo = round($kbytes_togo/1024,2); |
|
| 835 | + $mbytes_tota = round($kbytes_tota/1024,2); |
|
| 836 | 836 | |
| 837 | - $pct_this = ceil($bytes_this/$filesize*100); |
|
| 838 | - $pct_done = ceil($foffset/$filesize*100); |
|
| 839 | - $pct_togo = 100 - $pct_done; |
|
| 840 | - $pct_tota = 100; |
|
| 841 | - |
|
| 842 | - if ($bytes_togo==0) |
|
| 843 | - { $lines_togo = '0';
|
|
| 844 | - $lines_tota = $linenumber-1; |
|
| 845 | - $queries_togo = '0'; |
|
| 846 | - $queries_tota = $totalqueries; |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - $pct_bar = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>"; |
|
| 850 | - } |
|
| 851 | - else |
|
| 852 | - {
|
|
| 853 | - $bytes_togo = ' ? '; |
|
| 854 | - $bytes_tota = ' ? '; |
|
| 855 | - $kbytes_togo = ' ? '; |
|
| 856 | - $kbytes_tota = ' ? '; |
|
| 857 | - $mbytes_togo = ' ? '; |
|
| 858 | - $mbytes_tota = ' ? '; |
|
| 837 | + $pct_this = ceil($bytes_this/$filesize*100); |
|
| 838 | + $pct_done = ceil($foffset/$filesize*100); |
|
| 839 | + $pct_togo = 100 - $pct_done; |
|
| 840 | + $pct_tota = 100; |
|
| 841 | + |
|
| 842 | + if ($bytes_togo==0) |
|
| 843 | + { $lines_togo = '0';
|
|
| 844 | + $lines_tota = $linenumber-1; |
|
| 845 | + $queries_togo = '0'; |
|
| 846 | + $queries_tota = $totalqueries; |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + $pct_bar = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>"; |
|
| 850 | + } |
|
| 851 | + else |
|
| 852 | + {
|
|
| 853 | + $bytes_togo = ' ? '; |
|
| 854 | + $bytes_tota = ' ? '; |
|
| 855 | + $kbytes_togo = ' ? '; |
|
| 856 | + $kbytes_tota = ' ? '; |
|
| 857 | + $mbytes_togo = ' ? '; |
|
| 858 | + $mbytes_tota = ' ? '; |
|
| 859 | 859 | |
| 860 | - $pct_this = ' ? '; |
|
| 861 | - $pct_done = ' ? '; |
|
| 862 | - $pct_togo = ' ? '; |
|
| 863 | - $pct_tota = 100; |
|
| 864 | - $pct_bar = str_replace(' ',' ','<tt>[ Not available for gzipped files ]</tt>');
|
|
| 865 | - } |
|
| 860 | + $pct_this = ' ? '; |
|
| 861 | + $pct_done = ' ? '; |
|
| 862 | + $pct_togo = ' ? '; |
|
| 863 | + $pct_tota = 100; |
|
| 864 | + $pct_bar = str_replace(' ',' ','<tt>[ Not available for gzipped files ]</tt>');
|
|
| 865 | + } |
|
| 866 | 866 | |
| 867 | - echo ("
|
|
| 867 | + echo ("
|
|
| 868 | 868 | <center> |
| 869 | 869 | <table width=\"520\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\"> |
| 870 | 870 | <tr><th class=\"bg4\"> </th><th class=\"bg4\">Session</th><th class=\"bg4\">Done</th><th class=\"bg4\">To go</th><th class=\"bg4\">Total</th></tr> |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | // Finish message and restart the script |
| 883 | 883 | |
| 884 | - if ($linenumber<$_REQUEST["start"]+$linespersession) |
|
| 885 | - { echo ("<p class=\"successcentr\">Congratulations: End of file reached, assuming OK</p>\n");
|
|
| 886 | - echo ("<p class=\"successcentr\">IMPORTANT: REMOVE YOUR DUMP FILE and BIGDUMP SCRIPT FROM SERVER NOW!</p>\n");
|
|
| 887 | - echo ("<p class=\"centr\">Thank you for using this tool! Please rate <a href=\"http://www.hotscripts.com/listing/bigdump/?RID=403\" target=\"_blank\">Bigdump at Hotscripts.com</a></p>\n");
|
|
| 888 | - echo ("<p class=\"centr\">You can send me some bucks or euros as appreciation via PayPal. Thank you!</p>\n");
|
|
| 884 | + if ($linenumber<$_REQUEST["start"]+$linespersession) |
|
| 885 | + { echo ("<p class=\"successcentr\">Congratulations: End of file reached, assuming OK</p>\n");
|
|
| 886 | + echo ("<p class=\"successcentr\">IMPORTANT: REMOVE YOUR DUMP FILE and BIGDUMP SCRIPT FROM SERVER NOW!</p>\n");
|
|
| 887 | + echo ("<p class=\"centr\">Thank you for using this tool! Please rate <a href=\"http://www.hotscripts.com/listing/bigdump/?RID=403\" target=\"_blank\">Bigdump at Hotscripts.com</a></p>\n");
|
|
| 888 | + echo ("<p class=\"centr\">You can send me some bucks or euros as appreciation via PayPal. Thank you!</p>\n");
|
|
| 889 | 889 | ?> |
| 890 | 890 | |
| 891 | 891 | <!-- Start Paypal donation code --> |
@@ -904,24 +904,24 @@ discard block |
||
| 904 | 904 | <!-- End Paypal donation code --> |
| 905 | 905 | |
| 906 | 906 | <?php |
| 907 | - do_action('script_finished');
|
|
| 908 | - $error=true; // This is a semi-error telling the script is finished |
|
| 909 | - } |
|
| 910 | - else |
|
| 911 | - { if ($delaypersession!=0)
|
|
| 912 | - echo ("<p class=\"centr\">Now I'm <b>waiting $delaypersession milliseconds</b> before starting next session...</p>\n");
|
|
| 913 | - if (!$ajax) |
|
| 914 | - echo ("<script language=\"JavaScript\" type=\"text/javascript\">window.setTimeout('location.href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&fn=".urlencode($curfilename)."&foffset=$foffset&totalqueries=$totalqueries&delimiter=".urlencode($delimiter)."\";',500+$delaypersession);</script>\n");
|
|
| 915 | - |
|
| 916 | - echo ("<noscript>\n");
|
|
| 917 | - echo ("<p class=\"centr\"><a href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&fn=".urlencode($curfilename)."&foffset=$foffset&totalqueries=$totalqueries&delimiter=".urlencode($delimiter)."\">Continue from the line $linenumber</a> (Enable JavaScript to do it automatically)</p>\n");
|
|
| 918 | - echo ("</noscript>\n");
|
|
| 907 | + do_action('script_finished');
|
|
| 908 | + $error=true; // This is a semi-error telling the script is finished |
|
| 909 | + } |
|
| 910 | + else |
|
| 911 | + { if ($delaypersession!=0)
|
|
| 912 | + echo ("<p class=\"centr\">Now I'm <b>waiting $delaypersession milliseconds</b> before starting next session...</p>\n");
|
|
| 913 | + if (!$ajax) |
|
| 914 | + echo ("<script language=\"JavaScript\" type=\"text/javascript\">window.setTimeout('location.href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&fn=".urlencode($curfilename)."&foffset=$foffset&totalqueries=$totalqueries&delimiter=".urlencode($delimiter)."\";',500+$delaypersession);</script>\n");
|
|
| 915 | + |
|
| 916 | + echo ("<noscript>\n");
|
|
| 917 | + echo ("<p class=\"centr\"><a href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&fn=".urlencode($curfilename)."&foffset=$foffset&totalqueries=$totalqueries&delimiter=".urlencode($delimiter)."\">Continue from the line $linenumber</a> (Enable JavaScript to do it automatically)</p>\n");
|
|
| 918 | + echo ("</noscript>\n");
|
|
| 919 | 919 | |
| 920 | - echo ("<p class=\"centr\">Press <b><a href=\"".$_SERVER["PHP_SELF"]."\">STOP</a></b> to abort the import <b>OR WAIT!</b></p>\n");
|
|
| 921 | - } |
|
| 920 | + echo ("<p class=\"centr\">Press <b><a href=\"".$_SERVER["PHP_SELF"]."\">STOP</a></b> to abort the import <b>OR WAIT!</b></p>\n");
|
|
| 921 | + } |
|
| 922 | 922 | } |
| 923 | 923 | else |
| 924 | - echo ("<p class=\"error\">Stopped on error</p>\n");
|
|
| 924 | + echo ("<p class=\"error\">Stopped on error</p>\n");
|
|
| 925 | 925 | |
| 926 | 926 | skin_close(); |
| 927 | 927 | |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | die; |
| 968 | 968 | } |
| 969 | 969 | else |
| 970 | - create_ajax_script(); |
|
| 970 | + create_ajax_script(); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | // Anyway put out the output from above |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | |
| 986 | 986 | if (isset($plugin_actions[$tag])) |
| 987 | 987 | { reset ($plugin_actions[$tag]);
|
| 988 | - foreach ($plugin_actions[$tag] as $action) |
|
| 989 | - call_user_func_array($action, array()); |
|
| 988 | + foreach ($plugin_actions[$tag] as $action) |
|
| 989 | + call_user_func_array($action, array()); |
|
| 990 | 990 | } |
| 991 | 991 | } |
| 992 | 992 | |
@@ -24,34 +24,34 @@ |
||
| 24 | 24 | include(XOOPS_ROOT_PATH . '/header.php'); |
| 25 | 25 | |
| 26 | 26 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
| 27 | - exit(_NOPERM); |
|
| 27 | + exit(_NOPERM); |
|
| 28 | 28 | } |
| 29 | 29 | function adminer_object() |
| 30 | 30 | { |
| 31 | - class AdminerKfr extends Adminer |
|
| 32 | - { |
|
| 33 | - public function name() |
|
| 34 | - { |
|
| 35 | - return 'XOOPS Admin'; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - public function credentials() |
|
| 39 | - { |
|
| 40 | - return array(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function database() |
|
| 44 | - { |
|
| 45 | - return XOOPS_DB_NAME; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function login($login, $password) |
|
| 49 | - { |
|
| 50 | - return ($login == XOOPS_DB_USER); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - return new AdminerKfr; |
|
| 31 | + class AdminerKfr extends Adminer |
|
| 32 | + { |
|
| 33 | + public function name() |
|
| 34 | + { |
|
| 35 | + return 'XOOPS Admin'; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + public function credentials() |
|
| 39 | + { |
|
| 40 | + return array(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function database() |
|
| 44 | + { |
|
| 45 | + return XOOPS_DB_NAME; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function login($login, $password) |
|
| 49 | + { |
|
| 50 | + return ($login == XOOPS_DB_USER); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + return new AdminerKfr; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | include __DIR__ . '/include/editor.php'; |