@@ -21,7 +21,9 @@ |
||
21 | 21 | die("XOOPS root path not defined"); |
22 | 22 | } |
23 | 23 | $module_dirname = basename( dirname( __FILE__ ) ) ; |
24 | -if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM ); |
|
24 | +if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|
25 | + exit( _NOPERM ); |
|
26 | +} |
|
25 | 27 | $xoopsOption["template_main"] = $module_dirname . "_index.html"; |
26 | 28 | |
27 | 29 | include(XOOPS_ROOT_PATH."/header.php"); |
@@ -22,7 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | $module_dirname = basename( dirname( __FILE__ ) ) ; |
24 | 24 | include(XOOPS_ROOT_PATH."/header.php"); |
25 | -if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM ); |
|
25 | +if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|
26 | + exit( _NOPERM ); |
|
27 | +} |
|
26 | 28 | |
27 | 29 | function adminer_object() { |
28 | 30 | class AdminerKfr extends Adminer { |
@@ -95,8 +95,9 @@ discard block |
||
95 | 95 | // If not familiar with PHP please don't change anything below this line |
96 | 96 | // ******************************************************************************************* |
97 | 97 | |
98 | -if ($ajax) |
|
98 | +if ($ajax) { |
|
99 | 99 | ob_start(); |
100 | +} |
|
100 | 101 | |
101 | 102 | define ('VERSION','0.34b'); |
102 | 103 | define ('DATA_CHUNK_LENGTH',16384); // How many chars are read per time |
@@ -112,8 +113,9 @@ discard block |
||
112 | 113 | @ini_set('auto_detect_line_endings', true); |
113 | 114 | @set_time_limit(0); |
114 | 115 | |
115 | -if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) |
|
116 | +if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) { |
|
116 | 117 | @date_default_timezone_set(@date_default_timezone_get()); |
118 | +} |
|
117 | 119 | |
118 | 120 | // Clean and strip anything we don't want from user's input [0.27b] |
119 | 121 | |
@@ -296,23 +298,30 @@ discard block |
||
296 | 298 | |
297 | 299 | if (!$error) |
298 | 300 | { $upload_max_filesize=ini_get("upload_max_filesize"); |
299 | - if (preg_match("/([0-9]+)K/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024; |
|
300 | - if (preg_match("/([0-9]+)M/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024; |
|
301 | - if (preg_match("/([0-9]+)G/i",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024*1024; |
|
302 | -} |
|
301 | + if (preg_match("/([0-9]+)K/i",$upload_max_filesize,$tempregs)) { |
|
302 | + $upload_max_filesize=$tempregs[1]*1024; |
|
303 | + } |
|
304 | + if (preg_match("/([0-9]+)M/i",$upload_max_filesize,$tempregs)) { |
|
305 | + $upload_max_filesize=$tempregs[1]*1024*1024; |
|
306 | + } |
|
307 | + if (preg_match("/([0-9]+)G/i",$upload_max_filesize,$tempregs)) { |
|
308 | + $upload_max_filesize=$tempregs[1]*1024*1024*1024; |
|
309 | + } |
|
310 | + } |
|
303 | 311 | |
304 | 312 | // Get the current directory |
305 | 313 | |
306 | -if (isset($_SERVER["CGIA"])) |
|
314 | +if (isset($_SERVER["CGIA"])) { |
|
307 | 315 | $upload_dir=dirname($_SERVER["CGIA"]); |
308 | -else if (isset($_SERVER["ORIG_PATH_TRANSLATED"])) |
|
316 | +} else if (isset($_SERVER["ORIG_PATH_TRANSLATED"])) { |
|
309 | 317 | $upload_dir=dirname($_SERVER["ORIG_PATH_TRANSLATED"]); |
310 | -else if (isset($_SERVER["ORIG_SCRIPT_FILENAME"])) |
|
318 | +} else if (isset($_SERVER["ORIG_SCRIPT_FILENAME"])) { |
|
311 | 319 | $upload_dir=dirname($_SERVER["ORIG_SCRIPT_FILENAME"]); |
312 | -else if (isset($_SERVER["PATH_TRANSLATED"])) |
|
320 | +} else if (isset($_SERVER["PATH_TRANSLATED"])) { |
|
313 | 321 | $upload_dir=dirname($_SERVER["PATH_TRANSLATED"]); |
314 | -else |
|
322 | +} else { |
|
315 | 323 | $upload_dir=dirname($_SERVER["SCRIPT_FILENAME"]); |
324 | +} |
|
316 | 325 | |
317 | 326 | // Handle file upload |
318 | 327 | |
@@ -325,19 +334,15 @@ discard block |
||
325 | 334 | |
326 | 335 | if (file_exists($uploaded_filename)) |
327 | 336 | { echo ("<p class=\"error\">File $uploaded_filename already exist! Delete and upload again!</p>\n"); |
328 | - } |
|
329 | - else if (!preg_match("/(\.(sql|gz|csv))$/i",$uploaded_filename)) |
|
337 | + } else if (!preg_match("/(\.(sql|gz|csv))$/i",$uploaded_filename)) |
|
330 | 338 | { echo ("<p class=\"error\">You may only upload .sql .gz or .csv files.</p>\n"); |
331 | - } |
|
332 | - else if (!@move_uploaded_file($_FILES["dumpfile"]["tmp_name"],$uploaded_filepath)) |
|
339 | + } else if (!@move_uploaded_file($_FILES["dumpfile"]["tmp_name"],$uploaded_filepath)) |
|
333 | 340 | { echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n"); |
334 | 341 | echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n"); |
335 | - } |
|
336 | - else |
|
342 | + } else |
|
337 | 343 | { echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n"); |
338 | 344 | } |
339 | - } |
|
340 | - else |
|
345 | + } else |
|
341 | 346 | { echo ("<p class=\"error\">Error uploading file ".$_FILES["dumpfile"]["name"]."</p>\n"); |
342 | 347 | } |
343 | 348 | } |
@@ -346,25 +351,28 @@ discard block |
||
346 | 351 | // Handle file deletion (delete only in the current directory for security reasons) |
347 | 352 | |
348 | 353 | if (!$error && isset($_REQUEST["delete"]) && $_REQUEST["delete"]!=basename($_SERVER["SCRIPT_FILENAME"])) |
349 | -{ if (preg_match("/(\.(sql|gz|csv))$/i",$_REQUEST["delete"]) && @unlink(basename($_REQUEST["delete"]))) |
|
354 | +{ if (preg_match("/(\.(sql|gz|csv))$/i",$_REQUEST["delete"]) && @unlink(basename($_REQUEST["delete"]))) { |
|
350 | 355 | echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n"); |
351 | - else |
|
352 | - echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n"); |
|
353 | -} |
|
356 | +} else { |
|
357 | + echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n"); |
|
358 | + } |
|
359 | + } |
|
354 | 360 | |
355 | 361 | // Connect to the database, set charset and execute pre-queries |
356 | 362 | |
357 | 363 | if (!$error && !TESTMODE) |
358 | 364 | { $dbconnection = @mysql_connect($db_server,$db_username,$db_password); |
359 | - if ($dbconnection) |
|
360 | - $db = mysql_select_db($db_name); |
|
365 | + if ($dbconnection) { |
|
366 | + $db = mysql_select_db($db_name); |
|
367 | + } |
|
361 | 368 | if (!$dbconnection || !$db) |
362 | 369 | { echo ("<p class=\"error\">Database connection failed due to ".mysql_error()."</p>\n"); |
363 | 370 | echo ("<p>Edit the database settings in ".$_SERVER["SCRIPT_FILENAME"]." or contact your database provider.</p>\n"); |
364 | 371 | $error=true; |
365 | 372 | } |
366 | - if (!$error && $db_connection_charset!=='') |
|
367 | - @mysql_query("SET NAMES $db_connection_charset", $dbconnection); |
|
373 | + if (!$error && $db_connection_charset!=='') { |
|
374 | + @mysql_query("SET NAMES $db_connection_charset", $dbconnection); |
|
375 | + } |
|
368 | 376 | |
369 | 377 | if (!$error && isset ($pre_query) && sizeof ($pre_query)>0) |
370 | 378 | { reset($pre_query); |
@@ -378,8 +386,7 @@ discard block |
||
378 | 386 | } |
379 | 387 | } |
380 | 388 | } |
381 | -} |
|
382 | -else |
|
389 | +} else |
|
383 | 390 | { $dbconnection = false; |
384 | 391 | } |
385 | 392 | |
@@ -410,29 +417,31 @@ discard block |
||
410 | 417 | } |
411 | 418 | echo ("<tr><td>$dirfile</td><td class=\"right\">".filesize($dirfile)."</td><td>".date ("Y-m-d H:i:s", filemtime($dirfile))."</td>"); |
412 | 419 | |
413 | - if (preg_match("/\.sql$/i",$dirfile)) |
|
414 | - echo ("<td>SQL</td>"); |
|
415 | - elseif (preg_match("/\.gz$/i",$dirfile)) |
|
416 | - echo ("<td>GZip</td>"); |
|
417 | - elseif (preg_match("/\.csv$/i",$dirfile)) |
|
418 | - echo ("<td>CSV</td>"); |
|
419 | - else |
|
420 | - echo ("<td>Misc</td>"); |
|
421 | - |
|
422 | - if ((preg_match("/\.gz$/i",$dirfile) && function_exists("gzopen")) || preg_match("/\.sql$/i",$dirfile) || preg_match("/\.csv$/i",$dirfile)) |
|
423 | - 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"); |
|
424 | - else |
|
425 | - echo ("<td> </td>\n <td> </td></tr>\n"); |
|
420 | + if (preg_match("/\.sql$/i",$dirfile)) { |
|
421 | + echo ("<td>SQL</td>"); |
|
422 | + } elseif (preg_match("/\.gz$/i",$dirfile)) { |
|
423 | + echo ("<td>GZip</td>"); |
|
424 | + } elseif (preg_match("/\.csv$/i",$dirfile)) { |
|
425 | + echo ("<td>CSV</td>"); |
|
426 | + } else { |
|
427 | + echo ("<td>Misc</td>"); |
|
428 | + } |
|
429 | + |
|
430 | + if ((preg_match("/\.gz$/i",$dirfile) && function_exists("gzopen")) || preg_match("/\.sql$/i",$dirfile) || preg_match("/\.csv$/i",$dirfile)) { |
|
431 | + 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"); |
|
432 | + } else { |
|
433 | + echo ("<td> </td>\n <td> </td></tr>\n"); |
|
434 | + } |
|
426 | 435 | } |
427 | 436 | } |
428 | 437 | } |
429 | 438 | |
430 | - if ($dirhead) |
|
431 | - echo ("</table>\n"); |
|
432 | - else |
|
433 | - echo ("<p>No uploaded SQL, GZ or CSV files found in the working directory</p>\n"); |
|
434 | - } |
|
435 | - else |
|
439 | + if ($dirhead) { |
|
440 | + echo ("</table>\n"); |
|
441 | + } else { |
|
442 | + echo ("<p>No uploaded SQL, GZ or CSV files found in the working directory</p>\n"); |
|
443 | + } |
|
444 | + } else |
|
436 | 445 | { echo ("<p class=\"error\">Error listing directory $upload_dir</p>\n"); |
437 | 446 | $error=true; |
438 | 447 | } |
@@ -457,8 +466,7 @@ discard block |
||
457 | 466 | if (!($tempfile=@fopen($tempfilename,"w"))) |
458 | 467 | { 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 "); |
459 | 468 | echo ("to upload files here. Alternatively you can upload your dump files via FTP.</p>\n"); |
460 | - } |
|
461 | - else |
|
469 | + } else |
|
462 | 470 | { fclose($tempfile); |
463 | 471 | unlink ($tempfilename); |
464 | 472 | |
@@ -493,19 +501,21 @@ discard block |
||
493 | 501 | |
494 | 502 | // Set current filename ($filename overrides $_REQUEST["fn"] if set) |
495 | 503 | |
496 | - if ($filename!="") |
|
497 | - $curfilename=$filename; |
|
498 | - else if (isset($_REQUEST["fn"])) |
|
499 | - $curfilename=urldecode($_REQUEST["fn"]); |
|
500 | - else |
|
501 | - $curfilename=""; |
|
504 | + if ($filename!="") { |
|
505 | + $curfilename=$filename; |
|
506 | + } else if (isset($_REQUEST["fn"])) { |
|
507 | + $curfilename=urldecode($_REQUEST["fn"]); |
|
508 | + } else { |
|
509 | + $curfilename=""; |
|
510 | + } |
|
502 | 511 | |
503 | 512 | // Recognize GZip filename |
504 | 513 | |
505 | - if (preg_match("/\.gz$/i",$curfilename)) |
|
506 | - $gzipmode=true; |
|
507 | - else |
|
508 | - $gzipmode=false; |
|
514 | + if (preg_match("/\.gz$/i",$curfilename)) { |
|
515 | + $gzipmode=true; |
|
516 | + } else { |
|
517 | + $gzipmode=false; |
|
518 | + } |
|
509 | 519 | |
510 | 520 | if ((!$gzipmode && !$file=@fopen($curfilename,"r")) || ($gzipmode && !$file=@gzopen($curfilename,"r"))) |
511 | 521 | { echo ("<p class=\"error\">Can't open ".$curfilename." for import</p>\n"); |
@@ -518,10 +528,13 @@ discard block |
||
518 | 528 | // Get the file size (can't do it fast on gzipped files, no idea how) |
519 | 529 | |
520 | 530 | else if ((!$gzipmode && @fseek($file, 0, SEEK_END)==0) || ($gzipmode && @gzseek($file, 0)==0)) |
521 | - { if (!$gzipmode) $filesize = ftell($file); |
|
522 | - else $filesize = gztell($file); // Always zero, ignore |
|
523 | - } |
|
524 | - else |
|
531 | + { if (!$gzipmode) { |
|
532 | + $filesize = ftell($file); |
|
533 | + } else { |
|
534 | + $filesize = gztell($file); |
|
535 | + } |
|
536 | + // Always zero, ignore |
|
537 | + } else |
|
525 | 538 | { echo ("<p class=\"error\">I can't seek into $curfilename</p>\n"); |
526 | 539 | $error=true; |
527 | 540 | } |
@@ -547,16 +560,16 @@ discard block |
||
547 | 560 | if (!is_numeric($_REQUEST["start"]) || !is_numeric($_REQUEST["foffset"])) |
548 | 561 | { echo ("<p class=\"error\">UNEXPECTED: Non-numeric values for start and foffset</p>\n"); |
549 | 562 | $error=true; |
550 | - } |
|
551 | - else |
|
563 | + } else |
|
552 | 564 | { $_REQUEST["start"] = floor($_REQUEST["start"]); |
553 | 565 | $_REQUEST["foffset"] = floor($_REQUEST["foffset"]); |
554 | 566 | } |
555 | 567 | |
556 | 568 | // Set the current delimiter if defined |
557 | 569 | |
558 | - if (isset($_REQUEST["delimiter"])) |
|
559 | - $delimiter = $_REQUEST["delimiter"]; |
|
570 | + if (isset($_REQUEST["delimiter"])) { |
|
571 | + $delimiter = $_REQUEST["delimiter"]; |
|
572 | + } |
|
560 | 573 | |
561 | 574 | // Empty CSV table if requested |
562 | 575 | |
@@ -575,8 +588,9 @@ discard block |
||
575 | 588 | |
576 | 589 | if (!$error) |
577 | 590 | { skin_open(); |
578 | - if (TESTMODE) |
|
579 | - echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n"); |
|
591 | + if (TESTMODE) { |
|
592 | + echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n"); |
|
593 | + } |
|
580 | 594 | echo ("<p class=\"centr\">Processing file: <b>".$curfilename."</b></p>\n"); |
581 | 595 | echo ("<p class=\"smlcentr\">Starting from line: ".$_REQUEST["start"]."</p>\n"); |
582 | 596 | skin_close(); |
@@ -615,29 +629,35 @@ discard block |
||
615 | 629 | |
616 | 630 | $dumpline = ""; |
617 | 631 | while (!feof($file) && substr ($dumpline, -1) != "\n" && substr ($dumpline, -1) != "\r") |
618 | - { if (!$gzipmode) |
|
619 | - $dumpline .= fgets($file, DATA_CHUNK_LENGTH); |
|
620 | - else |
|
621 | - $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); |
|
632 | + { if (!$gzipmode) { |
|
633 | + $dumpline .= fgets($file, DATA_CHUNK_LENGTH); |
|
634 | + } else { |
|
635 | + $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); |
|
636 | + } |
|
637 | + } |
|
638 | + if ($dumpline==="") { |
|
639 | + break; |
|
622 | 640 | } |
623 | - if ($dumpline==="") break; |
|
624 | 641 | |
625 | 642 | // Remove UTF8 Byte Order Mark at the file beginning if any |
626 | 643 | |
627 | - if ($_REQUEST["foffset"]==0) |
|
628 | - $dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline); |
|
644 | + if ($_REQUEST["foffset"]==0) { |
|
645 | + $dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline); |
|
646 | + } |
|
629 | 647 | |
630 | 648 | // Create an SQL query from CSV line |
631 | 649 | |
632 | 650 | if (($csv_insert_table != "") && (preg_match("/(\.csv)$/i",$curfilename))) |
633 | 651 | { |
634 | - if ($csv_add_slashes) |
|
635 | - $dumpline = addslashes($dumpline); |
|
652 | + if ($csv_add_slashes) { |
|
653 | + $dumpline = addslashes($dumpline); |
|
654 | + } |
|
636 | 655 | $dumpline = explode($csv_delimiter,$dumpline); |
637 | - if ($csv_add_quotes) |
|
638 | - $dumpline = "'".implode("','",$dumpline)."'"; |
|
639 | - else |
|
640 | - $dumpline = implode(",",$dumpline); |
|
656 | + if ($csv_add_quotes) { |
|
657 | + $dumpline = "'".implode("','",$dumpline)."'"; |
|
658 | + } else { |
|
659 | + $dumpline = implode(",",$dumpline); |
|
660 | + } |
|
641 | 661 | $dumpline = 'INSERT INTO '.$csv_insert_table.' VALUES ('.$dumpline.');'; |
642 | 662 | } |
643 | 663 | |
@@ -651,8 +671,9 @@ discard block |
||
651 | 671 | |
652 | 672 | // Recognize delimiter statement |
653 | 673 | |
654 | - if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0) |
|
655 | - $delimiter = str_replace ("DELIMITER ","",trim($dumpline)); |
|
674 | + if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0) { |
|
675 | + $delimiter = str_replace ("DELIMITER ","",trim($dumpline)); |
|
676 | + } |
|
656 | 677 | |
657 | 678 | // Skip comments and blank lines only if NOT in parents |
658 | 679 | |
@@ -686,8 +707,9 @@ discard block |
||
686 | 707 | // Count ' and \' (or " and \") in the dumpline to avoid query break within a text field ending by $delimiter |
687 | 708 | |
688 | 709 | $parents=substr_count ($dumpline_deslashed, $string_quotes)-substr_count ($dumpline_deslashed, "\\$string_quotes"); |
689 | - if ($parents % 2 != 0) |
|
690 | - $inparents=!$inparents; |
|
710 | + if ($parents % 2 != 0) { |
|
711 | + $inparents=!$inparents; |
|
712 | + } |
|
691 | 713 | |
692 | 714 | // Add the line to query |
693 | 715 | |
@@ -695,8 +717,9 @@ discard block |
||
695 | 717 | |
696 | 718 | // Don't count the line if in parents (text fields may include unlimited linebreaks) |
697 | 719 | |
698 | - if (!$inparents) |
|
699 | - $querylines++; |
|
720 | + if (!$inparents) { |
|
721 | + $querylines++; |
|
722 | + } |
|
700 | 723 | |
701 | 724 | // Stop if query contains more lines as defined by MAX_QUERY_LINES |
702 | 725 | |
@@ -748,10 +771,11 @@ discard block |
||
748 | 771 | // Get the current file position |
749 | 772 | |
750 | 773 | if (!$error) |
751 | - { if (!$gzipmode) |
|
752 | - $foffset = ftell($file); |
|
753 | - else |
|
754 | - $foffset = gztell($file); |
|
774 | + { if (!$gzipmode) { |
|
775 | + $foffset = ftell($file); |
|
776 | + } else { |
|
777 | + $foffset = gztell($file); |
|
778 | + } |
|
755 | 779 | if (!$foffset) |
756 | 780 | { echo ("<p class=\"error\">UNEXPECTED: Can't read the file pointer offset</p>\n"); |
757 | 781 | $error=true; |
@@ -805,8 +829,7 @@ discard block |
||
805 | 829 | } |
806 | 830 | |
807 | 831 | $pct_bar = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>"; |
808 | - } |
|
809 | - else |
|
832 | + } else |
|
810 | 833 | { |
811 | 834 | $bytes_togo = ' ? '; |
812 | 835 | $bytes_tota = ' ? '; |
@@ -864,12 +887,13 @@ discard block |
||
864 | 887 | <?php |
865 | 888 | |
866 | 889 | $error=true; // This is a semi-error telling the script is finished |
890 | + } else |
|
891 | + { if ($delaypersession!=0) { |
|
892 | + echo ("<p class=\"centr\">Now I'm <b>waiting $delaypersession milliseconds</b> before starting next session...</p>\n"); |
|
867 | 893 | } |
868 | - else |
|
869 | - { if ($delaypersession!=0) |
|
870 | - echo ("<p class=\"centr\">Now I'm <b>waiting $delaypersession milliseconds</b> before starting next session...</p>\n"); |
|
871 | - if (!$ajax) |
|
872 | - 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"); |
|
894 | + if (!$ajax) { |
|
895 | + 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"); |
|
896 | + } |
|
873 | 897 | |
874 | 898 | echo ("<noscript>\n"); |
875 | 899 | 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"); |
@@ -877,20 +901,26 @@ discard block |
||
877 | 901 | |
878 | 902 | echo ("<p class=\"centr\">Press <b><a href=\"".$_SERVER["PHP_SELF"]."\">STOP</a></b> to abort the import <b>OR WAIT!</b></p>\n"); |
879 | 903 | } |
904 | + } else { |
|
905 | + echo ("<p class=\"error\">Stopped on error</p>\n"); |
|
880 | 906 | } |
881 | - else |
|
882 | - echo ("<p class=\"error\">Stopped on error</p>\n"); |
|
883 | 907 | |
884 | 908 | skin_close(); |
885 | 909 | |
886 | 910 | } |
887 | 911 | |
888 | -if ($error) |
|
912 | +if ($error) { |
|
889 | 913 | echo ("<p class=\"centr\"><a href=\"".$_SERVER["PHP_SELF"]."\">Start from the beginning</a> (DROP the old tables before restarting)</p>\n"); |
914 | +} |
|
890 | 915 | |
891 | -if ($dbconnection) mysql_close($dbconnection); |
|
892 | -if ($file && !$gzipmode) fclose($file); |
|
893 | -else if ($file && $gzipmode) gzclose($file); |
|
916 | +if ($dbconnection) { |
|
917 | + mysql_close($dbconnection); |
|
918 | +} |
|
919 | +if ($file && !$gzipmode) { |
|
920 | + fclose($file); |
|
921 | +} else if ($file && $gzipmode) { |
|
922 | + gzclose($file); |
|
923 | +} |
|
894 | 924 | |
895 | 925 | ?> |
896 | 926 | |
@@ -923,10 +953,10 @@ discard block |
||
923 | 953 | { ob_end_clean(); |
924 | 954 | create_xml_response(); |
925 | 955 | die; |
926 | - } |
|
927 | - else |
|
928 | - create_ajax_script(); |
|
929 | -} |
|
956 | + } else { |
|
957 | + create_ajax_script(); |
|
958 | + } |
|
959 | + } |
|
930 | 960 | |
931 | 961 | // Anyway put out the output from above |
932 | 962 |
@@ -24,8 +24,12 @@ |
||
24 | 24 | } |
25 | 25 | $module_dirname = basename( dirname( __FILE__ ) ) ; |
26 | 26 | include(XOOPS_ROOT_PATH."/header.php"); |
27 | -if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM ); |
|
28 | -if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM ); |
|
27 | +if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|
28 | + exit( _NOPERM ); |
|
29 | +} |
|
30 | +if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|
31 | + exit( _NOPERM ); |
|
32 | +} |
|
29 | 33 | function adminer_object() { |
30 | 34 | class AdminerKfr extends Adminer { |
31 | 35 | function name() { |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if ( !include("../../mainfile.php") ) { |
22 | 22 | die("XOOPS root path not defined"); |
23 | 23 | } |
24 | -if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM ); |
|
24 | +if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { |
|
25 | + exit( _NOPERM ); |
|
26 | +} |
|
25 | 27 | include(XOOPS_ROOT_PATH."/header.php"); |
26 | 28 | include "./include/bigdump.php"; |
27 | 29 | ?> |
28 | 30 | \ No newline at end of file |