Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 6:40 AM

in-portal

Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_0_9.txt
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_0_9.txt (revision 794)
+++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_0_9.txt (revision 795)
Property changes on: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_0_9.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.1.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.3.4/admin/modules/addmodule.php
===================================================================
--- branches/unlabeled/unlabeled-1.3.4/admin/modules/addmodule.php (revision 794)
+++ branches/unlabeled/unlabeled-1.3.4/admin/modules/addmodule.php (revision 795)
@@ -1,226 +1,226 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath(__FILE__));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL=$rootURL.$admin;
$imagesURL = $adminURL."/images";
//admin only util
$pathtolocal = $pathtoroot."kernel/";
require_once ($pathtoroot.$admin."/include/elements.php");
+require_once ($pathtoroot.$admin."/install/install_lib.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$pathtolocal = $pathtoroot;
//Set Section
$section = 'in-portal:addmodule';
//Set Environment Variable
$envar = "env=" . BuildEnv();
//Display header
$order = $objConfig->Get("Module_SortOrder");
$orderBy = trim($objConfig->Get("Module_SortField")." ".$order);
if(strlen($orderBy))
{
$orderBy = " ORDER BY LoadOrder,".$orderBy;
}
else
$orderBy = " ORDER BY LoadOrder";
$objModules->Clear();
$sql = "SELECT * FROM ".GetTablePrefix()."Modules";
$objModules->Query_Item($sql);
$objModList = new clsModList();
$path = $pathtoroot;
$new = array();
if ($dir = @opendir($path))
{
while (($file = readdir($dir)) !== false)
{
if($file !="." && $file !=".." && substr($file,0,1)!="_")
{
if(is_dir($path.$pathchar.$file))
{
$inst_file = $path.$pathchar.$file.$pathchar.$admin."/install.php";
if(file_exists($inst_file))
{
if(!$objModules->ModuleInstalled($file))
{
$new[$file] = $inst_file;
}
}
}
}
}
closedir($dir);
}
-
foreach($new as $mod => $file)
{
$m = new clsModule();
unset($data);
$data = array();
$status= admin_language("la_text_ready_to_install");
$mod_tmp_name_arr = explode('-', $mod);
$mod_tmp_name = '';
foreach ($mod_tmp_name_arr as $names) {
$mod_tmp_name .= ucfirst($names)."-";
}
$mod_tmp_name = substr($mod_tmp_name, 0, strlen($mod_tmp_name) - 1);
- if (_ModuleLicensed($mod_tmp_name)) {
+ if (inst_ModuleLicensed($mod_tmp_name)) {
$data["Url"] = "<A HREF=\"".$rootURL.$mod."/admin/install.php?env=".BuildEnv()."&redirect=1\">$status</A>";
}
else {
$data["Url"] = '<a href="'.$rootURL.'admin/modules/upgrade_lic.php?env='.BuildEnv().'"><font color="#FF0000">'.admin_language("la_module_not_licensed").'</font></a>';
}
$data["Name"] = $mod_tmp_name;
$objModList->AddItemFromArray($data);
}
$itemcount = $objModList->NumItems();
$title = admin_language("la_Text_Install")." ".admin_language("la_Text_Modules")." (".$itemcount.")";
$objListView = new clsListView(NULL,$objModList);
$objListView->IdField = "Name";
$objListView->PageLinkTemplate = $pathtoroot.$admin."/templates/user_page_link.tpl";
$objListView->ColumnHeaders->Add("Name", admin_language("la_prompt_Available_Modules"),1,0,$order,"width=\"50%\"","Module_SortField","Module_SortOrder","Name");
$objListView->ColumnHeaders->Add("Url",admin_language("la_prompt_Install_Status"),1,0,$order,"width=\"50%\"","Module_SortField","Module_SortOrder","Version");
$objListView->ColumnHeaders->SetSort("Name",$order);
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = FALSE;
$objListView->checkboxes= FALSE;
$objListView->SearchAction="";
$objListView->CurrentPageVar = "Page_Modules";
$objListView->PerPageVar = "Perpage_Modules";
$objListView->CheckboxName = "";
$objListView->TotalItemCount = $itemcount;
$objListView->SelectorType="none";
int_header(null,NULL,$title);
?>
<FORM method="POST" ACTION="" NAME="modlistform" ID="modlistform">
<?php
$objListView->PageLinks = $objListView->PrintPageLinks(); /* call this before we slice! */
$objListView->SliceItems();
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers()
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: branches/unlabeled/unlabeled-1.3.4/admin/modules/addmodule.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.3.4.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.20.4/admin/install/install_lib.php
===================================================================
--- branches/unlabeled/unlabeled-1.20.4/admin/install/install_lib.php (revision 794)
+++ branches/unlabeled/unlabeled-1.20.4/admin/install/install_lib.php (revision 795)
@@ -1,738 +1,738 @@
<?php
function minimum_php_version( $vercheck )
{
$minver = explode(".", $vercheck);
$curver = explode(".", phpversion());
if (($curver[0] < $minver[0])
|| (($curver[0] == $minver[0])
&& ($curver[1] < $minver[1]))
|| (($curver[0] == $minver[0]) && ($curver[1] == $minver[1])
&& ($curver[2][0] < $minver[2][0])))
return false;
else
return true;
}
function VersionSort($a, $b)
{
if ($a == $b) {
return 0;
}
else {
$tmp_a = str_replace("inportal_upgrade_v", "", $a);
$tmp_a = str_replace(".sql", "", $a);
$tmp_b = str_replace("inportal_upgrade_v", "", $b);
$tmp_b = str_replace(".sql", "", $b);
return (ConvertVersion($a) < ConvertVersion($b)) ? -1 : 1;
}
}
function GetMaxPortalVersion($admindirname)
{
$dir = @dir($admindirname.'/install/upgrades');
$upgrades_arr = Array();
$version = '';
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) {
if (strstr($file, 'inportal_upgrade_v')) {
$upgrades_arr[] = $file;
}
}
}
usort($upgrades_arr, "VersionSort");
foreach($upgrades_arr as $file) {
$file_tmp = str_replace("inportal_upgrade_v", "", $file);
$file_tmp = str_replace(".sql", "", $file_tmp);
if (ConvertVersion($file_tmp) > ConvertVersion($version)) {
$version = $file_tmp;
}
}
return $version;
}
function ConvertVersion($version)
{
$parts = explode('.', $version);
$bin = '';
foreach ($parts as $part) {
$bin .= str_pad(decbin($part), 8, '0', STR_PAD_LEFT);
}
$dec = bindec($bin);
return $dec;
}
function TableExists($ado, $tables)
{
global $g_TablePrefix;
$t = explode(",",$tables);
$i = $ado->MetaTables();
for($x=0;$x<count($i);$x++)
$i[$x] = strtolower($i[$x]);
$AllFound = TRUE;
for($tIndex=0;$tIndex<count($t);$tIndex++)
{
$table = $g_TablePrefix.$t[$tIndex];
$table = strtolower($table);
if(!in_array($table,$i))
{
$AllFound = FALSE;
}
}
return $AllFound;
}
function set_ini_value($section, $key, $newvalue)
{
global $ini_vars;
$ini_vars[$section][$key] = $newvalue;
}
function save_values()
{
// Should write something to somwere, but it doesn't :(
global $ini_file,$ini_vars;
//if( file_exists($ini_file) )
//{
$fp = fopen($ini_file, "w");
fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
foreach($ini_vars as $secname => $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 IF EXISTS ".$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;$i<count($commands);$i++)
{
$cmd = $commands[$i];
$cmd = trim($cmd);
if(strlen($cmd)>0)
{
$ado->Execute($cmd);
if($ado->ErrorNo()!=0)
{
$db_error = $ado->ErrorMsg()." COMMAND:<PRE>$cmd</PRE>";
//echo "<br><p class=\"error\">$db_error</p>";
//break;
}
}
}
}
}
function RunSQLText($ado,$allsql)
{
global $g_TablePrefix;
$line = 0;
while($line<count($allsql))
{
$sql = $allsql[$line];
if(strlen(trim($sql))>0 && substr($sql,0,1)!="#")
{
if(strlen($g_TablePrefix))
{
$what = "CREATE TABLE ";
$replace = "CREATE TABLE ".$g_TablePrefix;
$sql = ereg_replace($what, $replace, $sql);
$what = "DELETE FROM ";
$replace = "DELETE FROM ".$g_TablePrefix;
$sql = ereg_replace($what, $replace, $sql);
$what = "DROP TABLE ";
$replace = "DROP TABLE IF EXISTS ".$g_TablePrefix;
$sql = ereg_replace($what, $replace, $sql);
$what = "DROP TABLE IF EXISTS ";
$replace = "DROP TABLE IF EXISTS ".$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:<PRE>$sql</PRE>";
//echo "<br><p class=\"error\">$db_error</p>";
$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;$i<strlen($txt);$i++)
{
if ($ctr==strlen($encrypt_key)) $ctr=0;
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
$ctr++;
}
return $tmp;
}
function inst_decrypt($txt,$key)
{
$txt = inst_keyED($txt,$key);
$tmp = "";
for ($i=0;$i<strlen($txt);$i++)
{
$md5 = substr($txt,$i,1);
$i++;
$tmp.= (substr($txt,$i,1) ^ $md5);
}
return $tmp;
}
function inst_LoadFromRemote()
{
return "";
}
function mod_DLid()
{
global $DownloadId;
echo $DownloadId."\n";
die();
}
function inst_LoadLicense($LoadRemote=FALSE,$file="")
{
global $path,$admin;
$data = Array();
if(!strlen($file))
{
$f = $path.$admin."/include/inportal.dat";
}
else
$f = $file;
if(file_exists($f))
{
$contents = file($f);
$data[0] = base64_decode($contents[1]);
$data[1] = $contents[2];
}
else
if($LoadRemote)
return $LoadFromRemote;
return $data;
}
function inst_SaveLicense($data)
{
}
function inst_VerifyKey($domain,$k)
{
$key = md5($domain);
$lkey = substr($key,0,strlen($key)/2);
$rkey = substr($key,strlen($key)/2);
$r = $rkey.$lkey;
if($k==$r)
return TRUE;
return FALSE;
}
function inst_ParseLicense($txt)
{
global $i_User, $i_Pswd, $i_Keys;
$data = inst_decrypt($txt,"beagle");
$i_Keys = array();
$lines = explode("\n",$data);
for($x=0;$x<count($lines);$x++)
{
$l = $lines[$x];
$p = explode("=",$l,2);
switch($p[0])
{
case "Username":
$i_User = $p[1];
break;
case "UserPass":
$i_Pswd = $p[1];
break;
default:
if(substr($p[0],0,3)=="key")
{
$parts = explode("|",$p[1]);
if(inst_VerifyKey($parts[0],$parts[1]))
{
unset($K);
$k["domain"]=$parts[0];
$k["key"]=$parts[1];
$k["desc"]=$parts[2];
$k["mod"]=$parts[3];
$i_Keys[] = $k;
}
}
break;
}
}
}
function inst_IsLocalSite($domain)
{
$localb = FALSE;
if(substr($domain,0,3)=="172")
{
$b = substr($domain,0,6);
$p = explode(".",$domain);
$subnet = $p[1];
if($p[1]>15 && $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..<br>\n";
-// echo "<PRE>";print_r($i_Keys); echo "</PRE><br>";
+
+ //echo "Checking $g_Domain..<br>\n";
+ //echo "<PRE>";print_r($i_Keys); echo "</PRE><br>";
+
$modules = array();
if(!inst_IsLocalSite($g_Domain))
{
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if($key["domain"]==$g_Domain)
{
$modules = explode(",",strtolower($key["mod"]));
}
}
- if(in_array($name,$modules))
- {
-// echo "Module $name is licensed<br>\n";
- return TRUE;
- }
- else
- {
- // echo "Module $name is not licensed<br>\n";
- return FALSE;
- }
+ if(in_array(strtolower($name),$modules))
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
else
return TRUE;
return FALSE;
}
function inst_parse_portal_ini($file, $parse_section = false) {
if(!file_exists($file) && !is_readable($file))
die('Could Not Open Ini File');
$contents = file($file);
$retval = array();
$section = '';
$ln = 1;
$resave = false;
foreach($contents as $line) {
if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") {
$resave = true;
}
$ln++;
$line = trim($line);
$line = eregi_replace(';[.]*','',$line);
if(strlen($line) > 0) {
//echo $line . " - ";
if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) {
//echo 'section';
$section = substr($line,1,(strlen($line)-2));
if ($parse_section) {
$retval[$section] = array();
}
continue;
} elseif(eregi('=',$line)) {
//echo 'main element';
list($key,$val) = explode(' = ',$line);
if (!$parse_section) {
$retval[trim($key)] = str_replace('"', '', $val);
}
else {
$retval[$section][trim($key)] = str_replace('"', '', $val);
}
} //end if
//echo '<br />';
} //end if
} //end foreach
if ($resave) {
$fp = fopen($file, "w");
reset($contents);
fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
foreach($contents as $line) fwrite($fp,"$line");
fclose($fp);
}
return $retval;
}
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))
{
$ModuleAdminDir = $path.$file.'/admin/';
$inst_file = $ModuleAdminDir.'install.php';
if( file_exists($inst_file) && file_exists($ModuleAdminDir.'install/inportal_schema.sql') )
{
- //if(inst_ModuleLicensed($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 = '<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">'.
'<tr><td class="tablenav" width="580" nowrap background="images/tabnav_left.jpg"><span class="tablenav_link">&nbsp;'.$title.'</span>'.
'</td><td align="right" class="tablenav" background="images/tabnav_back.jpg" width="100%">'.
"<a class=\"link\" onclick=\"ShowHelp('in-portal:install');\"><img src=\"images/blue_bar_help.gif\" border=\"0\"></A>".
'</td></tr></table>';
if( $return_result )
return $ret;
else
echo $ret;
}
function &VerifyDB($error_state, $next_state, $success_func = null, $db_must_exist = false)
{
// perform various check type to database specified
// 1. user is allowed to connect to database
// 2. user has all types of permissions in database
global $state, $db_error;
// enshure we use data from post & not from config
$GLOBALS['g_DBType'] = $_POST["ServerType"];
$GLOBALS['g_DBHost'] = $_POST["ServerHost"];
$GLOBALS['g_DBName'] = $_POST["ServerDB"];
$GLOBALS['g_DBUser'] = $_POST["ServerUser"];
$GLOBALS['g_DBUserPassword'] = $_POST["ServerPass"];
// connect to database
$ado =& inst_GetADODBConnection();
if($ado->ErrorNo() != 0)
{
// was error while connecting
$db_error = "Connection Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg();
$state = $error_state;
}
elseif( $ado->ErrorNo() == 0 )
{
// if connected, then check if all sql statements work
$test_result = 1;
$sql_tests[] = 'DROP TABLE IF EXISTS test_table';
$sql_tests[] = 'CREATE TABLE test_table(test_col mediumint(6))';
$sql_tests[] = 'INSERT INTO test_table(test_col) VALUES (5)';
$sql_tests[] = 'UPDATE test_table SET test_col = 12';
$sql_tests[] = 'ALTER TABLE test_table ADD COLUMN new_col varchar(10)';
$sql_tests[] = 'SELECT * FROM test_table';
$sql_tests[] = 'DELETE FROM test_table';
$sql_tests[] = 'DROP TABLE IF EXISTS test_table';
foreach($sql_tests as $sql_test)
{
$ado->Execute($sql_test);
if( $ado->ErrorNo()!=0 )
{
$test_result = 0;
break;
}
}
if($test_result == 1)
{
// if statements work & connection made, then check table existance
$db_exists = TableExists($ado,"ConfigurationAdmin,Category,Permissions");
if($db_exists != $db_must_exist)
{
$state = $error_state;
$db_error = $db_must_exist ? 'An In-Portal Database already exists at this location' : 'An In-Portal Database was not found at this location';
}
else
{
$state = $next_state;
if( isset($success_func) ) $success_func();
}
}
else
{
// user has insufficient permissions in database specified
$db_error = "Permission Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg();
$state = $error_state;
}
}
return $ado;
}
function SaveDBConfig()
{
// save new database configuration
set_ini_value("Database", "DBType",$_POST["ServerType"]);
set_ini_value("Database", "DBHost",$_POST["ServerHost"]);
set_ini_value("Database", "DBName",$_POST["ServerDB"]);
set_ini_value("Database", "DBUser",$_POST["ServerUser"]);
set_ini_value("Database", "DBUserPassword",$_POST["ServerPass"]);
set_ini_value("Database","TablePrefix",$_POST["TablePrefix"]);
save_values();
$GLOBALS['include_file'] = 'install/install_finish.php';
}
function ReSetVar($var)
{
// define varible if not defined before
if( !isset($GLOBALS[$var]) ) $GLOBALS[$var] = '';
}
// if globals.php not yet included (1st steps of install),
// then define GetVar function
if( !function_exists('GetVar') )
{
function GetVar($name, $post_priority = false)
{
if(!$post_priority) // follow gpc_order in php.ini
return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false;
else // get variable from post 1stly if not found then from get
return isset($_POST[$name]) && $_POST[$name] ? $_POST[$name] : ( isset($_GET[$name]) && $_GET[$name] ? $_GET[$name] : false );
}
}
function RadioChecked($name, $value)
{
// return " checked" word in case if radio is checked
$submit_value = GetVar($name);
return $submit_value == $value ? ' checked' : '';
}
?>
Property changes on: branches/unlabeled/unlabeled-1.20.4/admin/install/install_lib.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.20
\ No newline at end of property
+1.20.4.1
\ No newline at end of property

Event Timeline