Browse Source

Upload Yii Framework 1.1.16

master v1.1.16
parent
commit
243be66bc5
  1. 1793
      CHANGELOG
  2. 31
      LICENSE
  3. 64
      README
  4. 539
      UPGRADE
  5. BIN
      demos/blog/css/bg.gif
  6. 166
      demos/blog/css/form.css
  7. 35
      demos/blog/css/ie.css
  8. 267
      demos/blog/css/main.css
  9. 29
      demos/blog/css/print.css
  10. 235
      demos/blog/css/screen.css
  11. 15
      demos/blog/index-test.php
  12. 11
      demos/blog/index.php
  13. 1
      demos/blog/protected/.htaccess
  14. 23
      demos/blog/protected/components/Controller.php
  15. 19
      demos/blog/protected/components/RecentComments.php
  16. 23
      demos/blog/protected/components/TagCloud.php
  17. 39
      demos/blog/protected/components/UserIdentity.php
  18. 17
      demos/blog/protected/components/UserMenu.php
  19. 7
      demos/blog/protected/components/views/recentComments.php
  20. 6
      demos/blog/protected/components/views/userMenu.php
  21. 8
      demos/blog/protected/config/console.php
  22. 76
      demos/blog/protected/config/main.php
  23. 19
      demos/blog/protected/config/params.php
  24. 25
      demos/blog/protected/config/test.php
  25. 130
      demos/blog/protected/controllers/CommentController.php
  26. 216
      demos/blog/protected/controllers/PostController.php
  27. 97
      demos/blog/protected/controllers/SiteController.php
  28. BIN
      demos/blog/protected/data/blog-test.db
  29. BIN
      demos/blog/protected/data/blog.db
  30. 13
      demos/blog/protected/data/dbgen.php
  31. 70
      demos/blog/protected/data/schema.cubrid.sql
  32. 70
      demos/blog/protected/data/schema.mysql.sql
  33. 70
      demos/blog/protected/data/schema.sqlite.sql
  34. 147
      demos/blog/protected/models/Comment.php
  35. 42
      demos/blog/protected/models/ContactForm.php
  36. 74
      demos/blog/protected/models/LoginForm.php
  37. 74
      demos/blog/protected/models/Lookup.php
  38. 201
      demos/blog/protected/models/Post.php
  39. 157
      demos/blog/protected/models/Tag.php
  40. 89
      demos/blog/protected/models/User.php
  41. 25
      demos/blog/protected/tests/WebTestCase.php
  42. 10
      demos/blog/protected/tests/bootstrap.php
  43. 24
      demos/blog/protected/tests/fixtures/tbl_comment.php
  44. 18
      demos/blog/protected/tests/fixtures/tbl_lookup.php
  45. 13
      demos/blog/protected/tests/fixtures/tbl_post.php
  46. 12
      demos/blog/protected/tests/fixtures/tbl_tag.php
  47. 9
      demos/blog/protected/tests/fixtures/tbl_user.php
  48. 36
      demos/blog/protected/tests/functional/CommentTest.php
  49. 30
      demos/blog/protected/tests/functional/PostTest.php
  50. 41
      demos/blog/protected/tests/functional/SiteTest.php
  51. 13
      demos/blog/protected/tests/phpunit.xml
  52. 42
      demos/blog/protected/tests/readme.txt
  53. 57
      demos/blog/protected/tests/unit/CommentTest.php
  54. 13
      demos/blog/protected/tests/unit/LookupTest.php
  55. 18
      demos/blog/protected/tests/unit/PostTest.php
  56. 13
      demos/blog/protected/tests/unit/TagTest.php
  57. 24
      demos/blog/protected/tests/unit/UserTest.php
  58. 40
      demos/blog/protected/views/comment/_form.php
  59. 46
      demos/blog/protected/views/comment/_view.php
  60. 12
      demos/blog/protected/views/comment/index.php
  61. 10
      demos/blog/protected/views/comment/update.php
  62. 7
      demos/blog/protected/views/layouts/column1.php
  63. 22
      demos/blog/protected/views/layouts/column2.php
  64. 55
      demos/blog/protected/views/layouts/main.php
  65. 22
      demos/blog/protected/views/post/_comments.php
  66. 47
      demos/blog/protected/views/post/_form.php
  67. 23
      demos/blog/protected/views/post/_view.php
  68. 31
      demos/blog/protected/views/post/admin.php
  69. 8
      demos/blog/protected/views/post/create.php
  70. 9
      demos/blog/protected/views/post/index.php
  71. 10
      demos/blog/protected/views/post/update.php
  72. 36
      demos/blog/protected/views/post/view.php
  73. 70
      demos/blog/protected/views/site/contact.php
  74. 12
      demos/blog/protected/views/site/error.php
  75. 46
      demos/blog/protected/views/site/login.php
  76. 9
      demos/blog/protected/views/site/pages/about.php
  77. 4
      demos/blog/protected/yiic
  78. 16
      demos/blog/protected/yiic.bat
  79. 7
      demos/blog/protected/yiic.php
  80. 1
      demos/blog/themes/classic/views/.htaccess
  81. 0
      demos/hangman/assets/empty
  82. 7
      demos/hangman/index.php
  83. 1
      demos/hangman/protected/.htaccess
  84. 14
      demos/hangman/protected/config/main.php
  85. 222
      demos/hangman/protected/controllers/GameController.php
  86. 28
      demos/hangman/protected/controllers/words.txt
  87. 0
      demos/hangman/protected/runtime/empty
  88. 21
      demos/hangman/protected/views/game/guess.php
  89. 5
      demos/hangman/protected/views/game/lose.php
  90. 15
      demos/hangman/protected/views/game/play.php
  91. 5
      demos/hangman/protected/views/game/win.php
  92. 14
      demos/hangman/protected/views/layouts/main.php
  93. 7
      demos/helloworld/index.php
  94. 1
      demos/helloworld/protected/.htaccess
  95. 15
      demos/helloworld/protected/controllers/SiteController.php
  96. 24
      demos/phonebook/flex/.actionScriptProperties
  97. 2
      demos/phonebook/flex/.flexProperties
  98. 18
      demos/phonebook/flex/.project
  99. 3
      demos/phonebook/flex/.settings/com.adobe.flexbuilder.project.prefs
  100. 3
      demos/phonebook/flex/.settings/org.eclipse.core.resources.prefs

1793
CHANGELOG

File diff suppressed because it is too large

31
LICENSE

@ -0,0 +1,31 @@
The Yii framework is free software. It is released under the terms of
the following BSD License.
Copyright (c) 2008-2014 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

64
README

@ -0,0 +1,64 @@
Yii Web Programming Framework
=============================
Thank you for choosing Yii - a high-performance component-based PHP framework.
INSTALLATION
------------
Please make sure the release file is unpacked under a Web-accessible
directory. You shall see the following files and directories:
demos/ demos
framework/ framework source files
requirements/ requirement checker
CHANGELOG describing changes in every Yii release
LICENSE license of Yii
README this file
UPGRADE upgrading instructions
REQUIREMENTS
------------
The minimum requirement by Yii is that your Web server supports
PHP 5.1.0 or above. Yii has been tested with Apache HTTP server
on Windows and Linux operating systems.
Please access the following URL to check if your Web server reaches
the requirements by Yii, assuming "YiiPath" is where Yii is installed:
http://hostname/YiiPath/requirements/index.php
QUICK START
-----------
Yii comes with a command line tool called "yiic" that can create
a skeleton Yii application for you to start with.
On command line, type in the following commands:
$ cd YiiPath/framework (Linux)
cd YiiPath\framework (Windows)
$ ./yiic webapp ../testdrive (Linux)
yiic webapp ..\testdrive (Windows)
The new Yii application will be created at "YiiPath/testdrive".
You can access it with the following URL:
http://hostname/YiiPath/testdrive/index.php
WHAT's NEXT
-----------
Please visit the project website for tutorials, class reference
and join discussions with other Yii users.
The Yii Developer Team
http://www.yiiframework.com

539
UPGRADE

@ -0,0 +1,539 @@
Upgrading Instructions for Yii Framework v1.1.16
================================================
!!!IMPORTANT!!!
The following upgrading instructions are cumulative. That is,
if you want to upgrade from version A to version C and there is
version B between A and C, you need to following the instructions
for both A and B.
General upgrade instructions
----------------------------
- Make a backup.
- Clean up your 'assets' folder.
- Replace 'framework' dir with the new one or point GIT to a fresh
release and update.
- Check if everything is OK, if not — revert from backup and post
issues to Yii issue tracker.
Upgrading from v1.1.15
----------------------
- 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 being interpreted as
PHP functions. CDetailView now only allows anonymous functions to be called, all other values will be taken as value.
- We updated the `framework/utils/mimeTypes.php` with more file extensions from the http apache project.
Due to this fact some of the assignments have changed so if you rely on the mimeType detection of `CFileHelper`
you need to check if your code works with the new mime type assignments.
You can use a custom `mimeTypes.php` file to bring back the old behavior if needed by specifying the second parameter
of `CFileHelper::getMimeTypeByExtension($file, $magicFile='path/to/your/mimeTypes.php')`.
- We upgraded the bundled jQuery version to 1.11.1. Previous version was 1.8.3.
There were breaking changes in the jQuery API which you can find in the jQuery blog:
<http://jquery.com/upgrade-guide/1.9/#changes-of-note-in-jquery-1-9>. The [jquery-migrate plugin](https://github.com/jquery/jquery-migrate/)
can help checking your code for deprecated functionality.
- jQueryUI was updated. Check the upgrade guides for [1.10](http://jqueryui.com/upgrade-guide/1.10) and
[1.11](http://jqueryui.com/upgrade-guide/1.11).
- The implementation of `CSecurityManager::encrypt()` and `decrypt()` were changed to be more secure.
The old implementations were renamed as `legacyEncrypt()` and `legacyDecrypt()`. If you use these methods to encrypt
your data, you should either call legacy versions now to avoid code break or take the following steps to use the new
version (which we highly recommend):
1. Decrypt existing data that were encrypted using `legacyDecrypt()`.
2. Change key via application config (encryptionKey property of securityManager component) to the one that conforms
to recommendations.
3. Encrypt the data using `legacyEncrypt()`.
You can disable key validation by setting validateEncryptionKey property of securityManager component to false but
if it strongly not recommended.
Upgrading from v1.1.14
----------------------
No significant changes, 1.1.15 was a security fix release.
Upgrading from v1.1.13
----------------------
- CActiveRecord::count() now respects group by and having. If your code relied
on ignoring it your application may break and should be updated.
- Vendors: phlymail's Net_IDNA was replaced by PEAR Net_IDNA2. The latter library is better maintained than the former.
In case your code relies on bundled phlymail's Net_IDNA you should change it a bit. Old way of encoding IDNs:
require_once(Yii::getPathOfAlias('system.vendors.idna_convert').DIRECTORY_SEPARATOR.'idna_convert.class.php');
$idnaConvert=new idna_convert();
$result=$idnaConvert->encode($value);
New:
require_once(Yii::getPathOfAlias('system.vendors.Net_IDNA2.Net').DIRECTORY_SEPARATOR.'IDNA2.php');
$idna=new Net_IDNA2();
$result=$idna->encode($value);
- CAPTCHA appearance has been changed. Non-free Duality.ttf font (used by CCaptchaAction) replaced by open/free
SpicyRice.ttf. New font is distributed under SIL Open Font License version 1.1. Do not forget to adjust font path
in case your application relies on Duality.ttf font file.
- 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/)
and [jQuery release notes](http://blog.jquery.com/2012/08/09/jquery-1-8-released/).
- We completed the behavior of CFormatter::sizeFormat() which has been introduced in Yii 1.1.11. If you are using it with your own translation file
you have to move your translations to the `yii` category in `yii.php` file which is handled by the application component `coreMessages`.
We also fixed the default translation strings to be correct English and apply to choice format, so you have to adjust your translation file keys.
- Be sure to clean all your existing cache during the upgrade. The cache values from CDbCommand has been
changed to an array to be able to store false values (returned when no records are found).
- Make sure all your event handlers in behaviors are public methods, as we are not supporting protected methods as event handlers anymore.
- We fixed the calls to CActiveRecord::beforeFind() for consistency so that beforeFind() now always gets called for every relation
on eager loading even if the main query does not return a result. This has been the case for all CActiveRecord::find*()-methods
already but now also applies for findBySql() and findAllBySql().
- Criteria modification in CActiveRecord::beforeFind() did not apply to the query when model was loaded in a relational context.
Since version 1.1.13 changes to query criteria made in beforeFind() now also apply to the query when model is loaded in a relational context.
The main problem here is that you can not use the `t`-alias for your table anymore, you have to change your code to
use the table alias currently in use as this is different in relational context.
You can get that alias by calling `$this->getTableAlias();` in your active record class
or `$this->owner->getTableAlias()` in behavior context.
Example:
$criteria->condition = 't.myfield = 1';
You need to change that to:
$alias = $this->owner->getTableAlias();
$criteria->condition = $alias.'.myfield = 1';
- Make sure you are using `CCaptcha::checkRequirements()` method for checking whether CAPTCHA could be rendered successfully in your environment.
`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
If your application relies on these newly added changes. You should change your code from
$cookies->add(new CHttpCookie($name, $value));
to
$cookies[$name] = new CHttpCookie($name, $value);
- CActiveRecord::resetScope() method signature changed. Please update your subclasses that override resetScope() if any.
Upgrading from v1.1.10
----------------------
- API of public method CConsoleCommand::confirm() changed. If you are overriding this method make sure to update your code.
The method now has a 2nd parameter for the default value which will be used if no selection is made, so you have to
adjust the signature to fit
public function confirm($message,$default=false)
and the parent call to
parent::confirm($message,$default);
- API of protected method CConsoleCommand::afterAction() changed, if you are overriding this method make sure to update your code.
method now has a 3rd parameter for application exit code, so you have to adjust the signature to fit
protected function afterAction($action,$params,$exitCode=0)
and the parent call to
parent::afterAction($action,$params,$exitCode);
- CDateFormat::format() now will return null if the parameter $time is null. Previously it would return 1/1/1970.
- If you are using CJavaScript::encode in your application with parameter coming
from user input, set second argument to true:
CJavaScript::encode($userInput, true);
It will disable prefixing parameters with "js:". If you need to pass JavaScript
expression it's now preferrable to wrap these with CJavaScriptExpression:
CJavaScript::encode(new CJavaScriptExpression('alert("Yii!");'), true);
Note that second "safe" parameter doesn't affect CJavaScriptExpression in any way.
Upgrading from v1.1.9
---------------------
- Previously xSendFile() was returning false if the file was not found.
This has been removed to allow relative file paths. If you are relying on this check,
you will need to do it manually before calling xSendFile().
Upgrading from v1.1.8
---------------------
- CConfiguration::createObject, CController::paginate and CHtml::getActiveId deprecated since 1.0.x were removed. Use
Yii::createComponent, new CPagination directly and CHtml::activeId respectively.
- In CErrorHandler::handleException() the checking for ajax call has been removed
as it was preventing to customize the display of the exception during an ajax call.
- Previously in case of validation error the CSS "error" class was not added to the row container at all when
checkBoxList or radioButtonList where used. This is fixed now and proper "error" CSS class is added to the row
container but in case of validation error, all labels from the list are shown in red because of the CSS rule.
To fix this and display only the attribute label in red:
in <projectdir>/css/form.css the line:
div.form div.error label
should be changed to
div.form div.error label:first-child
- If you've used "through" ActiveRecord option in your relation definitions it's good to update code as shown below.
Old style of defining this option still works but is now deprecated.
Change
~~~
class Group extends CActiveRecord
{
public function relations()
{
return array(
'roles'=>array(self::HAS_MANY,'Role','group_id'),
'users'=>array(self::HAS_MANY,'User','user_id','through'=>'roles'),
);
}
}
~~~
to
~~~
class Group extends CActiveRecord
{
public function relations()
{
return array(
'roles'=>array(self::HAS_MANY,'Role','group_id'),
'users'=>array(self::HAS_MANY,'User',array('user_id'=>'id'),'through'=>'roles'),
);
}
}
~~~
Upgrading from v1.1.7
---------------------
- CDbAuthManager will now quote columns and tables referenced in its SQL code.
If your auth tables were created in a case-insensitive fashion (e.g. on PostgreSQL)
while your DBMS is case-sensitive, this change may cause DB query errors.
To fix this issue, you will have to rename the table names and columns, or re-create
the auth tables by following the SQL code given in framework/web/auth/*.sql.
- jQuery was upgraded to 1.6.1. Check your client side code and if you have issues consider
downgrading to 1.5.1 or 1.4.4.
Upgrading from v1.1.6
---------------------
- Make sure you are using latest stable PHPUnit 3.5 if you are using unit tests.
Upgrading from v1.1.5
---------------------
- In CActiveRecord::relations(), if a relation involves composite foreign keys, the foreign key
columns must be separated by commas now. Previously, the columns can be separated by either
commas or spaces. If your mode code are generated by Gii or yiic shell, you do not need to
worry about this.
- CLDR data was updated to a newest available version so data formats, month
names and other regional data can be changed.
Upgrading from v1.1.4
---------------------
- CHtml will no longer render null attributes for HTML tags. This means if $htmlOptions is
array('class'=>null), it will no longer render the 'class' attribute in the HTML tag.
it would render the class attribute as class="". We expect this will not cause much trouble
in upgrading. However, in case problems happen, you may set the attribute to be an empty string
to solve them.
- Now by default CWebLogRoute does not render logs in FireBug for ajax calls.
To get logs rendered for ajax calls in FireBug set CWebLogRoute::ignoreAjaxInFireBug to false
- The implementation of CCache::flush() was changed a little. Child classes should now implement
a flushValues() method. If you use any custom cache class with flush functionality, you should
rename the flush method accordingly.
- The prompt and empty options used in CHtml methods will NOT be HTML-encoded anymore. It will now
always convert ">" and "<" into "&gt;" and "lt;", respectively. This should be sufficient in most
cases. But if your application uses some other special characters, or if you allow user inputs
to be used as prompt and empty text labels, please call CHtml::encode() explicitly on these option
values.
Upgrading from v1.1.3
---------------------
- Zii was merged into Yii so if you are using SVN to keep framework
up to date, you'll need to delete 'framework/zii' and then update it.
Upgrading from v1.1.2
---------------------
- When using the skin feature, you now need to explicitly configure
the 'enableSkin' property of 'widgetFactory' application component
to be true. Also, if you have configured the 'widgets' property, you
should rename it to be 'skinnableWidgets'. These changes are due to
the introduction of the global widget customization feature.
Please see the guide (the "Theming" section) for more details.
- CAutoComplete is now deprecated and will be removed in Yii 1.2. Consider
using CJuiAutoComplete.
- Now it's not possible to reuse CActiveFinder. So if you have code like this:
$finder = Post::model()->with('comments');
$posts1 = $finder->findAll();
$posts2 = $finder->findAll();
you should rewrite it to:
$posts1 = Post::model()->with('comments');
$posts2 = Post::model()->with('comments');
- The 'condition' declared in the scopes of the related AR classes will now
be put in the 'ON' clause of the JOIN statement when performing relational AR queries.
Upgrading from v1.1.1
---------------------
Upgrading from v1.1.0
---------------------
- CHtml::beginForm() will automatically generate hidden fields to represent
the parameters in the query string when the form uses GET method.
To avoid submitting duplicated query parameters, you may use createUrl()
to explicitly specify the action of the form. You may also need to remove
the hidden fields that you previously render for the same purpose.
- The code generated by yiic tool is changed. If you are using yiic tool
to generate new CRUD code on a previously generated skeleton, you are recommended
to run "yiic webapp" again to re-generate the skeleton. Make sure you backup
your work before you do this.
- CMenu now renders the 'active' CSS class for the 'li' tag instead of the
hyperlink tag. You should adjust your CSS code accordingly if you use CMenu
in your application.
- CUrlManager::parsePathInfo() is changed to be non-static. If you override
this method or your existing code calls this method directly (neither is common),
you need to change your code accordingly.
- CController::forward() will exit the application by default now. If you want
to keep the old behavior, you may pass false as the second parameter.
- The jQuery copy included in the framework has been upgraded to version 1.4.2.
This may cause some incompatibility problems to your existing jQuery code or plugins.
If you want to keep using version 1.3.2, you may do so by configuring
CClientScript::scriptMap property.
- The default theme for JQuery UI widgets was changed from 'smoothness' to 'base'.
If you are using 'smoothness', you will need to manually download this theme from
jqueryui.com and configure the 'theme' property of the JQuery UI widgets accordingly.
Upgrading from v1.1rc
---------------------
- CRudColumn is renamed as CButtonColumn
- CDataColumn.dataField and dataExpression are renamed as name and value, respectively
- The alias name for the primary table in an AR query is fixed to be 't'
Upgrading from v1.1b
--------------------
Upgrading from v1.1a
--------------------
- CSort::attributes is changed. Now the array keys refer to attribute names
and array values refer to virtual attribute definitions. Please read the
API documentation for this property to learn more details. This change will
affect your code only when you explicitly specify this property.
Upgrading from v1.0.x
---------------------
- Application and module parameter names are changed to be case-sensitive.
In 1.0.x, they are case-insensitive.
- For tabular input, using Field[$i] is not valid anymore. Attribute names
should look like [$i]Field in order to support array-typed fields
(e.g. [$i]Field[$index]).
- Please read the Guide for further details on how to upgrade from v1.0.x to v1.1.
Upgrading from v1.0.12
----------------------
Upgrading from v1.0.11
----------------------
Upgrading from v1.0.10
----------------------
Upgrading from v1.0.9
---------------------
Upgrading from v1.0.8
---------------------
- ActiveRecord lazy loading is changed for optimization purpose. Previously,
when lazy loading occurs, the related table will be joined with the primary
table. Now, the related table will be queried without joining the primary table.
As a result, if you are using lazy loading and the corresponding relation
declaration includes reference to the primary table, the query will fail.
To fix this problem, please specify the lazy loading query options with the
actual primary table column values.
Upgrading from v1.0.7
---------------------
- A directory imported using Yii::import() will have precedence over
any existing include paths. For example, if we import 'application.models.*',
then the corresponding directory will be searched before any other
existing include paths. This also means, a directory imported later will
have precedence over directories imported earlier. Previously, this order
was reversed. This change may affect you if you have several classes with
the same name and they are imported via different directories. You will need
to adjust the import order of these directories to make sure your existing
applications are not broken due to this change.
Upgrading from v1.0.6
---------------------
- Default named scope will no longer be applied to INSERT, UPDATE and
DELETE queries. It is only applied to SELECT queries. You should be aware
of this change if you override CActiveRecord::defaultScope() in your code.
- The signature of CWebUser::logout() is changed. If you override this method,
you will need to modify your method declaration accordingly.
Upgrading from v1.0.5
---------------------
Upgrading from v1.0.4
---------------------
- CWebUser::checkAccess() takes an additional parameter to allow caching
the access check results. If you override this method, you will need to
modify your method declaration accordingly. Because the new parameter will
enable caching the access check results by default, please double check
your code containing this method call to make sure the behavior is as expected.
- CDateParser has been renamed to CDateTimeParser
Upgrading from v1.0.3
---------------------
- The signature of CWebModule::init() is modified. Its parameter is removed.
If your application uses modules, you have to modify your module class
files accordingly.
Upgrading from v1.0.2
---------------------
- Controllers that are organized in subdirectories are now referenced
using the ID format "path/to/xyz". Previously it was "path.to.xyz".
If you use "path.to.xyz" in your application, you have to modify it
to "path/to/xyz".
- CHtml::coreScript() is removed. If you used this in your application,
please use the following alternative:
Yii::app()->clientScript->registerCoreScript($name);
Upgrading from v1.0.1
---------------------
- Due to the introduction of the scenario-based massive assignment feature,
we removed CActiveRecord::protectedAttributes(). Please use safeAttributes()
to specify which attributes are safe to be massively assigned.
For more details about scenario-based assignment and validation,
please read the following tutorial section:
http://www.yiiframework.com/doc/guide/form.model#securing-attribute-assignments
- The signature of CModel::validate() has been changed to:
CModel::validate($scenario='', $attributes=null)
That is, the order of the two parameters has been swapped. If your application
contains code that invokes the validate() method (of either a CFormModel
or a CActiveRecord object) with some parameter, please make sure you fix
the parameter order.
- The usage of CActiveRecord::with() and the 'with' option in relations
has been changed. In order to query child relations, we should specify the 'with'
parameter/option like the following now:
Post::model()->with(array('comments', 'author.profile'))->findAll();
Previously, this should be written as:
Post::model()->with(array('comments', 'author'=>'profile'))->findAll();
If your code does not involve child relations (like 'profile' in the above),
nothing needs to be changed.
This change has been introduced in order to support dynamic relational
query options. For example, we can specify that comments be sorted in
descending order (assuming in the relations() method it is specified as
ascending order):
Post::model()->with(array(
'comments'=>array('order'=>'createTime DESC'),
'author.profile',
))->findAll();
Upgrading from v1.0.0
---------------------
- An $scenario parameter is added to both CModel::beforeValidate() and afterValidate().
If you override these methods in your child classes (form models, AR classes),
make sure you change the method signature accordingly.

BIN
demos/blog/css/bg.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

166
demos/blog/css/form.css

@ -0,0 +1,166 @@
/**
* CSS styles for forms generated by yiic.
*
* The styles can be applied to the following form structure:
*
* <div class="form">
* <div class="row">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* <div class="row">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* <div class="row buttons">
* <label for="inputid">xyz</label>
* <input name="inputid" id="inputid" type="text" />
* <p class="hint">hint text</p>
* </div>
* </div>
*
* The above code will render the labels and input fields in separate lines.
* In order to render them in the same line, please use the "wide" form as follows,
*
* <div class="wide form">
* ......
* </div>
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2010 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
div.form
{
margin: 0;
}
div.form input,
div.form textarea,
div.form select
{
margin: 0.2em 0 0.5em 0;
}
div.form fieldset
{
border: 1px solid #DDD;
padding: 10px;
margin: 0 0 10px 0;
-moz-border-radius:7px;
}
div.form label
{
font-weight: bold;
font-size: 0.9em;
display: block;
}
div.form .row
{
margin: 5px 0;
}
div.form .hint
{
margin: 0;
padding: 0;
color: #999;
}
div.form .note
{
font-style: italic;
}
div.form span.required
{
color: red;
}
div.form div.error label,
div.form label.error,
div.form span.error
{
color: #C00;
}
div.form div.error input,
div.form div.error textarea,
div.form div.error select,
div.form input.error,
div.form textarea.error,
div.form select.error
{
background: #FEE;
border-color: #C00;
}
div.form div.success input,
div.form div.success textarea,
div.form div.success select,
div.form input.success,
div.form textarea.success,
div.form select.success
{
background: #E6EFC2;
border-color: #C6D880;
}
div.form .errorSummary
{
border: 2px solid #C00;
padding: 7px 7px 12px 7px;
margin: 0 0 20px 0;
background: #FEE;
font-size: 0.9em;
}
div.form .errorMessage
{
color: red;
font-size: 0.9em;
}
div.form .errorSummary p
{
margin: 0;
padding: 5px;
}
div.form .errorSummary ul
{
margin: 0;
padding: 0 0 0 20px;
}
div.wide form label
{
float: left;
margin-right: 10px;
position: relative;
text-align: right;
width: 100px;
}
div.wide form .row
{
clear: left;
}
div.wide form .buttons
{
clear: left;
padding-left: 110px;
}
div.wide form .errorMessage
{
margin: 0 0 0 110px;
}

35
demos/blog/css/ie.css

@ -0,0 +1,35 @@
/* -----------------------------------------------------------------------
Blueprint CSS Framework 0.9
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
----------------------------------------------------------------------- */
/* ie.css */
body {text-align:center;}
.container {text-align:left;}
* html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {display:inline;overflow-x:hidden;}
* html legend {margin:0px -8px 16px 0;padding:0;}
sup {vertical-align:text-top;}
sub {vertical-align:text-bottom;}
html>body p code {*white-space:normal;}
hr {margin:-8px auto 11px;}
img {-ms-interpolation-mode:bicubic;}
.clearfix, .container {display:inline-block;}
* html .clearfix, * html .container {height:1%;}
fieldset {padding-top:0;}
textarea {overflow:auto;}
input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;}
input.text:focus, input.title:focus {border-color:#666;}
input.text, input.title, textarea, select {margin:0.5em 0;}
input.checkbox, input.radio {position:relative;top:.25em;}
form.inline div, form.inline p {vertical-align:middle;}
form.inline label {position:relative;top:-0.25em;}
form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;}
button, input.button {position:relative;top:0.25em;}

267
demos/blog/css/main.css

@ -0,0 +1,267 @@
body
{
margin: 0;
padding: 0;
color: #555;
font: normal 10pt Arial,Helvetica,sans-serif;
background: #EFEFEF;
}
#page
{
margin-top: 5px;
margin-bottom: 5px;
background: white;
border: 1px solid #C9E0ED;
}
#header
{
margin: 0;
padding: 0;
border-top: 3px solid #C9E0ED;
}
#content
{
padding: 20px;
}
#sidebar
{
padding: 20px;
}
#footer
{
padding: 10px;
margin: 10px 20px;
font-size: 0.8em;
text-align: center;
border-top: 1px solid #C9E0ED;
}
#logo
{
padding: 10px 20px;
font-size: 200%;
}
#mainmenu
{
background:white url(bg.gif) repeat-x left top;
}
#mainmenu ul
{
padding:6px 20px 5px 20px;
margin:0px;
}
#mainmenu ul li
{
display: inline;
}
#mainmenu ul li a
{
color:#ffffff;
background-color:transparent;
font-size:12px;
font-weight:bold;
text-decoration:none;
padding:5px 8px;
}
#mainmenu ul li a:hover, #mainmenu ul li.active a
{
color: #6399cd;
background-color:#EFF4FA;
text-decoration:none;
}
div.flash-error, div.flash-notice, div.flash-success
{
padding:.8em;
margin-bottom:1em;
border:2px solid #ddd;
}
div.flash-error
{
background:#FBE3E4;
color:#8a1f11;
border-color:#FBC2C4;
}
div.flash-notice
{
background:#FFF6BF;
color:#514721;
border-color:#FFD324;
}
div.flash-success
{
background:#E6EFC2;
color:#264409;
border-color:#C6D880;
}
div.flash-error a
{
color:#8a1f11;
}
div.flash-notice a
{
color:#514721;
}
div.flash-success a
{
color:#264409;
}
div.form .rememberMe label
{
display: inline;
}
div.view
{
padding: 10px;
margin: 10px 0;
border: 1px solid #C9E0ED;
}
div.breadcrumbs
{
font-size: 0.9em;
padding: 5px 20px;
}
div.breadcrumbs span
{
font-weight: bold;
}
.portlet
{
}
.portlet-decoration
{
padding: 3px 8px;
background: #B7D6E7;
border-left: 5px solid #6FACCF;
}
.portlet-title
{
font-size: 12px;
font-weight: bold;
padding: 0;
margin: 0;
color: #298dcd;
}
.portlet-content
{
font-size:0.9em;
margin: 0;
padding: 5px 8px;
margin-bottom:15px;
background:#EFFDFF;
}
.portlet-content ul
{
list-style-image:none;
list-style-position:outside;
list-style-type:none;
margin: 0;
padding: 0;
}
.portlet-content li
{
padding: 2px 0 4px 0px;
}
.post
{
margin: 0 0 20px;
}
.post .title
{
font-size: 1.5em;
border-bottom: 1px solid #C9E0ED;
}
.post .title a
{
color: #555;
text-decoration: none;
}
.post .author
{
color: #888;
margin: 0 0 5px;
}
.post .nav
{
-moz-border-radius:7px;
padding: 5px;
background: #EFFDFF;
}
.comment
{
-moz-border-radius:7px;
padding: 10px;
background: #F5F5F5;
margin: 5px 0;
}
.comment .content
{
margin: 10px 0;
}
.comment .author
{
margin: 5px 0;
padding: 0 0 3px;
border-bottom: 1px solid #DDD;
}
.comment .time
{
color: #888;
font-size: 0.8em;
}
.comment a.cid
{
color:#CCC;
float:right;
font-size:1.5em;
font-weight:bold;
padding:0 5px 5px 5px;
text-decoration: none;
}
.comment a.cid:hover
{
color:#555;
}
.comment .pending
{
color:red;
}

29
demos/blog/css/print.css

@ -0,0 +1,29 @@
/* -----------------------------------------------------------------------
Blueprint CSS Framework 0.9
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
----------------------------------------------------------------------- */
/* print.css */
body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
.container {background:none;}
hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
hr.space {background:#fff;color:#fff;visibility:hidden;}
h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
code {font:.9em "Courier New", Monaco, Courier, monospace;}
a img {border:none;}
p img.top {margin-top:0;}
blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
.small {font-size:.9em;}
.large {font-size:1.1em;}
.quiet {color:#999;}
.hide {display:none;}
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}

235
demos/blog/css/screen.css

@ -0,0 +1,235 @@
/* -----------------------------------------------------------------------
Blueprint CSS Framework 0.9
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
----------------------------------------------------------------------- */
/* reset.css */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
body {line-height:1.5;}
table {border-collapse:separate;border-spacing:0;}
caption, th, td {text-align:left;font-weight:normal;}
table, td, th {vertical-align:middle;}
blockquote:before, blockquote:after, q:before, q:after {content:"";}
blockquote, q {quotes:"" "";}
a img {border:none;}
/* typography.css */
html {font-size:100.01%;}
body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
h1 {font-size:2em;line-height:1;margin-bottom:0.5em;}
h2 {font-size:1.6em;margin-bottom:0.75em;}
h3 {font-size:1.4em;line-height:1;margin-bottom:1em;}
h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
h6 {font-size:1em;font-weight:bold;}
h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
p {margin:0 0 1.5em;}
p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
a:focus, a:hover {color:#000;}
a {color:#009;text-decoration:underline;}
blockquote {margin:1.5em;color:#666;font-style:italic;}
strong {font-weight:bold;}
em, dfn {font-style:italic;}
dfn {font-weight:bold;}
sup, sub {line-height:0;}
abbr, acronym {border-bottom:1px dotted #666;}
address {margin:0 0 1.5em;font-style:italic;}
del {color:#666;}
pre {margin:1.5em 0;white-space:pre;}
pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
li ul, li ol {margin:0;}
ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;}
ul {list-style-type:disc;}
ol {list-style-type:decimal;}
dl {margin:0 0 1.5em 0;}
dl dt {font-weight:bold;}
dd {margin-left:1.5em;}
table {margin-bottom:1.4em;width:100%;}
th {font-weight:bold;}
thead th {background:#c3d9ff;}
th, td, caption {padding:4px 10px 4px 5px;}
tfoot {font-style:italic;}
caption {background:#eee;}
.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
.hide {display:none;}
.quiet {color:#666;}
.loud {color:#000;}
.highlight {background:#ff0;}
.added {background:#060;color:#fff;}
.removed {background:#900;color:#fff;}
.first {margin-left:0;padding-left:0;}
.last {margin-right:0;padding-right:0;}
.top {margin-top:0;padding-top:0;}
.bottom {margin-bottom:0;padding-bottom:0;}
/* grid.css */
.container {width:950px;margin:0 auto;}
.showgrid {background:url(src/grid.png);}
.column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 {float:left;margin-right:10px;}
.last, div.last {margin-right:0;}
.span-1 {width:30px;}
.span-2 {width:70px;}
.span-3 {width:110px;}
.span-4 {width:150px;}
.span-5 {width:190px;}
.span-6 {width:230px;}
.span-7 {width:270px;}
.span-8 {width:310px;}
.span-9 {width:350px;}
.span-10 {width:390px;}
.span-11 {width:430px;}
.span-12 {width:470px;}
.span-13 {width:510px;}
.span-14 {width:550px;}
.span-15 {width:590px;}
.span-16 {width:630px;}
.span-17 {width:670px;}
.span-18 {width:710px;}
.span-19 {width:750px;}
.span-20 {width:790px;}
.span-21 {width:830px;}
.span-22 {width:870px;}
.span-23 {width:910px;}
.span-24, div.span-24 {width:950px;margin-right:0;}
input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {border-left-width:1px!important;border-right-width:1px!important;padding-left:5px!important;padding-right:5px!important;}
input.span-1, textarea.span-1 {width:18px!important;}
input.span-2, textarea.span-2 {width:58px!important;}
input.span-3, textarea.span-3 {width:98px!important;}
input.span-4, textarea.span-4 {width:138px!important;}
input.span-5, textarea.span-5 {width:178px!important;}
input.span-6, textarea.span-6 {width:218px!important;}
input.span-7, textarea.span-7 {width:258px!important;}
input.span-8, textarea.span-8 {width:298px!important;}
input.span-9, textarea.span-9 {width:338px!important;}
input.span-10, textarea.span-10 {width:378px!important;}
input.span-11, textarea.span-11 {width:418px!important;}
input.span-12, textarea.span-12 {width:458px!important;}
input.span-13, textarea.span-13 {width:498px!important;}
input.span-14, textarea.span-14 {width:538px!important;}
input.span-15, textarea.span-15 {width:578px!important;}
input.span-16, textarea.span-16 {width:618px!important;}
input.span-17, textarea.span-17 {width:658px!important;}
input.span-18, textarea.span-18 {width:698px!important;}
input.span-19, textarea.span-19 {width:738px!important;}
input.span-20, textarea.span-20 {width:778px!important;}
input.span-21, textarea.span-21 {width:818px!important;}
input.span-22, textarea.span-22 {width:858px!important;}
input.span-23, textarea.span-23 {width:898px!important;}
input.span-24, textarea.span-24 {width:938px!important;}
.append-1 {padding-right:40px;}
.append-2 {padding-right:80px;}
.append-3 {padding-right:120px;}
.append-4 {padding-right:160px;}
.append-5 {padding-right:200px;}
.append-6 {padding-right:240px;}
.append-7 {padding-right:280px;}
.append-8 {padding-right:320px;}
.append-9 {padding-right:360px;}
.append-10 {padding-right:400px;}
.append-11 {padding-right:440px;}
.append-12 {padding-right:480px;}
.append-13 {padding-right:520px;}
.append-14 {padding-right:560px;}
.append-15 {padding-right:600px;}
.append-16 {padding-right:640px;}
.append-17 {padding-right:680px;}
.append-18 {padding-right:720px;}
.append-19 {padding-right:760px;}
.append-20 {padding-right:800px;}
.append-21 {padding-right:840px;}
.append-22 {padding-right:880px;}
.append-23 {padding-right:920px;}
.prepend-1 {padding-left:40px;}
.prepend-2 {padding-left:80px;}
.prepend-3 {padding-left:120px;}
.prepend-4 {padding-left:160px;}
.prepend-5 {padding-left:200px;}
.prepend-6 {padding-left:240px;}
.prepend-7 {padding-left:280px;}
.prepend-8 {padding-left:320px;}
.prepend-9 {padding-left:360px;}
.prepend-10 {padding-left:400px;}
.prepend-11 {padding-left:440px;}
.prepend-12 {padding-left:480px;}
.prepend-13 {padding-left:520px;}
.prepend-14 {padding-left:560px;}
.prepend-15 {padding-left:600px;}
.prepend-16 {padding-left:640px;}
.prepend-17 {padding-left:680px;}
.prepend-18 {padding-left:720px;}
.prepend-19 {padding-left:760px;}
.prepend-20 {padding-left:800px;}
.prepend-21 {padding-left:840px;}
.prepend-22 {padding-left:880px;}
.prepend-23 {padding-left:920px;}
div.border {padding-right:4px;margin-right:5px;border-right:1px solid #eee;}
div.colborder {padding-right:24px;margin-right:25px;border-right:1px solid #eee;}
.pull-1 {margin-left:-40px;}
.pull-2 {margin-left:-80px;}
.pull-3 {margin-left:-120px;}
.pull-4 {margin-left:-160px;}
.pull-5 {margin-left:-200px;}
.pull-6 {margin-left:-240px;}
.pull-7 {margin-left:-280px;}
.pull-8 {margin-left:-320px;}
.pull-9 {margin-left:-360px;}
.pull-10 {margin-left:-400px;}
.pull-11 {margin-left:-440px;}
.pull-12 {margin-left:-480px;}
.pull-13 {margin-left:-520px;}
.pull-14 {margin-left:-560px;}
.pull-15 {margin-left:-600px;}
.pull-16 {margin-left:-640px;}
.pull-17 {margin-left:-680px;}
.pull-18 {margin-left:-720px;}
.pull-19 {margin-left:-760px;}
.pull-20 {margin-left:-800px;}
.pull-21 {margin-left:-840px;}
.pull-22 {margin-left:-880px;}
.pull-23 {margin-left:-920px;}
.pull-24 {margin-left:-960px;}
.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;}
.push-1 {margin:0 -40px 1.5em 40px;}
.push-2 {margin:0 -80px 1.5em 80px;}
.push-3 {margin:0 -120px 1.5em 120px;}
.push-4 {margin:0 -160px 1.5em 160px;}
.push-5 {margin:0 -200px 1.5em 200px;}
.push-6 {margin:0 -240px 1.5em 240px;}
.push-7 {margin:0 -280px 1.5em 280px;}
.push-8 {margin:0 -320px 1.5em 320px;}
.push-9 {margin:0 -360px 1.5em 360px;}
.push-10 {margin:0 -400px 1.5em 400px;}
.push-11 {margin:0 -440px 1.5em 440px;}
.push-12 {margin:0 -480px 1.5em 480px;}
.push-13 {margin:0 -520px 1.5em 520px;}
.push-14 {margin:0 -560px 1.5em 560px;}
.push-15 {margin:0 -600px 1.5em 600px;}
.push-16 {margin:0 -640px 1.5em 640px;}
.push-17 {margin:0 -680px 1.5em 680px;}
.push-18 {margin:0 -720px 1.5em 720px;}
.push-19 {margin:0 -760px 1.5em 760px;}
.push-20 {margin:0 -800px 1.5em 800px;}
.push-21 {margin:0 -840px 1.5em 840px;}
.push-22 {margin:0 -880px 1.5em 880px;}
.push-23 {margin:0 -920px 1.5em 920px;}
.push-24 {margin:0 -960px 1.5em 960px;}
.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:right;position:relative;}
.prepend-top {margin-top:1.5em;}
.append-bottom {margin-bottom:1.5em;}
.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
hr.space {background:#fff;color:#fff;visibility:hidden;}
.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
.clearfix, .container {display:block;}
.clear {clear:both;}

15
demos/blog/index-test.php

@ -0,0 +1,15 @@
<?php
/**
* This is the bootstrap file for test application.
* This file should be removed when the application is deployed for production.
*/
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/test.php';
// remove the following line when in production mode
// defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
Yii::createWebApplication($config)->run();

11
demos/blog/index.php

@ -0,0 +1,11 @@
<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following line when in production mode
// defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
Yii::createWebApplication($config)->run();

1
demos/blog/protected/.htaccess

@ -0,0 +1 @@
deny from all

23
demos/blog/protected/components/Controller.php

@ -0,0 +1,23 @@
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class Controller extends CController
{
/**
* @var string the default layout for the controller view. Defaults to 'column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
*/
public $layout='column1';
/**
* @var array context menu items. This property will be assigned to {@link CMenu::items}.
*/
public $menu=array();
/**
* @var array the breadcrumbs of the current page. The value of this property will
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
* for more details on how to specify this property.
*/
public $breadcrumbs=array();
}

19
demos/blog/protected/components/RecentComments.php

@ -0,0 +1,19 @@
<?php
Yii::import('zii.widgets.CPortlet');
class RecentComments extends CPortlet
{
public $title='Recent Comments';
public $maxComments=10;
public function getRecentComments()
{
return Comment::model()->findRecentComments($this->maxComments);
}
protected function renderContent()
{
$this->render('recentComments');
}
}

23
demos/blog/protected/components/TagCloud.php

@ -0,0 +1,23 @@
<?php
Yii::import('zii.widgets.CPortlet');
class TagCloud extends CPortlet
{
public $title='Tags';
public $maxTags=20;
protected function renderContent()
{
$tags=Tag::model()->findTagWeights($this->maxTags);
foreach($tags as $tag=>$weight)
{
$link=CHtml::link(CHtml::encode($tag), array('post/index','tag'=>$tag));
echo CHtml::tag('span', array(
'class'=>'tag',
'style'=>"font-size:{$weight}pt",
), $link)."\n";
}
}
}

39
demos/blog/protected/components/UserIdentity.php

@ -0,0 +1,39 @@
<?php
/**
* UserIdentity represents the data needed to identity a user.
* It contains the authentication method that checks if the provided
* data can identity the user.
*/
class UserIdentity extends CUserIdentity
{
private $_id;
/**
* Authenticates a user.
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
$user=User::model()->find('LOWER(username)=?',array(strtolower($this->username)));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if(!$user->validatePassword($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id=$user->id;
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
return $this->errorCode==self::ERROR_NONE;
}
/**
* @return integer the ID of the user record
*/
public function getId()
{
return $this->_id;
}
}

17
demos/blog/protected/components/UserMenu.php

@ -0,0 +1,17 @@
<?php
Yii::import('zii.widgets.CPortlet');
class UserMenu extends CPortlet
{
public function init()
{
$this->title=CHtml::encode(Yii::app()->user->name);
parent::init();
}
protected function renderContent()
{
$this->render('userMenu');
}
}

7
demos/blog/protected/components/views/recentComments.php

@ -0,0 +1,7 @@
<ul>
<?php foreach($this->getRecentComments() as $comment): ?>
<li><?php echo $comment->authorLink; ?> on
<?php echo CHtml::link(CHtml::encode($comment->post->title), $comment->getUrl()); ?>
</li>
<?php endforeach; ?>
</ul>

6
demos/blog/protected/components/views/userMenu.php

@ -0,0 +1,6 @@
<ul>
<li><?php echo CHtml::link('Create New Post',array('post/create')); ?></li>
<li><?php echo CHtml::link('Manage Posts',array('post/admin')); ?></li>
<li><?php echo CHtml::link('Approve Comments',array('comment/index')) . ' (' . Comment::model()->pendingCommentCount . ')'; ?></li>
<li><?php echo CHtml::link('Logout',array('site/logout')); ?></li>
</ul>

8
demos/blog/protected/config/console.php

@ -0,0 +1,8 @@
<?php
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Console Application',
);

76
demos/blog/protected/config/main.php

@ -0,0 +1,76 @@
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Yii Blog Demo',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
'defaultController'=>'post',