Author Topic: readcomments MOD  (Read 13284 times)

0 Members and 1 Guest are viewing this topic.

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
readcomments MOD
« on: January 23, 2006, 01:58:24 AM »
Hi there,

at a few time ago in this board where a mod that user can see new comments from his images. Today i have see that it brings me a blank page when i click on this link

http://www.terraristik-galerie.de/member.php?action=readcomments

I don´t have find this Mod and i have no changes made in the member.php at a long time. Can anyone say me what is wrong with it??
This is the function in the member.php

Code: [Select]
if ($action == "readcomments") {
  if ($user_info['user_level'] >= GUEST) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
   $txt_clickstream = "Comments";
   if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
     $commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
     if ($commentsetperpage) {
       $site_sess->set_session_var("commentperpage", $commentsetperpage);
       $session_info['commentperpage'] = $commentsetperpage;
     }
   }

   if (isset($session_info['commentperpage'])) {
     $commentperpage = $session_info['commentperpage'];
   }
   else {
     $commentperpage = 5;
   }
   $commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
   for($i = 1; $i <= 15; $i++) {
     $setvalue = 1 * $i;
     $commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
       if ($setvalue == $commentperpage) {
       $commentsperpage_dropdown .= " selected=\"selected\"";
     }
     $commentsperpage_dropdown .= ">";
     $commentsperpage_dropdown .= $setvalue;
     $commentsperpage_dropdown .= "</option>\n";
   }
   $commentsperpage_dropdown .= "</select>\n";

   $site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
   $commentsperpage_dropdown_form = $site_template->parse_template("member_commentsdropdown_form");
   $site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);

  $sql = "SELECT COUNT(c.comment_id) AS comments
        FROM ".COMMENTS_TABLE." c
        LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
        WHERE i.user_id = ".$user_info['user_id']." AND c.is_read = 0";
   $result = $site_db->query_firstrow($sql);
   $site_db->free_result();
   $num_comments = $result['comments'];
   if ($action == "postcomment") {
      $page = ceil($num_comments / $commentperpage);
   }
   $num_rows_all = (isset($num_comments)) ? $num_comments : 0;
   $link_arg = $site_sess->url(ROOT_PATH."member.php?action=readcomments");
   include(ROOT_PATH.'includes/paging.php');
   $getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
   $offset = $getpaging->get_offset();
   $get_comment_stats = ($num_comments) ? $getpaging->get_paging_stats() : "";
   $comment_stats = preg_replace("/image/", "comment", $get_comment_stats);
   $site_template->register_vars(array(
     "paging" => $getpaging->get_paging(),
     "paging_stats" => $comment_stats
   ));
  $additional_sql = "";
  if (!empty($additional_user_fields)) {
    $table_fields = $site_db->get_table_fields(USERS_TABLE);
    foreach ($additional_user_fields as $key => $val) {
      if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
        $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
      }
    }
  }
  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date, i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file".$additional_sql.get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
        FROM ".COMMENTS_TABLE." c
        LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
        WHERE i.user_id = ".$user_info['user_id']." AND c.is_read = 0
        ORDER BY c.comment_date ASC
          LIMIT $offset, $commentperpage";
  $result = $site_db->query($sql);
  $comment_row = array();
  while ($row = $site_db->fetch_array($result)) {
    $comment_row[] = $row;
  }
  $site_db->free_result($result);
  $num_comments = sizeof($comment_row);

  if (!$num_comments) {
    $comments = "<tr><td class=\"commentrow1\" colspan=\"2\"> Es sind keine ungelesenen Kommentare vorhanden. </td></tr>";
  }
  else {
    $comments = "";
    $bgcounter = 0;
    for ($i = 0; $i < $num_comments; $i++) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

      $comment_user_email = "";
      $comment_user_email_save = "";
      $comment_user_mailform_link = "";
      $comment_user_email_button = "";
      $comment_user_homepage_button = "";
      $comment_user_icq_button = "";
      $comment_user_profile_button = "";
      $comment_user_status_img = REPLACE_EMPTY;
      $comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
      $comment_user_info = $lang['userlevel_guest'];

      $comment_user_id = $comment_row[$i]['user_id'];

      if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        $comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
       
        $comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$comment_user_id);
        $comment_user_profile_button = "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";
       
        $comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";
       
        $comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
        if (!empty($comment_user_homepage)) {
          $comment_user_homepage_button = "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
        }
       
        $comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? $comment_row[$i][$user_table_fields['user_icq']] : "";
        if (!empty($comment_user_icq)) {
          $comment_user_icq_button = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://web.icq.com/whitepages/online?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
        }
       
        if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
          $comment_user_email = $comment_row[$i][$user_table_fields['user_email']];
          $comment_user_email_save = str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]);
          if (!empty($url_mailform)) {
            $comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
          }
          else {
            $comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
          }
          $comment_user_email_button = "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
        }

        if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
          $comment_user_info = $lang['userlevel_user'];
        }
        elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
          $comment_user_info = $lang['userlevel_admin'];
        }
       
        $comment_user_info .= "<br />";
        $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
        $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
      }

      $comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
     
      $admin_links = "";
      if ($user_info['user_level'] == ADMIN) {
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }
      elseif ($is_image_owner) {
        $admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
      }
      $image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id']);
     $image_link = "<b><a href=\"".$image_url."\">".$comment_row[$i]['image_name']."</a></b>";
      $site_template->register_vars(array(
        "thumb" => "<a href=\"".$image_url."\">".get_thumbnail_code($comment_row[$i]['image_media_file'], $comment_row[$i]['image_thumb_file'], $comment_row[$i]['image_id'], $comment_row[$i]['cat_id'])."</a>",
        "count" => $i,
        "image_name" => $image_link,
        "comment_id" => $comment_row[$i]['comment_id'],
        "comment_user_id" => $comment_user_id,
        "comment_user_status_img" => $comment_user_status_img,
        "comment_user_name" => $comment_user_name,
        "comment_user_info" => $comment_user_info,
        "comment_user_profile_button" => $comment_user_profile_button,
        "comment_user_email" => $comment_user_email,
        "comment_user_email_save" => $comment_user_email_save,
        "comment_user_mailform_link" => $comment_user_mailform_link,
        "comment_user_email_button" => $comment_user_email_button,
        "comment_user_homepage_button" => $comment_user_homepage_button,
        "comment_user_icq_button" => $comment_user_icq_button,
        "comment_user_ip" => $comment_user_ip,
        "comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
        "comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        "comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
        "row_bg_number" => $row_bg_number,
        "admin_links" => $admin_links
      ));
      $comments .= $site_template->parse_template("new_comment_bit");
    } // end while
  } //end else
  $site_template->register_vars("comments", $comments);
  unset($comments); 
 
  $content = $site_template->parse_template("member_comments");
 
}
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: readcomments MOD
« Reply #1 on: January 23, 2006, 02:12:57 AM »
Find :

Quote

if ($action == "readcomments") {
  if ($user_info['user_level'] >= GUEST) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }


replace with :

Code: [Select]

if ($action == "readcomments") {
if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
   $user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
   if (!$user_id) {
     $num_comments = "";
     $user_id = GUEST;
   }


Then, find :

Quote

unset($comments);
 
  $content = $site_template->parse_template("member_comments");


add below :

Code: [Select]

}


;)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: readcomments MOD
« Reply #2 on: January 23, 2006, 02:19:16 AM »
I think this is no help for me. You say me abou the
Code: [Select]
if ($action == "showcomments") {function.

This i have over the
Code: [Select]
if ($action == "readcomments") {function

This is my full member.php

Member.php
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: readcomments MOD
« Reply #3 on: January 23, 2006, 02:26:53 AM »
I think this is no help for me. You say me abou the
Code: [Select]
if ($action == "showcomments") {function.


I'm ... not sure what you mean exacly ... your paragraph from your first post indicates the "readcomments" and not "showcomments" ... is there something I'm missing ?

[ edit ]

The topic I have showed above, now I get it. You're right, it was looking so much similar I forgot to look at the action name. My apologize.  :oops:

However, fortunitely, I gave you more instructions with that. ;)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: readcomments MOD
« Reply #4 on: January 23, 2006, 03:18:30 AM »
@JensF:

Ok, I have just took a look at your entire file and it would seems this MOD is depending on other codings from other files that might of been instructed so from the original package of the " read comments " MOD. Meaning, if it cannot be found no more, on this forum, it is unlikely it could be easily resolved.  :|

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: readcomments MOD
« Reply #5 on: January 23, 2006, 03:31:53 AM »
Here is a google cached page of that mod.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: readcomments MOD
« Reply #6 on: January 23, 2006, 11:18:38 AM »
Here is a google cached page of that mod.

HI, thanks for this. Now i have reinstall the Mod and it works....but where can i find site 2 and 3 from the Mod???

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: readcomments MOD
« Reply #7 on: January 23, 2006, 02:24:10 PM »
If you mean pages 2 and 3 of that mod, then I guess they are gone...:(
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: readcomments MOD
« Reply #8 on: January 23, 2006, 10:53:39 PM »
If you mean pages 2 and 3 of that mod, then I guess they are gone...:(

Yes, this is what i mean. But OK.....The Mod works but without thumbnails...It´s OK!!!
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: readcomments MOD
« Reply #9 on: January 23, 2006, 11:37:25 PM »
hallo!
thank you very much!
the mod works. I've the same problem with the thumbnails, too.
it's display the thumb of the first comment into the next followed comments.

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: readcomments MOD
« Reply #10 on: January 23, 2006, 11:47:29 PM »
Bei mir wird gar kein Thumb angezeigt, nur der Link Name den man dann auch anklicken kann. Bevor das Ding bei mir gechrasht ist (ich weiß immer noch nicht wieso) da konnte ich auch das Thumbnail sehen.....

Aber ich bin froh das es so erstmal wieder geht :)
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline TRAKTOR_WEB

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: readcomments MOD
« Reply #11 on: September 30, 2012, 08:34:30 AM »
V@no, подскажите как сделать исключение для своих комментариев, чтобы они на этой странице не отображались?