Update of /cvsroot/phpmychat/phpMyChat-0.15/chat
In directory usw-pr-cvs1:/tmp/cvs-serv14795/chat
Modified Files:
handle_input.php3 input.php3 users.php3 users_low.php3
users_popup.php3 users_popup_low.php3 whois_popup.php3
Log Message:
Begin right levels improvement
Index: handle_input.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/handle_input.php3,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** handle_input.php3 2001/06/10 14:56:06 1.32
--- handle_input.php3 2001/12/04 20:01:03 1.33
***************
*** 48,56 ****
* defined in the 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms);
$toGrab = array('dbSessionId', '%POST', 'cookieColor');
pmcGrabGlobals($toGrab);
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
unset($retVar);
if (!empty($msgTo))
--- 48,57 ----
* defined in the 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms, $rightLevels);
$toGrab = array('dbSessionId', '%POST', 'cookieColor');
pmcGrabGlobals($toGrab);
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
+ $rightLevels = $retVar[2];
unset($retVar);
if (!empty($msgTo))
***************
*** 116,120 ****
// Red colors are reserved to the admin or a moderator for the current room
if (ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $color)
! && $dbSessionVars['status'] < 5)
{
$color = '#000000';
--- 117,121 ----
// Red colors are reserved to the admin or a moderator for the current room
if (ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $color)
! && $dbSessionVars['status'] < 3)
{
$color = '#000000';
***************
*** 294,298 ****
. '?' . dbSessionSID()
. $pmcQueryArgSeparator . 'dummy=' . uniqid('');
! if ($dbSessionVars['status'] >= 5)
{
echo("\n");
--- 295,299 ----
. '?' . dbSessionSID()
. $pmcQueryArgSeparator . 'dummy=' . uniqid('');
! if ($dbSessionVars['status'] >= 3)
{
echo("\n");
Index: input.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/input.php3,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** input.php3 2001/06/16 10:20:14 1.40
--- input.php3 2001/12/04 20:01:03 1.41
***************
*** 48,56 ****
* defined in the 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms);
$toGrab = array('dbSessionId', '%POST', 'cookieColor');
pmcGrabGlobals($toGrab);
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
unset($retVar);
if (!empty($msgTo))
--- 48,57 ----
* defined in the 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms, $rightLevels);
$toGrab = array('dbSessionId', '%POST', 'cookieColor');
pmcGrabGlobals($toGrab);
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
+ $rightLevels = $retVar[2];
unset($retVar);
if (!empty($msgTo))
***************
*** 123,127 ****
// Red colors are reserved to the admin or a moderator for the current room
if (ereg('#(FF0000|fc3f40|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $color)
! && $dbSessionVars['status'] < 5)
{
$color = '#000000';
--- 124,128 ----
// Red colors are reserved to the admin or a moderator for the current room
if (ereg('#(FF0000|fc3f40|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $color)
! && $dbSessionVars['status'] < 3)
{
$color = '#000000';
***************
*** 271,275 ****
// Red color is reserved to the admin or a moderator for the current room
if ($colorCode == '#FF0000'
! && $dbSessionVars['status'] < 5)
{
continue;
--- 272,276 ----
// Red color is reserved to the admin or a moderator for the current room
if ($colorCode == '#FF0000'
! && $dbSessionVars['status'] < 3)
{
continue;
***************
*** 398,402 ****
<!--
// Buffer the color picker
! window.parent.jsIsModerator = <?php echo(($dbSessionVars['status'] >= 5) ? 1 : 0); ?>;
window.parent.pmcSetColorPicker('<?php echo($color); ?>');
--- 399,403 ----
<!--
// Buffer the color picker
! window.parent.jsIsModerator = <?php echo(($dbSessionVars['status'] >= 3) ? 1 : 0); ?>;
window.parent.pmcSetColorPicker('<?php echo($color); ?>');
Index: users.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/users.php3,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** users.php3 2001/11/29 22:10:35 1.28
--- users.php3 2001/12/04 20:01:03 1.29
***************
*** 137,141 ****
$tagsOpen = '';
$tagsClose = '';
! if (intval($theStatus) >= 5)
{
$tagsOpen = '<i>';
--- 137,141 ----
$tagsOpen = '';
$tagsClose = '';
! if (intval($theStatus) >= 3)
{
$tagsOpen = '<i>';
Index: users_low.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/users_low.php3,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** users_low.php3 2001/11/29 22:10:35 1.23
--- users_low.php3 2001/12/04 20:01:03 1.24
***************
*** 138,142 ****
$tagsOpen = '';
$tagsClose = '';
! if (intval($theStatus) >= 5)
{
$tagsOpen = '<i>';
--- 138,142 ----
$tagsOpen = '';
$tagsClose = '';
! if (intval($theStatus) >= 3)
{
$tagsOpen = '<i>';
Index: users_popup.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/users_popup.php3,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** users_popup.php3 2001/11/30 19:30:35 1.23
--- users_popup.php3 2001/12/04 20:01:03 1.24
***************
*** 158,162 ****
function pmcFormatUsername($theUsername, $isUnLatin1, $theStatus)
{
! $tagOpen = (intval($theStatus) >= 5) ? '<i>' : '';
$tagClose = ($tagOpen != '') ? '</i>' : '';
$theUsername = $tagOpen
--- 158,162 ----
function pmcFormatUsername($theUsername, $isUnLatin1, $theStatus)
{
! $tagOpen = (intval($theStatus) >= 3) ? '<i>' : '';
$tagClose = ($tagOpen != '') ? '</i>' : '';
$theUsername = $tagOpen
Index: users_popup_low.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/users_popup_low.php3,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** users_popup_low.php3 2001/11/29 22:10:35 1.18
--- users_popup_low.php3 2001/12/04 20:01:03 1.19
***************
*** 159,163 ****
function pmcFormatUsername($theUsername, $isUnLatin1, $theStatus)
{
! $tagOpen = (intval($theStatus) >= 5) ? '<i>' : '';
$tagClose = ($tagOpen != '') ? '</i>' : '';
$theUsername = $tagOpen
--- 159,163 ----
function pmcFormatUsername($theUsername, $isUnLatin1, $theStatus)
{
! $tagOpen = (intval($theStatus) >= 3) ? '<i>' : '';
$tagClose = ($tagOpen != '') ? '</i>' : '';
$theUsername = $tagOpen
Index: whois_popup.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/whois_popup.php3,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** whois_popup.php3 2001/06/12 19:46:55 1.18
--- whois_popup.php3 2001/12/04 20:01:04 1.19
***************
*** 46,53 ****
* 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms);
pmcGrabGlobals('%GET');
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
unset($retVar);
$whoisTarget = pmcHandleMagicQuotes($whoisTarget, '1', '', 'del');
--- 46,54 ----
* 'chat/lib/common.lib.php3' library.
*/
! $retVar = array($defaultChatRooms, $defaultPrivateRooms, $rightLevels);
pmcGrabGlobals('%GET');
$defaultChatRooms = $retVar[0];
$defaultPrivateRooms = $retVar[1];
+ $rightLevels = $retVar[2];
unset($retVar);
$whoisTarget = pmcHandleMagicQuotes($whoisTarget, '1', '', 'del');
***************
*** 87,111 ****
* Define the level of information the current user is allowed to see
*/
! $whoisDbLnk = new pmcDB;
! if ($dbSessionVars['nick'] == $whoisTarget)
{
! $power = 'high';
}
! else if ($dbSessionVars['status'] == 10) // administrator
{
! $power = 'high';
}
! else if ($dbSessionVars['status'] >= 5) // moderators
{
! $whoisDbLnk->query("SELECT COUNT(*) FROM " . C_USR_TBL . " WHERE username = '$slashedWhoisTarget' AND room = '" . pmcSlashSingleQuotes($dbSessionVars['currentRoom']) . "'");
! list($isInCurrentRoom) = $whoisDbLnk->nextRecord();
$whoisDbLnk->cleanResults();
! $power = ($isInCurrentRoom) ? 'medium' : 'weak';
}
! else // simple user
{
! $power = 'weak';
}
/**
* Get the target user profile and define his/her permission level
--- 88,165 ----
* Define the level of information the current user is allowed to see
*/
! $slashedUser = pmcSlashSingleQuotes($dbSessionVars['nick']);
! $whoisDbLnk = new pmcDB;
! // Self whois or ownner
! if ($dbSessionVars['nick'] == $whoisTarget
! || $dbSessionVars['status'] == 9)
{
! $power = 'high';
}
! // Super-moderator or administrator
! else if ($dbSessionVars['status'] > 5)
{
! if ($dbSessionVars['status'] < $rightLevels['cmd_whois_ip'])
! {
! $power = 'low';
! }
! else
! {
! $whoisDbLnk->query("SELECT COUNT(*) FROM " . C_RIGHT_TBL . " WHERE username = '$slashedWhoisTarget' AND right_level < " . $dbSessionVars['status']);
! list($isHigh) = $whoisDbLnk->nextRecord();
! $whoisDbLnk->cleanResults();
! $power = ($isHigh) ? 'high' : 'low';
! }
}
! // Registered user
! else if ($dbSessionVars['status'] > 0 && $rightLevels['cmd_whois_ip'] < 6)
{
! $whoisDbLnk->query("SELECT room, status FROM " . C_USR_TBL . " WHERE username = '$slashedWhoisTarget'");
! list($whoisTargetRoom, $whoisTargetStatus) = $whoisDbLnk->nextRecord();
$whoisDbLnk->cleanResults();
! // 1. Target user is chatting...
! if (!empty($whoisTargetRoom))
! {
! $whoisTargetRoom = pmcHandleMagicQuotes($firstname, '', '1', 'del');
! // 1.1 ... in the current room
! if ($dbSessionVars['currentRoom'] == $whoisTargetRoom)
! {
! $power = ($dbSessionVars['status'] >= $rightLevels['cmd_whois_ip'] && $dbSessionVars['status'] > $whoisTargetStatus)
! ? 'high'
! : 'low';
! }
! // 1.2 ... in an other room
! else
! {
! $toCheck = max($whoisTargetStatus + 0 , $rightLevels['cmd_whois_ip'] - 1);
! $whoisDbLnk->query("SELECT COUNT(*) FROM " . C_RIGHT_TBL . " WHERE username = '$slashedUser' AND room = '" . pmcSlashSingleQuotes($whoisTargetRoom) . "' AND right_level > " . $toCheck);
! list($isHigh) = $whoisDbLnk->nextRecord();
! $whoisDbLnk->cleanResults();
! $power = ($isHigh) ? 'high' : 'low';
! }
! }
! //2. Target user isn't chating
! else
! {
! if ($dbSessionVars['status'] < $rightLevels['cmd_whois_ip'])
! {
! $power = 'low';
! }
! else
! {
! $slashedCurrentRoom = pmcSlashSingleQuotes($dbSessionVars['currentRoom']);
! $whoisDbLnk->query("SELECT COUNT(*) FROM " . C_RIGHT_TBL . " WHERE username = '$slashedWhoisTarget' AND room = '$slashedCurrentRoom' AND right_level < " . $dbSessionVars['status']);
! list($isHigh) = $whoisDbLnk->nextRecord();
! $whoisDbLnk->cleanResults();
! $power = ($isHigh) ? 'high' : 'low';
! }
! }
}
! // Simple user
! else
{
! $power = 'low';
}
+
/**
* Get the target user profile and define his/her permission level
***************
*** 125,151 ****
$country = pmcHandleMagicQuotes($country, '', '1', 'del');
! $tagOpen = '';
! $tagClose = '';
! if ($whoisTargetPerms == 10) // administrator
! {
! $perms = '<i>' . L_WHOIS_ADMIN . '</i>';
! $tagOpen = '<i>';
! $tagClose = '</i>';
! // Do not allow moderators to see some of the administrator
! // informations (ip and e-mail)
! if ($power == 'medium')
! {
! $power = 'weak';
! }
! }
! else if ($whoisTargetPerms >= 5) // moderators
! {
! $perms = '<i>' . L_WHOIS_MODER . '</i>';
! $tagOpen = '<i>';
! $tagClose = '</i>';
! }
! else // simple user
{
! $perms = L_WHOIS_USER;
}
--- 179,217 ----
$country = pmcHandleMagicQuotes($country, '', '1', 'del');
! switch ($whoisTargetPerms)
{
! case 0:
! $perms = L_RIGHT_0;
! break;
! case 1:
! $perms = L_RIGHT_1;
! break;
! case 2:
! $perms = L_RIGHT_2;
! break;
! case 3:
! $perms = L_RIGHT_3;
! break;
! case 4:
! $perms = L_RIGHT_4;
! break;
! case 5:
! $perms = L_RIGHT_5;
! break;
! case 6:
! $perms = L_RIGHT_6;
! break;
! case 7:
! $perms = L_RIGHT_7;
! break;
! case 8:
! $perms = L_RIGHT_8;
! break;
! case 9:
! $perms = L_RIGHT_9;
! break;
! default:
! $perms = L_RIGHT_0;
! break;
}
***************
*** 194,198 ****
<p class="title">
! <?php echo($tagOpen . pmcSpecialChars($whoisTarget, $latin1) . $tagClose . "\n"); ?>
</p>
<p></p>
--- 260,264 ----
<p class="title">
! <?php echo(pmcSpecialChars($whoisTarget, $latin1) . "\n"); ?>
</p>
<p></p>
***************
*** 231,235 ****
echo("\n");
! if ($showemail || $power != 'weak')
{
?>
--- 297,301 ----
echo("\n");
! if ($showemail || $power == 'high')
{
?>
***************
*** 254,258 ****
echo("\n");
! if ($power != 'weak')
{
$ipProxyStr = '';
--- 320,324 ----
echo("\n");
! if ($power == 'high')
{
$ipProxyStr = '';
***************
*** 285,289 ****
<br />
! <span class="whois"><?php echo('> ' . $tagOpen . $perms . $tagClose . ' <'); ?></span>
</center>
--- 351,355 ----
<br />
! <span class="whois"><?php echo('> ' . $perms . ' <'); ?></span>
</center>
|