bugfix système de commentaire

This commit is contained in:
Leblanc Simon 2008-10-16 20:11:14 +00:00
commit 43bd663cb3
3 changed files with 21 additions and 20 deletions

View file

@ -340,7 +340,7 @@ else if ( $_GET['action'] == 'topic') {
FROM FROM
'.$db->prefix.'topics AS t '.$db->prefix.'topics AS t
WHERE WHERE
t.subject="'.$_GET['ttitle'].'" t.subject="'.utf8_decode($_GET['ttitle']).'"
;'; ;';
@ -361,26 +361,26 @@ else if ( $_GET['action'] == 'topic') {
ORDER BY ORDER BY
p.edited 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)) $subject_truncated = $cur_post['message'];
{ if (pun_strlen($cur_post['message']) > $max_subject_length) {
if ($pun_config['o_censoring'] == '1') $subject_truncated = pun_htmlspecialchars(trim(substr($cur_post['message'], 0, ($max_subject_length-5)))).' …';
$cur_post['message'] = censor_words($cur_post['message']); } else {
$subject_truncated = pun_htmlspecialchars($cur_post['message']);
}
$subject_truncated = $cur_post['message']; echo '<li>'.$subject_truncated.'</li>';
if (pun_strlen($cur_post['message']) > $max_subject_length) {
$subject_truncated = pun_htmlspecialchars(trim(substr($cur_post['message'], 0, ($max_subject_length-5)))).' &hellip;';
} else {
$subject_truncated = pun_htmlspecialchars($cur_post['message']);
} }
} else {
echo '<li>'.$subject_truncated.'</li>'; // 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() );
} }
} }

View file

@ -41,7 +41,7 @@ $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
// Must ask for the topic title AND the forum id // Must ask for the topic title AND the forum id
// http://localhost/~nojhan/punbb/upload/post.php?ttitle=Strip-It&fid=1 // 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 != '') { if ($ttitle != '') {
// query a topic id on title match // query a topic id on title match
@ -67,7 +67,7 @@ if ($ttitle != '') {
$ids = $db->fetch_row($result); $ids = $db->fetch_row($result);
var_dump( $ids ); //var_dump( $ids );
// fetch only one value // fetch only one value
$_tid = intval( $ids[0] ); $_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 // the topic does not exists, but as a title is suggested, we put it in the entry field
$_POST['req_subject'] = $ttitle; $_POST['req_subject'] = $ttitle;
$subject = $ttitle;
} }
} }

View file

@ -423,7 +423,7 @@ class strip_manager
// if one want to use punbb as forum // if one want to use punbb as forum
if( $this->general->use_punbb ) { if( $this->general->use_punbb ) {
// lasts posts associated to the strip // 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) { if (!$fh) {
// TODO traduction // TODO traduction
@ -434,7 +434,7 @@ class strip_manager
} }
// link for posting a new comment // 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;
} }
} }