Пример #1
0
function uddeIMrestoreMessage($myself, $messageid, $limit, $limitstart, $item_id, $config) {
	$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 {
		$mosmsg=_UDDEADM_NOTRASHACCESS_NOT;
		uddeJSEFredirect("HTTP_REFERER", $mosmsg, "trashcan");
	}

	// to do: show error message when trying to restore message that has been purged or is no longer available
	$exists = uddeIMexistsMessage($messageid);
	if (!$exists) {
		$mosmsg = _UDDEIM_CANTRESTORE;
		uddeJSEFredirect("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart, $mosmsg);
		return;
	}

	$total = uddeIMgetArchiveCount($myself);
	if ($config->inboxlimit && $config->allowarchive) {		// inbox + archive
		$total = uddeIMgetInboxArchiveCount($myself);
	}
	if ($total >= $config->maxarchive && !uddeIMisAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) {
//		echo "<p>"._UDDEIM_ARC_SAVED_1.$total._UDDEIM_ARC_SAVED_2."</p>\n";
//		echo "<p>"._UDDEIM_ARC_SAVED_3."</p>\n";
		$mosmsg = _UDDEIM_LIMITREACHED;
		uddeJSEFredirect("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart, $mosmsg);
	}

	// WAS: check if the deleted message was in the archive,  but the archive in not longer enabled, so deny access to the message
	// NOW: check if the deleted message was in the archive,  but the archive in not longer enabled, so unarchive message
	$isarchived = uddeIMgetArchivedFromTrashedMessage($myself, $messageid);
	if(!$config->allowarchive && $isarchived) {
		uddeIMupdateArchived($messageid, 0);
	}

	uddeIMrestoreMessageToInboxOutboxArchive($myself, $messageid);
	uddeJSEFredirect("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart);
}
Пример #2
0
function uddeIMdeleteListsMultiple($myself, $item_id, $arcmes, $limit, $limitstart, $config) {
	$my_gid = $config->usergid;
	$lg = 0;
	if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))
		$lg = true;

	$n = count($arcmes);
	if (!$n) {
		echo _UDDEIM_NOLISTSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>";
		return;
	}
	for ($i = 0; $i <= ($n-1); $i++) {
		if ($arcmes[$i]>0) {
			uddeIMpurgeUserlist($myself, $arcmes[$i], $lg);
		}
	}
	uddeJSEFredirect("index.php?option=com_uddeim&task=showlists&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart);
}
Пример #3
0
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>&nbsp;</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);
}
Пример #4
0
function uddeIMmarkFlagged($myself, $messageid, $limit, $limitstart, $item_id, $recip, $ret, $config) {
	$addlink = "";
	if ($recip)
		$addlink = "&recip=".(int)$recip;

	$task="inbox";
	if ($ret=="postboxuser" && $config->enablepostbox)
		$task = "postboxuser";
	if($ret=='archive' && $config->allowarchive)
		$task = "archive";

	uddeIMupdateFlagged($myself, $messageid, 1);
	if(!$limit && !$limitstart) {
		$redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id.$addlink;
	} else {
		$redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id.$addlink."&limit=".$limit."&limitstart=".$limitstart;
	}
	uddeJSEFredirect($redirecturl);
}
Пример #5
0
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);
}
Пример #6
0
function uddeIMdeleteInbox($myself, $item_id, $arcmes, $limit, $limitstart, $config) {
	$n = count($arcmes);
	if (!$n) {
		echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>";
		return;
	}
	for ($i = 0; $i <= ($n-1); $i++) {
		$rightnow=uddetime($config->timezone);
		if ($arcmes[$i]>0) {
			// uddeIMupdateToread($myself, $arcmes[$i], 1);
			uddeIMdeleteMessageFromInbox($myself, $arcmes[$i], $rightnow);
			// when it is a message from me to me and I trash the message then also trash the message from the outbox
//			$sql="UPDATE #__uddeim SET totrashoutbox=1, totrashdateoutbox=".$rightnow." WHERE toid=fromid AND toid=".(int)$myself." AND id=".(int)$arcmes[$i];
//			$___atabase->setQuery($sql);
//			if (!$___atabase->query()) {
//				die("SQL error when attempting to trash a message" . $___atabase->stderr(true));
//			}
		}
	}
	uddeJSEFredirect("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart);
}
Пример #7
0
function uddeIMdeleteMessagePostboxMultiple($myself, $userid, $arcmes, $limit, $limitstart, $item_id, $config) {
	$n = count($arcmes);
	if (!$n) {
		echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>";
		return;
	}

	for ($i = 0; $i <= ($n-1); $i++) {
		$deletetime=uddetime($config->timezone);
		if ($arcmes[$i]>0) {
			$allmessages = uddeIMselectMessage($myself, $arcmes[$i], $config, $trashed=-1);
			foreach($allmessages as $themessage) {
				if ($myself==$themessage->toid && $myself!=$themessage->fromid) {
					uddeIMupdateToread($myself, $themessage->id, 1);
					uddeIMdeleteMessageFromInbox($myself, $themessage->id, $deletetime);
				} elseif ($myself==$themessage->fromid && $myself!=$themessage->toid) {
					uddeIMdeleteMessageFromOutbox($myself, $themessage->id, $deletetime);
				} else {	// this case appears when a copy to me message has been trashed my myself
					uddeIMupdateToread($myself, $themessage->id, 1);
					uddeIMdeleteMessageFromInbox($myself, $themessage->id, $deletetime);
				}
			}
		}
	}
	uddeJSEFredirect("index.php?option=com_uddeim&task=postboxuser&Itemid=".$item_id."&recip=".$userid."&limit=".$limit."&limitstart=".$limitstart);
}
Пример #8
0
function uddeIMunreportSpam($myself, $item_id, $messageid, $recip, $ret, $limit, $limitstart, $config) {
	uddeIMdeleteReport($myself, $messageid);

	$addlink = "";
	if ($recip)
		$addlink = "&recip=".(int)$recip;
	
	$task = "inbox";
	if ($ret=="postboxuser")
		$task = "postboxuser";

	if(!$limit && !$limitstart) {
		$redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id.$addlink;
	} else {
		$redirecturl="index.php?option=com_uddeim&task=".$task."&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart.$addlink;
	}
	uddeJSEFredirect($redirecturl);
}
Пример #9
0
function uddeIMrecallMessage($myself, $item_id, $messageid, $cryptpass, $config) {
	// this function has three parts
	// first, read the message
	// second, delete the message from the db (complete erase)
	// third, display values for editing

	$my_gid = $config->usergid;

	$displaymessages = uddeIMselectOutboxMessageIfUnread($myself, $messageid, $config);
	if(count($displaymessages)<1) {
		$mosmsg = _UDDEIM_COULDNOTRECALL;
		uddeJSEFredirect("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id, $mosmsg);
	}

	$recipname = "";
	$recalled_message = "";
	foreach($displaymessages as $themessage) {

		// recalling a message to a public user makes no sense since it has been sent anyway
		if ( uddeIMisPublicUser($themessage->toname,$themessage->toid) ) {
			$mosmsg = _UDDEIM_COULDNOTRECALLPUBLIC;
			uddeJSEFredirect("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id, $mosmsg);
		}

		// CRYPT
		$recalled_message = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->crypthash, $config->cryptkey);
		$recalled_message = stripslashes($recalled_message);
		$recipname 		  = uddeIMgetNameFromID($themessage->toid, $config);
	}

	// write the uddeim menu
	uddeIMprintMenu($myself, 'new', $item_id, $config);
	echo "<div id='uddeim-m'>\n";
	// delete it from db (after writing the form since I need the message for a query inside of uddeIMdrawWriteform)
	uddeIMpurgeMessageFromUser($myself, $messageid);

	echo "<div id='uddeim-toplines'><p>"._UDDEIM_RECALLEDMESSAGE_INFO."</p></div>\n";
	uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $recipname, $recalled_message, 0, 0, 0, 0, $config);	// allow to select a recipient
	echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n";
}