diff --git a/app/webroot/css.php b/app/webroot/css.php index 445b2fb2e..aae68cba8 100644 --- a/app/webroot/css.php +++ b/app/webroot/css.php @@ -1,6 +1,6 @@ ; SVN FILE: $Id$ ;/** -; * Short description for file. +; * ACL Configuration ; * ; * ; * PHP versions 4 and 5 diff --git a/cake/console/templates/skel/config/routes.php b/cake/console/templates/skel/config/routes.php index 696c49a87..9e4a28c14 100644 --- a/cake/console/templates/skel/config/routes.php +++ b/cake/console/templates/skel/config/routes.php @@ -1,6 +1,6 @@ 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; } diff --git a/cake/libs/controller/app_controller.php b/cake/libs/controller/app_controller.php index e2a8302c5..073c6405e 100644 --- a/cake/libs/controller/app_controller.php +++ b/cake/libs/controller/app_controller.php @@ -1,6 +1,6 @@ _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; diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 65c00e630..67f83ff52 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -1,6 +1,6 @@ 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) { diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index 1fdba32a8..efc660f33 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/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"; diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index db5dca354..128b0c309 100755 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -1,6 +1,6 @@ type) && $key->type === 'expression') { + $result[] = $key->value; + continue; } if (preg_match('/\\x20(ASC|DESC).*/i', $key, $_dir)) { diff --git a/cake/libs/model/db_acl.php b/cake/libs/model/db_acl.php index 5dba318f8..245e10b0b 100644 --- a/cake/libs/model/db_acl.php +++ b/cake/libs/model/db_acl.php @@ -26,7 +26,7 @@ App::import('Model', 'App'); /** - * Short description for file. + * ACL Node * * * @package cake diff --git a/cake/libs/security.php b/cake/libs/security.php index b7c5f520b..4020b83ac 100644 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -1,6 +1,6 @@ '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 * diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index 11faa3aa2..a1f12c6df 100644 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/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 diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index 1267c96a7..f5de3e9d2 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -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 = <<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 + + +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 diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index ead5a9d7b..73f86be55 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -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 *