MetaTables(); for($x=0;$x $section) { fwrite($fp,"[".$secname."]\n"); foreach($section as $key => $value) fwrite($fp,"$key = \"$value\"\n"); fwrite($fp,"\n"); } fclose($fp); //} } function RunSchemaFile($ado,$filename) { if(file_exists($filename)) { $fp = fopen($filename, "r");//open file $sql = fread($fp, filesize($filename)); fclose($fp); if(strlen($sql)) RunSchemaText($ado,$sql); } } function RunSchemaText($ado,$sql) { global $g_TablePrefix; if(strlen($g_TablePrefix)) { $what = "CREATE TABLE "; $replace = "CREATE TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "DROP TABLE "; $replace = "DROP TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "INSERT INTO "; $replace = "INSERT INTO ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "UPDATE "; $replace = "UPDATE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "ALTER TABLE "; $replace = "ALTER TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); } $commands = explode("# --------------------------------------------------------",$sql); if(count($commands)>0) { for($i=0;$i0) { $ado->Execute($cmd); if($ado->ErrorNo()!=0) { $db_error = $ado->ErrorMsg()." COMMAND:
$cmd
"; //echo "

$db_error

"; //break; } } } } } function RunSQLText($ado,$allsql) { global $g_TablePrefix; $line = 0; while($line0 && substr($sql,0,1)!="#") { if(strlen($g_TablePrefix)) { $what = "CREATE TABLE "; $replace = "CREATE TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "DROP TABLE "; $replace = "DROP TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "INSERT INTO "; $replace = "INSERT INTO ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "UPDATE "; $replace = "UPDATE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); $what = "ALTER TABLE "; $replace = "ALTER TABLE ".$g_TablePrefix; $sql = ereg_replace($what, $replace, $sql); } $sql = trim($sql); if(strlen($sql)>0) { $ado->Execute($sql); if($ado->ErrorNo()!=0) { $db_error = $ado->ErrorMsg()." COMMAND:
$sql
"; //echo "

$db_error

"; $error = TRUE; } } } $line++; } } function RunSQLFile($ado,$filename) { if(file_exists($filename)) { $allsql = file($filename); RunSQLText($ado,$allsql); } } function RunRestoreFile($ado,$filename,$FileOffset,$MaxLines) { $size = filesize($filename); if($FileOffset > $size) return -2; $fp = fopen($filename,"r"); if(!$fp) return -1; if($FileOffset>0) { fseek($fp,$FileOffset); } else { $EndOfSQL = FALSE; $sql = ""; while(!feof($fp) && !$EndOfSQL) { $l = fgets($fp,16384); if(substr($l,0,11)=="INSERT INTO") { $EndOfSQL = TRUE; } else { $sql .= $l; $FileOffset = ftell($fp) - strlen($l); } } if(strlen($sql)) { RunSchemaText($ado,$sql); } fseek($fp,$FileOffset); } $LinesRead = 0; $sql = ""; $AllSql = array(); while($LinesRead < $MaxLines && !feof($fp)) { $sql = fgets($fp, 16384); if(strlen($sql)) { $AllSql[] = $sql; $LinesRead++; } } if(!feof($fp)) { $FileOffset = ftell($fp); } else { $FileOffset = $TotalSize; } fclose($fp); if(count($AllSql)>0) RunSQLText($ado,$AllSql); return (int)$FileOffset; } function inst_keyED($txt,$encrypt_key) { $encrypt_key = md5($encrypt_key); $ctr=0; $tmp = ""; for ($i=0;$i15 && $p[1]<32) $localb=TRUE; } $localname = (strpos($domain,".")==0); if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" || substr($domain,0,3)=="10." || $localb || $localname) { return TRUE; } return FALSE; } function inst_ModuleLicensed($name) { global $i_Keys, $objConfig, $g_License, $g_Domain; //$lic = LoadLicense(); $lic = base64_decode($g_License); inst_ParseLicense($lic); // echo "Checking $g_Domain..
\n"; // echo "
";print_r($i_Keys); echo "

"; $modules = array(); if(!inst_IsLocalSite($g_Domain)) { for($x=0;$x\n"; return TRUE; } else { // echo "Module $name is not licensed
\n"; return FALSE; } } else return TRUE; return FALSE; } function inst_GetModuleList() { global $rootpath,$pathchar,$admin, $pathtoroot; $path = $pathtoroot; $new = array(); if ($dir = @opendir($path)) { while (($file = readdir($dir)) !== false) { if($file !="." && $file !=".." && substr($file,0,1)!="_") { if(is_dir($path."/".$file)) { $inst_file = $path.$file."/admin/install.php"; if(file_exists($inst_file)) { // if(inst_ModuleLicensed($file)) // { $new[$file] = $inst_file; // } } } } } closedir($dir); } return array_keys($new); } function GetDirList ($dirName) { $filedates = array(); $d = dir($dirName); while($entry = $d->read()) { if ($entry != "." && $entry != "..") { if (!is_dir($dirName."/".$entry)) { $filedate[]=$entry; } } } $d->close(); return $filedate; } function GetLanguageList() { global $pathtoroot, $admin; $packs = array(); $dir = $pathtoroot.$admin."/install/langpacks"; $files = GetDirList($dir); if(is_array($files)) { foreach($files as $f) { $p = pathinfo($f); if($p["extension"]=="lang") { $packs[] = $f; } } } return $packs; } function section_header($title, $return_result = false) { $ret = ''. '
 '.$title.''. ''. "". '
'; if( $return_result ) return $ret; else echo $ret; } ?>