Changeset 448 for trunk/phpbms/install
- Timestamp:
- 03/03/09 12:35:56 (3 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/install/install_include.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/install/install_include.php
r386 r448 2 2 function processSQLfile($db,$filename){ 3 3 global $dblink; 4 4 5 5 $thefile = @ fopen($filename,"r"); 6 if(!$thefile) 6 if(!$thefile) 7 7 return "Could not open the file ".$filename.".\n"; 8 8 … … 29 29 else 30 30 $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 32 32 $queryresult=$db->query($querystatement); 33 33 34 34 if(!$queryresult) 35 35 return false; … … 44 44 45 45 $ver=$db->fetchArray($queryresult); 46 return $ver["version"]; 46 return $ver["version"]; 47 47 } 48 48 … … 52 52 53 53 $thedir= @ opendir("../modules/"); 54 54 55 55 echo 'modules = Array();'."\n"; 56 56 57 57 $modules = array(); 58 58 while($entry=readdir($thedir)){ … … 60 60 if(file_exists("../modules/".$entry."/install/".$type.".php") && file_exists("../modules/".$entry."/install/version.php")){ 61 61 include("../modules/".$entry."/install/version.php"); 62 } 62 } 63 63 } 64 } 65 64 } 65 66 66 foreach($modules as $name=>$module) 67 67 if(is_array($module)){ … … 70 70 echo 'modules["'.$name.'"]["'.$key.'"] = "'.$value.'";'."\n"; 71 71 } 72 72 73 73 @ chdir ($currdirectory); 74 74 75 75 return $modules; 76 76 }//end function 77 77 78 78 79 79 function showModules($modules){ 80 80 if(is_array($modules)){ … … 92 92 $sqlstatement=""; 93 93 $thereturn = ""; 94 94 95 95 $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; 98 98 else{ 99 99 while(!feof($createfile)) { 100 100 $sqlstatement.= @ fgets($createfile,1024); 101 101 if(strpos($sqlstatement,";")){ 102 103 $theresult = $db->query(trim($sqlstatement)); 104 102 103 $theresult = $db->query(trim($sqlstatement)); 104 105 105 if($db->error){ 106 106 return "Error creating tables: ".$db->error."\n\n".trim($sqlstatement); … … 109 109 }//end if; 110 110 }//end while 111 112 }//end if 111 112 }//end if 113 113 114 114 return true; … … 117 117 118 118 function importData($db,$tablename){ 119 119 120 120 $tablefile = @ fopen($tablename.".sql","rb"); 121 if(!$tablefile) 121 if(!$tablefile) 122 122 return "Could not open the file ".$tablename.".sql\n"; 123 123 … … 125 125 $counter=0; 126 126 $failure = false; 127 127 128 128 while(!feof($tablefile)) { 129 129 $sqlstatement=trim(fgets($tablefile,8184)); … … 142 142 }//end if; 143 143 }//end while 144 144 145 145 if($failure) 146 146 $threturn = "Importing of some records in ".$tablename." occured.\n\n"; 147 147 else 148 148 $thereturn.="Import of ".$counter." record(s) for '".$tablename."' complete.\n"; 149 149 150 150 return $thereturn; 151 151 }//end function