mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging changes from sandboxes
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@856 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
37da997748
commit
1dce095546
35 changed files with 549 additions and 428 deletions
|
@ -1,18 +1,18 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title><?=$title_for_layout?></title>
|
<title><?php echo $title_for_layout?></title>
|
||||||
<?=$html->charsetTag('UTF-8')?>
|
<?php echo $html->charsetTag('UTF-8')?>
|
||||||
<?=$html->cssTag('default')?>
|
<?php echo $html->cssTag('default')?>
|
||||||
<?=$html->cssTag('forms')?>
|
<?php echo $html->cssTag('forms')?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<?=$content_for_layout?>
|
<?php echo $content_for_layout?>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a id="logo" href="http://www.cakephp.org/" target="_new"><img src="/img/pbcake.gif" width="120" height="28" alt="CakePHP : Rapid Development Framework" /></a>
|
<a id="logo" href="http://www.cakephp.org/" target="_new"><img src="<?php echo $html->url("/img/pbcake.gif"); ?>" width="120" height="28" alt="CakePHP : Rapid Development Framework" /></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
|
||||||
<head>
|
<head>
|
||||||
<title><?=$page_title?></title>
|
<title><?php echo $page_title?></title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<?php if(DEBUG == 0) { ?>
|
<?php if(DEBUG == 0) { ?>
|
||||||
<meta http-equiv="Refresh" content="<?=$time?>;url=<?=$url?>" />
|
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>" />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<style><!--
|
<style><!--
|
||||||
P { text-align:center; font:bold 1.1em sans-serif }
|
P { text-align:center; font:bold 1.1em sans-serif }
|
||||||
|
@ -15,7 +15,7 @@ A:HOVER { text-decoration: underline; color:#44E }
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p><a href="<?=$url?>"><?=$message?></a></p>
|
<p><a href="<?php echo $url?>"><?php echo $message?></a></p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,10 +1,10 @@
|
||||||
<h1>CakePHP <em>Works!</em></h1><br/>
|
<h1>CakePHP <em>Works!</em></h1><br/>
|
||||||
<hr/>
|
<hr/>
|
||||||
Your database configuration file is <?= file_exists(CONFIGS.'database.php') ? 'present.'. $filePresent = ' ' : 'not present.';?><br/>
|
Your database configuration file is <?php echo file_exists(CONFIGS.'database.php') ? 'present.'. $filePresent = ' ' : 'not present.';?><br/>
|
||||||
<? $db = DboFactory::getInstance(); ?>
|
<?php $db = DboFactory::getInstance(); ?>
|
||||||
<? if (!empty($filePresent)):?>
|
<?php if (!empty($filePresent)):?>
|
||||||
Cake <?=$db->connected ? "is able to" : "is not able to" ?> connect to the database.
|
Cake <?php echo $db->connected ? "is able to" : "is not able to" ?> connect to the database.
|
||||||
<?endif?>
|
<?php endif; ?>
|
||||||
<hr/>
|
<hr/>
|
||||||
<br/>
|
<br/>
|
||||||
<h2>Editing <em>this Page</em></h2>
|
<h2>Editing <em>this Page</em></h2>
|
||||||
|
@ -19,10 +19,10 @@ To change the content of this page, edit <code>/app/views/pages/home.thtml</code
|
||||||
|
|
||||||
<h2>Get <em>Involved</em></h2>
|
<h2>Get <em>Involved</em></h2>
|
||||||
<p>Cake PHP needs you! We have an active user base and are always open to new bug reports or feature ideas!</p><br/>
|
<p>Cake PHP needs you! We have an active user base and are always open to new bug reports or feature ideas!</p><br/>
|
||||||
<?=$html->linkOut('Google Group','http://groups-beta.google.com/group/cake-php')?> – for public discussions about everything Cake.<br/>
|
<?php echo $html->linkOut('Google Group','http://groups-beta.google.com/group/cake-php')?> – for public discussions about everything Cake.<br/>
|
||||||
<?=$html->linkOut('Wiki','https://trac.cakephp.org/wiki')?> – fastest way of getting newest information on Cake PHP.<br/>
|
<?php echo $html->linkOut('Wiki','https://trac.cakephp.org/wiki')?> – fastest way of getting newest information on Cake PHP.<br/>
|
||||||
<?=$html->linkOut('Report a bug or feature request','https://trac.cakephp.org/newticket')?>.<br/>
|
<?php echo $html->linkOut('Report a bug or feature request','https://trac.cakephp.org/newticket')?>.<br/>
|
||||||
<?=$html->linkOut('Roadmap','https://trac.cakephp.org/roadmap')?> – check our plans for the bright future.<br/>
|
<?php echo $html->linkOut('Roadmap','https://trac.cakephp.org/roadmap')?> – check our plans for the bright future.<br/>
|
||||||
#cakephp on irc.euirc.net for quick help<br/>
|
#cakephp on irc.euirc.net for quick help<br/>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
* - 0: production
|
* - 0: production
|
||||||
* - 1: development
|
* - 1: development
|
||||||
* - 2: full debug with sql
|
* - 2: full debug with sql
|
||||||
|
*
|
||||||
|
* In production, the "flash messages" redirect after a time interval.
|
||||||
|
* With the other debug levels you get to click the "flash message" to continue.
|
||||||
*/
|
*/
|
||||||
define('DEBUG', 1);
|
define('DEBUG', 1);
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ tableCell = "<td%s>%s</td>"
|
||||||
tableRow = "<tr%s>%s</tr>"
|
tableRow = "<tr%s>%s</tr>"
|
||||||
|
|
||||||
; Tag template for a CSS link tag.
|
; Tag template for a CSS link tag.
|
||||||
css = "<link rel="%s" type="text/css" href="%s" />"
|
css = "<link rel="%s" type="text/css" href="%s" %s/>"
|
||||||
|
|
||||||
; Tag template for a charset meta-tag.
|
; Tag template for a charset meta-tag.
|
||||||
charset = "<meta http-equiv="Content-Type" content="text/html; charset=%s" />"
|
charset = "<meta http-equiv="Content-Type" content="text/html; charset=%s" />"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id:$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Short description for file.
|
||||||
|
|
|
@ -444,7 +444,7 @@ class %sTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a test for a given model.
|
* Creates a test for given model.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic defines
|
* Basic defines for timing functions.
|
||||||
*/
|
*/
|
||||||
define('SECOND', 1);
|
define('SECOND', 1);
|
||||||
define('MINUTE', 60 * SECOND);
|
define('MINUTE', 60 * SECOND);
|
||||||
|
@ -103,8 +103,8 @@ function loadController ($name)
|
||||||
/**
|
/**
|
||||||
* Lists PHP files in given directory.
|
* Lists PHP files in given directory.
|
||||||
*
|
*
|
||||||
* @param string $path Path to scan for files
|
* @param string $path Path to scan for files
|
||||||
* @return array List of files in directory
|
* @return array List of files in directory
|
||||||
*/
|
*/
|
||||||
function listClasses($path)
|
function listClasses($path)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ function listClasses($path)
|
||||||
/**
|
/**
|
||||||
* Loads configuration files
|
* Loads configuration files
|
||||||
*
|
*
|
||||||
* @return boolean True on success.
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function config ()
|
function config ()
|
||||||
{
|
{
|
||||||
|
@ -160,7 +160,7 @@ function uses ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Require given files in the VENDORS directory. Function takes optional number of parameters.
|
* Require given files in the VENDORS directory. Takes optional number of parameters.
|
||||||
*
|
*
|
||||||
* @param string $name Filename without the .php part.
|
* @param string $name Filename without the .php part.
|
||||||
*
|
*
|
||||||
|
@ -175,10 +175,12 @@ function vendor($name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup a debug point.
|
* Print out debug information about given variable.
|
||||||
*
|
*
|
||||||
* @param boolean $var
|
* Only runs if DEBUG level is non-zero.
|
||||||
* @param boolean $show_html
|
*
|
||||||
|
* @param boolean $var Variable to show debug information for.
|
||||||
|
* @param boolean $show_html If set to true, the method prints the debug data in a screen-friendly way.
|
||||||
*/
|
*/
|
||||||
function debug($var = false, $show_html = false)
|
function debug($var = false, $show_html = false)
|
||||||
{
|
{
|
||||||
|
@ -271,4 +273,66 @@ if (!function_exists('array_combine'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
function h($text)
|
||||||
|
{
|
||||||
|
return htmlspecialchars($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function a()
|
||||||
|
{
|
||||||
|
$args = func_get_args();
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ha()
|
||||||
|
{
|
||||||
|
$args = func_get_args();
|
||||||
|
|
||||||
|
for($l=0 ; $l<count($args) ; $l++)
|
||||||
|
{
|
||||||
|
$a[$args[$l]] = $l+1<count($args) ? $args[$l+1] : null;
|
||||||
|
$l++;
|
||||||
|
}
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function e($text)
|
||||||
|
{
|
||||||
|
echo $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pr($var)
|
||||||
|
{
|
||||||
|
if(DEBUG > 0)
|
||||||
|
{
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($var);
|
||||||
|
echo "</pre>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function params($p)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!is_array($p) || count($p) == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(is_array($p[0]) && count($p) == 1)
|
||||||
|
{
|
||||||
|
return $p[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
195
libs/cache.php
195
libs/cache.php
|
@ -49,113 +49,114 @@ uses('model');
|
||||||
*/
|
*/
|
||||||
class Cache extends Model {
|
class Cache extends Model {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier. Either an MD5 string or NULL.
|
* Identifier. Either an MD5 string or NULL.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $id = null;
|
var $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content container for cache data.
|
* Content container for cache data.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
*/
|
*/
|
||||||
var $data = null;
|
var $data = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content to be cached.
|
* Content to be cached.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
*/
|
*/
|
||||||
var $for_caching = null;
|
var $for_caching = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the database table used for caching.
|
* Name of the database table used for caching.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $use_table = 'cache';
|
var $use_table = 'cache';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
|
* Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
|
||||||
*
|
*
|
||||||
* @param unknown_type $id
|
* @param unknown_type $id
|
||||||
*/
|
*/
|
||||||
function __construct ($id)
|
function __construct ($id)
|
||||||
{
|
{
|
||||||
$this->id = (md5($id));
|
$this->id = (md5($id));
|
||||||
parent::__construct($this->id);
|
parent::__construct($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this object's id after setting it. If no $id is given then $this->id is returned.
|
* Returns this object's id after setting it. If called without parameters the current object's id is returned.
|
||||||
*
|
*
|
||||||
* @param unknown_type $id
|
* @param unknown_type $id
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
function id ($id=null)
|
function id ($id=null)
|
||||||
{
|
{
|
||||||
if (!$id) return $this->id;
|
if (!$id) return $this->id;
|
||||||
return ($this->id = $id);
|
return ($this->id = $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save $content in cache for $keep_for seconds.
|
* Store given content in cache database.
|
||||||
*
|
*
|
||||||
* @param string $content Content to keep in cache.
|
* @param string $content Content to keep in cache.
|
||||||
* @param int $keep_for Number of seconds to keep data in cache.
|
* @param int $keep_for Number of seconds to keep data in cache.
|
||||||
* @return unknown
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function remember ($content, $keep_for=CACHE_PAGES_FOR)
|
function remember ($content, $keep_for=CACHE_PAGES_FOR)
|
||||||
{
|
{
|
||||||
$data = addslashes($this->for_caching.$content);
|
$data = addslashes($this->for_caching.$content);
|
||||||
$expire = date("Y-m-d H:i:s",time()+($keep_for>0? $keep_for: 999999999));
|
$expire = date("Y-m-d H:i:s",time()+($keep_for>0? $keep_for: 999999999));
|
||||||
return $this->query("REPLACE {$this->use_table} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
|
return $this->query("REPLACE {$this->use_table} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns content from the Cache object itself, if the Cache object has a non-empty data property. Else from the database cache.
|
* Returns content from the Cache object itself, if the Cache object has a non-empty data property.
|
||||||
*
|
* Else from the database cache.
|
||||||
* @return unknown
|
*
|
||||||
*/
|
* @return unknown
|
||||||
function restore()
|
*/
|
||||||
{
|
function restore()
|
||||||
if (empty($this->data['data']))
|
{
|
||||||
return $this->find("id='{$this->id}' AND expire>NOW()");
|
if (empty($this->data['data']))
|
||||||
|
return $this->find("id='{$this->id}' AND expire>NOW()");
|
||||||
return $this->data['data'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return $this->data['data'];
|
||||||
* Returns true if the cache data property has current (non-stale) content for given id.
|
}
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
function has()
|
|
||||||
{
|
|
||||||
return is_array($this->data = $this->find("id='{$this->id}' AND expire>NOW()"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends $string to the for_caching property of the Cache object.
|
* Returns true if the cache data property has current (non-stale) content for given id.
|
||||||
*
|
*
|
||||||
* @param string $string
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function append($string)
|
function has()
|
||||||
{
|
{
|
||||||
$this->for_caching .= $string;
|
return is_array($this->data = $this->find("id='{$this->id}' AND expire>NOW()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the cache database table.
|
* Appends $string to the for_caching property of the Cache object.
|
||||||
*
|
*
|
||||||
* @return unknown
|
* @param string $string
|
||||||
*/
|
*/
|
||||||
function clear()
|
function append($string)
|
||||||
{
|
{
|
||||||
return $this->query("DELETE FROM {$this->use_table}");
|
$this->for_caching .= $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the cache database table.
|
||||||
|
*
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
|
function clear()
|
||||||
|
{
|
||||||
|
return $this->query("DELETE FROM {$this->use_table}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -2,9 +2,9 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Class collections.
|
||||||
*
|
*
|
||||||
* Long description for file
|
* A repository for class objects, each registered with a key.
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,9 @@
|
||||||
/**
|
/**
|
||||||
* Class Collections.
|
* Class Collections.
|
||||||
*
|
*
|
||||||
* Long description for class
|
* A repository for class objects, each registered with a key.
|
||||||
|
* If you try to add an object with the same key twice, nothing will come of it.
|
||||||
|
* If you need a second instance of an object, give it another key.
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.libs
|
* @subpackage cake.libs
|
||||||
|
@ -44,15 +46,15 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Names of classes with their objects.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $_objects = array();
|
var $_objects = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return a singleton instance of the ClassRegistry.
|
||||||
*
|
*
|
||||||
* @return ClassRegistry instance
|
* @return ClassRegistry instance
|
||||||
*/
|
*/
|
||||||
|
@ -67,10 +69,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Add $object to the registry, associating it with the name $key.
|
||||||
*
|
*
|
||||||
* @param unknown_type $key
|
* @param string $key
|
||||||
* @param unknown_type $object
|
* @param mixed $object
|
||||||
*/
|
*/
|
||||||
function addObject($key, &$object)
|
function addObject($key, &$object)
|
||||||
{
|
{
|
||||||
|
@ -83,10 +85,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Returns true if given key is present in the ClassRegistry.
|
||||||
*
|
*
|
||||||
* @param unknown_type $key
|
* @param string $key Key to look for
|
||||||
* @return unknown
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function isKeySet($key)
|
function isKeySet($key)
|
||||||
{
|
{
|
||||||
|
@ -95,18 +97,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return object which corresponds to given key.
|
||||||
*
|
*
|
||||||
* @param unknown_type $key
|
* @param string $key
|
||||||
* @return unknown
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function &getObject($key)
|
function &getObject($key)
|
||||||
{
|
{
|
||||||
$key = strtolower($key);
|
$key = strtolower($key);
|
||||||
return $this->_objects[$key];
|
return $this->_objects[$key];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -181,7 +181,7 @@ class Controller extends Object
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function __construct ($params=null)
|
function __construct ()
|
||||||
{
|
{
|
||||||
// parent::__construct();
|
// parent::__construct();
|
||||||
$r = null;
|
$r = null;
|
||||||
|
@ -190,7 +190,7 @@ class Controller extends Object
|
||||||
die("Controller::__construct() : Can't get or parse my own class name, exiting.");
|
die("Controller::__construct() : Can't get or parse my own class name, exiting.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->name = strtolower($r[1]);
|
$this->name = $r[1];
|
||||||
$this->viewPath = Inflector::underscore($r[1]);
|
$this->viewPath = Inflector::underscore($r[1]);
|
||||||
|
|
||||||
//Adding Before Filter check
|
//Adding Before Filter check
|
||||||
|
@ -227,11 +227,15 @@ class Controller extends Object
|
||||||
$dboFactory = DboFactory::getInstance($this->useDbConfig);
|
$dboFactory = DboFactory::getInstance($this->useDbConfig);
|
||||||
$this->db =& $dboFactory;
|
$this->db =& $dboFactory;
|
||||||
|
|
||||||
$model_class = Inflector::singularize($this->name);
|
$match = array();
|
||||||
|
preg_match('/(.*)Controller/i', get_class($this), $match);
|
||||||
|
|
||||||
|
$model_class = Inflector::singularize($match[1]);
|
||||||
|
$modelKey = strtolower(Inflector::underscore($model_class));
|
||||||
|
|
||||||
if (class_exists($model_class) && ($this->uses === false))
|
if (class_exists($model_class) && ($this->uses === false))
|
||||||
{
|
{
|
||||||
$this->models[$model_class] = new $model_class($id);
|
$this->models[$modelKey] = new $model_class($id);
|
||||||
}
|
}
|
||||||
elseif ($this->uses)
|
elseif ($this->uses)
|
||||||
{
|
{
|
||||||
|
@ -245,10 +249,11 @@ class Controller extends Object
|
||||||
foreach ($uses as $model_name)
|
foreach ($uses as $model_name)
|
||||||
{
|
{
|
||||||
$model_class = ucfirst(strtolower($model_name));
|
$model_class = ucfirst(strtolower($model_name));
|
||||||
|
$modelKey = strtolower(Inflector::underscore($model_class));
|
||||||
|
|
||||||
if (class_exists($model_class))
|
if (class_exists($model_class))
|
||||||
{
|
{
|
||||||
$this->models[$model_name] = new $model_class($id);
|
$this->models[$modelKey] = new $model_class($id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -357,8 +362,9 @@ class Controller extends Object
|
||||||
|
|
||||||
if(!empty($this->models))
|
if(!empty($this->models))
|
||||||
{
|
{
|
||||||
foreach ($this->models as $key => $value)
|
foreach ($this->models as $key)
|
||||||
{
|
{
|
||||||
|
$key = Inflector::underscore(get_class($key));
|
||||||
if(!empty($this->models[$key]->validationErrors))
|
if(!empty($this->models[$key]->validationErrors))
|
||||||
{
|
{
|
||||||
$view->validationErrors[$key] =& $this->models[$key]->validationErrors;
|
$view->validationErrors[$key] =& $this->models[$key]->validationErrors;
|
||||||
|
@ -448,14 +454,15 @@ class Controller extends Object
|
||||||
* @param string $url Relative URL to redirect to after the time expires
|
* @param string $url Relative URL to redirect to after the time expires
|
||||||
* @param int $time Time to show the message
|
* @param int $time Time to show the message
|
||||||
*/
|
*/
|
||||||
function flash($message, $url, $time=1)
|
function flash($message, $url, $pause=1)
|
||||||
{
|
{
|
||||||
$this->autoRender = false;
|
$this->autoRender = false;
|
||||||
$this->autoLayout = false;
|
$this->autoLayout = false;
|
||||||
|
|
||||||
$this->set('url', $this->base.$url);
|
$this->set('url', $this->base.$url);
|
||||||
$this->set('message', $message);
|
$this->set('message', $message);
|
||||||
$this->set('time', $time);
|
$this->set('pause', $pause);
|
||||||
|
$this->set('page_title', $message);
|
||||||
|
|
||||||
$this->render(null,false,VIEWS.'layouts'.DS.'flash.thtml');
|
$this->render(null,false,VIEWS.'layouts'.DS.'flash.thtml');
|
||||||
}
|
}
|
||||||
|
@ -497,11 +504,11 @@ class Controller extends Object
|
||||||
|
|
||||||
// figure out what model and table we are working with
|
// figure out what model and table we are working with
|
||||||
$model = Inflector::pluralize($this->name);
|
$model = Inflector::pluralize($this->name);
|
||||||
$table = Inflector::singularize($this->name);
|
$table = Inflector::underscore(Inflector::singularize($this->name));
|
||||||
|
|
||||||
// get all of the column names.
|
// get all of the column names.
|
||||||
$classRegistry =& ClassRegistry::getInstance();
|
$classRegistry =& ClassRegistry::getInstance();
|
||||||
$objRegistryModel = $classRegistry->getObject($table);
|
$objRegistryModel = $classRegistry->getObject(Inflector::singularize($model));
|
||||||
|
|
||||||
foreach ($objRegistryModel->_table_info as $tables)
|
foreach ($objRegistryModel->_table_info as $tables)
|
||||||
{
|
{
|
||||||
|
@ -676,7 +683,6 @@ class Controller extends Object
|
||||||
$fieldNames[ $tabl['name']]['options'] = array();
|
$fieldNames[ $tabl['name']]['options'] = array();
|
||||||
|
|
||||||
$enumValues = split(',', $fieldLength );
|
$enumValues = split(',', $fieldLength );
|
||||||
$iCount = 1;
|
|
||||||
foreach ($enumValues as $enum )
|
foreach ($enumValues as $enum )
|
||||||
{
|
{
|
||||||
$enum = trim( $enum, "'" );
|
$enum = trim( $enum, "'" );
|
||||||
|
@ -704,7 +710,7 @@ class Controller extends Object
|
||||||
// loop through the many to many relations to make a list box.
|
// loop through the many to many relations to make a list box.
|
||||||
foreach( $objRegistryModel->_manyToMany as $relation )
|
foreach( $objRegistryModel->_manyToMany as $relation )
|
||||||
{
|
{
|
||||||
list($tableName, $field, $value, $joinTable, $key1, $key2) = $relation;
|
list($tableName) = $relation;
|
||||||
|
|
||||||
$otherModelName = Inflector::singularize($tableName);
|
$otherModelName = Inflector::singularize($tableName);
|
||||||
$otherModel = new $otherModelName();
|
$otherModel = new $otherModelName();
|
||||||
|
|
|
@ -3,7 +3,7 @@ uses('helpers/form');
|
||||||
|
|
||||||
$form = new FormHelper();
|
$form = new FormHelper();
|
||||||
|
|
||||||
echo $html->formTag('/'.$this->name.'/update');
|
echo $html->formTag('/'.Inflector::underscore($this->name).'/update');
|
||||||
|
|
||||||
echo $form->generateFields( $html, $fieldNames );
|
echo $form->generateFields( $html, $fieldNames );
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ uses('helpers/form');
|
||||||
<ul class='actions'>
|
<ul class='actions'>
|
||||||
<?php
|
<?php
|
||||||
$modelName = Inflector::singularize($this->name);
|
$modelName = Inflector::singularize($this->name);
|
||||||
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelName), '/'.$this->viewPath.'/destroy/'.$data[$modelName]['id'])."</li>";
|
$modelKey = Inflector::underscore($modelName);
|
||||||
|
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelName), '/'.$this->viewPath.'/destroy/'.$data[$modelKey]['id'])."</li>";
|
||||||
|
|
||||||
foreach( $fieldNames as $field=>$value ) {
|
foreach( $fieldNames as $field => $value ) {
|
||||||
if( isset( $value['foreignKey'] ) )
|
if( isset( $value['foreignKey'] ) )
|
||||||
{
|
{
|
||||||
echo "<li>".$html->linkTo( "View ".Inflector::humanize($value['controller']), "/".Inflector::underscore($value['controller'])."/show/".$data[Inflector::singularize($params['controller'])][$field] )."</li>";
|
echo "<li>".$html->linkTo( "View ".Inflector::humanize($value['controller']), "/".Inflector::underscore($value['controller'])."/show/".$data[Inflector::singularize($params['controller'])][$field] )."</li>";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
$model = Inflector::pluralize($this->name);
|
$model = Inflector::pluralize($this->name);
|
||||||
$table = Inflector::singularize($this->name);
|
//$table = Inflector::underscore(get_class($this->models[strtolower(Inflector::singularize(Inflector::underscore($this->name)))]));
|
||||||
|
|
||||||
|
$modelKey = Inflector::underscore(Inflector::singularize($this->name));
|
||||||
$humanName = Inflector::humanize($this->name);
|
$humanName = Inflector::humanize($this->name);
|
||||||
$humanSingularName = Inflector::singularize( $humanName );
|
$humanSingularName = Inflector::singularize( $humanName );
|
||||||
// var_dump( $data );
|
// var_dump( $data );
|
||||||
|
@ -40,18 +42,18 @@
|
||||||
{
|
{
|
||||||
$displayText = $row[$otherModelName][ $otherModelObject->getDisplayField() ];
|
$displayText = $row[$otherModelName][ $otherModelObject->getDisplayField() ];
|
||||||
} else{
|
} else{
|
||||||
$displayText = $row[$table][$field];
|
$displayText = $row[$modelKey][$field];
|
||||||
}
|
}
|
||||||
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$table][$field] );
|
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo $row[$table ][$field];
|
echo $row[$modelKey][$field];
|
||||||
} ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
<?php } // end for each $fieldNames as $field=>value ?>
|
<?php } // end for each $fieldNames as $field=>value ?>
|
||||||
<td class="listactions"><?php echo $html->linkTo('View',"/".$this->viewPath."/show/{$row[$table]['id']}/")?>
|
<td class="listactions"><?php echo $html->linkTo('View',"/".$this->viewPath."/show/{$row[$modelKey]['id']}/")?>
|
||||||
<?php echo $html->linkTo('Edit',"/".$this->viewPath."/edit/{$row[$table]['id']}/")?>
|
<?php echo $html->linkTo('Edit',"/".$this->viewPath."/edit/{$row[$modelKey]['id']}/")?>
|
||||||
<?php echo $html->linkTo('Delete',"/".$this->viewPath."/destroy/{$row[$table]['id']}/")?>
|
<?php echo $html->linkTo('Delete',"/".$this->viewPath."/destroy/{$row[$modelKey]['id']}/")?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -3,7 +3,7 @@ uses('helpers/form');
|
||||||
|
|
||||||
$form = new FormHelper();
|
$form = new FormHelper();
|
||||||
|
|
||||||
echo $html->formTag('/'.$this->name.'/create');
|
echo $html->formTag('/'.Inflector::underscore($this->name).'/create');
|
||||||
|
|
||||||
echo $form->generateFields( $html, $fieldNames );
|
echo $form->generateFields( $html, $fieldNames );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$modelName = Inflector::singularize($this->name);
|
$modelName = Inflector::singularize($this->name);
|
||||||
|
$modelKey = Inflector::underscore($modelName);
|
||||||
$registry = ClassRegistry::getInstance();
|
$registry = ClassRegistry::getInstance();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -11,9 +12,9 @@
|
||||||
$displayField = $otherModelObject->getDisplayField();
|
$displayField = $otherModelObject->getDisplayField();
|
||||||
$displayText = $data[$value['model']][ $displayField ];
|
$displayText = $data[$value['model']][ $displayField ];
|
||||||
|
|
||||||
if( !empty($data[$modelName][$field]))
|
if( !empty($data[$modelKey][$field]))
|
||||||
{
|
{
|
||||||
echo "<dd>".$html->linkTo($displayText, '/'.Inflector::underscore($value['controller']).'/show/'.$data[$modelName][ $field ] )."</dd>";
|
echo "<dd>".$html->linkTo($displayText, '/'.Inflector::underscore($value['controller']).'/show/'.$data[$modelKey][ $field ] )."</dd>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,9 +24,9 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this is just a plain old field.
|
// this is just a plain old field.
|
||||||
if( !empty($data[$modelName][$field]))
|
if( !empty($data[$modelKey][$field]))
|
||||||
{
|
{
|
||||||
echo "<dd>".$data[$modelName][$field]."</dd>";
|
echo "<dd>".$data[$modelKey][$field]."</dd>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -38,8 +39,8 @@
|
||||||
</dl>
|
</dl>
|
||||||
<ul class='actions'>
|
<ul class='actions'>
|
||||||
<?php
|
<?php
|
||||||
echo "<li>".$html->linkTo('Edit '.Inflector::humanize($modelName), '/'.$this->viewPath.'/edit/'.$data[$modelName]['id'])."</li>";
|
echo "<li>".$html->linkTo('Edit '.Inflector::humanize($modelKey), '/'.$this->viewPath.'/edit/'.$data[$modelKey]['id'])."</li>";
|
||||||
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelName), '/'.$this->viewPath.'/destroy/'.$data[$modelName]['id'])."</li>";
|
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelKey), '/'.$this->viewPath.'/destroy/'.$data[$modelKey]['id'])."</li>";
|
||||||
|
|
||||||
foreach( $fieldNames as $field=>$value ) {
|
foreach( $fieldNames as $field=>$value ) {
|
||||||
if( isset( $value['foreignKey'] ) )
|
if( isset( $value['foreignKey'] ) )
|
||||||
|
@ -146,4 +147,4 @@
|
||||||
</ul></div>
|
</ul></div>
|
||||||
|
|
||||||
<?php } // end loop through relations
|
<?php } // end loop through relations
|
||||||
?>
|
?>
|
|
@ -144,8 +144,18 @@ class DBO_MySQL extends DBO
|
||||||
$cols = $this->all("DESC {$table_name}");
|
$cols = $this->all("DESC {$table_name}");
|
||||||
|
|
||||||
foreach ($cols as $column)
|
foreach ($cols as $column)
|
||||||
|
{
|
||||||
// $fields[] = array('name'=>$column['Field'], 'type'=>$column['Type']);
|
// $fields[] = array('name'=>$column['Field'], 'type'=>$column['Type']);
|
||||||
$fields[] = array('name'=>$column[0]['Field'], 'type'=>$column[0]['Type']);
|
if(isset($column['COLUMNS']) && !isset($column[0]))
|
||||||
|
{
|
||||||
|
$column[0] = $column['COLUMNS'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($column[0]))
|
||||||
|
{
|
||||||
|
$fields[] = array('name' => $column[0]['Field'], 'type' => $column[0]['Type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +221,7 @@ class DBO_MySQL extends DBO
|
||||||
*/
|
*/
|
||||||
function selectLimit ($limit, $offset=null)
|
function selectLimit ($limit, $offset=null)
|
||||||
{
|
{
|
||||||
return $limit? " LIMIT {$limit}".($offset? "{$offset}": null): null;
|
return $limit? " LIMIT".($offset? " {$offset},": null)." {$limit}": null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Dispatcher takes the URL information, parses it for paramters and
|
||||||
|
* tells the involved controllers what to do.
|
||||||
*
|
*
|
||||||
* Long description for file
|
* This is the heart of Cake's operation.
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -65,7 +66,7 @@ class Dispatcher extends Object
|
||||||
var $base = false;
|
var $base = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches base url.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
@ -73,30 +74,19 @@ class Dispatcher extends Object
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches the request (action).
|
* Dispatches and invokes given URL, handing over control to the involved controllers, and then renders the results (if autoRender is set).
|
||||||
*
|
*
|
||||||
* @param string $url
|
* If no controller of given name can be found, invoke() shows error messages in
|
||||||
* @return array
|
* the form of Missing Controllers information. It does the same with Actions (methods of Controllers are called
|
||||||
|
* Actions).
|
||||||
|
*
|
||||||
|
* @param string $url URL information to work on.
|
||||||
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function dispatch($url)
|
function dispatch($url)
|
||||||
{
|
{
|
||||||
$params = $this->parseParams($url);
|
|
||||||
$result = $this->invoke($url);
|
|
||||||
|
|
||||||
return $result === true? $params: array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter description here...
|
|
||||||
*
|
|
||||||
* @param string $url
|
|
||||||
* @return unknown
|
|
||||||
*/
|
|
||||||
function invoke($url)
|
|
||||||
{
|
|
||||||
global $_POST, $_GET, $_FILES, $_SESSION;
|
|
||||||
|
|
||||||
$params = $this->parseParams($url);
|
$params = $this->parseParams($url);
|
||||||
$missingController = false;
|
$missingController = false;
|
||||||
$missingAction = false;
|
$missingAction = false;
|
||||||
|
@ -217,13 +207,11 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
|
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
|
||||||
*
|
*
|
||||||
* @param string $from_url
|
* @param string $from_url URL to mine for parameter information.
|
||||||
* @return array Parameters found in POST and GET.
|
* @return array Parameters found in POST and GET.
|
||||||
*/
|
*/
|
||||||
function parseParams($from_url)
|
function parseParams($from_url)
|
||||||
{
|
{
|
||||||
global $_POST, $_FILES;
|
|
||||||
|
|
||||||
// load routes config
|
// load routes config
|
||||||
$Route = new Router();
|
$Route = new Router();
|
||||||
include CONFIGS.'routes.php';
|
include CONFIGS.'routes.php';
|
||||||
|
@ -233,7 +221,14 @@ class Dispatcher extends Object
|
||||||
$params['form'] = $_POST;
|
$params['form'] = $_POST;
|
||||||
if (isset($_POST['data']))
|
if (isset($_POST['data']))
|
||||||
{
|
{
|
||||||
$params['data'] = (ini_get('magic_quotes_gpc') == 1) ? $this->stripslashes_deep($_POST['data']) : $_POST['data'];
|
$params['data'] = (ini_get('magic_quotes_gpc') == 1)?
|
||||||
|
$this->stripslashes_deep($_POST['data']) : $_POST['data'];
|
||||||
|
}
|
||||||
|
if (isset($_GET))
|
||||||
|
{
|
||||||
|
$params['url'] = $this->urldecode_deep($_GET);
|
||||||
|
$params['url'] = (ini_get('magic_quotes_gpc') == 1)?
|
||||||
|
$this->stripslashes_deep($params['url']) : $params['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($_FILES as $name => $data)
|
foreach ($_FILES as $name => $data)
|
||||||
|
@ -254,14 +249,23 @@ class Dispatcher extends Object
|
||||||
array_map(array('Dispatcher','stripslashes_deep'), $val) : stripslashes($val);
|
array_map(array('Dispatcher','stripslashes_deep'), $val) : stripslashes($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively performs urldecode.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function urldecode_deep($val)
|
||||||
|
{
|
||||||
|
return (is_array($val)) ?
|
||||||
|
array_map(array('Dispatcher','urldecode_deep'), $val) : urldecode($val);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a base URL.
|
* Returns a base URL.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string Base URL
|
||||||
*/
|
*/
|
||||||
function baseUrl()
|
function baseUrl()
|
||||||
{
|
{
|
||||||
global $_SERVER;
|
|
||||||
|
|
||||||
//non mod_rewrite use:
|
//non mod_rewrite use:
|
||||||
if (defined('BASE_URL')) return BASE_URL;
|
if (defined('BASE_URL')) return BASE_URL;
|
||||||
|
@ -281,8 +285,8 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* Displays an error page (e.g. 404 Not found).
|
* Displays an error page (e.g. 404 Not found).
|
||||||
*
|
*
|
||||||
* @param int $code Error code (e.g. 404)
|
* @param int $code Error code (e.g. 404)
|
||||||
* @param string $name Name of the error message (e.g. Not found)
|
* @param string $name Name of the error message (e.g. Not found)
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
function error ($code, $name, $message)
|
function error ($code, $name, $message)
|
||||||
|
@ -295,8 +299,8 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* Convenience method to display a 404 page.
|
* Convenience method to display a 404 page.
|
||||||
*
|
*
|
||||||
* @param unknown_type $url
|
* @param string $url URL that spawned this message, to be included in the output.
|
||||||
* @param unknown_type $message
|
* @param string $message Message text for the 404 page.
|
||||||
*/
|
*/
|
||||||
function error404 ($url, $message)
|
function error404 ($url, $message)
|
||||||
{
|
{
|
||||||
|
@ -304,9 +308,10 @@ class Dispatcher extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If DEBUG is set, this displays a 404 error with the message that no controller is set. If DEBUG is not set, nothing happens.
|
* If DEBUG is set, this displays a 404 error with the message that no controller is set.
|
||||||
|
* If DEBUG is not set, nothing happens.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url URL that spawned this message, to be included in the output.
|
||||||
*/
|
*/
|
||||||
function errorNoController ($url)
|
function errorNoController ($url)
|
||||||
{
|
{
|
||||||
|
@ -319,7 +324,7 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* If DEBUG is set, this displays a 404 error with the message that the asked-for controller does not exist. If DEBUG is not set, nothing happens.
|
* If DEBUG is set, this displays a 404 error with the message that the asked-for controller does not exist. If DEBUG is not set, nothing happens.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url URL that spawned this message, to be included in the output.
|
||||||
* @param string $controller_class
|
* @param string $controller_class
|
||||||
*/
|
*/
|
||||||
function errorUnknownController ($url, $controller_class)
|
function errorUnknownController ($url, $controller_class)
|
||||||
|
@ -333,7 +338,7 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* If DEBUG is set, this displays a 404 error with the message that no action is set. If DEBUG is not set, nothing happens.
|
* If DEBUG is set, this displays a 404 error with the message that no action is set. If DEBUG is not set, nothing happens.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url URL that spawned this message, to be included in the output.
|
||||||
*/
|
*/
|
||||||
function errorNoAction ($url)
|
function errorNoAction ($url)
|
||||||
{
|
{
|
||||||
|
@ -346,7 +351,7 @@ class Dispatcher extends Object
|
||||||
/**
|
/**
|
||||||
* If DEBUG is set, this displays a 404 error with the message that no such action exists. If DEBUG is not set, nothing happens.
|
* If DEBUG is set, this displays a 404 error with the message that no such action exists. If DEBUG is not set, nothing happens.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url URL that spawned this message, to be included in the output.
|
||||||
* @param string $controller_class
|
* @param string $controller_class
|
||||||
* @param string $action
|
* @param string $action
|
||||||
*/
|
*/
|
||||||
|
@ -359,17 +364,17 @@ class Dispatcher extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When now methods are present in a controller
|
* When methods are now present in a controller
|
||||||
* scaffoldView is used to call default Scaffold methods if:
|
* scaffoldView is used to call default Scaffold methods if:
|
||||||
* <code>
|
* <code>
|
||||||
* var $scaffold;
|
* var $scaffold;
|
||||||
* </code>
|
* </code>
|
||||||
* is placed in the controller class definition
|
* is placed in the controller's class definition.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $controller_class
|
* @param string $controller_class
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @since Cake v 1.0.0.172
|
* @since Cake v 0.10.0.172
|
||||||
*/
|
*/
|
||||||
function scaffoldView ($url, $controller_class, $params)
|
function scaffoldView ($url, $controller_class, $params)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Convenience class for reading, writing and appending to files.
|
||||||
*
|
*
|
||||||
* Long description for file
|
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -33,9 +32,8 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for class
|
* Convenience class for reading, writing and appending to files.
|
||||||
*
|
*
|
||||||
* Long description for class
|
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.libs
|
* @subpackage cake.libs
|
||||||
|
@ -44,16 +42,16 @@
|
||||||
class File
|
class File
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Path to file
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $path = null;
|
var $path = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param unknown_type $path
|
* @param string $path
|
||||||
* @return File
|
* @return File
|
||||||
*/
|
*/
|
||||||
function File ($path)
|
function File ($path)
|
||||||
|
@ -62,9 +60,9 @@ class File
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return the contents of this File as a string.
|
||||||
*
|
*
|
||||||
* @return unknown
|
* @return string Contents
|
||||||
*/
|
*/
|
||||||
function read ()
|
function read ()
|
||||||
{
|
{
|
||||||
|
@ -72,10 +70,10 @@ class File
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Append given data string to this File.
|
||||||
*
|
*
|
||||||
* @param unknown_type $data
|
* @param string $data Data to write
|
||||||
* @return unknown
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function append ($data)
|
function append ($data)
|
||||||
{
|
{
|
||||||
|
@ -83,11 +81,11 @@ class File
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Write given data to this File.
|
||||||
*
|
*
|
||||||
* @param unknown_type $data
|
* @param string $data Data to write to this File.
|
||||||
* @param unknown_type $mode
|
* @param string $mode Mode of writing. {@link http://php.net/fwrite See fwrite()}.
|
||||||
* @return unknown
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function write ($data, $mode = 'w')
|
function write ($data, $mode = 'w')
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Text-to-HTML parser.
|
||||||
*
|
*
|
||||||
* Long description for file
|
* Text-to-html parser, similar to {@link http://textism.com/tools/textile/ Textile} or {@link http://www.whytheluckystiff.net/ruby/redcloth/ RedCloth}.
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
uses('object');
|
uses('object');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for class
|
* Text-to-HTML parser.
|
||||||
*
|
*
|
||||||
* Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
|
* Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
|
||||||
*
|
*
|
||||||
|
@ -49,14 +49,14 @@ uses('object');
|
||||||
class Flay extends Object
|
class Flay extends Object
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Text to be parsed.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $text = null;
|
var $text = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Set this to allow HTML in the markup.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,7 @@ class Flay extends Object
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param unknown_type $text
|
* @param string $text
|
||||||
*/
|
*/
|
||||||
function __construct ($text=null)
|
function __construct ($text=null)
|
||||||
{
|
{
|
||||||
|
@ -74,10 +74,10 @@ class Flay extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns $text translated to HTML using the Flay syntax.
|
* Returns given text translated to HTML using the Flay syntax.
|
||||||
*
|
*
|
||||||
* @param string $text Text to format
|
* @param string $text String to format
|
||||||
* @param boolean $bare
|
* @param boolean $bare Set this to only do <p> transforms and > to >, no typography additions.
|
||||||
* @param boolean $allowHtml Set this to trim whitespace and disable all HTML
|
* @param boolean $allowHtml Set this to trim whitespace and disable all HTML
|
||||||
* @return string Formatted text
|
* @return string Formatted text
|
||||||
*/
|
*/
|
||||||
|
@ -85,15 +85,21 @@ class Flay extends Object
|
||||||
{
|
{
|
||||||
|
|
||||||
if (empty($text) && empty($this->text))
|
if (empty($text) && empty($this->text))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$text = $text? $text: $this->text;
|
$text = $text? $text: $this->text;
|
||||||
|
|
||||||
// trim whitespace and disable all HTML
|
// trim whitespace and disable all HTML
|
||||||
if ($allowHtml)
|
if ($allowHtml)
|
||||||
|
{
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$text = str_replace('<', '<', str_replace('>', '>', trim($text)));
|
$text = str_replace('<', '<', str_replace('>', '>', trim($text)));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$bare)
|
if (!$bare)
|
||||||
{
|
{
|
||||||
|
@ -195,9 +201,13 @@ class Flay extends Object
|
||||||
if (isset($regs[2]))
|
if (isset($regs[2]))
|
||||||
{
|
{
|
||||||
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $regs[2]))
|
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $regs[2]))
|
||||||
|
{
|
||||||
$body = "<img src=\"{$prefix}{$regs[2]}\" alt=\"\" />";
|
$body = "<img src=\"{$prefix}{$regs[2]}\" alt=\"\" />";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$body = $regs[2];
|
$body = $regs[2];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -235,10 +245,10 @@ class Flay extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return the words of the string as an array.
|
||||||
*
|
*
|
||||||
* @param unknown_type $string
|
* @param string $string
|
||||||
* @return unknown
|
* @return array Array of words
|
||||||
*/
|
*/
|
||||||
function extractWords ($string)
|
function extractWords ($string)
|
||||||
{
|
{
|
||||||
|
@ -246,12 +256,13 @@ class Flay extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return given string with words in array colorMarked, up to a number of times (defaults to 5).
|
||||||
*
|
*
|
||||||
* @param unknown_type $words
|
* @param array $words Words to look for and markup
|
||||||
* @param unknown_type $string
|
* @param string $string String to look in
|
||||||
* @param unknown_type $max_snippets
|
* @param integer $max_snippets Max number of snippets to extract
|
||||||
* @return unknown
|
* @return string
|
||||||
|
* @see colorMark
|
||||||
*/
|
*/
|
||||||
function markedSnippets ($words, $string, $max_snippets=5)
|
function markedSnippets ($words, $string, $max_snippets=5)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +276,9 @@ class Flay extends Object
|
||||||
if (preg_match_all("/[\s,]+.{0,40}{$word}.{0,40}[\s,]+/i", $rest, $r))
|
if (preg_match_all("/[\s,]+.{0,40}{$word}.{0,40}[\s,]+/i", $rest, $r))
|
||||||
{
|
{
|
||||||
foreach ($r as $result)
|
foreach ($r as $result)
|
||||||
|
{
|
||||||
$rest = str_replace($result, '', $rest);
|
$rest = str_replace($result, '', $rest);
|
||||||
|
}
|
||||||
$snips = array_merge($snips, $r[0]);
|
$snips = array_merge($snips, $r[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,17 +288,17 @@ class Flay extends Object
|
||||||
$snips = array_slice($snips, 0, $max_snippets);
|
$snips = array_slice($snips, 0, $max_snippets);
|
||||||
}
|
}
|
||||||
$joined = join(' <b>...</b> ', $snips);
|
$joined = join(' <b>...</b> ', $snips);
|
||||||
$snips = $joined? "<b>...</b> {$joined} <b>...</b>": substr($string, 0, 80).'<b>...</b>';
|
$snips = $joined? "<b>...</b> {$joined} <b>...</b>": substr($string, 0, 80) . '<b>...</b>';
|
||||||
|
|
||||||
return Flay::colorMark($words, $snips);
|
return Flay::colorMark($words, $snips);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Returns string with EM elements with color classes added.
|
||||||
*
|
*
|
||||||
* @param unknown_type $words
|
* @param array $words Array of words to be colorized
|
||||||
* @param unknown_type $string
|
* @param string $string Text in which the words might be found
|
||||||
* @return unknown
|
* @return string
|
||||||
*/
|
*/
|
||||||
function colorMark($words, $string)
|
function colorMark($words, $string)
|
||||||
{
|
{
|
||||||
|
@ -294,52 +307,58 @@ class Flay extends Object
|
||||||
$nextColorIndex = 0;
|
$nextColorIndex = 0;
|
||||||
foreach ($words as $word)
|
foreach ($words as $word)
|
||||||
{
|
{
|
||||||
$string = preg_replace("/({$word})/i", '<em class="'.$colors[$nextColorIndex%count($colors)]."\">\\1</em>", $string);
|
$string = preg_replace("/({$word})/i", '<em class="' . $colors[$nextColorIndex%count($colors)] . "\">\\1</em>", $string);
|
||||||
$nextColorIndex++;
|
$nextColorIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Returns given text with tags stripped out.
|
||||||
*
|
*
|
||||||
* @param unknown_type $text
|
* @param string $text
|
||||||
* @return unknown
|
* @return string
|
||||||
*/
|
*/
|
||||||
function toClean ($text)
|
function toClean ($text)
|
||||||
{
|
{
|
||||||
return strip_tags(html_entity_decode($text, ENT_QUOTES));
|
return strip_tags(html_entity_decode($text, ENT_QUOTES));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return parsed text with tags stripped out.
|
||||||
|
*
|
||||||
|
* @param string $text
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function toParsedAndClean ($text)
|
function toParsedAndClean ($text)
|
||||||
{
|
{
|
||||||
return Flay::toClean(Flay::toHtml($text));
|
return Flay::toClean(Flay::toHtml($text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Return a fragment of a text, up to $length characters long, with an ellipsis after it.
|
||||||
*
|
*
|
||||||
* @param unknown_type $text
|
* @param string $text Text to be truncated.
|
||||||
* @param unknown_type $length
|
* @param integer $length Max length of text.
|
||||||
* @param unknown_type $elipsis
|
* @param string $ellipsis Sign to print after truncated text.
|
||||||
* @return unknown
|
* @return string
|
||||||
*/
|
*/
|
||||||
function fragment ($text, $length, $elipsis='...')
|
function fragment ($text, $length, $ellipsis='...')
|
||||||
{
|
{
|
||||||
$soft=$length-5;
|
$soft = $length - 5;
|
||||||
$hard=$length+5;
|
$hard = $length + 5;
|
||||||
$rx = '/(.{'.$soft.','.$hard.'})[\s,\.:\/="!\(\)<>~\[\]]+.*/';
|
$rx = '/(.{' . $soft . ',' . $hard . '})[\s,\.:\/="!\(\)<>~\[\]]+.*/';
|
||||||
if (preg_match($rx, $text, $r))
|
if (preg_match($rx, $text, $r))
|
||||||
{
|
{
|
||||||
$out = $r[1];
|
$out = $r[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out = substr($text,0,$length);
|
$out = substr($text, 0, $length);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = $out.(strlen($out)<strlen($text)? $elipsis: null);
|
$out = $out . (strlen($out)<strlen($text)? $ellipsis: null);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Convenience class for handling directories.
|
||||||
*
|
*
|
||||||
* Long description for file
|
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
|
|
@ -116,9 +116,11 @@ class AjaxHelper extends Helper
|
||||||
{
|
{
|
||||||
// mouse click should call our remote function
|
// mouse click should call our remote function
|
||||||
$html_options['onclick'] = $this->remoteFunction($html, $options);
|
$html_options['onclick'] = $this->remoteFunction($html, $options);
|
||||||
|
|
||||||
|
$href = (!empty($options['fallback'])) ? $options['fallback'] : '#';
|
||||||
|
|
||||||
// generate actual link
|
// generate actual link
|
||||||
return $html->link($title, '#', $html_options);
|
return $html->link($title, $href, $html_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,19 +144,20 @@ class AjaxHelper extends Helper
|
||||||
|
|
||||||
if (isset($options['before']))
|
if (isset($options['before']))
|
||||||
{
|
{
|
||||||
$func .= "{$options['before']}; $function";
|
$func = "{$options['before']}; $function";
|
||||||
}
|
}
|
||||||
if (isset($options['after']))
|
if (isset($options['after']))
|
||||||
{
|
{
|
||||||
$func .= "$func; {$options['before']};";
|
$func = "$func; {$options['before']};";
|
||||||
}
|
}
|
||||||
if (isset($options['condition']))
|
if (isset($options['condition']))
|
||||||
{
|
{
|
||||||
$func .= "if ({$options['condition']}) { $func; }";
|
$func = "if ({$options['condition']}) { $func; }";
|
||||||
}
|
}
|
||||||
if (isset($options['confirm']))
|
if (isset($options['confirm']))
|
||||||
{
|
{
|
||||||
$func .= "if (confirm('" . $this->escapeScript($options['confirm']) . "')) { $func; }";
|
$js = new JavascriptHelper;
|
||||||
|
$func = "if (confirm('" . $js->escapeScript($options['confirm']) . "')) { $func; } else { return false; }";
|
||||||
}
|
}
|
||||||
return $func;
|
return $func;
|
||||||
}
|
}
|
||||||
|
|
|
@ -420,12 +420,13 @@ class HtmlHelper extends Helper
|
||||||
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT
|
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT
|
||||||
* and $return.
|
* and $return.
|
||||||
*/
|
*/
|
||||||
function image($path, $htmlAttributes = null, $return = false)
|
|
||||||
{
|
function image($path, $htmlAttributes = null, $return = false)
|
||||||
$url = $this->base.IMAGES_URL.$path;
|
{
|
||||||
$alt = $htmlAttributes['alt'];
|
$url = $this->base.IMAGES_URL.$path;
|
||||||
return $this->output(sprintf($this->tags['image'], $url, $alt, $this->parseHtmlOptions($htmlAttributes, null, '', ' ')), $return);
|
$alt = isset($htmlAttributes['alt']) ? $htmlAttributes['alt'] : "";
|
||||||
}
|
return $this->output(sprintf($this->tags['image'], $url, $alt, $this->parseHtmlOptions($htmlAttributes, null, '', ' ')), $return);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a text input widget.
|
* Creates a text input widget.
|
||||||
|
@ -531,11 +532,11 @@ class HtmlHelper extends Helper
|
||||||
$cells_out = array();
|
$cells_out = array();
|
||||||
foreach ($line as $cell)
|
foreach ($line as $cell)
|
||||||
{
|
{
|
||||||
$cells_out[] = sprintf($this->tags['tableCell'], null, $cell);
|
$cells_out[] = sprintf($this->tags['tablecell'], null, $cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = $this->parseHtmlOptions($count%2? $odd_tr_options: $even_tr_options);
|
$options = $this->parseHtmlOptions($count%2? $odd_tr_options: $even_tr_options);
|
||||||
$out[] = sprintf($this->tags['tableRow'], $options, join(' ', $cells_out));
|
$out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cells_out));
|
||||||
}
|
}
|
||||||
|
|
||||||
return join("\n", $out);
|
return join("\n", $out);
|
||||||
|
|
|
@ -30,14 +30,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if(!defined("TAG_JAVASCRIPT")) {
|
|
||||||
define("TAG_JAVASCRIPT", '<script type="text/javascript">%s</script>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!defined("TAG_JAVASCRIPT_INCLUDE")) {
|
|
||||||
define("TAG_JAVASCRIPT_INCLUDE", '<script type="text/javascript" src="%s"></script>');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Javascript Helper class for easy use of JavaScript.
|
* Javascript Helper class for easy use of JavaScript.
|
||||||
*
|
*
|
||||||
|
@ -57,7 +49,7 @@ class JavascriptHelper extends Helper
|
||||||
*/
|
*/
|
||||||
function codeBlock($script)
|
function codeBlock($script)
|
||||||
{
|
{
|
||||||
return sprintf(TAG_JAVASCRIPT, $script);
|
return sprintf($this->tags['javascriptBlock'], $script);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +60,18 @@ class JavascriptHelper extends Helper
|
||||||
*/
|
*/
|
||||||
function link($url)
|
function link($url)
|
||||||
{
|
{
|
||||||
return sprintf(TAG_JAVASCRIPT_INCLUDE, $this->base.$url);
|
return sprintf($this->tags['javascriptLink'], $this->base.$url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JavaScript include tag for an externally-hosted script
|
||||||
|
*
|
||||||
|
* @param string $url URL to JavaScript file.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function linkOut($url)
|
||||||
|
{
|
||||||
|
return sprintf($this->tags['javascriptLink'], $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -780,7 +780,7 @@ class Model extends Object
|
||||||
function set ($one, $two=null)
|
function set ($one, $two=null)
|
||||||
{
|
{
|
||||||
$this->validationErrors = null;
|
$this->validationErrors = null;
|
||||||
$data = is_array($one)? $one: array($one=>$two);
|
$data = is_array($one)? array($this->table=>$one) : array($one=>$two);
|
||||||
|
|
||||||
foreach ($data as $n => $v)
|
foreach ($data as $n => $v)
|
||||||
{
|
{
|
||||||
|
@ -792,21 +792,17 @@ class Model extends Object
|
||||||
trigger_error('Application error occured, trying to set a field name that doesn\'t exist.', E_USER_WARNING);
|
trigger_error('Application error occured, trying to set a field name that doesn\'t exist.', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//$n == 'id'? $this->setId($v): $this->data[$n] = $v;
|
|
||||||
|
|
||||||
foreach ($v as $x => $y)
|
foreach ($v as $x => $y)
|
||||||
{
|
{
|
||||||
//$x == 'id'? $this->id = $y: $this->data[$n][$x] = $y;
|
if($x == 'id')
|
||||||
if($x == 'id')
|
{
|
||||||
{
|
$this->id = $y;
|
||||||
$this->id = $y;
|
}
|
||||||
}
|
$this->data[$n][$x] = $y;
|
||||||
$this->data[$n][$x] = $y;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets current Model id to given $id.
|
* Sets current Model id to given $id.
|
||||||
|
@ -815,7 +811,7 @@ class Model extends Object
|
||||||
*/
|
*/
|
||||||
function setId ($id)
|
function setId ($id)
|
||||||
{
|
{
|
||||||
$this->id[0] = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
if(!empty($this->_belongsToOther))
|
if(!empty($this->_belongsToOther))
|
||||||
{
|
{
|
||||||
|
@ -1329,7 +1325,7 @@ class Model extends Object
|
||||||
{
|
{
|
||||||
for ($i = 0; $i< count($original); $i++)
|
for ($i = 0; $i< count($original); $i++)
|
||||||
{
|
{
|
||||||
$newValue2[$i] = $original[$i];
|
$newValue[$i] = $original[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif(!empty($original))
|
elseif(!empty($original))
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Library of array functions for Cake.
|
||||||
*
|
*
|
||||||
* Long description for file
|
* Internal use only.
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used for internal manipulation of multiarrays (arrays of arrays).
|
* Class used for internal manipulation of multi-dimensional arrays (arrays of arrays).
|
||||||
*
|
*
|
||||||
* Long description for class
|
* Long description for class
|
||||||
*
|
*
|
||||||
|
@ -63,7 +63,7 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds and returns records with $fieldName equal $value from this NeatArray.
|
* Finds and returns records with $fieldName equal to $value from this NeatArray.
|
||||||
*
|
*
|
||||||
* @param string $fieldName
|
* @param string $fieldName
|
||||||
* @param string $value
|
* @param string $value
|
||||||
|
@ -91,7 +91,7 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if $this->value is array, and removes all empty elements.
|
* Checks if $this->value is an array, and removes all empty elements.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @uses NeatArray::value
|
* @uses NeatArray::value
|
||||||
|
@ -114,7 +114,7 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds elements from the supplied array to itself.
|
* Adds elements from given array to itself.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -169,10 +169,10 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs an array_filter() on the contents.
|
* Performs an array_filter() on the contents of this NeatArray.
|
||||||
*
|
*
|
||||||
* @param unknown_type $with
|
* @param string $with Name of callback function to perform on each element of this NeatArray.
|
||||||
* @return unknown
|
* @return array
|
||||||
*/
|
*/
|
||||||
function filter ($with)
|
function filter ($with)
|
||||||
{
|
{
|
||||||
|
@ -180,9 +180,10 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passes each of its values through a specified function or method. Think of PHP's array_walk.
|
* Passes each of its values through a specified function or method. Think of PHP's {@link http://php.net/array_walk array_walk()}.
|
||||||
*
|
*
|
||||||
* @return array
|
* @param string $with Name of callback function
|
||||||
|
* @return array Returns value of NeatArray::value
|
||||||
* @access public
|
* @access public
|
||||||
* @uses NeatArray::value
|
* @uses NeatArray::value
|
||||||
*/
|
*/
|
||||||
|
@ -193,10 +194,10 @@ class NeatArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Apply $template to all elements of this NeatArray, and return the array itself.
|
||||||
*
|
*
|
||||||
* @param unknown_type $template
|
* @param string $template {@link http://php.net/sprintf sprintf()}-compatible string to be applied to all values of this NeatArray.
|
||||||
* @return unknown
|
* @return array
|
||||||
*/
|
*/
|
||||||
function sprintf($template)
|
function sprintf($template)
|
||||||
{
|
{
|
||||||
|
@ -306,12 +307,13 @@ class NeatArray
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
|
* @todo Explain this function. almost looks like it creates a tree
|
||||||
*
|
*
|
||||||
* @param unknown_type $root
|
* @param string $root
|
||||||
* @param unknown_type $idKey
|
* @param string $idKey
|
||||||
* @param unknown_type $parentIdKey
|
* @param string $parentIdKey
|
||||||
* @param unknown_type $childrenKey
|
* @param string $childrenKey
|
||||||
* @return unknown
|
* @return array
|
||||||
*/
|
*/
|
||||||
function threaded ($root=null, $idKey='id', $parentIdKey='parent_id', $childrenKey='children')
|
function threaded ($root=null, $idKey='id', $parentIdKey='parent_id', $childrenKey='children')
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: sanitize.php 491 2005-07-31 18:31:45Z phpnut $ */
|
/* SVN FILE: $Id: sanitize.php 491 2005-07-31 18:31:45Z phpnut $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Short description for file.
|
||||||
*
|
*
|
||||||
* Long description for file
|
* Long description for file
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||||
* Copyright (c) 2005, CakePHP Authors/Developers
|
* Copyright (c) 2005, CakePHP Authors/Developers
|
||||||
*
|
*
|
||||||
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
|
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
|
||||||
* Larry E. Masters aka PhpNut <nut@phpnut.com>
|
* Larry E. Masters aka PhpNut <nut@phpnut.com>
|
||||||
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
|
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @author CakePHP Authors/Developers
|
* @author CakePHP Authors/Developers
|
||||||
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
||||||
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.libs
|
* @subpackage cake.libs
|
||||||
* @since CakePHP v 0.9.2
|
* @since CakePHP v 0.9.2
|
||||||
* @version $Revision: 491 $
|
* @version $Revision: 491 $
|
||||||
* @modifiedby $LastChangedBy: phpnut $
|
* @modifiedby $LastChangedBy: phpnut $
|
||||||
* @lastmodified $Date: 2005-07-31 13:31:45 -0500 (Sun, 31 Jul 2005) $
|
* @lastmodified $Date: 2005-07-31 13:31:45 -0500 (Sun, 31 Jul 2005) $
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data Sanitization.
|
* Data Sanitization.
|
||||||
*
|
*
|
||||||
* Long description for class
|
* Long description for class
|
||||||
*
|
*
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.libs
|
* @subpackage cake.libs
|
||||||
* @since CakePHP v 0.9.2
|
* @since CakePHP v 0.9.2
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Sanitize
|
class Sanitize
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,21 +62,21 @@ class Sanitize
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function sql($string)
|
function sql($string)
|
||||||
{
|
{
|
||||||
if (!ini_get('magic_quotes_gpc'))
|
if (!ini_get('magic_quotes_gpc'))
|
||||||
{
|
{
|
||||||
$string = addslashes($string);
|
$string = addslashes($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes the string safe for display as HTML. Renders entities and converts newlines to <br/>.
|
* Makes the string safe for display as HTML. Renders entities and converts newlines to <br/>.
|
||||||
*
|
*
|
||||||
* @param string $string
|
* @param string $string
|
||||||
* @param boolean $remove
|
* @param boolean $remove
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function html($string, $remove = false)
|
function html($string, $remove = false)
|
||||||
{
|
{
|
||||||
|
@ -96,10 +96,10 @@ class Sanitize
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively sanitizes an array of data for safe input.
|
* Recursively sanitizes an array of data for safe input.
|
||||||
*
|
*
|
||||||
* @param mixed $toClean
|
* @param mixed $toClean
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function cleanArray(&$toClean)
|
function cleanArray(&$toClean)
|
||||||
{
|
{
|
||||||
return $this->cleanArrayR($toClean);
|
return $this->cleanArrayR($toClean);
|
||||||
|
@ -136,12 +136,12 @@ class Sanitize
|
||||||
/**
|
/**
|
||||||
* Do we really need to sanitize array keys? If so, we can use this code...
|
* Do we really need to sanitize array keys? If so, we can use this code...
|
||||||
|
|
||||||
function cleanKey($key)
|
function cleanKey($key)
|
||||||
{
|
{
|
||||||
if ($key == "")
|
if ($key == "")
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//URL decode and convert chars to HTML entities
|
//URL decode and convert chars to HTML entities
|
||||||
$key = htmlspecialchars(urldecode($key));
|
$key = htmlspecialchars(urldecode($key));
|
||||||
|
@ -153,7 +153,7 @@ class Sanitize
|
||||||
$key = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $key );
|
$key = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $key );
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Scaffold extends Object {
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
*/
|
*/
|
||||||
var $model = null;
|
var $modelKey = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
|
@ -115,8 +115,8 @@ class Scaffold extends Object {
|
||||||
{
|
{
|
||||||
die("Scaffold::__construct() : Can't get or parse class name.");
|
die("Scaffold::__construct() : Can't get or parse class name.");
|
||||||
}
|
}
|
||||||
$this->model = strtolower(Inflector::singularize($r[1]));
|
$this->modelKey = Inflector::underscore(Inflector::singularize($r[1]));
|
||||||
$this->scaffoldTitle = $r[1];
|
$this->scaffoldTitle = Inflector::humanize($this->modelKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,6 +142,7 @@ class Scaffold extends Object {
|
||||||
*/
|
*/
|
||||||
function scaffoldIndex($params)
|
function scaffoldIndex($params)
|
||||||
{
|
{
|
||||||
|
$this->controllerClass->pageTitle = Inflector::humanize(Inflector::pluralize($this->modelKey));
|
||||||
return $this->scaffoldList($params);
|
return $this->scaffoldList($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ class Scaffold extends Object {
|
||||||
*/
|
*/
|
||||||
function scaffoldShow($params)
|
function scaffoldShow($params)
|
||||||
{
|
{
|
||||||
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->read();
|
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->modelKey]->read();
|
||||||
$this->controllerClass->set('data', $this->controllerClass->params['data'] );
|
$this->controllerClass->set('data', $this->controllerClass->params['data'] );
|
||||||
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames( $this->controllerClass->params['data'], false ) );
|
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames( $this->controllerClass->params['data'], false ) );
|
||||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
|
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
|
||||||
|
@ -165,9 +166,8 @@ class Scaffold extends Object {
|
||||||
*/
|
*/
|
||||||
function scaffoldList($params)
|
function scaffoldList($params)
|
||||||
{
|
{
|
||||||
$model = $this->model;
|
|
||||||
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
|
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
|
||||||
$this->controllerClass->set('data', $this->controllerClass->models[$model]->findAll());
|
$this->controllerClass->set('data', $this->controllerClass->models[$this->modelKey]->findAll());
|
||||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
|
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class Scaffold extends Object {
|
||||||
*/
|
*/
|
||||||
function scaffoldEdit($params)
|
function scaffoldEdit($params)
|
||||||
{
|
{
|
||||||
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->read();
|
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->modelKey]->read();
|
||||||
// generate the field names.
|
// generate the field names.
|
||||||
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames($this->controllerClass->params['data']) );
|
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames($this->controllerClass->params['data']) );
|
||||||
$this->controllerClass->set('data', $this->controllerClass->params['data']);
|
$this->controllerClass->set('data', $this->controllerClass->params['data']);
|
||||||
|
@ -207,14 +207,14 @@ class Scaffold extends Object {
|
||||||
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
|
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
|
||||||
$this->cleanUpFields();
|
$this->cleanUpFields();
|
||||||
|
|
||||||
if ($this->controllerClass->models[$this->model]->save($this->controllerClass->params['data']))
|
if ($this->controllerClass->models[$this->modelKey]->save($this->controllerClass->params['data']))
|
||||||
{
|
{
|
||||||
$this->controllerClass->flash('Your '.$this->model.' has been saved.', '/'.$this->controllerClass->viewPath );
|
$this->controllerClass->flash('Your '.$this->modelKey.' has been saved.', '/'.Inflector::underscore($this->controllerClass->viewPath) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->controllerClass->set('data', $this->controllerClass->params['data']);
|
$this->controllerClass->set('data', $this->controllerClass->params['data']);
|
||||||
$this->controllerClass->validateErrors($this->controllerClass->models[$this->model]);
|
$this->controllerClass->validateErrors($this->controllerClass->models[$this->modelKey]);
|
||||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
|
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,14 +229,14 @@ class Scaffold extends Object {
|
||||||
// clean up the date fields
|
// clean up the date fields
|
||||||
$this->cleanUpFields();
|
$this->cleanUpFields();
|
||||||
|
|
||||||
$this->controllerClass->models[$this->model]->set($this->controllerClass->params['data']);
|
$this->controllerClass->models[$this->modelKey]->set($this->controllerClass->params['data']);
|
||||||
if ( $this->controllerClass->models[$this->model]->save())
|
if ( $this->controllerClass->models[$this->modelKey]->save())
|
||||||
{
|
{
|
||||||
$this->controllerClass->flash('The '.$this->model.' has been updated.','/'.$this->controllerClass->name);
|
$this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' has been updated.','/'.Inflector::underscore($this->controllerClass->viewPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->controllerClass->flash('There was an error updating the '.$this->model,'/'.$this->controllerClass->name);
|
$this->controllerClass->flash('There was an error updating the '.Inflector::humanize($this->modelKey),'/'.Inflector::underscore($this->controllerClass->viewPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,15 +249,13 @@ class Scaffold extends Object {
|
||||||
{
|
{
|
||||||
$id = $params['pass'][0];
|
$id = $params['pass'][0];
|
||||||
// figure out what model and table we are working with
|
// figure out what model and table we are working with
|
||||||
$controllerName = $this->controllerClass->name;
|
if ($this->controllerClass->models[$this->modelKey]->del($id))
|
||||||
$table = Inflector::singularize($controllerName);
|
|
||||||
if ($this->controllerClass->models[$table]->del($id))
|
|
||||||
{
|
{
|
||||||
$this->controllerClass->flash('The '.$table.' with id: '.$id.' has been deleted.', '/'.$controllerName);
|
$this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' with id: '.$id.' has been deleted.', '/'.Inflector::underscore($this->controllerClass->viewPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->controllerClass->flash('There was an error deleting the '.$table.' with the id '.$id, '/'.$controllerName);
|
$this->controllerClass->flash('There was an error deleting the '.Inflector::humanize($this->modelKey).' with the id '.$id, '/'.Inflector::underscore($this->controllerClass->viewPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -268,46 +266,46 @@ class Scaffold extends Object {
|
||||||
function cleanUpFields()
|
function cleanUpFields()
|
||||||
{
|
{
|
||||||
// clean up the date fields
|
// clean up the date fields
|
||||||
$objModel = $this->controllerClass->models[$this->model];
|
$objModel = $this->controllerClass->models[$this->modelKey];
|
||||||
foreach( $objModel->_table_info as $table )
|
foreach( $objModel->_table_info as $table )
|
||||||
{
|
{
|
||||||
foreach ($table as $field)
|
foreach ($table as $field)
|
||||||
{
|
{
|
||||||
if( 'date' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
|
if( 'date' == $field['type'] && isset($this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] ) )
|
||||||
{
|
{
|
||||||
$newDate = mktime( 0,0,0,
|
$newDate = mktime( 0,0,0,
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_month'],
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_day'],
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] );
|
||||||
$newDate = date( 'Y-m-d', $newDate );
|
$newDate = date( 'Y-m-d', $newDate );
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
|
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = $newDate;
|
||||||
}
|
}
|
||||||
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
|
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] ) )
|
||||||
{
|
{
|
||||||
$hour = $this->controllerClass->params['data'][$this->model][$field['name'].'_hour'];
|
$hour = $this->controllerClass->params['data'][$this->modelKey][$field['name'].'_hour'];
|
||||||
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$this->model][$field['name'].'_meridian'] )
|
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$this->modelKey][$field['name'].'_meridian'] )
|
||||||
{
|
{
|
||||||
$hour = $hour + 12;
|
$hour = $hour + 12;
|
||||||
}
|
}
|
||||||
$newDate = mktime( $hour,
|
$newDate = mktime( $hour,
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_min'],
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_min'],
|
||||||
0,
|
0,
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_month'],
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_day'],
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
|
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] );
|
||||||
$newDate = date( 'Y-m-d', $newDate );
|
$newDate = date( 'Y-m-d', $newDate );
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
|
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = $newDate;
|
||||||
}
|
}
|
||||||
else if( 'tinyint(1)' == $field['type'] )
|
else if( 'tinyint(1)' == $field['type'] )
|
||||||
{
|
{
|
||||||
if( isset( $this->controllerClass->params['data'][$this->model][$field['name']]) &&
|
if( isset( $this->controllerClass->params['data'][$this->modelKey][$field['name']]) &&
|
||||||
"on" == $this->controllerClass->params['data'][$this->model][$field['name']] )
|
"on" == $this->controllerClass->params['data'][$this->modelKey][$field['name']] )
|
||||||
{
|
{
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name']] = true;
|
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->controllerClass->params['data'][$this->model][$field['name']] = false;
|
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Methods for displaying presentation data
|
||||||
*
|
*
|
||||||
* Long description for file
|
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
|
@ -63,7 +62,7 @@ class View extends Object
|
||||||
var $here = null;
|
var $here = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Not used. 2005-09
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
* @access public
|
* @access public
|
||||||
|
|
BIN
public/img/bg_fade.gif
Normal file
BIN
public/img/bg_fade.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
public/img/bg_header.gif
Normal file
BIN
public/img/bg_header.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 531 B |
BIN
public/img/logo.png
Normal file
BIN
public/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
public/img/red_box.gif
Normal file
BIN
public/img/red_box.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 B |
|
@ -99,4 +99,4 @@ if (class_exists('DATABASE_CONFIG'))
|
||||||
//CLEANUP
|
//CLEANUP
|
||||||
if (DEBUG) echo "<!-- ". round(getMicrotime() - $TIME_START, 2) ."s -->";
|
if (DEBUG) echo "<!-- ". round(getMicrotime() - $TIME_START, 2) ."s -->";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -29,7 +29,7 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
*/
|
*/
|
||||||
|
require_once LIBS.'inflectornew.php';
|
||||||
/**
|
/**
|
||||||
* Short description for class.
|
* Short description for class.
|
||||||
*
|
*
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
*/
|
*/
|
||||||
class InflectorTest extends UnitTestCase
|
class InflectorTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
10
vendors/simpletest/simple_test.php
vendored
10
vendors/simpletest/simple_test.php
vendored
|
@ -30,7 +30,15 @@
|
||||||
* @subpackage UnitTester
|
* @subpackage UnitTester
|
||||||
*/
|
*/
|
||||||
class SimpleTestCase {
|
class SimpleTestCase {
|
||||||
|
/**
|
||||||
|
* @var string Name of the test.
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
var $_label = false;
|
var $_label = false;
|
||||||
|
/**
|
||||||
|
* @var SimpleRunner Test runner.
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
var $_runner = false;
|
var $_runner = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -536,6 +544,8 @@
|
||||||
* Sets the name of the test suite and error message.
|
* Sets the name of the test suite and error message.
|
||||||
* @param string $label Name sent at the start and end
|
* @param string $label Name sent at the start and end
|
||||||
* of the test.
|
* of the test.
|
||||||
|
* @param string $error
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function BadGroupTest($label, $error) {
|
function BadGroupTest($label, $error) {
|
||||||
|
|
Loading…
Reference in a new issue