Permalink
Browse files

autoloader structural changes

  • Loading branch information...
1 parent 68cb979 commit 22e24781e9265d7ad810c32623627cdb86657c45 @haraldpdl haraldpdl committed Apr 3, 2010
Showing 840 changed files with 3,956 additions and 2,554 deletions.
@@ -1,33 +0,0 @@
-# $Id$
-#
-# This is used with Apache WebServers
-#
-# For this to work, you must include the parameter 'Options' to
-# the AllowOverride configuration
-#
-# Example:
-#
-# <Directory "/usr/local/apache/htdocs">
-# AllowOverride Options
-# </Directory>
-#
-# 'All' with also work. (This configuration is in the
-# apache/conf/httpd.conf file)
-
-# The following makes adjustments to the SSL protocol for Internet
-# Explorer browsers
-
-<IfModule mod_setenvif.c>
- <IfDefine SSL>
- SetEnvIf User-Agent ".*MSIE.*" \
- nokeepalive ssl-unclean-shutdown \
- downgrade-1.0 force-response-1.0
- </IfDefine>
-</IfModule>
-
-# Fix certain PHP values
-
-#<IfModule mod_php4.c>
-# php_value session.use_trans_sid 0
-# php_value register_globals 1
-#</IfModule>
@@ -0,0 +1,84 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ define('OSC_IN_ADMIN', true);
+
+ require(OSCOM::BASE_DIRECTORY . 'sites/Admin/includes/functions/general.php');
+ require(OSCOM::BASE_DIRECTORY . 'sites/Admin/includes/functions/html_output.php');
+ require(OSCOM::BASE_DIRECTORY . 'sites/Admin/classes/access.php');
+ require(OSCOM::BASE_DIRECTORY . 'sites/Admin/includes/functions/localization.php');
+ require(OSCOM::BASE_DIRECTORY . 'classes/object_info.php');
+
+ class OSCOM_Admin extends OSCOM_SiteAbstract {
+ protected static $_default_application = 'Index';
+ protected static $_guest_applications = array('Index', 'Login');
+
+ public static function initialize() {
+ OSCOM_Registry::set('MessageStack', new OSCOM_Site_Admin_MessageStack(), true); // initialize before session due to register_shutdown_function
+
+ OSCOM_Registry::set('Session', OSCOM_Session::load('adminSid'));
+ OSCOM_Registry::get('Session')->start();
+
+ OSCOM_Registry::get('MessageStack')->loadFromSession();
+
+ if ( !isset($_SESSION['admin']) ) {
+ $redirect = false;
+
+ if ( OSCOM::getSiteApplication() != 'Login' ) {
+ if ( !isset($_SESSION['redirect_origin']) ) {
+ $_SESSION['redirect_origin'] = OSCOM::getSiteApplication();
+ }
+
+ $redirect = true;
+ }
+
+ if ( $redirect === true ) {
+ osc_redirect_admin(OSCOM::getLink(OSCOM::getSite(), 'Login'));
+ }
+
+ unset($redirect);
+ }
+
+ OSCOM_Registry::set('osC_Language', new OSCOM_Site_Admin_Language());
+
+ $_SESSION['module'] = OSCOM::getSiteApplication(); // HPDL to delete; use OSCOM::getSiteApplication()
+ if ( !osC_Access::hasAccess(OSCOM::getSiteApplication()) ) {
+ OSCOM_Registry::get('MessageStack')->add('header', 'No access.', 'error');
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+
+ $application = 'OSCOM_Site_' . OSCOM::getSite() . '_Application_' . OSCOM::getSiteApplication();
+ OSCOM_Registry::set('Application', new $application());
+
+ OSCOM_Registry::set('osC_Template', new OSCOM_Site_Admin_Template());
+ OSCOM_Registry::get('osC_Template')->setApplication(OSCOM_Registry::get('Application'));
+
+// HPDL move following checks elsewhere
+// check if a default currency is set
+ if (!defined('DEFAULT_CURRENCY')) {
+ OSCOM_Registry::get('MessageStack')->add('header', __('ms_error_no_default_currency'), 'error');
+ }
+
+// check if a default language is set
+ if (!defined('DEFAULT_LANGUAGE')) {
+ OSCOM_Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
+ }
+
+ if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
+ OSCOM_Registry::get('MessageStack')->add('header', __('ms_warning_uploads_disabled'), 'warning');
+ }
+ }
+
+ public static function getGuestApplications() {
+ return self::$_guest_applications;
+ }
+ }
+?>
@@ -0,0 +1,16 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ class OSCOM_Site_Admin_Application_Administrators extends OSCOM_Site_Admin_ApplicationAbstract {
+ protected function initialize() {
+ $this->_page_title = __('heading_title');
+ }
+ }
+?>
@@ -0,0 +1,37 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ class OSCOM_Site_Admin_Application_Administrators_Action_BatchDelete {
+ public function execute(OSCOM_ApplicationAbstract $application) {
+ if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
+ $application->setPageContent('batch_delete.php');
+
+ if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
+ $error = false;
+
+ foreach ( $_POST['batch'] as $id ) {
+ if ( !OSCOM_Site_Admin_Application_Administrators_Administrators::delete($id) ) {
+ $error = true;
+ break;
+ }
+ }
+
+ if ( $error === false ) {
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_success_action_performed'), 'success');
+ } else {
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+ }
+ }
+?>
@@ -1,47 +1,39 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2009 osCommerce
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
- class osC_Application_Administrators_Actions_batch_save extends osC_Application_Administrators {
- public function __construct() {
- global $osC_Language, $osC_MessageStack;
-
- parent::__construct();
-
+ class OSCOM_Site_Admin_Application_Administrators_Action_BatchSave {
+ public function execute(OSCOM_ApplicationAbstract $application) {
if ( isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch']) ) {
- $this->_page_contents = 'batch_edit.php';
+ $application->setPageContent('batch_edit.php');
if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
$error = false;
foreach ( $_POST['batch'] as $id ) {
- if ( !osC_Administrators_Admin::setAccessLevels($id, $_POST['modules'], $_POST['mode']) ) {
+ if ( !OSCOM_Site_Admin_Application_Administrators_Administrators::setAccessLevels($id, $_POST['modules'], $_POST['mode']) ) {
$error = true;
break;
}
}
if ( $error === false ) {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_success_action_performed'), 'success');
if ( in_array($_SESSION['admin']['id'], $_POST['batch']) ) {
$_SESSION['admin']['access'] = osC_Access::getUserLevels($_SESSION['admin']['id']);
}
} else {
- $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_error_action_not_performed'), 'error');
}
- osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
+ osc_redirect_admin(OSCOM::getLink());
}
}
}
@@ -0,0 +1,26 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ class OSCOM_Site_Admin_Application_Administrators_Action_Delete {
+ public function execute(OSCOM_ApplicationAbstract $application) {
+ $application->setPageContent('delete.php');
+
+ if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
+ if ( OSCOM_Site_Admin_Application_Administrators_Administrators::delete($_GET['id']) ) {
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_success_action_performed'), 'success');
+ } else {
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_error_action_not_performed'), 'error');
+ }
+
+ osc_redirect_admin(OSCOM::getLink());
+ }
+ }
+ }
+?>
@@ -0,0 +1,50 @@
+<?php
+/*
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License v2 (1991)
+ as published by the Free Software Foundation.
+*/
+
+ class OSCOM_Site_Admin_Application_Administrators_Action_Save {
+ public function execute(OSCOM_ApplicationAbstract $application) {
+ if ( isset($_GET['id']) && is_numeric($_GET['id']) ) {
+ $application->setPageContent('edit.php');
+ } else {
+ $application->setPageContent('new.php');
+ }
+
+ if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
+ $data = array('username' => $_POST['user_name'],
+ 'password' => $_POST['user_password']);
+
+ switch ( OSCOM_Site_Admin_Application_Administrators_Administrators::save((isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null), $data, (isset($_POST['modules']) ? $_POST['modules'] : null)) ) {
+ case 1:
+ if ( isset($_GET['id']) && is_numeric($_GET['id']) && ($_GET['id'] == $_SESSION['admin']['id']) ) {
+ $_SESSION['admin']['access'] = osC_Access::getUserLevels($_GET['id']);
+ }
+
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_success_action_performed'), 'success');
+
+ osc_redirect_admin(OSCOM::getLink());
+
+ break;
+
+ case -1:
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_error_action_not_performed'), 'error');
+
+ osc_redirect_admin(OSCOM::getLink());
+
+ break;
+
+ case -2:
+ OSCOM_Registry::get('MessageStack')->add(null, __('ms_error_username_already_exists'), 'error');
+
+ break;
+ }
+ }
+ }
+ }
+?>
@@ -1,18 +1,14 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2009 osCommerce
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
- class osC_Administrators_Admin {
+ class OSCOM_Site_Admin_Application_Administrators_Administrators {
const ACCESS_MODE_ADD = 'add';
const ACCESS_MODE_SET = 'set';
const ACCESS_MODE_REMOVE = 'remove';
@@ -319,7 +315,7 @@ public static function setAccessLevels($id, $modules, $mode = self::ACCESS_MODE_
public static function getAccessModules() {
global $osC_Language;
- $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
+ $osC_DirectoryListing = new OSCOM_DirectoryListing(OSCOM::BASE_DIRECTORY . 'sites/' . OSCOM::getSite() . '/modules/Access');
$osC_DirectoryListing->setIncludeDirectories(false);
$modules = array();
@@ -1,20 +1,14 @@
<?php
/*
- $Id: $
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2009 osCommerce
+ osCommerce Online Merchant $osCommerce-SIG$
+ Copyright (c) 2010 osCommerce (http://www.oscommerce.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
- require('includes/applications/administrators/classes/administrators.php');
-
- class osC_Administrators_Admin_rpc {
+ class OSCOM_Site_Admin_Application_Administrators_RPC {
public static function getAll() {
if ( !isset($_GET['search']) ) {
$_GET['search'] = '';
@@ -25,9 +19,9 @@ public static function getAll() {
}
if ( !empty($_GET['search']) ) {
- $result = osC_Administrators_Admin::find($_GET['search'], $_GET['page']);
+ $result = OSCOM_Site_Admin_Application_Administrators_Administrators::find($_GET['search'], $_GET['page']);
} else {
- $result = osC_Administrators_Admin::getAll($_GET['page']);
+ $result = OSCOM_Site_Admin_Application_Administrators_Administrators::getAll($_GET['page']);
}
$result['rpcStatus'] = RPC_STATUS_SUCCESS;
Oops, something went wrong.

0 comments on commit 22e2478

Please sign in to comment.