From: Lo?c C. <lo...@us...> - 2001-05-05 17:26:19
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat In directory usw-pr-cvs1:/tmp/cvs-serv25748/chat Added Files: admin.php3 Log Message: First draft of the administration sheets --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html | // +--------------------------------------------------------------------------+ // | This script displays the administration pages for phpMyChat. When it is | // | launched by the administrator, it runs once then calls itself twice | // | inside a frameset to display the administration menu ($whichFrame value | // | is 'top') and the body of the choosen sheet ($whichFrame value is | // | 'body'). | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <te...@ph...> | // +--------------------------------------------------------------------------+ // // $Id: admin.php3,v 1.1 2001/05/05 17:26:17 loic1 Exp $ // // Administration work for phpMyChat. // /** * Gets the extension to use 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'); /** * Includes some libraries */ require('./config/config.lib.' . C_EXTENSION); require('./lib/database/' . C_DB_TYPE . '.lib.' . C_EXTENSION); require('./lib/common.lib.' . C_EXTENSION); /** * Gets the names and values for variables sent or posted to this script * * Uses the 'pmcGrabGlobals()' and 'pmcHandleMagicQuotes()' function defined in * the 'chat/lib/common.lib.php3' library */ $toGrab = array('%GET', '%POST'); pmcGrabGlobals($toGrab); // Unslashes values of variables sent to this script if (!empty($authUsername)) $authUsername = pmcHandleMagicQuotes($authUsername, '1', '', 'del'); if (!empty($authPassword)) $authPassword = pmcHandleMagicQuotes($authPassword, '1', '', 'del'); if (!empty($submitType)) $submitType = pmcHandleMagicQuotes($submitType, '1', '', 'del'); /** * Start the session handler */ require('./lib/db_sessions.lib.' . C_EXTENSION); dbSessionInit( C_DB_TYPE, C_DB_HOST, C_DB_NAME, C_DB_USER, C_DB_PASS, C_SESS_TBL, C_SESS_DEL * 60, '' ); dbSessionStart(); /** * Checks for a convenient administration language file */ if (empty($whichFrame)) // Script is launched for the first time { // If no language name has been sent to this script, finds the language // of the user among existing translations if (!dbSessionIsRegistered('lang') || empty($dbSessionVars['lang'])) { include('./localization/languages.lib.' . C_EXTENSION); } include('./localization/' . $dbSessionVars['lang'] . '/chat.loc'); // If the administration pages haven't been translated into the language of // the user, retains some values and gets the name of the default language // for these pages if (!file_exists('./localization/' . $dbSessionVars['lang'] .'/admin.loc')) { include('./localization/admin.lib.' . C_EXTENSION); } else { $dbSessionVars['adminLang'] = $dbSessionVars['lang']; } } // end if (empty($whichFrame)) // Gets the convenient translation for the administration work require('./localization/' . $dbSessionVars['adminLang'] . '/admin.loc'); /** * Authentification work */ if (!(dbSessionIsRegistered('authUsername') && dbSessionIsRegistered('authPassword'))) { $mustBeAdmin = true; include('./lib/login.lib.' . C_EXTENSION); } /** * Sends HTTP headers * * Uses the pmcHttpHeaders() function defined in 'chat/lib/common.lib.php3' to * send no-cache and charset HTTP headers */ pmcHttpHeaders(A_CHARSET, true); /** * Sends the webpage */ // Update or set session datas if (dbSessionIsRegistered('adminDoOptimize')) { dbSessionUnregister('adminDoOptimize'); } if (isset($adminSheet) && ereg('[1-4]', $adminSheet)) { $dbSessionVars['adminSheet'] = $adminSheet; } if (isset($sortBy)) { $dbSessionVars['sortBy'] = $sortBy; } if (isset($sortOrder)) { $dbSessionVars['sortOrder'] = $sortOrder; } if (isset($offset)) { $dbSessionVars['offset'] = $offset; } // Load the frame when the $whichFrame var indicate one if (!empty($whichFrame)) { dbSessionSave(); include('./admin/admin_' . $whichFrame . '.' . C_EXTENSION); exit(); } // Else update the session data and display the frameset else { if (!dbSessionIsRegistered('adminFrom')) { $dbSessionVars['adminFrom'] = urlencode(basename($PHP_SELF)); $dbSessionVars['adminDoOptimize'] = true; $dbSessionVars['adminSheet'] = 1; $dbSessionVars['sortBy'] = 'username'; $dbSessionVars['sortOrder'] = 'ASC'; $dbSessionVars['offset'] = 0; } dbSessionSave(); // Defines some URLs $topUrl = $dbSessionVars['adminFrom'] . '?' . dbSessionSID('GET') . $pmcQueryArgSeparator . 'whichFrame=top'; $bodyUrl = $dbSessionVars['adminFrom'] . '?' . dbSessionSID('GET') . $pmcQueryArgSeparator . 'whichFrame=body'; $nsResizeUrl = $dbSessionVars['adminFrom'] . '?' . dbSessionSID('GET'); // Kill the db session handler associated to sessions $dbSessionDbLink->close(); unset($dbSessionDbLink); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd"> <html dir="<?php echo((A_CHARSET == 'windows-1256') ? 'rtl' : 'ltr'); ?>"> <head> <title><?php echo(APP_NAME); ?></title> </head> <frameset rows="50,*" frameborder="0" border="0" framespacing="0" onresize="if (typeof(document.layers) != 'undefined') window.location.replace('<?php echo($nsResizeUrl); ?>')"> <frame src="<?php echo($topUrl); ?>" name="admin_top" frameborder="0" border="0" framespacing="0" marginwidth="3" marginheight="3" scrolling="no" /> <frame src="<?php echo($bodyUrl); ?>" name="admin_body" frameborder="0" border="0" framespacing="0" marginwidth="0" marginheight="0" noresize="noresize" /> </frameset> </html> <?php } ?> |