<?php

/********************************************************************************
	- MemHT Portal -
	
	Copyright (C) 2007-2008 by Miltenovik Manojlo
	http://www.memht.com
	
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your opinion) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License along
	with this program; if not, see <http://www.gnu.org/licenses/> (GPLv2)
	or write to the Free Software Foundation, Inc., 51 Franklin Street,
	Fifth Floor, Boston, MA02110-1301, USA.
		
********************************************************************************/

if (stristr(htmlentities($_SERVER['PHP_SELF']), "inc_newevents.php")) {
	die("<table style='padding: 2px; border: 1px solid #999; background-color: #EEE; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>Error:</b> This file cannot be opened directly!</td></tr></table>");
}
	
	global $dblink,$siteConfig;
	
	//Waiting articles
	if ($dblink->get_num("SELECT id FROM memht_articoli WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=articles' title='"._WAITINGARTICLES_."'>"._WAITINGARTICLES_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting blog posts
	if ($dblink->get_num("SELECT id FROM memht_blog_posts WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=blog' title='"._WAITINGBLOGPOSTS_."'>"._WAITINGBLOGPOSTS_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting downloads
	if ($dblink->get_num("SELECT id FROM memht_download WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=download' title='"._WAITINGDOWNLOADS_."'>"._WAITINGDOWNLOADS_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting gallery
	if ($dblink->get_num("SELECT id FROM memht_gallery_images WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=gallery' title='"._WAITINGIMAGES_."'>"._WAITINGIMAGES_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting guides
	if ($dblink->get_num("SELECT id FROM memht_guide WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=guide' title='"._WAITINGGUIDES_."'>"._WAITINGGUIDES_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting links
	if ($dblink->get_num("SELECT id FROM memht_mylinks WHERE flag=0 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=mylinks' title='"._WAITINGLINKS_."'>"._WAITINGLINKS_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting news
	if ($dblink->get_num("SELECT id FROM memht_news WHERE waiting=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=submission&op=news' title='"._WAITINGNEWS_."'>"._WAITINGNEWS_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting accounts
	if ($dblink->get_num("SELECT id FROM memht_utenti_attesa WHERE activated=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
		echo "<thead>\n";
		echo "<tr><td colspan='5'><img src='images/view.gif' alt='View' align='left'>&nbsp;"._ACCWAITINGACTIVATION_."</td></tr>";
		echo "<tr><td width='20%'><b>"._USER_."</b></td><td width='25%'><b>"._EMAIL_."</b></td><td width='10%'><b>"._LASTIP_."</b></td><td width='15%'><b>"._REGISTERED_."</b></td><td align='right' width='1%' nowrap>&nbsp;</td></tr>\n";
		echo "</thead>\n";
		echo "<tbody>\n";
		$n = 0;
		$result = $dblink->get_list("SELECT * FROM memht_utenti_attesa WHERE activated=1");
		foreach ($result as $row) {
			$wa_id = intval($row['id']);
			$wa_user = outCode($row['user']);
			$wa_pass = outCode($row['pass']);
			$wa_email = outCode($row['email']);
			$wa_lastip = outCode($row['lastip']);
			$wa_data = outCode($row['data']);									
					
			$class = (($n++%2)!=0) ? "hlight" : "clean" ;
			echo "<tr><td class='$class' width='15%'><b>$wa_user</b></td><td class='$class' width='25%'>$wa_email</td><td class='$class' width='15%'>$wa_lastip</td><td class='$class' width='15%' nowrap>$wa_data</td><td class='$class' align='right' width='10%'>";
					
			echo "<select onChange='location = this.options[this.selectedIndex].value;' style='font-size:9px; border:0;' class='$class'>";
				echo "<option value='' selected>-- "._APPROVE_." --</option>\n";
				echo "<option value='admin.php?page=users&op=approvation&id=$wa_id&decision=1' style='font-weight:bold; color:green;'>"._YES_."</option>\n";
				echo "<option value='admin.php?page=users&op=approvation&id=$wa_id&decision=0' style='font-weight:bold; color:red;'>"._NO_."</option>\n";
			echo "</select>\n";
			
			echo "</td></tr>\n";
		}
		echo "</tbody>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
	
	//Waiting comments
	if ($dblink->get_num("SELECT id FROM memht_comments WHERE moderate=1 LIMIT 1")>0) {
		echo "<table width='100%' border='0' cellspacing='1' cellpadding='0' align='center' class='std_nicetable'>\n";
			echo "<thead>\n";
				echo "<tr><td><img src='images/view.gif' alt='View' align='left'>&nbsp;<a href='admin.php?page=comments' title='"._COMMENTSWAITINGMODERATION_."'>"._COMMENTSWAITINGMODERATION_."</a></td></tr>\n";
			echo "</thead>\n";
		echo "</table>\n";
		echo "<div style='padding:2px;'></div>";
	}
			
?>