From 43bd663cb304d36dfbc69f5a58bb15fdbf9ac7bf Mon Sep 17 00:00:00 2001 From: Leblanc Simon Date: Thu, 16 Oct 2008 20:11:14 +0000 Subject: [PATCH] =?UTF-8?q?bugfix=20syst=C3=A8me=20de=20commentaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- punbb-1.2.15_extern.php | 32 ++++++++++++++++---------------- punbb-1.2.15_post.php | 5 +++-- strip_manager.php | 4 ++-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/punbb-1.2.15_extern.php b/punbb-1.2.15_extern.php index 4908265..c005de7 100644 --- a/punbb-1.2.15_extern.php +++ b/punbb-1.2.15_extern.php @@ -340,7 +340,7 @@ else if ( $_GET['action'] == 'topic') { FROM '.$db->prefix.'topics AS t WHERE - t.subject="'.$_GET['ttitle'].'" + t.subject="'.utf8_decode($_GET['ttitle']).'" ;'; @@ -361,26 +361,26 @@ else if ( $_GET['action'] == 'topic') { ORDER BY p.edited ;'; - } else { - error( 'Unable to fetch posts list, you must ask for a topic id or title', __FILE__, __LINE__, $db->error() ); - } + $result = $db->query($sql) or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error()); - $result = $db->query($sql) or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error()); + while ($cur_post = $db->fetch_assoc($result)) + { + if ($pun_config['o_censoring'] == '1') + $cur_post['message'] = censor_words($cur_post['message']); - while ($cur_post = $db->fetch_assoc($result)) - { - if ($pun_config['o_censoring'] == '1') - $cur_post['message'] = censor_words($cur_post['message']); + $subject_truncated = $cur_post['message']; + if (pun_strlen($cur_post['message']) > $max_subject_length) { + $subject_truncated = pun_htmlspecialchars(trim(substr($cur_post['message'], 0, ($max_subject_length-5)))).' …'; + } else { + $subject_truncated = pun_htmlspecialchars($cur_post['message']); + } - $subject_truncated = $cur_post['message']; - if (pun_strlen($cur_post['message']) > $max_subject_length) { - $subject_truncated = pun_htmlspecialchars(trim(substr($cur_post['message'], 0, ($max_subject_length-5)))).' …'; - } else { - $subject_truncated = pun_htmlspecialchars($cur_post['message']); + echo '
  • '.$subject_truncated.'
  • '; } - - echo '
  • '.$subject_truncated.'
  • '; + } else { + // No error for a nice show in strip-it :-) + //error( 'Unable to fetch posts list, you must ask for a topic id or title', __FILE__, __LINE__, $db->error() ); } } diff --git a/punbb-1.2.15_post.php b/punbb-1.2.15_post.php index 0fb2481..939cb38 100644 --- a/punbb-1.2.15_post.php +++ b/punbb-1.2.15_post.php @@ -41,7 +41,7 @@ $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; // Must ask for the topic title AND the forum id // http://localhost/~nojhan/punbb/upload/post.php?ttitle=Strip-It&fid=1 -$ttitle = isset($_GET['ttitle']) ? $_GET['ttitle'] : ''; +$ttitle = isset($_GET['ttitle']) ? utf8_decode($_GET['ttitle']) : ''; if ($ttitle != '') { // query a topic id on title match @@ -67,7 +67,7 @@ if ($ttitle != '') { $ids = $db->fetch_row($result); - var_dump( $ids ); + //var_dump( $ids ); // fetch only one value $_tid = intval( $ids[0] ); @@ -83,6 +83,7 @@ if ($ttitle != '') { // the topic does not exists, but as a title is suggested, we put it in the entry field $_POST['req_subject'] = $ttitle; + $subject = $ttitle; } } diff --git a/strip_manager.php b/strip_manager.php index 79811a4..602a464 100644 --- a/strip_manager.php +++ b/strip_manager.php @@ -423,7 +423,7 @@ 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&tid=1', 'r'); + $fh = fopen( $this->general->forum.'/extern.php?action=topic&ttitle='.urlencode($this->title), 'r'); if (!$fh) { // TODO traduction @@ -434,7 +434,7 @@ class strip_manager } // link for posting a new comment - $this->forum_post_url = $this->general->forum . '/post.php?ttitle='.$this->title.'&fid='.$this->general->punbb_forum_id; + $this->forum_post_url = $this->general->forum . '/post.php?ttitle='.urlencode($this->title).'&fid='.$this->general->punbb_forum_id; } }