Viewing file: index.php (4.5 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?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 (!defined("_LOAD_PAGE_")) {
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>");
}
$op = (isset($_GET['op'])) ? inCode($_GET['op']) : "" ;
$ok = (isset($_GET['ok'])) ? inCode($_GET['ok']) : false ;
$template = (isset($_POST['template'])) ? inCode($_POST['template']) : "memht" ;
$smiles = (isset($_POST['smiles'])) ? intval($_POST['smiles']) : 18 ;
function configChat($template,$smiles,$ok) {
global $dblink;
if (!$ok) {
$row = $dblink->get_row("SELECT template,numsmiles FROM memht_chat_config");
$template = outCode($row['template']);
$smiles = intval($row['numsmiles']);
echo "<form name='admin_chatcfg' method='post' action='admin.php?page=chat&ok=true'>\n";
echo "<table width='100%' cellspacing='0' cellpadding='1'>\n";
echo "<tr><td width='25%'><b>"._TEMPLATE_."</b></td><td>\n";
echo "<select name='template'>\n";
unset($filearray);
$filearray = array();
$handle = opendir('pages/chat/templates/');
while (false !== ($file = readdir($handle))) {
if ($file != "." AND $file != ".." AND !eregi("html",$file) AND file_exists("pages/chat/templates/$file/style.css")) {
$filearray[] = $file;
}
}
closedir($handle);
@sort($filearray);
@reset($filearray);
foreach($filearray as $file) {
if ($template=="$file") {
echo "<option value='$file' selected>$file</option>\n";
} else {
echo "<option value='$file'>$file</option>\n";
}
}
echo "</select></td></tr>\n";
echo "<tr><td><b>"._SMILES_."</b></td><td><input type='text' name='smiles' value='$smiles' size='20' maxlength='255'></td></tr>\n";
echo "<tr><td colspan='2'><input type='submit' name='Submit' value='"._SAVE_."'></td></tr>";
echo "</table>\n";
echo "</form>";
} else {
$dblink->query("UPDATE memht_chat_config SET template='$template',numsmiles='$smiles'");
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=chat'>";
}
}
function resetChat($ok=false) {
global $dblink,$tzNOW,$admin;
if ($ok) {
$file = "pages/chat/messages.txt";
if ($handle = @fopen($file,'w')) {
$row = $dblink->get_row("SELECT DATE_FORMAT($tzNOW, '%H:%i:%S') as date");
$time = $row['date'];
$content = "$admin|$time|Reset";
fwrite($handle,$content);
fclose($handle);
echo "<meta http-equiv='refresh' content='0;URL=admin.php?page=chat'>";
} else {
echo "Cannot write the database file";
}
} else {
echo "<div align='center'><b>"._RESET_."?</b><br><a href='admin.php?page=chat&op=reset&ok=true' title='"._YES_."'>"._YES_."</a> - <a href='admin.php?page=chat' title='"._NO_."'>"._NO_."</a></div>";
}
}
require_once("admin/inc/inc_header.php");
admin_page_title($page);
openTable();
echo "<div align='center' class='box'>";
echo "<a href='admin.php?page=chat' title='"._CONFIGURATION_."'><img src='admin/icons/config.png' border='0' title='"._CONFIGURATION_."' align='top'> "._CONFIGURATION_."</a>";
echo " - <a href='admin.php?page=chat&op=reset' title='"._RESET_."'><img src='admin/icons/attention.png' border='0' title='"._RESET_."' align='top'> "._RESET_."</a>";
echo "</div>";
closeTable();
openTable();
switch($op) {
case "reset":
resetChat($ok);
break;
default:
configChat($template,$smiles,$ok);
break;
}
closeTable();
require_once("admin/inc/inc_footer.php");
?>
|