Index: tribune.backend.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tribune/tribune.backend.inc,v retrieving revision 1.6.2.3 diff -u -r1.6.2.3 tribune.backend.inc --- tribune.backend.inc 17 Dec 2008 13:49:26 -0000 1.6.2.3 +++ tribune.backend.inc 30 May 2009 19:38:14 -0000 @@ -57,9 +57,9 @@ $contents = "\n"; $contents .= "\n"; $contents .= "\t\n"; - $contents .= "\t\t".variable_get("site_name", "")."\n"; - $contents .= "\t\t".url('node'. $node->nid, array('absolute' => TRUE))."\n"; - $contents .= "\t\t".variable_get("site_slogan", "")."\n"; + $contents .= "\t\t".t('Posts in "@title"', array('@title' => $node->title))."\n"; + $contents .= "\t\t".url('node/'. $node->nid, array('absolute' => TRUE))."\n"; + $contents .= "\t\t".strip_tags($node->body)."\n"; $posts = array_reverse($posts, TRUE); @@ -94,9 +94,12 @@ * @param post Array with the following keys : id, clock, login, info, message */ function theme_tribune_post_rss($post, $node) { + $timezone = variable_get('date_default_timezone', 0); $contents = "\t\t\n"; + $contents .= "\t\t\t". $post['tribune_post_id'] ."\n"; + $contents .= "\t\t\t".url('node/'. $node->nid, array('absolute' => TRUE))."\n"; $contents .= "\t\t\t". tribune_rss_slip($post['message'], $node) ."\n"; - $contents .= "\t\t\t". date('r', tribune_date_to_timestamp($post['post_time'])) ."\n"; + $contents .= "\t\t\t". date('r', tribune_date_to_timestamp($post['post_time'])+ $timezone) ."\n"; $contents .= "\t\t\t". tribune_rss_slip($post['login'], $node) ." <". tribune_rss_slip($post['login'], $node) ."@null>\n"; $contents .= "\t\t\n"; @@ -108,17 +111,6 @@ $string = tribune_sleep($string, $node->tribune_settings['max_message_size']); $string = preg_replace('#((https?|ftp|gopher|file|mms|rtsp|rtmp)://.*?)((,|\.|\)|\])?(<| | |"|$))#', '[url]\3', $string); - $replacements = array( - '' => '', - '' => '', - '' => '', - '' => '', - '' => '', - '' => '', - '' => '', - '' => '', - ); - $string = str_replace(array_keys($replacements), array_values($replacements), $string); $string = htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); return $string; Index: tribune.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tribune/tribune.module,v retrieving revision 1.159.2.19 diff -u -r1.159.2.19 tribune.module --- tribune.module 20 May 2009 15:50:15 -0000 1.159.2.19 +++ tribune.module 30 May 2009 19:37:56 -0000 @@ -125,7 +125,7 @@ $form['tribune_settings']['history_size'] = array( '#type' => 'textfield', '#title' => t('Number of comments displayed'), - '#default_value' => isset($node->tribune_settings['history_size']) ? $node->tribune_settings['history_size'] : 25, + '#default_value' => isset($node->tribune_settings['history_size']) ? $node->tribune_settings['history_size'] : 20, '#size' => 3, '#maxlength' => 4, '#description' => t('The number of comments to display.'), @@ -145,7 +145,7 @@ $form['tribune_settings']['rss_size'] = array( '#type' => 'textfield', '#title' => t('Number of comments displayed in the RSS feed'), - '#default_value' => isset($node->tribune_settings['rss_size']) ? $node->tribune_settings['rss_size'] : 50, + '#default_value' => isset($node->tribune_settings['rss_size']) ? $node->tribune_settings['rss_size'] : 30, '#size' => 3, '#maxlength' => 4, '#description' => t('The number of comments to display in the RSS feed.'), @@ -185,7 +185,7 @@ $form['tribune_settings']['posts_order'] = array( '#type' => 'radios', '#title' => t('Message order'), - '#default_value' => isset($node->tribune_settings['posts_order']) ? $node->tribune_settings['posts_order'] : 1, + '#default_value' => isset($node->tribune_settings['posts_order']) ? $node->tribune_settings['posts_order'] : 0, '#options' => array('1' => t("Last messages at the bottom"), '0' => t("Last messages at the top")), '#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.'), ); @@ -193,7 +193,7 @@ $form['tribune_settings']['show_pager'] = array( '#type' => 'checkbox', '#title' => t('Show pager'), - '#default_value' => isset($node->tribune_settings['show_pager']) ? $node->tribune_settings['show_pager'] : FALSE, + '#default_value' => isset($node->tribune_settings['show_pager']) ? $node->tribune_settings['show_pager'] : TRUE, '#description' => t('Show a pager (all posts will be accessible, instead of just the last ones).'), ); @@ -271,7 +271,7 @@ $node->tribune_settings['flood_protection_delay'], $node->tribune_settings['posts_order'], $node->tribune_settings['show_pager'], - serialize(array('totoz' => "totoz", "url" => "url")), + serialize(array("url" => "url")), serialize(array()), serialize(array()) ); @@ -319,6 +319,11 @@ drupal_add_css(drupal_get_path('module', 'tribune') .'/css/tribune.page.css'); + drupal_add_feed( + url('node/'. $node->nid.'/tribune.rss'), + 'tribune feed' + ); + $history_size = $node->tribune_settings['history_size']; $reload_delay = $node->tribune_settings['reload_delay'] * 1000; // in milliseconds $idle_delay = $node->tribune_settings['idle_delay'] * 1000; // in milliseconds @@ -488,7 +493,7 @@ if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { $enabled_filters = $node->tribune_settings['enabled_filters']; } else { - $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); + $enabled_filters = variable_get('tribune_enabled_filters', array("url" => "url")); } foreach (_tribune_filter_files() as $filter_file) { $filter = $filter_file->name; @@ -534,7 +539,7 @@ if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { $enabled_filters = $node->tribune_settings['enabled_filters']; } else { - $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); + $enabled_filters = variable_get('tribune_enabled_filters', array("url" => "url")); } foreach (_tribune_filter_files() as $filter_file) { $filter = $filter_file->name; @@ -1183,7 +1188,7 @@ if (user_access("configure own tribune filters", user_load($node->uid)) and is_array($node->tribune_settings['enabled_filters'])) { $enabled_filters = $node->tribune_settings['enabled_filters']; } else { - $enabled_filters = variable_get('tribune_enabled_filters', array('totoz' => "totoz", "url" => "url")); + $enabled_filters = variable_get('tribune_enabled_filters', array("url" => "url")); } foreach (_tribune_filter_files() as $filter_file) { $filter = $filter_file->name; @@ -1619,7 +1624,13 @@ $minute = str_pad($match[5], 2, '0', STR_PAD_LEFT); $second = str_pad($match[7], 2, '0', STR_PAD_LEFT); - $timezone = variable_get('date_default_timezone', 0); + global $user; + if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + $timezone = $user->timezone; + } + else { + $timezone = variable_get('date_default_timezone', 0); + } $datetime = mktime($hour, $minute, $second) - $timezone; $hour = date('H', $datetime); $minute = date('i', $datetime); @@ -1676,7 +1687,7 @@ $posts = implode("|", tribune_get_posts_from_clock($clock)); - return $space ."". $clock .""; + return $space ."". $_tribune_current_post_id .""; } @@ -1896,9 +1907,9 @@ $description .= ''; $description .= '
'; - $description .= t('You can format your message using some HTML tags. ' - .'The allowed tags are <i>, <b>, ' - .'<u>, <s> and <tt>'); + $description .= t('You can format your message using BBCode. ' + .'The allowed tags are [i], [b] + [u], [s] and [code]'); $description .= '
'; $description .= '
'; @@ -1959,7 +1970,7 @@ $form['submit'] = array( '#type' => 'submit', - '#value' => t('Post'), + '#value' => '+', '#suffix' => ' '. t(', ); @@ -2308,7 +2319,13 @@ * Convert the timezone of a YYYYMMDDHHMMSS date */ function tribune_date_to_localdate($date) { - $timezone = variable_get('date_default_timezone', 0); + global $user; + if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + $timezone = $user->timezone; + } + else { + $timezone = variable_get('date_default_timezone', 0); + } $timestamp = tribune_date_to_timestamp($date) + $timezone; return date('YmdHis', $timestamp); } Index: tribune.sleep.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tribune/tribune.sleep.inc,v retrieving revision 1.3 diff -u -r1.3 tribune.sleep.inc --- tribune.sleep.inc 3 Nov 2008 20:50:39 -0000 1.3 +++ tribune.sleep.inc 30 May 2009 19:38:16 -0000 @@ -39,47 +39,25 @@ function tribune_sleep($message, $length = -1) { $message = str_clean($message, $length); - $message = preg_replace_callback(':<(m|s|u|b|i|tt)>(.*?):', 'tribune_sleep_replace', $message); - $replacement = array( - "&" => "&", - "<" => "<", - ">" => ">", - "'" => "'", - '"' => """, - chr(26) => "<", - chr(27) => ">", - chr(28) => "'", - chr(29) => '"', + '&' => '&', + '<' => '<', + '>' => '>', + "'" => ''', + '"' => '"', + '[b]' => '', + '[/b]' => '', + '[i]' => '', + '[/i]' => '', + '[s]' => '', + '[/s]' => '', + '[u]' => '', + '[/u]' => '', + '[code]' => '', + '[/code]' => '', ); $message = str_replace(array_keys($replacement), array_values($replacement), $message); return $message; } - -function tribune_sleep_replace($matches) { - $text = preg_replace_callback(':<(m|s|u|b|i|tt)>(.*?):', 'tribune_sleep_replace', $matches[2]); - if ($matches[1] == 'm') { - $start = "====> ". chr(26) ."b". chr(27) ."Moment "; - $stop = chr(26) ."/b". chr(27) ." <===="; - } - else { - $start = chr(26) . $matches[1] . chr(27); - $stop = chr(26) ."/". $matches[1] . chr(27); - } - return $start . $text . $stop; -} - -function tribune_sleep_mother($matches) { - $text = preg_replace_callback(':<(m|s|u|b|i|tt)>([^'. chr(26) .']*)(.*)$:', 'tribune_sleep_mother', $matches[2]); - if ($matches[1] == 'm') { - $start = "====> ". chr(26) ."b". chr(27) ."Moment "; - $stop = chr(26) ."/b". chr(27) ." <===="; - } - else { - $start = chr(26) . $matches[1] . chr(27); - $stop = chr(26) ."/". $matches[1] . chr(27); - } - return $start . $text . $stop . $matches[3]; -}