From 6234c7b216c43969b4bd1d1715ec6bf9bc5eae58 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 22:43:12 -0500 Subject: [PATCH 1/7] Removed Cache class. * File was little more than just a stub file for the Cache class. --- classes/Cache.php | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 classes/Cache.php diff --git a/classes/Cache.php b/classes/Cache.php deleted file mode 100644 index af4fbbb..0000000 --- a/classes/Cache.php +++ /dev/null @@ -1,8 +0,0 @@ - From de5b850db413eb36735fe06b949bae10e27e0441 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 22:44:07 -0500 Subject: [PATCH 2/7] Removed Mailer class. * Attempting to remove non-critical classes from the system. * Class will be re-added / re-factored at a later date once the core of PICKLES is done. --- classes/Mailer.php | 144 --------------------------------------------- 1 file changed, 144 deletions(-) delete mode 100644 classes/Mailer.php diff --git a/classes/Mailer.php b/classes/Mailer.php deleted file mode 100644 index 00fb318..0000000 --- a/classes/Mailer.php +++ /dev/null @@ -1,144 +0,0 @@ -. - * - * @author Joshua John Sherman - * @copyright Copyright 2007, 2008, 2009 Joshua John Sherman - * @link http://phpwithpickles.org - * @license http://www.gnu.org/copyleft/lesser.html - * @package PICKLES - */ - -/** - * Mailer Class - * - * Handles mailing messages from within PICKLES. Modules interact with the - * Mailer object directly (each module has an instance) to send mail. - * - * @todo Add a Pickles config to allow for overrides (i.e. email goes to a - * developer's email account instead of the actual account passed in) - */ -class Mailer extends Object -{ - /** - * Sends an email message - * - * @param mixed $to String, object or array representing the recipient(s) - * @param mixed $from String object or array representing the sender - * @param string $subject Subject line for the email - * @param string $message The body of the email - * @return array An associative array with a status type and message - * @todo Implement the $html parameter - */ - public function send($to, $from, $subject, $message, $html = false) - { - // Converts the recipients into a usable string format - if (is_object($to)) { $this->object2array($to); } - if (is_array($to)) { $this->array2string($to); } - - // Converts the from variable into a usable string format - if (is_object($from)) { $this->object2array($from); } - if (is_array($from)) { $this->array2string($from); } - - // Constructs the header - $additional_headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: {$from}\r\nX-Mailer: PICKLES (http://phpwithpickles.com)\r\n"; - - // Sends the mail - if (mail($to, stripslashes(trim($subject)), nl2br(stripslashes(trim($message))), $additional_headers)) - { - $type = 'success'; - $message = 'Message sent successfully'; - } - else - { - $type = 'error'; - $message = 'An unexpected error has occurred'; - } - - Logger::write('mailer', '[' . $type . ']'); - - // Returns the status array - return array( - 'type' => $type, - 'message' => $message - ); - } - - /** - * Converts an object to an array - * - * This function assumes that the object is formatted in a certain way, - * with a name and email member variable. - * - * @param object $object Object to be converted - * @return array The resulting array - */ - private function object2array(&$object) - { - $array = array(); - - foreach ($object as $key => $node) - { - if (isset($node->name, $node->email)) - { - $array[trim((string)$node->name)] = trim((string)$node->email); - } - else if (isset($node->email)) - { - $array[] = trim((string)$node->email); - } - else - { - $array[] = trim((string)$node); - } - } - - $object = $array; - } - - - /** - * Converts an array to a string - * - * This function assumes that the array is formatted in a certain way, - * with the name as the key and the email as the value. - * - * @param array $array Array to be converted - * @return string The resulting string - */ - private function array2string(&$array) - { - $temp = array(); - - foreach ($array as $name => $email) - { - if (is_string($name)) - { - $temp[$name] = "{$name} <{$email}>"; - } - else - { - $temp[] = $email; - } - } - - $array = implode(', ', $temp); - } -} - -?> From 38dfd821019c9bb86c8d90c752ba660702b5a232 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 22:45:40 -0500 Subject: [PATCH 3/7] Removed Security class. * Removing non-critcal classes from the system. * Security class was not very generic and will be replaced down the road once the security scheme is full realized. --- classes/Security.php | 159 ------------------------------------------- 1 file changed, 159 deletions(-) delete mode 100644 classes/Security.php diff --git a/classes/Security.php b/classes/Security.php deleted file mode 100644 index 7751825..0000000 --- a/classes/Security.php +++ /dev/null @@ -1,159 +0,0 @@ -. - * - * @author Joshua John Sherman - * @copyright Copyright 2007, 2008, 2009 Joshua John Sherman - * @link http://phpwithpickles.org - * @license http://www.gnu.org/copyleft/lesser.html - * @package PICKLES - */ - -/** - * Security Class - * - * Handles authenticating a user via an Apache login box. - */ -class Security extends Object -{ - private $config; - private $db; - - public function __construct(Config $config, DB $db) - { - parent::__construct(); - $this->config = $config; - $this->db = $db; - } - - /** - * Authenticates the user - * - * Checks for the authentication variables to be passed in the $_SERVER - * super global and attempts to authenticate the user against MySQL. If - * the user cannot successfully they will be presented with a 401 - * Unauthorized page. - * - * @todo May also want to add in the ability for someone to add a custom - * message and/or landing page in the configuration as well. - */ - public function authenticate() - { - if (!isset($_SESSION['user_id'])) - { - if (isset($this->config->admin, $this->config->admin->username, $this->config->admin->password)) - { - $_SESSION['user_id'] = null; - - if (isset($_SERVER['PHP_AUTH_USER'])) - { - if ($_SERVER['PHP_AUTH_USER'] == $this->config->admin->username && Security::doubleMD5($_SERVER['PHP_AUTH_PW'], $this->config->admin->salt) == $this->config->admin->password) - { - $_SESSION['user_id'] = 1; - } - } - } - else - { - $table = array( - 'name' => 'users', - 'fields' => array( - 'id' => 'id', - 'username' => 'username', - 'password' => 'password' - ) - ); - - $table = $this->config->getTableMapping('users', $table); - - if (isset($_SERVER['PHP_AUTH_USER'])) - { - $from = ' - FROM ' . $table['name'] . ' - WHERE ' . $table['fields']['username'] . ' = "' . $_SERVER['PHP_AUTH_USER'] . '" - AND ' . $table['fields']['password'] . ' = "' . md5($_SERVER['PHP_AUTH_PW']) . '"; - '; - - $this->db->execute('SELECT COUNT(' . $table['fields']['id'] . ') ' . $from); - if ($this->db->getField() != 0) - { - $this->db->execute('SELECT ' . $table['fields']['id'] . ' ' . $from); - $_SESSION['user_id'] = $this->db->getField(); - } - else - { - $_SESSION['user_id'] = null; - } - } - } - } - - if (!isset($_SESSION['user_id'])) - { - if ($this->config->modules->{'pre-login'}) - { - header('Location: /' . $this->config->modules->{'pre-login'}); - exit(); - } - else - { - header('WWW-Authenticate: Basic realm="' . $_SERVER['SERVER_NAME'] . ' Secured Page"'); - header('HTTP/1.0 401 Unauthorized'); - exit('Invalid login credentials, access denied.'); - } - } - /* - else - { - if ($this->config->modules->{'post-login'}) - { - //header('Location: /' . $this->config->modules->{'post-login'}); - //exit(); - } - else - { - //header('Location: /'); - //exit(); - } - } - */ - } - - /** - * Logs the user out - * - * Destroys the session, and redirects the user to the root of the site. - */ - public function logout() - { - session_destroy(); - header('Location: /'); - } - - public static function doubleMD5($string, $salt1 = null, $salt2 = null) - { - if (!isset($salt2)) - { - $salt2 = $salt1; - } - - return md5($salt2 . md5($salt1 . $string)); - } -} - -?> From 8d1b00610d50f2b0ac33f7ed1085a4529285eb81 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 22:48:06 -0500 Subject: [PATCH 4/7] Removed Form class. * Removing non-critcal classes from PICKLES to help the rewrite efforts. * Form class would take a database table and convert it into a webform. Nice script, but really had no place in PICKLES. * Eventually will replace with a generic HTML form element generation class. --- classes/Form.php | 80 ------------------------------------------------ 1 file changed, 80 deletions(-) delete mode 100644 classes/Form.php diff --git a/classes/Form.php b/classes/Form.php deleted file mode 100644 index e1d66aa..0000000 --- a/classes/Form.php +++ /dev/null @@ -1,80 +0,0 @@ -getArray('DESCRIBE menopausesolutions.affiliates'); - - $form = "
\n\t
\n"; - - while ($row = mysql_fetch_assoc($results)) { - - $label = ucwords(strtr($row['Field'], '_', ' ')); - $attributes = "name='{$row['Field']}' id='{$row['Field']}'"; - - $form .= "\t\t
{$label}:
\n\t\t
\n\t\t\t"; - - // ENUM() - if (preg_match('/^enum/', $row['Type'])) { - $options = str_replace(array("enum('", "')"), '', $row['Type']); - $options = explode("','", $options); - - if (is_array($options)) { - if (count($options) <= 2) { - foreach ($options as $option) { - $form .= " {$option} "; - } - } - else { - $form .= "'; - } - // TEXT and BLOG (all sizes) - else if (preg_match('/(tiny|medium|long)?(text|blob)$/', $row['Type'])) { - $form .= ""; - } - // DATE (not DATETIME) - else if (preg_match('/^date$/', $row['Type'])) { - - } - /* - else if (preg_match('/^datetime$/', $row['Type'])) { - - } - */ - else if (preg_match('/(tiny|medium|long)?int([0-9]+)$/', $row['Type'])) { - var_dump(split('int', $row['Type'])); - } - // Generic default (input box) - else { - var_dump($row); - if (preg_match('/^(var)?char\([0-9]+\)$/', $row['Type'])) { - $type_array = split('(\(|\))', $row['Type']); - $attributes .= " maxlength='{$type_array[1]}' size='{$type_array[1]}'"; - } - - $form .= ""; - } - - $form .= "\n\t\t
\n"; - } - - $form .= "\t
\n
\n"; - - exit($form); - } -} - -?> From 4d02c1f9ce764fd596817ea901cde35f3cfe616f Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 22:59:11 -0500 Subject: [PATCH 5/7] Added INSTALL file. --- INSTALL | 1 + 1 file changed, 1 insertion(+) create mode 100644 INSTALL diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..a5582ad --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +Come back later... From 6c0b28b82fe4cbee145a8b8222a73120586292d5 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 23:02:10 -0500 Subject: [PATCH 6/7] Updated derivation of the hostname. * Hostname is now defaulted in the class variable definition. --- classes/Database.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/classes/Database.php b/classes/Database.php index f09ae3f..b91aeec 100644 --- a/classes/Database.php +++ b/classes/Database.php @@ -31,7 +31,7 @@ class Database extends Object * @access private * @var string */ - private $hostname = null; + private $hostname = 'localhost'; /** * Username for the MySQL Server @@ -112,10 +112,6 @@ class Database extends Object { $this->hostname = $config['hostname']; } - else - { - $this->hostname = 'localhost'; - } } /** @@ -130,12 +126,6 @@ class Database extends Object { if ($this->connection === null) { - // Sets the database server to localhost if the URL is local - if ($this->hostname == '' || (isset($_SERVER['HTTP_HOST']) && ($_SERVER['HTTP_HOST'] == 'groupocity2.localhost' || $_SERVER['HTTP_HOST'] == 'groupocity2.desktop' || $_SERVER['HTTP_HOST'] == 'local2.groupocity.com'))) - { - $this->hostname = 'localhost'; - } - if (isset($this->username, $this->password, $this->database)) { // Creates a new PDO database object (persistent) From 3c75861e9cc79cd7d1f0b73cabca596910dc64ce Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 11 Mar 2010 23:16:14 -0500 Subject: [PATCH 7/7] Refactoring Controller and Module --- classes/Controller.php | 148 +++++++++----------- classes/Module.php | 307 ++++++++++++----------------------------- 2 files changed, 148 insertions(+), 307 deletions(-) diff --git a/classes/Controller.php b/classes/Controller.php index d5dc853..7889dc0 100644 --- a/classes/Controller.php +++ b/classes/Controller.php @@ -26,76 +26,82 @@ * * @usage new Controller($config); */ -class Controller extends Object { - - private $execute_tests = false; - +class Controller extends Object +{ /** * Constructor * - * To make life a bit easier when using PICKLES, the Controller logici + * To make life a bit easier when using PICKLES, the Controller logic * is executed automatically via use of a constructor. - * - * @param mixed Config object or filename (optional) */ - public function __construct($config = null) { + public function __construct() + { parent::__construct(); - // Creates the core objects that don't need a Config object - $error = new Error(); - - // Check the passed config variables object type - if (is_object($config)) { - if ($config instanceof Config === false) { - $error->addWarning('Passed object is not an instance of Config'); - $config = null; - } - } - - // Config filename to be loaded - $filename = null; - - // Checks if the config value is a filename - if (is_string($config)) { - if (file_exists($config)) { - $filename = $config; - } - else { - $error->addWarning('Passed config filename does not exist'); - } - } - else { - $config = null; - } - - // If no Config object is passed (or it's cleared), create a new one from assumptions - if ($config == null) { - $config = new Config(); - } - else { - $config = new Config($filename); - } - - unset($filename); - - // Creates all the other core objects we need to pass around - $db = new DB($config, $error); - $mailer = new Mailer($config, $error); - // Generate a generic "site down" message - if ($config->getDisabled()) { + if ($this->config->disabled()) { exit("

{$_SERVER['SERVER_NAME']} is currently down for maintenance

"); } - // Loads the default module - $module['requested']['name'] = $config->getDefaultModule(); + // Loads the default module information (if any) + $basename = $this->config->module(); - // Attempts to override the default module - if (isset($_REQUEST['module'])) { - if (strpos($config->templates->main, $_REQUEST['module']) !== 0) { - $module['requested']['name'] = $_REQUEST['module']; + if ($basename != null) + { + $module_class = strtr($basename, '/', '_'); + $module_filename = '../modules/' . $basename . '.php'; + $css_class = strtr($basename, '_', '-'); + $js_filename = $basename; + + unset($basename); + } + + // Attempts to override the defaults with passed information (if any) + if (isset($_REQUEST['module']) && trim($_REQUEST['module']) != '') + { + $new_basename = strtr($_REQUEST['module'], '-', '_'); + $new_module_class = strtr($new_basename, '/', '_'); + $new_module_filename = '../modules/' . $new_basename . '.php'; + $new_css_class = strtr($new_basename, '_', '-'); + $new_js_filename = $new_basename; + + // File exists, proceed with override + if (file_exists($new_module_filename)) + { + $module_class = $new_module_class; + $module_filename = $new_module_filename; + $css_class = $new_css_class; + $js_filename = $new_js_filename; + } + + unset($new_basename, $new_module_class, $new_module_filename, $new_css_class, $new_js_filename); + } + + // Loads the module or errors out + if (isset($module_filename) && $module_filename != null && file_exists($module_filename)) + { + require_once $module_filename; + + // Checks that our class exists + if (class_exists($module_class)) + { + $module = new $module_class; + + // Checks that our default method exists + if (method_exists($module, '__default')) + { + var_dump($module->__default()); + } } } + else + { + // @todo Error handling + // @todo Should we be creating a new generic Module? + } + + + exit('EOF'); // Checks if we have a display type passed in if (strpos($module['requested']['name'], '.') !== false) { @@ -120,37 +126,7 @@ class Controller extends Object { } } - // Loads the requested module's information - $module['requested']['filename'] = strtr($module['requested']['name'], '-', '_'); - $module['requested']['php_file'] = '../modules/' . $module['requested']['filename'] . '.php'; - $module['requested']['class_name'] = strtr($module['requested']['filename'], '/', '_'); - // Establishes the shared module information - $module['shared']['name'] = $config->getSharedModule($module['requested']['name']); - $module['shared']['filename'] = strtr($module['shared']['name'], '-', '_'); - $module['shared']['php_file'] = PICKLES_PATH . 'common/modules/' . $module['shared']['filename'] . '.php'; - $module['shared']['class_name'] = strtr($module['shared']['filename'], '/', '_'); - - // Tries to load the site level module - if (file_exists($module['requested']['php_file'])) { - require_once $module['requested']['php_file']; - - if (class_exists($module['requested']['class_name'])) { - $module['object'] = new $module['requested']['class_name']($config, $db, $mailer, $error); - } - } - // Tries to load the shared module - else if (file_exists($module['shared']['php_file']) && $module['shared']['name'] != false) { - require_once $module['shared']['php_file']; - - if (class_exists($module['shared']['class_name'])) { - $module['object'] = new $module['shared']['class_name']($config, $db, $mailer, $error); - } - } - // Loads the stock module - else { - $module['object'] = new Module($config, $db, $mailer, $error); - } // Checks if we loaded a module file and no class was present if ($module['object'] != null) { diff --git a/classes/Module.php b/classes/Module.php index 5113a6b..36d05d8 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -3,261 +3,126 @@ /** * Module Class File for PICKLES * - * PICKLES is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. + * PHP version 5 * - * PICKLES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. + * Licensed under the GNU General Public License Version 3 + * Redistribution of these files must retain the above copyright notice. * - * You should have received a copy of the GNU Lesser General Public - * License along with PICKLES. If not, see - * . - * - * @author Joshua John Sherman - * @copyright Copyright 2007, 2008, 2009 Joshua John Sherman + * @package pickles + * @author Josh Sherman + * @copyright Copyright 2007-2010, Gravity Boulevard, LLC + * @license http://www.gnu.org/licenses/gpl.html GPL v3 * @link http://phpwithpickles.org - * @license http://www.gnu.org/copyleft/lesser.html - * @package PICKLES */ /** * Module Class * - * Every module (page) in PICKLES at both the core and site levels should - * extend this class. It handles the getting of common module variables - * (auth, data and view) as well as making sure that every module has a - * database object available. + * This is a parent class that all PICKLES modules should be extending. + * Each module can specify it's own meta data and whether or not a user + * must be properly authenticated to view the page. Currently any pages + * without a template are treated as pages being requested via AJAX and the + * return will be JSON encoded. In the future this may need to be changed + * out for logic that allows the requested module to specify what display + * type(s) it can use. */ -class Module extends Object { +class Module extends Object +{ + /** + * Page title + * + * @var string + */ + public $title; /** - * Array of public variables to be available by the display + * Meta description + * + * @var string */ - protected $public = array(); + public $description; /** - * Passed objects + * Meta keywords (comma separated) + * + * @var string */ - protected $config = null; - protected $db = null; - protected $mailer = null; - protected $error = null; + public $keywords; /** - * Template file for the module + * Access level of the page + * + * Defaults to false which is everybody, even anonymous + * + * @access protected + * @var boolean */ - protected $template = null; - protected $name = null; - - /** - * Module defaults - */ - protected $authentication = false; - protected $caching = false; - protected $display = false; - protected $session = false; + protected $access = false; - private $smarty; - private $cache_id; + /** + * Secure + * + * Whether or not the page should be loaded via SSL. Not currently + * being used. Defaults to false, non-SSL. + * + * @access protected + * @var boolean + */ + protected $secure = false; + + /** + * AJAX + * + * Whether or not the page must be loaded via AJAX and if so, what + * pages are allowed to access it and the request method. + * + * @access protected + * @var array + */ + protected $ajax = false; + + /** + * Default template + * + * Defaults to index.tpl but could be set to any valid template. + * + * @var string + */ + public $template = 'index'; /** * Constructor * - * Handles calling the parent constructor and sets up the module's - * internal config and database object + * The constructor does nothing by default but can be passed a boolean + * variable to tell it to automatically run the __default() method. + * This is typically used when a module is called outside of the scope + * of the controller (the registration page calls the login page in + * this manner. * - * @param object $config Instance of the Config class - * @param object $db Instance of the DB class - * @param object $mailer Instance of the Mailer class + * @param boolean $autorun optional flag to autorun __default() */ - public function __construct(Config $config, DB $db, Mailer $mailer, Error $error) { + public function __construct($autorun = false) + { parent::__construct(); - $this->config = $config; - $this->db = $db; - $this->mailer = $mailer; - $this->error = $error; - } - - /** - * Gets the authentication value - * - * Order of precedence: - * Module, Config, Guess (guess is always false) - * - * @return boolean Whether or not user authentication is required - */ - public function getAuthentication() { - if ($this->authentication != null) { - return $this->authentication; - } - else if (is_bool($this->config->getAuthentication())) { - return $this->config->getAuthentication(); - } - - return false; - } - - /** - * Gets the caching value - * - * Order of precedence: - * POSTed, Module, Config, Guess (guess is always false) - * - * @return boolean Whether or not user authentication is required - */ - public function getCaching() { - /* - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - return false; - } - */ - if ($this->caching != null) { - return $this->caching; - } - else if ($this->config->getCaching()) { - return $this->config->getCaching(); - } - - return false; - } - - /** - * Gets the session value - * - * Order of precedence: - * Auth On, Module, Config, Guess (guess is always false) - * - * @return boolean Whether or not the session needs to be started - */ - public function getSession() { - if ($this->authentication === true) { - return true; - } - else if ($this->session != null) { - return $this->session; - } - else if (is_bool($this->config->getSession())) { - return $this->config->getSession(); - } - - return false; - } - - /** - * Gets the requested Display - * - * Order of precedence: - * Module, Config, Guess (guess is always Smarty) - * - * @return string The display that the module has requested to be used - */ - public function getDisplay() { - - // Checks if the module has a display tyoe - if (isset($this->display)) { - // Checks if multiple display types are supported - if (is_array($this->display)) { - $display = $this->display[0]; - } - else { - $display = $this->display; - } - - if (in_array($display, array(DISPLAY_JSON, DISPLAY_PHP, DISPLAY_RSS, DISPLAY_SMARTY))) { - return $display; - } - } - - // Checks for a display type in the config - if (isset($this->config->modules->display)) { - return (string)$this->config->modules->display; - } - else { - $this->error->addWarning('Invalid display specified, DISPLAY_PHP used by default (' . $this->display . ')'); - return DISPLAY_PHP; + if ($autorun === true) + { + $this->__default(); } } /** - * Alias for $module->data + * Default "Magic" Method * - * @return array Associative array of data that was set by the module + * This function is overloaded by the module. The __default() method is + * where you want to place any code that needs to be executed at + * runtime. The reason the code isn't in the constructor is because the + * module must be instantiated before the code is executed so that the + * controller script is aware of the authentication requirements. */ - public function getData() { - if (isset($this->data)) { - return $this->data; - } + public function __default() + { - return null; - } - - public function setPublic($variable, $value) { - $this->public[$variable] = $value; - return true; - } - - public function getPublic($variable) { - if (isset($this->public[$variable])) { - return $this->public[$variable]; - } - else { - return null; - } - } - - public function setSmartyObject(Smarty $smarty) { - $this->smarty = $smarty; - } - - public function isCached($id = null) { - if ($id == null) { - $id = get_class($this); - } - - switch ($this->getDisplay()) { - case DISPLAY_PHP: - break; - - case DISPLAY_SMARTY: - if (is_object($this->smarty)) { - if ($this->smarty->template_exists('index.tpl')) { - return $this->smarty->is_cached('index.tpl', $id); - } - else { - return $this->smarty->is_cached($template, $id); - } - } - break; - } - - return false; - } - - public function setCacheID($id) { - $this->cache_id = $id; - } - - public function getCacheID() { - return $this->cache_id; - } - - /** - * Default function - * - * This function is overloaded by the module. The __default() function - * is where any code that needs to be executed at run time needs to be - * placed. It's not in the constructor as the module needs to be - * instantiated first so that the authorization requirements can be - * checked without running code it's potentially not supposed to have - * been executed. - */ - public function __default() { - } }