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

title

Body

[close]

/ -> delete.php (source)

   1  <?php
   2  // $Id: delete.php,v 1.9 2005/12/02 05:09:24 glen Exp $
   3  // Copyright (c)2005, Glen Campbell. All rights reserved.
   4  
   5  require_once  'siteframe.inc';
   6  
   7  $PAGE->assign('page_title', lang('page_title_delete'));
   8  
   9  if (!isset($_GET['c']))
  10  {
  11      $PAGE->assign('error', lang('err_badqstring'));
  12      $PAGE->display();
  13      exit;
  14  }
  15  
  16  // create a new object
  17  $class = $_GET['c'];
  18  $obj = new $class($_GET['id']);
  19  
  20  $PAGE->assign('page_title', lang('page_title_delete').' '.lang("class_$class"));
  21  
  22  // are we authorized?
  23  if (!$obj->authorized())
  24      $PAGE->assign('error', lang('err_notauth'));
  25  else if ($_POST['_submitted'])
  26  {
  27      $obj->delete();
  28      if ($obj->is_valid())
  29      {
  30          if ($_POST['r'] != '')
  31          {
  32              header('Location: '.$_POST['r']);
  33              exit;
  34          }
  35          $PAGE->assign('error', lang('msg_deleted'));
  36      }
  37      else
  38          $PAGE->assign('error', $obj->get_errors());
  39      $PAGE->display();
  40      exit;
  41  }
  42  else
  43  {
  44      $inf = new InputForm(
  45          'delete',
  46          $obj->get_delete_url(),
  47          'post',
  48          lang('delete')
  49      );
  50      $inf->add_item('obj_id', array(
  51          'type' => 'number',
  52          'hidden' => true,
  53          'value' => $obj->id(),
  54      ));
  55      $inf->add_item('obj_title', array(
  56          'type' => 'text',
  57          'size' => 40,
  58          'disabled' => true,
  59          'value' => $obj->get_title(),
  60          'prompt' => lang($class),
  61      ));
  62      $inf->add_item('r', array(
  63          'type' => 'text',
  64          'hidden' => true,
  65          'value' => $_GET['r']
  66      ));
  67      $PAGE->assign('edit_form', $inf->get_form());
  68  }
  69  
  70  $PAGE->assign('help_text', lang('help_delete'));
  71  $PAGE->assign('class', $class);
  72  $PAGE->display();
  73  ?>


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