1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Admin logging, plugin.xml for chatbox. Other tidying up

This commit is contained in:
e107steved
2008-12-11 21:13:48 +00:00
parent 8d8be1b5cf
commit 9af14eaf19
14 changed files with 151 additions and 177 deletions

View File

@@ -11,50 +11,66 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/admin_chatbox.php,v $
| $Revision: 1.4 $
| $Date: 2007-01-28 13:51:45 $
| $Revision: 1.5 $
| $Date: 2008-12-11 21:13:48 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../../class2.php");
if(!getperms("P")) { header("location:".e_BASE."index.php"); exit; }
if (!plugInstalled('chatbox_menu') || !getperms("P"))
{
header("Location: ".e_BASE."index.php");
exit;
}
@include_once e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE."_config.php";
@include_once e_PLUGIN."chatbox_menu/languages/English/English_config.php";
@include_lan( e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/admin_chatbox_menu.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."userclass_class.php");
if (isset($_POST['updatesettings'])) {
$pref['chatbox_posts'] = $_POST['chatbox_posts'];
$pref['cb_layer'] = $_POST['cb_layer'];
$pref['cb_layer_height'] = ($_POST['cb_layer_height'] ? $_POST['cb_layer_height'] : 200);
$pref['cb_emote'] = $_POST['cb_emote'];
$pref['cb_mod'] = $_POST['cb_mod'];
save_prefs();
$e107cache->clear("nq_chatbox");
$message = CHBLAN_1;
if (isset($_POST['updatesettings']))
{
$temp = array();
$temp['chatbox_posts'] = min(intval($_POST['chatbox_posts']), 5);
$temp['cb_layer'] = intval($_POST['cb_layer']);
$temp['cb_layer_height'] = max(varset($_POST['cb_layer_height'], 200), 150);
$temp['cb_emote'] = intval($_POST['cb_emote']);
$temp['cb_mod'] = intval($_POST['cb_mod']);
if ($admin_log->logArrayDiffs($temp, $pref, 'CHBLAN_01'))
{
save_prefs(); // Only save if changes
$e107cache->clear("nq_chatbox");
$message = CHBLAN_1;
}
else
{
$message = CHBLAN_39;
}
}
if (isset($_POST['prune'])) {
$chatbox_prune = $_POST['chatbox_prune'];
if (isset($_POST['prune']))
{
$chatbox_prune = intval($_POST['chatbox_prune']);
$prunetime = time() - $chatbox_prune;
$sql->db_Delete("chatbox", "cb_datestamp < '$prunetime' ");
$sql->db_Delete("chatbox", "cb_datestamp < '{$prunetime}' ");
$admin_log->log_event('CHBLAN_02', $chatbox_prune.', '.$prunetime, E_LOG_INFORMATIVE, '');
$e107cache->clear("nq_chatbox");
$message = CHBLAN_28;
}
if (isset($_POST['recalculate'])) {
if (isset($_POST['recalculate']))
{
$sql->db_Update("user", "user_chats = 0");
$qry = "SELECT u.user_id AS uid, count(c.cb_nick) AS count FROM #chatbox AS c
LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id
WHERE u.user_id > 0
GROUP BY uid";
if ($sql -> db_Select_gen($qry)) {
if ($sql -> db_Select_gen($qry))
{
$ret = array();
while($row = $sql -> db_Fetch())
{
@@ -66,10 +82,12 @@ if (isset($_POST['recalculate'])) {
{
$sql->db_Update("user", "user_chats = '{$cnt}' WHERE user_id = '{$uid}'");
}
$admin_log->log_event('CHBLAN_03','', E_LOG_INFORMATIVE, '');
$message = CHBLAN_33;
}
if (isset($message)) {
if (isset($message))
{
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
}

View File

@@ -11,23 +11,26 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/chat.php,v $
| $Revision: 1.7 $
| $Date: 2007-04-30 20:17:05 $
| $Revision: 1.8 $
| $Date: 2008-12-11 21:13:48 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../../class2.php");
if (file_exists(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php")) {
include_once(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
} else {
include_once(e_PLUGIN."chatbox_menu/languages/English/English.php");
if (!plugInstalled('chatbox_menu'))
{
header("Location: ".e_BASE."index.php");
exit;
}
@include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
require_once(HEADERF);
$sql->db_Select("menus", "*", "menu_name='chatbox_menu'");
$row = $sql->db_Fetch();
if (!check_class($row['menu_class'])) {
if (!check_class($row['menu_class']))
{
$ns->tablerender(CHATBOX_L23, "<div style='text-align:center'>".CHATBOX_L24."</div>");
require_once(FOOTERF);
exit;

View File

@@ -11,13 +11,17 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/chatbox_menu.php,v $
| $Revision: 1.11 $
| $Date: 2008-01-27 11:02:34 $
| $Author: e107coders $
| $Revision: 1.12 $
| $Date: 2008-12-11 21:13:48 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
global $tp, $e107cache, $e_event, $e107, $pref, $footer_js, $PLUGINS_DIRECTORY;
if (!plugInstalled('chatbox_menu'))
{
return '';
}
if(($pref['cb_layer']==2) || isset($_POST['chatbox_ajax']))
{

View File

@@ -3,10 +3,10 @@
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/languages/English/English_config.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:51 $
| $Author: mcfly_e107 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/languages/English/admin_chatbox_menu.php,v $
| $Revision: 1.1 $
| $Date: 2008-12-11 21:13:48 $
| $Author: e107steved $
| Encoding:
+----------------------------------------------------------------------------+
*/
@@ -52,5 +52,18 @@ define("CHBLAN_35", "Recalculate");
define("CHBLAN_36", "Chatbox Display options");
define("CHBLAN_37", "Normal chatbox");
define("CHBLAN_38", "Use javascript code to update posts dynamically (AJAX)");
define('CHBLAN_39', 'Nothing changed - not updated');
define('CHBLAN_40', 'Chatbox');
define('CHBLAN_41', 'Chatbox Menu');
define('CHBLAN_42', '');
define('CHBLAN_43', '');
// Admin Log
define('LAN_AL_CHBLAN_01','Chatbox settings updated');
define('LAN_AL_CHBLAN_02','Chatbox pruned');
define('LAN_AL_CHBLAN_03','Chatbox posts recalculated');
define('LAN_AL_CHBLAN_04','');
define('LAN_AL_CHBLAN_05','');
?>

View File

@@ -1,102 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/plugin.php,v $
| $Revision: 1.2 $
| $Date: 2007-09-22 21:46:23 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "Chatbox";
$eplug_version = "1.0";
$eplug_author = "e107";
$eplug_url = "http://e107.org";
$eplug_email = "jalist@e107.org";
$eplug_description = "Chatbox Menu";
$eplug_compatible = "e107v0.7+";
$eplug_readme = "";
$eplug_status = TRUE;
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "chatbox_menu";
// Name of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "chatbox_menu";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_chatbox.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/chatbox_32.png";
$eplug_icon_small = $eplug_folder."/images/chatbox_16.png";
$eplug_caption = LAN_CONFIGURE; // e107 generic term.
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = array(
'chatbox_posts' => '10',
'cb_wordwrap' => '20',
'cb_layer' => '0',
'cb_layer_height' => '200',
'cb_emote' => '0',
'cb_mod' => e_UC_ADMIN
);
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"chatbox"
);
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."chatbox (
cb_id int(10) unsigned NOT NULL auto_increment,
cb_nick varchar(30) NOT NULL default '',
cb_message text NOT NULL,
cb_datestamp int(10) unsigned NOT NULL default '0',
cb_blocked tinyint(3) unsigned NOT NULL default '0',
cb_ip varchar(45) NOT NULL default '',
PRIMARY KEY (cb_id)
) TYPE=MyISAM;"
);
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = FALSE;
$eplug_link_name = '';
$eplug_link_url = '';
// upgrading ... //
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
if (!function_exists('chatbox_menu_uninstall')) {
function chatbox_menu_uninstall() {
global $sql;
$sql -> db_Update("user", "user_chats='0'");
}
}
if (!function_exists('chatbox_menu_install')) {
function chatbox_menu_install() {
global $sql;
$sql -> db_Update("user", "user_chats='0'");
}
}
?>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-11 21:13:48 e107steved Exp $ -->
<e107Plugin name="CHBLAN_40" version="1.0" compatibility="0.8" installRequired="true">
<author name="e107" url="http://e107.org" email="jalist@e107.org" />
<description>CHBLAN_41</description>
<compatibility>e107v0.7+</compatibility>
<folder>chatbox_menu</folder>
<logLanguageFile filename="languages/--LAN--/--LAN--_config.php" />
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<administration>
<configFile>admin_chatbox.php</configFile>
<icon>images/chatbox_32.png</icon>
<iconSmall>images/chatbox_16.png</iconSmall>
<caption>LAN_CONFIGURE</caption>
</administration>
<mainPrefs>
<pref name="chatbox_posts" value="10" />
<pref name="cb_wordwrap" value="20" />
<pref name="cb_layer" value="0" />
<pref name="cb_layer_height" value="200" />
<pref name="cb_emote" value="0" />
<pref name="cb_mod" value="254" />
</mainPrefs>
</e107Plugin>