4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Rembrandt on June 09, 2011, 09:30:35 PM

Title: [Mod] Quote Comments
Post by: Rembrandt on June 09, 2011, 09:30:35 PM
Hi!

This Modification will allow comments to cite.

1.) search in root/details.php:

if ($image_allow_comments == 1) {

insert below:

//##################### Start Quote Comments ###########################################
function parse_quote($matches) {
  global $lang;
  $bbcode = '';
  preg_match_all('/(\w*?)=\'(.*?)\'/msi', $matches[1], $attr_matches);
  $attributes = array_combine($attr_matches[1], $attr_matches[2]);
  if(!empty($attributes)){
    $width=100;
    $attribute_strings = array();
    foreach($attributes as $key => $value){
      $width -= 2;
      switch($key){
        case 'name':
          $attribute_strings[] = ''.$lang['comment_quote'].': <a href="#comment'.$attributes['id'].'">'.$value.'</a>';
        break;
        case 'timestamp':
          $attribute_strings[] = ''.$lang['comment_at'].' '.$value;
        break;            
      }        
    }
    $citation = '<span class="quote_name">'.implode(' ', $attribute_strings).'</span>'."\n";
  }
  else{        
    $citation = '';
  }      
  return $citation.'<div class="quote_text" style="width:'.$width.'%;">';
}
//##################### End Quote Comments ###########################################

1.1) search:

      $site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],

insert above:

//##################### Start Quote Comments ########################################    
      $quote_string[$i] = str_replace('[/quote]', '</div>', $comment_row[$i]['comment_text']);
      $comment_text_quote[$i] =  preg_replace_callback('/\[quote(.*?)\]/msi','parse_quote', $quote_string[$i]);
//##################### End Quote Comments ###########################################  

1.2) search:

"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),

replace:

 //##################### Start Quote Comments ########################################
      //"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        "lang_comment_reply" => $lang['comment_reply'],
        "lang_comment_quoting" => $lang['comment_quoting'],
        "lang_comment_quote" => $lang['comment_quote'],
        "allow_posting" => check_permission("auth_postcomment", $cat_id) ? 1:0,
        "comment_text" => ($config['html_comments']) ? format_text($comment_text_quote[$i], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']) : nl2br(trim($comment_text_quote[$i])),
        "comment_text_quote" => $comment_row[$i]['comment_text'],
 //##################### End Quote Comments ##########################################  

1.3) search:

if (!$allow_posting) {

insert above:

//##################### Start Quote Comments ########################################  
  $allow_posting = ($error) ?  $allow_posting :  0;
  $user_comment_quote ="";
if ($action == "post_quote") {
  $allow_posting = check_permission("auth_postcomment", $cat_id);

  $comment_user_name_quote = (isset($HTTP_POST_VARS['comment_user_name_quote'])) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_user_name_quote'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
  $comment_id_quote = (isset($HTTP_POST_VARS['comment_id_quote'])) ? intval($HTTP_POST_VARS['comment_id_quote']) : "";
  $comment_text_quote = (isset($HTTP_POST_VARS['comment_text_quote'])) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text_quote'])), 2) : "";
  $comment_date_quote = (isset($HTTP_POST_VARS['comment_date_quote'])) ? ($HTTP_POST_VARS['comment_date_quote']) : "";
  $user_comment_quote = stripslashes("[quote name='$comment_user_name_quote' id='$comment_id_quote' timestamp='$comment_date_quote']".$comment_text_quote."[/quote]");
}

if ($action == "post_comment") {
  $allow_posting = check_permission("auth_postcomment", $cat_id);
}
//##################### End Quote Comments ##########################################

1.4) search:

"comment_text" => $comment_text,

replace:

//##################### Start Quote Comments #################################      
      "comment_text" => ($error) ? $comment_text : $user_comment_quote,
//##################### End Quote Comments ###################################

1.5) search:

"msg" => $msg,

insert below:

  "lang_comment_reply" => $lang['comment_reply'],


2.)  search in lang/yourLang/main.php "?>" and insert above:
(deutsch)

$lang['comment_quoting'] = "Zitieren";
$lang['comment_quote'] = "Zitat von";
$lang['comment_reply'] = "Antworten";
$lang['comment_at'] = "am";

(english)

$lang['comment_quoting'] = "Quoting";
$lang['comment_quote'] = "Quote from";
$lang['comment_reply'] = "Reply";
$lang['comment_at'] = "at";


3.) search in templates/your template/details.html:
Code: [Select]
{if allow_comments}
<a name="comments"></a>
<br />
insert below:
Code: [Select]
                 {if allow_posting}
                   <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                    <tr>
                      <td align="right">
                        <form style="margin:0px;padding:0px;" name="quoteform" action="{self}&name=#comment_post_quote" method="post" onsubmit="reply_button.disabled=true;">
                          <input type="hidden" name="action" value="post_comment" >
                          <input type="submit" name="reply_button" value="{lang_comment_reply}" class="button">
                        </form>
                      </td>
                    </tr>
                  </table>
                  <br>
                  {endif allow_posting}
3.1) search:
Code: [Select]
{comment_form}
insert above:
Code: [Select]
                 {if allow_posting}
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                    <tr>
                      <td align="right">
                        <form style="margin:0px;padding:0px;" name="quoteform" action="{self}&name=#comment_post_quote" method="post" onsubmit="reply_button.disabled=true;">
                          <input type="hidden" name="action" value="post_comment" >
                          <input type="submit" name="reply_button" value="{lang_comment_reply}" class="button">
                        </form>
                      </td>
                    </tr>
                  </table>
                  <br>
                 {endif allow_posting}

4.)  search in templates/your template/comment_bit.html, or download from attachment:
Code: [Select]
<td class="commentrow{row_bg_number}" valign="top" nowrap="nowrap">
replace:
Code: [Select]
<td width="100%" class="commentrow{row_bg_number}" valign="top" colspan="3">
4.1) search:
Code: [Select]
</tr>
<tr>
  <td colspan="2" class="commentspacerrow"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
</tr>
replace:
Code: [Select]
 {if allow_posting}
  <td class="commentrow{row_bg_number}">
    <form style="margin:0px;padding:0px;" name="quoteform" action="{self}&name=#comment_post_quote" method="post" onsubmit="quote_button.disabled=true;">
      <input type="hidden" name="action" value="post_quote">
      <input type="hidden" name="comment_user_name_quote" value="{comment_user_name}">
      <input type="hidden" name="comment_id_quote" value="{comment_id}">
      <input type="hidden" name="comment_date_quote" value="{comment_date}">
      <input type="hidden" name="comment_text_quote" value="{comment_text_quote}">
      <input type="submit" name="quote_button" value="{lang_comment_quoting}" class="button">
    </form>
  </td>
  {endif allow_posting}
  {ifno allow_posting}
  {endifno allow_posting}
</tr>
<tr>
  <td colspan="4" class="commentspacerrow"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
</tr>

5.) search in templates/your template/comment_form.html:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
insert above:
Code: [Select]
<a name="comment_post_quote"></a>
5.1) search:
Code: [Select]
<input type="submit" name="postbutton" value="{lang_post_comment}" class="button" />
insert above:
Code: [Select]
<input type="hidden" name="comment_text_quote" value="{comment_text}">

6.)  add at end of file templates/your template/style.css:
Code: [Select]
.quote_name{
  margin:0px 5px;
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  font-size: 10px;
  font-weight: normal;
}

.quote_text{
  margin:2px 5px;
  padding:0px 5px;
  font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
  font-size: 11px;
  border:solid 1px black;
  background-color:#f9f9f9;
  line-height:16px;
}


mfg Andi
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on July 17, 2011, 10:17:18 PM
Hallo Andi,

habe alles so gemacht wie hier beschrieben. Nur sieht es so bei mir aus. SIEHE BILD!
Wo könnte da der Fehler sein? Und ich muss bein zitieren eine überschrift angeben. Kann man diese nich weg lassen?

Gruß Ronny

INFO: Also wenn man keinen Plan von dem Zeuchs hat, ist das echt schwer. Habe aber das Probs gelöst. Habe in der comment_bit.html etwas geändert. Jetzt sieht es ganz okay aus.
Title: Re: [Mod] Quote Comments
Post by: Rembrandt on July 18, 2011, 05:40:15 AM
.. Und ich muss bein zitieren eine überschrift angeben. Kann man diese nich weg lassen?
das ist standard, hat ja nicht mit dem Mod zu tun, aber du kannst das entfernen:
http://www.4homepages.de/forum/index.php?topic=29834

...
Also wenn man keinen Plan von dem Zeuchs hat, ist das echt schwer. Habe aber das Probs gelöst. Habe in der comment_bit.html etwas geändert. Jetzt sieht es ganz okay aus.
sieht schlimm aus  :mrgreen: aber wird schon werden.
mein erster Kontakt mit php und html war auch nicht besser.  8O
 
so,... als alternative habe ich im ersten Post eine "comment_bit.html" hochgeladen (attachment), dort kannst du sie dir runterladen und mit deiner ersetzen, versuche es einmal.

mfg Andi
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on July 18, 2011, 10:11:43 AM
Hallo Anti,

besten Dank! Jetzt sieht es viel besser aus. Freut mich!  :)

Mal sehen mit welchen Problemchen ich noch kommen werde. Ich hoffe nur das ich keinen Nerve. Bis jetzt hab ich ja schon viel
selbst gefunden. Gut das es dieses Forum gibt.  :thumbup:

Schöne Grüße
Ronny
Title: Re: [Mod] Quote Comments
Post by: Rembrandt on July 18, 2011, 11:17:16 AM
...Mal sehen mit welchen Problemchen ich noch kommen werde. Ich hoffe nur das ich keinen Nerve. ..
du nervst hier niemanden mit deinen Fragen, dazu ist ja ein Forum da (zum Nerven..)  :mrgreen:

mfg Andi
Title: Re: [Mod] Quote Comments
Post by: bma2004 on July 19, 2011, 09:23:18 AM
Great mod.
And how would it relate [MOD]AJAX COMMENTS?
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on March 01, 2013, 12:13:38 PM
hi andi,

kurze frage :?: wie bekomme ich den ersten antwort button über den kommentarfeld weg? der untere reicht eigentlich! habs schon versucht,
will aber nicht so recht klappen.  :roll:

danke!  :wink:

gruß ronny


PS: HAB ES GEFUNDEN! in der der deteil.html schritt 3.) nicht ausführen, bzw wieder löschen.


MIST! jetzt habe ich einen anderen fehler gefunden. beim zitieren stimmt was nicht. habe zwei bilder reingestellt. dort sieht man die fehler.
BILD 1 bei Zitieren steht darüber der Text. Bild 2 da steht neben Kommentar posten Name&quote. was nun?
                  
Title: Re: [Mod] Quote Comments
Post by: Rembrandt on March 01, 2013, 08:45:57 PM
..... was nun?                  

ka. wenn du es so einbaust wie ich es beschrieben habe wird es funktionieren, wenn du danach etwas falsches rauslöscht mußt du schauen wo der Fehler ist.
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on March 01, 2013, 09:35:47 PM
..... was nun?                  

ka. wenn du es so einbaust wie ich es beschrieben habe wird es funktionieren, wenn du danach etwas falsches rauslöscht mußt du schauen wo der Fehler ist.

ich such schon alles durch. alle schritte die ich bis dahin gemacht habe kann ich nur abarbeiten. ist bestimmt nur ein kleiner mistiger fehler.
ich weis ja das der MOD funzt. ist ja im alten 4images gelaufen, bis der server wechsel nicht geklappt un ich keine bilder mehr hochladen kann. deswegen bau ich neu auf, und dann das  :cry:

danke das du mal drauf geschaut hast!  :wink:

gruß ronny
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on March 02, 2013, 11:41:45 PM
Hi Andi,

habe lange gesucht, und habe hier
Code: [Select]
//##################### Start Quote Comments ########################################  
  $allow_posting = ($error) ?  $allow_posting :  0;
  $user_comment_quote ="";
if ($action == "post_quote") {
  $allow_posting = check_permission("auth_postcomment", $cat_id);

  $comment_user_name_quote = (isset($HTTP_POST_VARS['comment_user_name_quote'])) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_user_name_quote'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
  $comment_id_quote = (isset($HTTP_POST_VARS['comment_id_quote'])) ? intval($HTTP_POST_VARS['comment_id_quote']) : "";
  $comment_text_quote = (isset($HTTP_POST_VARS['comment_text_quote'])) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text_quote'])), 2) : "";
  $comment_date_quote = (isset($HTTP_POST_VARS['comment_date_quote'])) ? ($HTTP_POST_VARS['comment_date_quote']) : "";
  $user_comment_quote = stripslashes("[quote name='$comment_user_name_quote' id='$comment_id_quote' timestamp='$comment_date_quote']".$comment_text_quote."[/quote]");
}

if ($action == "post_comment") {
  $allow_posting = check_permission("auth_postcomment", $cat_id);
}
//##################### End Quote Comments ##########################################
in zeile 11 am schluss steht .$comment_text_quote."[/quote]");  in folgendes umgeändert "[quote/]".
jetzt ist der fehler weg und es sieht ganz normal aus. die users bekommen auch die nachricht. DAFÜR habe ich nun folende meldung im oberen bereich (über bild) der galerie mit der ich nichts anfangen kann.

diese hier: Warning: arry_combine() [funktion.arry-combine]: Both parameters should have a least 1 element in /www/htdocs/w*******/galerie/details.php on line 371

und in zeile 371 der deteils.php ist das drin: $attributes = array_combine($attr_matches[1], $attr_matches[2]);

gruß ronny



Title: Re: [Mod] Quote Comments
Post by: Rembrandt on March 03, 2013, 05:30:47 AM
Was soll ich dazu sagen das ist ganz einfach falsch:
Code: [Select]
[quote/]
Meiner Meinung nach liegt der Fehler entweder in der comment_bit oder comment_form.
Title: Re: [Mod] Quote Comments
Post by: Ronny5000 on March 03, 2013, 12:51:03 PM
Was soll ich dazu sagen das ist ganz einfach falsch:
Code: [Select]
[quote/]
Meiner Meinung nach liegt der Fehler entweder in der comment_bit oder comment_form.

danke für den tipp. das der fehler in der comment_bit ist glaube ich jetzt nicht, weil die von diesen MOD bzw von dir ist. also schau ich
genauer die comment_form an.  :wink:
Title: Re: [Mod] Quote Comments
Post by: FairyCosmo on April 28, 2015, 11:04:40 PM
Ist das normal das der captcha nun weg ist und nur noch die "Reply" buttons an der rechten seite kleben?