phpBMS

Changeset 448 for trunk/phpbms/install

Show
Ignore:
Timestamp:
03/03/09 12:35:56 (3 years ago)
Author:
brieb
Message:

* Fixed install error reporting

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/install/install_include.php

    r386 r448  
    22function processSQLfile($db,$filename){ 
    33        global $dblink; 
    4                          
     4 
    55        $thefile = @ fopen($filename,"r"); 
    6         if(!$thefile)  
     6        if(!$thefile) 
    77                return "Could not open the file ".$filename.".\n"; 
    88 
     
    2929        else 
    3030                $querystatement="SELECT id FROM users WHERE login=\"".mysql_real_escape_string($user)."\" AND password=encode(\"".mysql_real_escape_string($pass)."\",\"".ENCRYPTION_SEED."\") AND accesslevel>=90"; 
    31          
     31 
    3232        $queryresult=$db->query($querystatement); 
    33                          
     33 
    3434        if(!$queryresult) 
    3535                return false; 
     
    4444 
    4545        $ver=$db->fetchArray($queryresult); 
    46         return $ver["version"];                  
     46        return $ver["version"]; 
    4747} 
    4848 
     
    5252 
    5353        $thedir= @ opendir("../modules/"); 
    54          
     54 
    5555        echo 'modules = Array();'."\n"; 
    56          
     56 
    5757        $modules = array(); 
    5858        while($entry=readdir($thedir)){ 
     
    6060                        if(file_exists("../modules/".$entry."/install/".$type.".php") && file_exists("../modules/".$entry."/install/version.php")){ 
    6161                                include("../modules/".$entry."/install/version.php"); 
    62                         }                                        
     62                        } 
    6363                } 
    64         }                
    65          
     64        } 
     65 
    6666        foreach($modules as $name=>$module) 
    6767                if(is_array($module)){ 
     
    7070                                echo 'modules["'.$name.'"]["'.$key.'"] = "'.$value.'";'."\n"; 
    7171                } 
    72          
     72 
    7373        @ chdir ($currdirectory); 
    74          
     74 
    7575        return $modules; 
    7676}//end function 
    7777 
    78          
     78 
    7979function showModules($modules){ 
    8080        if(is_array($modules)){ 
     
    9292        $sqlstatement=""; 
    9393        $thereturn = ""; 
    94          
     94 
    9595        $createfile = @ fopen("createtables.sql","r"); 
    96         if(!$createfile)  
    97                 return "Could not open SQL file: ".sqlfile; 
     96        if(!$createfile) 
     97                return "Could not open SQL file: ".$sqlfile; 
    9898        else{ 
    9999                while(!feof($createfile)) { 
    100100                        $sqlstatement.= @ fgets($createfile,1024); 
    101101                        if(strpos($sqlstatement,";")){ 
    102                          
    103                                 $theresult = $db->query(trim($sqlstatement));  
    104                                  
     102 
     103                                $theresult = $db->query(trim($sqlstatement)); 
     104 
    105105                                if($db->error){ 
    106106                                        return "Error creating tables: ".$db->error."\n\n".trim($sqlstatement); 
     
    109109                        }//end if; 
    110110                }//end while 
    111                  
    112         }//end if        
     111 
     112        }//end if 
    113113 
    114114        return true; 
     
    117117 
    118118function importData($db,$tablename){ 
    119          
     119 
    120120        $tablefile = @ fopen($tablename.".sql","rb"); 
    121         if(!$tablefile)  
     121        if(!$tablefile) 
    122122                return "Could not open the file ".$tablename.".sql\n"; 
    123123 
     
    125125        $counter=0; 
    126126        $failure = false; 
    127          
     127 
    128128        while(!feof($tablefile)) { 
    129129                $sqlstatement=trim(fgets($tablefile,8184)); 
     
    142142                }//end if; 
    143143        }//end while 
    144          
     144 
    145145        if($failure) 
    146146                $threturn = "Importing of some records in ".$tablename." occured.\n\n"; 
    147147        else 
    148148                $thereturn.="Import of ".$counter." record(s) for '".$tablename."' complete.\n"; 
    149          
     149 
    150150        return $thereturn; 
    151151}//end function 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.