@@ -29,15 +29,15 @@ |
||
29 | 29 | */ |
30 | 30 | interface ILinkAction extends IAction { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 12.0 |
|
34 | - * @param string $href the target URL of the action |
|
35 | - */ |
|
36 | - public function setHref($href); |
|
32 | + /** |
|
33 | + * @since 12.0 |
|
34 | + * @param string $href the target URL of the action |
|
35 | + */ |
|
36 | + public function setHref($href); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @since 12.0 |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function getHref(); |
|
38 | + /** |
|
39 | + * @since 12.0 |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function getHref(); |
|
43 | 43 | } |
@@ -29,9 +29,9 @@ |
||
29 | 29 | */ |
30 | 30 | interface IProvider { |
31 | 31 | |
32 | - /** |
|
33 | - * @since 12.0 |
|
34 | - * @param IEntry $entry |
|
35 | - */ |
|
36 | - public function process(IEntry $entry); |
|
32 | + /** |
|
33 | + * @since 12.0 |
|
34 | + * @param IEntry $entry |
|
35 | + */ |
|
36 | + public function process(IEntry $entry); |
|
37 | 37 | } |
@@ -30,69 +30,69 @@ |
||
30 | 30 | |
31 | 31 | class Manager { |
32 | 32 | |
33 | - /** @var ContactsStore */ |
|
34 | - private $store; |
|
33 | + /** @var ContactsStore */ |
|
34 | + private $store; |
|
35 | 35 | |
36 | - /** @var ActionProviderStore */ |
|
37 | - private $actionProviderStore; |
|
36 | + /** @var ActionProviderStore */ |
|
37 | + private $actionProviderStore; |
|
38 | 38 | |
39 | - /** @var IAppManager */ |
|
40 | - private $appManager; |
|
39 | + /** @var IAppManager */ |
|
40 | + private $appManager; |
|
41 | 41 | |
42 | - /** @var IURLGenerator */ |
|
43 | - private $urlGenerator; |
|
42 | + /** @var IURLGenerator */ |
|
43 | + private $urlGenerator; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param ContactsStore $store |
|
47 | - * @param ActionProviderStore $actionProviderStore |
|
48 | - * @param IAppManager $appManager |
|
49 | - */ |
|
50 | - public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) { |
|
51 | - $this->store = $store; |
|
52 | - $this->actionProviderStore = $actionProviderStore; |
|
53 | - $this->appManager = $appManager; |
|
54 | - } |
|
45 | + /** |
|
46 | + * @param ContactsStore $store |
|
47 | + * @param ActionProviderStore $actionProviderStore |
|
48 | + * @param IAppManager $appManager |
|
49 | + */ |
|
50 | + public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) { |
|
51 | + $this->store = $store; |
|
52 | + $this->actionProviderStore = $actionProviderStore; |
|
53 | + $this->appManager = $appManager; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param string $userId |
|
58 | - * @param string $filter |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - public function getEntries($userId, $filter) { |
|
62 | - $entries = $this->store->getContacts($filter); |
|
56 | + /** |
|
57 | + * @param string $userId |
|
58 | + * @param string $filter |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + public function getEntries($userId, $filter) { |
|
62 | + $entries = $this->store->getContacts($filter); |
|
63 | 63 | |
64 | - $sortedEntries = $this->sortEntries($entries); |
|
65 | - $topEntries = array_slice($sortedEntries, 0, 25); |
|
66 | - $this->processEntries($topEntries); |
|
64 | + $sortedEntries = $this->sortEntries($entries); |
|
65 | + $topEntries = array_slice($sortedEntries, 0, 25); |
|
66 | + $this->processEntries($topEntries); |
|
67 | 67 | |
68 | - $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $userId); |
|
69 | - return [ |
|
70 | - 'contacts' => $topEntries, |
|
71 | - 'contactsAppEnabled' => $contactsEnabled, |
|
72 | - ]; |
|
73 | - } |
|
68 | + $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $userId); |
|
69 | + return [ |
|
70 | + 'contacts' => $topEntries, |
|
71 | + 'contactsAppEnabled' => $contactsEnabled, |
|
72 | + ]; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @param IEntry[] $entries |
|
77 | - * @return IEntry[] |
|
78 | - */ |
|
79 | - private function sortEntries(array $entries) { |
|
80 | - usort($entries, function(IEntry $entryA, IEntry $entryB) { |
|
81 | - return strcasecmp($entryA->getFullName(), $entryB->getFullName()); |
|
82 | - }); |
|
83 | - return $entries; |
|
84 | - } |
|
75 | + /** |
|
76 | + * @param IEntry[] $entries |
|
77 | + * @return IEntry[] |
|
78 | + */ |
|
79 | + private function sortEntries(array $entries) { |
|
80 | + usort($entries, function(IEntry $entryA, IEntry $entryB) { |
|
81 | + return strcasecmp($entryA->getFullName(), $entryB->getFullName()); |
|
82 | + }); |
|
83 | + return $entries; |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param IEntry[] $entries |
|
88 | - */ |
|
89 | - private function processEntries(array $entries) { |
|
90 | - $providers = $this->actionProviderStore->getProviders(); |
|
91 | - foreach ($entries as $entry) { |
|
92 | - foreach ($providers as $provider) { |
|
93 | - $provider->process($entry); |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
86 | + /** |
|
87 | + * @param IEntry[] $entries |
|
88 | + */ |
|
89 | + private function processEntries(array $entries) { |
|
90 | + $providers = $this->actionProviderStore->getProviders(); |
|
91 | + foreach ($entries as $entry) { |
|
92 | + foreach ($providers as $provider) { |
|
93 | + $provider->process($entry); |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | 98 | } |
@@ -44,347 +44,347 @@ |
||
44 | 44 | */ |
45 | 45 | class OC_Template extends \OC\Template\Base { |
46 | 46 | |
47 | - /** @var string */ |
|
48 | - private $renderAs; // Create a full page? |
|
49 | - |
|
50 | - /** @var string */ |
|
51 | - private $path; // The path to the template |
|
52 | - |
|
53 | - /** @var array */ |
|
54 | - private $headers = array(); //custom headers |
|
55 | - |
|
56 | - /** @var string */ |
|
57 | - protected $app; // app id |
|
58 | - |
|
59 | - protected static $initTemplateEngineFirstRun = true; |
|
60 | - |
|
61 | - /** |
|
62 | - * Constructor |
|
63 | - * |
|
64 | - * @param string $app app providing the template |
|
65 | - * @param string $name of the template file (without suffix) |
|
66 | - * @param string $renderAs If $renderAs is set, OC_Template will try to |
|
67 | - * produce a full page in the according layout. For |
|
68 | - * now, $renderAs can be set to "guest", "user" or |
|
69 | - * "admin". |
|
70 | - * @param bool $registerCall = true |
|
71 | - */ |
|
72 | - public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { |
|
73 | - // Read the selected theme from the config file |
|
74 | - self::initTemplateEngine($renderAs); |
|
75 | - |
|
76 | - $theme = OC_Util::getTheme(); |
|
77 | - |
|
78 | - $requestToken = (OC::$server->getSession() && $registerCall) ? \OCP\Util::callRegister() : ''; |
|
79 | - |
|
80 | - $parts = explode('/', $app); // fix translation when app is something like core/lostpassword |
|
81 | - $l10n = \OC::$server->getL10N($parts[0]); |
|
82 | - $themeDefaults = \OC::$server->getThemingDefaults(); |
|
83 | - |
|
84 | - list($path, $template) = $this->findTemplate($theme, $app, $name); |
|
85 | - |
|
86 | - // Set the private data |
|
87 | - $this->renderAs = $renderAs; |
|
88 | - $this->path = $path; |
|
89 | - $this->app = $app; |
|
90 | - |
|
91 | - parent::__construct($template, $requestToken, $l10n, $themeDefaults); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @param string $renderAs |
|
96 | - */ |
|
97 | - public static function initTemplateEngine($renderAs) { |
|
98 | - if (self::$initTemplateEngineFirstRun){ |
|
99 | - |
|
100 | - //apps that started before the template initialization can load their own scripts/styles |
|
101 | - //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true |
|
102 | - //meaning the last script/style in this list will be loaded first |
|
103 | - if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { |
|
104 | - if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { |
|
105 | - OC_Util::addScript ( 'backgroundjobs', null, true ); |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - OC_Util::addStyle('jquery-ui-fixes',null,true); |
|
110 | - OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui',null,true); |
|
111 | - OC_Util::addStyle('server', null, true); |
|
112 | - |
|
113 | - // avatars |
|
114 | - \OC_Util::addScript('jquery.avatar', null, true); |
|
115 | - \OC_Util::addScript('placeholder', null, true); |
|
116 | - |
|
117 | - OC_Util::addVendorScript('select2/select2'); |
|
118 | - OC_Util::addVendorStyle('select2/select2', null, true); |
|
119 | - OC_Util::addScript('select2-toggleselect'); |
|
120 | - |
|
121 | - OC_Util::addScript('oc-backbone', null, true); |
|
122 | - OC_Util::addVendorScript('core', 'backbone/backbone', true); |
|
123 | - OC_Util::addVendorScript('snapjs/dist/latest/snap', null, true); |
|
124 | - OC_Util::addScript('mimetypelist', null, true); |
|
125 | - OC_Util::addScript('mimetype', null, true); |
|
126 | - OC_Util::addScript("apps", null, true); |
|
127 | - OC_Util::addScript("oc-requesttoken", null, true); |
|
128 | - OC_Util::addScript('search', 'search', true); |
|
129 | - OC_Util::addScript("config", null, true); |
|
130 | - OC_Util::addScript("public/appconfig", null, true); |
|
131 | - OC_Util::addScript("eventsource", null, true); |
|
132 | - OC_Util::addScript("octemplate", null, true); |
|
133 | - OC_Util::addTranslations("core", null, true); |
|
134 | - OC_Util::addScript("l10n", null, true); |
|
135 | - OC_Util::addScript("js", null, true); |
|
136 | - OC_Util::addScript("oc-dialogs", null, true); |
|
137 | - OC_Util::addScript("jquery.ocdialog", null, true); |
|
138 | - OC_Util::addScript("jquery-ui-fixes"); |
|
139 | - OC_Util::addStyle("jquery.ocdialog"); |
|
140 | - OC_Util::addScript('files/fileinfo'); |
|
141 | - OC_Util::addScript('files/client'); |
|
142 | - OC_Util::addScript('contactsmenu'); |
|
143 | - |
|
144 | - // Add the stuff we need always |
|
145 | - // following logic will import all vendor libraries that are |
|
146 | - // specified in core/js/core.json |
|
147 | - $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json'); |
|
148 | - if($fileContent !== false) { |
|
149 | - $coreDependencies = json_decode($fileContent, true); |
|
150 | - foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) { |
|
151 | - // remove trailing ".js" as addVendorScript will append it |
|
152 | - OC_Util::addVendorScript( |
|
153 | - substr($vendorLibrary, 0, strlen($vendorLibrary) - 3),null,true); |
|
154 | - } |
|
155 | - } else { |
|
156 | - throw new \Exception('Cannot read core/js/core.json'); |
|
157 | - } |
|
158 | - |
|
159 | - if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) { |
|
160 | - // polyfill for btoa/atob for IE friends |
|
161 | - OC_Util::addVendorScript('base64/base64'); |
|
162 | - // shim for the davclient.js library |
|
163 | - \OCP\Util::addScript('files/iedavclient'); |
|
164 | - } |
|
165 | - |
|
166 | - self::$initTemplateEngineFirstRun = false; |
|
167 | - } |
|
168 | - |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - /** |
|
173 | - * find the template with the given name |
|
174 | - * @param string $name of the template file (without suffix) |
|
175 | - * |
|
176 | - * Will select the template file for the selected theme. |
|
177 | - * Checking all the possible locations. |
|
178 | - * @param string $theme |
|
179 | - * @param string $app |
|
180 | - * @return string[] |
|
181 | - */ |
|
182 | - protected function findTemplate($theme, $app, $name) { |
|
183 | - // Check if it is a app template or not. |
|
184 | - if( $app !== '' ) { |
|
185 | - $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); |
|
186 | - } else { |
|
187 | - $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); |
|
188 | - } |
|
189 | - $locator = new \OC\Template\TemplateFileLocator( $dirs ); |
|
190 | - $template = $locator->find($name); |
|
191 | - $path = $locator->getPath(); |
|
192 | - return array($path, $template); |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Add a custom element to the header |
|
197 | - * @param string $tag tag name of the element |
|
198 | - * @param array $attributes array of attributes for the element |
|
199 | - * @param string $text the text content for the element. If $text is null then the |
|
200 | - * element will be written as empty element. So use "" to get a closing tag. |
|
201 | - */ |
|
202 | - public function addHeader($tag, $attributes, $text=null) { |
|
203 | - $this->headers[]= array( |
|
204 | - 'tag' => $tag, |
|
205 | - 'attributes' => $attributes, |
|
206 | - 'text' => $text |
|
207 | - ); |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * Process the template |
|
212 | - * @return boolean|string |
|
213 | - * |
|
214 | - * This function process the template. If $this->renderAs is set, it |
|
215 | - * will produce a full page. |
|
216 | - */ |
|
217 | - public function fetchPage($additionalParams = null) { |
|
218 | - $data = parent::fetchPage($additionalParams); |
|
219 | - |
|
220 | - if( $this->renderAs ) { |
|
221 | - $page = new TemplateLayout($this->renderAs, $this->app); |
|
222 | - |
|
223 | - // Add custom headers |
|
224 | - $headers = ''; |
|
225 | - foreach(OC_Util::$headers as $header) { |
|
226 | - $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); |
|
227 | - foreach($header['attributes'] as $name=>$value) { |
|
228 | - $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"'; |
|
229 | - } |
|
230 | - if ($header['text'] !== null) { |
|
231 | - $headers .= '>'.\OCP\Util::sanitizeHTML($header['text']).'</'.\OCP\Util::sanitizeHTML($header['tag']).'>'; |
|
232 | - } else { |
|
233 | - $headers .= '/>'; |
|
234 | - } |
|
235 | - } |
|
236 | - |
|
237 | - $page->assign('headers', $headers); |
|
238 | - |
|
239 | - $page->assign('content', $data); |
|
240 | - return $page->fetchPage(); |
|
241 | - } |
|
242 | - |
|
243 | - return $data; |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * Include template |
|
248 | - * |
|
249 | - * @param string $file |
|
250 | - * @param array|null $additionalParams |
|
251 | - * @return string returns content of included template |
|
252 | - * |
|
253 | - * Includes another template. use <?php echo $this->inc('template'); ?> to |
|
254 | - * do this. |
|
255 | - */ |
|
256 | - public function inc( $file, $additionalParams = null ) { |
|
257 | - return $this->load($this->path.$file.'.php', $additionalParams); |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
261 | - * Shortcut to print a simple page for users |
|
262 | - * @param string $application The application we render the template for |
|
263 | - * @param string $name Name of the template |
|
264 | - * @param array $parameters Parameters for the template |
|
265 | - * @return boolean|null |
|
266 | - */ |
|
267 | - public static function printUserPage( $application, $name, $parameters = array() ) { |
|
268 | - $content = new OC_Template( $application, $name, "user" ); |
|
269 | - foreach( $parameters as $key => $value ) { |
|
270 | - $content->assign( $key, $value ); |
|
271 | - } |
|
272 | - print $content->printPage(); |
|
273 | - } |
|
274 | - |
|
275 | - /** |
|
276 | - * Shortcut to print a simple page for admins |
|
277 | - * @param string $application The application we render the template for |
|
278 | - * @param string $name Name of the template |
|
279 | - * @param array $parameters Parameters for the template |
|
280 | - * @return bool |
|
281 | - */ |
|
282 | - public static function printAdminPage( $application, $name, $parameters = array() ) { |
|
283 | - $content = new OC_Template( $application, $name, "admin" ); |
|
284 | - foreach( $parameters as $key => $value ) { |
|
285 | - $content->assign( $key, $value ); |
|
286 | - } |
|
287 | - return $content->printPage(); |
|
288 | - } |
|
289 | - |
|
290 | - /** |
|
291 | - * Shortcut to print a simple page for guests |
|
292 | - * @param string $application The application we render the template for |
|
293 | - * @param string $name Name of the template |
|
294 | - * @param array|string $parameters Parameters for the template |
|
295 | - * @return bool |
|
296 | - */ |
|
297 | - public static function printGuestPage( $application, $name, $parameters = array() ) { |
|
298 | - $content = new OC_Template( $application, $name, "guest" ); |
|
299 | - foreach( $parameters as $key => $value ) { |
|
300 | - $content->assign( $key, $value ); |
|
301 | - } |
|
302 | - return $content->printPage(); |
|
303 | - } |
|
304 | - |
|
305 | - /** |
|
306 | - * Print a fatal error page and terminates the script |
|
307 | - * @param string $error_msg The error message to show |
|
308 | - * @param string $hint An optional hint message - needs to be properly escaped |
|
309 | - */ |
|
310 | - public static function printErrorPage( $error_msg, $hint = '' ) { |
|
311 | - if ($error_msg === $hint) { |
|
312 | - // If the hint is the same as the message there is no need to display it twice. |
|
313 | - $hint = ''; |
|
314 | - } |
|
315 | - |
|
316 | - try { |
|
317 | - $content = new \OC_Template( '', 'error', 'error', false ); |
|
318 | - $errors = array(array('error' => $error_msg, 'hint' => $hint)); |
|
319 | - $content->assign( 'errors', $errors ); |
|
320 | - $content->printPage(); |
|
321 | - } catch (\Exception $e) { |
|
322 | - $logger = \OC::$server->getLogger(); |
|
323 | - $logger->error("$error_msg $hint", ['app' => 'core']); |
|
324 | - $logger->logException($e, ['app' => 'core']); |
|
325 | - |
|
326 | - header(self::getHttpProtocol() . ' 500 Internal Server Error'); |
|
327 | - header('Content-Type: text/plain; charset=utf-8'); |
|
328 | - print("$error_msg $hint"); |
|
329 | - } |
|
330 | - die(); |
|
331 | - } |
|
332 | - |
|
333 | - /** |
|
334 | - * print error page using Exception details |
|
335 | - * @param Exception | Throwable $exception |
|
336 | - */ |
|
337 | - public static function printExceptionErrorPage($exception, $fetchPage = false) { |
|
338 | - try { |
|
339 | - $request = \OC::$server->getRequest(); |
|
340 | - $content = new \OC_Template('', 'exception', 'error', false); |
|
341 | - $content->assign('errorClass', get_class($exception)); |
|
342 | - $content->assign('errorMsg', $exception->getMessage()); |
|
343 | - $content->assign('errorCode', $exception->getCode()); |
|
344 | - $content->assign('file', $exception->getFile()); |
|
345 | - $content->assign('line', $exception->getLine()); |
|
346 | - $content->assign('trace', $exception->getTraceAsString()); |
|
347 | - $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); |
|
348 | - $content->assign('remoteAddr', $request->getRemoteAddress()); |
|
349 | - $content->assign('requestID', $request->getId()); |
|
350 | - if ($fetchPage) { |
|
351 | - return $content->fetchPage(); |
|
352 | - } |
|
353 | - $content->printPage(); |
|
354 | - } catch (\Exception $e) { |
|
355 | - $logger = \OC::$server->getLogger(); |
|
356 | - $logger->logException($exception, ['app' => 'core']); |
|
357 | - $logger->logException($e, ['app' => 'core']); |
|
358 | - |
|
359 | - header(self::getHttpProtocol() . ' 500 Internal Server Error'); |
|
360 | - header('Content-Type: text/plain; charset=utf-8'); |
|
361 | - print("Internal Server Error\n\n"); |
|
362 | - print("The server encountered an internal error and was unable to complete your request.\n"); |
|
363 | - print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
364 | - print("More details can be found in the server log.\n"); |
|
365 | - } |
|
366 | - die(); |
|
367 | - } |
|
368 | - |
|
369 | - /** |
|
370 | - * This is only here to reduce the dependencies in case of an exception to |
|
371 | - * still be able to print a plain error message. |
|
372 | - * |
|
373 | - * Returns the used HTTP protocol. |
|
374 | - * |
|
375 | - * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. |
|
376 | - * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead |
|
377 | - */ |
|
378 | - protected static function getHttpProtocol() { |
|
379 | - $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
380 | - $validProtocols = [ |
|
381 | - 'HTTP/1.0', |
|
382 | - 'HTTP/1.1', |
|
383 | - 'HTTP/2', |
|
384 | - ]; |
|
385 | - if(in_array($claimedProtocol, $validProtocols, true)) { |
|
386 | - return $claimedProtocol; |
|
387 | - } |
|
388 | - return 'HTTP/1.1'; |
|
389 | - } |
|
47 | + /** @var string */ |
|
48 | + private $renderAs; // Create a full page? |
|
49 | + |
|
50 | + /** @var string */ |
|
51 | + private $path; // The path to the template |
|
52 | + |
|
53 | + /** @var array */ |
|
54 | + private $headers = array(); //custom headers |
|
55 | + |
|
56 | + /** @var string */ |
|
57 | + protected $app; // app id |
|
58 | + |
|
59 | + protected static $initTemplateEngineFirstRun = true; |
|
60 | + |
|
61 | + /** |
|
62 | + * Constructor |
|
63 | + * |
|
64 | + * @param string $app app providing the template |
|
65 | + * @param string $name of the template file (without suffix) |
|
66 | + * @param string $renderAs If $renderAs is set, OC_Template will try to |
|
67 | + * produce a full page in the according layout. For |
|
68 | + * now, $renderAs can be set to "guest", "user" or |
|
69 | + * "admin". |
|
70 | + * @param bool $registerCall = true |
|
71 | + */ |
|
72 | + public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { |
|
73 | + // Read the selected theme from the config file |
|
74 | + self::initTemplateEngine($renderAs); |
|
75 | + |
|
76 | + $theme = OC_Util::getTheme(); |
|
77 | + |
|
78 | + $requestToken = (OC::$server->getSession() && $registerCall) ? \OCP\Util::callRegister() : ''; |
|
79 | + |
|
80 | + $parts = explode('/', $app); // fix translation when app is something like core/lostpassword |
|
81 | + $l10n = \OC::$server->getL10N($parts[0]); |
|
82 | + $themeDefaults = \OC::$server->getThemingDefaults(); |
|
83 | + |
|
84 | + list($path, $template) = $this->findTemplate($theme, $app, $name); |
|
85 | + |
|
86 | + // Set the private data |
|
87 | + $this->renderAs = $renderAs; |
|
88 | + $this->path = $path; |
|
89 | + $this->app = $app; |
|
90 | + |
|
91 | + parent::__construct($template, $requestToken, $l10n, $themeDefaults); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @param string $renderAs |
|
96 | + */ |
|
97 | + public static function initTemplateEngine($renderAs) { |
|
98 | + if (self::$initTemplateEngineFirstRun){ |
|
99 | + |
|
100 | + //apps that started before the template initialization can load their own scripts/styles |
|
101 | + //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true |
|
102 | + //meaning the last script/style in this list will be loaded first |
|
103 | + if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { |
|
104 | + if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { |
|
105 | + OC_Util::addScript ( 'backgroundjobs', null, true ); |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + OC_Util::addStyle('jquery-ui-fixes',null,true); |
|
110 | + OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui',null,true); |
|
111 | + OC_Util::addStyle('server', null, true); |
|
112 | + |
|
113 | + // avatars |
|
114 | + \OC_Util::addScript('jquery.avatar', null, true); |
|
115 | + \OC_Util::addScript('placeholder', null, true); |
|
116 | + |
|
117 | + OC_Util::addVendorScript('select2/select2'); |
|
118 | + OC_Util::addVendorStyle('select2/select2', null, true); |
|
119 | + OC_Util::addScript('select2-toggleselect'); |
|
120 | + |
|
121 | + OC_Util::addScript('oc-backbone', null, true); |
|
122 | + OC_Util::addVendorScript('core', 'backbone/backbone', true); |
|
123 | + OC_Util::addVendorScript('snapjs/dist/latest/snap', null, true); |
|
124 | + OC_Util::addScript('mimetypelist', null, true); |
|
125 | + OC_Util::addScript('mimetype', null, true); |
|
126 | + OC_Util::addScript("apps", null, true); |
|
127 | + OC_Util::addScript("oc-requesttoken", null, true); |
|
128 | + OC_Util::addScript('search', 'search', true); |
|
129 | + OC_Util::addScript("config", null, true); |
|
130 | + OC_Util::addScript("public/appconfig", null, true); |
|
131 | + OC_Util::addScript("eventsource", null, true); |
|
132 | + OC_Util::addScript("octemplate", null, true); |
|
133 | + OC_Util::addTranslations("core", null, true); |
|
134 | + OC_Util::addScript("l10n", null, true); |
|
135 | + OC_Util::addScript("js", null, true); |
|
136 | + OC_Util::addScript("oc-dialogs", null, true); |
|
137 | + OC_Util::addScript("jquery.ocdialog", null, true); |
|
138 | + OC_Util::addScript("jquery-ui-fixes"); |
|
139 | + OC_Util::addStyle("jquery.ocdialog"); |
|
140 | + OC_Util::addScript('files/fileinfo'); |
|
141 | + OC_Util::addScript('files/client'); |
|
142 | + OC_Util::addScript('contactsmenu'); |
|
143 | + |
|
144 | + // Add the stuff we need always |
|
145 | + // following logic will import all vendor libraries that are |
|
146 | + // specified in core/js/core.json |
|
147 | + $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json'); |
|
148 | + if($fileContent !== false) { |
|
149 | + $coreDependencies = json_decode($fileContent, true); |
|
150 | + foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) { |
|
151 | + // remove trailing ".js" as addVendorScript will append it |
|
152 | + OC_Util::addVendorScript( |
|
153 | + substr($vendorLibrary, 0, strlen($vendorLibrary) - 3),null,true); |
|
154 | + } |
|
155 | + } else { |
|
156 | + throw new \Exception('Cannot read core/js/core.json'); |
|
157 | + } |
|
158 | + |
|
159 | + if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) { |
|
160 | + // polyfill for btoa/atob for IE friends |
|
161 | + OC_Util::addVendorScript('base64/base64'); |
|
162 | + // shim for the davclient.js library |
|
163 | + \OCP\Util::addScript('files/iedavclient'); |
|
164 | + } |
|
165 | + |
|
166 | + self::$initTemplateEngineFirstRun = false; |
|
167 | + } |
|
168 | + |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + /** |
|
173 | + * find the template with the given name |
|
174 | + * @param string $name of the template file (without suffix) |
|
175 | + * |
|
176 | + * Will select the template file for the selected theme. |
|
177 | + * Checking all the possible locations. |
|
178 | + * @param string $theme |
|
179 | + * @param string $app |
|
180 | + * @return string[] |
|
181 | + */ |
|
182 | + protected function findTemplate($theme, $app, $name) { |
|
183 | + // Check if it is a app template or not. |
|
184 | + if( $app !== '' ) { |
|
185 | + $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); |
|
186 | + } else { |
|
187 | + $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); |
|
188 | + } |
|
189 | + $locator = new \OC\Template\TemplateFileLocator( $dirs ); |
|
190 | + $template = $locator->find($name); |
|
191 | + $path = $locator->getPath(); |
|
192 | + return array($path, $template); |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Add a custom element to the header |
|
197 | + * @param string $tag tag name of the element |
|
198 | + * @param array $attributes array of attributes for the element |
|
199 | + * @param string $text the text content for the element. If $text is null then the |
|
200 | + * element will be written as empty element. So use "" to get a closing tag. |
|
201 | + */ |
|
202 | + public function addHeader($tag, $attributes, $text=null) { |
|
203 | + $this->headers[]= array( |
|
204 | + 'tag' => $tag, |
|
205 | + 'attributes' => $attributes, |
|
206 | + 'text' => $text |
|
207 | + ); |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * Process the template |
|
212 | + * @return boolean|string |
|
213 | + * |
|
214 | + * This function process the template. If $this->renderAs is set, it |
|
215 | + * will produce a full page. |
|
216 | + */ |
|
217 | + public function fetchPage($additionalParams = null) { |
|
218 | + $data = parent::fetchPage($additionalParams); |
|
219 | + |
|
220 | + if( $this->renderAs ) { |
|
221 | + $page = new TemplateLayout($this->renderAs, $this->app); |
|
222 | + |
|
223 | + // Add custom headers |
|
224 | + $headers = ''; |
|
225 | + foreach(OC_Util::$headers as $header) { |
|
226 | + $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); |
|
227 | + foreach($header['attributes'] as $name=>$value) { |
|
228 | + $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"'; |
|
229 | + } |
|
230 | + if ($header['text'] !== null) { |
|
231 | + $headers .= '>'.\OCP\Util::sanitizeHTML($header['text']).'</'.\OCP\Util::sanitizeHTML($header['tag']).'>'; |
|
232 | + } else { |
|
233 | + $headers .= '/>'; |
|
234 | + } |
|
235 | + } |
|
236 | + |
|
237 | + $page->assign('headers', $headers); |
|
238 | + |
|
239 | + $page->assign('content', $data); |
|
240 | + return $page->fetchPage(); |
|
241 | + } |
|
242 | + |
|
243 | + return $data; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * Include template |
|
248 | + * |
|
249 | + * @param string $file |
|
250 | + * @param array|null $additionalParams |
|
251 | + * @return string returns content of included template |
|
252 | + * |
|
253 | + * Includes another template. use <?php echo $this->inc('template'); ?> to |
|
254 | + * do this. |
|
255 | + */ |
|
256 | + public function inc( $file, $additionalParams = null ) { |
|
257 | + return $this->load($this->path.$file.'.php', $additionalParams); |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * Shortcut to print a simple page for users |
|
262 | + * @param string $application The application we render the template for |
|
263 | + * @param string $name Name of the template |
|
264 | + * @param array $parameters Parameters for the template |
|
265 | + * @return boolean|null |
|
266 | + */ |
|
267 | + public static function printUserPage( $application, $name, $parameters = array() ) { |
|
268 | + $content = new OC_Template( $application, $name, "user" ); |
|
269 | + foreach( $parameters as $key => $value ) { |
|
270 | + $content->assign( $key, $value ); |
|
271 | + } |
|
272 | + print $content->printPage(); |
|
273 | + } |
|
274 | + |
|
275 | + /** |
|
276 | + * Shortcut to print a simple page for admins |
|
277 | + * @param string $application The application we render the template for |
|
278 | + * @param string $name Name of the template |
|
279 | + * @param array $parameters Parameters for the template |
|
280 | + * @return bool |
|
281 | + */ |
|
282 | + public static function printAdminPage( $application, $name, $parameters = array() ) { |
|
283 | + $content = new OC_Template( $application, $name, "admin" ); |
|
284 | + foreach( $parameters as $key => $value ) { |
|
285 | + $content->assign( $key, $value ); |
|
286 | + } |
|
287 | + return $content->printPage(); |
|
288 | + } |
|
289 | + |
|
290 | + /** |
|
291 | + * Shortcut to print a simple page for guests |
|
292 | + * @param string $application The application we render the template for |
|
293 | + * @param string $name Name of the template |
|
294 | + * @param array|string $parameters Parameters for the template |
|
295 | + * @return bool |
|
296 | + */ |
|
297 | + public static function printGuestPage( $application, $name, $parameters = array() ) { |
|
298 | + $content = new OC_Template( $application, $name, "guest" ); |
|
299 | + foreach( $parameters as $key => $value ) { |
|
300 | + $content->assign( $key, $value ); |
|
301 | + } |
|
302 | + return $content->printPage(); |
|
303 | + } |
|
304 | + |
|
305 | + /** |
|
306 | + * Print a fatal error page and terminates the script |
|
307 | + * @param string $error_msg The error message to show |
|
308 | + * @param string $hint An optional hint message - needs to be properly escaped |
|
309 | + */ |
|
310 | + public static function printErrorPage( $error_msg, $hint = '' ) { |
|
311 | + if ($error_msg === $hint) { |
|
312 | + // If the hint is the same as the message there is no need to display it twice. |
|
313 | + $hint = ''; |
|
314 | + } |
|
315 | + |
|
316 | + try { |
|
317 | + $content = new \OC_Template( '', 'error', 'error', false ); |
|
318 | + $errors = array(array('error' => $error_msg, 'hint' => $hint)); |
|
319 | + $content->assign( 'errors', $errors ); |
|
320 | + $content->printPage(); |
|
321 | + } catch (\Exception $e) { |
|
322 | + $logger = \OC::$server->getLogger(); |
|
323 | + $logger->error("$error_msg $hint", ['app' => 'core']); |
|
324 | + $logger->logException($e, ['app' => 'core']); |
|
325 | + |
|
326 | + header(self::getHttpProtocol() . ' 500 Internal Server Error'); |
|
327 | + header('Content-Type: text/plain; charset=utf-8'); |
|
328 | + print("$error_msg $hint"); |
|
329 | + } |
|
330 | + die(); |
|
331 | + } |
|
332 | + |
|
333 | + /** |
|
334 | + * print error page using Exception details |
|
335 | + * @param Exception | Throwable $exception |
|
336 | + */ |
|
337 | + public static function printExceptionErrorPage($exception, $fetchPage = false) { |
|
338 | + try { |
|
339 | + $request = \OC::$server->getRequest(); |
|
340 | + $content = new \OC_Template('', 'exception', 'error', false); |
|
341 | + $content->assign('errorClass', get_class($exception)); |
|
342 | + $content->assign('errorMsg', $exception->getMessage()); |
|
343 | + $content->assign('errorCode', $exception->getCode()); |
|
344 | + $content->assign('file', $exception->getFile()); |
|
345 | + $content->assign('line', $exception->getLine()); |
|
346 | + $content->assign('trace', $exception->getTraceAsString()); |
|
347 | + $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); |
|
348 | + $content->assign('remoteAddr', $request->getRemoteAddress()); |
|
349 | + $content->assign('requestID', $request->getId()); |
|
350 | + if ($fetchPage) { |
|
351 | + return $content->fetchPage(); |
|
352 | + } |
|
353 | + $content->printPage(); |
|
354 | + } catch (\Exception $e) { |
|
355 | + $logger = \OC::$server->getLogger(); |
|
356 | + $logger->logException($exception, ['app' => 'core']); |
|
357 | + $logger->logException($e, ['app' => 'core']); |
|
358 | + |
|
359 | + header(self::getHttpProtocol() . ' 500 Internal Server Error'); |
|
360 | + header('Content-Type: text/plain; charset=utf-8'); |
|
361 | + print("Internal Server Error\n\n"); |
|
362 | + print("The server encountered an internal error and was unable to complete your request.\n"); |
|
363 | + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); |
|
364 | + print("More details can be found in the server log.\n"); |
|
365 | + } |
|
366 | + die(); |
|
367 | + } |
|
368 | + |
|
369 | + /** |
|
370 | + * This is only here to reduce the dependencies in case of an exception to |
|
371 | + * still be able to print a plain error message. |
|
372 | + * |
|
373 | + * Returns the used HTTP protocol. |
|
374 | + * |
|
375 | + * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0. |
|
376 | + * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead |
|
377 | + */ |
|
378 | + protected static function getHttpProtocol() { |
|
379 | + $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']); |
|
380 | + $validProtocols = [ |
|
381 | + 'HTTP/1.0', |
|
382 | + 'HTTP/1.1', |
|
383 | + 'HTTP/2', |
|
384 | + ]; |
|
385 | + if(in_array($claimedProtocol, $validProtocols, true)) { |
|
386 | + return $claimedProtocol; |
|
387 | + } |
|
388 | + return 'HTTP/1.1'; |
|
389 | + } |
|
390 | 390 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'> |
11 | 11 | <form action="index.php" method="post"> |
12 | 12 | <input type="hidden" name="install" value="true"> |
13 | - <?php if(count($_['errors']) > 0): ?> |
|
13 | + <?php if (count($_['errors']) > 0): ?> |
|
14 | 14 | <fieldset class="warning"> |
15 | - <legend><strong><?php p($l->t('Error'));?></strong></legend> |
|
16 | - <?php foreach($_['errors'] as $err): ?> |
|
15 | + <legend><strong><?php p($l->t('Error')); ?></strong></legend> |
|
16 | + <?php foreach ($_['errors'] as $err): ?> |
|
17 | 17 | <p> |
18 | - <?php if(is_array($err)):?> |
|
18 | + <?php if (is_array($err)):?> |
|
19 | 19 | <?php print_unescaped($err['error']); ?> |
20 | 20 | <span class='hint'><?php print_unescaped($err['hint']); ?></span> |
21 | 21 | <?php else: ?> |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | <?php endforeach; ?> |
26 | 26 | </fieldset> |
27 | 27 | <?php endif; ?> |
28 | - <?php if(!$_['htaccessWorking']): ?> |
|
28 | + <?php if (!$_['htaccessWorking']): ?> |
|
29 | 29 | <fieldset class="warning"> |
30 | - <legend><strong><?php p($l->t('Security warning'));?></strong></legend> |
|
31 | - <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br> |
|
30 | + <legend><strong><?php p($l->t('Security warning')); ?></strong></legend> |
|
31 | + <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.')); ?><br> |
|
32 | 32 | <?php print_unescaped($l->t( |
33 | 33 | 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer">documentation</a>.', |
34 | 34 | link_to_docs('admin-install') |
@@ -36,35 +36,35 @@ discard block |
||
36 | 36 | </fieldset> |
37 | 37 | <?php endif; ?> |
38 | 38 | <fieldset id="adminaccount"> |
39 | - <legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend> |
|
39 | + <legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend> |
|
40 | 40 | <p class="grouptop"> |
41 | 41 | <input type="text" name="adminlogin" id="adminlogin" |
42 | - placeholder="<?php p($l->t( 'Username' )); ?>" |
|
42 | + placeholder="<?php p($l->t('Username')); ?>" |
|
43 | 43 | value="<?php p($_['adminlogin']); ?>" |
44 | 44 | autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required> |
45 | - <label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label> |
|
45 | + <label for="adminlogin" class="infield"><?php p($l->t('Username')); ?></label> |
|
46 | 46 | </p> |
47 | 47 | <p class="groupbottom"> |
48 | 48 | <input type="password" name="adminpass" data-typetoggle="#show" id="adminpass" |
49 | - placeholder="<?php p($l->t( 'Password' )); ?>" |
|
49 | + placeholder="<?php p($l->t('Password')); ?>" |
|
50 | 50 | value="<?php p($_['adminpass']); ?>" |
51 | 51 | autocomplete="off" autocapitalize="none" autocorrect="off" required> |
52 | - <label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label> |
|
52 | + <label for="adminpass" class="infield"><?php p($l->t('Password')); ?></label> |
|
53 | 53 | <input type="checkbox" id="show" name="show"> |
54 | 54 | <label for="show"></label> |
55 | 55 | </p> |
56 | 56 | </fieldset> |
57 | 57 | |
58 | - <?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
58 | + <?php if (!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
59 | 59 | <fieldset id="advancedHeader"> |
60 | - <legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend> |
|
60 | + <legend><a id="showAdvanced"><?php p($l->t('Storage & database')); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend> |
|
61 | 61 | </fieldset> |
62 | 62 | <?php endif; ?> |
63 | 63 | |
64 | - <?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?> |
|
64 | + <?php if (!$_['directoryIsSet'] OR count($_['errors']) > 0): ?> |
|
65 | 65 | <fieldset id="datadirField"> |
66 | 66 | <div id="datadirContent"> |
67 | - <label for="directory"><?php p($l->t( 'Data folder' )); ?></label> |
|
67 | + <label for="directory"><?php p($l->t('Data folder')); ?></label> |
|
68 | 68 | <input type="text" name="directory" id="directory" |
69 | 69 | placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>" |
70 | 70 | value="<?php p($_['directory']); ?>" |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | </fieldset> |
74 | 74 | <?php endif; ?> |
75 | 75 | |
76 | - <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
76 | + <?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
77 | 77 | <fieldset id='databaseBackend'> |
78 | - <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
|
79 | - $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> |
|
80 | - <legend><?php p($l->t( 'Configure the database' )); ?></legend> |
|
78 | + <?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
|
79 | + $hasOtherDB = true; else $hasOtherDB = false; //other than SQLite ?> |
|
80 | + <legend><?php p($l->t('Configure the database')); ?></legend> |
|
81 | 81 | <div id="selectDbType"> |
82 | - <?php foreach($_['databases'] as $type => $label): ?> |
|
83 | - <?php if(count($_['databases']) === 1): ?> |
|
82 | + <?php foreach ($_['databases'] as $type => $label): ?> |
|
83 | + <?php if (count($_['databases']) === 1): ?> |
|
84 | 84 | <p class="info"> |
85 | - <?php p($l->t( 'Only %s is available.', array($label) )); ?> |
|
86 | - <?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br> |
|
85 | + <?php p($l->t('Only %s is available.', array($label))); ?> |
|
86 | + <?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br> |
|
87 | 87 | <a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer"> |
88 | - <?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a> |
|
88 | + <?php p($l->t('For more details check out the documentation.')); ?> ↗</a> |
|
89 | 89 | </p> |
90 | 90 | <input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>"> |
91 | 91 | <?php else: ?> |
@@ -97,75 +97,75 @@ discard block |
||
97 | 97 | </div> |
98 | 98 | </fieldset> |
99 | 99 | |
100 | - <?php if($hasOtherDB): ?> |
|
100 | + <?php if ($hasOtherDB): ?> |
|
101 | 101 | <fieldset id='databaseField'> |
102 | 102 | <div id="use_other_db"> |
103 | 103 | <p class="grouptop"> |
104 | - <label for="dbuser" class="infield"><?php p($l->t( 'Database user' )); ?></label> |
|
104 | + <label for="dbuser" class="infield"><?php p($l->t('Database user')); ?></label> |
|
105 | 105 | <input type="text" name="dbuser" id="dbuser" |
106 | - placeholder="<?php p($l->t( 'Database user' )); ?>" |
|
106 | + placeholder="<?php p($l->t('Database user')); ?>" |
|
107 | 107 | value="<?php p($_['dbuser']); ?>" |
108 | 108 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
109 | 109 | </p> |
110 | 110 | <p class="groupmiddle"> |
111 | 111 | <input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle" |
112 | - placeholder="<?php p($l->t( 'Database password' )); ?>" |
|
112 | + placeholder="<?php p($l->t('Database password')); ?>" |
|
113 | 113 | value="<?php p($_['dbpass']); ?>" |
114 | 114 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
115 | - <label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label> |
|
115 | + <label for="dbpass" class="infield"><?php p($l->t('Database password')); ?></label> |
|
116 | 116 | <input type="checkbox" id="dbpassword-toggle" name="dbpassword-toggle"> |
117 | 117 | <label for="dbpassword-toggle"></label> |
118 | 118 | </p> |
119 | 119 | <p class="groupmiddle"> |
120 | - <label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label> |
|
120 | + <label for="dbname" class="infield"><?php p($l->t('Database name')); ?></label> |
|
121 | 121 | <input type="text" name="dbname" id="dbname" |
122 | - placeholder="<?php p($l->t( 'Database name' )); ?>" |
|
122 | + placeholder="<?php p($l->t('Database name')); ?>" |
|
123 | 123 | value="<?php p($_['dbname']); ?>" |
124 | 124 | autocomplete="off" autocapitalize="none" autocorrect="off" |
125 | 125 | pattern="[0-9a-zA-Z$_-]+"> |
126 | 126 | </p> |
127 | - <?php if($_['hasOracle']): ?> |
|
127 | + <?php if ($_['hasOracle']): ?> |
|
128 | 128 | <div id="use_oracle_db"> |
129 | 129 | <p class="groupmiddle"> |
130 | - <label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label> |
|
130 | + <label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label> |
|
131 | 131 | <input type="text" name="dbtablespace" id="dbtablespace" |
132 | - placeholder="<?php p($l->t( 'Database tablespace' )); ?>" |
|
132 | + placeholder="<?php p($l->t('Database tablespace')); ?>" |
|
133 | 133 | value="<?php p($_['dbtablespace']); ?>" |
134 | 134 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | <?php endif; ?> |
138 | 138 | <p class="groupbottom"> |
139 | - <label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label> |
|
139 | + <label for="dbhost" class="infield"><?php p($l->t('Database host')); ?></label> |
|
140 | 140 | <input type="text" name="dbhost" id="dbhost" |
141 | - placeholder="<?php p($l->t( 'Database host' )); ?>" |
|
141 | + placeholder="<?php p($l->t('Database host')); ?>" |
|
142 | 142 | value="<?php p($_['dbhost']); ?>" |
143 | 143 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
144 | 144 | </p> |
145 | 145 | <p class="info"> |
146 | - <?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?> |
|
146 | + <?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?> |
|
147 | 147 | </p> |
148 | 148 | </div> |
149 | 149 | </fieldset> |
150 | 150 | <?php endif; ?> |
151 | 151 | <?php endif; ?> |
152 | 152 | |
153 | - <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
153 | + <?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
154 | 154 | <fieldset id="sqliteInformation" class="warning"> |
155 | - <legend><?php p($l->t('Performance warning'));?></legend> |
|
156 | - <p><?php p($l->t('SQLite will be used as database.'));?></p> |
|
157 | - <p><?php p($l->t('For larger installations we recommend to choose a different database backend.'));?></p> |
|
155 | + <legend><?php p($l->t('Performance warning')); ?></legend> |
|
156 | + <p><?php p($l->t('SQLite will be used as database.')); ?></p> |
|
157 | + <p><?php p($l->t('For larger installations we recommend to choose a different database backend.')); ?></p> |
|
158 | 158 | <p><?php p($l->t('Especially when using the desktop client for file syncing the use of SQLite is discouraged.')); ?></p> |
159 | 159 | </fieldset> |
160 | 160 | <?php endif ?> |
161 | 161 | |
162 | 162 | <div class="icon-loading-dark float-spinner"> </div> |
163 | 163 | |
164 | - <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div> |
|
164 | + <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Finish setup')); ?>" data-finishing="<?php p($l->t('Finishing …')); ?>"></div> |
|
165 | 165 | |
166 | 166 | <p class="info"> |
167 | 167 | <span class="icon-info-white"></span> |
168 | - <?php p($l->t('Need help?'));?> |
|
169 | - <a target="_blank" rel="noreferrer" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a> |
|
168 | + <?php p($l->t('Need help?')); ?> |
|
169 | + <a target="_blank" rel="noreferrer" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation')); ?> ↗</a> |
|
170 | 170 | </p> |
171 | 171 | </form> |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | - p($theme->getTitle()); |
|
9 | - ?> |
|
7 | + p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | + p($theme->getTitle()); |
|
9 | + ?> |
|
10 | 10 | </title> |
11 | 11 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
12 | 12 | <meta name="referrer" content="never"> |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | </li> |
117 | 117 | <?php endforeach; ?> |
118 | 118 | <?php |
119 | - /* show "More apps" link to app administration directly in app navigation, as last entry */ |
|
120 | - if(OC_User::isAdminUser(OC_User::getUser())): |
|
121 | - ?> |
|
119 | + /* show "More apps" link to app administration directly in app navigation, as last entry */ |
|
120 | + if(OC_User::isAdminUser(OC_User::getUser())): |
|
121 | + ?> |
|
122 | 122 | <li class="apps-management"> |
123 | 123 | <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" |
124 | 124 | <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> |
@@ -81,7 +81,10 @@ discard block |
||
81 | 81 | </a> |
82 | 82 | </li> |
83 | 83 | <?php if(OC_User::isAdminUser(OC_User::getUser())): ?> |
84 | - <li <?php if(count($_['navigation'])>$headerIconCount-1): ?> class="hidden apps-management"<?php else: ?> class="apps-management" <?php endif; ?>> |
|
84 | + <li <?php if(count($_['navigation'])>$headerIconCount-1): ?> class="hidden apps-management"<?php else { |
|
85 | + : ?> class="apps-management" <?php endif; |
|
86 | +} |
|
87 | +?>> |
|
85 | 88 | <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" |
86 | 89 | <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> |
87 | 90 | <img src="<?php print_unescaped(image_path('settings', 'apps.svg') . '?v=' . $_['versionHash']); ?>" /> |
@@ -99,8 +102,11 @@ discard block |
||
99 | 102 | <?php foreach($_['navigation'] as $entry): ?> |
100 | 103 | <?php if($entry['showInHeader']): ?> |
101 | 104 | <li data-id="<?php p($entry['id']); ?>" class="in-header"> |
102 | - <?php else: ?> |
|
103 | - <li data-id="<?php p($entry['id']); ?>"> |
|
105 | + <?php else { |
|
106 | + : ?> |
|
107 | + <li data-id="<?php p($entry['id']); |
|
108 | +} |
|
109 | +?>"> |
|
104 | 110 | <?php endif; ?> |
105 | 111 | <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3" |
106 | 112 | <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
7 | + p(!empty($_['application']) ? $_['application'].' - ' : ''); |
|
8 | 8 | p($theme->getTitle()); |
9 | 9 | ?> |
10 | 10 | </title> |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | <meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>"> |
15 | 15 | <meta name="apple-mobile-web-app-capable" content="yes"> |
16 | 16 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
17 | - <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>"> |
|
17 | + <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files') ? $_['application'] : $theme->getTitle()); ?>"> |
|
18 | 18 | <meta name="mobile-web-app-capable" content="yes"> |
19 | 19 | <meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>"> |
20 | 20 | <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> |
21 | 21 | <link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path($_['appid'], 'favicon-touch.png')); ?>"> |
22 | 22 | <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path($_['appid'], 'favicon-mask.svg')); ?>" color="#0082c9"> |
23 | - <?php foreach($_['cssfiles'] as $cssfile): ?> |
|
23 | + <?php foreach ($_['cssfiles'] as $cssfile): ?> |
|
24 | 24 | <link rel="stylesheet" href="<?php print_unescaped($cssfile); ?>"> |
25 | 25 | <?php endforeach; ?> |
26 | - <?php foreach($_['printcssfiles'] as $cssfile): ?> |
|
26 | + <?php foreach ($_['printcssfiles'] as $cssfile): ?> |
|
27 | 27 | <link rel="stylesheet" href="<?php print_unescaped($cssfile); ?>" media="print"> |
28 | 28 | <?php endforeach; ?> |
29 | 29 | <?php if (isset($_['inline_ocjs'])): ?> |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | <?php print_unescaped($_['inline_ocjs']); ?> |
32 | 32 | </script> |
33 | 33 | <?php endif; ?> |
34 | - <?php foreach($_['jsfiles'] as $jsfile): ?> |
|
34 | + <?php foreach ($_['jsfiles'] as $jsfile): ?> |
|
35 | 35 | <script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php print_unescaped($jsfile); ?>"></script> |
36 | 36 | <?php endforeach; ?> |
37 | 37 | <?php print_unescaped($_['headers']); ?> |
38 | 38 | </head> |
39 | - <body id="<?php p($_['bodyid']);?>"> |
|
39 | + <body id="<?php p($_['bodyid']); ?>"> |
|
40 | 40 | <?php include('layout.noscript.warning.php'); ?> |
41 | 41 | <div id="notification-container"> |
42 | 42 | <div id="notification"></div> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | <a href="#" class="header-appname-container menutoggle" tabindex="2"> |
56 | 56 | <h1 class="header-appname"> |
57 | - <?php p(!empty($_['application'])?$_['application']: $l->t('Apps')); ?> |
|
57 | + <?php p(!empty($_['application']) ? $_['application'] : $l->t('Apps')); ?> |
|
58 | 58 | </h1> |
59 | 59 | <div class="icon-caret"></div> |
60 | 60 | </a> |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | <div id="appmenu"> |
63 | 63 | <ul> |
64 | 64 | <?php $headerIconCount = 8; ?> |
65 | - <?php foreach($_['headernavigation'] as $entry): ?> |
|
65 | + <?php foreach ($_['headernavigation'] as $entry): ?> |
|
66 | 66 | <li data-id="<?php p($entry['id']); ?>"> |
67 | 67 | <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3" |
68 | - <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>> |
|
69 | - <img src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" class="app-icon" /> |
|
68 | + <?php if ($entry['active']): ?> class="active"<?php endif; ?>> |
|
69 | + <img src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" class="app-icon" /> |
|
70 | 70 | <div class="icon-loading-dark" style="display:none;"></div> |
71 | 71 | <span> |
72 | 72 | <?php p($entry['name']); ?> |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | </a> |
75 | 75 | </li> |
76 | 76 | <?php endforeach; ?> |
77 | - <li id="more-apps" class="menutoggle<?php if (!(count($_['navigation']) > $headerIconCount || (OC_User::isAdminUser(OC_User::getUser()) && count($_['navigation'])>=$headerIconCount))): ?> hidden<?php endif; ?>"> |
|
77 | + <li id="more-apps" class="menutoggle<?php if (!(count($_['navigation']) > $headerIconCount || (OC_User::isAdminUser(OC_User::getUser()) && count($_['navigation']) >= $headerIconCount))): ?> hidden<?php endif; ?>"> |
|
78 | 78 | <a href="#"> |
79 | 79 | <div class="icon-more-white"></div> |
80 | 80 | <span><?php p($l->t('More apps')); ?></span> |
81 | 81 | </a> |
82 | 82 | </li> |
83 | - <?php if(OC_User::isAdminUser(OC_User::getUser())): ?> |
|
84 | - <li <?php if(count($_['navigation'])>$headerIconCount-1): ?> class="hidden apps-management"<?php else: ?> class="apps-management" <?php endif; ?>> |
|
83 | + <?php if (OC_User::isAdminUser(OC_User::getUser())): ?> |
|
84 | + <li <?php if (count($_['navigation']) > $headerIconCount - 1): ?> class="hidden apps-management"<?php else: ?> class="apps-management" <?php endif; ?>> |
|
85 | 85 | <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" |
86 | - <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> |
|
87 | - <img src="<?php print_unescaped(image_path('settings', 'apps.svg') . '?v=' . $_['versionHash']); ?>" /> |
|
86 | + <?php if ($_['appsmanagement_active']): ?> class="active"<?php endif; ?>> |
|
87 | + <img src="<?php print_unescaped(image_path('settings', 'apps.svg').'?v='.$_['versionHash']); ?>" /> |
|
88 | 88 | <div class="icon-loading-dark" style="display:none;"></div> |
89 | 89 | <span><?php p($l->t('Apps')); ?></span> |
90 | 90 | </a> |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | <nav role="navigation"><div id="navigation"> |
97 | 97 | <div id="apps"> |
98 | 98 | <ul> |
99 | - <?php foreach($_['navigation'] as $entry): ?> |
|
100 | - <?php if($entry['showInHeader']): ?> |
|
99 | + <?php foreach ($_['navigation'] as $entry): ?> |
|
100 | + <?php if ($entry['showInHeader']): ?> |
|
101 | 101 | <li data-id="<?php p($entry['id']); ?>" class="in-header"> |
102 | 102 | <?php else: ?> |
103 | 103 | <li data-id="<?php p($entry['id']); ?>"> |
104 | 104 | <?php endif; ?> |
105 | 105 | <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3" |
106 | - <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>> |
|
106 | + <?php if ($entry['active']): ?> class="active"<?php endif; ?>> |
|
107 | 107 | <svg width="32" height="32" viewBox="0 0 32 32"> |
108 | 108 | <defs><filter id="invert-<?php p($entry['id']); ?>"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs> |
109 | - <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>" class="app-icon"></image> |
|
109 | + <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert-<?php p($entry['id']); ?>)" xlink:href="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>" class="app-icon"></image> |
|
110 | 110 | </svg> |
111 | 111 | <div class="icon-loading-dark" style="display:none;"></div> |
112 | 112 | <span> |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | <?php endforeach; ?> |
118 | 118 | <?php |
119 | 119 | /* show "More apps" link to app administration directly in app navigation, as last entry */ |
120 | - if(OC_User::isAdminUser(OC_User::getUser())): |
|
120 | + if (OC_User::isAdminUser(OC_User::getUser())): |
|
121 | 121 | ?> |
122 | 122 | <li class="apps-management"> |
123 | 123 | <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" |
124 | - <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> |
|
124 | + <?php if ($_['appsmanagement_active']): ?> class="active"<?php endif; ?>> |
|
125 | 125 | <svg width="32" height="32" viewBox="0 0 32 32" class="app-icon"> |
126 | 126 | <defs><filter id="invert-appsmanagement"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs> |
127 | - <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert-appsmanagement)" xlink:href="<?php print_unescaped(image_path('settings', 'apps.svg') . '?v=' . $_['versionHash']); ?>"></image> |
|
127 | + <image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert-appsmanagement)" xlink:href="<?php print_unescaped(image_path('settings', 'apps.svg').'?v='.$_['versionHash']); ?>"></image> |
|
128 | 128 | </svg> |
129 | 129 | <div class="icon-loading-dark" style="display:none;"></div> |
130 | 130 | <span> |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | <div id="header-right"> |
144 | 144 | <form class="searchbox" action="#" method="post" role="search" novalidate> |
145 | 145 | <label for="searchbox" class="hidden-visually"> |
146 | - <?php p($l->t('Search'));?> |
|
146 | + <?php p($l->t('Search')); ?> |
|
147 | 147 | </label> |
148 | 148 | <input id="searchbox" type="search" name="query" |
149 | 149 | value="" required |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>"> |
156 | 156 | <?php if ($_['userAvatarSet']): ?> |
157 | 157 | <img alt="" width="32" height="32" |
158 | - src="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 32, 'v' => $_['userAvatarVersion']]));?>" |
|
159 | - srcset="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 64, 'v' => $_['userAvatarVersion']]));?> 2x, <?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 128, 'v' => $_['userAvatarVersion']]));?> 4x" |
|
158 | + src="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 32, 'v' => $_['userAvatarVersion']])); ?>" |
|
159 | + srcset="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 64, 'v' => $_['userAvatarVersion']])); ?> 2x, <?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 128, 'v' => $_['userAvatarVersion']])); ?> 4x" |
|
160 | 160 | > |
161 | 161 | <?php endif; ?> |
162 | 162 | </div> |
@@ -165,19 +165,19 @@ discard block |
||
165 | 165 | </div> |
166 | 166 | <div id="expanddiv"> |
167 | 167 | <ul> |
168 | - <?php foreach($_['settingsnavigation'] as $entry):?> |
|
168 | + <?php foreach ($_['settingsnavigation'] as $entry):?> |
|
169 | 169 | <li> |
170 | 170 | <a href="<?php print_unescaped($entry['href']); ?>" |
171 | - <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>> |
|
172 | - <img alt="" src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>"> |
|
171 | + <?php if ($entry["active"]): ?> class="active"<?php endif; ?>> |
|
172 | + <img alt="" src="<?php print_unescaped($entry['icon'].'?v='.$_['versionHash']); ?>"> |
|
173 | 173 | <?php p($entry['name']) ?> |
174 | 174 | </a> |
175 | 175 | </li> |
176 | 176 | <?php endforeach; ?> |
177 | 177 | <li> |
178 | 178 | <a id="logout" <?php print_unescaped(OC_User::getLogoutAttribute()); ?>> |
179 | - <img alt="" src="<?php print_unescaped(image_path('', 'actions/logout.svg') . '?v=' . $_['versionHash']); ?>"> |
|
180 | - <?php p($l->t('Log out'));?> |
|
179 | + <img alt="" src="<?php print_unescaped(image_path('', 'actions/logout.svg').'?v='.$_['versionHash']); ?>"> |
|
180 | + <?php p($l->t('Log out')); ?> |
|
181 | 181 | </a> |
182 | 182 | </li> |
183 | 183 | </ul> |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | 13 | <?php foreach($_['forms'] as $form) { |
14 | - if (isset($form['anchor'])) { |
|
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
17 | - $sectionName = $form['section-name']; |
|
18 | - print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | - \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | - } |
|
21 | - }?> |
|
14 | + if (isset($form['anchor'])) { |
|
15 | + $anchor = '#' . $form['anchor']; |
|
16 | + $class = 'nav-icon-' . $form['anchor']; |
|
17 | + $sectionName = $form['section-name']; |
|
18 | + print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | + \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | + } |
|
21 | + }?> |
|
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']]));?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | <?php |
181 | 181 | if($_['passwordChangeSupported']) { |
182 | - script('jquery-showpassword'); |
|
182 | + script('jquery-showpassword'); |
|
183 | 183 | ?> |
184 | 184 | <form id="passwordform" class="section"> |
185 | 185 | <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | |
249 | 249 | <p> |
250 | 250 | <?php print_unescaped(str_replace( |
251 | - [ |
|
252 | - '{contributeopen}', |
|
253 | - '{linkclose}', |
|
254 | - ], |
|
255 | - [ |
|
256 | - '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
257 | - '</a>', |
|
258 | - ], |
|
259 | - $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
251 | + [ |
|
252 | + '{contributeopen}', |
|
253 | + '{linkclose}', |
|
254 | + ], |
|
255 | + [ |
|
256 | + '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
257 | + '</a>', |
|
258 | + ], |
|
259 | + $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
260 | 260 | </p> |
261 | 261 | |
262 | 262 | <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | </div> |
318 | 318 | |
319 | 319 | <?php foreach($_['forms'] as $form) { |
320 | - if (isset($form['form'])) {?> |
|
320 | + if (isset($form['form'])) {?> |
|
321 | 321 | <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
322 | 322 | <?php } |
323 | 323 | };?> |
@@ -31,9 +31,12 @@ discard block |
||
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | 33 | [$_['usage'], $_['total_space']]));?> |
34 | - <?php else: ?> |
|
34 | + <?php else { |
|
35 | + : ?> |
|
35 | 36 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); |
|
38 | +} |
|
39 | +?> |
|
37 | 40 | <?php endif ?> |
38 | 41 | </p> |
39 | 42 | </div> |
@@ -55,8 +58,11 @@ discard block |
||
55 | 58 | <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div> |
56 | 59 | <input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield"> |
57 | 60 | <p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p> |
58 | - <?php else: ?> |
|
59 | - <?php p($l->t('Picture provided by original account')); ?> |
|
61 | + <?php else { |
|
62 | + : ?> |
|
63 | + <?php p($l->t('Picture provided by original account')); |
|
64 | +} |
|
65 | +?> |
|
60 | 66 | <?php endif; ?> |
61 | 67 | </div> |
62 | 68 |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | - <?php foreach($_['forms'] as $form) { |
|
13 | + <?php foreach ($_['forms'] as $form) { |
|
14 | 14 | if (isset($form['anchor'])) { |
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
15 | + $anchor = '#'.$form['anchor']; |
|
16 | + $class = 'nav-icon-'.$form['anchor']; |
|
17 | 17 | $sectionName = $form['section-name']; |
18 | 18 | print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
19 | 19 | \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | <div id="app-content"> |
26 | 26 | |
27 | 27 | <div id="quota" class="section"> |
28 | - <div style="width:<?php p($_['usage_relative']);?>%" |
|
29 | - <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
28 | + <div style="width:<?php p($_['usage_relative']); ?>%" |
|
29 | + <?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']])); ?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); ?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | <span class="icon-password"/> |
80 | 80 | </h2> |
81 | 81 | <input type="text" id="displayname" name="displayname" |
82 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
82 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
83 | 83 | value="<?php p($_['displayName']) ?>" |
84 | 84 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
85 | - <?php if(!$_['displayNameChangeSupported']) { ?> |
|
86 | - <span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span> |
|
85 | + <?php if (!$_['displayNameChangeSupported']) { ?> |
|
86 | + <span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span> |
|
87 | 87 | <?php } ?> |
88 | 88 | <span class="icon-checkmark hidden"/> |
89 | 89 | <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>"> |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | <span class="icon-password"/> |
97 | 97 | </h2> |
98 | 98 | <input type="email" name="email" id="email" value="<?php p($_['email']); ?>" |
99 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
99 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
100 | 100 | placeholder="<?php p($l->t('Your email address')); ?>" |
101 | 101 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
102 | - <?php if(!$_['displayNameChangeSupported']) { ?> |
|
103 | - <span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span> |
|
102 | + <?php if (!$_['displayNameChangeSupported']) { ?> |
|
103 | + <span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span> |
|
104 | 104 | <?php } ?> |
105 | - <?php if($_['displayNameChangeSupported']) { ?> |
|
105 | + <?php if ($_['displayNameChangeSupported']) { ?> |
|
106 | 106 | <br /> |
107 | 107 | <em><?php p($l->t('For password reset and notifications')); ?></em> |
108 | 108 | <?php } ?> |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | |
180 | 180 | <?php |
181 | -if($_['passwordChangeSupported']) { |
|
181 | +if ($_['passwordChangeSupported']) { |
|
182 | 182 | script('jquery-showpassword'); |
183 | 183 | ?> |
184 | 184 | <form id="passwordform" class="section"> |
185 | - <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
|
185 | + <h2 class="inlineblock"><?php p($l->t('Password')); ?></h2> |
|
186 | 186 | <div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div> |
187 | 187 | <br> |
188 | 188 | <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label> |
189 | 189 | <input type="password" id="pass1" name="oldpassword" |
190 | - placeholder="<?php p($l->t('Current password'));?>" |
|
190 | + placeholder="<?php p($l->t('Current password')); ?>" |
|
191 | 191 | autocomplete="off" autocapitalize="none" autocorrect="off" /> |
192 | 192 | <div class="personal-show-container"> |
193 | - <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label> |
|
193 | + <label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label> |
|
194 | 194 | <input type="password" id="pass2" name="newpassword" |
195 | 195 | placeholder="<?php p($l->t('New password')); ?>" |
196 | 196 | data-typetoggle="#personal-show" |
@@ -206,44 +206,44 @@ discard block |
||
206 | 206 | |
207 | 207 | <form id="language" class="section"> |
208 | 208 | <h2> |
209 | - <label for="languageinput"><?php p($l->t('Language'));?></label> |
|
209 | + <label for="languageinput"><?php p($l->t('Language')); ?></label> |
|
210 | 210 | </h2> |
211 | - <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>"> |
|
212 | - <option value="<?php p($_['activelanguage']['code']);?>"> |
|
213 | - <?php p($_['activelanguage']['name']);?> |
|
211 | + <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>"> |
|
212 | + <option value="<?php p($_['activelanguage']['code']); ?>"> |
|
213 | + <?php p($_['activelanguage']['name']); ?> |
|
214 | 214 | </option> |
215 | - <?php foreach($_['commonlanguages'] as $language):?> |
|
216 | - <option value="<?php p($language['code']);?>"> |
|
217 | - <?php p($language['name']);?> |
|
215 | + <?php foreach ($_['commonlanguages'] as $language):?> |
|
216 | + <option value="<?php p($language['code']); ?>"> |
|
217 | + <?php p($language['name']); ?> |
|
218 | 218 | </option> |
219 | - <?php endforeach;?> |
|
219 | + <?php endforeach; ?> |
|
220 | 220 | <optgroup label="––––––––––"></optgroup> |
221 | - <?php foreach($_['languages'] as $language):?> |
|
222 | - <option value="<?php p($language['code']);?>"> |
|
223 | - <?php p($language['name']);?> |
|
221 | + <?php foreach ($_['languages'] as $language):?> |
|
222 | + <option value="<?php p($language['code']); ?>"> |
|
223 | + <?php p($language['name']); ?> |
|
224 | 224 | </option> |
225 | - <?php endforeach;?> |
|
225 | + <?php endforeach; ?> |
|
226 | 226 | </select> |
227 | 227 | <a href="https://www.transifex.com/nextcloud/nextcloud/" |
228 | 228 | target="_blank" rel="noreferrer"> |
229 | - <em><?php p($l->t('Help translate'));?></em> |
|
229 | + <em><?php p($l->t('Help translate')); ?></em> |
|
230 | 230 | </a> |
231 | 231 | </form> |
232 | 232 | |
233 | 233 | |
234 | 234 | <div id="clientsbox" class="section clientsbox"> |
235 | - <h2><?php p($l->t('Get the apps to sync your files'));?></h2> |
|
235 | + <h2><?php p($l->t('Get the apps to sync your files')); ?></h2> |
|
236 | 236 | <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank"> |
237 | 237 | <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>" |
238 | - alt="<?php p($l->t('Desktop client'));?>" /> |
|
238 | + alt="<?php p($l->t('Desktop client')); ?>" /> |
|
239 | 239 | </a> |
240 | 240 | <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank"> |
241 | 241 | <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>" |
242 | - alt="<?php p($l->t('Android app'));?>" /> |
|
242 | + alt="<?php p($l->t('Android app')); ?>" /> |
|
243 | 243 | </a> |
244 | 244 | <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank"> |
245 | 245 | <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>" |
246 | - alt="<?php p($l->t('iOS app'));?>" /> |
|
246 | + alt="<?php p($l->t('iOS app')); ?>" /> |
|
247 | 247 | </a> |
248 | 248 | |
249 | 249 | <p> |
@@ -259,19 +259,19 @@ discard block |
||
259 | 259 | $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
260 | 260 | </p> |
261 | 261 | |
262 | - <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
|
263 | - <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p> |
|
262 | + <?php if (OC_APP::isEnabled('firstrunwizard')) {?> |
|
263 | + <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again')); ?></a></p> |
|
264 | 264 | <?php }?> |
265 | 265 | </div> |
266 | 266 | |
267 | 267 | <div id="sessions" class="section"> |
268 | - <h2><?php p($l->t('Sessions'));?></h2> |
|
269 | - <span class="hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></span> |
|
268 | + <h2><?php p($l->t('Sessions')); ?></h2> |
|
269 | + <span class="hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></span> |
|
270 | 270 | <table class="icon-loading"> |
271 | 271 | <thead class="token-list-header"> |
272 | 272 | <tr> |
273 | - <th><?php p($l->t('Device'));?></th> |
|
274 | - <th><?php p($l->t('Last activity'));?></th> |
|
273 | + <th><?php p($l->t('Device')); ?></th> |
|
274 | + <th><?php p($l->t('Last activity')); ?></th> |
|
275 | 275 | <th></th> |
276 | 276 | </tr> |
277 | 277 | </thead> |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | </div> |
282 | 282 | |
283 | 283 | <div id="apppasswords" class="section"> |
284 | - <h2><?php p($l->t('App passwords'));?></h2> |
|
285 | - <p><?php p($l->t('Passcodes that give an app or device permissions to access your account.'));?></p> |
|
284 | + <h2><?php p($l->t('App passwords')); ?></h2> |
|
285 | + <p><?php p($l->t('Passcodes that give an app or device permissions to access your account.')); ?></p> |
|
286 | 286 | <table class="icon-loading"> |
287 | 287 | <thead class="hidden-when-empty"> |
288 | 288 | <tr> |
289 | - <th><?php p($l->t('Name'));?></th> |
|
290 | - <th><?php p($l->t('Last activity'));?></th> |
|
289 | + <th><?php p($l->t('Name')); ?></th> |
|
290 | + <th><?php p($l->t('Last activity')); ?></th> |
|
291 | 291 | <th></th> |
292 | 292 | </tr> |
293 | 293 | </thead> |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | </div> |
317 | 317 | </div> |
318 | 318 | |
319 | -<?php foreach($_['forms'] as $form) { |
|
319 | +<?php foreach ($_['forms'] as $form) { |
|
320 | 320 | if (isset($form['form'])) {?> |
321 | - <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
|
321 | + <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p(''); ?>"><?php print_unescaped($form['form']); ?></div> |
|
322 | 322 | <?php } |
323 | 323 | };?> |
324 | 324 | |
325 | 325 | <div class="section"> |
326 | - <h2><?php p($l->t('Version'));?></h2> |
|
326 | + <h2><?php p($l->t('Version')); ?></h2> |
|
327 | 327 | <p><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></p> |
328 | 328 | <p><?php include('settings.development.notice.php'); ?></p> |
329 | 329 | </div> |
@@ -36,91 +36,91 @@ |
||
36 | 36 | * @method array fetchAll(integer $fetchMode = null); |
37 | 37 | */ |
38 | 38 | class OC_DB_StatementWrapper { |
39 | - /** |
|
40 | - * @var \Doctrine\DBAL\Driver\Statement |
|
41 | - */ |
|
42 | - private $statement = null; |
|
43 | - private $isManipulation = false; |
|
44 | - private $lastArguments = array(); |
|
39 | + /** |
|
40 | + * @var \Doctrine\DBAL\Driver\Statement |
|
41 | + */ |
|
42 | + private $statement = null; |
|
43 | + private $isManipulation = false; |
|
44 | + private $lastArguments = array(); |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param boolean $isManipulation |
|
48 | - */ |
|
49 | - public function __construct($statement, $isManipulation) { |
|
50 | - $this->statement = $statement; |
|
51 | - $this->isManipulation = $isManipulation; |
|
52 | - } |
|
46 | + /** |
|
47 | + * @param boolean $isManipulation |
|
48 | + */ |
|
49 | + public function __construct($statement, $isManipulation) { |
|
50 | + $this->statement = $statement; |
|
51 | + $this->isManipulation = $isManipulation; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * pass all other function directly to the \Doctrine\DBAL\Driver\Statement |
|
56 | - */ |
|
57 | - public function __call($name,$arguments) { |
|
58 | - return call_user_func_array(array($this->statement,$name), $arguments); |
|
59 | - } |
|
54 | + /** |
|
55 | + * pass all other function directly to the \Doctrine\DBAL\Driver\Statement |
|
56 | + */ |
|
57 | + public function __call($name,$arguments) { |
|
58 | + return call_user_func_array(array($this->statement,$name), $arguments); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * make execute return the result instead of a bool |
|
63 | - * |
|
64 | - * @param array $input |
|
65 | - * @return \OC_DB_StatementWrapper|int |
|
66 | - */ |
|
67 | - public function execute($input=array()) { |
|
68 | - if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) { |
|
69 | - $backTrace = debug_backtrace(); |
|
70 | - $class = $backTrace[1]['class'] . ':' . $backTrace[1]['function']; |
|
71 | - $file = substr($backTrace[0]['file'], strlen(\OC::$SERVERROOT)) . ':' . $backTrace[0]['line']; |
|
72 | - $params_str = str_replace("\n", " ", var_export($input, true)); |
|
73 | - \OCP\Util::writeLog('core', "DB execute with arguments : $params_str in $class; $file", \OCP\Util::DEBUG); |
|
74 | - } |
|
75 | - $this->lastArguments = $input; |
|
76 | - if (count($input) > 0) { |
|
77 | - $result = $this->statement->execute($input); |
|
78 | - } else { |
|
79 | - $result = $this->statement->execute(); |
|
80 | - } |
|
61 | + /** |
|
62 | + * make execute return the result instead of a bool |
|
63 | + * |
|
64 | + * @param array $input |
|
65 | + * @return \OC_DB_StatementWrapper|int |
|
66 | + */ |
|
67 | + public function execute($input=array()) { |
|
68 | + if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) { |
|
69 | + $backTrace = debug_backtrace(); |
|
70 | + $class = $backTrace[1]['class'] . ':' . $backTrace[1]['function']; |
|
71 | + $file = substr($backTrace[0]['file'], strlen(\OC::$SERVERROOT)) . ':' . $backTrace[0]['line']; |
|
72 | + $params_str = str_replace("\n", " ", var_export($input, true)); |
|
73 | + \OCP\Util::writeLog('core', "DB execute with arguments : $params_str in $class; $file", \OCP\Util::DEBUG); |
|
74 | + } |
|
75 | + $this->lastArguments = $input; |
|
76 | + if (count($input) > 0) { |
|
77 | + $result = $this->statement->execute($input); |
|
78 | + } else { |
|
79 | + $result = $this->statement->execute(); |
|
80 | + } |
|
81 | 81 | |
82 | - if ($result === false) { |
|
83 | - return false; |
|
84 | - } |
|
85 | - if ($this->isManipulation) { |
|
86 | - $count = $this->statement->rowCount(); |
|
87 | - return $count; |
|
88 | - } else { |
|
89 | - return $this; |
|
90 | - } |
|
91 | - } |
|
82 | + if ($result === false) { |
|
83 | + return false; |
|
84 | + } |
|
85 | + if ($this->isManipulation) { |
|
86 | + $count = $this->statement->rowCount(); |
|
87 | + return $count; |
|
88 | + } else { |
|
89 | + return $this; |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * provide an alias for fetch |
|
95 | - * |
|
96 | - * @return mixed |
|
97 | - */ |
|
98 | - public function fetchRow() { |
|
99 | - return $this->statement->fetch(); |
|
100 | - } |
|
93 | + /** |
|
94 | + * provide an alias for fetch |
|
95 | + * |
|
96 | + * @return mixed |
|
97 | + */ |
|
98 | + public function fetchRow() { |
|
99 | + return $this->statement->fetch(); |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Provide a simple fetchOne. |
|
104 | - * |
|
105 | - * fetch single column from the next row |
|
106 | - * @param int $column the column number to fetch |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function fetchOne($column = 0) { |
|
110 | - return $this->statement->fetchColumn($column); |
|
111 | - } |
|
102 | + /** |
|
103 | + * Provide a simple fetchOne. |
|
104 | + * |
|
105 | + * fetch single column from the next row |
|
106 | + * @param int $column the column number to fetch |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function fetchOne($column = 0) { |
|
110 | + return $this->statement->fetchColumn($column); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Binds a PHP variable to a corresponding named or question mark placeholder in the |
|
115 | - * SQL statement that was use to prepare the statement. |
|
116 | - * |
|
117 | - * @param mixed $column Either the placeholder name or the 1-indexed placeholder index |
|
118 | - * @param mixed $variable The variable to bind |
|
119 | - * @param integer|null $type one of the PDO::PARAM_* constants |
|
120 | - * @param integer|null $length max length when using an OUT bind |
|
121 | - * @return boolean |
|
122 | - */ |
|
123 | - public function bindParam($column, &$variable, $type = null, $length = null){ |
|
124 | - return $this->statement->bindParam($column, $variable, $type, $length); |
|
125 | - } |
|
113 | + /** |
|
114 | + * Binds a PHP variable to a corresponding named or question mark placeholder in the |
|
115 | + * SQL statement that was use to prepare the statement. |
|
116 | + * |
|
117 | + * @param mixed $column Either the placeholder name or the 1-indexed placeholder index |
|
118 | + * @param mixed $variable The variable to bind |
|
119 | + * @param integer|null $type one of the PDO::PARAM_* constants |
|
120 | + * @param integer|null $length max length when using an OUT bind |
|
121 | + * @return boolean |
|
122 | + */ |
|
123 | + public function bindParam($column, &$variable, $type = null, $length = null){ |
|
124 | + return $this->statement->bindParam($column, $variable, $type, $length); |
|
125 | + } |
|
126 | 126 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * pass all other function directly to the \Doctrine\DBAL\Driver\Statement |
56 | 56 | */ |
57 | - public function __call($name,$arguments) { |
|
58 | - return call_user_func_array(array($this->statement,$name), $arguments); |
|
57 | + public function __call($name, $arguments) { |
|
58 | + return call_user_func_array(array($this->statement, $name), $arguments); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @param array $input |
65 | 65 | * @return \OC_DB_StatementWrapper|int |
66 | 66 | */ |
67 | - public function execute($input=array()) { |
|
68 | - if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) { |
|
67 | + public function execute($input = array()) { |
|
68 | + if (\OC::$server->getSystemConfig()->getValue("log_query", false)) { |
|
69 | 69 | $backTrace = debug_backtrace(); |
70 | - $class = $backTrace[1]['class'] . ':' . $backTrace[1]['function']; |
|
71 | - $file = substr($backTrace[0]['file'], strlen(\OC::$SERVERROOT)) . ':' . $backTrace[0]['line']; |
|
70 | + $class = $backTrace[1]['class'].':'.$backTrace[1]['function']; |
|
71 | + $file = substr($backTrace[0]['file'], strlen(\OC::$SERVERROOT)).':'.$backTrace[0]['line']; |
|
72 | 72 | $params_str = str_replace("\n", " ", var_export($input, true)); |
73 | 73 | \OCP\Util::writeLog('core', "DB execute with arguments : $params_str in $class; $file", \OCP\Util::DEBUG); |
74 | 74 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param integer|null $length max length when using an OUT bind |
121 | 121 | * @return boolean |
122 | 122 | */ |
123 | - public function bindParam($column, &$variable, $type = null, $length = null){ |
|
123 | + public function bindParam($column, &$variable, $type = null, $length = null) { |
|
124 | 124 | return $this->statement->bindParam($column, $variable, $type, $length); |
125 | 125 | } |
126 | 126 | } |
@@ -32,51 +32,51 @@ |
||
32 | 32 | |
33 | 33 | class ActionProviderStore { |
34 | 34 | |
35 | - /** @var IServerContainer */ |
|
36 | - private $serverContainer; |
|
35 | + /** @var IServerContainer */ |
|
36 | + private $serverContainer; |
|
37 | 37 | |
38 | - /** @var ILogger */ |
|
39 | - private $logger; |
|
38 | + /** @var ILogger */ |
|
39 | + private $logger; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param IServerContainer $serverContainer |
|
43 | - */ |
|
44 | - public function __construct(IServerContainer $serverContainer, ILogger $logger) { |
|
45 | - $this->serverContainer = $serverContainer; |
|
46 | - $this->logger = $logger; |
|
47 | - } |
|
41 | + /** |
|
42 | + * @param IServerContainer $serverContainer |
|
43 | + */ |
|
44 | + public function __construct(IServerContainer $serverContainer, ILogger $logger) { |
|
45 | + $this->serverContainer = $serverContainer; |
|
46 | + $this->logger = $logger; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return IProvider[] |
|
51 | - * @throws Exception |
|
52 | - */ |
|
53 | - public function getProviders() { |
|
54 | - // TODO: include apps |
|
55 | - $providerClasses = $this->getServerProviderClasses(); |
|
56 | - $providers = []; |
|
49 | + /** |
|
50 | + * @return IProvider[] |
|
51 | + * @throws Exception |
|
52 | + */ |
|
53 | + public function getProviders() { |
|
54 | + // TODO: include apps |
|
55 | + $providerClasses = $this->getServerProviderClasses(); |
|
56 | + $providers = []; |
|
57 | 57 | |
58 | - foreach ($providerClasses as $class) { |
|
59 | - try { |
|
60 | - $providers[] = $this->serverContainer->query($class); |
|
61 | - } catch (QueryException $ex) { |
|
62 | - $this->logger->logException($ex, [ |
|
63 | - 'message' => "Could not load contacts menu action provider $class", |
|
64 | - 'app' => 'core', |
|
65 | - ]); |
|
66 | - throw new \Exception("Could not load contacts menu action provider"); |
|
67 | - } |
|
68 | - } |
|
58 | + foreach ($providerClasses as $class) { |
|
59 | + try { |
|
60 | + $providers[] = $this->serverContainer->query($class); |
|
61 | + } catch (QueryException $ex) { |
|
62 | + $this->logger->logException($ex, [ |
|
63 | + 'message' => "Could not load contacts menu action provider $class", |
|
64 | + 'app' => 'core', |
|
65 | + ]); |
|
66 | + throw new \Exception("Could not load contacts menu action provider"); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - return $providers; |
|
71 | - } |
|
70 | + return $providers; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * @return string[] |
|
75 | - */ |
|
76 | - private function getServerProviderClasses() { |
|
77 | - return [ |
|
78 | - EMailProvider::class, |
|
79 | - ]; |
|
80 | - } |
|
73 | + /** |
|
74 | + * @return string[] |
|
75 | + */ |
|
76 | + private function getServerProviderClasses() { |
|
77 | + return [ |
|
78 | + EMailProvider::class, |
|
79 | + ]; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |