1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

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

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

View File

@@ -1,195 +1,198 @@
<?php <?php
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 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 $ * $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/admin_chatbox.php,v $
* $Revision$ * $Revision$
* $Date$ * $Date$
* $Author$ * $Author$
*/ */
require_once("../../class2.php"); require_once("../../class2.php");
$frm = e107::getForm();
if (!plugInstalled('chatbox_menu') || !getperms("P"))
{ if (!plugInstalled('chatbox_menu') || !getperms("P"))
header("Location: ".e_BASE."index.php"); {
exit; header("Location: ".e_BASE."index.php");
} exit;
}
include_lan( e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/admin_chatbox_menu.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"); require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."userclass_class.php");
if (isset($_POST['updatesettings']))
{ if (isset($_POST['updatesettings']))
$temp = array(); {
$temp['chatbox_posts'] = min(intval($_POST['chatbox_posts']), 5); $temp = array();
$temp['cb_layer'] = intval($_POST['cb_layer']); $temp['chatbox_posts'] = min(intval($_POST['chatbox_posts']), 5);
$temp['cb_layer_height'] = max(varset($_POST['cb_layer_height'], 200), 150); $temp['cb_layer'] = intval($_POST['cb_layer']);
$temp['cb_emote'] = intval($_POST['cb_emote']); $temp['cb_layer_height'] = max(varset($_POST['cb_layer_height'], 200), 150);
$temp['cb_mod'] = intval($_POST['cb_mod']); $temp['cb_emote'] = intval($_POST['cb_emote']);
if ($admin_log->logArrayDiffs($temp, $pref, 'CHBLAN_01')) $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"); save_prefs(); // Only save if changes
$message = CHBLAN_1; $e107cache->clear("nq_chatbox");
} $message = CHBLAN_1;
else }
{ else
$message = CHBLAN_39; {
} $message = CHBLAN_39;
} }
}
if (isset($_POST['prune']))
{ if (isset($_POST['prune']))
$chatbox_prune = intval($_POST['chatbox_prune']); {
$prunetime = time() - $chatbox_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, ''); $sql->db_Delete("chatbox", "cb_datestamp < '{$prunetime}' ");
$e107cache->clear("nq_chatbox"); $admin_log->log_event('CHBLAN_02', $chatbox_prune.', '.$prunetime, E_LOG_INFORMATIVE, '');
$message = CHBLAN_28; $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 $sql->db_Update("user", "user_chats = 0");
LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id $qry = "SELECT u.user_id AS uid, count(c.cb_nick) AS count FROM #chatbox AS c
WHERE u.user_id > 0 LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id
GROUP BY uid"; 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()) $ret = array();
{ while($row = $sql -> db_Fetch())
$list[$row['uid']] = $row['count']; {
} $list[$row['uid']] = $row['count'];
} }
}
foreach($list as $uid => $cnt)
{ foreach($list as $uid => $cnt)
$sql->db_Update("user", "user_chats = '{$cnt}' WHERE user_id = '{$uid}'"); {
} $sql->db_Update("user", "user_chats = '{$cnt}' WHERE user_id = '{$uid}'");
$admin_log->log_event('CHBLAN_03','', E_LOG_INFORMATIVE, ''); }
$message = CHBLAN_33; $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>"); {
} $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); // $mes->addSuccess?
}
$chatbox_posts = $pref['chatbox_posts'];
$chatbox_posts = $pref['chatbox_posts'];
$text = "<div>
<form method='post' action='".e_SELF."' id='cbform'> $text = "<div>
<table cellpadding='0' cellspacing='0' class='adminform'> <form method='post' action='".e_SELF."' id='cbform' >
<colgroup span='2'> <table class='table adminform'>
<col class='col-label' /> <colgroup span='2'>
<col class='col-control' /> <col class='col-label' />
</colgroup> <col class='col-control' />
<tr> </colgroup>
<td>".CHBLAN_11.": <div class='smalltext'>".CHBLAN_12."</div></td> <tr>
<td> <td>".CHBLAN_11.":</td>
<select name='chatbox_posts' class='tbox'>"; <td>
if ($chatbox_posts == 5) { <select name='chatbox_posts' class='tbox'>";
$text .= "<option selected='selected'>5</option>\n"; if ($chatbox_posts == 5) {
} else { $text .= "<option selected='selected'>5</option>\n";
$text .= "<option>5</option>\n"; } else {
} $text .= "<option>5</option>\n";
if ($chatbox_posts == 10) { }
$text .= "<option selected='selected'>10</option>\n"; if ($chatbox_posts == 10) {
} else { $text .= "<option selected='selected'>10</option>\n";
$text .= "<option>10</option>\n"; } else {
} $text .= "<option>10</option>\n";
if ($chatbox_posts == 15) { }
$text .= "<option selected='selected'>15</option>\n"; if ($chatbox_posts == 15) {
} else { $text .= "<option selected='selected'>15</option>\n";
$text .= "<option>15</option>\n"; } else {
} $text .= "<option>15</option>\n";
if ($chatbox_posts == 20) { }
$text .= "<option selected='selected'>20</option>\n"; if ($chatbox_posts == 20) {
} else { $text .= "<option selected='selected'>20</option>\n";
$text .= "<option>20</option>\n"; } else {
} $text .= "<option>20</option>\n";
if ($chatbox_posts == 25) { }
$text .= "<option selected='selected'>25</option>\n"; if ($chatbox_posts == 25) {
} else { $text .= "<option selected='selected'>25</option>\n";
$text .= "<option>25</option>\n"; } else {
} $text .= "<option>25</option>\n";
}
if(!isset($pref['cb_mod']))
{ if(!isset($pref['cb_mod']))
$pref['cb_mod'] = e_UC_ADMIN; {
} $pref['cb_mod'] = e_UC_ADMIN;
}
$text .= "</select>
</td> $text .= "</select>
</tr> <span class='field-help'>".CHBLAN_12."</span>
</td>
<tr><td>".CHBLAN_32.": </td> </tr>
<td>". r_userclass("cb_mod", $pref['cb_mod'], 'off', "nobody,main,admin, classes")."
</td> <tr><td>".CHBLAN_32.": </td>
</tr> <td>". r_userclass("cb_mod", $pref['cb_mod'], 'off', "nobody,main,admin, classes")."
</td>
<tr><td>".CHBLAN_36."</td> </tr>
<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 />". <tr><td>".CHBLAN_36."</td>
($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 />". <td>".
($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." ($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 />".
</td> ($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 />".
</tr> ($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> if($pref['smiley_activate'])
<td>". ($pref['cb_emote'] ? "<input type='checkbox' name='cb_emote' value='1' checked='checked' />" : "<input type='checkbox' name='cb_emote' value='1' />")." {
</td> $text .= "<tr><td>".CHBLAN_31."?: </td>
</tr> <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> $text .= "<tr>
".CHBLAN_23." <select name='chatbox_prune' class='tbox'> <td>".CHBLAN_21.":</td>
<option></option> <td>
<option value='86400'>".CHBLAN_24."</option> ".CHBLAN_23." <select name='chatbox_prune' class='tbox'>
<option value='604800'>".CHBLAN_25."</option> <option></option>
<option value='2592000'>".CHBLAN_26."</option> <option value='86400'>".CHBLAN_24."</option>
<option value='1'>".CHBLAN_27."</option> <option value='604800'>".CHBLAN_25."</option>
</select> <option value='2592000'>".CHBLAN_26."</option>
<input class='button' type='submit' name='prune' value='".CHBLAN_21."' /> <option value='1'>".CHBLAN_27."</option>
</td> </select>
</tr>"; ".$frm->admin_button('prune', CHBLAN_21, 'other')."
<span class='field-help'>".CHBLAN_22."</span>
</td>
$text .= "<tr> </tr>";
<td>".CHBLAN_34.":</td>
<td>
<input class='button' type='submit' name='recalculate' value='".CHBLAN_35."' /> $text .= "<tr>
</td> <td>".CHBLAN_34.":</td>
</tr> <td>
</table>"; ".$frm->admin_button('recalculate', CHBLAN_35, 'other')."
</td>
$text .= "<div class='buttons-bar center'> </tr>
<input class='button' type='submit' name='updatesettings' value='".CHBLAN_19."' /> </table>";
</div>
</form> $text .= "<div class='buttons-bar center'>
</div>"; ".$frm->admin_button('updatesettings', LAN_UPDATE, 'update')."
</div>
$ns->tablerender(CHBLAN_20, $text); </form>
</div>";
require_once(e_ADMIN."footer.php");
$ns->tablerender(CHBLAN_20, $text);
require_once(e_ADMIN."footer.php");
?> ?>

View File

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