GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 2.8 ( 757b80...f8dd9b )
by Thorsten
86:54 queued 69:27
created
phpmyfaq/admin/editor/plugins/ajaxfilemanager/ajax_image_save.php 3 patches
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -1,201 +1,201 @@
 block discarded – undo
1 1
 <?php
2
-	/**
3
-	 * image save function
4
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
-	 * @link www.phpletter.com
6
-	 * @since 22/May/2007
7
-	 *
8
-	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");	
2
+    /**
3
+     * image save function
4
+     * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
+     * @link www.phpletter.com
6
+     * @since 22/May/2007
7
+     *
8
+     */
9
+    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");	
10 10
 	
11 11
 
12
-	$error = "";
13
-	$info = "";
14
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
15
-	{
16
-		$error = SYS_DISABLED;
17
-	}
18
-	elseif(empty($_POST['path']))
19
-	{
20
-		$error  =  IMG_SAVE_EMPTY_PATH;
21
-	}elseif(!file_exists($_POST['path']))
22
-	{		
23
-		$error  =  IMG_SAVE_NOT_EXISTS;
24
-	}elseif(!isUnderRoot($_POST['path']))
25
-	{
26
-		$error = IMG_SAVE_PATH_DISALLOWED;
27
-	}elseif(($sessionDir = $session->getSessionDir()) == '')
28
-	{
29
-		$error = SESSION_PERSONAL_DIR_NOT_FOUND;
30
-	}
31
-	else
32
-	{	
33
-		require_once(CLASS_HISTORY);
34
-		$history = new History($_POST['path'], $session);
35
-		if(!empty($_POST['mode']))
36
-		{
37
-			//get the original image which is the lastest session image if any when the system is in demo
38
-			$lastestSessionImageInfo = $history->getLastestRestorable();
39
-			if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
40
-			{				
41
-				$originalSessionImageInfo = $history->getOriginalImage();
42
-				if(sizeof($originalSessionImageInfo))
43
-				{					
44
-					$originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
45
-				}				
46
-			}
47
-			if(empty($originalImage))
48
-			{
49
-				$originalImage = $_POST['path'];
50
-			}
12
+    $error = "";
13
+    $info = "";
14
+    if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
15
+    {
16
+        $error = SYS_DISABLED;
17
+    }
18
+    elseif(empty($_POST['path']))
19
+    {
20
+        $error  =  IMG_SAVE_EMPTY_PATH;
21
+    }elseif(!file_exists($_POST['path']))
22
+    {		
23
+        $error  =  IMG_SAVE_NOT_EXISTS;
24
+    }elseif(!isUnderRoot($_POST['path']))
25
+    {
26
+        $error = IMG_SAVE_PATH_DISALLOWED;
27
+    }elseif(($sessionDir = $session->getSessionDir()) == '')
28
+    {
29
+        $error = SESSION_PERSONAL_DIR_NOT_FOUND;
30
+    }
31
+    else
32
+    {	
33
+        require_once(CLASS_HISTORY);
34
+        $history = new History($_POST['path'], $session);
35
+        if(!empty($_POST['mode']))
36
+        {
37
+            //get the original image which is the lastest session image if any when the system is in demo
38
+            $lastestSessionImageInfo = $history->getLastestRestorable();
39
+            if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
40
+            {				
41
+                $originalSessionImageInfo = $history->getOriginalImage();
42
+                if(sizeof($originalSessionImageInfo))
43
+                {					
44
+                    $originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
45
+                }				
46
+            }
47
+            if(empty($originalImage))
48
+            {
49
+                $originalImage = $_POST['path'];
50
+            }
51 51
 			
52
-			include_once(CLASS_IMAGE);
53
-			$image = new Image();
54
-			if($image->loadImage($originalImage))
55
-			{				
52
+            include_once(CLASS_IMAGE);
53
+            $image = new Image();
54
+            if($image->loadImage($originalImage))
55
+            {				
56 56
 				
57
-				switch($_POST['mode'])
58
-				{
59
-					case "resize":					
60
-						if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
61
-						{
62
-							$error = IMG_SAVE_RESIZE_FAILED;
63
-						}					
64
-						break;
65
-					case "crop":	
66
-						if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
67
-						{
68
-							$error = IMG_SAVE_CROP_FAILED;
69
-						}
70
-						break;
71
-					case "flip":
72
-						if(!$image->flip($_POST['flip_angle']))
73
-						{
74
-							$error = IMG_SAVE_FLIP_FAILED;
75
-						}
76
-						break;
77
-					case "rotate":
57
+                switch($_POST['mode'])
58
+                {
59
+                    case "resize":					
60
+                        if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
61
+                        {
62
+                            $error = IMG_SAVE_RESIZE_FAILED;
63
+                        }					
64
+                        break;
65
+                    case "crop":	
66
+                        if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
67
+                        {
68
+                            $error = IMG_SAVE_CROP_FAILED;
69
+                        }
70
+                        break;
71
+                    case "flip":
72
+                        if(!$image->flip($_POST['flip_angle']))
73
+                        {
74
+                            $error = IMG_SAVE_FLIP_FAILED;
75
+                        }
76
+                        break;
77
+                    case "rotate":
78 78
 						
79
-						if(!$image->rotate(intval($_POST['angle'])))
80
-						{
81
-							$error = IMG_SAVE_ROTATE_FAILED;
82
-						}
79
+                        if(!$image->rotate(intval($_POST['angle'])))
80
+                        {
81
+                            $error = IMG_SAVE_ROTATE_FAILED;
82
+                        }
83 83
 						
84
-						break;
85
-					default:
86
-						$error = IMG_SAVE_UNKNOWN_MODE;
87
-				}
84
+                        break;
85
+                    default:
86
+                        $error = IMG_SAVE_UNKNOWN_MODE;
87
+                }
88 88
 				
89 89
 				
90
-				if(empty($error))
91
-				{					
92
-					$sessionNewPath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);					
93
-					if(!@copy($originalImage, $sessionNewPath))
94
-					{//keep a copy under the session folder
95
-						$error = IMG_SAVE_BACKUP_FAILED;						
96
-					}else 
97
-					{
90
+                if(empty($error))
91
+                {					
92
+                    $sessionNewPath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);					
93
+                    if(!@copy($originalImage, $sessionNewPath))
94
+                    {//keep a copy under the session folder
95
+                        $error = IMG_SAVE_BACKUP_FAILED;						
96
+                    }else 
97
+                    {
98 98
 						
99
-						$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
100
-						//save the modified image
101
-						$sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
102
-						$history->add($sessionImageInfo);
103
-						if(CONFIG_SYS_DEMO_ENABLE)
104
-						{//demo only
105
-							if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
106
-							{
107
-								$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
108
-							}else 
109
-							{	
110
-								$imagePath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
111
-							}
112
-						}else 
113
-						{	
114
-							if($isSaveAsRequest)
115
-							{//save as request
116
-								//check save to folder if exists
117
-								if(isset($_POST['save_to']) && strlen($_POST['save_to']))
118
-								{
119
-									$imagePath = $originalImage;
120
-								}else 
121
-								{
122
-									$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); 
123
-								}
99
+                        $isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
100
+                        //save the modified image
101
+                        $sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
102
+                        $history->add($sessionImageInfo);
103
+                        if(CONFIG_SYS_DEMO_ENABLE)
104
+                        {//demo only
105
+                            if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
106
+                            {
107
+                                $imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
108
+                            }else 
109
+                            {	
110
+                                $imagePath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
111
+                            }
112
+                        }else 
113
+                        {	
114
+                            if($isSaveAsRequest)
115
+                            {//save as request
116
+                                //check save to folder if exists
117
+                                if(isset($_POST['save_to']) && strlen($_POST['save_to']))
118
+                                {
119
+                                    $imagePath = $originalImage;
120
+                                }else 
121
+                                {
122
+                                    $imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); 
123
+                                }
124 124
 								
125
-								if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
126
-								{
127
-									$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
128
-								}elseif(file_exists($imagePath)) 
129
-								{
130
-									$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
131
-								}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
132
-								{
133
-									$error = IMG_SAVE_AS_ERR_NAME_INVALID;
134
-								}
125
+                                if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
126
+                                {
127
+                                    $error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
128
+                                }elseif(file_exists($imagePath)) 
129
+                                {
130
+                                    $error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
131
+                                }elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
132
+                                {
133
+                                    $error = IMG_SAVE_AS_ERR_NAME_INVALID;
134
+                                }
135 135
 								
136
-							}else 
137
-							{//save request
138
-								$imagePath = $originalImage;	
139
-							}
136
+                            }else 
137
+                            {//save request
138
+                                $imagePath = $originalImage;	
139
+                            }
140 140
 												
141
-						}
141
+                        }
142 142
 
143
-						if($image->saveImage($imagePath))
144
-						{		
143
+                        if($image->saveImage($imagePath))
144
+                        {		
145 145
 									
146
-							if(CONFIG_SYS_DEMO_ENABLE)
147
-							{
148
-								if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
149
-								{//keep this original image information on session for future reference if demo only	
150
-									$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
151
-									$history->add($originalSessionImageInfo);
152
-								}
153
-							}
154
-							$imageInfo = $image->getFinalImageInfo();								
155
-						}else 
156
-						{
157
-							$error = IMG_SAVE_FAILED;
146
+                            if(CONFIG_SYS_DEMO_ENABLE)
147
+                            {
148
+                                if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
149
+                                {//keep this original image information on session for future reference if demo only	
150
+                                    $originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
151
+                                    $history->add($originalSessionImageInfo);
152
+                                }
153
+                            }
154
+                            $imageInfo = $image->getFinalImageInfo();								
155
+                        }else 
156
+                        {
157
+                            $error = IMG_SAVE_FAILED;
158 158
 							
159
-						}							
160
-						if(isset($imageInfo))
161
-						{
162
-								$info .= ",width:" . $imageInfo['width'] . "";
163
-								$info .= ",height:" . $imageInfo['height'] . "";
164
-								$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
165
-								if($isSaveAsRequest)
166
-								{
167
-									$info .= ",save_as:'1'";
168
-								}else 
169
-								{
170
-									$info .= ",save_as:'0'";
171
-								}
172
-								$info .= ",folder_path:'" . dirname($imagePath) . "'";
173
-								$info .= ",path:'" . backslashToSlash($imagePath) . "'";	
159
+                        }							
160
+                        if(isset($imageInfo))
161
+                        {
162
+                                $info .= ",width:" . $imageInfo['width'] . "";
163
+                                $info .= ",height:" . $imageInfo['height'] . "";
164
+                                $info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
165
+                                if($isSaveAsRequest)
166
+                                {
167
+                                    $info .= ",save_as:'1'";
168
+                                }else 
169
+                                {
170
+                                    $info .= ",save_as:'0'";
171
+                                }
172
+                                $info .= ",folder_path:'" . dirname($imagePath) . "'";
173
+                                $info .= ",path:'" . backslashToSlash($imagePath) . "'";	
174 174
 													
175
-						}				
175
+                        }				
176 176
 			
177
-					}				
177
+                    }				
178 178
 								
179
-				}			
180
-			}else 
181
-			{
182
-				$error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
183
-			}		
179
+                }			
180
+            }else 
181
+            {
182
+                $error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
183
+            }		
184 184
 
185
-		}else 
186
-		{
187
-			$error = IMG_SAVE_UNKNOWN_MODE;
188
-		}
189
-	}
190
-	echo "{";	
191
-	echo "error:'" . $error . "'";
192
-	if(isset($image) && is_object($image))
193
-	{
194
-		$image->DestroyImages();
195
-	}
196
-	echo $info;
197
-	echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0)  . "";
198
-	echo "}";
185
+        }else 
186
+        {
187
+            $error = IMG_SAVE_UNKNOWN_MODE;
188
+        }
189
+    }
190
+    echo "{";	
191
+    echo "error:'" . $error . "'";
192
+    if(isset($image) && is_object($image))
193
+    {
194
+        $image->DestroyImages();
195
+    }
196
+    echo $info;
197
+    echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0)  . "";
198
+    echo "}";
199 199
 	
200 200
 	
201 201
 ?>
202 202
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
 	 * @since 22/May/2007
7 7
 	 *
8 8
 	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");	
9
+	require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");	
10 10
 	
11 11
 
12 12
 	$error = "";
13 13
 	$info = "";
14
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
14
+	if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
15 15
 	{
16 16
 		$error = SYS_DISABLED;
17 17
 	}
18
-	elseif(empty($_POST['path']))
18
+	elseif (empty($_POST['path']))
19 19
 	{
20
-		$error  =  IMG_SAVE_EMPTY_PATH;
21
-	}elseif(!file_exists($_POST['path']))
20
+		$error  = IMG_SAVE_EMPTY_PATH;
21
+	}elseif (!file_exists($_POST['path']))
22 22
 	{		
23
-		$error  =  IMG_SAVE_NOT_EXISTS;
24
-	}elseif(!isUnderRoot($_POST['path']))
23
+		$error  = IMG_SAVE_NOT_EXISTS;
24
+	}elseif (!isUnderRoot($_POST['path']))
25 25
 	{
26 26
 		$error = IMG_SAVE_PATH_DISALLOWED;
27
-	}elseif(($sessionDir = $session->getSessionDir()) == '')
27
+	}elseif (($sessionDir = $session->getSessionDir()) == '')
28 28
 	{
29 29
 		$error = SESSION_PERSONAL_DIR_NOT_FOUND;
30 30
 	}
@@ -32,51 +32,51 @@  discard block
 block discarded – undo
32 32
 	{	
33 33
 		require_once(CLASS_HISTORY);
34 34
 		$history = new History($_POST['path'], $session);
35
-		if(!empty($_POST['mode']))
35
+		if (!empty($_POST['mode']))
36 36
 		{
37 37
 			//get the original image which is the lastest session image if any when the system is in demo
38 38
 			$lastestSessionImageInfo = $history->getLastestRestorable();
39
-			if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
39
+			if (sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
40 40
 			{				
41 41
 				$originalSessionImageInfo = $history->getOriginalImage();
42
-				if(sizeof($originalSessionImageInfo))
42
+				if (sizeof($originalSessionImageInfo))
43 43
 				{					
44
-					$originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
44
+					$originalImage = $sessionDir.$originalSessionImageInfo['info']['name'];
45 45
 				}				
46 46
 			}
47
-			if(empty($originalImage))
47
+			if (empty($originalImage))
48 48
 			{
49 49
 				$originalImage = $_POST['path'];
50 50
 			}
51 51
 			
52 52
 			include_once(CLASS_IMAGE);
53 53
 			$image = new Image();
54
-			if($image->loadImage($originalImage))
54
+			if ($image->loadImage($originalImage))
55 55
 			{				
56 56
 				
57
-				switch($_POST['mode'])
57
+				switch ($_POST['mode'])
58 58
 				{
59 59
 					case "resize":					
60
-						if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
60
+						if (!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint']) ? true : false)))
61 61
 						{
62 62
 							$error = IMG_SAVE_RESIZE_FAILED;
63 63
 						}					
64 64
 						break;
65 65
 					case "crop":	
66
-						if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
66
+						if (!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
67 67
 						{
68 68
 							$error = IMG_SAVE_CROP_FAILED;
69 69
 						}
70 70
 						break;
71 71
 					case "flip":
72
-						if(!$image->flip($_POST['flip_angle']))
72
+						if (!$image->flip($_POST['flip_angle']))
73 73
 						{
74 74
 							$error = IMG_SAVE_FLIP_FAILED;
75 75
 						}
76 76
 						break;
77 77
 					case "rotate":
78 78
 						
79
-						if(!$image->rotate(intval($_POST['angle'])))
79
+						if (!$image->rotate(intval($_POST['angle'])))
80 80
 						{
81 81
 							$error = IMG_SAVE_ROTATE_FAILED;
82 82
 						}
@@ -87,114 +87,114 @@  discard block
 block discarded – undo
87 87
 				}
88 88
 				
89 89
 				
90
-				if(empty($error))
90
+				if (empty($error))
91 91
 				{					
92
-					$sessionNewPath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);					
93
-					if(!@copy($originalImage, $sessionNewPath))
92
+					$sessionNewPath = $sessionDir.uniqid(md5(time())).".".getFileExt($_POST['path']);					
93
+					if (!@copy($originalImage, $sessionNewPath))
94 94
 					{//keep a copy under the session folder
95 95
 						$error = IMG_SAVE_BACKUP_FAILED;						
96
-					}else 
96
+					} else 
97 97
 					{
98 98
 						
99
-						$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
99
+						$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to']) ? true : false);
100 100
 						//save the modified image
101 101
 						$sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
102 102
 						$history->add($sessionImageInfo);
103
-						if(CONFIG_SYS_DEMO_ENABLE)
103
+						if (CONFIG_SYS_DEMO_ENABLE)
104 104
 						{//demo only
105
-							if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
105
+							if (isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
106 106
 							{
107
-								$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
108
-							}else 
107
+								$imagePath = $sessionDir.$originalSessionImageInfo['info']['name'];
108
+							} else 
109 109
 							{	
110
-								$imagePath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
110
+								$imagePath = $sessionDir.uniqid(md5(time())).".".getFileExt($_POST['path']);
111 111
 							}
112
-						}else 
112
+						} else 
113 113
 						{	
114
-							if($isSaveAsRequest)
114
+							if ($isSaveAsRequest)
115 115
 							{//save as request
116 116
 								//check save to folder if exists
117
-								if(isset($_POST['save_to']) && strlen($_POST['save_to']))
117
+								if (isset($_POST['save_to']) && strlen($_POST['save_to']))
118 118
 								{
119 119
 									$imagePath = $originalImage;
120
-								}else 
120
+								} else 
121 121
 								{
122
-									$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); 
122
+									$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])).$_POST['new_name'].".".getFileExt($_POST['path']); 
123 123
 								}
124 124
 								
125
-								if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
125
+								if (!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
126 126
 								{
127 127
 									$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
128
-								}elseif(file_exists($imagePath)) 
128
+								}elseif (file_exists($imagePath)) 
129 129
 								{
130 130
 									$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
131
-								}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
131
+								}elseif (!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
132 132
 								{
133 133
 									$error = IMG_SAVE_AS_ERR_NAME_INVALID;
134 134
 								}
135 135
 								
136
-							}else 
136
+							} else 
137 137
 							{//save request
138 138
 								$imagePath = $originalImage;	
139 139
 							}
140 140
 												
141 141
 						}
142 142
 
143
-						if($image->saveImage($imagePath))
143
+						if ($image->saveImage($imagePath))
144 144
 						{		
145 145
 									
146
-							if(CONFIG_SYS_DEMO_ENABLE)
146
+							if (CONFIG_SYS_DEMO_ENABLE)
147 147
 							{
148
-								if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
148
+								if (!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
149 149
 								{//keep this original image information on session for future reference if demo only	
150 150
 									$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
151 151
 									$history->add($originalSessionImageInfo);
152 152
 								}
153 153
 							}
154 154
 							$imageInfo = $image->getFinalImageInfo();								
155
-						}else 
155
+						} else 
156 156
 						{
157 157
 							$error = IMG_SAVE_FAILED;
158 158
 							
159 159
 						}							
160
-						if(isset($imageInfo))
160
+						if (isset($imageInfo))
161 161
 						{
162
-								$info .= ",width:" . $imageInfo['width'] . "";
163
-								$info .= ",height:" . $imageInfo['height'] . "";
164
-								$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
165
-								if($isSaveAsRequest)
162
+								$info .= ",width:".$imageInfo['width']."";
163
+								$info .= ",height:".$imageInfo['height']."";
164
+								$info .= ",size:'".transformFileSize($imageInfo['size'])."'";
165
+								if ($isSaveAsRequest)
166 166
 								{
167 167
 									$info .= ",save_as:'1'";
168
-								}else 
168
+								} else 
169 169
 								{
170 170
 									$info .= ",save_as:'0'";
171 171
 								}
172
-								$info .= ",folder_path:'" . dirname($imagePath) . "'";
173
-								$info .= ",path:'" . backslashToSlash($imagePath) . "'";	
172
+								$info .= ",folder_path:'".dirname($imagePath)."'";
173
+								$info .= ",path:'".backslashToSlash($imagePath)."'";	
174 174
 													
175 175
 						}				
176 176
 			
177 177
 					}				
178 178
 								
179 179
 				}			
180
-			}else 
180
+			} else 
181 181
 			{
182
-				$error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
182
+				$error = IMG_SAVE_IMG_OPEN_FAILED.$originalImage;
183 183
 			}		
184 184
 
185
-		}else 
185
+		} else 
186 186
 		{
187 187
 			$error = IMG_SAVE_UNKNOWN_MODE;
188 188
 		}
189 189
 	}
190 190
 	echo "{";	
191
-	echo "error:'" . $error . "'";
192
-	if(isset($image) && is_object($image))
191
+	echo "error:'".$error."'";
192
+	if (isset($image) && is_object($image))
193 193
 	{
194 194
 		$image->DestroyImages();
195 195
 	}
196 196
 	echo $info;
197
-	echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0)  . "";
197
+	echo ",history:".(isset($history) && is_object($history) ? ($history->getNumRestorable()) : 0)."";
198 198
 	echo "}";
199 199
 	
200 200
 	
Please login to merge, or discard this patch.
Braces   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,21 +14,19 @@  discard block
 block discarded – undo
14 14
 	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
15 15
 	{
16 16
 		$error = SYS_DISABLED;
17
-	}
18
-	elseif(empty($_POST['path']))
17
+	} elseif(empty($_POST['path']))
19 18
 	{
20 19
 		$error  =  IMG_SAVE_EMPTY_PATH;
21
-	}elseif(!file_exists($_POST['path']))
20
+	} elseif(!file_exists($_POST['path']))
22 21
 	{		
23 22
 		$error  =  IMG_SAVE_NOT_EXISTS;
24
-	}elseif(!isUnderRoot($_POST['path']))
23
+	} elseif(!isUnderRoot($_POST['path']))
25 24
 	{
26 25
 		$error = IMG_SAVE_PATH_DISALLOWED;
27
-	}elseif(($sessionDir = $session->getSessionDir()) == '')
26
+	} elseif(($sessionDir = $session->getSessionDir()) == '')
28 27
 	{
29 28
 		$error = SESSION_PERSONAL_DIR_NOT_FOUND;
30
-	}
31
-	else
29
+	} else
32 30
 	{	
33 31
 		require_once(CLASS_HISTORY);
34 32
 		$history = new History($_POST['path'], $session);
@@ -93,7 +91,7 @@  discard block
 block discarded – undo
93 91
 					if(!@copy($originalImage, $sessionNewPath))
94 92
 					{//keep a copy under the session folder
95 93
 						$error = IMG_SAVE_BACKUP_FAILED;						
96
-					}else 
94
+					} else 
97 95
 					{
98 96
 						
99 97
 						$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
@@ -105,11 +103,11 @@  discard block
 block discarded – undo
105 103
 							if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
106 104
 							{
107 105
 								$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
108
-							}else 
106
+							} else 
109 107
 							{	
110 108
 								$imagePath = $sessionDir  . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
111 109
 							}
112
-						}else 
110
+						} else 
113 111
 						{	
114 112
 							if($isSaveAsRequest)
115 113
 							{//save as request
@@ -117,7 +115,7 @@  discard block
 block discarded – undo
117 115
 								if(isset($_POST['save_to']) && strlen($_POST['save_to']))
118 116
 								{
119 117
 									$imagePath = $originalImage;
120
-								}else 
118
+								} else 
121 119
 								{
122 120
 									$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']); 
123 121
 								}
@@ -125,15 +123,15 @@  discard block
 block discarded – undo
125 123
 								if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
126 124
 								{
127 125
 									$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
128
-								}elseif(file_exists($imagePath)) 
126
+								} elseif(file_exists($imagePath)) 
129 127
 								{
130 128
 									$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
131
-								}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
129
+								} elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
132 130
 								{
133 131
 									$error = IMG_SAVE_AS_ERR_NAME_INVALID;
134 132
 								}
135 133
 								
136
-							}else 
134
+							} else 
137 135
 							{//save request
138 136
 								$imagePath = $originalImage;	
139 137
 							}
@@ -152,7 +150,7 @@  discard block
 block discarded – undo
152 150
 								}
153 151
 							}
154 152
 							$imageInfo = $image->getFinalImageInfo();								
155
-						}else 
153
+						} else 
156 154
 						{
157 155
 							$error = IMG_SAVE_FAILED;
158 156
 							
@@ -165,7 +163,7 @@  discard block
 block discarded – undo
165 163
 								if($isSaveAsRequest)
166 164
 								{
167 165
 									$info .= ",save_as:'1'";
168
-								}else 
166
+								} else 
169 167
 								{
170 168
 									$info .= ",save_as:'0'";
171 169
 								}
@@ -177,12 +175,12 @@  discard block
 block discarded – undo
177 175
 					}				
178 176
 								
179 177
 				}			
180
-			}else 
178
+			} else 
181 179
 			{
182 180
 				$error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
183 181
 			}		
184 182
 
185
-		}else 
183
+		} else 
186 184
 		{
187 185
 			$error = IMG_SAVE_UNKNOWN_MODE;
188 186
 		}
Please login to merge, or discard this patch.
phpmyfaq/admin/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
3
-	echo '{';
4
-	$count = 1;
5
-	foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
6
-	{
2
+    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
3
+    echo '{';
4
+    $count = 1;
5
+    foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
6
+    {
7 7
 		
8 8
 
9
-		echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; 
10
-		$count++;
11
-	}
12
-	echo "}";
9
+        echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; 
10
+        $count++;
11
+    }
12
+    echo "}";
13 13
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
2
+	require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
3 3
 	echo '{';
4 4
 	$count = 1;
5
-	foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
5
+	foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
6 6
 	{
7 7
 		
8 8
 
9
-		echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; 
9
+		echo (($count > 1) ? ', ' : '')."'".$v."':'".$k."'"; 
10 10
 		$count++;
11 11
 	}
12 12
 	echo "}";
Please login to merge, or discard this patch.
phpmyfaq/admin/editor/plugins/ajaxfilemanager/_ajax_load_folders.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2
-	if(!defined('AJAX_INIT_DONE'))
3
-	{
4
-		die('Permission denied');
5
-	}
2
+    if(!defined('AJAX_INIT_DONE'))
3
+    {
4
+        die('Permission denied');
5
+    }
6 6
 ?><?php
7
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
7
+    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
8 8
 ?>
9 9
 <select class="input inputSearch" name="search_folder" id="search_folder">
10 10
 	<?php 
11 11
 	
12
-					foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
13
-					{
14
-						?>
12
+                    foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
13
+                    {
14
+                        ?>
15 15
       <option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
16 16
       <?php 
17
-					}
17
+                    }
18 18
 		
19
-				?>            	
19
+                ?>            	
20 20
 </select>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2
-	if(!defined('AJAX_INIT_DONE'))
2
+	if (!defined('AJAX_INIT_DONE'))
3 3
 	{
4 4
 		die('Permission denied');
5 5
 	}
6 6
 ?><?php
7
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
7
+	require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
8 8
 ?>
9 9
 <select class="input inputSearch" name="search_folder" id="search_folder">
10 10
 	<?php 
11 11
 	
12
-					foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
12
+					foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
13 13
 					{
14 14
 						?>
15 15
       <option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
Please login to merge, or discard this patch.
phpmyfaq/admin/editor/plugins/ajaxfilemanager/ajax_save_name.php 3 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -1,81 +1,81 @@
 block discarded – undo
1 1
 <?php
2
-	/**
3
-	 * ajax save name
4
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
-	 * @link www.phpletter.com
6
-	 * @since 22/May/2007
7
-	 *
8
-	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
10
-	$error = '';
11
-	$fileInfo = array();
12
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
13
-	{
14
-		$error = SYS_DISABLED;
15
-	}
16
-	elseif(empty($_POST['name']))
17
-	{
18
-		$error = ERR_RENAME_EMPTY;
19
-	}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
20
-	{
21
-		$error = ERR_RENAME_FORMAT;
22
-	}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
23
-	{
24
-		$error = ERR_RENAME_FILE_NOT_EXISTS;
25
-	}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
26
-	{
27
-		$error = ERR_NO_CHANGES_MADE;
28
-	}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
29
-	{
30
-		$error = ERR_RENAME_EXISTS;
31
-	}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
32
-	{
33
-		$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
34
-	}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
35
-	{
36
-		$error = ERR_RENAME_FAILED;
37
-	}else 
38
-	{
39
-		//update record of session if image exists in session for cut or copy
40
-		include_once(CLASS_SESSION_ACTION);
41
-		$sessionAction = new SessionAction();		
42
-		$selectedDocuments = $sessionAction->get();
43
-		if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
44
-		{
45
-			if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
46
-			{
47
-				$selectedDocuments[$key] = $_POST['name'];
48
-				$sessionAction->set($selectedDocuments);
2
+    /**
3
+     * ajax save name
4
+     * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
+     * @link www.phpletter.com
6
+     * @since 22/May/2007
7
+     *
8
+     */
9
+    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
10
+    $error = '';
11
+    $fileInfo = array();
12
+    if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
13
+    {
14
+        $error = SYS_DISABLED;
15
+    }
16
+    elseif(empty($_POST['name']))
17
+    {
18
+        $error = ERR_RENAME_EMPTY;
19
+    }elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
20
+    {
21
+        $error = ERR_RENAME_FORMAT;
22
+    }elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
23
+    {
24
+        $error = ERR_RENAME_FILE_NOT_EXISTS;
25
+    }elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
26
+    {
27
+        $error = ERR_NO_CHANGES_MADE;
28
+    }elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
29
+    {
30
+        $error = ERR_RENAME_EXISTS;
31
+    }elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
32
+    {
33
+        $error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
34
+    }elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
35
+    {
36
+        $error = ERR_RENAME_FAILED;
37
+    }else 
38
+    {
39
+        //update record of session if image exists in session for cut or copy
40
+        include_once(CLASS_SESSION_ACTION);
41
+        $sessionAction = new SessionAction();		
42
+        $selectedDocuments = $sessionAction->get();
43
+        if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
44
+        {
45
+            if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
46
+            {
47
+                $selectedDocuments[$key] = $_POST['name'];
48
+                $sessionAction->set($selectedDocuments);
49 49
 				
50
-			}
50
+            }
51 51
 			
52
-		}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
53
-		{
54
-			$sessionAction->setFolder($_POST['original_path']);
55
-		}	
56
-		$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
57
-		if(is_file($path))
58
-		{
59
-			include_once(CLASS_FILE);
60
-			$file = new file($path);
61
-			$fileInfo = $file->getFileInfo();
62
-			$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
63
-		}else
64
-		{
65
-			include_once(CLASS_MANAGER);
66
-			$manager = new manager($path, false);
67
-			$fileInfo = $manager->getFolderInfo();
68
-			$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
69
-		}
70
-	}
52
+        }elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
53
+        {
54
+            $sessionAction->setFolder($_POST['original_path']);
55
+        }	
56
+        $path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
57
+        if(is_file($path))
58
+        {
59
+            include_once(CLASS_FILE);
60
+            $file = new file($path);
61
+            $fileInfo = $file->getFileInfo();
62
+            $fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
63
+        }else
64
+        {
65
+            include_once(CLASS_MANAGER);
66
+            $manager = new manager($path, false);
67
+            $fileInfo = $manager->getFolderInfo();
68
+            $fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
69
+        }
70
+    }
71 71
 	
72
-	echo "{";
73
-	echo "error:'" . $error . "' ";
74
-	foreach ($fileInfo as $k=>$v)
75
-	{
76
-		echo "," . $k . ":'" . $v . "' ";
77
-	}
78
-	echo "}";
72
+    echo "{";
73
+    echo "error:'" . $error . "' ";
74
+    foreach ($fileInfo as $k=>$v)
75
+    {
76
+        echo "," . $k . ":'" . $v . "' ";
77
+    }
78
+    echo "}";
79 79
 	
80 80
 	
81 81
 ?>
82 82
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,74 +6,74 @@
 block discarded – undo
6 6
 	 * @since 22/May/2007
7 7
 	 *
8 8
 	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
9
+	require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
10 10
 	$error = '';
11 11
 	$fileInfo = array();
12
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
12
+	if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
13 13
 	{
14 14
 		$error = SYS_DISABLED;
15 15
 	}
16
-	elseif(empty($_POST['name']))
16
+	elseif (empty($_POST['name']))
17 17
 	{
18 18
 		$error = ERR_RENAME_EMPTY;
19
-	}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
19
+	}elseif (!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
20 20
 	{
21 21
 		$error = ERR_RENAME_FORMAT;
22
-	}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
22
+	}elseif (empty($_POST['original_path']) || !file_exists($_POST['original_path']))
23 23
 	{
24 24
 		$error = ERR_RENAME_FILE_NOT_EXISTS;
25
-	}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
25
+	}elseif (substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
26 26
 	{
27 27
 		$error = ERR_NO_CHANGES_MADE;
28
-	}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
28
+	}elseif (file_exists(addTrailingSlash(getParentPath($_POST['original_path'])).$_POST['name']))
29 29
 	{
30 30
 		$error = ERR_RENAME_EXISTS;
31
-	}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
31
+	}elseif (is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
32 32
 	{
33 33
 		$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
34
-	}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
34
+	}elseif (!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])).$_POST['name']))
35 35
 	{
36 36
 		$error = ERR_RENAME_FAILED;
37
-	}else 
37
+	} else 
38 38
 	{
39 39
 		//update record of session if image exists in session for cut or copy
40 40
 		include_once(CLASS_SESSION_ACTION);
41 41
 		$sessionAction = new SessionAction();		
42 42
 		$selectedDocuments = $sessionAction->get();
43
-		if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
43
+		if (removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
44 44
 		{
45
-			if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
45
+			if (($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
46 46
 			{
47 47
 				$selectedDocuments[$key] = $_POST['name'];
48 48
 				$sessionAction->set($selectedDocuments);
49 49
 				
50 50
 			}
51 51
 			
52
-		}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
52
+		}elseif (removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
53 53
 		{
54 54
 			$sessionAction->setFolder($_POST['original_path']);
55 55
 		}	
56
-		$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
57
-		if(is_file($path))
56
+		$path = addTrailingSlash(getParentPath($_POST['original_path'])).$_POST['name'];
57
+		if (is_file($path))
58 58
 		{
59 59
 			include_once(CLASS_FILE);
60 60
 			$file = new file($path);
61 61
 			$fileInfo = $file->getFileInfo();
62
-			$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
63
-		}else
62
+			$fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
63
+		} else
64 64
 		{
65 65
 			include_once(CLASS_MANAGER);
66 66
 			$manager = new manager($path, false);
67 67
 			$fileInfo = $manager->getFolderInfo();
68
-			$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
68
+			$fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
69 69
 		}
70 70
 	}
71 71
 	
72 72
 	echo "{";
73
-	echo "error:'" . $error . "' ";
73
+	echo "error:'".$error."' ";
74 74
 	foreach ($fileInfo as $k=>$v)
75 75
 	{
76
-		echo "," . $k . ":'" . $v . "' ";
76
+		echo ",".$k.":'".$v."' ";
77 77
 	}
78 78
 	echo "}";
79 79
 	
Please login to merge, or discard this patch.
Braces   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,29 +12,28 @@  discard block
 block discarded – undo
12 12
 	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
13 13
 	{
14 14
 		$error = SYS_DISABLED;
15
-	}
16
-	elseif(empty($_POST['name']))
15
+	} elseif(empty($_POST['name']))
17 16
 	{
18 17
 		$error = ERR_RENAME_EMPTY;
19
-	}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
18
+	} elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
20 19
 	{
21 20
 		$error = ERR_RENAME_FORMAT;
22
-	}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
21
+	} elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
23 22
 	{
24 23
 		$error = ERR_RENAME_FILE_NOT_EXISTS;
25
-	}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
24
+	} elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
26 25
 	{
27 26
 		$error = ERR_NO_CHANGES_MADE;
28
-	}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
27
+	} elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
29 28
 	{
30 29
 		$error = ERR_RENAME_EXISTS;
31
-	}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
30
+	} elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
32 31
 	{
33 32
 		$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
34
-	}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
33
+	} elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
35 34
 	{
36 35
 		$error = ERR_RENAME_FAILED;
37
-	}else 
36
+	} else 
38 37
 	{
39 38
 		//update record of session if image exists in session for cut or copy
40 39
 		include_once(CLASS_SESSION_ACTION);
@@ -49,7 +48,7 @@  discard block
 block discarded – undo
49 48
 				
50 49
 			}
51 50
 			
52
-		}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
51
+		} elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
53 52
 		{
54 53
 			$sessionAction->setFolder($_POST['original_path']);
55 54
 		}	
@@ -60,7 +59,7 @@  discard block
 block discarded – undo
60 59
 			$file = new file($path);
61 60
 			$fileInfo = $file->getFileInfo();
62 61
 			$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
63
-		}else
62
+		} else
64 63
 		{
65 64
 			include_once(CLASS_MANAGER);
66 65
 			$manager = new manager($path, false);
Please login to merge, or discard this patch.
phpmyfaq/admin/editor/plugins/ajaxfilemanager/ajax_save_text.php 3 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -1,88 +1,88 @@
 block discarded – undo
1 1
 <?php
2
-	/**
3
-	 * ajax save name
4
-	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
-	 * @link www.phpletter.com
6
-	 * @since 22/May/2007
7
-	 *
8
-	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
10
-	$error = '';
11
-	$path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
12
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
13
-	{
14
-		$error = SYS_DISABLED;
15
-	}
16
-	elseif(isset($_POST['save_as_request']))
17
-	{		
18
-		if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
19
-		{
20
-			$error = TXT_SAVE_AS_ERR_NAME_INVALID;
21
-		}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
22
-		{
23
-			$error = TXT_DISALLOWED_EXT;
24
-		}elseif(!isUnderRoot($_POST['folder']))
25
-		{
26
-			$error = ERR_FOLDER_PATH_NOT_ALLOWED;
27
-		}
28
-		else
29
-		{
2
+    /**
3
+     * ajax save name
4
+     * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
5
+     * @link www.phpletter.com
6
+     * @since 22/May/2007
7
+     *
8
+     */
9
+    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
10
+    $error = '';
11
+    $path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
12
+    if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
13
+    {
14
+        $error = SYS_DISABLED;
15
+    }
16
+    elseif(isset($_POST['save_as_request']))
17
+    {		
18
+        if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
19
+        {
20
+            $error = TXT_SAVE_AS_ERR_NAME_INVALID;
21
+        }elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
22
+        {
23
+            $error = TXT_DISALLOWED_EXT;
24
+        }elseif(!isUnderRoot($_POST['folder']))
25
+        {
26
+            $error = ERR_FOLDER_PATH_NOT_ALLOWED;
27
+        }
28
+        else
29
+        {
30 30
 			
31
-			if(!empty($_POST['save_as_request']))
32
-			{//save as request
33
-				if(file_exists($path))
34
-				{
35
-					$error = TXT_FILE_EXIST;
36
-				}else 
37
-				{
38
-					if(($fp = @fopen($path, 'w+')) !== false)
39
-					{
40
-						if(@fwrite($fp, $_POST['text']))
41
-						{
42
-							@fclose($fp);
43
-						}else 
44
-						{
45
-							$error = TXT_CONTENT_WRITE_FAILED;
46
-						}
47
-					}else 
48
-					{
49
-						$error = TXT_CREATE_FAILED;
50
-					}					
51
-				}
31
+            if(!empty($_POST['save_as_request']))
32
+            {//save as request
33
+                if(file_exists($path))
34
+                {
35
+                    $error = TXT_FILE_EXIST;
36
+                }else 
37
+                {
38
+                    if(($fp = @fopen($path, 'w+')) !== false)
39
+                    {
40
+                        if(@fwrite($fp, $_POST['text']))
41
+                        {
42
+                            @fclose($fp);
43
+                        }else 
44
+                        {
45
+                            $error = TXT_CONTENT_WRITE_FAILED;
46
+                        }
47
+                    }else 
48
+                    {
49
+                        $error = TXT_CREATE_FAILED;
50
+                    }					
51
+                }
52 52
 
53 53
 				
54
-			}else 
55
-			{
56
-				if(!file_exists($path))
57
-				{
58
-					$error = TXT_FILE_NOT_EXIST;
59
-				}else 
60
-				{
61
-					if(($fp = @fopen($path, 'w')) !== false)
62
-					{
63
-						if(@fwrite($fp, $_POST['text']))
64
-						{
65
-							@fclose($fp);
66
-						}else 
67
-						{
68
-							$error = TXT_CONTENT_UPDATE_FAILED;
69
-						}
70
-					}else 
71
-					{
72
-						$error = TXT_FILE_OPEN_FAILED;
73
-					}						
74
-				}
75
-			}
54
+            }else 
55
+            {
56
+                if(!file_exists($path))
57
+                {
58
+                    $error = TXT_FILE_NOT_EXIST;
59
+                }else 
60
+                {
61
+                    if(($fp = @fopen($path, 'w')) !== false)
62
+                    {
63
+                        if(@fwrite($fp, $_POST['text']))
64
+                        {
65
+                            @fclose($fp);
66
+                        }else 
67
+                        {
68
+                            $error = TXT_CONTENT_UPDATE_FAILED;
69
+                        }
70
+                    }else 
71
+                    {
72
+                        $error = TXT_FILE_OPEN_FAILED;
73
+                    }						
74
+                }
75
+            }
76 76
 			
77
-		}
77
+        }
78 78
 
79
-	}else 
80
-	{
81
-		$error = TXT_UNKNOWN_REQUEST;
82
-	}
83
-		echo "{";
84
-		echo "error:'" . $error . "',\n";
85
-		echo  "path:'" . $path . "'";
86
-		echo "}";
79
+    }else 
80
+    {
81
+        $error = TXT_UNKNOWN_REQUEST;
82
+    }
83
+        echo "{";
84
+        echo "error:'" . $error . "',\n";
85
+        echo  "path:'" . $path . "'";
86
+        echo "}";
87 87
 	
88 88
 ?>
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,68 +6,68 @@  discard block
 block discarded – undo
6 6
 	 * @since 22/May/2007
7 7
 	 *
8 8
 	 */
9
-	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
9
+	require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
10 10
 	$error = '';
11
-	$path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
12
-	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
11
+	$path = addTrailingSlash(backslashToSlash($_POST['folder'])).$_POST['name'];
12
+	if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
13 13
 	{
14 14
 		$error = SYS_DISABLED;
15 15
 	}
16
-	elseif(isset($_POST['save_as_request']))
16
+	elseif (isset($_POST['save_as_request']))
17 17
 	{		
18
-		if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
18
+		if (!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
19 19
 		{
20 20
 			$error = TXT_SAVE_AS_ERR_NAME_INVALID;
21
-		}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
21
+		}elseif (array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
22 22
 		{
23 23
 			$error = TXT_DISALLOWED_EXT;
24
-		}elseif(!isUnderRoot($_POST['folder']))
24
+		}elseif (!isUnderRoot($_POST['folder']))
25 25
 		{
26 26
 			$error = ERR_FOLDER_PATH_NOT_ALLOWED;
27 27
 		}
28 28
 		else
29 29
 		{
30 30
 			
31
-			if(!empty($_POST['save_as_request']))
31
+			if (!empty($_POST['save_as_request']))
32 32
 			{//save as request
33
-				if(file_exists($path))
33
+				if (file_exists($path))
34 34
 				{
35 35
 					$error = TXT_FILE_EXIST;
36
-				}else 
36
+				} else 
37 37
 				{
38
-					if(($fp = @fopen($path, 'w+')) !== false)
38
+					if (($fp = @fopen($path, 'w+')) !== false)
39 39
 					{
40
-						if(@fwrite($fp, $_POST['text']))
40
+						if (@fwrite($fp, $_POST['text']))
41 41
 						{
42 42
 							@fclose($fp);
43
-						}else 
43
+						} else 
44 44
 						{
45 45
 							$error = TXT_CONTENT_WRITE_FAILED;
46 46
 						}
47
-					}else 
47
+					} else 
48 48
 					{
49 49
 						$error = TXT_CREATE_FAILED;
50 50
 					}					
51 51
 				}
52 52
 
53 53
 				
54
-			}else 
54
+			} else 
55 55
 			{
56
-				if(!file_exists($path))
56
+				if (!file_exists($path))
57 57
 				{
58 58
 					$error = TXT_FILE_NOT_EXIST;
59
-				}else 
59
+				} else 
60 60
 				{
61
-					if(($fp = @fopen($path, 'w')) !== false)
61
+					if (($fp = @fopen($path, 'w')) !== false)
62 62
 					{
63
-						if(@fwrite($fp, $_POST['text']))
63
+						if (@fwrite($fp, $_POST['text']))
64 64
 						{
65 65
 							@fclose($fp);
66
-						}else 
66
+						} else 
67 67
 						{
68 68
 							$error = TXT_CONTENT_UPDATE_FAILED;
69 69
 						}
70
-					}else 
70
+					} else 
71 71
 					{
72 72
 						$error = TXT_FILE_OPEN_FAILED;
73 73
 					}						
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 			
77 77
 		}
78 78
 
79
-	}else 
79
+	} else 
80 80
 	{
81 81
 		$error = TXT_UNKNOWN_REQUEST;
82 82
 	}
83 83
 		echo "{";
84
-		echo "error:'" . $error . "',\n";
85
-		echo  "path:'" . $path . "'";
84
+		echo "error:'".$error."',\n";
85
+		echo  "path:'".$path."'";
86 86
 		echo "}";
87 87
 	
88 88
 ?>
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,20 +12,18 @@  discard block
 block discarded – undo
12 12
 	if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
13 13
 	{
14 14
 		$error = SYS_DISABLED;
15
-	}
16
-	elseif(isset($_POST['save_as_request']))
15
+	} elseif(isset($_POST['save_as_request']))
17 16
 	{		
18 17
 		if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
19 18
 		{
20 19
 			$error = TXT_SAVE_AS_ERR_NAME_INVALID;
21
-		}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
20
+		} elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
22 21
 		{
23 22
 			$error = TXT_DISALLOWED_EXT;
24
-		}elseif(!isUnderRoot($_POST['folder']))
23
+		} elseif(!isUnderRoot($_POST['folder']))
25 24
 		{
26 25
 			$error = ERR_FOLDER_PATH_NOT_ALLOWED;
27
-		}
28
-		else
26
+		} else
29 27
 		{
30 28
 			
31 29
 			if(!empty($_POST['save_as_request']))
@@ -33,41 +31,41 @@  discard block
 block discarded – undo
33 31
 				if(file_exists($path))
34 32
 				{
35 33
 					$error = TXT_FILE_EXIST;
36
-				}else 
34
+				} else 
37 35
 				{
38 36
 					if(($fp = @fopen($path, 'w+')) !== false)
39 37
 					{
40 38
 						if(@fwrite($fp, $_POST['text']))
41 39
 						{
42 40
 							@fclose($fp);
43
-						}else 
41
+						} else 
44 42
 						{
45 43
 							$error = TXT_CONTENT_WRITE_FAILED;
46 44
 						}
47
-					}else 
45
+					} else 
48 46
 					{
49 47
 						$error = TXT_CREATE_FAILED;
50 48
 					}					
51 49
 				}
52 50
 
53 51
 				
54
-			}else 
52
+			} else 
55 53
 			{
56 54
 				if(!file_exists($path))
57 55
 				{
58 56
 					$error = TXT_FILE_NOT_EXIST;
59
-				}else 
57
+				} else 
60 58
 				{
61 59
 					if(($fp = @fopen($path, 'w')) !== false)
62 60
 					{
63 61
 						if(@fwrite($fp, $_POST['text']))
64 62
 						{
65 63
 							@fclose($fp);
66
-						}else 
64
+						} else 
67 65
 						{
68 66
 							$error = TXT_CONTENT_UPDATE_FAILED;
69 67
 						}
70
-					}else 
68
+					} else 
71 69
 					{
72 70
 						$error = TXT_FILE_OPEN_FAILED;
73 71
 					}						
@@ -76,7 +74,7 @@  discard block
 block discarded – undo
76 74
 			
77 75
 		}
78 76
 
79
-	}else 
77
+	} else 
80 78
 	{
81 79
 		$error = TXT_UNKNOWN_REQUEST;
82 80
 	}
Please login to merge, or discard this patch.
phpmyfaq/admin/editor/plugins/phpmyfaq/dialog.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
 define('PMF_ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__)))));
19 19
 define('IS_VALID_PHPMYFAQ', null);
20 20
 
21
-require PMF_ROOT_DIR . '/inc/Bootstrap.php';
21
+require PMF_ROOT_DIR.'/inc/Bootstrap.php';
22 22
 
23 23
 $user = PMF_User_CurrentUser::getFromCookie($faqConfig);
24
-if (! $user instanceof PMF_User_CurrentUser) {
24
+if (!$user instanceof PMF_User_CurrentUser) {
25 25
     $user = PMF_User_CurrentUser::getFromSession($faqConfig);
26 26
 }
27 27
 
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.config_list.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                         echo PMF_Language::languageOptions(
99 99
                             str_replace(
100 100
                                 array(
101
-                                     'language_',
102
-                                     '.php'
101
+                                        'language_',
102
+                                        '.php'
103 103
                                 ),
104 104
                                 '',
105 105
                                 $faqConfig->get('main.language')
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                     } else {
111 111
                         echo '<option value="language_en.php">English</option>';
112 112
                     }
113
-                   break;
113
+                    break;
114 114
                 
115 115
                 case 'records.orderby':
116 116
                     echo PMF_Configuration::sortingOptions($faqConfig->get($key));
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                                   ? ' selected="selected"'
148 148
                                   : '';
149 149
                         printf('<option value="%d"%s>%s</option>',
150
-                               $i, $selected, $item);
150
+                                $i, $selected, $item);
151 151
                     }
152 152
                     break;
153 153
                     
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (!defined('IS_VALID_PHPMYFAQ')) {
22 22
     $protocol = 'http';
23
-    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
23
+    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
24 24
         $protocol = 'https';
25 25
     }
26
-    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
26
+    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
27 27
     exit();
28 28
 }
29 29
 
30
-require PMF_ROOT_DIR . '/inc/libs/twitteroauth/twitteroauth.php';
30
+require PMF_ROOT_DIR.'/inc/libs/twitteroauth/twitteroauth.php';
31 31
 
32 32
 if (!empty($_SESSION['access_token'])) {
33 33
     $connection = new TwitterOAuth(
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                     $templates = $faqSystem->getAvailableTemplates();
135 135
 
136 136
                     foreach ($templates as $template => $selected) {
137
-                        printf ("<option%s>%s</option>",
137
+                        printf("<option%s>%s</option>",
138 138
                             ($selected === true ? ' selected="selected"' : ''),
139 139
                             $template
140 140
                         );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     break;
143 143
                     
144 144
                 case "records.attachmentsStorageType":
145
-                    foreach($PMF_LANG['att_storage_type'] as $i => $item) {
145
+                    foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
146 146
                         $selected = $faqConfig->get($key) == $i
147 147
                                   ? ' selected="selected"'
148 148
                                   : '';
@@ -226,18 +226,18 @@  discard block
 block discarded – undo
226 226
 
227 227
                 echo '<a target="_blank" href="https://dev.twitter.com/apps/new">Create Twitter App for your FAQ</a>';
228 228
                 echo "<br />\n";
229
-                echo "Your Callback URL is: " .$faqConfig->get('main.referenceURL') . "/services/twitter/callback.php";
229
+                echo "Your Callback URL is: ".$faqConfig->get('main.referenceURL')."/services/twitter/callback.php";
230 230
             }
231 231
 
232 232
             if (!isset($content)) {
233 233
                 echo '<a target="_blank" href="../services/twitter/redirect.php">';
234 234
                 echo '<img src="../assets/img/twitter.signin.png" alt="Sign in with Twitter"/></a>';
235 235
             } elseif (isset($content)) {
236
-                echo $content->screen_name . "<br />\n";
237
-                echo "<img src='" . $content->profile_image_url_https . "'><br />\n";
238
-                echo "Follower: " . $content->followers_count . "<br />\n";
239
-                echo "Status Count: " . $content->statuses_count . "<br />\n";
240
-                echo "Status: " . $content->status->text;
236
+                echo $content->screen_name."<br />\n";
237
+                echo "<img src='".$content->profile_image_url_https."'><br />\n";
238
+                echo "Follower: ".$content->followers_count."<br />\n";
239
+                echo "Status Count: ".$content->statuses_count."<br />\n";
240
+                echo "Status: ".$content->status->text;
241 241
             }
242 242
             echo '</div>';
243 243
             echo '</div>';
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.records.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AJAX: handling of Ajax record calls
4
- *
5
- * PHP Version 5.3
6
- *
7
- * This Source Code Form is subject to the terms of the Mozilla Public License,
8
- * v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
- * obtain one at http://mozilla.org/MPL/2.0/.
10
- *
11
- * @category  phpMyFAQ
12
- * @package   Administration
13
- * @author    Anatoliy Belsky <[email protected]>
14
- * @author    Thorsten Rinne <[email protected]>
15
- * @copyright 2009-2015 phpMyFAQ Team
16
- * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
17
- * @link      http://www.phpmyfaq.de
18
- * @since     2009-03-31
19
- */
3
+     * AJAX: handling of Ajax record calls
4
+     *
5
+     * PHP Version 5.3
6
+     *
7
+     * This Source Code Form is subject to the terms of the Mozilla Public License,
8
+     * v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
+     * obtain one at http://mozilla.org/MPL/2.0/.
10
+     *
11
+     * @category  phpMyFAQ
12
+     * @package   Administration
13
+     * @author    Anatoliy Belsky <[email protected]>
14
+     * @author    Thorsten Rinne <[email protected]>
15
+     * @copyright 2009-2015 phpMyFAQ Team
16
+     * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
17
+     * @link      http://www.phpmyfaq.de
18
+     * @since     2009-03-31
19
+     */
20 20
 
21 21
 if (!defined('IS_VALID_PHPMYFAQ')) {
22 22
     $protocol = 'http';
Please login to merge, or discard this patch.
Switch Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -51,102 +51,102 @@
 block discarded – undo
51 51
 switch($ajax_action) {
52 52
 
53 53
     // save active FAQs
54
-    case 'save_active_records':
55
-        if ($permission['approverec']) {
56
-            if (!empty($items)) {
57
-                $faq = new PMF_Faq($faqConfig);
54
+        case 'save_active_records':
55
+            if ($permission['approverec']) {
56
+                if (!empty($items)) {
57
+                    $faq = new PMF_Faq($faqConfig);
58 58
                 
59
-                foreach ($items as $item) {
60
-                    if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
61
-                        echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'active');
59
+                    foreach ($items as $item) {
60
+                        if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
61
+                            echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'active');
62
+                        }
62 63
                     }
63 64
                 }
65
+            } else {
66
+                echo $PMF_LANG['err_NotAuth'];
64 67
             }
65
-        } else {
66
-            echo $PMF_LANG['err_NotAuth'];
67
-        }
68
-        break;
68
+            break;
69 69
 
70
-    // save sticky FAQs
71
-    case 'save_sticky_records':
72
-        if ($permission['editbt']) {
70
+        // save sticky FAQs
71
+        case 'save_sticky_records':
72
+            if ($permission['editbt']) {
73 73
 
74
-            if (!empty($items)) {
75
-                $faq = new PMF_Faq($faqConfig);
74
+                if (!empty($items)) {
75
+                    $faq = new PMF_Faq($faqConfig);
76 76
 
77
-                foreach ($items as $item) {
78
-                    if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
79
-                        echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'sticky');
77
+                    foreach ($items as $item) {
78
+                        if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
79
+                            echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'sticky');
80
+                        }
80 81
                     }
81 82
                 }
83
+            } else {
84
+                echo $PMF_LANG['err_NotAuth'];
82 85
             }
83
-        } else {
84
-            echo $PMF_LANG['err_NotAuth'];
85
-        }
86
-        break;
86
+            break;
87 87
 
88
-    // search FAQs for suggestions
89
-    case 'search_records':
90
-        if ($permission['editbt']) {
88
+        // search FAQs for suggestions
89
+        case 'search_records':
90
+            if ($permission['editbt']) {
91 91
 
92
-            $faq             = new PMF_Faq($faqConfig);
93
-            $faqSearch       = new PMF_Search($faqConfig);
94
-            $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
95
-            $searchResult    = '';
96
-            $searchString    = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
92
+                $faq             = new PMF_Faq($faqConfig);
93
+                $faqSearch       = new PMF_Search($faqConfig);
94
+                $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
95
+                $searchResult    = '';
96
+                $searchString    = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
97 97
 
98
-            if (!is_null($searchString)) {
99
-                $searchResult = $faqSearch->search($searchString, false);
98
+                if (!is_null($searchString)) {
99
+                    $searchResult = $faqSearch->search($searchString, false);
100 100
 
101
-                $faqSearchResult->reviewResultset($searchResult);
101
+                    $faqSearchResult->reviewResultset($searchResult);
102 102
 
103
-                $searchHelper = new PMF_Helper_Search($faqConfig);
104
-                $searchHelper->setSearchterm($searchString);
103
+                    $searchHelper = new PMF_Helper_Search($faqConfig);
104
+                    $searchHelper->setSearchterm($searchString);
105 105
 
106
-                echo $searchHelper->renderAdminSuggestionResult($faqSearchResult);
107
-            }
106
+                    echo $searchHelper->renderAdminSuggestionResult($faqSearchResult);
107
+                }
108 108
             
109
-        } else {
110
-            echo $PMF_LANG['err_NotAuth'];
111
-        }
112
-        break;
109
+            } else {
110
+                echo $PMF_LANG['err_NotAuth'];
111
+            }
112
+            break;
113 113
 
114
-    // delete FAQs
115
-    case 'delete_record':
116
-        if ($permission['delbt']) {
114
+        // delete FAQs
115
+        case 'delete_record':
116
+            if ($permission['delbt']) {
117 117
 
118
-            $recordId   = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
119
-            $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
118
+                $recordId   = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
119
+                $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
120 120
 
121
-            $logging = new PMF_Logging($faqConfig);
122
-            $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId);
121
+                $logging = new PMF_Logging($faqConfig);
122
+                $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId);
123 123
 
124
-            $faq->deleteRecord($recordId, $recordLang);
125
-            echo $PMF_LANG['ad_entry_delsuc'];
124
+                $faq->deleteRecord($recordId, $recordLang);
125
+                echo $PMF_LANG['ad_entry_delsuc'];
126 126
             
127
-        } else {
128
-            echo $PMF_LANG['err_NotAuth'];
129
-        }
130
-        break;
131
-
132
-    // delete open questions
133
-    case 'delete_question':
134
-        if ($permission['delquestion']) {
135
-
136
-            $checks  = array(
137
-                'filter'  => FILTER_VALIDATE_INT,
138
-                'flags'   => FILTER_REQUIRE_ARRAY
139
-            );
140
-            $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks));
141
-
142
-            if (!is_null($questionIds['questions'])) {
143
-                foreach ($questionIds['questions'] as $questionId) {
144
-                    $faq->deleteQuestion((int)$questionId);
127
+            } else {
128
+                echo $PMF_LANG['err_NotAuth'];
129
+            }
130
+            break;
131
+
132
+        // delete open questions
133
+        case 'delete_question':
134
+            if ($permission['delquestion']) {
135
+
136
+                $checks  = array(
137
+                    'filter'  => FILTER_VALIDATE_INT,
138
+                    'flags'   => FILTER_REQUIRE_ARRAY
139
+                );
140
+                $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks));
141
+
142
+                if (!is_null($questionIds['questions'])) {
143
+                    foreach ($questionIds['questions'] as $questionId) {
144
+                        $faq->deleteQuestion((int)$questionId);
145
+                    }
145 146
                 }
147
+                echo $PMF_LANG['ad_entry_delsuc'];
148
+            } else {
149
+                echo $PMF_LANG['err_NotAuth'];
146 150
             }
147
-            echo $PMF_LANG['ad_entry_delsuc'];
148
-        } else {
149
-            echo $PMF_LANG['err_NotAuth'];
150
-        }
151
-        break;
151
+            break;
152 152
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (!defined('IS_VALID_PHPMYFAQ')) {
22 22
     $protocol = 'http';
23
-    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
23
+    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
24 24
         $protocol = 'https';
25 25
     }
26
-    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
26
+    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
27 27
     exit();
28 28
 }
29 29
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     $items[0][2] = 0;
49 49
 }
50 50
 
51
-switch($ajax_action) {
51
+switch ($ajax_action) {
52 52
 
53 53
     // save active FAQs
54 54
     case 'save_active_records':
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
120 120
 
121 121
             $logging = new PMF_Logging($faqConfig);
122
-            $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId);
122
+            $logging->logAdmin($user, 'Deleted FAQ ID '.$recordId);
123 123
 
124 124
             $faq->deleteRecord($recordId, $recordLang);
125 125
             echo $PMF_LANG['ad_entry_delsuc'];
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     case 'delete_question':
134 134
         if ($permission['delquestion']) {
135 135
 
136
-            $checks  = array(
136
+            $checks = array(
137 137
                 'filter'  => FILTER_VALIDATE_INT,
138 138
                 'flags'   => FILTER_REQUIRE_ARRAY
139 139
             );
Please login to merge, or discard this patch.
phpmyfaq/admin/attachment.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Select an attachment and save it
4
- *
5
- * PHP Version 5.3
6
- *
7
- * This Source Code Form is subject to the terms of the Mozilla Public License,
8
- * v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
- * obtain one at http://mozilla.org/MPL/2.0/.
10
- *
11
- * @category  phpMyFAQ
12
- * @package   Administration
13
- * @author    Thorsten Rinne <[email protected]>
14
- * @author    Anatoliy Belsky <[email protected]>
15
- * @copyright 2002-2015 phpMyFAQ
16
- * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
17
- * @link      http://www.phpmyfaq.de
18
- * @since     2002-09-17
19
- */
3
+         * Select an attachment and save it
4
+         *
5
+         * PHP Version 5.3
6
+         *
7
+         * This Source Code Form is subject to the terms of the Mozilla Public License,
8
+         * v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
+         * obtain one at http://mozilla.org/MPL/2.0/.
10
+         *
11
+         * @category  phpMyFAQ
12
+         * @package   Administration
13
+         * @author    Thorsten Rinne <[email protected]>
14
+         * @author    Anatoliy Belsky <[email protected]>
15
+         * @copyright 2002-2015 phpMyFAQ
16
+         * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
17
+         * @link      http://www.phpmyfaq.de
18
+         * @since     2002-09-17
19
+         */
20 20
 
21 21
 define('PMF_ROOT_DIR', dirname(__DIR__));
22 22
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 //
29 29
 // Bootstrapping
30 30
 //
31
-require PMF_ROOT_DIR . '/inc/Bootstrap.php';
31
+require PMF_ROOT_DIR.'/inc/Bootstrap.php';
32 32
 
33 33
 /**
34 34
  * Initialize attachment factory
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 $Language = new PMF_Language($faqConfig);
47 47
 $LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
48 48
 
49
-require_once PMF_ROOT_DIR . '/lang/language_en.php';
49
+require_once PMF_ROOT_DIR.'/lang/language_en.php';
50 50
 
51 51
 if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) {
52
-    require_once PMF_ROOT_DIR . '/lang/language_'.$LANGCODE.'.php';
52
+    require_once PMF_ROOT_DIR.'/lang/language_'.$LANGCODE.'.php';
53 53
 } else {
54 54
     $LANGCODE = 'en';
55 55
 }
56 56
 
57 57
 $auth = false;
58 58
 $user = PMF_User_CurrentUser::getFromCookie($faqConfig);
59
-if (! $user instanceof PMF_User_CurrentUser) {
59
+if (!$user instanceof PMF_User_CurrentUser) {
60 60
     $user = PMF_User_CurrentUser::getFromSession($faqConfig);
61 61
 }
62 62
 if ($user) {
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 <?php
120 120
 }
121 121
 if (is_null($currentAction) && $auth && $permission['addattachment']) {
122
-    $recordId   = filter_input(INPUT_GET, 'record_id',   FILTER_VALIDATE_INT);
122
+    $recordId   = filter_input(INPUT_GET, 'record_id', FILTER_VALIDATE_INT);
123 123
     $recordLang = filter_input(INPUT_GET, 'record_lang', FILTER_SANITIZE_STRING);
124 124
 ?>
125 125
         <form action="attachment.php?action=save" enctype="multipart/form-data" method="post" accept-charset="utf-8">
126 126
             <fieldset>
127 127
             <legend>
128 128
                 <?php echo $PMF_LANG["ad_att_addto"]." ".$PMF_LANG["ad_att_addto_2"]; ?>
129
-                (max <?php echo round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2) ?> MB)
129
+                (max <?php echo round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2) ?> MB)
130 130
             </legend>
131 131
                 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $faqConfig->get('records.maxAttachmentSize'); ?>" />
132 132
                 <input type="hidden" name="record_id" value="<?php echo $recordId; ?>" />
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 }
153 153
 
154 154
 if (!is_null($currentSave) && $currentSave == true && $auth && $permission['addattachment']) {
155
-    $recordId   = filter_input(INPUT_POST, 'record_id',   FILTER_VALIDATE_INT);
155
+    $recordId   = filter_input(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
156 156
     $recordLang = filter_input(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
157 157
 ?>
158 158
 <p><strong><?php echo $PMF_LANG["ad_att_addto"]." ".$PMF_LANG["ad_att_addto_2"]; ?></strong></p>
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             '<p>%s</p>',
195 195
             sprintf(
196 196
                 $PMF_LANG['ad_attach_4'],
197
-                round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2)
197
+                round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2)
198 198
             )
199 199
         );
200 200
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,9 @@
 block discarded – undo
75 75
     // check user rights, set them TRUE
76 76
     $allUserRights = $user->perm->getAllUserRights($user->getUserId());
77 77
     foreach ($allRights as $right) {
78
-        if (in_array($right['right_id'], $allUserRights))
79
-            $permission[$right['name']] = true;
78
+        if (in_array($right['right_id'], $allUserRights)) {
79
+                    $permission[$right['name']] = true;
80
+        }
80 81
     }
81 82
 }
82 83
 
Please login to merge, or discard this patch.