|
From: Lo?c C. <lo...@us...> - 2001-06-10 14:59:16
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/admin
In directory usw-pr-cvs1:/tmp/cvs-serv18029/chat/admin
Modified Files:
admin1.php3 admin2.php3 admin3.php3 admin4.php3
admin_body.php3 admin_top.php3
Log Message:
Updated with the new table structure but just a first draft
Index: admin1.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin1.php3,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** admin1.php3 2001/05/30 08:07:13 1.3
--- admin1.php3 2001/06/10 14:59:13 1.4
***************
*** 43,46 ****
--- 43,48 ----
* is currently chatting
*
+ * @param string wheter the right levels table has to be cleaned or not
+ *
* @global string the nick of the user to remove
* @global object the pmcDB instance to use
***************
*** 48,52 ****
* @access private
*/
! function delProfile()
{
global $username;
--- 50,54 ----
* @access private
*/
! function delProfile($doDelRights = '')
{
global $username;
***************
*** 58,80 ****
$dbLink->query("DELETE FROM " . C_REG_TBL . " WHERE username = '$slashedUsername'");
$dbLink->query("SELECT room FROM " . C_USR_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
$isChatting = (list($room) = $dbLink->nextRecord());
// Sends a message to the user if he is currently chatting
if ($isChatting)
{
! $room = pmcHandleMagicQuotes($room, '', '1', 'del');
! $dbLink->cleanResults();
! // Gets the type of the room (public/private) where the message has to be sent
! $slashedTargetRoom = pmcSlashSingleQuotes($room);
! $dbLink->query("SELECT type FROM " . C_MSG_TBL . " WHERE room = '$slashedTargetRoom' LIMIT 1");
! list($targetRoomType) = $dbLink->nextRecord();
! $dbLink->cleanResults();
$dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'u' WHERE username = '$slashedUsername'");
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$targetRoomType, '$slashedTargetRoom', 'SYS delreg', '', " . time() . ", '$slashedUsername', '#666699', 'sprintf(L_ADM_2)', 'sprintf(L_ADM_2)'"
! . ')';
$dbLink->query($aQuery);
}
--- 60,83 ----
$dbLink->query("DELETE FROM " . C_REG_TBL . " WHERE username = '$slashedUsername'");
+ if (!empty($doDelRights))
+ {
+ $dbLink->query("DELETE FROM " . C_RIGHT_TBL . " WHERE username = '$slashedUsername'");
+ }
$dbLink->query("SELECT room FROM " . C_USR_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
$isChatting = (list($room) = $dbLink->nextRecord());
+ $dbLink->cleanResults();
// Sends a message to the user if he is currently chatting
if ($isChatting)
{
! $theTime = time();
! $slashedTargetRoom = pmcSlashSingleQuotes(pmcHandleMagicQuotes($room, '', '1', 'del'));
$dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'u' WHERE username = '$slashedUsername'");
! $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = $theTime WHERE room_name = '$slashedTargetRoom'");
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "'$slashedTargetRoom', 'SYS delreg', '', $theTime, '$slashedUsername', '#666699', 'sprintf(L_ADM_2)', 'sprintf(L_ADM_2)'"
! . ')';
$dbLink->query($aQuery);
}
***************
*** 100,107 ****
// Gets some additional values from the registered users table
! $dbLink->query("SELECT latin1, ip FROM " . C_REG_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
! list($latin1, $ip) = $dbLink->nextRecord();
$dbLink->cleanResults();
// Ensure the user isn't already banished before doing the work
$dbLink->query("SELECT count(*) FROM " . C_BAN_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
--- 103,112 ----
// Gets some additional values from the registered users table
! $dbLink->query("SELECT charset, ip FROM " . C_REG_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
! list($theUsrCharset, $theIp) = $dbLink->nextRecord();
$dbLink->cleanResults();
+ $isLatin1 = ($theUsrCharset == 'iso-8859-1') ? 1 : 0;
+
// Ensure the user isn't already banished before doing the work
$dbLink->query("SELECT count(*) FROM " . C_BAN_TBL . " WHERE username = '$slashedUsername' LIMIT 1");
***************
*** 113,117 ****
if ($banUntil > 2147483647)
$banUntil = 2147483647;
! $dbLink->query("INSERT INTO " . C_BAN_TBL . " (username, latin1, ip, rooms, ban_until) VALUES ('$slashedUsername', $latin1, '$ip', '**to define**', $banUntil)");
}
} // end of the 'banProfile()' function
--- 118,122 ----
if ($banUntil > 2147483647)
$banUntil = 2147483647;
! $dbLink->query("INSERT INTO " . C_BAN_TBL . " (username, latin1, ip, rooms, ban_until) VALUES ('$slashedUsername', $isLatin1, '$theIp', '**to define**', $banUntil)");
}
} // end of the 'banProfile()' function
***************
*** 144,148 ****
// Updates perms level
! $dbLink->query("UPDATE " . C_REG_TBL . " SET perms = '$newPermLevel', rooms = '" . pmcSlashSingleQuotes($newModeratedRooms) . "' WHERE username = '$slashedUsername'");
// Checks if the user should be sent a message
--- 149,162 ----
// Updates perms level
! $modRooms = explode(',', $newModeratedRooms);
! $modRoomsCnt = count($modRooms);
! $dbLink->query("DELETE FROM " . C_RIGHT_TBL . " WHERE username = '$slashedUsername'");
! for ($i = 0; $i < $modRoomsCnt; $i++)
! {
! if (!empty($modRooms[$i]))
! {
! $dbLink->query("INSERT INTO " . C_RIGHT_TBL . " (username, room, right_level) VALUES ('$slashedUsername', '" . pmcSlashSingleQuotes($modRooms[$i]) . "', 5)");
! }
! }
// Checks if the user should be sent a message
***************
*** 233,248 ****
}
! // Udpates the user status for the room he is chatting into
$dbLink->query("UPDATE " . C_USR_TBL . " SET status = '$status' WHERE username = '$slashedUsername'");
! // Gets the type of the room
$slashedTargetRoom = pmcSlashSingleQuotes($room);
! $dbLink->query("SELECT type FROM " . C_MSG_TBL . " WHERE room = '$slashedTargetRoom' LIMIT 1");
! list($targetRoomType) = $dbLink->nextRecord();
! $dbLink->cleanResults();
! // Inserts the message into the messages table
$aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
. 'VALUES ('
! . "$targetRoomType, '$slashedTargetRoom', 'SYS promote', '', " . time() . ", NULL, '#666699', '$message', '$message'"
. ')';
$dbLink->query($aQuery);
--- 247,259 ----
}
! // Udpates the tables
$dbLink->query("UPDATE " . C_USR_TBL . " SET status = '$status' WHERE username = '$slashedUsername'");
! $theTime = time();
$slashedTargetRoom = pmcSlashSingleQuotes($room);
! $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = $theTime WHERE room_name = '$slashedTargetRoom'");
$aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
. 'VALUES ('
! . "'$slashedTargetRoom', 'SYS promote', '', " . time() . ", NULL, '#666699', '$message', '$message'"
. ')';
$dbLink->query($aQuery);
***************
*** 260,263 ****
--- 271,275 ----
* @see delProfile(), banProfile(), modifyPerms()
*/
+ $slashedAdminNick = pmcSlashSingleQuotes($dbSessionVars['authUsername']);
if (!empty($submitType))
{
***************
*** 282,286 ****
$queryLimits = '';
}
! $dbLink->query("SELECT username FROM " . C_REG_TBL . " WHERE perms != 'admin' ORDER BY " . $dbSessionVars['sortBy'] . " " . $dbSessionVars['sortOrder'] . $queryLimits);
$regUsers = array();
while (list($username) = $dbLink->nextRecord())
--- 294,298 ----
$queryLimits = '';
}
! $dbLink->query("SELECT username FROM " . C_REG_TBL . " WHERE username != '$slashedAdminNick'" . $queryLimits);
$regUsers = array();
while (list($username) = $dbLink->nextRecord())
***************
*** 303,312 ****
if ($deleteMode)
{
! $varName = 'selected_' . $encodedUsername;
if (isset($$varName))
! delProfile();
!
! // Optimize the registered users table when a MySQL DB is used
$dbLink->optimize(C_REG_TBL);
} // end of the case where some profiles have to been deleted
--- 315,327 ----
if ($deleteMode)
{
! $varName = 'selected_' . $encodedUsername;
! $permsLevel = 'old_perms_' . $encodedUsername;
if (isset($$varName))
! {
! delProfile($$permsLevel);
! }
! // Optimize the registered users table
$dbLink->optimize(C_REG_TBL);
+ $dbLink->optimize(C_RIGHT_TBL);
} // end of the case where some profiles have to been deleted
***************
*** 334,339 ****
$oldModeratedRooms = pmcHandleMagicQuotes($$varName, 1, '', 'del');
if ($newPermLevel == $oldPermLevel && $newModeratedRooms == $oldModeratedRooms)
continue; // No changes for this user
!
modifyPerms();
} // end of the case where some permission levels have to been modified
--- 349,355 ----
$oldModeratedRooms = pmcHandleMagicQuotes($$varName, 1, '', 'del');
if ($newPermLevel == $oldPermLevel && $newModeratedRooms == $oldModeratedRooms)
+ {
continue; // No changes for this user
! }
modifyPerms();
} // end of the case where some permission levels have to been modified
***************
*** 345,358 ****
/**
* Cleans the registered users table
*/
// Removes profiles of users that have not been chatting for a time > C_REG_DEL
if (!isset($submitType) && C_REG_DEL != 0)
! $dbLink->query("DELETE FROM " . C_REG_TBL . " WHERE reg_time < " . (time() - C_REG_DEL * 60 * 60 * 24) . " AND perms != 'admin'");
- // Removes moderator status when there is no room associated to
- $dbLink->query("UPDATE " . C_REG_TBL . " SET perms = 'user' WHERE perms = 'moderator' AND rooms = ''");
/**
* Displays the registered users sheet
--- 361,504 ----
/**
* Cleans the registered users table
+ *
+ * The 'pmcSlashSingleQuotes()' and 'pmcHandleMagicQuotes()' functions are
+ * defined inside the 'chat/lib/common.lib.php3' library
*/
// Removes profiles of users that have not been chatting for a time > C_REG_DEL
if (!isset($submitType) && C_REG_DEL != 0)
! {
! $delBefore = time() - C_REG_DEL * 60 * 60 * 24;
! $dbLink->query("SELECT username FROM " . C_REG_TBL . " WHERE reg_time < $delBefore AND username != '$slashedAdminNick'");
! while (list($username) = $dbLink->nextRecord())
! {
! $username = pmcSlashSingleQuotes(pmcHandleMagicQuotes($username, '', 1, 'del'));
! $toDelRegUsersQuery = (isset($toDelRegUsersQuery))
! ? $toDelRegUsersQuery . ', \'' . $username . '\''
! : '\'' . $username . '\'';
! }
! $dbLink->query("DELETE FROM " . C_REG_TBL . " WHERE reg_time < $delBefore AND username != '$slashedAdminNick'");
! $dbLink->query("DELETE FROM " . C_RIGHT_TBL . " WHERE username IN ($toDelRegUsersQuery)");
! }
+ /**
+ * Prepares the registered users list to be displayed
+ *
+ * The 'pmcSlashSingleQuotes()' and 'pmcHandleMagicQuotes()' functions are
+ * defined inside the 'chat/lib/common.lib.php3' library
+ */
+ // Get the number of registered users
+ $dbLink->query("SELECT COUNT(*) FROM " . C_REG_TBL . " WHERE username != '$slashedAdminNick' LIMIT 1");
+ list($regUsersCnt) = $dbLink->nextRecord();
+ $dbLink->cleanResults();
+ if ($regUsersCnt != 0)
+ {
+ // Defines wich profiles have to been displayed
+ $lastPageOffset = floor(($regUsersCnt - 1) / 10) * 10;
+ if ($dbSessionVars['offset'] > $lastPageOffset)
+ $dbSessionVars['offset'] = $lastPageOffset;
+ if (C_DB_TYPE == 'mysql')
+ {
+ $queryLimits = ' LIMIT ' . $dbSessionVars['offset'] . ',10';
+ }
+ else if (C_DB_TYPE == 'pgsql')
+ {
+ $queryLimits = ' LIMIT 10 OFFSET ' . $dbSessionVars['offset'];
+ }
+ else // TODO
+ {
+ $queryLimits = '';
+ }
+ // Define the sorting clause
+ $querySort = ($dbSessionVars['sortBy'] != 'perms')
+ ? ' ORDER BY ' . $dbSessionVars['sortBy'] . ' ' . $dbSessionVars['sortOrder']
+ : '';
+ // Gets these profiles
+ $regUsersList = array();
+ $dbLink->query("SELECT username, charset, reg_time, ip FROM " . C_REG_TBL . " WHERE username != '$slashedAdminNick'" . $querySort . $queryLimits);
+ while (list($username, $usrCharset, $lastLog, $ip) = $dbLink->nextRecord())
+ {
+ $username = pmcHandleMagicQuotes($username, '', 1, 'del');
+ $latin1 = ($usrCharset == 'iso-8859-1') ? 1 : 0;
+ $regUsersList[$username] = array($username, $latin1, $lastLog, $ip, '', '');
+ $regUsersPermsQuery = (isset($regUsersPermsQuery))
+ ? $regUsersPermsQuery . ', \'' . pmcSlashSingleQuotes($username) . '\''
+ : '\'' . pmcSlashSingleQuotes($username) . '\'';
+ }
+ $dbLink->cleanResults();
+
+ // Get the right levels
+ $dbLink->query("SELECT username, room, right_level FROM " . C_RIGHT_TBL . " WHERE username IN ($regUsersPermsQuery) ORDER BY username");
+ while (list($username, $moderatedRoom, $perms) = $dbLink->nextRecord())
+ {
+ $username = pmcHandleMagicQuotes($username, '', 1, 'del');
+ $moderatedRoom = pmcHandleMagicQuotes($moderatedRoom, '', 1, 'del');
+
+ // New user starts here -> save data for the previous one
+ if ((isset($handledNick) && $handledNick != $username)
+ && !empty($moderatedRoomsList))
+ {
+ $regUsersList[$handledNick][5] = $moderatedRoomsList;
+ $handledNick = $username;
+ unset($moderatedRoomsList);
+ }
+ // First iteration -> define the handled nick
+ else if (empty($handledNick))
+ {
+ $handledNick = $username;
+ }
+
+ // Define the list of moderated rooms splitted by a comma
+ if (!empty($moderatedRoom))
+ {
+ $moderatedRoomsList = (isset($moderatedRoomsList))
+ ? $moderatedRoomsList . ',' . $moderatedRoom
+ : $moderatedRoom;
+ if (empty($regUsersList[$username][4]))
+ {
+ $regUsersList[$username][4] = $perms;
+ }
+ }
+ }
+ // For the last moderator
+ if (!empty($moderatedRoomsList))
+ {
+ $regUsersList[$handledNick][5] = $moderatedRoomsList;
+ }
+ $dbLink->cleanResults();
+
+ // Sort by right level if required
+ if ($dbSessionVars['sortBy'] == 'perms')
+ {
+ /**
+ * Home build comparaison function used to sort registered users by
+ * right level
+ *
+ * @param array data related to one user
+ * @param array data related to an other user
+ */
+ function permsCmp($a, $b)
+ {
+ if ($a[4] == $b[4])
+ {
+ return strcasecmp($a[0], $b[0]);
+ }
+ else if ($GLOBALS['dbSessionVars']['sortOrder'] == 'ASC')
+ {
+ return (empty($a[4])) ? -1 : 1;
+ }
+ else
+ {
+ return (empty($a[4])) ? 1 : -1;
+ }
+ } // end of the 'permsCmp()' function
+
+ uasort($regUsersList, 'permsCmp');
+ } // end of sorting by right level
+ } // end of preparing the list of registered users
+
+
/**
* Displays the registered users sheet
***************
*** 386,395 ****
<?php
! // Ensures at least one registered user exists (except the administrator)
! // before displaying the sheet
! $dbLink->query("SELECT COUNT(*) FROM " . C_REG_TBL . " WHERE perms != 'admin' LIMIT 1");
! list($regUsersCnt) = $dbLink->nextRecord();
! $dbLink->cleanResults();
! if ($regUsersCnt != 0)
{
echo("\n");
--- 532,537 ----
<?php
! // At least one registered user exists (except the administrator)
! if (isset($regUsersList))
{
echo("\n");
***************
*** 420,448 ****
</td>
</tr>
- <?php
-
- // Defines wich profiles have to been displayed
- $lastPageOffset = floor(($regUsersCnt - 1) / 10) * 10;
- if ($dbSessionVars['offset'] > $lastPageOffset)
- $dbSessionVars['offset'] = $lastPageOffset;
- if (C_DB_TYPE == 'mysql')
- {
- $queryLimits = ' LIMIT ' . $dbSessionVars['offset'] . ',10';
- }
- else if (C_DB_TYPE == 'pgsql')
- {
- $queryLimits = ' LIMIT 10 OFFSET ' . $dbSessionVars['offset'];
- }
- else
- {
- $queryLimits = '';
- }
! // Gets these profiles
! $dbLink->query("SELECT username, latin1, perms, rooms, reg_time, ip FROM " . C_REG_TBL . " WHERE perms != 'admin' ORDER BY " . $dbSessionVars['sortBy'] . " " . $dbSessionVars['sortOrder'] . $queryLimits);
! while (list($username, $latin1, $perms, $rooms, $lastLog, $ip) = $dbLink->nextRecord())
! {
! $username = pmcHandleMagicQuotes($username, '', 1, 'del');
! $rooms = pmcHandleMagicQuotes($rooms, '', 1, 'del');
echo("\n");
?>
--- 562,577 ----
</td>
</tr>
! <?php
! // Displays the profiles
! reset($regUsersList);
! while (list($key, $value) = each($regUsersList))
! {
! $username = $value[0];
! $latin1 = $value[1];
! $lastLog = $value[2];
! $ip = $value[3];
! $perms = $value[4];
! $rooms = $value[5];
echo("\n");
?>
***************
*** 463,468 ****
<td valign="middle" align="center">
<select name="perms_<?php echo(urlencode($username)); ?>">
! <option value="user"<?php if ($perms == 'user') echo(' selected="selected"'); ?>><?php echo(A_USER); ?></option>
! <option value="moderator"<?php if ($perms == 'moderator') echo(' selected="selected"'); ?>><?php echo(A_MODER); ?></option>
</select>
<input type="hidden" name="old_perms_<?php echo(urlencode($username)); ?>" value="<?php echo($perms); ?>" />
--- 592,597 ----
<td valign="middle" align="center">
<select name="perms_<?php echo(urlencode($username)); ?>">
! <option value="user"<?php if (empty($perms)) echo(' selected="selected"'); ?>><?php echo(A_USER); ?></option>
! <option value="moderator"<?php if ($perms == 5) echo(' selected="selected"'); ?>><?php echo(A_MODER); ?></option>
</select>
<input type="hidden" name="old_perms_<?php echo(urlencode($username)); ?>" value="<?php echo($perms); ?>" />
***************
*** 476,480 ****
} // end of the work to display profiles
- $dbLink->cleanResults();
echo("\n");
?>
--- 605,608 ----
Index: admin2.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin2.php3,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** admin2.php3 2001/05/30 08:07:13 1.4
--- admin2.php3 2001/06/10 14:59:13 1.5
***************
*** 80,83 ****
--- 80,88 ----
$dbLink->query("UPDATE " . C_BAN_TBL . " SET rooms = '" . pmcSlashSingleQuotes($newBanishedRooms) . "'$untilQuery WHERE username = '$slashedUsername'");
+ // Remove moderator status that the user may had been granted for the
+ // rooms he/she is banised from
+ $roomQueryPart = '(\'' . str_replace(',', '\', \'', pmcSlashSingleQuotes($newBanishedRooms)) . '\')';
+ $dbLink->query("DELETE FROM " . C_RIGHT_TBL . " WHERE username = '$slashedUsername' AND room IN $roomQueryPart");
+
// Banish the user if he's currently chatting
if ($newBanishedRooms == '*') // The user is banished from all rooms
***************
*** 170,174 ****
--- 175,185 ----
$oldBanishedUntil = $$varName;
if ($newBanishedRooms == $oldBanishedRooms && $newBanishedUntil == $oldBanishedUntil)
+ {
continue; // No changes for this user
+ }
+ else
+ {
+ $newBanishedRooms = ereg_replace('^,|,$', '', str_replace(',,', ',', $newBanishedRooms));
+ }
modifyBanishment();
Index: admin3.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin3.php3,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** admin3.php3 2001/05/30 08:07:13 1.4
--- admin3.php3 2001/06/10 14:59:13 1.5
***************
*** 74,111 ****
&& pmcIsInto($room, $defaultPrivateRooms) == -1)
{
! $dbLink->query("SELECT username, rooms FROM " . C_REG_TBL . " WHERE perms = 'moderator'");
! while (list($moderatorUsername, $moderatedRooms) = $dbLink->nextRecord())
! {
! $moderatorUsername = pmcHandleMagicQuotes($moderatorUsername, '', 1, 'del');
! $moderatorUsername = pmcSlashSingleQuotes($moderatorUsername);
! $moderatedRooms = pmcHandleMagicQuotes($moderatedRooms, '', 1, 'del');
! $moderatedRooms = pmcSlashSingleQuotes($moderatedRooms);
! $changed = false;
! $rooms = explode(',', $moderatedRooms);
! $roomsCnt = count($rooms);
! reset($rooms);
! for ($j = 0; $j < $roomsCnt; $j++)
! {
! if (strcasecmp($room, $rooms[$j]) == 0)
! {
! $rooms[$j] = '';
! $changed = true;
! break;
! }
! }
! if ($changed)
! {
! $moderatedRooms = implode(',', $rooms);
! $moderatedRooms = ereg_replace('^,|,$', '', $moderatedRooms);
! $moderatedRooms = str_replace(',,', ',', $moderatedRooms);
! $dbLink->query("UPDATE " . C_REG_TBL . " SET rooms = '$moderatedRooms' WHERE username = '$moderatorUsername'");
! }
! unset($rooms);
! }
! $dbLink->cleanResults();
}
// Clean the room;
$dbLink->query("DELETE FROM " . C_USR_TBL . " WHERE room = '$room'");
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE room = '$room'");
}// end ot the function 'cleanRoom()'
--- 74,83 ----
&& pmcIsInto($room, $defaultPrivateRooms) == -1)
{
! $dbLink->query("DELETE FROM " . C_RIGHT_TBL . " WHERE room = '$room'");
}
// Clean the room;
$dbLink->query("DELETE FROM " . C_USR_TBL . " WHERE room = '$room'");
+ $dbLink->query("DELETE FROM " . C_ROOM_TBL . " WHERE room_name = '$room'");
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE room = '$room'");
}// end ot the function 'cleanRoom()'
***************
*** 125,129 ****
}
! // Optimize the messages table when a MySQL DB is used
$dbLink->optimize(C_MSG_TBL);
--- 97,102 ----
}
! // Optimize the rooms and the messages table
! $dbLink->optimize(C_ROOM_TBL);
$dbLink->optimize(C_MSG_TBL);
Index: admin4.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin4.php3,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** admin4.php3 2001/05/30 08:07:13 1.3
--- admin4.php3 2001/06/10 14:59:13 1.4
***************
*** 66,70 ****
$splitted = explode(' ', $mailTo);
$splitted[1] = pmcHandleMagicQuotes($splitted[1], 1, '', 'del');
! $recipient[$splitted[0]] = array($splitted[1], '');
// Send the e-mail
$mailHandler->pmmSendEmail( $recipient,
--- 66,70 ----
$splitted = explode(' ', $mailTo);
$splitted[1] = pmcHandleMagicQuotes($splitted[1], 1, '', 'del');
! $recipient[$splitted[0]] = array($splitted[1], $splitted[2]);
// Send the e-mail
$mailHandler->pmmSendEmail( $recipient,
***************
*** 119,126 ****
else
{
// Ensure at least one registered user exists (except the administrator)
// before displaying the mail form
! $dbLink->query("SELECT COUNT(*) FROM " . C_REG_TBL . " WHERE perms != 'admin' LIMIT 1");
list($regUsersCnt) = $dbLink->nextRecord();
$dbLink->cleanResults();
--- 119,127 ----
else
{
+ $slashedAdminNick = pmcSlashSingleQuotes($dbSessionVars['authUsername']);
// Ensure at least one registered user exists (except the administrator)
// before displaying the mail form
! $dbLink->query("SELECT COUNT(*) FROM " . C_REG_TBL . " WHERE username != '$slashedAdminNick' LIMIT 1");
list($regUsersCnt) = $dbLink->nextRecord();
$dbLink->cleanResults();
***************
*** 146,156 ****
<?php
echo("\n");
! $dbLink->query("SELECT username, latin1, email FROM " . C_REG_TBL . " WHERE perms != 'admin' ORDER BY username");
! while (list($username, $latin1, $email) = $dbLink->nextRecord())
{
$username = pmcHandleMagicQuotes($username, '', '1', 'del');
$email = pmcHandleMagicQuotes($email, '', '1', 'del');
echo("\t\t\t\t\t\t\t\t");
! echo('<option value="' . $email . ' ' . htmlspecialchars($username) . '">' . pmcSpecialChars($username, $latin1) . '</option>');
echo("\n");
}
--- 147,158 ----
<?php
echo("\n");
! $dbLink->query("SELECT username, charset, email FROM " . C_REG_TBL . " WHERE username != '$slashedAdminNick' ORDER BY username");
! while (list($username, $usrCharset, $email) = $dbLink->nextRecord())
{
$username = pmcHandleMagicQuotes($username, '', '1', 'del');
+ $latin1 = ($usrCharset == 'iso-8859-1') ? 1 : 0;
$email = pmcHandleMagicQuotes($email, '', '1', 'del');
echo("\t\t\t\t\t\t\t\t");
! echo('<option value="' . $email . ' ' . htmlspecialchars($username) . ' ' . $usrCharset . '">' . pmcSpecialChars($username, $latin1) . '</option>');
echo("\n");
}
Index: admin_body.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin_body.php3,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
Index: admin_top.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/admin/admin_top.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
|