Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/yiisoft/yii into user_host_…
Browse files Browse the repository at this point in the history
…address
  • Loading branch information
janisto committed Jan 28, 2014
2 parents cee55e8 + 81dea0e commit ca25bc1
Show file tree
Hide file tree
Showing 238 changed files with 13,194 additions and 5,752 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -8,6 +8,7 @@ php:

services:
- redis-server
- memcached

before_script:
- ./tests/travis/mysql-setup.sh
Expand Down
78 changes: 74 additions & 4 deletions CHANGELOG
@@ -1,10 +1,78 @@
Yii Framework Change Log
========================
Work in progress
----------------

Version 1.1.14
--------------
Version 1.1.15 under development
--------------------------------
- Bug #268: Fixed Active Record count error when some field name starting from 'count' (nineinchnick)
- Bug #788: createIndex is not using the recommended way to create unique indexes on Postgres (nineinchnick)
- Bug #2235: CPgsqlColumnSchema can't parse default value for numeric field (cebe, pavimus)
- Bug #2378: CActiveRecord::tableName() in namespaced model returned fully qualified class name (velosipedist, cebe)
- Bug #2654: Allow CDbCommand to compose queries without 'from' clause (klimov-paul)
- Bug #2658: CBaseListView, CGridView, CListView: added note about $itemsCssClass and $pagerCssClass properties, they must not contain empty string, null or false values (resurtm)
- Bug #2969: CPgsqlSchema::addColumn() converts column type twice (cebe, klimov-paul)
- Bug #2753: Fixed CErrorHandler::errorAction ignored if error occurs while AJAX request (klimov-paul)
- Bug #2756: Fixed applying condition twice during Active Record relation lazy loading (klimov-paul)
- Bug #2770: Fixed CClientScript renders scripts with different HTML options inside same tag (klimov-paul)
- Bug #2778: Fixed throwing unnecessary exception in CFileValidator when validating MIME types for a file upload that failed (Rupert-RR)
- Bug #2785: Use table name with schema in composeMultipleInsertCommand (nineinchnick)
- Bug #2836: Fixed rendering when try-catching widget Exception while 'captureOutput' is set to true (darkheir)
- Bug #2855: Fixed issue with Component::__call() and normal properties holding a Closure (cebe)
- Bug #2862: Fixed array_merge caused renumbering of $data indexes in CHtml::radioButtonList() (ligser)
- Bug #2864: Fixed CGridView ajax calls failing CSRF validation when ajaxType is set to POST (nineinchnick)
- Bug #2874: Fixed duplicate columns selection for HAS_MANY relation with composite primary key (borro)
- Bug #2876: Fixed single quotes in comments column causes syntax error in model code generated by Gii(klimov-paul)
- Bug #2884: Fixed problem with table alias in CActiveRecord that has been introduced in 1.1.14 (cebe)
- Bug #2887: Fixed CFormElement is missing __isset() (bijibox)
- Bug #2912: Add options parameter to CListView beforeAjaxUpdate (spikyjt)
- Bug #2944: Fixed CDbCriteria fails to merge limit when it is 0 (softark)
- Bug #2959: Fixed CFileValidator to encode file name, while composing error messages (klimov-paul)
- Bug #2963: CAssetManager::generatePath no longer uses basename for hasing (eirikhm)
- Bug #2970: Fixed Active Record may join same relation twice on eager loading. (klimov-paul)
- Bug #3010: Problem with callables given as values to CDetailView. CDetailView now only allows annonymous functions to be called, all other values will be taken as value (cebe)
- Bug #3064: Fixed problem with array to string converion in CDbMigration methods that accept array parameters (cebe)
- Bug #3113: Fixed problems with realpath(false) which can occur in combination with Yii::getPathOfAlias() when alias does not exist (cebe)
- Bug #3134: Fixed the issue that query cache returns the same data for the same SQL but different query methods (qiangxue)
- Bug #3144: It wasn't possible to use attributes with spaces in validation rules (samdark)
- Bug: Fixed the bug that backslashes are not escaped by CDbCommandBuilder::buildSearchCondition() (qiangxue)
- Bug: Fixed URL parsing so it's now properly giving 404 for URLs like "http://example.com//////site/about/////" (samdark)
- Bug: Fixed an issue with CFilehelper and not accessable directories which resulted in endless loop (cebe)
- Enh: Public method CFileHelper::createDirectory() has been added (klimov-paul)
- Enh #106: Added getters to CGridColumn to allow getting cell contents for extended use cases of CGridView (cebe)
- Enh #182: CSort: allow arrays in asc/desc keys of virtual attributes (nineinchnick)
- Enh #640: Introduce bigpk and bigint column types in each class extending CDbSchema (nineinchnick)
- Enh #873: CStatRelation (CActiveRecord::STAT) now supports scopes (resurtm, klimov-paul)
- Enh #1515: Post-JOIN operations (use|force|ignore index()) support in relational queries (KonovalovMaxim, resurtm)
- Enh #1593: Allow access to exception currently processed by CErrorHandler (klimov-paul)
- Enh #2540: Enable CJSON to use JsonSerializable interface when serializing objects (sammousa)
- Enh #2664: Added support for HTTP PATCH requests to CHttpRequest (cebe)
- Enh #2688: CHtml::beginForm() now supports additional HTTP methods, via a hidden `_method` field. (phpnode)
- Enh #2722: CFileHelper::findFiles() accepts absolutePaths in $options and returns absolute paths if true or relative ones otherwise (defaults to true) (pavel-voronin)
- Enh #2737: CFileCache: added cachePathMode and cacheFileMode options to set modes used by chmod() for cache directory and files (ujovlado)
- Enh #2758: Updated phpdoc in blog demo to match current IDE supported syntax (samdark)
- Enh #2777: Allow Yii::import() and Yii::createComponent() to import classes that are loaded by other autoloaders e.g. composer (cebe)
- Enh #2791: requirements/index.php: added CRYPT_BLOWFISH check for CPasswordHelper (tom--)
- Enh #2799: Add HTML5 input support for color, datetime, datetime-local, week and search to CHtml and CActiveForm (phpnode)
- Enh #2817: Allow specifying $colums and $refColumns arguments as array in various CDbSchema methods (mynameiszanders, samdark)
- Enh #2852: Refactored ShellCommand to be easier to extend (samdark, mindplay-dk)
- Enh #2908: Add insertMultiple to Migrations (luislobo)
- Enh #3014: Allow changing the database used by ActiveRecord in beforeCount() like it is possible in beforeFind() already (cebe)
- Enh #3023: Added support for formatting DateTime instances to CFormatter (cebe, nitso)
- Enh #3027: Added custom encodeLabel attributes of the CMenu items (hugeval)
- Enh #3048: CApcCache is now compatible with APCu (iobotis, samdark)
- Enh #3068: Added CDbCommand::naturalLeftJoin() and CDbCommand::naturalRightJoin() (bunchachis)
- Enh #3115: Updated phpdoc for better code completion in modern IDEs (samdark)
- Enh #3147: Updated Request::getIsSecureConnection() to work with lower and uppercase config values (cebe)
- Enh #3182: Added namespace support for controllers in subdirectories (Ekstazi, samdark)
- Chg #3137: Upgraded HTMLPurifier to 4.6.0 (samdark)
- New #2955: Added official support for MariaDB (cebe, DaSourcerer)

Version 1.1.14 August 11, 2013
------------------------------
- Bug: There was unnecessary echo in CRUD views generated by Gii (samdark)
- Bug: CJavaScript::encode was formatting floats in a wrong way during encoding (samdark)
- Bug: Fixed minLength and maxLength range check in CCaptchaAction::generateVerifyCode so values are now always stay in bounds (samdark)
- Bug #101: CActiveFinder::buildJoinTree() no longer uses 'false' for 'select' value (klimov-paul)
- Bug #135: Fixed wrong CActiveRecord rows count with having (klimov-paul)
- Bug #139: Fixed Active Record lazy load through relation with condition (klimov-paul)
Expand Down Expand Up @@ -83,8 +151,9 @@ Version 1.1.14
- Bug #2565: CCaptchaAction in ImageMagick mode used to issue an exception in case $backColor or $foreColor have had leading zeros (resurtm)
- Bug #2581: Fixed the bug with empty ajaxVar in jquery.yiilistview.js and jquery.yiigridview.js (seregagl)
- Bug #2602: CUrlValidator and CEmailValidator now works correctly with display_errors = on and validateIDN = true (creocoder)
- Bug #2662: CLocale::getTerritory() used to return null value even for proper input values, bug fix #1622 made in 1.1.13 has been reverted (resurtm)
- Bug #2632: Fixed inability import non-build aliases by config on some case (Yiivgeny)
- Bug #2651: CHttpSession wasn't using GC probability/divisor from php.ini (marcovtwout, cebe, samdark)
- Bug #2651: CHttpSession was using hardcoded GC probability/divisor values (marcovtwout, cebe, samdark)
- Enh: Better CFileLogRoute performance (Qiang, samdark)
- Enh: Refactored CHttpRequest::getDelete and CHttpRequest::getPut not to use _restParams directly (samdark)
- Enh #100: CLogFilter::$logVars can now be array of arrays intended for designating particular items of the $GLOBALS (resurtm, tomtomsen)
Expand Down Expand Up @@ -131,6 +200,7 @@ Version 1.1.14
- Enh #2494: Allow to configure CBaseListView emptyText container tag name (ifdattic)
- Enh #2529: Silenced all chmod calls to prevent "chmod() operation not allowed" error on NTFS (samdark)
- Enh #2602: CEmailValidator and CUrlValidator now uses native PHP `idn` extension in case it is available (`idn_to_ascii` and `idn_ to_ utf8` functions) and Net_IDNA2 otherwise (resurtm, creocoder)
- Enh #2642: Support third party autoloaders when importing classes via Yii::import() (phpnode)
- Chg: Upgraded HTMLPurifier to v4.5.0 (samdark)
- Chg #645: CDbConnection now throws CDbException when failed to open DB connection instead of failing with a warning (kidol, eirikhm, samdark, cebe)
- Chg #895: Add second argument $params to client validation function (slavcodev)
Expand All @@ -140,7 +210,7 @@ Version 1.1.14
- Chg #2187: Vendors: punycode.js updated from 1.1.1 (June 27, 2012) to 1.2.0 (October 10, 2012) (resurtm)
- Chg #2461: Upgraded jquery star rating to 4.11 (samdark)
- Chg #2531: Upgraded jquery masked input to 1.3.1 (samdark)
- New: Added CRedisCache which uses redis key value store as cache backend (cebe)
- New: Added CRedisCache which uses redis key value store as cache backend (cebe, maxlun86)
- New #575: Yii registering at Packagist, added composer info file (schmunk42)
- New #1785: Added CPasswordHelper (tom--)
- New #2178: Added Catalan Translation (ArnauAregall)
Expand Down
12 changes: 11 additions & 1 deletion UPGRADE
@@ -1,4 +1,4 @@
Upgrading Instructions for Yii Framework v1.1.14
Upgrading Instructions for Yii Framework v1.1.15
================================================

!!!IMPORTANT!!!
Expand All @@ -17,6 +17,16 @@ General upgrade instructions
- Check if everything is OK, if not — revert from backup and post
issues to Yii issue tracker.

Upgrading from v1.1.14
----------------------

- CErrorHandler now runs errorAction for errors, which appear via AJAX request.
If you use CErrorHandler::errorAction, make sure it handles AJAX request properly.

- The possibility to use callables for values of CDetailView introduced a problem with string beeing interpreted as
PHP functions. CDetailView now only allows anonymous functions to be called, all other values will be taken as value.


Upgrading from v1.1.13
----------------------

Expand Down
2 changes: 1 addition & 1 deletion build/commands/api/ApiModel.php
Expand Up @@ -202,7 +202,7 @@ protected function processLink($matches)
if(($text=trim($matches[2]))==='')
$text=$url;

if(preg_match('/^(http|ftp):\/\//i',$url)) // an external URL
if(preg_match('/^(http|https|ftp):\/\//i',$url)) // an external URL
return "<a href=\"$url\">$text</a>";
$url=$this->resolveInternalUrl($url);
return $url===''?$text:'{{'.$url.'|'.$text.'}}';
Expand Down
25 changes: 12 additions & 13 deletions demos/blog/protected/models/Comment.php
@@ -1,24 +1,23 @@
<?php

/**
* The followings are the available columns in table 'tbl_comment':
* @property integer $id
* @property string $content
* @property integer $status
* @property integer $create_time
* @property string $author
* @property string $email
* @property string $url
* @property integer $post_id
*/
class Comment extends CActiveRecord
{
/**
* The followings are the available columns in table 'tbl_comment':
* @var integer $id
* @var string $content
* @var integer $status
* @var integer $create_time
* @var string $author
* @var string $email
* @var string $url
* @var integer $post_id
*/
const STATUS_PENDING=1;
const STATUS_APPROVED=2;

/**
* Returns the static model of the specified AR class.
* @return CActiveRecord the static model class
* @return static the static model class
*/
public static function model($className=__CLASS__)
{
Expand Down
24 changes: 11 additions & 13 deletions demos/blog/protected/models/Lookup.php
@@ -1,23 +1,21 @@
<?php

/**
* The followings are the available columns in table 'tbl_lookup':
* @property integer $id
* @property string $object_type
* @property integer $code
* @property string $name_en
* @property string $name_fr
* @property integer $sequence
* @property integer $status
*/
class Lookup extends CActiveRecord
{
/**
* The followings are the available columns in table 'tbl_lookup':
* @var integer $id
* @var string $object_type
* @var integer $code
* @var string $name_en
* @var string $name_fr
* @var integer $sequence
* @var integer $status
*/

private static $_items=array();

/**
* Returns the static model of the specified AR class.
* @return CActiveRecord the static model class
* @return static the static model class
*/
public static function model($className=__CLASS__)
{
Expand Down
25 changes: 12 additions & 13 deletions demos/blog/protected/models/Post.php
@@ -1,18 +1,17 @@
<?php

/**
* The followings are the available columns in table 'tbl_post':
* @property integer $id
* @property string $title
* @property string $content
* @property string $tags
* @property integer $status
* @property integer $create_time
* @property integer $update_time
* @property integer $author_id
*/
class Post extends CActiveRecord
{
/**
* The followings are the available columns in table 'tbl_post':
* @var integer $id
* @var string $title
* @var string $content
* @var string $tags
* @var integer $status
* @var integer $create_time
* @var integer $update_time
* @var integer $author_id
*/
const STATUS_DRAFT=1;
const STATUS_PUBLISHED=2;
const STATUS_ARCHIVED=3;
Expand All @@ -21,7 +20,7 @@ class Post extends CActiveRecord

/**
* Returns the static model of the specified AR class.
* @return CActiveRecord the static model class
* @return static the static model class
*/
public static function model($className=__CLASS__)
{
Expand Down
16 changes: 7 additions & 9 deletions demos/blog/protected/models/Tag.php
@@ -1,17 +1,15 @@
<?php

/**
* The followings are the available columns in table 'tbl_tag':
* @property integer $id
* @property string $name
* @property integer $frequency
*/
class Tag extends CActiveRecord
{
/**
* The followings are the available columns in table 'tbl_tag':
* @var integer $id
* @var string $name
* @var integer $frequency
*/

/**
* Returns the static model of the specified AR class.
* @return CActiveRecord the static model class
* @return static the static model class
*/
public static function model($className=__CLASS__)
{
Expand Down
19 changes: 9 additions & 10 deletions demos/blog/protected/models/User.php
@@ -1,19 +1,18 @@
<?php

/**
* The followings are the available columns in table 'tbl_user':
* @property integer $id
* @property string $username
* @property string $password
* @property string $email
* @property string $profile
*/
class User extends CActiveRecord
{
/**
* The followings are the available columns in table 'tbl_user':
* @var integer $id
* @var string $username
* @var string $password
* @var string $email
* @var string $profile
*/

/**
* Returns the static model of the specified AR class.
* @return CActiveRecord the static model class
* @return static the static model class
*/
public static function model($className=__CLASS__)
{
Expand Down
18 changes: 10 additions & 8 deletions docs/blog/ja/prototype.auth.txt
Expand Up @@ -44,15 +44,17 @@ class UserIdentity extends CUserIdentity
}
~~~

この `authenticate()` メソッドにおいては、`User` クラスを用いて、`tbl_user` テーブルの中から、`username` カラムが与えられた `username` と同じである行を探し出しています(大文字と小文字は区別しません)。`User` クラスは前のセクションで `gii` ツールによって作られたものであることを思い出してください。`User` クラスは [CActiveRecord] を継承しているため、 [アクティブレコードの機能](http://www.yiiframework.com/doc/guide/ja/database.ar) を利用して、オブジェクト指向(OOP)の流儀で `tbl_user` テーブルにアクセスすることが出来ます。
この `authenticate()` メソッドにおいては、`User` クラスを用いて、`tbl_user` テーブルの中から、
`username` カラムが与えられた `username` と同じである行を探し出しています(大文字と小文字は区別しません)。
`User` クラスは前のセクションで `gii` ツールによって作られたものであることを思い出してください。
`User` クラスは [CActiveRecord] を継承しているため、 [アクティブレコードの機能](http://www.yiiframework.com/doc/guide/ja/database.ar) を利用して、
オブジェクト指向(OOP)の流儀で `tbl_user` テーブルにアクセスすることが出来ます。

ユーザが正当なパスワードを入力したかどうかをチェックするため、`User` クラスの `validatePassword` メソッドを呼び出しています。
`/wwwroot/blog/protected/models/User.php` を以下の様に修正する必要があります。
平文のパスワードをデータベースに保存するのではなく、パスワードとランダムに発生させたソルトキーのハッシュを保存することに注意してください。
ユーザが入力したパスワードを検証する際は、パスワードではなくハッシュの結果を比較することになります。
パスワードのハッシュと検証には、PHP の組み込み関数である `crypt()` を使います。
詳細な解説としては、Wiki 記事 [Use crypt() for password storage](http://www.yiiframework.com/wiki/425) を参照して下さい。

平文のパスワードをデータベースに保存するのではなく、パスワードのハッシュを保存することに注意してください。
ユーザが入力したパスワードを検証する際は、パスワードではなくハッシュの結果を比較しなければなりません。
パスワードのハッシュと検証には、Yii に組み込まれている [CPasswordHelper] クラスを使います。

~~~
[php]
Expand All @@ -61,12 +63,12 @@ class User extends CActiveRecord
......
public function validatePassword($password)
{
return crypt($password,$this->password)===$this->password;
return CPasswordHelper::verifyPassword($password,$this->password);
}

public function hashPassword($password)
{
return crypt($password, $this->generateSalt());
return CPasswordHelper::hashPassword($password);
}
}
~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/ru/comment.admin.txt
Expand Up @@ -49,7 +49,7 @@ public function approve()
}
~~~

Здесь мы просто выставляем свойство `status` комментария в `approved` согласно значению соответсвующей константы класса `Comment`:
Здесь мы просто выставляем свойство `status` комментария в `approved` согласно значению соответствующей константы класса `Comment`:

~~~
[php]
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/ru/final.future.txt
Expand Up @@ -48,7 +48,7 @@ return array(
------------------------------------------------

Хотя сам Yii [довольно быстр](http://www.yiiframework.com/performance/), не обязательно,
что приложение, написанное с использованием Yii, будет работать также эффективно. Есть
что приложение, написанное с использованием Yii, будет работать так же эффективно. Есть
несколько мест в приложении, где мы можем улучшить работу. Например,
портлет облака тэгов может быть одним из узких мест в работе, потому что он
использует сложный запрос к базе данных и логику PHP.
Expand Down

0 comments on commit ca25bc1

Please sign in to comment.