1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 20:21:51 +02:00

Merge branch 'master' of github.com:e107inc/e107

This commit is contained in:
SecretR 2012-11-28 15:46:24 +02:00
commit 750b84bfc1
2 changed files with 265 additions and 262 deletions

View File

@ -1,195 +1,198 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/admin_chatbox.php,v $
* $Revision$
* $Date$
* $Author$
*/
require_once("../../class2.php");
if (!plugInstalled('chatbox_menu') || !getperms("P"))
{
header("Location: ".e_BASE."index.php");
exit;
}
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']))
{
$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 = intval($_POST['chatbox_prune']);
$prunetime = time() - $chatbox_prune;
$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']))
{
$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))
{
$ret = array();
while($row = $sql -> db_Fetch())
{
$list[$row['uid']] = $row['count'];
}
}
foreach($list as $uid => $cnt)
{
$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))
{
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
}
$chatbox_posts = $pref['chatbox_posts'];
$text = "<div>
<form method='post' action='".e_SELF."' id='cbform'>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr>
<td>".CHBLAN_11.": <div class='smalltext'>".CHBLAN_12."</div></td>
<td>
<select name='chatbox_posts' class='tbox'>";
if ($chatbox_posts == 5) {
$text .= "<option selected='selected'>5</option>\n";
} else {
$text .= "<option>5</option>\n";
}
if ($chatbox_posts == 10) {
$text .= "<option selected='selected'>10</option>\n";
} else {
$text .= "<option>10</option>\n";
}
if ($chatbox_posts == 15) {
$text .= "<option selected='selected'>15</option>\n";
} else {
$text .= "<option>15</option>\n";
}
if ($chatbox_posts == 20) {
$text .= "<option selected='selected'>20</option>\n";
} else {
$text .= "<option>20</option>\n";
}
if ($chatbox_posts == 25) {
$text .= "<option selected='selected'>25</option>\n";
} else {
$text .= "<option>25</option>\n";
}
if(!isset($pref['cb_mod']))
{
$pref['cb_mod'] = e_UC_ADMIN;
}
$text .= "</select>
</td>
</tr>
<tr><td>".CHBLAN_32.": </td>
<td>". r_userclass("cb_mod", $pref['cb_mod'], 'off', "nobody,main,admin, classes")."
</td>
</tr>
<tr><td>".CHBLAN_36."</td>
<td>".
($pref['cb_layer'] == 0 ? "<input type='radio' name='cb_layer' value='0' checked='checked' />" : "<input type='radio' name='cb_layer' value='0' />")."&nbsp;&nbsp;". CHBLAN_37."<br />".
($pref['cb_layer'] == 1 ? "<input type='radio' name='cb_layer' value='1' checked='checked' />" : "<input type='radio' name='cb_layer' value='1' />")."&nbsp;".CHBLAN_29."&nbsp;--&nbsp;". CHBLAN_30.": <input class='tbox' type='text' name='cb_layer_height' size='8' value='".$pref['cb_layer_height']."' maxlength='3' /><br />".
($pref['cb_layer'] == 2 ? "<input type='radio' name='cb_layer' value='2' checked='checked' />" : "<input type='radio' name='cb_layer' value='2' />")."&nbsp;&nbsp;". CHBLAN_38."
</td>
</tr>
";
if($pref['smiley_activate'])
{
$text .= "<tr><td>".CHBLAN_31."?: </td>
<td>". ($pref['cb_emote'] ? "<input type='checkbox' name='cb_emote' value='1' checked='checked' />" : "<input type='checkbox' name='cb_emote' value='1' />")."
</td>
</tr>
";
}
$text .= "<tr>
<td>".CHBLAN_21.": <div class='smalltext'>".CHBLAN_22."</div></td>
<td>
".CHBLAN_23." <select name='chatbox_prune' class='tbox'>
<option></option>
<option value='86400'>".CHBLAN_24."</option>
<option value='604800'>".CHBLAN_25."</option>
<option value='2592000'>".CHBLAN_26."</option>
<option value='1'>".CHBLAN_27."</option>
</select>
<input class='button' type='submit' name='prune' value='".CHBLAN_21."' />
</td>
</tr>";
$text .= "<tr>
<td>".CHBLAN_34.":</td>
<td>
<input class='button' type='submit' name='recalculate' value='".CHBLAN_35."' />
</td>
</tr>
</table>";
$text .= "<div class='buttons-bar center'>
<input class='button' type='submit' name='updatesettings' value='".CHBLAN_19."' />
</div>
</form>
</div>";
$ns->tablerender(CHBLAN_20, $text);
require_once(e_ADMIN."footer.php");
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/admin_chatbox.php,v $
* $Revision$
* $Date$
* $Author$
*/
require_once("../../class2.php");
$frm = e107::getForm();
if (!plugInstalled('chatbox_menu') || !getperms("P"))
{
header("Location: ".e_BASE."index.php");
exit;
}
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']))
{
$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 = intval($_POST['chatbox_prune']);
$prunetime = time() - $chatbox_prune;
$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']))
{
$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))
{
$ret = array();
while($row = $sql -> db_Fetch())
{
$list[$row['uid']] = $row['count'];
}
}
foreach($list as $uid => $cnt)
{
$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))
{
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); // $mes->addSuccess?
}
$chatbox_posts = $pref['chatbox_posts'];
$text = "<div>
<form method='post' action='".e_SELF."' id='cbform' >
<table class='table adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr>
<td>".CHBLAN_11.":</td>
<td>
<select name='chatbox_posts' class='tbox'>";
if ($chatbox_posts == 5) {
$text .= "<option selected='selected'>5</option>\n";
} else {
$text .= "<option>5</option>\n";
}
if ($chatbox_posts == 10) {
$text .= "<option selected='selected'>10</option>\n";
} else {
$text .= "<option>10</option>\n";
}
if ($chatbox_posts == 15) {
$text .= "<option selected='selected'>15</option>\n";
} else {
$text .= "<option>15</option>\n";
}
if ($chatbox_posts == 20) {
$text .= "<option selected='selected'>20</option>\n";
} else {
$text .= "<option>20</option>\n";
}
if ($chatbox_posts == 25) {
$text .= "<option selected='selected'>25</option>\n";
} else {
$text .= "<option>25</option>\n";
}
if(!isset($pref['cb_mod']))
{
$pref['cb_mod'] = e_UC_ADMIN;
}
$text .= "</select>
<span class='field-help'>".CHBLAN_12."</span>
</td>
</tr>
<tr><td>".CHBLAN_32.": </td>
<td>". r_userclass("cb_mod", $pref['cb_mod'], 'off', "nobody,main,admin, classes")."
</td>
</tr>
<tr><td>".CHBLAN_36."</td>
<td>".
($pref['cb_layer'] == 0 ? "<input type='radio' name='cb_layer' value='0' checked='checked' />" : "<input type='radio' name='cb_layer' value='0' />")."&nbsp;&nbsp;". CHBLAN_37."<br />".
($pref['cb_layer'] == 1 ? "<input type='radio' name='cb_layer' value='1' checked='checked' />" : "<input type='radio' name='cb_layer' value='1' />")."&nbsp;&nbsp;".CHBLAN_29."&nbsp;--&nbsp;". CHBLAN_30.": <input class='tbox' type='text' name='cb_layer_height' size='8' value='".$pref['cb_layer_height']."' maxlength='3' /><br />".
($pref['cb_layer'] == 2 ? "<input type='radio' name='cb_layer' value='2' checked='checked' />" : "<input type='radio' name='cb_layer' value='2' />")."&nbsp;&nbsp;". CHBLAN_38."
</td>
</tr>
";
if($pref['smiley_activate'])
{
$text .= "<tr><td>".CHBLAN_31."?: </td>
<td>". ($pref['cb_emote'] ? "<input type='checkbox' name='cb_emote' value='1' checked='checked' />" : "<input type='checkbox' name='cb_emote' value='1' />")."
</td>
</tr>
";
}
$text .= "<tr>
<td>".CHBLAN_21.":</td>
<td>
".CHBLAN_23." <select name='chatbox_prune' class='tbox'>
<option></option>
<option value='86400'>".CHBLAN_24."</option>
<option value='604800'>".CHBLAN_25."</option>
<option value='2592000'>".CHBLAN_26."</option>
<option value='1'>".CHBLAN_27."</option>
</select>
".$frm->admin_button('prune', CHBLAN_21, 'other')."
<span class='field-help'>".CHBLAN_22."</span>
</td>
</tr>";
$text .= "<tr>
<td>".CHBLAN_34.":</td>
<td>
".$frm->admin_button('recalculate', CHBLAN_35, 'other')."
</td>
</tr>
</table>";
$text .= "<div class='buttons-bar center'>
".$frm->admin_button('updatesettings', LAN_UPDATE, 'update')."
</div>
</form>
</div>";
$ns->tablerender(CHBLAN_20, $text);
require_once(e_ADMIN."footer.php");
?>

View File

@ -1,69 +1,69 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/languages/English/admin_chatbox_menu.php,v $
| $Revision$
| $Date$
| $Author$
| Encoding:
+----------------------------------------------------------------------------+
*/
define("CHBLAN_1", "Chatbox settings updated.");
define("CHBLAN_2", "Moderated.");
define("CHBLAN_3", "No chatbox posts yet.");
define("CHBLAN_4", "Member");
define("CHBLAN_5", "Guest");
define("CHBLAN_6", "unblock");
define("CHBLAN_7", "block");
define("CHBLAN_8", "delete");
define("CHBLAN_9", "Moderate Chatbox");
define("CHBLAN_10", "Moderate posts");
define("CHBLAN_11", "Chatbox posts to display");
define("CHBLAN_12", "amount of posts displayed in chatbox");
define("CHBLAN_13", "Replace links");
define("CHBLAN_14", "if ticked, posted links will be replaced by text entered in box below");
define("CHBLAN_15", "Replace string if activated");
define("CHBLAN_16", "links will be replaced by this string");
define("CHBLAN_17", "Wordwrap count");
define("CHBLAN_18", "words longer than the number you set here will be wrapped");
define("CHBLAN_19", "Update Chatbox Settings");
define("CHBLAN_20", "Chatbox Settings");
define("CHBLAN_21", "Prune");
define("CHBLAN_22", "Delete posts older than a certain time period");
define("CHBLAN_23", "Delete posts older than ");
define("CHBLAN_24", "One day");
define("CHBLAN_25", "One week");
define("CHBLAN_26", "One month");
define("CHBLAN_27", "- Delete all posts -");
define("CHBLAN_28", "Chatbox pruned.");
define("CHBLAN_29", "Display chatbox inside scrolling layer");
define("CHBLAN_30", "Layer height");
define("CHBLAN_31", "Show emoticons");
define("CHBLAN_32", "Moderator userclass");
define("CHBLAN_33", "User counts recalculated");
define("CHBLAN_34", "Recalculate user post counts");
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','');
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/languages/English/admin_chatbox_menu.php,v $
| $Revision$
| $Date$
| $Author$
| Encoding:
+----------------------------------------------------------------------------+
*/
define("CHBLAN_1", "Chatbox settings updated.");
define("CHBLAN_2", "Moderated.");
define("CHBLAN_3", "No chatbox posts yet.");
define("CHBLAN_4", "Member");
define("CHBLAN_5", "Guest");
define("CHBLAN_6", "unblock");
define("CHBLAN_7", "block");
define("CHBLAN_8", "delete");
define("CHBLAN_9", "Moderate Chatbox");
define("CHBLAN_10", "Moderate posts");
define("CHBLAN_11", "Chatbox posts to display");
define("CHBLAN_12", "Amount of posts displayed in chatbox");
define("CHBLAN_13", "Replace links");
define("CHBLAN_14", "if ticked, posted links will be replaced by text entered in box below");
define("CHBLAN_15", "Replace string if activated");
define("CHBLAN_16", "links will be replaced by this string");
define("CHBLAN_17", "Wordwrap count");
define("CHBLAN_18", "words longer than the number you set here will be wrapped");
//define("CHBLAN_19", "Update Chatbox Settings");
define("CHBLAN_20", "Chatbox Settings");
define("CHBLAN_21", "Prune");
define("CHBLAN_22", "Delete posts older than a certain time period");
define("CHBLAN_23", "Delete posts older than ");
define("CHBLAN_24", "One day");
define("CHBLAN_25", "One week");
define("CHBLAN_26", "One month");
define("CHBLAN_27", "- Delete all posts -");
define("CHBLAN_28", "Chatbox pruned.");
define("CHBLAN_29", "Display chatbox inside scrolling layer");
define("CHBLAN_30", "Layer height");
define("CHBLAN_31", "Show emoticons");
define("CHBLAN_32", "Moderator userclass");
define("CHBLAN_33", "User counts recalculated");
define("CHBLAN_34", "Recalculate user post counts");
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','');
?>