Example #1
0
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();
	}
}
Example #2
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";
}