Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovtwout committed Feb 3, 2014
2 parents 182c718 + 01217c8 commit 6b4faf2
Show file tree
Hide file tree
Showing 444 changed files with 20,577 additions and 7,517 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ php:
- 5.4
- 5.5

services:
- redis-server
- memcached

before_script:
- ./tests/travis/mysql-setup.sh
- ./tests/travis/postgresql-setup.sh
Expand Down
155 changes: 152 additions & 3 deletions CHANGELOG

Large diffs are not rendered by default.

46 changes: 44 additions & 2 deletions UPGRADE
Original file line number Diff line number Diff line change
@@ -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 All @@ -43,6 +53,35 @@ Upgrading from v1.1.13
- CSecurityManager::computeHMAC() method is now public and third parameter has been added. You must change signature
of this method in the extended child class to fit new circumstances. Otherwise an E_STRICT error will be issued.

- CClientScript::registerScriptFile() and CClientScript::registerScript() methods signature changed.
Update your subclasses that override registerScriptFile() or registerScript() if any.

- CActiveRecord::refreshMetaData() now clears meta data for all objects of the particular Active Record class.
Also CActiveRecord::refreshMetaData() will not create new meta data at once - new CActiveRecordMetaData instance
will be created on the first demand.

- Oracle related note: in case you're using COciSchema::resetSequence() or CDbSchema::resetSequence() methods with
the Oracle database, keep in mind that its behavior has changed to be consistent with the same methods for
the other database management systems. Please refer to its documentation for more details and don't forget
to adjust your code respectively.

- Signature of the CJuiInputWidget::resolveNameID() method has changed. If you're overriding this method you must
change your code to fit it. This method now accepts two parameters, it means you have to adjust code of the
overlapped descendant method signature as follows:

protected function resolveNameID($nameProperty='name',$attributeProperty='attribute')

And ancestor method call to:

parent::resolveNameID($nameProperty,$attributeProperty);

- In case you've used your own relation types extended from `CHasOneRelation` or
`CHasManyRelation` make sure you update these to reflect moving `through` property
from both these to `CActiveRelation`.

- CSecurityManager::generateRandomKey() has been deprecated in favor of CSecurityManager::generateRandomString().
Try not to use it anymore and avoid CSecurityManager::generateRandomKey() method in your code.

Upgrading from v1.1.12
----------------------
- Both jQuery and jQueryUI were updated. Check [jQuery UI upgrade guide](http://jqueryui.com/upgrade-guide/1.9/)
Expand Down Expand Up @@ -78,6 +117,9 @@ Upgrading from v1.1.12
`extension_loaded('gd')` expression is not enough and wrong because CAPTCHA could be rendered via ImageMagick with fallback to GD since 1.1.13
(thus checking code is not simple as it seems).

- In case you're using MSSQL driver make sure authentication credentials you use have permissions to use
`sys.extended_properties` system view. This is critical for retrieving additional metadata on tables.

Upgrading from v1.1.11
----------------------
- Changes in CCookieCollection::add() (introduced in 1.1.11) were reverted as they were triggering E_STRICT on some old PHP-versions
Expand All @@ -88,7 +130,7 @@ Upgrading from v1.1.11
$cookies[$name] = new CHttpCookie($name, $value);


- CActiveRecord::resetScope() method signature changed. Updated your subclasses that override resetScope() if any.
- CActiveRecord::resetScope() method signature changed. Please update your subclasses that override resetScope() if any.

Upgrading from v1.1.10
----------------------
Expand Down
4 changes: 2 additions & 2 deletions build/commands/api/ApiModel.php
Original file line number Diff line number Diff line change
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 Expand Up @@ -614,7 +614,7 @@ protected function checkSource($sourceFile)
/*
* Get lines with @param, and parameter name
*/
if(preg_match('/^\s*\*\s*@param\s[A-Za-z0-9_\|]+\s(\$\w+)\s./',$line,$matches,PREG_OFFSET_CAPTURE))
if(preg_match('/^\s*\*\s*@param\s[A-Za-z0-9_\|\[\]]+\s(\$\w+)\s./',$line,$matches,PREG_OFFSET_CAPTURE))
{
$docParam[]=array(
'docLine'=>$no+1,
Expand Down
25 changes: 12 additions & 13 deletions demos/blog/protected/models/Comment.php
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
58 changes: 12 additions & 46 deletions demos/blog/protected/models/User.php
Original file line number Diff line number Diff line change
@@ -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 Expand Up @@ -75,7 +74,7 @@ public function attributeLabels()
*/
public function validatePassword($password)
{
return crypt($password,$this->password)===$this->password;
return CPasswordHelper::verifyPassword($password,$this->password);
}

/**
Expand All @@ -85,39 +84,6 @@ public function validatePassword($password)
*/
public function hashPassword($password)
{
return crypt($password, $this->generateSalt());
}

/**
* Generates a salt that can be used to generate a password hash.
*
* The {@link http://php.net/manual/en/function.crypt.php PHP `crypt()` built-in function}
* requires, for the Blowfish hash algorithm, a salt string in a specific format:
* - "$2a$"
* - a two digit cost parameter
* - "$"
* - 22 characters from the alphabet "./0-9A-Za-z".
*
* @param int cost parameter for Blowfish hash algorithm
* @return string the salt
*/
protected function generateSalt($cost=10)
{
if(!is_numeric($cost)||$cost<4||$cost>31){
throw new CException(Yii::t('Cost parameter must be between 4 and 31.'));
}
// Get some pseudo-random data from mt_rand().
$rand='';
for($i=0;$i<8;++$i)
$rand.=pack('S',mt_rand(0,0xffff));
// Add the microtime for a little more entropy.
$rand.=microtime();
// Mix the bits cryptographically.
$rand=sha1($rand,true);
// Form the prefix that specifies hash algorithm type and cost parameter.
$salt='$2a$'.str_pad((int)$cost,2,'0',STR_PAD_RIGHT).'$';
// Append the random salt string in the required base64 format.
$salt.=strtr(substr(base64_encode($rand),0,22),array('+'=>'.'));
return $salt;
return CPasswordHelper::hashPassword($password);
}
}
}
18 changes: 10 additions & 8 deletions docs/blog/ja/prototype.auth.txt
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions docs/blog/ja/start.testdrive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Yii のリリースファイル(バージョン 1.1.1以上)を [www.yiiframewor
> Tip|ヒント: Yii framework はファイルシステムのどの場所にでもインストールすることが出来ます。ウェブフォルダ(ドキュメントルート)の下である必要はありません。Yii の `framework` ディレクトリはすべてのフレームワークコードを含んでおり、このディレクトリが Yii アプリケーションの配布に必要な唯一のフレームワークディレクトリです。インストールした単一の Yii を複数の Yii アプリケーションから利用することが可能です。

Yii をインストールした後、ブラウザのウィンドウを開いて、`http://www.example.com/yii/requirements/index.php` という URL にアクセスしてください。
そうすると、Yii のリリースに含まれる要求チェッカが表示されます
ブログアプリケーションのためには、Yii が必要とする最小限の要求に加えて、SQLite データベースにアクセスするために、`pdo` と `pdo_sqlite` という二つの PHP 拡張を有効にする必要があります
そうすると、Yii のリリースに含まれる必要条件チェッカが表示されます
ブログアプリケーションのためには、Yii が必要とする最小限の要求に加えて、SQLite データベースにアクセスするために、`pdo` と `pdo_sqlite` という二つの PHP 拡張が有効である必要があります


スケルトンアプリケーションを作る
Expand Down
Loading

0 comments on commit 6b4faf2

Please sign in to comment.