Parent Directory
|
Revision Log
|
Revision Graph
forgot to update tribune_add_post
| 1 | <?php |
| 2 | // vim:filetype=php expandtab tabstop=2 softtabstop=2 shiftwidth=2 autoindent smartindent |
| 3 | // $Id: tribune.module,v 1.168 2008/11/30 15:27:45 seeschloss Exp $ |
| 4 | |
| 5 | /** |
| 6 | * Some variables |
| 7 | */ |
| 8 | $_tribune_current_post_id = -1; |
| 9 | $_tribune_current_clock_id = -1; |
| 10 | |
| 11 | /** |
| 12 | * Display help and module information |
| 13 | * @param section which section of the site we're displaying help |
| 14 | * @return help text for section |
| 15 | */ |
| 16 | function tribune_help($section = '') { |
| 17 | |
| 18 | $output = ''; |
| 19 | switch ($section) { |
| 20 | case "admin/help#tribune": |
| 21 | $output = "<p>". t("Provides a 'tribune'") ."</p>"; |
| 22 | break; |
| 23 | } |
| 24 | |
| 25 | return $output; |
| 26 | } |
| 27 | |
| 28 | function tribune_load($nid) { |
| 29 | $node = NULL; |
| 30 | |
| 31 | if (!is_object($nid)) { |
| 32 | $node = node_load(array('type' => "tribune", 'nid' => $nid)); |
| 33 | } else if ($nid->type == "tribune") { |
| 34 | $node = $nid; |
| 35 | } |
| 36 | |
| 37 | $node->tribune_settings = db_fetch_array(db_query('SELECT * FROM {tribune_tribunes} WHERE nid = %d', $node->nid)); |
| 38 | |
| 39 | $node->tribune_settings['enabled_filters'] = unserialize($node->tribune_settings['enabled_filters']); |
| 40 | $node->tribune_settings['variables'] = unserialize($node->tribune_settings['variables']); |
| 41 | |
| 42 | return $node; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | function tribune_node_info() { |
| 47 | return array( |
| 48 | 'tribune' => array( |
| 49 | 'name' => t('Tribune'), |
| 50 | 'module' => 'tribune', |
| 51 | 'description' => t('An advanced discussion space'), |
| 52 | 'title_label' => t('Tribune name'), |
| 53 | 'body_label' => t('Tribune message'), |
| 54 | 'has_body' => TRUE, |
| 55 | ), |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | function tribune_access($op, $node = NULL) { |
| 60 | global $user; |
| 61 | switch ($op) { |
| 62 | case 'create': |
| 63 | return user_access('create tribune node'); |
| 64 | case 'update': |
| 65 | return user_access('edit own tribune') and ($user->uid == $node->uid); |
| 66 | case 'delete': |
| 67 | return user_access('delete own tribune') and ($user->uid == $node->uid); |
| 68 | case 'view': |
| 69 | return user_access('read tribunes'); |
| 70 | case 'post': |
| 71 | return user_access('post in tribunes'); |
| 72 | case 'moderate tribune': |
| 73 | case 'delete tribune post': |
| 74 | case 'undelete tribune post': |
| 75 | case 'delete moderated posts': |
| 76 | case 'delete all posts': |
| 77 | return ($user->uid == $node->uid); |
| 78 | case 'configure own tribune filters': |
| 79 | return user_access('configure own tribune filters') and ($user->uid == $node->uid); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | function tribune_form(&$node) { |
| 84 | $type = node_get_types('type', $node); |
| 85 | |
| 86 | $form = array(); |
| 87 | |
| 88 | $form['title'] = array( |
| 89 | '#type' => 'textfield', |
| 90 | '#title' => check_plain($type->title_label), |
| 91 | '#required' => true, |
| 92 | '#default_value' => $node->title, |
| 93 | '#weight' => -5, |
| 94 | ); |
| 95 | |
| 96 | $form['body_filter']['body'] = array( |
| 97 | '#type' => 'textarea', |
| 98 | '#title' => check_plain($type->body_label), |
| 99 | '#default_value' => $node->body, |
| 100 | '#required' => FALSE |
| 101 | ); |
| 102 | $form['body_filter']['filter'] = filter_form($node->format); |
| 103 | |
| 104 | $form['tribune_settings'] = array( |
| 105 | '#title' => t('Tribune parameters'), |
| 106 | '#type' => 'fieldset', |
| 107 | '#collapsible' => TRUE, |
| 108 | '#collapsed' => FALSE, |
| 109 | '#tree' => TRUE, |
| 110 | ); |
| 111 | |
| 112 | $form['tribune_settings']['max_message_size'] = array( |
| 113 | '#type' => 'textfield', |
| 114 | '#title' => t('Maximum length of a comment'), |
| 115 | '#default_value' => isset($node->tribune_settings['max_message_size']) ? $node->tribune_settings['max_message_size'] : 512, |
| 116 | '#size' => 4, |
| 117 | '#maxlength' => 4, |
| 118 | '#description' => t('The maximum length of a comment.'), |
| 119 | ); |
| 120 | |
| 121 | $form['tribune_settings']['history_size'] = array( |
| 122 | '#type' => 'textfield', |
| 123 | '#title' => t('Number of comments displayed'), |
| 124 | '#default_value' => isset($node->tribune_settings['history_size']) ? $node->tribune_settings['history_size'] : 25, |
| 125 | '#size' => 3, |
| 126 | '#maxlength' => 3, |
| 127 | '#description' => t('The number of comments to display.'), |
| 128 | ); |
| 129 | |
| 130 | $form['tribune_settings']['xml_size'] = array( |
| 131 | '#type' => 'textfield', |
| 132 | '#title' => t('Number of comments displayed in the XML backend'), |
| 133 | '#default_value' => isset($node->tribune_settings['xml_size']) ? $node->tribune_settings['xml_size'] : 100, |
| 134 | '#size' => 3, |
| 135 | '#maxlength' => 3, |
| 136 | '#description' => t('The number of comments to display in the XML backend.'), |
| 137 | ); |
| 138 | |
| 139 | $form['tribune_settings']['rss_size'] = array( |
| 140 | '#type' => 'textfield', |
| 141 | '#title' => t('Number of comments displayed in the RSS feed'), |
| 142 | '#default_value' => isset($node->tribune_settings['rss_size']) ? $node->tribune_settings['rss_size'] : 50, |
| 143 | '#size' => 3, |
| 144 | '#maxlength' => 3, |
| 145 | '#description' => t('The number of comments to display in the RSS feed.'), |
| 146 | ); |
| 147 | |
| 148 | $form['tribune_settings']['reload_delay'] = array( |
| 149 | '#type' => 'textfield', |
| 150 | '#title' => t('Reload delay'), |
| 151 | '#default_value' => isset($node->tribune_settings['reload_delay']) ? $node->tribune_settings['reload_delay'] : 30, |
| 152 | '#size' => 3, |
| 153 | '#maxlength' => 3, |
| 154 | '#description' => t('The delay between automatic reloading of the tribune, in seconds (0 to disable Ajax reloading).'), |
| 155 | ); |
| 156 | |
| 157 | $form['tribune_settings']['flood_protection_delay'] = array( |
| 158 | '#type' => 'textfield', |
| 159 | '#title' => t('Flood protection'), |
| 160 | '#default_value' => isset($node->tribune_settings['flood_protection_delay']) ? $node->tribune_settings['flood_protection_delay'] : 0, |
| 161 | '#size' => 3, |
| 162 | '#maxlength' => 3, |
| 163 | '#description' => t('Minimum time before someone can post again, in seconds (0 disables flood protection).'), |
| 164 | ); |
| 165 | |
| 166 | $form['tribune_settings']['posts_order'] = array( |
| 167 | '#type' => 'radios', |
| 168 | '#title' => t('Message order'), |
| 169 | '#default_value' => isset($node->tribune_settings['posts_order']) ? $node->tribune_settings['posts_order'] : 1, |
| 170 | '#options' => array('1' => t("Last messages at the bottom"), '0' => t("Last messages at the top")), |
| 171 | '#description' => t('How the messages are displayed. Displaying the messages top-to-bottom makes it easier to follow real discussions, but displaying the latest one at the top is sometimes less confusing.'), |
| 172 | ); |
| 173 | |
| 174 | $form['tribune_settings']['show_pager'] = array( |
| 175 | '#type' => 'checkbox', |
| 176 | '#title' => t('Show pager'), |
| 177 | '#default_value' => isset($node->tribune_settings['show_pager']) ? $node->tribune_settings['show_pager'] : FALSE, |
| 178 | '#description' => t('Show a pager (all posts will be accessible, instead of just the last ones).'), |
| 179 | ); |
| 180 | |
| 181 | return $form; |
| 182 | } |
| 183 | |
| 184 | function tribune_insert($node) { |
| 185 | db_query('INSERT INTO {tribune_tribunes} SET |
| 186 | nid = %d, |
| 187 | banned_useragents = \'\', |
| 188 | banned_usernames = \'\', |
| 189 | banned_messages = \'\', |
| 190 | max_message_size = %d, |
| 191 | history_size = %d, |
| 192 | xml_size = %d, |
| 193 | rss_size = %d, |
| 194 | reload_delay = %d, |
| 195 | flood_protection_delay = %d, |
| 196 | posts_order = %d, |
| 197 | show_pager = %d, |
| 198 | enabled_filters = \'%s\', |
| 199 | variables = \'%s\' |
| 200 | ', |
| 201 | $node->nid, |
| 202 | $node->tribune_settings['max_message_size'], |
| 203 | $node->tribune_settings['history_size'], |
| 204 | $node->tribune_settings['xml_size'], |
| 205 | $node->tribune_settings['rss_size'], |
| 206 | $node->tribune_settings['reload_delay'], |
| 207 | $node->tribune_settings['flood_protection_delay'], |
| 208 | $node->tribune_settings['posts_order'], |
| 209 | $node->tribune_settings['show_pager'], |
| 210 | serialize(array('totoz' => "totoz", "url" => "url")), |
| 211 | serialize(array()) |
| 212 | ); |
| 213 | } |
| 214 | |
| 215 | function tribune_update($node) { |
| 216 | db_query('UPDATE {tribune_tribunes} SET |
| 217 | max_message_size = %d, |
| 218 | history_size = %d, |
| 219 | xml_size = %d, |
| 220 | rss_size = %d, |
| 221 | reload_delay = %d, |
| 222 | flood_protection_delay = %d, |
| 223 | posts_order = %d, |
| 224 | show_pager = %d, |
| 225 | enabled_filters = \'%s\', |
| 226 | variables = \'%s\' |
| 227 | WHERE nid = %d |
| 228 | ', |
| 229 | $node->tribune_settings['max_message_size'], |
| 230 | $node->tribune_settings['history_size'], |
| 231 | $node->tribune_settings['xml_size'], |
| 232 | $node->tribune_settings['rss_size'], |
| 233 | $node->tribune_settings['reload_delay'], |
| 234 | $node->tribune_settings['flood_protection_delay'], |
| 235 | $node->tribune_settings['posts_order'], |
| 236 | $node->tribune_settings['show_pager'], |
| 237 | serialize($node->tribune_settings['enabled_filters']), |
| 238 | serialize($node->tribune_settings['variables']), |
| 239 | $node->nid |
| 240 | ); |
| 241 | } |
| 242 | |
| 243 | function tribune_delete($node) { |
| 244 | db_query('DELETE FROM {tribune_tribunes} WHERE nid = %d', $node->nid); |
| 245 | db_query('DELETE FROM {tribune}, {tribune_post_references} USING {tribune} INNER JOIN {tribune_post_references} ON {tribune_post_references}.target_post_id = {tribune}.post_id WHERE {tribune}.tribune_id = %d', $node->nid); |
| 246 | } |
| 247 | |
| 248 | function tribune_view($node, $teaser = FALSE, $page = FALSE) { |
| 249 | $node = node_prepare($node, FALSE); |
| 250 | |
| 251 | drupal_add_css(drupal_get_path('module', 'tribune') .'/css/tribune.page.css'); |
| 252 | |
| 253 | $history_size = $node->tribune_settings['history_size']; |
| 254 | $reload_delay = $node->tribune_settings['reload_delay'] * 1000; // in milliseconds |
| 255 | $message_order = $node->tribune_settings['posts_order'] ? 'top_to_bottom' : 'bottom_to_top'; |
| 256 | $last_load_time = time(); |
| 257 | |
| 258 | $tribune_id = "tribune-". $node->nid; |
| 259 | |
| 260 | drupal_add_js( |
| 261 | array( |
| 262 | "tribune" => array( |
| 263 | "tribunes" => array( |
| 264 | $tribune_id => array( |
| 265 | "history_size" => $history_size, |
| 266 | "reload_delay" => $reload_delay, |
| 267 | "last_load_time" => $last_load_time, |
| 268 | "message_order" => $message_order, |
| 269 | "block" => FALSE, |
| 270 | "path" => array( |
| 271 | "post" => url("node/".$node->nid."/post"), |
| 272 | "json_post" => url("node/".$node->nid."/post-json"), |
| 273 | "json_posts" => url("node/".$node->nid."/newposts-json"), |
| 274 | "filters" => url("node/".$node->nid."/filter"), |
| 275 | ), |
| 276 | ), |
| 277 | ), |
| 278 | ), |
| 279 | ), "setting" |
| 280 | ); |
| 281 | |
| 282 | drupal_add_js(drupal_get_path('module', 'tribune') .'/js/tribune.ajax.js'); |
| 283 | drupal_add_js('misc/jquery.form.js'); |
| 284 | |
| 285 | $top_message = $node->body; |
| 286 | |
| 287 | if ($page and $node->tribune_settings['show_pager']) { |
| 288 | $posts = array(); |
| 289 | |
| 290 | $r = pager_query("SELECT * |
| 291 | FROM {tribune} |
| 292 | WHERE tribune_id = %d |
| 293 | ORDER BY post_id DESC", |
| 294 | $history_size, |
| 295 | 0, |
| 296 | NULL, |
| 297 | array($node->nid) |
| 298 | ); |
| 299 | |
| 300 | while ($row = db_fetch_array($r)) { |
| 301 | $posts[$row['post_id']] = tribune_post_from_row($row); |
| 302 | } |
| 303 | $posts = array_reverse($posts, true); |
| 304 | $contents = theme("tribune_page", $posts, $node, $tribune_id, $top_message, $node->tribune_settings['posts_order']).theme("pager", array(), $history_size); |
| 305 | } else { |
| 306 | $posts = tribune_get_last_posts($node, $history_size); |
| 307 | $contents = theme("tribune_page", $posts, $node, $tribune_id, $top_message, $node->tribune_settings['posts_order']); |
| 308 | } |
| 309 | |
| 310 | $node->content['body']['#value'] = $contents; |
| 311 | |
| 312 | return $node; |
| 313 | } |
| 314 | |
| 315 | function tribune_perm() { |
| 316 | return array( |
| 317 | "read tribunes", |
| 318 | "view tribunes history", |
| 319 | "view tribunes rss feed", |
| 320 | "view tribunes information", |
| 321 | "post in tribunes", |
| 322 | "create tribune node", |
| 323 | "edit own tribune", |
| 324 | "configure own tribune filters", |
| 325 | "delete own tribune", |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * Adds or update an user in the list of users viewing the tribune. |
| 331 | * this list is stored in the "tribune_active_users" variable |
| 332 | * as an array containing the last time each user has visited |
| 333 | * the tribune, keyed by his username. |
| 334 | */ |
| 335 | function tribune_update_active_user($node, $user) { |
| 336 | $key = 0; |
| 337 | $data = array(); |
| 338 | $tribune_active_users = tribune_variable_get('active_users', array(), $node); |
| 339 | if (!is_array($tribune_active_users)) { |
| 340 | $tribune_active_users = array(); |
| 341 | } |
| 342 | |
| 343 | if ($user->uid) { |
| 344 | $key = "a".strtolower($user->name).$user->name; |
| 345 | $data['name'] = $user->name; |
| 346 | $data['uid'] = $user->uid; |
| 347 | } else if (!$user->uid and isset($_SESSION['tribune_nickname'])) { |
| 348 | // this is to display users who have set their nickname |
| 349 | // using the "nick" filter... including filter-specific |
| 350 | // code in the main tribune code doesn't look very good |
| 351 | // but I can't see a better way to do it |
| 352 | $key = "z".strtolower($_SESSION['tribune_nickname']).$_SESSION['tribune_nickname']; |
| 353 | $data['name'] = $_SESSION['tribune_nickname']; |
| 354 | $data['uid'] = $user->uid; |
| 355 | } |
| 356 | $data['time'] = time(); |
| 357 | |
| 358 | if ($key) { |
| 359 | $tribune_active_users[$key] = $data; |
| 360 | tribune_variable_set('active_users', $tribune_active_users, $node); |
| 361 | |
| 362 | _tribune_update_active_users($node); |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * Updates the list of active users by removing all the users who |
| 368 | * have not visited the tribune for more than five minutes |
| 369 | */ |
| 370 | function _tribune_update_active_users($node) { |
| 371 | $now = time(); |
| 372 | $reload_delay = $node->tribune_settings['reload_delay']; |
| 373 | $tribune_active_users = tribune_variable_get('active_users', array(), $node); |
| 374 | foreach ($tribune_active_users as $key => $data) { |
| 375 | if ($data['time'] < $now - (5 * 60)) { |
| 376 | unset($tribune_active_users[$key]); |
| 377 | } |
| 378 | } |
| 379 | tribune_variable_set('active_users', $tribune_active_users, $node); |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Get the list of users who are currently reading the tribune |
| 384 | * @return An array of ('name, 'uid', time') arrays |
| 385 | */ |
| 386 | function tribune_get_active_users($node) { |
| 387 | _tribune_update_active_users($node); |
| 388 | $users = tribune_variable_get('active_users', array(), $node); |
| 389 | ksort($users); |
| 390 | return $users; |
| 391 | } |
| 392 | |
| 393 | /** |
| 394 | * Returns an array of filter files. |
| 395 | */ |
| 396 | function _tribune_filter_files() { |
| 397 | $filters_dir = drupal_get_path('module', 'tribune'); |
| 398 | $files = file_scan_directory($filters_dir, '\.inc$'); |
| 399 | |
| 400 | $filters = array(); |
| 401 | foreach ($files as $file) { |
| 402 | include_once($file->filename); |
| 403 | $filters[$file->name] = $file; |
| 404 | } |
| 405 | return $filters; |
| 406 | } |
| 407 | |
| 408 | /** |
| 409 | * Returns the pointers to all active filters |
| 410 | */ |
| 411 | function _tribune_get_filters($node, $after_slip) { |
| 412 | $info = _tribune_filters_info(); |
| 413 | |
| 414 | $filters = array(); |
| 415 | |
| 416 | if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { |
| 417 | $enabled_filters = $node->tribune_settings['enabled_filters']; |
| 418 | } else { |
| 419 | $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); |
| 420 | } |
| 421 | foreach (_tribune_filter_files() as $filter_file) { |
| 422 | $filter = $filter_file->name; |
| 423 | |
| 424 | if (isset ($enabled_filters[$filter]) and $enabled_filters[$filter]) { |
| 425 | if ($after_slip) { |
| 426 | $func = 'tribune_'. $filter .'_filter_after'; |
| 427 | if (function_exists($func)) { |
| 428 | $filters[$info[$filter]['weight']][$filter] = $func; |
| 429 | ksort($filters[$info[$filter]['weight']]); |
| 430 | } |
| 431 | } |
| 432 | else { |
| 433 | $func = 'tribune_'. $filter .'_filter'; |
| 434 | if (function_exists($func)) { |
| 435 | $filters[$info[$filter]['weight']][$filter] = $func; |
| 436 | ksort($filters[$info[$filter]['weight']]); |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | ksort($filters); |
| 443 | |
| 444 | $sorted_filters = array(); |
| 445 | |
| 446 | foreach ($filters as $weight => $list) { |
| 447 | |
| 448 | foreach ($list as $name => $func) { |
| 449 | $sorted_filters[$name] = $func; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | return $sorted_filters; |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Returns the pointers to all active filters with a help function |
| 458 | */ |
| 459 | function _tribune_get_filters_help($node) { |
| 460 | $filters = array(); |
| 461 | |
| 462 | if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { |
| 463 | $enabled_filters = $node->tribune_settings['enabled_filters']; |
| 464 | } else { |
| 465 | $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); |
| 466 | } |
| 467 | foreach (_tribune_filter_files() as $filter_file) { |
| 468 | $filter = $filter_file->name; |
| 469 | |
| 470 | if (isset ($enabled_filters[$filter]) and $enabled_filters[$filter]) { |
| 471 | $func = 'tribune_'. $filter .'_help'; |
| 472 | if (function_exists($func)) { |
| 473 | $filters[$filter] = $func; |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | return $filters; |
| 479 | } |
| 480 | |
| 481 | /** |
| 482 | * Returns the description of every available filter |
| 483 | */ |
| 484 | function _tribune_filters_info() { |
| 485 | $filters = array(); |
| 486 | |
| 487 | foreach (_tribune_filter_files() as $filter_file) { |
| 488 | $filter = $filter_file->name; |
| 489 | $func_info = 'tribune_'. $filter .'_info'; |
| 490 | |
| 491 | if (function_exists($func_info)) { |
| 492 | $info = $func_info(); |
| 493 | if (!is_array($info)) { |
| 494 | $info = array('description' => $info); |
| 495 | } |
| 496 | if (!isset($info['weight'])) { |
| 497 | $info['weight'] = 0; |
| 498 | } |
| 499 | |
| 500 | $info['before_slip'] = function_exists('tribune_'. $filter .'_filter'); |
| 501 | $info['after_slip'] = function_exists('tribune_'. $filter .'_filter_after'); |
| 502 | |
| 503 | $func_settings = 'tribune_'. $filter .'_settings'; |
| 504 | |
| 505 | if (function_exists($func_settings)) { |
| 506 | $info['settings'] = $func_settings; |
| 507 | } |
| 508 | else { |
| 509 | $info['settings'] = FALSE; |
| 510 | } |
| 511 | |
| 512 | $filters[$info['weight']][$filter] = $info; |
| 513 | |
| 514 | ksort($filters[$info['weight']]); |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | ksort($filters); |
| 519 | |
| 520 | $sorted_filters = array(); |
| 521 | |
| 522 | foreach ($filters as $weight => $list) { |
| 523 | foreach ($list as $name => $info) { |
| 524 | $sorted_filters[$name] = $info; |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | return $sorted_filters; |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * Returns a clock representation |
| 533 | */ |
| 534 | function tribune_filters_print_clock($post) { |
| 535 | $post_date = tribune_date_to_localdate($post['time']); |
| 536 | if ($post_date == date('YmdHis') and $post['rank'] == 0) { |
| 537 | $post['rank'] = 1; |
| 538 | } |
| 539 | $clock = tribune_format_clock($post_date, $post['rank']); |
| 540 | |
| 541 | return $clock; |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * Post a message to the tribune (jQuery/coincoins) |
| 546 | */ |
| 547 | function tribune_post($node) { |
| 548 | if (isset ($_POST['message']) and $_POST['message']) { |
| 549 | $result = tribune_add_post($node, $_POST['message']); |
| 550 | |
| 551 | if ($result['error']) { |
| 552 | // There is an error |
| 553 | header("HTTP/1.0 403 Forbidden"); |
| 554 | print "<div>". $result['error'] ."</div>"; |
| 555 | } |
| 556 | else if ($result['post']) { |
| 557 | header("X-Post-Id: ". $result['post']['tribune_post_id']); |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | exit(); |
| 562 | } |
| 563 | |
| 564 | function tribune_build_block($node, $history_size) { |
| 565 | $block = array(); |
| 566 | |
| 567 | drupal_add_css(drupal_get_path('module', 'tribune') .'/css/tribune.block.css'); |
| 568 | |
| 569 | $reload_delay = $node->tribune_settings['reload_delay'] * 1000; // in milliseconds |
| 570 | $message_order = $node->tribune_settings['posts_order'] ? 'top_to_bottom' : 'bottom_to_top'; |
| 571 | $last_load_time = time(); |
| 572 | |
| 573 | $tribune_id = 'tribune-block-'. $node->nid; |
| 574 | |
| 575 | drupal_add_js( |
| 576 | array( |
| 577 | "tribune" => array( |
| 578 | "tribunes" => array( |
| 579 | $tribune_id => array( |
| 580 | "history_size" => $history_size, |
| 581 | "reload_delay" => $reload_delay, |
| 582 | "last_load_time" => $last_load_time, |
| 583 | "message_order" => $message_order, |
| 584 | "block" => TRUE, |
| 585 | "path" => array( |
| 586 | "post" => url("node/". $node->nid ."/post"), |
| 587 | "json_post" => url("node/". $node->nid ."/post-json"), |
| 588 | "json_posts" => url("node/". $node->nid ."/newposts-json"), |
| 589 | "filters" => url("node/". $node->nid ."/filter"), |
| 590 | ), |
| 591 | ), |
| 592 | ), |
| 593 | ), |
| 594 | ), "setting"); |
| 595 | |
| 596 | drupal_add_js(drupal_get_path('module', 'tribune') .'/js/tribune.ajax.js'); |
| 597 | drupal_add_js('misc/jquery.form.js'); |
| 598 | |
| 599 | $posts = tribune_get_last_posts($node, $history_size); |
| 600 | |
| 601 | $block['subject'] = l($node->title, 'node/'. $node->nid); |
| 602 | $block['content'] = theme("tribune_block", $posts, $node, $tribune_id); |
| 603 | |
| 604 | return $block; |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * Show the last interventions in a block |
| 609 | * @param op the operation from the URL |
| 610 | * @param delta offset |
| 611 | * @returns block HTML |
| 612 | */ |
| 613 | function tribune_block($op = 'list', $delta = 0, $edit = array()) { |
| 614 | switch ($op) { |
| 615 | case 'list': |
| 616 | $num_blocks = 4; // yeah that's completely arbitrary |
| 617 | |
| 618 | //$block[1]["info"] = t("Tribune users"); |
| 619 | |
| 620 | for ($i = 0 ; $i < $num_blocks ; $i++) { |
| 621 | $block[$i]["info"] = t("Tribune block #".($i+1)); |
| 622 | } |
| 623 | |
| 624 | return $block; |
| 625 | break; |
| 626 | case 'configure': |
| 627 | $tribune_blocks = variable_get('tribune_blocks', array()); |
| 628 | |
| 629 | $form = array(); |
| 630 | $form['tribune_id'] = array( |
| 631 | '#type' => 'textfield', |
| 632 | '#title' => t('Tribune'), |
| 633 | '#description' => t('Which tribune to show in this block'), |
| 634 | '#default_value' => $tribune_blocks[$delta]['config_display'], |
| 635 | '#autocomplete_path' => 'tribune/autocomplete', |
| 636 | ); |
| 637 | |
| 638 | $form['history_size'] = array( |
| 639 | '#type' => 'textfield', |
| 640 | '#title' => t('Size'), |
| 641 | '#description' => t('How many posts to show in this block'), |
| 642 | '#default_value' => $tribune_blocks[$delta]['history_size'], |
| 643 | ); |
| 644 | |
| 645 | return $form; |
| 646 | break; |
| 647 | case 'save': |
| 648 | $tribune_id = substr($edit['tribune_id'], 0, strpos($edit['tribune_id'], ' ')); |
| 649 | $tribune_blocks = variable_get('tribune_blocks', array()); |
| 650 | $tribune_blocks[$delta]['nid'] = $tribune_id; |
| 651 | $tribune_blocks[$delta]['config_display'] = $tribune_id ? $edit['tribune_id'] : ''; |
| 652 | $tribune_blocks[$delta]['history_size'] = $edit['history_size']; |
| 653 | variable_set('tribune_blocks', $tribune_blocks); |
| 654 | break; |
| 655 | case 'view': |
| 656 | $tribune_blocks = variable_get('tribune_blocks', array()); |
| 657 | if ($tribune_blocks[$delta]['nid']) { |
| 658 | $node = node_load($tribune_blocks[$delta]['nid']); |
| 659 | if (tribune_access("view", $node)) { |
| 660 | return tribune_build_block($node, $tribune_blocks[$delta]['history_size']); |
| 661 | } |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | function theme_tribune_active_users($users, $node) { |
| 667 | $registered_users = array(); |
| 668 | |
| 669 | foreach ($users as $key => $data) { |
| 670 | $registered_users[] = (object)$data; |
| 671 | } |
| 672 | |
| 673 | return theme('user_list', $registered_users); |
| 674 | } |
| 675 | |
| 676 | function tribune_autocomplete($name) { |
| 677 | $tribunes = array(); |
| 678 | |
| 679 | if (tribune_access('view')) { |
| 680 | $result = db_query("SELECT nid, title FROM {node} WHERE type = 'tribune' AND (title LIKE '%%%s%%' or nid = %d)", $name, $name); |
| 681 | while ($row = db_fetch_array($result)) { |
| 682 | $display_string = t('@tribune_nid (@tribune_title)', array('@tribune_nid' => $row['nid'], '@tribune_title' => $row['title'])); |
| 683 | $tribunes[$display_string] = $display_string; |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | print drupal_to_js($tribunes); |
| 688 | exit(); |
| 689 | } |
| 690 | |
| 691 | function tribune_needs_migration() { |
| 692 | return db_result(db_query('SELECT COUNT(*) FROM {tribune} WHERE tribune_id = 0')); |
| 693 | } |
| 694 | |
| 695 | function tribune_menu() { |
| 696 | $items = array(); |
| 697 | |
| 698 | $items['admin/settings/tribune'] = array( |
| 699 | 'file' => "tribune.admin.inc", |
| 700 | 'title' => 'Tribune', |
| 701 | 'page callback' => 'drupal_get_form', |
| 702 | 'page arguments' => array('tribune_admin'), |
| 703 | 'access arguments' => array('administer site configuration'), |
| 704 | ); |
| 705 | |
| 706 | $items['admin/settings/tribune/settings'] = array( |
| 707 | 'file' => "tribune.admin.inc", |
| 708 | 'title' => 'Tribune settings', |
| 709 | 'page callback' => 'drupal_get_form', |
| 710 | 'page arguments' => array('tribune_admin'), |
| 711 | 'access arguments' => array('administer site configuration'), |
| 712 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 713 | 'weight' => 0, |
| 714 | ); |
| 715 | |
| 716 | $items['admin/settings/tribune/filters'] = array( |
| 717 | 'file' => "tribune.admin.filters.inc", |
| 718 | 'title' => 'Filters settings', |
| 719 | 'page callback' => 'tribune_admin_filters', |
| 720 | 'access arguments' => array('administer site configuration'), |
| 721 | 'type' => MENU_LOCAL_TASK, |
| 722 | 'weight' => 1, |
| 723 | ); |
| 724 | |
| 725 | $items['admin/settings/tribune/migration'] = array( |
| 726 | 'file' => "tribune.admin.inc", |
| 727 | 'title' => '1.x tribune migration', |
| 728 | 'page callback' => 'drupal_get_form', |
| 729 | 'page arguments' => array('tribune_admin_migration'), |
| 730 | 'access callback' => 'tribune_needs_migration', |
| 731 | 'access arguments' => array(), |
| 732 | 'type' => MENU_LOCAL_TASK, |
| 733 | 'weight' => 2, |
| 734 | ); |
| 735 | |
| 736 | $items['admin/settings/tribune/filters/settings/%'] = array( |
| 737 | 'file' => "tribune.admin.filters.inc", |
| 738 | 'title' => 'Filter settings', |
| 739 | 'page callback' => 'tribune_filter_settings', |
| 740 | 'page arguments' => array(NULL, 5), |
| 741 | 'access arguments' => array('administer site configuration'), |
| 742 | 'type' => MENU_LOCAL_TASK, |
| 743 | ); |
| 744 | |
| 745 | |
| 746 | $items['tribune/autocomplete/%'] = array( |
| 747 | 'title' => 'Tribune autocomplete', |
| 748 | 'page callback' => 'tribune_autocomplete', |
| 749 | 'page arguments' => array(2), |
| 750 | 'access arguments' => array('access content'), |
| 751 | 'type' => MENU_CALLBACK, |
| 752 | ); |
| 753 | |
| 754 | |
| 755 | /** |
| 756 | * pages associated to each tribune node |
| 757 | */ |
| 758 | |
| 759 | // JSON stuff |
| 760 | $items['node/%tribune/post-json/%'] = array( |
| 761 | 'file' => "tribune.json.inc", |
| 762 | 'page callback' => 'tribune_print_json_post', |
| 763 | 'page arguments' => array(3, 1), |
| 764 | 'access arguments' => array('read tribunes'), |
| 765 | 'type' => MENU_CALLBACK, |
| 766 | ); |
| 767 | $items['node/%tribune/newposts-json/%'] = array( |
| 768 | 'file' => "tribune.json.inc", |
| 769 | 'title' => 'Tribune', |
| 770 | 'page callback' => 'tribune_print_json_newposts', |
| 771 | 'page arguments' => array(3, 1), |
| 772 | 'access arguments' => array('read tribunes'), |
| 773 | 'type' => MENU_CALLBACK, |
| 774 | ); |
| 775 | |
| 776 | // moderation pages |
| 777 | $items['node/%tribune/moderation/delete/%'] = array( |
| 778 | 'file' => "tribune.moderation.inc", |
| 779 | 'page callback' => 'tribune_delete_post', |
| 780 | 'page arguments' => array(4, 1), |
| 781 | 'access callback' => 'tribune_access', |
| 782 | 'access arguments' => array('delete tribune post', 1), |
| 783 | 'type' => MENU_CALLBACK, |
| 784 | ); |
| 785 | $items['node/%tribune/moderation/undelete/%'] = array( |
| 786 | 'file' => "tribune.moderation.inc", |
| 787 | 'page callback' => 'tribune_undelete_post', |
| 788 | 'page arguments' => array(4, 1), |
| 789 | 'access callback' => 'tribune_access', |
| 790 | 'access arguments' => array('undelete tribune post', 1), |
| 791 | 'type' => MENU_CALLBACK, |
| 792 | ); |
| 793 | $items['node/%tribune/moderation'] = array( |
| 794 | 'file' => "tribune.moderation.inc", |
| 795 | 'title' => 'Moderation', |
| 796 | 'page callback' => 'drupal_get_form', |
| 797 | 'page arguments' => array('tribune_moderation_form', 1), |
| 798 | 'access callback' => 'tribune_access', |
| 799 | 'access arguments' => array('moderate tribune', 1), |
| 800 | 'type' => MENU_LOCAL_TASK, |
| 801 | ); |
| 802 | |
| 803 | // for AJAX and Coincoins |
| 804 | $items['node/%tribune/post'] = array( |
| 805 | 'title' => 'Post a message', |
| 806 | 'page callback' => 'tribune_post', |
| 807 | 'page arguments' => array(1), |
| 808 | 'access arguments' => array('post in tribunes'), |
| 809 | 'type' => MENU_CALLBACK, |
| 810 | ); |
| 811 | |
| 812 | // history pages |
| 813 | $items['node/%tribune/history'] = array( |
| 814 | 'file' => 'tribune.history.inc', |
| 815 | 'title' => 'History', |
| 816 | 'page callback' => 'tribune_history_page', |
| 817 | 'page arguments' => array(1), |
| 818 | 'access arguments' => array('view tribunes history'), |
| 819 | 'type' => MENU_LOCAL_TASK, |
| 820 | ); |
| 821 | $items['node/%tribune/history/%/%'] = array( |
| 822 | 'file' => 'tribune.history.inc', |
| 823 | 'title' => 'History', |
| 824 | 'page callback' => 'tribune_history_search', |
| 825 | 'page arguments' => array(1, 3, 4), |
| 826 | 'access arguments' => array('view tribunes history'), |
| 827 | 'type' => MENU_LOCAL_TASK, |
| 828 | ); |
| 829 | |
| 830 | // XML backends |
| 831 | $items['node/%tribune/tribune.xml'] = array( |
| 832 | 'file' => "tribune.backend.inc", |
| 833 | 'title' => 'Tribune backend', |
| 834 | 'page callback' => 'tribune_backend', |
| 835 | 'page arguments' => array(1, 'xml'), |
| 836 | 'access arguments' => array('read tribunes'), |
| 837 | 'type' => MENU_CALLBACK, |
| 838 | ); |
| 839 | $items['node/%tribune/tribune.rss'] = array( |
| 840 | 'file' => "tribune.backend.inc", |
| 841 | 'title' => 'Tribune RSS feed', |
| 842 | 'page callback' => 'tribune_backend', |
| 843 | 'page arguments' => array(1, 'rss'), |
| 844 | 'access arguments' => array('view tribunes rss feed'), |
| 845 | 'type' => MENU_CALLBACK, |
| 846 | ); |
| 847 | |
| 848 | // information/Coincoin configuration pages |
| 849 | $items['node/%tribune/info'] = array( |
| 850 | 'file' => "tribune.info.inc", |
| 851 | 'title' => 'Information', |
| 852 | 'page callback' => 'tribune_show_info', |
| 853 | 'page arguments' => array(1), |
| 854 | 'access arguments' => array('view tribunes information'), |
| 855 | 'type' => MENU_LOCAL_TASK, |
| 856 | ); |
| 857 | $items['node/%tribune/info/b2b.xml'] = array( |
| 858 | 'file' => "tribune.info.inc", |
| 859 | 'title' => 'b2b config', |
| 860 | 'page callback' => 'tribune_b2b_xml', |
| 861 | 'page arguments' => array(1), |
| 862 | 'access arguments' => array('view tribunes information'), |
| 863 | 'type' => MENU_CALLBACK, |
| 864 | ); |
| 865 | |
| 866 | // filters configuration |
| 867 | $items['node/%tribune/filters'] = array( |
| 868 | 'file' => "tribune.admin.filters.inc", |
| 869 | 'title' => 'Filters', |
| 870 | 'page callback' => 'tribune_admin_filters', |
| 871 | 'page arguments' => array(1), |
| 872 | 'access callback' => 'tribune_access', |
| 873 | 'access arguments' => array('configure own tribune filters', 1), |
| 874 | 'type' => MENU_LOCAL_TASK, |
| 875 | ); |
| 876 | $items['node/%tribune/filters/settings/%'] = array( |
| 877 | 'file' => "tribune.admin.filters.inc", |
| 878 | 'title' => 'Filter settings', |
| 879 | 'page callback' => 'tribune_filter_settings', |
| 880 | 'page arguments' => array(1, 4), |
| 881 | 'access arguments' => array('administer site configuration'), |
| 882 | 'type' => MENU_LOCAL_TASK, |
| 883 | ); |
| 884 | |
| 885 | // filters pages |
| 886 | $items['node/%tribune/filter/%'] = array( |
| 887 | 'title' => 'Filter page', |
| 888 | 'page callback' => 'tribune_filters_pages', |
| 889 | 'page arguments' => array(1, 3), |
| 890 | 'access arguments' => array('read tribunes'), |
| 891 | 'type' => MENU_CALLBACK, |
| 892 | ); |
| 893 | |
| 894 | return $items; |
| 895 | } |
| 896 | |
| 897 | function tribune_settings_form($form, $node = NULL) { |
| 898 | if ($node === NULL) { |
| 899 | global $tribune; |
| 900 | $node = $tribune; |
| 901 | } |
| 902 | |
| 903 | $form = system_settings_form($form); |
| 904 | |
| 905 | if ($node) { |
| 906 | $form['tribune_id'] = array( |
| 907 | '#type' => 'value', |
| 908 | '#value' => $node->nid, |
| 909 | ); |
| 910 | } |
| 911 | |
| 912 | $form['#submit'] = array('tribune_settings_form_submit'); |
| 913 | return $form; |
| 914 | } |
| 915 | |
| 916 | function tribune_settings_form_submit($form, &$form_state) { |
| 917 | $node = NULL; |
| 918 | if (isset($form_state['values']['tribune_id'])) { |
| 919 | $node = node_load($form_state['values']['tribune_id']); |
| 920 | } |
| 921 | |
| 922 | $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; |
| 923 | |
| 924 | // Exclude unnecessary elements. |
| 925 | unset($form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token'], $form_state['values']['form_build_id']); |
| 926 | |
| 927 | foreach ($form_state['values'] as $key => $value) { |
| 928 | if ($op == t('Reset to defaults')) { |
| 929 | tribune_variable_del($key, $node); |
| 930 | } |
| 931 | else { |
| 932 | if (is_array($value) && isset($form_state['values']['array_filter'])) { |
| 933 | $value = array_keys(array_filter($value)); |
| 934 | } |
| 935 | tribune_variable_set($key, $value, $node); |
| 936 | } |
| 937 | } |
| 938 | if ($op == t('Reset to defaults')) { |
| 939 | drupal_set_message(t('The configuration options have been reset to their default values.')); |
| 940 | } |
| 941 | else { |
| 942 | drupal_set_message(t('The configuration options have been saved.')); |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | function tribune_variable_get($name, $default_value, $node = NULL) { |
| 947 | global $tribune; |
| 948 | |
| 949 | if ($node === NULL and $tribune) { |
| 950 | $node = $tribune; |
| 951 | } else if ($node == 'global') { |
| 952 | $node = NULL; |
| 953 | } |
| 954 | |
| 955 | if ($node) { |
| 956 | $result = db_result(db_query('SELECT variables FROM {tribune_tribunes} WHERE nid = %d', $node->nid)); |
| 957 | $array = unserialize($result); |
| 958 | } else { |
| 959 | $array = variable_get('tribune_global_variables', array()); |
| 960 | } |
| 961 | |
| 962 | if ($array and isset($array[$name])) { |
| 963 | return $array[$name]; |
| 964 | } else { |
| 965 | if ($node) { |
| 966 | return tribune_variable_get($name, $default_value, 'global'); |
| 967 | } else { |
| 968 | return $default_value; |
| 969 | } |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | function tribune_variable_set($name, $value, $node = NULL) { |
| 974 | global $tribune; |
| 975 | |
| 976 | if ($node === NULL and $tribune) { |
| 977 | $node = $tribune; |
| 978 | } else if ($node == 'global') { |
| 979 | $node = NULL; |
| 980 | } |
| 981 | |
| 982 | if ($node) { |
| 983 | $result = db_result(db_query('SELECT variables FROM {tribune_tribunes} WHERE nid = %d', $node->nid)); |
| 984 | $array = unserialize($result); |
| 985 | } else { |
| 986 | $array = variable_get('tribune_global_variables', array()); |
| 987 | } |
| 988 | |
| 989 | if ($array) { |
| 990 | $array[$name] = $value; |
| 991 | } else { |
| 992 | $array = array($name => $value); |
| 993 | } |
| 994 | |
| 995 | if ($node) { |
| 996 | db_query('UPDATE {tribune_tribunes} SET variables = \'%s\' WHERE nid = %d', |
| 997 | serialize($array), $node->nid); |
| 998 | } else { |
| 999 | variable_set('tribune_global_variables', $array); |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | function tribune_variable_del($name, $node = NULL) { |
| 1004 | global $tribune; |
| 1005 | |
| 1006 | if ($node === NULL and $tribune) { |
| 1007 | $node = $tribune; |
| 1008 | } else if ($node == 'global') { |
| 1009 | $node = NULL; |
| 1010 | } |
| 1011 | |
| 1012 | if ($node) { |
| 1013 | $result = db_result(db_query('SELECT variables FROM {tribune_tribunes} WHERE nid = %d', $node->nid)); |
| 1014 | $array = unserialize($result); |
| 1015 | } else { |
| 1016 | $array = variable_get('tribune_global_variables', array()); |
| 1017 | } |
| 1018 | |
| 1019 | if ($array and isset($array[$name])) { |
| 1020 | unset($array[$name]); |
| 1021 | |
| 1022 | if ($node) { |
| 1023 | db_query('UPDATE {tribune_tribunes} SET variables = \'%s\' WHERE nid = %d', |
| 1024 | serialize($array), $node->nid); |
| 1025 | } else { |
| 1026 | variable_set('tribune_global_variables', $array); |
| 1027 | } |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | function tribune_set_option($tribune, $option, $value) { |
| 1032 | if (is_object($tribune)) { |
| 1033 | $tribune = $tribune->nid; |
| 1034 | } |
| 1035 | |
| 1036 | db_query("UPDATE {tribune_tribunes} |
| 1037 | SET `".$option."` = '%s' |
| 1038 | WHERE nid = %d", |
| 1039 | array( |
| 1040 | $value, |
| 1041 | $tribune, |
| 1042 | ) |
| 1043 | ); |
| 1044 | } |
| 1045 | |
| 1046 | function tribune_get_option($tribune, $option) { |
| 1047 | if (is_object($tribune)) { |
| 1048 | $tribune = $tribune->nid; |
| 1049 | } |
| 1050 | |
| 1051 | return db_result(db_query("SELECT `".$option."` |
| 1052 | FROM {tribune_tribunes} |
| 1053 | WHERE nid = %d", |
| 1054 | array( |
| 1055 | $tribune, |
| 1056 | ) |
| 1057 | )); |
| 1058 | } |
| 1059 | |
| 1060 | function tribune_filters_pages($node, $argument) { |
| 1061 | global $tribune; |
| 1062 | $tribune = $node; |
| 1063 | |
| 1064 | $filters = array(); |
| 1065 | |
| 1066 | if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { |
| 1067 | $enabled_filters = $node->tribune_settings['enabled_filters']; |
| 1068 | } else { |
| 1069 | $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); |
| 1070 | } |
| 1071 | foreach (_tribune_filter_files() as $filter_file) { |
| 1072 | $filter = $filter_file->name; |
| 1073 | |
| 1074 | if ($filter == $argument && isset ($enabled_filters[$filter]) and $enabled_filters[$filter]) { |
| 1075 | $func = 'tribune_'. $filter .'_page'; |
| 1076 | if (function_exists($func)) { |
| 1077 | return $func(); |
| 1078 | } |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | return FALSE; |
| 1083 | } |
| 1084 | |
| 1085 | function tribune_theme($existing, $type, $theme, $path) { |
| 1086 | return array( |
| 1087 | 'post_moderation' => array( |
| 1088 | 'arguments' => array('post' => NULL), |
| 1089 | ), |
| 1090 | 'post_time' => array( |
| 1091 | 'arguments' => array('post' => NULL), |
| 1092 | ), |
| 1093 | 'post_username' => array( |
| 1094 | 'arguments' => array('post' => NULL), |
| 1095 | ), |
| 1096 | 'post_message' => array( |
| 1097 | 'arguments' => array('post' => NULL), |
| 1098 | ), |
| 1099 | 'tribune_post' => array( |
| 1100 | 'arguments' => array('post' => NULL, 'node' => NULL), |
| 1101 | ), |
| 1102 | 'tribune_post_xml' => array( |
| 1103 | 'file' => "tribune.backend.inc", |
| 1104 | 'arguments' => array('post' => NULL, 'node' => NULL), |
| 1105 | ), |
| 1106 | 'tribune_post_rss' => array( |
| 1107 | 'file' => "tribune.backend.inc", |
| 1108 | 'arguments' => array('post' => NULL, 'node' => NULL), |
| 1109 | ), |
| 1110 | 'tribune_block' => array( |
| 1111 | 'arguments' => array('posts' => array(), 'node' => NULL, 'tribune_id' => 'tribune-block'), |
| 1112 | ), |
| 1113 | 'tribune_page' => array( |
| 1114 | 'arguments' => array('posts' => array(), 'node' => NULL, 'tribune_id' => 'tribune-page', 'top_message' => '', 'top_to_bottom' => TRUE), |
| 1115 | ), |
| 1116 | 'tribune_xml' => array( |
| 1117 | 'file' => "tribune.backend.inc", |
| 1118 | 'arguments' => array('posts' => array(), 'node' => NULL), |
| 1119 | ), |
| 1120 | 'tribune_rss' => array( |
| 1121 | 'file' => "tribune.backend.inc", |
| 1122 | 'arguments' => array('posts' => array(), |