<?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_info.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>");
}

?>
<style type="text/css">
	.std_qnheight {
		height:81px;
	}
</style>
<!--[if IE]>
<style type="text/css">
	.std_qnheight {
		height:83px;
	}
</style>
<![endif]-->
<?php

global $userid,$siteInfo;

$op = (isset($_POST['op'])) ? inCode($_POST['op']) : "" ;

openTable();
if (isAuth($userid,2)) {
	$versarr = array();
	for ($i=0;$i<3;$i++) { $versarr[$i] = substr($siteInfo['version'],$i,1); }
	$memhtversion = implode(".",$versarr);
	
	echo "<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n";
		echo "<tr>\n";
			echo "<td width='50%' valign='top' style='padding:0 2px 4px 0;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>MemHT Portal</td></tr>\n";
					echo "</thead>\n";
					echo "<tbody>\n";
						echo "<tr><td class='clean' width='50%'><b>Version:</b></td><td class='clean' width='50%'>$memhtversion (<a href='admin.php?page=configuration&op=newVersion' title='"._CHECKUPDATES_."'>"._CHECKUPDATES_."</a>)</td></tr>\n";
						echo "<tr><td class='hlight'><b>Site language:</b></span></td><td class='hlight'>".$siteConfig['language']."</td></tr>\n";
						echo "<tr><td class='clean'><b>Default safe language:</b></td><td class='clean'>".$siteConfig['default_language']."</td></tr>\n";
						$info_gc = ($siteConfig['graphic_check']) ? _ON2_ : _OFF_; echo "<tr><td class='hlight'><b>Graphic check (CAPTCHA):</b></td><td class='hlight'>$info_gc</td></tr>\n";
						$info_al = ($siteConfig['adminlog']) ? _ON2_ : _OFF_; echo "<tr><td class='clean'><b>Log some admin activities:</b></td><td class='clean'>$info_al</td></tr>\n";
						$info_mr = ($siteConfig['modrewrite']) ? _ON2_ : _OFF_; echo "<tr><td class='hlight'><b>Mod rewrite:</b></td><td class='hlight'>$info_mr</td></tr>\n";
						$info_te = ($siteConfig['textarea_editor']) ? _ON2_ : _OFF_; echo "<tr><td class='clean'><b>WYSIWYG text editor:</b></td><td class='clean'>$info_te</td></tr>\n";
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
			echo "<td width='50%' valign='top' style='padding:0 0 4px 2px;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>PHP Engine</td></tr>\n";
					echo "</thead>\n";
					echo "<tbody>\n";
						echo "<tr><td class='clean' width='50%'><b>PHP version:</b></td><td class='clean' width='50%'>".phpversion()." (<a href='admin.php?page=memht&op=phpinfo'>Get phpinfo</a>)</td></tr>\n";
						$row = $dblink->get_row("SELECT VERSION() AS version");
						echo "<tr><td class='clean'><b>MySQL version:</b></td><td class='clean'>".$row['version']."</td></tr>\n";		
						$info_le = (get_cfg_var('log_errors')) ? _ON2_ : _OFF_; echo "<tr><td class='hlight'><b>Log errors:</b></td><td class='hlight'>$info_le</td></tr>\n";
						$info_mq = (get_cfg_var('magic_quotes_gpc')) ? _ON2_ : _OFF_; echo "<tr><td class='clean'><b>Magic quotes:</b></td><td class='clean'>$info_mq ";
							echo (get_cfg_var('magic_quotes_gpc')) ? "<img src='images/attention.png' alt='X'>" : "<img src='images/ok.png' alt='Ok'>";
							echo "</td></tr>\n";
						echo "<tr><td class='hlight'><b>Memory limit:</b></td><td class='hlight'>".get_cfg_var('memory_limit')."</td></tr>\n";
						$info_rg = (get_cfg_var('register_globals')) ? _ON2_ : _OFF_; echo "<tr><td class='clean'><b>Register globals:</b></td><td class='clean'>$info_rg ";
							echo (get_cfg_var('register_globals')) ? "<img src='images/attention.png' alt='X'>" : "<img src='images/ok.png' alt='Ok'>";
							echo "</td></tr>\n";
						echo "<tr><td class='hlight'><b>Upload max. filesize:</b></td><td class='hlight'>".get_cfg_var('upload_max_filesize')."</td></tr>\n";
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
			echo "<td width='50%' valign='top' style='padding:0 2px 4px 0;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>Server</td></tr>\n";
					echo "</thead>\n";
						echo "<tr><td class='clean' width='50%'><b>Operating system:</b></td><td class='clean' width='50%'>".@php_uname('s')." (".@php_uname('r').")</td></tr>\n";
						echo "<tr><td class='hlight'><b>Server name:</b></td><td class='hlight'>".@php_uname('n')."</td></tr>\n";
						echo "<tr><td class='clean'><b>Disk free space:</b></td><td class='clean'>".strSize(@disk_free_space("/"))."</td></tr>\n";
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
			echo "<td width='50%' valign='top' style='padding:0 0 4px 2px;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>GD Graphics Library</td></tr>\n";
					echo "</thead>\n";
					echo "<tbody>\n";
						$info_gd = (extension_loaded('gd')) ? _ON2_ : _OFF_; echo "<tr><td class='clean'><b>Status:</b></td><td class='clean'>$info_gd</td></tr>\n";
						$gdinfo = @gd_info();
						$gdtypes = array();
						if (@$gdinfo['FreeType Support']) { $gdtypes[] = "FreeType"; }
						if (@$gdinfo['T1Lib Support']) { $gdtypes[] = "T1Lib"; }
						if (@$gdinfo['GIF Read Support']) { $gdtypes[] = "GIF Read"; }
						if (@$gdinfo['GIF Create Support']) { $gdtypes[] = "GIF Create"; }
						if (@$gdinfo['JPG Support']) { $gdtypes[] = "JPG"; }
						if (@$gdinfo['PNG Support']) { $gdtypes[] = "PNG"; }
						if (@$gdinfo['WBMP Support']) { $gdtypes[] = "WBMP"; }
						if (@$gdinfo['XBM Support']) { $gdtypes[] = "XBM"; }
						$gdtypes = implode(", ",$gdtypes);
						echo "<tr><td class='hlight' width='50%'><b>Version:</b></td><td class='hlight' width='50%'>".$gdinfo['GD Version']."</td></tr>\n";
						echo "<tr><td class='clean' valign='top'><b>Supported types:</b></td><td class='clean'>$gdtypes</td></tr>\n";
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
			echo "<td width='50%' valign='top' style='padding:0 2px 4px 0;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>Quick links</td></tr>\n";
					echo "</thead>\n";
						echo "<tr><td class='clean'><b>User finder</b></td><td class='clean'>\n";
							echo "<form name='qfu' method='post' action='admin.php?page=users'>\n";
								echo "<input type='text' name='adm_user' size='14' maxlength='255'>\n";
								echo " <input type='submit' name='find' value='"._FIND_."'>\n";
								echo " <input type='submit' name='match' value='"._EXACT_MATCH_."'>\n";
								echo "<input type='hidden' name='op' value='findUser'>";
							echo "</form>\n";
						echo "</td></tr>\n";
						
						echo "<tr><td class='hlight'><b>IP finder</b></td><td class='hlight'>\n";
							echo "<form name='qfi' method='post' action='admin.php?page=security&op=findip&ok=true'>\n";
								echo "<input type='text' name='ip' size='14' maxlength='15'> <input type='submit' name='Submit' value='"._FIND_."'></td></tr>\n";
							echo "</form>\n";
						echo "</td></tr>\n";
						
						echo "<tr><td class='clean'><b>MemHT Wiki</b></td><td class='clean'>\n";
							echo "<form name='qwk' method='POST' action='http://memht.com/wiki/Special:Search'>\n";
								echo "<input name='search' size='14' type='text' value=''>\n";
								echo " <input type='submit' name='go' value='Go'>\n";
								echo " <input type='submit' name='fulltext' value='"._SEARCH_."'>\n";
							echo "</form>\n";
						echo "</td></tr>\n";
						
						echo "<tr><td class='hlight'><b>MemHT Portal</b></td><td class='hlight'>\n";
							echo "<form name='qmh' method='GET' action='http://www.memht.com/index.php'>\n";
								echo "<input name='page' type='hidden' value='search'>\n";
								echo "<input name='query' size='14' type='text' value=''>\n";
								echo " <select name='where'>\n";
									echo "<option value='all' selected>"._ALLSITE_."</option>\n";
									echo "<option value='download'>"._AM_DOWNLOADS_."</option>\n";
									echo "<option value='forum'>"._AM_FORUMS_."</option>\n";
									echo "<option value='news'>"._AM_NEWS_."</option>\n";
								echo "</select>\n";
								echo " <input type='submit' value='"._SEARCH_."'>\n";
							echo "</form>\n";
						echo "</td></tr>\n";					
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
			echo "<td width='50%' valign='top' style='padding:0 0 4px 2px;'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>Quick note</td></tr>\n";
					echo "</thead>\n";
						echo "<tr><td class='clean' colspan='2'>\n";
							
							if ($op=="savequicknote") {
								$quicknote = (isset($_POST['quicknote'])) ? inCode($_POST['quicknote']) : "" ;			
								$dblink->query("REPLACE INTO memht_admin_tools (id,value) VALUES ('quicknote','$quicknote')");
								
								$quicknoteinfo = "<div style='color:#009900;'><b>"._DONE_."</b></div>";
							} else {
								$quicknoteinfo = "";
							}
							$row = $dblink->get_row("SELECT value FROM memht_admin_tools WHERE id='quicknote'");
							$quicknote = outCode($row['value']);
							
							echo "<form name='qsv' method='post' action='admin.php'>\n";
								echo "<textarea name='quicknote' style='width:435px;' class='std_qnheight'>$quicknote</textarea>\n";
								echo "<div><input type='submit' value='"._SAVE_."' style='float:left; margin-right:6px;'><div style='padding-top:5px;'>$quicknoteinfo</div></div>\n";
								echo "<input type='hidden' name='op' value='savequicknote'>";
							echo "</form>\n";
						echo "</td></tr>\n";
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
			echo "<td colspan='2'>\n";
				echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='std_nicetable'>\n";
					echo "<thead>\n";
						echo "<tr><td colspan='2'>MemHT.com Bulletin</td></tr>\n";
					echo "</thead>\n";
					echo "<tbody>\n";
						define('MAGPIE_CACHE_DIR', 'inc/magpie/cache');
						require_once("inc/magpie/rss_fetch.inc");
						if ($rss = @fetch_rss("http://www.memht.com/bulletin.php")) {
							$rssitems = array_slice($rss->items,0,5);
							if (sizeof($rssitems)>0) {
								foreach ($rssitems as $item) {
									$title = @$item['title'];
									$link = @$item['link'];
									$description = @$item['description'];
									$flag = intval(@$item['flag']);
									if ($link!="" AND $title!="") {
										if ($description=="") { $description = "-"; }
										/*
										Flag
										----------------------
										0 = Standard
										1 = Highlight (Blue)
										2 = Important (Yellow)
										3 = Warning (Red)
										*/
										switch ($flag) {
											default:
											case 0: $style = ""; break;
											case 1: $style = " style='color:#06F;'"; break;
											case 2: $style = " style='color:#F90;'"; break;
											case 3: $style = " style='color:#F00;'"; break;
										}
										echo "<tr><td class='clean'><a href='$link' target='_blank' title=\"header=["._DESCRIPTION_."] body=[$description]\"><span{$style}><b>$title</b></span></a></td></tr>\n";
									}
								}
							} else {
								echo "<tr><td class='clean' align='center' id='errorText'>"._EMPTY_."</td></tr>\n";
							}
						} else {
							echo "<tr><td class='clean' align='center' id='errorText'><b>"._CANNOTREADFEED_."</b></td></tr>\n";
						}
					echo "</tbody>\n";
				echo "</table>\n";
			echo "</td>\n";
		echo "</tr>\n";
	echo "</table>\n";
} else {
	echo "<div align='center' id='errorText'><b>"._ACCESSDENIED_."</b></div>";
}
closeTable();
			
?>