<?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.
		
********************************************************************************/

?>
<style type="text/css">
	body {
		font-family: Arial, Helvetica, sans-serif;
		font-size: 12px;
	}
	
	a:link { color: #000; text-decoration: none; }
	a:visited { color: #000; text-decoration: none; }
	a:hover { color: #000; text-decoration: none; }
	a:active { color: #000; text-decoration: none; }
	
	/* Nice table */
	table.std_nicetable {
		background-color:#DDD;
		font-size: 12px;
	}
	table.std_nicetable td {
		padding:2px;
	}
	table.std_nicetable thead td {
		background: url(../../images/tablebg.gif) #DDD repeat-x;
		border:1px solid #FFF;
		font-weight:bold;
		color:#A6301C;
	}
	td.std_clean { background-color: #FFF; }
	td.std_hlight { background-color: #F7F7F7; }
</style>
<script type="text/javascript">
	function addSmileC(val,frm,elm) {
		window.opener.document.forms[frm].elements[elm].value+=val;
		window.opener.document.forms[frm].elements[elm].focus();
	}
</script>
<?php

$form = (isset($_GET['form'])) ? preg_replace("`[^a-zA-Z0-9_]`is","",$_GET['form']) : "" ;
$element = (isset($_GET['element'])) ? preg_replace("`[^a-zA-Z0-9_]`is","",$_GET['element']) : "" ;

//===========================================
//Database: Connect
//===========================================
require_once("../inc_config.php");
require_once("../inc_database.php");

$dblink = new database();
$dblink->connect();

require_once("../inc_functions.php");
require_once("../inc_readConfig.php");
if (file_exists("../../lang/".$siteConfig['language'].".php")) {
	include_once("../../lang/".$siteConfig['language'].".php");
} else {
	include_once("../../lang/".$siteConfig['default_language'].".php");
}

echo "<table width='100%' align='center' cellspacing='1' cellpadding='0' class='std_nicetable'>\n";
	echo "<thead>\n";
		echo "<tr><td width='30%' align='center'>"._IMAGE_."</td><td width='35%' align='center'>"._TITLE_."</td><td width='35%' align='center'>"._BBCODE_."</td></tr>\n";
	echo "</thead>\n";
	echo "<tbody>\n";
	$n = 0;
	$result = $dblink->get_list("SELECT * FROM memht_smiles");
	foreach ($result as $row) {
		$sbtitle = outCode($row['title']);
		$sbimg = outCode($row['img']);
		$sbcode = outCode($row['code']);
		
		$class = (($n++%2)!=0) ? "std_hlight" : "std_clean" ;
		echo "<tr><td align='center' class='$class'><img src='../../images/smiles/$sbimg' border='0' title='$sbtitle' alt='$sbtitle' style='margin: 1px; cursor:pointer;' onclick=\"addSmileC('$sbcode','$form','$element');\"></td><td align='center' class='$class'>$sbtitle</td><td align='center' class='$class'>$sbcode</td></tr>\n";
	}
	echo "</tbody>\n";
echo "</table>\n";

echo "<div align='center' style='margin-top:4px;'><a href='javascript:window.close();' title='"._CLOSE_."'><b>"._CLOSE_."</b></a></div>\n";
//===========================================
//Database: Disconnect
//===========================================
$dblink->disconnect();

?>