Kommentarmodul mit Spamschutz und Baumstruktur

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Mi 2. Jan 2013, 04:34

Die Texte z.B. wie:

- Schreibe einen Kommentar!
- Anzahl der bisherigen Kommentar

usw.

wo werden diese erzeugt? Ich würde diese gerne stylen...

Danke :)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Fr 4. Jan 2013, 21:22

Hi,
kannst du mir verraten, wo genau die Texte "Kommentar" und Bisher wurde kein Kommentar verfasst erzeugt werden?
Guck Dir mal beim Modul den Reiter "Übersetzung" an... :wink:
Und kurz eine Frage, wenn ich einen Artikel vollständig lösche, dann wird der Kommentar auch vollständig aus der DB gelöscht oder?
Nein, denn zwischen den Contenido-Tabellen und der Kommentar-Tabelle besteht keine direkte Verbindung. In dem Fall müsstest Du entweder vor dem Löschen des Artikels im Backend von Contenido die Kommentare einzeln löschen oder Du gehst über die Datenbanktabelle. Da sortierst Du dann einfach nach der idart, setzt bei allen Kommentaren mit der entsprechenden idart ein Häkchen und löschst dann in einem Rutsch.

Wenn ich Zeit finde, baue ich ggf. noch für's Backend einen Button zum Löschen aller Kommentare ein und poste den aktualisierten Code dann hier im Forum.

Gruß,


Markus
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Sa 5. Jan 2013, 04:39

Was meiner Meinung nach ein sinnvolle Ergänzung wäre, ist eine Mail Benachrichtigung bei einem Kommentar. Bei über 200 Artikel wo Kommentare freigeschaltet werden müssen, ist es schwierig, diese immer durchzusehen :)

Hierfür können wir ja etwas vereinbaren;)

Mir reicht ja schon einfach eine kurze Mail muss noch nicht einmal über das Backend laufen wie ich in PHP eine E-Mail Adresse ändere weiß ich ja ;)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Sa 5. Jan 2013, 12:46

Lies Dir doch bitte nochmal die im ersten Post genannten Features durch. :arrow: :idea: :twisted:
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Sa 5. Jan 2013, 12:49

Habe ich, und ich hab das Modul ausgiebig getestet, aber ich bekomme keine E-Mail? Welche E-Mail nimmt das Modul denn?

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Sa 5. Jan 2013, 17:52

Neben der üblichen Installationsroutine ist es wichtig, sich den Abschnitt /****** begin configuration ******/ am Anfang des Outputs anzusehen und hier zumindest bei
$email_comment_alert
$main_url
$headline_comments_image
$path_countcha_1
$path_countcha_2
eigene Daten einzutragen.
An die Mailadresse, die Du unter $email_comment_alert eingetragen hast. An diese Mailadresse wird immer eine Benachrichtigung verschickt. Zusätzlich kannst Du für jeden Artikel individuell über den Konfigurationsreiter weitere Mailadressen einfügen. Hast Du schonmal im Spamordner Deines Postfachs nachgeschaut?
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Di 26. Feb 2013, 21:52

Hi,

ich hab das Modul installiert und auch mal den kompletten Thread durchgeschaut bzgl. der Änderungen im AMR Modul, jedoch bekomme ich immer die 404
Fehlerseite...

Kann mir jemand helfen? Wäre echt dankbar:)

Das ist schon das angepasste Modul und Template wie ich es nach dem Vorgaben im Thread angepasst habe.

Modul Input:

Code: Alles auswählen

/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname   :     comments_sd
* Author(s)   :     www.Seamless-Design.de Markus Hübner
* Copyright   :     www.Seamless-Design.de Markus Hübner
* Created     :     11.09.2011
************************************************/

echo 'Kommentare erlauben? ';
if ("CMS_VALUE[10]" != "true") { 
   echo '          <input type="radio" name="CMS_VAR[10]" value="true"> ja'; 
} else { 
   echo '          <input type="radio" name="CMS_VAR[10]" value="true" checked> ja'; 
} 
if ("CMS_VALUE[10]" != "false") { 
   echo '          <input type="radio" name="CMS_VAR[10]" value="false"> nein'; 
} else { 
   echo '          <input type="radio" name="CMS_VAR[10]" value="false" checked> nein'; 
} 

echo '<font style="font-size:80%"><br/><br/>Die Konfiguration des Moduls erfolgt über die Variablen am Beginn des Modul-Outputs.<br/>
Wichtig: Kommentare können im Backend nur gelöscht werden, wenn keine Folgekommentare vorhanden sind UND sie zuerst offline gesetzt werden.<br/>
Ein Löschen per Tabellenzugriff über phpMyAdmin sollte nicht erfolgen, da sonst die Baumstruktur zusammenbrechen kann!</font>';
Modul Output:

Code: Alles auswählen

<?php

/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :     comments_sd
* Author(s)   :     www.Seamless-Design.de Markus Hübner
* Copyright   :     www.Seamless-Design.de Markus Hübner
* Created     :     11.09.2011
************************************************/

$enable='CMS_VALUE[10]';
if($enable=="false" AND $contenido) echo '<p><font style="color: #DF1010; font-weight: 900; font-size: 15px;">COMMENTS DISABLED IN FRONTEND!</font></p>';
if($contenido) $enable="true"; // enables showing comments in backend, which are switched to "false" after being "true" while they are hidden in frontend
if($enable=="false")
  {
  echo '';
  }
  else
{
echo '<div class="c_sd_box_main">';

/****** begin configuration ******/

$display_countchas="true"; // true or false
$amount_countchas_total="8"; // how many countchas should be displayed if anti-spam is activated?
$path_countcha_1="upload/bullets/countcha_01.jpg"; // path to first symbol
$path_countcha_2="upload/bullets/countcha_02.jpg"; // path to second symbol

$debug="false"; // true or false. if you want to see several hints how this modul works, set it to true - have fun... ;O)
$mail_alert="true"; // if you want to get an email if there is a new comment, set it to true or otherwise false
$email_comment_alert="info@xyz.de"; // email-adress for email-alert
$maximum_comment_level=15; // after the xth level (level 1: 0=first comment ... level 6: 5=fifth answer ...) there is no possibility to answer an answer anymore 
$standard_onlinestatus="0"; // 1: comment is immediately online after posting or 0: you have to set it online
$enable_br="true"; // true enables displaying <br/> within comment text, set to false to disable
$base_url="http://www.xyz.de"; //needed for correct link in email-alert and link in comment-box
$headline_comments_image="upload/bullets/comments-bubble.jpg"; //path to image displayed before the headline

$template_form="comments_sd_commentform.html"; // template containing the comment form
$template_commentbox="comments_sd_commentbox.html"; // template containing the standard html-construct to display one posted comment
$template_commentbox_no_more_comments="comments_sd_commentbox_no_more_answers.html"; // template containing the standard html-construct to display one posted comment without the answer-this-comment-link
$template_form_commentchange="comments_sd_form_commentchange.html"; // template containing the backend-form to change contents of a comment

//if you want to configure the look: use the prepared css-styles.

/****** end configuration ******/


$commentname=mysql_real_escape_string(htmlspecialchars(strip_tags($_POST[commentname])));
$commentemail=mysql_real_escape_string(htmlspecialchars(strip_tags($_POST[commentemail])));
$commentwebsite=mysql_real_escape_string(htmlspecialchars(strip_tags($_POST[commentwebsite])));
  $commentwebsite = str_replace("https://","",$commentwebsite);
  $commentwebsite = str_replace("http://","",$commentwebsite);
$commenttext=mysql_real_escape_string(htmlspecialchars(strip_tags($_POST[commenttext])));
$amount=htmlspecialchars(strip_tags($_POST[amount]));
$countcha=htmlspecialchars(strip_tags($_POST[countcha]));
$show_form=htmlspecialchars(strip_tags($_GET[show_form]));
$parent_id=htmlspecialchars(strip_tags($_GET[parent_id]));
$level=htmlspecialchars(strip_tags($_GET[level]));
$timestamp = time();
$date = date("Y.m.d",$timestamp);
$time = date("H:i",$timestamp);
$url=$_SERVER["REQUEST_URI"];


if($contenido)
  {
  $url="/cms/front_content.php?idart=".$idart;
  $reload_url="front_content.php?idcat=$idcat&idart=$idart&lang=$lang&client=$client&contenido=$contenido";
  $change_id_select=htmlspecialchars(strip_tags($_POST[change_id_select]));
  $change_name=htmlspecialchars(strip_tags($_POST[change_name])); if($change_name=="") $change_name="-";
  $change_email=htmlspecialchars(strip_tags($_POST[change_email])); if($change_email=="") $change_email="-";
  $change_www=htmlspecialchars(strip_tags($_POST[change_www])); if($change_www=="") $change_www="-";
  $change_text=htmlspecialchars(strip_tags($_POST[change_text])); if($change_text=="") $change_text="-";
  }







if ($debug=="true")
  {
  echo 'submit: '.$submit.'<br/>';
  echo 'commentname: '.$commentname.'<br/>';
  echo 'commentemail: '.$commentemail.'<br/>';
  echo 'commentwebsite: '.$commentwebsite.'<br/>';
  echo 'commenttext: '.$commenttext.'<br/>';
  echo 'date: '.$date.'<br/>';
  echo 'time: '.$time.'<br/>';
  echo 'url: '.$url.'<br/>';
  echo 'idart: '.$idart.'<br/>';
  }

/****** begin backend functions ******/

if($contenido)
  {
  $toggle_id=htmlspecialchars(strip_tags($_GET[toggle_id]));
  $toggle_onlinestatus=htmlspecialchars(strip_tags($_GET[onlinestatus]));
  $erase=htmlspecialchars(strip_tags($_GET[erase]));
  if($debug=="true")
    {
    echo 'toggle_id: '.$toggle_id.'<br/>';
    echo 'online-status: '.$toggle_onlinestatus.'<br/>';
    echo 'erase: '.$erase.'<br/>';
    }
  if($toggle_id!="" AND $toggle_onlinestatus!="")
    {
    $toggle = "UPDATE comments_sd Set online = $toggle_onlinestatus WHERE id = $toggle_id";
    $update = mysql_query($toggle);
    }
  if($erase=="1")
    {
    $erase = "DELETE from comments_sd WHERE id = $toggle_id";
    $erase = mysql_query($erase);
    }


$query = "SELECT id FROM comments_sd WHERE idart='$idart' ORDER by id ASC";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
  {
  $ids_to_select[]=$row[id];
  }
$select="<option>?</option>";
$amount_of_comments = mysql_num_rows($result); //edit blau1 contenido post Do Nov 10, 2011 7:19 pm http://forum.contenido.org/viewtopic.php?f=60&t=31573
if($amount_of_comments>0)
{
foreach($ids_to_select AS $element)
{
$select=$select.'<option>'.$element.'</option>';
}
}
echo '<div style="background-color: #FFE4E4;border: 1px solid #FFE4E4;border-radius: 5px;padding: 5px;margin-bottom: 10px;">';
echo '<strong>Inhalte eines Kommentars &auml;ndern</strong><br/><span style="font-size: 80%;">(Wenn für Feld <u>keine</u> Änderung gewünscht ist, bitte "-" im Feld belassen. Leer führt zu L&ouml;schung des Inhalts!)</span>';
  if(!isset($tpl) || !is_object($tpl)) $tpl = new Template();
    $tpl->reset();
    $tpl->set('s', 'value_change_name', $change_name);
    $tpl->set('s', 'value_change_email', $change_email);
    $tpl->set('s', 'value_change_www', $change_www);
    $tpl->set('s', 'value_change_text', $change_text);
    $tpl->set('s', 'button_text', "update");
    $tpl->set('s', 'select', $select);
    $tpl->generate('templates/'.$template_form_commentchange);
echo '</div>';

if($change_id_select!="")
  {
  if($change_id_select=="?")
    {
    echo mi18n("please_select_a_change_id").'<br/>';
    }
    else
      {
      if($debug=="true") {echo $change_id_select.'<br/>';echo $change_name.'<br/>';echo $change_email.'<br/>';echo $change_www.'<br/>';echo $change_text.'<br/>';}
      if($change_name!="-") mysql_query("UPDATE comments_sd SET name='$change_name' WHERE id='$change_id_select'");
      if($change_email!="-") mysql_query("UPDATE comments_sd SET email='$change_email' WHERE id='$change_id_select'");
      if($change_www!="-") mysql_query("UPDATE comments_sd SET website='$change_www' WHERE id='$change_id_select'");
      if($change_text!="-") mysql_query("UPDATE comments_sd SET text='$change_text' WHERE id='$change_id_select'");
      }
  }

  }

function backend_comment_options ($reload_url,$toggle_id,$onlinestatus,$commentemail,$has_child){
echo '<div class="c_sd_commentbox_backend_options">';
if($debug=="true") echo 'has child: '.$has_child.'<br/>';
if($onlinestatus=="0")
  {
  echo 'eMail: <a href="mailto:'.$commentemail.'">'.$commentemail.'</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
  if($has_child!="true") echo '<a href="'.$reload_url.'&toggle_id='.$toggle_id.'&onlinestatus=0&erase=1"><img src="/contenido/images/delete.gif" alt="delete" title="delete"/></a>&nbsp;&nbsp;|&nbsp;&nbsp;';
  echo '<a href="'.$reload_url.'&toggle_id='.$toggle_id.'&onlinestatus=1&erase=0"><img src="/contenido/images/offline.gif" alt="offline" title="offline"/></a>';
  }
if($onlinestatus=="1") echo 'eMail: <a href="mailto:'.$commentemail.'">'.$commentemail.'</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                              <a href="'.$reload_url.'&toggle_id='.$toggle_id.'&onlinestatus=0&erase=0"><img src="/contenido/images/online.gif" alt="online" title="online"/></a>';
echo ' | id: '.$toggle_id;
echo '</div>';
}

/****** end backend functions ******/



/****** begin checking errors ******/  

if($submit!="")
  {
  if($commentemail != "")
    {
    if(!preg_match("/^[\w-]+((\.|\+)[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/i", $commentemail))
      {
      $errormessage_commentemail=mi18n("errormessage_commentemail").'<br/>';
      }
        else $errormessage_commentemail="";
    } 

  if($commentwebsite != "")
    {
    if(!preg_match("/[w.0-9]{0,4}[a-zA-Z0-9.-]{2,40}[.][a-zA-Z]{2,7}/", $commentwebsite))
      {
      $errormessage_commentwebsite=mi18n("errormessage_commentwebsite").'<br/>';
      }
      else $errormessage_commentwebsite="";
    }

  if($commenttext=="") $errormessage_commenttext=mi18n("errormessage_commenttext").'<br/>';
      else $errormessage_commenttext="";

  if($display_countchas=="true")
    {
      if($amount!=$countcha) $errormessage_countchas=mi18n("errormessage_countchas").'<br/>';
         else $errormessage_countchas="";
    }
  }

if($show_form=="true")
  {
  if($errormessage_commentemail!="" OR $errormessage_commentwebsite!="" OR $errormessage_commenttext!="" OR $errormessage_countchas!="")
    {
    echo '<h2>'.mi18n("headline_form").'</h2>';
    echo '<p class="c_sd_box_errormessages">';
    echo $errormessage_commentemail;
    echo $errormessage_commentwebsite;
    echo $errormessage_commenttext;
    if($display_countchas=="true") echo $errormessage_countchas;
    echo '<p>';
    }
    elseif ($submit!="")
      {
      echo '<h2>'.mi18n("headline_form").'</h2>';
      if($standard_onlinestatus=="0") echo mi18n("confirmation");
      if($standard_onlinestatus=="1") echo mi18n("confirmation_immediately_online");
      $insert_data="true";
      }
      else echo '<h2>'.mi18n("headline_form").'</h2>';
  }
/****** end checking errors ******/




/****** begin displaying form ******/ 

if($insert_data!="true" AND $show_form=="true")
  {
  if($display_countchas=="true")
    {
    $countchas_1="";
    $countchas_2="";
    $amount=rand(1,$amount_countchas_total); // amount of symbols to count
    $amount_wrong_countchas=$amount_countchas_total-$amount;
    $i=0;
    while ($i<$amount_wrong_countchas)
      {
      $countchas_2=$countchas_2."<img src=\"".$path_countcha_2."\" border=\"0\" alt=\"\"></img>&nbsp;";
      $i=$i+1;
      }
    while ($i<$amount_countchas_total)
      {
      $countchas_1=$countchas_1."<img src=\"".$path_countcha_1."\" border=\"0\" alt=\"\"></img>&nbsp;";
      $i=$i+1;
      }
    }

  if(!isset($tpl) || !is_object($tpl)) $tpl = new Template();
    $tpl->reset();
    $tpl->set('s', 'name', mi18n("name"));
    $tpl->set('s', 'commentname', $commentname);
    $tpl->set('s', 'email', mi18n("email"));
    $tpl->set('s', 'commentemail', $commentemail);
    $tpl->set('s', 'website', mi18n("website"));
    $tpl->set('s', 'commentwebsite', $commentwebsite);
    $tpl->set('s', 'text', mi18n("text"));
    $tpl->set('s', 'commenttext', $commenttext);
    $tpl->set('s', 'countchas_2', $countchas_2);
    $tpl->set('s', 'countchas_1', $countchas_1);
    $tpl->set('s', 'how_many_countchas', mi18n("how_many_countchas"));
    $tpl->set('s', 'title_right_countcha', mi18n("title_right_countcha"));
    $tpl->set('s', 'how_many_countchas_hint_spam', mi18n("how_many_countchas_hint_spam"));
    $tpl->set('s', 'how_many_countchas_input', mi18n("how_many_countchas_input"));
    $tpl->set('s', 'countchas', $countchas);
    $tpl->set('s', 'title_right_countcha_input', mi18n("title_right_countcha_input"));
    $tpl->set('s', 'amount', $amount);
    $tpl->set('s', 'button_text', mi18n("button_text"));
    $tpl->generate('templates/'.$template_form);
  }
  

/****** end displaying form ******/



/****** begin displaying comment after confirmation and mysql-insert ******/ 

if($insert_data=="true")
  {

  /****** begin displaying comment after confirmation ******/ 
  $stringposition=strpos ($url,'&'); //clear url from variables
  $url_for_insert=substr($url,0,$stringposition);
  echo'<p><a class="c_sd_link" href="'.$url_for_insert.'" title="'.mi18n("back_to_article").'">'.mi18n("back_to_article").'</a></p>';
  /****** end displaying comment after confirmation ******/

  /****** begin mysql-insert ******/
  $insert="INSERT INTO comments_sd (idart, url, name, email, website, text, parent_id, level, date, time, online) VALUES ('$idart', '$url_for_insert', '$commentname', '$commentemail', '$commentwebsite', '$commenttext', '$parent_id', '$level', '$date', '$time', '$standard_onlinestatus')";
  $insert = mysql_query($insert);
  if($debug=="true") {if ($insert==true) {echo 'insert: success';} else echo 'insert: failure';}
  /****** end mysql-insert ******/

  /****** begin email-alert ******/

if($mail_alert=="true")
  {
  // eMail-header:
  $link_new_comment = $base_url.$_SERVER["REQUEST_URI"];  $mail_header = mi18n("email_header");
  $from="From: Website <no_reply@new_comment.com>\n";
  $from .= "Reply-To: no_reply@new_comment.com\n";
  $from .= "Content-Type: text/html\n";
  $message=mi18n("email_message_new_comment_for").' <a href="'.$link_new_comment.'" target="_blank">'.$link_new_comment.'</a>';
  // send eMail
  $emails_in_array=explode("//",$email_comment_alert);
  foreach($emails_in_array as $mailto)
    {
    mail($mailto, $mail_header, $message, $from);
    }
  }
  
  /****** end email-alert ******/

}
/****** end displaying comment after confirmation and mysql-insert ******/ 



/****** begin displaying comments ******/

echo '<div class="c_sd_headline_comments">';
if($headline_comments_image!="") echo '<img src="'.$headline_comments_image.'" alt="'.mi18n("headline_comments").'" title alt="'.mi18n("headline_comments").'"/>';
echo mi18n("headline_comments").'</div><br/>';

if($show_form!="true") echo '<p><a class="c_sd_link" href="'.$main_url.'?idcat='.$idcat.'&idart='.$idart.'&show_form=true" title="'.mi18n("post_a_comment").'">'.mi18n("post_a_comment").'</a><p>';

if($show_form=="true")//for displaying form, the url contains &show_form - what blocks searching the correct data in the database. so it has to be cut
  {
  $stringposition=strpos ($url,'&'); 
  $url=substr($url,0,$stringposition);
  }

function datatransfer($commentname,$commentemail,$commentwebsite,$commentdate,$commenttime,$commenttext,$url,$main_url,$idart,$commentlevel,$comment_parent_id,$linktext,$id,$online,$reload_url,$has_child,$maximum_comment_level)
{
//echo 'reload_url: '.$reload_url.'<br/>';
global $array_displayed_comments,$contenido,$template_commentbox,$template_commentbox_no_more_comments,$enable_br;
if($enable_br=="true") $commenttext = nl2br($commenttext);// enables displaying <br/>
$d=explode("-",$commentdate);
$commentdate=sprintf("%02d.%02d.%04d", $d[2], $d[1], $d[0]);
$margin_left=$commentlevel*20;
$commentlevel=$commentlevel+1;
if(!isset($tpl) || !is_object($tpl))
  {
  $tpl = new Template();
  }
  $tpl->reset();
  $tpl->set('s', 'margin_left', $margin_left);
  $tpl->set('s', 'commentname', $commentname);
  $tpl->set('s', 'commentwebsite', $commentwebsite);
  $tpl->set('s', 'commentdate', $commentdate);
  $tpl->set('s', 'commenttime', $commenttime);
  $tpl->set('s', 'commenttext', $commenttext);
  $tpl->set('s', 'url', $url); //currently not in use, the database table contains url, because the next step would be enabling comments for dynamic contents of articles. e.g. a picture-gallery -> the url contains besides the idart other information like name and path of picture
  $tpl->set('s', 'main_url', $main_url);
  $tpl->set('s', 'idart', $idart);
  $tpl->set('s', 'commentlevel', $commentlevel);
  $tpl->set('s', 'comment_parent_id', $comment_parent_id);
  $tpl->set('s', 'linktext', $linktext);
  if($commentlevel<=$maximum_comment_level) 
    $tpl->generate('templates/'.$template_commentbox);
    else
      $tpl->generate('templates/'.$template_commentbox_no_more_comments);
  if($contenido) backend_comment_options ($reload_url,$id,$online,$commentemail,$has_child);
}


//$query = "SELECT parent_id, id,level FROM comments_sd WHERE url='$url' ORDER by id ASC"; //currently not possible, the database table contains url, because the next step would be enabling comments for dynamic contents of articles. e.g. a picture-gallery -> the url contains besides the idart other information like name and path of picture

if($edit)
  {
  // backend: count all comments (on- and offline)
  $query = "SELECT parent_id, id,level FROM comments_sd WHERE idart='$idart' ORDER by id ASC";
  }
  else
    {
    //frontend: count comments which are online
    $query = "SELECT parent_id, id,level FROM comments_sd WHERE idart='$idart' AND online = '1' ORDER by id ASC";
    }
$result = mysql_query($query);
$amount_of_comments = mysql_num_rows($result);
if($amount_of_comments=="0")
  {
  echo mi18n("no_comments_yet");
  }
  else
    {
    echo mi18n("amount_of_comments_yet").' '.$amount_of_comments.'<br/>';
    if($edit) echo '(online + offline)<br/>';
    $maxlevel=0;
    while ($row = mysql_fetch_array($result))// AND $i<=$maxlevel)
      {
      ${'array_l_'.$row[level]}[]=$row[id];
      if($maxlevel<$row[level]) $maxlevel=$row[level];
      $array_level_id_parent_id[]=array($row[level],$row[id],$row[parent_id]);
      }
    if($debug=="true") echo 'maxlevel: '.$maxlevel.'<br/>';
     }

if($debug=="true")
  {
  $i=0;
  while($i<=$maxlevel)
    {
    echo 'level '.$i.': ';  if(count(${'array_l_'.$i}) > 0) {foreach(${'array_l_'.$i}  AS ${'element_l_'.$i})  echo ${'element_l_'.$i}." | ";}  echo '<br/>';
    $i++;
    }
     
  $i=0;
  while($i<$amount_of_comments)
    {
    echo $all_comments[$i].'<br/>';
    $i++;
    }

  echo '<br/>array_level_id_parent_id<br/>';
  $i=0;
  foreach($array_level_id_parent_id AS $element)
    {
    echo $i.' ';
    print_r($element);
    echo '<br/>';
    $i++;
    }

  echo '<br/>array_level_id_parent_id - sorting<br/>';
  }


/****** begin building comment ranking ******/

$array_used_comments=array();
$array_comment_ranking=array();

$levelcounter=1;

function unset_array_level_id_parent_id($element)
  {
  global $array_level_id_parent_id;
  $i=0;
  $n=count($array_level_id_parent_id);
  while($i<$n)
    {
     if($array_level_id_parent_id[$i][1]==$element) unset($array_level_id_parent_id[$i]);
     $i++;
    }
  }


function level_extractor($levelcounter) 
  {
  global $array_level_id_parent_id;
  foreach($array_level_id_parent_id AS $element)
    {
    if($element[0]==$levelcounter) $extracted_levels[]=$element;
    }
  return $extracted_levels;
  }


function collect_level_parent_ids($extracted_levels)
  {
  foreach($extracted_levels AS $element)
    {
    $collected_level_parent_ids[]=$element[2];
    }
  $collected_level_parent_ids=array_unique($collected_level_parent_ids);
  return $collected_level_parent_ids;
  }


function integrate($parent_id,$ids_for_function_integrate)
  {
  global $array_comment_ranking;
  $i=0;
  foreach($array_comment_ranking AS $element) //search for parent_id to place the pointer for integration
    {
    if($element==$parent_id) 
      {
      $pointer=$i+1;
      break;
      }
    $i++;
    }
  $array_comment_ranking=array_merge(array_slice($array_comment_ranking, 0, $pointer), array_values($ids_for_function_integrate), array_slice($array_comment_ranking, $pointer));
  if($debug=="true") {echo '<br/>integrate<br/>';print_r($array_comment_ranking);}
  }


function collect_ids_to_integrate($collected_level_parent_ids)
  {
  global $array_level_id_parent_id; 
  foreach($collected_level_parent_ids AS $element)
    {
    $i=0;
    $n=count($array_level_id_parent_id);
    while($i<=$n)
      {
      if($element==$array_level_id_parent_id[$i][2])
        {
        $ids_to_integrate[]=$array_level_id_parent_id[$i];
        }
      $i++;
      }
    foreach($ids_to_integrate AS $element)
      {
      if($debug=="true") echo 'element: '.$element[1].'<br/>';
      $i=0;
      $n=count($array_level_id_parent_id);
      while($i<=$n)
      {
      if($element[1]==$array_level_id_parent_id[$i][1])
        {
        unset($array_level_id_parent_id[$i]);
        $array_level_id_parent_id=array_values($array_level_id_parent_id);
        }
      $i++;
      }
      }
    $parent_id=$ids_to_integrate[0][2];

    foreach($ids_to_integrate AS $element)
      {
      $ids_for_function_integrate[]=$element[1];
      }
    if($debug=="true") {echo 'parent_id: '.$parent_id.' '; echo 'ids to integrate: '; foreach($ids_for_function_integrate AS $element) {echo $element.',';} echo '<br/>';}
    integrate($parent_id,$ids_for_function_integrate);
    $ids_to_integrate=array(); // setting back, so childs of a further parent-id will not be appended to childs of previous parent-id
    $ids_for_function_integrate=array();
    }
  }


//LEVEL 0
$array_comment_ranking=$array_l_0;
$array_used_comments=$array_l_0;

if($amount_of_comments>0)
{
foreach($array_comment_ranking AS $element)
  {
  unset_array_level_id_parent_id($element);
  $array_level_id_parent_id=array_values($array_level_id_parent_id);
  }

//LEVELS > 0
while($levelcounter<=$maxlevel)
  {
  $extracted_levels=level_extractor($levelcounter);
  if($debug=="true") {echo '<br/>extracted_levels<br/>'; foreach($extracted_levels AS $element) {print_r($element); echo '<br/>';}}

  $collected_level_parent_ids=collect_level_parent_ids($extracted_levels);
  if($debug=="true") {echo '<br/>collected_level_parent_ids<br/>'; foreach($collected_level_parent_ids AS $element) {print_r($element); echo '<br/>';}}

  $collected_ids_to_integrate=collect_ids_to_integrate($collected_level_parent_ids);

  $levelcounter++; 
  }
}
/****** end building comment ranking ******/




if($debug=="true")
  {
  echo '<br/>array_used_comments:<br/>';
  $i=0;
  while($i<count($array_used_comments))
    {
    echo $array_used_comments[$i].'<br/>';
    $i++;
    }

  echo '<br/>array_level_id_parent_id<br/>';
  $i=0;
  foreach($array_level_id_parent_id AS $element)
    {
    echo $i.' ';
    print_r($element);
    echo '<br/>';
    $i++;
    }

  echo '<br/>array_comment_ranking:<br/>';
  $i=0;
  while($i<count($array_comment_ranking))
    {
    echo $array_comment_ranking[$i].'<br/>';
    $i++;
    }
  }

/****** begin building the comment tree ******/

if($amount_of_comments>0)
{
echo '<div class="c_sd_box_comment_tree">';

foreach($array_comment_ranking AS $element)
  {
  $has_child="false";
  $query = "SELECT * FROM comments_sd WHERE id='$element' ORDER by id ASC";
  $result = mysql_query($query);
  $row = mysql_fetch_array($result);
  $has_child="";
  if($contenido) // only needed for backend, not for frontend
    {$array_children_element_l_0=array("");
    $query_b = "SELECT id FROM comments_sd WHERE parent_id='$element' ORDER by id ASC";
    $result_b = mysql_query($query_b);
    $num_rows= mysql_num_rows($result_b);
    if($num_rows>0) $has_child="true";
    }
  if($row[online]=="1" AND !$contenido) datatransfer ($row[name],$row[email],$row[website],$row[date],$row[time],$row[text],$url,$main_url,$idart,$row[level],$row[id],mi18n("answer_comment"),$row[id],$row[online],$reload_url,$has_child,$maximum_comment_level);
  if($row[text]!="" AND $contenido) datatransfer ($row[name],$row[email],$row[website],$row[date],$row[time],$row[text],$url,$main_url,$idart,$row[level],$row[id],mi18n("answer_comment"),$row[id],$row[online],$reload_url,$has_child,$maximum_comment_level);
  }
echo '</div>';
}

/****** end building the comment tree ******/

/****** end displaying comments ******/

echo '</div>';
}
?>

comments_sd_commentbox.htmlt:

Code: Alles auswählen

<div class="c_sd_commentbox_{commentlevel}" style="margin-left:{margin_left}px">
<table class="c_sd_commentbox">
<tr>
  <td class="c_sd_commentbox_1_a">
    <span class="c_sd_commentbox_name">{commentname}</span><br/>
    <span class="c_sd_commentbox_website">web: <a href="http://{commentwebsite}" target="_blank" title="{commentwebsite}">{commentwebsite}</a></span>
  </td>
  <td class="c_sd_commentbox_1_b">
    <span class="c_sd_commentbox_date">{commentdate}</span><br/>
    <span class="c_sd_commentbox_time">{commenttime}</span>
  </td>
</tr>
<tr>
  <td colspan="2" class="c_sd_commentbox_2">{commenttext}</td>
</tr>
<tr>
  <td colspan="2" class="c_sd_commentbox_3">
    <a class="c_sd_link" href="'.$main_url.'?idcat='.$idcat.'&idart='.$idart.'&show_form=true" title="'.mi18n("post_a_comment").'">'.mi18n("post_a_comment").'</a>
  </td>
</tr>
</table>
</div>
comments_sd_commentbox_no_more_answers.html:

Code: Alles auswählen

<div class="c_sd_commentbox_{commentlevel}" style="margin-left:{margin_left}px">
<table class="c_sd_commentbox">
<tr>
  <td class="c_sd_commentbox_1_a">
    <span class="c_sd_commentbox_name">{commentname}</span><br/>
    <span class="c_sd_commentbox_website">web: <a href="http://{commentwebsite}" target="_blank" title="{commentwebsite}">{commentwebsite}</a></span>
  </td>
  <td class="c_sd_commentbox_1_b">
    <span class="c_sd_commentbox_date">{commentdate}</span><br/>
    <span class="c_sd_commentbox_time">{commenttime}</span>
  </td>
</tr>
<tr>
  <td colspan="2" class="c_sd_commentbox_2" style="border-bottom: 0px;">{commenttext}</td>
</tr>

</table>
</div>

comments_sd_commentform.html:

Code: Alles auswählen

<form id="commentform" name="comments" method="post" action="">
  <table>
    <tr>
      <td class="tabellenzelle_formular_ueberschrift">{name}</td>
      <td><input type="text" name="commentname" value="{commentname}"/></td>
    </tr>
    <tr>
      <td class="tabellenzelle_formular_ueberschrift">{email}</td>
      <td><input type="text" name="commentemail" value="{commentemail}"/></td>
    </tr>
    <tr>
      <td class="tabellenzelle_formular_ueberschrift">{website}</td>
      <td><input type="text" name="commentwebsite" value="{commentwebsite}"/></td>
    </tr>
    <tr>
      <td class="tabellenzelle_formular_ueberschrift">{text}</td>
      <td><textarea cols="40" rows="10" name="commenttext">{commenttext}</textarea></td>
    </tr>
  </table>
  {how_many_countchas} {title_right_countcha}<br/>
  <span class="hinweis_klein">{how_many_countchas_hint_spam}</span><br/>
  {countchas_2}{countchas_1}
  <table>
    <tr>
      <td>{how_many_countchas_input}</td>
      <td><input style="width: 40px;" type="text" name="countcha" value="{countchas}" size="1" maxlength="10"></input></td>
      <td>{title_right_countcha_input}</td>
    </tr>
  </table>
  <br/>
  <input type="hidden" name="amount" value="{amount}"></input>
  <input type="submit" class="button" name="submit" value="{button_text}">
</form>
<br/>
<br/>
comments_sd_form_commentchange.html:

Code: Alles auswählen

<form id="commentform" name="comments" method="post" action="">
  <table>
    <tr>
      <td>comment-id</td>
      <td>
        <select name="change_id_select">
          {select}
        </select>   
      </td>
      <td rowspan="4">Text<br/><textarea cols="30" rows="4" name="change_text"/>{value_change_text}</textarea></td>
    </tr>
    <tr>
      <td>Name</td><td><input type="text" name="change_name" value="{value_change_name}" size="20"/></td>
    </tr>
    <tr>
      <td>eMail</td><td><input type="text" name="change_email" value="{value_change_email}" size="20"/></td>
    </tr>
    <tr>
      <td>www</td><td><input type="text" name="change_www" value="{value_change_www}" size="20"/></td>
    </tr>
  </table>
  <span style="font-size: 80%;"><u>Wichtig:</u> &Auml;nderungen k&ouml;nnen nicht wieder r&uuml;ckg&auml;ngig gemacht werden. Richtige Comment-ID eingetragen?</span><br/>
  <input type="submit" class="button" name="submit" value="{button_text}">
</form>
Dankeschön :)
Zuletzt geändert von contenidoAmateur am Mi 27. Feb 2013, 20:26, insgesamt 1-mal geändert.

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Mi 27. Feb 2013, 12:20

Hi,

kann man sich das irgendwo "live" anschauen? Post mal einen Link auf die Seite in der Du das Modul eingebunden hast. Geht auch per PN. Danke :D
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Mi 27. Feb 2013, 19:28

Hallo,

Dein Output des Moduls unterscheidet sich im Hinblick auf die Darstellung des Formulars nur in diesen Zeilen am Anfang:

Original:

Code: Alles auswählen

$main_url="http://www.MEINEDOMAIN.de/cms/front_content.php"; //needed for correct link in email-alert and link in comment-box
Deins:

Code: Alles auswählen

$base_url="http://www.meineseite.de"; //needed for correct link in email-alert and link in comment-box
Die Variable $main_url wird bei Dir nicht mit Daten versorgt.

Im Abschnitt /****** begin displaying comments ******/ wird der Link zum Kommentar schreiben aufgebaut und dort wird auch die $main_url verwendet:

Code: Alles auswählen

if($show_form!="true") echo '<p><a class="c_sd_link" href="'.$main_url.'?idcat='.$idcat.'&idart='.$idart.'&show_form=true" title="'.mi18n("post_a_comment").'">'.mi18n("post_a_comment").'</a><p>';
Bei Dir wird dadurch der Link zum Kommentar schreiben ("Schreibe einen Kommentar") nicht vollständig generiert:

Code: Alles auswählen

http://www.meineseite.de/cms/?idcat=xxx&idart=xxx&show_form=true
Da fehlt was:

Code: Alles auswählen

http://www.meineseite.de/cms/front_content.php?idcat=xxx&idart=xxx&show_form=true
Insofern musst Du die Deklaration der $main_url am Anfang nachholen!

Allerdings kommt auch hier ein Fehler, wenn Du den Link händisch in die Adresszeile eingibst.

Das scheint aber nicht am Modul zu liegen sondern ein generelles Problem zu sein. Denn auch ein simples

Code: Alles auswählen

http://www.meineseite.de/cms/front_content.php?idcat=1
führt zur Fehlerseite. Egal welche idcat ich eintrage. Ich hab auch auf einigen Seiten AMR laufen und dort funktioniert der Aufruf der Seiten auch immer per front_content.php - bei Dir jedoch nicht.

In Deinem Fall wird nur dann das Formular zur Kommentarabgabe angezeigt, wenn der Link z. B. lautet

Code: Alles auswählen

http://www.meineseite.de/blabla/blubblub.html?show_form=true
Insofern müsstest Du entweder das anscheinend grundlegende Problem mit Adresseingaben á la front_content.php beheben oder den beim im Abschnitt /****** begin displaying comments ******/ generierten Link zum Aufruf des Formulars die Linkgenerierung auf AMR-Format, also "sprechende" URL umstellen.

Was genau bei Dir dazwischen funkt kann ich Dir nicht sagen. Ich hab das Modul auf mehreren Seiten mit AMR und aktueller con am Laufen mit den Originalcodes aus dem Eröffnungs-Posting.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Mi 27. Feb 2013, 20:44

Und wie stelle ich alles in dem Bereich um? :/ So viel Ahnung habe ich leider auch nicht...

Bei meiner vorherigen Installation hat ja auch alles geklappt...

Ohne Kommentarmodul kann ich meine Webseite eigentl. wegschmeißen :P

Danke,
:P

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Mi 27. Feb 2013, 21:09

Schick mir mal Zugangsdaten per PN. Dann schau ich mir das mal an.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

contenidoAmateur

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von contenidoAmateur » Mi 27. Feb 2013, 21:10

Welche Zugriffe brauchst du?

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Mi 27. Feb 2013, 21:22

Na, richte ein neues AdministratorKonto ein und sende mir den Benutzernamen und das Passwort. Später löschst Du es dann wieder...
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

McHubi
Beiträge: 1209
Registriert: Do 18. Nov 2004, 23:06
Wohnort: Mettmann
Kontaktdaten:

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von McHubi » Fr 8. Mär 2013, 12:36

Hallo zusammen,

auch wenn bei mir in allen Installationen der Aufruf des Formulars zum Erfassen eines Kommentars tadellos bis hin zur 4.8.18 mit den im ersten Post veröffentlichten Codes funktioniert, habe ich ihn leicht angepasst. An der Stelle ein dickes Danke an xmurrix, der ja das AMR-Plugin pflegt. :D Er schreibt zur Ursache der Probleme von ContenidoAmateur:
Das Problem lag am Link zum Zum Schreiben eines Kommentares.
Die generierte URL "http://www.meinedomain.de/cms/front_con ... _form=true" hat immer zur Fehlerseite umgeleitet.

In der Ausgabe des Kommentarmoduls wurde die URL "http://www.meinedomain.de/cms/front_con ... _form=true" nicht in eine Clean-URL umgewandelt.
Das AMR-Plugin wandelt generell keine URLs in Clean-URLs um, wenn die URLs den Protokoll und Host enthalten.
- Die URL "http://www.meinedomain.de/cms/front_con ... _form=true" wird nicht umgewandelt.
- Die URL "front_content.php?idcat=xxx&idart=xxx&show_form=true" wird umgewandelt.
Im Modul-Output wurde deshalb die Zeile

Code: Alles auswählen

$main_url="http://www.MEINEDOMAIN.de/cms/front_content.php"; //needed for correct link in email-alert and link in comment-box
ausgetauscht durch

Code: Alles auswählen

$main_url="front_content.php"; //needed for correct link in comment-box
$main_url_email_alert="http://www.MEINEDOMAIN.de/cms/front_content.php"; //needed for correct link in email-alert
Und anschließend die Zeile

Code: Alles auswählen

$link_new_comment=$main_url.'?idcat='.$idcat.'&idart='.$idart;
ausgetauscht durch

Code: Alles auswählen

$link_new_comment=$main_url_email_alert.'?idcat='.$idcat.'&idart='.$idart;
Die Codes im ersten Post sind bereits angepasst!
Zuletzt geändert von McHubi am Fr 8. Mär 2013, 16:15, insgesamt 1-mal geändert.
seamless-design.de
"Geht nicht!" wohnt in der "Will nicht!"-Strasse.

Das Handbuch zur Version 4.10: CONTENIDO für Einsteiger (4.10)

Das Handbuch zur Version 4.9: CONTENIDO für Einsteiger (4.9)

Spider IT
Beiträge: 1416
Registriert: Fr 3. Dez 2004, 10:15

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Beitrag von Spider IT » Fr 8. Mär 2013, 13:34

Hallo Markus,

du kannst im Modul absolute URIs für die Mails generieren lassen, ohne dass dazu irgendwas angegeben werden muss:

Code: Alles auswählen

$url = Contenido_Url::getInstance()->build(array('idcat' => $idcat, 'idart' => $idart, 'client' => $client, 'lang' => $lang), true);
Das Array der Parameter kannst du um eigene Parameter erweitern.
Der URL-Builder "weiß" ob AMR aktiv ist und generiert immer korrekte Links (nutzt AMR wenn eingeschaltet).
Der 2. Parameter "true" sagt aus, dass eine absolute URI erzeugt werden soll, bei "false" oder weglassen werden relative URLs erzeugt.

Übrigens, Murat ist NICHT der Ersteller von AMR, das war jemand anderes (ich meine Strese).
Murat hat aber seit damals AMR weitergepflegt (an neue Versionen von Contenido angepasst) und erweitert.

Gruß
René

Gesperrt