mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
677a39a445
Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
179 lines
No EOL
4.4 KiB
PHP
179 lines
No EOL
4.4 KiB
PHP
<?php
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
|
* Object class, allowing __construct and __destruct in PHP4.
|
|
*
|
|
* Also includes methods for logging and the special method RequestAction,
|
|
* to call other Controllers' Actions from anywhere.
|
|
*
|
|
* PHP versions 4 and 5
|
|
*
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
|
* Copyright (c) 2005, Cake Software Foundation, Inc.
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
* Las Vegas, Nevada 89104
|
|
*
|
|
* Licensed under The MIT License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @filesource
|
|
* @copyright Copyright (c) 2005, Cake Software Foundation, Inc.
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
|
* @package cake
|
|
* @subpackage cake.cake.libs
|
|
* @since CakePHP v 0.2.9
|
|
* @version $Revision$
|
|
* @modifiedby $LastChangedBy$
|
|
* @lastmodified $Date$
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
*/
|
|
|
|
/**
|
|
* Object class, allowing __construct and __destruct in PHP4.
|
|
*
|
|
* Also includes methods for logging and the special method RequestAction,
|
|
* to call other Controllers' Actions from anywhere.
|
|
*
|
|
* @package cake
|
|
* @subpackage cake.cake.libs
|
|
* @since CakePHP v 0.2.9
|
|
*/
|
|
class Object
|
|
{
|
|
|
|
/**
|
|
* Log object
|
|
*
|
|
* @var object
|
|
*/
|
|
var $_log = null;
|
|
|
|
/**
|
|
* A hack to support __construct() on PHP 4
|
|
* Hint: descendant classes have no PHP4 class_name() constructors,
|
|
* so this constructor gets called first and calls the top-layer __construct()
|
|
* which (if present) should call parent::__construct()
|
|
*
|
|
* @return Object
|
|
*/
|
|
function Object()
|
|
{
|
|
$args = func_get_args();
|
|
|
|
if (method_exists($this, '__destruct'))
|
|
{
|
|
register_shutdown_function(array(&$this, '__destruct'));
|
|
}
|
|
|
|
call_user_func_array(array(&$this, '__construct'), $args);
|
|
}
|
|
|
|
/**
|
|
* Class constructor, overridden in descendant classes.
|
|
*/
|
|
function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Object-to-string conversion.
|
|
* Each class can override this method as necessary.
|
|
*
|
|
* @return string The name of this class
|
|
*/
|
|
function toString()
|
|
{
|
|
return get_class($this);
|
|
}
|
|
|
|
/**
|
|
* Calls a controller's method from any location.
|
|
*
|
|
* @param string $url URL in the form of Cake URL ("/controller/method/parameter")
|
|
* @param array $extra If array includes the key "render" it sets the AutoRender to true.
|
|
* @return boolean Success
|
|
*/
|
|
function requestAction ($url, $extra = array())
|
|
{
|
|
$dispatcher =& new Dispatcher();
|
|
if(in_array('return', $extra))
|
|
{
|
|
$extra['return'] = 0;
|
|
$extra['bare'] = 1;
|
|
ob_start();
|
|
$out = $dispatcher->dispatch($url, $extra);
|
|
$out = ob_get_clean();
|
|
return $out;
|
|
}
|
|
else
|
|
{
|
|
$extra['return'] = 1;
|
|
$extra['bare'] = 1;
|
|
return $dispatcher->dispatch($url, $extra);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API for logging events.
|
|
*
|
|
* @param string $msg Log message
|
|
* @param int $type Error type constant. Defined in /libs/log.php.
|
|
*/
|
|
function log ($msg, $type=LOG_ERROR)
|
|
{
|
|
if(!class_exists('Log'))
|
|
{
|
|
uses('log');
|
|
}
|
|
if (is_null($this->_log))
|
|
{
|
|
$this->_log = new Log ();
|
|
}
|
|
|
|
switch ($type)
|
|
{
|
|
case LOG_DEBUG:
|
|
return $this->_log->write('debug', $msg);
|
|
default:
|
|
return $this->_log->write('error', $msg);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Renders the Missing Helper file web page.
|
|
*
|
|
*/
|
|
function missingHelperFile($file)
|
|
{
|
|
$this->missingHelperFile = $file;
|
|
$this->missingHelperClass = Inflector::camelize($file) . "Helper";
|
|
$this->pageTitle = 'Missing Helper File';
|
|
$this->render('../errors/missingHelperFile');
|
|
exit();
|
|
}
|
|
|
|
/**
|
|
* Renders the Missing Helper class web page.
|
|
*
|
|
*/
|
|
function missingHelperClass($class)
|
|
{
|
|
$this->missingHelperClass = Inflector::camelize($class) . "Helper";
|
|
$this->missingHelperFile = Inflector::underscore($class);
|
|
$this->pageTitle = 'Missing Helper Class';
|
|
$this->render('../errors/missingHelperClass');
|
|
exit();
|
|
}
|
|
|
|
function cakeError($method, $messages)
|
|
{
|
|
if(!class_exists('ErrorHandler'))
|
|
{
|
|
uses('error');
|
|
}
|
|
return new ErrorHandler($method, $messages);
|
|
}
|
|
}
|
|
|
|
?>
|