@@ -95,15 +95,13 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); |
| 97 | 97 | |
| 98 | - if ( $this->_config->get('use_captcha') |
|
| 99 | - || ( !midcom::get()->auth->user |
|
| 98 | + if ($this->_config->get('use_captcha') |
|
| 99 | + || (!midcom::get()->auth->user |
|
| 100 | 100 | && $this->_config->get('use_captcha_if_anonymous'))) |
| 101 | 101 | { |
| 102 | - $this->_schemadb['comment']->append_field |
|
| 103 | - ( |
|
| 102 | + $this->_schemadb['comment']->append_field( |
|
| 104 | 103 | 'captcha', |
| 105 | - array |
|
| 106 | - ( |
|
| 104 | + array( |
|
| 107 | 105 | 'title' => $this->_l10n_midcom->get('captcha field title'), |
| 108 | 106 | 'storage' => null, |
| 109 | 107 | 'type' => 'captcha', |
@@ -113,7 +111,7 @@ discard block |
||
| 113 | 111 | ); |
| 114 | 112 | } |
| 115 | 113 | |
| 116 | - if ( $this->_config->get('ratings_enable') |
|
| 114 | + if ($this->_config->get('ratings_enable') |
|
| 117 | 115 | && array_key_exists('rating', $this->_schemadb['comment']->fields)) |
| 118 | 116 | { |
| 119 | 117 | $this->_schemadb['comment']->fields['rating']['hidden'] = false; |
@@ -135,12 +133,12 @@ discard block |
||
| 135 | 133 | } |
| 136 | 134 | |
| 137 | 135 | $this->_post_controller = midcom_helper_datamanager2_controller::create('create'); |
| 138 | - $this->_post_controller->schemadb =& $this->_schemadb; |
|
| 136 | + $this->_post_controller->schemadb = & $this->_schemadb; |
|
| 139 | 137 | $this->_post_controller->schema = 'comment'; |
| 140 | 138 | $this->_post_controller->defaults = $defaults; |
| 141 | - $this->_post_controller->callback_object =& $this; |
|
| 139 | + $this->_post_controller->callback_object = & $this; |
|
| 142 | 140 | |
| 143 | - if (! $this->_post_controller->initialize()) |
|
| 141 | + if (!$this->_post_controller->initialize()) |
|
| 144 | 142 | { |
| 145 | 143 | throw new midcom_error('Failed to initialize a DM2 create controller.'); |
| 146 | 144 | } |
@@ -149,7 +147,7 @@ discard block |
||
| 149 | 147 | /** |
| 150 | 148 | * DM2 creation callback, binds the new object directly to the _objectguid. |
| 151 | 149 | */ |
| 152 | - public function & dm2_create_callback (&$controller) |
|
| 150 | + public function & dm2_create_callback(&$controller) |
|
| 153 | 151 | { |
| 154 | 152 | $this->_new_comment = new net_nehmer_comments_comment(); |
| 155 | 153 | $this->_new_comment->objectguid = $this->_objectguid; |
@@ -178,13 +176,13 @@ discard block |
||
| 178 | 176 | $this->_new_comment->_send_notification = true; |
| 179 | 177 | } |
| 180 | 178 | |
| 181 | - if (! $this->_new_comment->create()) |
|
| 179 | + if (!$this->_new_comment->create()) |
|
| 182 | 180 | { |
| 183 | 181 | debug_print_r('We operated on this object:', $this->_new_comment); |
| 184 | - throw new midcom_error('Failed to create a new comment, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
| 182 | + throw new midcom_error('Failed to create a new comment, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
| 185 | 183 | } |
| 186 | 184 | |
| 187 | - if ( isset($_POST['subscribe']) |
|
| 185 | + if (isset($_POST['subscribe']) |
|
| 188 | 186 | && midcom::get()->auth->user) |
| 189 | 187 | { |
| 190 | 188 | // User wants to subscribe to receive notifications about this comments thread |
@@ -216,7 +214,7 @@ discard block |
||
| 216 | 214 | */ |
| 217 | 215 | public function _handler_comments($handler_id, array $args, array &$data) |
| 218 | 216 | { |
| 219 | - if (! mgd_is_guid($args[0])) |
|
| 217 | + if (!mgd_is_guid($args[0])) |
|
| 220 | 218 | { |
| 221 | 219 | throw new midcom_error("The GUID '{$args[0]}' is invalid. Cannot continue."); |
| 222 | 220 | } |
@@ -249,7 +247,7 @@ discard block |
||
| 249 | 247 | $this->_comments = $this->_comments->execute(); |
| 250 | 248 | } |
| 251 | 249 | |
| 252 | - if ( midcom::get()->auth->user |
|
| 250 | + if (midcom::get()->auth->user |
|
| 253 | 251 | || $this->_config->get('allow_anonymous')) |
| 254 | 252 | { |
| 255 | 253 | $this->_init_post_controller(); |
@@ -264,7 +262,7 @@ discard block |
||
| 264 | 262 | $this->_process_admintoolbar(); |
| 265 | 263 | // This might exit. |
| 266 | 264 | |
| 267 | - if ( $handler_id == 'view-comments-custom' |
|
| 265 | + if ($handler_id == 'view-comments-custom' |
|
| 268 | 266 | && count($args) > 1) |
| 269 | 267 | { |
| 270 | 268 | midcom::get()->skip_page_style = true; |
@@ -274,7 +272,7 @@ discard block |
||
| 274 | 272 | $this->_prepare_request_data(); |
| 275 | 273 | midcom::get()->metadata->set_request_metadata($this->_get_last_modified(), $this->_objectguid); |
| 276 | 274 | |
| 277 | - if ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) |
|
| 275 | + if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) |
|
| 278 | 276 | && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') |
| 279 | 277 | { |
| 280 | 278 | midcom::get()->skip_page_style = true; |
@@ -313,7 +311,7 @@ discard block |
||
| 313 | 311 | */ |
| 314 | 312 | private function _process_post() |
| 315 | 313 | { |
| 316 | - if ( !midcom::get()->auth->user |
|
| 314 | + if (!midcom::get()->auth->user |
|
| 317 | 315 | && !midcom::get()->auth->request_sudo('net.nehmer.comments')) |
| 318 | 316 | { |
| 319 | 317 | throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting'); |
@@ -329,7 +327,7 @@ discard block |
||
| 329 | 327 | // Fall-through intentional |
| 330 | 328 | |
| 331 | 329 | case 'cancel': |
| 332 | - if (! midcom::get()->auth->user) |
|
| 330 | + if (!midcom::get()->auth->user) |
|
| 333 | 331 | { |
| 334 | 332 | midcom::get()->auth->drop_sudo(); |
| 335 | 333 | } |
@@ -346,7 +344,7 @@ discard block |
||
| 346 | 344 | */ |
| 347 | 345 | private function _get_last_modified() |
| 348 | 346 | { |
| 349 | - if (! $this->_comments) |
|
| 347 | + if (!$this->_comments) |
|
| 350 | 348 | { |
| 351 | 349 | return 0; |
| 352 | 350 | } |
@@ -398,8 +396,8 @@ discard block |
||
| 398 | 396 | $data['comment_toolbar'] = $this->_master->_populate_post_toolbar($comment); |
| 399 | 397 | midcom_show_style('comments-item'); |
| 400 | 398 | |
| 401 | - if ( midcom::get()->auth->admin |
|
| 402 | - || ( midcom::get()->auth->user |
|
| 399 | + if (midcom::get()->auth->admin |
|
| 400 | + || (midcom::get()->auth->user |
|
| 403 | 401 | && $comment->can_do('midgard:delete'))) |
| 404 | 402 | { |
| 405 | 403 | midcom_show_style('comments-admintoolbar'); |
@@ -412,7 +410,7 @@ discard block |
||
| 412 | 410 | midcom_show_style('comments-nonefound'); |
| 413 | 411 | } |
| 414 | 412 | |
| 415 | - if ( midcom::get()->auth->user |
|
| 413 | + if (midcom::get()->auth->user |
|
| 416 | 414 | || $this->_config->get('allow_anonymous')) |
| 417 | 415 | { |
| 418 | 416 | midcom_show_style('post-comment'); |
@@ -14,11 +14,10 @@ discard block |
||
| 14 | 14 | class midcom_config_test |
| 15 | 15 | { |
| 16 | 16 | const OK = 0; |
| 17 | - const WARNING = 1; |
|
| 17 | + const WARNING = 1; |
|
| 18 | 18 | const ERROR = 2; |
| 19 | 19 | |
| 20 | - private $messages = array |
|
| 21 | - ( |
|
| 20 | + private $messages = array( |
|
| 22 | 21 | 'midcom' => array(), |
| 23 | 22 | 'php' => array(), |
| 24 | 23 | 'external' => array() |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | |
| 43 | 42 | private function add($testname, $result_code, $recommendations = ' ') |
| 44 | 43 | { |
| 45 | - $this->messages[$this->section][$testname] = array |
|
| 46 | - ( |
|
| 44 | + $this->messages[$this->section][$testname] = array( |
|
| 47 | 45 | 'result' => $result_code, |
| 48 | 46 | 'message' => $recommendations |
| 49 | 47 | ); |
@@ -53,12 +51,12 @@ discard block |
||
| 53 | 51 | private function check_midcom() |
| 54 | 52 | { |
| 55 | 53 | $this->section = 'midcom'; |
| 56 | - if ( extension_loaded('midgard') |
|
| 54 | + if (extension_loaded('midgard') |
|
| 57 | 55 | && version_compare(mgd_version(), '8.09.9', '<')) |
| 58 | 56 | { |
| 59 | 57 | $this->add('Midgard Version', self::ERROR, 'Midgard 8.09.9 or greater is required for OpenPSA.'); |
| 60 | 58 | } |
| 61 | - else if ( extension_loaded('midgard2') |
|
| 59 | + else if (extension_loaded('midgard2') |
|
| 62 | 60 | && version_compare(mgd_version(), '10.05.5', '<')) |
| 63 | 61 | { |
| 64 | 62 | $this->add('Midgard Version', self::ERROR, 'Midgard2 10.05.5 or greater is required for OpenPSA.'); |
@@ -70,11 +68,11 @@ discard block |
||
| 70 | 68 | |
| 71 | 69 | // Validate the Cache Base Directory. |
| 72 | 70 | $cachedir = midcom::get()->config->get('cache_base_directory'); |
| 73 | - if (! is_dir($cachedir)) |
|
| 71 | + if (!is_dir($cachedir)) |
|
| 74 | 72 | { |
| 75 | 73 | $this->add('MidCOM cache base directory', self::ERROR, "The configured MidCOM cache base directory ({$cachedir}) does not exist or is not a directory. You have to create it as a directory writable by the Apache user."); |
| 76 | 74 | } |
| 77 | - else if (! is_writable($cachedir)) |
|
| 75 | + else if (!is_writable($cachedir)) |
|
| 78 | 76 | { |
| 79 | 77 | $this->add('MidCOM cache base directory', self::ERROR, "The configured MidCOM cache base directory ({$cachedir}) is not writable by the Apache user. You have to create it as a directory writable by the Apache user."); |
| 80 | 78 | } |
@@ -152,7 +150,7 @@ discard block |
||
| 152 | 150 | $this->add('Setting: post_max_size', self::WARNING, 'post_max_size should be larger than upload_max_filesize, as both limits apply during uploads.'); |
| 153 | 151 | } |
| 154 | 152 | |
| 155 | - if (! $this->ini_get_boolean('magic_quotes_gpc')) |
|
| 153 | + if (!$this->ini_get_boolean('magic_quotes_gpc')) |
|
| 156 | 154 | { |
| 157 | 155 | $this->add('Setting: magic_quotes_gpc', self::OK); |
| 158 | 156 | } |
@@ -160,7 +158,7 @@ discard block |
||
| 160 | 158 | { |
| 161 | 159 | $this->add('Setting: magic_quotes_gpc', self::ERROR, 'Magic Quotes must be turned off, Midgard/MidCOM does this explicitly where required.'); |
| 162 | 160 | } |
| 163 | - if (! $this->ini_get_boolean('magic_quotes_runtime')) |
|
| 161 | + if (!$this->ini_get_boolean('magic_quotes_runtime')) |
|
| 164 | 162 | { |
| 165 | 163 | $this->add('Setting: magic_quotes_runtime', self::OK); |
| 166 | 164 | } |
@@ -186,7 +184,7 @@ discard block |
||
| 186 | 184 | $this->add("Bytecode cache", self::WARNING, "A PHP bytecode cache is recommended for efficient MidCOM operation"); |
| 187 | 185 | } |
| 188 | 186 | |
| 189 | - if (! class_exists('Memcache')) |
|
| 187 | + if (!class_exists('Memcache')) |
|
| 190 | 188 | { |
| 191 | 189 | $this->add('Memcache', self::WARNING, 'The PHP Memcache module is recommended for efficient MidCOM operation.'); |
| 192 | 190 | } |
@@ -247,7 +245,7 @@ discard block |
||
| 247 | 245 | $this->section = 'external'; |
| 248 | 246 | // ImageMagick |
| 249 | 247 | $cmd = midcom::get()->config->get('utility_imagemagick_base') . "identify -version"; |
| 250 | - exec ($cmd, $output, $result); |
|
| 248 | + exec($cmd, $output, $result); |
|
| 251 | 249 | if ($result !== 0 && $result !== 1) |
| 252 | 250 | { |
| 253 | 251 | $this->add('ImageMagick', self::ERROR, 'The existence ImageMagick toolkit could not be verified, it is required for all kinds of image processing in MidCOM.'); |
@@ -274,7 +272,7 @@ discard block |
||
| 274 | 272 | } |
| 275 | 273 | } |
| 276 | 274 | |
| 277 | - private function check_for_utility ($testname, $fail_code, $fail_recommendations, $ok_notice = ' ') |
|
| 275 | + private function check_for_utility($testname, $fail_code, $fail_recommendations, $ok_notice = ' ') |
|
| 278 | 276 | { |
| 279 | 277 | $executable = midcom::get()->config->get("utility_{$testname}"); |
| 280 | 278 | if (is_null($executable)) |
@@ -287,7 +285,7 @@ discard block |
||
| 287 | 285 | } |
| 288 | 286 | else |
| 289 | 287 | { |
| 290 | - exec ("which {$executable}", $output, $exitcode); |
|
| 288 | + exec("which {$executable}", $output, $exitcode); |
|
| 291 | 289 | if ($exitcode == 0) |
| 292 | 290 | { |
| 293 | 291 | $this->add($testname, self::OK, $ok_notice); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @return int The ID of the Node for which we have a match, or false on failure. |
| 194 | 194 | * @see midcom_helper_nav_backend::get_leaf_uplink() |
| 195 | 195 | */ |
| 196 | - function get_leaf_uplink ($leaf_id) |
|
| 196 | + function get_leaf_uplink($leaf_id) |
|
| 197 | 197 | { |
| 198 | 198 | return $this->_backend->get_leaf_uplink($leaf_id); |
| 199 | 199 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | return true; |
| 227 | 227 | } |
| 228 | - if ( $uplink == false |
|
| 228 | + if ($uplink == false |
|
| 229 | 229 | || $uplink == -1) |
| 230 | 230 | { |
| 231 | 231 | return false; |
@@ -370,9 +370,9 @@ discard block |
||
| 370 | 370 | // this is the rest of the lot, we need to traverse everything, unfortunately. |
| 371 | 371 | // First, we traverse a list of nodes to be checked on by one, avoiding a recursive |
| 372 | 372 | // function call. |
| 373 | - $unprocessed_node_ids = Array ($this->get_root_node()); |
|
| 373 | + $unprocessed_node_ids = Array($this->get_root_node()); |
|
| 374 | 374 | |
| 375 | - while (count ($unprocessed_node_ids) > 0) |
|
| 375 | + while (count($unprocessed_node_ids) > 0) |
|
| 376 | 376 | { |
| 377 | 377 | $node_id = array_shift($unprocessed_node_ids); |
| 378 | 378 | |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | } |
| 486 | 486 | else |
| 487 | 487 | { |
| 488 | - if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 488 | + if (!empty($data['napobject'][MIDCOM_NAV_GUID]) |
|
| 489 | 489 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) |
| 490 | 490 | { |
| 491 | 491 | continue; |
@@ -587,8 +587,7 @@ discard block |
||
| 587 | 587 | foreach ($this->get_node_path($curr_node) as $node_id) |
| 588 | 588 | { |
| 589 | 589 | $node = $this->get_node($node_id); |
| 590 | - $result[$node[MIDCOM_NAV_ID]] = Array |
|
| 591 | - ( |
|
| 590 | + $result[$node[MIDCOM_NAV_ID]] = Array( |
|
| 592 | 591 | MIDCOM_NAV_URL => $node[MIDCOM_NAV_ABSOLUTEURL], |
| 593 | 592 | MIDCOM_NAV_NAME => $node[MIDCOM_NAV_NAME], |
| 594 | 593 | MIDCOM_NAV_TYPE => 'node', |
@@ -603,8 +602,7 @@ discard block |
||
| 603 | 602 | // Ignore Index Article Leaves |
| 604 | 603 | if ($leaf[MIDCOM_NAV_URL] != '') |
| 605 | 604 | { |
| 606 | - $result[$leaf[MIDCOM_NAV_ID]] = Array |
|
| 607 | - ( |
|
| 605 | + $result[$leaf[MIDCOM_NAV_ID]] = Array( |
|
| 608 | 606 | MIDCOM_NAV_URL => $leaf[MIDCOM_NAV_ABSOLUTEURL], |
| 609 | 607 | MIDCOM_NAV_NAME => $leaf[MIDCOM_NAV_NAME], |
| 610 | 608 | MIDCOM_NAV_TYPE => 'leaf', |
@@ -624,14 +622,13 @@ discard block |
||
| 624 | 622 | $id = "custom-{$key}"; |
| 625 | 623 | |
| 626 | 624 | $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}"; |
| 627 | - if ( substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 625 | + if (substr($entry[MIDCOM_NAV_URL], 0, 1) == '/' |
|
| 628 | 626 | || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) |
| 629 | 627 | { |
| 630 | 628 | $url = $entry[MIDCOM_NAV_URL]; |
| 631 | 629 | } |
| 632 | 630 | |
| 633 | - $result[$id] = Array |
|
| 634 | - ( |
|
| 631 | + $result[$id] = Array( |
|
| 635 | 632 | MIDCOM_NAV_URL => $url, |
| 636 | 633 | MIDCOM_NAV_NAME => $entry[MIDCOM_NAV_NAME], |
| 637 | 634 | MIDCOM_NAV_TYPE => 'custom', |
@@ -266,12 +266,10 @@ discard block |
||
| 266 | 266 | if ($navorder == MIDCOM_NAVORDER_ARTICLESFIRST) |
| 267 | 267 | { |
| 268 | 268 | $navorder = 'articlesfirst'; |
| 269 | - } |
|
| 270 | - else if ($navorder == MIDCOM_NAVORDER_SCORE) |
|
| 269 | + } else if ($navorder == MIDCOM_NAVORDER_SCORE) |
|
| 271 | 270 | { |
| 272 | 271 | $navorder = 'score'; |
| 273 | - } |
|
| 274 | - else |
|
| 272 | + } else |
|
| 275 | 273 | { |
| 276 | 274 | $navorder = 'topicsfirst'; |
| 277 | 275 | } |
@@ -313,8 +311,7 @@ discard block |
||
| 313 | 311 | try |
| 314 | 312 | { |
| 315 | 313 | $object = midcom::get()->dbfactory->get_object_by_guid($guid); |
| 316 | - } |
|
| 317 | - catch (midcom_error $e) |
|
| 314 | + } catch (midcom_error $e) |
|
| 318 | 315 | { |
| 319 | 316 | debug_add("Could not load GUID {$guid}, trying to continue anyway. Last error was: " . $e->getMessage(), MIDCOM_LOG_WARN); |
| 320 | 317 | } |
@@ -482,8 +479,7 @@ discard block |
||
| 482 | 479 | { |
| 483 | 480 | $entry = "<span class=\"{$current_class}\">{$entry}</span>"; |
| 484 | 481 | } |
| 485 | - } |
|
| 486 | - else |
|
| 482 | + } else |
|
| 487 | 483 | { |
| 488 | 484 | if ( !empty($data['napobject'][MIDCOM_NAV_GUID]) |
| 489 | 485 | && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) |
@@ -566,8 +562,7 @@ discard block |
||
| 566 | 562 | { |
| 567 | 563 | $curr_leaf = $this->get_current_leaf(); |
| 568 | 564 | $curr_node = $this->get_current_node(); |
| 569 | - } |
|
| 570 | - else |
|
| 565 | + } else |
|
| 571 | 566 | { |
| 572 | 567 | $curr_leaf = $this->get_leaf($id); |
| 573 | 568 | $curr_node = -1; |
@@ -578,8 +573,7 @@ discard block |
||
| 578 | 573 | { |
| 579 | 574 | $curr_node = $node[MIDCOM_NAV_ID]; |
| 580 | 575 | } |
| 581 | - } |
|
| 582 | - else |
|
| 576 | + } else |
|
| 583 | 577 | { |
| 584 | 578 | $curr_node = $this->get_node($curr_leaf[MIDCOM_NAV_NODEID]); |
| 585 | 579 | } |
@@ -36,14 +36,14 @@ |
||
| 36 | 36 | * |
| 37 | 37 | * Assumes Admin Privileges. |
| 38 | 38 | */ |
| 39 | - public function & dm2_create_callback (&$controller) |
|
| 39 | + public function & dm2_create_callback(&$controller) |
|
| 40 | 40 | { |
| 41 | 41 | // Create a new group |
| 42 | 42 | $this->_group = new midcom_db_group(); |
| 43 | - if (! $this->_group->create()) |
|
| 43 | + if (!$this->_group->create()) |
|
| 44 | 44 | { |
| 45 | 45 | debug_print_r('We operated on this object:', $this->_group); |
| 46 | - throw new midcom_error('Failed to create a new group. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
| 46 | + throw new midcom_error('Failed to create a new group. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $this->_group; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | case 'edit': |
| 68 | 68 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
| 69 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 69 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 70 | 70 | $this->_controller->set_storage($this->_topic); |
| 71 | 71 | break; |
| 72 | 72 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
| 82 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 82 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 83 | 83 | $this->_controller->schemaname = 'default'; |
| 84 | - $this->_controller->callback_object =& $this; |
|
| 84 | + $this->_controller->callback_object = & $this; |
|
| 85 | 85 | |
| 86 | 86 | // Suggest to create the same type of a folder as the parent is |
| 87 | 87 | $component_suggestion = $this->_topic->component; |
@@ -92,8 +92,7 @@ discard block |
||
| 92 | 92 | $component_suggestion = $this->_config->get('default_component'); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $this->_controller->defaults = array |
|
| 96 | - ( |
|
| 95 | + $this->_controller->defaults = array( |
|
| 97 | 96 | 'component' => $component_suggestion, |
| 98 | 97 | ); |
| 99 | 98 | break; |
@@ -108,16 +107,16 @@ discard block |
||
| 108 | 107 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($schemadb); |
| 109 | 108 | |
| 110 | 109 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
| 111 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 110 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 112 | 111 | $this->_controller->schemaname = 'link'; |
| 113 | - $this->_controller->callback_object =& $this; |
|
| 112 | + $this->_controller->callback_object = & $this; |
|
| 114 | 113 | break; |
| 115 | 114 | |
| 116 | 115 | default: |
| 117 | 116 | throw new midcom_error('Unable to process the request, unknown handler id'); |
| 118 | 117 | } |
| 119 | 118 | |
| 120 | - if (! $this->_controller->initialize()) |
|
| 119 | + if (!$this->_controller->initialize()) |
|
| 121 | 120 | { |
| 122 | 121 | throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_event->id}."); |
| 123 | 122 | } |
@@ -126,15 +125,15 @@ discard block |
||
| 126 | 125 | /** |
| 127 | 126 | * DM2 creation callback, binds to the current content topic. |
| 128 | 127 | */ |
| 129 | - public function & dm2_create_callback (&$controller) |
|
| 128 | + public function & dm2_create_callback(&$controller) |
|
| 130 | 129 | { |
| 131 | 130 | $this->_new_topic = new midcom_db_topic(); |
| 132 | 131 | $this->_new_topic->up = $this->_topic->id; |
| 133 | 132 | |
| 134 | - if (! $this->_new_topic->create()) |
|
| 133 | + if (!$this->_new_topic->create()) |
|
| 135 | 134 | { |
| 136 | 135 | debug_print_r('We operated on this object:', $this->_new_topic); |
| 137 | - throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
| 136 | + throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
| 138 | 137 | } |
| 139 | 138 | |
| 140 | 139 | return $this->_new_topic; |
@@ -186,8 +185,7 @@ discard block |
||
| 186 | 185 | |
| 187 | 186 | midcom::get()->head->set_pagetitle($title); |
| 188 | 187 | |
| 189 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 190 | - ( |
|
| 188 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 191 | 189 | 'controller' => $this->_controller, |
| 192 | 190 | 'save_callback' => array($this, 'save_callback') |
| 193 | 191 | )); |
@@ -206,7 +204,7 @@ discard block |
||
| 206 | 204 | |
| 207 | 205 | private function _update_topic($prefix, $old_name) |
| 208 | 206 | { |
| 209 | - if ( !empty($this->_topic->symlink) |
|
| 207 | + if (!empty($this->_topic->symlink) |
|
| 210 | 208 | && !empty($this->_topic->component)) |
| 211 | 209 | { |
| 212 | 210 | $this->_topic->symlink = null; |
@@ -225,7 +223,7 @@ discard block |
||
| 225 | 223 | |
| 226 | 224 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.folder'), $this->_l10n->get('new style created')); |
| 227 | 225 | |
| 228 | - if (! $this->_topic->update()) |
|
| 226 | + if (!$this->_topic->update()) |
|
| 229 | 227 | { |
| 230 | 228 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.folder'), sprintf($this->_l10n->get('could not save folder: %s'), midcom_connection::get_error_string())); |
| 231 | 229 | return false; |
@@ -274,8 +272,7 @@ discard block |
||
| 274 | 272 | $e->getMessage(), MIDCOM_LOG_ERROR); |
| 275 | 273 | |
| 276 | 274 | $this->_new_topic->purge(); |
| 277 | - throw new midcom_error |
|
| 278 | - ( |
|
| 275 | + throw new midcom_error( |
|
| 279 | 276 | "Refusing to create this symlink because its target folder was not found: " . |
| 280 | 277 | $e->getMessage() |
| 281 | 278 | ); |
@@ -285,8 +282,7 @@ discard block |
||
| 285 | 282 | if ($this->_new_topic->up == $topic->up) |
| 286 | 283 | { |
| 287 | 284 | $this->_new_topic->purge(); |
| 288 | - throw new midcom_error |
|
| 289 | - ( |
|
| 285 | + throw new midcom_error( |
|
| 290 | 286 | "Refusing to create this symlink because it is located in the same |
| 291 | 287 | folder as its target" |
| 292 | 288 | ); |
@@ -294,8 +290,7 @@ discard block |
||
| 294 | 290 | if ($this->_new_topic->up == $topic->id) |
| 295 | 291 | { |
| 296 | 292 | $this->_new_topic->purge(); |
| 297 | - throw new midcom_error |
|
| 298 | - ( |
|
| 293 | + throw new midcom_error( |
|
| 299 | 294 | "Refusing to create this symlink because its parent folder is the same |
| 300 | 295 | folder as its target." |
| 301 | 296 | ); |
@@ -304,8 +299,7 @@ discard block |
||
| 304 | 299 | if (!midcom_admin_folder_management::is_child_listing_finite($topic)) |
| 305 | 300 | { |
| 306 | 301 | $this->_new_topic->purge(); |
| 307 | - throw new midcom_error |
|
| 308 | - ( |
|
| 302 | + throw new midcom_error( |
|
| 309 | 303 | "Refusing to create this symlink because it would have created an |
| 310 | 304 | infinite loop situation." |
| 311 | 305 | ); |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | if ($current++ == 0) |
| 43 | 43 | { |
| 44 | - $field['start_fieldset'] = array |
|
| 45 | - ( |
|
| 44 | + $field['start_fieldset'] = array( |
|
| 46 | 45 | 'title' => 'account_fieldset', |
| 47 | 46 | 'css_group' => 'area meta', |
| 48 | 47 | ); |
@@ -87,8 +86,7 @@ discard block |
||
| 87 | 86 | midcom::get()->head->set_pagetitle($this->_l10n->get('create person')); |
| 88 | 87 | |
| 89 | 88 | $data['controller'] = $this->get_controller('create'); |
| 90 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 91 | - ( |
|
| 89 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 92 | 90 | 'controller' => $data['controller'], |
| 93 | 91 | 'save_callback' => array($this, 'save_callback') |
| 94 | 92 | )); |
@@ -107,14 +105,14 @@ discard block |
||
| 107 | 105 | /** |
| 108 | 106 | * DM2 creation callback. |
| 109 | 107 | */ |
| 110 | - public function & dm2_create_callback (&$controller) |
|
| 108 | + public function & dm2_create_callback(&$controller) |
|
| 111 | 109 | { |
| 112 | 110 | // Create a new person |
| 113 | 111 | $this->_person = new midcom_db_person; |
| 114 | - if (! $this->_person->create()) |
|
| 112 | + if (!$this->_person->create()) |
|
| 115 | 113 | { |
| 116 | 114 | debug_print_r('We operated on this object:', $this->_person); |
| 117 | - throw new midcom_error('Failed to create a new person. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
| 115 | + throw new midcom_error('Failed to create a new person. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
| 118 | 116 | } |
| 119 | 117 | |
| 120 | 118 | return $this->_person; |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | midcom::get()->auth->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface'); |
| 42 | 42 | midcom::get()->head->set_pagetitle($this->_l10n->get('create group')); |
| 43 | 43 | |
| 44 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 45 | - ( |
|
| 44 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 46 | 45 | 'controller' => $this->get_controller('create'), |
| 47 | 46 | 'save_callback' => array($this, 'save_callback') |
| 48 | 47 | )); |
@@ -58,14 +57,14 @@ discard block |
||
| 58 | 57 | /** |
| 59 | 58 | * DM2 creation callback. |
| 60 | 59 | */ |
| 61 | - public function & dm2_create_callback (&$controller) |
|
| 60 | + public function & dm2_create_callback(&$controller) |
|
| 62 | 61 | { |
| 63 | 62 | // Create a new group |
| 64 | 63 | $this->_group = new midcom_db_group(); |
| 65 | - if (! $this->_group->create()) |
|
| 64 | + if (!$this->_group->create()) |
|
| 66 | 65 | { |
| 67 | 66 | debug_print_r('We operated on this object:', $this->_group); |
| 68 | - throw new midcom_error('Failed to create a new group. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
| 67 | + throw new midcom_error('Failed to create a new group. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | return $this->_group; |