Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F772943
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Feb 1, 9:08 PM
Size
72 KB
Mime Type
text/x-diff
Expires
Mon, Feb 3, 9:08 PM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
556221
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/include/emailmessage.php
===================================================================
--- trunk/kernel/include/emailmessage.php (revision 308)
+++ trunk/kernel/include/emailmessage.php (revision 309)
@@ -1,888 +1,908 @@
<?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;
$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);
}
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)
{
$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";
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.24
\ No newline at end of property
+1.25
\ No newline at end of property
Index: trunk/admin/include/sections.php
===================================================================
--- trunk/admin/include/sections.php (revision 308)
+++ trunk/admin/include/sections.php (revision 309)
@@ -1,611 +1,615 @@
<?php
$sections = array();
class clsSection
{
var $m_sections;
var $m_name;
var $m_title;
var $m_path;
var $m_file;
var $m_icon;
var $m_icon_small;
var $m_icon_list;
var $m_child;
var $m_parent;
var $m_left;
var $m_right;
var $m_notree = 0;
var $m_notabs=0;
var $m_nonavbar=0;
var $m_notitle=0;
var $m_toolbar=0;
var $m_description = NULL;
var $m_onclick=NULL;
var $m_key;
var $m_bar_title;
var $m_bar_title_plain_text = "";
function clsSection()
{
/* constructor */
}
function Get($name)
{
$var = "m_" . $name;
return isset($this->$var) ? $this->$var : '';
}
function Set($name, $value)
{
if (is_array($name))
{
for ($i=0; $i<sizeof($name); $i++)
{
$var = "m_" . $name[$i];
$this->$var = $value[$i];
}
}
else
{
$var = "m_" . $name;
$this->$var = $value;
}
}
function IsJavaScriptLink()
{
$file = $this->Get('file');
if(!$file) return false;
return (substr($file, 0, 10) == 'javascript' || $file == '#') ? true : false;
}
function IconURL($large=1)
{
global $rootURL;
if($large==1)
{
$url = $rootURL.$this->Get("icon");
}
elseif($large==2)
{
$url = $rootURL.$this->Get("icon_list");
}
else
$url = $rootURL.$this->Get("icon_small");
return $url;
}
function URL()
{
global $rootURL;
$env = BuildEnv();
if(!$this->IsJavaScriptLink())
{
$url = $rootURL.$this->Get("path").$this->Get("file");
if(strstr($url,"?"))
{
$url .= "&env=".$env;
}
else
$url .= "?env=".$env;
}
else
$url = $this->Get("file");
return $url;
}
/* functions to display navigation elements */
function tab($envar)
{
global $imagesURL;
$link = $this->URL();
if(!$this->IsJavaScriptLink())
{
if(!strstr($link,"env="))
$link .= "?". $envar;
}
$onclick = $this->Get("onclick");
$caption = language($this->Get("name"));
if(strlen($this->Get("name")))
{
$o ="<!-- Tab: $caption -->
<td><table bgcolor=\"#009FF0\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" onclick=\"\">
<tr onclick=\"$onclick\">
<td bgcolor=\"#009FF0\"><img alt=\"\" src=\"$imagesURL/tab_left.gif\" width=\"15\" height=\"23\"></td>
<td nowrap bgcolor=\"#009FF0\" background=\"$imagesURL/tab_back.gif\" align=\"center\">
<a href=\"$link\" class=\"tab2\" onClick=\"$onclick\">$caption</a><br>
</td>
<td bgcolor=\"#009FF0\"><img alt=\"\" src=\"$imagesURL/tab_right.gif\" width=\"15\" height=\"23\"></td>
</tr>
</table></td>";
}
return $o;
}//Individual Tab
function active_tab()
{
global $imagesURL, $envar;
$link = $this->URL();
$onclick = $this->Get("onclick");
if(!$this->IsJavaScriptLink())
{
if(!strstr($link,"env="))
$link .= "?". $envar;
}
$caption = language($this->Get("name"));
if (strlen($caption)<=8)
$backgr = "$imagesURL/tab_active_back3.jpg";
else if (strlen($caption)<=20)
$backgr = "$imagesURL/tab_active_back2.jpg";
else
$backgr = "$imagesURL/tab_active_back.jpg";
$o = "<!-- Tab: $caption -->
<td><table bgcolor=\"#FFFB32\" background=\"$backgr\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>
<td><img alt=\"\" src=\"$imagesURL/tab_active_left.gif\" width=\"15\" height=\"23\"></td>
<td nowrap align=\"center\" background=\"$imagesURL/tab_active_back.gif\">
<a href=\"$link\" class=\"tab\" onClick=\"$onclick\">$caption</a><br>
</td>
<td><img alt=\"\" src=\"$imagesURL/tab_active_right.gif\" width=\"15\" height=\"23\"></td></tr>
</table></td>";
return $o;
}//Active Tab
} /*clsSection*/
class clsSectionList
{
var $sections;
// var $section;
var $current;
function clsSectionList()
{
$this->sections = array();
$this->current = "default";
}
function GetSection($section)
{
if(is_array($this->sections) && strlen($section))
{
if(array_key_exists($section,$this->sections))
{
return $this->sections[$section];
}
else
return NULL;
}
else
return NULL;
}
function SetCurrentSection($section)
{
$this->current = $section;
}
function GetCurrentSection()
{
$ret = $this->GetSection($this->current);
if(!is_object($ret))
$ret = $this->GetSection("default");
return $ret;
}
function SimpleSection($module, $section_name, $tab_phrase, $title_phrase, $path, $script, $child,$parent,$left,$right)
{
// simplified method to add sections
global $pathtoroot;
$sn = explode(':', $section_name);
$img_path = $module.'/admin/images';
if( !isset($title_phrase) ) $title_phrase = $tab_phrase;
$this->AddSection( $section_name,$tab_phrase, $title_phrase,$path, $script,
$img_path.'/icon46_'.$sn[1].'.gif', $img_path.'/icon24_'.$sn[1].'.gif',
$child,$parent,$left,$right,0,'',1,null,null,null,$img_path.'/icon46_list_'.$sn[1].'.gif');
}
function AddSection($section,$name,$title,$path,$file,$icon,$icon_small, $child,$parent,$left,$right,
$notree=0,$onClick = "",$notabs=0,$nonavbar=0,$notitle=0,$toolbar=0,$icon_list="", $bar_title = "", $bar_title_plain_text = "")
{
if($file == "subitems.php")
$file .= "?section=$section";
$s = new clsSection();
$s->Set("name", $name);
$s->Set("title",$title);
$s->Set("path", $path);
$s->Set("file", $file);
$s->Set("icon", $icon);
$s->Set("icon_list", $icon_list);
$s->Set("icon_small", $icon_small);
$s->Set("child", $child);
$s->Set("parent", $parent);
$s->Set("left", $left);
$s->Set("right", $right);
$s->Set("notree", $notree);
$s->Set("notabs", $notabs);
$s->Set("nonavbar", $nonavbar);
$s->Set("notitle", $notitle);
$s->Set("toolbar", $toolbar);
$s->Set("description", NULL);
$s->Set("onclick", $onClick);
$s->Set("key",$section);
$s->Set("bar_title",$bar_title);
$s->Set("bar_title_plain_text", $bar_title_plain_text);
if($parent != NULL)
{
$p = $this->GetSection($parent);
if(is_object($p))
{
if(!strlen($p->Get("child")))
{
//echo "Setting child of $parent to $section<br>\n";
$p->Set("child", $section); //set the parent if none set!
$this->sections[$parent]=$p;
}
}
if(!strlen($left) && !strlen($right))
{
/* find first child w/ a null right value */
foreach($this->sections as $secname => $subsection)
{
if($subsection->Get("parent") == $parent)
{
if(!strlen($subsection->Get("right")))
{
$this->sections[$secname]->Set("right", $section);
$s->Set("left", $secname);
break;
}
}
}
}
}
$this->sections[$section]=$s;
}
function AddDescription($section,$desc)
{
$sec = $this->GetSection($section);
if(is_object($sec))
{
$sec->Set("description",$desc);
$this->sections[$section] = $sec;
}
}
function sectionURL($section)
{
return $this->sections[$section]->URL();
}
function SectionIconURL($section,$large=1)
{
return $this->sections[$section]->IconURL($large);
}
function BuildTree($element, $parent)
{
global $pathtoroot,$envar;
global $rootURL;
$org = $element;
$element = strtolower($element);
$j_el=str_replace("-","_",$element);
$j_el=str_replace(":","_",$j_el);
$j_par=str_replace("-","_",$parent);
$j_par=str_replace(":","_",$j_par);
$sec = $this->sections[$element];
if(is_object($sec))
{
$caption = $this->sections[$element]->Get("name");
if(strlen($caption)==0)
$caption = $this->sections[$element]->Get("title");
$caption = language($caption);
$child =$this->sections[$element]->Get("child");
$notree = "";
if( isset($this->sections[$child]) && is_object($this->sections[$child]) )
$notree = $this->sections[$child]->Get("notree");
if (($child == NULL) or ($notree==-1))
{
print "var item = insDoc($j_par, gLnk(0, \"".$caption."\", \"".$this->SectionURL($element)."\"));\n";
print "item.iconSrc = '".$this->SectionIconURL($element,0)."';\n";
if($this->sections[$element]->Get("right")!=NULL)
$this->BuildTree($this->sections[$element]->Get("right"), $parent);
return;
}
if ($child != NULL && $notree !=-1)
{ //print "$j_el = insFld($j_par, gFld(\"".$sections[$element]['name']."\"));\n";
print "var $j_el = insFld($j_par, gFld(\"".$caption."\",\"".$this->SectionURL($element)."\"));\n";
print $j_el . ".iconSrc='".$this->SectionIconURL($element,0)."';\n";
if($this->sections[$element]->Get("right")!=NULL)
$this->BuildTree($this->sections[$element]->Get("right"), $parent);
$parent = $element;
$this->BuildTree($this->sections[$element]->Get("child"), $parent);
}
}
}
function page_title()
{
global $imagesURL,$adminURL, $objConfig;
$o = "";
$sec = $this->GetCurrentSection();
if($sec->Get("notitle")!="1")
{
$caption = $sec->Get("title");
if(strlen($caption)==0)
{
if(strlen($sec->Get("parent")))
{
$p = $this->GetSection($sec->Get("parent"));
if(is_object($p))
{
$caption = $p->Get("title");
$icon = $p->IconURL(1);
}
}
}
else
$icon = $sec->IconURL(1);
$logout_link = $adminURL."/index.php";
if(strlen($caption))
{
if($sec->Get("key")=="in-portal:root")
{
$caption=stripslashes($objConfig->Get("Site_Name"));
}
else
{
$caption = admin_language($caption);
}
$bg_image = 'logo_bg.gif';
$replace_modules = Array('in-link','in-news','in-bulletin');
foreach($replace_modules as $r_module)
if( $this->IsModule($r_module) )
{
$bg_image = 'logo_bg_'.$r_module.'.gif';
break;
}
$o = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'>
<div style='position:absolute; width:100%;top:0px;' align='right'>
<img src='".$imagesURL.'/'.$bg_image."'></div><img src='".$imagesURL."/spacer.gif' width=1 height=7>
<br><div style='z-Index:1; position:relative'>";
$o .= "<!-- ADMIN TITLE --><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">
<tr><td valign=\"top\" class=\"admintitle\" align=\"left\">
<img alt=\"\" width=\"46\" height=\"46\" src=\"$icon\" align=\"absmiddle\"> $caption<br>
<img src='".$imagesURL."/spacer.gif' width=1 height=4><br>
</td></tr></table>";
}
}
return $o;
}
function IsModule($module_name)
{
// checks if there is requested module used in right frame
// module folder match
$url_split = explode('/', $_SERVER['PHP_SELF']);
if( in_array($module_name, $url_split) ) return 1;
// module section match
if( isset($_REQUEST['section']) )
{
$section = explode(':', $_GET['section']);
if( $section[0] == $module_name ) return true;
}
return false;
}
function page_tabs($envar)
{
$showtabs=0;
$o = '';
$sec = $this->GetCurrentSection();
if ($sec->Get("notabs")!=1)
{
//get starting node
$node = $sec;
while (strlen($node->Get("left")))
{
$node = $this->GetSection($node->Get("left"));
}
if($node)
{
$o = "<!-- TABS --><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr>
<td align=\"right\" width=\"100%\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" height=\"23\">
<tr>";
$showtabs=1;
}
//traverse and print tabs
while ( isset($node) && is_object($node) )
{
if ($node->Get("key") == $this->current)
$o .= $node->active_tab();
else
$o .= $node->tab($envar);
$right = $node->Get("right");
unset($node);
if(strlen($right))
$node = $this->GetSection($right);
}
if($showtabs)
{
$o .= "</tr></table></td></tr></table>";
}
}
return $o;
}
function section_header($envar,$navbar=NULL,$extra_title=NULL, $no_help = false)
{
global $pathtoroot;
global $pathtolocal;
global $imagesURL;
global $adminURL;
global $objConfig;
$output = '';
$HelpIcon = $imagesURL."/blue_bar_help.gif";
$node = $this->GetCurrentSection();
if(is_object($node))
{
$helpURL = $adminURL.'/help/help.php?'.( substr($envar,0,3) == 'env' ? '' : 'env=').$envar.'&destform=popup';
$node_key = $node->Get('key');
$o = "<!-- SECTION NAVIGATOR -->";
//background="'.$imagesURL.'/tabnav_left.jpg"
if($no_help == false) $o .= '<form name="help_form" id="help_form" action="'.$helpURL.'" method="post"><input type="hidden" id="section" name="section" value=""></form>';
$o .= '<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">';
$o .= '<tr><TD class="header_left_bg" width="100%">';
//get path up to the parent node
while ( isset($node) && is_object($node) )
{
if(!strlen($extra_title))
{
$bar_title = $node->Get("bar_title");
$bar_title_plain_text = $node->Get("bar_title_plain_text");
if(strlen($bar_title) && !is_null($bar_title))
$caption = language($bar_title);
elseif (is_null($bar_title))
$caption = "";
else
$caption = language($node->Get("name"));
if (strlen($bar_title_plain_text))
$caption.= $bar_title_plain_text;
}
else
$caption = $extra_title;
$output = "<span class=\"tablenav_link\">$caption</span>";
unset($node);
}
$o .= $output;
if(strlen($navbar))
$o .= "::<b>".$navbar."</b>";
$o .= "</td><td align=\"right\" class=\"tablenav\" background=\"$imagesURL/tabnav_back.jpg\" width=\"10\">";
if($no_help == false) $o .= "<a class=\"link\" onclick=\"ShowHelp('".$node_key."');\"><img src=\"$HelpIcon\" border=\"0\"></A>";
$o .= "</td></tr></table><!-- END SECTION NAVIGATOR -->";
}
return $o;
}
} /* clsSectionList */
$objSections = new clsSectionList();
$objSections->AddSection("in-portal:root", $objConfig->Get("Site_Name"), $objConfig->Get("Site_Name"), $admin."/","subitems.php",
$admin."/icons/icon46_site.gif", $admin."/icons/icon24_site.gif",
"in-portal:site", NULL, NULL,"in-portal:users",0,"",1, NULL,NULL,NULL, "", "la_section_overview");
$objSections->AddSection("in-portal:site", "la_tab_Site_Structure","la_title_Site_Structure", $admin."/","subitems.php",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_struct.gif",
"in-portal:browse", "in-portal:root", NULL,"in-portal:users",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_struct.gif","la_selecting_categories");
$objSections->AddSection("in-portal:users","la_tab_Community","la_title_Community",$admin."/","subitems.php",
$admin."/icons/icon46_community.gif",$admin."/icons/icon24_community.gif", NULL,"in-portal:root","in-portal:site","in-portal:modules",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_community.gif","la_section_overview");
$objSections->AddSection("in-portal:modules","la_tab_ModulesSettings","la_title_Settings",$admin."/","subitems.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, "in-portal:root","in-portal:users","in-portal:reports",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif","la_section_overview");
$objSections->AddSection("in-portal:mod_status","la_tab_Modules","la_title_Module_Status",$admin."/modules/","mod_status.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, NULL,NULL,NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif");
$objSections->AddSection("in-portal:addmodule","la_tab_Modules","la_title_Add_Module",$admin."/modules/","addmodule.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",NULL, NULL,NULL,NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_modules.gif");
$objSections->AddSection("in-portal:reports","la_tab_Reports","la_title_Reports",$admin."/","subitems.php",
$admin."/icons/icon46_summary_logs.gif",$admin."/icons/icon24_summary_logs.gif",NULL, "in-portal:root","in-portal:modules","in-portal:system",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_summary_logs.gif","la_section_overview");
$objSections->AddSection("in-portal:log_summary","la_tab_Summary","la_tab_Summary",$admin."/logs/","summary.php",
$admin."/icons/icon46_summary.gif",$admin."/icons/icon24_summary.gif",NULL,
"in-portal:reports",NULL,"in-portal:searchlog",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_summary.gif");
$objSections->AddSection("in-portal:searchlog","la_tab_SearchLog","la_tab_SearchLog",$admin."/logs/","searchlog.php",
$admin."/icons/icon46_search_log.gif",$admin."/icons/icon24_search_log.gif",
NULL,"in-portal:reports","in-portal:log_summary","in-portal:sessionlog",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_search_log.gif");
$objSections->AddSection("in-portal:sessionlog","la_tab_SessionLog","la_tab_SessionLog",$admin."/logs/","session_list.php",
$admin."/icons/icon46_sessions_log.gif",$admin."/icons/icon24_sessions_log.gif",
- NULL,"in-portal:reports","in-portal:sessionlog",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_sessions_log.gif");
+ NULL,"in-portal:reports","in-portal:sessionlog",'in-portal:emaillog',0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_sessions_log.gif");
+
+$objSections->AddSection("in-portal:emaillog","la_tab_EmailLog","la_tab_EmailLog",$admin."/logs/","email_log.php",
+ $admin."/icons/icon46_sessions_log.gif",$admin."/icons/icon24_sessions_log.gif",
+ NULL,"in-portal:reports","in-portal:emaillog",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_sessions_log.gif");
/* Help */
$objSections->AddSection("in-portal:help","la_tab_Help","la_title_Help",$admin."/help/","manual.pdf",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:root","in-portal:system",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
/*
$objSections->AddSection("in-portal:help","la_tab_Help","la_title_Help",$admin."/help/topics/","download.html",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:root","in-portal:system",NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
$objSections->AddSection("in-portal:help_overview","la_tab_Overview","la_title_Help",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"in-portal:help",NULL,"in-portal:help_ch1",NULL,NULL,NULL,NULL,NULL,NULL,$admin."/icons/icon46_list_help.gif");
$objSections->AddSection("in-portal:help_ch1","Chapter 1","Chapter 1",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"inportal:help","in-portal:help_overview","in-portal:help_ch2");
$objSections->AddSection("in-portal:help_ch2","Chapter 2","Chapter 2",$admin."/help/","help.php",
$admin."/icons/icon46_help.gif",$admin."/icons/icon24_help.gif",
NULL,"inportal:help","in-portal:help_ch1",NULL);
*/
/* Help ends */
$objSections->AddSection("in-portal:item_select","la_title_Select_Item","Select Item",$admin."/","item_select.php","","",
NULL,NULL,NULL,0,"",1,1);
$objSections->AddSection("in-portal:rel_select","la_title_Select_Target_Item","Select Item",$admin."/","rel_select.php","","",
NULL,NULL,NULL,0,"",1,0,1,1);
$NewButtons = array();
/* each module will add to the array declared below, which contains the info for the
'new' button for the module's Browse data. The array is an array of arrays,
and the subarray should contain the following indexes:
ImagePath = URL to the directory containing the image
Action = Action attribute of the image (this is also the "base name" of the image
Alt = Image ALT value
Tab = If set, button will only be displayed when this div is active
*/
$m = GetModuleArray("admin");
if(is_array($m))
{
foreach($m as $key=>$value)
{
$mod = $pathtoroot . $value . "admin/include/navmenu.php";
include_once($mod);
}
}
$objSections->AddSection("default","","",$admin."/","#",NULL,NULL,NULL,NULL,NULL,NULL);
?>
Property changes on: trunk/admin/include/sections.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql
===================================================================
--- trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql (nonexistent)
+++ trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql (revision 309)
@@ -0,0 +1,11 @@
+CREATE TABLE EmailLog (
+ EmailLogId INT(11) NOT NULL ,
+ fromuser VARCHAR(200) NOT NULL ,
+ addressto VARCHAR(255) NOT NULL ,
+ subject VARCHAR(255) NOT NULL ,
+ timestamp BIGINT NOT NULL ,
+ event VARCHAR(100) NOT NULL ,
+PRIMARY KEY (EmailLogId)
+)
+
+UPDATE Modules SET Version = '1.0.7' WHERE Name = 'In-Portal';
\ No newline at end of file
Property changes on: trunk/admin/install/upgrades/inportal_upgrade_v1.0.7.sql
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/admin/install/inportal_schema.sql
===================================================================
--- trunk/admin/install/inportal_schema.sql (revision 308)
+++ trunk/admin/install/inportal_schema.sql (revision 309)
@@ -1,500 +1,510 @@
CREATE TABLE BanRules (
RuleId int(11) NOT NULL auto_increment,
RuleType tinyint(4) NOT NULL default '0',
ItemField varchar(255) default NULL,
ItemVerb tinyint(4) NOT NULL default '0',
ItemValue varchar(255) NOT NULL default '',
ItemType int(11) NOT NULL default '0',
Priority int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '1',
ErrorTag varchar(255) default NULL,
PRIMARY KEY (RuleId)
)
# --------------------------------------------------------
CREATE TABLE Category (
CategoryId int(11) NOT NULL auto_increment,
Type int(11) NOT NULL default '0',
ParentId int(11) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
Description text NOT NULL,
CreatedOn double NOT NULL default '0',
EditorsPick tinyint(4) default NULL,
Status tinyint(4) NOT NULL default '0',
Pop tinyint(4) default NULL,
Priority int(11) default NULL,
MetaKeywords varchar(255) default NULL,
CachedDescendantCatsQty int(11) default NULL,
CachedNavbar text NOT NULL,
CreatedById int(11) NOT NULL default '0',
ResourceId int(11) default NULL,
ParentPath text NOT NULL,
MetaDescription varchar(255) default NULL,
HotItem int(11) NOT NULL default '2',
NewItem int(11) NOT NULL default '2',
PopItem int(11) NOT NULL default '2',
Modified double NOT NULL default '0',
ModifiedById int(11) NOT NULL default '0',
PRIMARY KEY (CategoryId),
KEY ParentId (ParentId),
KEY ResourceId (ResourceId),
KEY Modified (Modified),
KEY Priority (Priority),
KEY sorting (Name,Priority)
)
# --------------------------------------------------------
CREATE TABLE CategoryItems (
CategoryId int(11) NOT NULL default '0',
ItemResourceId int(11) NOT NULL default '0',
PrimaryCat tinyint(4) NOT NULL default '0',
PRIMARY KEY (CategoryId,ItemResourceId),
KEY ItemResourceId (ItemResourceId),
KEY PrimaryCat (PrimaryCat)
)
# --------------------------------------------------------
CREATE TABLE ConfigurationAdmin (
VariableName varchar(80) NOT NULL default '',
heading varchar(255) default NULL,
prompt varchar(255) default NULL,
element_type varchar(20) NOT NULL default '',
validation varchar(255) default NULL,
ValueList varchar(255) default NULL,
DisplayOrder int(11) NOT NULL default '0',
Install int(11) NOT NULL default '1',
PRIMARY KEY (VariableName)
)
# --------------------------------------------------------
CREATE TABLE ConfigurationValues (
VariableName varchar(255) NOT NULL default '',
VariableValue varchar(255) default NULL,
ModuleOwner varchar(20) default 'In-Portal',
Section varchar(255) NOT NULL default '',
PRIMARY KEY (VariableName)
)
# --------------------------------------------------------
CREATE TABLE CountCache (
ListType int(11) NOT NULL default '0',
ItemType int(11) NOT NULL default '-1',
Value int(11) NOT NULL default '0',
CountCacheId int(11) NOT NULL auto_increment,
LastUpdate int(11) NOT NULL default '0',
ExtraId varchar(50) default NULL,
TodayOnly tinyint(4) NOT NULL default '0',
PRIMARY KEY (CountCacheId)
)
# --------------------------------------------------------
CREATE TABLE CustomField (
CustomFieldId int(11) NOT NULL auto_increment,
Type int(11) NOT NULL default '0',
FieldName varchar(255) NOT NULL default '',
FieldLabel varchar(40) default NULL,
Heading varchar(60) default NULL,
Prompt varchar(60) default NULL,
ElementType varchar(50) NOT NULL default '',
ValueList varchar(255) default NULL,
DisplayOrder int(11) NOT NULL default '0',
OnGeneralTab tinyint(4) NOT NULL default '0',
PRIMARY KEY (CustomFieldId),
KEY Type (Type)
)
# --------------------------------------------------------
CREATE TABLE CustomMetaData (
CustomDataId int(11) NOT NULL auto_increment,
ResourceId int(11) NOT NULL default '0',
CustomFieldId int(11) NOT NULL default '0',
Value text NOT NULL,
PRIMARY KEY (CustomDataId)
)
# --------------------------------------------------------
CREATE TABLE EmailMessage (
EmailMessageId int(10) NOT NULL auto_increment,
Template longtext,
MessageType enum('html','text') NOT NULL default 'text',
LanguageId int(11) NOT NULL default '0',
EventId int(11) NOT NULL default '0',
PRIMARY KEY (EmailMessageId)
)
# --------------------------------------------------------
CREATE TABLE EmailQueue (
Subject text NOT NULL,
toaddr text NOT NULL,
fromaddr text NOT NULL,
message blob,
headers blob,
queued timestamp NOT NULL
)
# --------------------------------------------------------
CREATE TABLE EmailSubscribers (
EmailMessageId int(11) NOT NULL default '0',
PortalUserId int(11) NOT NULL default '0'
)
# --------------------------------------------------------
CREATE TABLE Events (
EventId int(11) NOT NULL auto_increment,
Event varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
FromUserId int(11) NOT NULL default '0',
Module varchar(40) NOT NULL default '',
Description varchar(255) NOT NULL default '',
Type int(11) NOT NULL default '0',
PRIMARY KEY (EventId)
)
# --------------------------------------------------------
CREATE TABLE Favorites (
FavoriteId int(11) NOT NULL auto_increment,
PortalUserId int(11) NOT NULL default '0',
ResourceId int(11) NOT NULL default '0',
ItemTypeId int(11) NOT NULL default '0',
Modified int(11) NOT NULL default '0',
PRIMARY KEY (FavoriteId),
UNIQUE KEY main (PortalUserId,ResourceId)
)
# --------------------------------------------------------
CREATE TABLE IdGenerator (
lastid int(11) default NULL
)
# --------------------------------------------------------
CREATE TABLE Images (
ImageId int(11) NOT NULL auto_increment,
ResourceId int(11) NOT NULL default '0',
Url varchar(255) NOT NULL default '',
Name varchar(255) NOT NULL default '',
AltName varchar(255) default NULL,
ImageIndex int(11) NOT NULL default '0',
LocalImage tinyint(4) NOT NULL default '1',
LocalPath varchar(240) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
DefaultImg int(11) NOT NULL default '0',
ThumbUrl varchar(255) default NULL,
Priority int(11) NOT NULL default '0',
ThumbPath varchar(255) default NULL,
LocalThumb tinyint(4) NOT NULL default '0',
SameImages tinyint(4) NOT NULL default '0',
PRIMARY KEY (ImageId),
KEY ResourceId (ResourceId)
)
# --------------------------------------------------------
CREATE TABLE ItemRating (
RatingId int(11) NOT NULL auto_increment,
IPAddress varchar(255) NOT NULL default '',
CreatedOn double NOT NULL default '0',
RatingValue int(11) NOT NULL default '0',
ItemId int(11) NOT NULL default '0',
PRIMARY KEY (RatingId)
)
# --------------------------------------------------------
CREATE TABLE ItemReview (
ReviewId int(11) NOT NULL auto_increment,
CreatedOn double NOT NULL default '0',
ReviewText longtext NOT NULL,
IPAddress varchar(255) NOT NULL default '',
ItemId int(11) NOT NULL default '0',
CreatedById int(11) NOT NULL default '0',
ItemType tinyint(4) NOT NULL default '0',
Priority int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '0',
TextFormat int(11) NOT NULL default '0',
Module varchar(255) NOT NULL default '',
PRIMARY KEY (ReviewId)
)
# --------------------------------------------------------
CREATE TABLE ItemTypes (
ItemType int(11) NOT NULL default '0',
Module varchar(50) NOT NULL default '',
SourceTable varchar(100) NOT NULL default '',
TitleField varchar(50) default NULL,
CreatorField varchar(255) NOT NULL default '',
PopField varchar(255) default NULL,
RateField varchar(255) default NULL,
LangVar varchar(255) NOT NULL default '',
PrimaryItem int(11) NOT NULL default '0',
EditUrl varchar(255) NOT NULL default '',
ClassName varchar(40) NOT NULL default '',
ItemName varchar(50) NOT NULL default '',
PRIMARY KEY (ItemType),
KEY Module (Module)
)
# --------------------------------------------------------
CREATE TABLE Language (
LanguageId int(11) NOT NULL auto_increment,
PackName varchar(40) NOT NULL default '',
LocalName varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '0',
PrimaryLang int(11) NOT NULL default '0',
IconURL varchar(255) default NULL,
DateFormat varchar(50) NOT NULL default '',
TimeFormat varchar(50) NOT NULL default '',
DecimalPoint char(2) NOT NULL default '.',
ThousandSep char(1) NOT NULL default ',',
PRIMARY KEY (LanguageId)
)
# --------------------------------------------------------
CREATE TABLE Modules (
Name varchar(255) NOT NULL default '',
Path varchar(255) NOT NULL default '',
Var varchar(10) NOT NULL default '',
Version varchar(10) NOT NULL default '',
Loaded tinyint(4) NOT NULL default '1',
LoadOrder tinyint(4) NOT NULL default '0',
TemplatePath varchar(255) NOT NULL default '',
RootCat int(11) NOT NULL default '0',
BuildDate double NOT NULL default '0',
PRIMARY KEY (Name)
)
# --------------------------------------------------------
CREATE TABLE PermCache (
PermCacheId int(11) NOT NULL auto_increment,
CategoryId int(11) NOT NULL default '0',
PermId int(11) NOT NULL default '0',
ACL varchar(255) NOT NULL default '',
DACL varchar(255) NOT NULL default '',
PRIMARY KEY (PermCacheId),
KEY CategoryId (CategoryId),
KEY PermId (PermId)
)
# --------------------------------------------------------
CREATE TABLE PermissionConfig (
PermissionConfigId int(11) NOT NULL auto_increment,
PermissionName varchar(30) NOT NULL default '',
Description varchar(255) NOT NULL default '',
ErrorMessage varchar(255) NOT NULL default '',
ModuleId varchar(20) NOT NULL default '0',
PRIMARY KEY (PermissionConfigId),
KEY PermissionName (PermissionName)
)
# --------------------------------------------------------
CREATE TABLE Permissions (
PermissionId int(11) NOT NULL auto_increment,
Permission varchar(30) NOT NULL default '',
GroupId int(11) default '0',
PermissionValue int(11) NOT NULL default '0',
Type tinyint(4) NOT NULL default '0',
CatId int(11) NOT NULL default '0',
PRIMARY KEY (PermissionId)
)
# --------------------------------------------------------
CREATE TABLE PersistantSessionData (
PortalUserId int(11) NOT NULL default '0',
VariableName varchar(255) NOT NULL default '',
VariableValue text NOT NULL,
KEY UserId (PortalUserId),
KEY VariableName (VariableName)
)
# --------------------------------------------------------
CREATE TABLE Phrase (
Phrase varchar(255) NOT NULL default '',
Translation varchar(255) NOT NULL default '',
PhraseType int(11) NOT NULL default '0',
PhraseId int(11) NOT NULL auto_increment,
LanguageId int(11) NOT NULL default '0',
PRIMARY KEY (PhraseId),
INDEX Phrase_Index (Phrase)
)
# --------------------------------------------------------
CREATE TABLE PhraseCache (
Template varchar(40) NOT NULL default '',
PhraseList text NOT NULL,
CacheDate int(11) NOT NULL default '0',
ThemeId int(11) NOT NULL default '0',
PRIMARY KEY (Template)
)
# --------------------------------------------------------
CREATE TABLE PortalGroup (
GroupId int(11) NOT NULL auto_increment,
Name varchar(255) NOT NULL default '',
Description varchar(255) default NULL,
CreatedOn double NOT NULL default '0',
System tinyint(4) NOT NULL default '0',
Personal tinyint(4) NOT NULL default '0',
Enabled tinyint(4) NOT NULL default '1',
ResourceId int(11) NOT NULL default '0',
PRIMARY KEY (GroupId),
UNIQUE KEY Name (Name),
KEY ResourceId (ResourceId),
KEY Personal (Personal),
KEY Enabled (Enabled)
)
# --------------------------------------------------------
CREATE TABLE PortalUser (
PortalUserId int(11) NOT NULL auto_increment,
Login varchar(255) default NULL,
Password varchar(255) default NULL,
FirstName varchar(255) default NULL,
LastName varchar(255) default NULL,
Email varchar(255) NOT NULL default '',
CreatedOn double NOT NULL default '0',
Phone varchar(20) default NULL,
Street varchar(255) default NULL,
City varchar(20) default NULL,
State varchar(20) default NULL,
Zip varchar(20) default NULL,
Country varchar(20) NOT NULL default '',
ResourceId int(11) NOT NULL default '0',
Status tinyint(4) NOT NULL default '2',
Modified int(11) NOT NULL default '0',
dob double NOT NULL default '0',
tz int(11) default NULL,
ip varchar(20) default NULL,
IsBanned tinyint(1) NOT NULL default '0',
PRIMARY KEY (PortalUserId),
UNIQUE KEY Login (Login),
KEY ResourceId (ResourceId),
KEY CreatedOn (CreatedOn)
)
# --------------------------------------------------------
CREATE TABLE Relationship (
RelationshipId int(11) NOT NULL auto_increment,
SourceId int(11) default NULL,
TargetId int(11) default NULL,
SourceType tinyint(4) NOT NULL default '0',
TargetType tinyint(4) NOT NULL default '0',
Type int(11) NOT NULL default '0',
Enabled int(11) NOT NULL default '1',
Priority int(11) NOT NULL default '0',
PRIMARY KEY (RelationshipId),
KEY RelSource (SourceId),
KEY RelTarget (TargetId)
)
# --------------------------------------------------------
CREATE TABLE SearchConfig (
TableName varchar(40) NOT NULL default '',
FieldName varchar(40) NOT NULL default '',
SimpleSearch tinyint(4) NOT NULL default '0',
AdvancedSearch tinyint(4) NOT NULL default '0',
Description varchar(255) default NULL,
DisplayName varchar(80) default NULL,
ModuleName varchar(20) default NULL,
ConfigHeader varchar(255) default NULL,
DisplayOrder int(11) NOT NULL default '0',
SearchConfigId int(11) NOT NULL auto_increment,
Priority int(11) NOT NULL default '0',
FieldType varchar(20) NOT NULL default 'text',
ForeignField varchar(255) default NULL,
JoinClause varchar(255) default NULL,
IsWhere text,
IsNotWhere text,
ContainsWhere text,
NotContainsWhere text,
CustomFieldId int(11) NOT NULL default '0',
PRIMARY KEY (SearchConfigId)
)
# --------------------------------------------------------
CREATE TABLE SearchLog (
SearchLogId int(11) NOT NULL auto_increment,
Keyword varchar(255) NOT NULL default '',
Indices bigint(20) NOT NULL default '0',
SearchType int(11) NOT NULL default '0',
PRIMARY KEY (SearchLogId)
)
# --------------------------------------------------------
CREATE TABLE SessionData (
SessionKey varchar(50) NOT NULL default '',
VariableName varchar(255) NOT NULL default '',
VariableValue text NOT NULL,
KEY SessionKey (SessionKey),
KEY VariableName (VariableName)
)
# --------------------------------------------------------
CREATE TABLE SpamControl (
ItemResourceId int(11) NOT NULL default '0',
IPaddress varchar(20) NOT NULL default '',
Expire double NOT NULL default '0',
PortalUserId int(11) NOT NULL default '0',
DataType varchar(20) default NULL
)
# --------------------------------------------------------
CREATE TABLE StatItem (
StatItemId int(11) NOT NULL auto_increment,
Module varchar(20) NOT NULL default '',
ValueSQL varchar(255) default NULL,
ResetSQL varchar(255) default NULL,
ListLabel varchar(255) NOT NULL default '',
Priority int(11) NOT NULL default '0',
AdminSummary int(11) NOT NULL default '0',
PRIMARY KEY (StatItemId)
)
# --------------------------------------------------------
CREATE TABLE Theme (
ThemeId int(11) NOT NULL auto_increment,
Name varchar(40) NOT NULL default '',
Enabled int(11) NOT NULL default '1',
Description varchar(255) default NULL,
PrimaryTheme int(11) NOT NULL default '0',
CacheTimeout int(11) NOT NULL default '0',
PRIMARY KEY (ThemeId)
)
# --------------------------------------------------------
CREATE TABLE ThemeFiles (
FileId int(11) NOT NULL auto_increment,
ThemeId int(11) NOT NULL default '0',
FileName varchar(255) NOT NULL default '',
FilePath varchar(255) NOT NULL default '',
Description varchar(255) default NULL,
FileType int(11) NOT NULL default '0',
PRIMARY KEY (FileId)
)
# --------------------------------------------------------
CREATE TABLE UserGroup (
PortalUserId int(11) NOT NULL default '0',
GroupId int(11) NOT NULL default '0',
PrimaryGroup tinyint(4) NOT NULL default '1',
PRIMARY KEY (PortalUserId,GroupId),
KEY GroupId (GroupId),
KEY PrimaryGroup (PrimaryGroup)
)
# --------------------------------------------------------
CREATE TABLE UserSession (
SessionKey varchar(50) NOT NULL default '',
CurrentTempKey varchar(50) default NULL,
PrevTempKey varchar(50) default NULL,
LastAccessed double NOT NULL default '0',
PortalUserId varchar(255) NOT NULL default '',
Language varchar(255) NOT NULL default '',
Theme varchar(255) NOT NULL default '',
GroupId int(11) NOT NULL default '0',
IpAddress varchar(20) NOT NULL default '0.0.0.0',
Status int(11) NOT NULL default '1',
GroupList varchar(255) default NULL,
tz int(11) default NULL,
PRIMARY KEY (SessionKey),
KEY UserId (PortalUserId),
KEY LastAccessed (LastAccessed)
)
# --------------------------------------------------------
CREATE TABLE SuggestMail (
email varchar(255) NOT NULL default '',
sent double,
PRIMARY KEY (email)
)
# --------------------------------------------------------
CREATE TABLE SysCache (
SysCacheId int(11) NOT NULL auto_increment,
Name varchar(255) NOT NULL default '',
Value mediumtext,
Expire double NOT NULL default '0',
Module varchar(20) default NULL,
Context varchar(255) default NULL,
GroupList varchar(255) NOT NULL default '',
PRIMARY KEY (SysCacheId),
KEY Name (Name)
)
# --------------------------------------------------------
CREATE TABLE TagLibrary (
TagId int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
description text,
example text,
scope varchar(20) NOT NULL default 'global',
PRIMARY KEY (TagId)
)
# --------------------------------------------------------
CREATE TABLE TagAttributes (
AttrId int(11) NOT NULL auto_increment,
TagId int(11) NOT NULL default '0',
Name varchar(255) NOT NULL default '',
AttrType varchar(20) default NULL,
DefValue varchar(255) default NULL,
Description TEXT,
Required int(11) NOT NULL default '0',
PRIMARY KEY (AttrId)
)
+# --------------------------------------------------------
+CREATE TABLE EmailLog (
+ EmailLogId INT(11) NOT NULL ,
+ fromuser VARCHAR(200) NOT NULL ,
+ addressto VARCHAR(255) NOT NULL ,
+ subject VARCHAR(255) NOT NULL ,
+ timestamp BIGINT NOT NULL ,
+ event VARCHAR(100) NOT NULL ,
+PRIMARY KEY (EmailLogId)
+)
Property changes on: trunk/admin/install/inportal_schema.sql
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Event Timeline
Log In to Comment