Completed
Branch master (bcadff)
by Michael
05:30
created
index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 **/
19 19
 
20 20
 if ( !include("../../mainfile.php") ) {
21
-    die("XOOPS root path not defined");
21
+	die("XOOPS root path not defined");
22 22
 }
23 23
 $module_dirname = basename( dirname( __FILE__ ) ) ;
24 24
 if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit( _NOPERM );
Please login to merge, or discard this patch.
mysql.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 **/
19 19
 // connect xoops database 
20 20
 if ( !include("../../mainfile.php") ) {
21
-    die("XOOPS root path not defined");
21
+	die("XOOPS root path not defined");
22 22
 }
23 23
 $module_dirname = basename( dirname( __FILE__ ) ) ;
24 24
 include(XOOPS_ROOT_PATH."/header.php");
Please login to merge, or discard this patch.
include/bigdump.php 1 patch
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 $ajax               = true;   // AJAX mode: import will be done without refreshing the website
52 52
 $linespersession    = 3000;   // Lines to be executed per one import session
53 53
 $delaypersession    = 0;      // You can specify a sleep time in milliseconds after each session
54
-                              // Works only if JavaScript is activated. Use to reduce server overrun
54
+							  // Works only if JavaScript is activated. Use to reduce server overrun
55 55
 
56 56
 // CSV related settings (only if you use a CSV dump)
57 57
 
@@ -319,23 +319,23 @@  discard block
 block discarded – undo
319 319
 if (!$error && isset($_REQUEST["uploadbutton"]))
320 320
 { if (is_uploaded_file($_FILES["dumpfile"]["tmp_name"]) && ($_FILES["dumpfile"]["error"])==0)
321 321
   { 
322
-    $uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]);
323
-    $uploaded_filename=preg_replace("/[^_A-Za-z0-9-\.]/i",'',$uploaded_filename);
324
-    $uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename);
325
-
326
-    if (file_exists($uploaded_filename))
327
-    { 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))
330
-    { 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))
333
-    { echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n");
334
-      echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n");
335
-    }
336
-    else
337
-    { echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n");
338
-    }
322
+	$uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]);
323
+	$uploaded_filename=preg_replace("/[^_A-Za-z0-9-\.]/i",'',$uploaded_filename);
324
+	$uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename);
325
+
326
+	if (file_exists($uploaded_filename))
327
+	{ 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))
330
+	{ 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))
333
+	{ echo ("<p class=\"error\">Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath</p>\n");
334
+	  echo ("<p>Check the directory permissions for $upload_dir (must be 777)!</p>\n");
335
+	}
336
+	else
337
+	{ echo ("<p class=\"success\">Uploaded file saved as $uploaded_filename</p>\n");
338
+	}
339 339
   }
340 340
   else
341 341
   { echo ("<p class=\"error\">Error uploading file ".$_FILES["dumpfile"]["name"]."</p>\n");
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 
348 348
 if (!$error && isset($_REQUEST["delete"]) && $_REQUEST["delete"]!=basename($_SERVER["SCRIPT_FILENAME"]))
349 349
 { if (preg_match("/(\.(sql|gz|csv))$/i",$_REQUEST["delete"]) && @unlink(basename($_REQUEST["delete"])))
350
-    echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n");
350
+	echo ("<p class=\"success\">".$_REQUEST["delete"]." was removed successfully</p>\n");
351 351
   else
352
-    echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n");
352
+	echo ("<p class=\"error\">Can't remove ".$_REQUEST["delete"]."</p>\n");
353 353
 }
354 354
 
355 355
 // Connect to the database, set charset and execute pre-queries
@@ -357,26 +357,26 @@  discard block
 block discarded – undo
357 357
 if (!$error && !TESTMODE)
358 358
 { $dbconnection = @mysql_connect($db_server,$db_username,$db_password);
359 359
   if ($dbconnection) 
360
-    $db = mysql_select_db($db_name);
360
+	$db = mysql_select_db($db_name);
361 361
   if (!$dbconnection || !$db) 
362 362
   { echo ("<p class=\"error\">Database connection failed due to ".mysql_error()."</p>\n");
363
-    echo ("<p>Edit the database settings in ".$_SERVER["SCRIPT_FILENAME"]." or contact your database provider.</p>\n");
364
-    $error=true;
363
+	echo ("<p>Edit the database settings in ".$_SERVER["SCRIPT_FILENAME"]." or contact your database provider.</p>\n");
364
+	$error=true;
365 365
   }
366 366
   if (!$error && $db_connection_charset!=='')
367
-    @mysql_query("SET NAMES $db_connection_charset", $dbconnection);
367
+	@mysql_query("SET NAMES $db_connection_charset", $dbconnection);
368 368
 
369 369
   if (!$error && isset ($pre_query) && sizeof ($pre_query)>0)
370 370
   { reset($pre_query);
371
-    foreach ($pre_query as $pre_query_value)
372
-    {	if (!@mysql_query($pre_query_value, $dbconnection))
373
-    	{ echo ("<p class=\"error\">Error with pre-query.</p>\n");
374
-      	echo ("<p>Query: ".trim(nl2br(htmlentities($pre_query_value)))."</p>\n");
375
-      	echo ("<p>MySQL: ".mysql_error()."</p>\n");
376
-      	$error=true;
377
-      	break;
378
-     }
379
-    }
371
+	foreach ($pre_query as $pre_query_value)
372
+	{	if (!@mysql_query($pre_query_value, $dbconnection))
373
+		{ echo ("<p class=\"error\">Error with pre-query.</p>\n");
374
+	  	echo ("<p>Query: ".trim(nl2br(htmlentities($pre_query_value)))."</p>\n");
375
+	  	echo ("<p>MySQL: ".mysql_error()."</p>\n");
376
+	  	$error=true;
377
+	  	break;
378
+	 }
379
+	}
380 380
   }
381 381
 }
382 382
 else
@@ -392,49 +392,49 @@  discard block
 block discarded – undo
392 392
 if (!$error && !isset($_REQUEST["fn"]) && $filename=="")
393 393
 { if ($dirhandle = opendir($upload_dir)) 
394 394
   { 
395
-    $files=array();
396
-    while (false !== ($files[] = readdir($dirhandle)));
397
-    closedir($dirhandle);
398
-    $dirhead=false;
399
-
400
-    if (sizeof($files)>0)
401
-    { 
402
-      sort($files);
403
-      foreach ($files as $dirfile)
404
-      { 
405
-        if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"]) && preg_match("/\.(sql|gz|csv)$/i",$dirfile))
406
-        { if (!$dirhead)
407
-          { echo ("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\">\n");
408
-            echo ("<tr><th>Filename</th><th>Size</th><th>Date&amp;Time</th><th>Type</th><th>&nbsp;</th><th>&nbsp;</th>\n");
409
-            $dirhead=true;
410
-          }
411
-          echo ("<tr><td>$dirfile</td><td class=\"right\">".filesize($dirfile)."</td><td>".date ("Y-m-d H:i:s", filemtime($dirfile))."</td>");
412
-
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&amp;fn=".urlencode($dirfile)."&amp;foffset=0&amp;totalqueries=0&amp;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>&nbsp;</td>\n <td>&nbsp;</td></tr>\n");
426
-        }
427
-      }
428
-    }
429
-
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");
395
+	$files=array();
396
+	while (false !== ($files[] = readdir($dirhandle)));
397
+	closedir($dirhandle);
398
+	$dirhead=false;
399
+
400
+	if (sizeof($files)>0)
401
+	{ 
402
+	  sort($files);
403
+	  foreach ($files as $dirfile)
404
+	  { 
405
+		if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"]) && preg_match("/\.(sql|gz|csv)$/i",$dirfile))
406
+		{ if (!$dirhead)
407
+		  { echo ("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\">\n");
408
+			echo ("<tr><th>Filename</th><th>Size</th><th>Date&amp;Time</th><th>Type</th><th>&nbsp;</th><th>&nbsp;</th>\n");
409
+			$dirhead=true;
410
+		  }
411
+		  echo ("<tr><td>$dirfile</td><td class=\"right\">".filesize($dirfile)."</td><td>".date ("Y-m-d H:i:s", filemtime($dirfile))."</td>");
412
+
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&amp;fn=".urlencode($dirfile)."&amp;foffset=0&amp;totalqueries=0&amp;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>&nbsp;</td>\n <td>&nbsp;</td></tr>\n");
426
+		}
427
+	  }
428
+	}
429
+
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 434
   }
435 435
   else
436 436
   { echo ("<p class=\"error\">Error listing directory $upload_dir</p>\n");
437
-    $error=true;
437
+	$error=true;
438 438
   }
439 439
 }
440 440
 
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
   do { $tempfilename=time().".tmp"; } while (file_exists($tempfilename));
457 457
   if (!($tempfile=@fopen($tempfilename,"w")))
458 458
   { 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
-    echo ("to upload files here. Alternatively you can upload your dump files via FTP.</p>\n");
459
+	echo ("to upload files here. Alternatively you can upload your dump files via FTP.</p>\n");
460 460
   }
461 461
   else
462 462
   { fclose($tempfile);
463
-    unlink ($tempfilename);
463
+	unlink ($tempfilename);
464 464
  
465
-    echo ("<p>You can now upload your dump file up to $upload_max_filesize bytes (".round ($upload_max_filesize/1024/1024)." Mbytes)  ");
466
-    echo ("directly from your browser to the server. Alternatively you can upload your dump files of any size via FTP.</p>\n");
465
+	echo ("<p>You can now upload your dump file up to $upload_max_filesize bytes (".round ($upload_max_filesize/1024/1024)." Mbytes)  ");
466
+	echo ("directly from your browser to the server. Alternatively you can upload your dump files of any size via FTP.</p>\n");
467 467
 ?>
468 468
 <form method="POST" action="<?php echo ($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">
469 469
 <input type="hidden" name="MAX_FILE_SIZE" value="$upload_max_filesize">
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
   $row = mysql_fetch_assoc($result);
483 483
   if ($row) 
484 484
   { $charset = $row['Value'];
485
-    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");
485
+	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");
486 486
   }
487 487
 }
488 488
 
@@ -494,36 +494,36 @@  discard block
 block discarded – undo
494 494
 // Set current filename ($filename overrides $_REQUEST["fn"] if set)
495 495
 
496 496
   if ($filename!="")
497
-    $curfilename=$filename;
497
+	$curfilename=$filename;
498 498
   else if (isset($_REQUEST["fn"]))
499
-    $curfilename=urldecode($_REQUEST["fn"]);
499
+	$curfilename=urldecode($_REQUEST["fn"]);
500 500
   else
501
-    $curfilename="";
501
+	$curfilename="";
502 502
 
503 503
 // Recognize GZip filename
504 504
 
505 505
   if (preg_match("/\.gz$/i",$curfilename)) 
506
-    $gzipmode=true;
506
+	$gzipmode=true;
507 507
   else
508
-    $gzipmode=false;
508
+	$gzipmode=false;
509 509
 
510 510
   if ((!$gzipmode && !$file=@fopen($curfilename,"r")) || ($gzipmode && !$file=@gzopen($curfilename,"r")))
511 511
   { echo ("<p class=\"error\">Can't open ".$curfilename." for import</p>\n");
512
-    echo ("<p>Please, check that your dump file name contains only alphanumerical characters, and rename it accordingly, for example: $curfilename.".
513
-           "<br>Or, specify \$filename in bigdump.php with the full filename. ".
514
-           "<br>Or, you have to upload the $curfilename to the server first.</p>\n");
515
-    $error=true;
512
+	echo ("<p>Please, check that your dump file name contains only alphanumerical characters, and rename it accordingly, for example: $curfilename.".
513
+		   "<br>Or, specify \$filename in bigdump.php with the full filename. ".
514
+		   "<br>Or, you have to upload the $curfilename to the server first.</p>\n");
515
+	$error=true;
516 516
   }
517 517
 
518 518
 // Get the file size (can't do it fast on gzipped files, no idea how)
519 519
 
520 520
   else if ((!$gzipmode && @fseek($file, 0, SEEK_END)==0) || ($gzipmode && @gzseek($file, 0)==0))
521 521
   { if (!$gzipmode) $filesize = ftell($file);
522
-    else $filesize = gztell($file);                   // Always zero, ignore
522
+	else $filesize = gztell($file);                   // Always zero, ignore
523 523
   }
524 524
   else
525 525
   { echo ("<p class=\"error\">I can't seek into $curfilename</p>\n");
526
-    $error=true;
526
+	$error=true;
527 527
   }
528 528
 }
529 529
 
@@ -546,171 +546,171 @@  discard block
 block discarded – undo
546 546
 
547 547
   if (!is_numeric($_REQUEST["start"]) || !is_numeric($_REQUEST["foffset"]))
548 548
   { echo ("<p class=\"error\">UNEXPECTED: Non-numeric values for start and foffset</p>\n");
549
-    $error=true;
549
+	$error=true;
550 550
   }
551 551
   else
552 552
   {	$_REQUEST["start"]   = floor($_REQUEST["start"]);
553
-    $_REQUEST["foffset"] = floor($_REQUEST["foffset"]);
553
+	$_REQUEST["foffset"] = floor($_REQUEST["foffset"]);
554 554
   }
555 555
 
556 556
 // Set the current delimiter if defined
557 557
 
558 558
   if (isset($_REQUEST["delimiter"]))
559
-    $delimiter = $_REQUEST["delimiter"];
559
+	$delimiter = $_REQUEST["delimiter"];
560 560
 
561 561
 // Empty CSV table if requested
562 562
 
563 563
   if (!$error && $_REQUEST["start"]==1 && $csv_insert_table != "" && $csv_preempty_table)
564 564
   { 
565
-    $query = "DELETE FROM $csv_insert_table";
566
-    if (!TESTMODE && !mysql_query(trim($query), $dbconnection))
567
-    { echo ("<p class=\"error\">Error when deleting entries from $csv_insert_table.</p>\n");
568
-      echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
569
-      echo ("<p>MySQL: ".mysql_error()."</p>\n");
570
-      $error=true;
571
-    }
565
+	$query = "DELETE FROM $csv_insert_table";
566
+	if (!TESTMODE && !mysql_query(trim($query), $dbconnection))
567
+	{ echo ("<p class=\"error\">Error when deleting entries from $csv_insert_table.</p>\n");
568
+	  echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
569
+	  echo ("<p>MySQL: ".mysql_error()."</p>\n");
570
+	  $error=true;
571
+	}
572 572
   }
573 573
   
574 574
 // Print start message
575 575
 
576 576
   if (!$error)
577 577
   { skin_open();
578
-    if (TESTMODE) 
579
-      echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n");
580
-    echo ("<p class=\"centr\">Processing file: <b>".$curfilename."</b></p>\n");
581
-    echo ("<p class=\"smlcentr\">Starting from line: ".$_REQUEST["start"]."</p>\n");	
582
-    skin_close();
578
+	if (TESTMODE) 
579
+	  echo ("<p class=\"centr\">TEST MODE ENABLED</p>\n");
580
+	echo ("<p class=\"centr\">Processing file: <b>".$curfilename."</b></p>\n");
581
+	echo ("<p class=\"smlcentr\">Starting from line: ".$_REQUEST["start"]."</p>\n");	
582
+	skin_close();
583 583
   }
584 584
 
585 585
 // Check $_REQUEST["foffset"] upon $filesize (can't do it on gzipped files)
586 586
 
587 587
   if (!$error && !$gzipmode && $_REQUEST["foffset"]>$filesize)
588 588
   { echo ("<p class=\"error\">UNEXPECTED: Can't set file pointer behind the end of file</p>\n");
589
-    $error=true;
589
+	$error=true;
590 590
   }
591 591
 
592 592
 // Set file pointer to $_REQUEST["foffset"]
593 593
 
594 594
   if (!$error && ((!$gzipmode && fseek($file, $_REQUEST["foffset"])!=0) || ($gzipmode && gzseek($file, $_REQUEST["foffset"])!=0)))
595 595
   { echo ("<p class=\"error\">UNEXPECTED: Can't set file pointer to offset: ".$_REQUEST["foffset"]."</p>\n");
596
-    $error=true;
596
+	$error=true;
597 597
   }
598 598
 
599 599
 // Start processing queries from $file
600 600
 
601 601
   if (!$error)
602 602
   { $query="";
603
-    $queries=0;
604
-    $totalqueries=$_REQUEST["totalqueries"];
605
-    $linenumber=$_REQUEST["start"];
606
-    $querylines=0;
607
-    $inparents=false;
603
+	$queries=0;
604
+	$totalqueries=$_REQUEST["totalqueries"];
605
+	$linenumber=$_REQUEST["start"];
606
+	$querylines=0;
607
+	$inparents=false;
608 608
 
609 609
 // Stay processing as long as the $linespersession is not reached or the query is still incomplete
610 610
 
611
-    while ($linenumber<$_REQUEST["start"]+$linespersession || $query!="")
612
-    {
611
+	while ($linenumber<$_REQUEST["start"]+$linespersession || $query!="")
612
+	{
613 613
 
614 614
 // Read the whole next line
615 615
 
616
-      $dumpline = "";
617
-      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);
622
-      }
623
-      if ($dumpline==="") break;
616
+	  $dumpline = "";
617
+	  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);
622
+	  }
623
+	  if ($dumpline==="") break;
624 624
 
625 625
 // Remove UTF8 Byte Order Mark at the file beginning if any
626 626
 
627
-      if ($_REQUEST["foffset"]==0)
628
-        $dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline);
627
+	  if ($_REQUEST["foffset"]==0)
628
+		$dumpline=preg_replace('|^\xEF\xBB\xBF|','',$dumpline);
629 629
 
630 630
 // Create an SQL query from CSV line
631 631
 
632
-      if (($csv_insert_table != "") && (preg_match("/(\.csv)$/i",$curfilename)))
633
-      {
634
-        if ($csv_add_slashes)
635
-          $dumpline = addslashes($dumpline);
636
-        $dumpline = explode($csv_delimiter,$dumpline);
637
-        if ($csv_add_quotes)
638
-          $dumpline = "'".implode("','",$dumpline)."'";
639
-        else
640
-          $dumpline = implode(",",$dumpline);
641
-        $dumpline = 'INSERT INTO '.$csv_insert_table.' VALUES ('.$dumpline.');';
642
-      }
632
+	  if (($csv_insert_table != "") && (preg_match("/(\.csv)$/i",$curfilename)))
633
+	  {
634
+		if ($csv_add_slashes)
635
+		  $dumpline = addslashes($dumpline);
636
+		$dumpline = explode($csv_delimiter,$dumpline);
637
+		if ($csv_add_quotes)
638
+		  $dumpline = "'".implode("','",$dumpline)."'";
639
+		else
640
+		  $dumpline = implode(",",$dumpline);
641
+		$dumpline = 'INSERT INTO '.$csv_insert_table.' VALUES ('.$dumpline.');';
642
+	  }
643 643
 
644 644
 // Handle DOS and Mac encoded linebreaks (I don't know if it really works on Win32 or Mac Servers)
645 645
 
646
-      $dumpline=str_replace("\r\n", "\n", $dumpline);
647
-      $dumpline=str_replace("\r", "\n", $dumpline);
646
+	  $dumpline=str_replace("\r\n", "\n", $dumpline);
647
+	  $dumpline=str_replace("\r", "\n", $dumpline);
648 648
             
649 649
 // DIAGNOSTIC
650 650
 // echo ("<p>Line $linenumber: $dumpline</p>\n");
651 651
 
652 652
 // Recognize delimiter statement
653 653
 
654
-      if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0)
655
-        $delimiter = str_replace ("DELIMITER ","",trim($dumpline));
654
+	  if (!$inparents && strpos ($dumpline, "DELIMITER ") === 0)
655
+		$delimiter = str_replace ("DELIMITER ","",trim($dumpline));
656 656
 
657 657
 // Skip comments and blank lines only if NOT in parents
658 658
 
659
-      if (!$inparents)
660
-      { $skipline=false;
661
-        reset($comment);
662
-        foreach ($comment as $comment_value)
663
-        { 
659
+	  if (!$inparents)
660
+	  { $skipline=false;
661
+		reset($comment);
662
+		foreach ($comment as $comment_value)
663
+		{ 
664 664
 
665 665
 // DIAGNOSTIC
666 666
 //          echo ($comment_value);
667
-          if (trim($dumpline)=="" || strpos (trim($dumpline), $comment_value) === 0)
668
-          { $skipline=true;
669
-            break;
670
-          }
671
-        }
672
-        if ($skipline)
673
-        { $linenumber++;
667
+		  if (trim($dumpline)=="" || strpos (trim($dumpline), $comment_value) === 0)
668
+		  { $skipline=true;
669
+			break;
670
+		  }
671
+		}
672
+		if ($skipline)
673
+		{ $linenumber++;
674 674
 
675 675
 // DIAGNOSTIC
676 676
 // echo ("<p>Comment line skipped</p>\n");
677 677
 
678
-          continue;
679
-        }
680
-      }
678
+		  continue;
679
+		}
680
+	  }
681 681
 
682 682
 // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings)
683 683
       
684
-      $dumpline_deslashed = str_replace ("\\\\","",$dumpline);
684
+	  $dumpline_deslashed = str_replace ("\\\\","",$dumpline);
685 685
 
686 686
 // Count ' and \' (or " and \") in the dumpline to avoid query break within a text field ending by $delimiter
687 687
 
688
-      $parents=substr_count ($dumpline_deslashed, $string_quotes)-substr_count ($dumpline_deslashed, "\\$string_quotes");
689
-      if ($parents % 2 != 0)
690
-        $inparents=!$inparents;
688
+	  $parents=substr_count ($dumpline_deslashed, $string_quotes)-substr_count ($dumpline_deslashed, "\\$string_quotes");
689
+	  if ($parents % 2 != 0)
690
+		$inparents=!$inparents;
691 691
 
692 692
 // Add the line to query
693 693
 
694
-      $query .= $dumpline;
694
+	  $query .= $dumpline;
695 695
 
696 696
 // Don't count the line if in parents (text fields may include unlimited linebreaks)
697 697
       
698
-      if (!$inparents)
699
-        $querylines++;
698
+	  if (!$inparents)
699
+		$querylines++;
700 700
       
701 701
 // Stop if query contains more lines as defined by MAX_QUERY_LINES
702 702
 
703
-      if ($querylines>MAX_QUERY_LINES)
704
-      {
705
-        echo ("<p class=\"error\">Stopped at the line $linenumber. </p>");
706
-        echo ("<p>At this place the current query includes more than ".MAX_QUERY_LINES." dump lines. That can happen if your dump file was ");
707
-        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 ");
708
-        echo ("extended inserts or very long procedure definitions. Please read the <a href=\"http://www.ozerov.de/bigdump/usage/\">BigDump usage notes</a> ");
709
-        echo ("for more infos. Ask for our support services ");
710
-        echo ("in order to handle dump files containing extended inserts.</p>\n");
711
-        $error=true;
712
-        break;
713
-      }
703
+	  if ($querylines>MAX_QUERY_LINES)
704
+	  {
705
+		echo ("<p class=\"error\">Stopped at the line $linenumber. </p>");
706
+		echo ("<p>At this place the current query includes more than ".MAX_QUERY_LINES." dump lines. That can happen if your dump file was ");
707
+		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 ");
708
+		echo ("extended inserts or very long procedure definitions. Please read the <a href=\"http://www.ozerov.de/bigdump/usage/\">BigDump usage notes</a> ");
709
+		echo ("for more infos. Ask for our support services ");
710
+		echo ("in order to handle dump files containing extended inserts.</p>\n");
711
+		$error=true;
712
+		break;
713
+	  }
714 714
 
715 715
 // Execute query if end of query detected ($delimiter as last character) AND NOT in parents
716 716
 
@@ -719,43 +719,43 @@  discard block
 block discarded – undo
719 719
 // echo ("<p>In Parents: ".($inparents?"true":"false")."</p>\n");
720 720
 // echo ("<p>Line: $dumpline</p>\n");
721 721
 
722
-      if (preg_match('/'.preg_quote($delimiter).'$/',trim($dumpline)) && !$inparents)
723
-      { 
722
+	  if (preg_match('/'.preg_quote($delimiter).'$/',trim($dumpline)) && !$inparents)
723
+	  { 
724 724
 
725 725
 // Cut off delimiter of the end of the query
726 726
 
727
-        $query = substr(trim($query),0,-1*strlen($delimiter));
727
+		$query = substr(trim($query),0,-1*strlen($delimiter));
728 728
 
729 729
 // DIAGNOSTIC
730 730
 // echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
731 731
 
732
-        if (!TESTMODE && !mysql_query($query, $dbconnection))
733
-        { echo ("<p class=\"error\">Error at the line $linenumber: ". trim($dumpline)."</p>\n");
734
-          echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
735
-          echo ("<p>MySQL: ".mysql_error()."</p>\n");
736
-          $error=true;
737
-          break;
738
-        }
739
-        $totalqueries++;
740
-        $queries++;
741
-        $query="";
742
-        $querylines=0;
743
-      }
744
-      $linenumber++;
745
-    }
732
+		if (!TESTMODE && !mysql_query($query, $dbconnection))
733
+		{ echo ("<p class=\"error\">Error at the line $linenumber: ". trim($dumpline)."</p>\n");
734
+		  echo ("<p>Query: ".trim(nl2br(htmlentities($query)))."</p>\n");
735
+		  echo ("<p>MySQL: ".mysql_error()."</p>\n");
736
+		  $error=true;
737
+		  break;
738
+		}
739
+		$totalqueries++;
740
+		$queries++;
741
+		$query="";
742
+		$querylines=0;
743
+	  }
744
+	  $linenumber++;
745
+	}
746 746
   }
747 747
 
748 748
 // Get the current file position
749 749
 
750 750
   if (!$error)
751 751
   { if (!$gzipmode) 
752
-      $foffset = ftell($file);
753
-    else
754
-      $foffset = gztell($file);
755
-    if (!$foffset)
756
-    { echo ("<p class=\"error\">UNEXPECTED: Can't read the file pointer offset</p>\n");
757
-      $error=true;
758
-    }
752
+	  $foffset = ftell($file);
753
+	else
754
+	  $foffset = gztell($file);
755
+	if (!$foffset)
756
+	{ echo ("<p class=\"error\">UNEXPECTED: Can't read the file pointer offset</p>\n");
757
+	  $error=true;
758
+	}
759 759
   }
760 760
 
761 761
 // Print statistics
@@ -766,63 +766,63 @@  discard block
 block discarded – undo
766 766
 
767 767
   if (!$error)
768 768
   { 
769
-    $lines_this   = $linenumber-$_REQUEST["start"];
770
-    $lines_done   = $linenumber-1;
771
-    $lines_togo   = ' ? ';
772
-    $lines_tota   = ' ? ';
769
+	$lines_this   = $linenumber-$_REQUEST["start"];
770
+	$lines_done   = $linenumber-1;
771
+	$lines_togo   = ' ? ';
772
+	$lines_tota   = ' ? ';
773 773
     
774
-    $queries_this = $queries;
775
-    $queries_done = $totalqueries;
776
-    $queries_togo = ' ? ';
777
-    $queries_tota = ' ? ';
778
-
779
-    $bytes_this   = $foffset-$_REQUEST["foffset"];
780
-    $bytes_done   = $foffset;
781
-    $kbytes_this  = round($bytes_this/1024,2);
782
-    $kbytes_done  = round($bytes_done/1024,2);
783
-    $mbytes_this  = round($kbytes_this/1024,2);
784
-    $mbytes_done  = round($kbytes_done/1024,2);
774
+	$queries_this = $queries;
775
+	$queries_done = $totalqueries;
776
+	$queries_togo = ' ? ';
777
+	$queries_tota = ' ? ';
778
+
779
+	$bytes_this   = $foffset-$_REQUEST["foffset"];
780
+	$bytes_done   = $foffset;
781
+	$kbytes_this  = round($bytes_this/1024,2);
782
+	$kbytes_done  = round($bytes_done/1024,2);
783
+	$mbytes_this  = round($kbytes_this/1024,2);
784
+	$mbytes_done  = round($kbytes_done/1024,2);
785 785
    
786
-    if (!$gzipmode)
787
-    {
788
-      $bytes_togo  = $filesize-$foffset;
789
-      $bytes_tota  = $filesize;
790
-      $kbytes_togo = round($bytes_togo/1024,2);
791
-      $kbytes_tota = round($bytes_tota/1024,2);
792
-      $mbytes_togo = round($kbytes_togo/1024,2);
793
-      $mbytes_tota = round($kbytes_tota/1024,2);
786
+	if (!$gzipmode)
787
+	{
788
+	  $bytes_togo  = $filesize-$foffset;
789
+	  $bytes_tota  = $filesize;
790
+	  $kbytes_togo = round($bytes_togo/1024,2);
791
+	  $kbytes_tota = round($bytes_tota/1024,2);
792
+	  $mbytes_togo = round($kbytes_togo/1024,2);
793
+	  $mbytes_tota = round($kbytes_tota/1024,2);
794 794
       
795
-      $pct_this   = ceil($bytes_this/$filesize*100);
796
-      $pct_done   = ceil($foffset/$filesize*100);
797
-      $pct_togo   = 100 - $pct_done;
798
-      $pct_tota   = 100;
799
-
800
-      if ($bytes_togo==0) 
801
-      { $lines_togo   = '0'; 
802
-        $lines_tota   = $linenumber-1; 
803
-        $queries_togo = '0'; 
804
-        $queries_tota = $totalqueries; 
805
-      }
806
-
807
-      $pct_bar    = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>";
808
-    }
809
-    else
810
-    {
811
-      $bytes_togo  = ' ? ';
812
-      $bytes_tota  = ' ? ';
813
-      $kbytes_togo = ' ? ';
814
-      $kbytes_tota = ' ? ';
815
-      $mbytes_togo = ' ? ';
816
-      $mbytes_tota = ' ? ';
795
+	  $pct_this   = ceil($bytes_this/$filesize*100);
796
+	  $pct_done   = ceil($foffset/$filesize*100);
797
+	  $pct_togo   = 100 - $pct_done;
798
+	  $pct_tota   = 100;
799
+
800
+	  if ($bytes_togo==0) 
801
+	  { $lines_togo   = '0'; 
802
+		$lines_tota   = $linenumber-1; 
803
+		$queries_togo = '0'; 
804
+		$queries_tota = $totalqueries; 
805
+	  }
806
+
807
+	  $pct_bar    = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>";
808
+	}
809
+	else
810
+	{
811
+	  $bytes_togo  = ' ? ';
812
+	  $bytes_tota  = ' ? ';
813
+	  $kbytes_togo = ' ? ';
814
+	  $kbytes_tota = ' ? ';
815
+	  $mbytes_togo = ' ? ';
816
+	  $mbytes_tota = ' ? ';
817 817
       
818
-      $pct_this    = ' ? ';
819
-      $pct_done    = ' ? ';
820
-      $pct_togo    = ' ? ';
821
-      $pct_tota    = 100;
822
-      $pct_bar     = str_replace(' ','&nbsp;','<tt>[         Not available for gzipped files          ]</tt>');
823
-    }
818
+	  $pct_this    = ' ? ';
819
+	  $pct_done    = ' ? ';
820
+	  $pct_togo    = ' ? ';
821
+	  $pct_tota    = 100;
822
+	  $pct_bar     = str_replace(' ','&nbsp;','<tt>[         Not available for gzipped files          ]</tt>');
823
+	}
824 824
     
825
-    echo ("
825
+	echo ("
826 826
     <center>
827 827
     <table width=\"520\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">
828 828
     <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>
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
 
840 840
 // Finish message and restart the script
841 841
 
842
-    if ($linenumber<$_REQUEST["start"]+$linespersession)
843
-    { echo ("<p class=\"successcentr\">Congratulations: End of file reached, assuming OK</p>\n");
844
-      echo ("<p class=\"successcentr\">IMPORTANT: REMOVE YOUR DUMP FILE and BIGDUMP SCRIPT FROM SERVER NOW!</p>\n");
845
-      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");
846
-      echo ("<p class=\"centr\">You can send me some bucks or euros as appreciation via PayPal. Thank you!</p>\n");
842
+	if ($linenumber<$_REQUEST["start"]+$linespersession)
843
+	{ echo ("<p class=\"successcentr\">Congratulations: End of file reached, assuming OK</p>\n");
844
+	  echo ("<p class=\"successcentr\">IMPORTANT: REMOVE YOUR DUMP FILE and BIGDUMP SCRIPT FROM SERVER NOW!</p>\n");
845
+	  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");
846
+	  echo ("<p class=\"centr\">You can send me some bucks or euros as appreciation via PayPal. Thank you!</p>\n");
847 847
 ?>
848 848
 
849 849
 <!-- Start Paypal donation code -->
@@ -863,23 +863,23 @@  discard block
 block discarded – undo
863 863
 
864 864
 <?php      
865 865
 
866
-      $error=true; // This is a semi-error telling the script is finished
867
-    }
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");
873
-
874
-      echo ("<noscript>\n");
875
-      echo ("<p class=\"centr\"><a href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&amp;fn=".urlencode($curfilename)."&amp;foffset=$foffset&amp;totalqueries=$totalqueries&amp;delimiter=".urlencode($delimiter)."\">Continue from the line $linenumber</a> (Enable JavaScript to do it automatically)</p>\n");
876
-      echo ("</noscript>\n");
866
+	  $error=true; // This is a semi-error telling the script is finished
867
+	}
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");
873
+
874
+	  echo ("<noscript>\n");
875
+	  echo ("<p class=\"centr\"><a href=\"".$_SERVER["PHP_SELF"]."?start=$linenumber&amp;fn=".urlencode($curfilename)."&amp;foffset=$foffset&amp;totalqueries=$totalqueries&amp;delimiter=".urlencode($delimiter)."\">Continue from the line $linenumber</a> (Enable JavaScript to do it automatically)</p>\n");
876
+	  echo ("</noscript>\n");
877 877
    
878
-      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
-    }
878
+	  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
+	}
880 880
   }
881 881
   else 
882
-    echo ("<p class=\"error\">Stopped on error</p>\n");
882
+	echo ("<p class=\"error\">Stopped on error</p>\n");
883 883
 
884 884
 skin_close();
885 885
 
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	die;
926 926
   } 
927 927
   else 
928
-    create_ajax_script();	  
928
+	create_ajax_script();	  
929 929
 }
930 930
 
931 931
 // Anyway put out the output from above
Please login to merge, or discard this patch.
include/plugins/frames.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 	var $sameOrigin;
10 10
 	
11 11
 	/**
12
-	* @param bool allow running from the same origin only
13
-	*/
12
+	 * @param bool allow running from the same origin only
13
+	 */
14 14
 	function AdminerFrames($sameOrigin = false) {
15 15
 		$this->sameOrigin = $sameOrigin;
16 16
 	}
Please login to merge, or discard this patch.
include/plugins/plugin.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 	var $plugins;
10 10
 	
11 11
 	/**
12
-	* @param array
13
-	*/
12
+	 * @param array
13
+	 */
14 14
 	function AdminerPlugin($plugins) {
15 15
 		$this->plugins = $plugins;
16 16
 		// it is possible to use ReflectionObject in PHP 5 to find out which plugins defines which methods at once
Please login to merge, or discard this patch.
include/plugins/tinymce.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 	var $path;
11 11
 	
12 12
 	/**
13
-	* @param string
14
-	*/
13
+	 * @param string
14
+	 */
15 15
 	function AdminerTinymce($path = "tiny_mce/tiny_mce.js") {
16 16
 		$this->path = $path;
17 17
 	}
Please login to merge, or discard this patch.
include/plugins/login-table.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
include/plugins/file-upload.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 	var $uploadPath, $displayPath;
10 10
 	
11 11
 	/**
12
-	* @param string prefix for uploading data (create writable subdirectory for each table containing uploadable fields)
13
-	* @param string prefix for displaying data, null stands for $uploadPath
14
-	*/
12
+	 * @param string prefix for uploading data (create writable subdirectory for each table containing uploadable fields)
13
+	 * @param string prefix for displaying data, null stands for $uploadPath
14
+	 */
15 15
 	function AdminerFileUpload($uploadPath = "../static/data/", $displayPath = null) {
16 16
 		$this->uploadPath = $uploadPath;
17 17
 		$this->displayPath = (isset($displayPath) ? $displayPath : $uploadPath);
Please login to merge, or discard this patch.
include/plugins/slugify.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 	var $from, $to;
10 10
 	
11 11
 	/**
12
-	* @param string find these characters ...
13
-	* @param string ... and replace them by these
14
-	*/
12
+	 * @param string find these characters ...
13
+	 * @param string ... and replace them by these
14
+	 */
15 15
 	function AdminerSlugify($from = 'áčďéěíňóřšťúůýž', $to = 'acdeeinorstuuyz') {
16 16
 		$this->from = $from;
17 17
 		$this->to = $to;
Please login to merge, or discard this patch.