Skip to content
This repository
Browse code

Merge branch 'master' of https://github.com/yiisoft/yii

* 'master' of https://github.com/yiisoft/yii: (27 commits)
  CHtml::cssFile() url fix
  Replaced CModel with actual model name
  Rollback CHANGELOG
  A little refactoring
  CHANGELOG
  CHtml::cssFile() fix
  Completed phpdoc comments for the controller template
  Document the 'submit' options in CHtml::clientChange() even better.
  Document the 'submit' and 'csrf' options in CHtml::clientChange() even better.
  Performance optimization
  CHANGELOG fix
  Coding style fix
  Coding style fix
  CHANGELOG fix
  Fixed can sorting cutted array with CArrayDataProvider
  Code style fix
  Document the 'submit' option in CHtml::clientChange() better.
  form.css success label fix
  doc fix
  else if => elseif
  ...
  • Loading branch information...
commit 7cc307d22f735eb83a5ddc696a5930aa56a1abac 2 parents cca7eca + a48a1cc
Carsten Brandt authored October 07, 2012

Showing 147 changed files with 442 additions and 409 deletions. Show diff stats Hide diff stats

  1. 2  CHANGELOG
  2. 12  framework/YiiBase.php
  3. 2  framework/base/CApplication.php
  4. 28  framework/base/CComponent.php
  5. 14  framework/base/CErrorHandler.php
  6. 2  framework/base/CModel.php
  7. 4  framework/base/CModule.php
  8. 4  framework/base/CStatePersister.php
  9. 4  framework/caching/CDbCache.php
  10. 4  framework/caching/CFileCache.php
  11. 2  framework/cli/commands/MigrateCommand.php
  12. 6  framework/cli/commands/shell/CrudCommand.php
  13. 8  framework/cli/commands/shell/ModelCommand.php
  14. 4  framework/cli/views/webapp/css/form.css
  15. 2  framework/cli/views/webapp/protected/components/UserIdentity.php
  16. 8  framework/collections/CList.php
  17. 6  framework/collections/CMap.php
  18. 2  framework/collections/CQueue.php
  19. 2  framework/collections/CStack.php
  20. 12  framework/console/CConsoleCommand.php
  21. 2  framework/console/CConsoleCommandRunner.php
  22. 12  framework/db/CDbCommand.php
  23. 2  framework/db/CDbConnection.php
  24. 32  framework/db/ar/CActiveFinder.php
  25. 56  framework/db/ar/CActiveRecord.php
  26. 4  framework/db/schema/CDbColumnSchema.php
  27. 10  framework/db/schema/CDbCommandBuilder.php
  28. 24  framework/db/schema/CDbCriteria.php
  29. 2  framework/db/schema/CDbSchema.php
  30. 4  framework/db/schema/mssql/CMssqlColumnSchema.php
  31. 8  framework/db/schema/mssql/CMssqlCommandBuilder.php
  32. 6  framework/db/schema/mysql/CMysqlColumnSchema.php
  33. 2  framework/db/schema/mysql/CMysqlSchema.php
  34. 2  framework/db/schema/oci/COciSchema.php
  35. 14  framework/db/schema/pgsql/CPgsqlColumnSchema.php
  36. 6  framework/db/schema/pgsql/CPgsqlSchema.php
  37. 2  framework/db/schema/sqlite/CSqliteSchema.php
  38. 2  framework/gii/CCodeFile.php
  39. 2  framework/gii/CCodeGenerator.php
  40. 6  framework/gii/CCodeModel.php
  41. 2  framework/gii/components/UserIdentity.php
  42. 8  framework/gii/generators/crud/CrudCode.php
  43. 6  framework/gii/generators/crud/templates/default/controller.php
  44. 2  framework/gii/generators/form/FormCode.php
  45. 10  framework/gii/generators/model/ModelCode.php
  46. 2  framework/gii/generators/module/ModuleCode.php
  47. 2  framework/gii/views/common/code.php
  48. 2  framework/i18n/CChoiceFormat.php
  49. 22  framework/i18n/CDateFormatter.php
  50. 6  framework/i18n/CLocale.php
  51. 2  framework/i18n/CMessageSource.php
  52. 4  framework/i18n/CNumberFormatter.php
  53. 2  framework/i18n/gettext/CGettextMoFile.php
  54. 2  framework/logging/CDbLogRoute.php
  55. 26  framework/logging/CLogger.php
  56. 6  framework/logging/CProfileLogRoute.php
  57. 2  framework/logging/CWebLogRoute.php
  58. 2  framework/test/CDbFixtureManager.php
  59. 2  framework/utils/CDateTimeParser.php
  60. 8  framework/utils/CFileHelper.php
  61. 1  framework/utils/CFormatter.php
  62. 6  framework/utils/CTimestamp.php
  63. 4  framework/utils/CVarDumper.php
  64. 12  framework/validators/CFileValidator.php
  65. 2  framework/validators/CRangeValidator.php
  66. 2  framework/validators/CRequiredValidator.php
  67. 10  framework/validators/CTypeValidator.php
  68. 2  framework/views/ar/exception.php
  69. 2  framework/views/ar/log-firebug.php
  70. 2  framework/views/bg/log-firebug.php
  71. 2  framework/views/de/log-firebug.php
  72. 2  framework/views/el/log-firebug.php
  73. 2  framework/views/es/log-firebug.php
  74. 2  framework/views/exception.php
  75. 2  framework/views/fr/log-firebug.php
  76. 2  framework/views/he/log-firebug.php
  77. 2  framework/views/hr/log-firebug.php
  78. 2  framework/views/id/log-firebug.php
  79. 2  framework/views/it/log-firebug.php
  80. 2  framework/views/ja/log-firebug.php
  81. 2  framework/views/ko/exception.php
  82. 2  framework/views/ko/log-firebug.php
  83. 2  framework/views/log-firebug.php
  84. 2  framework/views/lt/exception.php
  85. 2  framework/views/lt/log-firebug.php
  86. 2  framework/views/lv/log-firebug.php
  87. 4  framework/views/nl/log-firebug.php
  88. 2  framework/views/no/log-firebug.php
  89. 2  framework/views/pl/log-firebug.php
  90. 2  framework/views/pt/log-firebug.php
  91. 2  framework/views/pt_br/log-firebug.php
  92. 2  framework/views/ro/log-firebug.php
  93. 2  framework/views/ru/log-firebug.php
  94. 2  framework/views/sk/log-firebug.php
  95. 2  framework/views/sv/exception.php
  96. 2  framework/views/sv/log-firebug.php
  97. 2  framework/views/uk/exception.php
  98. 2  framework/views/uk/log-firebug.php
  99. 2  framework/views/vi/log-firebug.php
  100. 2  framework/views/zh_cn/log-firebug.php
  101. 2  framework/views/zh_tw/log-firebug.php
  102. 2  framework/web/CActiveDataProvider.php
  103. 12  framework/web/CArrayDataProvider.php
  104. 8  framework/web/CAssetManager.php
  105. 6  framework/web/CClientScript.php
  106. 12  framework/web/CController.php
  107. 4  framework/web/CDbHttpSession.php
  108. 16  framework/web/CHttpRequest.php
  109. 6  framework/web/CHttpSession.php
  110. 12  framework/web/CSort.php
  111. 2  framework/web/CTheme.php
  112. 2  framework/web/CUploadedFile.php
  113. 8  framework/web/CUrlManager.php
  114. 4  framework/web/actions/CAction.php
  115. 10  framework/web/auth/CAccessControlFilter.php
  116. 8  framework/web/auth/CDbAuthManager.php
  117. 4  framework/web/auth/CPhpAuthManager.php
  118. 2  framework/web/auth/CWebUser.php
  119. 2  framework/web/filters/CFilterChain.php
  120. 10  framework/web/filters/CHttpCacheFilter.php
  121. 4  framework/web/form/CForm.php
  122. 2  framework/web/form/CFormButtonElement.php
  123. 2  framework/web/form/CFormElement.php
  124. 4  framework/web/form/CFormElementCollection.php
  125. 52  framework/web/helpers/CHtml.php
  126. 16  framework/web/helpers/CJavaScript.php
  127. 14  framework/web/renderers/CPradoViewRenderer.php
  128. 2  framework/web/services/CWebService.php
  129. 6  framework/web/services/CWsdlGenerator.php
  130. 4  framework/web/widgets/CInputWidget.php
  131. 8  framework/web/widgets/COutputCache.php
  132. 2  framework/web/widgets/CTabView.php
  133. 2  framework/web/widgets/CTreeView.php
  134. 6  framework/web/widgets/CWidget.php
  135. 2  framework/web/widgets/views/flexWidget.php
  136. 2  framework/zii/behaviors/CTimestampBehavior.php
  137. 2  framework/zii/widgets/CBaseListView.php
  138. 2  framework/zii/widgets/CBreadcrumbs.php
  139. 6  framework/zii/widgets/CDetailView.php
  140. 2  framework/zii/widgets/CMenu.php
  141. 2  framework/zii/widgets/grid/CButtonColumn.php
  142. 4  framework/zii/widgets/grid/CCheckBoxColumn.php
  143. 8  framework/zii/widgets/grid/CDataColumn.php
  144. 6  framework/zii/widgets/grid/CGridView.php
  145. 4  framework/zii/widgets/jui/CJuiInputWidget.php
  146. 2  framework/zii/widgets/jui/CJuiProgressBar.php
  147. 4  framework/zii/widgets/jui/CJuiWidget.php
2  CHANGELOG
@@ -48,6 +48,8 @@ Version 1.1.13 work in progress
48 48
 - Enh #1396: Added 'text/csv' mime-type for the 'csv' file extension in utils/mimeTypes.php (effectively used by e.g. CHttpRequest::sendFile()) (rawtaz)
49 49
 - Enh #1426: Behaviors are now affecting memory consumption significantly less (slavcodev, creocoder, Qiang, samdark)
50 50
 - Enh #1443: Added CHttpRequest::getRawBody() that allows reading RAW HTTP request body multiple times (itamar82, resurtm, samdark)
  51
+- Enh #1518: Allow to configure CHtml::$closeSingleTags and CHtml::$renderSpecialAttributesValue. Useful for HTML5 code (creocoder)
  52
+- Enh #1531: CArrayDataProvider is now able to sort cutted array, where sorting column is not available in every entry (Yiivgeny)
51 53
 - Enh: Fixed the check for ajaxUpdate false value in jquery.yiilistview.js as that never happens (mdomba)
52 54
 - Enh: Requirements checker: added check for Oracle database (pdo_oci extension) and MSSQL (pdo_dblib, pdo_sqlsrv and pdo_mssql extensions) (resurtm)
53 55
 - Enh: Added CChainedLogFilter class to allow adding multiple filters to a logroute (cebe)
12  framework/YiiBase.php
@@ -184,7 +184,7 @@ public static function createComponent($config)
184 184
 			$type=$config;
185 185
 			$config=array();
186 186
 		}
187  
-		else if(isset($config['class']))
  187
+		elseif(isset($config['class']))
188 188
 		{
189 189
 			$type=$config['class'];
190 190
 			unset($config['class']);
@@ -200,9 +200,9 @@ public static function createComponent($config)
200 200
 			$args=func_get_args();
201 201
 			if($n===2)
202 202
 				$object=new $type($args[1]);
203  
-			else if($n===3)
  203
+			elseif($n===3)
204 204
 				$object=new $type($args[1],$args[2]);
205  
-			else if($n===4)
  205
+			elseif($n===4)
206 206
 				$object=new $type($args[1],$args[2],$args[3]);
207 207
 			else
208 208
 			{
@@ -353,12 +353,12 @@ public static function getPathOfAlias($alias)
353 353
 	{
354 354
 		if(isset(self::$_aliases[$alias]))
355 355
 			return self::$_aliases[$alias];
356  
-		else if(($pos=strpos($alias,'.'))!==false)
  356
+		elseif(($pos=strpos($alias,'.'))!==false)
357 357
 		{
358 358
 			$rootAlias=substr($alias,0,$pos);
359 359
 			if(isset(self::$_aliases[$rootAlias]))
360 360
 				return self::$_aliases[$alias]=rtrim(self::$_aliases[$rootAlias].DIRECTORY_SEPARATOR.str_replace('.',DIRECTORY_SEPARATOR,substr($alias,$pos+1)),'*'.DIRECTORY_SEPARATOR);
361  
-			else if(self::$_app instanceof CWebApplication)
  361
+			elseif(self::$_app instanceof CWebApplication)
362 362
 			{
363 363
 				if(self::$_app->findModule($rootAlias)!==null)
364 364
 					return self::getPathOfAlias($alias);
@@ -393,7 +393,7 @@ public static function autoload($className)
393 393
 		// use include so that the error PHP file may appear
394 394
 		if(isset(self::$classMap[$className]))
395 395
 			include(self::$classMap[$className]);
396  
-		else if(isset(self::$_coreClasses[$className]))
  396
+		elseif(isset(self::$_coreClasses[$className]))
397 397
 			include(YII_PATH.self::$_coreClasses[$className]);
398 398
 		else
399 399
 		{
2  framework/base/CApplication.php
@@ -626,7 +626,7 @@ public function setGlobalState($key,$value,$defaultValue=null)
626 626
 				$this->_stateChanged=true;
627 627
 			}
628 628
 		}
629  
-		else if(!isset($this->_globalState[$key]) || $this->_globalState[$key]!==$value)
  629
+		elseif(!isset($this->_globalState[$key]) || $this->_globalState[$key]!==$value)
630 630
 		{
631 631
 			$this->_globalState[$key]=$value;
632 632
 			$this->_stateChanged=true;
28  framework/base/CComponent.php
@@ -109,7 +109,7 @@ public function __get($name)
109 109
 		$getter='get'.$name;
110 110
 		if(method_exists($this,$getter))
111 111
 			return $this->$getter();
112  
-		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
  112
+		elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
113 113
 		{
114 114
 			// duplicating getEventHandlers() here for performance
115 115
 			$name=strtolower($name);
@@ -117,9 +117,9 @@ public function __get($name)
117 117
 				$this->_e[$name]=new CList;
118 118
 			return $this->_e[$name];
119 119
 		}
120  
-		else if(isset($this->_m[$name]))
  120
+		elseif(isset($this->_m[$name]))
121 121
 			return $this->_m[$name];
122  
-		else if(is_array($this->_m))
  122
+		elseif(is_array($this->_m))
123 123
 		{
124 124
 			foreach($this->_m as $object)
125 125
 			{
@@ -150,7 +150,7 @@ public function __set($name,$value)
150 150
 		$setter='set'.$name;
151 151
 		if(method_exists($this,$setter))
152 152
 			return $this->$setter($value);
153  
-		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
  153
+		elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
154 154
 		{
155 155
 			// duplicating getEventHandlers() here for performance
156 156
 			$name=strtolower($name);
@@ -158,7 +158,7 @@ public function __set($name,$value)
158 158
 				$this->_e[$name]=new CList;
159 159
 			return $this->_e[$name]->add($value);
160 160
 		}
161  
-		else if(is_array($this->_m))
  161
+		elseif(is_array($this->_m))
162 162
 		{
163 163
 			foreach($this->_m as $object)
164 164
 			{
@@ -186,12 +186,12 @@ public function __isset($name)
186 186
 		$getter='get'.$name;
187 187
 		if(method_exists($this,$getter))
188 188
 			return $this->$getter()!==null;
189  
-		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
  189
+		elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
190 190
 		{
191 191
 			$name=strtolower($name);
192 192
 			return isset($this->_e[$name]) && $this->_e[$name]->getCount();
193 193
 		}
194  
-		else if(is_array($this->_m))
  194
+		elseif(is_array($this->_m))
195 195
 		{
196 196
  			if(isset($this->_m[$name]))
197 197
  				return true;
@@ -217,9 +217,9 @@ public function __unset($name)
217 217
 		$setter='set'.$name;
218 218
 		if(method_exists($this,$setter))
219 219
 			$this->$setter(null);
220  
-		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
  220
+		elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
221 221
 			unset($this->_e[strtolower($name)]);
222  
-		else if(is_array($this->_m))
  222
+		elseif(is_array($this->_m))
223 223
 		{
224 224
 			if(isset($this->_m[$name]))
225 225
 				$this->detachBehavior($name);
@@ -231,13 +231,13 @@ public function __unset($name)
231 231
 					{
232 232
 						if(property_exists($object,$name))
233 233
 							return $object->$name=null;
234  
-						else if($object->canSetProperty($name))
  234
+						elseif($object->canSetProperty($name))
235 235
 							return $object->$setter(null);
236 236
 					}
237 237
 				}
238 238
 			}
239 239
 		}
240  
-		else if(method_exists($this,'get'.$name))
  240
+		elseif(method_exists($this,'get'.$name))
241 241
 			throw new CException(Yii::t('yii','Property "{class}.{property}" is read only.',
242 242
 				array('{class}'=>get_class($this), '{property}'=>$name)));
243 243
 	}
@@ -546,7 +546,7 @@ public function raiseEvent($name,$event)
546 546
 			{
547 547
 				if(is_string($handler))
548 548
 					call_user_func($handler,$event);
549  
-				else if(is_callable($handler,true))
  549
+				elseif(is_callable($handler,true))
550 550
 				{
551 551
 					if(is_array($handler))
552 552
 					{
@@ -554,7 +554,7 @@ public function raiseEvent($name,$event)
554 554
 						list($object,$method)=$handler;
555 555
 						if(is_string($object))	// static method call
556 556
 							call_user_func($handler,$event);
557  
-						else if(method_exists($object,$method))
  557
+						elseif(method_exists($object,$method))
558 558
 							$object->$method($event);
559 559
 						else
560 560
 							throw new CException(Yii::t('yii','Event "{class}.{event}" is attached with an invalid handler "{handler}".',
@@ -571,7 +571,7 @@ public function raiseEvent($name,$event)
571 571
 					return;
572 572
 			}
573 573
 		}
574  
-		else if(YII_DEBUG && !$this->hasEvent($name))
  574
+		elseif(YII_DEBUG && !$this->hasEvent($name))
575 575
 			throw new CException(Yii::t('yii','Event "{class}.{event}" is not defined.',
576 576
 				array('{class}'=>get_class($this), '{event}'=>$name)));
577 577
 	}
14  framework/base/CErrorHandler.php
@@ -283,7 +283,7 @@ protected function handleError($event)
283 283
 				header("HTTP/1.0 500 Internal Server Error");
284 284
 			if($this->isAjaxRequest())
285 285
 				$app->displayError($event->code,$event->message,$event->file,$event->line);
286  
-			else if(YII_DEBUG)
  286
+			elseif(YII_DEBUG)
287 287
 				$this->render('exception',$data);
288 288
 			else
289 289
 				$this->render('error',$data);
@@ -430,27 +430,27 @@ protected function argumentsToString($args)
430 430
 
431 431
 			if(is_object($value))
432 432
 				$args[$key] = get_class($value);
433  
-			else if(is_bool($value))
  433
+			elseif(is_bool($value))
434 434
 				$args[$key] = $value ? 'true' : 'false';
435  
-			else if(is_string($value))
  435
+			elseif(is_string($value))
436 436
 			{
437 437
 				if(strlen($value)>64)
438 438
 					$args[$key] = '"'.substr($value,0,64).'..."';
439 439
 				else
440 440
 					$args[$key] = '"'.$value.'"';
441 441
 			}
442  
-			else if(is_array($value))
  442
+			elseif(is_array($value))
443 443
 				$args[$key] = 'array('.$this->argumentsToString($value).')';
444  
-			else if($value===null)
  444
+			elseif($value===null)
445 445
 				$args[$key] = 'null';
446  
-			else if(is_resource($value))
  446
+			elseif(is_resource($value))
447 447
 				$args[$key] = 'resource';
448 448
 
449 449
 			if(is_string($key))
450 450
 			{
451 451
 				$args[$key] = '"'.$key.'" => '.$args[$key];
452 452
 			}
453  
-			else if($isAssoc)
  453
+			elseif($isAssoc)
454 454
 			{
455 455
 				$args[$key] = $key.' => '.$args[$key];
456 456
 			}
2  framework/base/CModel.php
@@ -469,7 +469,7 @@ public function setAttributes($values,$safeOnly=true)
469 469
 		{
470 470
 			if(isset($attributes[$name]))
471 471
 				$this->$name=$value;
472  
-			else if($safeOnly)
  472
+			elseif($safeOnly)
473 473
 				$this->onUnsafeAttribute($name,$value);
474 474
 		}
475 475
 	}
4  framework/base/CModule.php
@@ -270,7 +270,7 @@ public function getModule($id)
270 270
 	{
271 271
 		if(isset($this->_modules[$id]) || array_key_exists($id,$this->_modules))
272 272
 			return $this->_modules[$id];
273  
-		else if(isset($this->_moduleConfig[$id]))
  273
+		elseif(isset($this->_moduleConfig[$id]))
274 274
 		{
275 275
 			$config=$this->_moduleConfig[$id];
276 276
 			if(!isset($config['enabled']) || $config['enabled'])
@@ -376,7 +376,7 @@ public function getComponent($id,$createIfNull=true)
376 376
 	{
377 377
 		if(isset($this->_components[$id]))
378 378
 			return $this->_components[$id];
379  
-		else if(isset($this->_componentConfig[$id]) && $createIfNull)
  379
+		elseif(isset($this->_componentConfig[$id]) && $createIfNull)
380 380
 		{
381 381
 			$config=$this->_componentConfig[$id];
382 382
 			if(!isset($config['enabled']) || $config['enabled'])
4  framework/base/CStatePersister.php
@@ -82,7 +82,7 @@ public function load()
82 82
 			$cacheKey='Yii.CStatePersister.'.$stateFile;
83 83
 			if(($value=$cache->get($cacheKey))!==false)
84 84
 				return unserialize($value);
85  
-			else if(($content=@file_get_contents($stateFile))!==false)
  85
+			elseif(($content=@file_get_contents($stateFile))!==false)
86 86
 			{
87 87
 				$cache->set($cacheKey,$content,0,new CFileCacheDependency($stateFile));
88 88
 				return unserialize($content);
@@ -90,7 +90,7 @@ public function load()
90 90
 			else
91 91
 				return null;
92 92
 		}
93  
-		else if(($content=@file_get_contents($stateFile))!==false)
  93
+		elseif(($content=@file_get_contents($stateFile))!==false)
94 94
 			return unserialize($content);
95 95
 		else
96 96
 			return null;
4  framework/caching/CDbCache.php
@@ -124,7 +124,7 @@ protected function createCacheTable($db,$tableName)
124 124
 		$driver=$db->getDriverName();
125 125
 		if($driver==='mysql')
126 126
 			$blob='LONGBLOB';
127  
-		else if($driver==='pgsql')
  127
+		elseif($driver==='pgsql')
128 128
 			$blob='BYTEA';
129 129
 		else
130 130
 			$blob='BLOB';
@@ -147,7 +147,7 @@ public function getDbConnection()
147 147
 	{
148 148
 		if($this->_db!==null)
149 149
 			return $this->_db;
150  
-		else if(($id=$this->connectionID)!==null)
  150
+		elseif(($id=$this->connectionID)!==null)
151 151
 		{
152 152
 			if(($this->_db=Yii::app()->getComponent($id)) instanceof CDbConnection)
153 153
 				return $this->_db;
4  framework/caching/CFileCache.php
@@ -105,7 +105,7 @@ protected function getValue($key)
105 105
 		$cacheFile=$this->getCacheFile($key);
106 106
 		if(($time=@filemtime($cacheFile))>time())
107 107
 			return @file_get_contents($cacheFile);
108  
-		else if($time>0)
  108
+		elseif($time>0)
109 109
 			@unlink($cacheFile);
110 110
 		return false;
111 111
 	}
@@ -212,7 +212,7 @@ public function gc($expiredOnly=true,$path=null)
212 212
 			$fullPath=$path.DIRECTORY_SEPARATOR.$file;
213 213
 			if(is_dir($fullPath))
214 214
 				$this->gc($expiredOnly,$fullPath);
215  
-			else if($expiredOnly && @filemtime($fullPath)<time() || !$expiredOnly)
  215
+			elseif($expiredOnly && @filemtime($fullPath)<time() || !$expiredOnly)
216 216
 				@unlink($fullPath);
217 217
 		}
218 218
 		closedir($handle);
2  framework/cli/commands/MigrateCommand.php
@@ -439,7 +439,7 @@ protected function getDbConnection()
439 439
 	{
440 440
 		if($this->_db!==null)
441 441
 			return $this->_db;
442  
-		else if(($this->_db=Yii::app()->getComponent($this->connectionID)) instanceof CDbConnection)
  442
+		elseif(($this->_db=Yii::app()->getComponent($this->connectionID)) instanceof CDbConnection)
443 443
 			return $this->_db;
444 444
 
445 445
 		echo "Error: CMigrationCommand.connectionID '{$this->connectionID}' is invalid. Please make sure it refers to the ID of a CDbConnection application component.\n";
6  framework/cli/commands/shell/CrudCommand.php
@@ -196,7 +196,7 @@ public function generateController($source,$params)
196 196
 		$id=$model->tableSchema->primaryKey;
197 197
 		if($id===null)
198 198
 			throw new ShellException(Yii::t('yii','Error: Table "{table}" does not have a primary key.',array('{table}'=>$model->tableName())));
199  
-		else if(is_array($id))
  199
+		elseif(is_array($id))
200 200
 			throw new ShellException(Yii::t('yii','Error: Table "{table}" has a composite primary key which is not supported by crud command.',array('{table}'=>$model->tableName())));
201 201
 
202 202
 		if(!is_file($source))  // fall back to default ones
@@ -243,7 +243,7 @@ public function generateInputField($modelClass,$column)
243 243
 	{
244 244
 		if($column->type==='boolean')
245 245
 			return "CHtml::activeCheckBox(\$model,'{$column->name}')";
246  
-		else if(stripos($column->dbType,'text')!==false)
  246
+		elseif(stripos($column->dbType,'text')!==false)
247 247
 			return "CHtml::activeTextArea(\$model,'{$column->name}',array('rows'=>6, 'cols'=>50))";
248 248
 		else
249 249
 		{
@@ -272,7 +272,7 @@ public function generateActiveField($modelClass,$column)
272 272
 	{
273 273
 		if($column->type==='boolean')
274 274
 			return "\$form->checkBox(\$model,'{$column->name}')";
275  
-		else if(stripos($column->dbType,'text')!==false)
  275
+		elseif(stripos($column->dbType,'text')!==false)
276 276
 			return "\$form->textArea(\$model,'{$column->name}',array('rows'=>6, 'cols'=>50))";
277 277
 		else
278 278
 		{
8  framework/cli/commands/shell/ModelCommand.php
@@ -205,7 +205,7 @@ protected function generateClassNames($schema,$pattern=null)
205 205
 		{
206 206
 			if($pattern===null)
207 207
 				$this->_tables[$name]=$this->generateClassName($this->removePrefix($name));
208  
-			else if(preg_match($pattern,$name,$matches))
  208
+			elseif(preg_match($pattern,$name,$matches))
209 209
 			{
210 210
 				if(count($matches)>1 && !empty($matches[1]))
211 211
 					$className=$this->generateClassName($matches[1]);
@@ -406,11 +406,11 @@ public function generateModel($source,$params)
406 406
 					$required[]=$column->name;
407 407
 				if($column->type==='integer')
408 408
 					$integers[]=$column->name;
409  
-				else if($column->type==='double')
  409
+				elseif($column->type==='double')
410 410
 					$numerical[]=$column->name;
411  
-				else if($column->type==='string' && $column->size>0)
  411
+				elseif($column->type==='string' && $column->size>0)
412 412
 					$length[$column->size][]=$column->name;
413  
-				else if(!$column->isPrimaryKey && !$r)
  413
+				elseif(!$column->isPrimaryKey && !$r)
414 414
 					$safe[]=$column->name;
415 415
 			}
416 416
 			if($required!==array())
4  framework/cli/views/webapp/css/form.css
@@ -111,6 +111,10 @@ div.form select.success
111 111
 	border-color: #C6D880;
112 112
 }
113 113
 
  114
+div.form div.success label
  115
+{
  116
+	color: inherit;
  117
+}
114 118
 
115 119
 div.form .errorSummary
116 120
 {
2  framework/cli/views/webapp/protected/components/UserIdentity.php
@@ -24,7 +24,7 @@ public function authenticate()
24 24
 		);
25 25
 		if(!isset($users[$this->username]))
26 26
 			$this->errorCode=self::ERROR_USERNAME_INVALID;
27  
-		else if($users[$this->username]!==$this->password)
  27
+		elseif($users[$this->username]!==$this->password)
28 28
 			$this->errorCode=self::ERROR_PASSWORD_INVALID;
29 29
 		else
30 30
 			$this->errorCode=self::ERROR_NONE;
8  framework/collections/CList.php
@@ -120,7 +120,7 @@ public function itemAt($index)
120 120
 	{
121 121
 		if(isset($this->_d[$index]))
122 122
 			return $this->_d[$index];
123  
-		else if($index>=0 && $index<$this->_c) // in case the value is null
  123
+		elseif($index>=0 && $index<$this->_c) // in case the value is null
124 124
 			return $this->_d[$index];
125 125
 		else
126 126
 			throw new CException(Yii::t('yii','List index "{index}" is out of bound.',
@@ -152,7 +152,7 @@ public function insertAt($index,$item)
152 152
 		{
153 153
 			if($index===$this->_c)
154 154
 				$this->_d[$this->_c++]=$item;
155  
-			else if($index>=0 && $index<$this->_c)
  155
+			elseif($index>=0 && $index<$this->_c)
156 156
 			{
157 157
 				array_splice($this->_d,$index,0,array($item));
158 158
 				$this->_c++;
@@ -269,7 +269,7 @@ public function copyFrom($data)
269 269
 			foreach($data as $item)
270 270
 				$this->add($item);
271 271
 		}
272  
-		else if($data!==null)
  272
+		elseif($data!==null)
273 273
 			throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
274 274
 	}
275 275
 
@@ -288,7 +288,7 @@ public function mergeWith($data)
288 288
 			foreach($data as $item)
289 289
 				$this->add($item);
290 290
 		}
291  
-		else if($data!==null)
  291
+		elseif($data!==null)
292 292
 			throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
293 293
 	}
294 294
 
6  framework/collections/CMap.php
@@ -214,7 +214,7 @@ public function copyFrom($data)
214 214
 			foreach($data as $key=>$value)
215 215
 				$this->add($key,$value);
216 216
 		}
217  
-		else if($data!==null)
  217
+		elseif($data!==null)
218 218
 			throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
219 219
 	}
220 220
 
@@ -259,7 +259,7 @@ public function mergeWith($data,$recursive=true)
259 259
 					$this->add($key,$value);
260 260
 			}
261 261
 		}
262  
-		else if($data!==null)
  262
+		elseif($data!==null)
263 263
 			throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
264 264
 	}
265 265
 
@@ -288,7 +288,7 @@ public static function mergeArray($a,$b)
288 288
 			{
289 289
 				if(is_integer($k))
290 290
 					isset($res[$k]) ? $res[]=$v : $res[$k]=$v;
291  
-				else if(is_array($v) && isset($res[$k]) && is_array($res[$k]))
  291
+				elseif(is_array($v) && isset($res[$k]) && is_array($res[$k]))
292 292
 					$res[$k]=self::mergeArray($res[$k],$v);
293 293
 				else
294 294
 					$res[$k]=$v;
2  framework/collections/CQueue.php
@@ -79,7 +79,7 @@ public function copyFrom($data)
79 79
 				++$this->_c;
80 80
 			}
81 81
 		}
82  
-		else if($data!==null)
  82
+		elseif($data!==null)
83 83
 			throw new CException(Yii::t('yii','Queue data must be an array or an object implementing Traversable.'));
84 84
 	}
85 85
 
2  framework/collections/CStack.php
@@ -79,7 +79,7 @@ public function copyFrom($data)
79 79
 				++$this->_c;
80 80
 			}
81 81
 		}
82  
-		else if($data!==null)
  82
+		elseif($data!==null)
83 83
 			throw new CException(Yii::t('yii','Stack data must be an array or an object implementing Traversable.'));
84 84
 	}
85 85
 
12  framework/console/CConsoleCommand.php
@@ -131,14 +131,14 @@ public function run($args)
131 131
 			{
132 132
 				if($param->isArray())
133 133
 					$params[]=is_array($options[$name]) ? $options[$name] : array($options[$name]);
134  
-				else if(!is_array($options[$name]))
  134
+				elseif(!is_array($options[$name]))
135 135
 					$params[]=$options[$name];
136 136
 				else
137 137
 					$this->usageError("Option --$name requires a scalar. Array is given.");
138 138
 			}
139  
-			else if($name==='args')
  139
+			elseif($name==='args')
140 140
 				$params[]=$args;
141  
-			else if($param->isDefaultValueAvailable())
  141
+			elseif($param->isDefaultValueAvailable())
142 142
 				$params[]=$param->getDefaultValue();
143 143
 			else
144 144
 				$this->usageError("Missing required option --$name.");
@@ -237,7 +237,7 @@ protected function resolveRequest($args)
237 237
 				else
238 238
 					$options[$name]=$value;
239 239
 			}
240  
-			else if(isset($action))
  240
+			elseif(isset($action))
241 241
 				$params[]=$arg;
242 242
 			else
243 243
 				$action=$arg;
@@ -386,9 +386,9 @@ public function copyFiles($fileList)
386 386
 					$answer=trim(fgets(STDIN));
387 387
 					if(!strncasecmp($answer,'q',1))
388 388
 						return;
389  
-					else if(!strncasecmp($answer,'y',1))
  389
+					elseif(!strncasecmp($answer,'y',1))
390 390
 						echo "  overwrite $name\n";
391  
-					else if(!strncasecmp($answer,'a',1))
  391
+					elseif(!strncasecmp($answer,'a',1))
392 392
 					{
393 393
 						echo "  overwrite $name\n";
394 394
 						$overwriteAll=true;
2  framework/console/CConsoleCommandRunner.php
@@ -147,7 +147,7 @@ public function createCommand($name)
147 147
 			else // an array configuration
148 148
 				return Yii::createComponent($command,$name,$this);
149 149
 		}
150  
-		else if($name==='help')
  150
+		elseif($name==='help')
151 151
 			return new CHelpCommand('help',$this);
152 152
 		else
153 153
 			return null;
12  framework/db/CDbCommand.php
@@ -246,9 +246,9 @@ public function bindParam($name, &$value, $dataType=null, $length=null, $driverO
246 246
 		$this->prepare();
247 247
 		if($dataType===null)
248 248
 			$this->_statement->bindParam($name,$value,$this->_connection->getPdoType(gettype($value)));
249  
-		else if($length===null)
  249
+		elseif($length===null)
250 250
 			$this->_statement->bindParam($name,$value,$dataType);
251  
-		else if($driverOptions===null)
  251
+		elseif($driverOptions===null)
252 252
 			$this->_statement->bindParam($name,$value,$dataType,$length);
253 253
 		else
254 254
 			$this->_statement->bindParam($name,$value,$dataType,$length,$driverOptions);
@@ -599,7 +599,7 @@ public function select($columns='*', $option='')
599 599
 			{
600 600
 				if(is_object($column))
601 601
 					$columns[$i]=(string)$column;
602  
-				else if(strpos($column,'(')===false)
  602
+				elseif(strpos($column,'(')===false)
603 603
 				{
604 604
 					if(preg_match('/^(.*?)(?i:\s+as\s+|\s+)(.*)$/',$column,$matches))
605 605
 						$columns[$i]=$this->_connection->quoteColumnName($matches[1]).' AS '.$this->_connection->quoteColumnName($matches[2]);
@@ -964,7 +964,7 @@ public function group($columns)
964 964
 			{
965 965
 				if(is_object($column))
966 966
 					$columns[$i]=(string)$column;
967  
-				else if(strpos($column,'(')===false)
  967
+				elseif(strpos($column,'(')===false)
968 968
 					$columns[$i]=$this->_connection->quoteColumnName($column);
969 969
 			}
970 970
 			$this->_query['group']=implode(', ',$columns);
@@ -1051,7 +1051,7 @@ public function order($columns)
1051 1051
 			{
1052 1052
 				if(is_object($column))
1053 1053
 					$columns[$i]=(string)$column;
1054  
-				else if(strpos($column,'(')===false)
  1054
+				elseif(strpos($column,'(')===false)
1055 1055
 				{
1056 1056
 					if(preg_match('/^(.*?)\s+(asc|desc)$/i',$column,$matches))
1057 1057
 						$columns[$i]=$this->_connection->quoteColumnName($matches[1]).' '.strtoupper($matches[2]);
@@ -1459,7 +1459,7 @@ private function processConditions($conditions)
1459 1459
 	{
1460 1460
 		if(!is_array($conditions))
1461 1461
 			return $conditions;
1462  
-		else if($conditions===array())
  1462
+		elseif($conditions===array())
1463 1463
 			return '';
1464 1464
 		$n=count($conditions);
1465 1465
 		$operator=strtoupper($conditions[0]);
2  framework/db/CDbConnection.php
@@ -416,7 +416,7 @@ protected function createPdoInstance()
416 416
 			$driver=strtolower(substr($this->connectionString,0,$pos));
417 417
 			if($driver==='mssql' || $driver==='dblib')
418 418
 				$pdoClass='CMssqlPdoAdapter';
419  
-			else if($driver==='sqlsrv')
  419
+			elseif($driver==='sqlsrv')
420 420
 				$pdoClass='CMssqlSqlsrvPdoAdapter';
421 421
 		}
422 422
 		return new $pdoClass($this->connectionString,$this->username,
32  framework/db/ar/CActiveFinder.php
@@ -80,7 +80,7 @@ public function query($criteria,$all=false)
80 80
 				$result=$array;
81 81
 			}
82 82
 		}
83  
-		else if(count($this->_joinTree->records))
  83
+		elseif(count($this->_joinTree->records))
84 84
 			$result = reset($this->_joinTree->records);
85 85
 		else
86 86
 			$result = null;
@@ -219,7 +219,7 @@ private function buildJoinTree($parent,$with,$options=null)
219 219
 				$oldAlias=$model->getTableAlias(false,false);
220 220
 				if(isset($options['alias']))
221 221
 					$model->setTableAlias($options['alias']);
222  
-				else if($relation->alias===null)
  222
+				elseif($relation->alias===null)
223 223
 					$model->setTableAlias($relation->name);
224 224
 				else
225 225
 					$model->setTableAlias($relation->alias);
@@ -274,7 +274,7 @@ private function buildJoinTree($parent,$with,$options=null)
274 274
 		{
275 275
 			if(is_string($value))  // the value is a relation name
276 276
 				$this->buildJoinTree($parent,$value);
277  
-			else if(is_string($key) && is_array($value))
  277
+			elseif(is_string($key) && is_array($value))
278 278
 				$this->buildJoinTree($parent,$key,$value);
279 279
 		}
280 280
 	}
@@ -383,7 +383,7 @@ public function __construct($finder,$relation,$parent=null,$id=0)
383 383
 			$this->_columnAliases[$name]=$alias;
384 384
 			if($table->primaryKey===$name)
385 385
 				$this->_pkAlias=$alias;
386  
-			else if(is_array($table->primaryKey) && in_array($name,$table->primaryKey))
  386
+			elseif(is_array($table->primaryKey) && in_array($name,$table->primaryKey))
387 387
 				$this->_pkAlias[$name]=$alias;
388 388
 		}
389 389
 	}
@@ -416,7 +416,7 @@ public function find($criteria=null)
416 416
 			$this->_finder->baseLimited=false;
417 417
 			$this->runQuery($query);
418 418
 		}
419  
-		else if(!$this->_joined && !empty($this->_parent->records)) // not joined before
  419
+		elseif(!$this->_joined && !empty($this->_parent->records)) // not joined before
420 420
 		{
421 421
 			$query=new CJoinQuery($this->_parent);
422 422
 			$this->_joined=true;
@@ -546,7 +546,7 @@ private function applyLazyCondition($query,$record)
546 546
 						$params[':ypl'.$count]=$record->$pk;
547 547
 						$count++;
548 548
 					}
549  
-					else if(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
  549
+					elseif(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
550 550
 						$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
551 551
 					else
552 552
 					{
@@ -624,7 +624,7 @@ private function applyLazyCondition($query,$record)
624 624
 					{
625 625
 						if(isset($parent->_table->foreignKeys[$fk]))  // FK defined
626 626
 							$pk=$parent->_table->foreignKeys[$fk][1];
627  
-						else if(is_array($this->_table->primaryKey)) // composite PK
  627
+						elseif(is_array($this->_table->primaryKey)) // composite PK
628 628
 							$pk=$this->_table->primaryKey[$i];
629 629
 						else
630 630
 							$pk=$this->_table->primaryKey;
@@ -637,7 +637,7 @@ private function applyLazyCondition($query,$record)
637 637
 					{
638 638
 						if(isset($this->_table->foreignKeys[$fk]))  // FK defined
639 639
 							$pk=$this->_table->foreignKeys[$fk][1];
640  
-						else if(is_array($parent->_table->primaryKey)) // composite PK
  640
+						elseif(is_array($parent->_table->primaryKey)) // composite PK
641 641
 							$pk=$parent->_table->primaryKey[$i];
642 642
 						else
643 643
 							$pk=$parent->_table->primaryKey;
@@ -706,7 +706,7 @@ public function count($criteria=null)
706 706
 		$select=is_array($criteria->select) ? implode(',',$criteria->select) : $criteria->select;
707 707
 		if($select!=='*' && !strncasecmp($select,'count',5))
708 708
 			$query->selects=array($select);
709  
-		else if(is_string($this->_table->primaryKey))
  709
+		elseif(is_string($this->_table->primaryKey))
710 710
 		{
711 711
 			$prefix=$this->getColumnPrefix();
712 712
 			$schema=$this->_builder->getSchema();
@@ -745,7 +745,7 @@ public function buildQuery($query)
745 745
 		{
746 746
 			if($child->master!==null)
747 747
 				$child->_joined=true;
748  
-			else if($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
  748
+			elseif($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
749 749
 				|| $this->_finder->joinAll || $child->relation->together || (!$this->_finder->baseLimited && $child->relation->together===null))
750 750
 			{
751 751
 				$child->_joined=true;
@@ -907,7 +907,7 @@ public function getColumnSelect($select='*')
907 907
 					$columns[]=$prefix.$schema->quoteColumnName($key).' AS '.$schema->quoteColumnName($this->_columnAliases[$key]);
908 908
 					$selected[$this->_columnAliases[$key]]=1;
909 909
 				}
910  
-				else if(preg_match('/^(.*?)\s+AS\s+(\w+)$/im',$name,$matches)) // if the column is already aliased
  910
+				elseif(preg_match('/^(.*?)\s+AS\s+(\w+)$/im',$name,$matches)) // if the column is already aliased
911 911
 				{
912 912
 					$alias=$matches[2];
913 913
 					if(!isset($this->_columnAliases[$alias]) || $this->_columnAliases[$alias]!==$alias)
@@ -924,7 +924,7 @@ public function getColumnSelect($select='*')
924 924
 			// add primary key selection if they are not selected
925 925
 			if(is_string($this->_pkAlias) && !isset($selected[$this->_pkAlias]))
926 926
 				$columns[]=$prefix.$schema->quoteColumnName($this->_table->primaryKey).' AS '.$schema->quoteColumnName($this->_pkAlias);
927  
-			else if(is_array($this->_pkAlias))
  927
+			elseif(is_array($this->_pkAlias))
928 928
 			{
929 929
 				foreach($this->_table->primaryKey as $name)
930 930
 					if(!isset($selected[$name]))
@@ -945,7 +945,7 @@ public function getPrimaryKeySelect()
945 945
 		$columns=array();
946 946
 		if(is_string($this->_pkAlias))
947 947
 			$columns[]=$prefix.$schema->quoteColumnName($this->_table->primaryKey).' AS '.$schema->quoteColumnName($this->_pkAlias);
948  
-		else if(is_array($this->_pkAlias))
  948
+		elseif(is_array($this->_pkAlias))
949 949
 		{
950 950
 			foreach($this->_pkAlias as $name=>$alias)
951 951
 				$columns[]=$prefix.$schema->quoteColumnName($name).' AS '.$schema->quoteColumnName($alias);
@@ -1005,7 +1005,7 @@ public function getJoinCondition()
1005 1005
 				$pke=$this;
1006 1006
 				$fke=$parent;
1007 1007
 			}
1008  
-			else if($this->slave===null)
  1008
+			elseif($this->slave===null)
1009 1009
 			{
1010 1010
 				$pke=$parent;
1011 1011
 				$fke=$this;
@@ -1094,7 +1094,7 @@ private function joinManyMany($joinTable,$fks,$parent)
1094 1094
 				list($tableName,$pk)=$joinTable->foreignKeys[$fk];
1095 1095
 				if(!isset($parentCondition[$pk]) && $schema->compareTableNames($parent->_table->rawName,$tableName))
1096 1096
 					$parentCondition[$pk]=$parent->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
1097  
-				else if(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
  1097
+				elseif(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
1098 1098
 					$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
1099 1099
 				else
1100 1100
 				{
@@ -1491,7 +1491,7 @@ private function queryManyMany($joinTableName,$keys)
1491 1491
 				list($tableName,$pk)=$joinTable->foreignKeys[$fk];
1492 1492
 				if(!isset($joinCondition[$pk]) && $schema->compareTableNames($table->rawName,$tableName))
1493 1493
 					$joinCondition[$pk]=$tableAlias.'.'.$schema->quoteColumnName($pk).'='.$joinTable->rawName.'.'.$schema->quoteColumnName($fk);
1494  
-				else if(!isset($map[$pk]) && $schema->compareTableNames($pkTable->rawName,$tableName))
  1494
+				elseif(!isset($map[$pk]) && $schema->compareTableNames($pkTable->rawName,$tableName))
1495 1495
 					$map[$pk]=$fk;
1496 1496
 				else
1497 1497
 				{
56  framework/db/ar/CActiveRecord.php
@@ -133,11 +133,11 @@ public function __get($name)
133 133
 	{
134 134
 		if(isset($this->_attributes[$name]))
135 135
 			return $this->_attributes[$name];
136  
-		else if(isset($this->getMetaData()->columns[$name]))
  136
+		elseif(isset($this->getMetaData()->columns[$name]))
137 137
 			return null;
138  
-		else if(isset($this->_related[$name]))
  138
+		elseif(isset($this->_related[$name]))
139 139
 			return $this->_related[$name];
140  
-		else if(isset($this->getMetaData()->relations[$name]))
  140
+		elseif(isset($this->getMetaData()->relations[$name]))
141 141
 			return $this->getRelated($name);
142 142
 		else
143 143
 			return parent::__get($name);
@@ -171,11 +171,11 @@ public function __isset($name)
171 171
 	{
172 172
 		if(isset($this->_attributes[$name]))
173 173
 			return true;
174  
-		else if(isset($this->getMetaData()->columns[$name]))
  174
+		elseif(isset($this->getMetaData()->columns[$name]))
175 175
 			return false;
176  
-		else if(isset($this->_related[$name]))
  176
+		elseif(isset($this->_related[$name]))
177 177
 			return true;
178  
-		else if(isset($this->getMetaData()->relations[$name]))
  178
+		elseif(isset($this->getMetaData()->relations[$name]))
179 179
 			return $this->getRelated($name)!==null;
180 180
 		else
181 181
 			return parent::__isset($name);
@@ -191,7 +191,7 @@ public function __unset($name)
191 191
 	{
192 192
 		if(isset($this->getMetaData()->columns[$name]))
193 193
 			unset($this->_attributes[$name]);
194  
-		else if(isset($this->getMetaData()->relations[$name]))
  194
+		elseif(isset($this->getMetaData()->relations[$name]))
195 195
 			unset($this->_related[$name]);
196 196
 		else
197 197
 			parent::__unset($name);
@@ -275,7 +275,7 @@ public function getRelated($name,$refresh=false,$params=array())
275 275
 		{
276 276
 			if($relation instanceof CHasManyRelation)
277 277
 				$this->_related[$name]=array();
278  
-			else if($relation instanceof CStatRelation)
  278
+			elseif($relation instanceof CStatRelation)
279 279
 				$this->_related[$name]=$relation->defaultValue;
280 280
 			else
281 281
 				$this->_related[$name]=null;
@@ -589,7 +589,7 @@ public function getAttributeLabel($attribute)
589 589
 		$labels=$this->attributeLabels();
590 590
 		if(isset($labels[$attribute]))
591 591
 			return $labels[$attribute];
592  
-		else if(strpos($attribute,'.')!==false)
  592
+		elseif(strpos($attribute,'.')!==false)
593 593
 		{
594 594
 			$segs=explode('.',$attribute);
595 595
 			$name=array_pop($segs);
@@ -681,7 +681,7 @@ public function getAttribute($name)
681 681
 	{
682 682
 		if(property_exists($this,$name))
683 683
 			return $this->$name;
684  
-		else if(isset($this->_attributes[$name]))
  684
+		elseif(isset($this->_attributes[$name]))
685 685
 			return $this->_attributes[$name];
686 686
 	}
687 687
 
@@ -697,7 +697,7 @@ public function setAttribute($name,$value)
697 697
 	{
698 698
 		if(property_exists($this,$name))
699 699
 			$this->$name=$value;
700  
-		else if(isset($this->getMetaData()->columns[$name]))
  700
+		elseif(isset($this->getMetaData()->columns[$name]))
701 701
 			$this->_attributes[$name]=$value;
702 702
 		else
703 703
 			return false;
@@ -727,7 +727,7 @@ public function addRelatedRecord($name,$record,$index)
727 727
 					$this->_related[$name][$index]=$record;
728 728
 			}
729 729
 		}
730  
-		else if(!isset($this->_related[$name]))
  730
+		elseif(!isset($this->_related[$name]))
731 731
 			$this->_related[$name]=$record;
732 732
 	}
733 733
 
@@ -747,7 +747,7 @@ public function getAttributes($names=true)
747 747
 		{
748 748
 			if(property_exists($this,$name))
749 749
 				$attributes[$name]=$this->$name;
750  
-			else if($names===true && !isset($attributes[$name]))
  750
+			elseif($names===true && !isset($attributes[$name]))
751 751
 				$attributes[$name]=null;
752 752
 		}
753 753
 		if(is_array($names))
@@ -1027,7 +1027,7 @@ public function insert($attributes=null)
1027 1027
 				{
1028 1028
 					if(is_string($primaryKey) && $this->$primaryKey===null)
1029 1029
 						$this->$primaryKey=$builder->getLastInsertID($table);
1030  
-					else if(is_array($primaryKey))
  1030
+					elseif(is_array($primaryKey))
1031 1031
 					{
1032 1032
 						foreach($primaryKey as $pk)
1033 1033
 						{
@@ -1221,7 +1221,7 @@ public function getPrimaryKey()
1221 1221
 		$table=$this->getMetaData()->tableSchema;
1222 1222
 		if(is_string($table->primaryKey))
1223 1223
 			return $this->{$table->primaryKey};
1224  
-		else if(is_array($table->primaryKey))
  1224
+		elseif(is_array($table->primaryKey))
1225 1225
 		{
1226 1226
 			$values=array();
1227 1227
 			foreach($table->primaryKey as $name)
@@ -1245,7 +1245,7 @@ public function setPrimaryKey($value)
1245 1245
 		$table=$this->getMetaData()->tableSchema;
1246 1246
 		if(is_string($table->primaryKey))
1247 1247
 			$this->{$table->primaryKey}=$value;
1248  
-		else if(is_array($table->primaryKey))
  1248
+		elseif(is_array($table->primaryKey))
1249 1249
 		{
1250 1250
 			foreach($table->primaryKey as $name)
1251 1251
 				$this->$name=$value[$name];
@@ -1329,13 +1329,13 @@ public function applyScopes(&$criteria)
1329 1329
 						$scope=$v;
1330 1330
 						$params=array();
1331 1331
 					}
1332  
-					else if(is_array($v))
  1332
+					elseif(is_array($v))
1333 1333
 					{
1334 1334
 						$scope=key($v);
1335 1335
 						$params=current($v);
1336 1336
 					}
1337 1337
 				}
1338  
-				else if(is_string($k))
  1338
+				elseif(is_string($k))
1339 1339
 				{
1340 1340
 					$scope=$k;
1341 1341
 					$params=$v;
@@ -1800,7 +1800,7 @@ public function populateRecord($attributes,$callAfterFind=true)
1800 1800
 			{
1801 1801
 				if(property_exists($record,$name))
1802 1802
 					$record->$name=$value;
1803  
-				else if(isset($md->columns[$name]))
  1803
+				elseif(isset($md->columns[$name]))
1804 1804
 					$record->_attributes[$name]=$value;
1805 1805
 			}
1806 1806
 			$record->_pk=$record->getPrimaryKey();
@@ -1954,7 +1954,7 @@ public function mergeWith($criteria,$fromScope=false)
1954 1954
 		{
1955 1955
 			if($this->select==='*')
1956 1956
 				$this->select=$criteria['select'];
1957  
-			else if($criteria['select']!=='*')
  1957
+			elseif($criteria['select']!=='*')
1958 1958
 			{
1959 1959
 				$select1=is_string($this->select)?preg_split('/\s*,\s*/',trim($this->select),-1,PREG_SPLIT_NO_EMPTY):$this->select;
1960 1960
 				$select2=is_string($criteria['select'])?preg_split('/\s*,\s*/',trim($criteria['select']),-1,PREG_SPLIT_NO_EMPTY):$criteria['select'];
@@ -1966,7 +1966,7 @@ public function mergeWith($criteria,$fromScope=false)
1966 1966
 		{
1967 1967
 			if($this->condition==='')
1968 1968
 				$this->condition=$criteria['condition'];
1969  
-			else if($criteria['condition']!=='')
  1969
+			elseif($criteria['condition']!=='')
1970 1970
 				$this->condition="({$this->condition}) AND ({$criteria['condition']})";
1971 1971
 		}
1972 1972
 
@@ -1977,7 +1977,7 @@ public function mergeWith($criteria,$fromScope=false)
1977 1977
 		{
1978 1978
 			if($this->order==='')
1979 1979
 				$this->order=$criteria['order'];
1980  
-			else if($criteria['order']!=='')
  1980
+			elseif($criteria['order']!=='')
1981 1981
 				$this->order=$criteria['order'].', '.$this->order;
1982 1982
 		}
1983 1983
 
@@ -1985,7 +1985,7 @@ public function mergeWith($criteria,$fromScope=false)
1985 1985
 		{
1986 1986
 			if($this->group==='')
1987 1987
 				$this->group=$criteria['group'];
1988  
-			else if($criteria['group']!=='')
  1988
+			elseif($criteria['group']!=='')
1989 1989
 				$this->group.=', '.$criteria['group'];
1990 1990
 		}
1991 1991
 
@@ -1993,7 +1993,7 @@ public function mergeWith($criteria,$fromScope=false)
1993 1993
 		{
1994 1994
 			if($this->join==='')
1995 1995
 				$this->join=$criteria['join'];
1996  
-			else if($criteria['join']!=='')
  1996
+			elseif($criteria['join']!=='')
1997 1997
 				$this->join.=' '.$criteria['join'];
1998 1998
 		}
1999 1999
 
@@ -2001,7 +2001,7 @@ public function mergeWith($criteria,$fromScope=false)
2001 2001
 		{
2002 2002
 			if($this->having==='')
2003 2003
 				$this->having=$criteria['having'];
2004  
-			else if($criteria['having']!=='')
  2004
+			elseif($criteria['having']!=='')
2005 2005
 				$this->having="({$this->having}) AND ({$criteria['having']})";
2006 2006
 		}
2007 2007
 	}
@@ -2105,7 +2105,7 @@ public function mergeWith($criteria,$fromScope=false)
2105 2105
 			{
2106 2106
 				if($this->on==='')
2107 2107
 					$this->on=$criteria['condition'];
2108  
-				else if($criteria['condition']!=='')
  2108
+				elseif($criteria['condition']!=='')
2109 2109
 					$this->on="({$this->on}) AND ({$criteria['condition']})";
2110 2110
 			}
2111 2111
 			unset($criteria['condition']);
@@ -2120,7 +2120,7 @@ public function mergeWith($criteria,$fromScope=false)
2120 2120
 		{
2121 2121
 			if($this->on==='')
2122 2122
 				$this->on=$criteria['on'];
2123  
-			else if($criteria['on']!=='')
  2123
+			elseif($criteria['on']!=='')
2124 2124
 				$this->on="({$this->on}) AND ({$criteria['on']})";
2125 2125
 		}
2126 2126
 
@@ -2314,7 +2314,7 @@ public function __construct($model)
2314 2314
 			$table->primaryKey=$model->primaryKey();
2315 2315
 			if(is_string($table->primaryKey) && isset($table->columns[$table->primaryKey]))
2316 2316
 				$table->columns[$table->primaryKey]->isPrimaryKey=true;
2317  
-			else if(is_array($table->primaryKey))
  2317
+			elseif(is_array($table->primaryKey))
2318 2318
 			{
2319 2319
 				foreach($table->primaryKey as $name)
2320 2320
 				{
4  framework/db/schema/CDbColumnSchema.php
@@ -97,9 +97,9 @@ protected function extractType($dbType)
97 97
 	{
98 98
 		if(stripos($dbType,'int')!==false && stripos($dbType,'unsigned int')===false)
99 99
 			$this->type='integer';
100  
-		else if(stripos($dbType,'bool')!==false)
  100
+		elseif(stripos($dbType,'bool')!==false)
101 101
 			$this->type='boolean';
102  
-		else if(preg_match('/(real|floa|doub)/i',$dbType))
  102
+		elseif(preg_match('/(real|floa|doub)/i',$dbType))
103 103
 			$this->type='double';
104 104
 		else
105 105
 			$this->type='string';
10  framework/db/schema/CDbCommandBuilder.php
@@ -131,7 +131,7 @@ public function createCountCommand($table,$criteria,$alias='t')
131 131
 		{
132 132
 			if(is_string($criteria->select) && stripos($criteria->select,'count')===0)
133 133
 				$sql="SELECT ".$criteria->select;
134  
-			else if($criteria->distinct)
  134
+			elseif($criteria->distinct)
135 135
 			{
136 136
 				if(is_array($table->primaryKey))
137 137
 				{
@@ -251,7 +251,7 @@ public function createUpdateCommand($table,$data,$criteria)
251 251
 					foreach($value->params as $n=>$v)
252 252
 						$values[$n]=$v;
253 253
 				}
254  
-				else if($bindByPosition)
  254
+				elseif($bindByPosition)
255 255
 				{
256 256
 					$fields[]=$column->rawName.'=?';
257 257
 					$values[]=$column->typecast($value);
@@ -459,7 +459,7 @@ public function createCriteria($condition='',$params=array())
459 459
 	{
460 460
 		if(is_array($condition))
461 461
 			$criteria=new CDbCriteria($condition);
462  
-		else if($condition instanceof CDbCriteria)
  462
+		elseif($condition instanceof CDbCriteria)
463 463
 			$criteria=clone $condition;
464 464
 		else
465 465
 		{
@@ -548,7 +548,7 @@ public function createColumnCriteria($table,$columns,$condition='',$params=array
548 548
 			{
549 549
 				if(is_array($value))
550 550
 					$conditions[]=$this->createInCondition($table,$name,$value,$prefix);
551  
-				else if($value!==null)
  551
+				elseif($value!==null)
552 552
 				{
553 553
 					if($bindByPosition)
554 554
 					{
@@ -663,7 +663,7 @@ public function createInCondition($table,$columnName,$values,$prefix=null)
663 663
 			else
664 664
 				return $prefix.$column->rawName.' IN ('.implode(', ',$values).')';
665 665
 		}
666  
-		else if(is_array($columnName)) // composite key: $values=array(array('pk1'=>'v1','pk2'=>'v2'),array(...))
  666
+		elseif(is_array($columnName)) // composite key: $values=array(array('pk1'=>'v1','pk2'=>'v2'),array(...))
667 667
 		{
</