@@ -28,7 +28,7 @@ |
||
28 | 28 | new type\radiocheckselect, |
29 | 29 | new type\subform, |
30 | 30 | new type\select, |
31 | - new type\tinymce, |
|
31 | + new type\tinymce, |
|
32 | 32 | new type\toolbar, |
33 | 33 | ); |
34 | 34 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function transform($array) |
21 | 21 | { |
22 | - if (!is_array($array) ) { |
|
22 | + if (!is_array($array)) { |
|
23 | 23 | throw new TransformationFailedException('Expected an array.'); |
24 | 24 | } |
25 | 25 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $title = $this->data['midcom_services_auth_access_denied_title']; |
4 | 4 | $login_warning = $this->data['midcom_services_auth_access_denied_login_warning']; |
5 | 5 | |
6 | -midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL.'/midcom.services.auth/style.css'); |
|
6 | +midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.auth/style.css'); |
|
7 | 7 | ?> |
8 | 8 | <!DOCTYPE html> |
9 | 9 | <html lang="<?php echo midcom::get()->i18n->get_current_language(); ?>"> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | $title = $this->data['midcom_services_auth_show_login_page_title']; |
3 | 3 | $login_warning = $this->data['midcom_services_auth_show_login_page_login_warning']; |
4 | 4 | |
5 | -midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL.'/midcom.services.auth/style.css'); |
|
5 | +midcom::get()->head->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.auth/style.css'); |
|
6 | 6 | ?> |
7 | 7 | <!DOCTYPE html> |
8 | 8 | <html lang="<?php echo midcom::get()->i18n->get_current_language(); ?>"> |
@@ -312,17 +312,17 @@ |
||
312 | 312 | private static $_privileges_cache = array(); |
313 | 313 | |
314 | 314 | /** |
315 | - * Internal cache of the content privileges of users on content objects, this is |
|
316 | - * an associative array using a combination of the user identifier and the object's |
|
317 | - * guid as index. The privileges for the anonymous user use the magic |
|
318 | - * EVERYONE as user identifier. |
|
319 | - * |
|
320 | - * This must not be merged with the class-wide privileges_cache, because otherwise |
|
321 | - * class_default_privileges for child objects might be overridden by parent default |
|
322 | - * privileges |
|
323 | - * |
|
324 | - * @var Array |
|
325 | - */ |
|
315 | + * Internal cache of the content privileges of users on content objects, this is |
|
316 | + * an associative array using a combination of the user identifier and the object's |
|
317 | + * guid as index. The privileges for the anonymous user use the magic |
|
318 | + * EVERYONE as user identifier. |
|
319 | + * |
|
320 | + * This must not be merged with the class-wide privileges_cache, because otherwise |
|
321 | + * class_default_privileges for child objects might be overridden by parent default |
|
322 | + * privileges |
|
323 | + * |
|
324 | + * @var Array |
|
325 | + */ |
|
326 | 326 | private static $_content_privileges_cache = array(); |
327 | 327 | |
328 | 328 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $cache_id = $user_id . '::' . $object_guid; |
519 | 519 | |
520 | 520 | if (!array_key_exists($cache_id, self::$_privileges_cache)) { |
521 | - if ( empty($object_guid) |
|
521 | + if (empty($object_guid) |
|
522 | 522 | || empty($object_class)) { |
523 | 523 | /* No idea if there should be some special log message written */ |
524 | 524 | return array(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
631 | 631 | // <== out of SUDO |
632 | 632 | |
633 | - if ( $parent_guid == $guid |
|
633 | + if ($parent_guid == $guid |
|
634 | 634 | || !mgd_is_guid($parent_guid)) { |
635 | 635 | $base_privileges = array(); |
636 | 636 | } else { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | // Determine parent ownership |
642 | 642 | $is_owner = false; |
643 | 643 | $last_owner_scope = -1; |
644 | - if ( array_key_exists('midgard:owner', $base_privileges) |
|
644 | + if (array_key_exists('midgard:owner', $base_privileges) |
|
645 | 645 | && $base_privileges['midgard:owner'] == MIDCOM_PRIVILEGE_ALLOW) { |
646 | 646 | $is_owner = true; |
647 | 647 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | $valid_privileges[$scope][$privilege->privilegename] = $privilege->value; |
683 | 683 | |
684 | - if ( $privilege->privilegename == 'midgard:owner' |
|
684 | + if ($privilege->privilegename == 'midgard:owner' |
|
685 | 685 | && $scope > $last_owner_scope) { |
686 | 686 | $is_owner = ($privilege->value == MIDCOM_PRIVILEGE_ALLOW); |
687 | 687 | $last_owner_scope = $scope; |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | $content_privilege = null; |
893 | 893 | |
894 | 894 | foreach ($object_privileges as $privilege) { |
895 | - if ( $privilege->privilegename != $privilegename |
|
895 | + if ($privilege->privilegename != $privilegename |
|
896 | 896 | || $privilege->scope <= $last_scope |
897 | 897 | || !$privilege->does_privilege_apply($user_id)) { |
898 | 898 | continue; |
@@ -903,10 +903,10 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | //owner privileges override everything but person privileges, so we have to cross-check those here |
906 | - if ( $privilegename != 'midgard:owner' |
|
906 | + if ($privilegename != 'midgard:owner' |
|
907 | 907 | && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) { |
908 | 908 | $owner_privileges = $this->get_owner_default_privileges(); |
909 | - if ( array_key_exists($privilegename, $owner_privileges) |
|
909 | + if (array_key_exists($privilegename, $owner_privileges) |
|
910 | 910 | && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id) |
911 | 911 | && self::$_content_privileges_cache[$cache_id]['midgard:owner']) { |
912 | 912 | self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | midcom::get()->auth->acl->_internal_sudo = $previous_sudo; |
931 | 931 | // <== out of SUDO |
932 | 932 | |
933 | - if ( $parent_guid == $guid |
|
933 | + if ($parent_guid == $guid |
|
934 | 934 | || !mgd_is_guid($parent_guid)) { |
935 | 935 | return false; |
936 | 936 | } |
@@ -474,7 +474,7 @@ |
||
474 | 474 | { |
475 | 475 | return |
476 | 476 | ( |
477 | - $this->string_exists($string, $this->_language) |
|
477 | + $this->string_exists($string, $this->_language) |
|
478 | 478 | || $this->string_exists($string, $this->_fallback_language) |
479 | 479 | ); |
480 | 480 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | self::$_localedb[$this->_library] = array(); |
150 | 150 | } |
151 | 151 | |
152 | - $this->_stringdb =& self::$_localedb[$this->_library]; |
|
152 | + $this->_stringdb = & self::$_localedb[$this->_library]; |
|
153 | 153 | |
154 | 154 | $this->set_language(midcom::get()->i18n->get_current_language()); |
155 | 155 | $this->set_charset(midcom::get()->i18n->get_current_charset()); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $data = $this->parse_data(file($filename), $lang, $filename); |
219 | 219 | |
220 | 220 | // get site-specific l10n |
221 | - $component_locale = midcom_helper_misc::get_snippet_content_graceful("conf:/" . $this->_component_name . '/l10n/'. $this->database . '.' . $lang . '.txt'); |
|
221 | + $component_locale = midcom_helper_misc::get_snippet_content_graceful("conf:/" . $this->_component_name . '/l10n/' . $this->database . '.' . $lang . '.txt'); |
|
222 | 222 | if (!empty($component_locale)) { |
223 | 223 | $data = array_merge($data, $this->parse_data(explode("\n", $component_locale), $lang, $component_locale)); |
224 | 224 | } |
@@ -58,7 +58,6 @@ |
||
58 | 58 | * @property string $revisor The person that modified the object, read-only. |
59 | 59 | * @property integer $approved The time of approval of the object, or 0 if not approved. Set automatically through approve/unapprove. |
60 | 60 | * @property string $approver The person that approved/unapproved the object. Set automatically through approve/unapprove. |
61 | - |
|
62 | 61 | * @package midcom.helper |
63 | 62 | */ |
64 | 63 | class midcom_helper_metadata |
@@ -658,7 +658,8 @@ |
||
658 | 658 | && mgd_is_guid($guid)) { |
659 | 659 | try { |
660 | 660 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
661 | - } catch (midcom_error $e) { |
|
661 | + } |
|
662 | + catch (midcom_error $e) { |
|
662 | 663 | debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN); |
663 | 664 | debug_print_r("Source was:", $source); |
664 | 665 |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // Check if we have metadata schema defined in the schemadb specific for the object's schema or component |
227 | 227 | $object_schema = $object->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
228 | 228 | $component_schema = str_replace('.', '_', midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT)); |
229 | - if ( $object_schema == '' |
|
229 | + if ($object_schema == '' |
|
230 | 230 | || !isset($schemadb[$object_schema])) { |
231 | 231 | if (isset($schemadb[$component_schema])) { |
232 | 232 | // No specific metadata schema for object, fall back to component-specific metadata schema |
@@ -525,11 +525,11 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | $now = time(); |
528 | - if ( $this->get('schedulestart') |
|
528 | + if ($this->get('schedulestart') |
|
529 | 529 | && $this->get('schedulestart') > $now) { |
530 | 530 | return false; |
531 | 531 | } |
532 | - if ( $this->get('scheduleend') |
|
532 | + if ($this->get('scheduleend') |
|
533 | 533 | && $this->get('scheduleend') < $now) { |
534 | 534 | return false; |
535 | 535 | } |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | public function is_object_visible_onsite() |
548 | 548 | { |
549 | 549 | return |
550 | - ( ( midcom::get()->config->get('show_hidden_objects') |
|
550 | + ((midcom::get()->config->get('show_hidden_objects') |
|
551 | 551 | || $this->is_visible()) |
552 | - && ( midcom::get()->config->get('show_unapproved_objects') |
|
552 | + && (midcom::get()->config->get('show_unapproved_objects') |
|
553 | 553 | || $this->is_approved()) |
554 | 554 | ); |
555 | 555 | } |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $object = $source; |
637 | 637 | $guid = $source->guid; |
638 | 638 | } elseif (is_array($source)) { |
639 | - if ( !array_key_exists(MIDCOM_NAV_GUID, $source) |
|
639 | + if (!array_key_exists(MIDCOM_NAV_GUID, $source) |
|
640 | 640 | || is_null($source[MIDCOM_NAV_GUID])) { |
641 | 641 | debug_print_r('We got an invalid input, cannot return metadata:', $source); |
642 | 642 | return false; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | $guid = $source; |
648 | 648 | } |
649 | 649 | |
650 | - if ( is_null($object) |
|
650 | + if (is_null($object) |
|
651 | 651 | && mgd_is_guid($guid)) { |
652 | 652 | try { |
653 | 653 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | } |
683 | 683 | |
684 | 684 | // Lock was created by the user, return "not locked" |
685 | - if ( !empty(midcom::get()->auth->user->guid) |
|
685 | + if (!empty(midcom::get()->auth->user->guid) |
|
686 | 686 | && $this->get('locker') === midcom::get()->auth->user->guid) { |
687 | 687 | return false; |
688 | 688 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | { |
701 | 701 | midcom::get()->auth->require_do('midgard:update', $this->__object); |
702 | 702 | |
703 | - if ( is_object($this->__object) |
|
703 | + if (is_object($this->__object) |
|
704 | 704 | && $this->__object->lock()) { |
705 | 705 | $this->_cache = array(); |
706 | 706 | return true; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | */ |
718 | 718 | public function can_unlock() |
719 | 719 | { |
720 | - return ( $this->__object->can_do('midcom:unlock') |
|
720 | + return ($this->__object->can_do('midcom:unlock') |
|
721 | 721 | || midcom::get()->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom')); |
722 | 722 | } |
723 | 723 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function unlock() |
730 | 730 | { |
731 | - if ( $this->can_unlock() |
|
731 | + if ($this->can_unlock() |
|
732 | 732 | && is_object($this->__object) |
733 | 733 | && $this->__object->unlock()) { |
734 | 734 | $this->_cache = array(); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - var $jsevents=null; |
|
38 | + var $jsevents = null; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Whether to show field title or not. |
@@ -407,7 +407,7 @@ |
||
407 | 407 | |
408 | 408 | $parent = $parent->get_parent_group(); |
409 | 409 | } |
410 | - */ |
|
410 | + */ |
|
411 | 411 | $this->_inheritance_chains[$id] = $inheritance_chain; |
412 | 412 | } |
413 | 413 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | private function _load_from_string($id, $person_class) |
214 | 214 | { |
215 | 215 | // Don't even try with the magic assignees |
216 | - if ( 'ANONYMOUS' === $id |
|
216 | + if ('ANONYMOUS' === $id |
|
217 | 217 | || 'EVERYONE' === $id |
218 | 218 | || 'USERS' === $id |
219 | 219 | || 'OWNER' === $id |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $this->_inheritance_chains = array(); |
362 | 362 | |
363 | 363 | foreach ($this->_direct_groups as $id => $group) { |
364 | - $this->_all_groups[$id] =& $this->_direct_groups[$id]; |
|
364 | + $this->_all_groups[$id] = & $this->_direct_groups[$id]; |
|
365 | 365 | $inheritance_chain = array($group->id); |
366 | 366 | /** |
367 | 367 | * FIXME: Parent group members should inherit permissions from |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | } |
491 | 491 | // We scan through our groups looking for a midgard group with the right name |
492 | 492 | foreach ($this->_all_groups as $group_object) { |
493 | - if ( midcom::get()->dbfactory->is_a($group_object, 'midcom_core_group') |
|
493 | + if (midcom::get()->dbfactory->is_a($group_object, 'midcom_core_group') |
|
494 | 494 | && $group_object->get_storage()->name == $group) { |
495 | 495 | return true; |
496 | 496 | } |
@@ -180,7 +180,8 @@ discard block |
||
180 | 180 | } |
181 | 181 | try { |
182 | 182 | $this->_storage = new $person_class($id); |
183 | - } catch (midgard_error_exception $e) { |
|
183 | + } |
|
184 | + catch (midgard_error_exception $e) { |
|
184 | 185 | debug_add("Failed to retrieve the person ID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
185 | 186 | throw new midcom_error_midgard($e, $id); |
186 | 187 | } |
@@ -228,7 +229,8 @@ discard block |
||
228 | 229 | if (mgd_is_guid($id)) { |
229 | 230 | try { |
230 | 231 | return new $person_class($id); |
231 | - } catch (midgard_error_exception $e) { |
|
232 | + } |
|
233 | + catch (midgard_error_exception $e) { |
|
232 | 234 | debug_add("Failed to retrieve the person GUID {$id}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
233 | 235 | throw new midcom_error_midgard($e, $id); |
234 | 236 | } |