Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 1, 8:05 PM

in-portal

Index: trunk/kernel/include/emailmessage.php
===================================================================
--- trunk/kernel/include/emailmessage.php (revision 314)
+++ trunk/kernel/include/emailmessage.php (revision 315)
@@ -1,923 +1,923 @@
<?php
class clsEmailMessage extends clsParsedItem
{
var $Event = "";
var $Item;
var $headers = array();
var $subject = "";
var $body = "";
var $TemplateParsed = FALSE;
var $recipient = NULL;
var $fromuser = NULL;
function clsEmailMessage($MessageId=NULL,$Item=NULL)
{
$this->clsParsedItem();
$this->tablename = GetTablePrefix()."EmailMessage";
$this->Item = $Item;
$this->BasePermission = "EMAIL";
$this->id_field = "EmailMessageId";
$this->TagPrefix = "email";
$this->NoResourceId=1;
if($MessageId)
$this->LoadFromDatabase($MessageId);
}
function LoadEvent($event,$language=NULL)
{
global $objConfig, $objLanguages;
if(!strlen($language))
$language = $objLanguages->GetPrimary();
$sql = "SELECT * FROM ".$this->tablename." WHERE EventId = $event AND LanguageId=$language";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$data = $rs->fields;
$this->SetFromArray($data);
$this->Clean();
return TRUE;
}
else
return FALSE;
}
function LoadFromDatabase($MessageId)
{
global $Errors;
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$MessageId);
$result = $this->adodbConnection->Execute($sql);
if ($result === FALSE)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return FALSE;
}
$data = $result->fields;
$this->SetFromArray($data);
return TRUE;
}
function EditTemplate()
{
}
/* read the template, split into peices */
function ReadTemplate()
{
if(!$this->TemplateParsed)
{
$this->headers = array();
$lines = explode("\n",$this->Get("Template"));
$header_end = FALSE;
$i = 0;
while(!$header_end && $i<count($lines))
{
$h = $lines[$i];
if(strlen(trim($h))==0 || ($h=="."))
{
$header_end = TRUE;
}
else
{
$parts = explode(":",$h,2);
if(strtolower($parts[0])=="subject")
{
$this->subject = $h;
}
else
$this->headers[] = $h;
}
$i++;
}
while($i<count($lines))
{
$this->body .= $lines[$i++];
}
$this->TemplateParsed=TRUE;
}
}
function ParseSection($text, $parser=null)
{
global $objUsers, $objTemplate;
$res = $this->ParseTemplateText($text);
/* parse email class tags */
if(!is_object($this->fromuser))
{
$this->fromuser = $objUsers->GetItem($this->Get("FromUserId"));
$this->fromuser->TagPrefix = "fromuser";
}
/* parse from user object */
if(is_object($this->fromuser))
{
$res = $this->fromuser->ParseTemplateText($res);
}
/* parse recipient user object */
if(is_object($this->recipient))
{
$res = $this->recipient->ParseTemplateText($res);
}
//print_pre($this->Item);
if(is_object($this->Item))
{
$res = $this->Item->ParseTemplateText($res);
}
else
{
if(!is_object($objTemplate))
$objTemplate = new clsTemplateList(" ");
$res = $objTemplate->ParseTemplateText($res);
}
return $res;
}
function SendToGroup($GroupId)
{
global $objUsers;
$users = $objUsers->Query_GroupPortalUser("GroupId=$GroupId");
if(is_array($users))
{
foreach($users as $u)
{
$this->SendToUser($u->Get("PortalUserId"));
}
}
}
function SendToAddress($EmailAddress,$name="")
{
global $objUsers, $objEmailQueue,$objConfig;
$conn = GetADODBConnection();
//$this->recipient = $objUsers->GetUser($UserId);
//$this->recipient->TagPrefix="touser";
if(strlen($EmailAddress))
{
$to_addr = $EmailAddress;
$this->ReadTemplate();
$subject = $this->ParseSection($this->subject);
$body = $this->ParseSection($this->body);
if(is_object($this->fromuser))
{
$FromAddr = $this->fromuser->Get("Email");
$FromName = trim($this->fromuser->Get("FirstName")." ".$this->fromuser->Get("LastName"));
}
if(!strlen($FromAddr))
{
$FromName = $objConfig->Get("Site_Name");
$FromAddr = $objConfig->Get("Smtp_AdminMailFrom");
}
$charset = "ascii-us";
if($this->Get("MessageType")=="html")
{
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,"",$body,$charset,NULL,$this->headers);
}
else
{
$body = nl2br($body);
$body = str_replace("<br />","\n",$body);
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,$body,"",$charset,NULL,$this->headers);
}
/*$time = time();
$sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '$FromName', '$To', '$subject', $time, '')";
$conn->Execute($sql); */
return TRUE;
}
return FALSE;
}
function SendToUser($UserId)
{
global $objUsers, $objEmailQueue, $objConfig;
$conn = GetADODBConnection();
//echo "Handling Event ".$this->Get("Event")." for user $UserId <br>\n";
$this->recipient = new clsPortalUser($UserId); // $objUsers->GetItem($UserId);
//echo "<PRE>";print_r($this->recipient); echo "</PRE>";
$this->recipient->TagPrefix="touser";
if($this->recipient->Get("PortalUserId")==$UserId)
{
$to_addr = $this->recipient->Get("Email");
$To = trim($this->recipient->Get("FirstName")." ".$this->recipient->Get("LastName"));
$this->ReadTemplate();
$subject = $this->ParseSection($this->subject, $this->recipient);
$body = $this->ParseSection($this->body);
if(!is_object($this->fromuser))
{
$this->fromuser = $objUsers->GetItem($this->Get("FromUserId"));
}
if(is_object($this->fromuser))
{
$FromAddr = $this->fromuser->Get("Email");
$FromName = trim($this->fromuser->Get("FirstName")." ".$this->fromuser->Get("LastName"));
$charset = "ascii-us";
}
if(!strlen($FromAddr))
{
$FromName = $objConfig->Get("Site_Name");
$FromAddr = $objConfig->Get("Smtp_AdminMailFrom");
}
if($this->Get("MessageType")=="html")
{
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,"",$body,$charset,NULL,$this->headers);
}
else
{
$body = nl2br($body);
$body = str_replace("<br />","\n",$body);
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,$body,"",$charset,NULL,$this->headers);
}
/*$time = time();
$sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '$FromName', '$To ($to_addr)', '$subject', $time, '')";
$conn->Execute($sql); */
return TRUE;
}
return FALSE;
}
function SendAdmin()
{
global $objUsers, $objConfig, $objEmailQueue;
$conn = GetADODBConnection();
$this->recipient = $objUsers->GetUser($this->Get("FromUserId"));
$this->recipient->TagPrefix="touser";
if($this->recipient->Get("PortalUserId")==$this->Get("FromUserId"))
{
$to_addr = $this->recipient->Get("Email");
$To = trim($this->recipient->Get("FirstName")." ".$this->recipient->Get("LastName"));
$this->ReadTemplate();
$subject = $this->ParseSection($this->subject);
$body = $this->ParseSection($this->body);
$FromName = "System Event";
$FromAddr = $objConfig->Get("Smtp_AdminMailFrom");
if(strlen($FromAddr))
{
$charset = "ascii-us";
if($this->Get("MessageType")=="html")
{
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,"",$body,$charset,NULL,$this->headers);
}
else
{
$body=nl2br($body);
$body = str_replace("<br />","\n",$body);
$objEmailQueue->SendMail($FromAddr,$FromName,$to_addr,$To,$subject,$body,"",$charset,NULL,$this->headers);
}
/* $time = time();
$sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '$FromName', '$To ($to_addr)', '$subject', $time, '')";
$conn->Execute($sql);
*/
return TRUE;
}
}
return FALSE;
}
function ParseTemplateText($text)
{
$html = $text;
$search = "<inp:".$this->TagPrefix;
$next_tag = strpos($html,"<inp:");
//$next_tag = strpos($html,$search);
while($next_tag)
{
$closer = strpos(strtolower($html),">",$next_tag);
$end_tag = strpos($html,"/>",$next_tag);
if($end_tag < $closer || $closer == 0)
{
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+2);
$pre = substr($html,0,$next_tag);
$post = substr($html,$end_tag+2);
$inner = $this->ParseElement($tagtext);
$html = $pre.$inner.$post;
}
else
{
$OldTagStyle = "</inp>";
## Try to find end of TagName
$TagNameEnd = strpos($html, " ", $next_tag);
## Support Old version
// $closer = strpos(strtolower($html),"</inp>",$next_tag);
if ($TagNameEnd)
{
$Tag = strtolower(substr($html, $next_tag, $TagNameEnd-$next_tag));
$TagName = explode(":", $Tag);
if (strlen($TagName[1]))
$CloserTag = "</inp:".$TagName[1].">";
}
else
{
$CloserTag = $OldTagStyle;
}
$closer = strpos(strtolower($html), $CloserTag, $next_tag);
## Try to find old tag closer
if (!$closer && ($CloserTag != $OldTagStyle))
{
$CloserTag = $OldTagStyle;
$closer = strpos(strtolower($html), $CloserTag, $next_tag);
}
$end_tag = strpos($html,">",$next_tag);
$tagtext = substr($html,$next_tag,($end_tag - $next_tag)+1);
$pre = substr($html,0,$next_tag);
$inner = substr($html,$end_tag+1,$closer-($end_tag+1));
$post = substr($html,$end_tag+1+strlen($inner) + strlen($CloserTag));
//echo "PRE:". htmlentities($pre,ENT_NOQUOTES);
//echo "INNER:". htmlentities($inner,ENT_NOQUOTES);
//echo "POST:". htmlentities($post,ENT_NOQUOTES);
$parsed = $this->ParseElement($tagtext);
if(strlen($parsed))
{
$html = $pre.$this->ParseTemplateText($inner).$post;
}
else
$html = $pre.$post;
}
$next_tag = strpos($html,$search);
}
return $html;
}
function ParseElement($raw, $inner_html ="")
{
$tag = new clsHtmlTag($raw);
$tag->inner_html = $inner_html;
if($tag->parsed)
{
if($tag->name=="include" || $tag->name=="perm_include" || $tag->name=="lang_include")
{
$output = $this->Parser->IncludeTemplate($tag);
}
else
{
if (is_object($this->Item)) {
$output = $this->Item->ParseObject($tag);
}
else {
$output = $this->ParseObject($tag);
}
//echo $output."<br>";
if(substr($output,0,9)=="Undefined")
{
$output = $tag->Execute();
// if(substr($output,0,8)="{Unknown")
// $output = $raw;
} return $output;
}
}
else
return "";
}
}
class clsEmailMessageList extends clsItemCollection
{
function clsEmailMessageList()
{
$this->clsItemCollection();
$this->classname = "clsEmailMessage";
$this->SourceTable = GetTablePrefix()."EmailMessage";
$this->PerPageVar = "Perpage_EmailEvents";
$this->AdminSearchFields = array("Template","Description", "Module","Event");
}
function LoadLanguage($LangId=NULL)
{
global $objLanguages;
if(!$LangId)
$LangId = $objLanguages->GetPrimary();
$sql = "SELECT * FROM ".$this->SourceTable." WHERE LanguageId=$LangId";
$this->Clear();
return $this->Query_Item($sql);
}
function &GetMessage($EventId,$LangId,$LoadFromDB=TRUE)
{
$found=FALSE;
if(is_array($this->Items))
{
for($x=0;$x<count($this->Items);$x++)
{
$i =& $this->GetItemRefByIndex($x);
if(is_object($i))
{
if($i->Get("EventId")==$EventId && $i->Get("LanguageId")==$LangId)
{
$found=TRUE;
break;
}
}
}
}
if(!$found)
{
if($LoadFromDB)
{
$n = NULL;
$n = new $this->classname();
$n->tablename = $this->SourceTable;
if($n->LoadEvent($EventId,$LangId))
{
array_push($this->Items, $n);
$i =& $this->Items[count($this->Items)-1];
}
else
$i = FALSE;
}
else
$i = FALSE;
}
return $i;
}
function CreateEmptyEditTable($IdList)
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
$query = "SELECT * FROM ".$this->SourceTable." WHERE $idfield = -1";
$insert = "CREATE TABLE ".$edit_table." ".$query;
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($insert,ENT_NOQUOTES)."<br>\n";
$this->adodbConnection->Execute($insert);
$this->LoadLanguage();
$idvalue = -1;
for($i=0;$i<$this->NumItems();$i++)
{
$e =& $this->Items[$i];
$e->SourceTable = $edit_table;
if(is_array($IdList))
{
foreach($IdList as $id)
{
$e->UnsetIdField();
$e->Set("EmailMessageId",$idvalue--);
$e->Set("LanguageId",$id);
$e->Set("Description",admin_language("la_desc_emailevent_".$e->Get("Event"),$id));
$e->Create();
}
}
else
{
$e->UnsetIdField();
$e->Set("EmailMessageId",$idvalue--);
$e->Set("LanguageId",$IdList);
$e->Set("Description",admin_language("la_desc_emailevent_".$e->Get("Event"),$LangId));
$e->Create();
}
}
$this->Clear();
}
function CopyFromEditTable()
{
global $objSession;
$idfield = "EmailMessageId";
$edit_table = $objSession->GetEditTable($this->SourceTable);
$sql = "SELECT * FROM $edit_table";
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = new $this->classname;
$c->SetFromArray($data);
//$c->idfield = $idfield;
if($c->Get($idfield)<1)
{
$old_id = $c->Get($idfield);
$c->Dirty();
$c->UnsetIdField();
$c->Create();
}
else
{
$c->Dirty();
$c->Update();
}
$rs->MoveNext();
}
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
function PurgeEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
@$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
function &GetEmailEventObject($EventName,$Type=0,$LangId=NULL)
{
global $objLanguages;
if(!$LangId)
$LangId = $objLanguages->GetPrimary();
$EmailTable = $this->SourceTable;
$EventTable = GetTablePrefix()."Events";
$sql = "SELECT * FROM $EventTable INNER JOIN $EmailTable ON ($EventTable.EventId = $EmailTable.EventId) ";
$sql .="WHERE Event='$EventName' AND LanguageId=$LangId AND Type=$Type";
$result = $this->adodbConnection->Execute($sql);
if ($result === FALSE)
{
//$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"","clsEvent","GetEmailEventObject");
return FALSE;
}
$data = $result->fields;
$e = new clsEmailMessage();
$e->SetFromArray($data);
$e->Clean();
return $e;
}
- function ReadImportTable($TableName,$Overwite=FALSE, $MaxInserts=100,$Offset=0)
+ function ReadImportTable($TableName,$Overwrite=FALSE, $MaxInserts=100,$Offset=0)
{
$eml = new clsEmailMessageList();
$this->Clear();
$Inserts = 0;
$sql = "SELECT * FROM $TableName LIMIT $Offset,$MaxInserts";
$this->Query_Item($sql);
if($this->NumItems()>0)
{
foreach($this->Items as $i)
{
$e = $eml->GetMessage($i->Get("EventId"),$i->Get("LanguageId"));
if(is_object($e))
{
if($Overwrite)
{
$e->Set("MessageType",$i->Get("MessageType"));
$e->Set("Template",$i->Get("Template"));
$e->Update();
}
}
else
{
$i->Create();
}
$Inserts++;
}
}
$Offset = $Offset + $Inserts;
return $Offset;
}
}
function EventEnabled($e)
{
global $objConfig;
$var = "Email_".$e."_Enabled";
return ($objConfig->Get($var)=="1");
}
class clsEmailQueue
{
var $SourceTable;
var $MessagesAtOnce;
var $MessagesSent=0;
var $LogLevel = 0;
function clsEmailQueue($SourceTable=NULL,$MessagesAtOnce=NULL)
{
global $objConfig;
if($SourceTable)
{
$this->SourceTable=$SourceTable;
}
else
$this->SourceTable = GetTablePrefix()."EmailQueue";
if(!$MessagesAtOnce)
$MessagesAtOnce = (int)$objConfig->Get("Email_MaxSend");
if($MessagesAtOnce<1)
$MessagesAtOnce=1;
$this->MessagesAtOnce = $MessagesAtOnce;
$this->LogLevel = (int)$objConfig->Get("Smtp_LogLevel");
}
function WriteToMailLog($text)
{
global $pathtoroot,$admin;
//echo htmlentities($text)."<br>\n";
if($this->LogLevel>0)
{
$Logfile = $pathtoroot.$admin."/email/log.txt";
if(is_writable($Logfile))
{
$fp = fopen($Logfile,"a");
if($fp)
{
fputs($fp,$text."\n");
fclose($fp);
}
}
}
}
function AllowSockets()
{
$minver = explode(".", "4.3.0");
$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 DeliverMail($To,$From,$Subject,$Msg,$headers, $ForceSend=0)
{
global $MessagesSent,$objConfig;
if(($this->MessagesSent >$this->MessagesAtOnce) && !$ForceSend)
{
$this->EnqueueMail($To,$From,$Subject,$Msg,$headers);
return TRUE;
}
else
{
$this->MessagesSent++;
$time = time();
$conn = GetADODBConnection();
/* $sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '".htmlspecialchars($From)."', '".htmlspecialchars($To)."', '$Subject', $time, '')";
$conn->Execute($sql);*/
/* ensure headers are using \r\n instead of \n */
//$headers = str_replace("\r\n","\n",$headers);
//$headers = str_replace("\n","\r\n",$headers);
$headers = "Date: ".date("r")."\n".$headers;
$headers = "Return-Path: ".$objConfig->Get("Smtp_AdminMailFrom")."\n".$headers;
//$Msg = str_replace("\r\n","\n",$Msg);
//$Msg = str_replace("\n","\r\n",$Msg);
//echo "<PRE>"; print_r(htmlentities($headers)); echo "</PRE>";
//echo "<PRE>"; print_r(htmlentities($Msg)); echo "</PRE>";
$ver = phpversion();
if(substr($Subject,0,9)=="Subject: ")
$Subject = substr($Subject,9);
if(!strlen($objConfig->Get("Smtp_Server")) || !$this->AllowSockets())
{
return mail($To,trim($Subject),$Msg, $headers);
}
$headers = "Subject: ".trim($Subject)."\r\n".$headers;
$send_params['recipients'] = array($To); // The recipients (can be multiple)
$send_params['headers'] = explode("\r\n",$headers);
$send_params['from'] = $From; // This is used as in the MAIL FROM: cmd
// It should end up as the Return-Path: header
$send_params['body'] = $Msg; // The body of the email
$params['host'] = $objConfig->Get("Smtp_Server"); // The smtp server host/ip
$params['port'] = 25; // The smtp server port
$params['helo'] = 'INPORTAL'; // What to use when sending the helo command. Typically, your domain/hostname
if($objConfig->Get("Smtp_Authenticate")) // Whether to use basic authentication or not
{
$params['auth'] = TRUE;
$params['user'] = $objConfig->Get("Smtp_User");
$params['pass'] = $objConfig->get("Smtp_Pass");
}
else
$params['auth'] = FALSE;
$this->LogLevel=0;
$SmtpServer = new smtp($params);
if($this->LogLevel>0)
{
$SmtpServer->debug=1;
foreach($params as $key=>$value)
{
$this->WriteToMailLog($key."=".$value);
}
}
else
$SmtpServer->debug = 0;
$connected = $SmtpServer->connect();
if($connected)
{
if($this->LogLevel>1)
{
$this->WriteToMailLog("Connected to ".$params['host']);
}
$res = $SmtpServer->send($send_params);
}
$SmtpServer->disconnect();
if($this->LogLevel>1)
{
foreach($SmtpServer->buffer as $l)
{
$this->WriteToMailLog($l);
}
}
if($this->LogLevel>0)
{
if(count($SmtpServer->errors)>0)
{
foreach($SmtpServer->errors as $e)
{
$this->WriteToMailLog($e);
}
}
else
$this->WriteToMailLog("Message to $From Delivered Successfully");
}
unset($SmtpServer);
return $res;
}
}
function EnqueueMail($To,$From,$Subject,$Msg,$headers)
{
global $objSession;
$ado = GetADODBConnection();
$To = mysql_escape_string($To);
$From = mysql_escape_string($From);
$Msg = mysql_escape_string($Msg);
$headers = mysql_escape_string($headers);
$Subject = mysql_escape_string($Subject);
$sql = "INSERT INTO ".$this->SourceTable." (toaddr,fromaddr,subject,message,headers) VALUES ('$To','$From','$Subject','$Msg','$headers')";
$ado->Execute($sql);
}
function SendMailQeue()
{
global $objConfig, $objSession, $TotalMessagesSent;
$ado = GetADODBConnection();
$MaxAllowed = $this->MessagesAtOnce;
$del_sql = array();
$NumToSend = $MaxAllowed - $this->MessagesSent;
$sql = "SELECT * FROM ".$this->SourceTable." ORDER BY queued ASC LIMIT $NumToSend";
$rs = $ado->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$this->DeliverMail($data["toaddr"],$data["fromaddr"],$data["Subject"],$data["headers"],$data["message"],1);
$del_sql[] = "DELETE FROM ".$this->SourceTable." WHERE queued=".$data["queued"];
$rs->MoveNext();
}
$numdel = count($del_sql);
for($i=0;$i<$numdel;$i++)
{
$sql = $del_sql[$i];
if(strlen($sql))
$ado->Execute($sql);
if($objSession->HasSystemPermission("DEBUG.ITEM"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
}
}
function SendMail($From, $FromName, $ToAddr, $ToName, $Subject, $Text, $Html, $charset,
$FileName="",$FileLoc="",$QueueOnly=0,$extra_headers = array())
{
$HasFile = FALSE;
$HasFile = (strlen($FileName)>0);
$OB="----=_OuterBoundary_000";
$boundary = "-----=".md5( uniqid (rand()));
$f = "\"$FromName\" <".$From.">";
$headers = "From: $f\n";
$headers .= "MIME-Version: 1.0\n";
$conn = GetADODBConnection();
$time = time();
$sql = "INSERT INTO ".GetTablePrefix()."EmailLog VALUES ('', '$FromName', '$ToName ($ToAddr)', '$Subject', $time, '')";
$conn->Execute($sql);
if($HasFile)
{
//Messages start with text/html alternatives in OB
$headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n\n";
$msg.="--".$OB."\n";
$msg.="Content-Type: multipart/alternative; boundary=\"$boundary\"\n\n";
}
else
$headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"";
if(is_array($extra_headers))
{
for($i=0;$i<count($extra_headers);$i++);
{
$headers .= $extra_headers[$i]."\n";
}
}
$msg .="This is a multi-part message in MIME format.\n\n";
$msg .= "--" . $boundary . "\n";
$msg .= "Content-Type: text/plain; charset=\"$charset\"\r\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n";
$msg .= stripslashes($Text);
$msg .= "\r\n\r\n";
if(strlen($Html)>0)
{
$msg .= "--" . $boundary . "\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= stripslashes($Html);
$msg .= "\r\n\r\n";
}
$msg .= "--" . $boundary . "--\n";
if($HasFile)
{
if(!strlen($FileLoc))
$FileLoc = $FileName;
$FileName = basename($FileName);
$msg .= "\n--".$OB."\n";
$msg.="Content-Type: application/octetstream;\n\tname=\"".$FileName."\"\r\n";
$msg.="Content-Transfer-Encoding: base64\n";
$msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\r\n\r\n";
//file goes here
$fd=fopen ($FileLoc, "r");
if($fd)
{
$FileContent=fread($fd,filesize($FileLoc));
fclose ($fd);
}
$FileContent=chunk_split(base64_encode($FileContent));
$msg.=$FileContent;
$msg .= "--".$OB."\n";
}
if(strlen($ToName)>0)
{
$To = "\"$ToName\" <$ToAddr>";
}
else
$To = "<".$ToAddr.">";
//$headers.="To: $To\r\n";
if($this->MessagesSent>$this->MessagesAtOnce || $QueueOnly==1)
{
$this->EnqueueMail($To,$f,$Subject,$msg,$headers);
}
else
{
$this->DeliverMail($To,$f,$Subject,$msg,$headers);
}
}
}
?>
Property changes on: trunk/kernel/include/emailmessage.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.26
\ No newline at end of property
+1.27
\ No newline at end of property
Index: trunk/kernel/include/modules.php
===================================================================
--- trunk/kernel/include/modules.php (revision 314)
+++ trunk/kernel/include/modules.php (revision 315)
@@ -1,904 +1,906 @@
<?php
/* List of installed modules and module-specific variables
Copyright 2002, Intechnic Corporation, All rights reserved
*/
setcookie("CookiesTest", "1");
+// if branches that uses if($mod_prefix) or like that will never be executed
+// due global variable $mod_prefix is never defined
+
$ExtraVars = array();
function ParseEnv()
{
global $env, $var_list, $mod_prefix,$objSession, $SessionQueryString;
/* parse individual sections */
$env = isset($_GET['env']) ? $_GET['env'] : '';
if ($env == "")
{
$var_list["t"] = "index";
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parser_name = $key . "_ParseEnv";
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
}
else
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
$parser_name = $key . "_ParseEnv";
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
if(!$parsed)
{
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
$req_vars = explode("-", $envsections[0]);
$sid = $req_vars[0];
if(!$SessionQueryString)
{
if(!strlen($sid) || $sid=="_")
{
if($sid != "_")
$sid = $_COOKIE["sid"];
}
else
$SessionQueryString = TRUE;
}
$var_list["sid"] = $sid;
$var_list["t"] = $req_vars[1];
if( isset($_GET['dest']) )
$var_list['dest'] = $_GET['dest'];
}
}
function LoadEnv()
{
global $env, $var_list, $mod_prefix,$objSession;
$env = $_GET["env"];
// echo "Loading Variables..<br>\n";
if ($env != "")
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
break;
}
}
if(!$parsed)
{
$parser_name = $key . "_LoadEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name();
}
}
else
{
$parser_name = $key . "_SaveEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
}
}
}
function BuildEnv($mod_prefix = false)
{
global $var_list,$m_var_list, $var_list_update, $mod_prefix, $objSession, $objConfig,
$ExtraVars, $objThemes, $CurrentTheme, $SessionQueryString, $FrontEnd;
static $theme;
$env = "";
//echo "Query String: $SessionQueryString<br>\n";
if(($objConfig->Get("CookieSessions")==0 || !$FrontEnd || ($objConfig->Get("CookieSessions")==2 && $SessionQueryString==TRUE)))
{
if(!$objSession->UseTempKeys)
{
$sessionkey = $objSession->GetSessionKey();
}
else
$sessionkey = $objSession->Get("CurrentTempKey");
$env = $sessionkey;
}
$env .= "-";
if (isset($var_list_update["t"]))
{
if($var_list_update["t"]=="_referer_")
{
$var_list_update["t"] =$objSession->GetVariable("Template_Referer");
}
$t = $var_list_update["t"];
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$var_list_update["t"] = $id;
}
$env .= $var_list_update["t"];
}
else
{
- $t = $var_list["t"];
+ $t = isset($var_list['t']) ? $var_list['t'] : '';
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$t = $id;
}
$env .= $t;
}
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$builder_name = $key . "_BuildEnv";
if(function_exists($builder_name))
{
$GLOBALS[$key.'_var_list_update']['test'] = 'test';
$env .= $builder_name();
}
}
}
$extra = "";
$keys = array_keys($ExtraVars);
if(is_array($keys))
{
for($i=0;$i<count($keys);$i++)
{
$key = $keys[$i];
$e = "&".$key."=".$ExtraVars[$key];
$extra .= $e;
$e = "";
}
}
$env .= $extra;
return $env;
}
function CategoryActionFunc($basename,$CatList)
{
global $mod_prefix;
foreach($mod_prefix as $key => $value)
{
$function_name = $key."_".$basename;
if(function_exists($function_name))
{
$function_name($CatList);
}
}
}
function RegisterEnv($Var,$Value)
{
global $ExtraVars;
$ExtraVars[$Var] = $Value;
}
function UnregisterEnv($Var)
{
global $ExtraVars;
unset($ExtraVars[$Var]);
}
function ModuleTagPrefix($name)
{
global $modules_loaded;
$ret = "";
foreach($modules_loaded as $prefix=>$mod_name)
{
if($name==$mod_name)
{
$ret = $prefix;
break;
}
}
return $ret;
}
function ModuleEnabled($name)
{
global $template_path;
$a = array_keys($template_path);
if(in_array($name,$a))
return TRUE;
return FALSE;
}
function GetModuleArray($array_name="mod_prefix")
{
switch($array_name)
{
case "mod_prefix":
global $mod_prefix;
return $mod_prefix;
break;
case "admin":
global $mod_prefix, $modules_loaded;
$mod = array();
if(is_array($mod_prefix) && is_array($modules_loaded))
{
foreach ($mod_prefix as $key=>$value)
{
if(_ModuleLicensed($modules_loaded[$key]) || $key=="m")
{
$mod[$key] = $value;
}
}
}
return $mod;
break;
case "loaded":
global $modules_loaded;
return $modules_loaded;
break;
case "template":
global $template_path;
return $template_path;
case "rootcat":
global $mod_root_cats;
return $mod_root_cats;
break;
}
}
function admin_login()
{
global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny;
//echo "<pre>"; print_r($objSession); echo "</pre>";
if( GetVar('help_usage') == 'install' ) return true;
$env_arr = explode('-', $_GET['env']);
$get_session_key = $env_arr[0];
$admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; // $_POST['adminlogin'] != 1
if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) {
if( isset($_GET['expired']) && ($_GET['expired'] == 1) )
$login_error = admin_language("la_text_sess_expired");
return FALSE;
//echo "Expired<br>";
}
if ($objSession->HasSystemPermission("ADMIN") == 1)
return TRUE;
if(count($_POST)==0 || $_POST["adminlogin"]!=1)
return FALSE;
$login=$_POST["login"];
$password = $_POST["password"];
if (strlen($login) && strlen($password))
{
if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny))
{
$login_error = admin_language("la_text_address_denied");
return FALSE;
}
$valid = $objSession->Login($login, md5($password));
$hasperm = ($objSession->HasSystemPermission("ADMIN") == 1);
if (($login=="root" || $hasperm) && $valid)
{
if(_ValidateModules())
{
return TRUE;
}
else
$login_error = "Missing or invalid In-Portal License";
}
else
{
if(!$hasperm && $valid)
{
$login_error = admin_language("la_text_nopermissions");
}
else
{
$login_error = admin_language("la_Text_Access_Denied");
}
return FALSE;
}
}
else
{
if(!strlen($login))
{
$login_error = admin_language("la_Text_Missing_Username");
}
else
if(!strlen($password))
$login_error = admin_language("la_Text_Missing_Password");
return FALSE;
}
}
#---------------------------------------------------------------------------
function _EnableCookieSID()
{
global $var_list, $objConfig;
if((!$_COOKIE["sid"] && $objConfig->Get("CookieSessions")>0 && strlen($var_list["sid"])<2 && !headers_sent())
|| strlen($_COOKIE["sid"])>0)
{
return TRUE;
}
else
return FALSE;
}
function _IsSpider($UserAgent)
{
global $robots, $pathtoroot;
$lines = file($pathtoroot."robots_list.txt");
if(!is_array($robots))
{
$robots = array();
for($i=0;$i<count($lines);$i++)
{
$l = $lines[$i];
$p = explode("\t",$l,3);
$robots[] = $p[2];
}
}
return in_array($UserAgent,$robots);
}
function _StripDomainHost($d)
{
$dotcount = substr_count($d,".");
if($dotcount==3)
{
$IsIp = TRUE;
for($x=0;$x<strlen($d);$x++)
{
if(!is_numeric(substr($d,$x,1)) && substr($d,$x,1)!=".")
{
$IsIp = FALSE;
break;
}
}
}
if($dotcount>1 && !$IsIp)
{
$p = explode(".",$d);
$ret = $p[count($p)-2].".".$p[count($p)-1];
}
else
$ret = $d;
return $ret;
}
function _MatchIp($ip1,$ip2)
{
$matched = TRUE;
$ip = explode(".",$ip1);
$MatchIp = explode(".",$ip2);
for($i=0;$i<count($ip);$i++)
{
if($i==count($MatchIp))
break;
if(trim($ip[$i]) != trim($MatchIp[$i]) || trim($ip[$i])=="*")
{
$matched=FALSE;
break;
}
}
return $matched;
}
function _IpAccess($IpAddress,$AllowList,$DenyList)
{
$allowed = explode(",",$AllowList);
$denied = explode(",",$DenyList);
$MatchAllowed = FALSE;
for($x=0;$x<count($allowed);$x++)
{
$ip = explode(".",$allowed[$x]);
$MatchAllowed = _MatchIp($IpAddress,$allowed[$x]);
if($MatchAllowed)
break;
}
$MatchDenied = FALSE;
for($x=0;$x<count($denied);$x++)
{
$ip = explode(".",$denied[$x]);
$MatchDenied = _MatchIp($IpAddress,$denied[$x]);
if($MatchDenied)
break;
}
$Result = (($MatchAllowed && !$MatchDenied) || (!$MatchAllowed && !$MatchDenied) ||
($MatchAllowed && $MatchDenied));
return $Result;
}
function _ValidateModules()
{
global $i_Keys, $objConfig, $g_License;
$lic = base64_decode($g_License);
_ParseLicense($lic);
$modules = array();
//echo "License: ".$lic."<br>";
$domain = _GetDomain();
//echo "Domain: ".$domain."<br>";
if(!_IsLocalSite($domain))
{
$domain = _StripDomainHost($domain);
//echo "New domain: $domain<br>";
// echo "<pre>"; print_r($i_Keys); echo "</pre>";
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr($key["domain"],$domain)))
{
$modules = explode(",",$key["mod"]);
//echo "Modules: $modules";
}
}
if(count($modules)>0)
{
return TRUE;
}
}
else
return TRUE;
return FALSE;
}
function _ModuleLicensed($name)
{
global $i_Keys, $objConfig, $pathtoroot;
$vars = parse_portal_ini($pathtoroot."config.php");
+ // globalize vars from config
while($key = key($vars))
{
- $key = "g_".$key;
- global $$key;
- $$key = current($vars); //variable variables
- if(strlen($$key)>80)
- {
- $lic = base64_decode($$key);
- }
+ $GLOBALS["g_".$key] = current($vars);
next($vars);
}
- //$lic = base64_decode($g_License);
+ $lic = base64_decode($GLOBALS['g_License']); // this works in all cases
+
_ParseLicense($lic);
$modules = array();
if(!_IsLocalSite(_GetDomain()))
{
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr(_GetDomain(),$key["domain"])))
{
//echo "ok<br>";
$modules = explode(",",$key["mod"]);
}
}
if(in_array($name,$modules)) {
//echo "ok<br>";
return TRUE;
}
}
else {
return TRUE;
}
return FALSE;
}
function _GetDomain()
{
global $objConfig, $g_Domain;
if($objConfig->Get("DomainDetect"))
{
$d = $_SERVER['HTTP_HOST'];
}
else
$d = $g_Domain;
return $d;
}
function _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 _decrypt($txt,$key)
{
$txt = _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 LoadFromRemote()
{
return "";
}
function DLid()
{
global $lid;
echo $lid."\n";
die();
}
function _LoadLicense($LoadRemote=FALSE)
{
global $pathtoroot, $objConfig;
$f = $pathtoroot."intechnic.php";
if(file_exists($f))
{
$contents = file($f);
$data = base64_decode($contents[1]);
}
else
if($LoadRemote)
return $LoadFromRemote;
return $data;
}
function _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 _ParseLicense($txt)
{
global $i_User, $i_Pswd, $i_Keys;
$data = _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(_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 _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;
}
if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" ||
substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0)
{
return TRUE;
}
return FALSE;
}
//echo "Before Stuff<br>";
LogEntry("Loading Modules\n");
/* get the module list from the database */
$adodbConnection = GetADODBConnection();
$sql = "SELECT Name, Path, Var,TemplatePath, RootCat from ".GetTablePrefix()."Modules where Loaded=1 ORDER BY LoadOrder";
$rs = $adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$key = $rs->fields["Var"];
$mod_prefix[$key] = $rs->fields["Path"];
$modules_loaded[$key] = $rs->fields["Name"];
$name = $rs->fields["Name"];
$template_path[$name] = $rs->fields["TemplatePath"];
$mod_root_cats[$name] = $rs->fields["RootCat"];
// echo $key . "=". $modules_loaded[$key]."<br>\n";
$rs->MoveNext();
}
LogEntry("Loading Module Parser scripts\n");
/* for each module enabled, load up parser.php */
//foreach($mod_prefix as $key => $value)
$LogLevel++;
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$mod = $pathtoroot . $value . "parser.php";
// LogEntry("Loading parser $mod \n");
require_once($mod);
}
}
$LogLevel--;
LogEntry("Finished Loading Module Parser scripts\n");
/*now each module gets a look at the environment string */
$SessionQueryString = FALSE;
if(!isset($FrontEnd)) $FrontEnd = false;
if($FrontEnd != 1)
$SessionQueryString = TRUE;
if(is_array($mod_prefix))
ParseEnv();
/* create the session object */
$ip = $_SERVER["REMOTE_ADDR"];
if ( !isset($var_list['sid']) ) $var_list['sid'] = '';
if ( !isset($_GET['env']) ) $_GET['env'] = '';
if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==2)
{
if(_IsSpider($_SERVER["HTTP_USER_AGENT"]))
{
$UseSession = FALSE;
}
else
{
/* switch user to GET session var */
if (!$_COOKIE['sid']) {
$SessionQueryString = TRUE;
}
//else {
//$SessionQueryString = FALSE;
//}
$UseSession = TRUE;
}
}
else {
$UseSession = TRUE;
}
if($var_list["sid"]=="_")
$var_list["sid"]="";
/*setup action variable*/
$Action = isset($_REQUEST['Action']) ? $_REQUEST['Action'] : '';
if($Action=="m_logout")
{
$u = new clsUserSession($var_list["sid"] ,($SessionQueryString && $FrontEnd==1));
$u->Logout();
unset($u);
$var_list_update["t"] = "index";
$var_list["t"] = "";
$var_list["sid"]="";
setcookie("login","",time()-3600);
setcookie("sid","",time()-3600);
}
$CookieTest = isset($_COOKIE["CookiesTest"]) ? $_COOKIE["CookiesTest"] : '';
$HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if ( ($CookieTest == 1) || !strstr($HTTP_REFERER, $_SERVER['SERVER_NAME'].$objConfig->Get("Site_Path"))) {
$SessionQueryString = FALSE;
}
if ($FrontEnd != 1) {
$SessionQueryString = TRUE;
}
$objSession = new clsUserSession($var_list["sid"],($SessionQueryString && $FrontEnd==1));
if($UseSession)
{
if(!$objSession->ValidSession())
{
/* Get rid of Invalid Session and make a brand new one*/
// echo "Dumping Session ".$var_list["sid"]."<br>";
unset($var_list["sid"]);
$objSession->GetNewSession();
$var_list["sid"] = $objSession->GetSessionKey();
$var_list_update["sid"]=$objSession->GetSessionKey();
if(is_numeric($m_var_list["theme"]))
$objSession->SetThemeName($m_var_list["theme"]);
if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent())
setcookie("sid",$var_list["sid"]);
//echo "New Session: ".$objSession->GetSessionKey()."<br>\n";
if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1)
{
$parts = explode("|",$_COOKIE["login"]);
$username = $parts[0];
$pass = $parts[1];
$objSession->Login($username,$pass);
}
}
else
{ //echo "Update Session<br>";
if($objSession->Get("Language")!=$m_var_list["lang"])
{
$objSession->Set("Language",$m_var_list["lang"]);
}
$objSession->LoadSessionData();
$objSession->UpdateAccessTime();
$objSession->Update();
LoadEnv();
}
}
-if(is_numeric($var_list["t"]))
+if( isset($var_list['t']) && is_numeric($var_list['t']))
{
if( !isset($CurrentTheme) ) $CurrentTheme = null;
if(!is_object($CurrentTheme))
$CurrentTheme = $objThemes->GetItem($m_var_list["theme"]);
$var_list["t"] = $CurrentTheme->GetTemplateById($var_list["t"]);
$objSession->Set("Theme",$CurrentTheme->Get("Name"));
}
/*create the global current user object */
$UserID=$objSession->Get("PortalUserId");
$objCurrentUser = new clsPortalUser($UserID);
$objLanguageCache = new clsLanguageCache($m_var_list["lang"]);
/* include each module's action.php script */
LogEntry("Loading Module action scripts\n");
## Global Referer Template
-$_local_t = $var_list["t"];
+$_local_t = isset($var_list['t']) ? $var_list['t'] : '';
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $folder_name)
{
if($FrontEnd==0 || !is_numeric($FrontEnd) || $FrontEnd==2)
{
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if( !strlen($admin) ) $admin = "admin";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
+
if(_ModuleLicensed($modules_loaded[$key]))
{
$mod = $pathtoroot.$folder_name."module_init.php";
if( file_exists($mod) ) require_once($mod);
$mod = $pathtoroot.$folder_name."action.php";
if( file_exists($mod) ) require_once($mod);
$mod = $pathtoroot.$folder_name."searchaction.php";
if( file_exists($mod) ) require_once($mod);
+
}
+
}
if($FrontEnd==1 || $FrontEnd==2)
{
$mod = $pathtoroot.$folder_name."module_init.php";
if(file_exists($mod))
require_once($mod);
$mod = $pathtoroot.$folder_name."frontaction.php";
if(file_exists($mod))
require_once($mod);
}
}
}
if (strstr($_SERVER['SCRIPT_NAME'], 'install')) {
$objSession->Delete();
}
if( !isset($SearchPerformed) ) $SearchPerformed = false;
if($SearchPerformed == true) $objSearch->BuildIndexes();
LogEntry("Finished Loading Module action scripts\n");
?>
Property changes on: trunk/kernel/include/modules.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.12
\ No newline at end of property
+1.13
\ No newline at end of property
Index: trunk/kernel/include/theme.php
===================================================================
--- trunk/kernel/include/theme.php (revision 314)
+++ trunk/kernel/include/theme.php (revision 315)
@@ -1,735 +1,735 @@
<?php
define('THEME_ERROR_1', 'Theme folder not writable');
define('THEME_ERROR_2', 'Template File Not Found');
class clsThemeFile extends clsItem
{
var $Contents;
var $Root;
var $Errors = Array(); // global template error messages (not db related)
function clsThemeFile($id=NULL)
{
$this->clsItem();
$this->tablename = GetTablePrefix()."ThemeFiles";
$this->id_field = "FileId";
$this->NoResourceId=1;
$this->Root = "";
$this->Contents = '';
if($id) $this->LoadFromDatabase($id);
}
function ThemeRoot()
{
if( !$this->Root )
{
$t = new clsTheme( $this->Get("ThemeId") );
$this->Root = $t->Get("Name");
}
return $this->Root;
}
function FullPath()
{
// need to rewrite (by Alex)
global $objConfig, $pathchar,$pathtoroot;
$path = $pathtoroot."themes".$pathchar.$this->ThemeRoot();
if(strlen(trim($this->Get("FilePath"))))
$path .= $pathchar.$this->Get("FilePath");
$path .= $pathchar.$this->Get("FileName");
//echo "Full Path is $path <br>\n";
return str_replace('//','/',$path);
}
function Get($name)
{
if($name == 'Contents')
return $this->Contents;
else
return parent::Get($name);
}
function Set($name, $value)
{
if( !is_array($name) )
{
$name = Array($name);
$value = Array($value);
}
$i = 0; $field_count = count($name);
while($i < $field_count)
{
if($name[$i] == 'Contents')
$this->Contents = $value[$i];
else
parent::Set($name[$i], $value[$i]);
$i++;
}
}
/*
function LoadFromDatabase($Id)
{
global $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
$this->SetFromArray($data);
$this->Clean();
return true;
}
*/
function Delete()
{
$path = $this->FullPath();
if($this->debuglevel) echo "Trying to delete file [$path]<br>";
if( file_exists($path) ) @unlink($path);
parent::Delete();
}
function LoadFileContents($want_return = true)
{
global $objConfig,$pathchar;
$this->Contents = '';
$path = $this->FullPath();
if( file_exists($path) )
$this->Contents = file_get_contents($path);
else
$this->SetError(THEME_ERROR_2, 2); // template not found
if($want_return) return $this->Contents;
}
function SetError($msg, $code, $field = 'global_error')
{
$this->Errors[$field]['msg'] = $msg;
$this->Errors[$field]['code'] = $code;
}
function HasError()
{
return count($this->Errors) ? 1 : 0;
}
function ErrorMsg()
{
return $this->Errors['global_error']['msg'];
}
function SaveFileContents($filecontents, $new_file = false)
{
$path = $this->FullPath();
if( is_array($filecontents) ) $filecontents = implode("\n",$filecontents);
if( $this->IsWriteablePath($new_file) )
{
$fp = fopen($path,"w");
if($fp)
{
fwrite($fp,$filecontents);
fclose($fp);
return true;
}
}
return false;
}
function IsWriteablePath($new_file = false)
{
$path = $this->FullPath();
$path = str_replace('//','/',$path);
$ret = $new_file ? is_writable(dirname($path)): is_writable($path);
if(!$ret)
{
$this->SetError(THEME_ERROR_1, 1);
return false;
}
return $ret;
}
}
class clsThemeFileList extends clsItemCollection
{
var $Page;
var $PerPageVar;
var $ThemeId;
function clsThemeFileList($theme_id=NULL)
{
global $m_var_list;
$this->clsItemCollection();
$this->classname = "clsThemeFile";
$this->Page=(int)$m_var_list["p"];
$this->PerPageVar = "Perpage_ThemeFiles";
$this->SourceTable = GetTablePrefix()."ThemeFiles";
$this->AdminSearchFields = array("FileName","FilePath","Description");
$this->ThemeId=$theme_id;
//if($theme_id)
// $this->LoadFiles($theme_id);
}
function LoadFiles($id,$where="",$orderBy="")
{
global $objConfig;
$this->Clear();
$this->ThemeId=$id;
$sql = "SELECT * FROM ".$this->SourceTable. " WHERE ThemeId=$id ";
if(strlen(trim($where)))
$sql .= $where." ";
if(strlen(trim($orderBy)))
$sql .= "ORDER BY $orderBy";
if(strlen($this->PerPageVar))
{
$sql .= GetLimitSQL($this->Page,$objConfig->Get($this->PerPageVar));
}
//echo $sql;
return $this->Query_Item($sql);
}
function GetFileByName($path,$name,$LoadFromDB=TRUE)
{
$found = FALSE;
$f = FALSE;
//echo "Looking through ".$this->NumItems()." Files <br>\n";
if($this->NumItems()>0)
{
foreach($this->Items as $f)
{
if(($f->Get("FilePath")== $path) && ($f->Get("FileName")==$name))
{
$found = TRUE;
break;
}
}
}
if(!$found && $LoadFromDB)
{
$sql = "SELECT * FROM ".$this->SourceTable." WHERE ThemeId=".$this->ThemeId." AND FileName LIKE '$name' AND FilePath LIKE '$path'";
$rs = $this->adodbConnection->Execute($sql);
//echo $sql."<br>\n";
if($rs && !$rs->EOF)
{
$data = $rs->fields;
$f =& $this->AddItemFromArray($data);
}
else
$f = FALSE;
}
return $f;
}
function AddFile($Path,$Name,$ThemeId,$Type,$Description,$contents=NULL)
{
$f = new clsThemeFile();
$f->Set(array("FilePath","FileName","ThemeId","FileType","Description"),
array($Path,$Name,$ThemeId,$Type,$Description));
$f->Create();
- if($Contents!=NULL)
- $f->SaveFileContents($Contents);
+ if($contents!=NULL)
+ $f->SaveFileContents($contents);
//echo $f->Get("FilePath")."/".$f->Get("FileName")."<br>\n";
return $f;
}
function EditFile($FileId,$Path,$Name,$ThemeId,$Type,$Description,$contents=NULL)
{
$f = $this->GetItem($FileId);
$f->Set(array("FilePath","FileName","ThemeId","FileType","Description"),
array($Path,$Name,$ThemeId,$Type,$Description));
$f->Update();
if($Contents!=NULL)
$f->SaveFileContents($Contents);
return $f;
}
function DeleteFile($FileId)
{
$f = $this->GetItem($FileId);
$f->Delete();
}
function DeleteAll()
{
$this->Clear();
$this->LoadFiles($this->ThemeId);
foreach($this->Items as $f)
$f->Delete();
$this->Clear();
}
function SetFileContents($FileId,$Contents)
{
$f = $this->GetItem($FileId);
$f->SaveFileContents($Contents);
}
function GetFileContents($FileId)
{
$f = $this->GetItem($FileId);
return $f->LoadFileContents();
}
function FindMissingFiles($path)
{
global $objConfig, $pathchar, $pathtoroot, $ttt_time;
$this->Clear();
$fullpath = $pathtoroot."themes/".$path;
$this->LoadFiles($this->ThemeId);
//assemble directoy file list
$files = filelist($fullpath, NULL, "tpl");
//assemble DB file list
$tt_inc=0;
$db_file_array=array(0 => '0');
foreach($this->Items as $f)
{
$db_file_array[$tt_inc]=$f->Get("FilePath").$f->Get("FileName");
$tt_inc++;
}
//iterate through all files in the directory
for($i=0;$i<count($files);$i++)
{
$file_path = dirname($files[$i]);
$file_path = substr($file_path,strlen($fullpath));
$file_base = basename($files[$i]);
//check if there is a matching file in the db
$res=array_search($file_path.$file_base,$db_file_array);
if(is_null($res) || $res === FALSE)
{ //add file to the DB if there isn't one there
if(strlen($file_base))
$this->AddFile($file_path,$file_base,$this->ThemeId,0,"");
}
}
}
}
RegisterPrefix("clsTheme","theme","kernel/include/theme.php");
class clsTheme extends clsParsedItem
{
var $Files;
var $FileCache;
var $IdCache;
var $ParseCacheDate;
var $ParseCacheTimeout;
function clsTheme($Id = NULL)
{
$this->clsParsedItem($Id);
$this->tablename = GetTablePrefix()."Theme";
$this->id_field = "ThemeId";
$this->NoResourceId=1;
$this->TagPrefix="theme";
$this->Files = new clsThemeFileList($Id);
$this->FileCache = array();
$this->IdCache = array();
$this->ParseCacheDate=array();
$this->ParseCacheTimeout = array();
if($Id)
$this->LoadFromDatabase($Id);
}
function ThemeDirectory()
{
global $objConfig, $pathchar, $pathtoroot;
$path = $pathtoroot."themes/".strtolower($this->Get("Name"));
return $path;
}
function UpdateFileCacheData($id,$CacheDate)
{
$sql = "UPDATE ".GetTablePrefix()."ThemeFiles SET CacheDate=$CacheDate WHERE FileId=$id";
$this->adodbConnection->Execute($sql);
}
function LoadFileCache()
{
$sql = "SELECT * FROM ".GetTablePrefix()."ThemeFiles WHERE ThemeId=".$this->Get("ThemeId");
$rs = $this->adodbConnection->Execute($sql);
while($rs && ! $rs->EOF)
{
//$this->Files->AddItemFromArray($rs->fields,TRUE);
$f = $rs->fields["FileName"];
$t = $rs->fields["FilePath"];
if(strlen($t))
$t .= "/";
$parts = pathinfo($f);
$fname = substr($f,0,(strlen($parts["extension"])+1)*-1);
// echo "Name: $fname<br>\n";
$t .= $fname;
$this->FileCache[$t] = $rs->fields["FileId"];
$this->IdCache[$rs->fields["FileId"]] = $t;
/*
if($rs->fields["EnableCache"]) // no such field in this table (commented by Alex)
{
$this->ParseCacheDate[$rs->fields["FileId"]] = $rs->fields["CacheDate"];
$this->ParseCacheTimeout[$rs->fields["FileId"]] = $rs->fields["CacheTimeout"];
}
*/
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
adodb_movenext($rs);
else
$rs->MoveNext();
}
//echo "<PRE>"; print_r($this->IdCache); echo "</PRE>";
}
function GetTemplateById($FileId)
{
if(count($this->FileCache)==0)
$this->LoadFileCache();
$f = $this->IdCache[$FileId];
return $f;
}
function GetTemplateId($t)
{
if( count($this->IdCache) == 0 ) $this->LoadFileCache();
$f = isset( $this->FileCache[$t] ) ? $this->FileCache[$t] : '';
return is_numeric($f) ? $f : $t;
}
function LoadFromDatabase($Id)
{
global $Errors;
if(!isset($Id))
{
$Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
return false;
}
$sql = sprintf("SELECT * FROM ".$this->tablename." WHERE ".$this->IdField()." = '%s'",$Id);
$result = $this->adodbConnection->Execute($sql);
if ($result === false)
{
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
return false;
}
$data = $result->fields;
$this->SetFromArray($data);
$this->Clean();
$this->Files = new clsThemeFileList($Id);
return true;
}
function GetFileList($where,$OrderBy)
{
global $objConfig, $pathchar;
$this->Files->PerPageVar="";
$this->Files->ThemeId = $this->Get("ThemeId");
$this->Files->LoadFiles($this->Get("ThemeId"),$where,$OrderBy);
}
function VerifyTemplates()
{
if(!is_object($this->Files))
$this->Files = new clsThemeFileList($this->Get("ThemeId"));
$this->Files->ThemeId = $this->Get("ThemeId");
$this->Files->FindMissingFiles(strtolower($this->Get("Name")));
}
function EditTemplateContents($FileId,$Contents)
{
$this->Files->SetFileContents($FileId,$Contents);
}
function ReadTemplateContents($FileId)
{
return $this->Files->GetFileContents($FileId);
}
function CreateDirectory()
{
$dir = $this->ThemeDirectory();
if(!is_dir($dir))
mkdir($dir);
}
function Delete()
{
$this->Files->DeleteAll();
$dir = $this->ThemeDirectory();
if(is_writable($dir))
@rmdir($dir);
parent::Delete();
}
function AdminIcon()
{
global $imagesURL;
$file = $imagesURL."/itemicons/icon16_theme";
if($this->Get("PrimaryTheme")==1)
{
$file .= "_primary.gif";
}
else
{
if($this->Get("Enabled")==0)
{
$file .= "_disabled";
}
$file .= ".gif";
}
return $file;
}
function ParseObject($element)
{
global $var_list_update, $objSession;
$extra_attribs = ExtraAttributes($element->attributes);
if(strtolower($element->name)==$this->TagPrefix)
{
$field = strtolower($element->attributes["_field"]);
switch($field)
{
case "id":
$ret = $this->Get("ThemeId");
break;
case "name": // was "nane"
$ret = $this->Get("Name");
break;
case "description":
$ret = $this->Get("Description");
break;
case "adminicon":
$ret = $this->AdminIcon();
break;
case "directory":
$ret = $this->ThemeDirectory();
break;
case "select_url":
$var_list_update["t"] = "index";
$ret = GetIndexURL()."?env=".BuildEnv()."&Action=m_set_theme&ThemeId=".$this->Get("ThemeId");
break;
case "selected":
$ret = "";
if($this->Get("Name")==$objSession->Get("Theme"))
$ret = "SELECTED";
break;
default:
$tag = $this->TagPrefix."_".$field;
$ret = ""; $this->parsetag($tag);
break;
}
}
return $ret;
}
}
class clsThemeList extends clsItemCollection
{
var $Page;
var $PerPageVar;
function clsThemeList($id=NULL)
{
$this->clsItemCollection();
$this->classname="clsTheme";
$this->SourceTable=GetTablePrefix()."Theme";
$this->PerPageVar = "Perpage_Themes";
$this->AdminSearchFields = array("Name","Description");
}
function LoadThemes($where="",$order="")
{
global $objConfig;
$this->Clear();
$sql = "SELECT * FROM ".$this->SourceTable." ";
if(strlen(trim($where)))
$sql .= "WHERE ".$where." ";
if(strlen(trim($orderBy)))
$sql .= "ORDER BY $orderBy";
$sql .= GetLimitSQL($this->Page,$objConfig->Get($this->PerPageVar));
return $this->Query_Item($sql);
}
function AddTheme($Name,$Description,$Enabled,$Primary,$CacheTimeout=3600)
{
$t = new clsTheme();
$t->tablename = $this->SourceTable;
$t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout"),
array($Name,$Description,$Enabled,$Primary,$CacheTimeout));
$t->Create();
if($Primary==1)
{
$sql = "UPDATE ".$this->SourceTable." SET PrimaryTheme=0 WHERE ThemeId != ".$t->Get("ThemeId");
$this->adodbConnection->Execute($sql);
}
return $t;
}
function EditTheme($ThemeId,$Name,$Description,$Enabled,$Primary, $CacheTimeout)
{
$t = $this->GetItem($ThemeId);
$t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout"),
array($Name, $Description, $Enabled, $Primary, $CacheTimeout));
$t->Dirty();
$t->Update();
if($Primary==1)
{
$sql = "UPDATE ".$this->SourceTable." SET PrimaryTheme=0 WHERE ThemeId!=$ThemeId";
$this->adodbConnection->Execute($sql);
}
return $t;
}
function DeleteTheme($ThemeId)
{
$t = $this->GetItem($ThemeId);
$t->Delete();
}
function SetPrimaryTheme($ThemeId)
{
$theme = $this->GetItem($ThemeId);
if($theme->Get("Enabled")==1)
{
$sql = "UPDATE ".$this->SourceTable." SET PrimaryTheme=0";
$this->adodbConnection->Execute($sql);
$theme->Set("PrimaryTheme","1");
$theme->Update();
}
}
function GetPrimaryTheme($field="ThemeId")
{
$sql = "SELECT * FROM ".$this->SourceTable." WHERE PrimaryTheme=1";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$l = $rs->fields[$field];
}
else
$l = 0;
return $l;
}
function CreateMissingThemes()
{
global $objConfig,$pathchar, $pathtoroot;
$path = $pathtoroot."themes";
$themes = array();
if ($dir = @opendir($path))
{
while (($file = readdir($dir)) !== false)
{
if($file !="." && $file !=".." && substr($file,0,1)!="_")
{
if(is_dir($path."/".$file))
{
$file = strtolower($file);
$themes[$file]=0;
}
}
}
}
closedir($dir);
$this->Clear();
$this->Query_Item("SELECT * FROM ".$this->SourceTable);
foreach($this->Items as $i)
{
$n = strtolower($i->Get("Name"));
$themes[$n] = $i->Get("ThemeId");
}
$names = array_keys($themes);
for($i=0;$i<count($names);$i++)
{
$name = $names[$i];
$value = $themes[$name];
if($value==0)
{
$t = $this->AddTheme($name,"New Theme",0,0);
$themes[$name] = $t->Get("ThemeId");
}
}
$where = implode(",",array_values($themes));
$sql = "DELETE FROM ".$this->SourceTable." WHERE ThemeId NOT IN ($where)";
}
function CopyFromEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$idlist = array();
$sql = "SELECT * FROM $edit_table";
$this->Clear();
$rs = $this->adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
$c = $this->AddItemFromArray($data);
$c->Dirty();
if($data["ThemeId"]>0)
{
$c->Update();
}
else
{
$c->UnsetIdField();
$c->Create();
$c->CreateDirectory();
}
if($c->Get("PrimaryTheme"))
{
$this->SetPrimaryTheme($c->Get("ThemeId"));
}
$rs->MoveNext();
}
$this->adodbConnection->Execute($sql);
}
function PurgeEditTable()
{
global $objSession;
$edit_table = $objSession->GetEditTable($this->SourceTable);
$this->adodbConnection->Execute("DROP TABLE IF EXISTS $edit_table");
}
}
?>
Property changes on: trunk/kernel/include/theme.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/kernel/include/config.php
===================================================================
--- trunk/kernel/include/config.php (revision 314)
+++ trunk/kernel/include/config.php (revision 315)
@@ -1,514 +1,514 @@
<?php
require_once($pathtoroot."kernel/include/adodb/adodb.inc.php");
class clsConfig
{
var $config;
var $m_dirty_session;
var $m_IsDirty;
var $m_DirtyFields;
var $m_VarType;
var $adodbConnection;
function clsConfig()
{
$this->m_IsDirty=false;
$this->adodbConnection = GetADODBConnection();
$this->config = array();
$this->m_IsDefault = array();
$this->VarType = array();
}
function SetDebugLevel($value)
{
}
function Load()
{
if(is_object($this->adodbConnection))
{
LogEntry("Config Load Start\n");
$sql = "select VariableName, VariableValue from ".GetTablePrefix()."ConfigurationValues";
$rs = $this->adodbConnection->Execute($sql);
unset($this->config);
#this->config=array();
$count=0;
while($rs && !$rs->EOF)
{
$this->config[$rs->fields["VariableName"]] = $rs->fields["VariableValue"];
$this->m_VarType[$rs->fields["VariableName"]] = 0;
// $this->Set($rs->fields["VariableName"],$rs->fields["VariableValue"],0);
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
{
adodb_movenext($rs);
}
else
$rs->MoveNext();
$count++;
}
LogEntry("Config Load End - $count Variables\n");
}
unset($this->m_DirtyFields);
$this->m_IsDirty=false;
}
function Get($property)
{
return isset($this->config[$property]) ? $this->config[$property] : '';
}
function Set($property, $value,$type=0,$force=FALSE)
{
if(is_array($this->config) && strlen($property)>0)
{
if(array_key_exists($property,$this->config))
{
$current = $this->config[$property];
$changed = ($current != $value);
}
else
$changed = true;
}
else
$changed = false;
$this->config[$property]=$value;
$this->m_IsDirty = ($this->m_IsDirty or $changed or $force);
if($changed || $force)
{
$this->m_DirtyFields[$property] = $value;
}
$this->m_VarType[$property] = $type;
}
function Save()
{
if($this->m_IsDirty==TRUE)
{
foreach($this->m_DirtyFields as $field=>$value)
{
if($this->m_VarType[$field]==0)
{
$sql = sprintf("UPDATE ".GetTablePrefix()."ConfigurationValues SET VariableValue=%s WHERE VariableName=%s", $this->adodbConnection->qstr($value), $this->adodbConnection->qstr($field));
// echo $sql."<br>\n";
$rs = $this->adodbConnection->execute($sql);
}
}
}
$this->m_IsDirty=FALSE;
unset($this->m_DirtyFields);
}
function TimeFormat()
{
if($this->Get("ampm_time")=="1")
{
$format = "g:i:s A";
}
else
$format = "H:i:s";
return $format;
}
/* vartype should be either 1 or 2, 1 = perstant data, 2 = session data */
function GetDirtySessionValues($VarType)
{
$result = array();
if(is_array($this->m_DirtyFields))
{
foreach($this->m_DirtyFields as $property=>$values)
{
if($this->m_VarType[$property]==$VarType)
$result[$property] = $values;
}
}
return $result;
}
function GetConfigValues($postfix = '')
{
// return only varibles, that match specified criteria
if(!$postfix) return $this->config;
$result = Array();
$postfix_len = $postfix ? strlen($postfix) : 0;
foreach($this->config as $config_var => $var_value)
{
if( substr($config_var, - $postfix_len) == $postfix )
$result[$config_var] = $var_value;
}
return $result;
}
}/* clsConfig */
/*
To create the configuration forms in the admin section, populate the table ConfigurationAdmin and
ConfigurationValues.
The tables are fairly straight-forward. The fields of concern in the ConfigurationValues table is
ModuleOwner and Section. ModuleOwner should either be the module name or In-Portal for kernel related stuff.
(Items which should appear under 'System Configuration').
The Section field determines the NavMenu section the value is associated with. For example,
in-portal:configure_general refers to items listed under System Configuration->General.
In the ConfigurationAdmin table, ensure the VariableName field is the same as the one in ConfigurationValues
(this is the field that creates the natural join.) The prompt field is the text displayed to the left of the form element
in the table. This should contain LANGUAGE ELEMENT IDENTIFIERS that are plugged into the Language function.
The element_type field describes the type of form element is associated with this item. Possible values are:
- text : textbox
- checkbox : a simple checkbox
- select : creates a dropdown box. In this case, the ValueList field should be populated with a comma-separated list
in name=value,name=value format (each element is translated to:
<option VALUE="[value]">[name]</option>
To add dynamic data to this list, enclose an SQL statement with <SQL></SQL> tags for example:
<SQL>SELECT FieldLabel as OptionName, FieldName as OptionValue FROM <prefix>CustomField WHERE <prefix>.CustomFieldType=3></SQL>
note the specific field labels OptionName and OptionValue. They are required by the parser.
use the <prefix> tag to insert the system's table prefix into the sql statement as appropriate
*/
class clsConfigAdminItem
{
var $name;
var $heading;
var $prompt;
var $ElementType;
var $ValueList; /* comma-separated list in name=value pair format*/
var $ValidationRules;
var $default_value;
var $adodbConnection;
var $NextItem=NULL;
var $Section;
function clsConfigAdminItem($config_name=NULL)
{
$this->adodbConnection = GetADODBConnection();
if($config_name)
$this->LoadSetting($config_name);
}
function LoadSetting($config_name)
{
$sql = "SELECT * FROM ".GetTablePrefix()."ConfigurationAdmin INNER JOIN ".GetTablePrefix()."ConfigurationValues Using(VariableName) WHERE ".GetTablePrefix()."ConfigurationAdmin.VariableName='".$config_name."'";
$rs = $this->adodbConnection->Execute($sql);
if($rs && !$rs->EOF)
{
$this->name = $rs->fields["VariableName"];
$this->heading = $rs->fields["heading"];
$this->prompt = $rs->fields["prompt"];
$this->ElementType = $rs->fields["element_type"];
$this->ValidationRules=$rs->fields["validation"];
$this->default_value = $rs->fields["VariableValue"];
$this->ValueList=$rs->fields["ValueList"];
$this->Section = $rs->fields["Section"];
}
}
function explode_sql($sql)
{
$s = "";
$rs = $this->adodbConnection->Execute($sql);
while ($rs && !$rs->EOF)
{
if(strlen(trim($rs->fields["OptionName"]))>0 && strlen(trim($rs->fields["OptionValue"]))>0)
{
if(strlen($s))
$s .= ",";
$s .= $rs->fields["OptionName"]."="."+".$rs->fields["OptionValue"];
$rs->MoveNext();
}
}
return $s;
}
function replace_sql($string)
{
$string = str_replace("<PREFIX>",GetTablePrefix(),$string);
$start = strpos($string,"<SQL>");
while($start)
{
$end = strpos($string,"</SQL>");
if(!$end)
{
$end = strlen($string);
}
$len = $end - $start;
$sql = substr($string,$start+5,$len-5);
$sql_val = $this->explode_sql($sql);
$s = substr($string,0,$start) . $sql_val . substr($string,$end+5);
$string = $s;
$start = strpos($string,"<SQL>");
}
return $string;
}
function ItemFormElement()
{
global $objConfig;
static $TabIndex;
if (empty($TabIndex))
$TabIndex = 1;
$o = "";
if($objConfig->Get($this->name)!="")
$this->default_value = stripslashes($objConfig->Get($this->name));
switch($this->ElementType)
{
case "text":
$o .= "<INPUT TYPE=\"TEXT\" tabindex=\"".($TabIndex++)."\" NAME=\"".$this->name."\" ";
$o .= "VALUE=\"".$this->default_value."\">";
break;
case "checkbox":
$o .= "<INPUT TYPE=\"checkbox\" NAME=\"".$this->name."\" tabindex=\"".($TabIndex++)."\"";
if($this->default_value)
{
$o .= " CHECKED>";
}
else
$o .= ">";
break;
case "password":
/* To exclude config form from populating with Root (md5) password */
if ($this->Section == "in-portal:configure_users")
$this->default_value = "";
$o .= "<INPUT TYPE=\"PASSWORD\" tabindex=\"".($TabIndex++)."\" NAME=\"".$this->name."\" ";
$o .= "VALUE=\"".$this->default_value."\">";
break;
case "textarea":
$o .= "<TEXTAREA tabindex=\"".($TabIndex++)."\" ".$this->ValueList." name=\"".$this->name."\">".$this->default_value."</TEXTAREA>";
break;
case "label":
if($this->default_value)
{
$o .= $this->default_value;
}
break;
case "radio":
$radioname = $this->name;
$ValList = $this->replace_sql($this->ValueList);
$TabIndex++;
$localTabIndex = $TabIndex;
$TabIndex++;
$val = explode(",",$ValList);
for($i=0;$i<=count($val);$i++)
{
if(strlen($val[$i]))
{
$parts = explode("=",$val[$i]);
$s = $parts[1];
if(strlen($s)==0)
$s="";
$o .= "<input type=\"radio\" tabindex=\"".($localTabIndex)."\" name=\"".$this->name."\" VALUE=\"".$parts[0]."\"";
if($this->default_value==$parts[0])
{
$o .= " CHECKED>";
}
else
$o .= ">";
if(substr($s,0,1)=="+")
{
$o .= $s;
}
else
$o .= prompt_language($s);
}
}
break;
case "select":
$o .= "<SELECT NAME=\"".$this->name."\" tabindex=\"".($TabIndex++)."\">";
$ValList = $this->replace_sql($this->ValueList);
$val = explode(",",$ValList);
for($i=0;$i<=count($val);$i++)
{
if(strlen($val[$i]))
{
$parts = explode("=",$val[$i]);
$s = $parts[1];
if(strlen($s)==0)
$s="";
$selected = "";
if($this->default_value==$parts[0])
$selected = " SELECTED";
if(substr($s,0,1)=="+")
{
$o .= "<OPTION VALUE=\"".$parts[0]."\" $selected>".substr($s,1)."</OPTION>";
}
else
{
if(strlen($s))
$o .= "<OPTION VALUE=\"".$parts[0]."\" $selected>".admin_language($s)."</OPTION>";
}
}
}
$o .= "</SELECT>";
}
return $o;
}
function GetPrompt()
{
$ret = prompt_language($this->prompt);
return $ret;
}
}
class clsConfigAdmin
{
var $module;
var $section;
var $Items;
function clsConfigAdmin($module="",$section="",$Inst=FALSE)
{
$this->module = $module;
$this->section = $section;
$this->Items= array();
if(strlen($module) && strlen($section))
$this->LoadItems(TRUE,$Inst);
}
function Clear()
{
unset($this->Items);
$this->Items = array();
}
function NumItems()
{
if(is_array($this->Items))
{
return count($this->Items);
}
else
return 0;
}
function LoadItems($CheckNextItems=TRUE, $inst=FALSE)
{
$this->Clear();
if(!$inst)
{
$sql = "SELECT * FROM ".GetTablePrefix()."ConfigurationAdmin INNER JOIN ".GetTablePrefix()."ConfigurationValues Using(VariableName)
WHERE ModuleOwner='".$this->module."' AND Section='".$this->section."' ORDER BY DisplayOrder ASC";
}
else
{
$sql = "SELECT * FROM ".GetTablePrefix()."ConfigurationAdmin INNER JOIN ".GetTablePrefix()."ConfigurationValues Using(VariableName)
WHERE ModuleOwner='".$this->module."' AND Section='".$this->section."' AND Install=1 ORDER BY DisplayOrder ASC";
}
if( $GLOBALS['debuglevel'] ) echo $sql."<br>\n";
$adodbConnection = GetADODBConnection();
$rs = $adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$data = $rs->fields;
if(is_object($i) && $CheckNextItems)
{
$last = $i->prompt;
unset($i);
}
$i = new clsConfigAdminItem(NULL);
$i->name = $data["VariableName"];
$i->default_value = $data["VariableValue"];
$i->heading = $data["heading"];
$i->prompt = $data["prompt"];
$i->ElementType = $data["element_type"];
$i->ValueList = $data["ValueList"];
- $i->ValidationRules = $data["validaton"];
+ $i->ValidationRules = isset($data['validaton']) ? $data['validaton'] : '';
$i->Section = $data["Section"];
if(strlen($last)>0)
{
if($i->prompt==$last)
{
$this->Items[count($this->Items)-1]->NextItem=$i;
}
else
{
$i->NextItem=NULL;
array_push($this->Items,$i);
}
}
else
{
$i->NextItem=NULL;
array_push($this->Items,$i);
}
//unset($i);
$rs->MoveNext();
}
}
function SaveItems($POSTVARS, $force=FALSE)
{
global $objConfig;
foreach($this->Items as $i)
{
if($i->ElementType != "label")
{
if($i->ElementType != "checkbox")
{
$objConfig->Set($i->name,$POSTVARS[$i->name]);
}
else
{
if($POSTVARS[$i->name]=="on")
{
$value=1;
}
else
$value = (int)$POSTVARS[$i->name];
$objConfig->Set($i->name,$value,0,$force);
}
}
}
$objConfig->Save();
}
function GetHeadingList()
{
$res = array();
foreach($this->Items as $i)
{
$res[$i->heading]=1;
}
reset($res);
return array_keys($res);
}
function GetHeadingItems($heading)
{
$res = array();
foreach($this->Items as $i)
{
if($i->heading==$heading)
array_push($res,$i);
}
return $res;
}
}
?>
Property changes on: trunk/kernel/include/config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/admin/install.php
===================================================================
--- trunk/admin/install.php (revision 314)
+++ trunk/admin/install.php (revision 315)
@@ -1,1896 +1,1895 @@
<?php
error_reporting(0);
//$new_version = '1.0.2';
define("GET_LICENSE_URL", "http://www.intechnic.com/myaccount/license.php");
define('BACKUP_NAME', 'dump(.*).txt'); // how backup dump files are named
$general_error = '';
-if ($_POST['install_type'] != '') {
- $install_type = $_POST['install_type'];
-}
-else if ($_GET['install_type'] != '') {
- $install_type = $_GET['install_type'];
-}
-
-$force_finish = isset($_REQUEST['ff']) ? true : false;
-
$pathtoroot = "";
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
//$path=dirname(realpath($_SERVER['PATH_TRANSLATED']));
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;
}
}
$path_char = GetPathChar();
//phpinfo(INFO_VARIABLES);
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
$is_install = TRUE;
$admin = substr($path,strlen($pathtoroot));
$state = isset($_GET["state"]) ? $_GET["state"] : '';
if(!strlen($state))
{
- $state = $_POST["state"];
+ $state = isset($_POST['state']) ? $_POST['state'] : '';
}
include($pathtoroot.$admin."/install/install_lib.php");
+$install_type = GetVar('install_type', true);
+$force_finish = isset($_REQUEST['ff']) ? true : false;
+
$ini_file = $pathtoroot."config.php";
if(file_exists($ini_file))
{
$write_access = is_writable($ini_file);
$ini_vars = inst_parse_portal_ini($ini_file,TRUE);
foreach($ini_vars as $secname => $section)
{
foreach($section as $key => $value)
{
$key = "g_".str_replace('-', '', $key);
global $$key;
$$key = $value;
}
}
}
else
{
$state="";
$write_access = is_writable($pathtoroot);
if($write_access)
{
set_ini_value("Database", "DBType", "");
set_ini_value("Database", "DBHost", "");
set_ini_value("Database", "DBUser", "");
set_ini_value("Database", "DBUserPassword", "");
set_ini_value("Database", "DBName", "");
set_ini_value("Module Versions", "In-Portal", "");
save_values();
}
}
$titles[1] = "General Site Setup";
$configs[1] = "in-portal:configure_general";
$mods[1] = "In-Portal";
$titles[2] = "User Setup";
$configs[2] = "in-portal:configure_users";
$mods[2] = "In-Portal:Users";
$titles[3] = "Category Display Setup";
$configs[3] = "in-portal:configure_categories";
$mods[3] = "In-Portal";
// simulate rootURL variable: begin
$rootURL = 'http://'.dirname($_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);
$tmp = explode('/', $rootURL);
if( $tmp[ count($tmp) - 1 ] == $admin) unset( $tmp[ count($tmp) - 1 ] );
$rootURL = implode('/', $tmp).'/';
unset($tmp);
//echo "RU: $rootURL<br>";
// simulate rootURL variable: end
$db_savings = Array('dbinfo', 'db_config_save', 'db_reconfig_save'); //, 'reinstall_process'
-if(strlen($g_DBType)>0 && strlen($state)>0 && !in_array($state, $db_savings) )
+if( isset($g_DBType) && $g_DBType && strlen($state)>0 && !in_array($state, $db_savings) )
{
require_once($pathtoroot."kernel/startup.php");
$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."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
}
function GetPathChar($path = null)
{
if( !isset($path) ) $path = $GLOBALS['pathtoroot'];
$pos = strpos($path, ':');
return ($pos === false) ? "/" : "\\";
}
function SuperStrip($str, $inverse = false)
{
$str = $inverse ? str_replace("%5C","\\",$str) : str_replace("\\","%5C",$str);
return stripslashes($str);
}
require_once($pathtoroot.$admin."/install/inst_ado.php");
$helpURL = $rootURL.$admin.'/help/install_help.php?destform=popup&help_usage=install';
?>
<html>
<head>
<title>In-Portal Installation</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Notepad">
<link rel="stylesheet" type="text/css" href="include/style.css">
<LINK REL="stylesheet" TYPE="text/css" href="install/2col.css">
<SCRIPT LANGUAGE="JavaScript1.2">
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function swap(imgid, src){
var ob = document.getElementById(imgid);
ob.src = 'images/' + src;
}
function Continue() {
document.iform1.submit();
}
function CreatePopup(window_name, url, width, height)
{
// creates a popup window & returns it
if(url == null && typeof(url) == 'undefined' ) url = '';
if(width == null && typeof(width) == 'undefined' ) width = 750;
if(height == null && typeof(height) == 'undefined' ) height = 400;
return window.open(url,window_name,'width='+width+',height='+height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no');
}
function ShowHelp(section)
{
var frm = document.getElementById('help_form');
frm.section.value = section;
frm.method = 'POST';
CreatePopup('HelpPopup','<?php echo $rootURL.$admin; ?>/help/blank.html'); // , null, 600);
frm.target = 'HelpPopup';
frm.submit();
}
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="height: 100%">
<form name="help_form" id="help_form" action="<?php echo $helpURL; ?>" method="post"><input type="hidden" id="section" name="section" value=""></form>
<form enctype="multipart/form-data" name="iform1" id="iform1" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td height="90">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="90">
<tr>
<td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img alt="In-portal" src="images/globe.gif" width="84" height="91" border="0"></a></td>
<td rowspan="3" valign="top"><a href="http://www.in-portal.net" target="_top"><img alt="In-portal" src="images/logo.gif" width="150" height="91" border="0"></a></td>
<td rowspan="3" width="100000" align="right">&nbsp;</td>
<td width="400"><img alt="" src="images/blocks.gif" width="400" height="73"></td>
</tr>
<tr><td align="right" background="images/version_bg.gif" class="head_version" valign="top"><img alt="" src="images/spacer.gif" width="1" height="14">In-Portal Version <?php echo GetMaxPortalVersion($pathtoroot.$admin)?>: English US</td></tr>
<tr><td><img alt="" src="images/blocks2.gif" width="400" height="2"><br></td></tr>
<tr><td bgcolor="black" colspan="4"><img alt="" src="images/spacer.gif" width="1" height="1"><br></td></tr>
</table>
</td>
</tr>
<?php
require_once($pathtoroot."kernel/include/adodb/adodb.inc.php");
if(!strlen($state))
$state = @$_POST["state"];
//echo $state;
if(strlen($state)==0)
{
$ado = inst_GetADODBConnection();
- if($ado)
- {
- $installed = TableExists($ado,"ConfigurationAdmin,Category,Permissions");
- }
+ $installed = $ado ? TableExists($ado,"ConfigurationAdmin,Category,Permissions") : false;
if(!minimum_php_version("4.1.2"))
{
$general_error = "You have version ".phpversion()." - please upgrade!";
//die();
}
if(!$write_access)
{
if ($general_error != '') {
$general_error .= '<br /><br />';
}
$general_error .= "Install cannot write to config.php in the root directory of your in-portal installation ($pathtoroot).";
//die();
}
if(!is_writable($pathtoroot."themes/"))
{
if ($general_error != '') {
$general_error .= '<br /><br />';
}
$general_error .= "In-portal's Theme directory must be writable (".$pathtoroot."themes/).";
//die();
}
if(!is_writable($pathtoroot."kernel/images/"))
{
if ($general_error != '') {
$general_error .= '<br /><br />';
}
$general_error .= "In-portal's Image Upload directory must be writable (".$pathtoroot."kernel/images/).";
//die();
}
if(!is_writable($pathtoroot."admin/backupdata/"))
{
if ($general_error != '') {
$general_error .= '<br /><br />';
}
$general_error .= "In-portal's Backup directory must be writable (".$pathtoroot."admin/backupdata/).";
//die();
}
if(!is_writable($pathtoroot."admin/export/"))
{
if ($general_error != '') {
$general_error .= '<br /><br />';
}
$general_error .= "In-portal's Exportd directory must be writable (".$pathtoroot."admin/export/).";
//die();
}
if($installed)
{
$state="reinstall";
}
else {
$state="dbinfo";
}
}
if($state=="reinstall_process")
{
+ $login_err_mesg = ''; // always init vars before use
+ if( !isset($g_License) ) $g_License = '';
$lic = base64_decode($g_License);
if(strlen($lic))
{
inst_ParseLicense($lic);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
}
$LoggedIn = FALSE;
if($_POST["UserName"]=="root")
{
$ado = inst_GetADODBConnection();
$sql = "SELECT * FROM ".$g_TablePrefix."ConfigurationValues WHERE VariableName='RootPass'";
$rs = $ado->Execute($sql);
if($rs && !$rs->EOF)
{
$RootPass = $rs->fields["VariableValue"];
if(strlen($RootPass)>0)
$LoggedIn = ($RootPass==md5($_POST["UserPass"]));
}
}
else
{
$act = '';
if (ConvertVersion($g_InPortal) >= ConvertVersion("1.0.5")) {
$act = 'check';
}
$rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['UserName'])."&password=".md5($_POST['UserPass'])."&action=$act&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
$login_err_mesg = "Unable to connect to the Intechnic server!";
$LoggedIn = false;
}
else {
$rcontents = '';
while (!feof($rfile)) {
$line = fgets($rfile, 10000);
$rcontents .= $line;
}
@fclose($rfile);
if (substr($rcontents, 0, 5) == 'Error') {
$login_err_mesg = substr($rcontents, 6);
$LoggedIn = false;
}
else {
$LoggedIn = true;
}
}
//$LoggedIn = ($i_User == $_POST["UserName"] && ($i_Pswd == $_POST["UserPass"]) && strlen($i_User)>0) || strlen($i_User)==0;
}
if($LoggedIn)
{
if (!(int)$_POST["inp_opt"]) {
$state="reinstall";
$inst_error = "Please select one of the options above!";
}
else {
switch((int)$_POST["inp_opt"])
{
case 0:
$inst_error = "Please select an option above";
break;
case 1:
/* clean out all tables */
$install_type = 4;
$ado = inst_GetADODBConnection();
$filename = $pathtoroot.$admin."/install/inportal_remove.sql";
RunSchemaFile($ado,$filename);
/* run install again */
$state="license";
break;
case 2:
$install_type = 3;
$state="dbinfo";
break;
case 3:
$install_type = 5;
$state="license";
break;
case 4:
$install_type = 6;
/* clean out all tables */
$ado = inst_GetADODBConnection();
//$filename = $pathtoroot.$admin."/install/inportal_remove.sql";
//RunSchemaFile($ado,$filename);
/* run install again */
$state="restore_select";
break;
case 5:
$install_type = 7;
/* change DB config */
$state="db_reconfig";
break;
case 6:
$install_type = 8;
$state = "upgrade";
break;
}
}
}
else
{
$state="reinstall";
$login_error = $login_err_mesg;//"Invalid Username or Password - Try Again";
}
}
if ($state == "upgrade") {
$ado = inst_GetADODBConnection();
$Modules = array();
$Texts = array();
if (str_replace('.', '', GetMaxPortalVersion($pathtoroot.$admin)) >= 105 && ($g_LicenseCode == '' && $g_License != '')) {
$state = 'reinstall';
$inst_error = "Your license must be updated before you can upgrade. Please don't use 'Existing License' option, instead either Download from Intechnic or Upload a new license file!";
}
else {
$sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules";
$rs = $ado->Execute($sql);
$i = 0;
while ($rs && !$rs->EOF) {
$p = strtolower($rs->fields['Name']);
if ($p == 'in-portal') {
$p = '';
}
$dir_name = $pathtoroot.$p."/admin/install/upgrades/";
$dir = @dir($dir_name);
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($dir_name.$file))
{
if (strstr($file, 'inportal_upgrade_v')) {
$file = str_replace("inportal_upgrade_v", "", $file);
$file = str_replace(".sql", "", $file);
$sql = "SELECT count(*) AS count FROM ".$g_TablePrefix."Modules WHERE Name = '".$rs->fields['Name']."' AND Version = '$file'";
$rs1 = $ado->Execute($sql);
if ($rs1->fields['count'] == 0 && ConvertVersion($file) > ConvertVersion($rs->fields['Version'])) {
if ($Modules[$i-1] == $rs->fields['Name']) {
$Texts[$i-1] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".$file.")";
$i--;
}
else {
$Texts[$i] = $rs->fields['Name']." (".$rs->fields['Version']." ".prompt_language("la_to")." ".$file.")";
$Modules[$i] = $rs->fields['Name'];
}
$i++;
}
}
}
}
$rs->MoveNext();
}
$include_file = $pathtoroot.$admin."/install/upgrade.php";
}
}
if ($state == "upgrade_process") {
$ado = inst_GetADODBConnection();
$mod_arr = $_POST['modules'];
foreach($mod_arr as $p)
{
$mod_name = strtolower($p);
$sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '$p'";
$rs = $ado->Execute($sql);
$current_version = $rs->fields['Version'];
if ($mod_name == 'in-portal') {
$mod_name = '';
}
$dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/";
$dir = @dir($dir_name);
$new_version = '';
$tmp1 = 0;
$tmp2 = 0;
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) {
if (strstr($file, 'inportal_upgrade_v')) {
$file_tmp = str_replace("inportal_upgrade_v", "", $file);
$file_tmp = str_replace(".sql", "", $file);
if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) {
$filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file";
//echo "Trying Version: $try_version<br>";
if(file_exists($filename))
{
RunSQLFile($ado, $filename);
set_ini_value("Module Versions", $p, $try_version);
save_values();
}
/* $tmp1 = str_replace(".", "", $file);
if ($tmp1 > $tmp2) {
$new_version = $file;
}*/
}
}
//$tmp2 = $tmp1;
}
}
}
$state = 'languagepack_upgrade';
}
// upgrade language pack
if($state=='languagepack_upgrade')
{
$state = 'lang_install_init';
$_POST['lang'][] = 'english.lang';
$force_finish = true;
}
if($state=="db_reconfig_save")
{
$ini_vars = inst_parse_portal_ini($ini_file,TRUE);
foreach($ini_vars as $secname => $section)
{
foreach($section as $key => $value)
{
$key = "g_".str_replace("-", "", $key);
global $$key;
$$key = $value;
}
}
unset($ado);
$ado = VerifyDB('db_reconfig', 'finish', 'SaveDBConfig', true);
}
if($state=="db_reconfig")
{
$include_file = $pathtoroot.$admin."/install/db_reconfig.php";
}
if($state=="restore_file")
{
if($_POST["submit"]=="Update")
{
$filepath = $_POST["backupdir"];
$state="restore_select";
}
else
{
$filepath = stripslashes($_POST['backupdir']);
$backupfile = $filepath.$path_char.str_replace('(.*)', $_POST['backupdate'], BACKUP_NAME);
if(file_exists($backupfile) && is_readable($backupfile))
{
$ado = inst_GetADODBConnection();
$show_warning = false;
if (!$_POST['warning_ok']) {
// Here we comapre versions between backup and config
$file_contents = file_get_contents($backupfile);
$file_tmp_cont = explode("#------------------------------------------", $file_contents);
$tmp_vers = $file_tmp_cont[0];
$vers_arr = explode(";", $tmp_vers);
$ini_values = inst_parse_portal_ini($ini_file);
foreach ($ini_values as $key => $value) {
foreach ($vers_arr as $k) {
if (strstr($k, $key)) {
if (!strstr($k, $value)) {
$show_warning = true;
}
}
}
}
//$show_warning = true;
}
if (!$show_warning) {
$filename = $pathtoroot.$admin.$path_char.'install'.$path_char.'inportal_remove.sql';
RunSchemaFile($ado,$filename);
$state="restore_run";
}
else {
$state = "warning";
$include_file = $pathtoroot.$admin."/install/warning.php";
}
}
else {
if ($_POST['backupdate'] != '') {
$include_file = $pathtoroot.$admin."/install/restore_select.php";
$restore_error = "$backupfile not found or could not be read";
}
else {
$include_file = $pathtoroot.$admin."/install/restore_select.php";
$restore_error = "No backup selected!!!";
}
}
}
//echo $restore_error;
}
if($state=="restore_select")
{
if( isset($_POST['backupdir']) ) $filepath = stripslashes($_POST['backupdir']);
$include_file = $pathtoroot.$admin."/install/restore_select.php";
}
if($state=="restore_run")
{
$ado = inst_GetADODBConnection();
$FileOffset = (int)$_GET["Offset"];
if(!strlen($backupfile))
$backupfile = SuperStrip($_GET['File'], true);
$include_file = $pathtoroot.$admin."/install/restore_run.php";
}
if($state=="db_config_save")
{
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();
$ini_vars = inst_parse_portal_ini($ini_file,TRUE);
foreach($ini_vars as $secname => $section)
{
foreach($section as $key => $value)
{
$key = "g_".str_replace("-", "", $key);
global $$key;
$$key = $value;
}
}
unset($ado);
$ado = VerifyDB('dbinfo', 'license');
}
if($state=="dbinfo")
{
if ($install_type == '') {
$install_type = 1;
}
$include_file = $pathtoroot.$admin."/install/dbinfo.php";
}
if ($state == "download_license") {
$ValidLicense = FALSE;
- if ($_POST['login'] != '' && $_POST['password'] != '') {
+
+ $lic_login = isset($_POST['login']) ? $_POST['login'] : '';
+ $lic_password = isset($_POST['password']) ? $_POST['password'] : '';
+
+ if ($lic_login != '' && $lic_password != '') {
// Here we determine weather login is ok & check available licenses
$rfile = @fopen(GET_LICENSE_URL."?login=".md5($_POST['login'])."&password=".md5($_POST['password'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
$state = "get_license";
$include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
$rcontents = '';
while (!feof($rfile)) {
$line = fgets($rfile, 10000);
$rcontents .= $line;
}
@fclose($rfile);
if (substr($rcontents, 0, 5) == 'Error') {
$get_license_error = substr($rcontents, 6);
$state = "get_license";
$include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
if (substr($rcontents, 0, 3) == "SEL") {
$state = "download_license";
$license_select = substr($rcontents, 4);
$include_file = $pathtoroot.$admin."/install/download_license.php";
}
else {
// Here we get one license
$tmp_data = explode('Code==:', $rcontents);
$data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0]));
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
$got_license = 1;
}
else {
$license_error="Invalid License File";
}
if(!$ValidLicense)
{
$state="license";
}
}
}
}
}
else if ($_POST['licenses'] == '') {
$state = "get_license";
$get_license_error = "Username and / or password not specified!!!";
$include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
// Here we download license
+ echo "LICENSE_ID: ".md5($_POST['licenses'])."<br>";
+ echo "DLOG: ".md5($_POST['dlog'])."<br>";
+ echo "DPASS: ".md5($_POST['dpass'])."<br>";
+ echo "VERSION: ".GetMaxPortalVersion($pathtoroot.$admin)."<br>";
+ echo "DOMAIN: ".base64_encode($_POST['domain'])."<br>";
+
$rfile = @fopen(GET_LICENSE_URL."?license_id=".md5($_POST['licenses'])."&dlog=".md5($_POST['dlog'])."&dpass=".md5($_POST['dpass'])."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".base64_encode($_POST['domain']), "r");
if (!$rfile) {
$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
$state = "get_license";
$include_file = $pathtoroot.$admin."/install/get_license.php";
}
else {
$rcontents = '';
while (!feof($rfile)) {
$line = fgets($rfile, 10000);
$rcontents .= $line;
}
@fclose($rfile);
if (substr($rcontents, 0, 5) == 'Error') {
$download_license_error = substr($rcontents, 6);
$state = "download_license";
$include_file = $pathtoroot.$admin."/install/download_license.php";
}
else {
$tmp_data = explode('Code==:', $rcontents);
$data = base64_decode(str_replace("In-Portal License File - do not edit!\n", "", $tmp_data[0]));
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
- set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
+ // old licensing script doen't return 2nd parameter (licanse code)
+ if( isset($tmp_data[1]) ) set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
}
else {
$license_error="Invalid License File";
}
if(!$ValidLicense)
{
$state="license";
}
}
}
}
}
if($state=="license_process")
{
$ValidLicense = FALSE;
- switch($_POST["lic_opt"])
+ $tmp_lic_opt = GetVar('lic_opt', true);
+ switch($tmp_lic_opt)
{
case 1: /* download from intechnic */
$include_file = $pathtoroot.$admin."/install/get_license.php";
$state = "get_license";
//if(!$ValidLicense)
//{
// $state="license";
//}
break;
case 2: /* upload file */
$file = $_FILES["licfile"];
if(is_array($file))
{
move_uploaded_file($file["tmp_name"],$pathtoroot."themes/tmp.lic");
$fp = @fopen($pathtoroot."themes/tmp.lic","rb");
if($fp)
{
$lic = fread($fp,filesize($pathtoroot."themes/tmp.lic"));
fclose($fp);
}
$tmp_data = inst_LoadLicense(FALSE,$pathtoroot."themes/tmp.lic");
$data = $tmp_data[0];
@unlink($pathtoroot."themes/tmp.lic");
inst_ParseLicense($data);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
set_ini_value("Intechnic","License",base64_encode($data));
set_ini_value("Intechnic","LicenseCode",$tmp_data[1]);
save_values();
$state="domain_select";
}
else
$license_error="Invalid License File";
}
if(!$ValidLicense)
{
$state="license";
}
break;
case 3: /* existing */
if(strlen($g_License))
{
$lic = base64_decode($g_License);
inst_ParseLicense($lic);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
if($ValidLicense)
{
$state="domain_select";
}
else
{
$state="license";
$license_error="Invalid or corrupt license detected";
}
}
else
{
$state="license";
$license_error="Missing License File";
}
if(!$ValidLicense)
{
$state="license";
}
break;
case 4:
//set_ini_value("Intechnic","License",base64_encode("local"));
//set_ini_value("Intechnic","LicenseCode",base64_encode("local"));
//save_values();
$state="domain_select";
break;
}
if($ValidLicense)
$state="domain_select";
}
if($state=="license")
{
$include_file = $pathtoroot.$admin."/install/sel_license.php";
}
if($state=="reinstall")
{
$ado = inst_GetADODBConnection();
$show_upgrade = false;
$sql = "SELECT Name FROM ".$g_TablePrefix."Modules";
$rs = $ado->Execute($sql);
$modules = '';
while ($rs && !$rs->EOF) {
$modules .= strtolower($rs->fields['Name']).',';
$rs->MoveNext();
}
$mod_arr = explode(",", substr($modules, 0, strlen($modules) - 1));
foreach($mod_arr as $p)
{
if ($p == 'in-portal') {
$p = '';
}
$dir_name = $pathtoroot.$p."/admin/install/upgrades/";
$dir = @dir($dir_name);
//echo "<pre>"; print_r($dir); echo "</pre>";
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($dir_name.$file))
{
if (strstr($file, 'inportal_upgrade_v')) {
$file = str_replace("inportal_upgrade_v", "", $file);
$file = str_replace(".sql", "", $file);
if ($p == '') {
$p = 'in-portal';
}
$sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '".$p."'";
$rs = $ado->Execute($sql);
if (ConvertVersion($rs->fields['Version']) < ConvertVersion($file)) {
$show_upgrade = true;
}
}
}
}
}
- if ($install_type == '') {
+ if ( !isset($install_type) || $install_type == '') {
$install_type = 2;
}
$include_file = $pathtoroot.$admin."/install/reinstall.php";
}
if($state=="login")
{
$lic = base64_decode($g_License);
if(strlen($lic))
{
inst_ParseLicense($lic);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
}
if(!$ValidLicense)
{
$state="license";
}
else
if($i_User == $_POST["UserName"] || $i_Pswd == $_POST["UserPass"])
{
$state = "domain_select";
}
else
{
$state="getuser";
$login_error = "Invalid User Name or Password. If you don't know your username or password, contact Intechnic Support";
}
//die();
}
if($state=="getuser")
{
$include_file = $pathtoroot.$admin."/install/login.php";
}
if($state=="set_domain")
{
- if(!is_array($i_Keys))
+ if( !is_array($i_Keys) || !count($i_Keys) )
{
$lic = base64_decode($g_License);
if(strlen($lic))
{
inst_ParseLicense($lic);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
}
}
if($_POST["domain"]==1)
{
$domain = $_SERVER['HTTP_HOST'];
if (strstr($domain, $i_Keys[0]['domain']) || inst_IsLocalSite($domain)) {
set_ini_value("Intechnic","Domain",$domain);
save_values();
$state="runsql";
}
else {
$DomainError = 'Domain name selected does not match domain name in the license!';
$state = "domain_select";
}
}
else
{
$domain = str_replace(" ", "", $_POST["other"]);
if ($domain != '') {
if (strstr($domain, $i_Keys[0]['domain']) || inst_IsLocalSite($domain)) {
set_ini_value("Intechnic","Domain",$domain);
save_values();
$state="runsql";
}
else {
$DomainError = 'Domain name entered does not match domain name in the license!';
$state = "domain_select";
}
}
else {
$DomainError = 'Please enter valid domain!';
$state = "domain_select";
}
}
}
if($state=="domain_select")
{
if(!is_array($i_Keys))
{
$lic = base64_decode($g_License);
if(strlen($lic))
{
inst_ParseLicense($lic);
$ValidLicense = ((strlen($i_User)>0) && (strlen($i_Pswd)>0));
}
}
$include_file = $pathtoroot.$admin."/install/domain.php";
}
if($state=="runsql")
{
$ado = inst_GetADODBConnection();
$installed = TableExists($ado,"ConfigurationAdmin,Category,Permissions");
if(!$installed)
{
// create tables
$filename = $pathtoroot.$admin."/install/inportal_schema.sql";
RunSchemaFile($ado,$filename);
// insert default info
$filename = $pathtoroot.$admin."/install/inportal_data.sql";
RunSQLFile($ado,$filename);
$sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = 'In-Portal'";
$rs = $ado->Execute($sql);
set_ini_value("Module Versions", "In-Portal", $rs->fields['Version']);
save_values();
require_once $pathtoroot.'kernel/include/tag-class.php';
if( !is_object($objTagList) ) $objTagList = new clsTagList();
// install kernel specific tags
$objTagList->DeleteTags(); // delete all existing tags in db
// create 3 predifined tags (because there no functions with such names
$t = new clsTagFunction();
$t->Set("name","include");
$t->Set("description","insert template output into the current template");
$t->Create();
$t->AddAttribute("_template","tpl","Template to insert","",TRUE);
$t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE);
$t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE);
$t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE);
unset($t);
$t = new clsTagFunction();
$t->Set("name","perm_include");
$t->Set("description","insert template output into the current template if permissions are set");
$t->Create();
$t->AddAttribute("_template","tpl","Template to insert","",TRUE);
$t->AddAttribute("_noaccess","tpl","Template to insert if access is denied","",FALSE);
$t->AddAttribute("_permission","","Comma-separated list of permissions, any of which will grant access","",FALSE);
$t->AddAttribute("_module","","Used in place of the _permission attribute, this attribute verifies the module listed is enabled","",FALSE);
$t->AddAttribute("_system","bool","Must be set to true if any permissions in _permission list is a system permission","",FALSE);
$t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE);
$t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE);
$t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE);
unset($t);
$t = new clsTagFunction();
$t->Set("name","mod_include");
$t->Set("description","insert templates from all enabled modules. No error occurs if the template does not exist.");
$t->Create();
$t->AddAttribute("_template","tpl","Template to insert. This template path should be relative to the module template root directory","",TRUE);
$t->AddAttribute("_modules","","Comma-separated list of modules. Defaults to all enabled modules if not set","",FALSE);
$t->AddAttribute("_supresserror","bool","Supress missing template errors","",FALSE);
$t->AddAttribute("_dataexists","bool","Only include template output if content exists (content is defined by the tags in the template)","",FALSE);
$t->AddAttribute("_nodatatemplate","tpl","Template to include if the nodataexists condition is true","",FALSE);
$objTagList->ParseFile($pathtoroot.'kernel/parser.php'); // insert module tags
if( is_array($ItemTagFiles) )
foreach($ItemTagFiles as $file)
$objTagList->ParseItemFile($pathtoroot.$file);
$state="RootPass";
}
else {
$include_file = $pathtoroot.$admin."/install/install_finish.php";
$state="finish";
}
}
if ($state == "finish") {
$include_file = $pathtoroot.$admin."/install/install_finish.php";
}
if($state=="RootSetPass")
{
$pass = $_POST["RootPass"];
if(strlen($pass)<4)
{
$PassError = "Root Password must be at least 4 characters";
$state = "RootPass";
}
else if ($pass != $_POST["RootPassConfirm"]) {
$PassError = "Passwords does not match";
$state = "RootPass";
}
else
{
$pass = md5($pass);
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$pass' WHERE VariableName='RootPass' OR VariableName='RootPassVerify'";
$ado = inst_GetADODBConnection();
$ado->Execute($sql);
$state="modselect";
}
}
if($state=="RootPass")
{
$include_file = $pathtoroot.$admin."/install/rootpass.php";
}
if($state=="lang_install_init")
{
include_once($pathtoroot."kernel/include/xml.php");
$ado = inst_GetADODBConnection();
if (TableExists($ado, "Language,Phrase")) {
$MaxInserts = 200;
$PhraseTable = GetTablePrefix()."ImportPhrases";
$EventTable = GetTablePrefix()."ImportEvents";
$sql = "CREATE TABLE $PhraseTable SELECT Phrase,Translation,PhraseType,LanguageId FROM ".GetTablePrefix()."Phrase WHERE PhraseId=-1";
$ado->Execute($sql);
$sql = "CREATE TABLE $EventTable SELECT Template,MessageType,EventId,LanguageId FROM ".GetTablePrefix()."EmailMessage WHERE EmailMessageId=-1";
$ado->Execute($sql);
$sql = "SELECT EventId,Event,Type FROM ".GetTablePrefix()."Events";
$rs = $ado->Execute($sql);
$Events = array();
while($rs && !$rs->EOF)
{
$Events[$rs->fields["Event"]."_".$rs->fields["Type"]] = $rs->fields["EventId"];
$rs->MoveNext();
}
if(count($_POST["lang"])>0)
{
$Langs = $_POST["lang"];
for($x=0;$x<count($Langs);$x++)
{
$lang = $Langs[$x];
$p = $pathtoroot.$admin."/install/langpacks/".$lang;
/* parse xml file */
$fp = fopen($p,"r");
$xml = fread($fp,filesize($p));
fclose($fp);
unset($objInXML);
$objInXML = new xml_doc($xml);
$objInXML->parse();
$objInXML->getTag(0,$name,$attribs,$contents,$tags);
if(is_array($tags))
{
foreach($tags as $t)
{
$LangRoot =& $objInXML->getTagByID($t);
$PackName = $LangRoot->attributes["PACKNAME"];
$l = $objLanguages->GetItemByField("PackName",$PackName);
if(is_object($l))
{
$LangId = $l->Get("LanguageId");
+ $NewLang = false;
}
else
{
$l = new clsLanguage();
$l->Set("Enabled",1);
$l->Create();
- $NewLang = TRUE;
+ $NewLang = true;
$LangId = $l->Get("LanguageId");
}
foreach($LangRoot->children as $tag)
{
switch($tag->name)
{
case "PHRASES":
foreach($tag->children as $PhraseTag)
{
$Phrase = $ado->qstr($PhraseTag->attributes["LABEL"]);
$Translation = $ado->qstr(base64_decode($PhraseTag->contents));
$PhraseType = $PhraseTag->attributes["TYPE"];
$psql = "INSERT INTO $PhraseTable (Phrase,Translation,PhraseType,LanguageId) VALUES ($Phrase,$Translation,$PhraseType,$LangId)";
$ado->Execute($psql);
//echo "$psql <br>\n";
}
break;
case "DATEFORMAT":
$DateFormat = $tag->contents;
break;
case "TIMEFORMAT":
$TimeFormat = $tag->contents;
break;
case "DECIMAL":
$Decimal = $tag->contents;
break;
case "THOUSANDS":
$Thousands = $tag->contents;
break;
case "EVENTS":
foreach($tag->children as $EventTag)
{
$event = $EventTag->attributes["EVENT"];
$MsgType = strtolower($EventTag->attributes["MESSAGETYPE"]);
$template = base64_decode($EventTag->contents);
$Type = $EventTag->attributes["TYPE"];
$EventId = $Events[$event."_".$Type];
$esql = "INSERT INTO $EventTable (Template,MessageType,EventId,LanguageId) VALUES ('$template','$MsgType',$EventId,$LangId)";
$ado->Execute($esql);
//echo htmlentities($esql)."<br>\n";
}
break;
}
if($NewLang)
{
$l->Set("PackName",$PackName);
$l->Set("LocalName",$PackName);
$l->Set("DateFormat",$DateFormat);
$l->Set("TimeFormat",$TimeFormat);
$l->Set("DecimalPoint",$Decimal);
$l->Set("ThousandSep",$Thousands);
$l->Update();
}
}
}
}
}
$state="lang_install";
}
else {
$state="lang_select";
}
}
else {
$general_error = 'Database error! No language tables found!';
}
}
if($state=="lang_install")
{
/* do pack install */
$Offset = (int)$_GET["Offset"];
$Status = (int)$_GET["Status"];
$PhraseTable = GetTablePrefix()."ImportPhrases";
$EventTable = GetTablePrefix()."ImportEvents";
if($Status==0)
{
$Total = TableCount($PhraseTable,"",0);
}
else
{
$Total = TableCount($EventTable,"",0);
}
if($Status==0)
{
$Offset = $objLanguages->ReadImportTable($PhraseTable, 1,"0,1,2", $force_finish ? false : true, 200,$Offset);
if($Offset>=$Total)
{
$Offset=0;
$Status=1;
}
- if ($_POST['next_step']) {
- $next_step = $_POST['next_step'];
- }
- else if ($_GET['next_step']) {
- $next_step = $_GET['next_step'];
- }
+ $next_step = GetVar('next_step', true);
if($force_finish == true) $next_step = 3;
$NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&state=lang_install&next_step=$next_step&install_type=$install_type";
if($force_finish == true) $NextUrl .= '&ff=1';
$include_file = $pathtoroot.$admin."/install/lang_run.php";
}
else
{
if(!is_object($objMessageList))
$objMessageList = new clsEmailMessageList();
$Offset = $objMessageList->ReadImportTable($EventTable, $force_finish ? false : true,100,$Offset);
if($Offset>$Total)
{
- if ($_POST['next_step']) {
- $next_step = $_POST['next_step'];
- }
- else if ($_GET['next_step']) {
- $next_step = $_GET['next_step'];
- }
+ $next_step = GetVar('next_step', true);
+
if($force_finish == true) $next_step = 3;
$NextUrl = $_SERVER['PHP_SELF']."?Offset=$Offset&Status=$Status&State=lang_install&next_step=$next_step&install_type=$install_type";
if($force_finish == true) $NextUrl .= '&ff=1';
$include_file = $pathtoroot.$admin."/install/lang_run.php";
}
else
{
if( !$force_finish )
{
$state = 'lang_default';
}
else
{
$_POST['next_step'] = 4;
$state = 'finish';
$include_file = $pathtoroot.$admin."/install/install_finish.php";
}
}
}
}
if($state=="lang_default_set")
{
// phpinfo(INFO_VARIABLES);
$ado = inst_GetADODBConnection();
$PhraseTable = GetTablePrefix()."ImportPhrases";
$EventTable = GetTablePrefix()."ImportEvents";
$ado->Execute("DROP TABLE IF EXISTS $PhraseTable");
$ado->Execute("DROP TABLE IF EXISTS $EventTable");
$Id = $_POST["lang"];
$objLanguages->SetPrimary($Id);
$state="postconfig_1";
}
if($state=="lang_default")
{
$Packs = Array();
$objLanguages->Clear();
$objLanguages->LoadAllLanguages();
foreach($objLanguages->Items as $l)
{
$Packs[$l->Get("LanguageId")] = $l->Get("PackName");
}
$include_file = $pathtoroot.$admin."/install/lang_default.php";
}
if($state=="modinstall")
{
$doms = $_POST["domain"];
if(is_array($doms))
{
$ado = inst_GetADODBConnection();
require_once $pathtoroot.'kernel/include/tag-class.php';
- if( !is_object($objTagList) ) $objTagList = new clsTagList();
+ if( !isset($objTagList) || !is_object($objTagList) ) $objTagList = new clsTagList();
foreach($doms as $p)
{
$filename = $pathtoroot.$p."/admin/install.php";
if(file_exists($filename))
{
include($filename);
}
}
}
/* $sql = "SELECT Name FROM ".GetTablePrefix()."Modules";
$rs = $ado->Execute($sql);
while($rs && !$rs->EOF)
{
$p = $rs->fields['Name'];
$mod_name = strtolower($p);
if ($mod_name == 'in-portal') {
$mod_name = '';
}
$dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/";
$dir = @dir($dir_name);
$new_version = '';
$tmp1 = 0;
$tmp2 = 0;
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($dir_name.$file))
{
$file = str_replace("inportal_upgrade_v", "", $file);
$file = str_replace(".sql", "", $file);
if ($file != '' && !strstr($file, 'changelog') && !strstr($file, 'readme')) {
$tmp1 = str_replace(".", "", $file);
if ($tmp1 > $tmp2) {
$new_version = $file;
}
}
}
$tmp2 = $tmp1;
}
$version_nrs = explode(".", $new_version);
for ($i = 0; $i < $version_nrs[0] + 1; $i++) {
for ($j = 0; $j < $version_nrs[1] + 1; $j++) {
for ($k = 0; $k < $version_nrs[2] + 1; $k++) {
$try_version = "$i.$j.$k";
$filename = $pathtoroot.$mod_name."/admin/install/upgrades/inportal_upgrade_v$try_version.sql";
if(file_exists($filename))
{
RunSQLFile($ado, $filename);
set_ini_value("Module Versions", $p, $try_version);
save_values();
}
}
}
}
$rs->MoveNext();
}
*/
$state="lang_select";
}
if($state=="lang_select")
{
$Packs = GetLanguageList();
$include_file = $pathtoroot.$admin."/install/lang_select.php";
}
if($state=="modselect")
{
/* /admin/install.php */
$UrlLen = (strlen($admin) + 12)*-1;
$pathguess =substr($_SERVER["SCRIPT_NAME"],0,$UrlLen);
$sitepath = $pathguess;
$esc_path = str_replace("\\","/",$pathtoroot);
$esc_path = str_replace("/","\\",$esc_path);
//set_ini_value("Site","DomainName",$_SERVER["SERVER_NAME"]);
//$g_DomainName= $_SERVER["SERVER_NAME"];
save_values();
$ado = inst_GetADODBConnection();
if(substr($sitepath,0,1)!="/")
$sitepath="/".$sitepath;
if(substr($sitepath,-1)!="/")
$sitepath .= "/";
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$sitepath' WHERE VariableName='Site_Path'";
$ado->Execute($sql);
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$g_Domain' WHERE VariableName='Server_Name'";
$ado->Execute($sql);
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '".$_SERVER['DOCUMENT_ROOT'].$sitepath."admin/backupdata' WHERE VariableName='Backup_Path'";
$ado->Execute($sql);
$Modules = inst_GetModuleList();
$include_file = $pathtoroot.$admin."/install/modselect.php";
}
if(substr($state,0,10)=="postconfig")
{
$p = explode("_",$state);
$step = $p[1];
if ($_POST['Site_Path'] != '') {
$sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules";
$rs = $ado->Execute($sql);
$modules_str = '';
while ($rs && !$rs->EOF) {
$modules_str .= $rs->fields['Name'].' ('.$rs->fields['Version'].'),';
$rs->MoveNext();
}
$modules_str = substr($modules_str, 0, strlen($modules_str) - 1);
$rfile = @fopen(GET_LICENSE_URL."?url=".base64_encode($_SERVER['SERVER_NAME'].$_POST['Site_Path'])."&modules=".base64_encode($modules_str)."&license_code=".base64_encode($g_LicenseCode)."&version=".GetMaxPortalVersion($pathtoroot.$admin)."&domain=".md5($_SERVER['SERVER_NAME']), "r");
if (!$rfile) {
//$get_license_error = "Unable to connect to the Intechnic server! Please try again later!";
//$state = "postconfig_1";
//$include_file = $pathtoroot.$admin."/install/postconfig.php";
}
else {
$rcontents = '';
while (!feof($rfile)) {
$line = fgets($rfile, 10000);
$rcontents .= $line;
}
@fclose($rfile);
}
}
if(strlen($_POST["oldstate"])>0)
{
$s = explode("_",$_POST["oldstate"]);
$oldstep = $s[1];
if($oldstep<count($configs))
{
$section = $configs[$oldstep];
$module = $mods[$oldstep];
$title = $titles[$oldstep];
$objAdmin = new clsConfigAdmin($module,$section,TRUE);
$objAdmin->SaveItems($_POST,TRUE);
}
}
$section = $configs[$step];
$module = $mods[$step];
$title = $titles[$step];
$step++;
if($step <= count($configs)+1)
{
$include_file = $pathtoroot.$admin."/install/postconfig.php";
}
else
$state = "theme_sel";
}
if($state=="theme_sel")
{
$objThemes->CreateMissingThemes();
$include_file = $pathtoroot.$admin."/install/theme_select.php";
}
if($state=="theme_set")
{
## get & define Non-Blocking & Blocking versions ##
$blocking_sockets = minimum_php_version("4.3.0")? 0 : 1;
$ado = inst_GetADODBConnection();
$sql = "UPDATE ".$g_TablePrefix."ConfigurationValues SET VariableValue = '$blocking_sockets' WHERE VariableName='SocketBlockingMode'";
$ado->Execute($sql);
## get & define Non-Blocking & Blocking versions ##
$theme_id = $_POST["theme"];
$pathchar="/";
//$objThemes->SetPrimaryTheme($theme_id);
$t = $objThemes->GetItem($theme_id);
$t->Set("Enabled",1);
$t->Set("PrimaryTheme",1);
$t->Update();
$t->VerifyTemplates();
$include_file = $pathtoroot.$admin."/install/install_finish.php";
$state="finish";
}
if ($state == "adm_login") {
echo "<script>window.location='index.php';</script>";
}
+// init variables
+$vars = Array('db_error','restore_error','PassError','DomainError','login_error','inst_error');
+foreach($vars as $var_name) ReSetVar($var_name);
+
switch($state)
{
case "modselect":
$title = "Select Modules";
$help = "<p>Select the In-Portal modules you wish to install. The modules listed to the right ";
$help .="are all modules included in this installation that are licensed to run on this server. </p>";
break;
case "reinstall":
$title = "Installation Maintenance";
$help = "<p>A Configuration file has been detected on your system and it appears In-Portal is correctly installed. ";
$help .="In order to work with the maintenance functions provided to the left you must provide the Intechnic ";
$help .="Username and Password you used when obtaining the license file residing on the server, or your admin Root password. ";
$help .=" <i>(Use Username 'root' if using your root password)</i></p>";
$help .= "<p>To removing your existing database and start with a fresh installation, select the first option ";
$help .= "provided. Note that this operation cannot be undone and no backups are made! Use at your own risk.</p>";
$help .="<p>If you wish to scrap your current installation and install to a new location, choose the second option. ";
$help .="If this option is selected you will be prompted for new database configuration information.</p>";
$help .="<p>The <i>Update License Information</i> option is used to update your In-Portal license data. Select this option if you have ";
$help .="modified your licensing status with Intechnic, or you have received new license data via email</p>";
break;
case "RootPass":
$title = "Set Admin Root Password";
$help = "<p>The Root Password is initially required to access the admin sections of In-Portal. ";
$help .="The root user cannot be used to access the front-end of the system, so it is recommended that you ";
$help .="create additional users with admin privlidges.</p>";
break;
case "finish":
$title = "Thank You!";
$help ="<P>Thanks for using In-Portal! Be sure to visit <A TARGET=\"_new\" HREF=\"http://www.in-portal.net\">www.in-portal.net</A> ";
$help.=" for the latest news, module releases and support. </p>";
break;
case "license":
$title = "License Configuration";
$help ="<p>A License is required to run In-Portal on a server connected to the Internet. You ";
$help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN. ";
$help.="If Intechnic has provided you with a license file, upload it here. Otherwise select the first ";
$help.="option to allow Install to download your license for you.</p>";
$help.="<p>If a valid license has been detected on your server, you can choose the <i>Use Existing License</i> ";
$help.="and continue the installation process</p>";
break;
case "domain_select":
$title="Select Licensed Domain";
$help ="<p>Select the domain you wish to configure In-Portal for. The <i>Other</i> option ";
$help.=" can be used to configure In-Portal for use on a local domain.</p>";
$help.="<p>For local domains, enter the hostname or LAN IP Address of the machine running In-Portal.</p>";
break;
case "db_reconfig":
case "dbinfo":
$title="Database Configuration";
$help = "<p>In-Portal needs to connect to your Database Server. Please provide the database server type*, ";
$help .="host name (<i>normally \"localhost\"</i>), Database user name, and database Password. ";
$help .="These fields are required to connect to the database.</p><p>If you would like In-Portal ";
$help .="to use a table prefix, enter it in the field provided. This prefix can be any ";
$help .=" text which can be used in the names of tables on your system. The characters entered in this field ";
$help .=" are placed <i>before</i> the names of the tables used by In-Portal. For example, if you enter \"inp_\"";
$help .=" into the prefix field, the table named Category will be named inp_Category.</p>";
break;
case "lang_select":
$title="Language Pack Installation";
$help = "<p>Select the language packs you wish to install. Each language pack contains all the phrases ";
$help .="used by the In-Portal administration and the default template set. Note that at least one ";
$help .="pack <b>must</b> be installed.</p>";
break;
case "lang_default":
$title="Select Default Language";
$help = "<p>Select which language should be considered the \"default\" language. This is the language ";
$help .="used by In-Portal when a language has not been selected by the user. This selection is applicable ";
$help .="to both the administration and front-end.</p>";
break;
case "lang_install":
$title="Installing Language Packs";
$help = "<p>The language packs you have selected are being installed. You may install more languages at a ";
$help.="later time from the Regional admin section.</p>";
break;
case "postconfig_1":
$help = "<P>These options define the general operation of In-Portal. Items listed here are ";
$help .="required for In-Portal's operation.</p><p>When you have finished, click <i>save</i> to continue.</p>";
break;
case "postconfig_2":
$help = "<P>User Management configuration options determine how In-Portal manages your user base.</p>";
$help .="<p>The groups listed to the right are pre-defined by the installation process and may be changed ";
$help .="through the Groups section of admin.</p>";
break;
case "postconfig_3":
$help = "<P>The options listed here are used to control the category list display functions of In-Portal. </p>";
break;
case "theme_sel":
$title="Select Default Theme";
$help = "<P>This theme will be used whenever a front-end session is started. ";
$help .="If you intend to upload a new theme and use that as default, you can do so through the ";
$help .="admin at a later date. A default theme is required for session management.</p>";
break;
case "get_license":
$title="Download License from Intechnic";
$help ="<p>A License is required to run In-Portal on a server connected to the Internet. You ";
$help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.</p>";
$help.="<p>Here as you have selected download license from Intechnic you have to input your username and ";
$help.="password of your In-Business account in order to download all your available licenses.</p>";
break;
case "download_license":
$title="Download License from Intechnic";
$help ="<p>A License is required to run In-Portal on a server connected to the Internet. You ";
$help.="can run In-Portal on localhost, non-routable IP addresses, or other computers on your LAN.</p>";
$help.="<p>Please choose the license from the drop down for this site! </p> ";
break;
case "restore_select":
$title="Select Restore File";
$help = "<P>Select the restore file to use to reinstall In-Portal. If your backups are not performed ";
$help .= "in the default location, you can enter the location of the backup directory and click the ";
$help .="<i>Update</i> button.</p>";
case "restore_run":
$title= "Restore in Progress";
$help = "<P>Restoration of your system is in progress. When the restore has completed, the installation ";
$help .="will continue as normal. Hitting the <i>Cancel</i> button will restart the entire installation process. ";
break;
case "warning":
$title = "Restore in Progress";
$help = "<p>Please approve that you understand that you are restoring your In-Portal data base from other version of In-Portal.</p>";
break;
case "update":
$title = "Update In-Portal";
$help = "<p>Select modules from the list, you need to update to the last downloaded version of In-Portal</p>";
break;
}
-if ($_POST['next_step']) {
- $tmp_step = $_POST['next_step'];
-}
-else if ($_GET['next_step']) {
- $tmp_step = $_GET['next_step'];
-}
+$tmp_step = GetVar('next_step', true);
if (!$tmp_step) {
$tmp_step = 1;
}
-if ($got_license == 1) {
+if ( isset($got_license) && $got_license == 1) {
$tmp_step++;
}
$next_step = $tmp_step + 1;
if ($general_error != '') {
$state = '';
$title = '';
$help = '';
$general_error = $general_error.'<br /><br />Installation cannot continue!';
}
if ($include_file == '' && $general_error == '' && $state == '') {
$state = '';
$title = '';
$help = '';
$filename = $pathtoroot.$admin."/install/inportal_remove.sql";
RunSQLFile($ado,$filename);
$general_error = 'Unexpected installation error! <br /><br />Installation has been stopped!';
}
if ($restore_error != '') {
$next_step = 3;
$tmp_step = 2;
}
if ($PassError != '') {
$tmp_step = 4;
$next_step = 5;
}
if ($DomainError != '') {
$tmp_step--;
$next_step = $tmp_step + 1;
}
if ($db_error != '') {
$tmp_step--;
$next_step = $tmp_step + 1;
}
if ($state == "warning") {
$tmp_step--;
$next_step = $tmp_step + 1;
}
?>
<tr height="100%">
<td valign="top">
<table cellpadding=10 cellspacing=0 border=0 width="100%" height="100%">
<tr valign="top">
<td style="width: 200px; background: #009ff0 url(images/bg_install_menu.gif) no-repeat bottom right; border-right: 1px solid #000">
<img src="images/spacer.gif" width="180" height="1" border="0" alt=""><br>
<span class="admintitle-white">Installation</span>
<!--<ol class="install">
<li class="current">Licence Verification
<li>Configuration
<li>File Permissions
<li>Security
<li>Integrity Check
</ol>
</td>-->
- <?php if ($general_error == '') { ?>
+ <?php
+ $lic_opt = isset($_POST['lic_opt']) ? $_POST['lic_opt'] : false;
+ if ($general_error == '') {
+ ?>
<?php if ($install_type == 1) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1) { ?>class="current"<?php } ?>>Database Configuration
- <li <?php if ($tmp_step == 2 || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License
- <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain
+ <li <?php if ($tmp_step == 2 || $lic_opt == 1) { ?>class="current"<?php } ?>>Select License
+ <li <?php if ($tmp_step == 3 && $lic_opt != 1) { ?>class="current"<?php } ?>>Select Domain
<li <?php if ($tmp_step == 4 ) { ?>class="current"<?php } ?>>Set Root Password
<li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install
<li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs
<li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration
<li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 2) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
<!--<li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License
<li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain
<li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Set Root Password
<li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install
<li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs
<li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration
<li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish-->
</ol>
<?php } else if ($install_type == 3) { ?>
<ol class="install">
<li>License Verification
<li <?php if ($tmp_step == 2) { ?>class="current"<?php } ?>>Database Configuration
<li <?php if ($tmp_step == 3 || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License
<li <?php if ($tmp_step == 4 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain
<li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Set Root Password
<li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Select Modules to Install
<li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Install Language Packs
<li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Post-Install Configuration
<li <?php if ($tmp_step == 9) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 4) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
- <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License
+ <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $lic_opt == 1) { ?>class="current"<?php } ?>>Select License
<li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain
<li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Set Root Password
<li <?php if ($tmp_step == 5) { ?>class="current"<?php } ?>>Select Modules to Install
<li <?php if ($tmp_step == 6) { ?>class="current"<?php } ?>>Install Language Packs
<li <?php if ($tmp_step == 7) { ?>class="current"<?php } ?>>Post-Install Configuration
<li <?php if ($tmp_step == 8) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 5) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
- <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_POST['lic_opt'] == 1) { ?>class="current"<?php } ?>>Select License
- <li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1) { ?>class="current"<?php } ?>>Select Domain
+ <li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $lic_opt == 1) { ?>class="current"<?php } ?>>Select License
+ <li <?php if ($tmp_step == 3 && $lic_opt != 1) { ?>class="current"<?php } ?>>Select Domain
<li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 6) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
<li <?php if (($tmp_step == 2 && $login_error == '' && $inst_error == '') || $_GET['show_prev'] == 1 || $_POST['backupdir']) { ?>class="current"<?php } ?>>Select Backup File
<li <?php if ($tmp_step == 3 && $_POST['lic_opt'] != 1 && $_GET['show_prev'] != 1 && !$_POST['backupdir']) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 7) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
<li <?php if ($tmp_step == 2 && $login_error == '' && $inst_error == '') { ?>class="current"<?php } ?>>Database Configuration
<li <?php if ($tmp_step == 3) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } else if ($install_type == 8) { ?>
<ol class="install">
<li <?php if ($tmp_step == 1 || $login_error != '' || $inst_error != '') { ?>class="current"<?php } ?>>License Verification
<li <?php if ($tmp_step == 2 && $login_error == '' && $inst_error == '') { ?>class="current"<?php } ?>>Select Modules to Upgrade
<li <?php if ($tmp_step == 3) { ?>class="current"<?php } ?>>Language Pack Upgrade
<li <?php if ($tmp_step == 4) { ?>class="current"<?php } ?>>Finish
</ol>
<?php } ?>
<?php include($include_file); ?>
<?php } else { ?>
<?php include("install/general_error.php"); ?>
<?php } ?>
<td width="40%" style="border-left: 1px solid #000; background: #f0f0f0">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
- <td class="subsectiontitle" style="border-bottom: 1px solid #000000; background-color:#999"><?php echo $title;?></td>
+ <td class="subsectiontitle" style="border-bottom: 1px solid #000000; background-color:#999"><?php if( isset($title) ) echo $title;?></td>
</tr>
<tr>
- <td class="text"><?php echo $help;?></td>
+ <td class="text"><?php if( isset($help) ) echo $help;?></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="footer">
Powered by In-portal &copy; 1997-2004, Intechnic Corporation. All rights reserved.
<br><img src="images/spacer.gif" width="1" height="10" alt="">
</td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
Property changes on: trunk/admin/install.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.41
\ No newline at end of property
+1.42
\ No newline at end of property
Index: trunk/admin/install/install_lib.php
===================================================================
--- trunk/admin/install/install_lib.php (revision 314)
+++ trunk/admin/install/install_lib.php (revision 315)
@@ -1,683 +1,710 @@
<?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 GetMaxPortalVersion($admindirname)
{
$dir = @dir($admindirname.'/install/upgrades');
$version = '';
while ($file = $dir->read()) {
if ($file != "." && $file != ".." && !is_dir($admindirname.$file))
{
if (strstr($file, 'inportal_upgrade_v')) {
$file = str_replace("inportal_upgrade_v", "", $file);
$file = str_replace(".sql", "", $file);
if (ConvertVersion($file) > ConvertVersion($version)) {
$version = $file;
}
}
}
}
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 ".$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 ".$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>";
$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;
}
}
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))
{
$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 = '<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
- echo "in_ere";
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: trunk/admin/install/install_lib.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.13
\ No newline at end of property
+1.14
\ No newline at end of property
Index: trunk/admin/install/dbinfo.php
===================================================================
--- trunk/admin/install/dbinfo.php (revision 314)
+++ trunk/admin/install/dbinfo.php (revision 315)
@@ -1,70 +1,70 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Database Configuration</span><br><br>
<?php section_header('Step '.$tmp_step.' - Database Configuration'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0f" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td class="txt"><b>Server Type:</b></td>
<td ALIGN="left">
<SELECT NAME="ServerType">
<OPTION VALUE="mysql" <?php if($g_DBType=="mysql") echo "SELECTED"; ?>>MySQL</OPTION>
<!--<OPTION VALUE="mssql" <?php if($g_DBType=="mssql") echo "SELECTED"; ?>>MS-SQL Server</OPTION>
<OPTION VALUE="pgsql" <?php if($g_DBType=="pgsql") echo "SELECTED"; ?>>pgSQL</OPTION>-->
</SELECT>
</td>
</tr>
<tr class="table_color2">
<td class="txt"><b>Hostname:</b></td>
<td ALIGN="left">
<input type="text" name="ServerHost" class="text" VALUE="<?php echo $g_DBHost; ?>">
</td>
</tr>
<tr class="table_color2">
<td class="txt"><b>Database Name:</b></td>
<td ALIGN="left">
<input type="text" name="ServerDB" class="text" VALUE="<?php echo $g_DBName; ?>">
</td>
</tr>
<tr class="table_color2">
<td class="txt"><b>Databse User Name:</b></td>
<td ALIGN="left">
<input type="text" name="ServerUser" class="text" VALUE="<?php echo $g_DBUser; ?>">
</td>
</tr>
<tr class="table_color2">
<td class="txt"><b>Database User Password:</b></td>
<td ALIGN="left">
<input type="password" name="ServerPass" class="text" VALUE="<?php echo $g_DBUserPassword; ?>">
</td>
</tr>
<tr class="table_color2">
<td class="txt"><b>Table Name Prefix:</b></td>
<td ALIGN="left">
- <input type="text" name="TablePrefix" class="text" VALUE="<?php echo $g_TablePrefix; ?>">
+ <input type="text" name="TablePrefix" class="text" VALUE="<?php if( isset($g_TablePrefix) ) echo $g_TablePrefix; ?>">
</td>
</tr>
<tr class="table_color2">
<td colspan="2"><p class="error"><?php if ($general_error != '') echo $general_error; else echo $db_error; ?></p><br/></td>
</tr>
- <input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
- <input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
+ <input type="hidden" name="UserPass" VALUE="<?php if( isset($UserPass) ) echo $UserPass; ?>">
+ <input type="hidden" name="UserName" VALUE="<?php if( isset($UserName) )echo $UserName; ?>">
<input TYPE="hidden" NAME ="state" VALUE="db_config_save">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
<tr>
<td COLSPAN=2>
<br>
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="button" name="Cancel" value="Cancel" CLASS="button" ONCLICK = "history.go(-1);">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/dbinfo.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/install/lang_run.php
===================================================================
--- trunk/admin/install/lang_run.php (revision 314)
+++ trunk/admin/install/lang_run.php (revision 315)
@@ -1,72 +1,72 @@
<?php
function stats($caption,$myprogress,$totalnum)
{
global $rootURL, $CancelURL, $admin, $force_finish;
$step_num = $force_finish ? 3 : 6;
if($totalnum>0)
{
$pct=round(($myprogress/ $totalnum)*100);
}
else
$pct = 100;
- $o .=' <td>
+ $o =' <td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">'.$caption.'</span><br><br>
'.section_header('Step '.$step_num.' - '.$caption.' - '.$pct.'%',true).'
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<tr>
<td><img src="images/toolbar/tool_cancel.gif" id="img_Cancel" width="32" height="32" border="0" alt="Next Category" onMouseOut="swap(\'img_Cancel\', \'toolbar/tool_cancel.gif\');" onMouseOver="swap(\'img_Cancel\',\'toolbar/tool_cancel_f2.gif\');" onClick="history.go(-1);"></td>
<!--<td><img src="images/toolbar/tool_divider.gif" width="4" height="32" border="0"><br></td>-->
<td width="100%">&nbsp;</td>
</tr>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0"><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">';
echo "\n";
$o .= " <tr class=\"table_color2\">
<td ALIGN=\"center\"> <br/>
<TABLE CLASS=\"tableborder_full\" width=\"75%\">
<TR border=1><TD bgcolor=\"#507F15\" width=\"".$pct."%\">&nbsp;</TD>";
$comp_pct = 100-$pct;
$o .= " <TD bgcolor=#FFFFFF width=\"".$comp_pct."%\"></TD></TR>";
$o .= " </TABLE><BR /><input type=button VALUE=\"Cancel\" CLASS=\"button\" ONCLICK=\"document.location='".$CancelURL."';\">
</td>
</tr></table></td>";
//$o .= "<!--<tr><td class=\"tabletitle\" STYLE=\"border: 1px solid #000000;\" bgcolor=\"#333333\">".$caption."-".$pct."%</td></tr>-->";
//$o .= "<TR><TD align=\"middle\" bgcolor=\"#F0F0F0\"><br />";
//$o .= " <TABLE CLASS=\"tableborder_full\" width=\"75%\">";
//$o .=" <TR border=1><TD bgcolor=\"#507F15\" width=\"".$pct."%\">&nbsp;</TD>";
//$comp_pct = 100-$pct;
//$o .= " <TD bgcolor=#FFFFFF width=\"".$comp_pct."%\"></TD></TR>";
//$o .= " </TABLE>";
//$o .= " <BR /><input type=button VALUE=\"Cancel\" CLASS=\"button\" ONCLICK=\"document.location='".$CancelURL."';\">";
echo $o."\n";
//echo "</TD></TR></TABLE></td>";
}
function reload($url)
{
print "<script language=\"javascript\">" ;
print "setTimeout(\"document.location='$url';\",40);";
print " </script>";
//echo "<A HREF=\"$url\">Next </A>";
}
$PageTitle = "Language Pack Installation In Progress";
$CancelURL = $rootURL ."admin/install.php";
stats($PageTitle,$Offset,$Total);
reload($NextUrl);
?>
Property changes on: trunk/admin/install/lang_run.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/admin/install/download_license.php
===================================================================
--- trunk/admin/install/download_license.php (revision 314)
+++ trunk/admin/install/download_license.php (revision 315)
@@ -1,42 +1,42 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select License</span><br><br>
<?php
$stmp_step = $tmp_step;
section_header('Step '.$stmp_step.' - Select License');
?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Domain:</b></td>
<td ALIGN="left" class="txt"><input type="text" readonly name="domain" value="<?php echo $_SERVER['SERVER_NAME']?>"></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Available licenses:</b></td>
<td ALIGN="left" class="txt"><?php echo $license_select;?></td>
</tr>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $download_license_error; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($download_license_error) ) echo $download_license_error; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="download_license">
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="dlog" VALUE="<?php echo $_POST['login']; ?>">
<input type="hidden" name="dpass" VALUE="<?php echo $_POST['password']; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/download_license.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/install/modselect.php
===================================================================
--- trunk/admin/install/modselect.php (revision 314)
+++ trunk/admin/install/modselect.php (revision 315)
@@ -1,39 +1,39 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select Modules to Install</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select Modules'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<?php
foreach($Modules as $m)
{
echo "<TR class=\"table_color2\"><TD colspan=\"2\" align=\"left\" class=\"txt\">";
echo "<INPUT TYPE=\"CHECKBOX\" NAME=\"domain[]\" VALUE=\"$m\" CHECKED=\"checked\">";
echo $m;
echo "</TD></TR>\n";
}
?>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $ModuleError; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($ModuleError) ) echo $ModuleError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="modinstall">
<input type="submit" name="submit_form" value="Select" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/modselect.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/install/get_license.php
===================================================================
--- trunk/admin/install/get_license.php (revision 314)
+++ trunk/admin/install/get_license.php (revision 315)
@@ -1,39 +1,39 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select License</span><br><br>
<?php section_header('Step 2 - Select License'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Login / E-mail:</b></td>
- <td ALIGN="left" class="txt"><input type="text" name="login" value="<?php echo $_POST['login'];?>" class="text"></td>
+ <td ALIGN="left" class="txt"><input type="text" name="login" value="<?php if( isset($_POST['login']) ) echo $_POST['login'];?>" class="text"></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" class="txt"><b>Password:</b></td>
<td ALIGN="left" class="txt"><input type="password" name="password" value="" class="text"></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" colspan="2" WIDTH="100%" class="txt"><a href="http://www.intechnic.com/myaccount/index.php?t=users/reveal_password&">Forgot password</a></td>
</tr>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $get_license_error; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($get_license_error) ) echo $get_license_error; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="download_license">
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="2">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/get_license.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/install/sel_license.php
===================================================================
--- trunk/admin/install/sel_license.php (revision 314)
+++ trunk/admin/install/sel_license.php (revision 315)
@@ -1,49 +1,50 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select License</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select License'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td ALIGN="left" WIDTH="100%" class="txt"><INPUT TYPE="RADIO" NAME="lic_opt" id="lic_opt_1" VALUE="1"><label for="lic_opt_1">Download from Intechnic</label></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" WIDTH="100%" class="txt"><INPUT TYPE=RADIO value="2" id="lic_opt_2" name="lic_opt"><label for="lic_opt_2">Upload License File:</label>
- <INPUT TYPE="FILE" CLASS="button" NAME="licfile">
+ <INPUT TYPE="FILE" CLASS="button" NAME="licfile" onclick="document.getElementById('lic_opt_2').checked = true;">
</td>
</tr>
<tr class="table_color2">
<?php
- if(!strlen($g_License))
+ $enabled = '';
+ if(!isset($g_License) || !$g_License )
{
$enabled="disabled='true'";
}
?>
<td ALIGN="left" WIDTH="100%" class="txt" <?php echo $enabled; ?>><INPUT TYPE=RADIO value="3" id="lic_opt_3" name="lic_opt"><label for="lic_opt_3">Use Existing License</label></td>
</tr>
<tr class="table_color2">
<td ALIGN="left" WIDTH="100%" class="txt"><INPUT TYPE=RADIO value="4" id="lic_opt_4" name="lic_opt"><label for="lic_opt_4">Skip License (Local Domain Installation)</label></td>
</tr>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $license_error; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($license_error) ) echo $license_error; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="license_process">
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/sel_license.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/install/reinstall.php
===================================================================
--- trunk/admin/install/reinstall.php (revision 314)
+++ trunk/admin/install/reinstall.php (revision 315)
@@ -1,70 +1,70 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Licence Verification</span><br><br>
<?php section_header('Step 1 - Licence Verification'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color1">
<td COLSPAN=2><p class="error">In-Portal is already installed at this location.</p></TD>
</tr>
<tr class="table_color2">
<td COLSPAN=2>In order to use the installation tool, please provide your Intechnic account information:</td>
</tr>
<tr class="table_color2">
<td class="text"><B>Username:</B></td>
- <td width="80%"><input type="text" name="UserName" value="<?php $_POST['UserName'];?>" class="text"></td>
+ <td width="80%"><input type="text" name="UserName" value="<?php GetVar('UserName', true);?>" class="text"></td>
</tr>
<tr class="table_color2">
<td class="text"><B>Password:</B></td>
<td><input type="password" name="UserPass" class="text"></td>
</tr>
- <tr class="table_color2"><td COLSPAN=2><p class="error"><?php echo $login_error;?></p><br></TD></tr>
+ <tr class="table_color2"><td COLSPAN=2><p class="error"><?php if( isset($login_error) ) echo $login_error;?></p><br></TD></tr>
<?php if($show_upgrade) { ?>
<tr class="table_color1">
<td COLSPAN=2 ><INPUT TYPE=RADIO value="6" name="inp_opt" id="inp_opt_6"><label for="inp_opt_6">Upgrade In-Portal</label></span></td>
</tr>
<?php } ?>
<tr class="table_color2">
<td COLSPAN=2 >
- <INPUT TYPE="RADIO" NAME="inp_opt" VALUE="1" id="inp_opt_1"><label for="inp_opt_1">Clean out the In-Portal database and reinstall</label><br>
+ <INPUT TYPE="RADIO" NAME="inp_opt" VALUE="1" id="inp_opt_1" <?php echo RadioChecked('inp_opt',1); ?>><label for="inp_opt_1">Clean out the In-Portal database and reinstall</label><br>
</td>
</tr>
<tr class="table_color1">
<td COLSPAN=2 >
- <INPUT TYPE="RADIO" NAME="inp_opt" VALUE="4" id="inp_opt_4"><label for="inp_opt_4">Clean out the In-Portal database and reinstall from backup</label>
+ <INPUT TYPE="RADIO" NAME="inp_opt" VALUE="4" id="inp_opt_4" <?php echo RadioChecked('inp_opt',4); ?>><label for="inp_opt_4">Clean out the In-Portal database and reinstall from backup</label>
</td>
</tr>
<tr class="table_color2">
- <td COLSPAN=2><INPUT TYPE=RADIO value="2" name="inp_opt" id="inp_opt_2"><label for="inp_opt_2">Install to a new database</label></td>
+ <td COLSPAN=2><INPUT TYPE=RADIO value="2" name="inp_opt" id="inp_opt_2" <?php echo RadioChecked('inp_opt',2); ?>><label for="inp_opt_2">Install to a new database</label></td>
</tr>
<tr class="table_color1">
- <td COLSPAN=2><INPUT TYPE=RADIO value="3" name="inp_opt" id="inp_opt_3"><label for="inp_opt_3">Update License Information</label></td>
+ <td COLSPAN=2><INPUT TYPE=RADIO value="3" name="inp_opt" id="inp_opt_3" <?php echo RadioChecked('inp_opt',3); ?>><label for="inp_opt_3">Update License Information</label></td>
</tr>
<tr class="table_color2">
- <td COLSPAN=2 ><INPUT TYPE=RADIO value="5" name="inp_opt" id="inp_opt_5"><label for="inp_opt_5">Change Database Configuration</label></td>
+ <td COLSPAN=2 ><INPUT TYPE=RADIO value="5" name="inp_opt" id="inp_opt_5" <?php echo RadioChecked('inp_opt',5); ?>><label for="inp_opt_5">Change Database Configuration</label></td>
</tr>
<tr class="table_color1">
- <td colspan="2"><p class="error"><?php echo $inst_error; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($inst_error) ) echo $inst_error; ?></p><br/></td>
</tr>
<tr>
<td COLSPAN=2>
<br>
<input TYPE="hidden" NAME ="state" VALUE="reinstall_process">
<input type="hidden" name="next_step" value="2<?php //=$next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
<input type="submit" name="submit_form" value="Continue" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/reinstall.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/install/theme_select.php
===================================================================
--- trunk/admin/install/theme_select.php (revision 314)
+++ trunk/admin/install/theme_select.php (revision 315)
@@ -1,45 +1,45 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select Default Theme</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select Default Theme'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<tr class="table_color2">
<td class="txt">
<b>Default Theme:</b></td>
<td>
<SELECT NAME="theme">
<?php
$objThemes->Clear();
$objThemes->Query_Item("SELECT * FROM ".GetTablePrefix()."Theme");
foreach($objThemes->Items as $t)
{
echo "<OPTION VALUE=\"".$t->Get("ThemeId")."\">".$t->Get("Name")."\n";
}
?>
</SELECT>
</td>
</tr>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $ThemeError; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($ThemeError) ) echo $ThemeError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="theme_set">
<input type="submit" name="submit_form" value="Select" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/theme_select.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/install/domain.php
===================================================================
--- trunk/admin/install/domain.php (revision 314)
+++ trunk/admin/install/domain.php (revision 315)
@@ -1,43 +1,43 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select Domain</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select Domain'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<?php
$current = $_SERVER['HTTP_HOST'];
- echo "<TR class=\"table_color2\"><TD colspan=\"2\" class=\"txt\" align=\"left\">";
- echo "<INPUT TYPE=\"RADIO\" NAME=\"domain\" id=\"domain_1\"checked VALUE=\"1\" $sel>";
+ echo '<TR class="table_color2"><TD colspan="2" class="txt" align="left">';
+ echo '<INPUT TYPE="RADIO" NAME="domain" id="domain_1" VALUE="1" checked>';
echo '<label for="domain_1">'.$current.'</label>';
echo "</TD></TR>\n";
?>
<tr class="table_color2">
<TD COLSPAN=2 align="left" class="txt">
<INPUT TYPE="radio" NAME="domain" VALUE="2" id="domain_2"><label for="domain_2">Other:</label>
<input TYPE="TEXT" NAME="other" VALUE="">
</TD>
</tr>
<tr class="table_color2">
<td colspan="2"><p class="error"><?php echo $DomainError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="set_domain">
<input type="submit" name="submit_form" value="Select" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/domain.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/admin/install/lang_select.php
===================================================================
--- trunk/admin/install/lang_select.php (revision 314)
+++ trunk/admin/install/lang_select.php (revision 315)
@@ -1,39 +1,39 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select Language Packs to Install</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select Language Packs'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<?php
foreach($Packs as $p)
{
echo "<TR class=\"table_color2\"><TD colspan=\"2\" align=\"left\" class=\"txt\">";
echo "<INPUT TYPE=\"CHECKBOX\" NAME=\"lang[]\" VALUE=\"$p\" CHECKED=\"checked\">";
echo substr($p,0,-5);
echo "</TD></TR>\n";
}
?>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $LangError; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($LangError) ) echo $LangError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="lang_install_init">
<input type="submit" name="submit_form" value="Select" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $tmp_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/lang_select.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/admin/install/lang_default.php
===================================================================
--- trunk/admin/install/lang_default.php (revision 314)
+++ trunk/admin/install/lang_default.php (revision 315)
@@ -1,42 +1,42 @@
<td>
<img src="images/icon_install.gif" width="46" height="46" alt="" align="absmiddle">&nbsp;<span class="admintitle">Select Default Language</span><br><br>
<?php section_header('Step '.$tmp_step.' - Select Default Language'); ?>
<table border=0 cellpadding=0 cellspacing=0 width="100%" class="toolbar">
<?php include("install/toolbar.php"); ?>
</table>
<!-- toolbar button \\-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr valign="top">
<td width="60%" bgcolor="#F0F0F0">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="4">
<?php
$checked=" CHECKED";
foreach($Packs as $id=>$p)
{
echo "<TR class=\"tabel_color2\"><TD colspan=\"2\" align=\"left\" class=\"text\">";
echo "<INPUT TYPE=\"RADIO\" NAME=\"lang\" VALUE=\"$id\" $checked>";
echo $p;
echo "</TD></TR>\n";
$checked = "";
}
?>
<tr class="table_color2">
- <td colspan="2"><p class="error"><?php echo $ModuleError; ?></p><br/></td>
+ <td colspan="2"><p class="error"><?php if( isset($ModuleError) ) echo $ModuleError; ?></p><br/></td>
</tr>
<td>
<br>
<input TYPE="hidden" NAME ="state" VALUE="lang_default_set">
<input type="submit" name="submit_form" value="Select" class="button">
<input type="reset" name="Cancel" value="Cancel" class="button" ONCLICK = "history.go(-1);">
<input type="hidden" name="UserPass" VALUE="<?php echo $UserPass; ?>">
<input type="hidden" name="UserName" VALUE="<?php echo $UserName; ?>">
<input type="hidden" name="next_step" value="<?php echo $next_step;?>">
<input type="hidden" name="install_type" value="<?php echo $install_type;?>">
</td>
</tr>
</table>
</td>
\ No newline at end of file
Property changes on: trunk/admin/install/lang_default.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property

Event Timeline