From 1914ba4362e39acf3d6ef29cdfc8e4caef211a79 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 14 Aug 2007 03:44:27 +0000 Subject: [PATCH] Renaming BSRegister to BSApp and moving Register.php to App.php --- Api.php | 24 ++++++++++++------------ Register.php => App.php | 20 ++++++++++---------- Input.php | 16 ++++++++-------- Installer.php | 4 ++-- Mail.php | 12 ++++++------ Pagination.php | 6 +++--- PrinterCss.php | 4 ++-- PrinterNavigation.php | 2 +- PrinterRootElementPage.php | 20 ++++++++++---------- Template.php | 16 ++++++++-------- tools/create_schema.php | 4 ++-- 11 files changed, 64 insertions(+), 64 deletions(-) rename Register.php => App.php (95%) diff --git a/Api.php b/Api.php index 002e04d..acb4198 100644 --- a/Api.php +++ b/Api.php @@ -127,7 +127,7 @@ abstract class BSApi */ public function __construct() { - BSRegister::RequiredModules(array('Db', 'Input')); + BSApp::RequiredModules(array('Db', 'Input')); } // ################################################################### @@ -205,7 +205,7 @@ abstract class BSApi return; } - $this->values["$field"] = ($doclean ? BSRegister::GetType('Input')->clean($value, $this->fields["$field"][F_TYPE]) : $value); + $this->values["$field"] = ($doclean ? BSApp::GetType('Input')->clean($value, $this->fields["$field"][F_TYPE]) : $value); $this->setfields["$field"] = $field; @@ -332,7 +332,7 @@ abstract class BSApi $this->_runActionMethod('pre_fetch', $doPre); - $result = BSRegister::GetType('Db')->queryFirst("SELECT * FROM {$this->prefix}{$this->table} WHERE {$this->condition}"); + $result = BSApp::GetType('Db')->queryFirst("SELECT * FROM {$this->prefix}{$this->table} WHERE {$this->condition}"); if (!$result) { return false; @@ -365,9 +365,9 @@ abstract class BSApi $values[] = $this->_prepareFieldForSql($field); } - BSRegister::GetType('Db')->query("INSERT INTO {$this->prefix}{$this->table} (" . implode(',', $fields) . ") VALUES (" . implode(',', $values) . ")"); + BSApp::GetType('Db')->query("INSERT INTO {$this->prefix}{$this->table} (" . implode(',', $fields) . ") VALUES (" . implode(',', $values) . ")"); - if (BSRegister::GetType('DbPostgreSql')) + if (BSApp::GetType('DbPostgreSql')) { foreach ($this->fields AS $field => $info) { @@ -378,11 +378,11 @@ abstract class BSApi } } - $this->insertid = BSRegister::GetType('Db')->insertId($this->prefix . $this->table, $autofield); + $this->insertid = BSApp::GetType('Db')->insertId($this->prefix . $this->table, $autofield); } else { - $this->insertid = BSRegister::GetType('Db')->insertId(); + $this->insertid = BSApp::GetType('Db')->insertId(); } $this->_runActionMethod('post_insert', $doPost); @@ -412,7 +412,7 @@ abstract class BSApi } $updates = implode(', ', $updates); - BSRegister::GetType('Db')->query("UPDATE {$this->prefix}{$this->table} SET $updates WHERE {$this->condition}"); + BSApp::GetType('Db')->query("UPDATE {$this->prefix}{$this->table} SET $updates WHERE {$this->condition}"); $this->_runActionMethod('post_update', $doPost); } @@ -435,7 +435,7 @@ abstract class BSApi $this->_runActionMethod('pre_remove', $doPre); - BSRegister::GetType('Db')->query("DELETE FROM {$this->prefix}{$this->table} WHERE {$this->condition}"); + BSApp::GetType('Db')->query("DELETE FROM {$this->prefix}{$this->table} WHERE {$this->condition}"); $this->_runActionMethod('post_remove', $doPost); } @@ -494,7 +494,7 @@ abstract class BSApi if ($type == TYPE_NONE OR $type == TYPE_STR OR $type == TYPE_STRUN) { - return "'" . BSRegister::GetType('Db')->escapeString($this->values["$name"]) . "'"; + return "'" . BSApp::GetType('Db')->escapeString($this->values["$name"]) . "'"; } else if ($type == TYPE_BOOL) { @@ -502,7 +502,7 @@ abstract class BSApi } else if ($type == TYPE_BIN) { - return "'" . BSRegister::GetType('Db')->escapeBinary($this->values["$name"]) . "'"; + return "'" . BSApp::GetType('Db')->escapeBinary($this->values["$name"]) . "'"; } else { @@ -544,7 +544,7 @@ abstract class BSApi */ protected function verify_unique($field) { - $res = BSRegister::GetType('Db')->queryFirst("SELECT $field FROM {$this->prefix}{$this->table} WHERE $field = " . $this->_prepareFieldForSql($field) . (empty($this->condition) ? "" : " AND !({$this->condition})")); + $res = BSApp::GetType('Db')->queryFirst("SELECT $field FROM {$this->prefix}{$this->table} WHERE $field = " . $this->_prepareFieldForSql($field) . (empty($this->condition) ? "" : " AND !({$this->condition})")); if ($res) { return sprintf(_('The "%1$s" field must contain a unique value'), $field); diff --git a/Register.php b/App.php similarity index 95% rename from Register.php rename to App.php index 3dbec3f..37cc070 100644 --- a/Register.php +++ b/App.php @@ -20,7 +20,7 @@ \*=====================================================================*/ /** -* ISSO Registry (Register.php) +* ISSO Application Root (App.php) * * Constants: * ISSO_MT_START - Define the microtime() value at the top of your @@ -60,9 +60,9 @@ if ((bool)ini_get('register_globals') === true) require_once('ISSO/Functions.php'); /** -* Register Class +* Application Class * -* This is an ISSO registry class. It holds all of the ISSO system variables as well +* This is an ISSO application class. It holds all of the ISSO system variables as well * as serving as an object registry that is avaliable in the global scope to prevent * globalization of variables. There can only be one instance of this existing * at any given time. @@ -73,7 +73,7 @@ require_once('ISSO/Functions.php'); * @package ISSO * */ -class BSRegister +class BSApp { /** * Instance of this class @@ -138,13 +138,13 @@ class BSRegister * * @param string A string param * - * @return object BSRegister instance + * @return object BSApp instance */ private static function _Instance() { if (!self::$instance) { - self::$instance = new BSRegister(); + self::$instance = new BSApp(); } return self::$instance; } @@ -313,7 +313,7 @@ class BSRegister */ public static function LoadModule($name) { - if (BSRegister::GetDebug()) + if (self::GetDebug()) { include_once("ISSO/$name.php"); } @@ -360,7 +360,7 @@ class BSRegister * Variable Registry * * This class can be used to store unlimited number of properties. It is a (make believe) - * inner class to BSRegister and cannot be instantiated outside of it. + * inner class to BSApp and cannot be instantiated outside of it. * * @author Blue Static * @copyright Copyright (c)2002 - [#]year[#], Blue Static @@ -372,12 +372,12 @@ class BSVariableRegistry { // ################################################################### /** - * Constructor: only able to be called by BSRegister + * Constructor: only able to be called by BSApp */ public function __construct() { $bt = debug_backtrace(); - if (!isset($bt[1]['class']) OR $bt[1]['class'] != 'BSRegister') + if (!isset($bt[1]['class']) OR $bt[1]['class'] != 'BSApp') { exit('You cannot instantiate ' . __CLASS__ . ' directly. It is an internal class.'); } diff --git a/Input.php b/Input.php index b4bf4f6..0f52515 100644 --- a/Input.php +++ b/Input.php @@ -109,8 +109,8 @@ class BSInput set_magic_quotes_runtime(0); // some debug info that's always useful - BSRegister::Debug('magic_quotes_gpc = ' . $this->magicquotes); - BSRegister::Debug('register_globals = ' . ini_get('register_globals')); + BSApp::Debug('magic_quotes_gpc = ' . $this->magicquotes); + BSApp::Debug('register_globals = ' . ini_get('register_globals')); $this->_sanitizeInputData(); @@ -212,17 +212,17 @@ class BSInput { if ($this->magicquotes AND !$force) { - if (BSRegister::GetType('Db')) + if (BSApp::GetType('Db')) { - return BSRegister::GetType('Db')->escapeString(str_replace(array("\'", '\"'), array("'", '"'), $str)); + return BSApp::GetType('Db')->escapeString(str_replace(array("\'", '\"'), array("'", '"'), $str)); } return $str; } else { - if (BSRegister::GetType('Db')) + if (BSApp::GetType('Db')) { - return BSRegister::GetType('Db')->escapeString($str); + return BSApp::GetType('Db')->escapeString($str); } return addslashes($str); } @@ -420,11 +420,11 @@ class BSInput throw new Exception('No external hosts are allowed to POST to this application'); exit; } - BSRegister::Debug('remote post check = ok'); + BSApp::Debug('remote post check = ok'); } else { - BSRegister::Debug('remote post check = FAILED'); + BSApp::Debug('remote post check = FAILED'); } } } diff --git a/Installer.php b/Installer.php index 5d23dab..3fc977f 100644 --- a/Installer.php +++ b/Installer.php @@ -61,7 +61,7 @@ abstract class BSInstaller { $this->fileName = $fileName; - BSRegister::RequiredModules(array('Input')); + BSApp::RequiredModules(array('Input')); $methods = get_class_methods($this); foreach ($methods AS $name) @@ -73,7 +73,7 @@ abstract class BSInstaller } natsort($this->steps); - $this->_runStep(BSRegister::GetType('Input')->inputClean('step', TYPE_UINT)); + $this->_runStep(BSApp::GetType('Input')->inputClean('step', TYPE_UINT)); } // ################################################################### diff --git a/Mail.php b/Mail.php index 046ac69..8aa4ee7 100644 --- a/Mail.php +++ b/Mail.php @@ -187,18 +187,18 @@ class BSMail } // load the input sanitizer - $input = BSRegister::GetType('Input'); + $input = BSApp::GetType('Input'); if ($input == null) { - BSRegister::Debug('ISSO/Input not loaded, so manually doing so'); - $input = BSRegister::LoadModule('Input'); + BSApp::Debug('ISSO/Input not loaded, so manually doing so'); + $input = BSApp::LoadModule('Input'); } // make sure we have a mailer // TODO - add support for SMTP if (!@ini_get('sendmail_path')) { - BSRegister::Debug("email: no sendmail -> not sending"); + BSApp::Debug("email: no sendmail -> not sending"); return false; } @@ -282,11 +282,11 @@ class BSMail // attempt to send the mail! if (mail($tostring, $subject, $body, $headers, "-f {$from}")) { - BSRegister::Debug("email: sent to $address"); + BSApp::Debug("email: sent to $address"); } else { - BSRegister::Debug("email: error sending to $address"); + BSApp::Debug("email: error sending to $address"); } } diff --git a/Pagination.php b/Pagination.php index 2fe6b71..c5412f9 100644 --- a/Pagination.php +++ b/Pagination.php @@ -239,11 +239,11 @@ class BSPagination */ public function processIncomingData() { - $input = BSRegister::GetType('Input'); + $input = BSApp::GetType('Input'); if ($input == null) { - BSRegister::Debug('ISSO/Input not loaded, so manually doing so'); - $input = BSRegister::LoadModule('Input'); + BSApp::Debug('ISSO/Input not loaded, so manually doing so'); + $input = BSApp::LoadModule('Input'); } $this->page = $input->inputClean($this->pagevar, TYPE_INT); diff --git a/PrinterCss.php b/PrinterCss.php index eacab16..cf5dd25 100644 --- a/PrinterCss.php +++ b/PrinterCss.php @@ -88,7 +88,7 @@ class BSPrinterCss */ public function __construct() { - BSRegister::RequiredModules(array('Db', 'Printer')); + BSApp::RequiredModules(array('Db', 'Printer')); } // ################################################################### @@ -488,7 +488,7 @@ class BSPrinterCss */ private function _escape($string) { - return BSRegister::GetType('Db')->escapeString($string); + return BSApp::GetType('Db')->escapeString($string); } // ################################################################### diff --git a/PrinterNavigation.php b/PrinterNavigation.php index c623905..e9c32b1 100644 --- a/PrinterNavigation.php +++ b/PrinterNavigation.php @@ -178,7 +178,7 @@ class BSPrinterNavigation } $output .= "\n" . ''; diff --git a/PrinterRootElementPage.php b/PrinterRootElementPage.php index bd9e107..6508751 100644 --- a/PrinterRootElementPage.php +++ b/PrinterRootElementPage.php @@ -249,24 +249,24 @@ class BSPrinterRootElementPage extends BSPrinterRootElement echo "\n"; echo "\n"; - echo "\n\t" . sprintf(_('%1$s - %2$s - %3$s'), BSRegister::GetApplication(), BSPrinter::GetRealm(), $this->title) . ""; + echo "\n\t" . sprintf(_('%1$s - %2$s - %3$s'), BSApp::GetApplication(), BSPrinter::GetRealm(), $this->title) . ""; echo "\n\t"; echo "\n\t"; echo "\n\n\n"; - if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) + if (BSApp::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { - echo BSRegister::GetType('PrinterNavigation')->constructHeaderHtml(); + echo BSApp::GetType('PrinterNavigation')->constructHeaderHtml(); } echo $this->_paintChildren(); - if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) + if (BSApp::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { - echo BSRegister::GetType('PrinterNavigation')->constructFooterHtml(); + echo BSApp::GetType('PrinterNavigation')->constructFooterHtml(); } - $copyright = "\n
\n

\n\t" . BSRegister::GetApplication() . ' ' . BSRegister::GetAppVersion() . ", ©2002 - " . gmdate('Y') . " Blue Static\n

"; + $copyright = "\n
\n

\n\t" . BSApp::GetApplication() . ' ' . BSApp::GetAppVersion() . ", ©2002 - " . gmdate('Y') . " Blue Static\n

"; if (!defined('ISSO_PRINTER_HIDE_SETUP')) { @@ -274,7 +274,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement echo "\n\n\n"; - if (BSRegister::GetDebug()) + if (BSApp::GetDebug()) { if (defined('SVN') AND preg_match('#^\$Id:?#', constant('SVN'))) { @@ -286,11 +286,11 @@ class BSPrinterRootElementPage extends BSPrinterRootElement echo "\n
Executed in " . round(BSFunctions::FetchMicrotimeDiff(ISSO_MT_START), 10) . ' seconds
'; } - echo "\n
" . BSRegister::GetDebugList() . "
\n"; + echo "\n
" . BSApp::GetDebugList() . "
\n"; - if (BSRegister::GetType('Db')) + if (BSApp::GetType('Db')) { - $queries = BSRegister::GetType('Db')->getHistory(); + $queries = BSApp::GetType('Db')->getHistory(); $table = new BSPrinterRootElementTable(); $head = new BSPrinterTableElement(); diff --git a/Template.php b/Template.php index 0395f6c..e20a6eb 100644 --- a/Template.php +++ b/Template.php @@ -169,11 +169,11 @@ class BSTemplate $dbCache = array(); if ($this->dbCacheTable) { - $db =& BSRegister::GetType('Db'); + $db =& BSApp::GetType('Db'); $cache = $db->query("SELECT * FROM {$this->dbCacheTable} WHERE filename IN ('" . implode("', '", $namearray) . "')"); while ($tpl = $db->fetchArray($cache)) { - $time = filemtime(BSRegister::GetAppPath() . $this->templateDir . $tpl['filename'] . '.' . $this->extension); + $time = filemtime(BSApp::GetAppPath() . $this->templateDir . $tpl['filename'] . '.' . $this->extension); $template = $tpl['template']; if ($time > $tpl['timestamp']) { @@ -227,7 +227,7 @@ class BSTemplate else { $this->uncached[] = $name; - BSRegister::Debug("Manually loading template '$name'"); + BSApp::Debug("Manually loading template '$name'"); $template = $this->_loadTemplate($name); $template = $this->_parseTemplate($template); } @@ -263,7 +263,7 @@ class BSTemplate } $debugBlock = ''; - if (BSRegister::GetDebug()) + if (BSApp::GetDebug()) { if (defined('SVN') AND preg_match('#^\$Id:?#', constant('SVN'))) { @@ -275,7 +275,7 @@ class BSTemplate $debugBlock .= "\n
Executed in " . round(BSFunctions::FetchMicrotimeDiff(ISSO_MT_START), 10) . ' seconds
'; } - $debugBlock .= "\n
" . BSRegister::GetDebugList() . "
"; + $debugBlock .= "\n
" . BSApp::GetDebugList() . "
"; $optlist = array(); $usage = array(); @@ -300,9 +300,9 @@ class BSTemplate } $debugBlock .= "\n"; - if (BSRegister::GetType('Db')) + if (BSApp::GetType('Db')) { - $queries = BSRegister::GetType('Db')->getHistory(); + $queries = BSApp::GetType('Db')->getHistory(); $debugBlock .= "
\n" . '' . "\n\t" . ''; @@ -332,7 +332,7 @@ class BSTemplate */ protected function _loadTemplate($name) { - $path = BSRegister::GetAppPath() . $this->templateDir . $name . '.' . $this->extension; + $path = BSApp::GetAppPath() . $this->templateDir . $name . '.' . $this->extension; if (is_file($path)) { if (($template = @file_get_contents($path)) !== false) diff --git a/tools/create_schema.php b/tools/create_schema.php index 6bbf8f2..9237c56 100644 --- a/tools/create_schema.php +++ b/tools/create_schema.php @@ -6,8 +6,8 @@ ini_set('include_path', ini_get('include_path') . ':' . dirname(dirname(getcwd()))); require_once('ISSO/Register.php'); -$db = BSRegister::LoadModule('DbMySQL'); -$input = BSRegister::LoadModule('Input'); +$db = BSApp::LoadModule('DbMySQL'); +$input = BSApp::LoadModule('Input'); if (empty($_REQUEST['submit'])) { -- 2.43.5
Query Debug