@@ -49,62 +49,62 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function jump_block($op = 'list', $delta = 0, $edit = array()) { |
51 | 51 | switch ($op) { |
52 | - case 'list': |
|
53 | - $blocks = array(); |
|
54 | - foreach (menu_get_menus() as $name => $title) { |
|
55 | - $blocks['menu-' . $name] = array( |
|
56 | - 'info' => t('Jump menu: !menu', array('!menu' => $name)) |
|
57 | - ); |
|
58 | - } |
|
52 | + case 'list': |
|
53 | + $blocks = array(); |
|
54 | + foreach (menu_get_menus() as $name => $title) { |
|
55 | + $blocks['menu-' . $name] = array( |
|
56 | + 'info' => t('Jump menu: !menu', array('!menu' => $name)) |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | - $vocs = taxonomy_get_vocabularies(); |
|
61 | - foreach ($vocs as $vid => $vocabulary) { |
|
62 | - $blocks['taxo-' . $vid] = array( |
|
63 | - 'info' => t('Jump menu: !voc', array('!voc' => $vocabulary->name)) |
|
64 | - ); |
|
65 | - } |
|
66 | - return $blocks; |
|
67 | - case 'configure': |
|
68 | - $form = array(); |
|
69 | - $form['block_settings']['jump_activepageinmenu_' . $delta] = array( |
|
70 | - '#type' => 'checkbox', |
|
71 | - '#title' => t('Show active page in jump menu.'), |
|
72 | - '#default_value' => variable_get('jump_activepageinmenu_' . $delta, 1), |
|
73 | - '#description' => t('This setting will force the jump menu to show the current page as the default selection in this block\'s jump menu.'), |
|
60 | + $vocs = taxonomy_get_vocabularies(); |
|
61 | + foreach ($vocs as $vid => $vocabulary) { |
|
62 | + $blocks['taxo-' . $vid] = array( |
|
63 | + 'info' => t('Jump menu: !voc', array('!voc' => $vocabulary->name)) |
|
74 | 64 | ); |
75 | - // Do the rest of the form additions in hook_form_alter() since we can't do ahah here. |
|
76 | - return $form; |
|
77 | - case 'save': |
|
78 | - variable_set('jump_activepageinmenu_' . $delta, $edit['jump_activepageinmenu_' . $delta]); |
|
79 | - variable_set('jump_use_js_' . $delta, $edit['jump_use_js_' . $delta]); |
|
80 | - variable_set('jump_add_select_' . $delta, $edit['jump_add_select_' . $delta]); |
|
81 | - variable_set('jump_add_select_text_' . $delta, $edit['jump_add_select_text_' . $delta]); |
|
82 | - break; |
|
83 | - case 'view': |
|
84 | - // The first 5 characters of $delta should be one of: |
|
85 | - // menu- |
|
86 | - // taxo- |
|
87 | - $subject = ''; |
|
88 | - $jumpmenu_type = substr($delta, 0, 4); |
|
89 | - $jumpmenu_name = substr($delta, 5); |
|
90 | - $active = jump_get_active_setting($delta); |
|
91 | - if ($jumpmenu_type == 'menu') { |
|
92 | - $form = jump_quickly($jumpmenu_name, 'menu', $active); |
|
65 | + } |
|
66 | + return $blocks; |
|
67 | + case 'configure': |
|
68 | + $form = array(); |
|
69 | + $form['block_settings']['jump_activepageinmenu_' . $delta] = array( |
|
70 | + '#type' => 'checkbox', |
|
71 | + '#title' => t('Show active page in jump menu.'), |
|
72 | + '#default_value' => variable_get('jump_activepageinmenu_' . $delta, 1), |
|
73 | + '#description' => t('This setting will force the jump menu to show the current page as the default selection in this block\'s jump menu.'), |
|
74 | + ); |
|
75 | + // Do the rest of the form additions in hook_form_alter() since we can't do ahah here. |
|
76 | + return $form; |
|
77 | + case 'save': |
|
78 | + variable_set('jump_activepageinmenu_' . $delta, $edit['jump_activepageinmenu_' . $delta]); |
|
79 | + variable_set('jump_use_js_' . $delta, $edit['jump_use_js_' . $delta]); |
|
80 | + variable_set('jump_add_select_' . $delta, $edit['jump_add_select_' . $delta]); |
|
81 | + variable_set('jump_add_select_text_' . $delta, $edit['jump_add_select_text_' . $delta]); |
|
82 | + break; |
|
83 | + case 'view': |
|
84 | + // The first 5 characters of $delta should be one of: |
|
85 | + // menu- |
|
86 | + // taxo- |
|
87 | + $subject = ''; |
|
88 | + $jumpmenu_type = substr($delta, 0, 4); |
|
89 | + $jumpmenu_name = substr($delta, 5); |
|
90 | + $active = jump_get_active_setting($delta); |
|
91 | + if ($jumpmenu_type == 'menu') { |
|
92 | + $form = jump_quickly($jumpmenu_name, 'menu', $active); |
|
93 | 93 | |
94 | - // Use the menu label as the default block subject |
|
95 | - $menus = menu_get_menus(); |
|
96 | - $subject = $menus[$jumpmenu_name]; |
|
97 | - } |
|
98 | - else if ($jumpmenu_type == 'taxo') { |
|
99 | - $form = jump_quickly($jumpmenu_name, 'taxo', $active); |
|
94 | + // Use the menu label as the default block subject |
|
95 | + $menus = menu_get_menus(); |
|
96 | + $subject = $menus[$jumpmenu_name]; |
|
97 | + } |
|
98 | + else if ($jumpmenu_type == 'taxo') { |
|
99 | + $form = jump_quickly($jumpmenu_name, 'taxo', $active); |
|
100 | 100 | |
101 | - // Use the vocabulary name as the default block subject |
|
102 | - $vocab = taxonomy_vocabulary_load($jumpmenu_name); |
|
103 | - $subject = $vocab->name; |
|
104 | - } |
|
105 | - if (variable_get('jump_use_js_' . $delta, 0) === 1) drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
106 | - return array('subject' => $subject, 'content' => $form); |
|
107 | - break; |
|
101 | + // Use the vocabulary name as the default block subject |
|
102 | + $vocab = taxonomy_vocabulary_load($jumpmenu_name); |
|
103 | + $subject = $vocab->name; |
|
104 | + } |
|
105 | + if (variable_get('jump_use_js_' . $delta, 0) === 1) drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
106 | + return array('subject' => $subject, 'content' => $form); |
|
107 | + break; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -309,52 +309,52 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function jump_form_alter(&$form, $form_state, $form_id) { |
311 | 311 | switch ($form_id) { |
312 | - case 'block_admin_configure': |
|
313 | - if ($form['module']['#value'] === 'jump' && function_exists('ahah_helper_register')) { |
|
314 | - $delta = $form['delta']['#value']; |
|
315 | - ahah_helper_register($form, $form_state); |
|
316 | - $default_jump_use_js = (!isset($form_state['storage']['jump_use_js_' . $delta])) ? variable_get('jump_use_js_' . $delta, 0) : $form_state['storage']['jump_use_js_' . $delta]; |
|
317 | - $default_jump_add_select = (!isset($form_state['storage']['jump_add_select_' . $delta])) ? variable_get('jump_add_select_' . $delta, 0) : $form_state['storage']['jump_add_select_' . $delta]; |
|
312 | + case 'block_admin_configure': |
|
313 | + if ($form['module']['#value'] === 'jump' && function_exists('ahah_helper_register')) { |
|
314 | + $delta = $form['delta']['#value']; |
|
315 | + ahah_helper_register($form, $form_state); |
|
316 | + $default_jump_use_js = (!isset($form_state['storage']['jump_use_js_' . $delta])) ? variable_get('jump_use_js_' . $delta, 0) : $form_state['storage']['jump_use_js_' . $delta]; |
|
317 | + $default_jump_add_select = (!isset($form_state['storage']['jump_add_select_' . $delta])) ? variable_get('jump_add_select_' . $delta, 0) : $form_state['storage']['jump_add_select_' . $delta]; |
|
318 | 318 | |
319 | - $form['block_settings']['jump_wrapper'] = array( |
|
320 | - '#prefix' => '<div id="jump-wrapper">', |
|
321 | - '#suffix' => '</div>', |
|
322 | - '#type' => 'markup' |
|
323 | - ); |
|
324 | - $form['block_settings']['jump_wrapper']['jump_use_js_' . $delta] = array( |
|
319 | + $form['block_settings']['jump_wrapper'] = array( |
|
320 | + '#prefix' => '<div id="jump-wrapper">', |
|
321 | + '#suffix' => '</div>', |
|
322 | + '#type' => 'markup' |
|
323 | + ); |
|
324 | + $form['block_settings']['jump_wrapper']['jump_use_js_' . $delta] = array( |
|
325 | + '#type' => 'checkbox', |
|
326 | + '#title' => t('Hide the submit button and use Javascript to automatically jump to the selected menu item'), |
|
327 | + '#default_value' => $default_jump_use_js, |
|
328 | + '#disabled' => ($default_jump_add_select === 1) ? TRUE : FALSE, |
|
329 | + '#ahah' => array( |
|
330 | + 'event' => 'change', |
|
331 | + 'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')), |
|
332 | + 'wrapper' => 'jump-wrapper', |
|
333 | + ), |
|
334 | + ); |
|
335 | + if ($default_jump_use_js === 1) { |
|
336 | + $form['block_settings']['jump_wrapper']['jump_add_select_' . $delta] = array( |
|
325 | 337 | '#type' => 'checkbox', |
326 | - '#title' => t('Hide the submit button and use Javascript to automatically jump to the selected menu item'), |
|
327 | - '#default_value' => $default_jump_use_js, |
|
328 | - '#disabled' => ($default_jump_add_select === 1) ? TRUE : FALSE, |
|
338 | + '#title' => t('Add an empty select option into the list of options'), |
|
339 | + '#default_value' => $default_jump_add_select, |
|
340 | + '#weight' => 1, |
|
329 | 341 | '#ahah' => array( |
330 | 342 | 'event' => 'change', |
331 | 343 | 'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')), |
332 | 344 | 'wrapper' => 'jump-wrapper', |
333 | 345 | ), |
334 | 346 | ); |
335 | - if ($default_jump_use_js === 1) { |
|
336 | - $form['block_settings']['jump_wrapper']['jump_add_select_' . $delta] = array( |
|
337 | - '#type' => 'checkbox', |
|
338 | - '#title' => t('Add an empty select option into the list of options'), |
|
339 | - '#default_value' => $default_jump_add_select, |
|
340 | - '#weight' => 1, |
|
341 | - '#ahah' => array( |
|
342 | - 'event' => 'change', |
|
343 | - 'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')), |
|
344 | - 'wrapper' => 'jump-wrapper', |
|
345 | - ), |
|
347 | + if ($default_jump_add_select === 1) { |
|
348 | + $form['block_settings']['jump_wrapper']['jump_add_select_text_' . $delta] = array( |
|
349 | + '#type' => 'textfield', |
|
350 | + '#title' => t('Text to use for the empty select option'), |
|
351 | + '#default_value' => variable_get('jump_add_select_text_' . $delta, t('Select Option')), |
|
352 | + '#weight' => 2 |
|
346 | 353 | ); |
347 | - if ($default_jump_add_select === 1) { |
|
348 | - $form['block_settings']['jump_wrapper']['jump_add_select_text_' . $delta] = array( |
|
349 | - '#type' => 'textfield', |
|
350 | - '#title' => t('Text to use for the empty select option'), |
|
351 | - '#default_value' => variable_get('jump_add_select_text_' . $delta, t('Select Option')), |
|
352 | - '#weight' => 2 |
|
353 | - ); |
|
354 | - } |
|
355 | 354 | } |
356 | 355 | } |
357 | - break; |
|
356 | + } |
|
357 | + break; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 |
@@ -94,8 +94,7 @@ discard block |
||
94 | 94 | // Use the menu label as the default block subject |
95 | 95 | $menus = menu_get_menus(); |
96 | 96 | $subject = $menus[$jumpmenu_name]; |
97 | - } |
|
98 | - else if ($jumpmenu_type == 'taxo') { |
|
97 | + } else if ($jumpmenu_type == 'taxo') { |
|
99 | 98 | $form = jump_quickly($jumpmenu_name, 'taxo', $active); |
100 | 99 | |
101 | 100 | // Use the vocabulary name as the default block subject |
@@ -137,13 +136,11 @@ discard block |
||
137 | 136 | |
138 | 137 | if (is_array($name)) { |
139 | 138 | $options = $name; |
140 | - } |
|
141 | - else { |
|
139 | + } else { |
|
142 | 140 | $options = array(); |
143 | 141 | if ($type == 'menu') { |
144 | 142 | jump_menu_get_menu_options($options, $name); |
145 | - } |
|
146 | - elseif ($type == 'taxo') { |
|
143 | + } elseif ($type == 'taxo') { |
|
147 | 144 | jump_menu_get_taxo_options($options, $name); |
148 | 145 | } |
149 | 146 | } |
@@ -215,8 +212,7 @@ discard block |
||
215 | 212 | $fragment = explode('#', $form_state['values']['jump_goto']); |
216 | 213 | if (isset($fragment[1])) { |
217 | 214 | drupal_goto($fragment[0], NULL, $fragment[1]); |
218 | - } |
|
219 | - else { |
|
215 | + } else { |
|
220 | 216 | drupal_goto($form_state['values']['jump_goto']); |
221 | 217 | } |
222 | 218 | } |
@@ -76,8 +76,7 @@ discard block |
||
76 | 76 | foreach ($handlers as $field => $handler) { |
77 | 77 | if ($label = $handler->label()) { |
78 | 78 | $field_names[$field] = $label; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | $field_names[$field] = $handler->ui_name(); |
82 | 81 | } |
83 | 82 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | $map = array_flip($this->field_map); |
126 | 125 | if (isset($row->$map[$field])) { |
127 | 126 | $tokens["[$field]"] = $row->$map[$field]; |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $tokens["[$field]"] = ''; |
131 | 129 | } |
132 | 130 | } |
@@ -49,23 +49,20 @@ discard block |
||
49 | 49 | foreach ($form['taxonomy'][$vid]['#options'] as $tid => $name) { |
50 | 50 | if (!is_numeric($tid)) { |
51 | 51 | $options[$tid] = $name; |
52 | - } |
|
53 | - elseif (is_object($name)) { |
|
52 | + } elseif (is_object($name)) { |
|
54 | 53 | foreach ($name->option as $sub_tid => $sub_name) { |
55 | 54 | if (!empty($tids[$sub_tid])) { |
56 | 55 | $options[$tid]->option[$sub_tid] = $sub_name; |
57 | 56 | } |
58 | 57 | } |
59 | - } |
|
60 | - elseif ($tids[$tid]) { |
|
58 | + } elseif ($tids[$tid]) { |
|
61 | 59 | $options[$tid] = $name; |
62 | 60 | } |
63 | 61 | } |
64 | 62 | |
65 | 63 | if ($options) { |
66 | 64 | $form['taxonomy'][$vid]['#options'] = $options; |
67 | - } |
|
68 | - else { |
|
65 | + } else { |
|
69 | 66 | unset($form['taxonomy'][$vid]); |
70 | 67 | } |
71 | 68 | |
@@ -135,8 +132,7 @@ discard block |
||
135 | 132 | } |
136 | 133 | break; |
137 | 134 | }//switch arg(0) |
138 | - } |
|
139 | - else { |
|
135 | + } else { |
|
140 | 136 | if (isset($form['admin']) && !empty($user->_forum_access_moderator)) { |
141 | 137 | foreach (element_children($form['admin']) as $key) { |
142 | 138 | if ($key != 'status') { |
@@ -79,27 +79,27 @@ discard block |
||
79 | 79 | $allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify')); |
80 | 80 | foreach (element_children($form) as $key) { |
81 | 81 | switch ($key) { |
82 | - case 'options': |
|
83 | - foreach (element_children($form[$key]) as $key2) { |
|
84 | - if (array_search($key2, $allowed_options) === FALSE) { |
|
85 | - $form[$key][$key2]['#access'] = FALSE; |
|
86 | - } |
|
87 | - } |
|
88 | - break; |
|
89 | - case 'buttons': |
|
90 | - $tid = $form['taxonomy'][$vid]['#default_value'][0]; |
|
91 | - if (!forum_access_access($tid, 'update')) { |
|
92 | - $form['buttons']['submit']['#access'] = FALSE; |
|
93 | - $form['buttons']['preview']['#access'] = FALSE; |
|
94 | - } |
|
95 | - if (!forum_access_access($tid, 'delete')) { |
|
96 | - $form['buttons']['delete']['#access'] = FALSE; |
|
97 | - } |
|
98 | - break; |
|
99 | - default: |
|
100 | - if (array_search($key, $allowed_elements) === FALSE) { |
|
101 | - $form[$key]['#access'] = FALSE; |
|
82 | + case 'options': |
|
83 | + foreach (element_children($form[$key]) as $key2) { |
|
84 | + if (array_search($key2, $allowed_options) === FALSE) { |
|
85 | + $form[$key][$key2]['#access'] = FALSE; |
|
102 | 86 | } |
87 | + } |
|
88 | + break; |
|
89 | + case 'buttons': |
|
90 | + $tid = $form['taxonomy'][$vid]['#default_value'][0]; |
|
91 | + if (!forum_access_access($tid, 'update')) { |
|
92 | + $form['buttons']['submit']['#access'] = FALSE; |
|
93 | + $form['buttons']['preview']['#access'] = FALSE; |
|
94 | + } |
|
95 | + if (!forum_access_access($tid, 'delete')) { |
|
96 | + $form['buttons']['delete']['#access'] = FALSE; |
|
97 | + } |
|
98 | + break; |
|
99 | + default: |
|
100 | + if (array_search($key, $allowed_elements) === FALSE) { |
|
101 | + $form[$key]['#access'] = FALSE; |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | if ($tid = _forum_access_get_tid($node)) { |
121 | 121 | if (!forum_access_access($tid, 'comment_create') and !(forum_access_access($tid, 'create') and ($node->uid==$user->uid)) ) { |
122 | 122 | switch (arg(0)) { |
123 | - case 'node': |
|
124 | - // Remove the in-line comment form, replace with text message to user. |
|
125 | - $form = NULL; |
|
126 | - $form['from'] = array( |
|
127 | - '#type' => 'item', |
|
128 | - '#value' => 'You do not have permission to post comments in this forum.',); |
|
129 | - break; |
|
130 | - case 'comment': |
|
131 | - if (arg(1)=='reply') { |
|
132 | - drupal_set_message(t("ERROR: You do not have permission to post comments in this forum."), 'error'); |
|
133 | - drupal_goto("node/$node->nid"); |
|
134 | - exit; |
|
135 | - } |
|
136 | - break; |
|
123 | + case 'node': |
|
124 | + // Remove the in-line comment form, replace with text message to user. |
|
125 | + $form = NULL; |
|
126 | + $form['from'] = array( |
|
127 | + '#type' => 'item', |
|
128 | + '#value' => 'You do not have permission to post comments in this forum.',); |
|
129 | + break; |
|
130 | + case 'comment': |
|
131 | + if (arg(1)=='reply') { |
|
132 | + drupal_set_message(t("ERROR: You do not have permission to post comments in this forum."), 'error'); |
|
133 | + drupal_goto("node/$node->nid"); |
|
134 | + exit; |
|
135 | + } |
|
136 | + break; |
|
137 | 137 | }//switch arg(0) |
138 | 138 | } |
139 | 139 | else { |
@@ -86,75 +86,75 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | switch (arg(0)) { |
89 | - case 'comment': |
|
90 | - if (variable_get('forum_access_D5_legacy_mode', FALSE)) { |
|
91 | - return; // disable comment access control |
|
92 | - } |
|
93 | - if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) { |
|
94 | - if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/% |
|
95 | - $access[] = (arg(1) == 'edit' ? 'update' : 'delete'); |
|
96 | - $comment = _comment_load($cid); |
|
97 | - $nid = $comment->nid; |
|
98 | - // If the node turns out to be in a forum where we have update/delete |
|
99 | - // access, then we need Moderator permissions now, so we can moderate |
|
100 | - // this comment. |
|
101 | - // We won't provide full Administrator access, though: we'll remove |
|
102 | - // author and timestamp, for example. |
|
103 | - $grant_normal_access = TRUE; |
|
104 | - } |
|
89 | + case 'comment': |
|
90 | + if (variable_get('forum_access_D5_legacy_mode', FALSE)) { |
|
91 | + return; // disable comment access control |
|
92 | + } |
|
93 | + if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) { |
|
94 | + if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/% |
|
95 | + $access[] = (arg(1) == 'edit' ? 'update' : 'delete'); |
|
96 | + $comment = _comment_load($cid); |
|
97 | + $nid = $comment->nid; |
|
98 | + // If the node turns out to be in a forum where we have update/delete |
|
99 | + // access, then we need Moderator permissions now, so we can moderate |
|
100 | + // this comment. |
|
101 | + // We won't provide full Administrator access, though: we'll remove |
|
102 | + // author and timestamp, for example. |
|
103 | + $grant_normal_access = TRUE; |
|
105 | 104 | } |
106 | - break; |
|
105 | + } |
|
106 | + break; |
|
107 | 107 | |
108 | - case 'node': |
|
109 | - if (is_numeric(arg(1))) { |
|
110 | - if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit |
|
111 | - $access[] = 'update'; |
|
112 | - $nid = arg(1); |
|
113 | - // If the node turns out to be in a forum where we have update/delete |
|
114 | - // access, then we already get limited edit capabilities from NA, but |
|
115 | - // we need some more, e.g. publish/unpublish and comment status. |
|
116 | - // In order to get these controls on the form, we need Moderator |
|
117 | - // permissions now. |
|
118 | - // We won't provide full Administrator access, though: we'll remove |
|
119 | - // author and timestamp, for example. |
|
120 | - } |
|
121 | - if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete |
|
122 | - $access = array(); |
|
123 | - $nid = arg(1); |
|
124 | - // This is the delete confirmation page. We don't need any |
|
125 | - // additional permissions, but we'll assert 'view' access below. |
|
126 | - } |
|
127 | - if (arg(2) == NULL && !user_access('administer comments')) { // node/% |
|
128 | - $access[] = 'update'; |
|
129 | - $nid = arg(1); |
|
130 | - // If the node turns out to be in a forum where we have update/delete |
|
131 | - // access, then we'll get the 'Edit' link automatically from NA, but |
|
132 | - // we'll need Moderator permissions, so that we can add the edit/delete |
|
133 | - // comment links (*after* we've identified the other comment links). |
|
134 | - } |
|
108 | + case 'node': |
|
109 | + if (is_numeric(arg(1))) { |
|
110 | + if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit |
|
111 | + $access[] = 'update'; |
|
112 | + $nid = arg(1); |
|
113 | + // If the node turns out to be in a forum where we have update/delete |
|
114 | + // access, then we already get limited edit capabilities from NA, but |
|
115 | + // we need some more, e.g. publish/unpublish and comment status. |
|
116 | + // In order to get these controls on the form, we need Moderator |
|
117 | + // permissions now. |
|
118 | + // We won't provide full Administrator access, though: we'll remove |
|
119 | + // author and timestamp, for example. |
|
135 | 120 | } |
136 | - break; |
|
137 | - |
|
138 | - case 'community': |
|
139 | - if (arg(1)=='forum') { |
|
140 | - if (is_numeric(arg(2))) { |
|
141 | - $tid=arg(2); |
|
142 | - // Obtain the tid from a URL path containing |
|
143 | - // community/forum/%tid, this will prevent users from |
|
144 | - // loading forums they are not allowed to access. |
|
145 | - // However, only tid>1 are terms we care about. (This |
|
146 | - // allows forum_tweaks mark-read functionality to |
|
147 | - // work.) |
|
148 | - if (isset($tid) and ($tid>1)) { |
|
149 | - if (!forum_access_access($tid, 'view')) { |
|
150 | - drupal_access_denied(); |
|
151 | - module_invoke_all('exit'); |
|
152 | - exit; |
|
153 | - } |
|
154 | - }// isset($tid) |
|
155 | - }// is_numeric(arg(2)) |
|
156 | - }// arg(1)==forum |
|
121 | + if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete |
|
122 | + $access = array(); |
|
123 | + $nid = arg(1); |
|
124 | + // This is the delete confirmation page. We don't need any |
|
125 | + // additional permissions, but we'll assert 'view' access below. |
|
126 | + } |
|
127 | + if (arg(2) == NULL && !user_access('administer comments')) { // node/% |
|
128 | + $access[] = 'update'; |
|
129 | + $nid = arg(1); |
|
130 | + // If the node turns out to be in a forum where we have update/delete |
|
131 | + // access, then we'll get the 'Edit' link automatically from NA, but |
|
132 | + // we'll need Moderator permissions, so that we can add the edit/delete |
|
133 | + // comment links (*after* we've identified the other comment links). |
|
134 | + } |
|
135 | + } |
|
157 | 136 | break; |
137 | + |
|
138 | + case 'community': |
|
139 | + if (arg(1)=='forum') { |
|
140 | + if (is_numeric(arg(2))) { |
|
141 | + $tid=arg(2); |
|
142 | + // Obtain the tid from a URL path containing |
|
143 | + // community/forum/%tid, this will prevent users from |
|
144 | + // loading forums they are not allowed to access. |
|
145 | + // However, only tid>1 are terms we care about. (This |
|
146 | + // allows forum_tweaks mark-read functionality to |
|
147 | + // work.) |
|
148 | + if (isset($tid) and ($tid>1)) { |
|
149 | + if (!forum_access_access($tid, 'view')) { |
|
150 | + drupal_access_denied(); |
|
151 | + module_invoke_all('exit'); |
|
152 | + exit; |
|
153 | + } |
|
154 | + }// isset($tid) |
|
155 | + }// is_numeric(arg(2)) |
|
156 | + }// arg(1)==forum |
|
157 | + break; |
|
158 | 158 | }// switch |
159 | 159 | if (isset($nid)) { |
160 | 160 | $node = node_load($nid); |
@@ -244,36 +244,36 @@ discard block |
||
244 | 244 | global $user; |
245 | 245 | $sql = NULL; |
246 | 246 | switch ($primary_field) { |
247 | - case 'tid': |
|
248 | - if ($user->uid == 1 |
|
249 | - || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE |
|
250 | - || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') { |
|
251 | - break; |
|
252 | - } |
|
253 | - if (strpos($_GET['q'], 'node/add/forum') !== FALSE) { |
|
254 | - $required_access = 'create'; |
|
255 | - } |
|
256 | - else { |
|
257 | - $required_access = 'view'; |
|
258 | - } |
|
259 | - $roles = implode(', ', array_keys($user->roles)); |
|
260 | - $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid |
|
247 | + case 'tid': |
|
248 | + if ($user->uid == 1 |
|
249 | + || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE |
|
250 | + || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') { |
|
251 | + break; |
|
252 | + } |
|
253 | + if (strpos($_GET['q'], 'node/add/forum') !== FALSE) { |
|
254 | + $required_access = 'create'; |
|
255 | + } |
|
256 | + else { |
|
257 | + $required_access = 'view'; |
|
258 | + } |
|
259 | + $roles = implode(', ', array_keys($user->roles)); |
|
260 | + $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid |
|
261 | 261 | LEFT JOIN {acl} acl_fa ON acl_fa.number = $primary_table.tid AND acl_fa.module = 'forum_access' |
262 | 262 | LEFT JOIN {acl_user} aclu_fa ON aclu_fa.acl_id = acl_fa.acl_id AND aclu_fa.uid = $user->uid"; |
263 | - $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid"; |
|
264 | - $sql['distinct'] = 1; |
|
265 | - break; |
|
263 | + $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid"; |
|
264 | + $sql['distinct'] = 1; |
|
265 | + break; |
|
266 | 266 | |
267 | - case 'rid': |
|
268 | - if (strpos($query, 'FROM {role}') === FALSE |
|
269 | - || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) { |
|
270 | - break; |
|
271 | - } |
|
272 | - $moderator_rid = forum_access_query_moderator_rid(); |
|
273 | - if (!empty($moderator_rid)) { |
|
274 | - $sql['where'] = "$primary_table.rid <> $moderator_rid"; |
|
275 | - } |
|
267 | + case 'rid': |
|
268 | + if (strpos($query, 'FROM {role}') === FALSE |
|
269 | + || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) { |
|
276 | 270 | break; |
271 | + } |
|
272 | + $moderator_rid = forum_access_query_moderator_rid(); |
|
273 | + if (!empty($moderator_rid)) { |
|
274 | + $sql['where'] = "$primary_table.rid <> $moderator_rid"; |
|
275 | + } |
|
276 | + break; |
|
277 | 277 | } |
278 | 278 | return $sql; |
279 | 279 | } |
@@ -301,42 +301,42 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | switch ($op) { |
304 | - case 'presave': |
|
305 | - $old_tid = db_result(db_query('SELECT tid FROM {forum} WHERE nid = %d', $node->nid)); |
|
306 | - break; |
|
304 | + case 'presave': |
|
305 | + $old_tid = db_result(db_query('SELECT tid FROM {forum} WHERE nid = %d', $node->nid)); |
|
306 | + break; |
|
307 | 307 | |
308 | - case 'update': |
|
309 | - if (!empty($old_tid)) { |
|
310 | - if (!empty($node->tid) && $node->tid == $old_tid) { |
|
311 | - return; |
|
312 | - } |
|
313 | - acl_node_clear_acls($node->nid, 'forum_access'); |
|
308 | + case 'update': |
|
309 | + if (!empty($old_tid)) { |
|
310 | + if (!empty($node->tid) && $node->tid == $old_tid) { |
|
311 | + return; |
|
312 | + } |
|
313 | + acl_node_clear_acls($node->nid, 'forum_access'); |
|
314 | 314 | |
315 | - if (module_exists('nodecomment')) { |
|
316 | - _forum_access_changed_tid($node->tid); |
|
317 | - $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid); |
|
318 | - while ($row = db_fetch_object($result)) { |
|
319 | - acl_node_clear_acls($row->cid, 'forum_access'); |
|
320 | - } |
|
315 | + if (module_exists('nodecomment')) { |
|
316 | + _forum_access_changed_tid($node->tid); |
|
317 | + $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid); |
|
318 | + while ($row = db_fetch_object($result)) { |
|
319 | + acl_node_clear_acls($row->cid, 'forum_access'); |
|
321 | 320 | } |
322 | 321 | } |
323 | - // Deliberate no break -- for changed and for previously unassigned terms we need an insert. |
|
324 | - |
|
325 | - case 'insert': |
|
326 | - if (!empty($node->tid)) { |
|
327 | - $acl_id = acl_get_id_by_number('forum_access', $node->tid); |
|
328 | - acl_node_add_acl($node->nid, $acl_id, 1, 1, 1); |
|
329 | - |
|
330 | - if (isset($old_tid) && module_exists('nodecomment')) { |
|
331 | - $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid); |
|
332 | - while ($row = db_fetch_object($result)) { |
|
333 | - acl_node_add_acl($row->cid, $acl_id, 1, 1, 1); |
|
334 | - node_access_acquire_grants(node_load($row->cid)); |
|
335 | - } |
|
322 | + } |
|
323 | + // Deliberate no break -- for changed and for previously unassigned terms we need an insert. |
|
324 | + |
|
325 | + case 'insert': |
|
326 | + if (!empty($node->tid)) { |
|
327 | + $acl_id = acl_get_id_by_number('forum_access', $node->tid); |
|
328 | + acl_node_add_acl($node->nid, $acl_id, 1, 1, 1); |
|
329 | + |
|
330 | + if (isset($old_tid) && module_exists('nodecomment')) { |
|
331 | + $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid); |
|
332 | + while ($row = db_fetch_object($result)) { |
|
333 | + acl_node_add_acl($row->cid, $acl_id, 1, 1, 1); |
|
334 | + node_access_acquire_grants(node_load($row->cid)); |
|
336 | 335 | } |
337 | 336 | } |
338 | - $old_tid = NULL; |
|
339 | - break; |
|
337 | + } |
|
338 | + $old_tid = NULL; |
|
339 | + break; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
@@ -587,20 +587,20 @@ discard block |
||
587 | 587 | */ |
588 | 588 | function forum_access_user($op, &$edit, &$account, $category = NULL) { |
589 | 589 | switch ($op) { |
590 | - case 'validate': |
|
591 | - $rid = forum_access_query_moderator_rid(); |
|
592 | - if (!empty($rid)) { |
|
593 | - if (isset($edit['roles'][$rid]) && $edit['roles'][$rid]) { |
|
594 | - $roles = user_roles(); |
|
595 | - $variables = array( |
|
596 | - '@Forum_Access' => 'Forum Access', |
|
597 | - '%Role' => $roles[$rid], |
|
598 | - ); |
|
599 | - drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning'); |
|
600 | - unset($edit['roles'][$rid]); |
|
601 | - } |
|
590 | + case 'validate': |
|
591 | + $rid = forum_access_query_moderator_rid(); |
|
592 | + if (!empty($rid)) { |
|
593 | + if (isset($edit['roles'][$rid]) && $edit['roles'][$rid]) { |
|
594 | + $roles = user_roles(); |
|
595 | + $variables = array( |
|
596 | + '@Forum_Access' => 'Forum Access', |
|
597 | + '%Role' => $roles[$rid], |
|
598 | + ); |
|
599 | + drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning'); |
|
600 | + unset($edit['roles'][$rid]); |
|
602 | 601 | } |
603 | - break; |
|
602 | + } |
|
603 | + break; |
|
604 | 604 | } |
605 | 605 | } |
606 | 606 |
@@ -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)) && !($access == 'comment_create' && forum_access_access($tid, 'create') && ($node->uid==$user->uid)) ) { |
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 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function i18nviews_help($path, $arg) { |
17 | 17 | switch ($path) { |
18 | - case 'admin/modules#description' : |
|
19 | - $output = '<p>'. t('Supports translation for views strings: title, header, footer...') .'</p>'; |
|
20 | - $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>'; |
|
21 | - return $output; |
|
18 | + case 'admin/modules#description' : |
|
19 | + $output = '<p>'. t('Supports translation for views strings: title, header, footer...') .'</p>'; |
|
20 | + $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>'; |
|
21 | + return $output; |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function i18nviews_locale($op = 'groups') { |
29 | 29 | switch ($op) { |
30 | - case 'groups': |
|
31 | - return array('views' => t('Views')); |
|
32 | - case 'info': |
|
33 | - $info['views']['refresh callback'] = 'i18nviews_locale_refresh'; |
|
34 | - $info['views']['format'] = TRUE; |
|
35 | - return $info; |
|
30 | + case 'groups': |
|
31 | + return array('views' => t('Views')); |
|
32 | + case 'info': |
|
33 | + $info['views']['refresh callback'] = 'i18nviews_locale_refresh'; |
|
34 | + $info['views']['format'] = TRUE; |
|
35 | + return $info; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | function i18nviews_views_handler_field_allterms($fieldinfo, $fielddata, $value, $data) { |
63 | 63 | if ($fieldinfo['vocabulary']) { |
64 | 64 | $terms = taxonomy_node_get_terms_by_vocabulary($data->nid, $fieldinfo['vocabulary']); |
65 | - } |
|
66 | - else { |
|
65 | + } else { |
|
67 | 66 | $terms = taxonomy_node_get_terms($data->nid); |
68 | 67 | } |
69 | 68 | // Translate all these terms. |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | $links[] = check_plain($term->name); |
75 | 74 | } |
76 | 75 | $links = !empty($links) ? implode(' | ', $links) : ''; |
77 | - } |
|
78 | - else { |
|
76 | + } else { |
|
79 | 77 | $node = new stdClass(); |
80 | 78 | $node->taxonomy = $terms; |
81 | 79 | $links = theme('links', taxonomy_link('taxonomy terms', $node)); |
@@ -126,8 +124,7 @@ discard block |
||
126 | 124 | if ($data['id'] == 'term_node.name') { |
127 | 125 | // That's a full taxonomy box. |
128 | 126 | $view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms'; |
129 | - } |
|
130 | - elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) { |
|
127 | + } elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) { |
|
131 | 128 | $vid = $matches[1]; |
132 | 129 | if ($translate[$vid]) { |
133 | 130 | // Set new handler for this field. |
@@ -161,8 +158,7 @@ discard block |
||
161 | 158 | if ($update) { |
162 | 159 | $format = isset($data[$field . '_format']) ? $data[$field . '_format'] : NULL; |
163 | 160 | i18nstrings_update("views:$name:$group:$field", $data[$field], $format); |
164 | - } |
|
165 | - else { |
|
161 | + } else { |
|
166 | 162 | $data[$field] = i18nstrings("views:$name:$group:$field", $data[$field]); |
167 | 163 | $translated[] = $field; |
168 | 164 | } |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | if (count($value) > 1) { |
103 | 103 | $tname = t($value[0]); |
104 | 104 | $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])"; |
105 | - } |
|
106 | - else { |
|
105 | + } else { |
|
107 | 106 | $predefined[$key] = t($value[0]); |
108 | 107 | } |
109 | 108 | } |
@@ -143,8 +142,7 @@ discard block |
||
143 | 142 | '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, |
144 | 143 | ); |
145 | 144 | } |
146 | - } |
|
147 | - else if (isset($meta['extensions']) && is_array($meta['extensions'])) { |
|
145 | + } else if (isset($meta['extensions']) && is_array($meta['extensions'])) { |
|
148 | 146 | foreach ($meta['extensions'] as $extension => $title) { |
149 | 147 | $form['buttons'][$name][$extension] = array( |
150 | 148 | '#type' => 'checkbox', |
@@ -334,8 +332,7 @@ discard block |
||
334 | 332 | // Determine if this is an update. |
335 | 333 | if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) { |
336 | 334 | $update = array(); |
337 | - } |
|
338 | - else { |
|
335 | + } else { |
|
339 | 336 | $update = array('format'); |
340 | 337 | } |
341 | 338 | $wysiwyg = new stdClass(); |
@@ -405,8 +402,7 @@ discard block |
||
405 | 402 | ); |
406 | 403 | if ($editor['installed']) { |
407 | 404 | $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : ''); |
408 | - } |
|
409 | - else { |
|
405 | + } else { |
|
410 | 406 | // Build on-site installation instructions. |
411 | 407 | // @todo Setup $library in wysiwyg_load_editor() already. |
412 | 408 | $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries'])); |
@@ -467,8 +463,7 @@ discard block |
||
467 | 463 | if ($in_code_only) { |
468 | 464 | $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>'; |
469 | 465 | } |
470 | - } |
|
471 | - else { |
|
466 | + } else { |
|
472 | 467 | $form['formats'][$id]['editor'] = array( |
473 | 468 | '#type' => 'select', |
474 | 469 | '#default_value' => '', |
@@ -574,8 +569,7 @@ discard block |
||
574 | 569 | wysiwyg_profile_delete($wysiwyg); |
575 | 570 | if (!empty($form_state['values']['revert'])) { |
576 | 571 | drupal_set_message(t('Wysiwyg profile settings for %name has been reverted.', array('%name' => $format->name))); |
577 | - } |
|
578 | - else { |
|
572 | + } else { |
|
579 | 573 | drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name))); |
580 | 574 | } |
581 | 575 | $form_state['redirect'] = 'admin/settings/wysiwyg'; |
@@ -130,8 +130,7 @@ |
||
130 | 130 | if (isset($config['css_setting'])) { |
131 | 131 | if ($config['css_setting'] == 'theme') { |
132 | 132 | $settings['EditorAreaCSS'] = implode(',', wysiwyg_get_css()); |
133 | - } |
|
134 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
133 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
135 | 134 | $settings['EditorAreaCSS'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
136 | 135 | } |
137 | 136 | } |
@@ -173,8 +173,7 @@ |
||
173 | 173 | if ($config['css_setting'] == 'theme') { |
174 | 174 | // WYMeditor only supports one CSS file currently. |
175 | 175 | $settings['stylesheet'] = reset(wysiwyg_get_css()); |
176 | - } |
|
177 | - else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
176 | + } else if ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
178 | 177 | $settings['stylesheet'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
179 | 178 | } |
180 | 179 | } |
@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | natcasesort($themes); |
106 | 106 | $themes = array_values($themes); |
107 | 107 | return !empty($themes) ? $themes : array('default'); |
108 | - } |
|
109 | - else { |
|
108 | + } else { |
|
110 | 109 | return array('default'); |
111 | 110 | } |
112 | 111 | } |
@@ -165,16 +164,13 @@ discard block |
||
165 | 164 | if (version_compare($editor['installed version'], '3.0.1.4391', '<')) { |
166 | 165 | if ($config['css_setting'] == 'theme') { |
167 | 166 | $settings['contentsCss'] = reset(wysiwyg_get_css()); |
168 | - } |
|
169 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
167 | + } elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
170 | 168 | $settings['contentsCss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); |
171 | 169 | } |
172 | - } |
|
173 | - else { |
|
170 | + } else { |
|
174 | 171 | if ($config['css_setting'] == 'theme') { |
175 | 172 | $settings['contentsCss'] = wysiwyg_get_css(); |
176 | - } |
|
177 | - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
173 | + } elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { |
|
178 | 174 | $settings['contentsCss'] = explode(',', strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()))); |
179 | 175 | } |
180 | 176 | } |