protected static function createMailer() { MLoader::register('MMail', MPATH_MIWI . '/proxy/mail/mail.php'); $mail = new MMail(); return $mail; }
<?php /* * @package Miwi Framework * @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved. * @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later */ defined('MIWI') or die('MIWI'); MLoader::register('MDatabaseQueryMySQL', dirname(__FILE__) . '/mysqlquery.php'); MLoader::register('MDatabaseExporterMySQL', dirname(__FILE__) . '/mysqlexporter.php'); MLoader::register('MDatabaseImporterMySQL', dirname(__FILE__) . '/mysqlimporter.php'); class MDatabaseMySQL extends MDatabase { public $name = 'mysql'; protected $nameQuote = '`'; protected $nullDate = '0000-00-00 00:00:00'; protected $dbMinimum = '5.0.4'; protected function __construct($options) { // Get some basic values from the options. $options['host'] = isset($options['host']) ? $options['host'] : 'localhost'; $options['user'] = isset($options['user']) ? $options['user'] : '******'; $options['password'] = isset($options['password']) ? $options['password'] : ''; $options['database'] = isset($options['database']) ? $options['database'] : ''; $options['select'] = isset($options['select']) ? (bool) $options['select'] : true; // Make sure the MySQL extension for PHP is installed and enabled. if (!function_exists('mysql_connect')) { if (MError::$legacy) { $this->errorNum = 1; $this->errorMsg = MText::_('MLIB_DATABASE_ERROR_ADAPTER_MYSQL');
protected function _createConfiguration($file) { MLoader::register('MConfig', $file); // Create the MConfig object. $config = new MConfig(); // Get the global configuration object. $registry = MFactory::getConfig(); // Load the configuration values into the registry. $registry->loadObject($config); return $config; }
} require_once MPATH_MIWI . '/defines.php'; // Import the library loader if necessary. if (!class_exists('MLoader')) { require_once MPATH_MIWI . '/loader.php'; } class_exists('MLoader') or die; MLoader::setup(); MLoader::import('framework.factory'); MLoader::import('framework.error.exception'); /* * If the HTTP_HOST environment variable is set we assume a Web request and * thus we import the request library and most likely clean the request input. */ if (isset($_SERVER['HTTP_HOST'])) { MLoader::register('MRequest', MPATH_MIWI . '/framework/environment/request.php'); // If an application flags it doesn't want this, adhere to that. if (!defined('_MREQUEST_NO_CLEAN') && (bool) ini_get('register_globals')) { //MRequest::clean(); // miwisoft ticket 110 } } MLoader::import('framework.object.object'); MLoader::import('framework.text.text'); MLoader::import('framework.route.route'); // Register the library base path for CMS libraries. MLoader::registerPrefix('M', MPATH_MIWI . '/framework'); // Define the Miwi version if not already defined. if (!defined('MVERSION')) { $Mversion = new MVersion(); define('MVERSION', $Mversion->getShortVersion()); }
<?php /* * @package Miwi Framework * @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved. * @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later */ defined('MIWI') or die('MIWI'); mimport('framework.log.logger'); // Register the MLoggerFormattedText class with the autoloader. MLoader::register('MLoggerFormattedText', dirname(__FILE__) . '/formattedtext.php'); class MLoggerW3C extends MLoggerFormattedText { protected $format = '{DATE} {TIME} {PRIORITY} {CLIENTIP} {CATEGORY} {MESSAGE}'; public function __construct(array &$options) { // The name of the text file defaults to 'error.w3c.php' if not explicitly given. if (empty($options['text_file'])) { $options['text_file'] = 'error.w3c.php'; } // Call the parent constructor. parent::__construct($options); } }
<?php /* * @package Miwi Framework * @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved. * @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later */ defined('MIWI') or die('MIWI'); mimport('framework.utilities.arrayhelper'); MLoader::register('MRegistryFormat', dirname(__FILE__) . '/format.php'); class MRegistry { protected $data; protected static $instances = array(); public function __construct($data = null) { // Instantiate the internal data object. $this->data = new stdClass(); // Optionally load supplied data. if (is_array($data) || is_object($data)) { $this->bindData($this->data, $data); } elseif (!empty($data) && is_string($data)) { $this->loadString($data); } } public function __clone() { $this->data = unserialize(serialize($this->data)); } public function __toString()
<?php /* * @package Miwi Framework * @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved. * @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later */ defined('MIWI') or die('MIWI'); mimport('framework.log.logger'); MLoader::register('LogException', MPATH_PLATFORM . '/joomla/log/logexception.php'); MLoader::discover('MLogger', dirname(__FILE__) . '/loggers'); // @deprecated 12.1 mimport('framework.filesystem.path'); class MLog { const ALL = 30719; const EMERGENCY = 1; const ALERT = 2; const CRITICAL = 4; const ERROR = 8; const WARNING = 16; const NOTICE = 32; const INFO = 64; const DEBUG = 128; protected static $instance; public static $legacy = array(); protected $configurations = array(); protected $loggers = array(); protected $lookup = array(); protected function __construct()
public static function getInstance($options = array()) { // Sanitize the database connector options. $options['driver'] = isset($options['driver']) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $options['driver']) : 'mysql'; $options['database'] = isset($options['database']) ? $options['database'] : null; $options['select'] = isset($options['select']) ? $options['select'] : true; // Get the options signature for the database connector. $signature = md5(serialize($options)); // If we already have a database connector instance for these options then just use that. if (empty(self::$instances[$signature])) { // Derive the class name from the driver. $class = 'MDatabase' . ucfirst($options['driver']); // If the class doesn't exist, let's look for it and register it. if (!class_exists($class)) { // Derive the file path for the driver class. $path = dirname(__FILE__) . '/database/' . $options['driver'] . '.php'; // If the file exists register the class with our class loader. if (file_exists($path)) { MLoader::register($class, $path); } else { // Legacy error handling switch based on the MError::$legacy switch. // @deprecated 12.1 if (MError::$legacy) { // Deprecation warning. MLog::add('MError is deprecated.', MLog::WARNING, 'deprecated'); MError::setErrorHandling(E_ERROR, 'die'); return MError::raiseError(500, MText::sprintf('MLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER', $options['driver'])); } else { throw new MDatabaseException(MText::sprintf('MLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER', $options['driver'])); } } } // If the class still doesn't exist we have nothing left to do but throw an exception. We did our best. if (!class_exists($class)) { if (MError::$legacy) { // Deprecation warning. MLog::add('MError() is deprecated.', MLog::WARNING, 'deprecated'); MError::setErrorHandling(E_ERROR, 'die'); return MError::raiseError(500, MText::sprintf('MLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER', $options['driver'])); } else { throw new MDatabaseException(MText::sprintf('MLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER', $options['driver'])); } } // Create our new MDatabase connector based on the options given. try { $instance = new $class($options); } catch (MDatabaseException $e) { // Legacy error handling switch based on the MError::$legacy switch. // @deprecated 12.1 if (MError::$legacy) { // Deprecation warning. MLog::add('MError() is deprecated.', MLog::WARNING, 'deprecated'); MError::setErrorHandling(E_ERROR, 'ignore'); return MError::raiseError(500, MText::sprintf('MLIB_DATABASE_ERROR_CONNECT_DATABASE', $e->getMessage())); } else { throw new MDatabaseException(MText::sprintf('MLIB_DATABASE_ERROR_CONNECT_DATABASE', $e->getMessage())); } } // Set the new connector to the global instances based on signature. self::$instances[$signature] = $instance; } return self::$instances[$signature]; }
<?php /* * @package Miwi Framework * @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved. * @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later */ defined('MIWI') or die('MIWI'); MLoader::register('MDocumentRenderer', dirname(__FILE__) . '/renderer.php'); mimport('framework.environment.response'); mimport('framework.filter.filteroutput'); class MDocument extends MObject { public $title = ''; public $description = ''; public $link = ''; public $base = ''; public $language = 'en-gb'; public $direction = 'ltr'; public $_generator = 'Miwisoft Framework'; public $_mdate = ''; public $_tab = "\t"; public $_lineEnd = "\n"; public $_charset = 'utf-8'; public $_mime = ''; public $_namespace = ''; public $_profile = ''; public $_scripts = array(); public $_script = array(); public $_styleSheets = array();