diff --git a/conf/configuration-dist.php b/conf/configuration-dist.php index 69480a9..7d93137 100644 --- a/conf/configuration-dist.php +++ b/conf/configuration-dist.php @@ -71,6 +71,11 @@ class configuration */ var $punbb_wotd_id = '1'; + /** + * PunBB's forum max length for the message + */ + var $punbb_max_length = 60; + /** * Additional URL */ diff --git a/conf/lang/en-EN.php b/conf/lang/en-EN.php index 6ce7166..d5638f2 100644 --- a/conf/lang/en-EN.php +++ b/conf/lang/en-EN.php @@ -18,6 +18,7 @@ class language var $see_also = "See also:"; var $forum ="Forum"; var $forum_new = "New"; + var $forum_view = "Show the topic"; var $forum_error = "Cannot read comments"; var $comments = "Comments"; var $wotd = "Word of the day"; diff --git a/conf/lang/fr-FR.php b/conf/lang/fr-FR.php index ce877b5..e6168f1 100644 --- a/conf/lang/fr-FR.php +++ b/conf/lang/fr-FR.php @@ -18,6 +18,7 @@ class language var $see_also = "Voir aussi :"; var $forum = "Forum"; var $forum_new = "Nouveau"; + var $forum_view = "Voir le sujet"; var $forum_error = "Impossible de lire les commentaires"; var $comments = "Commentaires"; var $wotd = "Dernier message du webmaster"; diff --git a/punbb-1.2.15_extern.php b/punbb-1.2.15_extern.php index c005de7..606e3dd 100644 --- a/punbb-1.2.15_extern.php +++ b/punbb-1.2.15_extern.php @@ -129,13 +129,13 @@ require PUN_ROOT.'include/functions.php'; // Load DB abstraction layer and try to connect require PUN_ROOT.'include/dblayer/common_db.php'; -// Load cached config -@include PUN_ROOT.'cache/cache_config.php'; -if (!defined('PUN_CONFIG_LOADED')) -{ - require PUN_ROOT.'include/cache.php'; - generate_config_cache(); - require PUN_ROOT.'cache/cache_config.php'; +// Load cached config +@include PUN_ROOT.'cache/cache_config.php'; +if (!defined('PUN_CONFIG_LOADED')) +{ + require PUN_ROOT.'include/cache.php'; + generate_config_cache(); + require PUN_ROOT.'cache/cache_config.php'; } // Make sure we (guests) have permission to read the forums @@ -363,6 +363,10 @@ else if ( $_GET['action'] == 'topic') { ;'; $result = $db->query($sql) or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error()); + + if (isset($_GET['max_subject_length']) && is_numeric($_GET['max_subject_length']) && !empty($_GET['max_subject_length'])) { + $max_subject_length = $_GET['max_subject_length']; + } while ($cur_post = $db->fetch_assoc($result)) { diff --git a/punbb-1.2.15_redirect_stripit.php b/punbb-1.2.15_redirect_stripit.php new file mode 100644 index 0000000..2a6b80a --- /dev/null +++ b/punbb-1.2.15_redirect_stripit.php @@ -0,0 +1,91 @@ +query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); +if ($db->result($result) == '0') + exit('No permission'); + + +// Attempt to load the common language file +@include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php'; +if (!isset($lang_common)) + exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.'); + +// Check if we are to display a maintenance message +if ($pun_config['o_maintenance'] && !defined('PUN_TURN_OFF_MAINT')) + maintenance_message(); + +if (!isset($_GET['ttitle'])) + exit('No parameters supplied. See redirect_stripit.php for instructions.'); + + +$sql = 'SELECT t.id + FROM '.$db->prefix.'topics AS t + WHERE t.subject="'.utf8_decode($_GET['ttitle']).'";'; + +$res = $db->query( $sql ); + +if ($res != false && $db->num_rows($res) > 0) { + $_tid = $db->fetch_row( $res ); + $tid = intval( $_tid[0] ); +} else { + $tid = 0; +} + +if( $tid > 0 ) { + header('Location: viewtopic.php?id='.$tid); +} else { + header('Location: index.php'); +} +exit; \ No newline at end of file diff --git a/strip_manager.php b/strip_manager.php index 602a464..8661fdd 100644 --- a/strip_manager.php +++ b/strip_manager.php @@ -423,19 +423,19 @@ class strip_manager // if one want to use punbb as forum if( $this->general->use_punbb ) { // lasts posts associated to the strip - $fh = fopen( $this->general->forum.'/extern.php?action=topic&ttitle='.urlencode($this->title), 'r'); + $fh = fopen( $this->general->forum.'/extern.php?action=topic&ttitle='.urlencode($this->title).'&max_subject_length='.$this->general->punbb_max_length, 'r'); if (!$fh) { // TODO traduction $this->comments = $this->lang->forum_error; } else { - $this->comments = stream_get_contents($fh); + $this->comments = utf8_encode(stream_get_contents($fh)); fclose($fh); } // link for posting a new comment $this->forum_post_url = $this->general->forum . '/post.php?ttitle='.urlencode($this->title).'&fid='.$this->general->punbb_forum_id; - + $this->forum_view_url = $this->general->forum . '/redirect_stripit.php?ttitle='.urlencode($this->title); } } diff --git a/template/lego/template.html b/template/lego/template.html index 86bc4bf..7ddf021 100644 --- a/template/lego/template.html +++ b/template/lego/template.html @@ -70,7 +70,8 @@