Merge branch '1.3' of github.com:cakephp/cakephp into 1.3

This commit is contained in:
renan.saddam 2010-05-29 12:23:04 -03:00
commit c96d074722
32 changed files with 189 additions and 71 deletions

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* CSS helping functions
*
* PHP versions 4 and 5
*
@ -21,14 +21,16 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
header('HTTP/1.1 404 Not Found');
exit('File Not Found');
}
/**
* Enter description here...
* Ensure required classes are available.
*/
if (!class_exists('File')) {
uses('file');
}
/**
* Enter description here...
* Make clean CSS
*
* @param unknown_type $path
* @param unknown_type $name
@ -44,7 +46,7 @@ if (!class_exists('File')) {
return $output;
}
/**
* Enter description here...
* Write CSS cache
*
* @param unknown_type $path
* @param unknown_type $content

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* CakePHP Console Shell
*
* PHP versions 4 and 5
*

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Internationalization Management Shell
*
* PHP versions 4 and 5
*

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
@ -22,7 +22,7 @@
*/
/**
* Short description for class.
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Application level View Helper
*
* This file is application-wide helper file. You can put all
* application-wide helper-related methods here.

View file

@ -1,7 +1,7 @@
;<?php exit() ?>
; SVN FILE: $Id$
;/**
; * Short description for file.
; * ACL Configuration
; *
; *
; * PHP versions 4 and 5

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Routes Configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* CSS Functions
*
* PHP versions 4 and 5
*
@ -23,14 +23,14 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
}
/**
* Enter description here...
* Ensure required files are included
*/
if (!class_exists('File')) {
require LIBS . 'file.php';
}
/**
* Enter description here...
* Make clean CSS
*
* @param unknown_type $path
* @param unknown_type $name
@ -47,7 +47,7 @@ if (!class_exists('File')) {
}
/**
* Enter description here...
* Write CSS cache
*
* @param unknown_type $path
* @param unknown_type $content

View file

@ -209,7 +209,11 @@ class FileEngine extends CacheEngine {
$now = time();
$threshold = $now - $this->settings['duration'];
}
$prefixLength = strlen($this->settings['prefix']);
while (($entry = $dir->read()) !== false) {
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
continue;
}
if ($this->_setKey($entry) === false) {
continue;
}

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Cookie Component
*
* PHP versions 4 and 5
*

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Email Component
*
* PHP versions 4 and 5
*
@ -808,7 +808,7 @@ class EmailComponent extends Object{
$host = 'localhost';
}
if (!$this->_smtpSend("HELO {$host}", '250')) {
if (!$this->_smtpSend("EHLO {$host}", '250') || !$this->_smtpSend("HELO {$host}", '250')) {
return false;
}
@ -868,22 +868,34 @@ class EmailComponent extends Object{
}
/**
* Private method for sending data to SMTP connection
* Protected method for sending data to SMTP connection
*
* @param string $data data to be sent to SMTP server
* @param mixed $checkCode code to check for in server response, false to skip
* @return bool Success
* @access private
* @access protected
*/
function _smtpSend($data, $checkCode = '250') {
if (!is_null($data)) {
$this->__smtpConnection->write($data . "\r\n");
}
if ($checkCode !== false) {
$response = $this->__smtpConnection->read();
while ($checkCode !== false) {
$response = '';
$startTime = time();
while (substr($response, -2) !== "\r\n" && ((time() - $startTime) < $this->smtpOptions['timeout'])) {
$response .= $this->__smtpConnection->read();
}
if (substr($response, -2) === "\r\n") {
$this->smtpError = 'timeout';
return false;
}
$response = end(explode("\r\n", rtrim($response, "\r\n")));
if (preg_match('/^(' . $checkCode . ')/', $response, $code)) {
return $code[0];
if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
if ($code[2] === '-') {
continue;
}
return $code[1];
}
$this->smtpError = $response;
return false;

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Security Component
*
* PHP versions 4 and 5
*
@ -18,8 +18,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::import('Core', array('String', 'Security'));
/**
* Short description for file.
* SecurityComponent
*
* @package cake
* @subpackage cake.cake.libs.controller.components

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Internationalization
*
* PHP versions 4 and 5
*

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Localization
*
* PHP versions 4 and 5
*
@ -19,7 +19,7 @@
*/
/**
* Short description for file.
* Localization
*
* @package cake
* @subpackage cake.cake.libs

View file

@ -21,7 +21,7 @@
*/
/**
* Short description for file
* ACL behavior
*
* @package cake
* @subpackage cake.cake.libs.model.behaviors

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Translate behavior
*
* PHP versions 4 and 5
*
@ -19,7 +19,7 @@
*/
/**
* Short description for file.
* Translate behavior
*
* @package cake
* @subpackage cake.cake.libs.model.behaviors

View file

@ -91,7 +91,7 @@ class DataSource extends Object {
var $endQuote = null;
/**
* Enter description here...
* Result
*
* @var array
* @access protected

View file

@ -19,7 +19,7 @@
*/
/**
* Short description for class.
* MS SQL layer for DBO
*
* Long description for class
*

View file

@ -507,9 +507,9 @@ class DboMysqlBase extends DboSource {
class DboMysql extends DboMysqlBase {
/**
* Enter description here...
* Datasource description
*
* @var unknown_type
* @var string
*/
var $description = "MySQL DBO Driver";

View file

@ -30,9 +30,9 @@ App::import('Datasource', 'DboMysql');
class DboMysqli extends DboMysqlBase {
/**
* Enter description here...
* Datasource Description
*
* @var unknown_type
* @var string
*/
var $description = "Mysqli DBO Driver";

View file

@ -19,7 +19,7 @@
*/
/**
* Short description for class.
* Oracle layer for DBO.
*
* Long description for class
*
@ -29,17 +29,17 @@
class DboOracle extends DboSource {
/**
* Enter description here...
* Configuration options
*
* @var unknown_type
* @var array
* @access public
*/
var $config = array();
/**
* Enter description here...
* Alias
*
* @var unknown_type
* @var string
*/
var $alias = '';
@ -56,9 +56,9 @@ class DboOracle extends DboSource {
var $__transactionStarted = false;
/**
* Enter description here...
* Column definitions
*
* @var unknown_type
* @var array
* @access public
*/
var $columns = array(
@ -77,25 +77,25 @@ class DboOracle extends DboSource {
'inet' => array('name' => 'inet'));
/**
* Enter description here...
* Connection object
*
* @var unknown_type
* @var mixed
* @access protected
*/
var $connection;
/**
* Enter description here...
* Query limit
*
* @var unknown_type
* @var int
* @access protected
*/
var $_limit = -1;
/**
* Enter description here...
* Query offset
*
* @var unknown_type
* @var int
* @access protected
*/
var $_offset = 0;
@ -109,25 +109,25 @@ class DboOracle extends DboSource {
var $_map;
/**
* Enter description here...
* Current Row
*
* @var unknown_type
* @var mixed
* @access protected
*/
var $_currentRow;
/**
* Enter description here...
* Number of rows
*
* @var unknown_type
* @var int
* @access protected
*/
var $_numRows;
/**
* Enter description here...
* Query results
*
* @var unknown_type
* @var mixed
* @access protected
*/
var $_results;
@ -378,9 +378,9 @@ class DboOracle extends DboSource {
}
/**
* Enter description here...
* Fetch result row
*
* @return unknown
* @return array
* @access public
*/
function fetchRow() {
@ -444,10 +444,10 @@ class DboOracle extends DboSource {
}
/**
* Enter description here...
* Create trigger
*
* @param unknown_type $table
* @return unknown
* @param string $table
* @return mixed
* @access public
*/
function createTrigger($table) {

View file

@ -29,9 +29,9 @@
class DboSqlite extends DboSource {
/**
* Enter description here...
* Datasource Description
*
* @var unknown_type
* @var string
*/
var $description = "SQLite DBO Driver";

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Dbo Source
*
* PHP versions 4 and 5
*
@ -2411,6 +2411,9 @@ class DboSource extends DataSource {
}
}
continue;
} elseif (is_object($key) && isset($key->type) && $key->type === 'expression') {
$result[] = $key->value;
continue;
}
if (preg_match('/\\x20(ASC|DESC).*/i', $key, $_dir)) {

View file

@ -26,7 +26,7 @@
App::import('Model', 'App');
/**
* Short description for file.
* ACL Node
*
*
* @package cake

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Core Security
*
* PHP versions 4 and 5
*

View file

@ -1,6 +1,6 @@
<?php
/**
* Short description for file.
* Application level View Helper
*
* This file is application-wide helper file. You can put all
* application-wide helper-related methods here.

View file

@ -69,7 +69,7 @@ class NumberHelper extends AppHelper {
*
* @param float $number A floating point number.
* @param integer $precision The precision of the returned number.
* @return float Enter description here...
* @return float Formatted float.
* @access public
* @link http://book.cakephp.org/view/1454/precision
*/

View file

@ -273,6 +273,34 @@ class FileEngineTest extends CakeTestCase {
Cache::config('default', array('engine' => 'File', 'path' => CACHE));
}
/**
* test that clear() doesn't wipe files not in the current engine's prefix.
*
* @return void
*/
function testClearWithPrefixes() {
$FileOne =& new FileEngine();
$FileOne->init(array(
'prefix' => 'prefix_one_',
'duration' => DAY
));
$FileTwo =& new FileEngine();
$FileTwo->init(array(
'prefix' => 'prefix_two_',
'duration' => DAY
));
$data1 = $data2 = $expected = 'content to cache';
$FileOne->write('key_one', $data1, DAY);
$FileTwo->write('key_two', $data2, DAY);
$this->assertEqual($FileOne->read('key_one'), $expected);
$this->assertEqual($FileTwo->read('key_two'), $expected);
$FileOne->clear(false);
$this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.');
}
/**
* testKeyPath method
*

View file

@ -194,7 +194,7 @@ class IniAclTest extends IniAcl {
}
/**
* Short description for class.
* ACL Component Text case
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components

View file

@ -295,6 +295,61 @@ TEMPDOC;
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect));
}
/**
* testSmtpEhlo method
*
* @access public
* @return void
*/
function testSmtpEhlo() {
if (!$this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost')) {
return;
}
$connection =& new CakeSocket(array('protocol'=>'smtp', 'host' => 'localhost', 'port' => 25));
$this->Controller->EmailTest->setConnectionSocket($connection);
$this->assertTrue($connection->connect());
$this->assertTrue($this->Controller->EmailTest->smtpSend(null, '220') !== false);
$this->skipIf($this->Controller->EmailTest->smtpSend('EHLO locahost', '250') === false, '%s do not support EHLO.');
$connection->disconnect();
$this->Controller->EmailTest->to = 'postmaster@localhost';
$this->Controller->EmailTest->from = 'noreply@example.com';
$this->Controller->EmailTest->subject = 'Cake SMTP test';
$this->Controller->EmailTest->replyTo = 'noreply@example.com';
$this->Controller->EmailTest->template = null;
$this->Controller->EmailTest->delivery = 'smtp';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->Controller->EmailTest->_debug = true;
$this->Controller->EmailTest->sendAs = 'text';
$expect = <<<TEMPDOC
<pre>Host: localhost
Port: 25
Timeout: 30
To: postmaster@localhost
From: noreply@example.com
Subject: Cake SMTP test
Header:
To: postmaster@localhost
From: noreply@example.com
Reply-To: noreply@example.com
Subject: Cake SMTP test
X-Mailer: CakePHP Email Component
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bitParameters:
Message:
This is the body of the message
</pre>
TEMPDOC;
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEqual($this->Controller->Session->read('Message.email.message'), $this->__osFix($expect));
}
/**
* testSmtpSendMultipleTo method

View file

@ -2966,6 +2966,19 @@ class DboSourceTest extends CakeTestCase {
);
$this->assertEqual($result, $expected);
}
/**
* test that order() will accept objects made from DboSource::expression
*
* @return void
*/
function testOrderWithExpression() {
$expression = $this->testDb->expression("CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col");
$result = $this->testDb->order($expression);
$expected = " ORDER BY CASE Sample.id WHEN 1 THEN 'Id One' ELSE 'Other Id' END AS case_col";
$this->assertEqual($result, $expected);
}
/**
* testMergeAssociations method
*