"Fossies" - the Fresh Open Source Software Archive

Member "phpESP/admin/manage.php" (20 Nov 2008, 6475 Bytes) of package /linux/www/old/phpESP-2.1.4.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "manage.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3     /* $Id$ */
    4 
    5     /* vim: set tabstop=4 shiftwidth=4 expandtab: */
    6 
    7     // Written by James Flemer
    8     // For eGrad2000.com
    9     // <jflemer@alum.rpi.edu>
   10 
   11     if (!defined('ESP_BASE'))
   12     define('ESP_BASE', dirname(dirname(__FILE__)) .'/');
   13 
   14     $CONFIG = ESP_BASE . 'admin/phpESP.ini.php';
   15     $DEFAULT_CONFIG = $CONFIG.'.default';
   16     $FIXED_CONFIG = $CONFIG.'.fixed';
   17     if(!file_exists($DEFAULT_CONFIG)) {
   18         echo("<b>FATAL: Unable to open default config file. Aborting.</b>");
   19         exit;
   20     }
   21     if(!file_exists($CONFIG)) {
   22         echo("<b>FATAL: Unable to open config file admin/phpESP.ini.php. Aborting.</b><br />");
   23         echo("See admin/phpESP.ini.php.default for all options. A small example:<br />");
   24         print nl2br(htmlspecialchars(file_get_contents("phpESP.ini.php.example")));
   25         exit;
   26     }
   27     if(!file_exists($FIXED_CONFIG)) {
   28         echo("<b>FATAL: Unable to open fixed config file. Aborting.</b>");
   29         exit;
   30     }
   31     require_once($DEFAULT_CONFIG);
   32     require_once($CONFIG);
   33     // let's check for values that should not exist yet ...
   34     // if they already exist, the user is still using an old too-complete
   35     // config file
   36     if (isset($ESPCONFIG['question_table'] )) {
   37         echo("<b>FATAL: Fixed values found in main config $CONFIG.<br />Please make sure $CONFIG contains only the differences from $FIXED_CONFIG, nothing else. Aborting.</b>");
   38         exit;
   39     }
   40     require_once($FIXED_CONFIG);
   41 
   42     /* check if the basic config files haven't changed */
   43     check_checksum($DEFAULT_CONFIG);
   44     #check_checksum($FIXED_CONFIG);
   45 
   46     /* check for an unsupported web server configuration */
   47     if((in_array(php_sapi_name(), $ESPCONFIG['unsupported'])) and ($ESPCONFIG['auth_design']) and ($ESPCONFIG['auth_mode'] == 'basic')) {
   48         echo ('<b>FATAL: Your webserver is running PHP in an unsupported mode. Aborting.</b><br/>');
   49         echo ('<b>Please read <a href="http://phpesp.sf.net/cvs/docs/faq.html?rev=.&content-type=text/html#iunsupported">this</a> entry in the FAQ for more information</b>');
   50         exit;
   51     }
   52 
   53     /* now let's check if we have the extension needed to connect to the db */
   54     if(!extension_loaded($ESPCONFIG['adodb_database_type'])) {
   55         echo('<b>FATAL: Mysql extension not loaded. Aborting.</b>');
   56         exit;
   57     }
   58     
   59     esp_init_adodb();
   60 
   61     if(get_cfg_var('register_globals')) {
   62         $_SESSION['acl'] = &$acl;
   63     }
   64 
   65     $db_version = get_dbversion();
   66     $where = '';
   67     if (version_compare($db_version,"0.0.0","eq")) {
   68         $where="install";
   69     } elseif($ESPCONFIG['auth_design']) {
   70         if ($ESPCONFIG['auth_mode'] == 'basic') {
   71             $raw_password = @$_SERVER['PHP_AUTH_PW'];
   72             $username = @$_SERVER['PHP_AUTH_USER'];
   73         }
   74         elseif ($ESPCONFIG['auth_mode'] == 'form') {
   75             if (isset($_POST['Login'])) {
   76                 if (!isset($_POST['username'])) {
   77                     $username = "";
   78                 }
   79                 if ($_POST['username'] != "") {
   80                     $_SESSION['username'] = $_POST['username'];
   81                 }
   82                 if (!isset($_POST['password'])) {
   83                     $password = "";
   84                 }
   85                 if ($_POST['password'] != "") {
   86                     $_SESSION['raw_password'] = $_POST['password'];
   87                 }
   88             }
   89             if (isset($_SESSION['username'])) {
   90                 $username = $_SESSION['username'];
   91             }
   92             else {
   93                 $username = "";
   94             }
   95             if (isset($_SESSION['raw_password'])) {
   96                 $raw_password = $_SESSION['raw_password'];
   97             }
   98             else {
   99                 $raw_password = "";
  100             }
  101         }
  102         $password = _addslashes($raw_password);
  103         if(!manage_auth($username, $password, $raw_password))
  104         exit;
  105     } else {
  106         $_SESSION['acl'] = array (
  107             'username'  => 'none',
  108             'pdesign'   => array('none'),
  109             'pdata'     => array('none'),
  110             'pstatus'   => array('none'),
  111             'pall'      => array('none'),
  112             'pgroup'    => array('none'),
  113             'puser'     => array('none'),
  114             'superuser' => 'Y',
  115             'disabled'  => 'N'
  116         );
  117     }
  118 
  119     if(empty($where) && isset($_REQUEST['where']))
  120        $where = $_REQUEST['where'];
  121 
  122     if ($where == 'download') {
  123         include(esp_where($where));
  124         exit;
  125     }
  126 ?>
  127 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
  128 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  129 <html xmlns="http://www.w3.org/1999/xhtml">
  130 <head>
  131 <?php
  132     if(!empty($ESPCONFIG['charset'])) {
  133         echo('<meta http-equiv="Content-Type" content="text/html; charset='. $ESPCONFIG['charset'] ."\" />\n");
  134     }
  135     if(!empty($ESPCONFIG['favicon'])) {
  136         echo("<link rel=\"shortcut icon\" href=\"" . $ESPCONFIG['favicon'] . "\" />\n");
  137     }
  138     if(!empty($ESPCONFIG['style_sheet'])) {
  139         echo("<link href=\"". $ESPCONFIG['style_sheet'] ."\" rel=\"stylesheet\" type=\"text/css\" />\n");
  140     }
  141 ?>
  142     <title><?php echo($ESPCONFIG['title']); ?></title>
  143     <script type="text/javascript" src="<?php echo($ESPCONFIG['js_url']);?>default.js"></script>
  144     <script type="text/javascript">
  145       var activateConfirmMsg="<?php echo(_('Warning! Once activated, this survey can no longer be edited.  Any further changes must be done on a copy.')); ?>";
  146       var cancelConfirmMsg="<?php echo(_('Warning! This survey has not been saved.  Canceling now will remove any changes.')); ?>";
  147       var mergeMsg="<h2><?php echo(_('You must select at least two surveys before you can merge')); ?></h2>";
  148     </script>
  149 </head>
  150 <body>
  151  <?php
  152     /* Moved to Stylesheet
  153     *
  154     *echo('bgcolor="'. $ESPCONFIG['main_bgcolor'] .'"');
  155     *if(!empty($ESPCONFIG['link_color']))  echo(' link="'.  $ESPCONFIG['link_color']  .'"');
  156     *if(!empty($ESPCONFIG['vlink_color'])) echo(' vlink="'. $ESPCONFIG['vlink_color'] .'"');
  157     *if(!empty($ESPCONFIG['alink_color'])) echo(' alink="'. $ESPCONFIG['alink_color'] .'"'); 
  158     */
  159 
  160     if($ESPCONFIG['DEBUG']) {
  161         include($ESPCONFIG['include_path']."/debug".$ESPCONFIG['extension']);
  162     }
  163 
  164     if(file_exists($ESPCONFIG['include_path']."/head".$ESPCONFIG['extension']))
  165         include($ESPCONFIG['include_path']."/head".$ESPCONFIG['extension']);
  166 
  167     include(esp_where($where));
  168 
  169     if(file_exists($ESPCONFIG['include_path']."/foot".$ESPCONFIG['extension']))
  170         include($ESPCONFIG['include_path']."/foot".$ESPCONFIG['extension']);
  171 
  172 ?>
  173 </body>
  174 </html>