Skip to content

Commit

Permalink
Fixed issue #4995 : check data integrity old_table old_token doesn't …
Browse files Browse the repository at this point in the history
…work for db with $dbprefix = ''

Dev : use explode("_", substr($table,strlen($dbprefix))); every where i found "_" and rename the variable

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9846 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Shnoulle committed Mar 3, 2011
1 parent 56bb10d commit b449350
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions admin/integritycheck.php
Expand Up @@ -419,7 +419,7 @@
$sids=array();
foreach($tables as $table)
{
list($one, $two, $three, $sid, $date)=explode("_", $table);
list($oldtxt, $surveytxt, $sid, $date)=explode("_", substr($table,strlen($dbprefix)));
$oldsids[]=$sid;
$fulloldsids[$sid][]=$table;
}
Expand All @@ -441,23 +441,22 @@
} else {
foreach($fulloldsids[$oldsid] as $tablename)
{
list($one, $two, $three, $four, $five)=explode("_", $tablename);
$five=substr($tablename,-14);
$year=substr($five, 0,4);
$month=substr($five, 4,2);
$day=substr($five, 6, 2);
$hour=substr($five, 8, 2);
$minute=substr($five, 10, 2);
list($oldtxt, $surveytxt, $sid, $datetime)=explode("_", substr($tablename,strlen($dbprefix)));
$year=substr($datetime, 0,4);
$month=substr($datetime, 4,2);
$day=substr($datetime, 6, 2);
$hour=substr($datetime, 8, 2);
$minute=substr($datetime, 10, 2);
$date=date("D, d M Y h:i a", mktime($hour, $minute, 0, $month, $day, $year));
$jq="SELECT * FROM ".$tablename;
$jqresult=$connect->execute($jq) or safe_die($query." failed");
$jqcount=$jqresult->RecordCount();
if($jqcount == 0) {
$oldsoptionaldelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s"), $four, $date);
// $oldsoptionaldelete[]=$tablename."| SID ".$four. " ". $clang->gT("saved at")." $date";
} else {
$oldsmultidelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s containing %d record(s)"), $four, $date, $jqcount);
// $oldsmultidelete[]=$tablename."| SID ".$four." ". $clang->gT("saved at")." $date ".sprintf($clang->gT("containing %d record(s)"), $jqcount);
if($jqcount == 0)
{
$oldsoptionaldelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s"), $sid, $date);
} else
{
$oldsmultidelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s containing %d record(s)"), $sid, $date, $jqcount);
}
}
}
Expand Down Expand Up @@ -486,7 +485,7 @@

foreach($tables as $table)
{
list($one, $two, $sid, $date)=explode("_", substr($table,strlen($dbprefix)));
list($oldtxt, $surveytxt, $sid, $date)=explode("_", substr($table,strlen($dbprefix)));
$oldtsids[]=$sid;
$fulloldtsids[$sid][]=$table;
}
Expand All @@ -508,23 +507,21 @@
} else {
foreach($fulloldtsids[$oldtsid] as $tablename)
{
list($one, $two, $three, $four, $five)=explode("_", $tablename);
$year=substr($five, 0,4);
$month=substr($five, 4,2);
$day=substr($five, 6, 2);
$hour=substr($five, 8, 2);
$minute=substr($five, 10, 2);
list($oldtxt, $tokenstxt, $sid, $datetime)=explode("_", substr($tablename,strlen($dbprefix)));
$year=substr($datetime, 0,4);
$month=substr($datetime, 4,2);
$day=substr($datetime, 6, 2);
$hour=substr($datetime, 8, 2);
$minute=substr($datetime, 10, 2);
$date=date("D, d M Y h:i a", mktime($hour, $minute, 0, $month, $day, $year));
$jq="SELECT * FROM ".$tablename;

$jqresult=$connect->execute($jq) or safe_die($query." failed");
$jqcount=$jqresult->RecordCount();
if($jqcount == 0) {
// $oldtoptionaldelete[]=$tablename."| SID ".$four. " ". $clang->gT("saved at")." $date";
$oldtoptionaldelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s"), $four, $date);
$oldtoptionaldelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s"), $sid, $date);
} else {
$oldtmultidelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s containing %d record(s)"), $four, $date, $jqcount);
// $oldtmultidelete[]=$tablename."| SID ".$four." ". $clang->gT("saved at")." $date ".sprintf($clang->gT("containing %d record(s)"), $jqcount);
$oldtmultidelete[]=$tablename."| ".sprintf($clang->gT("Survey ID %d saved at %s containing %d record(s)"), $sid, $date, $jqcount);
}
}
}
Expand Down

0 comments on commit b449350

Please sign in to comment.