function sendNewSysMessage($fromid, $recipients, $message, $systemmsg=0, $validfor=0, $sendnotification=0, $forceembedded=0) { $database = uddeIMgetDatabase(); if ($systemmsg) { // system message $sendername = $this->config->sysm_username; $savesysflag = addslashes($sendername); // system message $savedisablereply = 1; // and users can't reply to them $emn_fromid = 0; // for email notifications set userid 0 } else { $sendername = uddeIMgetNameFromID($fromid, $this->config); $savesysflag = addslashes($sendername); $savedisablereply = 0; $emn_fromid = $fromid; } $savedatum = uddetime($this->config->timezone); if ($validfor>0) { $now = uddetime($this->config->timezone); $validuntil = $now+($validfor*3600); } else { $validuntil = 0; } if ($this->config->cryptmode>=1) { // because of encoding do not use slashes $savemessage = strip_tags($message); } else { $savemessage = addslashes(strip_tags($message)); // original 0.6+ } getAdditonalGroups($add_special, $add_admin, $config); if (uddeIMcheckJversion()>=2) { // J1.6 if ($recipients=="all") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($recipients=="online") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($recipients=="special") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (3,4,5,6,7,8".$add_admin.$add_special.")"; } elseif($recipients=="admins") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (7,8".$add_admin.")"; } else { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id=".(int)$recipients; } } else { if ($recipients=="all") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($recipients=="online") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($recipients=="special") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (19,20,21,23,24,25".$add_admin.")"; } elseif($recipients=="admins") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")"; } else { $sql="SELECT id FROM #__users WHERE block=0 AND gid=".(int)$recipients; } } $database->setQuery($sql); $receivers=$database->loadObjectList(); if (!count($receivers)) { return 1; } foreach($receivers as $receiver) { $toid = $receiver->id; $themode = 0; if ($this->config->cryptmode==1 || $this->config->cryptmode==2 || $this->config->cryptmode==4) { $themode = 1; $cm = uddeIMencrypt($savemessage,$this->config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",1,'".md5($this->config->cryptkey)."')"; } elseif ($this->config->cryptmode==3) { $themode = 3; $cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",3)"; } else { $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox) VALUES (".(int)$fromid.", ".(int)$toid.", '".$savemessage."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1,".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insID = $database->insertid(); if ($sendnotification) { // Check if E-Mail notification or popups are enabled by default, if so create a record for the receiver. if ($this->config->notifydefault>0 || $this->config->popupdefault>0 || $this->config->pubfrontenddefault>0 || $this->config->autoresponder>0 || $this->config->autoforward>0) { if (!uddeIMexistsEMN($toid)) uddeIMinsertEMNdefaults($toid, $this->config); } } // ################################################################################################## // email notification // ################################################################################################## if ($sendnotification) { $currentlyonline = uddeIMisOnline($toid); if ($this->config->cryptmode>=1) { $email = stripslashes($savemessage); } else { $email = stripslashes(stripslashes($savemessage)); } $type = 0; if ($forceembedded) $type = 2; if ($this->config->allowemailnotify==1) { $ison = uddeIMgetEMNstatus($toid); if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config); } } elseif($this->config->allowemailnotify==2) { $gid = uddeIMgetGID((int)$toid); if (uddeIMisAdmin($gid) || uddeIMisAdmin2($gid, $this->config)) { $ison = uddeIMgetEMNstatus($toid); if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config); } } } } } return 0; }
/** * Sends a PM notification * * @param cbmypmsproTable $pm * @param null|string $message */ private function sendNotification($pm, $message = null) { if (!$pm->get('id')) { return; } $itemId = uddeIMgetItemid($this->uddeIMConfigRAW); if (!uddeIMexistsEMN($pm->get('toid'))) { uddeIMinsertEMNdefaults($pm->get('toid'), $this->uddeIMConfigRAW); } $emailNotify = $this->uddeIMConfig->get('allowemailnotify', 0); $isModerated = uddeIMgetEMNmoderated($pm->get('fromid')); $isReply = stristr($pm->get('message'), $this->uddeIMConfig->get('quotedivider'), '__________'); $isOnline = uddeIMisOnline($pm->get('toid')); // Strip the html and bbcode as uddeim supports neither in its notification: $message = strip_tags(uddeIMbbcode_strip($message ? $message : $pm->get('message'), $this->uddeIMConfigRAW)); if (!$isModerated) { if ($emailNotify == 1 || $emailNotify == 2 && Application::User($pm->get('toid'))->isSuperAdmin()) { $status = uddeIMgetEMNstatus($pm->get('toid')); if ($status == 1 || $status == 2 && !$isOnline || $status == 10 && !$isReply || $status == 20 && !$isOnline && !$isReply) { uddeIMdispatchEMN($pm->get('id'), $itemId, 0, $pm->get('fromid'), $pm->get('toid'), $message, 0, $this->uddeIMConfigRAW); } } } }
function uddeIMarchive($myself, $item_id, $limit, $limitstart, $cryptpass, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode) { global $uddeicons_flagged, $uddeicons_unflagged, $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; if(!$config->allowarchive) { uddeIMprintMenu($myself, 'archive', $item_id, $config); echo "<div id='uddeim-m'>\n"; echo "<div id='uddeim-overview'><p><b>"._UDDEIM_ARCHIVENOTENABLED."</b></p></div>\n"; echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } $pathtosite = uddeIMgetPath('live_site'); $addlink = ""; $addlink2 = ""; if ($filter_user) $addlink .= "&filter_user="******"&filter_unread=".(int)$filter_unread; if ($filter_flagged) $addlink .= "&filter_flagged=".(int)$filter_flagged; if ($sort_mode) $addlink2 .= "&sort_mode=".(int)$sort_mode; // TODO $sort_datum/name leer, wenn nicht aktiviert $sort_datum = ""; $sort_name = ""; if ($config->enablesort) { $temppic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_updown.gif' alt='"._UDDEIM_UPDOWN."' title='"._UDDEIM_UPDOWN."' border='0' />"; $sort_datum = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=0&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; $sort_name = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=2&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; switch($sort_mode) { case 0: $temppic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_down.gif' alt='"._UDDEIM_UP."' title='"._UDDEIM_UP."' border='0' />"; $sort_datum = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=1&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; case 1: $temppic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_up.gif' alt='"._UDDEIM_DOWN."' title='"._UDDEIM_DOWN."' border='0' />"; $sort_datum = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=0&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; case 2: $temppic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_down.gif' alt='"._UDDEIM_UP."' title='"._UDDEIM_UP."' border='0' />"; $sort_name = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=3&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; case 3: $temppic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_up.gif' alt='"._UDDEIM_DOWN."' title='"._UDDEIM_DOWN."' border='0' />"; $sort_name = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&sort_mode=2&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; } } $my_gid = $config->usergid; // message limit for archive? if ($config->inboxlimit) { $universeflag = _UDDEIM_ARC_UNIVERSE_BOTH; // inbox and archive. } else { $universeflag = _UDDEIM_ARC_UNIVERSE_ARC; // archive. } // how many messages total in archive? $totalarchive = uddeIMgetArchiveCount($myself, $filter_user, $filter_unread, $filter_flagged); if ($config->inboxlimit) { // inbox + archive $total = uddeIMgetInboxArchiveCount($myself); } else { $total = uddeIMgetArchiveCount($myself); } $limitwarning = ""; // "You have XX messages in your inbox/inbox+archive." $limitreached = _UDDEIM_INBOX_LIMIT_1." ".$total; $limitreached.= " ".($total==1 ? _UDDEIM_INBOX_LIMIT_2_SINGULAR : _UDDEIM_INBOX_LIMIT_2)." "; $limitreached.= $universeflag; if (!uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) { // "The allowed maximum is XX." // $limitreached.= _UDDEIM_INBOX_LIMIT_3." ".$config->maxarchive.". "; $limitreached.= " "._UDDEIM_SHOWINBOXLIMIT_2." ".$config->maxarchive.")."; // (of max. ) if ($total > $config->maxarchive) { $limitwarning = _UDDEIM_ARC_SAVED_3; // To save messages, you have to delete other messages first. } } // now load messages as required if (!$limitstart) $limitstart=0; if(!$limit) $limit=$config->perpage; if ($limitstart>=$totalarchive) $limitstart=max(0,$limitstart - $limit); // read from archive db all msg where toid is me // this query should return all messages stored by me $allmessages = uddeIMselectArchive($myself, $limitstart, $limit, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode); // write the uddeim menu uddeIMprintMenu($myself, 'archive', $item_id, $config); echo "<div id='uddeim-m'>\n"; if ($config->enablefilter==1 || $config->enablefilter==3) uddeIMprintFilter($myself, 'archive', $totalarchive, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); if (count($allmessages)<1) { // no messages to list uddeIMshowNoMessage('archive', $filter_user, $filter_unread, $filter_flagged); echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } uddeIMaddScript($pathtosite."/components/com_uddeim/js/uddeimtools.js"); echo "<form method='post' name='messages' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivefork&Itemid=".$item_id)."'>\n"; echo "<div id='uddeim-overview'><table cellpadding='7' width='100%'>\n"; echo "\t<tr><th style='text-align:center;' class='sectiontableheader'>"; echo "<input type='checkbox' name='arcmes[]' value='' onclick='wiglwogl(this);' title='"._UDDEIM_CHECKALL."' />"; echo "</th>"; echo "<th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_FROM.$sort_name."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DATE.$sort_datum."</th><th class='sectiontableheader'> </th></tr>"; $i=1; // now write the list foreach($allmessages as $themessage) { $fromname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); if($themessage->systemflag) $fromname=$themessage->systemmessage; $personalsys=0; if($themessage->systemmessage==$fromname) $personalsys=1; // show links ??? $fromcell=$fromname; if ($themessage->fromid) { if ($config->showcblink && $themessage->fromname) { if (!$themessage->systemflag || $personalsys) { $fromcell = uddeIMshowThumbOrLink($themessage->fromid, $fromname, $config); } } // is this user currently online? if ($config->showonline && $themessage->fromname) { if (!$themessage->systemflag || $personalsys) { $isonline = uddeIMisOnline($themessage->fromid); if ($isonline) $fromcell.=" ".$uddeicons_onlinepic; else $fromcell.=" ".$uddeicons_offlinepic; } } } $flagcell = ""; if($config->allowflagged) { if($themessage->flagged) $flagcell="<br /><br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unflag&ret=archive&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_flagged."</a>"; else $flagcell="<br /><br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=flag&ret=archive&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_unflagged."</a>"; } // as all messages in archive are READ by design, so this is basically nonsense but consistent with inbox/outbox handling if($themessage->toread) $readcell=$uddeicons_readpic; else $readcell=$uddeicons_unreadpic; if ($config->showlistattachment) { $cnt = uddeIMgetAttachmentCount($themessage->id); if ($cnt) $readcell .= "<br /><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/attachment.gif' alt='"._UDDEIM_ATTACHMENT."' title='"._UDDEIM_ATTACHMENT."' border='0' />"; } // CRYPT $cm = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->crypthash, $config->cryptkey); $teasermessage = $cm; // if it is a system message or bb codes allowed, parse BB codes if ($themessage->systemflag || $config->allowbb) $teasermessage = uddeIMbbcode_strip($teasermessage); $teasermessage=uddeIMteaser(stripslashes($teasermessage), $config->firstwordsinbox, $config->quotedivider, $config->languagecharset); $teasermessage=htmlspecialchars($teasermessage, ENT_QUOTES, $config->charset); $teasermessage=str_replace("&#", "&#", $teasermessage); $teasermessage=str_replace("&</br>", " ", $teasermessage); $safemessage=htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset); $safemessage=str_replace("&</br>", "</br>", $safemessage); if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $messagecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; } else { // normal message $messagecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; } $datumcell=uddeDate($themessage->datum, $config, uddeIMgetUserTZ()); $fwdcell=""; if($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=delete&ret=archive&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/trash.gif' alt='"._UDDEIM_DELETELINK."' title='"._UDDEIM_DELETELINK."' /></a>"; if ($config->allowforwards) { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardpass&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/forward.gif' alt='"._UDDEIM_FORWARDLINK."' title='"._UDDEIM_FORWARDLINK."' /></a><br />"; } else { // normal message $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forward&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/forward.gif' alt='"._UDDEIM_FORWARDLINK."' title='"._UDDEIM_FORWARDLINK."' /></a><br />"; } } $unarchivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unarchive&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/unarchive.gif' alt='"._UDDEIM_UNARCHIVE."' title='"._UDDEIM_UNARCHIVE."' /></a><br />"; } else { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=delete&ret=archive&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_DELETELINK."</a>"; if ($config->allowforwards) { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } else { // normal message $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forward&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } } $unarchivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unarchive&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_UNARCHIVE."</a><br />"; } // for displaying a checkbox (for mass delete, mass download) $delcell = "<input type='checkbox' name='arcmes[]' value='".$themessage->id."' />"; echo "\t<tr class='sectiontableentry".$i."'>"; // checkcell echo "\t<td style='width:32px; text-align:center; vertical-align:middle'>".$delcell."</td>"; echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$readcell.$flagcell."</td>"; $st=uddeIMgetStyleForThumb($config); echo "<td ".$st.">".$fromcell."</td>"; echo "<td>".$messagecell."</td>"; echo "<td>".$datumcell."</td>"; if($config->actionicons) { echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$fwdcell.$unarchivecell.$deletecell."</td>"; } else { echo "<td class='pathway'>".$fwdcell.$unarchivecell.$deletecell."</td>"; } echo "</tr>\n"; $i++; if ($i>2) { $i=1; } } $muldown = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivedownload&Itemid=".$item_id."&limitstart=0&limit=".$limit); $multrash = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivetrash&Itemid=".$item_id."&limitstart=0&limit=".$limit); if($config->bottomlineicons) { echo "<tr><th style='text-align:left;' class='sectiontablefooter' colspan='2'>"; // colspan=2 for more space if ($config->enabledownload) { echo '<a href="#" onclick="archiveDownload(\''.$muldown.'\'); return false;"><img src="'.$pathtosite.'/components/com_uddeim/templates/'.$config->templatedir.'/images/email.gif" alt="'._UDDEIM_EXPORT_NOW.'" title="'._UDDEIM_EXPORT_NOW.'" /></a> '; } echo '<a href="#" onclick="archiveTrash(\''.$multrash.'\'); return false;"><img src="'.$pathtosite.'/components/com_uddeim/templates/'.$config->templatedir.'/images/trash.gif" alt="'._UDDEIM_TRASHCHECKED.'" title="'._UDDEIM_TRASHCHECKED.'" /></a>'; echo "</th><th class='sectiontablefooter'> </th><th class='sectiontablefooter'> </th><th class='sectiontablefooter'> </th><th class='sectiontablefooter'> </th></tr>\n"; } // now close inbox table and container echo "</table></div>\n"; echo "</form>\n"; // write the inbox navigation links $pageNav = new uddeIMmosPageNav($totalarchive, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=archive&Itemid=".$item_id.$addlink.$addlink2; if ($totalarchive>$limit) { $shownav = $pageNav->writePagesLinks($referlink); $shownav = uddeIMarrowReplace($shownav, $config->templatedir); echo "<div id='uddeim-pagenav'>".$shownav."<br />"; echo "[<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&Itemid=".$item_id."&limitstart=0&limit=".$totalarchive.$addlink.$addlink2)."'>"._UDDEIM_SHOWALL."</a>]"; echo "</div>\n"; } $showinboxlimit_borderbottom = ""; if ($limitwarning) { $showinboxlimit_borderbottom = "<span class='uddeim-warning'>"; $showinboxlimit_borderbottom.= $limitreached." "; $showinboxlimit_borderbottom.= $limitwarning; $showinboxlimit_borderbottom.= "</span>"; } echo "<div id='uddeim-bottomlines'>"; if (!$config->bottomlineicons) { echo "<p>"; if ($config->enabledownload) { echo '<a href="#" onclick="archiveDownload(\''.$muldown.'\'); return false;">'._UDDEIM_EXPORT_NOW.'</a> | '; } echo '<a href="#" onclick="archiveTrash(\''.$multrash.'\'); return false;">'._UDDEIM_TRASHCHECKED.'</a>'; echo "</p>"; } if ($showinboxlimit_borderbottom) echo "<p>".$showinboxlimit_borderbottom."</p>"; echo "</div>\n"; if ($config->enablefilter==2 || $config->enablefilter==3) uddeIMprintFilter($myself, 'archive', $totalarchive, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', $limitreached, $config)."</div>\n"; }
function uddeIMshowTrashCan($myself, $item_id, $limit, $limitstart, $cryptpass, $config) { global $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $pathtosite = uddeIMgetPath('live_site'); $pathtouser = uddeIMgetPath('user'); $my_gid = $config->usergid; if( ($config->trashrestriction==0) || ($config->trashrestriction==1 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || ($config->trashrestriction==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ) { // ok trashcan enabled } else { uddeIMprintMenu($myself, 'trashcan', $item_id, $config); echo "<div id='uddeim-m'>\n"; echo "<div id='uddeim-overview'><p><b>"._UDDEADM_NOTRASHACCESS_NOT."</b></p></div>\n"; echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } $rightnow=uddetime($config->timezone); $offset=((float)$config->TrashLifespan) * 86400; $timeframe=$rightnow-$offset; $total = uddeIMgetTrashcanCount($myself, $timeframe); // now load messages as required if(!$limitstart) { $limitstart=0; } if(!$limit) { $limit=$config->perpage; } if ($limitstart>=$total) $limitstart=max(0,$limitstart - $limit); $allmessages = Array(); if ($total>0) $allmessages = uddeIMselectTrashcan($myself, $timeframe, $limitstart, $limit, $config); // write the uddeim menu uddeIMprintMenu($myself, 'trashcan', $item_id, $config); echo "<div id='uddeim-m'>\n"; // if no messages: if(count($allmessages)<1) { // no messages to list echo "<div id='uddeim-overview'><p><b>"._UDDEIM_NOMESSAGES_TRASHCAN."</b></p>\n</div>\n"; // and close the HTML output and return echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } // now open the inbox container and table; write table headings echo "<div id='uddeim-overview'>"; echo "<table cellpadding='7' width='100%'>"; // echo "\n\n\t<tr><th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DATE."</th><th class='sectiontableheader'> </th></tr>"; echo "\n\n\t<tr><th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DELETED."</th><th class='sectiontableheader'> </th></tr>"; $i=1; // now write the list foreach($allmessages as $themessage) { if($themessage->toread) { $readcell=$uddeicons_readpic; } else { $readcell=$uddeicons_unreadpic; } if ($config->showlistattachment) { $cnt = uddeIMgetAttachmentCount($themessage->id); if ($cnt) $readcell .= "<br /><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/attachment.gif' alt='"._UDDEIM_ATTACHMENT."' title='"._UDDEIM_ATTACHMENT."' border='0' />"; } $themarker = ""; $theuser = 0; $datumcell = ""; // $createdcell=uddeDate($themessage->datum, $config, uddeIMgetUserTZ()); if ($myself==$themessage->toid && $myself!=$themessage->fromid) { // Msg sent to me, sender is someone else, so user is in "fromid" $themarker = "<"; $theuser = $themessage->fromid; $datumcell=uddeDate($themessage->totrashdate, $config, uddeIMgetUserTZ()); // $displayname = $themessage->fromname; $displayname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); } elseif ($myself==$themessage->fromid && $myself!=$themessage->toid) { // Msg sent by me, receiver is someone else, so user is in "toid" $themarker = ">"; $theuser = $themessage->toid; $datumcell=uddeDate($themessage->totrashdateoutbox, $config, uddeIMgetUserTZ()); // $displayname = $themessage->toname; $displayname = uddeIMevaluateUsername($themessage->toname, $themessage->toid, $themessage->publicname); } else { // this case appears when a copy to me message has been trashed my myself // totrashoutbox=1 messages (sender has trashed are not selected in the SQL statement, so they do not appear here // totrash=1 messages has been trashed by myself, so I show them in the trashcan $themarker = "<"; // the message has been send to me (we could also reorder the if-clause and catch this case with "$myself==$themessage->toid" but maybe I change the marker sometime) $theuser = $themessage->fromid; $datumcell=uddeDate($themessage->totrashdate, $config, uddeIMgetUserTZ()); // $displayname = $themessage->fromname; $displayname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); } // systemmsg = "an XXX XXXX" $personalsys=0; if($themessage->systemflag && $myself==$themessage->toid && $themessage->systemmessage==$displayname) { $personalsys=1; } if($themessage->systemflag && $myself==$themessage->toid) { $displayname=$themessage->systemmessage; // its for me, so show systemname "to username" (copy2me message) } $fromcell = $themarker." ".$displayname; if ($theuser) { if(($config->showcblink && !$themessage->systemflag) || ($config->showcblink && $personalsys)) { $fromcell = uddeIMshowThumbOrLink($theuser, $themarker." ".$displayname, $config); } // Is this user currently online? Don't check, if it is a system message if (($config->showonline && !$themessage->systemflag) || ($config->showonline && $personalsys)) { $isonline = uddeIMisOnline($theuser); if($isonline) { $fromcell.=" ".$uddeicons_onlinepic; } else { $fromcell.=" ".$uddeicons_offlinepic; } } } // CRYPT $cm = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->crypthash, $config->cryptkey); $teasermessage=$cm; // if it is a system message or bb codes allowed, parse BB codes if ($themessage->systemflag || $config->allowbb) $teasermessage=uddeIMbbcode_strip($teasermessage); $teasermessage=uddeIMteaser(stripslashes($teasermessage), $config->firstwordsinbox, $config->quotedivider, $config->languagecharset); $teasermessage=htmlspecialchars($teasermessage, ENT_QUOTES, $config->charset); $teasermessage=str_replace("&#", "&#", $teasermessage); $teasermessage=str_replace("&</br>", " ", $teasermessage); $safemessage=htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset); $safemessage=str_replace("&</br>", "</br>", $safemessage); $messagecell=$teasermessage; if($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/recycle.gif' alt='"._UDDEIM_RESTORE."' title='"._UDDEIM_RESTORE."' /></a>"; } else { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_RESTORE."</a>"; } echo "\n\t<tr class='sectiontableentry".$i."'>"; echo "\n\t\t<td style='width:32px; text-align:center; vertical-align:middle'>".$readcell."</td>"; $st=uddeIMgetStyleForThumb($config); echo "\n\t\t<td ".$st.">".$fromcell."</td>"; echo "\n\t\t<td>".$messagecell."</td>"; // echo "\n\t\t<td>".$createdcell."</td>"; echo "\n\t\t<td>".$datumcell."</td>"; if($config->actionicons) { echo "\n\t\t<td style='width:32px; text-align:center; vertical-align:middle'>".$deletecell."</td>"; } else { echo "\n\t\t<td class='pathway'>".$deletecell."</td>"; } echo "</tr>"; $i++; if ($i>2) { $i=1; } } // now close inbox table and container echo "\n</table></div>\n"; // write the inbox navigation links $pageNav = new uddeIMmosPageNav($total, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id; if($total>$limit) { $shownav = $pageNav->writePagesLinks($referlink); $shownav = uddeIMarrowReplace($shownav, $config->templatedir, $pathtouser); echo "<div id='uddeim-pagenav'>".$shownav."<br />"; echo "[<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id."&limitstart=0&limit=".$total)."'>"._UDDEIM_SHOWALL."</a>]"; echo "</div>\n"; } $keephours=((float)$config->TrashLifespan) * 24; echo "<div id='uddeim-bottomlines'>"; if ($config->TrashLifespanNote) echo "<p>"._UDDEIM_TRASHCAN_INFO_1.$keephours._UDDEIM_TRASHCAN_INFO_2."</p>"; echo "</div>\n"; echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; }
function uddeIMpublicSaveMessage($fromname, $fromemail, $to_name, $to_id, $pmessage, $item_id, $sendeform_showallusers, $backto, $config) { $mosConfig_sitename = uddeIMgetSitename(); $pathtosite = uddeIMgetPath('live_site'); $database = uddeIMgetDatabase(); $to_name = stripslashes($to_name); $to_name_bak = $to_name; // save all already typed in names if(!$to_id && !$to_name && $sendeform_showallusers!=2) { // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 5, $config); return; } if($sendeform_showallusers) { // =2, click on button / =1, keep on showing // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 1, $config); return; } // do not allow multiple recipients from public frontend $to_name = trim($to_name); $fromname = trim($fromname); $fromemail = trim($fromemail); if(!$fromname) { // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 12, $config); return; } // When there is an email address this must be valid if ($fromemail && !preg_match("/\b[a-z0-9!#$%&'*+\/=?^_`{|}-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b/i", $fromemail)) { // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 13, $config); return; } // Check if an email address is required if (!$fromemail && $config->pubemail) { // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 13, $config); return; } $to_id = uddeIMgetIDfromNamePublic($to_name, $config, true); // add "AND block=0" // BUGBUG: Maybe it is a good idea to do the query vice versa (so I could add a query for "realname"s here) if (!$to_id) { // no user with this name found, so try again with username (maybe we do the query twice (see query above, but who cares) if ($config->pubrealnames) { $to_id = uddeIMgetIDfromUsername($to_name, true); // add "AND block=0" } } if(!$to_id) { // no user with this username found // display to form again so that the user can correct his/her fault // the wrong name is displayed in brackets (add brackets only once) if (substr($to_name,0,1)!="(") { $to_name = str_replace($to_name, "(".$to_name.")", $to_name_bak); } // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 3, $config); return; } // now check banning $is_banned = uddeIMisBanned($to_id, $config); if ($is_banned) { if (substr($to_name,0,1)!="(") { $to_name = str_replace($to_name, "(".$to_name.")", $to_name_bak); } // write the uddeim menu uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 17, $config); return; } // now check group blocking $is_group_blocked = uddeIMisRecipientBlockedPublic($to_id, $config); if ($is_group_blocked) { if (substr($to_name,0,1)!="(") { $to_name = str_replace($to_name, "(".$to_name.")", $to_name_bak); } uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 10, $config); return; } if(!$pmessage) { // write the uddeim menu $to_name = $to_name_bak; uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 4, $config); return; } // check if user allows public access (this check must be done after group blocking, because the admin can block a certain group and the user cannot longer decide if he allows the public frontend or not) $ispublic = uddeIMgetEMNpublic($to_id); if (!$ispublic) { // user does not allow public messages uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 8, $config); return; } // CAPTCHA (first check for all other errors and then the CAPTCHA) if ($config->usecaptcha>=1) { // CAPTCHA is enabled for public frontend if ($config->captchatype==0) { if (class_exists('JFactory')) { // CAPTCHA15 $session = JFactory::getSession(); $_SESSION['security_code'] = $session->get('security_code'); // so I do not need to modify saveMessage code } else { // CAPTCHA10 session_start(); } if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { // CAPTCHA is correct, so unset security code if (class_exists('JFactory')) { $session = JFactory::getSession(); $session->set('security_code', null); } else { unset($_SESSION['security_code']); } } else { // wrong captcha, so write the uddeim menu $to_name = $to_name_bak; uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 7, $config); return; } } else { $pathtouser = uddeIMgetPath('user'); require_once($pathtouser."/recaptchalib.php"); $resp = recaptcha_check_answer ($config->recaptchaprv, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $to_name = $to_name_bak; uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 7, $config); return; // die ("The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")"); } } } if (!uddeIMcheckCSRF($config)) { $to_name = $to_name_bak; uddeIMpublicMenuWriteform($item_id, $fromname, $fromemail, $to_name, $pmessage, 15, $config); return; } $savedatum = uddetime($config->timezone); $savetoid = $to_id; $savefromid = 0; // This is '0' in public frontend // CRYPT if ($config->cryptmode>=1) { // because of encoding do not use slashes $savemessage=strip_tags($pmessage); } else { $savemessage=addslashes(strip_tags($pmessage)); // original 0.6+ } // strip bbcodes if (!$config->allowbb) { $savemessage=uddeIMbbcode_strip($savemessage); } // set message max length if ($config->maxlength>0) { // because if 0 do not use any maxlength $savemessage=substr($savemessage, 0, $config->maxlength); } $fromname=addslashes(strip_tags($fromname)); $fromemail=addslashes(strip_tags($fromemail)); $delayed = 0; if ($config->modpubusers) $delayed = 1; // we have all we need, now save it // no replyid can be set here, since public users cannot reply to a message, replyid = 0 // CRYPT if ($config->cryptmode==1 || $config->cryptmode==2 || $config->cryptmode==4) { // do not allow individual encryption $cm = uddeIMencrypt($savemessage,$config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (`delayed`, publicname, publicemail, fromid, toid, message, datum, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$delayed.", '".$fromname."', '".$fromemail."', ".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.",1,".$savedatum.",1,'".md5($config->cryptkey)."')"; } elseif ($config->cryptmode==3) { $cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (`delayed`, publicname, publicemail, fromid, toid, message, datum, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$delayed.", '".$fromname."', '".$fromemail."', ".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.",1,".$savedatum.",3)"; } else { $sql="INSERT INTO #__uddeim (`delayed`, publicname, publicemail, fromid, toid, message, datum, totrashoutbox, totrashdateoutbox) VALUES (".(int)$delayed.", '".$fromname."', '".$fromemail."', ".(int)$savefromid.", ".(int)$savetoid.", '".$savemessage."', ".$savedatum.",1,".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insID = $database->insertid(); // When public users are moderated, delay the message // if (uddeIMgetEMNmoderated($savefromid) ) { // && uddeIMisReggedOnly($my_gid)) { // uddeIMupdateDelayed($savefromid, $insID, 1); // } // Check if E-Mail notification or popups are enabled by default, if so create a record for the receiver. // Note: Not necessary for "copy to myself" sind the record for the current user has been set at the very beginning... if ($config->notifydefault>0 || $config->popupdefault>0 || $config->pubfrontenddefault>0 || $config->autoresponder>0 || $config->autoforward>0) { if (!uddeIMexistsEMN($savetoid)) uddeIMinsertEMNdefaults($savetoid, $config); } $rec_gid = uddeIMgetGID((int)$savetoid); // ################################################################################################## // autoforward code // ################################################################################################## if ($config->autoforward==1 || ($config->autoforward==2 && (uddeIMisAdmin($rec_gid) || uddeIMisAdmin2($rec_gid, $config)))) { $ison = uddeIMgetEMNautoforward($savetoid); // recipient has autoforward enabled if ($ison==1) { $autoforwardid = uddeIMgetEMNautoforwardid($savetoid); // new recipient $forwardheader=" [i]("._UDDEIM_THISISAFORWARD.uddeIMgetNameFromID($savetoid, $config).")[/i]"; $savemessagecopy = $savemessage.$forwardheader; $themode = 0; if ($config->cryptmode==1) { $themode = 1; $cm = uddeIMencrypt($savemessagecopy,$config->cryptkey,CRYPT_MODE_BASE64); $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$autoforwardid.", '".$cm."', ".$savedatum.",1,'".md5($config->cryptkey)."')"; } elseif ($config->cryptmode==2) { $themode = 2; $thepass=$cryptpass; if (!$thepass) { // no password entered, then fallback to obfuscating $themode = 1; $thepass=$config->cryptkey; } $cm = uddeIMencrypt($savemessagecopy,$thepass,CRYPT_MODE_BASE64); $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$autoforwardid.", '".$cm."', ".$savedatum.",".$themode.",'".md5($thepass)."')"; } elseif ($config->cryptmode==3) { $themode = 3; $cm = uddeIMencrypt($savemessagecopy,"",CRYPT_MODE_STOREBASE64); $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum, cryptmode) VALUES (".(int)$savefromid.", ".(int)$autoforwardid.", '".$cm."', ".$savedatum.",3)"; } elseif ($config->cryptmode==4) { $themode = 4; $thepass=$cryptpass; if (!$thepass) { // no password entered, then fallback to obfuscating $themode = 1; $thepass=$config->cryptkey; } $cm = uddeIMencrypt($savemessagecopy,$thepass,CRYPT_MODE_3DESBASE64); $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$autoforwardid.", '".$cm."', ".$savedatum.",".$themode.",'".md5($thepass)."')"; } else { $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum) VALUES (".(int)$savefromid.", ".(int)$autoforwardid.", '".$savemessage."', ".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insIDforward = $database->insertid(); } } // ################################################################################################## // autoresponder // ################################################################################################## if ($config->autoresponder==1 || ($config->autoresponder==2 && (uddeIMisAdmin($rec_gid) || uddeIMisAdmin2($rec_gid, $config)))) { $ison = uddeIMgetEMNautoresponder($savetoid); if ($ison==1) { // $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, totrashoutbox, totrashdateoutbox) VALUES (".(int)$savetoid.", ".(int)$savefromid.", '". _UDDEIM_AUTORESPONDER_DEFAULT ."', ".$savedatum.", 1,".uddetime($config->timezone).")"; // BUGBUG: An autoresponder message is send via email but no message in the outbox is created. // This is not a bug since in my opinion it does not make sense to store autoresponder messages AND the received message. if($config->emailtrafficenabled && $fromemail) { $autorespondertext = uddeIMgetEMNautorespondertext($savetoid); $var_fromname = uddeIMgetNameFromID($savetoid, $config); if (!$var_fromname) $var_fromname=$config->sysm_username; $var_body = _UDDEIM_EMN_BODY_PUBLICWITHMESSAGE; $var_body = str_replace("%livesite%", $pathtosite, $var_body); $var_body = str_replace("%user%", $var_fromname, $var_body); $var_body = str_replace("%site%", $mosConfig_sitename, $var_body); $var_body = str_replace("%you%", $fromname, $var_body); $autorespondertext = str_replace(chr(13).chr(10), "\n", $autorespondertext); $var_body = str_replace("%pmessage%", $autorespondertext, $var_body); $subject = _UDDEIM_EMN_SUBJECT; $subject = str_replace("%livesite%", $pathtosite, $subject); $subject = str_replace("%site%", $mosConfig_sitename, $subject); $subject = str_replace("%you%", $fromname, $subject); $subject = str_replace("%user%", $var_fromname, $subject); $replyto = $fromemail; $replytoname = ""; if(uddeIMsendmail($config->emn_sendername, $config->emn_sendermail, $var_toname, $fromemail, $subject, $var_body, $replyto, $replytoname, "", $config)) { // maybe a code here that the email cound not have been sent } } } } // ################################################################################################## // email notification // ################################################################################################## // is the receiver currently online? $currentlyonline = uddeIMisOnline($savetoid); if ($config->cryptmode>=1) { $email=stripslashes($savemessage); } else { $email=stripslashes(stripslashes($savemessage)); // without encoding remove the safety slashes } if($config->allowemailnotify==1) { $ison = uddeIMgetEMNstatus($savetoid); if (($ison==1) || ($ison==2 && !$currentlyonline) || ($ison==10) || ($ison==20 && !$currentlyonline)) { uddeIMpublicDispatchEMN($insID, $fromname, $savetoid, $email, 0, $config); // 0 stands for normal (not forgetmenot) } } elseif($config->allowemailnotify==2) { $my_gid = uddeIMgetGID((int)$savetoid); if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) { $ison = uddeIMgetEMNstatus($savetoid); if (($ison==1) || ($ison==2 && !$currentlyonline) || ($ison==10) || ($ison==20 && !$currentlyonline)) { uddeIMpublicDispatchEMN($insID, $fromname, $savetoid, $email, 0, $config); // 0 stands for normal (not forgetmenot) } } } $mosmsg=""; // _UDDEIM_MESSAGE_SENT uddeJSEFredirect("index.php?option=com_uddeim&task=publicsent&Itemid=".$item_id, $mosmsg); }
function uddeIMshowMessage($myself, $item_id, $messageid, $isforward, $cryptpass, $config) { global $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $my_gid = $config->usergid; $displaymessages = uddeIMselectInboxMessage($myself, $messageid, $config, 0); if (count($displaymessages)<1) { echo _UDDEIM_MESSAGENOACCESS; return; } // write the uddeim menu uddeIMprintMenu($myself, 'showMessage', $item_id, $config); echo "<div id='uddeim-m'>\n"; foreach($displaymessages as $displaymessage) { $is_spam = 0; if ($config->reportspam) // save one database query if possible $is_spam = uddeIMgetSpamStatus($messageid); $fromname = uddeIMevaluateUsername($displaymessage->fromname, $displaymessage->fromid, $displaymessage->publicname); if ($displaymessage->systemflag) $fromname = $displaymessage->systemmessage; $personalsys = 0; if ($displaymessage->systemflag && $displaymessage->systemmessage==$displaymessage->fromname) $personalsys = 1; // CRYPT $cm = uddeIMgetMessage($displaymessage->message, $cryptpass, $displaymessage->cryptmode, $displaymessage->crypthash, $config->cryptkey); // echo str_replace("&#", "&#", nl2br(htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset))); $dmessage = nl2br(htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset)); $dmessage = str_replace("&#", "&#", $dmessage); // unicode workaround $dmessage = str_replace("&</br>", "</br>", $dmessage); // if system message or bbcodes allowed, call parser if ($displaymessage->systemflag || $config->allowbb) $dmessage = uddeIMbbcode_replace($dmessage, $config); if ($config->allowsmile) $dmessage = uddeIMsmile_replace($dmessage, $config); $bodystring = $dmessage; // converted message for email body $replytomessage = ""; if ($config->replytext) $replytomessage = uddeIMreplySuggestion($cm, $displaymessage, $fromname, "", $isforward, "inbox", $config); // We used an placeholder above to insert the "reply suggestion" for the "mailto:" link $urlbody = rawurlencode($replytomessage); // display the message $headerstring="<table class='innermost'><tr>"; // does CB have a thumbnail image of the sender? if ($config->showcbpic && $displaymessage->fromname || $config->gravatar) { $frompic = uddeIMgetPicOnly($displaymessage->fromid, $config); if ($frompic && ($personalsys || !$displaymessage->systemflag)) $headerstring.="<td valign='top' rowspan='2'>".$frompic."</td>\n"; } $headerstring.="<td valign='top' width='99%'><div class='uddeim-messagefrom'>"; if ($displaymessage->toid!=$displaymessage->fromid) { // not a copy to myself $headerstring.=_UDDEIM_MESSAGEFROM; } else { // $headerstring.=_UDDEIM_MESSAGE." "; // BUGBUG: "Message admin" - sollte besser "Copy to yourself" sein if ( 0 == strncasecmp($displaymessage->systemmessage, _UDDEIM_TO_SMALL." ", strlen(_UDDEIM_TO_SMALL)+1 ) ) $headerstring.=_UDDEIM_MESSAGE." "; // systemmsg is "to XXX", so suppress the from (copy2me) else $headerstring.=_UDDEIM_MESSAGEFROM." "; // systemmsg is a name } // show links ??? $temp = $fromname; if ($config->showcblink && $displaymessage->fromname) { if (!$displaymessage->systemflag || $personalsys) { $temp = uddeIMgetLinkOnly($displaymessage->fromid, $fromname, $config); } } // display email address if ($displaymessage->fromname==NULL && !$displaymessage->fromid && $displaymessage->publicemail!=NULL) $temp .= " <<a href='mailto:".$displaymessage->publicemail."?body=".$urlbody."'>".$displaymessage->publicemail."</a>>"; $headerstring.=$temp; // is this user currently online? if ($config->showonline && $displaymessage->fromname) { if (!$displaymessage->systemflag || $personalsys) { $isonline = uddeIMisOnline($displaymessage->fromid); if ($isonline) $headerstring.=" ".$uddeicons_onlinepic; else $headerstring.=" ".$uddeicons_offlinepic; } } $headerstring.="<br />"; $headerstring.=uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ()); $headerstring.="</div></td><td valign='top'><span class='uddeim-clear'> </span><ul>"; // show delete & block links if ($config->allowforwards) { if ($displaymessage->cryptmode==2 || $displaymessage->cryptmode==4) { // Message is encrypted, so go to enter password page $headerstring.="<li class='uddeim-messageactionlink-forward'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardpass&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_FORWARDLINK."</a></li>\n"; } else { // normal message $headerstring.="<li class='uddeim-messageactionlink-forward'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forward&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_FORWARDLINK."</a></li>\n"; } } if (!$displaymessage->archived && $config->allowarchive) $headerstring.="<li class='uddeim-messageactionlink-archive'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivemessage&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_STORE."</a></li>\n"; if ( $displaymessage->archived && $config->allowarchive) $headerstring.="<li class='uddeim-messageactionlink-archive'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unarchive&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_UNARCHIVE."</a></li>\n"; if (!$displaymessage->totrash) { // but only if not already moved to trash $headerstring.="<li class='uddeim-messageactionlink-delete'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=delete&Itemid=".$item_id."&ret=top&messageid=".$displaymessage->id)."'>"._UDDEIM_DELETELINK."</a></li>\n"; if ($config->blocksystem && !$displaymessage->systemflag && $displaymessage->fromid) { $headerstring.="<li class='uddeim-messageactionlink-block'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=blockuser&Itemid=".$item_id."&recip=".$displaymessage->fromid)."'>"._UDDEIM_BLOCKNOW."</a></li>\n"; } } if ($config->reportspam) { // uddeIMcheckPlugin('spamcontrol') && not required since uddeIMcheckConfig sets this 0 if plugin is missing if ($is_spam) $headerstring.="<br /><li class='uddeim-messageactionlink-spam'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unreportspam&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_SPAMCONTROL_UNREPORT."</a></li>"; else $headerstring.="<br /><li class='uddeim-messageactionlink-spam'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=reportspam&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_SPAMCONTROL_REPORT."</a></li>"; } $headerstring.="</ul>"; $headerstring.="</td>"; $headerstring.="</tr>"; $msgnavigation = " "; if ($config->enablereply) { $msgnavigation = ""; $pathtosite = uddeIMgetPath('live_site'); $pic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/envelope.gif' alt='"._UDDEIM_PMNAV_EXISTS."' title='"._UDDEIM_PMNAV_EXISTS."' />"; $picdel = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/envelope_deleted.gif' alt='"._UDDEIM_PMNAV_DELETED."' title='"._UDDEIM_PMNAV_DELETED."' />"; $replyid = $displaymessage->replyid; if ($replyid) { $msgnavigation .= _UDDEIM_PMNAV_THISISARESPONSE; $copy2me = ($displaymessage->toid==$displaymessage->fromid && $displaymessage->fromid==$myself); if ($copy2me) // this is a copy2me message, so the original is also stored in inbox $orig = uddeIMselectInboxMessage($myself, $replyid, $config, 0); else $orig = uddeIMselectOutboxMessage($myself, $replyid, $config, 0); $temp = Array(); foreach($orig as $or) $temp = $or; $orig = $temp; if (count($orig)>0) { // the message should be stored in the outbox $goto = "showout"; $c2me = ""; if ($copy2me) // this is a copy2me message, so the original is also stored in inbox $goto = "show"; if ($orig->cryptmode==2 || $orig->cryptmode==4) { // Message is encrypted, so go to enter password page $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=".$goto."pass&Itemid=".$item_id."&messageid=".$replyid)."'>".$pic."</a>"; } else { // normal message $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=".$goto."&Itemid=".$item_id."&messageid=".$replyid)."'>".$pic."</a>"; } } else { $msgnavigation .= " ".$picdel; } } $repls = uddeIMselectMessageReplies($displaymessage->id, 'outbox', $myself); if (count($repls)>0) { $msgnavigation .= "<br />"; $msgnavigation .= _UDDEIM_PMNAV_THEREARERESPONSES; foreach($repls as $repl) { $goto = "showout"; $c2me = ""; if ($repl->toid==$repl->fromid) { // copy2me are stored in the inbox $goto = "show"; $c2me = " "._UDDEIM_PMNAV_COPY2ME; // BUGBUG } if ($repl->cryptmode==2 || $repl->cryptmode==4) { // Message is encrypted, so go to enter password page $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=".$goto."pass&Itemid=".$item_id."&messageid=".$repl->id)."'>".$pic."</a>".$c2me; } else { // normal message $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=".$goto."&Itemid=".$item_id."&messageid=".$repl->id)."'>".$pic."</a>".$c2me; } $msgnavigation .= " "; } } } $headerstring.="<tr>"; $headerstring.="<td valign='bottom'><div class='uddeim-messagefrom'>".trim($msgnavigation)."</div></td>"; $headerstring.="<td valign='bottom'>"; if ($config->reportspam) { // uddeIMcheckPlugin('spamcontrol') && not required since uddeIMcheckConfig sets this 0 if plugin is missing if ($is_spam) $headerstring.="<div class='uddeim-messagefrom-spam'>"._UDDEIM_SPAMCONTROL_MARKED."</div>"; } $headerstring.="</td>"; $headerstring.="</tr>"; $headerstring.="</table>"; // output the message if (!$isforward) { echo "<div class='uddeim-messageheader'>".$headerstring."</div>"; echo "<div class='uddeim-messagebody'>".uddeIMreplyquoteMarkup($bodystring,$config->quotedivider)."</div>"; // UDDEIMFILE if( $config->enableattachment ) // Always show attachments when attachments are enabled uddeIMshowAttachments("inbox", $item_id, $displaymessage->id, $config); } $trashmessage = $displaymessage->totrash; $to_id = $displaymessage->fromid; $replytoid = $displaymessage->id; $disablereply = $displaymessage->disablereply; // now check, if we can send a reply if (!$config->pubreplies) { // we do not allow replies to public users, so check if it is a public user if ( uddeIMisPublicUser($displaymessage->fromname,$displaymessage->fromid) ) // it is $displaymessage->fromname which specifies if it is a public user or not $disablereply = 1; } else { // we allow replies to public users, so check if it is a public user... if ( uddeIMisPublicUser($displaymessage->fromname,$displaymessage->fromid) && (!$displaymessage->publicemail || $displaymessage->publicemail==NULL)) $disablereply = 1; // ..its a public user and there is no email address given, we could send a reply to } if ( uddeIMisDeletedUser($displaymessage->fromname,$displaymessage->fromid) ) $disablereply = 1; // ..its a deleted user so disable replies if ($displaymessage->archived) $disablereply = 1; // ..no reply to archived messages if ($displaymessage->fromid==$myself && $displaymessage->fromid==$displaymessage->toid) $disablereply = 1; // ...no reply to copy2me messages } // read flag set to true, but only when its a forward if (!$isforward) uddeIMupdateToread($myself, $displaymessage->id, 1); if ($config->inboxlimit) { // there is a limit for inbox + archive if ($config->allowarchive) { // have an archive and an "archive and inbox" limit, so get number of messages in inbox and archive $universeflag = _UDDEIM_ARC_UNIVERSE_BOTH; // inbox and archive $total = uddeIMgetInboxArchiveCount($myself); } else { // user has switched of archive but there is an limit for "inbox and archive", so count inbox messages only $universeflag = _UDDEIM_ARC_UNIVERSE_INBOX; // inbox $total = uddeIMgetInboxCount($myself); } // "You have XX messages in your inbox/inbox+archive." $limitreached = _UDDEIM_INBOX_LIMIT_1." ".$total; $limitreached.= " ".($total==1 ? _UDDEIM_INBOX_LIMIT_2_SINGULAR : _UDDEIM_INBOX_LIMIT_2)." "; $limitreached.= $universeflag; if (!uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config) && (!$disablereply || ($isforward && $config->allowforwards))) { // so the warning is only displayed when a forward or reply is possible // "The allowed maximum is XX." // $limitreached.= _UDDEIM_INBOX_LIMIT_3." ".$config->maxarchive.". "; $limitreached.= " "._UDDEIM_SHOWINBOXLIMIT_2." ".$config->maxarchive.")."; // (of max. ) if ($total > $config->maxarchive) { // "You have XX messages in your inbox/inbox+archive." $limitreached = _UDDEIM_INBOX_LIMIT_1." ".$total; $limitreached.= " ".($total==1 ? _UDDEIM_INBOX_LIMIT_2_SINGULAR : _UDDEIM_INBOX_LIMIT_2)." "; $limitreached.= $universeflag; // You can still receive and read messages but you will not be able to reply or to compose new ones until you delete messages. $limitwarning = _UDDEIM_INBOX_LIMIT_4; $showinboxlimit_borderbottom = "<span class='uddeim-warning'>"; $showinboxlimit_borderbottom.= $limitreached." "; $showinboxlimit_borderbottom.= $limitwarning; $showinboxlimit_borderbottom.= "</span>"; echo "<div id='uddeim-bottomlines'>".$showinboxlimit_borderbottom."</div>"; // close main container echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', $limitreached, $config)."</div>\n"; return; } } } if (($isforward && $config->allowforwards) || !$disablereply) { // it is a forward or you can reply to the message // show reply form if(!$trashmessage) { // but only if not already moved to trash // echo "<div id='uddeim-writeform'><b>"._UDDEIM_REPLY."</b><br />"; // which page did refer to this "show Message" page? we want to send back the user where he came from $tbackto = uddeIMmosGetParam($_SERVER, 'HTTP_REFERER', null); if(stristr($tbackto, "com_uddeim")) { $tbackto=""; } if ($isforward && $config->allowforwards) { // it is a forward, so allow selecting a recipient uddeIMdrawWriteform($myself, $my_gid, $item_id, $tbackto, "", $replytomessage, 0, 0, 0, 0, $config); } else { // it is a reply, so reply to $to_id { uddeIMdrawWriteform($myself, $my_gid, $item_id, $tbackto, $to_id, $replytomessage, $replytoid, 1, 0, 0, $config); // isreply, errorcode, sysmsg } } else { // offer restore link echo "<div id='uddeim-bottomlines'>"._UDDEIM_YOUMOVEDTOTRASH; echo "<br />"; echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&messageid=".$replytoid)."'>"._UDDEIM_RESTORE."</a></div>\n"; } } else { // don't allow replies ($disablereply) if ($displaymessage->archived) echo "<div id='uddeim-bottomlines'>"._UDDEIM_CANTREPLYARCHIVE."</div>\n"; else echo "<div id='uddeim-bottomlines'>"._UDDEIM_CANTREPLY."</div>\n"; } // close container echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; }
function uddeIMdoOutboxHeader($myself, $displaymessage, $config) { global $uddeicons_flagged, $uddeicons_unflagged, $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $toname = uddeIMevaluateUsername($displaymessage->toname, $displaymessage->toid, $displaymessage->publicname); // display the message $headerstring = ""; if ($config->postboxavatars==0) { $headerstring.=_UDDEIM_MESSAGETO; // show links ??? $temp = $toname; if ($config->showcblink && $displaymessage->toname) { $temp = uddeIMgetLinkOnly($displaymessage->toid, $toname, $config); } // display email address if ($displaymessage->toname==NULL && !$displaymessage->toid && $displaymessage->publicemail!=NULL) $temp .= " <<a href='mailto:".$displaymessage->publicemail."'>".$displaymessage->publicemail."</a>>"; } else { // show links ??? // $temp = $toname; // if ($config->showcblink && $displaymessage->toname) { $temp = uddeIMgetPicOnly($displaymessage->fromid, $config, false); // } // display email address if ($displaymessage->toname==NULL && !$displaymessage->toid && $displaymessage->publicemail!=NULL) $temp .= " <<a href='mailto:".$displaymessage->publicemail."'>".$displaymessage->publicemail."</a>>"; } $headerstring.=$temp; // is this user currently online? if ($config->showonline && $displaymessage->toname) { $isonline = uddeIMisOnline($displaymessage->toid); if($isonline) $headerstring.=" ".$uddeicons_onlinepic; else $headerstring.=" ".$uddeicons_offlinepic; } return $headerstring; }
function uddeIMsaveSysgm($myself, $to_name, $to_id, $pmessage, $tobedeleted, $tobedeletedsent, $forceembedded, $item_id, $messageid, $sysgm_sys, $sysgm_nonotify, $sysgm_universe, $sysgm_validfor, $sysgm_really, $cryptpass, $config) { $database = uddeIMgetDatabase(); $to_name = stripslashes($to_name); $my_gid = $config->usergid; if ($config->allowsysgm==0 || ($config->allowsysgm==1 && !uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) || ($config->allowsysgm==2 && !uddeIMisManager($my_gid)) ) { $mosmsg=_UDDEIM_NOTALLOWED_SYSM_GM; uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id, $mosmsg); } // what is username of sender? $sendername = uddeIMgetNameFromID($myself, $config); if ($sysgm_sys) $sendername=$config->sysm_username; if (!$sysgm_really) { // send not confirmed. ask for confirmation // CAPTCHA (first check for all other errors and then the CAPTCHA) if (!uddeIMcheckCAPTCHA($my_gid, $config)) { uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $to_name=stripslashes($to_name); $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $to_name, $pmessage, 0, 0, 7, 1, $config); echo "</div>\n<div id='uddeim-bottomborder'></div>\n"; return; } if (!uddeIMcheckCSRF($config)) { uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $to_name=stripslashes($to_name); $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $to_name, $pmessage, 0, 0, 15, 1, $config); echo "</div>\n<div id='uddeim-bottomborder'></div>\n"; return; } uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; echo "<div id='uddeim-toplines'><p>"._UDDEIM_SYSGM_PLEASECONFIRM."</p></div>\n"; echo "<div id='uddeim-message'><table cellpadding='7' cellspacing='1' width='100%'>\n"; $usql=""; // send to unblocked users only getAdditonalGroups($add_special, $add_admin, $config); if (uddeIMcheckJversion()>=2) { // J1.6 if ($sysgm_universe=="sysgm_toall") { $universe=_UDDEIM_SYSGM_WILLSENDTOALL; $usql="SELECT count(id) FROM #__users WHERE block=0"; } elseif ($sysgm_universe=="sysgm_toalllogged") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLLOGGED; $usql="SELECT count(a.id) FROM #__users AS a, #__session AS b WHERE a.block=0 AND a.id=b.userid"; } elseif ($sysgm_universe=="sysgm_toallspecial") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLSPECIAL; $usql="SELECT count(*) FROM (SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (3,4,5,6,7,8".$add_admin.$add_special.")) AS aTable"; } elseif ($sysgm_universe=="sysgm_toalladmins") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLADMINS; $usql="SELECT count(*) FROM (SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (7,8".$add_admin.")) AS aTable"; } elseif ($config->showgroups) { $aclsql = "SELECT title AS name FROM #__usergroups WHERE id=".(int)$sysgm_universe; $database->setQuery($aclsql); $universe=$database->loadResult(); $usql="SELECT count(*) FROM (SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE g.id=".(int)$sysgm_universe.") AS aTable"; } } else { if ($sysgm_universe=="sysgm_toall") { $universe=_UDDEIM_SYSGM_WILLSENDTOALL; $usql="SELECT count(id) FROM #__users WHERE block=0"; } elseif ($sysgm_universe=="sysgm_toalllogged") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLLOGGED; $usql="SELECT count(a.id) FROM #__users AS a, #__session AS b WHERE a.block=0 AND a.id=b.userid"; } elseif ($sysgm_universe=="sysgm_toallspecial") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLSPECIAL; $usql="SELECT count(id) FROM #__users WHERE block=0 AND gid IN (19,20,21,23,24,25".$add_admin.")"; } elseif ($sysgm_universe=="sysgm_toalladmins") { $universe=_UDDEIM_SYSGM_WILLSENDTOALLADMINS; $usql="SELECT count(id) FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")"; } else { if ($config->showgroups) { if (uddeIMcheckJversion()>=1) $aclsql = "SELECT name FROM #__core_acl_aro_groups WHERE id=".(int)$sysgm_universe; else $aclsql = "SELECT name FROM #__core_acl_aro_groups WHERE group_id=".(int)$sysgm_universe; $database->setQuery($aclsql); $universe=$database->loadResult(); $usql="SELECT count(id) FROM #__users WHERE block=0 AND gid=".(int)$sysgm_universe; } } } if (!$universe) { $mosmsg=_UDDEIM_UNEXPECTEDERROR_QUIT." No recipients selected"; uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id, $mosmsg); } if ($usql) { $database->setQuery($usql); $rf = (int)$database->loadResult(); $rft = ($rf==1) ? _UDDEIM_RECIPIENTFOUND : _UDDEIM_RECIPIENTSFOUND; $universe.=" (".$rf." ".$rft.")"; } // UDDEIMFILE // We have checked that everything is ok, now do the file uploads $uploadfile_temppathname = array(); $uploadfile_original = array(); $uploadfile_id = array(); $uploadfile_size = array(); $uploadfile_error = array(); if( $config->enableattachment && uddeIMisAttachmentAllowed($my_gid, $config)) { $noerror = uddeIMhandleAttachments($uploadfile_temppathname, $uploadfile_original, $uploadfile_id, $uploadfile_size, $uploadfile_error, $config); if (!$noerror) { // something goes wrong // BUGBUG: that is not the best error handling possible but is will do the work // iterate through all errorcodes and show the first error found, rest of data will be lost // ==> delete all files that were uploaded ok while (list($key, $value) = each( $uploadfile_temppathname )) { if (file_exists($value)) unlink($value); } while (list($key, $value) = each( $uploadfile_error )) { if ($value==-1) { // upload failed uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $to_name=stripslashes($to_name); $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $to_name, $pmessage, 0, 0, 18, 1, $config); return; } if ($value==-2) { // file size exceeded uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $to_name=stripslashes($to_name); $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $to_name, $pmessage, 0, 0, 19, 1, $config); return; } if ($value==-3) { // file type not allowed uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $to_name=stripslashes($to_name); $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $to_name, $pmessage, 0, 0, 20, 1, $config); return; } } $uploadfile_temppathname = array(); // should never been reached when an error occurs but neverthless destroy old arrays $uploadfile_original = array(); $uploadfile_id = array(); $uploadfile_size = array(); $uploadfile_error = array(); } else { $savedatum=uddetime($config->timezone); uddeIMpreSaveAttachments($uploadfile_temppathname, $uploadfile_original, $uploadfile_id, $uploadfile_size, $savedatum, $config); } } // The uploaded file is stored in "$uploadfile_tempname" (with path) ad the original name in "$uploadfile_original" (without path) and an Id for the file. // When we reach this line we can store these fileames in the DB. $udde_infoheader = $universe."<br />"; $udde_infoheader .= _UDDEIM_SYSGM_WILLSENDAS_1.$sendername._UDDEIM_SYSGM_WILLSENDAS_2."<br />"; if($sysgm_sys) { $udde_infoheader .= _UDDEIM_SYSGM_WILLDISABLEREPLY."<br />"; } if($forceembedded && !$sysgm_nonotify) { $udde_infoheader .= _UDDEIM_SYSGM_FORCEEMBEDDED."<br />"; } if($sysgm_nonotify) { $udde_infoheader .= _UDDEIM_SYSGM_NONOTIFY."<br />"; } if($sysgm_validfor>0) { $now=uddetime($config->timezone); $validuntil_timestamp=$now+($sysgm_validfor*3600); $validuntil=date("Y-m-d H:i", $validuntil_timestamp); $udde_infoheader .= _UDDEIM_SYSGM_WILLEXPIRE." ".$validuntil."<br />"; } echo "\t<tr class='sectiontableentry1'>\n\t\t<td>".$udde_infoheader."</td></tr>\n"; // strip any HTML from message but don't add slashes yet $dmessage=strip_tags($pmessage); $dmessage=stripslashes($pmessage); $hmessage=htmlspecialchars($dmessage, ENT_QUOTES, $config->charset); $jmessage=$dmessage; $containslink=stristr($dmessage, "[url"); // parse bb code if it is a sysgm $dmessage=uddeIMbbcode_replace($dmessage, $config); $dmessage=uddeIMsmile_replace($dmessage, $config); echo "\t<tr class='sectiontableentry2'>\n\t\t\n\t\t<td>".nl2br($dmessage)."</td></tr>\n"; // to do echo "</table></div>\n"; echo "<div id='uddeim-writeform'>\n"; echo "<form method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=savesysgm&Itemid=".$item_id)."'><input type='hidden' name='sysgm_sys' value='".$sysgm_sys."' />\n"; echo "<span style='display: none'>\n"; if ($sysgm_universe=="sysgm_toall") { echo "<input type='hidden' name='sysgm_universe' value='sysgm_toall' />\n"; } elseif ($sysgm_universe=="sysgm_toallspecial") { echo "<input type='hidden' name='sysgm_universe' value='sysgm_toallspecial' />\n"; } elseif ($sysgm_universe=="sysgm_toalladmins") { echo "<input type='hidden' name='sysgm_universe' value='sysgm_toalladmins' />\n"; } elseif ($sysgm_universe=="sysgm_toalllogged") { echo "<input type='hidden' name='sysgm_universe' value='sysgm_toalllogged' />\n"; } elseif ($config->showgroups) { echo "<input type='hidden' name='sysgm_universe' value='".$sysgm_universe."' />\n"; } echo "<input type='hidden' name='sysgm_validfor' value='".(int)$sysgm_validfor."' />\n"; echo "<textarea style='visibility: hidden;' name='pmessage' class='inputbox' rows='1' cols='60'>".$jmessage."</textarea>\n"; echo "<input type='hidden' name='sysgm_really' value='1' />\n"; echo "<input type='hidden' name='forceembedded' value='".(int)$forceembedded."' />\n"; echo "<input type='hidden' name='sysgm_nonotify' value='".(int)$sysgm_nonotify."' />\n"; echo "<span id='divpass' style='visibility:hidden;'><input type='hidden' name='cryptpass' value='".$cryptpass."' /></span>\n"; if( $config->enableattachment && uddeIMisAttachmentAllowed($my_gid, $config)) { while (list($key, $value) = each( $uploadfile_temppathname )) { echo "<input type='hidden' name='uploadfile_temppathname[". $key ."]' value=". $database->Quote($uploadfile_temppathname[$key]) ." />\n"; echo "<input type='hidden' name='uploadfile_original[". $key ."]' value=". $database->Quote($uploadfile_original[$key]) ." />\n"; echo "<input type='hidden' name='uploadfile_id[". $key ."]' value=". $database->Quote($uploadfile_id[$key]) ." />\n"; echo "<input type='hidden' name='uploadfile_size[". $key ."]' value=". $database->Quote($uploadfile_size[$key]) ." />\n"; } } echo "</span>\n"; echo "<input type='submit' name='reply' class='button' value='"._UDDEIM_SUBMIT."' />\n"; echo "<input type='button' class='button' value='".htmlspecialchars(_UDDEIM_DONTSEND, ENT_QUOTES, $config->charset)."' onclick='history.go(-1); return false;' />"; echo "</form>"; echo "</div>"; if ($containslink) { echo "<div id='uddeim-bottomlines'><p>"._UDDEIM_SYSGM_CHECKLINK."</p>\n</div>\n"; } echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; } else { // sysgm_really is set to true, send is confirmed. Now send it. $uploadfile_temppathname = uddeIMmosGetParam ($_POST, 'uploadfile_temppathname', array()); $uploadfile_original = uddeIMmosGetParam ($_POST, 'uploadfile_original', array()); $uploadfile_id = uddeIMmosGetParam ($_POST, 'uploadfile_id', array()); $uploadfile_size = uddeIMmosGetParam ($_POST, 'uploadfile_size', array()); $savedatum=uddetime($config->timezone); if($sysgm_validfor>0) { $now=uddetime($config->timezone); $validuntil=$now+($sysgm_validfor*3600); } else { $validuntil=0; } $savefromid=$myself; $savedisablereply=0; $savesysflag=""; if($sysgm_sys) { $savesysflag=addslashes($config->sysm_username); // system message $savedisablereply=1; // and users can't reply to them } else { $savesysflag=addslashes($sendername); $savedisablereply=0; } if ($config->cryptmode>=1) { // because of encoding do not use slashes $savemessage=strip_tags($pmessage); } else { $savemessage=addslashes(strip_tags($pmessage)); // original 0.6+ } // strip XSS code $savemessage = uddeIMRemoveXSS($savemessage); getAdditonalGroups($add_special, $add_admin, $config); if (uddeIMcheckJversion()>=2) { // J1.6 // who shall get the message? if($sysgm_universe=="sysgm_toall") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($sysgm_universe=="sysgm_toalllogged") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($sysgm_universe=="sysgm_toallspecial") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (3,4,5,6,7,8".$add_admin.$add_special.")"; } elseif($sysgm_universe=="sysgm_toalladmins") { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id IN (7,8".$add_admin.")"; } elseif ($config->showgroups) { $sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) INNER JOIN #__usergroups AS g ON um.group_id=g.id WHERE u.block=0 AND g.id=".(int)$sysgm_universe; } } else { // who shall get the message? if($sysgm_universe=="sysgm_toall") { $sql="SELECT id FROM #__users WHERE block=0"; } elseif($sysgm_universe=="sysgm_toalllogged") { $sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid"; } elseif($sysgm_universe=="sysgm_toallspecial") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (19,20,21,23,24,25".$add_admin.")"; } elseif($sysgm_universe=="sysgm_toalladmins") { $sql="SELECT id FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")"; } elseif ($config->showgroups) { $sql="SELECT id FROM #__users WHERE block=0 AND gid=".(int)$sysgm_universe; } } // query the database $database->setQuery($sql); $receivers=$database->loadObjectList(); if (!count($receivers)) { // when there are temporary files, remove them and the markers uddeIMpreSaveAttachmentsRemove($config); $mosmsg = _UDDEIM_SYSGM_ERRORNORECIPS; uddeJSEFredirect("index.php?option=com_uddeim&task=sysgm&Itemid=".$item_id, $mosmsg); } // we have all we need, now save it // when we have reached that, we can remove the temporary attachment markers since the files will be referenced later if( $config->enableattachment && uddeIMisAttachmentAllowed($my_gid, $config)) uddeIMpreSaveAttachmentsFinish($config); foreach($receivers as $receiver) { $savetoid=$receiver->id; // it is a systemmsg to "toid", so assume that the message has already been trashed in the senders outbox (remember: system messages are not shown in the outbox) // so set totrashoutbox=1, totrashdateoutbox=uddetime($config->timezone) // CRYPT $themode = 0; if ($config->cryptmode==1) { $themode = 1; $cm = uddeIMencrypt($savemessage,$config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",1,'".md5($config->cryptkey)."')"; } elseif ($config->cryptmode==2) { $themode = 2; $thepass=$cryptpass; if (!$thepass) { // no password entered, then fallback to obfuscating $themode = 1; $thepass=$config->cryptkey; } $cm = uddeIMencrypt($savemessage,$thepass,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.", ".$themode.",'".md5($thepass)."')"; } elseif ($config->cryptmode==3) { $themode = 3; $cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",3)"; } elseif ($config->cryptmode==4) { $themode = 4; $thepass=$cryptpass; $cipher = CRYPT_MODE_3DESBASE64; if (!$thepass) { // no password entered, then fallback to obfuscating $themode = 1; $thepass=$config->cryptkey; $cipher = CRYPT_MODE_BASE64; } $cm = uddeIMencrypt($savemessage,$thepass,$cipher); $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$savefromid.", ".(int)$savetoid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.", ".$themode.",'".md5($thepass)."')"; } else { $sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox) VALUES (".(int)$savefromid.", ".(int)$savetoid.", '".$savemessage."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1,".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insID = $database->insertid(); // UDDEIMFILE // Now save the uploads if( $config->enableattachment && uddeIMisAttachmentAllowed($my_gid, $config)) uddeIMsaveAttachments($insID, $uploadfile_temppathname, $uploadfile_original, $uploadfile_id, $uploadfile_size, $savedatum, $config); // Check if E-Mail notification or popups are enabled by default, if so create a record for the receiver. if ($config->modnewusers>0 || $config->notifydefault>0 || $config->popupdefault>0 || $config->pubfrontenddefault>0 || $config->autoresponder>0 || $config->autoforward>0) { if (!uddeIMexistsEMN($savetoid)) uddeIMinsertEMNdefaults($savetoid, $config); } // Check if notifications are not disabled temporary if (!$sysgm_nonotify) { // e-mail notification code // is the receiver currently online? $currentlyonline = uddeIMisOnline($savetoid); if ($config->cryptmode>=1) { $email=stripslashes($savemessage); } else { $email=stripslashes(stripslashes($savemessage)); // without encoding remove the safety slashes } $type = 0; // 0=normal message, 1=forgetmenot, 2=admin forces text if ($forceembedded) $type = 2; // admin forces if($config->allowemailnotify==1) { $ison = uddeIMgetEMNstatus($savetoid); if($sysgm_sys) { $emn_fromid = 0; } else { $emn_fromid = $savefromid; } if (($ison==1) || ($ison==2 && !$currentlyonline) || ($ison==10) || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $savetoid, $email, $type, $config); // 0 stands for normal (not forgetmenot) } } elseif($config->allowemailnotify==2) { $my_gid = uddeIMgetGID($savetoid); if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) { $ison = uddeIMgetEMNstatus($savetoid); if($sysgm_sys) { $emn_fromid = 0; } else { $emn_fromid = $savefromid; } if (($ison==1) || ($ison==2 && !$currentlyonline) || ($ison==10) || ($ison==20 && !$currentlyonline)) { uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $savetoid, $email, $type, $config); // 0 stands for normal (not forgetmenot) } } } } } $mosmsg=_UDDEIM_MESSAGE_SENT; uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id, $mosmsg); } }
function uddeIMshowOutmessage($myself, $item_id, $messageid, $isforward, $cryptpass, $config) { global $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $my_gid = $config->usergid; $displaymessages = uddeIMselectOutboxMessage($myself, $messageid, $config, 0); if(count($displaymessages)<1) { echo _UDDEIM_MESSAGENOACCESS; return; } // write the uddeim menu uddeIMprintMenu($myself, 'showOutmessage', $item_id, $config); echo "<div id='uddeim-m'>\n"; foreach($displaymessages as $displaymessage) { $msgread=$displaymessage->toread; $toname = uddeIMevaluateUsername($displaymessage->toname, $displaymessage->toid, $displaymessage->publicname); // CRYPT $cm = uddeIMgetMessage($displaymessage->message, $cryptpass, $displaymessage->cryptmode, $displaymessage->crypthash, $config->cryptkey); // echo str_replace("&#", "&#", nl2br(htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset))); $dmessage = nl2br(htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset)); $dmessage = str_replace("&#", "&#", $dmessage); // unicode workaround $dmessage = str_replace("&</br>", "</br>", $dmessage); // if system message or bbcodes allowed, call parser if ($displaymessage->systemflag || $config->allowbb) $dmessage=uddeIMbbcode_replace($dmessage, $config); if ($config->allowsmile) $dmessage=uddeIMsmile_replace($dmessage, $config); $bodystring=$dmessage; $replytomessage = uddeIMreplySuggestion($cm, $displaymessage, "", $toname, $isforward, "outbox", $config); // We used an placeholder above to insert the "reply suggestion" for the "mailto:" link $urlbody = rawurlencode($replytomessage); // display the message $headerstring="<table class='innermost'><tr>"; // does CB have a thumbnail image of the receiver? if ($config->showcbpic && $displaymessage->toname || $config->gravatar) { $topic = uddeIMgetPicOnly($displaymessage->toid, $config); if ($topic) $headerstring.="<td valign='top' rowspan='2'>".$topic."</td>\n"; } $headerstring.="<td valign='top' width='99%'><div class='uddeim-messagefrom'>"; $headerstring.=_UDDEIM_MESSAGETO; // show links ??? $temp = $toname; if ($config->showcblink && $displaymessage->toname) { $temp = uddeIMgetLinkOnly($displaymessage->toid, $toname, $config); } // display email address if ($displaymessage->toname==NULL && !$displaymessage->toid && $displaymessage->publicemail!=NULL) $temp .= " <<a href='mailto:".$displaymessage->publicemail."?body=".$urlbody."'>".$displaymessage->publicemail."</a>>"; $headerstring.=$temp; // is this user currently online? if ($config->showonline && $displaymessage->toname) { $isonline = uddeIMisOnline($displaymessage->toid); if($isonline) $headerstring.=" ".$uddeicons_onlinepic; else $headerstring.=" ".$uddeicons_offlinepic; } $headerstring.="<br />"; $headerstring.=uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ()); $headerstring.="</div></td><td valign='top' rowspan='2'><span class='uddeim-clear'> </span><ul>"; // show delete links if ($config->allowforwards) { if ($displaymessage->cryptmode==2 || $displaymessage->cryptmode==4) { // Message is encrypted, so go to enter password page $headerstring.="<li class='uddeim-messageactionlink-forward'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardoutboxpass&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_FORWARDLINK."</a></li>\n"; } else { // normal message $headerstring.="<li class='uddeim-messageactionlink-forward'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardoutbox&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_FORWARDLINK."</a></li>\n"; } } if (!$displaymessage->totrashoutbox) { // but only if not already moved to trash $headerstring.="<li class='uddeim-messageactionlink-delete'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletefromoutbox&Itemid=".$item_id."&ret=top&messageid=".$displaymessage->id)."'>"._UDDEIM_DELETELINK."</a></li>\n"; } if (!$displaymessage->toread) { // if not read then a recall is possible if ($displaymessage->cryptmode==2 || $displaymessage->cryptmode==4) { // Message is encrypted, so go to enter password page $headerstring.="<li class='uddeim-messageactionlink-recall'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_RECALL."</a></li>\n"; } else { // normal message $headerstring.="<li class='uddeim-messageactionlink-recall'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_RECALL."</a></li>\n"; } } $headerstring.="</ul></td>"; $headerstring.="</tr>"; $msgnavigation = " "; if ($config->enablereply) { $msgnavigation = ""; $pathtosite = uddeIMgetPath('live_site'); $pic = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/envelope.gif' alt='"._UDDEIM_PMNAV_EXISTS."' title='"._UDDEIM_PMNAV_EXISTS."' />"; $picdel = "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/envelope_deleted.gif' alt='"._UDDEIM_PMNAV_DELETED."' title='"._UDDEIM_PMNAV_DELETED."' />"; $replyid = $displaymessage->replyid; if ($replyid) { $msgnavigation .= _UDDEIM_PMNAV_THISISARESPONSE; $orig = uddeIMselectInboxMessage($myself, $replyid, $config, 0); $temp = Array(); foreach($orig as $or) $temp = $or; $orig = $temp; if (count($orig)>0) { // the message should be stored in the outbox if ($orig->cryptmode==2 || $orig->cryptmode==4) { // Message is encrypted, so go to enter password page $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$replyid)."'>".$pic."</a>"; } else { // normal message $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$replyid)."'>".$pic."</a>"; } } else { $msgnavigation .= " ".$picdel; } } $repls = uddeIMselectMessageReplies($displaymessage->id, 'inbox', $myself); if (count($repls)>0) { $msgnavigation .= "<br />"; $msgnavigation .= _UDDEIM_PMNAV_THEREARERESPONSES; foreach($repls as $repl) { if ($repl->cryptmode==2 || $repl->cryptmode==4) { // Message is encrypted, so go to enter password page $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$repl->id)."'>".$pic."</a>"; } else { // normal message $msgnavigation .= " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$repl->id)."'>".$pic."</a>"; } $msgnavigation .= " "; } } } $headerstring.="<tr><td valign='bottom'><div class='uddeim-messagefrom'>".trim($msgnavigation)."</div></td></tr>"; $headerstring.="</table>"; if (!$isforward) { echo "<div class='uddeim-messageheader'>".$headerstring."</div>"; echo "<div class='uddeim-messagebody'>".uddeIMreplyquoteMarkup($bodystring,$config->quotedivider)."</div>"; // UDDEIMFILE if( $config->enableattachment ) // Always show attachments when attachments are enabled uddeIMshowAttachments("outbox", $item_id, $displaymessage->id, $config); } $trashmessage = $displaymessage->totrashoutbox; } if ($config->inboxlimit) { // there is a limit for inbox + archive if ($config->allowarchive) { // have an archive and an "archive and inbox" limit, so get number of messages in inbox and archive $universeflag = _UDDEIM_ARC_UNIVERSE_BOTH; // inbox and archive $total = uddeIMgetInboxArchiveCount($myself); } else { // user has switched off archive but there is an limit for "inbox", so count inbox messages only $universeflag = _UDDEIM_ARC_UNIVERSE_INBOX; // inbox $total = uddeIMgetInboxCount($myself); } // "You have XX messages in your inbox/inbox+archive." $limitreached = _UDDEIM_INBOX_LIMIT_1." ".$total; $limitreached.= " ".($total==1 ? _UDDEIM_INBOX_LIMIT_2_SINGULAR : _UDDEIM_INBOX_LIMIT_2)." "; $limitreached.= $universeflag; if (!uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config) && ($isforward && $config->allowforwards)) { // so the warning is only displayed when a forward is possible // "The allowed maximum is XX." // $limitreached.= _UDDEIM_INBOX_LIMIT_3." ".$config->maxarchive.". "; $limitreached.= " "._UDDEIM_SHOWINBOXLIMIT_2." ".$config->maxarchive.")."; // (of max. ) if ($total > $config->maxarchive) { // "You have XX messages in your inbox/inbox+archive." $limitreached = _UDDEIM_INBOX_LIMIT_1." ".$total; $limitreached.= " ".($total==1 ? _UDDEIM_INBOX_LIMIT_2_SINGULAR : _UDDEIM_INBOX_LIMIT_2)." "; $limitreached.= $universeflag; // You can still receive and read messages but you will not be able to reply or to compose new ones until you delete messages. $limitwarning = _UDDEIM_INBOX_LIMIT_4; $showinboxlimit_borderbottom = "<span class='uddeim-warning'>"; $showinboxlimit_borderbottom.= $limitreached." "; $showinboxlimit_borderbottom.= $limitwarning; $showinboxlimit_borderbottom.= "</span>"; echo "<div id='uddeim-bottomlines'>".$showinboxlimit_borderbottom."</div>"; // close main container echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', $limitreached, $config)."</div>\n"; return; } } } if ($isforward && $config->allowforwards) { // it is a forward // show reply form if(!$trashmessage) { // but only if not already moved to trash $tbackto = uddeIMmosGetParam($_SERVER, 'HTTP_REFERER', null); if(stristr($tbackto, "com_uddeim")) { $tbackto=""; } uddeIMdrawWriteform($myself, $my_gid, $item_id, $tbackto, "", $replytomessage, 0, 0, 0, 0, $config); } else { // offer recycle link echo "<div id='uddeim-bottomlines'>"._UDDEIM_YOUMOVEDTOTRASH; echo "<br />"; echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=restore&Itemid=".$item_id."&messageid=".$replytoid)."'>"._UDDEIM_RESTORE."</a></div>\n"; } } // recall link if unread if (!$msgread) { echo "<div id='uddeim-bottomlines'>"; if ($displaymessage->cryptmode==2 || $displaymessage->cryptmode==4) { // Message is encrypted, so go to enter password page echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_RECALLTHISMESSAGE."</a>"; } else { // normal message echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$displaymessage->id)."'>"._UDDEIM_RECALLTHISMESSAGE."</a>"; } echo "</div>\n"; } echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; }