Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

1850
 
1851
 
1851
 
administrators.php
_> 11 <?php
  22 /*
<> 3 -  $Id: administrators.php 1850 2009-02-28 03:07:56Z hpdl $
   3+  $Id: administrators.php 1851 2009-02-28 03:08:07Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
  77 
<> 8 -  Copyright (c) 2007 osCommerce
   8+  Copyright (c) 2009 osCommerce
99 
  1010   This program is free software; you can redistribute it and/or modify
  1111   it under the terms of the GNU General Public License v2 (1991)
  1212   as published by the Free Software Foundation.
  1313 */
  1414 
<> 15 -  require('includes/classes/administrators.php');
   15+  require('includes/applications/administrators/classes/administrators.php');
1616 
<> 17 -  class osC_Content_Administrators extends osC_Template {
   17+  class osC_Application_Administrators extends osC_Template_Admin {
1818 
<> 19 -/* Private variables */
   19+/* Protected variables */
2020 
<> 21 -    var $_module = 'administrators',
  22 -        $_page_title,
  23 -        $_page_contents = 'main.php';
   21+    protected $_module = 'administrators',
   22+              $_page_title,
   23+              $_page_contents = 'main.php';
2424 
  2525 /* Class constructor */
  2626 
<> 27 -    function osC_Content_Administrators() {
   27+    public function __construct() {
2828       global $osC_Language,$osC_MessageStack;
  2929 
  3030       $this->_page_title = $osC_Language->get('heading_title');
<> 31 -
  32 -      if (!isset($_GET['action'])) {
  33 -        $_GET['action'] = '';
  34 -      }
  35 -
  36 -      if (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page']))) {
  37 -        $_GET['page'] = 1;
  38 -      }
  39 -
  40 -      if (!empty($_GET['action'])) {
  41 -        switch ($_GET['action']) {
  42 -          case 'save':
  43 -            if ( isset($_GET['aID']) && is_numeric($_GET['aID']) ) {
  44 -              $this->_page_contents = 'edit.php';
  45 -            } else {
  46 -              $this->_page_contents = 'new.php';
  47 -            }
  48 -
  49 -            if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
  50 -              $data = array('username' => $_POST['user_name'],
  51 -                            'password' => $_POST['user_password']);
  52 -
  53 -              switch ( osC_Administrators_Admin::save((isset($_GET['aID']) && is_numeric($_GET['aID']) ? $_GET['aID'] : null), $data, (isset($_POST['modules']) ? $_POST['modules'] : null)) ) {
  54 -                case 1:
  55 -                  if ( isset($_GET['aID']) && is_numeric($_GET['aID']) && ($_GET['aID'] == $_SESSION['admin']['id']) ) {
  56 -                    $_SESSION['admin']['access'] = osC_Access::getUserLevels($_GET['aID']);
  57 -                  }
  58 -
  59 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
  60 -
  61 -                  osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page']));
  62 -
  63 -                  break;
  64 -
  65 -                case -1:
  66 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
  67 -
  68 -                  osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page']));
  69 -
  70 -                  break;
  71 -
  72 -                case -2:
  73 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_username_already_exists'), 'error');
  74 -
  75 -                  break;
  76 -              }
  77 -            }
  78 -
  79 -            break;
  80 -
  81 -          case 'delete':
  82 -            $this->_page_contents = 'delete.php';
  83 -
  84 -            if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
  85 -              if ( osC_Administrators_Admin::delete($_GET['aID']) ) {
  86 -                $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
  87 -              } else {
  88 -                $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
  89 -              }
  90 -
  91 -              osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page']));
  92 -            }
  93 -
  94 -            break;
  95 -
  96 -          case 'batchSave':
  97 -            if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
  98 -              $this->_page_contents = 'batch_edit.php';
  99 -
  100 -              if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
  101 -                $error = false;
  102 -
  103 -                foreach ($_POST['batch'] as $id) {
  104 -                  if ( !osC_Administrators_Admin::setAccessLevels($id, $_POST['modules'], $_POST['mode']) ) {
  105 -                    $error = true;
  106 -                    break;
  107 -                  }
  108 -                }
  109 -
  110 -                if ( $error === false ) {
  111 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
  112 -
  113 -                  if ( in_array($_SESSION['admin']['id'], $_POST['batch']) ) {
  114 -                    $_SESSION['admin']['access'] = osC_Access::getUserLevels($_SESSION['admin']['id']);
  115 -                  }
  116 -                } else {
  117 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
  118 -                }
  119 -
  120 -                osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page']));
  121 -              }
  122 -            }
  123 -
  124 -            break;
  125 -
  126 -          case 'batchDelete':
  127 -            if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
  128 -              $this->_page_contents = 'batch_delete.php';
  129 -
  130 -              if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
  131 -                $error = false;
  132 -
  133 -                foreach ($_POST['batch'] as $id) {
  134 -                  if ( !osC_Administrators_Admin::delete($id) ) {
  135 -                    $error = true;
  136 -                    break;
  137 -                  }
  138 -                }
  139 -
  140 -                if ( $error === false ) {
  141 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
  142 -                } else {
  143 -                  $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
  144 -                }
  145 -
  146 -                osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module . '&page=' . $_GET['page']));
  147 -              }
  148 -            }
  149 -
  150 -            break;
  151 -        }
  152 -      }
<_ 15331     }
  15432   }
  15533 ?>