[ PHPXref.com ] [ Generated: Sun Jul 20 20:18:29 2008 ] [ Siteframe 5.0.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> admin.php (source)

   1  <?php
   2  // $Id: admin.php,v 1.12 2005/12/21 22:59:16 glen Exp $
   3  // Copyright (c)2005, Glen Campbell. All rights reserved.
   4  
   5  require_once  'siteframe.inc';
   6  require config('dir_includes')."/dbfunc.inc";
   7  
   8  // are we logged on?
   9  if (!is_object($_SESSION['user']))
  10  {
  11      header(sprintf(
  12          'Location: %s/login.php?rd=%s',
  13          config('site_url'),
  14          urlencode($_SERVER['REQUEST_URI'])
  15      ));
  16      exit;
  17  }
  18  
  19  // are we an administrator
  20  if (!$_SESSION['user']->get('user_admin'))
  21  {
  22      //abort("No cookie for you! Only administrators can use this page.");
  23      $PAGE->assign('error', lang('err_notadmin'));
  24      $PAGE->display();
  25      exit;
  26  }
  27  
  28  // set the page title
  29  $PAGE->assign('page_title', lang('page_title_admin'));
  30  
  31  // if module= is set, then load the corresponding module
  32  if (isset($_GET['module']))
  33  {
  34      require "admin/".basename($_GET['module']);
  35      if (isset($TEMPLATES[basename($_GET['module'])]))
  36      {
  37          $out = $PAGE->fetch($TEMPLATES[basename($_GET['module'])]);
  38          $PAGE->assign('admin_content', $out);
  39      }
  40  }
  41  else    // construct a menu
  42  {
  43      foreach(glob("admin/*.inc") as $filename)
  44      {
  45          $module = basename($filename);
  46          $string = file_get_contents($filename);
  47          preg_match('/MODULE\(([^)]+)\)/', $string, $match);
  48          $selection[$module] = $match[1];
  49      }
  50      $out = "<ul>\n";
  51      foreach($selection as $module => $title)
  52          $out .= sprintf(
  53              '<li><a href="%s/admin.php?module=%s">%s</a></li>'."\n",
  54              config('site_path'),
  55              $module,
  56              $title
  57          );
  58      $out .= "</ul>\n";
  59      $PAGE->assign('admin_content', $out);
  60  }
  61  
  62  $PAGE->display();
  63  
  64  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]