@@ -11,221 +11,221 @@ |
||
11 | 11 | * this file is part of the Source Code of CKFinder. |
12 | 12 | */ |
13 | 13 | |
14 | -define( 'CKFINDER_DEFAULT_BASEPATH', '/ckfinder/' ) ; |
|
14 | +define('CKFINDER_DEFAULT_BASEPATH', '/ckfinder/'); |
|
15 | 15 | |
16 | 16 | class CKFinder |
17 | 17 | { |
18 | - public $BasePath ; |
|
19 | - public $Width ; |
|
20 | - public $Height ; |
|
21 | - public $SelectFunction ; |
|
22 | - public $SelectFunctionData ; |
|
23 | - public $SelectThumbnailFunction ; |
|
24 | - public $SelectThumbnailFunctionData ; |
|
25 | - public $DisableThumbnailSelection = false ; |
|
26 | - public $ClassName = '' ; |
|
27 | - public $Id = '' ; |
|
28 | - public $StartupPath ; |
|
29 | - public $ResourceType ; |
|
30 | - public $RememberLastFolder = true ; |
|
31 | - public $StartupFolderExpanded = false ; |
|
18 | + public $BasePath; |
|
19 | + public $Width; |
|
20 | + public $Height; |
|
21 | + public $SelectFunction; |
|
22 | + public $SelectFunctionData; |
|
23 | + public $SelectThumbnailFunction; |
|
24 | + public $SelectThumbnailFunctionData; |
|
25 | + public $DisableThumbnailSelection = false; |
|
26 | + public $ClassName = ''; |
|
27 | + public $Id = ''; |
|
28 | + public $StartupPath; |
|
29 | + public $ResourceType; |
|
30 | + public $RememberLastFolder = true; |
|
31 | + public $StartupFolderExpanded = false; |
|
32 | 32 | |
33 | 33 | // PHP 5 Constructor |
34 | - function __construct( $basePath = CKFINDER_DEFAULT_BASEPATH, $width = '100%', $height = 400, $selectFunction = null ) |
|
34 | + function __construct($basePath = CKFINDER_DEFAULT_BASEPATH, $width = '100%', $height = 400, $selectFunction = null) |
|
35 | 35 | { |
36 | - $this->BasePath = $basePath ; |
|
37 | - $this->Width = $width ; |
|
38 | - $this->Height = $height ; |
|
39 | - $this->SelectFunction = $selectFunction ; |
|
40 | - $this->SelectThumbnailFunction = $selectFunction ; |
|
36 | + $this->BasePath = $basePath; |
|
37 | + $this->Width = $width; |
|
38 | + $this->Height = $height; |
|
39 | + $this->SelectFunction = $selectFunction; |
|
40 | + $this->SelectThumbnailFunction = $selectFunction; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // Renders CKFinder in the current page. |
44 | 44 | public function Create() |
45 | 45 | { |
46 | - echo $this->CreateHtml() ; |
|
46 | + echo $this->CreateHtml(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // Gets the HTML needed to create a CKFinder instance. |
50 | 50 | public function CreateHtml() |
51 | 51 | { |
52 | - $className = $this->ClassName ; |
|
53 | - if ( !empty( $className ) ) |
|
54 | - $className = ' class="' . $className . '"' ; |
|
52 | + $className = $this->ClassName; |
|
53 | + if (!empty($className)) |
|
54 | + $className = ' class="'.$className.'"'; |
|
55 | 55 | |
56 | - $id = $this->Id ; |
|
57 | - if ( !empty( $id ) ) |
|
58 | - $id = ' id="' . $id . '"' ; |
|
56 | + $id = $this->Id; |
|
57 | + if (!empty($id)) |
|
58 | + $id = ' id="'.$id.'"'; |
|
59 | 59 | |
60 | - return '<iframe src="' . $this->_BuildUrl() . '" width="' . $this->Width . '" ' . |
|
61 | - 'height="' . $this->Height . '"' . $className . $id . ' frameborder="0" scrolling="no"></iframe>' ; |
|
60 | + return '<iframe src="'.$this->_BuildUrl().'" width="'.$this->Width.'" '. |
|
61 | + 'height="'.$this->Height.'"'.$className.$id.' frameborder="0" scrolling="no"></iframe>'; |
|
62 | 62 | } |
63 | 63 | |
64 | - private function _BuildUrl( $url = "" ) |
|
64 | + private function _BuildUrl($url = "") |
|
65 | 65 | { |
66 | - if ( !$url ) |
|
67 | - $url = $this->BasePath ; |
|
66 | + if (!$url) |
|
67 | + $url = $this->BasePath; |
|
68 | 68 | |
69 | - $qs = "" ; |
|
69 | + $qs = ""; |
|
70 | 70 | |
71 | - if ( empty( $url ) ) |
|
72 | - $url = CKFINDER_DEFAULT_BASEPATH ; |
|
71 | + if (empty($url)) |
|
72 | + $url = CKFINDER_DEFAULT_BASEPATH; |
|
73 | 73 | |
74 | - if ( $url[ strlen( $url ) - 1 ] != '/' ) |
|
75 | - $url = $url . '/' ; |
|
74 | + if ($url[strlen($url) - 1] != '/') |
|
75 | + $url = $url.'/'; |
|
76 | 76 | |
77 | - $url .= 'ckfinder.html' ; |
|
77 | + $url .= 'ckfinder.html'; |
|
78 | 78 | |
79 | - if ( !empty( $this->SelectFunction ) ) |
|
80 | - $qs .= '?action=js&func=' . $this->SelectFunction ; |
|
79 | + if (!empty($this->SelectFunction)) |
|
80 | + $qs .= '?action=js&func='.$this->SelectFunction; |
|
81 | 81 | |
82 | - if ( !empty( $this->SelectFunctionData ) ) |
|
82 | + if (!empty($this->SelectFunctionData)) |
|
83 | 83 | { |
84 | - $qs .= $qs ? "&" : "?" ; |
|
85 | - $qs .= 'data=' . rawurlencode($this->SelectFunctionData) ; |
|
84 | + $qs .= $qs ? "&" : "?"; |
|
85 | + $qs .= 'data='.rawurlencode($this->SelectFunctionData); |
|
86 | 86 | } |
87 | 87 | |
88 | - if ( $this->DisableThumbnailSelection ) |
|
88 | + if ($this->DisableThumbnailSelection) |
|
89 | 89 | { |
90 | - $qs .= $qs ? "&" : "?" ; |
|
91 | - $qs .= "dts=1" ; |
|
90 | + $qs .= $qs ? "&" : "?"; |
|
91 | + $qs .= "dts=1"; |
|
92 | 92 | } |
93 | - else if ( !empty( $this->SelectThumbnailFunction ) || !empty( $this->SelectFunction ) ) |
|
93 | + else if (!empty($this->SelectThumbnailFunction) || !empty($this->SelectFunction)) |
|
94 | 94 | { |
95 | - $qs .= $qs ? "&" : "?" ; |
|
96 | - $qs .= 'thumbFunc=' . ( !empty( $this->SelectThumbnailFunction ) ? $this->SelectThumbnailFunction : $this->SelectFunction ) ; |
|
95 | + $qs .= $qs ? "&" : "?"; |
|
96 | + $qs .= 'thumbFunc='.(!empty($this->SelectThumbnailFunction) ? $this->SelectThumbnailFunction : $this->SelectFunction); |
|
97 | 97 | |
98 | - if ( !empty( $this->SelectThumbnailFunctionData ) ) |
|
99 | - $qs .= '&tdata=' . rawurlencode( $this->SelectThumbnailFunctionData ) ; |
|
100 | - else if ( empty( $this->SelectThumbnailFunction ) && !empty( $this->SelectFunctionData ) ) |
|
101 | - $qs .= '&tdata=' . rawurlencode( $this->SelectFunctionData ) ; |
|
98 | + if (!empty($this->SelectThumbnailFunctionData)) |
|
99 | + $qs .= '&tdata='.rawurlencode($this->SelectThumbnailFunctionData); |
|
100 | + else if (empty($this->SelectThumbnailFunction) && !empty($this->SelectFunctionData)) |
|
101 | + $qs .= '&tdata='.rawurlencode($this->SelectFunctionData); |
|
102 | 102 | } |
103 | 103 | |
104 | - if ( !empty( $this->StartupPath ) ) |
|
104 | + if (!empty($this->StartupPath)) |
|
105 | 105 | { |
106 | - $qs .= ( $qs ? "&" : "?" ) ; |
|
107 | - $qs .= "start=" . urlencode( $this->StartupPath . ( $this->StartupFolderExpanded ? ':1' : ':0' ) ) ; |
|
106 | + $qs .= ($qs ? "&" : "?"); |
|
107 | + $qs .= "start=".urlencode($this->StartupPath.($this->StartupFolderExpanded ? ':1' : ':0')); |
|
108 | 108 | } |
109 | 109 | |
110 | - if ( !empty( $this->ResourceType ) ) |
|
110 | + if (!empty($this->ResourceType)) |
|
111 | 111 | { |
112 | - $qs .= ( $qs ? "&" : "?" ) ; |
|
113 | - $qs .= "type=" . urlencode( $this->ResourceType ) ; |
|
112 | + $qs .= ($qs ? "&" : "?"); |
|
113 | + $qs .= "type=".urlencode($this->ResourceType); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( !$this->RememberLastFolder ) |
|
116 | + if (!$this->RememberLastFolder) |
|
117 | 117 | { |
118 | - $qs .= ( $qs ? "&" : "?" ) ; |
|
119 | - $qs .= "rlf=0" ; |
|
118 | + $qs .= ($qs ? "&" : "?"); |
|
119 | + $qs .= "rlf=0"; |
|
120 | 120 | } |
121 | 121 | |
122 | - if ( !empty( $this->Id ) ) |
|
122 | + if (!empty($this->Id)) |
|
123 | 123 | { |
124 | - $qs .= ( $qs ? "&" : "?" ) ; |
|
125 | - $qs .= "id=" . urlencode( $this->Id ) ; |
|
124 | + $qs .= ($qs ? "&" : "?"); |
|
125 | + $qs .= "id=".urlencode($this->Id); |
|
126 | 126 | } |
127 | 127 | |
128 | - return $url . $qs ; |
|
128 | + return $url.$qs; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Static "Create". |
132 | - public static function CreateStatic( $basePath = CKFINDER_DEFAULT_BASEPATH, $width = '100%', $height = 400, $selectFunction = null ) |
|
132 | + public static function CreateStatic($basePath = CKFINDER_DEFAULT_BASEPATH, $width = '100%', $height = 400, $selectFunction = null) |
|
133 | 133 | { |
134 | - $finder = new CKFinder( $basePath, $width, $height, $selectFunction ) ; |
|
135 | - $finder->Create() ; |
|
134 | + $finder = new CKFinder($basePath, $width, $height, $selectFunction); |
|
135 | + $finder->Create(); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // Static "SetupFCKeditor". |
139 | - public static function SetupFCKeditor( &$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null ) |
|
139 | + public static function SetupFCKeditor(&$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null) |
|
140 | 140 | { |
141 | - if ( empty( $basePath ) ) |
|
142 | - $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
141 | + if (empty($basePath)) |
|
142 | + $basePath = CKFINDER_DEFAULT_BASEPATH; |
|
143 | 143 | |
144 | - $ckfinder = new CKFinder( $basePath ) ; |
|
145 | - $ckfinder->SetupFCKeditorObject( $editorObj, $imageType, $flashType ); |
|
144 | + $ckfinder = new CKFinder($basePath); |
|
145 | + $ckfinder->SetupFCKeditorObject($editorObj, $imageType, $flashType); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Non-static method of attaching CKFinder to FCKeditor |
149 | - public function SetupFCKeditorObject( &$editorObj, $imageType = null, $flashType = null ) |
|
149 | + public function SetupFCKeditorObject(&$editorObj, $imageType = null, $flashType = null) |
|
150 | 150 | { |
151 | - $url = $this->BasePath ; |
|
151 | + $url = $this->BasePath; |
|
152 | 152 | |
153 | 153 | // If it is a path relative to the current page. |
154 | - if ( isset($url[0]) && $url[0] != '/' ) |
|
154 | + if (isset($url[0]) && $url[0] != '/') |
|
155 | 155 | { |
156 | - $url = substr( $_SERVER[ 'REQUEST_URI' ], 0, strrpos( $_SERVER[ 'REQUEST_URI' ], '/' ) + 1 ) . $url ; |
|
156 | + $url = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1).$url; |
|
157 | 157 | } |
158 | 158 | |
159 | - $url = $this->_BuildUrl( $url ) ; |
|
160 | - $qs = ( strpos($url, "?") !== false ) ? "&" : "?" ; |
|
159 | + $url = $this->_BuildUrl($url); |
|
160 | + $qs = (strpos($url, "?") !== false) ? "&" : "?"; |
|
161 | 161 | |
162 | - if ( $this->Width !== '100%' && is_numeric( str_ireplace( "px", "", $this->Width ) ) ) |
|
162 | + if ($this->Width !== '100%' && is_numeric(str_ireplace("px", "", $this->Width))) |
|
163 | 163 | { |
164 | - $width = intval( $this->Width ); |
|
165 | - $editorObj->Config['LinkBrowserWindowWidth'] = $width ; |
|
166 | - $editorObj->Config['ImageBrowserWindowWidth'] = $width ; |
|
167 | - $editorObj->Config['FlashBrowserWindowWidth'] = $width ; |
|
164 | + $width = intval($this->Width); |
|
165 | + $editorObj->Config['LinkBrowserWindowWidth'] = $width; |
|
166 | + $editorObj->Config['ImageBrowserWindowWidth'] = $width; |
|
167 | + $editorObj->Config['FlashBrowserWindowWidth'] = $width; |
|
168 | 168 | } |
169 | - if ( $this->Height !== 400 && is_numeric( str_ireplace( "px", "", $this->Height ) ) ) |
|
169 | + if ($this->Height !== 400 && is_numeric(str_ireplace("px", "", $this->Height))) |
|
170 | 170 | { |
171 | - $height = intval( $this->Height ); |
|
172 | - $editorObj->Config['LinkBrowserWindowHeight'] = $height ; |
|
173 | - $editorObj->Config['ImageBrowserWindowHeight'] = $height ; |
|
174 | - $editorObj->Config['FlashBrowserWindowHeight'] = $height ; |
|
171 | + $height = intval($this->Height); |
|
172 | + $editorObj->Config['LinkBrowserWindowHeight'] = $height; |
|
173 | + $editorObj->Config['ImageBrowserWindowHeight'] = $height; |
|
174 | + $editorObj->Config['FlashBrowserWindowHeight'] = $height; |
|
175 | 175 | } |
176 | 176 | |
177 | - $editorObj->Config['LinkBrowserURL'] = $url ; |
|
178 | - $editorObj->Config['ImageBrowserURL'] = $url . $qs . 'type=' . ( empty( $imageType ) ? 'Images' : $imageType ) ; |
|
179 | - $editorObj->Config['FlashBrowserURL'] = $url . $qs . 'type=' . ( empty( $flashType ) ? 'Flash' : $flashType ) ; |
|
177 | + $editorObj->Config['LinkBrowserURL'] = $url; |
|
178 | + $editorObj->Config['ImageBrowserURL'] = $url.$qs.'type='.(empty($imageType) ? 'Images' : $imageType); |
|
179 | + $editorObj->Config['FlashBrowserURL'] = $url.$qs.'type='.(empty($flashType) ? 'Flash' : $flashType); |
|
180 | 180 | |
181 | - $dir = substr( $url, 0, strrpos( $url, "/" ) + 1 ) ; |
|
182 | - $editorObj->Config['LinkUploadURL'] = $dir . urlencode( 'core/connector/php/connector.php?command=QuickUpload&type=Files' ) ; |
|
183 | - $editorObj->Config['ImageUploadURL'] = $dir . urlencode( 'core/connector/php/connector.php?command=QuickUpload&type=') . ( empty( $imageType ) ? 'Images' : $imageType ) ; |
|
184 | - $editorObj->Config['FlashUploadURL'] = $dir . urlencode( 'core/connector/php/connector.php?command=QuickUpload&type=') . ( empty( $flashType ) ? 'Flash' : $flashType ) ; |
|
181 | + $dir = substr($url, 0, strrpos($url, "/") + 1); |
|
182 | + $editorObj->Config['LinkUploadURL'] = $dir.urlencode('core/connector/php/connector.php?command=QuickUpload&type=Files'); |
|
183 | + $editorObj->Config['ImageUploadURL'] = $dir.urlencode('core/connector/php/connector.php?command=QuickUpload&type=').(empty($imageType) ? 'Images' : $imageType); |
|
184 | + $editorObj->Config['FlashUploadURL'] = $dir.urlencode('core/connector/php/connector.php?command=QuickUpload&type=').(empty($flashType) ? 'Flash' : $flashType); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | // Static "SetupCKEditor". |
188 | - public static function SetupCKEditor( &$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null ) |
|
188 | + public static function SetupCKEditor(&$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null) |
|
189 | 189 | { |
190 | - if ( empty( $basePath ) ) |
|
191 | - $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
190 | + if (empty($basePath)) |
|
191 | + $basePath = CKFINDER_DEFAULT_BASEPATH; |
|
192 | 192 | |
193 | - $ckfinder = new CKFinder( $basePath ) ; |
|
194 | - $ckfinder->SetupCKEditorObject( $editorObj, $imageType, $flashType ); |
|
193 | + $ckfinder = new CKFinder($basePath); |
|
194 | + $ckfinder->SetupCKEditorObject($editorObj, $imageType, $flashType); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // Non-static method of attaching CKFinder to CKEditor |
198 | - public function SetupCKEditorObject( &$editorObj, $imageType = null, $flashType = null ) |
|
198 | + public function SetupCKEditorObject(&$editorObj, $imageType = null, $flashType = null) |
|
199 | 199 | { |
200 | - $url = $this->BasePath ; |
|
200 | + $url = $this->BasePath; |
|
201 | 201 | |
202 | 202 | // If it is a path relative to the current page. |
203 | - if ( isset($url[0]) && $url[0] != '/' ) |
|
203 | + if (isset($url[0]) && $url[0] != '/') |
|
204 | 204 | { |
205 | - $url = substr( $_SERVER[ 'REQUEST_URI' ], 0, strrpos( $_SERVER[ 'REQUEST_URI' ], '/' ) + 1 ) . $url ; |
|
205 | + $url = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1).$url; |
|
206 | 206 | } |
207 | 207 | |
208 | - $url = $this->_BuildUrl( $url ) ; |
|
209 | - $qs = ( strpos($url, "?") !== false ) ? "&" : "?" ; |
|
208 | + $url = $this->_BuildUrl($url); |
|
209 | + $qs = (strpos($url, "?") !== false) ? "&" : "?"; |
|
210 | 210 | |
211 | - if ( $this->Width !== '100%' && is_numeric( str_ireplace( "px", "", $this->Width ) ) ) |
|
211 | + if ($this->Width !== '100%' && is_numeric(str_ireplace("px", "", $this->Width))) |
|
212 | 212 | { |
213 | - $width = intval( $this->Width ); |
|
214 | - $editorObj->config['filebrowserWindowWidth'] = $width ; |
|
213 | + $width = intval($this->Width); |
|
214 | + $editorObj->config['filebrowserWindowWidth'] = $width; |
|
215 | 215 | } |
216 | - if ( $this->Height !== 400 && is_numeric( str_ireplace( "px", "", $this->Height ) ) ) |
|
216 | + if ($this->Height !== 400 && is_numeric(str_ireplace("px", "", $this->Height))) |
|
217 | 217 | { |
218 | - $height = intval( $this->Height ); |
|
219 | - $editorObj->config['filebrowserWindowHeight'] = $height ; |
|
218 | + $height = intval($this->Height); |
|
219 | + $editorObj->config['filebrowserWindowHeight'] = $height; |
|
220 | 220 | } |
221 | 221 | |
222 | - $editorObj->config['filebrowserBrowseUrl'] = $url ; |
|
223 | - $editorObj->config['filebrowserImageBrowseUrl'] = $url . $qs . 'type=' . ( empty( $imageType ) ? 'Images' : $imageType ) ; |
|
224 | - $editorObj->config['filebrowserFlashBrowseUrl'] = $url . $qs . 'type=' . ( empty( $flashType ) ? 'Flash' : $flashType ) ; |
|
222 | + $editorObj->config['filebrowserBrowseUrl'] = $url; |
|
223 | + $editorObj->config['filebrowserImageBrowseUrl'] = $url.$qs.'type='.(empty($imageType) ? 'Images' : $imageType); |
|
224 | + $editorObj->config['filebrowserFlashBrowseUrl'] = $url.$qs.'type='.(empty($flashType) ? 'Flash' : $flashType); |
|
225 | 225 | |
226 | - $dir = substr( $url, 0, strrpos( $url, "/" ) + 1 ) ; |
|
227 | - $editorObj->config['filebrowserUploadUrl'] = $dir . 'core/connector/php/connector.php?command=QuickUpload&type=Files' ; |
|
228 | - $editorObj->config['filebrowserImageUploadUrl'] = $dir . 'core/connector/php/connector.php?command=QuickUpload&type=' . ( empty( $imageType ) ? 'Images' : $imageType ) ; |
|
229 | - $editorObj->config['filebrowserFlashUploadUrl'] = $dir . 'core/connector/php/connector.php?command=QuickUpload&type=' . ( empty( $flashType ) ? 'Flash' : $flashType ) ; |
|
226 | + $dir = substr($url, 0, strrpos($url, "/") + 1); |
|
227 | + $editorObj->config['filebrowserUploadUrl'] = $dir.'core/connector/php/connector.php?command=QuickUpload&type=Files'; |
|
228 | + $editorObj->config['filebrowserImageUploadUrl'] = $dir.'core/connector/php/connector.php?command=QuickUpload&type='.(empty($imageType) ? 'Images' : $imageType); |
|
229 | + $editorObj->config['filebrowserFlashUploadUrl'] = $dir.'core/connector/php/connector.php?command=QuickUpload&type='.(empty($flashType) ? 'Flash' : $flashType); |
|
230 | 230 | } |
231 | 231 | } |
@@ -50,12 +50,14 @@ discard block |
||
50 | 50 | public function CreateHtml() |
51 | 51 | { |
52 | 52 | $className = $this->ClassName ; |
53 | - if ( !empty( $className ) ) |
|
54 | - $className = ' class="' . $className . '"' ; |
|
53 | + if ( !empty( $className ) ) { |
|
54 | + $className = ' class="' . $className . '"' ; |
|
55 | + } |
|
55 | 56 | |
56 | 57 | $id = $this->Id ; |
57 | - if ( !empty( $id ) ) |
|
58 | - $id = ' id="' . $id . '"' ; |
|
58 | + if ( !empty( $id ) ) { |
|
59 | + $id = ' id="' . $id . '"' ; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | return '<iframe src="' . $this->_BuildUrl() . '" width="' . $this->Width . '" ' . |
61 | 63 | 'height="' . $this->Height . '"' . $className . $id . ' frameborder="0" scrolling="no"></iframe>' ; |
@@ -63,21 +65,25 @@ discard block |
||
63 | 65 | |
64 | 66 | private function _BuildUrl( $url = "" ) |
65 | 67 | { |
66 | - if ( !$url ) |
|
67 | - $url = $this->BasePath ; |
|
68 | + if ( !$url ) { |
|
69 | + $url = $this->BasePath ; |
|
70 | + } |
|
68 | 71 | |
69 | 72 | $qs = "" ; |
70 | 73 | |
71 | - if ( empty( $url ) ) |
|
72 | - $url = CKFINDER_DEFAULT_BASEPATH ; |
|
74 | + if ( empty( $url ) ) { |
|
75 | + $url = CKFINDER_DEFAULT_BASEPATH ; |
|
76 | + } |
|
73 | 77 | |
74 | - if ( $url[ strlen( $url ) - 1 ] != '/' ) |
|
75 | - $url = $url . '/' ; |
|
78 | + if ( $url[ strlen( $url ) - 1 ] != '/' ) { |
|
79 | + $url = $url . '/' ; |
|
80 | + } |
|
76 | 81 | |
77 | 82 | $url .= 'ckfinder.html' ; |
78 | 83 | |
79 | - if ( !empty( $this->SelectFunction ) ) |
|
80 | - $qs .= '?action=js&func=' . $this->SelectFunction ; |
|
84 | + if ( !empty( $this->SelectFunction ) ) { |
|
85 | + $qs .= '?action=js&func=' . $this->SelectFunction ; |
|
86 | + } |
|
81 | 87 | |
82 | 88 | if ( !empty( $this->SelectFunctionData ) ) |
83 | 89 | { |
@@ -89,16 +95,16 @@ discard block |
||
89 | 95 | { |
90 | 96 | $qs .= $qs ? "&" : "?" ; |
91 | 97 | $qs .= "dts=1" ; |
92 | - } |
|
93 | - else if ( !empty( $this->SelectThumbnailFunction ) || !empty( $this->SelectFunction ) ) |
|
98 | + } else if ( !empty( $this->SelectThumbnailFunction ) || !empty( $this->SelectFunction ) ) |
|
94 | 99 | { |
95 | 100 | $qs .= $qs ? "&" : "?" ; |
96 | 101 | $qs .= 'thumbFunc=' . ( !empty( $this->SelectThumbnailFunction ) ? $this->SelectThumbnailFunction : $this->SelectFunction ) ; |
97 | 102 | |
98 | - if ( !empty( $this->SelectThumbnailFunctionData ) ) |
|
99 | - $qs .= '&tdata=' . rawurlencode( $this->SelectThumbnailFunctionData ) ; |
|
100 | - else if ( empty( $this->SelectThumbnailFunction ) && !empty( $this->SelectFunctionData ) ) |
|
101 | - $qs .= '&tdata=' . rawurlencode( $this->SelectFunctionData ) ; |
|
103 | + if ( !empty( $this->SelectThumbnailFunctionData ) ) { |
|
104 | + $qs .= '&tdata=' . rawurlencode( $this->SelectThumbnailFunctionData ) ; |
|
105 | + } else if ( empty( $this->SelectThumbnailFunction ) && !empty( $this->SelectFunctionData ) ) { |
|
106 | + $qs .= '&tdata=' . rawurlencode( $this->SelectFunctionData ) ; |
|
107 | + } |
|
102 | 108 | } |
103 | 109 | |
104 | 110 | if ( !empty( $this->StartupPath ) ) |
@@ -138,8 +144,9 @@ discard block |
||
138 | 144 | // Static "SetupFCKeditor". |
139 | 145 | public static function SetupFCKeditor( &$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null ) |
140 | 146 | { |
141 | - if ( empty( $basePath ) ) |
|
142 | - $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
147 | + if ( empty( $basePath ) ) { |
|
148 | + $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
149 | + } |
|
143 | 150 | |
144 | 151 | $ckfinder = new CKFinder( $basePath ) ; |
145 | 152 | $ckfinder->SetupFCKeditorObject( $editorObj, $imageType, $flashType ); |
@@ -187,8 +194,9 @@ discard block |
||
187 | 194 | // Static "SetupCKEditor". |
188 | 195 | public static function SetupCKEditor( &$editorObj, $basePath = CKFINDER_DEFAULT_BASEPATH, $imageType = null, $flashType = null ) |
189 | 196 | { |
190 | - if ( empty( $basePath ) ) |
|
191 | - $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
197 | + if ( empty( $basePath ) ) { |
|
198 | + $basePath = CKFINDER_DEFAULT_BASEPATH ; |
|
199 | + } |
|
192 | 200 | |
193 | 201 | $ckfinder = new CKFinder( $basePath ) ; |
194 | 202 | $ckfinder->SetupCKEditorObject( $editorObj, $imageType, $flashType ); |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | $this->reload_cache = $obj->reload_cache; |
61 | 61 | $this->no_cache = $obj->no_cache; |
62 | 62 | } |
63 | - } |
|
64 | - else { |
|
63 | + } else { |
|
65 | 64 | $dbc->insert("nom_fichier", $this->page)->insert("reload_cache", 0)->into("cache")->set(); |
66 | 65 | |
67 | 66 | $this->reload_cache = 0; |
@@ -107,16 +106,14 @@ discard block |
||
107 | 106 | require_once($this->chemin_cache); |
108 | 107 | |
109 | 108 | return true; |
110 | - } |
|
111 | - else { |
|
109 | + } else { |
|
112 | 110 | if ($this->no_cache == null) { |
113 | 111 | ob_start(); |
114 | 112 | } |
115 | 113 | |
116 | 114 | return false; |
117 | 115 | } |
118 | - } |
|
119 | - else { |
|
116 | + } else { |
|
120 | 117 | return false; |
121 | 118 | } |
122 | 119 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | //definit le chemin sachant que l'on part de index.php |
45 | 45 | $chemin = str_replace("\\", "/", str_replace("index.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
46 | 46 | } |
47 | - else if (strstr($_SERVER['SCRIPT_NAME'], "installation.php")) { |
|
47 | + else if (strstr($_SERVER['SCRIPT_NAME'], "installation.php")) { |
|
48 | 48 | //definit le chemin sachant que l'on part de admin.php |
49 | 49 | $chemin = str_replace("\\", "/", str_replace("installation.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
50 | 50 | } |
@@ -17,11 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | if ($type == "error") { |
19 | 19 | $icone = "<i class='fa fa-close'></i>"; |
20 | - } |
|
21 | - else if ($type == "success") { |
|
20 | + } else if ($type == "success") { |
|
22 | 21 | $icone = "<i class='fa fa-check'></i>"; |
23 | - } |
|
24 | - else { |
|
22 | + } else { |
|
25 | 23 | $icone = "<i class='fa fa-info'></i>"; |
26 | 24 | } |
27 | 25 | |
@@ -43,12 +41,10 @@ discard block |
||
43 | 41 | if (strstr($_SERVER['SCRIPT_NAME'], "index.php")) { |
44 | 42 | //definit le chemin sachant que l'on part de index.php |
45 | 43 | $chemin = str_replace("\\", "/", str_replace("index.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
46 | - } |
|
47 | - else if (strstr($_SERVER['SCRIPT_NAME'], "installation.php")) { |
|
44 | + } else if (strstr($_SERVER['SCRIPT_NAME'], "installation.php")) { |
|
48 | 45 | //definit le chemin sachant que l'on part de admin.php |
49 | 46 | $chemin = str_replace("\\", "/", str_replace("installation.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
50 | - } |
|
51 | - else { |
|
47 | + } else { |
|
52 | 48 | //definit le chemin sachant que l'on part de admin.php |
53 | 49 | $chemin = str_replace("\\", "/", str_replace("admin.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
54 | 50 | } |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | public function getParse($file) { |
16 | 16 | if (file_exists($file)) { |
17 | 17 | return parse_ini_file($file); |
18 | - } |
|
19 | - else { |
|
18 | + } else { |
|
20 | 19 | return false; |
21 | 20 | } |
22 | 21 | } |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | public function setModifierConfigIni($developpement, $dev_info, $prod_info) { |
35 | 34 | if ($developpement == "on") { |
36 | 35 | $developpement = 1; |
37 | - } |
|
38 | - else { |
|
36 | + } else { |
|
39 | 37 | $developpement = 0; |
40 | 38 | } |
41 | 39 |
@@ -124,8 +124,7 @@ discard block |
||
124 | 124 | foreach ($query as $obj) { |
125 | 125 | if ($obj->activer == 1) { |
126 | 126 | return true; |
127 | - } |
|
128 | - else { |
|
127 | + } else { |
|
129 | 128 | return false; |
130 | 129 | } |
131 | 130 | } |
@@ -172,8 +171,7 @@ discard block |
||
172 | 171 | |
173 | 172 | if ($activer == 1) { |
174 | 173 | $nav->setAjoutLien("ID_module", self::getUrlToId($url)); |
175 | - } |
|
176 | - else { |
|
174 | + } else { |
|
177 | 175 | $nav->setSupprimerLien("ID_module", self::getUrlToId($url)); |
178 | 176 | } |
179 | 177 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | return $this->page; |
24 | 24 | } |
25 | 25 | public function getModule(){ |
26 | - return $this->module; |
|
26 | + return $this->module; |
|
27 | 27 | } |
28 | 28 | public function getController() { |
29 | 29 | return $this->controller; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function getPage() { |
23 | 23 | return $this->page; |
24 | 24 | } |
25 | - public function getModule(){ |
|
25 | + public function getModule() { |
|
26 | 26 | return $this->module; |
27 | 27 | } |
28 | 28 | public function getController() { |
@@ -62,12 +62,10 @@ |
||
62 | 62 | if (in_array($explode[$i], $this->getAllModules())) { |
63 | 63 | $this->module = $explode[$i]; |
64 | 64 | $debut_url = $explode[$i]; |
65 | - } |
|
66 | - else if ($i == 1) { |
|
65 | + } else if ($i == 1) { |
|
67 | 66 | $centre_url = $explode[$i]; |
68 | 67 | $this->page = $explode[$i]; |
69 | - } |
|
70 | - else { |
|
68 | + } else { |
|
71 | 69 | $this->parametre = $explode[$i]; |
72 | 70 | } |
73 | 71 | } |
@@ -21,8 +21,12 @@ discard block |
||
21 | 21 | //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
22 | 22 | public function __construct() { |
23 | 23 | //On test si dossier temporaire + modules a la racines existes bien sinon on les crées |
24 | - if (!file_exists(ROOT."temp")) mkdir(ROOT."temp"); |
|
25 | - if (!file_exists(ROOT."modules")) mkdir(ROOT."modules"); |
|
24 | + if (!file_exists(ROOT."temp")) { |
|
25 | + mkdir(ROOT."temp"); |
|
26 | + } |
|
27 | + if (!file_exists(ROOT."modules")) { |
|
28 | + mkdir(ROOT."modules"); |
|
29 | + } |
|
26 | 30 | } |
27 | 31 | //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
28 | 32 | |
@@ -95,8 +99,7 @@ discard block |
||
95 | 99 | } |
96 | 100 | |
97 | 101 | FlashMessage::setFlash("Votre module a bien été ajouté au site.", "success"); |
98 | - } |
|
99 | - else { |
|
102 | + } else { |
|
100 | 103 | FlashMessage::setFlash("Le module n'a pas pu être correctement téléchargé et installé, veuillez réesseyer dans un instant"); |
101 | 104 | } |
102 | 105 | } |
@@ -108,8 +111,7 @@ discard block |
||
108 | 111 | private function setSupprimerArchiveTemp() { |
109 | 112 | if (unlink(TEMPROOT.$this->nom_fichier) == true) { |
110 | 113 | return true; |
111 | - } |
|
112 | - else { |
|
114 | + } else { |
|
113 | 115 | return false; |
114 | 116 | } |
115 | 117 | } |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $minutesec = $minute * 60; |
29 | 29 | $heureseconde = $heuresec + $minutesec; |
30 | 30 | return $heureseconde; |
31 | - } |
|
32 | - else { |
|
31 | + } else { |
|
33 | 32 | FlashMessage::setFlash("La/les valeurs entrée n'est/ne sont pas de type int"); |
34 | 33 | FlashMessage::getFlash(); |
35 | 34 | die(); |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | |
49 | 48 | $temps = $heure."h".$minute."m".$seconde; |
50 | 49 | return $temps; |
51 | - } |
|
52 | - else { |
|
50 | + } else { |
|
53 | 51 | FlashMessage::setFlash("La valeur entrée n'est pas de type int"); |
54 | 52 | FlashMessage::getFlash(); |
55 | 53 | die(); |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | $chaine = str_replace(":", "h", $temps); |
67 | 65 | |
68 | 66 | return $chaine; |
69 | - } |
|
70 | - else { |
|
67 | + } else { |
|
71 | 68 | FlashMessage::setFlash("La valeur entrée n'est pas de type h:m"); |
72 | 69 | FlashMessage::getFlash(); |
73 | 70 | die(); |
@@ -85,8 +82,7 @@ discard block |
||
85 | 82 | |
86 | 83 | if ($date == 0) { |
87 | 84 | return $jours[date("w")]." ".date("j").(date("j") == 1 ? "er" : " ").$mois[date("n") - 1]." ".date("Y"); |
88 | - } |
|
89 | - else if ((strpos($date, "-") > 0) || (strpos($date, "/") > 0)) { |
|
85 | + } else if ((strpos($date, "-") > 0) || (strpos($date, "/") > 0)) { |
|
90 | 86 | $explode = explode("/", $date); |
91 | 87 | $jour_d = $explode[0]; |
92 | 88 | $mois_d = $explode[1]; |
@@ -130,8 +126,7 @@ discard block |
||
130 | 126 | self::$annee = $annee; |
131 | 127 | |
132 | 128 | return $jour."/".$mois."/".$annee; |
133 | - } |
|
134 | - else { |
|
129 | + } else { |
|
135 | 130 | FlashMessage::setFlash("format de date passé en paramètre ne correspond pas à YYYY-mm-jj"); |
136 | 131 | FlashMessage::getFlash(); |
137 | 132 | die(); |
@@ -153,8 +148,7 @@ discard block |
||
153 | 148 | $annee = $explode[2]; |
154 | 149 | |
155 | 150 | return $annee."-".$mois."-".$jour; |
156 | - } |
|
157 | - else { |
|
151 | + } else { |
|
158 | 152 | FlashMessage::setFlash("Format de date passé en paramètre ne correspond pas à jj/mm/aaaa"); |
159 | 153 | FlashMessage::getFlash(); |
160 | 154 | die(); |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | public static function FindInString($string, $find) { |
45 | 45 | if (strpos($string, $find) !== false) { |
46 | 46 | return true; |
47 | - } |
|
48 | - else { |
|
47 | + } else { |
|
49 | 48 | return false; |
50 | 49 | } |
51 | 50 | } |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | public static function alphaNumeric($string) { |
59 | 58 | if (!preg_match('/^[a-zA-Z0-9]+$/', $string)) { |
60 | 59 | return false; |
61 | - } |
|
62 | - else { |
|
60 | + } else { |
|
63 | 61 | return true; |
64 | 62 | } |
65 | 63 | } |