Skip to content

Commit

Permalink
A large, but relatively minor update to remove unnecessary PHP4 glue …
Browse files Browse the repository at this point in the history
…code which used a conditional check to do something PHP5 already does. Primarily all the old subsytems and the forms/controls had this old sytle code. This method is no longer necessary, hence the purpose of the include_once/require_once.

[exponentcms#261 state:resolved milestone:'Release Candidate 2']
  • Loading branch information
dleffler committed Aug 1, 2011
1 parent aaee8b9 commit 1892bac
Show file tree
Hide file tree
Showing 170 changed files with 616 additions and 388 deletions.
9 changes: 6 additions & 3 deletions cron/send_reminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@
// $viewparams = array("type"=>"byday", "range"=>"week");
// }

if (!defined("SYS_DATETIME")) include_once(BASE . "subsystems/datetime.php");
if (!defined('SYS_SORTING')) include_once(BASE . 'subsystems/sorting.php');
//if (!defined("SYS_DATETIME")) include_once(BASE . "subsystems/datetime.php");
include_once(BASE . "subsystems/datetime.php");
//if (!defined('SYS_SORTING')) include_once(BASE . 'subsystems/sorting.php');
include_once(BASE . 'subsystems/sorting.php');

if (!function_exists("exponent_sorting_byEventStartAscending")) {
function exponent_sorting_byEventStartAscending($a,$b) {
Expand Down Expand Up @@ -394,7 +396,8 @@ function exponent_sorting_byEventStartAscending($a,$b) {
"From"=>$from = $config->email_from_reminder,
"Reply-to"=>$reply = $config->email_reply_reminder
);
if (!defined("SYS_USERS")) require_once(BASE . "subsystems/users.php");
//if (!defined("SYS_USERS")) require_once(BASE . "subsystems/users.php");
require_once(BASE . "subsystems/users.php");

// set up the html message
$template->assign("showdetail",$config->email_showdetail);
Expand Down
13 changes: 8 additions & 5 deletions datatypes/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ static function form($object) {

$i18n = exponent_lang_loadFile('datatypes/calendar.php');

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down Expand Up @@ -75,7 +76,8 @@ static function form($object) {
$template = new template('calendarmodule','_recur_dates');
global $db;
$eventdates = $db->selectObjects('eventdate','event_id='.$object->id);
if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
// if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
require_once(BASE.'subsystems/sorting.php');
if (!function_exists('exponent_sorting_byDateAscending')) {
function exponent_sorting_byDateAscending($a,$b) {
return ($a->date > $b->date ? 1 : -1);
Expand Down Expand Up @@ -103,8 +105,9 @@ function exponent_sorting_byDateAscending($a,$b) {
}

static function update($values,$object) {
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$object->title = $values['title'];

Expand Down
5 changes: 3 additions & 2 deletions datatypes/calendarmodule_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class calendarmodule_config {
function form($object) {
$i18n = exponent_lang_loadFile('datatypes/calendarmodule_config.php');

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

global $db;
$tag_collections = $db->selectObjects("tag_collections");
Expand Down
5 changes: 3 additions & 2 deletions datatypes/database_importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ function form() {

exponent_lang_loadDictionary('modules','database');

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
//Form is created to collect information from the user
Expand Down
5 changes: 3 additions & 2 deletions datatypes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class file {
static function update($name,$dest,$object,$destname = null,$force=false) {
$i18n = exponent_lang_loadFile('datatypes/file.php');

if (!defined('SYS_FILES')) include_once(BASE.'subsystems/files.php');

// if (!defined('SYS_FILES')) include_once(BASE.'subsystems/files.php');
include_once(BASE.'subsystems/files.php');

// Get the filename, if it was passed in the update() call. Otherwise, fallback
if ($destname == null) {
$object->filename = $_FILES[$name]['name'];
Expand Down
5 changes: 3 additions & 2 deletions datatypes/file_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class file_collection {
function form($object) {
$i18n = exponent_lang_loadFile('datatypes/file_collection.php');

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down
13 changes: 8 additions & 5 deletions datatypes/formbuilder_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ static function form($object) {
$i18n = exponent_lang_loadFile('datatypes/formbuilder_form.php');

global $db;
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
if (!defined('SYS_USERS')) require_once(BASE.'subsystems/users.php');
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
// if (!defined('SYS_USERS')) require_once(BASE.'subsystems/users.php');
require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/users.php');
//global $user;
exponent_forms_initialize();
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down Expand Up @@ -125,8 +127,9 @@ static function update($values,$object) {
static function updateTable($object) {
global $db;

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();
if ($object->is_saved == 1) {
$datadef = array(
'id'=>array(
Expand Down
10 changes: 6 additions & 4 deletions datatypes/formbuilder_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ static function form($object) {
$i18n = exponent_lang_loadFile('datatypes/formbuilder_report.php');

global $db;
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down Expand Up @@ -77,8 +78,9 @@ static function form($object) {
}

static function update($values, $object) {
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();
$object->name = $values['name'];
$object->description = $values['description'];
$object->text = htmleditorcontrol::parseData('text',$values);
Expand Down
5 changes: 3 additions & 2 deletions datatypes/poll_answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@

class poll_answer {
static function form($object) {
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down
5 changes: 3 additions & 2 deletions datatypes/poll_question.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@

class poll_question {
static function form($object) {
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down
31 changes: 19 additions & 12 deletions datatypes/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function _commonForm(&$object) {
if (count($sections) && $object->parent >= 0) {
// Initialize the sorting subsystem so that we can order the sections
// by rank, ascending, and get the proper ordering.
if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
// if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
require_once(BASE.'subsystems/sorting.php');
usort($sections,'exponent_sorting_byRankAscending');

// Generate the Position dropdown array.
Expand Down Expand Up @@ -107,8 +108,9 @@ static function moveStandaloneForm($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section.php');

// Initialize the forms subsystem for use.
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = section::_commonForm($object);
// the name and sef_name are already set in the stand-alone page
Expand All @@ -121,7 +123,8 @@ static function moveStandaloneForm($object = null) {
$standalones[$s->id] = $s->name;
}

if (!defined('SYS_SORTING')) include_once(BASE.'subsystems/sorting.php');
// if (!defined('SYS_SORTING')) include_once(BASE.'subsystems/sorting.php');
include_once(BASE.'subsystems/sorting.php');
$form->register('page',$i18n['standalone_page'],new dropdowncontrol(0,$standalones));
$form->register('submit','',new buttongroupcontrol($i18n['save'],'',$i18n['cancel']));
return $form;
Expand All @@ -142,8 +145,9 @@ static function form($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section.php');

// Initialize the forms subsystem for use.
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

// Grab the basic form that all page types share
// This has the name and positional dropdowns registered.
Expand Down Expand Up @@ -192,8 +196,9 @@ static function externalAliasForm($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section.php');

// Initialize the forms subsystem for use.
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

// Grab the basic form that all page types share
// This has the name and positional dropdowns registered.
Expand Down Expand Up @@ -232,8 +237,9 @@ static function internalAliasForm($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section.php');

// Initialize the forms subsystem for use.
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

// Initialization
if (!isset($object->id)) {
Expand Down Expand Up @@ -275,8 +281,9 @@ static function pagesetForm($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section.php');

// Initialize the forms subsystem for use.
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

// Grab the basic form that all page types share
// This has the name and positional dropdowns registered.
Expand Down
8 changes: 5 additions & 3 deletions datatypes/section_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class section_template {
static function form($object = null) {
$i18n = exponent_lang_loadFile('datatypes/section_template.php');

if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand All @@ -49,7 +50,8 @@ static function form($object = null) {
$sections = $db->selectObjects('section_template','parent='.$object->parent);

if (count($sections)) {
if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
// if (!defined('SYS_SORTING')) require_once(BASE.'subsystems/sorting.php');
require_once(BASE.'subsystems/sorting.php');
usort($sections,'exponent_sorting_byRankAscending');

$dd = array($i18n['position_top']);
Expand Down
5 changes: 3 additions & 2 deletions datatypes/simplepollmodule_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@

class simplepollmodule_config {
function form($object) {
if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
exponent_forms_initialize();
// if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
require_once(BASE.'subsystems/forms.php');
// exponent_forms_initialize();

$form = new form();
if (!isset($object->id)) {
Expand Down
3 changes: 2 additions & 1 deletion edit_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
include_once('exponent.php');
if (!defined("EXPONENT")) exit("");

if (!defined('SYS_THEME')) include_once(BASE.'subsystems/theme.php');
//if (!defined('SYS_THEME')) include_once(BASE.'subsystems/theme.php');
include_once(BASE.'subsystems/theme.php');

$id = -1;
if (isset($_GET['sitetemplate_id'])) {
Expand Down
9 changes: 6 additions & 3 deletions exponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
exponent_sessions_initialize();

// Initialize the theme subsystem
if (!defined('SYS_THEME')) require_once(BASE.'subsystems/theme.php');
//if (!defined('SYS_THEME')) require_once(BASE.'subsystems/theme.php');
require_once(BASE.'subsystems/theme.php');

// Initialize the language subsystem
require_once(BASE.'subsystems/lang.php');
Expand Down Expand Up @@ -70,7 +71,8 @@
require_once(BASE.'subsystems/permissions.php');

// Initialize the Flow/History Subsystem.
if (!defined('SYS_FLOW')) require_once(BASE.'subsystems/flow.php');
//if (!defined('SYS_FLOW')) require_once(BASE.'subsystems/flow.php');
require_once(BASE.'subsystems/flow.php');
/**
* the browsing history object
* @global expHistory $history
Expand All @@ -82,7 +84,8 @@
require_once(BASE.'subsystems/users.php');

// Initialize the javascript subsystem
if (!defined('SYS_JAVASCRIPT')) require_once(BASE.'subsystems/javascript.php');
//if (!defined('SYS_JAVASCRIPT')) require_once(BASE.'subsystems/javascript.php');
require_once(BASE.'subsystems/javascript.php');

// Initialize the MVC framework
require_once(BASE.'framework/core/expFramework.php');
Expand Down
3 changes: 2 additions & 1 deletion framework/core/datatypes/expFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ public static function fileUpload( $_postName = null,
$_destDir = null
) {

if (!defined('SYS_FILES')) include_once(BASE.'subsystems/files.php');
// if (!defined('SYS_FILES')) include_once(BASE.'subsystems/files.php');
include_once(BASE.'subsystems/files.php');

// Make sure something was sent first off...
if ( ( !isset($_SERVER['CONTENT_TYPE'] )) ||
Expand Down
3 changes: 2 additions & 1 deletion framework/core/datatypes/expRss.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public function beforeSave() {

public function getFeedItems() {
// if (!defined('SYS_RSS')) include_once('core_rss.php');
if (!defined('SYS_RSS')) require_once(BASE.'external/feedcreator.class.php');
// if (!defined('SYS_RSS')) require_once(BASE.'external/feedcreator.class.php');
require_once(BASE.'external/feedcreator.class.php');

// get all the feeds available to this expRss object
$feeds = $this->getFeeds();
Expand Down
Loading

0 comments on commit 1892bac

Please sign in to comment.