From: Lo?c C. <lo...@us...> - 2001-04-04 23:52:40
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat In directory usw-pr-cvs1:/tmp/cvs-serv23458 Added Files: whois_popup.php3 Log Message: First working commands :) --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This script defines the 'whois' popups that are used to display users' | // | profiles. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: whois_popup.php3,v 1.1 2001/04/04 23:52:33 loic1 Exp $ // // The 'whois' popups. // /** * Gets the extension for the php scripts */ if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; define('C_EXTENSION', (substr($PHP_SELF, -1) == 3) ? 'php3' : 'php'); /** * Gets some core libraries */ require('./config/config.lib.' . C_EXTENSION); require('./lib/common.lib.' . C_EXTENSION); require('./lib/database/' . C_DB_TYPE . '.lib.' . C_EXTENSION); require('./lib/clean.lib.' . C_EXTENSION); /** * Gets the values of variables sent or posted to this script * * Uses the 'pmcGrabGlobals()' and the 'pmcHandleMagicQuotes()' functions * defined in the 'chat/lib/common.lib.php3' library. */ pmcGrabGlobals('%GET'); $slashedWhoisTarget = pmcHandleMagicQuotes($whoisTarget, '0', '', 'add'); /** * Start the session handler */ require('./lib/db_sessions.lib.' . C_EXTENSION); dbSessionInitIt( C_DB_TYPE, C_DB_HOST, C_DB_NAME, C_DB_USER, C_DB_PASS, C_SESS_TBL, C_REG_DEL, C_SESS_DEL * 60 ); dbSessionstart(); /** * Defines the language to be used */ require('./localization/' . $dbSessionVars['lang'] . '/localized.chat.' . C_EXTENSION); /** * Sends HTTP headers * * The 'pmcHttpHeaders()' fonction is defined in the 'chat/lib/common.lib.php3' * library */ pmcHttpHeaders(L_CHARSET, false); /** * Define the level of information the current user is allowed to see */ switch ($dbSessionVars['status']) { case 'a': // administrator $power = 'high'; break; case 'm': // moderator $power = 'medium'; break; default: $power = 'weak'; } // end switch /** * Get the target user profile and define his/her permission level * * Uses the 'pmcIsInto()' and the 'pmcHandleMagicQuotes()' functions * defined in the 'chat/lib/common.lib.php3' library. */ $whoisDbLnk = new pmcDB; $whoisDbLnk->query("SELECT latin1, firstname, lastname, country, website, email, showemail, perms, rooms, ip, gender FROM " . C_REG_TBL . " WHERE username='$slashedWhoisTarget' LIMIT 1"); list($latin1, $firstname, $lastname, $country, $website, $email, $showemail, $perms, $rooms, $ip, $gender) = $whoisDbLnk->nextRecord(); $whoisDbLnk->cleanResults(); $whoisDbLnk->close(); $firstname = pmcHandleMagicQuotes($firstname, '', '1', 'del'); $lastname = pmcHandleMagicQuotes($lastname, '', '1', 'del'); $country = pmcHandleMagicQuotes($country, '', '1', 'del'); $rooms = pmcHandleMagicQuotes($rooms, '', '1', 'del'); $tagOpen = ''; $tagClose = ''; switch ($perms) { case 'admin': $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'; break; case 'moderator': if (pmcIsInto($dbSessionVars['targetRoom'], $rooms) > 0) { $perms = '<i>' . L_WHOIS_MODER . '</i>'; $tagOpen = '<i>'; $tagClose = '</i>'; } else $perms = L_WHOIS_USER; break; default: $perms = L_WHOIS_USER; } // end switch /** * Displays the frame * * Uses the 'pmcUrlForStyleSheet()' and the 'pmcSpecialChars()' functions from * the 'chat/lib/common.lib.php3' library */ // The url for the style sheet $cssUrl = pmcUrlForStyleSheet('style', L_CHARSET, (defined('L_FONT_NAME')) ? L_FONT_NAME : '', L_FONT_SIZE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html dir="<?php echo((L_CHARSET == 'windows-1256') ? 'rtl' : 'ltr'); ?>"> <head> <title><?php echo(pmcSpecialChars($slashedWhoisTarget, $latin1)); ?></title> <link rel="stylesheet" href="<?php echo($cssUrl); ?>" type="text/css" /> <script type="text/javascript" language="javascript1.1"> <!-- // Put the focus at the message box in the input frame function putFocus() { if (typeof(window.opener) == 'undefined') return false; if (window.opener.window.document.title == 'Handle input hidden frame') targetFrame = window.opener.window.parent.frames['input'].window; else targetFrame = window.opener.window; with (targetFrame) { focus(); if (document.forms['inputForm'] && document.forms['inputForm'].elements['message']) document.forms['inputForm'].elements['message'].focus(); } } // --> </script> </head> <body class="frame" onunload="putFocus()"> <center> <p class="title"> <?php echo($tagOpen . pmcSpecialChars($slashedWhoisTarget, $latin1) . $tagClose . "\n"); ?> </p> <p></p> <table border="0"> <tr> <td class="whois" nowrap="nowrap"><?php echo(L_REG_30); ?>: </td> <td class="whois" nowrap="nowrap"><?php echo(pmcSpecialChars($firstname, $latin1)); ?></td> </tr> <tr> <td class="whois" nowrap="nowrap"><?php echo(L_REG_31); ?>: </td> <td class="whois" nowrap="nowrap"><?php echo(pmcSpecialChars($lastname, $latin1)); ?></td> </tr> <?php if ($gender) { $gender = ($gender == 1) ? L_REG_46 : L_REG_47; ?> <tr> <td class="whois" nowrap="nowrap"><?php echo(L_REG_45); ?>: </td> <td class="whois" nowrap="nowrap"><?php echo($gender); ?></td> </tr> <?php } echo("\n"); if ($country) { ?> <tr> <td class="whois" nowrap="nowrap"><?php echo(L_REG_36); ?>: </td> <td class="whois" nowrap="nowrap"><?php echo(pmcSpecialChars($country, $latin1)); ?></td> </tr> <?php } echo("\n"); if ($showemail || $power != 'weak') { ?> <tr> <td class="whois" nowrap="nowrap">e-mail: </td> <td nowrap="nowrap"><a href="mailto:<?php echo($email); ?>"><?php echo($email); ?></a></td> </tr> <?php } echo("\n"); if ($website) { $prefix = (strpos($website,"://")) ? '' : 'http://'; ?> <tr> <td class="whois" nowrap="nowrap"><?php echo(L_REG_32); ?>: </td> <td nowrap="nowrap"><a href="<?php echo($prefix . urlencode(str_replace('javascript:', '', $website))); ?>" target="_blank"><?php echo($prefix . $website); ?></a></td> </tr> <? } echo("\n"); if ($power != 'weak') { if (substr($ip, 0, 1) == 'p') $ip = substr($ip, 1) . ' (proxy)'; ?> <tr> <td class="whois" nowrap="nowrap">IP: </td> <td class="whois" nowrap="nowrap"><?php echo($ip); ?></td> </tr> <?php } echo("\n"); ?> </table> <br /> <span class="whois"><?php echo('> ' . $tagOpen . $perms . $tagClose . ' <'); ?></span> </center> </body> </html> <?php ?> |