Completed
Push — master ( 14dab9...35bf0e )
by Charles
12:03
created
protected/commands/CiiMigrateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Import System/Cli/Commands/MigrateCommand
3
-Yii::import('system.cli.commands.MigrateCommand');
3
+Yii::import ('system.cli.commands.MigrateCommand');
4 4
 /**
5 5
  * This class is an injection container for CDbMigration which permits us to
6 6
  * directly access CDbMigrations from our web application without having
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
      * This is our overloaded getDbConnection, allowing us to tell yii what our db connection is
22 22
      * without it having to go through
23 23
      */
24
-    public function getDbConnection()
24
+    public function getDbConnection ()
25 25
     {
26
-        $connection = new CDbConnection("mysql:host={$this->dsn['host']};dbname={$this->dsn['dbname']}", $this->dsn['username'], $this->dsn['password']);
27
-        $connection->setActive(true);
26
+        $connection = new CDbConnection ("mysql:host={$this->dsn['host']};dbname={$this->dsn['dbname']}", $this->dsn['username'], $this->dsn['password']);
27
+        $connection->setActive (true);
28 28
         return $connection;
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
protected/messages/en_us/yii.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  *
17 17
  * NOTE, this file must be saved in UTF-8 encoding.
18 18
  */
19
-return array (
19
+return array(
20 20
   '&lt; Previous' => '',
21 21
   '&lt;&lt; First' => '',
22 22
   'CApcCache requires PHP apc extension to be loaded.' => '',
Please login to merge, or discard this patch.
protected/migrations/m141001_145619_init.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 	 */
10 10
 	private $_moment = 0;
11 11
 
12
-	public function safeUp()
12
+	public function safeUp ()
13 13
 	{
14
-		$this->_moment = time();
14
+		$this->_moment = time ();
15 15
 
16 16
 		// Try to get the table names, if we get something back, do not run this migration
17 17
 		try
18 18
 		{
19
-			$test = Yii::app()->db->schema->getTables();
20
-			if (count($test) <= 1)
21
-				throw new Exception('CiiMS doesn\'t exist. Applying base migration');
19
+			$test = Yii::app ()->db->schema->getTables ();
20
+			if (count ($test) <= 1)
21
+				throw new Exception ('CiiMS doesn\'t exist. Applying base migration');
22 22
 			return true;
23 23
 		}
24 24
 		catch (Exception $e)
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 		}
29 29
 
30 30
 		// Otherwise, run the install migration
31
-		$this->createUserTables();
31
+		$this->createUserTables ();
32 32
 
33
-		$this->createCategories();
33
+		$this->createCategories ();
34 34
 
35
-		$this->createContent();
35
+		$this->createContent ();
36 36
 
37
-		$this->createConfiguration();
37
+		$this->createConfiguration ();
38 38
 	}
39 39
 
40
-	public function safeDown()
40
+	public function safeDown ()
41 41
 	{
42 42
 		echo "m141001_145619_init does not support migration down.\n";
43 43
 		return false;
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Creates the tables, indexes, and relations for users
48 48
 	 */
49
-	private function createUserTables()
49
+	private function createUserTables ()
50 50
 	{
51
-		$this->createTable('users', array(
51
+		$this->createTable ('users', array(
52 52
 			'id' 		=> 'pk',
53 53
 			'email' 	=> 'string NOT NULL',
54 54
 			'password' 	=> 'string NOT NULL',
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 			'updated' 	=> 'integer'
60 60
 		));
61 61
 
62
-		$this->createTable('user_roles', array(
62
+		$this->createTable ('user_roles', array(
63 63
 			'id' 		=> 'pk',
64 64
 			'name' 		=> 'string NOT NULL',
65 65
 			'created' 	=> 'integer',
66 66
 			'updated' 	=> 'integer'
67 67
 		));
68 68
 
69
-		$this->createTable('user_metadata', array(
69
+		$this->createTable ('user_metadata', array(
70 70
 			'user_id' 	  => 'integer',
71 71
 			'key'		  => 'string NOT NULL',
72 72
 			'value' 	  => 'text NOT NULL',
@@ -76,66 +76,66 @@  discard block
 block discarded – undo
76 76
 		));
77 77
 
78 78
 		// Create the necessary indexes on the columns
79
-		$this->createIndex('user_email', 'users', 'email', true);
80
-		$this->createIndex('user_username', 'users', 'username', true);
81
-		$this->createIndex('user_metadata', 'user_metadata', 'user_id, key', false);
79
+		$this->createIndex ('user_email', 'users', 'email', true);
80
+		$this->createIndex ('user_username', 'users', 'username', true);
81
+		$this->createIndex ('user_metadata', 'user_metadata', 'user_id, key', false);
82 82
 
83
-		$this->addPrimaryKey('user_metadata_composite', 'user_metadata', 'user_id,key');
83
+		$this->addPrimaryKey ('user_metadata_composite', 'user_metadata', 'user_id,key');
84 84
 
85 85
 		// Setup the foreign key constraints
86
-		$this->addForeignKey('user_roles_relation_fk', 'user_metadata', 'user_id', 'users', 'id', 'CASCADE', 'NO ACTION');
86
+		$this->addForeignKey ('user_roles_relation_fk', 'user_metadata', 'user_id', 'users', 'id', 'CASCADE', 'NO ACTION');
87 87
 
88 88
 		// Insert data into the tables
89
-		$this->insert('user_roles', array(
89
+		$this->insert ('user_roles', array(
90 90
 			'id'      => 1,
91 91
 			'name' 	  => 'User',
92 92
 			'created' => $this->_moment,
93 93
 			'updated' => $this->_moment
94 94
 		));
95 95
 
96
-		$this->insert('user_roles', array(
96
+		$this->insert ('user_roles', array(
97 97
 			'id'      => 2,
98 98
 			'name'    => 'Pending',
99 99
 			'created' => $this->_moment,
100 100
 			'updated' => $this->_moment
101 101
 		));
102 102
 
103
-		$this->insert('user_roles', array(
103
+		$this->insert ('user_roles', array(
104 104
 			'id'      => 3,
105 105
 			'name'    => 'Suspended',
106 106
 			'created' => $this->_moment,
107 107
 			'updated' => $this->_moment
108 108
 		));
109 109
 
110
-		$this->insert('user_roles', array(
110
+		$this->insert ('user_roles', array(
111 111
 			'id'      => 5,
112 112
 			'name'    => 'Collaborator',
113 113
 			'created' => $this->_moment,
114 114
 			'updated' => $this->_moment
115 115
 		));
116 116
 
117
-		$this->insert('user_roles', array(
117
+		$this->insert ('user_roles', array(
118 118
 			'id'      => 6,
119 119
 			'name'    => 'Author',
120 120
 			'created' => $this->_moment,
121 121
 			'updated' => $this->_moment
122 122
 		));
123 123
 
124
-		$this->insert('user_roles', array(
124
+		$this->insert ('user_roles', array(
125 125
 			'id'      => 7,
126 126
 			'name'    => 'User',
127 127
 			'created' => $this->_moment,
128 128
 			'updated' => $this->_moment
129 129
 		));
130 130
 
131
-		$this->insert('user_roles', array(
131
+		$this->insert ('user_roles', array(
132 132
 			'id'      => 8,
133 133
 			'name'    => 'Publisher',
134 134
 			'created' => $this->_moment,
135 135
 			'updated' => $this->_moment
136 136
 		));
137 137
 
138
-		$this->insert('user_roles', array(
138
+		$this->insert ('user_roles', array(
139 139
 			'id'      => 9,
140 140
 			'name'    => 'Administrator',
141 141
 			'created' => $this->_moment,
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	/**
147 147
 	 * Create the categories and relations
148 148
 	 */
149
-	private function createCategories()
149
+	private function createCategories ()
150 150
 	{
151 151
 		// Categories
152
-		$this->createTable('categories', array(
152
+		$this->createTable ('categories', array(
153 153
 			'id' 		=> 'pk',
154 154
 			'parent_id' => 'integer DEFAULT 1',
155 155
 			'name' 		=> 'string NOT NULL',
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'updated' 	=> 'integer'
159 159
 		));
160 160
 
161
-		$this->createTable('categories_metadata', array(
161
+		$this->createTable ('categories_metadata', array(
162 162
 			'category_id' => 'integer',
163 163
 			'key'		  => 'string NOT NULL',
164 164
 			'value' 	  => 'text NOT NULL',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		));
168 168
 
169 169
 		// Insert the first record into the categories table
170
-		$this->insert('categories', array(
170
+		$this->insert ('categories', array(
171 171
 			'id'      => 1,
172 172
 			'name'    => 'Uncategorized',
173 173
 			'slug'    => 'uncategorized',
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
 			'updated' => $this->_moment
176 176
 		));
177 177
 
178
-		$this->addPrimaryKey('categories_metadata_composite', 'categories_metadata', 'category_id,key');
179
-		$this->addForeignKey('categories_parents_fk', 'categories', 'parent_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
180
-		$this->addForeignKey('categories_metadata_fk', 'categories_metadata', 'category_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
178
+		$this->addPrimaryKey ('categories_metadata_composite', 'categories_metadata', 'category_id,key');
179
+		$this->addForeignKey ('categories_parents_fk', 'categories', 'parent_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
180
+		$this->addForeignKey ('categories_metadata_fk', 'categories_metadata', 'category_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
181 181
 	}
182 182
 
183 183
 	/**
184 184
 	 * Creates the content, comemnts, and necessary relations
185 185
 	 */
186
-	private function createContent()
186
+	private function createContent ()
187 187
 	{
188
-		$this->createTable('content', array(
188
+		$this->createTable ('content', array(
189 189
 			'id'		  => 'integer NOT NULL',
190 190
 			'vid' 		  => 'integer NOT NULL DEFAULT 1',
191 191
 			'title'		  => 'string  NOT NULL',
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 			'updated' 	  => 'integer'
205 205
 		));
206 206
 
207
-		$this->createTable('content_types', array(
207
+		$this->createTable ('content_types', array(
208 208
 			'id'          => 'pk',
209 209
 			'name'		  => 'string NOT NULL',
210 210
 			'created'     => 'integer',
211 211
 			'updated' 	  => 'integer'
212 212
 		));
213 213
 
214
-		$this->createTable('content_metadata', array(
214
+		$this->createTable ('content_metadata', array(
215 215
 			'content_id'  => 'integer',
216 216
 			'key'		  => 'string NOT NULL',
217 217
 			'value' 	  => 'text NOT NULL',
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			'updated' 	  => 'integer'
220 220
 		));
221 221
 
222
-		$this->createTable('comments', array(
222
+		$this->createTable ('comments', array(
223 223
 			'id'		  => 'pk',
224 224
 			'content_id'  => 'integer',
225 225
 			'author_id'   => 'integer',
@@ -228,53 +228,53 @@  discard block
 block discarded – undo
228 228
 			'updated' 	  => 'integer'
229 229
 		));
230 230
 
231
-		$this->insert('content_types', array(
231
+		$this->insert ('content_types', array(
232 232
 			'id'          => 1,
233 233
 			'name'        => 'Static Page',
234 234
 			'created'     => $this->_moment,
235 235
 			'updated'     => $this->_moment
236 236
 		));
237 237
 
238
-		$this->insert('content_types', array(
238
+		$this->insert ('content_types', array(
239 239
 			'id'          => 2,
240 240
 			'name'    	  => 'Blog Post',
241 241
 			'created'     => $this->_moment,
242 242
 			'updated'     => $this->_moment
243 243
 		));
244 244
 
245
-		$this->addPrimaryKey('content_composite', 'content', 'id, vid');
245
+		$this->addPrimaryKey ('content_composite', 'content', 'id, vid');
246 246
 
247
-		$this->execute('ALTER TABLE `content` CHANGE id id INT( 11 ) NOT NULL AUTO_INCREMENT');
247
+		$this->execute ('ALTER TABLE `content` CHANGE id id INT( 11 ) NOT NULL AUTO_INCREMENT');
248 248
 
249
-		$this->addPrimaryKey('content_metadata_composite', 'content_metadata', 'content_id,key');
249
+		$this->addPrimaryKey ('content_metadata_composite', 'content_metadata', 'content_id,key');
250 250
 
251
-		$this->createIndex('content_author', 'content', 'author_id', false);
252
-		$this->createIndex('content_category', 'content', 'category_id', false);
253
-		$this->createIndex('content_type', 'content', 'type_id', false);
254
-		$this->createIndex('comment_content', 'comments', 'content_id', false);
255
-		$this->createIndex('comment_author', 'comments', 'author_id', false);
251
+		$this->createIndex ('content_author', 'content', 'author_id', false);
252
+		$this->createIndex ('content_category', 'content', 'category_id', false);
253
+		$this->createIndex ('content_type', 'content', 'type_id', false);
254
+		$this->createIndex ('comment_content', 'comments', 'content_id', false);
255
+		$this->createIndex ('comment_author', 'comments', 'author_id', false);
256 256
 
257
-		$this->addForeignKey('content_category_fk', 'content', 'category_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
258
-		$this->addForeignKey('content_author_fk', 'content', 'author_id', 'users', 'id', 'CASCADE', 'NO ACTION');
259
-		$this->addForeignKey('content_type_fk', 'content', 'type_id', 'content_types', 'id', 'CASCADE', 'NO ACTION');
257
+		$this->addForeignKey ('content_category_fk', 'content', 'category_id', 'categories', 'id', 'CASCADE', 'NO ACTION');
258
+		$this->addForeignKey ('content_author_fk', 'content', 'author_id', 'users', 'id', 'CASCADE', 'NO ACTION');
259
+		$this->addForeignKey ('content_type_fk', 'content', 'type_id', 'content_types', 'id', 'CASCADE', 'NO ACTION');
260 260
 
261
-		$this->addForeignKey('comments_content_id_fk', 'comments', 'content_id', 'content', 'id', 'CASCADE', 'NO ACTION');
262
-		$this->addForeignKey('comments_author_fk', 'comments', 'author_id', 'users', 'id', 'CASCADE', 'NO ACTION');
261
+		$this->addForeignKey ('comments_content_id_fk', 'comments', 'content_id', 'content', 'id', 'CASCADE', 'NO ACTION');
262
+		$this->addForeignKey ('comments_author_fk', 'comments', 'author_id', 'users', 'id', 'CASCADE', 'NO ACTION');
263 263
 	}
264 264
 
265 265
 	/**
266 266
 	 * Creates the configuration and events tables
267 267
 	 */
268
-	private function createConfiguration()
268
+	private function createConfiguration ()
269 269
 	{
270
-		$this->createTable('configuration', array(
270
+		$this->createTable ('configuration', array(
271 271
 			'key'		  => 'string',
272 272
 			'value' 	  => 'text NOT NULL',
273 273
 			'created' 	  => 'integer',
274 274
 			'updated' 	  => 'integer'
275 275
 		));
276 276
 
277
-		$this->createTable('events', array(
277
+		$this->createTable ('events', array(
278 278
 			'id'		  => 'pk',
279 279
 			'event'       => 'string NOT NULL',
280 280
 			'event_data'  => 'text DEFAULT NULL',
@@ -283,6 +283,6 @@  discard block
 block discarded – undo
283 283
 			'created' 	  => 'integer'
284 284
 		));
285 285
 
286
-		$this->addPrimaryKey('configuration_pk', 'configuration', 'key');
286
+		$this->addPrimaryKey ('configuration_pk', 'configuration', 'key');
287 287
 	}
288 288
 }
289 289
\ No newline at end of file
Please login to merge, or discard this patch.
protected/models/CategoriesMetadata.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	 * @param string $className active record class name.
22 22
 	 * @return CategoriesMetadata the static model class
23 23
 	 */
24
-	public static function model($className=__CLASS__)
24
+	public static function model ($className = __CLASS__)
25 25
 	{
26
-		return parent::model($className);
26
+		return parent::model ($className);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return string the associated database table name
31 31
 	 */
32
-	public function tableName()
32
+	public function tableName ()
33 33
 	{
34 34
 		return 'categories_metadata';
35 35
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @return array validation rules for model attributes.
39 39
 	 */
40
-	public function rules()
40
+	public function rules ()
41 41
 	{
42 42
 		// NOTE: you should only define rules for those attributes that
43 43
 		// will receive user inputs.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @return array relational rules.
56 56
 	 */
57
-	public function relations()
57
+	public function relations ()
58 58
 	{
59 59
 		// NOTE: you may need to adjust the relation name and the related
60 60
 		// class name for the relations automatically generated below.
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * @return array customized attribute labels (name=>label)
68 68
 	 */
69
-	public function attributeLabels()
69
+	public function attributeLabels ()
70 70
 	{
71 71
 		return array(
72
-			'category_id' => Yii::t('ciims.models.CategoriesMetadata', 'Category ID'),
73
-			'key' 	      => Yii::t('ciims.models.CategoriesMetadata', 'Key'),
74
-			'value'       => Yii::t('ciims.models.CategoriesMetadata', 'Value'),
75
-			'created'	  => Yii::t('ciims.models.CategoriesMetadata', 'Created'),
76
-			'updated' 	  => Yii::t('ciims.models.CategoriesMetadata', 'Updated'),
72
+			'category_id' => Yii::t ('ciims.models.CategoriesMetadata', 'Category ID'),
73
+			'key' 	      => Yii::t ('ciims.models.CategoriesMetadata', 'Key'),
74
+			'value'       => Yii::t ('ciims.models.CategoriesMetadata', 'Value'),
75
+			'created'	  => Yii::t ('ciims.models.CategoriesMetadata', 'Created'),
76
+			'updated' 	  => Yii::t ('ciims.models.CategoriesMetadata', 'Updated'),
77 77
 		);
78 78
 	}
79 79
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 	 * Retrieves a list of models based on the current search/filter conditions.
82 82
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
83 83
 	 */
84
-	public function search()
84
+	public function search ()
85 85
 	{
86
-		$criteria=new CDbCriteria;
86
+		$criteria = new CDbCriteria;
87 87
 
88
-		$criteria->compare('category_id',$this->category_id);
89
-		$criteria->compare('t.key',$this->key,true);
90
-		$criteria->compare('value',$this->value,true);
91
-		$criteria->compare('created',$this->created,true);
92
-		$criteria->compare('updated',$this->updated,true);
88
+		$criteria->compare ('category_id', $this->category_id);
89
+		$criteria->compare ('t.key', $this->key, true);
90
+		$criteria->compare ('value', $this->value, true);
91
+		$criteria->compare ('created', $this->created, true);
92
+		$criteria->compare ('updated', $this->updated, true);
93 93
 
94
-		return new CActiveDataProvider($this, array(
94
+		return new CActiveDataProvider ($this, array(
95 95
 			'criteria'=>$criteria,
96 96
 		));
97 97
 	}
Please login to merge, or discard this patch.
protected/models/Comments.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * @param string $className active record class name.
37 37
 	 * @return Comments the static model class
38 38
 	 */
39
-	public static function model($className=__CLASS__)
39
+	public static function model ($className = __CLASS__)
40 40
 	{
41
-		return parent::model($className);
41
+		return parent::model ($className);
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @return string the associated database table name
46 46
 	 */
47
-	public function tableName()
47
+	public function tableName ()
48 48
 	{
49 49
 		return 'comments';
50 50
 	}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @return array validation rules for model attributes.
54 54
 	 */
55
-	public function rules()
55
+	public function rules ()
56 56
 	{
57 57
 		// NOTE: you should only define rules for those attributes that
58 58
 		// will receive user inputs.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * @return array relational rules.
69 69
 	 */
70
-	public function relations()
70
+	public function relations ()
71 71
 	{
72 72
 		// NOTE: you may need to adjust the relation name and the related
73 73
 		// class name for the relations automatically generated below.
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	/**
81 81
 	 * @return array customized attribute labels (name=>label)
82 82
 	 */
83
-	public function attributeLabels()
83
+	public function attributeLabels ()
84 84
 	{
85 85
 		return array(
86
-			'id'		 => Yii::t('ciims.models.Comments', 'ID'),
87
-			'content_id' => Yii::t('ciims.models.Comments', 'Content'),
88
-			'author_id'  => Yii::t('ciims.models.Comments', 'User'),
89
-			'comment' 	 => Yii::t('ciims.models.Comments', 'Comment'),
90
-			'created' 	 => Yii::t('ciims.models.Comments', 'Created'),
91
-			'updated' 	 => Yii::t('ciims.models.Comments', 'Updated'),
86
+			'id'		 => Yii::t ('ciims.models.Comments', 'ID'),
87
+			'content_id' => Yii::t ('ciims.models.Comments', 'Content'),
88
+			'author_id'  => Yii::t ('ciims.models.Comments', 'User'),
89
+			'comment' 	 => Yii::t ('ciims.models.Comments', 'Comment'),
90
+			'created' 	 => Yii::t ('ciims.models.Comments', 'Created'),
91
+			'updated' 	 => Yii::t ('ciims.models.Comments', 'Updated'),
92 92
 		);
93 93
 	}
94 94
 
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 	 * Retrieves a list of models based on the current search/filter conditions.
97 97
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
98 98
 	 */
99
-	public function search()
99
+	public function search ()
100 100
 	{
101
-		$criteria=new CDbCriteria;
101
+		$criteria = new CDbCriteria;
102 102
 
103
-		$criteria->compare('id',$this->id);
104
-		$criteria->compare('content_id',$this->content_id);
105
-		$criteria->compare('author_id',$this->author_id);
106
-		$criteria->compare('comment',$this->comment,true);
107
-		$criteria->compare('created',$this->created,true);
108
-		$criteria->compare('updated',$this->updated,true);
103
+		$criteria->compare ('id', $this->id);
104
+		$criteria->compare ('content_id', $this->content_id);
105
+		$criteria->compare ('author_id', $this->author_id);
106
+		$criteria->compare ('comment', $this->comment, true);
107
+		$criteria->compare ('created', $this->created, true);
108
+		$criteria->compare ('updated', $this->updated, true);
109 109
 
110
-		return new CActiveDataProvider($this, array(
110
+		return new CActiveDataProvider ($this, array(
111 111
 			'criteria'=>$criteria,
112 112
 		));
113 113
 	}
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 	 * Returns the API attributes for the model
117 117
 	 * @return array
118 118
 	 */
119
-	public function getApiAttributes($params = array(), $relations = false)
119
+	public function getApiAttributes ($params = array(), $relations = false)
120 120
 	{
121
-		$data = parent::getApiAttributes($params, $relations);
122
-		$user = Users::model()->findByPk($this->author_id);
123
-		$attributes = $user->getApiAttributes();
121
+		$data = parent::getApiAttributes ($params, $relations);
122
+		$user = Users::model ()->findByPk ($this->author_id);
123
+		$attributes = $user->getApiAttributes ();
124 124
 		$data['user'] = array(
125 125
 			'firstName' => $attributes['firstName'],
126 126
 			'lastName' => $attributes['lastName'],
127 127
 			'username' => $attributes['username'],
128 128
 		);
129 129
 
130
-		$content = Content::model()->findByPk($data['content_id']);
130
+		$content = Content::model ()->findByPk ($data['content_id']);
131 131
 		$data['content'] = array(
132 132
 			'id' => $data['content_id'],
133 133
 			'title' => $content->title,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		);
136 136
 
137 137
 		// If this user cannot comment without approval
138
-		if ($user->getReputation() < 100)
138
+		if ($user->getReputation () < 100)
139 139
 			$data['banned_comment'] = true;
140 140
 
141 141
 		return $data;
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 	 * Set the created and updated records
146 146
 	 * @see CiiModel::beforeSave();
147 147
 	 */
148
-	public function beforeSave()
148
+	public function beforeSave ()
149 149
 	{
150 150
 		if ($this->isNewRecord)
151 151
 			$this->_isNewRecord = true;
152 152
 
153
-		if (Content::model()->findByPk($this->content_id)->commentable)
154
-			return parent::beforeSave();
153
+		if (Content::model ()->findByPk ($this->content_id)->commentable)
154
+			return parent::beforeSave ();
155 155
 		else
156 156
 			return false;
157 157
 	}
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 * After a new comment is posted, set the reputation += 10
161 161
 	 * @see parent::afterSave();
162 162
 	 */
163
-	public function afterSave()
163
+	public function afterSave ()
164 164
 	{
165 165
 		if ($this->_isNewRecord)
166 166
 		{
167
-			$user = Users::model()->findByPk($this->author_id);
168
-			$user->setReputation(10);
167
+			$user = Users::model ()->findByPk ($this->author_id);
168
+			$user->setReputation (10);
169 169
 		}
170 170
 
171
-		return parent::afterSave();
171
+		return parent::afterSave ();
172 172
 	}
173 173
 }
Please login to merge, or discard this patch.
protected/models/ContentMetadata.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	 * @param string $className active record class name.
22 22
 	 * @return ContentMetadata the static model class
23 23
 	 */
24
-	public static function model($className=__CLASS__)
24
+	public static function model ($className = __CLASS__)
25 25
 	{
26
-		return parent::model($className);
26
+		return parent::model ($className);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return string the associated database table name
31 31
 	 */
32
-	public function tableName()
32
+	public function tableName ()
33 33
 	{
34 34
 		return 'content_metadata';
35 35
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @return array validation rules for model attributes.
39 39
 	 */
40
-	public function rules()
40
+	public function rules ()
41 41
 	{
42 42
 		// NOTE: you should only define rules for those attributes that
43 43
 		// will receive user inputs.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @return array relational rules.
55 55
 	 */
56
-	public function relations()
56
+	public function relations ()
57 57
 	{
58 58
 		// NOTE: you may need to adjust the relation name and the related
59 59
 		// class name for the relations automatically generated below.
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @return array customized attribute labels (name=>label)
67 67
 	 */
68
-	public function attributeLabels()
68
+	public function attributeLabels ()
69 69
 	{
70 70
 		return array(
71
-			'content_id' => Yii::t('ciims.models.ContentMetadata', 'Content ID'),
72
-			'key' 		 => Yii::t('ciims.models.ContentMetadata', 'Key'),
73
-			'value' 	 => Yii::t('ciims.models.ContentMetadata', 'Value'),
74
-			'created'	 => Yii::t('ciims.models.ContentMetadata', 'Created'),
75
-			'updated' 	 => Yii::t('ciims.models.ContentMetadata', 'Updated')
71
+			'content_id' => Yii::t ('ciims.models.ContentMetadata', 'Content ID'),
72
+			'key' 		 => Yii::t ('ciims.models.ContentMetadata', 'Key'),
73
+			'value' 	 => Yii::t ('ciims.models.ContentMetadata', 'Value'),
74
+			'created'	 => Yii::t ('ciims.models.ContentMetadata', 'Created'),
75
+			'updated' 	 => Yii::t ('ciims.models.ContentMetadata', 'Updated')
76 76
 		);
77 77
 	}
78 78
 
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 	 * Retrieves a list of models based on the current search/filter conditions.
81 81
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
82 82
 	 */
83
-	public function search()
83
+	public function search ()
84 84
 	{
85
-		$criteria=new CDbCriteria;
85
+		$criteria = new CDbCriteria;
86 86
 
87
-		$criteria->compare('content_id',$this->content_id);
88
-		$criteria->compare('t.key',$this->key,true);
89
-		$criteria->compare('value',$this->value,true);
90
-		$criteria->compare('created',$this->created,true);
91
-		$criteria->compare('updated',$this->updated,true);
87
+		$criteria->compare ('content_id', $this->content_id);
88
+		$criteria->compare ('t.key', $this->key, true);
89
+		$criteria->compare ('value', $this->value, true);
90
+		$criteria->compare ('created', $this->created, true);
91
+		$criteria->compare ('updated', $this->updated, true);
92 92
 
93
-		return new CActiveDataProvider($this, array(
93
+		return new CActiveDataProvider ($this, array(
94 94
 			'criteria'=>$criteria,
95 95
 		));
96 96
 	}
Please login to merge, or discard this patch.
protected/models/ContentTypes.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 	 * @param string $className active record class name.
8 8
 	 * @return ContentMetadata the static model class
9 9
 	 */
10
-	public static function model($className=__CLASS__)
10
+	public static function model ($className = __CLASS__)
11 11
 	{
12
-		return parent::model($className);
12
+		return parent::model ($className);
13 13
 	}
14 14
 
15 15
 	/**
16 16
 	 * @return string the associated database table name
17 17
 	 */
18
-	public function tableName()
18
+	public function tableName ()
19 19
 	{
20 20
 		return 'content_types';
21 21
 	}
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @return array validation rules for model attributes.
25 25
 	 */
26
-	public function rules()
26
+	public function rules ()
27 27
 	{
28 28
 		// NOTE: you should only define rules for those attributes that
29 29
 		// will receive user inputs.
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @return array relational rules.
39 39
 	 */
40
-	public function relations()
40
+	public function relations ()
41 41
 	{
42 42
 		// NOTE: you may need to adjust the relation name and the related
43 43
 		// class name for the relations automatically generated below.
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * @return array customized attribute labels (name=>label)
51 51
 	 */
52
-	public function attributeLabels()
52
+	public function attributeLabels ()
53 53
 	{
54 54
 		return array(
55
-			'id'	     => Yii::t('ciims.models.ContentTypes', 'ID'),
56
-			'name' 		 => Yii::t('ciims.models.ContentTypes', 'Name'),
57
-			'created'	 => Yii::t('ciims.models.ContentTypes', 'Created'),
58
-			'updated' 	 => Yii::t('ciims.models.ContentTypes', 'Updated')
55
+			'id'	     => Yii::t ('ciims.models.ContentTypes', 'ID'),
56
+			'name' 		 => Yii::t ('ciims.models.ContentTypes', 'Name'),
57
+			'created'	 => Yii::t ('ciims.models.ContentTypes', 'Created'),
58
+			'updated' 	 => Yii::t ('ciims.models.ContentTypes', 'Updated')
59 59
 		);
60 60
 	}
61 61
 
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 	 * Retrieves a list of models based on the current search/filter conditions.
64 64
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
65 65
 	 */
66
-	public function search()
66
+	public function search ()
67 67
 	{
68
-		$criteria=new CDbCriteria;
68
+		$criteria = new CDbCriteria;
69 69
 
70
-		$criteria->compare('id',$this->id);
71
-		$criteria->compare('name',$this->name,true);
72
-		$criteria->compare('created',$this->created,true);
73
-		$criteria->compare('updated',$this->updated,true);
70
+		$criteria->compare ('id', $this->id);
71
+		$criteria->compare ('name', $this->name, true);
72
+		$criteria->compare ('created', $this->created, true);
73
+		$criteria->compare ('updated', $this->updated, true);
74 74
 
75
-		return new CActiveDataProvider($this, array(
75
+		return new CActiveDataProvider ($this, array(
76 76
 			'criteria'=>$criteria,
77 77
 		));
78 78
 	}
Please login to merge, or discard this patch.
protected/models/UserMetadata.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	 * @param string $className active record class name.
22 22
 	 * @return UserMetadata the static model class
23 23
 	 */
24
-	public static function model($className=__CLASS__)
24
+	public static function model ($className = __CLASS__)
25 25
 	{
26
-		return parent::model($className);
26
+		return parent::model ($className);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return string the associated database table name
31 31
 	 */
32
-	public function tableName()
32
+	public function tableName ()
33 33
 	{
34 34
 		return 'user_metadata';
35 35
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @return array validation rules for model attributes.
39 39
 	 */
40
-	public function rules()
40
+	public function rules ()
41 41
 	{
42 42
 		// NOTE: you should only define rules for those attributes that
43 43
 		// will receive user inputs.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @return array relational rules.
55 55
 	 */
56
-	public function relations()
56
+	public function relations ()
57 57
 	{
58 58
 		// NOTE: you may need to adjust the relation name and the related
59 59
 		// class name for the relations automatically generated below.
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @return array customized attribute labels (name=>label)
67 67
 	 */
68
-	public function attributeLabels()
68
+	public function attributeLabels ()
69 69
 	{
70 70
 		return array(
71
-			'id' 		  => Yii::t('ciims.models.UserMetadata', 'ID'),
72
-			'user_id' 	  => Yii::t('ciims.models.UserMetadata', 'User'),
73
-			'key' 		  => Yii::t('ciims.models.UserMetadata', 'Key'),
74
-			'value' 	  => Yii::t('ciims.models.UserMetadata', 'Value'),
75
-			'entity_type' => Yii::t('ciims.models.UserMetadata', 'Entity Type'),
76
-			'created' 	  => Yii::t('ciims.models.UserMetadata', 'Created'),
77
-			'updated'     => Yii::t('ciims.models.UserMetadata', 'Updated'),
71
+			'id' 		  => Yii::t ('ciims.models.UserMetadata', 'ID'),
72
+			'user_id' 	  => Yii::t ('ciims.models.UserMetadata', 'User'),
73
+			'key' 		  => Yii::t ('ciims.models.UserMetadata', 'Key'),
74
+			'value' 	  => Yii::t ('ciims.models.UserMetadata', 'Value'),
75
+			'entity_type' => Yii::t ('ciims.models.UserMetadata', 'Entity Type'),
76
+			'created' 	  => Yii::t ('ciims.models.UserMetadata', 'Created'),
77
+			'updated'     => Yii::t ('ciims.models.UserMetadata', 'Updated'),
78 78
 		);
79 79
 	}
80 80
 
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * Retrieves a list of models based on the current search/filter conditions.
83 83
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
84 84
 	 */
85
-	public function search()
85
+	public function search ()
86 86
 	{
87
-		$criteria=new CDbCriteria;
87
+		$criteria = new CDbCriteria;
88 88
 
89
-		$criteria->compare('id',$this->id);
90
-		$criteria->compare('user_id',$this->user_id);
91
-		$criteria->compare('key',$this->key,true);
92
-		$criteria->compare('value',$this->value,true);
93
-		$criteria->compare('entity_type',$this->entity_type,true);
94
-		$criteria->compare('created',$this->created,true);
95
-		$criteria->compare('updated',$this->updated,true);
89
+		$criteria->compare ('id', $this->id);
90
+		$criteria->compare ('user_id', $this->user_id);
91
+		$criteria->compare ('key', $this->key, true);
92
+		$criteria->compare ('value', $this->value, true);
93
+		$criteria->compare ('entity_type', $this->entity_type, true);
94
+		$criteria->compare ('created', $this->created, true);
95
+		$criteria->compare ('updated', $this->updated, true);
96 96
 
97
-		return new CActiveDataProvider($this, array(
97
+		return new CActiveDataProvider ($this, array(
98 98
 			'criteria'=>$criteria,
99 99
 		));
100 100
 	}
Please login to merge, or discard this patch.
protected/models/UserRoles.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 	 * --------------------------------------------------------------------------------
37 37
 	 * @return array
38 38
 	 */
39
-	public function getPermissions()
39
+	public function getPermissions ()
40 40
 	{
41 41
 		return array(
42
-			'1' => 1,		// User
43
-			'2' => 0,		// Pending
44
-			'3' => 0,		// Suspended
45
-			'5' => 7,		// Collaborator
46
-			'7' => 16,		// Author
47
-			'8' => 32,		// Publisher
42
+			'1' => 1, // User
43
+			'2' => 0, // Pending
44
+			'3' => 0, // Suspended
45
+			'5' => 7, // Collaborator
46
+			'7' => 16, // Author
47
+			'8' => 32, // Publisher
48 48
 			'9' => 64		// Admin
49 49
 		);
50 50
 	}
51 51
 
52
-	public function isA($roleName, $role=false)
52
+	public function isA ($roleName, $role = false)
53 53
 	{
54 54
 		if ($role === false)
55
-			$role = Yii::app()->user->role;
55
+			$role = Yii::app ()->user->role;
56 56
 
57
-		$roleName = strtolower($roleName);
57
+		$roleName = strtolower ($roleName);
58 58
 
59 59
 		switch ($roleName)
60 60
 		{
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * Returns the bitwise permissions associated to each activity
78 78
 	 * @return array
79 79
 	 */
80
-	public function getActivities()
80
+	public function getActivities ()
81 81
 	{
82 82
 		return array(
83 83
 			'read' 			=> 1,
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 * @param int 	 $role 			The user role. If not provided, will be applied to the current user
99 99
 	 * @return boolean
100 100
 	 */
101
-	public function hasPermission($permission, $role=NULL)
101
+	public function hasPermission ($permission, $role = NULL)
102 102
 	{
103 103
 		if ($role === NULL)
104 104
 		{
105 105
 			if (isset($this->id))
106 106
 				$role = $this->id;
107
-			else if (Yii::app()->user->isGuest)
107
+			else if (Yii::app ()->user->isGuest)
108 108
 				$role = 1;
109 109
 			else
110
-				$role = Yii::app()->user->role;
110
+				$role = Yii::app ()->user->role;
111 111
 		}
112 112
 
113
-		$permissions = $this->getPermissions();
114
-		$activities = $this->getActivities();
113
+		$permissions = $this->getPermissions ();
114
+		$activities = $this->getActivities ();
115 115
 
116 116
 		// If the permission doesn't exist for that role, return false;
117 117
 		if (!isset($permissions[$role]))
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 * @param string $className active record class name.
126 126
 	 * @return UserRoles the static model class
127 127
 	 */
128
-	public static function model($className=__CLASS__)
128
+	public static function model ($className = __CLASS__)
129 129
 	{
130
-		return parent::model($className);
130
+		return parent::model ($className);
131 131
 	}
132 132
 
133 133
 	/**
134 134
 	 * @return string the associated database table name
135 135
 	 */
136
-	public function tableName()
136
+	public function tableName ()
137 137
 	{
138 138
 		return 'user_roles';
139 139
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	/**
142 142
 	 * @return array validation rules for model attributes.
143 143
 	 */
144
-	public function rules()
144
+	public function rules ()
145 145
 	{
146 146
 		// NOTE: you should only define rules for those attributes that
147 147
 		// will receive user inputs.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	/**
157 157
 	 * @return array relational rules.
158 158
 	 */
159
-	public function relations()
159
+	public function relations ()
160 160
 	{
161 161
 		// NOTE: you may need to adjust the relation name and the related
162 162
 		// class name for the relations automatically generated below.
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	/**
169 169
 	 * @return array customized attribute labels (name=>label)
170 170
 	 */
171
-	public function attributeLabels()
171
+	public function attributeLabels ()
172 172
 	{
173 173
 		return array(
174
-			'id' 	  => Yii::t('ciims.models.UserRoles', 'ID'),
175
-			'name' 	  => Yii::t('ciims.models.UserRoles', 'Name'),
176
-			'created' => Yii::t('ciims.models.UserRoles', 'Created'),
177
-			'updated' => Yii::t('ciims.models.UserRoles', 'Updated'),
174
+			'id' 	  => Yii::t ('ciims.models.UserRoles', 'ID'),
175
+			'name' 	  => Yii::t ('ciims.models.UserRoles', 'Name'),
176
+			'created' => Yii::t ('ciims.models.UserRoles', 'Created'),
177
+			'updated' => Yii::t ('ciims.models.UserRoles', 'Updated'),
178 178
 		);
179 179
 	}
180 180
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 	 * Retrieves a list of models based on the current search/filter conditions.
183 183
 	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
184 184
 	 */
185
-	public function search()
185
+	public function search ()
186 186
 	{
187
-		$criteria=new CDbCriteria;
187
+		$criteria = new CDbCriteria;
188 188
 
189
-		$criteria->compare('id',$this->id);
190
-		$criteria->compare('name',$this->name,true);
191
-		$criteria->compare('created',$this->created,true);
192
-		$criteria->compare('updated',$this->updated,true);
189
+		$criteria->compare ('id', $this->id);
190
+		$criteria->compare ('name', $this->name, true);
191
+		$criteria->compare ('created', $this->created, true);
192
+		$criteria->compare ('updated', $this->updated, true);
193 193
 
194
-		return new CActiveDataProvider($this, array(
194
+		return new CActiveDataProvider ($this, array(
195 195
 			'criteria'=>$criteria,
196 196
 		));
197 197
 	}
Please login to merge, or discard this patch.