@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -261,32 +261,32 @@ |
||
| 261 | 261 | |
| 262 | 262 | // Add theme-specific settings. |
| 263 | 263 | switch ($theme) { |
| 264 | - case 'advanced': |
|
| 264 | + case 'advanced': |
|
| 265 | + $settings += array( |
|
| 266 | + 'theme_advanced_resize_horizontal' => FALSE, |
|
| 267 | + 'theme_advanced_resizing_use_cookie' => FALSE, |
|
| 268 | + 'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom', |
|
| 269 | + 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
|
| 270 | + 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
|
| 271 | + 'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left', |
|
| 272 | + ); |
|
| 273 | + if (isset($config['block_formats'])) { |
|
| 274 | + $settings['theme_advanced_blockformats'] = $config['block_formats']; |
|
| 275 | + } |
|
| 276 | + if (isset($settings['buttons'])) { |
|
| 277 | + // These rows explicitly need to be set to be empty, otherwise TinyMCE |
|
| 278 | + // loads its default buttons of the advanced theme for each row. |
|
| 265 | 279 | $settings += array( |
| 266 | - 'theme_advanced_resize_horizontal' => FALSE, |
|
| 267 | - 'theme_advanced_resizing_use_cookie' => FALSE, |
|
| 268 | - 'theme_advanced_path_location' => isset($config['path_loc']) ? $config['path_loc'] : 'bottom', |
|
| 269 | - 'theme_advanced_resizing' => isset($config['resizing']) ? $config['resizing'] : 1, |
|
| 270 | - 'theme_advanced_toolbar_location' => isset($config['toolbar_loc']) ? $config['toolbar_loc'] : 'top', |
|
| 271 | - 'theme_advanced_toolbar_align' => isset($config['toolbar_align']) ? $config['toolbar_align'] : 'left', |
|
| 280 | + 'theme_advanced_buttons1' => array(), |
|
| 281 | + 'theme_advanced_buttons2' => array(), |
|
| 282 | + 'theme_advanced_buttons3' => array(), |
|
| 272 | 283 | ); |
| 273 | - if (isset($config['block_formats'])) { |
|
| 274 | - $settings['theme_advanced_blockformats'] = $config['block_formats']; |
|
| 284 | + // @todo Allow to sort/arrange editor buttons. |
|
| 285 | + for ($i = 0; $i < count($settings['buttons']); $i++) { |
|
| 286 | + $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 275 | 287 | } |
| 276 | - if (isset($settings['buttons'])) { |
|
| 277 | - // These rows explicitly need to be set to be empty, otherwise TinyMCE |
|
| 278 | - // loads its default buttons of the advanced theme for each row. |
|
| 279 | - $settings += array( |
|
| 280 | - 'theme_advanced_buttons1' => array(), |
|
| 281 | - 'theme_advanced_buttons2' => array(), |
|
| 282 | - 'theme_advanced_buttons3' => array(), |
|
| 283 | - ); |
|
| 284 | - // @todo Allow to sort/arrange editor buttons. |
|
| 285 | - for ($i = 0; $i < count($settings['buttons']); $i++) { |
|
| 286 | - $settings['theme_advanced_buttons1'][] = $settings['buttons'][$i]; |
|
| 287 | - } |
|
| 288 | - } |
|
| 289 | - break; |
|
| 288 | + } |
|
| 289 | + break; |
|
| 290 | 290 | } |
| 291 | 291 | unset($settings['buttons']); |
| 292 | 292 | |
@@ -79,9 +79,9 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | function wysiwyg_help($path, $arg) { |
| 81 | 81 | switch ($path) { |
| 82 | - case 'admin/settings/wysiwyg': |
|
| 83 | - $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
|
| 84 | - return $output; |
|
| 82 | + case 'admin/settings/wysiwyg': |
|
| 83 | + $output = '<p>' . t('A Wysiwyg profile is associated with an input format. A Wysiwyg profile defines which client-side editor is loaded with a particular input format, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions.') . '</p>'; |
|
| 84 | + return $output; |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -37,56 +37,56 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function hook_wysiwyg_plugin($editor, $version) { |
| 39 | 39 | switch ($editor) { |
| 40 | - case 'tinymce': |
|
| 41 | - if ($version > 3) { |
|
| 42 | - return array( |
|
| 43 | - 'myplugin' => array( |
|
| 44 | - // A URL to the plugin's homepage. |
|
| 45 | - 'url' => 'http://drupal.org/project/img_assist', |
|
| 46 | - // The full path to the native editor plugin, no trailing slash. |
|
| 47 | - // Ignored when 'internal' is set to TRUE below. |
|
| 48 | - 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', |
|
| 49 | - // The name of the plugin's main JavaScript file. |
|
| 50 | - // Ignored when 'internal' is set to TRUE below. |
|
| 51 | - // Default value depends on which editor the plugin is for. |
|
| 52 | - 'filename' => 'editor_plugin.js', |
|
| 53 | - // A list of buttons provided by this native plugin. The key has to |
|
| 54 | - // match the corresponding JavaScript implementation. The value is |
|
| 55 | - // is displayed on the editor configuration form only. |
|
| 56 | - 'buttons' => array( |
|
| 57 | - 'img_assist' => t('Image Assist'), |
|
| 58 | - ), |
|
| 59 | - // A list of editor extensions provided by this native plugin. |
|
| 60 | - // Extensions are not displayed as buttons and touch the editor's |
|
| 61 | - // internals, so you should know what you are doing. |
|
| 62 | - 'extensions' => array( |
|
| 63 | - 'imce' => t('IMCE'), |
|
| 64 | - ), |
|
| 65 | - // A list of global, native editor configuration settings to |
|
| 66 | - // override. To be used rarely and only when required. |
|
| 67 | - 'options' => array( |
|
| 68 | - 'file_browser_callback' => 'imceImageBrowser', |
|
| 69 | - 'inline_styles' => TRUE, |
|
| 70 | - ), |
|
| 71 | - // Boolean whether the editor needs to load this plugin. When TRUE, |
|
| 72 | - // the editor will automatically load the plugin based on the 'path' |
|
| 73 | - // variable provided. If FALSE, the plugin either does not need to |
|
| 74 | - // be loaded or is already loaded by something else on the page. |
|
| 75 | - // Most plugins should define TRUE here. |
|
| 76 | - 'load' => TRUE, |
|
| 77 | - // Boolean whether this plugin is a native plugin, i.e. shipped with |
|
| 78 | - // the editor. Definition must be ommitted for plugins provided by |
|
| 79 | - // other modules. TRUE means 'path' and 'filename' above are ignored |
|
| 80 | - // and the plugin is instead loaded from the editor's plugin folder. |
|
| 81 | - 'internal' => TRUE, |
|
| 82 | - // TinyMCE-specific: Additional HTML elements to allow in the markup. |
|
| 83 | - 'extended_valid_elements' => array( |
|
| 84 | - 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
| 85 | - ), |
|
| 40 | + case 'tinymce': |
|
| 41 | + if ($version > 3) { |
|
| 42 | + return array( |
|
| 43 | + 'myplugin' => array( |
|
| 44 | + // A URL to the plugin's homepage. |
|
| 45 | + 'url' => 'http://drupal.org/project/img_assist', |
|
| 46 | + // The full path to the native editor plugin, no trailing slash. |
|
| 47 | + // Ignored when 'internal' is set to TRUE below. |
|
| 48 | + 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', |
|
| 49 | + // The name of the plugin's main JavaScript file. |
|
| 50 | + // Ignored when 'internal' is set to TRUE below. |
|
| 51 | + // Default value depends on which editor the plugin is for. |
|
| 52 | + 'filename' => 'editor_plugin.js', |
|
| 53 | + // A list of buttons provided by this native plugin. The key has to |
|
| 54 | + // match the corresponding JavaScript implementation. The value is |
|
| 55 | + // is displayed on the editor configuration form only. |
|
| 56 | + 'buttons' => array( |
|
| 57 | + 'img_assist' => t('Image Assist'), |
|
| 86 | 58 | ), |
| 87 | - ); |
|
| 88 | - } |
|
| 89 | - break; |
|
| 59 | + // A list of editor extensions provided by this native plugin. |
|
| 60 | + // Extensions are not displayed as buttons and touch the editor's |
|
| 61 | + // internals, so you should know what you are doing. |
|
| 62 | + 'extensions' => array( |
|
| 63 | + 'imce' => t('IMCE'), |
|
| 64 | + ), |
|
| 65 | + // A list of global, native editor configuration settings to |
|
| 66 | + // override. To be used rarely and only when required. |
|
| 67 | + 'options' => array( |
|
| 68 | + 'file_browser_callback' => 'imceImageBrowser', |
|
| 69 | + 'inline_styles' => TRUE, |
|
| 70 | + ), |
|
| 71 | + // Boolean whether the editor needs to load this plugin. When TRUE, |
|
| 72 | + // the editor will automatically load the plugin based on the 'path' |
|
| 73 | + // variable provided. If FALSE, the plugin either does not need to |
|
| 74 | + // be loaded or is already loaded by something else on the page. |
|
| 75 | + // Most plugins should define TRUE here. |
|
| 76 | + 'load' => TRUE, |
|
| 77 | + // Boolean whether this plugin is a native plugin, i.e. shipped with |
|
| 78 | + // the editor. Definition must be ommitted for plugins provided by |
|
| 79 | + // other modules. TRUE means 'path' and 'filename' above are ignored |
|
| 80 | + // and the plugin is instead loaded from the editor's plugin folder. |
|
| 81 | + 'internal' => TRUE, |
|
| 82 | + // TinyMCE-specific: Additional HTML elements to allow in the markup. |
|
| 83 | + 'extended_valid_elements' => array( |
|
| 84 | + 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
| 85 | + ), |
|
| 86 | + ), |
|
| 87 | + ); |
|
| 88 | + } |
|
| 89 | + break; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | function hook_wysiwyg_include_directory($type) { |
| 104 | 104 | switch ($type) { |
| 105 | - case 'plugins': |
|
| 106 | - // You can just return $type, if you place your Wysiwyg plugins into a |
|
| 107 | - // sub-directory named 'plugins'. |
|
| 108 | - return $type; |
|
| 105 | + case 'plugins': |
|
| 106 | + // You can just return $type, if you place your Wysiwyg plugins into a |
|
| 107 | + // sub-directory named 'plugins'. |
|
| 108 | + return $type; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -34,67 +34,67 @@ |
||
| 34 | 34 | |
| 35 | 35 | function bbcode_filter($op, $delta = 0, $format = -1, $text = '') { |
| 36 | 36 | switch ($op) { |
| 37 | - case 'list': |
|
| 38 | - return array(0 => t('BBCode')); |
|
| 37 | + case 'list': |
|
| 38 | + return array(0 => t('BBCode')); |
|
| 39 | 39 | |
| 40 | - case 'description': |
|
| 41 | - return t('Converts BBCode to HTML.'); |
|
| 40 | + case 'description': |
|
| 41 | + return t('Converts BBCode to HTML.'); |
|
| 42 | 42 | |
| 43 | - case 'process': |
|
| 44 | - include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
|
| 45 | - if (variable_get("bbcode_debug_$format", 0)) { |
|
| 46 | - $timing_start = explode(' ', microtime()); |
|
| 47 | - $ret = _bbcode_filter_process($text, $format); |
|
| 48 | - $timing_stop = explode(' ', microtime()); |
|
| 49 | - $elapsed = $timing_stop[1] - $timing_start[1]; |
|
| 50 | - $elapsed += $timing_stop[0] - $timing_start[0]; |
|
| 51 | - $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
| 52 | - return $ret; |
|
| 53 | - } |
|
| 54 | - else |
|
| 55 | - return _bbcode_filter_process($text, $format); |
|
| 43 | + case 'process': |
|
| 44 | + include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
|
| 45 | + if (variable_get("bbcode_debug_$format", 0)) { |
|
| 46 | + $timing_start = explode(' ', microtime()); |
|
| 47 | + $ret = _bbcode_filter_process($text, $format); |
|
| 48 | + $timing_stop = explode(' ', microtime()); |
|
| 49 | + $elapsed = $timing_stop[1] - $timing_start[1]; |
|
| 50 | + $elapsed += $timing_stop[0] - $timing_start[0]; |
|
| 51 | + $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
| 52 | + return $ret; |
|
| 53 | + } |
|
| 54 | + else |
|
| 55 | + return _bbcode_filter_process($text, $format); |
|
| 56 | 56 | |
| 57 | - case 'settings': |
|
| 58 | - $form = array(); |
|
| 59 | - $form['bbcode_filter'] = array( |
|
| 60 | - '#type' => 'fieldset', |
|
| 61 | - '#title' => t('BBCode filter'), |
|
| 62 | - '#collapsible' => TRUE, |
|
| 63 | - '#collapsed' => FALSE); |
|
| 64 | - $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
| 65 | - '#type' => 'select', |
|
| 66 | - '#title' => t('Convert addresses to links'), |
|
| 67 | - '#default_value' => variable_get("bbcode_make_links_$format", 1), |
|
| 68 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
| 69 | - '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.')); |
|
| 70 | - $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
| 71 | - '#type' => 'select', |
|
| 72 | - '#title' => t('Spam link deterrent'), |
|
| 73 | - '#default_value' => variable_get("bbcode_filter_nofollow_$format", 0), |
|
| 74 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
| 75 | - '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.')); |
|
| 76 | - $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
| 77 | - '#type' => 'select', |
|
| 78 | - '#title' => t('Email address encoding'), |
|
| 79 | - '#default_value' => variable_get("bbcode_encode_mailto_$format", 1), |
|
| 80 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
| 81 | - '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.')); |
|
| 82 | - $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
| 83 | - '#type' => 'select', |
|
| 84 | - '#title' => t('Smart paragraph and line breaks'), |
|
| 85 | - '#default_value' => variable_get("bbcode_paragraph_breaks_$format", 2), |
|
| 86 | - '#options' => array(t('Disabled'), t('Line breaks only'), t('Line and paragraph breaks')), |
|
| 87 | - '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!')); |
|
| 88 | - $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
| 89 | - '#type' => 'select', |
|
| 90 | - '#title' => t('Print debugging info'), |
|
| 91 | - '#default_value' => variable_get("bbcode_debug_$format", 0), |
|
| 92 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
| 93 | - '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.')); |
|
| 94 | - return $form; |
|
| 57 | + case 'settings': |
|
| 58 | + $form = array(); |
|
| 59 | + $form['bbcode_filter'] = array( |
|
| 60 | + '#type' => 'fieldset', |
|
| 61 | + '#title' => t('BBCode filter'), |
|
| 62 | + '#collapsible' => TRUE, |
|
| 63 | + '#collapsed' => FALSE); |
|
| 64 | + $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
| 65 | + '#type' => 'select', |
|
| 66 | + '#title' => t('Convert addresses to links'), |
|
| 67 | + '#default_value' => variable_get("bbcode_make_links_$format", 1), |
|
| 68 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
| 69 | + '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.')); |
|
| 70 | + $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
| 71 | + '#type' => 'select', |
|
| 72 | + '#title' => t('Spam link deterrent'), |
|
| 73 | + '#default_value' => variable_get("bbcode_filter_nofollow_$format", 0), |
|
| 74 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
| 75 | + '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.')); |
|
| 76 | + $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
| 77 | + '#type' => 'select', |
|
| 78 | + '#title' => t('Email address encoding'), |
|
| 79 | + '#default_value' => variable_get("bbcode_encode_mailto_$format", 1), |
|
| 80 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
| 81 | + '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.')); |
|
| 82 | + $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
| 83 | + '#type' => 'select', |
|
| 84 | + '#title' => t('Smart paragraph and line breaks'), |
|
| 85 | + '#default_value' => variable_get("bbcode_paragraph_breaks_$format", 2), |
|
| 86 | + '#options' => array(t('Disabled'), t('Line breaks only'), t('Line and paragraph breaks')), |
|
| 87 | + '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!')); |
|
| 88 | + $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
| 89 | + '#type' => 'select', |
|
| 90 | + '#title' => t('Print debugging info'), |
|
| 91 | + '#default_value' => variable_get("bbcode_debug_$format", 0), |
|
| 92 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
| 93 | + '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.')); |
|
| 94 | + return $form; |
|
| 95 | 95 | |
| 96 | - default: |
|
| 97 | - return $text; |
|
| 96 | + default: |
|
| 97 | + return $text; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -412,12 +412,12 @@ discard block |
||
| 412 | 412 | $field['db_columns'] = $field['columns']; |
| 413 | 413 | |
| 414 | 414 | switch ($op) { |
| 415 | - case 'create': |
|
| 416 | - drupal_write_record(content_field_tablename(), $field); |
|
| 417 | - break; |
|
| 418 | - case 'update': |
|
| 419 | - drupal_write_record(content_field_tablename(), $field, 'field_name'); |
|
| 420 | - break; |
|
| 415 | + case 'create': |
|
| 416 | + drupal_write_record(content_field_tablename(), $field); |
|
| 417 | + break; |
|
| 418 | + case 'update': |
|
| 419 | + drupal_write_record(content_field_tablename(), $field, 'field_name'); |
|
| 420 | + break; |
|
| 421 | 421 | } |
| 422 | 422 | unset($field['db_columns']); |
| 423 | 423 | return $field; |
@@ -448,12 +448,12 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | switch ($op) { |
| 451 | - case 'create': |
|
| 452 | - drupal_write_record(content_instance_tablename(), $field); |
|
| 453 | - break; |
|
| 454 | - case 'update': |
|
| 455 | - drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name')); |
|
| 456 | - break; |
|
| 451 | + case 'create': |
|
| 452 | + drupal_write_record(content_instance_tablename(), $field); |
|
| 453 | + break; |
|
| 454 | + case 'update': |
|
| 455 | + drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name')); |
|
| 456 | + break; |
|
| 457 | 457 | } |
| 458 | 458 | return $field; |
| 459 | 459 | } |
@@ -41,31 +41,31 @@ |
||
| 41 | 41 | |
| 42 | 42 | // Now update values, options, etc. to those selected in the imported view. |
| 43 | 43 | switch ($type) { |
| 44 | - case 'field': |
|
| 45 | - $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options']; |
|
| 46 | - if ($views_field['handler'] == 'content_views_field_handler_group') { |
|
| 47 | - $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1; |
|
| 48 | - } |
|
| 49 | - else { |
|
| 50 | - $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0; |
|
| 51 | - } |
|
| 52 | - return; |
|
| 44 | + case 'field': |
|
| 45 | + $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options']; |
|
| 46 | + if ($views_field['handler'] == 'content_views_field_handler_group') { |
|
| 47 | + $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1; |
|
| 48 | + } |
|
| 49 | + else { |
|
| 50 | + $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0; |
|
| 51 | + } |
|
| 52 | + return; |
|
| 53 | 53 | |
| 54 | - case 'filter': |
|
| 55 | - // TODO |
|
| 56 | - return; |
|
| 54 | + case 'filter': |
|
| 55 | + // TODO |
|
| 56 | + return; |
|
| 57 | 57 | |
| 58 | - case 'exposed_filter': |
|
| 59 | - // TODO |
|
| 60 | - return; |
|
| 58 | + case 'exposed_filter': |
|
| 59 | + // TODO |
|
| 60 | + return; |
|
| 61 | 61 | |
| 62 | - case 'argument': |
|
| 63 | - // TODO |
|
| 64 | - return; |
|
| 62 | + case 'argument': |
|
| 63 | + // TODO |
|
| 64 | + return; |
|
| 65 | 65 | |
| 66 | - case 'sort': |
|
| 67 | - // TODO |
|
| 68 | - break; |
|
| 66 | + case 'sort': |
|
| 67 | + // TODO |
|
| 68 | + break; |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | return; |