@@ -175,9 +175,9 @@ |
||
175 | 175 | ]); |
176 | 176 | } |
177 | 177 | if ($userItems) { |
178 | - $out .= \yii\widgets\Menu::widget([ |
|
179 | - // this is the old code to use the yii/bootstrap extension |
|
180 | - // it becomes very hard to remove bootstrap if we use these. |
|
178 | + $out .= \yii\widgets\Menu::widget([ |
|
179 | + // this is the old code to use the yii/bootstrap extension |
|
180 | + // it becomes very hard to remove bootstrap if we use these. |
|
181 | 181 | 'options'=> ['class' => 'navbar-nav navbar-right nav'], |
182 | 182 | 'items'=> $userItems['items'] |
183 | 183 | ]); |
@@ -20,18 +20,18 @@ |
||
20 | 20 | */ |
21 | 21 | class ServeController extends YiiServeController |
22 | 22 | { |
23 | - /** |
|
24 | - * @var int port to serve on. |
|
25 | - */ |
|
26 | - public $port = 8080; |
|
27 | - /** |
|
28 | - * @var string path or path alias to directory to serve |
|
29 | - */ |
|
30 | - public $docroot = '@root/public'; |
|
31 | - /** |
|
32 | - * @var string path to router script. |
|
33 | - * See https://secure.php.net/manual/en/features.commandline.webserver.php |
|
34 | - */ |
|
35 | - public $router; |
|
23 | + /** |
|
24 | + * @var int port to serve on. |
|
25 | + */ |
|
26 | + public $port = 8080; |
|
27 | + /** |
|
28 | + * @var string path or path alias to directory to serve |
|
29 | + */ |
|
30 | + public $docroot = '@root/public'; |
|
31 | + /** |
|
32 | + * @var string path to router script. |
|
33 | + * See https://secure.php.net/manual/en/features.commandline.webserver.php |
|
34 | + */ |
|
35 | + public $router; |
|
36 | 36 | |
37 | 37 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | */ |
24 | 24 | class MigrateController extends \yii\console\controllers\MigrateController |
25 | 25 | { |
26 | - /** |
|
27 | - * @inheritdoc |
|
28 | - */ |
|
29 | - public $templateFile = '@neon/core/views/migration.php'; |
|
26 | + /** |
|
27 | + * @inheritdoc |
|
28 | + */ |
|
29 | + public $templateFile = '@neon/core/views/migration.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @var string Define the app that is responsible for this migration. |
@@ -68,7 +68,7 @@ |
||
68 | 68 | * 'order' => 1010, |
69 | 69 | * 'url' => ['/cms/index/index'], |
70 | 70 | * 'visible => neon()->user->is('neon-administrator') |
71 | - * ]; |
|
71 | + * ]; |
|
72 | 72 | * ``` |
73 | 73 | */ |
74 | 74 | public function getMenu(); |
@@ -95,8 +95,8 @@ |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | - * @inheritDoc |
|
99 | - */ |
|
98 | + * @inheritDoc |
|
99 | + */ |
|
100 | 100 | public function having($column, $operator = null, $value = null) |
101 | 101 | { |
102 | 102 | throw new \Exception('Having clause is currently not supported by DDS - you need to be able to specify custom columns for a start'); |
@@ -21,9 +21,9 @@ |
||
21 | 21 | */ |
22 | 22 | public function getFieldHtml() |
23 | 23 | { |
24 | - return Html::tag('neon-core-form-fields-guidance', [ |
|
25 | - 'text' => $this->getText(), |
|
26 | - ]); |
|
24 | + return Html::tag('neon-core-form-fields-guidance', [ |
|
25 | + 'text' => $this->getText(), |
|
26 | + ]); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
556 | - * The install specific to the core apps (admin, user, settings, etc) |
|
557 | - * @return void |
|
558 | - */ |
|
556 | + * The install specific to the core apps (admin, user, settings, etc) |
|
557 | + * @return void |
|
558 | + */ |
|
559 | 559 | public function installCore() |
560 | 560 | { |
561 | 561 | foreach ($this->getCoreApps() as $appName => $config) { |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | } |
566 | 566 | |
567 | 567 | /** |
568 | - * Run the install function of each app |
|
569 | - * @return void |
|
570 | - */ |
|
568 | + * Run the install function of each app |
|
569 | + * @return void |
|
570 | + */ |
|
571 | 571 | public function installApps() |
572 | 572 | { |
573 | 573 | foreach ($this->getApps() as $appName => $config) { |
@@ -51,68 +51,68 @@ discard block |
||
51 | 51 | * Receiver constructor. |
52 | 52 | * @param Request $request |
53 | 53 | */ |
54 | - public function __construct(Request $request) |
|
55 | - { |
|
56 | - $this->_request = $request; |
|
57 | - } |
|
54 | + public function __construct(Request $request) |
|
55 | + { |
|
56 | + $this->_request = $request; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Get the temporary path where plupload will store the file uploads |
|
61 | - * @return string - writable directory path |
|
62 | - */ |
|
63 | - public function getPath() |
|
64 | - { |
|
65 | - $path = neon()->getAlias('@runtime/plupload'); |
|
66 | - if (!is_dir($path)) { |
|
67 | - mkdir($path, 0755, true); |
|
68 | - } |
|
69 | - return $path; |
|
70 | - } |
|
59 | + /** |
|
60 | + * Get the temporary path where plupload will store the file uploads |
|
61 | + * @return string - writable directory path |
|
62 | + */ |
|
63 | + public function getPath() |
|
64 | + { |
|
65 | + $path = neon()->getAlias('@runtime/plupload'); |
|
66 | + if (!is_dir($path)) { |
|
67 | + mkdir($path, 0755, true); |
|
68 | + } |
|
69 | + return $path; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Whether the plupload upload will be uploaded in chunks |
|
74 | - * @return bool |
|
75 | - */ |
|
76 | - public function hasChunks() |
|
77 | - { |
|
78 | - return (bool) $this->_request->getBodyParam('chunks', false); |
|
79 | - } |
|
72 | + /** |
|
73 | + * Whether the plupload upload will be uploaded in chunks |
|
74 | + * @return bool |
|
75 | + */ |
|
76 | + public function hasChunks() |
|
77 | + { |
|
78 | + return (bool) $this->_request->getBodyParam('chunks', false); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Receive a plupload upload |
|
83 | - * @param string $name - Name of the request variable that holds |
|
84 | - * the plupload file(s) - typically the name of the plupload input field |
|
85 | - * @param \Closure $handler - A handler function that is passed the uploaded file |
|
86 | - * method signature is: function(\neon\core\web\UploadedFile $file) {} |
|
87 | - * @return array - return the result of the upload back to plupload, this should be json encoded |
|
88 | - */ |
|
89 | - public function receive($name, \Closure $handler) |
|
90 | - { |
|
91 | - $response = []; |
|
92 | - $response['jsonrpc'] = '2.0'; |
|
93 | - if ($this->hasChunks()) { |
|
94 | - $result = $this->receiveChunks($name, $handler); |
|
95 | - } else { |
|
96 | - $result = $this->receiveSingle($name, $handler); |
|
97 | - } |
|
98 | - $response['result'] = $result; |
|
99 | - $response['id'] = 'plup'; |
|
100 | - return $response; |
|
101 | - } |
|
81 | + /** |
|
82 | + * Receive a plupload upload |
|
83 | + * @param string $name - Name of the request variable that holds |
|
84 | + * the plupload file(s) - typically the name of the plupload input field |
|
85 | + * @param \Closure $handler - A handler function that is passed the uploaded file |
|
86 | + * method signature is: function(\neon\core\web\UploadedFile $file) {} |
|
87 | + * @return array - return the result of the upload back to plupload, this should be json encoded |
|
88 | + */ |
|
89 | + public function receive($name, \Closure $handler) |
|
90 | + { |
|
91 | + $response = []; |
|
92 | + $response['jsonrpc'] = '2.0'; |
|
93 | + if ($this->hasChunks()) { |
|
94 | + $result = $this->receiveChunks($name, $handler); |
|
95 | + } else { |
|
96 | + $result = $this->receiveSingle($name, $handler); |
|
97 | + } |
|
98 | + $response['result'] = $result; |
|
99 | + $response['id'] = 'plup'; |
|
100 | + return $response; |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Process single file upload |
|
105 | - * @param string $name |
|
106 | - * @param \Closure $handler - function to call on successful upload completed |
|
107 | - * @return bool|mixed |
|
108 | - */ |
|
109 | - public function receiveSingle($name, \Closure $handler) |
|
110 | - { |
|
111 | - if ($this->_request->file($name)) { |
|
112 | - return $handler($this->_request->file($name)); |
|
113 | - } |
|
114 | - return false; |
|
115 | - } |
|
103 | + /** |
|
104 | + * Process single file upload |
|
105 | + * @param string $name |
|
106 | + * @param \Closure $handler - function to call on successful upload completed |
|
107 | + * @return bool|mixed |
|
108 | + */ |
|
109 | + public function receiveSingle($name, \Closure $handler) |
|
110 | + { |
|
111 | + if ($this->_request->file($name)) { |
|
112 | + return $handler($this->_request->file($name)); |
|
113 | + } |
|
114 | + return false; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Process chunked file upload |
@@ -121,30 +121,30 @@ discard block |
||
121 | 121 | * @throws \Exception |
122 | 122 | * @return bool |
123 | 123 | */ |
124 | - public function receiveChunks($name, $handler) |
|
125 | - { |
|
126 | - $result = false; |
|
127 | - if ($this->_request->file($name)) { |
|
128 | - $file = $this->_request->file($name); |
|
129 | - $chunk = (int) $this->_request->getBodyParam("chunk", 0); |
|
130 | - $chunks = (int) $this->_request->getBodyParam("chunks", 0 ); |
|
131 | - $originalName = $this->_request->getBodyParam('name'); |
|
132 | - $filePath = $this->getPath().'/'.$originalName.'.part'; |
|
133 | - $this->_removeOldData($filePath); |
|
134 | - $this->_appendData($filePath, $file); |
|
135 | - if ($chunk == $chunks - 1) { |
|
136 | - $file = new UploadedFile([ |
|
137 | - 'name' => $originalName, |
|
138 | - 'size' => filesize($filePath), |
|
139 | - 'tempName' => $filePath, |
|
140 | - 'error' => UPLOAD_ERR_OK |
|
141 | - ]); |
|
142 | - $result = $handler($file); |
|
143 | - unlink($filePath); |
|
144 | - } |
|
145 | - } |
|
146 | - return $result; |
|
147 | - } |
|
124 | + public function receiveChunks($name, $handler) |
|
125 | + { |
|
126 | + $result = false; |
|
127 | + if ($this->_request->file($name)) { |
|
128 | + $file = $this->_request->file($name); |
|
129 | + $chunk = (int) $this->_request->getBodyParam("chunk", 0); |
|
130 | + $chunks = (int) $this->_request->getBodyParam("chunks", 0 ); |
|
131 | + $originalName = $this->_request->getBodyParam('name'); |
|
132 | + $filePath = $this->getPath().'/'.$originalName.'.part'; |
|
133 | + $this->_removeOldData($filePath); |
|
134 | + $this->_appendData($filePath, $file); |
|
135 | + if ($chunk == $chunks - 1) { |
|
136 | + $file = new UploadedFile([ |
|
137 | + 'name' => $originalName, |
|
138 | + 'size' => filesize($filePath), |
|
139 | + 'tempName' => $filePath, |
|
140 | + 'error' => UPLOAD_ERR_OK |
|
141 | + ]); |
|
142 | + $result = $handler($file); |
|
143 | + unlink($filePath); |
|
144 | + } |
|
145 | + } |
|
146 | + return $result; |
|
147 | + } |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Todo: requires test |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | * @param string $path Optional firefly media virtual path |
165 | 165 | * @return array |
166 | 166 | */ |
167 | - public function receiveToFirefly($name, $path='/') |
|
168 | - { |
|
169 | - return $this->receive($name, function (UploadedFile $file) use ($path) { |
|
170 | - // save file to firefly |
|
171 | - $id = neon()->firefly->fileManager->saveFile($file); |
|
172 | - $meta = neon()->firefly->mediaManager->addFile($id, $path); |
|
173 | - return $meta; |
|
174 | - }); |
|
175 | - } |
|
167 | + public function receiveToFirefly($name, $path='/') |
|
168 | + { |
|
169 | + return $this->receive($name, function (UploadedFile $file) use ($path) { |
|
170 | + // save file to firefly |
|
171 | + $id = neon()->firefly->fileManager->saveFile($file); |
|
172 | + $meta = neon()->firefly->mediaManager->addFile($id, $path); |
|
173 | + return $meta; |
|
174 | + }); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Receives a file and saves it to firefly file manager only. |
@@ -206,29 +206,29 @@ discard block |
||
206 | 206 | * @param UploadedFile $file |
207 | 207 | * @throws PluploadException |
208 | 208 | */ |
209 | - protected function _appendData($filePathPartial, UploadedFile $file) |
|
210 | - { |
|
211 | - if (!$out = fopen($filePathPartial, 'ab')) { |
|
212 | - throw new PluploadException('Failed to open output stream.', 102); |
|
213 | - } |
|
214 | - if (!$in = fopen($file->getRealPath(), 'rb')) { |
|
215 | - throw new PluploadException('Failed to open input stream', 101); |
|
216 | - } |
|
217 | - while ($buff = fread($in, 4096)) { |
|
218 | - fwrite($out, $buff); |
|
219 | - } |
|
220 | - fclose($out); |
|
221 | - fclose($in); |
|
222 | - } |
|
209 | + protected function _appendData($filePathPartial, UploadedFile $file) |
|
210 | + { |
|
211 | + if (!$out = fopen($filePathPartial, 'ab')) { |
|
212 | + throw new PluploadException('Failed to open output stream.', 102); |
|
213 | + } |
|
214 | + if (!$in = fopen($file->getRealPath(), 'rb')) { |
|
215 | + throw new PluploadException('Failed to open input stream', 101); |
|
216 | + } |
|
217 | + while ($buff = fread($in, 4096)) { |
|
218 | + fwrite($out, $buff); |
|
219 | + } |
|
220 | + fclose($out); |
|
221 | + fclose($in); |
|
222 | + } |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Remove old files |
226 | 226 | * @param string $filePath |
227 | 227 | */ |
228 | - protected function _removeOldData($filePath) |
|
229 | - { |
|
230 | - if (file_exists($filePath) && filemtime($filePath) < time() - $this->maxFileAge) { |
|
231 | - unlink($filePath); |
|
232 | - } |
|
233 | - } |
|
228 | + protected function _removeOldData($filePath) |
|
229 | + { |
|
230 | + if (file_exists($filePath) && filemtime($filePath) < time() - $this->maxFileAge) { |
|
231 | + unlink($filePath); |
|
232 | + } |
|
233 | + } |
|
234 | 234 | } |
235 | 235 | \ No newline at end of file |
@@ -138,7 +138,7 @@ |
||
138 | 138 | * Send appropriate cache headers |
139 | 139 | * @param string $mime - mime type of file |
140 | 140 | * @param string|int $size - size in bytes of response |
141 | - * @param string $modified - MySQL Datetime |
|
141 | + * @param string $modified - MySQL Datetime |
|
142 | 142 | * @param string $eTag - eTag token header to use |
143 | 143 | * @param string $name - filename string to use in content disposition header |
144 | 144 | */ |