function uddeIMsaveAutoforward($option, $task, $act, $config) { $database = uddeIMgetDatabase(); $emnid = intval( uddeIMmosGetParam( $_POST, 'id', '' ) ); $autoforwardcheck = (int)uddeIMmosGetParam ($_POST, 'autoforwardcheck', 0); $autoforwardid = intval( uddeIMmosGetParam ($_POST, 'autoforwardid', '') ); $autoforward = 0; if ($autoforwardcheck) $autoforward=1; $sql="UPDATE #__uddeim_emn SET autoforward=".(int)$autoforward." WHERE id=".(int)$emnid; $database->setQuery($sql); if (!$database->query()) { die("SQL error" . $database->stderr(true)); } if ($autoforward>0) { $sql="UPDATE #__uddeim_emn SET autoforwardid=".(int)$autoforwardid." WHERE id=".(int)$emnid; $database->setQuery($sql); if (!$database->query()) { die("SQL error" . $database->stderr(true)); } } $redirecturl = uddeIMredirectIndex()."?option=$option&task=usersettings"; uddeIMmosRedirect($redirecturl); }
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 uddeIMremoveReportSPAM($option, $task, $uddeid, $config) { $database = uddeIMgetDatabase(); if (count($uddeid)) { if ($task=='spamremove') { foreach($uddeid AS $id) { uddeIMdeleteOneReportSPAM($option, $task, 'delete', (int)$id, $config); } } if ($task=='reportremove') { foreach($uddeid AS $id) { uddeIMdeleteOneReportSPAM($option, $task, 'remove', (int)$id, $config); } } } $redirecturl = uddeIMredirectIndex()."?option=$option&task=spamcontrol"; uddeIMmosRedirect($redirecturl); }
function uddeIMremoveMessage($option, $task, $uddeid, $config) { $database = uddeIMgetDatabase(); if (count($uddeid)) { if ($task=='messageremove') { foreach($uddeid AS $id) { uddeIMdeleteOnemessage($option, $task, 'delete', (int)$id, $config); } } if ($task=='messagedeliver') { foreach($uddeid AS $id) { uddeIMdeleteOnemessage($option, $task, 'deliver', (int)$id, $config); } } } $redirecturl = uddeIMredirectIndex()."?option=$option&task=mcp"; uddeIMmosRedirect($redirecturl); }
function uddeIMarchivetoTrash($option, $task, $act, $config) { $database = uddeIMgetDatabase(); if($act=="inbox") { $rightnow=uddetime($config->timezone); $sql="UPDATE #__uddeim SET archived=0 WHERE archived=1"; $database->setQuery($sql); if (!$database->query()) { die("SQL error when attempting to unarchive messages" . $database->stderr(true)); } $mosmsg = _UDDEADM_ARCHIVETOTRASH_INBOX_DONE; $redirecturl = uddeIMredirectIndex()."?option=com_uddeim"; uddeIMmosRedirect($redirecturl, $mosmsg); } else { // <h4><img align=middle style="display: inline;" src="images/inbox.png" /> echo _UDDEADM_SETTINGS; </h4> ?> <table cellpadding="4" cellspacing="0" border="0" width="100%"> <tr> <td width="100%" class="sectionname"> <h4><?php echo _UDDEADM_SETTINGS; ?></h4> </td> </tr> </table> <table width="100%" border="0" cellpadding="4" cellspacing="2" class="adminForm" id="adminForm"> <tr align="center" valign="middle"> <td align="left" valign="top"> <?php echo "<p><b>"._UDDEADM_ARCHIVETOTRASH_INTRO."</b></p>"; echo "<p>"; echo "<a href='".uddeIMredirectIndex()."?option=com_uddeim&task=archivetotrash&act=inbox'>"._UDDEADM_ARCHIVETOTRASH_INBOX_LINK."</a><br />"._UDDEADM_ARCHIVETOTRASH_INBOX_EXP; echo "</p>"; echo "<p>"; echo "<a href='".uddeIMredirectIndex()."?option=com_uddeim'>"._UDDEADM_ARCHIVETOTRASH_LEAVE_LINK."</a><br />"._UDDEADM_ARCHIVETOTRASH_LEAVE_EXP; echo "</p>"; ?> </td> </tr> </table> <?php } }