Seite 1 von 6

Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Fr 16. Sep 2011, 13:03
von McHubi
Hallo zusammen,

es gibt ein neues Kommentarmodul :D

Features:
*nicht nur ein Artikel kann kommentiert werden sondern auch die Kommentare selbst
*Anzahl der Kommentarlevel theoretisch unbegrenzt, kann aber auf eine bestimmte Anzahl Ebenen eingeschränkt werden
*Darstellung der Kommentare in einer eingerückten Baumstruktur, je nachdem ob es sich um "Grundkommentare" oder Antworten auf Kommentare handelt. Jedes Einrück-Level lässt sich per CSS unterschiedlich darstellen.
*Spamschutz per "Countchas" aktivierbar
*Kommentar kann gleich online gehen oder erst nach Freischalten
*eMail-Alert bei neuem Kommentar
*Auf Mehrsprachigkeit ausgelegt
*Individuelle Anpassungsmöglichkeiten per CSS und Modul-Templates
*Kommentarmodul kann individuell für Artikel ein- oder ausgeschaltet werden
*Pflege der Kommentare über das Backend: online, offline, löschen, ändern. Löschfunktion wird nur dann eingeblendet, wenn Kommentar zuerst offline gesetzt wurde und keine Kinderelemente/-kommentare mehr vorhanden sind.

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. Die drei Bildchen für headline_comments_image und die beiden countchas dürft ihr auch selber machen... :wink:

ToDo: Zur Zeit orientiert sich die Zuordnung der Kommentare rein an der idart. Geplant ist eine Ausweitung der Zuordnung per "additional attributes", sprich z. B. die url wird nach Variablen durchsucht die dann zusätzlich zur idart in der DB-Tabelle gespeichert werden. So ließe sich z. B. auch eine Kommentierung innerhalb einer Bildergalerie realisieren, sofern der Dateiname und ggf. Pfad in der url oder sonstwo im Code als Variable auftaucht.

Wer gerne Detailinformationen zu den einzelnen Schritten einblenden möchte, der kann am Anfang des Output mal $debug auf "true" setzen und von einigen Zusatzinformationen erschlagen lassen. Wer's nicht braucht, lässt eben das "false" oder kann einfach alle if($debug=="true"){...} im Output rauslöschen. Macht das Ganze dann auch was schlanker :mrgreen:

Weitere Informationen unter http://www.seamless-design.de/cms/front ... ?idcat=115

Also, viel Spaß damit :D


Markus

SQL-Statement zum Anlegen der DB-Tabelle:

Code: Alles auswählen

CREATE TABLE IF NOT EXISTS `comments_sd` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idart` int(11) NOT NULL,
  `url` varchar(200) COLLATE latin1_german1_ci NOT NULL,
  `name` varchar(50) COLLATE latin1_german1_ci NOT NULL,
  `email` varchar(50) COLLATE latin1_german1_ci NOT NULL,
  `website` varchar(100) COLLATE latin1_german1_ci NOT NULL,
  `text` text COLLATE latin1_german1_ci NOT NULL,
  `parent_id` int(11) NOT NULL,
  `level` int(11) NOT NULL,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `online` int(1) NOT NULL,
  PRIMARY KEY (`id`)
)
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>';
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="ich@domain.de"; // email-adress for email-alert
$maximum_comment_level=99; // 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
$main_url="front_content.php"; //needed for correct link in comment-box
$main_url_email_alert="http://www.mein1job.de/cms/front_content.php"; //needed for correct link in email-alert
$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=$main_url_email_alert.'?idcat='.$idcat.'&idart='.$idart;
  $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>';
}
?>
Modul-Templates
comments_sd_commentbox.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">{commenttext}</td>
</tr>
<tr>
  <td colspan="2" class="c_sd_commentbox_3">
    <a class="c_sd_link" href="{main_url}?idart={idart}&show_form=true&parent_id={comment_parent_id}&level={commentlevel}" title="{linktext}">{linktext}</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>
CSS

Code: Alles auswählen

/* ###################################################### */
/* ##################### COMMENTS SD #################### */
/* ###################################################### */

a.c_sd_link {
color: #3d857d;
text-decoration: none;
background-image: url('../upload/bullets/link_text.jpg');
background-position: center left;
background-repeat: no-repeat;
padding-left: 20px;
}
a.c_sd_link:hover {
text-decoration: underline;
}

div.c_sd_box_main {
clear:both;
width: 90%;
border-left: 1px solid #999999;
border-top: 1px solid #999999;
border-radius: 5px;
margin-left: 10px;
margin-top: 10px;
padding-left: 10px;
padding-top: 10px;
}

div.c_sd_box_comment_tree {
margin-bottom: 20px;
}

div.c_sd_commentbox_1,
div.c_sd_commentbox_2,
div.c_sd_commentbox_3,
div.c_sd_commentbox_4,
div.c_sd_commentbox_5,
div.c_sd_commentbox_6,
div.c_sd_commentbox_7,
div.c_sd_commentbox_8,
div.c_sd_commentbox_9 {
clear: both;
width: 70%;
margin-top: 20px;
border: 1px solid #999999;
border-radius: 5px 5px;
}

div.c_sd_commentbox_1 {
border: 1px solid #000000;
background-color: #efefef;
}

div.c_sd_commentbox_backend_options {
width: 90%;
text-align: right;
}
div.c_sd_headline_comments {
color: #3d857d;
font-weight: 900;
font-size: 14px;
}
table.c_sd_commentbox {
width: 100%;
border-collapse: collapse;
}
td.c_sd_commentbox_1_a {
width: 80%;
font-weight: 900;
padding: 3px;
}
td.c_sd_commentbox_1_b {
width: 20%;
text-align: right;
padding: 3px;
}
td.c_sd_commentbox_2 {
color: #555555;
padding: 3px;
border-top: 1px dotted #999999;
border-bottom: 1px solid #999999;
}
td.c_sd_commentbox_3 {
text-align: right;
padding: 3px;
}
XML für Sprache Deutsch

Code: Alles auswählen

<?xml version="1.0" encoding="ISO-8859-1"?>
<module><translation origin-language-id="1" origin-language-name="deutsch"><string><original>errormessage_commentemail</original>
<translation>Bitte gebe eine korrekte eMail-Adresse ein.</translation>
</string>
<string><original>errormessage_commentwebsite</original>
<translation>Bitte gebe eine korrekte Webadresse ein.</translation>
</string>
<string><original>errormessage_commenttext</original>
<translation>Bitte gebe Deinen Kommentar ein.</translation>
</string>
<string><original>errormessage_countchas</original>
<translation>Bitte gebe die korrekte Anzahl an Daumen ein.</translation>
</string>
<string><original>headline_form</original>
<translation>Kommentar schreiben:</translation>
</string>
<string><original>confirmation</original>
<translation>Vielen Dank, der Kommentar wird nach Prüfung freigeschaltet.</translation>
</string>
<string><original>name</original>
<translation>Name:</translation>
</string>
<string><original>email</original>
<translation>eMail-Adresse<br>(wird nicht veröffentlicht):</translation>
</string>
<string><original>website</original>
<translation>Website:</translation>
</string>
<string><original>text</original>
<translation>Kommentar:</translation>
</string>
<string><original>how_many_countchas</original>
<translation>Wie viele </translation>
</string>
<string><original>title_right_countcha</original>
<translation>Daumen siehst Du?</translation>
</string>
<string><original>how_many_countchas_hint_spam</original>
<translation>(Diese Abfrage dient zur Vermeidung vom Spam-Einträgen.)</translation>
</string>
<string><original>how_many_countchas_input</original>
<translation>Es sind </translation>
</string>
<string><original>title_right_countcha_input</original>
<translation>Daumen.</translation>
</string>
<string><original>button_text</original>
<translation>Abschicken</translation>
</string>
<string><original>back_to_article</original>
<translation>zurück zum Artikel</translation>
</string>
<string><original>email_header</original>
<translation>Neuer Kommentar!</translation>
</string>
<string><original>email_message_new_comment_for</original>
<translation>Es gibt einen neuen Kommentar für diesen Artikel:</translation>
</string>
<string><original>headline_comments</original>
<translation>Kommentare:</translation>
</string>
<string><original>post_a_comment</original>
<translation>Schreibe einen Kommentar!</translation>
</string>
<string><original>no_comments_yet</original>
<translation>Bisher wurde kein Kommentar verfasst.</translation>
</string>
<string><original>answer_comment</original>
<translation>auf Kommentar antworten</translation>
</string>
<string><original>amount_of_comments_yet</original>
<translation>Anzahl bisheriger Kommentare:</translation>
</string>
<string><original>confirmation_immediately_online</original>
<translation>Vielen Dank für den Kommentar.</translation>
</string>
</translation>
</module>
----------------------------------------

EDIT 08.03.2013: Anpassungen in der Modul-Ausgabe in punkto AMR-Linkprobleme vorgenommen -> http://forum.contenido.org/viewtopic.ph ... 56#p157456

----------------------------------------

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Sa 22. Okt 2011, 17:45
von blau1
Hallo Markus,

da ich ohnehin gerade ein Kommentarmodul am einarbeiten war habe ich jetzt Deine Arbeit verwendet.
Ich kann jetzt noch nichts abschließendes sagen - nur soviel: Klasse Arbeit - vielen Dank.

Die Integration ist einfach - das Modul arbeitet direkt so wie es soll.

Das die Konfiguration im Modul und nicht im Template erfolgt und ein noch nicht freigeschalteter Kommentar gezählt wird sind zwei Kleinigkeiten die zu Anfang auffallen.
Es erscheint dem Seitenbesucher vielleicht merkwürdig wenn er sieht das ein Kommentar abgegeben wurde - er aber nicht zu sehen ist.
Die Konfiguration im Template würde es bei einer Redaktionsgruppe erleichtern die Kommentar-Info direkt an den zuständigen Redakteur zu leiten. Das geht aber auch durch Duplizieren des Moduls... nehme ich mal an.

Die Anmerkungen sollen die Arbeit aber keineswegs schälern - das Modul funktioniert und sieht auch bereits Out of Box gut aus - ein paar kleine css Änderungen und schon kann mal es lassen wie es ist.

Also - vielen Dank von meiner Seite!

Grüße
Michael

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Sa 22. Okt 2011, 18:43
von McHubi
Hallo Michael,
Das die Konfiguration im Modul und nicht im Template erfolgt und ein noch nicht freigeschalteter Kommentar gezählt wird sind zwei Kleinigkeiten die zu Anfang auffallen.
Das ist so beabsichtigt. Denn die Optionen die im Output für die Konfiguration vorgesehen sind, dürften in der Regel für alle Seiten bei denen die Kommentierung erlaubt ist gültig sein. Du kannst es natürlich auch über die Vorkonfiguration regeln, klar. Aber wenn jemand beim Erstellen des Artikels das Template zuweist und im Konfigurationsreiter eigene Kriterien festlegt, können die durch eine Änderung der Vorkonfiguration später nicht mehr automatisch geändert werden. Wenn das allerdings im Output passiert, hast Du das Problem erst gar nicht.

Wenn Du die Konfi aber über den Konfi-Reiter vornehmen möchtest, klar - kein Thema - die paar Inputs, Radio- und Checkboxen sind ja schnell eingerichtetet. :wink:

Was sicher Sinn macht, ist das Hinzufügen eines Input im Konfigurationsreiter für eine zusätzliche Mailadresse für den eMail-Alert, sprich, damit der Redakteur hier separat benachrichtigt werden kann. Für einen Kunden habe ich das letztlich auch so umgesetzt.

Was die gezählten Kommentare betrifft, geb ich Dir Recht. Die dürften nur gezählt werden wenn sie online sind. Aber das lässt sich ja einfach in die sql-query einbinden.
Es erscheint dem Seitenbesucher vielleicht merkwürdig wenn er sieht das ein Kommentar abgegeben wurde - er aber nicht zu sehen ist.
Das kannst Du ja im Output regeln. Je nachdem wie Du es einstellst, Kommentar direkt online oder nicht, kann ja eine eigene Infomeldung erscheinen. Wenn der Kommentar nicht sofort online ist halt eben "Vielen Dank, der Kommentar wird nach Prüfung freigeschaltet." oder "Vielen Dank für den Kommentar."

Freut mich, dass Dir das Modul gefällt und Du Deine eigenen Ideen einbringst um es auf Deine Bedürfnisse anzupassen - dafür ist es ja auch da. :D

Viele Grüße,

Markus

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mi 9. Nov 2011, 14:33
von blau1
Hallo Markus,

mein Projekt neigt sich dem Ende zu.., Dein Modul läuft.
Es gibt leider einen Schönheitsfehler den ich auf die Schnelle nicht in den Griff bekommen habe.

Beim Editieren eines Artikels (der logischerweise ein Template mit dem Modul nutzt) erhalte ich über dem Modul die Fehlermeldung:

Warning: Invalid argument supplied for foreach() in /homepages/45/d99988503/htdocs/entwicklung/contenido/includes/include.con_editcontent.php(634) : eval()'d code on line 703

Die Meldung kommt jedoch nur bei Artikeln die noch keinen Eintrag haben.

Hast Du eine Idee??

Gruße
Michael

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mi 9. Nov 2011, 21:04
von McHubi
Hallo Michael,

hm... an sich wird ja im Code an einigen Stellen per if($amount_of_comments>0) danach geprüft ob Kommentare vorhanden sind oder nicht. Insofern sollten die dahinter liegenden foreach erst gar nicht ausgeführt werden.

Ich habe das Modul mittlerweile in einer stark ausgebauten Version im Einsatz, die ich erst einmal nicht veröffentlichen werde, so dass ich Deinen Fehler so adhoc jetzt nicht nachvollziehen kann. Ich hab die "Unmengen" an foreach jedoch mal ausgedünnt (z. B. alle innerhalb der if(debug=="true") fallen ja flach wenn Du den Debug-Modus nicht eingeschaltet hast) und Du solltest mal hier schauen:

ca. Zeile 452: function level_extractor($levelcounter)
ca. Zeile 462: function collect_level_parent_ids($extracted_levels)
ca. Zeile 475: function integrate($parent_id,$ids_for_function_integrate)
ca. Zeile 492, 504, 521: function collect_ids_to_integrate($collected_level_parent_ids)
ca. Zeile 539: //LEVEL 0
ca. Zeile 599: /****** begin building the comment tree ******/

So ein foreach-Fehler kommt immer dann, wenn für foreach(xyz AS element) kein "each" vorhanden ist - sprich, aus nix ein element gezogen werden soll. Lass Dir an den Stellen einfach mal die Werte von xyz ausgeben. Wenn Du hier Daten bekommst, liegst Du falsch, wenn Dir an einer Stelle "leer" ausgegeben wird hast Du den Punkt gefunden wo Du foreach mit einer entsprechenden Bedingung unterdrücken musst.

Schreib mal wenn Du es gefunden hast, dann kann ich den Code im ersten Post ggf. erweitern.

Bis dann, :D


Markus

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Do 10. Nov 2011, 19:19
von blau1
Hallo Markus,

vielen Dank für den Tip.

Ich konnte die Fehlermeldung im Backend jetzt einbremsen.

Die Änderung:

Die Schleife bei Zeile 128:
foreach($ids_to_select AS $element)
{
$select=$select.'<option>'.$element.'</option>';
}

habe ich jetzt eingebunden in die Abfrage nach der Anzahl von Kommentaren:

$amount_of_comments = mysql_num_rows($result);
if($amount_of_comments>0)
{
foreach($ids_to_select AS $element)
{
$select=$select.'<option>'.$element.'</option>';
}
}

Das hat funktioniert.

Grüße
Michael

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Fr 11. Nov 2011, 11:00
von McHubi
Hallo Michael,

Danke für Deine Rückmeldung. :D Habe den Code zum Output im ersten Post entsprechend angepasst. Wer's sucht: ist mit //edit blau1 kommentiert.

Bis dann,


Markus

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mo 5. Dez 2011, 15:36
von Andreas
Hi,

besteht die Möglichkeit, im Modul das Datum der jeweiligen Kommentare auf das deutsche Format (z.B. 01.03.2012 anstelle 2012-03-01) umzustellen?

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mo 5. Dez 2011, 15:54
von McHubi
Hallo Andreas,

klar... suchmaschine.de :wink: oder Du ergänzt einfach die function datatransfer nach
global $array_displayed_comments,$contenido,$template_commentbox,$template_commentbox_no_more_comments,$enable_coc,$enable_br,$level_margin;
um das hier:

Code: Alles auswählen

$d=explode("-",$commentdate);
$commentdate=sprintf("%02d.%02d.%04d", $d[2], $d[1], $d[0]);
Code im ersten Posting ist entsprechend ergänzt... :D

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mo 5. Dez 2011, 16:05
von Andreas
Super! Danke!
Das ging schnell :D

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Fr 9. Dez 2011, 17:31
von Nepstar
Herzlichen Dank auch von meiner Seite!!

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Fr 9. Dez 2011, 18:33
von Spider IT
McHubi hat geschrieben:

Code: Alles auswählen

$d=explode("-",$commentdate);
$commentdate=sprintf("%02d.%02d.%04d", $d[2], $d[1], $d[0]);
Oder vielleicht

Code: Alles auswählen

$commentdate = date('d.m.Y', strtotime($commentdate));
Gruß
René

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Fr 6. Jan 2012, 11:42
von caps-log
Hallo,

ich habe die Installation des Moduls soweit zum Laufen bekommen, stoße jedoch auf das Problem, daß Einträge
nicht gespeichert werden... In der Contenido-System-Übersicht kommt folgende Fehlermeldung

blau1 hat geschrieben:
[06-Jan-2012 11:14:24] PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/portal/contenido/includes/include.con_editcontent.php(634) : eval()'d code on line 569
[06-Jan-2012 11:14:24] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/portal/contenido/includes/include.con_editcontent.php(634) : eval()'d code on line 574
[06-Jan-2012 11:14:24] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/portal/contenido/includes/include.con_editcontent.php(634) : eval()'d code on line 834
Hat jemand ne idee, worans liegen könnte?

Danke vorab,
T. Licker

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Mo 9. Jan 2012, 14:49
von McHubi
Hi,

lass Dir an den genannten Stellen - such mal im Code nach mysql_fetch_array( - ausgeben was in §result enthalten ist. Vermutlich nix und daher der Fehler...

Re: Kommentarmodul mit Spamschutz und Baumstruktur

Verfasst: Sa 28. Jan 2012, 11:36
von tagkalle
Hallo,
Danke für das Modul. Es ist Super.
Habe eine Frage: Kann man das Modul einstellen, dass das aktuelle Datum immer oben steht?
mfg
tagkalle