@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $message['content'] = ''; |
| 55 | 55 | $logs = $comment->get_logs(); |
| 56 | 56 | if (!empty($logs)) { |
| 57 | - $message['content'] .= $this->_l10n->get('moderation history').":\n\n"; |
|
| 57 | + $message['content'] .= $this->_l10n->get('moderation history') . ":\n\n"; |
|
| 58 | 58 | foreach ($logs as $time => $log) { |
| 59 | 59 | $reported = $this->_l10n->get_formatter()->datetime(strtotime("{$time}Z")); |
| 60 | 60 | $message['content'] .= $this->_l10n->get(sprintf('%s: %s by %s (from %s)', "$reported:\n", $this->_l10n->get($log['action']), $log['reporter'], $log['ip'])) . "\n\n"; |
@@ -47,7 +47,8 @@ |
||
| 47 | 47 | if ($node_id) { |
| 48 | 48 | try { |
| 49 | 49 | $comments_topic = new midcom_db_topic($node_id); |
| 50 | - } catch (midcom_error $e) { |
|
| 50 | + } |
|
| 51 | + catch (midcom_error $e) { |
|
| 51 | 52 | return null; |
| 52 | 53 | } |
| 53 | 54 | |
@@ -409,7 +409,8 @@ |
||
| 409 | 409 | foreach ($this->_articles as $article_counter => $article) { |
| 410 | 410 | try { |
| 411 | 411 | $data['datamanager']->set_storage($article); |
| 412 | - } catch (midcom_error $e) { |
|
| 412 | + } |
|
| 413 | + catch (midcom_error $e) { |
|
| 413 | 414 | $e->log(); |
| 414 | 415 | continue; |
| 415 | 416 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | private function _process_category_constraint(org_openpsa_qbpager $qb) |
| 77 | 77 | { |
| 78 | - if ( !in_array($this->category, $this->_request_data['categories']) |
|
| 78 | + if (!in_array($this->category, $this->_request_data['categories']) |
|
| 79 | 79 | && !$this->_config->get('categories_custom_enable')) { |
| 80 | 80 | throw new midcom_error('Custom categories are not allowed'); |
| 81 | 81 | // TODO: Check here if there are actually items in this cat? |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
| 89 | 89 | |
| 90 | 90 | // Activate correct leaf |
| 91 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
| 91 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
| 92 | 92 | && in_array($this->category, $this->_request_data['categories'])) { |
| 93 | 93 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->category); |
| 94 | 94 | } |
@@ -55,11 +55,11 @@ |
||
| 55 | 55 | foreach (array_filter($csv_line) as $field => $value) { |
| 56 | 56 | // Process the row accordingly |
| 57 | 57 | $field_matching = $this->_settings['fields'][$field]; |
| 58 | - if ( $field_matching |
|
| 58 | + if ($field_matching |
|
| 59 | 59 | && strstr($field_matching, ':')) { |
| 60 | 60 | [$schemadb, $schema_field] = explode(':', $field_matching); |
| 61 | 61 | |
| 62 | - if ( !array_key_exists($schemadb, $this->_schemadbs) |
|
| 62 | + if (!array_key_exists($schemadb, $this->_schemadbs) |
|
| 63 | 63 | || !$this->_schemadbs[$schemadb]->get('default')->has_field($schema_field)) { |
| 64 | 64 | // Invalid matching, skip |
| 65 | 65 | continue; |
@@ -568,10 +568,10 @@ |
||
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | //owner privileges override everything but person privileges, so we have to cross-check those here |
| 571 | - if ( $privilegename != 'midgard:owner' |
|
| 571 | + if ($privilegename != 'midgard:owner' |
|
| 572 | 572 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
| 573 | 573 | $owner_privileges = $this->get_owner_default_privileges(); |
| 574 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
| 574 | + if (array_key_exists($privilegename, $owner_privileges) |
|
| 575 | 575 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
| 576 | 576 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
| 577 | 577 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -261,17 +261,17 @@ |
||
| 261 | 261 | private static $_default_magic_class_privileges = []; |
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | - * Internal cache of the content privileges of users on content objects, this is |
|
| 265 | - * an associative array using a combination of the user identifier and the object's |
|
| 266 | - * guid as index. The privileges for the anonymous user use the magic |
|
| 267 | - * EVERYONE as user identifier. |
|
| 268 | - * |
|
| 269 | - * This must not be merged with the class-wide privileges_cache, because otherwise |
|
| 270 | - * class_default_privileges for child objects might be overridden by parent default |
|
| 271 | - * privileges |
|
| 272 | - * |
|
| 273 | - * @var array |
|
| 274 | - */ |
|
| 264 | + * Internal cache of the content privileges of users on content objects, this is |
|
| 265 | + * an associative array using a combination of the user identifier and the object's |
|
| 266 | + * guid as index. The privileges for the anonymous user use the magic |
|
| 267 | + * EVERYONE as user identifier. |
|
| 268 | + * |
|
| 269 | + * This must not be merged with the class-wide privileges_cache, because otherwise |
|
| 270 | + * class_default_privileges for child objects might be overridden by parent default |
|
| 271 | + * privileges |
|
| 272 | + * |
|
| 273 | + * @var array |
|
| 274 | + */ |
|
| 275 | 275 | private static $_content_privileges_cache = []; |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -64,7 +64,8 @@ |
||
| 64 | 64 | try { |
| 65 | 65 | $backend->update($message); |
| 66 | 66 | return true; |
| 67 | - } catch (midcom_error $e) { |
|
| 67 | + } |
|
| 68 | + catch (midcom_error $e) { |
|
| 68 | 69 | debug_add('RCS: Could not save file!'); |
| 69 | 70 | $e->log(); |
| 70 | 71 | return false; |
@@ -50,9 +50,11 @@ |
||
| 50 | 50 | $filepath = $this->generate_filename(); |
| 51 | 51 | try { |
| 52 | 52 | $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null"); |
| 53 | - } catch (midcom_error $e) { |
|
| 53 | + } |
|
| 54 | + catch (midcom_error $e) { |
|
| 54 | 55 | $e->log(); |
| 55 | - } finally { |
|
| 56 | + } |
|
| 57 | + finally { |
|
| 56 | 58 | if (!file_exists($filepath)) { |
| 57 | 59 | return []; |
| 58 | 60 | } |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $revisions[$history['revision']] = $history; |
| 92 | 92 | |
| 93 | 93 | $i += 3; |
| 94 | - while ( $i < $total |
|
| 94 | + while ($i < $total |
|
| 95 | 95 | && !str_starts_with($lines[$i], '----') |
| 96 | 96 | && !str_starts_with($lines[$i], '=====')) { |
| 97 | 97 | $i++; |
@@ -55,7 +55,8 @@ |
||
| 55 | 55 | { |
| 56 | 56 | try { |
| 57 | 57 | return eval("return [{$data}\n];"); |
| 58 | - } catch (ParseError $e) { |
|
| 58 | + } |
|
| 59 | + catch (ParseError $e) { |
|
| 59 | 60 | throw new midcom_error('Failed to parse config data: ' . $e->getMessage() . ' in ' . $path . ' line ' . $e->getLine()); |
| 60 | 61 | } |
| 61 | 62 | } |
@@ -43,11 +43,11 @@ |
||
| 43 | 43 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 44 | 44 | { |
| 45 | 45 | $session_key = md5($builder->getForm()->getName() . '_session_key'); |
| 46 | - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($session_key) { |
|
| 46 | + $builder->addEventListener(FormEvents::POST_SUBMIT, function(FormEvent $event) use ($session_key) { |
|
| 47 | 47 | $value = $event->getForm()->getData(); |
| 48 | 48 | $session = new midcom_services_session('midcom_datamanager_captcha'); |
| 49 | 49 | |
| 50 | - if ( !$session->exists($session_key) |
|
| 50 | + if (!$session->exists($session_key) |
|
| 51 | 51 | || $value != $session->get($session_key)) { |
| 52 | 52 | $event->getForm()->addError(new FormError($this->l10n->get('captcha validation failed'))); |
| 53 | 53 | } |