COnfiguration variables can now be edited via GUI
This commit is contained in:
@@ -10,6 +10,9 @@ $string['chatintro'] = "Introduction text";
|
||||
$string['chatname'] = "Name of this chat room";
|
||||
$string['chatreport'] = "Chat sessions";
|
||||
$string['chattime'] = "Next chat time";
|
||||
$string['configrefreshroom'] = "How often should the chat room itself be refreshed? (in seconds). Setting this low will make the chat room seem quicker, but it may place a higher load on your web server when many people are chatting";
|
||||
$string['configrefreshuserlist'] = "How often should the list of users be refreshed? (in seconds)";
|
||||
$string['configoldping'] = "After how long of not hearing from a user should we consider them gone?";
|
||||
$string['currentchats'] = "Active chat sessions";
|
||||
$string['currentusers'] = "Current users";
|
||||
$string['donotusechattime'] = "Don't publish any chat times";
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<form method="post" action="module.php" name="form">
|
||||
|
||||
<table cellpadding=9 cellspacing=0 >
|
||||
<tr valign=top>
|
||||
<td align=right><p>chat_refresh_room:</td>
|
||||
<td>
|
||||
<input name=chat_refresh_room type=text size=5 value="<?php p($CFG->chat_refresh_room) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configrefreshroom", "chat") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>chat_refresh_userlist:</td>
|
||||
<td>
|
||||
<input name=chat_refresh_userlist type=text size=5 value="<?php p($CFG->chat_refresh_userlist) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configrefreshuserlist", "chat") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p>chat_old_ping:</td>
|
||||
<td>
|
||||
<input name=chat_old_ping type=text size=5 value="<?php p($CFG->chat_old_ping) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configoldping", "chat") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
@@ -31,7 +31,7 @@ header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: text/html");
|
||||
header("Refresh: 4; URL=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);
|
||||
header("Refresh: $CFG->chat_refresh_room; URL=jsupdate.php?chat_sid=".$chat_sid."&chat_lasttime=".$chat_newlasttime);
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
|
||||
+12
-4
@@ -2,10 +2,16 @@
|
||||
|
||||
/// Library of functions and constants for module chat
|
||||
|
||||
if (!isset($CFG->chat_refresh_room)) {
|
||||
set_config("chat_refresh_room", 5);
|
||||
}
|
||||
if (!isset($CFG->chat_refresh_userlist)) {
|
||||
set_config("chat_refresh_userlist", 10);
|
||||
}
|
||||
if (!isset($CFG->chat_old_ping)) {
|
||||
set_config("chat_old_ping", 30);
|
||||
}
|
||||
|
||||
define("CHAT_REFRESH_ROOM", 10);
|
||||
define("CHAT_REFRESH_USERLIST", 10);
|
||||
define("CHAT_OLD_PING", 30);
|
||||
|
||||
define("CHAT_DRAWBOARD", false); // Look into this later
|
||||
|
||||
@@ -217,7 +223,9 @@ function chat_login_user($chatid, $version="header_js") {
|
||||
function chat_delete_old_users() {
|
||||
// Delete the old and in the way
|
||||
|
||||
$timeold = time() - CHAT_OLD_PING;
|
||||
global $CFG;
|
||||
|
||||
$timeold = time() - $CFG->chat_old_ping;
|
||||
|
||||
if ($oldusers = get_records_select("chat_users", "lastping < '$timeold'") ) {
|
||||
delete_records_select("chat_users", "lastping < '$timeold'");
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Content-Type: text/html");
|
||||
header("Refresh: ".CHAT_REFRESH_USERLIST."; URL=users.php?chat_sid=$chat_sid");
|
||||
header("Refresh: $CFG->chat_refresh_userlist; URL=users.php?chat_sid=$chat_sid");
|
||||
|
||||
print_header();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user