Commit 6a3e9e15 by Simone

Merge pull request #2 from yiisoft/master

Merge from master
parents 1451aa60 637e1160
...@@ -16,4 +16,4 @@ return array( ...@@ -16,4 +16,4 @@ return array(
'yii', 'yii',
), ),
), ),
); );
\ No newline at end of file
...@@ -18,4 +18,4 @@ return array( ...@@ -18,4 +18,4 @@ return array(
'params' => array( 'params' => array(
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
), ),
); );
\ No newline at end of file
...@@ -46,4 +46,4 @@ class SiteController extends Controller ...@@ -46,4 +46,4 @@ class SiteController extends Controller
{ {
echo $this->render('about'); echo $this->render('about');
} }
} }
\ No newline at end of file
...@@ -60,4 +60,4 @@ class ContactForm extends Model ...@@ -60,4 +60,4 @@ class ContactForm extends Model
return false; return false;
} }
} }
} }
\ No newline at end of file
...@@ -55,4 +55,4 @@ class LoginForm extends Model ...@@ -55,4 +55,4 @@ class LoginForm extends Model
return false; return false;
} }
} }
} }
\ No newline at end of file
...@@ -58,4 +58,4 @@ class User extends \yii\base\Object implements \yii\web\Identity ...@@ -58,4 +58,4 @@ class User extends \yii\base\Object implements \yii\web\Identity
{ {
return $this->password === $password; return $this->password === $password;
} }
} }
\ No newline at end of file
...@@ -54,4 +54,4 @@ $this->registerAssetBundle('app'); ...@@ -54,4 +54,4 @@ $this->registerAssetBundle('app');
</div> </div>
</body> </body>
</html> </html>
<?php $this->endPage(); ?> <?php $this->endPage(); ?>
\ No newline at end of file
...@@ -30,4 +30,4 @@ $this->title = 'Contact'; ...@@ -30,4 +30,4 @@ $this->title = 'Contact';
<div class="form-actions"> <div class="form-actions">
<?php echo Html::submitButton('Submit', null, null, array('class' => 'btn btn-primary')); ?> <?php echo Html::submitButton('Submit', null, null, array('class' => 'btn btn-primary')); ?>
</div> </div>
<?php $this->endWidget(); ?> <?php $this->endWidget(); ?>
\ No newline at end of file
...@@ -18,4 +18,4 @@ $this->title = 'Login'; ...@@ -18,4 +18,4 @@ $this->title = 'Login';
<div class="form-actions"> <div class="form-actions">
<?php echo Html::submitButton('Login', null, null, array('class' => 'btn btn-primary')); ?> <?php echo Html::submitButton('Login', null, null, array('class' => 'btn btn-primary')); ?>
</div> </div>
<?php $this->endWidget(); ?> <?php $this->endWidget(); ?>
\ No newline at end of file
...@@ -28,4 +28,4 @@ return array( ...@@ -28,4 +28,4 @@ return array(
), ),
'depends' => array('yii', 'yii/validation'), 'depends' => array('yii', 'yii/validation'),
), ),
); );
\ No newline at end of file
...@@ -87,4 +87,4 @@ class ActionFilter extends Behavior ...@@ -87,4 +87,4 @@ class ActionFilter extends Behavior
{ {
return !in_array($action->id, $this->except, true) && (empty($this->only) || in_array($action->id, $this->only, true)); return !in_array($action->id, $this->except, true) && (empty($this->only) || in_array($action->id, $this->only, true));
} }
} }
\ No newline at end of file
...@@ -306,6 +306,15 @@ class Application extends Module ...@@ -306,6 +306,15 @@ class Application extends Module
} }
/** /**
* @return null|Component
* @todo
*/
public function getAuthManager()
{
return $this->getComponent('auth');
}
/**
* Registers the core application components. * Registers the core application components.
* @see setComponents * @see setComponents
*/ */
......
...@@ -22,4 +22,4 @@ class Exception extends \Exception ...@@ -22,4 +22,4 @@ class Exception extends \Exception
{ {
return \Yii::t('yii|Exception'); return \Yii::t('yii|Exception');
} }
} }
\ No newline at end of file
...@@ -744,10 +744,10 @@ class View extends Component ...@@ -744,10 +744,10 @@ class View extends Component
{ {
$lines = array(); $lines = array();
if (!empty($this->metaTags)) { if (!empty($this->metaTags)) {
$lines[] = implode("\n", $this->cssFiles); $lines[] = implode("\n", $this->metaTags);
} }
if (!empty($this->linkTags)) { if (!empty($this->linkTags)) {
$lines[] = implode("\n", $this->cssFiles); $lines[] = implode("\n", $this->linkTags);
} }
if (!empty($this->cssFiles)) { if (!empty($this->cssFiles)) {
$lines[] = implode("\n", $this->cssFiles); $lines[] = implode("\n", $this->cssFiles);
...@@ -797,4 +797,4 @@ class View extends Component ...@@ -797,4 +797,4 @@ class View extends Component
} }
return implode("\n", $lines); return implode("\n", $lines);
} }
} }
\ No newline at end of file
...@@ -41,4 +41,4 @@ class ViewEvent extends Event ...@@ -41,4 +41,4 @@ class ViewEvent extends Event
$this->viewFile = $viewFile; $this->viewFile = $viewFile;
parent::__construct($config); parent::__construct($config);
} }
} }
\ No newline at end of file
...@@ -134,4 +134,4 @@ class Widget extends Component ...@@ -134,4 +134,4 @@ class Widget extends Component
return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . '.php' : $file; return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . '.php' : $file;
} }
} }
\ No newline at end of file
...@@ -349,4 +349,4 @@ abstract class Cache extends Component implements \ArrayAccess ...@@ -349,4 +349,4 @@ abstract class Cache extends Component implements \ArrayAccess
{ {
$this->delete($key); $this->delete($key);
} }
} }
\ No newline at end of file
...@@ -49,4 +49,4 @@ abstract class Dependency extends \yii\base\Object ...@@ -49,4 +49,4 @@ abstract class Dependency extends \yii\base\Object
* @return mixed the data needed to determine if dependency has been changed. * @return mixed the data needed to determine if dependency has been changed.
*/ */
abstract protected function generateDependencyData(); abstract protected function generateDependencyData();
} }
\ No newline at end of file
...@@ -46,4 +46,4 @@ class MemCacheServer extends \yii\base\Object ...@@ -46,4 +46,4 @@ class MemCacheServer extends \yii\base\Object
* @var boolean if the server should be flagged as online upon a failure. This is used by memcache only. * @var boolean if the server should be flagged as online upon a failure. This is used by memcache only.
*/ */
public $status = true; public $status = true;
} }
\ No newline at end of file
...@@ -89,4 +89,4 @@ class WinCache extends Cache ...@@ -89,4 +89,4 @@ class WinCache extends Cache
{ {
return wincache_ucache_clear(); return wincache_ucache_clear();
} }
} }
\ No newline at end of file
...@@ -147,4 +147,4 @@ class Controller extends \yii\base\Controller ...@@ -147,4 +147,4 @@ class Controller extends \yii\base\Controller
{ {
return array(); return array();
} }
} }
\ No newline at end of file
...@@ -321,4 +321,4 @@ class AppController extends Controller ...@@ -321,4 +321,4 @@ class AppController extends Controller
closedir($handle); closedir($handle);
return $list; return $list;
} }
} }
\ No newline at end of file
...@@ -350,4 +350,4 @@ return array( ...@@ -350,4 +350,4 @@ return array(
EOD; EOD;
file_put_contents($configFile, $template); file_put_contents($configFile, $template);
} }
} }
\ No newline at end of file
...@@ -418,4 +418,4 @@ class HelpController extends Controller ...@@ -418,4 +418,4 @@ class HelpController extends Controller
$name = $required ? "$name (required)" : $name; $name = $required ? "$name (required)" : $name;
return $doc === '' ? $name : "$name: $doc"; return $doc === '' ? $name : "$name: $doc";
} }
} }
\ No newline at end of file
...@@ -14,4 +14,4 @@ return array( ...@@ -14,4 +14,4 @@ return array(
'permissions' => 0755, 'permissions' => 0755,
), ),
), ),
); );
\ No newline at end of file
...@@ -7,4 +7,4 @@ $config = require dirname(__DIR__).'/protected/config/main.php'; ...@@ -7,4 +7,4 @@ $config = require dirname(__DIR__).'/protected/config/main.php';
$config['basePath'] = dirname(__DIR__).'/protected'; $config['basePath'] = dirname(__DIR__).'/protected';
$app = new \yii\web\Application($config); $app = new \yii\web\Application($config);
$app->run(); $app->run();
\ No newline at end of file
...@@ -17,4 +17,4 @@ return array( ...@@ -17,4 +17,4 @@ return array(
'class' => 'yii\caching\DummyCache', 'class' => 'yii\caching\DummyCache',
), ),
), ),
); );
\ No newline at end of file
...@@ -12,4 +12,4 @@ class SiteController extends Controller ...@@ -12,4 +12,4 @@ class SiteController extends Controller
'name' => 'Qiang', 'name' => 'Qiang',
)); ));
} }
} }
\ No newline at end of file
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
<?php echo \Yii::powered()?> <?php echo \Yii::powered()?>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
Hello, <?php echo $name?>! Hello, <?php echo $name?>!
\ No newline at end of file
...@@ -41,4 +41,4 @@ class Exception extends \yii\base\Exception ...@@ -41,4 +41,4 @@ class Exception extends \yii\base\Exception
{ {
return \Yii::t('yii|Database Exception'); return \Yii::t('yii|Database Exception');
} }
} }
\ No newline at end of file
...@@ -57,4 +57,4 @@ class Expression extends \yii\base\Object ...@@ -57,4 +57,4 @@ class Expression extends \yii\base\Object
{ {
return $this->expression; return $this->expression;
} }
} }
\ No newline at end of file
...@@ -368,4 +368,4 @@ class Migration extends \yii\base\Component ...@@ -368,4 +368,4 @@ class Migration extends \yii\base\Component
$this->db->createCommand()->dropIndex($name, $table)->execute(); $this->db->createCommand()->dropIndex($name, $table)->execute();
echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n";
} }
} }
\ No newline at end of file
...@@ -20,4 +20,4 @@ class StaleObjectException extends Exception ...@@ -20,4 +20,4 @@ class StaleObjectException extends Exception
{ {
return \Yii::t('yii|Stale Object Exception'); return \Yii::t('yii|Stale Object Exception');
} }
} }
\ No newline at end of file
...@@ -16,4 +16,4 @@ namespace yii\helpers; ...@@ -16,4 +16,4 @@ namespace yii\helpers;
*/ */
class ArrayHelper extends base\ArrayHelper class ArrayHelper extends base\ArrayHelper
{ {
} }
\ No newline at end of file
...@@ -18,4 +18,4 @@ namespace yii\helpers; ...@@ -18,4 +18,4 @@ namespace yii\helpers;
*/ */
class FileHelper extends base\FileHelper class FileHelper extends base\FileHelper
{ {
} }
\ No newline at end of file
...@@ -42,4 +42,4 @@ class JsExpression extends Object ...@@ -42,4 +42,4 @@ class JsExpression extends Object
{ {
return $this->expression; return $this->expression;
} }
} }
\ No newline at end of file
...@@ -15,4 +15,4 @@ namespace yii\helpers; ...@@ -15,4 +15,4 @@ namespace yii\helpers;
class Json extends base\Json class Json extends base\Json
{ {
} }
\ No newline at end of file
...@@ -26,4 +26,4 @@ namespace yii\helpers; ...@@ -26,4 +26,4 @@ namespace yii\helpers;
*/ */
class SecurityHelper extends base\SecurityHelper class SecurityHelper extends base\SecurityHelper
{ {
} }
\ No newline at end of file
...@@ -25,4 +25,4 @@ namespace yii\helpers; ...@@ -25,4 +25,4 @@ namespace yii\helpers;
*/ */
class VarDumper extends base\VarDumper class VarDumper extends base\VarDumper
{ {
} }
\ No newline at end of file
...@@ -349,4 +349,4 @@ class ArrayHelper ...@@ -349,4 +349,4 @@ class ArrayHelper
} }
return $d; return $d;
} }
} }
\ No newline at end of file
...@@ -169,4 +169,4 @@ class FileHelper ...@@ -169,4 +169,4 @@ class FileHelper
} }
closedir($handle); closedir($handle);
} }
} }
\ No newline at end of file
...@@ -104,4 +104,4 @@ class Json ...@@ -104,4 +104,4 @@ class Json
return $data; return $data;
} }
} }
} }
\ No newline at end of file
...@@ -167,11 +167,11 @@ class SecurityHelper ...@@ -167,11 +167,11 @@ class SecurityHelper
* *
* ~~~ * ~~~
* // generates the hash (usually done during user registration or when the password is changed) * // generates the hash (usually done during user registration or when the password is changed)
* $hash = SecurityHelper::hashPassword($password); * $hash = SecurityHelper::generatePasswordHash($password);
* // ...save $hash in database... * // ...save $hash in database...
* *
* // during login, validate if the password entered is correct using $hash fetched from database * // during login, validate if the password entered is correct using $hash fetched from database
* if (PasswordHelper::verifyPassword($password, $hash) { * if (SecurityHelper::verifyPassword($password, $hash) {
* // password is good * // password is good
* } else { * } else {
* // password is bad * // password is bad
...@@ -217,7 +217,7 @@ class SecurityHelper ...@@ -217,7 +217,7 @@ class SecurityHelper
throw new InvalidParamException('Password must be a string and cannot be empty.'); throw new InvalidParamException('Password must be a string and cannot be empty.');
} }
if (!preg_match('/^\$2[axy]\$(\d\d)\$[\./0-9A-Za-z]{22}/', $hash, $matches) || $matches[1] < 4 || $matches[1] > 30) { if (!preg_match('/^\$2[axy]\$(\d\d)\$[\.\/0-9A-Za-z]{22}/', $hash, $matches) || $matches[1] < 4 || $matches[1] > 30) {
throw new InvalidParamException('Hash is invalid.'); throw new InvalidParamException('Hash is invalid.');
} }
......
...@@ -39,7 +39,7 @@ class VarDumper ...@@ -39,7 +39,7 @@ class VarDumper
*/ */
public static function dump($var, $depth = 10, $highlight = false) public static function dump($var, $depth = 10, $highlight = false)
{ {
echo self::dumpAsString($var, $depth, $highlight); echo static::dumpAsString($var, $depth, $highlight);
} }
/** /**
...@@ -131,4 +131,4 @@ class VarDumper ...@@ -131,4 +131,4 @@ class VarDumper
break; break;
} }
} }
} }
\ No newline at end of file
...@@ -76,4 +76,4 @@ class PhpMessageSource extends MessageSource ...@@ -76,4 +76,4 @@ class PhpMessageSource extends MessageSource
return array(); return array();
} }
} }
} }
\ No newline at end of file
...@@ -624,4 +624,4 @@ return array ( ...@@ -624,4 +624,4 @@ return array (
array ( array (
0 => 'in_array(fmod($n,10),array(1,2))||fmod($n,20)==0', 0 => 'in_array(fmod($n,10),array(1,2))||fmod($n,20)==0',
), ),
); );
\ No newline at end of file
...@@ -69,4 +69,4 @@ class EmailTarget extends Target ...@@ -69,4 +69,4 @@ class EmailTarget extends Target
} }
mail($sentTo, $subject, $body, implode("\r\n", $headers)); mail($sentTo, $subject, $body, implode("\r\n", $headers));
} }
} }
\ No newline at end of file
...@@ -189,4 +189,4 @@ class CProfileLogRoute extends CWebLogRoute ...@@ -189,4 +189,4 @@ class CProfileLogRoute extends CWebLogRoute
$total += $delta; $total += $delta;
return array($token, $calls, $min, $max, $total); return array($token, $calls, $min, $max, $total);
} }
} }
\ No newline at end of file
...@@ -89,7 +89,7 @@ abstract class Target extends \yii\base\Component ...@@ -89,7 +89,7 @@ abstract class Target extends \yii\base\Component
*/ */
public function collect($messages, $final) public function collect($messages, $final)
{ {
$this->_messages = array($this->_messages, $this->filterMessages($messages)); $this->_messages = array_merge($this->_messages, $this->filterMessages($messages));
$count = count($this->_messages); $count = count($this->_messages);
if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) { if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
if (($context = $this->getContextMessage()) !== '') { if (($context = $this->getContextMessage()) !== '') {
......
...@@ -58,4 +58,4 @@ class CWebLogRoute extends CLogRoute ...@@ -58,4 +58,4 @@ class CWebLogRoute extends CLogRoute
$viewFile = YII_PATH . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $view . '.php'; $viewFile = YII_PATH . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $view . '.php';
include($app->findLocalizedFile($viewFile, 'en')); include($app->findLocalizedFile($viewFile, 'en'));
} }
} }
\ No newline at end of file
...@@ -102,4 +102,4 @@ class SmartyViewRenderer extends ViewRenderer ...@@ -102,4 +102,4 @@ class SmartyViewRenderer extends ViewRenderer
return $template->fetch(); return $template->fetch();
} }
} }
\ No newline at end of file
...@@ -192,11 +192,11 @@ class FileValidator extends Validator ...@@ -192,11 +192,11 @@ class FileValidator extends Validator
break; break;
case UPLOAD_ERR_CANT_WRITE: case UPLOAD_ERR_CANT_WRITE:
$this->addError($object, $attribute, $this->message); $this->addError($object, $attribute, $this->message);
Yii::warning('Failed to write the uploaded file to disk: ', $file->getName(), __METHOD__); Yii::warning('Failed to write the uploaded file to disk: ' . $file->getName(), __METHOD__);
break; break;
case UPLOAD_ERR_EXTENSION: case UPLOAD_ERR_EXTENSION:
$this->addError($object, $attribute, $this->message); $this->addError($object, $attribute, $this->message);
Yii::warning('File upload was stopped by some PHP extension: ', $file->getName(), __METHOD__); Yii::warning('File upload was stopped by some PHP extension: ' . $file->getName(), __METHOD__);
break; break;
default: default:
break; break;
...@@ -248,4 +248,4 @@ class FileValidator extends Validator ...@@ -248,4 +248,4 @@ class FileValidator extends Validator
return (int)$sizeStr; return (int)$sizeStr;
} }
} }
} }
\ No newline at end of file
...@@ -96,4 +96,4 @@ class InlineValidator extends Validator ...@@ -96,4 +96,4 @@ class InlineValidator extends Validator
return null; return null;
} }
} }
} }
\ No newline at end of file
...@@ -151,4 +151,4 @@ class NumberValidator extends Validator ...@@ -151,4 +151,4 @@ class NumberValidator extends Validator
return 'yii.validation.number(value, messages, ' . Json::encode($options) . ');'; return 'yii.validation.number(value, messages, ' . Json::encode($options) . ');';
} }
} }
\ No newline at end of file
...@@ -97,4 +97,4 @@ class UniqueValidator extends Validator ...@@ -97,4 +97,4 @@ class UniqueValidator extends Validator
$this->addError($object, $attribute, $this->message); $this->addError($object, $attribute, $this->message);
} }
} }
} }
\ No newline at end of file
...@@ -64,4 +64,4 @@ $title = $context->htmlEncode($exception instanceof \yii\base\Exception ? $excep ...@@ -64,4 +64,4 @@ $title = $context->htmlEncode($exception instanceof \yii\base\Exception ? $excep
<?php echo YII_DEBUG ? $context->versionInfo : ''?> <?php echo YII_DEBUG ? $context->versionInfo : ''?>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -103,4 +103,4 @@ class AccessControl extends ActionFilter ...@@ -103,4 +103,4 @@ class AccessControl extends ActionFilter
throw new HttpException(403, Yii::t('yii|You are not allowed to perform this action.')); throw new HttpException(403, Yii::t('yii|You are not allowed to perform this action.'));
} }
} }
} }
\ No newline at end of file
...@@ -144,7 +144,7 @@ class AccessRule extends Component ...@@ -144,7 +144,7 @@ class AccessRule extends Component
return true; return true;
} elseif ($role === '@' && !$user->getIsGuest()) { } elseif ($role === '@' && !$user->getIsGuest()) {
return true; return true;
} elseif ($user->hasAccess($role)) { } elseif ($user->checkAccess($role)) {
return true; return true;
} }
} }
...@@ -185,4 +185,4 @@ class AccessRule extends Component ...@@ -185,4 +185,4 @@ class AccessRule extends Component
{ {
return empty($this->matchCallback) || call_user_func($this->matchCallback, $this, $action); return empty($this->matchCallback) || call_user_func($this->matchCallback, $this, $action);
} }
} }
\ No newline at end of file
...@@ -173,4 +173,4 @@ class AssetBundle extends Object ...@@ -173,4 +173,4 @@ class AssetBundle extends Object
} }
} }
} }
} }
\ No newline at end of file
...@@ -53,10 +53,10 @@ class AssetConverter extends Component implements IAssetConverter ...@@ -53,10 +53,10 @@ class AssetConverter extends Component implements IAssetConverter
)); ));
exec($command, $output); exec($command, $output);
Yii::info("Converted $asset into $result: " . implode("\n", $output), __METHOD__); Yii::info("Converted $asset into $result: " . implode("\n", $output), __METHOD__);
return "$baseUrl/$result";
} }
return "$baseUrl/$result";
} }
} }
return "$baseUrl/$asset"; return "$baseUrl/$asset";
} }
} }
\ No newline at end of file
...@@ -40,4 +40,4 @@ class Controller extends \yii\base\Controller ...@@ -40,4 +40,4 @@ class Controller extends \yii\base\Controller
} }
return Yii::$app->getUrlManager()->createUrl($route, $params); return Yii::$app->getUrlManager()->createUrl($route, $params);
} }
} }
\ No newline at end of file
...@@ -128,4 +128,4 @@ class HttpCache extends ActionFilter ...@@ -128,4 +128,4 @@ class HttpCache extends ActionFilter
{ {
return '"' . base64_encode(sha1($seed, true)) . '"'; return '"' . base64_encode(sha1($seed, true)) . '"';
} }
} }
\ No newline at end of file
...@@ -24,4 +24,4 @@ interface IAssetConverter ...@@ -24,4 +24,4 @@ interface IAssetConverter
* need conversion, "$baseUrl/$asset" should be returned. * need conversion, "$baseUrl/$asset" should be returned.
*/ */
public function convert($asset, $basePath, $baseUrl); public function convert($asset, $basePath, $baseUrl);
} }
\ No newline at end of file
...@@ -78,4 +78,4 @@ interface Identity ...@@ -78,4 +78,4 @@ interface Identity
* @see getAuthKey() * @see getAuthKey()
*/ */
public function validateAuthKey($authKey); public function validateAuthKey($authKey);
} }
\ No newline at end of file
...@@ -101,4 +101,4 @@ class PageCache extends ActionFilter ...@@ -101,4 +101,4 @@ class PageCache extends ActionFilter
{ {
$this->view->endCache(); $this->view->endCache();
} }
} }
\ No newline at end of file
...@@ -205,4 +205,4 @@ class Pagination extends \yii\base\Object ...@@ -205,4 +205,4 @@ class Pagination extends \yii\base\Object
{ {
return $this->pageSize < 1 ? -1 : $this->pageSize; return $this->pageSize < 1 ? -1 : $this->pageSize;
} }
} }
\ No newline at end of file
...@@ -333,4 +333,4 @@ class Sort extends \yii\base\Object ...@@ -333,4 +333,4 @@ class Sort extends \yii\base\Object
return false; return false;
} }
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace yii\web; namespace yii\web;
use yii\widgets\ActiveForm; use yii\widgets\Html;
/** /**
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
...@@ -66,7 +66,7 @@ class UploadedFile extends \yii\base\Object ...@@ -66,7 +66,7 @@ class UploadedFile extends \yii\base\Object
*/ */
public static function getInstance($model, $attribute) public static function getInstance($model, $attribute)
{ {
$name = ActiveForm::getInputName($model, $attribute); $name = Html::getInputName($model, $attribute);
return static::getInstanceByName($name); return static::getInstanceByName($name);
} }
...@@ -80,7 +80,7 @@ class UploadedFile extends \yii\base\Object ...@@ -80,7 +80,7 @@ class UploadedFile extends \yii\base\Object
*/ */
public static function getInstances($model, $attribute) public static function getInstances($model, $attribute)
{ {
$name = ActiveForm::getInputName($model, $attribute); $name = Html::getInputName($model, $attribute);
return static::getInstancesByName($name); return static::getInstancesByName($name);
} }
......
...@@ -51,7 +51,7 @@ class UrlManager extends Component ...@@ -51,7 +51,7 @@ class UrlManager extends Component
* @var boolean whether to show entry script name in the constructed URL. Defaults to true. * @var boolean whether to show entry script name in the constructed URL. Defaults to true.
* This property is used only if [[enablePrettyUrl]] is true. * This property is used only if [[enablePrettyUrl]] is true.
*/ */
public $showScriptName = true; public $showScriptName = false;
/** /**
* @var string the GET variable name for route. This property is used only if [[enablePrettyUrl]] is false. * @var string the GET variable name for route. This property is used only if [[enablePrettyUrl]] is false.
*/ */
...@@ -174,7 +174,7 @@ class UrlManager extends Component ...@@ -174,7 +174,7 @@ class UrlManager extends Component
public function createUrl($route, $params = array()) public function createUrl($route, $params = array())
{ {
$anchor = isset($params['#']) ? '#' . $params['#'] : ''; $anchor = isset($params['#']) ? '#' . $params['#'] : '';
unset($params['#']); unset($params['#'], $params[$this->routeVar]);
$route = trim($route, '/'); $route = trim($route, '/');
$baseUrl = $this->getBaseUrl(); $baseUrl = $this->getBaseUrl();
......
...@@ -447,4 +447,21 @@ class User extends Component ...@@ -447,4 +447,21 @@ class User extends Component
} }
} }
} }
/**
* Checks whether the user has access to the specified operation.
* @param $operator
* @param array $params
* @return bool
* @todo
*/
public function checkAccess($operation, $params = array())
{
$auth = Yii::$app->getAuthManager();
if ($auth !== null) {
return $auth->checkAccess($this->getId(), $operation, $params);
} else {
return true;
}
}
} }
...@@ -31,4 +31,4 @@ class UserEvent extends Event ...@@ -31,4 +31,4 @@ class UserEvent extends Event
* This property is only meaningful for [[User::EVENT_BEFORE_LOGIN]] and [[User::EVENT_BEFORE_LOGOUT]] events. * This property is only meaningful for [[User::EVENT_BEFORE_LOGIN]] and [[User::EVENT_BEFORE_LOGOUT]] events.
*/ */
public $isValid = true; public $isValid = true;
} }
\ No newline at end of file
...@@ -541,4 +541,4 @@ class ActiveField extends Component ...@@ -541,4 +541,4 @@ class ActiveField extends Component
. '</div>' . '</div>'
); );
} }
} }
\ No newline at end of file
...@@ -46,4 +46,4 @@ class Block extends Widget ...@@ -46,4 +46,4 @@ class Block extends Widget
} }
$this->view->blocks[$this->id] = $block; $this->view->blocks[$this->id] = $block;
} }
} }
\ No newline at end of file
...@@ -171,4 +171,4 @@ class FragmentCache extends Widget ...@@ -171,4 +171,4 @@ class FragmentCache extends Widget
} }
return $this->cache->buildKey($factors); return $this->cache->buildKey($factors);
} }
} }
\ No newline at end of file
...@@ -33,4 +33,4 @@ class MysqlTestCase extends TestCase ...@@ -33,4 +33,4 @@ class MysqlTestCase extends TestCase
} }
return $db; return $db;
} }
} }
\ No newline at end of file
...@@ -13,4 +13,4 @@ class TestCase extends \yii\test\TestCase ...@@ -13,4 +13,4 @@ class TestCase extends \yii\test\TestCase
} }
return isset(self::$params[$name]) ? self::$params[$name] : null; return isset(self::$params[$name]) ? self::$params[$name] : null;
} }
} }
\ No newline at end of file
...@@ -23,4 +23,4 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -23,4 +23,4 @@ class ActiveRecord extends \yii\db\ActiveRecord
{ {
return self::$db; return self::$db;
} }
} }
\ No newline at end of file
...@@ -24,4 +24,4 @@ class Customer extends ActiveRecord ...@@ -24,4 +24,4 @@ class Customer extends ActiveRecord
{ {
return $query->andWhere('status=1'); return $query->andWhere('status=1');
} }
} }
\ No newline at end of file
...@@ -8,4 +8,4 @@ class Item extends ActiveRecord ...@@ -8,4 +8,4 @@ class Item extends ActiveRecord
{ {
return 'tbl_item'; return 'tbl_item';
} }
} }
\ No newline at end of file
...@@ -43,4 +43,4 @@ class Order extends ActiveRecord ...@@ -43,4 +43,4 @@ class Order extends ActiveRecord
return false; return false;
} }
} }
} }
\ No newline at end of file
...@@ -18,4 +18,4 @@ class OrderItem extends ActiveRecord ...@@ -18,4 +18,4 @@ class OrderItem extends ActiveRecord
{ {
return $this->hasOne('Item', array('id' => 'item_id')); return $this->hasOne('Item', array('id' => 'item_id'));
} }
} }
\ No newline at end of file
...@@ -18,4 +18,4 @@ class Singer extends Model ...@@ -18,4 +18,4 @@ class Singer extends Model
array('underscore_style', 'yii\validators\CaptchaValidator'), array('underscore_style', 'yii\validators\CaptchaValidator'),
); );
} }
} }
\ No newline at end of file
...@@ -387,4 +387,4 @@ class NewComponent2 extends Component ...@@ -387,4 +387,4 @@ class NewComponent2 extends Component
$this->b = $b; $this->b = $b;
$this->c = $c; $this->c = $c;
} }
} }
\ No newline at end of file
...@@ -181,4 +181,4 @@ class NewObject extends Object ...@@ -181,4 +181,4 @@ class NewObject extends Object
{ {
return $this->_items; return $this->_items;
} }
} }
\ No newline at end of file
...@@ -17,6 +17,8 @@ class ApcCacheTest extends CacheTest ...@@ -17,6 +17,8 @@ class ApcCacheTest extends CacheTest
{ {
if(!extension_loaded("apc")) { if(!extension_loaded("apc")) {
$this->markTestSkipped("APC not installed. Skipping."); $this->markTestSkipped("APC not installed. Skipping.");
} else if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
$this->markTestSkipped("APC cli is not enabled. Skipping.");
} }
if($this->_cacheInstance === null) { if($this->_cacheInstance === null) {
...@@ -24,4 +26,4 @@ class ApcCacheTest extends CacheTest ...@@ -24,4 +26,4 @@ class ApcCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -67,4 +67,4 @@ class DbCacheTest extends CacheTest ...@@ -67,4 +67,4 @@ class DbCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -22,4 +22,4 @@ class FileCacheTest extends CacheTest ...@@ -22,4 +22,4 @@ class FileCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -24,4 +24,4 @@ class MemCacheTest extends CacheTest ...@@ -24,4 +24,4 @@ class MemCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -26,4 +26,4 @@ class MemCachedTest extends CacheTest ...@@ -26,4 +26,4 @@ class MemCachedTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -28,4 +28,4 @@ class WinCacheTest extends CacheTest ...@@ -28,4 +28,4 @@ class WinCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -24,4 +24,4 @@ class XCacheTest extends CacheTest ...@@ -24,4 +24,4 @@ class XCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -24,4 +24,4 @@ class ZendDataCacheTest extends CacheTest ...@@ -24,4 +24,4 @@ class ZendDataCacheTest extends CacheTest
} }
return $this->_cacheInstance; return $this->_cacheInstance;
} }
} }
\ No newline at end of file
...@@ -356,4 +356,4 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase ...@@ -356,4 +356,4 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
$customers = Customer::find()->all(); $customers = Customer::find()->all();
$this->assertEquals(0, count($customers)); $this->assertEquals(0, count($customers));
} }
} }
\ No newline at end of file
...@@ -289,4 +289,4 @@ class CommandTest extends \yiiunit\MysqlTestCase ...@@ -289,4 +289,4 @@ class CommandTest extends \yiiunit\MysqlTestCase
{ {
} }
} }
\ No newline at end of file
...@@ -113,4 +113,4 @@ class QueryTest extends \yiiunit\MysqlTestCase ...@@ -113,4 +113,4 @@ class QueryTest extends \yiiunit\MysqlTestCase
{ {
} }
} }
\ No newline at end of file
...@@ -57,4 +57,4 @@ class JsonTest extends \yii\test\TestCase ...@@ -57,4 +57,4 @@ class JsonTest extends \yii\test\TestCase
$this->setExpectedException('yii\base\InvalidParamException'); $this->setExpectedException('yii\base\InvalidParamException');
Json::decode($json); Json::decode($json);
} }
} }
\ No newline at end of file
...@@ -70,4 +70,4 @@ class StringHelperTest extends \yii\test\TestCase ...@@ -70,4 +70,4 @@ class StringHelperTest extends \yii\test\TestCase
$this->assertEquals('PostTag', StringHelper::id2camel('post-tag')); $this->assertEquals('PostTag', StringHelper::id2camel('post-tag'));
$this->assertEquals('PostTag', StringHelper::id2camel('post_tag', '_')); $this->assertEquals('PostTag', StringHelper::id2camel('post_tag', '_'));
} }
} }
\ No newline at end of file
...@@ -9,4 +9,4 @@ class VarDumperTest extends \yii\test\TestCase ...@@ -9,4 +9,4 @@ class VarDumperTest extends \yii\test\TestCase
$obj = new \StdClass(); $obj = new \StdClass();
VarDumper::dump($obj); VarDumper::dump($obj);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment