Pages: [1]
Author Topic: error in the code  (Read 1305 times)
amitk
Guest


Email
on: Jul 01, 08, 09:28 AM

hi Sergey,
i found an error in the code in install.php, in the admin folder:

when the istallation of the gamepack starts, the for loop runs through the queries, and if one fails in turns $success into false.
problem is - the check afterwards is:
Code:
if( !success )
this should be:
Code:
if( !$success )

also, i think it would be helpfull to preg_match the names of the games not instralled, and display them in the ERROR msg, so that it would be easier to find the problem.

Amit
Logged
amitk
Guest


Email
Reply #1 on: Jul 01, 08, 09:38 AM

i forgot to add - this is my basic addition to the script - i think it's a lot easier this way

$falseQueries = array();
foreach( $queries as $query )
            {
               $slen .= strlen($query) . " - ";
               if( strlen($query) > 10 )
               {
                  if( !$db->query($query, 0) )
                  {
                     $success = false;
                     $falseQueries[] = $query;
                  }
                  else
                  {
                     $nqueriesleft--;
                     $ninstalled++;
                  }
               }
            }
            if( !$success )
               {
                  $failQs = implode('<br />',$falseQueries);
                  $tpl->assign( "ERROR", "An error occured while adding new records to the database.<br /><br />Un-installed queries:<br />$failQs" );
               }
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #2 on: Jul 01, 08, 12:36 PM

thank you very much for informing me about that error (fortunately it's not critical), I've corrected the file in both versions - 1.2 which is on the site and 1.3 which I'm working on... As for your suggestion in the second post, it looks good, I'll most likely add those changes in PAS v1.3.
Logged
Pages: [1]
 
Jump to: