@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | /* pData class definition */ |
17 | - class pBarcode128 |
|
18 | - { |
|
17 | + class pBarcode128 { |
|
19 | 18 | var $Codes; |
20 | 19 | var $Reverse; |
21 | 20 | var $Result; |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | var $CRC; |
24 | 23 | |
25 | 24 | /* Class creator */ |
26 | - function pBarcode128($BasePath="") |
|
27 | - { |
|
25 | + function pBarcode128($BasePath="") { |
|
28 | 26 | $this->Codes = ""; |
29 | 27 | $this->Reverse = ""; |
30 | 28 | |
@@ -32,8 +30,7 @@ discard block |
||
32 | 30 | |
33 | 31 | if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); } |
34 | 32 | |
35 | - while (!feof($FileHandle)) |
|
36 | - { |
|
33 | + while (!feof($FileHandle)) { |
|
37 | 34 | $Buffer = fgets($FileHandle,4096); |
38 | 35 | $Buffer = str_replace(chr(10),"",$Buffer); |
39 | 36 | $Buffer = str_replace(chr(13),"",$Buffer); |
@@ -48,8 +45,7 @@ discard block |
||
48 | 45 | } |
49 | 46 | |
50 | 47 | /* Return the projected size of a barcode */ |
51 | - function getSize($TextString,$Format="") |
|
52 | - { |
|
48 | + function getSize($TextString,$Format="") { |
|
53 | 49 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
54 | 50 | $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
55 | 51 | $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
@@ -76,17 +72,14 @@ discard block |
||
76 | 72 | return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight)); |
77 | 73 | } |
78 | 74 | |
79 | - function encode128($Value,$Format="") |
|
80 | - { |
|
75 | + function encode128($Value,$Format="") { |
|
81 | 76 | $this->Result = "11010010000"; |
82 | 77 | $this->CRC = 104; |
83 | 78 | $TextString = ""; |
84 | 79 | |
85 | - for($i=1;$i<=strlen($Value);$i++) |
|
86 | - { |
|
80 | + for($i=1;$i<=strlen($Value);$i++) { |
|
87 | 81 | $CharCode = ord($this->mid($Value,$i,1)); |
88 | - if ( isset($this->Codes[$CharCode]) ) |
|
89 | - { |
|
82 | + if ( isset($this->Codes[$CharCode]) ) { |
|
90 | 83 | $this->Result = $this->Result.$this->Codes[$CharCode]["Code"]; |
91 | 84 | $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"]; |
92 | 85 | $TextString = $TextString.chr($CharCode); |
@@ -101,8 +94,7 @@ discard block |
||
101 | 94 | } |
102 | 95 | |
103 | 96 | /* Create the encoded string */ |
104 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
105 | - { |
|
97 | + function draw($Object,$Value,$X,$Y,$Format="") { |
|
106 | 98 | $this->pChartObject = $Object; |
107 | 99 | |
108 | 100 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -123,21 +115,17 @@ discard block |
||
123 | 115 | |
124 | 116 | $TextString = $this->encode128($Value); |
125 | 117 | |
126 | - if ( $DrawArea ) |
|
127 | - { |
|
118 | + if ( $DrawArea ) { |
|
128 | 119 | $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
129 | 120 | $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
130 | 121 | |
131 | 122 | $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
132 | 123 | $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
133 | 124 | |
134 | - if ( $ShowLegend ) |
|
135 | - { |
|
125 | + if ( $ShowLegend ) { |
|
136 | 126 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
137 | 127 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
138 | - } |
|
139 | - else |
|
140 | - { |
|
128 | + } else { |
|
141 | 129 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
142 | 130 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
143 | 131 | } |
@@ -150,10 +138,8 @@ discard block |
||
150 | 138 | $this->pChartObject->drawPolygon($Polygon,$Settings); |
151 | 139 | } |
152 | 140 | |
153 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
154 | - { |
|
155 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
156 | - { |
|
141 | + for($i=1;$i<=strlen($this->Result);$i++) { |
|
142 | + if ( $this->mid($this->Result,$i,1) == 1 ) { |
|
157 | 143 | $X1 = $X + cos($Angle * PI / 180) * $i; |
158 | 144 | $Y1 = $Y + sin($Angle * PI / 180) * $i; |
159 | 145 | $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
@@ -164,8 +150,7 @@ discard block |
||
164 | 150 | } |
165 | 151 | } |
166 | 152 | |
167 | - if ( $ShowLegend ) |
|
168 | - { |
|
153 | + if ( $ShowLegend ) { |
|
169 | 154 | $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
170 | 155 | $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
171 | 156 |
@@ -20,11 +20,12 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | $roles = user_roles(); |
23 | - if (isset($tid)) { // edit |
|
23 | + if (isset($tid)) { |
|
24 | +// edit |
|
24 | 25 | $template_tid = variable_get('forum_access_default_template_tid', 0); |
25 | 26 | $settings = _forum_access_get_settings($tid); |
26 | - } |
|
27 | - else { // create |
|
27 | + } else { |
|
28 | +// create |
|
28 | 29 | $template_tid = variable_get('forum_access_new_template_tid', NULL); |
29 | 30 | $settings = _forum_access_get_settings($template_tid); |
30 | 31 | } |
@@ -208,9 +209,11 @@ discard block |
||
208 | 209 | drupal_add_css(drupal_get_path('module', 'forum_access') .'/forum_access.css'); |
209 | 210 | |
210 | 211 | // Find our moderator ACL: |
211 | - if (isset($tid)) { // edit, not new |
|
212 | + if (isset($tid)) { |
|
213 | +// edit, not new |
|
212 | 214 | $acl_id = acl_get_id_by_number('forum_access', $tid); |
213 | - if (!$acl_id) { // create one |
|
215 | + if (!$acl_id) { |
|
216 | +// create one |
|
214 | 217 | $acl_id = acl_create_new_acl('forum_access', NULL, $tid); |
215 | 218 | // update every existing node in this forum to use this acl. |
216 | 219 | $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid); |
@@ -288,8 +291,7 @@ discard block |
||
288 | 291 | $form['forum_access']['interference']['by_content_access'][] = array( |
289 | 292 | '#value' => '<div>'. t("Unless you really know what you're doing, we recommend that you go to the !link page and clear all checkboxes. This will instruct @Content_Access to leave the %content_type nodes alone. However, if you put nodes of other content types into forums as well, then these content types will continue to have this problem.", $variables) .'</div>', |
290 | 293 | ); |
291 | - } |
|
292 | - else { |
|
294 | + } else { |
|
293 | 295 | $form['forum_access']['interference']['by_content_access'][] = array( |
294 | 296 | '#value' => '<div>'. t("The priority of @Content_Access ($ca_priority) is higher than the priority of !Forum_Access ($fa_priority), which means the latter is <strong>completely disabled</strong> for the %content_type type! Unless you really know what you're doing, we recommend that you go to the !link page, change the priority (under %Advanced) to 0, and clear all checkboxes.", $variables) .'</div>', |
295 | 297 | ); |
@@ -297,8 +299,7 @@ discard block |
||
297 | 299 | $form['forum_access']['interference']['by_content_access'][] = array( |
298 | 300 | '#value' => '<div>'. t("Alternatively, you can give !Forum_Access priority over @Content_Access by either raising the priority of !Forum_Access in every forum above the priority of @Content_Access, or by lowering the priority of @Content_Access for the content types in question below the priority of !Forum_Access.", $variables) .'</div>', |
299 | 301 | ); |
300 | - } |
|
301 | - else { |
|
302 | + } else { |
|
302 | 303 | $form['forum_access']['interference'][] = array( |
303 | 304 | '#value' => '<p>'. t('Note: You have installed the !Content_Access module, which has the capability to grant access to content that would otherwise be protected by !Forum_Access. Be careful when configuring @Content_Access!', $variables) .'</p>', |
304 | 305 | ); |
@@ -445,21 +446,17 @@ discard block |
||
445 | 446 | $element[$rid]['#suffix'] = "</span>"; |
446 | 447 | $element[$rid]['#default_value'] = TRUE; |
447 | 448 | $element[$rid]['#disabled'] = TRUE; |
448 | - } |
|
449 | - elseif ($element['#parents'][1] == 'create') { |
|
449 | + } elseif ($element['#parents'][1] == 'create') { |
|
450 | 450 | // Do nothing (Post is always mutable). |
451 | - } |
|
452 | - elseif ($element['#parents'][1] == 'comment_create') { |
|
453 | - } |
|
454 | - elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) { |
|
451 | + } elseif ($element['#parents'][1] == 'comment_create') { |
|
452 | + } elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) { |
|
455 | 453 | $element[$rid]['#title'] = '<em>'. $element[$rid]['#title'] .'</em>'; |
456 | 454 | $element[$rid]['#prefix'] = '<span title="'. t("This role has the '@administer_forums' permission, and granting '@View' enables the role holders to change the settings on this page, including @Access_control!", array('@administer_forums' => $tr('administer forums'), '@View' => t('View'), '@Access_control' => t('Access control'))) .'">'; |
457 | 455 | if (isset($permissions[$rid]['administer nodes'])) { |
458 | 456 | $element[$rid]['#prefix'] = str_replace('">', ' '. t("Because the role also has the '@administer_nodes' permission, it has full access to all nodes either way.", array('@administer_nodes' => $tr('administer nodes'))) .'">', $element[$rid]['#prefix']); |
459 | 457 | } |
460 | 458 | $element[$rid]['#suffix'] = "</span>"; |
461 | - } |
|
462 | - elseif (isset($permissions[$rid]['administer nodes'])) { |
|
459 | + } elseif (isset($permissions[$rid]['administer nodes'])) { |
|
463 | 460 | $element[$rid]['#disabled'] = TRUE; |
464 | 461 | $element[$rid]['#default_value'] = TRUE; |
465 | 462 | $element[$rid]['#prefix'] = '<span title="'. ($rid != $moderator_rid |
@@ -515,8 +512,7 @@ discard block |
||
515 | 512 | if ($settings['priority'] != 0) { |
516 | 513 | $form['interference']['advanced']['#collapsed'] = FALSE; |
517 | 514 | } |
518 | - } |
|
519 | - elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) { |
|
515 | + } elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) { |
|
520 | 516 | $imv = reset($form_state['values']['forum_access']['template']['taxonomy']); |
521 | 517 | $template_tid = reset($imv); |
522 | 518 | } |
@@ -549,14 +545,12 @@ discard block |
||
549 | 545 | $template_tid = reset(array_values($access['template']['taxonomy'])); |
550 | 546 | if ($access['template']['select_by_default']) { |
551 | 547 | variable_set('forum_access_default_template_tid', $template_tid); |
552 | - } |
|
553 | - elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) { |
|
548 | + } elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) { |
|
554 | 549 | variable_del('forum_access_default_template_tid'); |
555 | 550 | } |
556 | 551 | if ($access['template']['load_for_new']) { |
557 | 552 | variable_set('forum_access_new_template_tid', $template_tid); |
558 | - } |
|
559 | - elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) { |
|
553 | + } elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) { |
|
560 | 554 | variable_del('forum_access_new_template_tid'); |
561 | 555 | } |
562 | 556 | module_load_include('node.inc', 'forum_access'); |
@@ -598,8 +592,7 @@ discard block |
||
598 | 592 | // We prefer not to save records for node administrators, because these have access anyway. |
599 | 593 | if (isset($permissions[$rid]['administer forums']) && $access['view'][$rid]) { |
600 | 594 | // For forum administrators, View needs to be saved, ... |
601 | - } |
|
602 | - else { |
|
595 | + } else { |
|
603 | 596 | // ... otherwise forget View. |
604 | 597 | $access['view'][$rid] = FALSE; |
605 | 598 | } |
@@ -607,8 +600,7 @@ discard block |
||
607 | 600 | db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)", |
608 | 601 | $tid, $rid, !empty($access['view'][$rid]), 0, 0, !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority); |
609 | 602 | } |
610 | - } |
|
611 | - else { |
|
603 | + } else { |
|
612 | 604 | db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)", |
613 | 605 | $tid, $rid, (bool) $checked, !empty($access['update'][$rid]), !empty($access['delete'][$rid]), !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority); |
614 | 606 | } |
@@ -620,8 +612,7 @@ discard block |
||
620 | 612 | if (!$is_new && $form_state['values']['form_id'] != 'forum_form_container') { |
621 | 613 | if (!isset($access['update_choice']) || $access['update_choice'] == 2) { |
622 | 614 | node_access_needs_rebuild(TRUE); |
623 | - } |
|
624 | - elseif ($access['update_choice'] == 0) { |
|
615 | + } elseif ($access['update_choice'] == 0) { |
|
625 | 616 | // update immediately (but use the batch functions anyway |
626 | 617 | $save_redirect = $form_state['redirect']; |
627 | 618 | $form_state['redirect'] = $_GET['q']; |
@@ -632,13 +623,13 @@ discard block |
||
632 | 623 | _forum_access_update_batch_operation($tid, 999999, 1, $context); |
633 | 624 | $pending_error_messages = drupal_get_messages('error', TRUE); // still alive, get and clear all 'error' messages |
634 | 625 | unset($pending_error_messages['error'][$our_error_message_index]); // remove our error message |
635 | - foreach ($pending_error_messages['error'] as $message) { // replay any others |
|
626 | + foreach ($pending_error_messages['error'] as $message) { |
|
627 | +// replay any others |
|
636 | 628 | drupal_set_message($message, 'error'); |
637 | 629 | } |
638 | 630 | _forum_access_update_batch_finished(TRUE, array(), array()); |
639 | 631 | $form_state['redirect'] = $save_redirect; |
640 | - } |
|
641 | - else { |
|
632 | + } else { |
|
642 | 633 | // mass update in batch mode, modeled after node.module |
643 | 634 | $limit = $access['update_limit']; |
644 | 635 | $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid)); |
@@ -698,8 +689,7 @@ discard block |
||
698 | 689 | if ($success) { |
699 | 690 | drupal_set_message(t('The content access permissions have been updated.')); |
700 | 691 | cache_clear_all(); |
701 | - } |
|
702 | - else { |
|
692 | + } else { |
|
703 | 693 | drupal_set_message(t('The content access permissions have not been properly updated.'), 'error'); |
704 | 694 | } |
705 | 695 | } |
@@ -744,8 +734,7 @@ discard block |
||
744 | 734 | $return['view'] = array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID); |
745 | 735 | $return['create'] = array(DRUPAL_AUTHENTICATED_RID); |
746 | 736 | $return['comment_create'] = array(DRUPAL_AUTHENTICATED_RID); |
747 | - } |
|
748 | - else { |
|
737 | + } else { |
|
749 | 738 | $result = db_query("SELECT * FROM {forum_access} where tid = %d", $tid); |
750 | 739 | while ($access = db_fetch_object($result)) { |
751 | 740 | if ($access->grant_view) { |
@@ -763,7 +752,8 @@ discard block |
||
763 | 752 | if ($access->grant_comment_create) { |
764 | 753 | $return['comment_create'][] = $access->rid; |
765 | 754 | } |
766 | - if ($access->rid == DRUPAL_AUTHENTICATED_RID) { // this is our reference |
|
755 | + if ($access->rid == DRUPAL_AUTHENTICATED_RID) { |
|
756 | +// this is our reference |
|
767 | 757 | $return['priority'] = $access->priority; |
768 | 758 | } |
769 | 759 | } |
@@ -831,8 +821,7 @@ discard block |
||
831 | 821 | drupal_set_message(t('Note: In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected in the !Forum_Access_link settings, but !Forum_Access can only allow <i>more</i> access, not less.', $variables) |
832 | 822 | .'<br /><span class="error">'. t('Specifically, any rights granted to the %anonymous_user and/or the %authenticated_user will <b>override</b> the settings of !Forum_Access!', $variables) .'</span>' |
833 | 823 | .'<br />'. t('To avoid conflicts with !Forum_Access settings, you may want to lower the priority of !Content_Access (under %Advanced below) below the priority of !Forum_Access for the content types that you want to be controlled by !Forum_Access.', $variables), 'warning'); |
834 | - } |
|
835 | - else { |
|
824 | + } else { |
|
836 | 825 | $vid = _forum_access_get_vid(); |
837 | 826 | $vocabulary = taxonomy_vocabulary_load($vid); |
838 | 827 | if (isset($vocabulary->nodes[arg(3)])) { |
@@ -926,8 +915,7 @@ discard block |
||
926 | 915 | } |
927 | 916 | watchdog('user', $msg, NULL, WATCHDOG_NOTICE); |
928 | 917 | return $rid; |
929 | - } |
|
930 | - else { |
|
918 | + } else { |
|
931 | 919 | $msg = t('!Forum_Access cannot create the %role role!', $variables); |
932 | 920 | watchdog('user', $msg, NULL, WATCHDOG_WARNING); |
933 | 921 | drupal_set_message($msg .' '. t('Is it already in use?'), 'error'); |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | if (isset($node->comment_target_nid)) { |
39 | 39 | if ($changed_tid = _forum_access_changed_tid()) { |
40 | 40 | $tid = $changed_tid; // the topic node hasn't been saved yet! |
41 | - } |
|
42 | - else { |
|
41 | + } else { |
|
43 | 42 | $node = node_load($node->comment_target_nid); |
44 | 43 | $tid = _forum_access_get_tid($node); |
45 | 44 | } |
@@ -91,7 +90,8 @@ discard block |
||
91 | 90 | return; // disable comment access control |
92 | 91 | } |
93 | 92 | if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) { |
94 | - if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/% |
|
93 | + if (is_numeric($cid = arg(2))) { |
|
94 | +// comment/edit/%, comment/delete/% |
|
95 | 95 | $access[] = (arg(1) == 'edit' ? 'update' : 'delete'); |
96 | 96 | $comment = _comment_load($cid); |
97 | 97 | $nid = $comment->nid; |
@@ -107,7 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | case 'node': |
109 | 109 | if (is_numeric(arg(1))) { |
110 | - if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit |
|
110 | + if (arg(2) == 'edit' && !user_access('administer nodes')) { |
|
111 | +// node/%/edit |
|
111 | 112 | $access[] = 'update'; |
112 | 113 | $nid = arg(1); |
113 | 114 | // If the node turns out to be in a forum where we have update/delete |
@@ -118,13 +119,15 @@ discard block |
||
118 | 119 | // We won't provide full Administrator access, though: we'll remove |
119 | 120 | // author and timestamp, for example. |
120 | 121 | } |
121 | - if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete |
|
122 | + if (arg(2) == 'delete' && !user_access('administer nodes')) { |
|
123 | +// node/%/delete |
|
122 | 124 | $access = array(); |
123 | 125 | $nid = arg(1); |
124 | 126 | // This is the delete confirmation page. We don't need any |
125 | 127 | // additional permissions, but we'll assert 'view' access below. |
126 | 128 | } |
127 | - if (arg(2) == NULL && !user_access('administer comments')) { // node/% |
|
129 | + if (arg(2) == NULL && !user_access('administer comments')) { |
|
130 | +// node/% |
|
128 | 131 | $access[] = 'update'; |
129 | 132 | $nid = arg(1); |
130 | 133 | // If the node turns out to be in a forum where we have update/delete |
@@ -190,44 +193,34 @@ discard block |
||
190 | 193 | if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) { |
191 | 194 | module_load_include('node.inc', 'forum_access'); |
192 | 195 | _forum_access_node_form($form, $form_state); |
193 | - } |
|
194 | - elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) { |
|
196 | + } elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) { |
|
195 | 197 | module_load_include('node.inc', 'forum_access'); |
196 | 198 | _forum_access_comment_form($form, $form_state); |
197 | - } |
|
198 | - elseif ($form_id == 'forum_overview') { |
|
199 | + } elseif ($form_id == 'forum_overview') { |
|
199 | 200 | module_load_include('admin.inc', 'forum_access'); |
200 | 201 | _forum_access_forum_overview($form, $form_state); |
201 | - } |
|
202 | - elseif ($form_id == 'forum_form_container') { |
|
202 | + } elseif ($form_id == 'forum_form_container') { |
|
203 | 203 | module_load_include('admin.inc', 'forum_access'); |
204 | 204 | _forum_access_forum_form($form, $form_state, TRUE); |
205 | - } |
|
206 | - elseif ($form_id == 'forum_form_forum') { |
|
205 | + } elseif ($form_id == 'forum_form_forum') { |
|
207 | 206 | module_load_include('admin.inc', 'forum_access'); |
208 | 207 | _forum_access_forum_form($form, $form_state, FALSE); |
209 | - } |
|
210 | - elseif ($form_id == 'forum_admin_settings') { |
|
208 | + } elseif ($form_id == 'forum_admin_settings') { |
|
211 | 209 | module_load_include('admin.inc', 'forum_access'); |
212 | 210 | _forum_access_forum_admin_settings_form($form, $form_state); |
213 | - } |
|
214 | - elseif ($form_id == 'user_admin_role') { |
|
211 | + } elseif ($form_id == 'user_admin_role') { |
|
215 | 212 | module_load_include('admin.inc', 'forum_access'); |
216 | 213 | _forum_access_user_admin_role_form($form, $form_state); |
217 | - } |
|
218 | - elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) { |
|
214 | + } elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) { |
|
219 | 215 | module_load_include('admin.inc', 'forum_access'); |
220 | 216 | _forum_access_content_access_admin_form(); |
221 | - } |
|
222 | - elseif ($form_id == 'user_admin_perm') { |
|
217 | + } elseif ($form_id == 'user_admin_perm') { |
|
223 | 218 | module_load_include('admin.inc', 'forum_access'); |
224 | 219 | _forum_access_user_admin_perm_form($form, $form_state); |
225 | - } |
|
226 | - elseif ($form_id == 'user_admin_account') { |
|
220 | + } elseif ($form_id == 'user_admin_account') { |
|
227 | 221 | module_load_include('admin.inc', 'forum_access'); |
228 | 222 | _forum_access_user_admin_account_form($form, $form_state); |
229 | - } |
|
230 | - elseif ($form_id == 'user_profile_form') { |
|
223 | + } elseif ($form_id == 'user_profile_form') { |
|
231 | 224 | module_load_include('admin.inc', 'forum_access'); |
232 | 225 | _forum_access_user_profile_form($form, $form_state); |
233 | 226 | } |
@@ -252,8 +245,7 @@ discard block |
||
252 | 245 | } |
253 | 246 | if (strpos($_GET['q'], 'node/add/forum') !== FALSE) { |
254 | 247 | $required_access = 'create'; |
255 | - } |
|
256 | - else { |
|
248 | + } else { |
|
257 | 249 | $required_access = 'view'; |
258 | 250 | } |
259 | 251 | $roles = implode(', ', array_keys($user->roles)); |
@@ -424,8 +416,7 @@ discard block |
||
424 | 416 | unset($links['quote']); |
425 | 417 | } |
426 | 418 | } |
427 | - } |
|
428 | - else { |
|
419 | + } else { |
|
429 | 420 | // Check links for the comment. |
430 | 421 | $required_keys = array( |
431 | 422 | 'comment_create' => 'comment_reply', |
@@ -436,8 +427,7 @@ discard block |
||
436 | 427 | if (!forum_access_access($tid, $access) && !($access == 'update' && comment_access('edit', $comment))) { |
437 | 428 | unset($links[$required_keys[$access]]); |
438 | 429 | unset($required_keys[$access]); |
439 | - } |
|
440 | - elseif (!array_key_exists($key, $links)) { |
|
430 | + } elseif (!array_key_exists($key, $links)) { |
|
441 | 431 | $link_is_missing = TRUE; |
442 | 432 | } |
443 | 433 | } |
@@ -566,15 +556,13 @@ discard block |
||
566 | 556 | |
567 | 557 | if ($result) { |
568 | 558 | $cache[$account->uid][$tid][$type] = 1; |
569 | - } |
|
570 | - else { |
|
559 | + } else { |
|
571 | 560 | // check our moderators too |
572 | 561 | $acl_id = acl_get_id_by_number('forum_access', $tid); |
573 | 562 | $result = db_result(db_query("SELECT uid FROM {acl_user} WHERE acl_id = %d AND uid = %d", $acl_id, $account->uid)); |
574 | 563 | if ($result) { |
575 | 564 | $cache[$account->uid][$tid][$type] = 2; |
576 | - } |
|
577 | - else { |
|
565 | + } else { |
|
578 | 566 | $cache[$account->uid][$tid][$type] = FALSE; |
579 | 567 | } |
580 | 568 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | // Strip preformatted code blocks from text during line break processing, replaced below |
23 | 23 | $body = str_replace($code_tag[0], "***pRe_sTrInG$i***", $body); |
24 | 24 | $pre[$i++] = '<pre class="bb-code-block">'. $code_tag[1] .'</pre>'; |
25 | - } |
|
26 | - else |
|
25 | + } else |
|
27 | 26 | $body = str_replace($code_tag[0], '<pre class="bb-code-block">'. $code_tag[1] .'</pre>', $body); |
28 | 27 | } |
29 | 28 | } |
@@ -34,7 +33,8 @@ discard block |
||
34 | 33 | if ($mode == 1) // Line breaks only (starting with PHP 4.0.5, nl2br() is XHTML compliant) |
35 | 34 | $body = nl2br($body); |
36 | 35 | |
37 | - if ($mode == 2) { // Line and paragraph breaks (may not always be XHTML compliant) |
|
36 | + if ($mode == 2) { |
|
37 | +// Line and paragraph breaks (may not always be XHTML compliant) |
|
38 | 38 | $body = preg_replace("/(\r\n|\n|\r)/", "\n", $body); |
39 | 39 | $body = preg_replace("/\n\n+/", "\n\n", $body); |
40 | 40 | $parts = explode("\n\n", $body); |
@@ -51,8 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | // Reinsert preformatted code blocks |
54 | - foreach ($pre as $i => $code_tag) |
|
55 | - $body = str_replace("***pRe_sTrInG$i***", $code_tag, $body); |
|
54 | + foreach ($pre as $i => $code_tag) { |
|
55 | + $body = str_replace("***pRe_sTrInG$i***", $code_tag, $body); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | // Replace any improper quote tags with proper quote tags |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | } |
84 | 85 | |
85 | 86 | // begin processing for [size] |
86 | - if (stristr($body, '[size=') !== FALSE) { // prevent useless processing |
|
87 | + if (stristr($body, '[size=') !== FALSE) { |
|
88 | +// prevent useless processing |
|
87 | 89 | $arr = array( |
88 | 90 | 'tag' => 'size', |
89 | 91 | 'pattern' => '#\[\x07=([\d]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi', |
@@ -93,7 +95,8 @@ discard block |
||
93 | 95 | } // end processing for [size] |
94 | 96 | |
95 | 97 | // begin processing for [color] |
96 | - if (stristr($body, '[color=') !== FALSE) { // prevent useless processing |
|
98 | + if (stristr($body, '[color=') !== FALSE) { |
|
99 | +// prevent useless processing |
|
97 | 100 | $arr = array( |
98 | 101 | 'tag' => 'color', |
99 | 102 | 'pattern' => '#\[\x07=([\#\w]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#si', |
@@ -103,7 +106,8 @@ discard block |
||
103 | 106 | } // end processing for [color] |
104 | 107 | |
105 | 108 | // begin processing for [font] |
106 | - if (stristr($body, '[font=') !== FALSE) { // prevent useless processing |
|
109 | + if (stristr($body, '[font=') !== FALSE) { |
|
110 | +// prevent useless processing |
|
107 | 111 | $arr = array( |
108 | 112 | 'tag' => 'font', |
109 | 113 | 'pattern' => '#\[\x07=([\w\s]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#si', |
@@ -113,7 +117,8 @@ discard block |
||
113 | 117 | } // end processing for [font] |
114 | 118 | |
115 | 119 | // begin processing for [list] and [*] |
116 | - if (stristr($body, '[list') !== FALSE) { // prevent useless processing |
|
120 | + if (stristr($body, '[list') !== FALSE) { |
|
121 | +// prevent useless processing |
|
117 | 122 | $l_type = array( |
118 | 123 | NULL => array('style' => 'circle', 'tag' => 'ul'), |
119 | 124 | 'c' => array('style' => 'circle', 'tag' => 'ul'), |
@@ -235,8 +240,7 @@ discard block |
||
235 | 240 | // Replacing email addresses with encoded html |
236 | 241 | $body = preg_replace_callback('#\[email(?::\w+)?\]([\w\.\-\+~@]+)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body); |
237 | 242 | $body = preg_replace_callback('#\[email=(.*?)(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body); |
238 | - } |
|
239 | - else { |
|
243 | + } else { |
|
240 | 244 | $body = preg_replace( |
241 | 245 | array('#\[email(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si','#\[email=(.*?)(?::\w+)?\]([\w\s]+)\[/email(?::\w+)?\]#si'), |
242 | 246 | array('<a href="mailto:\\1" class="bb-email">\\1</a>', '<a href="mailto:\\1" class="bb-email">\\2</a>'), |
@@ -330,8 +334,9 @@ discard block |
||
330 | 334 | $link = 'document.write(\'<a href="mailto:' . $matches[1] . '" class="bb-email">' . (isset($matches[2]) ? $matches[2] : $matches[1]) . '</a>\');'; |
331 | 335 | |
332 | 336 | $js_encode = ''; |
333 | - for ($x = 0; $x < strlen($link); $x++) |
|
334 | - $js_encode .= '%' . bin2hex($link{$x}); |
|
337 | + for ($x = 0; $x < strlen($link); $x++) { |
|
338 | + $js_encode .= '%' . bin2hex($link{$x}); |
|
339 | + } |
|
335 | 340 | |
336 | 341 | $link = '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>'; |
337 | 342 | if (isset($matches[3])) |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | if ($long) { |
11 | 11 | include_once(drupal_get_path('module', 'bbcode') .'/bbcode-help.inc'); |
12 | 12 | return _bbcode_filter_tip(); |
13 | - } |
|
14 | - else { |
|
13 | + } else { |
|
15 | 14 | # D5: $output = t('You can use !BBCode tags in the text.', array('!BBCode' => l(t('BBCode'), "filter/tips/$format", NULL, NULL, 'filter-bbcode-' . $delta))); |
16 | 15 | $output = t('You can use !BBCode (opens in new window) tags in the text.', |
17 | 16 | array( |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | $elapsed += $timing_stop[0] - $timing_start[0]; |
51 | 50 | $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
52 | 51 | return $ret; |
53 | - } |
|
54 | - else |
|
52 | + } else |
|
55 | 53 | return _bbcode_filter_process($text, $format); |
56 | 54 | |
57 | 55 | case 'settings': |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // Else user may view the page when they are going to create their own profile |
92 | 92 | // or have permission to create it for others. |
93 | 93 | global $user; |
94 | - if ($user->uid == $account->uid || user_access('administer nodes') ){ |
|
94 | + if ($user->uid == $account->uid || user_access('administer nodes') ) { |
|
95 | 95 | return node_access('create', $type); |
96 | 96 | } |
97 | 97 | return FALSE; |
@@ -270,8 +270,7 @@ discard block |
||
270 | 270 | '#title' => t('Use this content type as a content profile for users'), |
271 | 271 | '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE), |
272 | 272 | ); |
273 | - } |
|
274 | - elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) { |
|
273 | + } elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) { |
|
275 | 274 | // Customize the redirect target and buttons of our own node forms. |
276 | 275 | if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') { |
277 | 276 | $form['buttons']['preview']['#access'] = FALSE; |
@@ -382,8 +381,7 @@ discard block |
||
382 | 381 | // This node already exists, redirect to edit page |
383 | 382 | drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid); |
384 | 383 | } |
385 | - } |
|
386 | - elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) { |
|
384 | + } elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) { |
|
387 | 385 | $form = $a3; |
388 | 386 | // Only validate if the user-name changed or we add a new node |
389 | 387 | if (!empty($node->nid) && $form['author']['name']['#default_value'] == $node->name) { |
@@ -394,8 +392,7 @@ discard block |
||
394 | 392 | if ($uid && content_profile_profile_exists($node, $uid)) { |
395 | 393 | form_set_error('name', t('This user already has a content profile of this type. You can only create one profile per user.')); |
396 | 394 | } |
397 | - } |
|
398 | - elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) { |
|
395 | + } elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) { |
|
399 | 396 | // Make sure the translated profile belongs to the same user. |
400 | 397 | $node->uid = $node->translation_source->uid; |
401 | 398 | $node->name = $node->translation_source->name; |
@@ -504,8 +501,7 @@ discard block |
||
504 | 501 | $node = content_profile_load($type, $arg[1]); |
505 | 502 | if ($node) { |
506 | 503 | return node_help('node/%/edit', array(1 => $node->nid)); |
507 | - } |
|
508 | - else { |
|
504 | + } else { |
|
509 | 505 | return node_help('node/add/'. $type, array('node', 'add', $type)); |
510 | 506 | } |
511 | 507 | } |
@@ -537,8 +533,7 @@ discard block |
||
537 | 533 | |
538 | 534 | // Working around the bug described at http://drupal.org/node/302873 |
539 | 535 | module_load_include('inc', 'content_profile', 'content_profile.theme'); |
540 | - } |
|
541 | - elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) { |
|
536 | + } elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) { |
|
542 | 537 | $content['content_profile_'. $type] = array( |
543 | 538 | '#admin' => $uid != $user->uid, |
544 | 539 | '#theme' => 'content_profile_display_add_link', |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | foreach ($form['#content_profile_registration_use_types'] as $type => $typename) { |
22 | 22 | content_profile_registration_add_profile_form($type, $form, $form_state); |
23 | 23 | } |
24 | - } |
|
25 | - elseif ($form_id == 'content_profile_admin_settings') { |
|
24 | + } elseif ($form_id == 'content_profile_admin_settings') { |
|
26 | 25 | $type = $form_state['type']; |
27 | 26 | // Let other modules add registration child elements before us! |
28 | 27 | $form += array('registration' => array()); |
@@ -133,8 +132,7 @@ discard block |
||
133 | 132 | // Set this to the values of one node, as it might be need by some #ahah callbacks |
134 | 133 | $form_add['#node'] = $node_form['#node']; |
135 | 134 | $form_add['type'] = $node_form['type']; |
136 | - } |
|
137 | - else { |
|
135 | + } else { |
|
138 | 136 | foreach (array('uid', 'name', 'author', 'buttons', 'language', '#theme', 'options') as $key) { |
139 | 137 | unset($node_form[$key]); |
140 | 138 | } |
@@ -148,8 +146,7 @@ discard block |
||
148 | 146 | if (count(element_children($form_add[$group_name])) == 0) { |
149 | 147 | unset($form_add[$group_name]); |
150 | 148 | } |
151 | - } |
|
152 | - else { |
|
149 | + } else { |
|
153 | 150 | unset($form_add[$field_name]); |
154 | 151 | } |
155 | 152 | } |
@@ -175,7 +172,7 @@ discard block |
||
175 | 172 | } |
176 | 173 | |
177 | 174 | // Set the enctype, if necessary. |
178 | - if (isset($node_form['#attributes']['enctype'])){ |
|
175 | + if (isset($node_form['#attributes']['enctype'])) { |
|
179 | 176 | $form['#attributes']['enctype'] = $node_form['#attributes']['enctype']; |
180 | 177 | } |
181 | 178 | } |
@@ -213,8 +210,7 @@ discard block |
||
213 | 210 | |
214 | 211 | if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) { |
215 | 212 | node_validate($node, $form); |
216 | - } |
|
217 | - elseif (module_exists('content')) { |
|
213 | + } elseif (module_exists('content')) { |
|
218 | 214 | content_validate($node); |
219 | 215 | } |
220 | 216 | |
@@ -232,8 +228,7 @@ discard block |
||
232 | 228 | function _content_profile_registration_remove_values($key, $element, &$form_state) { |
233 | 229 | if ((isset($element['#input']) || !empty($element['#tree'])) && isset($form_state['values'][$key])) { |
234 | 230 | unset($form_state['values'][$key]); |
235 | - } |
|
236 | - elseif (empty($element['#input']) && empty($element['#tree'])) { |
|
231 | + } elseif (empty($element['#input']) && empty($element['#tree'])) { |
|
237 | 232 | foreach (element_children($element) as $key) { |
238 | 233 | _content_profile_registration_remove_values($key, $element[$key], $form_state); |
239 | 234 | } |
@@ -102,10 +102,11 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | $last = array_pop($to); |
105 | - if (count($to) == 0) { // Only one participant |
|
105 | + if (count($to) == 0) { |
|
106 | +// Only one participant |
|
106 | 107 | return t("From !last", array('!last' => $last)); |
107 | - } |
|
108 | - else { // Multipe participants.. |
|
108 | + } else { |
|
109 | +// Multipe participants.. |
|
109 | 110 | $participants = implode(', ', $to); |
110 | 111 | return t('Participants: !participants and !last', array('!participants' => $participants, '!last' => $last)); |
111 | 112 | } |
@@ -224,7 +225,8 @@ discard block |
||
224 | 225 | global $user; |
225 | 226 | $account = $user; |
226 | 227 | } |
227 | - if (!$account->uid) { // Disallow anonymous access, regardless of permissions |
|
228 | + if (!$account->uid) { |
|
229 | +// Disallow anonymous access, regardless of permissions |
|
228 | 230 | return FALSE; |
229 | 231 | } |
230 | 232 | if (!user_access($permission, $account)) { |
@@ -325,11 +327,9 @@ discard block |
||
325 | 327 | if (is_null($start)) { |
326 | 328 | if (isset($_GET['start']) && $_GET['start'] < $thread['message_count']) { |
327 | 329 | $start = $_GET['start']; |
328 | - } |
|
329 | - elseif (!variable_get('privatemsg_view_use_max_as_default', FALSE) && $max_amount == PRIVATEMSG_UNLIMITED) { |
|
330 | + } elseif (!variable_get('privatemsg_view_use_max_as_default', FALSE) && $max_amount == PRIVATEMSG_UNLIMITED) { |
|
330 | 331 | $start = PRIVATEMSG_UNLIMITED; |
331 | - } |
|
332 | - else { |
|
332 | + } else { |
|
333 | 333 | $start = $thread['message_count'] - (variable_get('privatemsg_view_use_max_as_default', FALSE) ? variable_get('privatemsg_view_default_amount', 10) : $max_amount); |
334 | 334 | } |
335 | 335 | } |
@@ -338,8 +338,7 @@ discard block |
||
338 | 338 | if ($max_amount == PRIVATEMSG_UNLIMITED) { |
339 | 339 | $last_page = 0; |
340 | 340 | $max_amount = $thread['message_count']; |
341 | - } |
|
342 | - else { |
|
341 | + } else { |
|
343 | 342 | // Calculate the number of messages on the "last" page to avoid |
344 | 343 | // message overlap. |
345 | 344 | // Note - the last page lists the earliest messages, not the latest. |
@@ -360,8 +359,7 @@ discard block |
||
360 | 359 | } |
361 | 360 | if ($start - $max_amount >= 0) { |
362 | 361 | $thread['older_start'] = $start - $max_amount; |
363 | - } |
|
364 | - elseif ($start > 0) { |
|
362 | + } elseif ($start > 0) { |
|
365 | 363 | $thread['older_start'] = 0; |
366 | 364 | } |
367 | 365 | |
@@ -377,8 +375,7 @@ discard block |
||
377 | 375 | // Visual counts start from 1 instead of zero, so plus one. |
378 | 376 | $thread['from'] = $start + 1; |
379 | 377 | $conversation = db_query_range($query['query'], $start, $max_amount); |
380 | - } |
|
381 | - else { |
|
378 | + } else { |
|
382 | 379 | $conversation = db_query($query['query']); |
383 | 380 | } |
384 | 381 | $mids = array(); |
@@ -398,12 +395,10 @@ discard block |
||
398 | 395 | // Thread does not exist, display 404. |
399 | 396 | $thread = FALSE; |
400 | 397 | } |
401 | - } |
|
402 | - else { |
|
398 | + } else { |
|
403 | 399 | $thread = FALSE; |
404 | 400 | } |
405 | - } |
|
406 | - else { |
|
401 | + } else { |
|
407 | 402 | // General data, assume subject is the same for all messages of that thread. |
408 | 403 | $thread['user'] = $account; |
409 | 404 | $message = current($thread['messages']); |
@@ -689,8 +684,7 @@ discard block |
||
689 | 684 | // Trying to view someone else's messages... |
690 | 685 | if (!privatemsg_user_access('read all private messages')) { |
691 | 686 | drupal_set_message(t("You do not have sufficient rights to view someone else's messages"), 'warning'); |
692 | - } |
|
693 | - elseif ($account_check = user_load(array('uid' => $uid))) { |
|
687 | + } elseif ($account_check = user_load(array('uid' => $uid))) { |
|
694 | 688 | // Has rights and user_load return an array so user does exist |
695 | 689 | $account = $account_check; |
696 | 690 | } |
@@ -852,11 +846,9 @@ discard block |
||
852 | 846 | // convert recipients to array of user objects |
853 | 847 | if (!empty($recipients) && is_string($recipients) || is_int($recipients)) { |
854 | 848 | $recipients = _privatemsg_generate_user_array($recipients); |
855 | - } |
|
856 | - elseif (is_object($recipients)) { |
|
849 | + } elseif (is_object($recipients)) { |
|
857 | 850 | $recipients = array($recipients); |
858 | - } |
|
859 | - elseif (empty($recipients) && is_string($recipients)) { |
|
851 | + } elseif (empty($recipients) && is_string($recipients)) { |
|
860 | 852 | $recipients = array(); |
861 | 853 | } |
862 | 854 | |
@@ -879,8 +871,7 @@ discard block |
||
879 | 871 | } |
880 | 872 | $to[] = $recipient->name; |
881 | 873 | $to_themed[$recipient->uid] = theme('username', $recipient); |
882 | - } |
|
883 | - else { |
|
874 | + } else { |
|
884 | 875 | // Recipient list contains blocked users. |
885 | 876 | $blocked = TRUE; |
886 | 877 | } |
@@ -905,8 +896,7 @@ discard block |
||
905 | 896 | } |
906 | 897 | if (!$thread_id && !empty($recipients_string)) { |
907 | 898 | drupal_set_title(t('Write new message to %recipient', array('%recipient' => $recipients_string))); |
908 | - } |
|
909 | - elseif (!$thread_id) { |
|
899 | + } elseif (!$thread_id) { |
|
910 | 900 | drupal_set_title(t('Write new message')); |
911 | 901 | } |
912 | 902 | |
@@ -982,8 +972,7 @@ discard block |
||
982 | 972 | $title = t('Cancel'); |
983 | 973 | if (isset($_REQUEST['destination'])) { |
984 | 974 | $url = $_REQUEST['destination']; |
985 | - } |
|
986 | - elseif (!is_null($thread_id)) { |
|
975 | + } elseif (!is_null($thread_id)) { |
|
987 | 976 | $url = $_GET['q']; |
988 | 977 | $title = t('Clear'); |
989 | 978 | } |
@@ -1034,8 +1023,7 @@ discard block |
||
1034 | 1023 | // Only parse the user string for a new thread. |
1035 | 1024 | if (!isset($message['thread_id'])) { |
1036 | 1025 | list($message['recipients'], $invalid) = _privatemsg_parse_userstring($message['recipient']); |
1037 | - } |
|
1038 | - else { |
|
1026 | + } else { |
|
1039 | 1027 | // Load participants. |
1040 | 1028 | $message['recipients'] = _privatemsg_load_thread_participants($message['thread_id']); |
1041 | 1029 | // Remove author. |
@@ -1094,7 +1082,8 @@ discard block |
||
1094 | 1082 | $recipients = array(); |
1095 | 1083 | foreach ($input as $string) { |
1096 | 1084 | $string = trim($string); |
1097 | - if (!empty($string)) { // We don't care about white space names. |
|
1085 | + if (!empty($string)) { |
|
1086 | +// We don't care about white space names. |
|
1098 | 1087 | |
1099 | 1088 | // First, check if another module is able to resolve the string into an |
1100 | 1089 | // user object. |
@@ -1131,10 +1120,9 @@ discard block |
||
1131 | 1120 | foreach ($form_state['validate_built_message']['recipients'] as $recipient) { |
1132 | 1121 | $recipient_names[] = theme('username', $recipient); |
1133 | 1122 | } |
1134 | - if ($status !== FALSE ) { |
|
1123 | + if ($status !== FALSE ) { |
|
1135 | 1124 | drupal_set_message(t('A message has been sent to !recipients.', array('!recipients' => implode(', ', $recipient_names)))); |
1136 | - } |
|
1137 | - else { |
|
1125 | + } else { |
|
1138 | 1126 | drupal_set_message(t('An attempt to send a message <em>may have failed</em> when sending to !recipients.', array('!recipients' => implode(', ', $recipient_names))), 'error'); |
1139 | 1127 | } |
1140 | 1128 | } |
@@ -1195,8 +1183,7 @@ discard block |
||
1195 | 1183 | $fragments['select'][] = "array_to_string(array(SELECT DISTINCT textin(int4out(pmia.uid)) |
1196 | 1184 | FROM {pm_index} pmia |
1197 | 1185 | WHERE pmia.thread_id = pmi.thread_id), ',') AS participants"; |
1198 | - } |
|
1199 | - else { |
|
1186 | + } else { |
|
1200 | 1187 | $fragments['select'][] = '(SELECT GROUP_CONCAT(DISTINCT pmia.uid SEPARATOR ",") |
1201 | 1188 | FROM {pm_index} pmia |
1202 | 1189 | WHERE pmia.thread_id = pmi.thread_id) AS participants'; |
@@ -1490,8 +1477,7 @@ discard block |
||
1490 | 1477 | ); |
1491 | 1478 | |
1492 | 1479 | return $blocks; |
1493 | - } |
|
1494 | - elseif ('view' == $op) { |
|
1480 | + } elseif ('view' == $op) { |
|
1495 | 1481 | $block = array(); |
1496 | 1482 | switch ($delta) { |
1497 | 1483 | case 'privatemsg-menu': |
@@ -1587,8 +1573,7 @@ discard block |
||
1587 | 1573 | if (isset($form_state['values']['delete_options']) && $form_state['values']['delete_options']) { |
1588 | 1574 | privatemsg_message_change_delete($form_state['values']['pmid'], 1); |
1589 | 1575 | drupal_set_message(t('Message has been deleted for all users.')); |
1590 | - } |
|
1591 | - else { |
|
1576 | + } else { |
|
1592 | 1577 | privatemsg_message_change_delete($form_state['values']['pmid'], 1, $account); |
1593 | 1578 | drupal_set_message(t('Message has been deleted.')); |
1594 | 1579 | } |
@@ -1617,8 +1602,7 @@ discard block |
||
1617 | 1602 | |
1618 | 1603 | if ($account) { |
1619 | 1604 | db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d AND uid = %d', $delete_value, $pmid, $account->uid); |
1620 | - } |
|
1621 | - else { |
|
1605 | + } else { |
|
1622 | 1606 | // Mark deleted for all users. |
1623 | 1607 | db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d', $delete_value, $pmid); |
1624 | 1608 | } |
@@ -1779,8 +1763,7 @@ discard block |
||
1779 | 1763 | 'success' => FALSE, |
1780 | 1764 | 'messages' => $messages, |
1781 | 1765 | ); |
1782 | - } |
|
1783 | - else { |
|
1766 | + } else { |
|
1784 | 1767 | $messages['error'][] = t('User @user is not allowed to write messages', array('@user' => $message['author']->name)); |
1785 | 1768 | return array( |
1786 | 1769 | 'success' => FALSE, |
@@ -1794,8 +1777,7 @@ discard block |
||
1794 | 1777 | if (empty($message['subject'])) { |
1795 | 1778 | if ($form) { |
1796 | 1779 | form_set_error('subject', t('Disallowed to send a message without subject')); |
1797 | - } |
|
1798 | - else { |
|
1780 | + } else { |
|
1799 | 1781 | $messages['error'][] = t('Disallowed to send a message without subject'); |
1800 | 1782 | } |
1801 | 1783 | } |
@@ -1804,8 +1786,7 @@ discard block |
||
1804 | 1786 | if (!empty($message['thread_id']) && ($message['body'] === NULL || $message['body'] === '') ) { |
1805 | 1787 | if ($form) { |
1806 | 1788 | form_set_error('body', t('Disallowed to send reply without a message.')); |
1807 | - } |
|
1808 | - else { |
|
1789 | + } else { |
|
1809 | 1790 | $messages['error'][] = t('Disallowed to send reply without a message.'); |
1810 | 1791 | } |
1811 | 1792 | } |
@@ -1819,8 +1800,7 @@ discard block |
||
1819 | 1800 | if (!filter_access($message['format'])) { |
1820 | 1801 | if ($form) { |
1821 | 1802 | form_set_error('format', t('You are not allowed to use the specified input format.')); |
1822 | - } |
|
1823 | - else { |
|
1803 | + } else { |
|
1824 | 1804 | $messages['error'][] = t('User @user is not allowed to use the specified input format.', array('@user' => $message['author']->name)); |
1825 | 1805 | } |
1826 | 1806 | } |
@@ -1831,8 +1811,7 @@ discard block |
||
1831 | 1811 | if (empty($message['recipients']) || !is_array($message['recipients'])) { |
1832 | 1812 | if ($form) { |
1833 | 1813 | form_set_error('to', t('Disallowed to send a message without at least one valid recipient')); |
1834 | - } |
|
1835 | - else { |
|
1814 | + } else { |
|
1836 | 1815 | $messages['error'][] = t('Disallowed to send a message without at least one valid recipient'); |
1837 | 1816 | } |
1838 | 1817 | } |
@@ -1842,8 +1821,7 @@ discard block |
||
1842 | 1821 | unset($message['recipients'][$blocked['uid']]); |
1843 | 1822 | if ($form) { |
1844 | 1823 | drupal_set_message($blocked['message'], 'warning'); |
1845 | - } |
|
1846 | - else { |
|
1824 | + } else { |
|
1847 | 1825 | $messages['warning'][] = $blocked['message']; |
1848 | 1826 | } |
1849 | 1827 | } |
@@ -1853,8 +1831,7 @@ discard block |
||
1853 | 1831 | if (empty($message['recipients'])) { |
1854 | 1832 | if ($form) { |
1855 | 1833 | form_set_error('to', t('Disallowed to send message because all recipients are blocked')); |
1856 | - } |
|
1857 | - else { |
|
1834 | + } else { |
|
1858 | 1835 | $messages['error'][] = t('Disallowed to send message because all recipients are blocked'); |
1859 | 1836 | } |
1860 | 1837 | } |
@@ -2060,8 +2037,7 @@ discard block |
||
2060 | 2037 | if (is_array($query)) { |
2061 | 2038 | $query_id = $query[0]; |
2062 | 2039 | $query_group = $query[1]; |
2063 | - } |
|
2064 | - else { |
|
2040 | + } else { |
|
2065 | 2041 | $query_id = $query; |
2066 | 2042 | $query_group = 'privatemsg'; |
2067 | 2043 | } |
@@ -2141,8 +2117,7 @@ discard block |
||
2141 | 2117 | // Works fine for thread_id/list but may generate an error when a more complex GROUP BY is used. |
2142 | 2118 | $str_group_by_count = current($GROUP_BY); |
2143 | 2119 | $count = "SELECT COUNT(DISTINCT {$str_group_by_count}) FROM ". $primary_table; |
2144 | - } |
|
2145 | - else { |
|
2120 | + } else { |
|
2146 | 2121 | $count = "SELECT COUNT(*) FROM ". $primary_table; |
2147 | 2122 | } |
2148 | 2123 | |
@@ -2263,8 +2238,7 @@ discard block |
||
2263 | 2238 | |
2264 | 2239 | if ($status == PRIVATEMSG_UNREAD) { |
2265 | 2240 | drupal_set_message(format_plural(count($threads), 'Marked 1 thread as unread.', 'Marked @count threads as unread.')); |
2266 | - } |
|
2267 | - else { |
|
2241 | + } else { |
|
2268 | 2242 | drupal_set_message(format_plural(count($threads), 'Marked 1 thread as read.', 'Marked @count threads as read.')); |
2269 | 2243 | } |
2270 | 2244 | } |
@@ -2445,8 +2419,7 @@ discard block |
||
2445 | 2419 | // Add in callback arguments if present. |
2446 | 2420 | if (isset($operation['callback arguments'])) { |
2447 | 2421 | $args = array_merge(array($threads), $operation['callback arguments']); |
2448 | - } |
|
2449 | - else { |
|
2422 | + } else { |
|
2450 | 2423 | $args = array($threads); |
2451 | 2424 | } |
2452 | 2425 | |
@@ -2463,8 +2436,7 @@ discard block |
||
2463 | 2436 | // Add in callback arguments if present. |
2464 | 2437 | if (isset($operation['undo callback arguments'])) { |
2465 | 2438 | $undo_args = array_merge(array($threads), $operation['undo callback arguments']); |
2466 | - } |
|
2467 | - else { |
|
2439 | + } else { |
|
2468 | 2440 | $undo_args = array($threads); |
2469 | 2441 | } |
2470 | 2442 | |
@@ -2516,8 +2488,7 @@ discard block |
||
2516 | 2488 | |
2517 | 2489 | if ($delete) { |
2518 | 2490 | drupal_set_message(format_plural(count($threads), 'Deleted 1 thread.', 'Deleted @count threads.')); |
2519 | - } |
|
2520 | - else { |
|
2491 | + } else { |
|
2521 | 2492 | drupal_set_message(format_plural(count($threads), 'Restored 1 thread.', 'Restored @count threads.')); |
2522 | 2493 | } |
2523 | 2494 | } |
@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | if ($view->base_table == 'node' && !empty($view->display['default']->display_options['fields'])) { |
97 | 97 | if ($view->type == 'Default') { |
98 | 98 | $views[t('Default Views')][$view->name] = $view->name; |
99 | - } |
|
100 | - else { |
|
99 | + } else { |
|
101 | 100 | $views[t('Existing Views')][$view->name] = $view->name; |
102 | 101 | } |
103 | 102 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | '#required' => FALSE, |
126 | 125 | '#description' => t('Provide a comma separated list of arguments to pass to the view.'), |
127 | 126 | ); |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $form['advanced']['no_view_help'] = array( |
131 | 129 | '#value' => t('<p>The list of nodes that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') . |
132 | 130 | t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Content types" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate nodes on node creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate nodes will be displayed.</li></ul>'), |
@@ -212,8 +210,7 @@ discard block |
||
212 | 210 | if (is_array($item) && !empty($item['nid'])) { |
213 | 211 | if (is_numeric($item['nid'])) { |
214 | 212 | $ids[] = $item['nid']; |
215 | - } |
|
216 | - else { |
|
213 | + } else { |
|
217 | 214 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
218 | 215 | if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
219 | 216 | form_set_error($error_element, t("%name: invalid input.", array('%name' => t($field['widget']['label'])))); |
@@ -487,8 +484,7 @@ discard block |
||
487 | 484 | '#element_validate' => array('_element_validate_integer_positive'), |
488 | 485 | '#required' => TRUE, |
489 | 486 | ); |
490 | - } |
|
491 | - else { |
|
487 | + } else { |
|
492 | 488 | $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match); |
493 | 489 | $form['size'] = array('#type' => 'hidden', '#value' => $size); |
494 | 490 | } |
@@ -736,14 +732,12 @@ discard block |
||
736 | 732 | if (!empty($title) && ($n = node_load($nid)) && trim($title) != trim($n->title)) { |
737 | 733 | form_error($element[$field_key], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label'])))); |
738 | 734 | } |
739 | - } |
|
740 | - else { |
|
735 | + } else { |
|
741 | 736 | // No explicit nid. |
742 | 737 | $reference = _nodereference_potential_references($field, $value, 'equals', NULL, 1); |
743 | 738 | if (empty($reference)) { |
744 | 739 | form_error($element[$field_key], t('%name: found no valid post with that title.', array('%name' => t($field['widget']['label'])))); |
745 | - } |
|
746 | - else { |
|
740 | + } else { |
|
747 | 741 | // TODO: |
748 | 742 | // the best thing would be to present the user with an additional form, |
749 | 743 | // allowing the user to choose between valid candidates with the same title |
@@ -868,8 +862,7 @@ discard block |
||
868 | 862 | if (!empty($field['advanced_view_args'])) { |
869 | 863 | // TODO: Support Tokens using token.module ? |
870 | 864 | $view_args = array_map('trim', explode(',', $field['advanced_view_args'])); |
871 | - } |
|
872 | - else { |
|
865 | + } else { |
|
873 | 866 | $view_args = array(); |
874 | 867 | } |
875 | 868 | |
@@ -894,8 +887,7 @@ discard block |
||
894 | 887 | |
895 | 888 | // Get the results. |
896 | 889 | $result = $view->execute_display($display, $view_args); |
897 | - } |
|
898 | - else { |
|
890 | + } else { |
|
899 | 891 | $result = FALSE; |
900 | 892 | } |
901 | 893 | |
@@ -933,8 +925,7 @@ discard block |
||
933 | 925 | ); |
934 | 926 | $where[] = 'n.title '. (isset($match_clauses[$match]) ? $match_clauses[$match] : $match_clauses['contains']); |
935 | 927 | $args[] = $string; |
936 | - } |
|
937 | - elseif ($ids) { |
|
928 | + } elseif ($ids) { |
|
938 | 929 | $where[] = 'n.nid IN (' . db_placeholders($ids) . ')'; |
939 | 930 | $args = array_merge($args, $ids); |
940 | 931 | } |