Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit c96d0747226587e99d1c6416a72ec83296fb300c 2 parents 8f5112b + 8decc68
@renan renan authored
Showing with 189 additions and 71 deletions.
  1. +6 −4 app/webroot/css.php
  2. +1 −1  cake/console/libs/console.php
  3. +1 −1  cake/console/libs/i18n.php
  4. +2 −2 cake/console/templates/skel/app_controller.php
  5. +1 −1  cake/console/templates/skel/app_helper.php
  6. +1 −1  cake/console/templates/skel/config/acl.ini.php
  7. +1 −1  cake/console/templates/skel/config/routes.php
  8. +4 −4 cake/console/templates/skel/webroot/css.php
  9. +4 −0 cake/libs/cache/file.php
  10. +1 −1  cake/libs/controller/app_controller.php
  11. +1 −1  cake/libs/controller/components/cookie.php
  12. +20 −8 cake/libs/controller/components/email.php
  13. +3 −2 cake/libs/controller/components/security.php
  14. +1 −1  cake/libs/i18n.php
  15. +2 −2 cake/libs/l10n.php
  16. +1 −1  cake/libs/model/behaviors/acl.php
  17. +2 −2 cake/libs/model/behaviors/translate.php
  18. +1 −1  cake/libs/model/datasources/datasource.php
  19. +1 −1  cake/libs/model/datasources/dbo/dbo_mssql.php
  20. +2 −2 cake/libs/model/datasources/dbo/dbo_mysql.php
  21. +2 −2 cake/libs/model/datasources/dbo/dbo_mysqli.php
  22. +24 −24 cake/libs/model/datasources/dbo/dbo_oracle.php
  23. +2 −2 cake/libs/model/datasources/dbo/dbo_sqlite.php
  24. +4 −1 cake/libs/model/datasources/dbo_source.php
  25. +1 −1  cake/libs/model/db_acl.php
  26. +1 −1  cake/libs/security.php
  27. +1 −1  cake/libs/view/helpers/app_helper.php
  28. +1 −1  cake/libs/view/helpers/number.php
  29. +28 −0 cake/tests/cases/libs/cache/file.test.php
  30. +1 −1  cake/tests/cases/libs/controller/components/acl.test.php
  31. +55 −0 cake/tests/cases/libs/controller/components/email.test.php
  32. +13 −0 cake/tests/cases/libs/model/datasources/dbo_source.test.php
View
10 app/webroot/css.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * CSS helping functions
*
* PHP versions 4 and 5
*
@@ -21,14 +21,16 @@
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 @@ function make_clean_css($path, $name) {
return $output;
}
/**
- * Enter description here...
+ * Write CSS cache
*
* @param unknown_type $path
* @param unknown_type $content
View
2  cake/console/libs/console.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * CakePHP Console Shell
*
* PHP versions 4 and 5
*
View
2  cake/console/libs/i18n.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Internationalization Management Shell
*
* PHP versions 4 and 5
*
View
4 cake/console/templates/skel/app_controller.php
@@ -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
2  cake/console/templates/skel/app_helper.php
@@ -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
2  cake/console/templates/skel/config/acl.ini.php
@@ -1,7 +1,7 @@
;<?php exit() ?>
; SVN FILE: $Id$
;/**
-; * Short description for file.
+; * ACL Configuration
; *
; *
; * PHP versions 4 and 5
View
2  cake/console/templates/skel/config/routes.php
@@ -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
8 cake/console/templates/skel/webroot/css.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * CSS Functions
*
* PHP versions 4 and 5
*
@@ -23,14 +23,14 @@
}
/**
- * 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 @@ function make_clean_css($path, $name) {
}
/**
- * Enter description here...
+ * Write CSS cache
*
* @param unknown_type $path
* @param unknown_type $content
View
4 cake/libs/cache/file.php
@@ -209,7 +209,11 @@ function clear($check) {
$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
2  cake/libs/controller/app_controller.php
@@ -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
2  cake/libs/controller/components/cookie.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Cookie Component
*
* PHP versions 4 and 5
*
View
28 cake/libs/controller/components/email.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Email Component
*
* PHP versions 4 and 5
*
@@ -808,7 +808,7 @@ function _smtp() {
$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 @@ function _smtp() {
}
/**
- * 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
5 cake/libs/controller/components/security.php
@@ -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
2  cake/libs/i18n.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Internationalization
*
* PHP versions 4 and 5
*
View
4 cake/libs/l10n.php
@@ -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
2  cake/libs/model/behaviors/acl.php
@@ -21,7 +21,7 @@
*/
/**
- * Short description for file
+ * ACL behavior
*
* @package cake
* @subpackage cake.cake.libs.model.behaviors
View
4 cake/libs/model/behaviors/translate.php
@@ -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
2  cake/libs/model/datasources/datasource.php
@@ -91,7 +91,7 @@ class DataSource extends Object {
var $endQuote = null;
/**
- * Enter description here...
+ * Result
*
* @var array
* @access protected
View
2  cake/libs/model/datasources/dbo/dbo_mssql.php
@@ -19,7 +19,7 @@
*/
/**
- * Short description for class.
+ * MS SQL layer for DBO
*
* Long description for class
*
View
4 cake/libs/model/datasources/dbo/dbo_mysql.php
@@ -507,9 +507,9 @@ function column($real) {
class DboMysql extends DboMysqlBase {
/**
- * Enter description here...
+ * Datasource description
*
- * @var unknown_type
+ * @var string
*/
var $description = "MySQL DBO Driver";
View
4 cake/libs/model/datasources/dbo/dbo_mysqli.php
@@ -30,9 +30,9 @@
class DboMysqli extends DboMysqlBase {
/**
- * Enter description here...
+ * Datasource Description
*
- * @var unknown_type
+ * @var string
*/
var $description = "Mysqli DBO Driver";
View
48 cake/libs/model/datasources/dbo/dbo_oracle.php
@@ -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 @@ function _execute($sql) {
}
/**
- * Enter description here...
+ * Fetch result row
*
- * @return unknown
+ * @return array
* @access public
*/
function fetchRow() {
@@ -444,10 +444,10 @@ function createSequence($sequence) {
}
/**
- * Enter description here...
+ * Create trigger
*
- * @param unknown_type $table
- * @return unknown
+ * @param string $table
+ * @return mixed
* @access public
*/
function createTrigger($table) {
View
4 cake/libs/model/datasources/dbo/dbo_sqlite.php
@@ -29,9 +29,9 @@
class DboSqlite extends DboSource {
/**
- * Enter description here...
+ * Datasource Description
*
- * @var unknown_type
+ * @var string
*/
var $description = "SQLite DBO Driver";
View
5 cake/libs/model/datasources/dbo_source.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Dbo Source
*
* PHP versions 4 and 5
*
@@ -2411,6 +2411,9 @@ function order($keys, $direction = 'ASC', $model = null) {
}
}
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
2  cake/libs/model/db_acl.php
@@ -26,7 +26,7 @@
App::import('Model', 'App');
/**
- * Short description for file.
+ * ACL Node
*
*
* @package cake
View
2  cake/libs/security.php
@@ -1,6 +1,6 @@
<?php
/**
- * Short description for file.
+ * Core Security
*
* PHP versions 4 and 5
*
View
2  cake/libs/view/helpers/app_helper.php
@@ -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
2  cake/libs/view/helpers/number.php
@@ -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
28 cake/tests/cases/libs/cache/file.test.php
@@ -274,6 +274,34 @@ function testClear() {
}
/**
+ * 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
*
* @access public
View
2  cake/tests/cases/libs/controller/components/acl.test.php
@@ -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
55 cake/tests/cases/libs/controller/components/email.test.php
@@ -295,6 +295,61 @@ function testSmtpSend() {
$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
13 cake/tests/cases/libs/model/datasources/dbo_source.test.php
@@ -2966,6 +2966,19 @@ function testFieldsWithExpression() {
);
$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
*
Please sign in to comment.
Something went wrong with that request. Please try again.