@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | $http_client = new org_openpsa_httplib(); |
| 57 | 57 | $http_client->set_param('timeout', 300); |
| 58 | -if ( !empty($_SERVER['PHP_AUTH_USER']) |
|
| 58 | +if (!empty($_SERVER['PHP_AUTH_USER']) |
|
| 59 | 59 | && !empty($_SERVER['PHP_AUTH_PW'])) { |
| 60 | 60 | $http_client->basicauth['user'] = $_SERVER['PHP_AUTH_USER']; |
| 61 | 61 | $http_client->basicauth['password'] = $_SERVER['PHP_AUTH_PW']; |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | return; |
| 87 | 87 | } |
| 88 | 88 | $initialized = true; |
| 89 | - if ( !midcom::get()->auth->user |
|
| 89 | + if (!midcom::get()->auth->user |
|
| 90 | 90 | || !midcom::get()->config->get('toolbars_enable_centralized') |
| 91 | 91 | || !midcom::get()->auth->can_user_do('midcom:centralized_toolbar', null, $this)) { |
| 92 | 92 | return; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | // Complete fields |
| 465 | 465 | $this->indexed = time(); |
| 466 | - if ( $this->author == '' |
|
| 466 | + if ($this->author == '' |
|
| 467 | 467 | && isset($this->creator->name)) { |
| 468 | 468 | $this->author = $this->creator->name; |
| 469 | 469 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | public function read_metadata_from_object($object) |
| 607 | 607 | { |
| 608 | 608 | // Published is set to non-empty value, use it as creation data |
| 609 | - if ( !empty($object->metadata->published) |
|
| 609 | + if (!empty($object->metadata->published) |
|
| 610 | 610 | && !preg_match('/0{1,4}-0{1,2}0{1,2}\s+0{1,2}:0{1,2}:0{1,2}/', $object->metadata->published)) { |
| 611 | 611 | $this->created = $this->read_unixtime($object->metadata->published); |
| 612 | 612 | } elseif (isset($object->metadata->created)) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | return @strtotime($stamp); |
| 646 | 646 | } |
| 647 | 647 | // Unix timestamp |
| 648 | - return (int)$stamp; |
|
| 648 | + return (int) $stamp; |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | private function process_attachment() |
| 95 | 95 | { |
| 96 | - if ( !isset($this->attachment->metadata) |
|
| 96 | + if (!isset($this->attachment->metadata) |
|
| 97 | 97 | || !is_object($this->attachment->metadata)) { |
| 98 | 98 | return; |
| 99 | 99 | } |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (strlen(trim($this->attachment->title)) > 0) { |
| 145 | - $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
| 145 | + $this->title = "{$this->attachment->title} ({$this->attachment->name})"; |
|
| 146 | 146 | $this->content .= "\n{$this->attachment->title}\n{$this->attachment->name}"; |
| 147 | 147 | } else { |
| 148 | - $this->title = $this->attachment->name; |
|
| 148 | + $this->title = $this->attachment->name; |
|
| 149 | 149 | $this->content .= "\n{$this->attachment->name}"; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $etag = trim($parser->data['headers']['etag']); |
| 102 | 102 | |
| 103 | 103 | $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag'); |
| 104 | - if ( !empty($feed_etag) |
|
| 104 | + if (!empty($feed_etag) |
|
| 105 | 105 | && $feed_etag == $etag) { |
| 106 | 106 | // Feed hasn't changed, skip updating |
| 107 | 107 | debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $guid = $item->get_id(); |
| 188 | 188 | $title = $item->get_title(); |
| 189 | 189 | |
| 190 | - if ( ( empty($title) |
|
| 190 | + if ((empty($title) |
|
| 191 | 191 | || trim($title) == '...') |
| 192 | 192 | && empty($guid)) { |
| 193 | 193 | // Something wrong with this entry, skip it |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $meta_values['published'] = $article_date; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if ( $this->apply_values($article, $values, $meta_values) |
|
| 258 | + if ($this->apply_values($article, $values, $meta_values) |
|
| 259 | 259 | && !$article->update()) { |
| 260 | 260 | return false; |
| 261 | 261 | } |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | private function find_author(net_nemein_rss_parser_item $item) |
| 285 | 285 | { |
| 286 | 286 | // Try to figure out item author |
| 287 | - if ( $this->_feed->forceauthor |
|
| 287 | + if ($this->_feed->forceauthor |
|
| 288 | 288 | && $this->_feed->defaultauthor) { |
| 289 | 289 | // Feed has a "default author" set, use it |
| 290 | 290 | return new midcom_db_person($this->_feed->defaultauthor); |
| 291 | 291 | } |
| 292 | 292 | $author = $this->match_item_author($item); |
| 293 | 293 | $fallback_person_id = 1; |
| 294 | - if ( !$author |
|
| 294 | + if (!$author |
|
| 295 | 295 | || $author->id == $fallback_person_id) { |
| 296 | 296 | if ($this->_feed->defaultauthor) { |
| 297 | 297 | // Feed has a "default author" set, use it |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - if ( !empty($author_info['username']) |
|
| 480 | + if (!empty($author_info['username']) |
|
| 481 | 481 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
| 482 | 482 | return $person->get_storage(); |
| 483 | 483 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $qb->add_constraint('name', '<>', ''); |
| 47 | 47 | |
| 48 | 48 | // Unless in Auto-Index mode or the index article is hidden, we skip the index article. |
| 49 | - if ( !$this->_config->get('autoindex') |
|
| 49 | + if (!$this->_config->get('autoindex') |
|
| 50 | 50 | && !$this->_config->get('indexinnav')) { |
| 51 | 51 | $qb->add_constraint('name', '<>', 'index'); |
| 52 | 52 | } |
@@ -109,8 +109,8 @@ |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $help = new midcom_admin_help_help(); |
| 112 | - $this->_request_data['help'] = $help->get_help_contents('asgard_'.$this->type, $help_component); |
|
| 113 | - $this->_request_data['component'] = $component; |
|
| 112 | + $this->_request_data['help'] = $help->get_help_contents('asgard_' . $this->type, $help_component); |
|
| 113 | + $this->_request_data['component'] = $component; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | $data['reflector'] = midcom_helper_reflector::get($data['type']); |
| 97 | 97 | $data['label_property'] = $data['reflector']->get_label_property(); |
| 98 | 98 | |
| 99 | - if ( isset($_POST['undelete']) |
|
| 99 | + if (isset($_POST['undelete']) |
|
| 100 | 100 | && is_array($_POST['undelete'])) { |
| 101 | 101 | if (isset($_POST['purge'])) { |
| 102 | 102 | $this->_purge(); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // List installed MgdSchema types and convert to DBA classes |
| 22 | 22 | foreach ($this->_request_data['schema_types'] as $schema_type) { |
| 23 | - if ( !is_null($type) |
|
| 23 | + if (!is_null($type) |
|
| 24 | 24 | && $schema_type != $type) { |
| 25 | 25 | // Skip |
| 26 | 26 | continue; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $qb->add_constraint('metadata.revised', '>=', $since); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ( $only_mine |
|
| 52 | + if ($only_mine |
|
| 53 | 53 | && midcom::get()->auth->user) { |
| 54 | 54 | $qb->add_constraint('metadata.authors', 'LIKE', '|' . midcom::get()->auth->user->guid . '|'); |
| 55 | 55 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $data['view_title'] = $this->_l10n->get('asgard'); |
| 95 | 95 | |
| 96 | - if ( isset($_POST['execute_mass_action']) |
|
| 96 | + if (isset($_POST['execute_mass_action']) |
|
| 97 | 97 | && !empty($_POST['selections']) |
| 98 | 98 | && isset($_POST['mass_action'])) { |
| 99 | 99 | $method_name = "_mass_{$_POST['mass_action']}"; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $data['review_by'] = null; |
| 111 | - if ( $this->_config->get('enable_review_dates') |
|
| 111 | + if ($this->_config->get('enable_review_dates') |
|
| 112 | 112 | && isset($_REQUEST['review_by']) |
| 113 | 113 | && $_REQUEST['review_by'] != 'any') { |
| 114 | 114 | $data['review_by'] = (int) $_REQUEST['review_by']; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $data['type_filter'] = null; |
| 118 | - if ( isset($_REQUEST['type_filter']) |
|
| 118 | + if (isset($_REQUEST['type_filter']) |
|
| 119 | 119 | && $_REQUEST['type_filter'] != 'any') { |
| 120 | 120 | $data['type_filter'] = $_REQUEST['type_filter']; |
| 121 | 121 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | continue; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if ( $object->can_do('midgard:update') |
|
| 277 | + if ($object->can_do('midgard:update') |
|
| 278 | 278 | && $object->can_do('midcom:approve')) { |
| 279 | 279 | $object->metadata->approve(); |
| 280 | 280 | midcom::get()->uimessages->add($this->_l10n->get('midgard.admin.asgard'), sprintf($this->_l10n->get('object %s approved'), $object->guid)); |