Ejemplo n.º 1
0
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'>&nbsp;</th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DATE."</th><th class='sectiontableheader'>&nbsp;</th></tr>";
	echo "\n\n\t<tr><th class='sectiontableheader'>&nbsp;</th><th class='sectiontableheader'>"._UDDEIM_FROM." / "._UDDEIM_TO."</th><th class='sectiontableheader'>"._UDDEIM_MESSAGE."</th><th class='sectiontableheader'>"._UDDEIM_DELETED."</th><th class='sectiontableheader'>&nbsp;</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 = "&lt;";
			$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 = "&gt;";
			$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 = "&lt;";	// 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.="&nbsp;".$uddeicons_onlinepic;
				} else {
					$fromcell.="&nbsp;".$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("&amp;#", "&#", $teasermessage);
		$teasermessage=str_replace("&amp;&lt;/br&gt;", " ", $teasermessage);

		$safemessage=htmlspecialchars(stripslashes($cm), ENT_QUOTES, $config->charset);
		$safemessage=str_replace("&amp;&lt;/br&gt;", "</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";
}
Ejemplo n.º 2
0
function uddeIMprintMenu($myself, $uddeaction, $item_id, $config) {
	$pathtosite = uddeIMgetPath('live_site');
	$my_gid = $config->usergid;

	// write the uddeim title
	if ($config->showtitle)
		echo "<div class='contentheading'>".$config->showtitle."</div>";

	if ($config->showmenuicons==3)
		return;

	// write the uddeim menu
	echo "\n<div id='uddeim-navbar2'><ul>\n";

	if ( $config->enablepostbox ) {
		$cnt = "";
		if ($config->showmenucount)
			$cnt = " (".uddeIMgetInboxCount($myself, 0, true, 0)."/".uddeIMgetInboxCount($myself)."/".uddeIMgetOutboxCount($myself).")";
		if ($uddeaction=="postbox") {
			echo "<li class='uddeim-activemenu'><span>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_inbox.gif' alt='"._UDDEIM_POSTBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_POSTBOX;
			echo $cnt;
			echo "</span></li>\n";
		} else {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=postbox&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_inbox.gif' border='0' alt='"._UDDEIM_POSTBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_POSTBOX;
			echo $cnt;
			echo "</a>";
			echo "</li>\n";
		}
	} else {
		$cnt = "";
		if ($config->showmenucount)
			$cnt = " (".uddeIMgetInboxCount($myself, 0, true, 0)."/".uddeIMgetInboxCount($myself).")";
		if ($uddeaction=="inbox") {
			echo "<li class='uddeim-activemenu'><span>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_inbox.gif' alt='"._UDDEIM_INBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_INBOX;
			echo $cnt;
			echo "</span></li>\n";
		} else {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=inbox&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_inbox.gif' border='0' alt='"._UDDEIM_INBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_INBOX;
			echo $cnt;
			echo "</a>";
			echo "</li>\n";
		}

		$cnt = "";
		if ($config->showmenucount)
			$cnt = " (".uddeIMgetOutboxCount($myself).")";
		if ($uddeaction=="outbox") {
			echo "<li class='uddeim-activemenu'><span>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_outbox.gif' alt='"._UDDEIM_OUTBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_OUTBOX;
			echo $cnt;
			echo "</span></li>\n";
		} else {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_outbox.gif' border='0' alt='"._UDDEIM_OUTBOX."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_OUTBOX;
			echo $cnt;
			echo "</a>";
			echo "</li>\n";
		}
	}

	$cnt = "";
	if ($config->showmenucount) {
		$rightnow=uddetime($config->timezone);
		$offset=((float)$config->TrashLifespan) * 86400;
		$timeframe=$rightnow-$offset;
		$cnt = " (".uddeIMgetTrashcanCount($myself, $timeframe).")";
	}
	if ($uddeaction=="trashcan") {
		echo "<li class='uddeim-activemenu'><span>";
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_trashcan.gif' alt='"._UDDEIM_TRASHCAN."' />";
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_TRASHCAN;
		echo $cnt;
		echo "</span></li>\n";
	} else {
		if( ($config->trashrestriction==0) ||
			($config->trashrestriction==1 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || 
			($config->trashrestriction==2 && (uddeIMisAdmin($my_gid)   || uddeIMisAdmin2($my_gid, $config))) ) {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=trashcan&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_trashcan.gif' border='0' alt='"._UDDEIM_TRASHCAN."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_TRASHCAN;
			echo $cnt;
			echo "</a>";
			echo "</li>\n";
		}
	}

	$cnt = "";
	if ($config->showmenucount)
		$cnt = " (".uddeIMgetArchiveCount($myself).")";
	if ($uddeaction=="archive") {
		echo "<li class='uddeim-activemenu'><span>";
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_archive.gif' alt='"._UDDEIM_ARCHIVE."' />";
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_ARCHIVE;
		echo $cnt;
		echo "</span></li>\n";
	} else {
		if ($config->allowarchive) {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=archive&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_archive.gif' border='0' alt='"._UDDEIM_ARCHIVE."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_ARCHIVE;
			echo $cnt;
			echo "</a>";
			echo "</li>\n";
		}
	}

	if ($uddeaction=="lists") {
		echo "<li class='uddeim-activemenu'><span>";
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_book.gif' alt='"._UDDEIM_LISTS."' />";
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_LISTS;
		echo "</span></li>\n";
	} else {
		if($config->allowmultiplerecipients &&
		   (($config->enablelists==1) ||
			($config->enablelists==2 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || 
			($config->enablelists==3 && (uddeIMisAdmin($my_gid)   || uddeIMisAdmin2($my_gid, $config))) )
		  ) {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showlists&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_book.gif' border='0' alt='"._UDDEIM_LISTS."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_LISTS;
			echo "</a>";
			echo "</li>\n";
		}
	}

	if ($uddeaction=="settings") {
		if ($config->showsettingslink==1) {
			echo "<li class='uddeim-activemenu'><span>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_settings.gif' alt='"._UDDEIM_SETTINGS."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_SETTINGS;
			echo "</span></li>\n";
		}
	} else {
		$showsettings = 0;
		if ($config->showsettingslink==1) {
			if ($config->pubfrontend || $config->allowpopup || $config->blocksystem || 
				$config->allowemailnotify==1 || 
			   ($config->allowemailnotify==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ||
				$config->autoresponder==1 ||
			   ($config->autoresponder==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) ||
				$config->autoforward==1 ||
			   ($config->autoforward==2 && (uddeIMisAdmin($my_gid)   || uddeIMisAdmin2($my_gid, $config))) ||
			   ($config->autoforward==3 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) ||
			    $config->enablerss==1 || 
			   ($config->enablerss==2 && (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))) )
				$showsettings = 1;
		}
		if ($showsettings) {
			echo "<li>";
			echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=settings&Itemid=".$item_id)."'>";
			if ($config->showmenuicons==1 || $config->showmenuicons==2)
				echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_settings.gif' border='0' alt='"._UDDEIM_SETTINGS."' />";
			if ($config->showmenuicons==0 || $config->showmenuicons==1)
				echo _UDDEIM_SETTINGS;
			echo "</a>";
			echo "</li>\n";
		}
	}

	if ($uddeaction=="new") {
		echo "<li class='uddeim-activemenu'><span>";
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif' alt='"._UDDEIM_COMPOSE."' />";
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_COMPOSE;
		echo "</span></li>\n";
	} else {
		echo "<li>";
		echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=new&Itemid=".$item_id)."'>";
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif' border='0' alt='"._UDDEIM_COMPOSE."' />";
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_COMPOSE;
		echo "</a>";
		echo "</li>\n";
	}
	
	// Add menu forum Kunena 
	if (uddeIMcheckKU() && in_array($config->showmenulink, array(5, 9, 11, 12))) {
		$cnt = ""; 
		echo "<li>"; 
		echo "<a href='".uddeIMsefRelToAbs("index.php?option=com_kunena")."'>";
		// echo "<a href='/forum/recent' />"; 
		if ($config->showmenuicons==1 || $config->showmenuicons==2)
			echo "<img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/icon_next.gif' border='0' alt='"._UDDEIM_KUNENA_LINK."' />"; 
		if ($config->showmenuicons==0 || $config->showmenuicons==1)
			echo _UDDEIM_KUNENA_LINK;
		echo $cnt; 
		echo "</a>"; 
		echo "</li>\n"; 
	}
	// End of add menu forum Kunena

	echo "</ul></div>\n";
}