@@ -4,7 +4,7 @@ |
||
| 4 | 4 | <h1>Merge tags</h1> |
| 5 | 5 | |
| 6 | 6 | <?php |
| 7 | -if ( isset($_POST['from']) |
|
| 7 | +if (isset($_POST['from']) |
|
| 8 | 8 | && isset($_POST['to'])) { |
| 9 | 9 | if (net_nemein_tag_handler::merge_tags($_POST['from'], $_POST['to'])) { |
| 10 | 10 | echo "<p>Successfully merged tag \"{$_POST['from']}\" to \"{$_POST['to']}\"</p>\n"; |
@@ -152,7 +152,8 @@ |
||
| 152 | 152 | try { |
| 153 | 153 | $topic = new midcom_db_topic($id); |
| 154 | 154 | $id = $topic->id; |
| 155 | - } catch (midcom_error $e) { |
|
| 155 | + } |
|
| 156 | + catch (midcom_error $e) { |
|
| 156 | 157 | $e->log(); |
| 157 | 158 | break; |
| 158 | 159 | } |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | public function _on_initialize() |
| 20 | 20 | { |
| 21 | 21 | // Match / |
| 22 | - if ( $this->_config->get('redirection_type') === null |
|
| 23 | - || ( $this->_topic->can_do('net.nemein.redirector:noredirect') |
|
| 22 | + if ($this->_config->get('redirection_type') === null |
|
| 23 | + || ($this->_topic->can_do('net.nemein.redirector:noredirect') |
|
| 24 | 24 | && !$this->_config->get('admin_redirection'))) { |
| 25 | 25 | $this->_request_switch['redirect'] = [ |
| 26 | 26 | 'handler' => [net_nemein_redirector_handler_tinyurl::class, 'list'], |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
| 43 | 43 | { |
| 44 | - if ( $object instanceof midcom_db_article |
|
| 44 | + if ($object instanceof midcom_db_article |
|
| 45 | 45 | && $topic->id == $object->topic) { |
| 46 | 46 | if ($object->name == 'index') { |
| 47 | 47 | return ''; |
@@ -30,7 +30,8 @@ |
||
| 30 | 30 | foreach ($result as $wikipage) { |
| 31 | 31 | try { |
| 32 | 32 | $datamanager->set_storage($wikipage); |
| 33 | - } catch (midcom_error $e) { |
|
| 33 | + } |
|
| 34 | + catch (midcom_error $e) { |
|
| 34 | 35 | $e->log(MIDCOM_LOG_WARN); |
| 35 | 36 | continue; |
| 36 | 37 | } |
@@ -66,7 +66,8 @@ |
||
| 66 | 66 | try { |
| 67 | 67 | $author = new midcom_db_person($wikipage->metadata->revisor); |
| 68 | 68 | $item->author = $author->name; |
| 69 | - } catch (midcom_error $e) { |
|
| 69 | + } |
|
| 70 | + catch (midcom_error $e) { |
|
| 70 | 71 | $e->log(); |
| 71 | 72 | } |
| 72 | 73 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( $history['date'] < $from |
|
| 53 | + if ($history['date'] < $from |
|
| 54 | 54 | || $history['date'] > $to) { |
| 55 | 55 | // We can ignore revisions outside the timeframe |
| 56 | 56 | continue; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->_seek_updated($from); |
| 94 | 94 | |
| 95 | 95 | $i = 0; |
| 96 | - while ( $this->_updated_pages < $this->_max_pages |
|
| 96 | + while ($this->_updated_pages < $this->_max_pages |
|
| 97 | 97 | && $i < 20) { |
| 98 | 98 | // Expand seek by another two weeks |
| 99 | 99 | $to = $from; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | public function _on_creating() |
| 31 | 31 | { |
| 32 | - if ( $this->title == '' |
|
| 32 | + if ($this->title == '' |
|
| 33 | 33 | || !$this->topic) { |
| 34 | 34 | // We must have wikiword and topic at this stage |
| 35 | 35 | return false; |
@@ -193,7 +193,8 @@ |
||
| 193 | 193 | |
| 194 | 194 | try { |
| 195 | 195 | $diff_fields = $rcs_handler->get_diff($prev_version, $this_version); |
| 196 | - } catch (midcom_error $e) { |
|
| 196 | + } |
|
| 197 | + catch (midcom_error $e) { |
|
| 197 | 198 | $e->log(); |
| 198 | 199 | return ''; |
| 199 | 200 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public function get_link($key = 0, $rel = 'alternate') |
| 62 | 62 | { |
| 63 | 63 | $link = parent::get_link($key, $rel); |
| 64 | - if ( $rel !== 'alternate' |
|
| 64 | + if ($rel !== 'alternate' |
|
| 65 | 65 | || $key !== 0) { |
| 66 | 66 | return $link; |
| 67 | 67 | } |
@@ -296,7 +296,8 @@ |
||
| 296 | 296 | // the tree. This is, for example, used by the on-delete cache invalidation. |
| 297 | 297 | try { |
| 298 | 298 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
| 299 | - } catch (midcom_error $e) { |
|
| 299 | + } |
|
| 300 | + catch (midcom_error $e) { |
|
| 300 | 301 | debug_add("Could not load GUID {$guid}, trying to continue anyway. Last error was: " . $e->getMessage(), MIDCOM_LOG_WARN); |
| 301 | 302 | } |
| 302 | 303 | if (!empty($object)) { |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
| 436 | 436 | } |
| 437 | 437 | } else { |
| 438 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 438 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 439 | 439 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) { |
| 440 | 440 | continue; |
| 441 | 441 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $id = "custom-{$key}"; |
| 555 | 555 | |
| 556 | 556 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
| 557 | - if ( substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 557 | + if (substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 558 | 558 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) { |
| 559 | 559 | $url = $entry[MIDCOM_NAV_URL]; |
| 560 | 560 | } |
@@ -52,7 +52,8 @@ |
||
| 52 | 52 | } elseif (!empty($this->data[MIDCOM_NAV_GUID])) { |
| 53 | 53 | try { |
| 54 | 54 | $this->data[MIDCOM_NAV_OBJECT] = midcom::get()->dbfactory->get_object_by_guid($this->data[MIDCOM_NAV_GUID]); |
| 55 | - } catch (midcom_error $e) { |
|
| 55 | + } |
|
| 56 | + catch (midcom_error $e) { |
|
| 56 | 57 | } |
| 57 | 58 | } else { |
| 58 | 59 | debug_add("Warning: The leaf {$this->leafid} of topic {$topic->id} does set neither a GUID nor an object."); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function is_readable_by($user_id) : bool |
| 30 | 30 | { |
| 31 | - return ( empty($this->object) |
|
| 31 | + return (empty($this->object) |
|
| 32 | 32 | || !$this->guid |
| 33 | 33 | || !$user_id |
| 34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, $this->object->__midcom_class_name__, $user_id)); |