Example #1
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);
}
Example #2
0
	function sendNewMessage($fromid, $toid, $message, $sendnotification=0, $updatelastsent=0) {

		if ($this->config->cryptmode>=1)
			$savemessage = strip_tags($message);
		else
			$savemessage = addslashes(strip_tags($message));

		$date  = uddetime($this->config->timezone);
		$replyid = 0;
		$cryptmode = $this->config->cryptmode;
		$insID = uddeIMsaveRAWmessage($fromid, $toid, $replyid, $savemessage, $date, $this->config, $cryptmode);

		if ($updatelastsent) {
			if (!uddeIMexistsEMN((int)$fromid))
				uddeIMinsertEMNdefaults((int)$fromid, $this->config);
			uddeIMupdateEMNlastsent($fromid, $date);
		}

		if ($sendnotification) {
			// 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 ($this->config->notifydefault>0 || $this->config->popupdefault>0 || $this->config->pubfrontenddefault>0 || $this->config->autoresponder>0 || $this->config->autoforward>0) {
				if (!uddeIMexistsEMN($toid))
					uddeIMinsertEMNdefaults($toid, $this->config);
			}
		}

		// get the group ID of the recipient
		$gid = uddeIMgetGID((int)$toid);

		// ##################################################################################################
		// autoforward code
		// ##################################################################################################
		if ($this->config->autoforward==1 || 
		   ($this->config->autoforward==2 && (uddeIMisAdmin($gid)   || uddeIMisAdmin2($gid, $this->config))) ||
		   ($this->config->autoforward==3 && (uddeIMisSpecial($gid) || uddeIMisSpecial2($my_gid, $this->config))) ) {
			$ison = uddeIMgetEMNautoforward($toid);						// recipient has autoforward enabled
			if ($ison==1) {
				$autoforwardid = uddeIMgetEMNautoforwardid($toid);	// new recipient

				if (uddeIMgetUserExists($autoforwardid)) {
					if (!uddeIMgetUserBlock($autoforwardid)) {
						$temp = uddeIMgetNameFromID($toid, $this->config);
						$temp = (($this->config->cryptmode>=1) ? $temp : addslashes($temp));
						if ($this->config->allowbb)
							$forwardheader="\n\n[i]("._UDDEIM_THISISAFORWARD.$temp.")[/i]";
						else
							$forwardheader="\n\n("._UDDEIM_THISISAFORWARD.$temp.")";
						$savemessagecopy = $savemessage.$forwardheader;
						$insIDforward = uddeIMsaveRAWmessage($fromid, $autoforwardid, 0, $savemessagecopy, $date, $this->config, $this->config->cryptmode, "");
					}
				}
			}
		}

		// ##################################################################################################
		// copy to myself?
		// ##################################################################################################

		// nothing to do

		// ##################################################################################################
		// autoresponder
		// ##################################################################################################

		// nothing to do

		// ##################################################################################################
		// email notification
		// ##################################################################################################

		if ($sendnotification) {
			$currentlyonline = uddeIMisOnline($toid);

			if ($this->config->cryptmode>=1) {
				$email = stripslashes($savemessage);
			} else {
				$email = stripslashes(stripslashes($savemessage));
			}
			
			if($this->config->allowemailnotify==1) {
				$ison = uddeIMgetEMNstatus($toid);
				if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) {
					uddeIMdispatchEMN($insID, $item_id, $cryptmode, $fromid, $toid, $email, 0, $this->config);
				}
			} elseif($this->config->allowemailnotify==2) {
				if (uddeIMisAdmin($gid) || uddeIMisAdmin2($gid, $this->config)) {
					$ison = uddeIMgetEMNstatus($toid);
					if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10  || ($ison==20 && !$currentlyonline)) {
						uddeIMdispatchEMN($insID, $item_id, $cryptmode, $fromid, $toid, $email, 0, $this->config);
					}
				}
			}
		}
		return $insID;
	}
Example #3
0
function uddeIMshowSettings($myself, $item_id, $config) {
	// write the uddeim menu
	uddeIMprintMenu($myself, 'settings', $item_id, $config);
	echo "<div id='uddeim-m'>\n";

	$emptysettings = _UDDEIM_NOSETTINGS;

	$my_gid = $config->usergid;

	if ($config->blocksystem) {
		$emptysettings='';
		$blockedusers = uddeIMselectBlockerBlockedList($myself, $config);
		$howmanyblocks=count($blockedusers);

		echo "<div class='uddeim-set-block'>\n";
		echo "<h4>"._UDDEIM_BLOCKSYSTEM."</h4>\n";
		if ($howmanyblocks) {
			echo "<p>"._UDDEIM_BLOCKS_EXP."</p>\n";
			echo "<p>"._UDDEIM_YOUBLOCKED_PRE.$howmanyblocks._UDDEIM_YOUBLOCKED_POST."</p>\n";
			echo "<div id='uddeim-overview'>";
			foreach($blockedusers as $blockeduser) {
				if ($blockeduser->displayname)
					echo uddeIMgetLinkOnly($blockeduser->blocked, "<b>".$blockeduser->displayname."</b>", $config);
				else
					echo _UDDEADM_NONEORUNKNOWN;
				echo "&nbsp;&nbsp;";
				echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=unblockuser&Itemid=".$item_id."&recip=".$blockeduser->blocked)."'>"._UDDEIM_UNBLOCKNOW."</a><br />";
			}
			echo "</div>\n";
			if ($config->blockalert) {
				echo "<p>"._UDDEIM_BLOCKALERT_EXP_ON."</p>\n";
			} else {
				echo "<p>"._UDDEIM_BLOCKALERT_EXP_OFF."</p>\n";
			}
		} else {
			echo "<p>"._UDDEIM_NOBODYBLOCKED."</p>\n";
		}
		echo "</div>";
	}

	if ($config->allowemailnotify==1 || 
	   ($config->allowemailnotify==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)))) {

		$emptysettings='';
		$emn_notonreply_checkstatus='';
		$emn_always_checkstatus='';
		$emn_whenoffline_checkstatus='';
		$emn_none_checkstatus='';

		$ison = uddeIMgetEMNstatus($myself);
		if ($ison==0) {
			$emn_none_checkstatus='checked="checked"';
		} elseif ($ison==1 || $ison==10) {
			$emn_always_checkstatus='checked="checked"';
		} elseif ($ison==2 || $ison==20) {
			$emn_whenoffline_checkstatus='checked="checked"';
		}
		if ($ison==10 || $ison==20) {
			$emn_notonreply_checkstatus='checked="checked"';
		}
		echo "<div class='uddeim-set-block'>";  // was uddeim-set-emn
		echo "<h4>"._UDDEIM_EMN."</h4>";
		echo "<p>"._UDDEIM_EMN_EXP."</p>";
		echo "<form name='emnform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=saveemn&Itemid=".$item_id)."'>";
		echo '<input type="radio" '.$emn_always_checkstatus.		' name="emailradio" value="1" onclick="document.emnform.emailreplycheck.disabled=false;" />'._UDDEIM_EMN_ALWAYS.'<br />';
		echo '<input type="radio" '.$emn_whenoffline_checkstatus.	' name="emailradio" value="2" onclick="document.emnform.emailreplycheck.disabled=false;" />'._UDDEIM_EMN_WHENOFFLINE.'<br />';
		echo '<input type="radio" '.$emn_none_checkstatus.			' name="emailradio" value="0" onclick="document.emnform.emailreplycheck.disabled=true; document.emnform.emailreplycheck.checked=false;" />'._UDDEIM_EMN_NONE.'<br />';
		if ($emn_none_checkstatus) {
			echo '<input type="checkbox" '.$emn_notonreply_checkstatus.' value="1" name="emailreplycheck" disabled="disabled" />'._UDDEIM_EMN_NOTONREPLY.'<br />';
		} else {
			echo '<input type="checkbox" '.$emn_notonreply_checkstatus.' value="1" name="emailreplycheck" />'._UDDEIM_EMN_NOTONREPLY.'<br />';
		}
		echo '<input type="submit" name="reply" class="button" value="'._UDDEIM_SAVECHANGE.'" />';
		echo "</form>";
		echo "</div>";
	}

	if ($config->autoresponder==1 || 
	   ($config->autoresponder==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)))) {
		$emptysettings='';

		$emn_responder_checkstatus='';
		$ison = uddeIMgetEMNautoresponder($myself);
		if ($ison==1) {
			$emn_responder_checkstatus='checked="checked"';
		}
		$autorespondertext = uddeIMgetEMNautorespondertext($myself);
		if (!$autorespondertext) {
			$autorespondertext = _UDDEIM_AUTORESPONDER_DEFAULT;
		}
		if ($config->maxlength>0)		// because if 0 do not use any maxlength
			$autorespondertext = uddeIM_utf8_substr($config->languagecharset, $autorespondertext, 0, $config->maxlength);
		echo "<div class='uddeim-set-block'>";  // was uddeim-set-emn
		echo "<h4>"._UDDEIM_AUTORESPONDER."</h4>";
		echo "<p>"._UDDEIM_AUTORESPONDER_EXP."</p>";
		echo "<form name='emnrespform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=saveresponderemn&Itemid=".$item_id)."'>";
		echo '<input onclick="document.emnrespform.autorespondercheck.checked ? document.emnrespform.autorespondertext.disabled=false : document.emnrespform.autorespondertext.disabled=true;" type="checkbox" '.$emn_responder_checkstatus.' value="1" name="autorespondercheck" />'._UDDEIM_EMN_AUTORESPONDER.'<br />';
		echo "<textarea name='autorespondertext' class='inputbox' rows='4' cols='60'".($ison==1 ? '' : 'disabled="disabled"').">".htmlentities($autorespondertext,ENT_QUOTES, $config->charset)."</textarea><br />";
		echo '<input type="submit" name="reply" class="button" value="'._UDDEIM_SAVECHANGE.'" />';
		echo "</form>";
		echo "</div>";
	}

	if ($config->autoforward==1 || 
	   ($config->autoforward==2 && (uddeIMisAdmin($my_gid)   || uddeIMisAdmin2($my_gid, $config))) ||
	   ($config->autoforward==3 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) ) {
		$emptysettings='';

		$emn_forward_checkstatus='';
		$ison = uddeIMgetEMNautoforward($myself);
		if ($ison==1) {
			$emn_forward_checkstatus='checked="checked"';
		}
		$autoforwardid = uddeIMgetEMNautoforwardid($myself);

		echo "<div class='uddeim-set-block'>";  // was uddeim-set-emn
		echo "<h4>"._UDDEIM_AUTOFORWARD."</h4>";
		echo "<p>"._UDDEIM_AUTOFORWARD_EXP."</p>";
		echo "<form name='emnfwdform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=saveforwardemn&Itemid=".$item_id)."'>";
		echo '<input onclick="document.emnfwdform.autoforwardcheck.checked ? document.emnfwdform.autoforwardid.disabled=false : document.emnfwdform.autoforwardid.disabled=true;" type="checkbox" '.$emn_forward_checkstatus.' value="1" name="autoforwardcheck" />'._UDDEIM_EMN_AUTOFORWARD.'<br />';
		uddeIMdoShowAllUsers($myself, $my_gid, $config, 2, $ison, $autoforwardid);
//		echo "<textarea name='autoforwardid' class='inputbox' rows='1' cols='10'".($ison==1 ? '' : 'disabled="disabled"').">".htmlentities($autoforwardid,ENT_QUOTES, $config->charset)."</textarea><br />";
		echo "<br />";
		echo '<input type="submit" name="reply" class="button" value="'._UDDEIM_SAVECHANGE.'" />';
		echo "</form>";
		echo "</div>";
	}

	if ($config->allowpopup || ($config->pubfrontend && !uddeIMisRecipientBlockedPublic($myself, $config)) ) {

		$emptysettings='';
		echo "<div class='uddeim-set-block'>";
		echo "<h4>"._UDDEIM_OPTIONS."</h4>";
		echo "<p>"._UDDEIM_OPTIONS_EXP."</p>";
		echo "<form name='uddeim-popupform' method='post' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=saveuseremn&Itemid=".$item_id)."'>";

		$ison = uddeIMgetEMNpopup($myself);
		$p0checked='';
		switch($ison) {
			case 0:		$p0checked='';						break;
			case 1:		$p0checked='checked="checked"'; 	break;
		}
		if ($config->allowpopup)
			echo '<input type="checkbox" '.$p0checked.' value="1" name="popupcheck" />'._UDDEIM_OPTIONS_P.'<br />';
		else
			echo '<input type="hidden" name="popupcheck" value="'.$ison.'" />';

		$ison = uddeIMgetEMNpublic($myself);
		$p0checked='';
		switch($ison) {
			case 0:		$p0checked='';						break;
			case 1:		$p0checked='checked="checked"'; 	break;
		}
		if ($config->pubfrontend && !uddeIMisRecipientBlockedPublic($myself, $config))			// show option only when I am not in a generally blocked group
			echo '<input type="checkbox" '.$p0checked.' value="1" name="publiccheck" />'._UDDEIM_OPTIONS_F.'<br />';
		else
			echo '<input type="hidden" name="publiccheck" value="'.$ison.'" />';
		// Note: When a certain group is blocked it does not matter what is stored in $public by default, since the group checked if performed before the individual check.
		// I.e. when the group is not blocked -> the individual check $public is tested (the user can modify this value here)
		// and when the group is blocked -> the individual check is not done, since the user will see an error message that the group is not allowed

		echo '<input type="submit" name="reply" class="button" value="'._UDDEIM_SAVECHANGE.'" />';
		echo "</form>";
		echo "</div>";
	}

	if ($config->enablerss==1 || 
	   ($config->enablerss==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)))) {

		$emptysettings='';
		$database = uddeIMgetDatabase();
		$sql = "SELECT id, name, username, password, block FROM #__users WHERE id=".(int)$myself;
		$database->setQuery($sql);
		$values = $database->loadObjectList();
		if (!$values)
			$values = Array();
		$row = NULL;
		foreach($values as $value) {
			$row = $value;
		}
		if ($row) {
			if ((strpos($row->password, ':') === false) && $row->password == md5($passwd)) {
				$salt = uddeIMmosMakePassword(16);
				$crypt = md5($passwd.$salt);
				$row->password = $crypt.':'.$salt;
			}
			list($hash, $salt) = explode(':', $row->password);
			$hash_db = sha1($hash);
			$pms_show = uddeIMgetPath('live_site')."/index.php?option=com_uddeim&amp;task=rss&amp;no_html=1&amp;format=raw&amp;user="******"&amp;pass="******"'.$pms_show.'" target="_blank">'.$pms_show.'</a>';
			echo '<div class="uddeim-set-block">';
			echo '<h4>'._UDDEIM_RSS_FEED.'</h4>';
			echo '<p>'._UDDEIM_RSS_INTRO1.' '._UDDEIM_RSS_INTRO1B.'</p>';
			echo '<p>'.$link.'</p>';
			echo '<p>'._UDDEIM_RSS_INTRO2.'</p>';
			
			if ($config->showigoogle) {
				echo '<p><a href="http://fusion.google.com/ig/add?synd=open&amp;source=ggyp&amp;moduleurl='.uddeIMgetPath('live_site').'/components/com_uddeim/uddeim_igoogle.xml">';
				echo '<img src="'.uddeIMgetPath('live_site').'/components/com_uddeim/templates/images/igoogle.gif" border="0" alt="Add to Google" width="62" height="17" />';
				echo '</a></p>';
				echo '</div>';
			}
		}
	}

	if ($emptysettings) {
			echo "<div id='uddeim-toplines'>".$emptysettings."</div>";
	}
	echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'settings', 'none', $config)."</div>\n";
}