Completed
Push — scrutinizer ( c2ef4a )
by Fabio
21:50
created
demos/chat/protected/App_Code/ChatUserRecord.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@
 block discarded – undo
9 9
 
10 10
 	public function getLast_Activity()
11 11
 	{
12
-		if($this->_last_activity === null)
13
-			$this->_last_activity = time();
12
+		if($this->_last_activity === null) {
13
+					$this->_last_activity = time();
14
+		}
14 15
 		return $this->_last_activity;
15 16
 	}
16 17
 
Please login to merge, or discard this patch.
demos/chat/protected/pages/Login.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@
 block discarded – undo
10 10
 	function checkUsername($sender, $param)
11 11
 	{
12 12
 		$manager = $this->Application->Modules['users'];
13
-		if($manager->usernameExists($this->username->Text))
14
-			$param->IsValid = false;
13
+		if($manager->usernameExists($this->username->Text)) {
14
+					$param->IsValid = false;
15
+		}
15 16
 	}
16 17
 
17 18
 	/**
Please login to merge, or discard this patch.
demos/chat/index_php.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,16 +10,21 @@
 block discarded – undo
10 10
 $sqliteDbDir = $basePath."/protected/App_Code";
11 11
 $sqliteDb = $sqliteDbDir."/chat.db";
12 12
 
13
-if(!is_file($frameworkPath))
13
+if(!is_file($frameworkPath)) {
14 14
 	die("Unable to find prado framework path $frameworkPath.");
15
-if(!is_writable($assetsPath))
15
+}
16
+if(!is_writable($assetsPath)) {
16 17
 	die("Please make sure that the directory $assetsPath is writable by Web server process.");
17
-if(!is_writable($runtimePath))
18
+}
19
+if(!is_writable($runtimePath)) {
18 20
 	die("Please make sure that the directory $runtimePath is writable by Web server process.");
19
-if(!is_writable($sqliteDbDir))
21
+}
22
+if(!is_writable($sqliteDbDir)) {
20 23
 	die("Please make sure that the directory $sqliteDbDir is writable by Web server process.");
21
-if(!is_writable($sqliteDb))
24
+}
25
+if(!is_writable($sqliteDb)) {
22 26
 	die("Please make sure that the sqlite file $sqliteDb is writable by Web server process.");
27
+}
23 28
 
24 29
 require_once($frameworkPath);
25 30
 
Please login to merge, or discard this patch.
demos/blog/protected/Pages/SearchPost.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,15 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 	private function getPageOffset()
22 22
 	{
23
-		if(($offset=TPropertyValue::ensureInteger($this->Request['offset']))<=0)
24
-			$offset=0;
23
+		if(($offset=TPropertyValue::ensureInteger($this->Request['offset']))<=0) {
24
+					$offset=0;
25
+		}
25 26
 		return $offset;
26 27
 	}
27 28
 
28 29
 	private function getPageSize()
29 30
 	{
30
-		if(($limit=TPropertyValue::ensureInteger($this->Request['limit']))<=0)
31
-			$limit=TPropertyValue::ensureInteger($this->Application->Parameters['PostPerPage']);
31
+		if(($limit=TPropertyValue::ensureInteger($this->Request['limit']))<=0) {
32
+					$limit=TPropertyValue::ensureInteger($this->Application->Parameters['PostPerPage']);
33
+		}
32 34
 		return $limit;
33 35
 	}
34 36
 
@@ -36,12 +38,15 @@  discard block
 block discarded – undo
36 38
 	{
37 39
 		$gets=array();
38 40
 		$gets['offset']=$newOffset;
39
-		if($this->Request['limit']!==null)
40
-			$gets['limit']=$this->Request['limit'];
41
-		if($this->Request['time']!==null)
42
-			$gets['time']=$this->Request['time'];
43
-		if($this->Request['cat']!==null)
44
-			$gets['cat']=$this->Request['cat'];
41
+		if($this->Request['limit']!==null) {
42
+					$gets['limit']=$this->Request['limit'];
43
+		}
44
+		if($this->Request['time']!==null) {
45
+					$gets['time']=$this->Request['time'];
46
+		}
47
+		if($this->Request['cat']!==null) {
48
+					$gets['cat']=$this->Request['cat'];
49
+		}
45 50
 		return $this->Service->constructUrl('Posts.ListPost',$gets);
46 51
 	}
47 52
 
@@ -52,8 +57,9 @@  discard block
 block discarded – undo
52 57
 		$this->PostList->dataBind();
53 58
 		if($this->getPageOffset()>0)
54 59
 		{
55
-			if(($offset=$this->getPageOffset()-$this->getPageSize())<0)
56
-				$offset=0;
60
+			if(($offset=$this->getPageOffset()-$this->getPageSize())<0) {
61
+							$offset=0;
62
+			}
57 63
 			$this->PrevPage->NavigateUrl=$this->formUrl($offset);
58 64
 			$this->PrevPage->Visible=true;
59 65
 		}
Please login to merge, or discard this patch.
demos/blog/protected/Pages/Users/EditUser.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,13 +26,15 @@  discard block
 block discarded – undo
26 26
 		if(($id=$this->Request['id'])!==null)
27 27
 		{
28 28
 			$id=TPropertyValue::ensureInteger($id);
29
-			if(!$this->User->IsAdmin && $this->User->ID!==$id)
30
-				throw new BlogException(500,'profile_edit_disallowed',$id);
29
+			if(!$this->User->IsAdmin && $this->User->ID!==$id) {
30
+							throw new BlogException(500,'profile_edit_disallowed',$id);
31
+			}
32
+		} else {
33
+					$id=$this->User->ID;
34
+		}
35
+		if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null) {
36
+					throw new BlogException(500,'profile_id_invalid',$id);
31 37
 		}
32
-		else
33
-			$id=$this->User->ID;
34
-		if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
35
-			throw new BlogException(500,'profile_id_invalid',$id);
36 38
 	}
37 39
 
38 40
 	public function onLoad($param)
@@ -53,8 +55,9 @@  discard block
 block discarded – undo
53 55
 		if($this->IsValid)
54 56
 		{
55 57
 			$userRecord=$this->_userRecord;
56
-			if($this->Password->Text!=='')
57
-				$userRecord->Password=md5($this->Password->Text);
58
+			if($this->Password->Text!=='') {
59
+							$userRecord->Password=md5($this->Password->Text);
60
+			}
58 61
 			$userRecord->FullName=$this->FullName->Text;
59 62
 			$userRecord->Email=$this->Email->Text;
60 63
 			$userRecord->Website=$this->Website->Text;
Please login to merge, or discard this patch.
demos/blog/protected/Pages/Users/ViewUser.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,12 +23,14 @@
 block discarded – undo
23 23
 	public function onInit($param)
24 24
 	{
25 25
 		parent::onInit($param);
26
-		if(($id=$this->Request['id'])!==null)
27
-			$id=TPropertyValue::ensureInteger($id);
28
-		else
29
-			$id=$this->User->ID;
30
-		if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
31
-			throw new BlogException(500,'profile_id_invalid',$id);
26
+		if(($id=$this->Request['id'])!==null) {
27
+					$id=TPropertyValue::ensureInteger($id);
28
+		} else {
29
+					$id=$this->User->ID;
30
+		}
31
+		if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null) {
32
+					throw new BlogException(500,'profile_id_invalid',$id);
33
+		}
32 34
 		$this->_userRecord->Email=strtr(strtoupper($this->_userRecord->Email),array('@'=>' at ','.'=>' dot '));
33 35
 	}
34 36
 
Please login to merge, or discard this patch.
demos/blog/protected/Pages/Users/NewUser.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 {
21 21
 	public function onInit($param)
22 22
 	{
23
-		if(!$this->User->IsAdmin && !TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser']))
24
-			throw new BlogException(500,'newuser_registration_disallowed');
23
+		if(!$this->User->IsAdmin && !TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser'])) {
24
+					throw new BlogException(500,'newuser_registration_disallowed');
25
+		}
25 26
 	}
26 27
 
27 28
 	public function checkUsername($sender,$param)
@@ -42,10 +43,11 @@  discard block
 block discarded – undo
42 43
 			$userRecord->Email=$this->Email->Text;
43 44
 			$userRecord->CreateTime=time();
44 45
 			$userRecord->Website=$this->Website->Text;
45
-			if(TPropertyValue::ensureBoolean($this->Application->Parameters['AccountApproval']))
46
-				$userRecord->Status=UserRecord::STATUS_PENDING;
47
-			else
48
-				$userRecord->Status=UserRecord::STATUS_NORMAL;
46
+			if(TPropertyValue::ensureBoolean($this->Application->Parameters['AccountApproval'])) {
47
+							$userRecord->Status=UserRecord::STATUS_PENDING;
48
+			} else {
49
+							$userRecord->Status=UserRecord::STATUS_NORMAL;
50
+			}
49 51
 			$this->DataAccess->insertUser($userRecord);
50 52
 			$authManager=$this->Application->getModule('auth');
51 53
 			$authManager->login($this->Username->Text,$this->Password->Text);
Please login to merge, or discard this patch.
demos/blog/protected/Pages/Posts/EditCategory.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@
 block discarded – undo
25 25
 		parent::onInit($param);
26 26
 		$id=TPropertyValue::ensureInteger($this->Request['id']);
27 27
 		$this->_category=$this->DataAccess->queryCategoryByID($id);
28
-		if($this->_category===null)
29
-			throw new BlogException(500,'category_id_invalid',$id);
28
+		if($this->_category===null) {
29
+					throw new BlogException(500,'category_id_invalid',$id);
30
+		}
30 31
 	}
31 32
 
32 33
 	public function onLoad($param)
Please login to merge, or discard this patch.
demos/blog/protected/Pages/Posts/EditPost.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,11 +25,13 @@  discard block
 block discarded – undo
25 25
 		parent::onInit($param);
26 26
 		$id=TPropertyValue::ensureInteger($this->Request['id']);
27 27
 		$this->_postRecord=$this->DataAccess->queryPostByID($id);
28
-		if($this->_postRecord===null)
29
-			throw new BlogException(500,'post_id_invalid',$id);
28
+		if($this->_postRecord===null) {
29
+					throw new BlogException(500,'post_id_invalid',$id);
30
+		}
30 31
 		// only the author and admin can edit the post
31
-		if(!$this->User->IsAdmin && $this->User->ID!==$this->_postRecord->AuthorID)
32
-			throw new BlogException(500,'post_edit_disallowed',$id);
32
+		if(!$this->User->IsAdmin && $this->User->ID!==$this->_postRecord->AuthorID) {
33
+					throw new BlogException(500,'post_edit_disallowed',$id);
34
+		}
33 35
 	}
34 36
 
35 37
 	public function onLoad($param)
@@ -45,8 +47,9 @@  discard block
 block discarded – undo
45 47
 			$this->Categories->dataBind();
46 48
 			$cats=$this->DataAccess->queryCategoriesByPostID($postRecord->ID);
47 49
 			$catIDs=array();
48
-			foreach($cats as $cat)
49
-				$catIDs[]=$cat->ID;
50
+			foreach($cats as $cat) {
51
+							$catIDs[]=$cat->ID;
52
+			}
50 53
 			$this->Categories->SelectedValues=$catIDs;
51 54
 		}
52 55
 	}
@@ -58,16 +61,18 @@  discard block
 block discarded – undo
58 61
 			$postRecord=$this->_postRecord;
59 62
 			$postRecord->Title=$this->Title->SafeText;
60 63
 			$postRecord->Content=$this->Content->SafeText;
61
-			if($this->DraftMode->Checked)
62
-				$postRecord->Status=PostRecord::STATUS_DRAFT;
63
-			else if(!$this->User->IsAdmin && TPropertyValue::ensureBoolean($this->Application->Parameters['PostApproval']))
64
-				$postRecord->Status=PostRecord::STATUS_PENDING;
65
-			else
66
-				$postRecord->Status=PostRecord::STATUS_PUBLISHED;
64
+			if($this->DraftMode->Checked) {
65
+							$postRecord->Status=PostRecord::STATUS_DRAFT;
66
+			} else if(!$this->User->IsAdmin && TPropertyValue::ensureBoolean($this->Application->Parameters['PostApproval'])) {
67
+							$postRecord->Status=PostRecord::STATUS_PENDING;
68
+			} else {
69
+							$postRecord->Status=PostRecord::STATUS_PUBLISHED;
70
+			}
67 71
 			$postRecord->ModifyTime=time();
68 72
 			$cats=array();
69
-			foreach($this->Categories->SelectedValues as $value)
70
-				$cats[]=TPropertyValue::ensureInteger($value);
73
+			foreach($this->Categories->SelectedValues as $value) {
74
+							$cats[]=TPropertyValue::ensureInteger($value);
75
+			}
71 76
 			$this->DataAccess->updatePost($postRecord,$cats);
72 77
 			$this->gotoPage('Posts.ViewPost',array('id'=>$postRecord->ID));
73 78
 		}
Please login to merge, or discard this patch.