4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: dosensteck on November 06, 2007, 09:33:46 PM

Title: Request: Quote Comments
Post by: dosensteck on November 06, 2007, 09:33:46 PM
I need a quote function for Comments.

Quote
Original posted by xxxx
Text

Found no Mods :(


Title: Re: Request: Quote Comments
Post by: mawenzi on November 06, 2007, 10:01:47 PM
@dosensteck,

... das solltest du in v@nos MOD für den erweiterten BB-Code finden ...
... ich denke hier ... http://www.4homepages.de/forum/index.php?topic=4745.msg20105#msg20105 ...
Title: Re: Request: Quote Comments
Post by: dosensteck on November 07, 2007, 07:38:49 PM
Danke für den Tipp - quote funktion funktioniert bei den kommentaren schon


ich meinte eher das man auf ein kommentar klickt (Quote Button) und das dann im Textfeld innerhalb der [ quote] tags der Kommentar steht

Wie gesagt, gefunden habe ich leider nichts.
Title: Re: Request: Quote Comments
Post by: Loda on November 08, 2007, 09:24:03 AM
vielleicht so:
 :arrow: finde in der details.php:
Code: [Select]
"admin_links" => $admin_links
ersetze mit:
Code: [Select]
"admin_links" => $admin_links,
        "comment_quote" => "<a href=\"".$site_sess->url($self_url."&quote=".$comment_row[$i]['comment_id'])."#commentform\">[Zitat]</a>&nbsp;"

 :arrow: dann finde:
Code: [Select]
    $site_template->register_vars(array(
      "bbcode" => $bbcode,

füge davor dieses ein:
Code: [Select]
$comment_quote_id = (isset($HTTP_GET_VARS['quote'])) ? $HTTP_GET_VARS['quote'] : $HTTP_POST_VARS['quote'];
if (intval($comment_quote_id)) {
  $sql = "SELECT c.comment_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.comment_id = $comment_quote_id";
  $result = $site_db->query_firstrow($sql);
    $comment_text = (isset($HTTP_POST_VARS['message']) && $error) ? stripslashes(trim($HTTP_POST_VARS['message'])) : "";
      $comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? stripslashes(trim($HTTP_POST_VARS['subject'])) : "";
   if ($result['comment_text']) {
      $comment_text .= "[quote=".$result['comment_user_name']."]".$result['comment_text']."[/quote]";
   }
   if ($result['comment_headline']) {
      $comment_headline .= "RE: ".$result['comment_headline'];
   }
}
    $user_name = (isset($HTTP_POST_VARS['username']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['username']))) : (($user_info['user_level'] != GUEST) ? htmlspecialchars($user_info['user_name']) : "");
//    $comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['subject']))) : "";

:arrow: dann in deiner comment_bit.html füge irgendwo das ein:
Code: [Select]
{comment_quote}
das war alles.. sollte es so sein?
Title: Re: Request: Quote Comments
Post by: dosensteck on November 08, 2007, 06:53:01 PM
wahnsinn - perfekt!

Tausend dank.

Ich hab bei mir nur die [quote= funktion rausgenommen. Hab die Integration mit phpbb installiert und da schreibt er bei der user_name spalte nichts in den comment table.
Hab mich jetzt zwar ein wenig mit der abfrage gespielt und versucht irgendwie den username aus der usertabele zu bekommen... hat aber nicht funktioniert...
Title: Re: Request: Quote Comments
Post by: thunderstrike on November 08, 2007, 07:08:49 PM
Change:

Quote
$comment_quote_id = (isset($HTTP_GET_VARS['quote'])) ? $HTTP_GET_VARS['quote'] : $HTTP_POST_VARS['quote'];

for:

Code: [Select]
$comment_quote_id = (isset($HTTP_GET_VARS['quote'])) ? intval(trim($HTTP_GET_VARS['quote'])) : intval(trim($HTTP_POST_VARS['quote']));

change:

Quote
$comment_text = (isset($HTTP_POST_VARS['message']) && $error) ? stripslashes(trim($HTTP_POST_VARS['message'])) : "";
$comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? stripslashes(trim($HTTP_POST_VARS['subject'])) : "";

for:

Code: [Select]
$comment_text = (isset($HTTP_POST_VARS['message']) && $error) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['message'])) : "";
$comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['subject'])) : "";

Change:

Quote
".$result['comment_user_name']."

for:

Code: [Select]
".format_text(trim($result['comment_user_name']), 2)."

Change:

Quote
".$result['comment_text']."

for:

Code: [Select]
".format_text(trim($result['comment_text']), 1, 0, 1)."

Change:

Quote
$comment_headline .= "RE: ".$result['comment_headline'];

for:

Code: [Select]
$comment_headline .= "RE: ".format_text(trim($result['comment_headline']), 2);

Change:

Quote
$user_name = (isset($HTTP_POST_VARS['username']) && $error) ? format_text(stripslashes(trim($HTTP_POST_VARS['username']), 2)) : (($user_info['user_level'] != GUEST) ? format_text(trim($user_info['user_name']), 2) : "");
//    $comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? stripslashes(htmlspecialchars(trim($HTTP_POST_VARS['subject']))) : "";

for:

Code: [Select]
$user_name = (isset($HTTP_POST_VARS['username']) && $error) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['username'])) : (($user_info['user_level'] != GUEST) ? format_text(trim($user_info['user_name']), 2) : "");
$user_name = preg_replace("/[^a-z0-9_-]+/i", "", $user_name);
$user_name = (isset($HTTP_POST_VARS['username']) && !empty($HTTP_POST_VARS['username']) && isset($user_name) && !empty($user_name)) ? format_text(trim($user_name), 2) : "";
//    $comment_headline = (isset($HTTP_POST_VARS['subject']) && $error) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['subject'])) : "";
Title: Re: Request: Quote Comments
Post by: dosensteck on November 09, 2007, 01:22:42 AM
@thunderstrike: much <br> in quote tag and no username...

thx for try
Title: Re: Request: Quote Comments
Post by: thunderstrike on November 09, 2007, 01:24:23 AM
<br> ? ... I no set code for BR in my post ...
If no user name, what is version of 4images use ?
Title: Re: Request: Quote Comments
Post by: dosensteck on November 09, 2007, 01:42:03 PM
result with your code:
Code: [Select]
[quote=]
<br>text
<br>text
<br>text
<br>text
<br>text
[/quote]
version is 1.7.3 with posted bug fixes

i have installed the integration with phpbb - in my comments_table the comment_user_name is empty. I only have usernames in phpbb_users table.
Title: Re: Request: Quote Comments
Post by: thunderstrike on November 09, 2007, 01:47:47 PM
Ohh ok so if no need BR for this -

change:

Quote
".format_text(trim($result['comment_text']), 1, 0, 1)."

for:

Code: [Select]
".format_text($result['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'])."