/** * Converts string containing BBCode to HTML * * @param string $string * @return string */ private function bbCodeToHTML($string) { // Parse BBCode: $string = uddeIMbbcode_replace($string, $this->uddeIMConfigRAW); // Remove remaining BBCode: $string = uddeIMbbcode_strip($string, $this->uddeIMConfigRAW); return $string; }
function uddeIMreplySuggestion($decryptedmessage, $displaymessage, $fromname, $toname, $isforward, $box, $config) { $replysuggest = stripslashes($decryptedmessage); // if allowed to contain bbcodes they should be stripped for the reply quote if ($displaymessage->systemflag || $config->allowbb) $replysuggest = uddeIMbbcode_strip($replysuggest); if ($box=="outbox") { if ($isforward && $config->allowforwards) { $fromname = uddeIMgetNameFromID($displaymessage->fromid, $config); if ($config->allowbb) $replysuggest="[i]"._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest; else $replysuggest=""._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest; } } else { if ($isforward && $config->allowforwards) { if ($displaymessage->toid!=$displaymessage->fromid) { // not a copy to myself $toname = uddeIMgetNameFromID($displaymessage->toid, $config); if ($config->allowbb) $replysuggest="[i]"._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest; else $replysuggest=""._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest; } else { // its a copy2me $toname = uddeIMgetNameFromID($displaymessage->toid, $config); if ($config->allowbb) $replysuggest="[i]"._UDDEIM_FWDFROM." ".$toname." ".$fromname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest; else $replysuggest=""._UDDEIM_FWDFROM." ".$toname." ".$fromname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest; } } } $replytomessage = "\n\n\n\n".$config->quotedivider."\n".$replysuggest; if ($config->maxlength) { if (uddeIM_utf8_strlen($config->languagecharset, $replytomessage)+3>=$config->maxlength) { $mlength = $config->maxlength * 2 / 3; $replytomessage = uddeIM_utf8_substr($config->languagecharset, $replytomessage,0,$mlength)."..."; } } return $replytomessage; }
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 uddeIMarchiveDownload($myself, $item_id, $arcmes, $limit, $limitstart, $cryptpass, $config) { $mosConfig_sitename = uddeIMgetSitename(); // if e-mail traffic stopped, don't send. if (!$config->emailtrafficenabled) { $mosmsg = _UDDEIM_STOPPEDEMAIL; uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); } if (!$config->allowarchive || !$config->enabledownload) { $mosmsg = _UDDEIM_ARCHIVENOTENABLED; uddeJSEFredirect("HTTP_REFERER", $mosmsg, "archive"); } $n = count($arcmes); if(!$n) { echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>"; return; } $clrf=chr(10); $rightnow=uddetime($config->timezone); $htmlstring="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>"; $htmlstring.=$mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD; $htmlstring.="</title></head><body><h2>"; $htmlstring.=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename; $htmlstring.="</h2><h4>".uddeLdate($rightnow, $config, uddeIMgetUserTZ())."</h4><!-- generated by uddeIM messaging component --><table cellspacing=0 cellpadding=4 border=0>"; $exportstring=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename.$clrf; $exportstring.=uddeLdate($rightnow, $config, uddeIMgetUserTZ()); $exportstring.=$clrf.$clrf.$clrf; $maindivider="================================================================================".$clrf; $exportstring.=$maindivider; for($i = 0; $i <= ($n-1); $i++) { $trashs = uddeIMselectArchiveMessage($myself, $arcmes[$i], $config); foreach($trashs as $trash) { $fromname = uddeIMevaluateUsername($trash->fromname, $trash->fromid, $trash->publicname); if($trash->systemflag) $fromname = $trash->systemmessage; // $headstring.=" (".uddeLdate($trash->datum, $config, uddeIMgetUserTZ()).")"; // $headdivider=str_repeat("=", strlen($headstring)); // $exportstring.=" ".$headstring.$clrf." ".$headdivider.$clrf.$clrf; $cm = uddeIMgetMessage($trash->message, $cryptpass, $trash->cryptmode, $trash->crypthash, $config->cryptkey); $dlmsg = stripslashes($cm); $dlmsg = uddeIMbbcode_strip($dlmsg); // $exportstring.=stripslashes($dlmsg); // $exportstring.=$clrf.$clrf.$clrf.$clrf; // $exportstring.=$maindivider; $exportstring.=_UDDEIM_EXPORT_FORMAT; $exportstring=str_replace("%user%", $fromname, $exportstring); $exportstring=str_replace("%msgdate%", uddeLdate($trash->datum, $config, uddeIMgetUserTZ()), $exportstring); $exportstring=str_replace("%msgbody%", $dlmsg, $exportstring); $htmlstring.="\n\t<tr bgcolor=#cccccc><td><strong>".$fromname."</strong></td><td align=right>".uddeLdate($trash->datum, $config, uddeIMgetUserTZ())."</td></tr><tr><td> </td><td>"; $htmlstring.=nl2br(stripslashes($dlmsg)); $htmlstring.="</td></tr>"; } } $htmlstring.="\n</table>\n</body>\n</html>\n"; // we now have $exportstring and $htmlstring (text and html respecitvely) as files with all checked messages (in arcmes[]) // $ret = uddeIMgetNameEmailFromID($myself, $var_toname, $var_tomail, $config); $var_toname = uddeIMgetNameFromID($myself, $config); $var_tomail = uddeIMgetEMailFromID($myself, $config); if (!$var_tomail) { $mosmsg = _UDDEIM_EXPORT_COULDNOTSEND; uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); } if (!$var_toname) $var_toname = "Anonymous"; $subject = $mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD; $var_fromname = $config->emn_sendername; $var_frommail = $config->emn_sendermail; if(uddeIMsendmail($var_fromname, $var_frommail, $var_toname, $var_tomail, $subject, $exportstring, "", "", "", $config)) { $mosmsg = _UDDEIM_EXPORT_MAILED; } else { $mosmsg = _UDDEIM_EXPORT_COULDNOTSEND; } uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg); }
if (function_exists('bcdiv')) { $udd_halfchars = bcdiv($udd_par_maxchars, 2, 0); } elseif (function_exists('floor')) { $udd_halfchars = floor($udd_par_maxchars / 2); } else { $udd_halfchars = $udd_par_maxchars / 2; } if (strlen($udd_whofrom) >= $udd_halfchars - 1) { $udd_whofrom = substr($udd_whofrom, 0, $udd_halfchars - 1); $udd_whofrom = $udd_whofrom . "."; } $udd_cm = uddeIMgetMessage($udd_themessage->message, "", $udd_themessage->cryptmode, "", $udd_config->cryptkey); $udd_displaymessage = stripslashes($udd_cm); if ($udd_themessage->systemmessage || $udd_config->allowbb) { require_once $udd_pathtouser . "/bbparser.php"; $udd_displaymessage = uddeIMbbcode_strip($udd_displaymessage); } $udd_displaymessage = htmlspecialchars($udd_displaymessage, ENT_QUOTES, $udd_config->charset); $udd_displaymessage = str_replace("&#", "&#", $udd_displaymessage); $udd_maxlen = $udd_par_maxchars - strlen($udd_whofrom) - 1; // one space if ($udd_maxlen < 5) { $udd_maxlen = 5; } if ($udd_themessage->cryptmode == 2) { $udd_pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim" . ($udd_item_id ? "&Itemid=" . $udd_item_id : "") . "&task=showpass&messageid=" . $udd_themessage->id); } else { $udd_pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim" . ($udd_item_id ? "&Itemid=" . $udd_item_id : "") . "&task=show&messageid=" . $udd_themessage->id); } if ($udd_par_showmsg == 2) { echo "<p class='uddeim-module-row'>";
function uddeIMshowInbox($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; $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=inbox&sort_mode=0&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; $sort_name = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=inbox&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=inbox&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=inbox&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=inbox&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=inbox&sort_mode=2&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; } } // invoke pruning if set so $my_gid = $config->usergid; if ($config->adminignitiononly==1) { // admin only if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) // call pruneMsgs, when it is an admin or superadmin uddeIMpruneMessages($myself, $item_id, $my_gid, 'inbox', $config); } elseif ($config->adminignitiononly==0) { // all users are allowed to prune messages, uddeIMpruneMessages($myself, $item_id, $my_gid, 'inbox', $config); // when all users can prune then gid is not really neccessary } if ($config->fileadminignitiononly==1) { // admin only if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) // call pruneMsgs, when it is an admin or superadmin uddeIMpruneFiles($myself, $item_id, $my_gid, 'inbox', $config); } elseif ($config->fileadminignitiononly==0) { // all users are allowed to prune messages, uddeIMpruneFiles($myself, $item_id, $my_gid, 'inbox', $config); // when all users can prune then gid is not really neccessary } // set the remindersent to now, because looking into inbox counts as remindersent uddeIMupdateEMNreminder($myself, uddetime($config->timezone)); // message limit for inbox? if ($config->inboxlimit && $config->allowarchive) { $universeflag = _UDDEIM_ARC_UNIVERSE_BOTH; // inbox and archive } else { $universeflag = _UDDEIM_ARC_UNIVERSE_INBOX; // inbox } // how many messages total in inbox? $totalinbox = uddeIMgetInboxCount($myself, $filter_user, $filter_unread, $filter_flagged); // also used for navigation if ($config->inboxlimit && $config->allowarchive) { // inbox + archive, already stored messages in archive are not counted, when archive is disabled $total = uddeIMgetInboxArchiveCount($myself); } else { $total = uddeIMgetInboxCount($myself); // also used for navigation } $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 ($config->inboxlimit) { // there is a limit for inbox + archive 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_INBOX_LIMIT_4; // You can still receive and read messages but you will not be able to reply or to compose new ones until you delete messages. } } } else { // there is a limit for the archive only $limitreached.= "."; // so inbox is unlimited } // now load messages as required if(!$limitstart) $limitstart = 0; if(!$limit) $limit=$config->perpage; if ($limitstart>=$totalinbox) $limitstart=max(0,$limitstart - $limit); $allmessages = uddeIMselectInbox($myself, $limitstart, $limit, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode); // write the uddeim menu uddeIMprintMenu($myself, 'inbox', $item_id, $config); echo "<div id='uddeim-m'>\n"; if ($config->enablefilter==1 || $config->enablefilter==3) uddeIMprintFilter($myself, 'inbox', $totalinbox, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); // if ($limitreached) { // BUGBUG, not required, planned for level meter // echo "<div id='uddeim-toplines'><p>".$limitreached."</p></div>\n"; // } // if no messages: if (count($allmessages)<1) { // no messages to list uddeIMshowNoMessage('inbox', $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=inboxfork&Itemid=".$item_id)."'>\n"; // now open the inbox container and table; write table headings echo "<div id='uddeim-overview'><table cellpadding='7' width='100%'>\n"; // checkcell $delall="<input type=\"checkbox\" name=\"arcmes[]\" value=\"\" onclick=\"wiglwogl(this);\" title=\""._UDDEIM_CHECKALL."\" />"; echo "<tr><th style='text-align:center;' class='sectiontableheader'>".$delall."</th><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>\n"; $i = 1; // now write the list foreach($allmessages as $themessage) { $fromname = uddeIMevaluateUsername($themessage->fromname, $themessage->fromid, $themessage->publicname); $personalsys = 0; if($themessage->systemflag && $themessage->systemmessage == $fromname) // || $themessage->toid==$myself) { dann wird auch ein Bild bei "Copy2me" angezeigt. $personalsys = 1; if($themessage->systemflag) $fromname = $themessage->systemmessage; // 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&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&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_unflagged."</a>"; } if($themessage->toread) $readcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=markunread&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_readpic."</a>"; else $readcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=markread&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_unreadpic."</a>"; 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("&#", "&#", $safemessage); $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()); $archivecell=""; $fwdcell=""; if ($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=delete&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 />"; } } if ($config->allowarchive && $themessage->toread) $archivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivemessage&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/archive.gif' alt='"._UDDEIM_STORE."' title='"._UDDEIM_STORE."' /></a><br />"; } else { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=delete&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 />"; } } if ($config->allowarchive && $themessage->toread) $archivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivemessage&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_STORE."</a><br />"; } // checkcell $delcell="<input type='checkbox' name='arcmes[]' value='".$themessage->id."' />"; echo "<tr class='sectiontableentry".$i."'>"; echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$delcell."</td>"; // checkcell 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.$archivecell.$deletecell."</td>"; } else { echo "<td class='pathway'>".$fwdcell.$archivecell.$deletecell."</td>"; } echo "</tr>\n"; $i++; if ($i>2) { $i=1; } } $muldel = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=muldelete&Itemid=".$item_id."&limitstart=0&limit=".$limit); if($config->bottomlineicons) { echo "<tr><th style='text-align:center;' class='sectiontablefooter'>"; echo '<a href="#" onclick="inboxDelete(\''.$muldel.'\'); 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><th class='sectiontablefooter'> </th></tr>\n"; } // now close inbox table and container echo "</table></div>\n"; // checkcell echo "</form>\n"; // write the inbox navigation links $pageNav = new uddeIMmosPageNav($totalinbox, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=inbox&Itemid=".$item_id.$addlink.$addlink2; if ($totalinbox>$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=inbox&Itemid=".$item_id."&limitstart=0&limit=".$totalinbox.$addlink.$addlink2)."'>"._UDDEIM_SHOWALL."</a>]"; echo "</div>\n"; } else { echo "<div id='uddeim-pagenav'></div>\n"; } $showinboxlimit_borderbottom = ""; if ($limitwarning) { $showinboxlimit_borderbottom = "<span class='uddeim-warning'>"; $showinboxlimit_borderbottom.= $limitreached." "; $showinboxlimit_borderbottom.= $limitwarning; $showinboxlimit_borderbottom.= "</span>"; } $keephours1=($config->ReadMessagesLifespan) * 1; // this are days $keephours2=($config->UnreadMessagesLifespan) * 1; // this are days echo "<div id='uddeim-bottomlines'>"; if(!$config->bottomlineicons) echo '<p><a href="#" onclick="inboxDelete(\''.$muldel.'\'); return false;">'._UDDEIM_TRASHCHECKED.'</a></p>'; if ($config->ReadMessagesLifespanNote) echo "<p>"._UDDEIM_READ_INFO_1.$keephours1._UDDEIM_READ_INFO_2."</p>"; if ($config->UnreadMessagesLifespanNote) echo "<p>"._UDDEIM_UNREAD_INFO_1.$keephours2._UDDEIM_UNREAD_INFO_2."</p>"; if ($showinboxlimit_borderbottom) echo "<p>".$showinboxlimit_borderbottom."</p>"; echo "</div>\n"; if ($config->enablefilter==2 || $config->enablefilter==3) uddeIMprintFilter($myself, 'inbox', $totalinbox, $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"; // echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', $showinboxlimit_borderbottom, $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 uddeIMshowPostboxUser($myself, $userid, $item_id, $limit, $limitstart, $cryptpass, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode) { global $uddeicons_delayedpic, $uddeicons_flagged, $uddeicons_unflagged, $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic; $pathtosite = uddeIMgetPath('live_site'); // invoke pruning if set so $my_gid = $config->usergid; // message limit for inbox? if ($config->inboxlimit && $config->allowarchive) { $universeflag = _UDDEIM_ARC_UNIVERSE_BOTH; // inbox and archive } else { $universeflag = _UDDEIM_ARC_UNIVERSE_INBOX; // inbox } if ($config->inboxlimit && $config->allowarchive) { // inbox + archive, already stored messages in archive are not counted, when archive is disabled $total = uddeIMgetInboxArchiveCount($myself); } else { $total = uddeIMgetInboxCount($myself); // also used for navigation } $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 ($config->inboxlimit) { // there is a limit for inbox + archive 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_INBOX_LIMIT_4; // You can still receive and read messages but you will not be able to reply or to compose new ones until you delete messages. } } } else { // there is a limit for the archive only $limitreached.= "."; // so inbox is unlimited } $totalpostbox = uddeIMgetPostboxUserCount($myself, $userid, $filter_user, $filter_unread, $filter_flagged); // now load messages as required if(!$limitstart) $limitstart = 0; if(!$limit) $limit=$config->perpage; if ($limitstart>=$totalpostbox) $limitstart=max(0,$limitstart - $limit); // $allmessages = uddeIMselectInbox($myself, $limitstart, $limit, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode); $allmessages = uddeIMselectPostboxUser($myself, $userid, $limitstart, $limit, $config); // write the uddeim menu uddeIMprintMenu($myself, 'inbox', $item_id, $config); echo "<div id='uddeim-m'>\n"; //if ($config->enablefilter==1 || $config->enablefilter==3) // uddeIMprintFilter($myself, 'postboxuser', $totalpostbox, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); // if no messages: if (count($allmessages)<1) { // no messages to list uddeIMshowNoMessage('postbox', $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"); if ($config->blocksystem) { if ($userid && $userid!=$myself) { $isblocked = uddeIMcheckBlockerBlocked($myself, $userid); if (!$isblocked) { echo "<div id='uddeim-block'>"; echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td align='left'>"; $blockcell = "<div style='text-align:right;'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=blockuser&Itemid=".$item_id."&recip=".$userid."&ret=postboxuser")."'>"._UDDEIM_BLOCKNOW."</a></div>"; echo $blockcell; echo "</td></tr></table>"; echo "</div>"; } } } echo "<form method='post' name='messages' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=inboxfork&Itemid=".$item_id)."'>\n"; // now open the inbox container and table; write table headings echo "<div id='uddeim-overview'>"; echo "<table cellpadding='7' width='100%'>\n"; // checkcell $delall="<input type=\"checkbox\" name=\"arcmes[]\" value=\"\" onclick=\"wiglwogl(this);\" title=\""._UDDEIM_CHECKALL."\" />"; echo "<tr>"; echo "<th style='border:none; text-align:center;' class='sectiontableheader'>".$delall."</th>"; echo "<th style='border:none;' class='sectiontableheader'> </th>"; echo "<th style='border:none;' class='sectiontableheader'>"._UDDEIM_FROM."/"._UDDEIM_TO."</th>"; echo "<th style='border:none;' class='sectiontableheader'>"._UDDEIM_DATE."</th>"; echo "<th style='border:none;' class='sectiontableheader'> </th>"; echo "</tr>\n"; $k = 1; $i = 1; // now write the list foreach($allmessages as $themessage) { $isinbox = 0; $isoutbox = 0; if ($myself==$themessage->toid && $myself!=$themessage->fromid) { $isinbox = 1; } elseif ($myself==$themessage->fromid && $myself!=$themessage->toid) { $isoutbox = 1; } else { // this case appears when a copy to me message has been trashed my myself $isinbox = 1; } $is_spam = 0; if ($config->reportspam) // save one database query if possible $is_spam = uddeIMgetSpamStatus($themessage->id); $flagcell = ""; $archivecell = ""; $fwdcell = ""; $deletecell = ""; $recallcell = ""; $attachcell = ""; $spamcell = ""; $spamcellflag = ""; if ($isinbox) { if($config->allowflagged) { if($themessage->flagged) $flagcell="<br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unflag&recip=".$userid."&ret=postboxuser&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_flagged."</a>"; else $flagcell="<br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=flag&recip=".$userid."&ret=postboxuser&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_unflagged."</a>"; } if($themessage->toread) $readcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=markunread&recip=".$userid."&ret=postboxuser&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_readpic."</a>"; else $readcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=markread&recip=".$userid."&ret=postboxuser&Itemid=".$item_id."&messageid=".$themessage->id."&limit=".$limit."&limitstart=".$limitstart)."'>".$uddeicons_unreadpic."</a>"; if ($config->showlistattachment) { $cnt = uddeIMgetAttachmentCount($themessage->id); if ($cnt) $attachcell = "<br /><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/attachment.gif' alt='"._UDDEIM_ATTACHMENT."' title='"._UDDEIM_ATTACHMENT."' border='0' />"; } if ($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=postboxdeleteinbox&recip=".$userid."&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 />"; } } if ($config->allowarchive && $themessage->toread) $archivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivemessage&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/archive.gif' alt='"._UDDEIM_STORE."' title='"._UDDEIM_STORE."' /></a><br />"; } else { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=postboxdeleteinbox&recip=".$userid."&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 />"; } } if ($config->allowarchive && $themessage->toread) $archivecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archivemessage&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_STORE."</a><br />"; } if ($config->reportspam) { // uddeIMcheckPlugin('spamcontrol') && not required since uddeIMcheckConfig sets this 0 if plugin is missing if ($is_spam) { $spamcell = "<br /><br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unreportspam&Itemid=".$item_id."&messageid=".$themessage->id."&recip=".$userid."&ret=postboxuser")."'>"._UDDEIM_SPAMCONTROL_UNREPORT."</a>"; $spamcellflag = "<br /><div class='uddeim-messagefrom-spam'>"._UDDEIM_SPAMCONTROL_MARKED."</div>"; } else { $spamcell = "<br /><br /><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=reportspam&Itemid=".$item_id."&messageid=".$themessage->id."&recip=".$userid."&ret=postboxuser")."'>"._UDDEIM_SPAMCONTROL_REPORT."</a>"; } } } if ($isoutbox) { if ($themessage->delayed) { $readcell=$uddeicons_delayedpic; } else { if ($themessage->toread) $readcell=$uddeicons_readpic; else $readcell=$uddeicons_unreadpic; } if ($config->showlistattachment) { $cnt = uddeIMgetAttachmentCount($themessage->id); if ($cnt) $attachcell = "<br /><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/attachment.gif' alt='"._UDDEIM_ATTACHMENT."' title='"._UDDEIM_ATTACHMENT."' border='0' />"; } if ($config->actionicons) { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=postboxdeleteoutbox&recip=".$userid."&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=forwardoutboxpass&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=forwardoutbox&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 { $deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=postboxdeleteoutbox&recip=".$userid."&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=forwardoutboxpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } else { // normal message $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardoutbox&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } } } if(!$themessage->toread) { // if not read then a recall is possible if($config->actionicons) { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/restore.gif' alt='"._UDDEIM_RECALL."' title='"._UDDEIM_RECALL."' /></a><br />"; } else { // normal message $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/restore.gif' alt='"._UDDEIM_RECALL."' title='"._UDDEIM_RECALL."' /></a><br />"; } } else { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_RECALL."</a><br />"; } else { // normal message $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_RECALL."</a><br />"; } } } } if ($isinbox) { if ($config->actionicons) { $newemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=reply&recip=".$userid."&Itemid=".$item_id."&messageid=".$themessage->id)."'>"; $newemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif' alt='"._UDDEIM_COMPOSE."' />"; $newemail .= "</a>"; } else { $newemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=reply&recip=".$userid."&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_COMPOSE."</a>"; } } if ($isoutbox) { if ($config->actionicons) { $newemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=new&recip=".$userid."&Itemid=".$item_id)."'>"; $newemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif' alt='"._UDDEIM_COMPOSE."' />"; $newemail .= "</a>"; } else { $newemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=new&recip=".$userid."&Itemid=".$item_id)."'>"._UDDEIM_COMPOSE."</a>"; } } // 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); $safemessage=htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset); $showemail = ""; if ($isinbox) { 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>"; $showemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"; $showemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/page_white_magnify.gif' alt='"._UDDEIM_DISPLAY."' />";; $showemail .= "</a>"; } else { // normal message // $messagecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; $messagecell="<a href='javascript:uddeIMtoggleLayer2(\"".$i."\");'>".$teasermessage."</a>"; $showemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$themessage->id)."'>"; $showemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/page_white_magnify.gif' alt='"._UDDEIM_DISPLAY."' />";; $showemail .= "</a>"; } } if ($isoutbox) { 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=showoutpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; $showemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showoutpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"; $showemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/page_white_magnify.gif' alt='"._UDDEIM_DISPLAY."' />";; $showemail .= "</a>"; } else { // normal message // $messagecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showout&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; $messagecell="<a href='javascript:uddeIMtoggleLayer2(\"".$i."\");'>".$teasermessage."</a>"; $showemail = "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showout&Itemid=".$item_id."&messageid=".$themessage->id)."'>"; $showemail .= "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/page_white_magnify.gif' alt='"._UDDEIM_DISPLAY."' />";; $showemail .= "</a>"; } } $datumcell=uddeDate($themessage->datum, $config, uddeIMgetUserTZ()); // checkcell $delcell="<input type='checkbox' name='arcmes[]' value='".$themessage->id."' />"; //echo "<tr class='sectiontableentry1'>"; echo "<tr class='uddeim-messagebody2header'>"; echo "<td style='padding:4px; border-bottom:none; border-right:none; width:32px; text-align:center; vertical-align:top'>".$delcell."</td>"; // checkcell echo "<td style='padding:4px; border-bottom:none; border-right:none; width:32px; text-align:center; vertical-align:top'>". $readcell.$attachcell.$flagcell. "</td>"; $st=uddeIMgetStyleForThumb($config); //echo "<td ".$st.">"; echo "<td style='padding:4px; border-bottom:none; border-right:none; vertical-align:top'>"; if ($isinbox) echo uddeIMdoInboxHeader($myself, $themessage, $config); if ($isoutbox) echo uddeIMdoOutboxHeader($myself, $themessage, $config); echo "</td>"; echo "<td style='padding:4px; border-bottom:none; border-right:none; vertical-align:top'>"; echo $datumcell; echo $spamcell.$spamcellflag; echo "</td>"; if ($config->actionicons) { echo "<td style='padding:4px; border-bottom:none; width:32px; text-align:center; vertical-align:top'>". // $fwdcell.$recallcell.$archivecell.$deletecell."<br /><br />".$newemail. $fwdcell.$recallcell.$archivecell.$deletecell. "</td>"; } else { echo "<td style='padding:4px; border-bottom:none; vertical-align:top' class='pathway'>". $fwdcell.$recallcell.$archivecell.$deletecell."<br /><br />".$newemail. "</td>"; } echo "</tr>\n"; // if ($themessage->cryptmode!=2 && $themessage->cryptmode!=4) { // Message is encrypted, so display no message // ############################################################# MESSSAGE $cm = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->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 // if system message or bbcodes allowed, call parser if ($themessage->systemflag || $config->allowbb) $dmessage = uddeIMbbcode_replace($dmessage, $config); if ($config->allowsmile) $dmessage = uddeIMsmile_replace($dmessage, $config); $bodystring = $dmessage; // converted message for email body if (0) { echo "<tr class='uddeim-messagebody2body'>"; echo "<td colspan='3' style='border-style:none; padding:0 8px 0 8px; text-align:left; vertical-align:bottom'>"; echo str_replace("<br />", "", $fwdcell." ".$recallcell." ".$archivecell." ".$deletecell." ".$newemail); echo "</td>"; echo "<td colspan='2' style='border-style:none; padding:0 8px 0 8px; text-align:right; vertical-align:middle'>"; echo str_replace("<br />", "", $readcell.$attachcell.$flagcell); echo "</td>"; echo "</tr>"; } echo "<tr class='uddeim-messagebody2body'>"; echo "<td colspan='4' style='padding:8px; border-top:none; border-right:none;'>"; // echo "<div style='text-align:right;'><a href='javascript:uddeIMtoggleLayer2(\"".$i."\");'>"._UDDEADM_SPAMCONTROL_SHOWHIDE."</a></div>"; if ($config->postboxfull==0) { $st_preview = "display:inline;"; $st_normal = "display:none;"; } if ($config->postboxfull==1) { if ($i==1) { $st_preview = "display:none;"; $st_normal = "display:inline;"; } else { $st_preview = "display:inline;"; $st_normal = "display:none;"; } } if ($config->postboxfull==2) { $st_preview = "display:none;"; $st_normal = "display:inline;"; } echo "<div id='uddeimdivlayerpreview_".$i."' style='".$st_preview."'>"; echo "<div class='uddeim-messagebody2'>".$messagecell."</div>"; echo "</div>\n"; echo "<div id='uddeimdivlayer_".$i."' style='".$st_normal."'>"; $messagecell="<a href='javascript:uddeIMtoggleLayer2(\"".$i."\");'>".uddeIMreplyquoteMarkup($bodystring,$config->quotedivider)."</a>"; echo "<div class='uddeim-messagebody2'>".$messagecell."</div>"; // UDDEIMFILE if( $config->enableattachment ) { // Always show attachments when attachments are enabled if ($isinbox) uddeIMshowAttachments("inbox", $item_id, $themessage->id, $config); if ($isoutbox) uddeIMshowAttachments("outbox", $item_id, $themessage->id, $config); } echo "</div>\n"; echo "</td>\n"; echo "<td style='padding:4px; border-top:none; border-left:none; width:32px; text-align:center; vertical-align:top'>"; echo $newemail."<br />".$showemail; echo "</td>\n"; echo "</tr>\n"; // } $i++; $k++; if ($k > 2) $k = 1; } $muldel = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=mulpostboxdelete&Itemid=".$item_id."&recip=".$userid."&limitstart=0&limit=".$limit); if($config->bottomlineicons) { echo "<tr><th style='border:none; text-align:center;' class='sectiontablefooter'>"; echo '<a href="#" onclick="inboxDelete(\''.$muldel.'\'); return false;"><img src="'.$pathtosite.'/components/com_uddeim/templates/'.$config->templatedir.'/images/trash.gif" alt="'._UDDEIM_TRASHCHECKED.'" title="'._UDDEIM_TRASHCHECKED.'"/></a>'; echo "</th><th style='border:none;' class='sectiontablefooter'> </th><th style='border:none;' class='sectiontablefooter'> </th><th style='border:none;' class='sectiontablefooter'> </th><th style='border:none;' class='sectiontablefooter'> </th></tr>\n"; } // now close inbox table and container echo "</table></div>\n"; // checkcell echo "</form>\n"; // write the inbox navigation links $pageNav = new uddeIMmosPageNav($totalpostbox, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=postboxuser&Itemid=".$item_id."&recip=".$userid; if ($totalpostbox>$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=postboxuser&Itemid=".$item_id."&recip=".$userid."&limitstart=0&limit=".$totalpostbox)."'>"._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>"; } $keephours1=($config->ReadMessagesLifespan) * 1; // this are days $keephours2=($config->UnreadMessagesLifespan) * 1; // this are days echo "<div id='uddeim-bottomlines'>"; if(!$config->bottomlineicons) echo '<p><a href="#" onclick="inboxDelete(\''.$muldel.'\'); return false;">'._UDDEIM_TRASHCHECKED.'</a></p>'; if ($config->ReadMessagesLifespanNote) echo "<p>"._UDDEIM_READ_INFO_1.$keephours1._UDDEIM_READ_INFO_2."</p>"; if ($config->UnreadMessagesLifespanNote) echo "<p>"._UDDEIM_UNREAD_INFO_1.$keephours2._UDDEIM_UNREAD_INFO_2."</p>"; if ($showinboxlimit_borderbottom) echo "<p>".$showinboxlimit_borderbottom."</p>"; echo "</div>\n"; //if ($config->enablefilter==2 || $config->enablefilter==3) // uddeIMprintFilter($myself, 'postboxuser', $totalpostbox, $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"; // echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', $showinboxlimit_borderbottom, $config)."</div>\n"; }
function uddeIMrssFeedPlugin($versionstring, $userid, $config) { $database = uddeIMgetDatabase(); $sitename = uddeIMgetSitename(); $live_site = uddeIMgetPath('live_site'); $Itemid = uddeIMmosGetParam( $_REQUEST, 'Itemid'); if (!$Itemid || !isset($Itemid) || empty( $Itemid )) { $Itemid = uddeIMgetItemid($config); } else if ($config->overwriteitemid) { $Itemid = (int)$config->useitemid; } $item_id = (int)$Itemid; $username = stripslashes( strval( uddeIMmosGetParam ($_REQUEST, 'user', '') )); $passwd = stripslashes( strval( uddeIMmosGetParam ($_REQUEST, 'pass', '') )); $showall = (int) uddeIMmosGetParam ($_REQUEST, 'showall', 0); $type = (int) uddeIMmosGetParam ($_REQUEST, 'type', 0); $row = uddeIMselectUserrecordFromUsername($username, $config); if ($row) { if ($row->block) { uddeIMrssOutputHeader($versionstring); uddeIMrssOutputItem($type, "Code=5", _UDDEIM_RSS_USERBLOCKED, ""); uddeIMrssOutputFooter(); return; } $gid = uddeIMgetGID($row->id); // $userid if (!$config->enablerss || ($config->enablerss==2 && !uddeIMisAdmin($gid) && !uddeIMisAdmin2($gid, $config))) { uddeIMrssOutputHeader($versionstring); uddeIMrssOutputItem($type, "Code=2", _UDDEIM_RSS_NOTALLOWED, ""); uddeIMrssOutputFooter(); return; } if ((strpos($row->password, ':') === false) && $row->password == md5($passwd)) { // Old password hash storage but authentic ... lets convert it $salt = uddeIMmosMakePassword(16); $crypt = md5($passwd.$salt); $row->password = $crypt.':'.$salt; } list($hash, $salt) = explode(':', $row->password); $hash_db = sha1($hash); // the hash value from the user database $hash_post = $passwd; if ($hash_db != $hash_post) { uddeIMrssOutputHeader($versionstring); uddeIMrssOutputItem($type, "Code=3", _UDDEIM_RSS_WRONGPASSWORD, ""); uddeIMrssOutputFooter(); return; } uddeIMrssOutputHeader($versionstring); $filter = ""; if (!$showall) { $filter = "AND a.toread=0 "; } $limit = ""; if ($config->rsslimit) $limit = " LIMIT ".(int)$config->rsslimit; $userid = uddeIMgetIDfromUsername($username, $config, true); $sql = "SELECT a.*, b.".($config->realnames ? "name" : "username")." AS fromname FROM #__uddeim AS a LEFT JOIN #__users AS b ON a.fromid=b.id WHERE a.toid=".(int)$userid." AND a.totrash=0 AND a.archived=0 AND `a`.`delayed`=0 ".$filter."ORDER BY a.datum DESC".$limit; $database->setQuery($sql); $rows = $database->loadObjectList(); if (!$rows) { $pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id); uddeIMrssOutputItem($type,($showall ? "Code=0" : "Code=1"), ($showall ? _UDDEIM_RSS_NOMESSAGES : _UDDEIM_RSS_NONEWMESSAGES), "", $pms_show); } else { foreach ($rows as $row) { $fromname = uddeIMevaluateUsername($row->fromname, $row->fromid, $row->publicname); if($row->systemmessage) $fromname = $row->systemmessage; if ($row->cryptmode==2) $pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id."&task=showpass&messageid=".$row->id); else $pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id."&task=show&messageid=".$row->id); $cm = uddeIMgetMessage($row->message, "", $row->cryptmode, "", $config->cryptkey); $cm = stripslashes($cm); if($row->systemflag || $config->allowbb) { $cm = uddeIMbbcode_strip($cm); } $cm = htmlspecialchars($cm, ENT_QUOTES, $config->charset); $cm = str_replace("&#", "&#", $cm); $title = $fromname.": ".substr($cm,0,30); $pubdate = date("r",$row->datum); $desc = substr($cm,0,500); uddeIMrssOutputItem(0, "", $title, $desc, $pms_show, $pubdate); } } uddeIMrssOutputFooter(); } else { uddeIMrssOutputHeader($versionstring); uddeIMrssOutputItem($type, "Code=4", _UDDEIM_RSS_NOOBJECT, ""); uddeIMrssOutputFooter(); } }
function uddeIMtoPublicSaveMessage($myself, $pmessage, $tobedeleted, $tobedeletedsent, $forceembedded, $item_id, $messageid, $copytome, $cryptpass, $backto, $config) { $mosConfig_sitename = uddeIMgetSitename(); $pathtosite = uddeIMgetPath('live_site'); $database = uddeIMgetDatabase(); $my_gid = $config->usergid; if($config->inboxlimit) { if ($config->allowarchive) { // have an archive and an "archive and inbox" limit, so get number of messages in 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 $total = uddeIMgetInboxCount($myself); } if($total>$config->maxarchive && !uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) { $mosmsg=_UDDEIM_MSGLIMITREACHED; uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id, $mosmsg); } } $lastsent = uddeIMgetEMNlastsent($myself); $flooding = 0; if ($config->timedelay>0) { if (uddeIMisReggedOnly($config->usergid)) { if ($lastsent) { $delay = uddetime($config->timezone) - $lastsent; if ($delay <= $config->timedelay) $flooding = 1; } } } if($flooding) { // write the uddeim menu uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", "", $pmessage, $messageid, 1, 14, 0, $config); // reply!!! echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } // select the message I write a reply to // I need the email address and the sender name of the public user (the message id is $messageid and I am $myself) // das war vorher... a.toid=b.id??? richtig sollte a.fromid=b.id sein, also selectInboxMessage nehmen // $sql = "SELECT a.*, b.".($config->realnames ? "name" : "username")." AS fromname FROM #__uddeim AS a LEFT JOIN #__users AS b ON a.toid=b.id WHERE a.toid=".(int)$myself." AND a.id=".(int)$messageid; $displaymessages = uddeIMselectInboxMessage($myself, $messageid, $config); if (count($displaymessages)<1) { echo _UDDEIM_MESSAGENOACCESS; return; } foreach($displaymessages as $displaymessage) { $var_toname = $displaymessage->publicname; $var_tomail = $displaymessage->publicemail; } if (!$var_toname || $var_toname==NULL) $var_toname = _UDDEIM_PUBLICUSER; if(!$pmessage) { // write the uddeim menu uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", "", $pmessage, $messageid, 1, 4, 0, $config); // reply!!! echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } // 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"; $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", "", $pmessage, $messageid, 1, 7, 0, $config); // reply!!! echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } if (!uddeIMcheckCSRF($config)) { uddeIMprintMenu($myself, 'new', $item_id, $config); echo "<div id='uddeim-m'>\n"; $pmessage=stripslashes($pmessage); uddeIMdrawWriteform($myself, $my_gid, $item_id, "", "", $pmessage, $messageid, 1, 15, 0, $config); // reply!!! echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; return; } $savedatum = uddetime($config->timezone); $savetoid = 0; // reveiver is a public user // 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 XSS code $savemessage = uddeIMRemoveXSS($savemessage); // 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=uddeIM_utf8_substr($config->languagecharset, $savemessage, 0, $config->maxlength); uddeIMemit("onSavePublicMessage", Array( "fromid" => $myself, "toid" => $savetoid, "replyid" => $replyid ) ); // we have all we need, now save it // CRYPT // maybe its an reply to a message from a public user $replyid = $messageid; $fromname=addslashes(strip_tags($var_toname)); $fromemail=addslashes(strip_tags($var_tomail)); if ($config->cryptmode==1) { $cm = uddeIMencrypt($savemessage,$config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (publicname, publicemail, fromid, toid, replyid, message, datum, totrash, totrashdate, toread, cryptmode, crypthash) VALUES ('".$fromname."', '".$fromemail."', ".(int)$myself.", ".(int)$savetoid.", ".(int)$replyid.", '".$cm."', ".$savedatum.",1,".$savedatum.",1,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 (publicname, publicemail, fromid, toid, replyid, message, datum, totrash, totrashdate, toread, cryptmode, crypthash) VALUES ('".$fromname."', '".$fromemail."', ".(int)$myself.", ".(int)$savetoid.", ".(int)$replyid.", '".$cm."', ".$savedatum.",1,".$savedatum.",1,".$themode.",'".md5($thepass)."')"; } elseif ($config->cryptmode==3) { $cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (publicname, publicemail, fromid, toid, replyid, message, datum, totrash, totrashdate, toread, cryptmode) VALUES ('".$fromname."', '".$fromemail."', ".(int)$myself.", ".(int)$savetoid.", ".(int)$replyid.", '".$cm."', ".$savedatum.",1,".$savedatum.",1,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 (publicname, publicemail, fromid, toid, replyid, message, datum, totrash, totrashdate, toread, cryptmode, crypthash) VALUES ('".$fromname."', '".$fromemail."', ".(int)$myself.", ".(int)$savetoid.", ".(int)$replyid.", '".$cm."', ".$savedatum.",1,".$savedatum.",1,".$themode.",'".md5($thepass)."')"; } else { $sql="INSERT INTO #__uddeim (publicname, publicemail, fromid, toid, replyid, message, datum, totrash, totrashdate, toread) VALUES ('".$fromname."', '".$fromemail."', ".(int)$myself.", ".(int)$savetoid.", ".(int)$replyid.", '".$savemessage."', ".$savedatum.",1,".$savedatum.",1)"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } $insID = $database->insertid(); // update lastsent field (record already exists since we check this at the very beginning of this component) uddeIMupdateEMNlastsent($myself, uddetime($config->timezone)); // copy to myself? if($copytome && $config->allowcopytome) { $temp = (($config->cryptmode>=1) ? $var_toname : addslashes($var_toname)); if ($config->allowbb) $copyheader="\n\n[i]("._UDDEIM_THISISACOPY.$temp.")[/i]"; else $copyheader="\n\n("._UDDEIM_THISISACOPY.$temp.")"; // also copy2me messages can be replies $replyid = $messageid; $savemessagecopy = $savemessage.$copyheader; $copyname = _UDDEIM_TO_SMALL." ".$temp; // "to username" in systemmsg // if($config->allowarchive) { $archiveflag=1; } // it is a copy to myself, 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 if ($config->cryptmode==1) { $cm = uddeIMencrypt($savemessagecopy,$config->cryptkey,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, replyid, toread, message, datum, disablereply, systemflag, systemmessage, archived, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$myself.", ".(int)$myself.", ".(int)$replyid.", 1, '".$cm."', ".$savedatum.", 1, 2, '".$copyname."', 0, 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($savemessagecopy,$thepass,CRYPT_MODE_BASE64); $sql="INSERT INTO #__uddeim (fromid, toid, replyid, toread, message, datum, disablereply, systemflag, systemmessage, archived, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$myself.", ".(int)$myself.", ".(int)$replyid.", 1, '".$cm. "', ".$savedatum.", 1, 2, '".$copyname."', 0, 1,".$savedatum.",".$themode.",'".md5($thepass)."')"; } elseif ($config->cryptmode==3) { $cm = uddeIMencrypt($savemessagecopy,"",CRYPT_MODE_STOREBASE64); $sql="INSERT INTO #__uddeim (fromid, toid, replyid, toread, message, datum, disablereply, systemflag, systemmessage, archived, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$myself.", ".(int)$myself.", ".(int)$replyid.", 1, '".$cm."', ".$savedatum.", 1, 2, '".$copyname."', 0, 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($savemessagecopy,$thepass,$cipher); $sql="INSERT INTO #__uddeim (fromid, toid, replyid, toread, message, datum, disablereply, systemflag, systemmessage, archived, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$myself.", ".(int)$myself.", ".(int)$replyid.", 1, '".$cm. "', ".$savedatum.", 1, 2, '".$copyname."', 0, 1,".$savedatum.",".$themode.",'".md5($thepass)."')"; } else { $sql="INSERT INTO #__uddeim (fromid, toid, replyid, toread, message, datum, disablereply, systemflag, systemmessage, archived, totrashoutbox, totrashdateoutbox) VALUES (".(int)$myself.", ".(int)$myself.", ".(int)$replyid.", 1, '".$savemessagecopy."', ".$savedatum.", 1, 2, '".$copyname."', 0, 1,".$savedatum.")"; } $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to save a message" . $database->stderr(true)); } } // send notification (message) to public user // check if we have an email address // uddeIMdispatchEMN(msgid, $myself, 0, $savemessage, 0, $config); // if e-mail traffic stopped, don't send. if($config->emailtrafficenabled && $var_tomail) { $var_fromname = uddeIMgetNameFromID($myself, $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("%you%", $var_toname, $var_body); $var_body = str_replace("%site%", $mosConfig_sitename, $var_body); $var_body = str_replace("%user%", $var_fromname, $var_body); $var_body = str_replace("%pmessage%", $savemessage, $var_body); $subject = _UDDEIM_EMN_SUBJECT; $subject = str_replace("%livesite%", $pathtosite, $subject); $subject = str_replace("%site%", $mosConfig_sitename, $subject); $subject = str_replace("%you%", $var_toname, $subject); $subject = str_replace("%user%", $var_fromname, $subject); $replyto = $var_tomail; $replytoname = ""; if(uddeIMsendmail($config->emn_sendername, $config->emn_sendermail, $var_toname, $var_tomail, $subject, $var_body, $replyto, $replytoname, "", $config)) { // maybe a code here that the email cound not have been sent } } if ($tobedeletedsent) { $deletetime=uddetime($config->timezone); uddeIMdeleteMessageFromOutbox($myself, $insID, $deletetime); } // delete the original message? if ($tobedeleted) { $deletetime=uddetime($config->timezone); uddeIMdeleteMessageFromInbox($myself, $messageid, $deletetime); } if($messageid) { $mosmsg=_UDDEIM_MESSAGE_REPLIEDTO; } else { $mosmsg=_UDDEIM_MESSAGE_SENT; } if ($tobedeleted) { $mosmsg.=_UDDEIM_MOVEDTOTRASH; } if($backto) { uddeIMmosRedirect($backto, $mosmsg); } uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id, $mosmsg); }
function uddeIMshowOutbox($myself, $item_id, $limit, $limitstart, $cryptpass, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode) { global $uddeicons_onlinepic, $uddeicons_offlinepic, $uddeicons_readpic, $uddeicons_unreadpic, $uddeicons_delayedpic; $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=outbox&sort_mode=0&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; $sort_name = " <a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=outbox&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=outbox&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=outbox&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=outbox&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=outbox&sort_mode=2&Itemid=".$item_id.$addlink)."'>". $temppic ."</a>"; break; } } // how many messages total? $total = uddeIMgetOutboxCount($myself, $filter_user, $filter_unread, $filter_flagged); // now load messages as required if(!$limitstart) $limitstart=0; if(!$limit) $limit=$config->perpage; if ($limitstart>=$total) $limitstart=max(0,$limitstart - $limit); $allmessages = uddeIMselectOutbox($myself, $limitstart, $limit, $config, $filter_user, $filter_unread, $filter_flagged, $sort_mode); // write the uddeim menu uddeIMprintMenu($myself, 'outbox', $item_id, $config); echo "<div id='uddeim-m'>\n"; if ($config->enablefilter==1 || $config->enablefilter==3) uddeIMprintFilter($myself, 'outbox', $total, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); // if no messages: if(count($allmessages)<1) { // no messages to list uddeIMshowNoMessage('outbox', $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=outboxfork&Itemid=".$item_id)."'>"; // now open the inbox container and table; write table headings echo "<div id='uddeim-overview'><table cellpadding='7' width='100%'>\n"; // checkcell $delall="<input type='checkbox' name='arcmes[]' value='' onclick='wiglwogl(this);' title='"._UDDEIM_CHECKALL."' />"; echo "<tr><th style='text-align:center;' class='sectiontableheader'>".$delall."</th><th class='sectiontableheader'> </th><th class='sectiontableheader'>"._UDDEIM_TO.$sort_name."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DATE.$sort_datum."</th><th class='sectiontableheader'> </th></tr>\n"; $i = 1; // now write the list foreach($allmessages as $themessage) { $toname = uddeIMevaluateUsername($themessage->toname, $themessage->toid, $themessage->publicname); // show links ??? $tocell = $toname; if ($config->showcblink && $themessage->toname) { $tocell = uddeIMshowThumbOrLink($themessage->toid, $toname, $config); } // is this user currently online? if ($config->showonline && $themessage->toname) { $isonline = uddeIMisOnline($themessage->toid); if($isonline) $tocell.=" ".$uddeicons_onlinepic; else $tocell.=" ".$uddeicons_offlinepic; } if ($themessage->delayed) { $readcell=$uddeicons_delayedpic; } else { 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=showoutpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; } else { // normal message $messagecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showout&Itemid=".$item_id."&messageid=".$themessage->id)."'>".$teasermessage."</a>"; } $datumcell=uddeDate($themessage->datum, $config, uddeIMgetUserTZ()); $fwdcell=""; if ($config->actionicons) { 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=forwardoutboxpass&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=forwardoutbox&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 />"; } } $sbsdeletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletefromoutbox&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>"; } else { 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=forwardoutboxpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } else { // normal message $fwdcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=forwardoutbox&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_FORWARDLINK."</a><br />"; } } $sbsdeletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletefromoutbox&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart."&messageid=".$themessage->id)."'>"._UDDEIM_DELETELINK."</a>"; } // checkcell $delcell="<input type='checkbox' name='arcmes[]' value='".$themessage->id."' />"; if(!$themessage->toread) { // if not read then a recall is possible if($config->actionicons) { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/restore.gif' alt='"._UDDEIM_RECALL."' title='"._UDDEIM_RECALL."' /></a><br />"; } else { // normal message $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$themessage->id)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/restore.gif' alt='"._UDDEIM_RECALL."' title='"._UDDEIM_RECALL."' /></a><br />"; } } else { if ($themessage->cryptmode==2 || $themessage->cryptmode==4) { // Message is encrypted, so go to enter password page $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recallpass&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_RECALL."</a><br />"; } else { // normal message $recallcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=recall&Itemid=".$item_id."&messageid=".$themessage->id)."'>"._UDDEIM_RECALL."</a><br />"; } } } else { $recallcell=""; } echo "<tr class='sectiontableentry".$i."'>"; // checkcell echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$delcell."</td>"; echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$readcell."</td>"; $st=uddeIMgetStyleForThumb($config); echo "<td ".$st.">".$tocell."</td>"; echo "<td>".$messagecell."</td>"; echo "<td>".$datumcell."</td>"; if($config->actionicons) { echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$fwdcell.$recallcell.$sbsdeletecell."</td>"; } else { echo "<td class='pathway'>".$fwdcell.$recallcell.$sbsdeletecell."</td>"; } echo "</tr>\n"; $i++; if ($i>2) { $i=1; } } $muldel = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=outboxmuldelete&Itemid=".$item_id."&limitstart=0&limit=".$limit); if ($config->bottomlineicons) { echo "<tr><th style='text-align:center;' class='sectiontablefooter'>"; echo '<a href="#" onclick="outboxDelete(\''.$muldel.'\'); 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><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($total, $limitstart, $limit); $referlink = "index.php?option=com_uddeim&task=outbox&Itemid=".$item_id.$addlink.$addlink2; if($total>$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=outbox&Itemid=".$item_id."&limitstart=0&limit=".$total.$addlink.$addlink2)."'>"._UDDEIM_SHOWALL."</a>]"; echo "</div>\n"; } echo "<div id='uddeim-bottomlines'>"; if (!$config->bottomlineicons) echo '<p><a href="#" onclick="outboxDelete(\''.$muldel.'\'); return false;">'._UDDEIM_TRASHCHECKED.'</a></p>'; // outbox warning $keephours=($config->SentMessagesLifespan) * 1; // this are days echo "<p>"._UDDEIM_OUTBOX_WARNING."</p>"; if ($config->SentMessagesLifespanNote) echo "<p>"._UDDEIM_SENT_INFO_1.$keephours._UDDEIM_SENT_INFO_2."</p>"; echo "</div>\n"; if ($config->enablefilter==2 || $config->enablefilter==3) uddeIMprintFilter($myself, 'outbox', $total, $item_id, $config, $filter_user, $filter_unread, $filter_flagged); echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n"; }
function _sendPMSuddeimMSG($udde_toid, $udde_fromid, $to, $from, $sub, $msg) { global $_CB_database, $_CB_framework; $params = $this->params; $pmsType = $params->get('pmsType', '1'); $udde_sysm = "System"; $config_realnames = "0"; $config_cryptmode = 0; $config_cryptkey = 'uddeIMcryptkey'; if ($pmsType == 4) { // uddeIM 1.0+ require_once $_CB_framework->getCfg('absolute_path') . "/components/com_uddeim/crypt.class.php"; if (file_exists($_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/config.class.php")) { include_once $_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/config.class.php"; } $this->uddeconfig = $config = new uddeimconfigclass(); if (isset($config->sysm_username)) { $udde_sysm = $config->sysm_username; } if (isset($config->realnames)) { $config_realnames = $config->realnames; } if (isset($config->cryptmode)) { $config_cryptmode = $config->cryptmode; } if (file_exists($_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/uddeim_crypt.php")) { require_once $_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/uddeim_crypt.php"; } if (isset($config->cryptkey)) { $config_cryptkey = $config->cryptkey; } } else { if (file_exists($_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/uddeim_config.php")) { include_once $_CB_framework->getCfg('absolute_path') . "/administrator/components/com_uddeim/uddeim_config.php"; } if (isset($config_sysm_username)) { $udde_sysm = $config_sysm_username; } } // format the message if ($sub) { // is actually impossible $udde_msg = "[b]" . $sub . "[/b]\n\n" . $msg; } else { $udde_msg = $msg; } // strip any bb code that might be present, but only in 0.4 if ($pmsType == 3) { require_once $_CB_framework->getCfg('absolute_path') . '/components/com_uddeim/bbparser.php'; if (function_exists('bbcode_strip')) { $udde_msg = bbcode_strip($udde_msg); } elseif (function_exists('uddeIMbbcode_strip')) { $udde_msg = uddeIMbbcode_strip($udde_msg); } } // now strip the remaining html tags $udde_msg = strip_tags($udde_msg); // escape dangerous stuff // not necessary, already escaped before this internal function gets called // get current time but recognize time offset $currentTime = time(); $udde_time = $this->_pmsUddeGetTime($currentTime); // set the udde systemmessage username to the virtual sender $udde_sysm = $from; if ($config_cryptmode == 1) { if (function_exists('uddeIMencrypt')) { // this added for uddeIM 1.4+ $cm = uddeIMencrypt($udde_msg, $config_cryptkey, CRYPT_MODE_BASE64); } else { $cm = Encrypt($udde_msg, $config_cryptkey, CRYPT_MODE_BASE64); } $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum, cryptmode, crypthash) VALUES (" . $udde_fromid . ", " . $udde_toid . ", '" . $cm . "', " . $udde_time . ",1,'" . md5($config_cryptkey) . "')"; } else { $sql = "INSERT INTO #__uddeim (fromid, toid, message, datum) VALUES (" . $udde_fromid . ", " . $udde_toid . ", '" . $udde_msg . "', " . $udde_time . ")"; } // now insert the message if ($udde_fromid && $udde_toid) { $_CB_database->SetQuery($sql); if (!$_CB_database->query()) { die("SQL error" . $_CB_database->stderr(true)); } } $udde_msgid = $_CB_database->insertid(); // E-Mail notification code $udde_sysm = ""; $this->_pmsUddeNotify($udde_msgid, $udde_fromid, $udde_toid, $udde_msg, $udde_sysm); }