Author Topic: [Mod] Mail Owner of image when Comment is Posted  (Read 241017 times)

0 Members and 2 Guests are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #150 on: August 20, 2007, 03:50:10 AM »
Examp:

http://www.cyclone-hosting.net/images/cpanel.png

Analysis and log files - > error log.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline vipersgarden

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #151 on: August 28, 2007, 03:48:45 PM »
Ich habe das MOD installiert und es funktioniert wunderbar!

Aber ich habe ein kleines Problem!
Ich habe für die verschiedenen User verschiedene Sprachen zur Auswahl.
Wenn ich jetzt auf z.B. Französisch stelle und dann einen Kommentar poste, bekomme ich eine mail mit französischem (natürlich von mir in den {lang, french, email, comment_email} vorgegebenen) Text.
Hab ich was überlesen oder gibt es hier noch keine Lösung?
Super wäre, wenn der Bildeigentümer diese mail in der von ihm eingestellten Sprache erhalten würde und nicht in der Sprache des Absenders!

I´ve installed this MOD and it works perfect!

But there is a little problem!
I have different languages, which could be joined by users.
When I set now to French and post a comment, I will get an email with French text (this one I´ve written within {lang, french, email, comment_email}, not the text posted.
Do I have overread something or is there no resolution at the time?
It would be good, if the image owner would get the email in his language and not in the language of the comment poster!


Thx
Mario Schweiger


Offline vipersgarden

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #152 on: August 28, 2007, 04:59:54 PM »
....... und hier sind die Texte in verschiedenen Sprachen (falls sie jemand braucht). Nur "Friends of Vipersgarden" gegen Euren Galerie Namen austauschen.:
...... and here are the texts (if somebody will need them). Just change "Friends of Vipersgarden" to your gallery name:

in Italian:
Code: [Select]
Caro {recipient_name},
 
{user_name} ha inviato un commento alla tua immagine: "{image_name}", nella galleria dell'utente "Friends of VipersGarden".
 
{comment_headline}:
 
{comment_text}
 
Per leggere il commento clicca qui: {image_url}
 
------
Saluti, {site_name}

in French:
Code: [Select]
Bonjour {recipient_name},
 

{user_name} a ajouté(e) un commentaire sur votre image: "{image_name}", dans la galérie d'images {Friends of VipersGarden}.
 

{comment_headline}:
 

{comment_text}
 

Pour lire le commentaire suivez ce lien: {image_url}
 

------
Cordialement, {site_name}

in Deutsch:
Code: [Select]
Lieber {recipient_name},

{user_name} hat ein Kommentar zu Deinem Bild: "{image_name}" bei Friends of VipersGarden Benutzer-Bildergalerie abgegeben.

{comment_headline}:

{comment_text}

Hier kannst Du es lesen: {image_url}

------
Mit freundlichen Grüßen, {site_name}

and in English:
Code: [Select]
Dear {recipient_name},

{user_name} posted a comment on your image: "{image_name}", at Friends of VipersGarden - User gallery.

{comment_headline}:

{comment_text}

To view the comment go to: {image_url}

------
Best regards, {site_name}

mit freundlichen Grüßen
Kind regardes

Mario
Mario Schweiger


Offline vipersgarden

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #153 on: September 05, 2007, 02:22:31 PM »
Ich glaube, dass ein derartiges MOD für alle, die ihre Galerie multilingual betreiben von grossem Nutzen wäre !!

Ich habe jetzt in der Datenbank unter "4images_users" ein Feld "user_language" eingerichtet.
Und in den template.html (member_editprofile.html, member_profile.html und register_form) die entsprechenden Felder ergänzt.
Funktioniert alles wunderbar!

I´m sure, a MOD like this would be very usefull for all, having their gallery multilingual.

I´ve made within the database a new field "user_language" and also made fields in the template.html files (member_editprofile.html, member_profile.html and register_form).
Works fine!




Jetzt müßte nur noch bei Versendung einer e-mail die Sprache des Empfängers (z.B. bei posting eines Kommentars, mails vom Admin, usw.) aus der Datenbank ausgelesen werden und die mail in der entsprechenden Sprache versandt werden.
Es ist ja ziemlich uninteressant, wenn z.B. ein Benutzer mit französischer Spracheinstellung ein Kommentar zu einem Bild postet und der kroatische Bildeigentümer dann die mail (nur den Text in der lang/email) in französisch erhält!
Aber wie geht das ????????

Now the script should look in the database for the language of the recipient and the mail should be sent in this language.
It´s not very good, when, for example, user choosen french is posting a comment to an image and the croatian imageowner gets this mail (only the text from lang/email) in french!

Sounds pretty simple! But how it works ?????

Thanks
Mario
Mario Schweiger


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #154 on: September 05, 2007, 02:33:33 PM »
Quote
Now the script should look in the database for the language of the recipient and the mail should be sent in this language.
It´s not very good, when, for example, user choosen french is posting a comment to an image and the croatian imageowner gets this mail (only the text from lang/email) in french!
Sounds pretty simple! But how it works ?????

Can try this:

http://www.4homepages.de/forum/index.php?topic=6749.0

can use [english][french] - all install lang in folder lang with tag foreach text (and email text) you like. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline P.Sterni

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #155 on: January 28, 2008, 11:11:39 PM »
Hallo Leute,

irgendwie habe ich hier keinen Durchblick mehr. 
Da ich kein englisch kann, würde ich mich riesig freuen wenn mir jemand den Vollständigen Script mal zumailen könnte.


Gruß
Peter

Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #156 on: March 20, 2008, 11:52:42 AM »
hi, dem schließe ich mich an:
es muss ja nur einmal zusammenhängend sein, und vor allem für V 1.7.6 kompertiebel

denn dort gibts kein:
Code: [Select]
$site_db->query($sql);
      $commentid = $site_db->get_insert_id();
      update_comment_count($id, $user_info['user_id']);

nur:

Code: [Select]
$site_db->query($sql);
}

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------

fügt man es dazwischen ein, bleibt die details.php beim Aufruf leer

...und wie der letzte Poster geschrieben hat, überschlagen sich in diesem Thread die Ereignisse

schöner wäre, eine normale Anleitung, angepasst an Version 1.7.6

dann würde der MOD auch funktionieren (für mein Mini-Anspruch)

Offline fritz_der_zweite

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #157 on: April 06, 2008, 08:53:59 PM »
Würde dies auch begrüßen.
Blicke bei dem langen Thread auch nicht mehr durch, wie der genue Mod aktuell am besten für die neue Version 1.7.6 auszusehen hat   :?

Offline Neo1

  • Full Member
  • ***
  • Posts: 202
    • View Profile
    • http://www.terradreams.de/
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #158 on: May 16, 2008, 10:51:57 PM »
Hallo,

leider funktionierte meine Galerie (v.1.7.) nach dem Umzug auf einen neuen Server nicht mehr richtig. Ich habe dann den Fehler gefunden ...es lag an der neuen PHP version ..in dem Fall PHP Version 5.1.6

Ich habe nun alle Probleme damit http://www.4homepages.de/forum/index.php?topic=10184.15 beheben können allerdings bleibt diese Mod, die leider nicht funktioniert. Es werden keine Mails mehr versendet. Kann mir vielleicht jemand helfen? Der Code ist noch original wie auf Seite 1 dieses Threads.

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #159 on: July 29, 2008, 06:39:15 PM »
Also ich habe

      $site_db->query($sql);
      $commentid = $site_db->get_insert_id();
      update_comment_count($id, $user_info['user_id']);

in 1.7.6

Habe es gerade mit dem Code von Seite1 in 1.7.6 geprüft; Geht alles wunderbar...

4images in Benutzung/use seit/since 2002 / Version 1.7.6

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #160 on: August 02, 2008, 12:09:17 AM »
Hallo,

ich verwende dieses hier: http://www.4homepages.de/forum/index.php?topic=2705.msg58205#msg58205
Doch leider kommt keine Mail an!?

Das Kommentar erscheint auf der Seite aber oben steht ein Fehler:
Quote
An unexpected error occured. Please try again later.

details.php
Code: [Select]
<?php
$action 
$HTTP_GET_VARS['action'];

if  (
$action == 'calendarprint') {
$main_template 'calendar';
}
else {
$main_template 'details';
}

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

if (!
$image_id) {
    
redirect($url);
}

$additional_sql "";
if (!empty(
$additional_user_fields)) {
  foreach (
$additional_user_fields as $key => $val) {
    
$additional_sql .= ", u.".$key;
  }
}
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_id = 
$image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 0;

if (!
check_permission("auth_viewcat"$cat_id) || !check_permission("auth_viewimage"$cat_id) || !$image_row) {
  
redirect($url);
}

$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image($cat_id);
$site_template->register_vars("random_cat_image"$random_cat_image);
unset(
$random_cat_image);

//################################ Start MOD Ajax Slideshow/Diashow ##############################
$max_length_image_name 65;
$max_length_image_description 55;
$ajax_slideshow_view 0;

  
$ajax_slideshow "<script type=\"text/javascript\" src=\"templates/".$config['template_dir']."/js/diashow.js\"></script>\n";
  
$ajax_slideshow .= "<script type=\"text/javascript\">\n<!-- \n";
  
$ajax_slideshow .= "var viewer = new PhotoViewer();\n";
  
$ajax_slideshow .= "viewer.setSlideDuration(".$config['ajax_slideshowviewer_setSlideDuration'].");\n";
  
$ajax_slideshow .= "viewer.disablePanning();\n";
  
$ajax_slideshow .= "viewer.disableAutoPlay();\n";
  
$ajax_slideshow .= "viewer.".$config['ajax_slideshowviewer_Fading']."Fading();\n";
  
$ajax_slideshow .= "viewer.setBackgroundColor('".$config['ajax_slideshowviewer_setBackgroundColor']."');\n";
  
$ajax_slideshow .= "viewer.setBorderWidth(".$config['ajax_slideshowviewer_setBorderWidth'].");\n";
  
$ajax_slideshow .= "viewer.setFontSize(".$config['ajax_slideshowviewer_setFontSize'].");\n";
  
$ajax_slideshow .= "viewer.".$config['ajax_slideshowviewer_Shade']."Shade();\n";
  
$ajax_slideshow .= "viewer.setShadeColor('".$config['ajax_slideshowviewer_setShadeColor']."');\n";
  
$ajax_slideshow .= "viewer.setShadeOpacity('".$config['ajax_slideshowviewer_setShadeOpacity']."');\n";
  
$ajax_slideshow .= "viewer.".$config['ajax_slideshowviewer_Loop']."Loop();\n";
  
$ajax_slideshow .= "viewer.setOnClickEvent(viewer.close);\n";
  
$ajax_slideshow .= "viewer.disableToolbar();\n";
  
$count 0;
  
$bgcounter 0;

   
$ext get_file_extension($image_row['image_media_file']);
   
$config['ajax_slideshowviewer_Types_array'] = explode(","$config['ajax_slideshowviewer_Types']);
   if (
in_array($ext$config['ajax_slideshowviewer_Types_array'])) {
   
$ajax_slideshow_view 1;
   
show_image($image_row);
   
$image_name_short = (isset($image_row['image_name']) && strlen($image_row['image_name']) > $max_length_image_name) ? substr(format_text(stripslashes($image_row['image_name']), 2), 0$max_length_image_name)."..." format_text(stripslashes($image_row['image_name']), 2);
   
$image_name_short str_replace("\r","",$image_name_short);
   
$image_name_short str_replace("\n","",$image_name_short);
   
$image_name_short str_replace("<br>","",$image_name_short);
   
$image_name_short str_replace("<br />","",$image_name_short);
   
$image_name_short str_replace("'","",$image_name_short);
   
$image_name_short str_replace("&lt;","<",$image_name_short);
   
$image_name_short str_replace("&gt;",">",$image_name_short);
   
$image_name_short stripslashes($image_name_short);
   
$image_name_short "".$lang['image_name'].$image_name_short";

   if (
$config['ajax_slideshowviewer_description'] == "enable") {
   
$image_description_short = (isset($image_row['image_description']) && strlen($image_row['image_description']) > $max_length_image_description) ? substr(format_text(stripslashes($image_row['image_description']), 101), 0$max_length_image_description)."..." format_text(stripslashes($image_row['image_description']), 101);
   
$image_description_short str_replace("\r","",$image_description_short);
   
$image_description_short str_replace("\n","",$image_description_short);
   
$image_description_short str_replace("<br>","",$image_description_short);
   
$image_description_short str_replace("<br />","",$image_description_short);
   
$image_description_short str_replace("'","",$image_description_short);
   
$image_description_short str_replace("&lt;","<",$image_description_short);
   
$image_description_short str_replace("&gt;",">",$image_description_short);
   
$image_description_short stripslashes($image_description_short);

   if (
$image_description_short == "")  {
   
$image_description_short "&nbsp;";
   } else {
    
$image_description_short "<br>".$lang['description'].$image_description_short";
   }
   }
   else {
   
$image_description_short "&nbsp;";
   }
   
$ajax_slideshow .= "viewer.add('".MEDIA_DIR."/".$image_row['cat_id']."/".$image_row['image_media_file']."', '".$image_description_short."', '".$image_name_short."');\n";
   }

  if (
$count 0)  {
    
$leftover = ($config['image_cells'] - $count);
  }
  
$ajax_slideshow .= "//-->\n</script>\n";

if (
$user_info['user_level'] == GUEST && $config['ajax_slideshowviewer_Show'] == "1" && $ajax_slideshow_view == "1") {
  
$ajax_slideshow_button "<img src=\"".get_gallery_image("diashow_off.gif")."\" border=\"0\" alt=\"\" />";
  
$site_template->register_vars(array(
  
"ajax_slideshow_button" => $ajax_slideshow_button
  
));
}
elseif (
$user_info['user_level'] != GUEST && $config['ajax_slideshowviewer_Show'] == "1" && $ajax_slideshow_view == "1" || $config['ajax_slideshowviewer_Show'] == "2" && $ajax_slideshow_view == "1") {
  
$ajax_slideshow_button "<a href=\"javascript:void(viewer.show(0))\"><img src=\"".get_gallery_image("diashow.gif")."\" border=\"0\" alt=\"\" /></a>";
  
$site_template->register_vars(array(
  
"ajax_slideshow" => $ajax_slideshow,
  
"ajax_slideshow_button" => $ajax_slideshow_button
  
));
}
else {
  
$site_template->register_vars(array(
  
"ajax_slideshow" => "",
  
"ajax_slideshow_button" => "",
));
}
unset(
$ajax_slideshow);
//################################ End MOD Ajax Slideshow/Diashow ##############################

//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment"$cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name format_text($image_row['image_name'], 2);
//----------------------------------------------------- 
//--- Image Terms ------------------------------------- 
//----------------------------------------------------- 
if ($action == "terms") { 
  
terms_add($cat_id, (($image_row['terms']) ? $image_id "")); 

$terms 0
if (!
terms_check($cat_id, (($image_row['terms']) ? $image_row "")) && $action != "terms"

  if (
$image_row['terms']) 
  { 
    
$terms_agreement = ($lang['terms_agreement'][$image_row['terms_msg']]) ? $lang['terms_agreement'][$image_row['terms_msg']] : $lang['terms_agreement'][0]; 
  } 
  else 
  { 
    
$terms_agreement = ($lang['terms_agreement'][$cat_cache[$cat_id]['terms_msg']]) ? $lang['terms_agreement'][$cat_cache[$cat_id]['terms_msg']] : $lang['terms_agreement'][0]; 
  } 
  
$site_template->register_vars(array( 
    
"url_home" => $site_sess->url(ROOT_PATH."index.php"), 
    
"lang_terms" => $lang['terms'], 
    
"mode" => $mode,
    
"lang_terms_agreement" => $terms_agreement
    
"lang_agree" => $lang['agree'], 
    
"lang_agree_not" => $lang['agree_not'
  )); 
  
$terms $site_template->parse_template("terms"); 

$site_template->register_vars(array( 
    
"show_terms" => $terms
    
"no_terms" => ($terms) ? 
)); 
//--- End Image Terms ------------------------------------- 
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
$lightbox_id = (isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) ? $HTTP_POST_VARS['lightbox_id'] : ((isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']) ? $HTTP_GET_VARS['lightbox_id'] : 0);
show_image($image_row$mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id ""), 01);
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

//--- Start mod: pin images -----------------------------
$image_pin_allow $image_row['image_pin_allow'];
$ext get_file_extension($image_row['image_media_file']);
$allow_filetypes = array('jpg','jpeg','JPG','JPEG','gif','bmp','png');
if (
in_array($ext$allow_filetypes) && $image_pin_allow == '1') {
$image_pin_allow '1'; } else {
$image_pin_allow '0';
}
//--- End mod: pin images -------------------------------

$in_mode 0;

$sql "";
if (
$mode == "lightbox") {
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  
$ids $user_info['lightbox_image_ids'];
  if (
$lightbox_id)
  {
    
$sql "SELECT l.lightbox_id, l.lightbox_name, l.lightbox_private, l.lightbox_image_ids, l.user_id, u.user_name, u.user_lightbox_private
            FROM "
.LIGHTBOXES_TABLE." l
            LEFT JOIN "
.USERS_TABLE." u ON u.user_id = l.user_id
            WHERE l.lightbox_id = '"
.$lightbox_id."'";
    if (
$row $site_db->query_firstrow($sql))
    {
      
$ids = (!$row['lightbox_private'] && $row['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN ) ? $row['lightbox_image_ids'] : "";//$user_info['lightbox_image_ids'];
      
$lightbox_name $row['lightbox_name']." (".$row['user_name'].")";
    }
    else
    {
      
$lightbox_name "";
    }
  }
  else
  {
    
$lightbox_name $user_info['lightboxes'][$user_info['user_lightbox']]['name'];
  }
  
$txt_clickstream $lang['lightbox'].(($lightbox_name) ? " - ".$lightbox_name "");
  if (!empty(
$ids)) {
    
$image_id_sql str_replace(" "", "trim($ids));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/
    
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM "
.IMAGES_TABLE."
            WHERE image_active = 1 AND image_id IN (
$image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))
            ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
    
$in_mode 1;
  }
}
elseif (
$mode == "search") {
  if (!isset(
$session_info['searchid']) || empty($session_info['searchid'])) {
    
$session_info['search_id'] = $site_sess->get_session_var("search_id");
  }

  if (!empty(
$session_info['search_id'])) {
    
$search_id unserialize($session_info['search_id']);
  }

  
$sql_where_query "";

  if (!empty(
$search_id['image_ids'])) {
    
$sql_where_query .= "AND image_id IN (".$search_id['image_ids'].") ";
  }

  if (!empty(
$search_id['user_ids'])) {
    
$sql_where_query .= "AND user_id IN (".$search_id['user_ids'].") ";
  }

  if (!empty(
$search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    
$new_cutoff time() - 60 60 24 $config['new_cutoff'];
    
$sql_where_query .= "AND image_date >= $new_cutoff ";
  }

  if (!empty(
$search_id['search_cat']) && $search_id['search_cat'] != 0) {
    
$cat_id_sql 0;
    if (
check_permission("auth_viewcat"$search_id['search_cat'])) {
      
$sub_cat_ids get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
      
$cat_id_sql .= ", ".$search_id['search_cat'];
      if (!empty(
$sub_cat_ids[$search_id['search_cat']])) {
        foreach (
$sub_cat_ids[$search_id['search_cat']] as $val) {
          if (
check_permission("auth_viewcat"$val)) {
            
$cat_id_sql .= ", ".$val;
          }
        }
      }
    }
    
$cat_id_sql $cat_id_sql !== "AND cat_id IN ($cat_id_sql)" "";
  }
  else {
    
$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");
    
$cat_id_sql $cat_id_sql !== "AND cat_id NOT IN (".$cat_id_sql.")" "";
  }

  if (!empty(
$sql_where_query)) {
    
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM "
.IMAGES_TABLE."
            WHERE image_active = 1
            
$sql_where_query
            
$cat_id_sql
            ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
    
$in_mode 1;
  }
}
if (!
$in_mode || empty($sql)) {
  
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND cat_id = 
$cat_id
          ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
}
$result $site_db->query($sql);

$image_id_cache = array();
$next_prev_cache = array();
$break 0;
$prev_id 0;
while(
$row $site_db->fetch_array($result)) {
  
$image_id_cache[] = $row['image_id'];
  
$next_prev_cache[$row['image_id']] = $row;
  if (
$break) {
    break;
  }
  if (
$prev_id == $image_id) {
    
$break 1;
  }
  
$prev_id $row['image_id'];
}
$site_db->free_result();

if (!
function_exists("array_search")) {
  function 
array_search($needle$haystack) {
    
$match false;
    foreach (
$haystack as $key => $value) {
      if (
$value == $needle) {
        
$match $key;
      }
    }
    return 
$match;
  }
}

$act_key array_search($image_id$image_id_cache);
$next_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
$prev_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
unset(
$image_id_cache);

// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
  
$next_image_name format_text($next_prev_cache[$next_image_id]['image_name'], 2);
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  
$next_image_url $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id "") : ""));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/
  
if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media"$next_prev_cache[$next_image_id]['cat_id'], 00)) {
    
$next_image_file ICON_PATH."/404.gif";
  }
  else {
    
$next_image_file get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media"$next_prev_cache[$next_image_id]['cat_id'], 01);
  }
  if (!
get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$next_image_id]['cat_id'], 00)) {
    
$next_thumb_file ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
  }
  else {
    
$next_thumb_file get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$next_image_id]['cat_id'], 01);
  }
}
else {
  
$next_image_name REPLACE_EMPTY;
  
$next_image_url REPLACE_EMPTY;
  
$next_image_file REPLACE_EMPTY;
  
$next_thumb_file REPLACE_EMPTY;
}

if (!empty(
$next_prev_cache[$prev_image_id])) {
  
$prev_image_name format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  
$prev_image_url $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id "") : ""));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/
  
if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media"$next_prev_cache[$prev_image_id]['cat_id'], 00)) {
    
$prev_image_file ICON_PATH."/404.gif";
  }
  else {
    
$prev_image_file get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media"$next_prev_cache[$prev_image_id]['cat_id'], 01);
  }
  if (!
get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$prev_image_id]['cat_id'], 00)) {
    
$prev_thumb_file ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
  }
  else {
    
$prev_thumb_file get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$prev_image_id]['cat_id'], 01);
  }
}
else {
  
$prev_image_name REPLACE_EMPTY;
  
$prev_image_url REPLACE_EMPTY;
  
$prev_image_file REPLACE_EMPTY;
  
$prev_thumb_file REPLACE_EMPTY;
}

$site_template->register_vars(array(
  
"next_image_id" => $next_image_id,
  
"next_image_name" => $next_image_name,
  
"next_image_url" => $next_image_url,
  
"next_image_file" => $next_image_file,
  
"next_thumb_file" => $next_thumb_file,
  
"prev_image_id" => $prev_image_id,
  
"prev_image_name" => $prev_image_name,
  
"prev_image_url" => $prev_image_url,
  
"prev_image_file" => $prev_image_file,
  
"prev_thumb_file" => $prev_thumb_file
));
unset(
$next_prev_cache);

//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error 0;
if (
$action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
  
$id intval($HTTP_POST_VARS[URL_ID]);
  
$sql "SELECT cat_id, image_allow_comments
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$id";
  
$row $site_db->query_firstrow($sql);

  if (
$row['image_allow_comments'] == || !check_permission("auth_postcomment"$row['cat_id']) || !$row) {
    
$msg $lang['comments_deactivated'];
  }
  else {
    
$user_name un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    
$comment_headline un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    
$comment_text un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

    
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

    
// Flood Check
if ($id != "2"){   //added for latest news mod 
    
$sql "SELECT comment_ip, comment_date 
            FROM "
.COMMENTS_TABLE."  
            WHERE image_id = 
$id  
            ORDER BY comment_date DESC  
            LIMIT 1"

    
$spam_row $site_db->query_firstrow($sql); 
    
$spamtime $spam_row['comment_date'] + 180

    if (
$session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  { 
      
$msg .= (($msg != "") ? "" "").$lang['spamming']; 
      
$error 1
    }
  }

    
$user_name_field get_user_table_field("""user_name");
    if (!empty(
$user_name_field)) {
      if (
$site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("""user_id")." <> '".$user_info['user_id']."'")) {
        
$msg .= (($msg != "") ? "<br />" "").$lang['username_exists'];
        
$error 1;
      }
    }
    if (
$user_name == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required'];
      
$error 1;
    }
    if (
$comment_headline == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['headline_required'];
      
$error 1;
    }
    if (
$comment_text == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['comment_required'];
      
$error 1;
    }

    if (
$captcha_enable_comments && !captcha_validate($captcha)) {
      
$msg .= (($msg != "") ? "<br />" "").$lang['captcha_required'];
      
$error 1;
    }

    if (!
$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
//-----------------------------------------------------
// Start Emailer for comments
//----------------------------------------------------- 
   
$recipient_name $image_row['user_name'];
   
$recipient_email $image_row['user_email'];
   
$image_url $script_url."/details.php?".URL_IMAGE_ID."=".$id;

   
$sql "SELECT user_allowemails FROM ".USERS_TABLE." WHERE ".get_user_table_field("""user_name")." = ".$recipient_name;
   
$result $site_db->query($sql);
   
$row $site_db->fetch_array($result);
   
$user_allowemails = ($row['user_allowemails']);

   if (
$image_row['user_id'] != $user_info['user_id'] && $user_allowemails == 1) {
   include(
ROOT_PATH.'includes/email.php'); 
   
$site_email = new Email(); 
   
$site_email->set_to($recipient_email); 
   
$site_email->set_from($config['site_email'], $config['site_name']); 
   
$site_email->set_subject($lang['send_comment_emailsubject']);
   
$site_email->register_vars(array( 
     
"user_name" => stripslashes($user_name), 
     
"recipient_name" => stripslashes($image_row['user_name']),
     
"image_name" => $image_row['image_name'], 
     
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time), 
     
"site_name" => $config['site_name'],
     
"image_url" => $image_url,
     
"comment_text" =>(stripslashes($comment_text)),
     
"comment_headline"=>(stripslashes($comment_headline)),
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email();
    }
    }
  }
 unset(
$row);
 unset(
$spam_row);
}

//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($image_allow_comments == 1) {
  
$site_template->register_vars(array(
      
"has_rss"   => true,
      
"rss_title" => "RSS Feed: ".$image_name." (".str_replace(':'''$lang['comments']).")",
      
"rss_url"   => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
  
));$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".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").", u.userpic 
          FROM "
.COMMENTS_TABLE." c
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = c.user_id)
          WHERE c.image_id = 
$image_id
          ORDER BY c.comment_date ASC"
;
  
$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\">".$lang['no_comments']."</td></tr>";
  }
  else {
    
$comments "";
    
$bgcounter 0;
    for (
$i 0$i $num_comments$i++) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;

      
$comment_user_email "";
      
$comment_user_email_save "";
      
$comment_user_mailform_link "";
      
$comment_user_email_button "";
      
$comment_user_homepage_button "";
  $comment_user_ckopf_button format_text($comment_row[$i][$user_table_fields['user_ckopf']]);
      
$comment_user_icq_button "";
      
$comment_user_profile_button "";
      
$comment_user_status_img REPLACE_EMPTY;
      
$comment_user_name format_text($comment_row[$i]['comment_user_name'], 2);
      
$comment_user_info $lang['userlevel_guest'];

      
$comment_user_id $comment_row[$i]['user_id'];
  $user_row_comment get_user_info($comment_user_id);

      if (isset(
$comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        
$comment_user_name format_text($comment_row[$i][$user_table_fields['user_name']], 2);

        
$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']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
        if (!empty(
$comment_user_icq)) {
          
$comment_user_icq_button "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?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 format_text($comment_row[$i][$user_table_fields['user_email']]);
          
$comment_user_email_save format_text(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>";
        }

//---[MOD] BUDDY  V.1.0.0 beta ------------
//----2007 by eMagix for 4images gallery --
//----------- START CODE  -----------------

 if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $comment_user_id)) {
    $buddy_url $self_url;
    $buddy_url .= (!empty($mode)) ? ((strpos($buddy_url'?') !== false) ? "&amp;" "?")."mode=".$mode "";
    $buddy_url .= strpos($buddy_url'?') !== false "&amp;" "?";

    
    // IF USER ALREADY A BUDDY SHOW ALREADY BUDDY TEXT
    $buddy_status check_buddy($comment_user_id);
    if ($buddy_status == 1) {
      $buddy_button $lang['user_buddy_yes'];
    }
    // IF USER REQUEST PENDING SHOW PENDING TEXT
    elseif ($buddy_status == 0) {
      $buddy_button $lang['user_buddy_pending'];
    }
// IF NOT YET BUDDY SHOW BUTTON
    elseif ($buddy_status == -1) {
      $buddy_url .= "action=addbuddy&amp;id=".$comment_user_id."";
      $buddy_button "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }


  }
  else {
  // BUDDY BUTTON DISABLED
    $buddy_button "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";
  }
//----------- END CODE  -----------------


        
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'] : "";
  
///// Nuevo tipo de usuarios /////
      /* ******* Antes ******** 
      $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>";
      }
      // ******* Ahora *********
      */
      
$admin_links "";
      if (
$user_info['user_level'] == ADMIN || ($user_info['user_level'] == MODERADOR && $user_info['user_moderador_comentarios'] == 1)) {
      
$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>";
      }
      
///// Fin nuevo tipo de usuario /////
  
// Mod PM Start
     
if ($user_info['user_level'] > GUEST && $user_info['user_pm_ban'] == 0) {
     
$comment_user_pm "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=quote&mode=comment&id=".$comment_row[$i]['comment_id']."&user_id=".$comment_row[$i]['user_id']."&username=".$comment_row[$i]['user_name'])."\" /><img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_user_pm_alt']."\" /></a>";
     } elseif (
$user_info['user_level'] == GUEST){
     
$comment_user_pm "<img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_hinweis']."\" />";
     }else {
     
$comment_user_pm "";
     }
// Mod PM END

      
$site_template->register_vars(array(
        
"comment_id" => $comment_row[$i]['comment_id'],
"user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_row_comment['user_avatar'] == "") ? "blank.gif" $user_row_comment['user_avatar'])."\" name=\"icons\" border=\"0\" hspace=\"15\" alt=\"\">" "",
// Mod PM Start
        
"comment_user_pm" => $comment_user_pm,
// Mod PM Start
        
"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_ckopf_button" => $comment_user_ckopf_button,
        
"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_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
// Mod PM Start
        
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0$config['wordwrap_comments'], 00), 
        
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
// Mod PM End 
        
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
"buddy_button" => $buddy_button,  // BUDDY MOD BY EMAGIX
        
"row_bg_number" => $row_bg_number,
        
"admin_links" => $admin_links
      
));
      
$comments .= $site_template->parse_template("comment_bit");
    } 
// end while
  
//end else
  
$site_template->register_vars("comments"$comments);
  unset(
$comments);

  
//-----------------------------------------------------
  //--- BBCode & Form -----------------------------------
  //-----------------------------------------------------
  
$allow_posting check_permission("auth_postcomment"$cat_id);
  
$bbcode "";
  if (
$config['bb_comments'] == && $allow_posting) {
    
$site_template->register_vars(array(
      
"lang_bbcode" => $lang['bbcode'],
      
"lang_tag_prompt" => $lang['tag_prompt'],
      
"lang_link_text_prompt" => $lang['link_text_prompt'],
      
"lang_link_url_prompt" => $lang['link_url_prompt'],
      
"lang_link_email_prompt" => $lang['link_email_prompt'],
      
"lang_list_type_prompt" => $lang['list_type_prompt'],
      
"lang_list_item_prompt" => $lang['list_item_prompt'],
    ));
    
$bbcode $site_template->parse_template("bbcode");
  }

  if (!
$allow_posting) {
    
$comment_form "";
  }
  else {
    
$user_name = (isset($HTTP_POST_VARS['user_name']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['user_name'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
    
$comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
    
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

    
$site_template->register_vars(array(
      
"bbcode" => $bbcode,
      
"user_name" => $user_name,
      
"comment_headline" => $comment_headline,
      
"comment_text" => $comment_text,
      
"lang_post_comment" => $lang['post_comment'],
      
"lang_name" => $lang['name'],
      
"lang_headline" => $lang['headline'],
      
"lang_comment" => $lang['comment'],
      
"lang_captcha" => $lang['captcha'],
      
"lang_captcha_desc" => $lang['captcha_desc'],
      
"captcha_comments" => (bool)$captcha_enable_comments
    
));
    
$comment_form $site_template->parse_template("comment_form");
  }
  
$site_template->register_vars("comment_form"$comment_form);
  unset(
$comment_form);
// end if allow_comments

// Admin Links
///// Nuevo tipo de usuarios /////
/* ******* Antes ******** 
// Admin Links
$admin_links = "";
if ($user_info['user_level'] == ADMIN) {
  $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
  $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($is_image_owner) {
  $admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
  $admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
}
// ******* Ahora *********
*/
$admin_links "";
if (
$user_info['user_level'] == ADMIN || ($user_info['user_level'] == MODERADOR && $user_info['user_moderador_imagenes'] == 1)) {
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
  
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif (
$is_image_owner) {
  
$admin_links .= ($config['user_edit_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
  
$admin_links .= ($config['user_delete_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
}
///// Fin nuevo tipo de usuario /////
$site_template->register_vars("admin_links"$admin_links);

// Update Hits
if ($user_info['user_level'] != ADMIN) {
  
$sql "UPDATE ".IMAGES_TABLE."
          SET image_hits = image_hits + 1
          WHERE image_id = 
$image_id";
  
$site_db->query($sql);
}

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if (
$mode == "lightbox" && $in_mode) {
  
$page_url "";
 if (
preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
    if (!empty(
$regs[1]) && $regs[1] != 1) {
      
$page_url "?".URL_PAGE."=".$regs[1];
    }
  }
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  
$page_url .= ($lightbox_id) ? (($page_url) ? "&" "?")."lightbox_id=".$lightbox_id "";
  
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$txt_clickstream."</a>".$config['category_separator'];
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/
}
elseif (
$mode == "search" && $in_mode) {
  
$page_url "";
  if (
preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
    if (!empty(
$regs[1]) && $regs[1] != 1) {
      
$page_url "&amp;".URL_PAGE."=".$regs[1];
    }
  }
  
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
  
$clickstream .= get_category_path($cat_id1).$config['category_separator'];
}
$clickstream .= $image_name."</span>";

//######################################### Start MOD: Calendar Print #####################################################
  
if ($user_info['user_level'] >= USER) {
  
$calendar_print_button_popup "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_row['image_id']."&action=calendarprint")."\" onclick=\"opendetailwindow()\" target=\"detailwindow\"><img src=\"".get_gallery_image("calendar_print_on.gif")."\" border=\"0\" /></a>";
   } else {
  
$calendar_print_button_popup " <img src=\"".get_gallery_image("calendar_print_off.gif")."\" border=\"0\" alt=\"\" />";
   }
//########################################## End MOD: Calendar Print  #####################################################

//-----------------------------------------------------
//--- Start mod: pin images ---------------------------
//-----------------------------------------------------
if (($config['pin_image_show'] == 'yes' && $image_pin_allow == '1') || ($config['pin_image_show'] == 'yes1' && $user_info['user_level'] >= USER && $image_pin_allow == '1') || ($config['pin_image_show'] == 'yes2' && $user_info['user_level'] >= USER && $image_pin_allow == '1') || ($config['pin_image_show'] == 'yes3' && $user_info['user_level'] == ADMIN && $image_pin_allow == '1') || ($config['pin_image_show'] == 'yes4' && $user_info['user_level'] == ADMIN && $image_pin_allow == '1')) {
$pin_image_show '1';
$pin_image_show_info '1';
$pin_image_show_access '1';
} elseif (
$config['pin_image_show'] == 'yes1' && $user_info['user_level'] == GUEST && $image_pin_allow == '1') {
$pin_image_show '1';
$pin_image_show_info '1';
$pin_image_show_access '0';
} elseif (
$config['pin_image_show'] == 'yes2' && $user_info['user_level'] == GUEST && $image_pin_allow == '1') {
$pin_image_show '0';
$pin_image_show_info '1';
$pin_image_show_access '0';
} elseif (
$config['pin_image_show'] == 'yes3' && $user_info['user_level'] != ADMIN && $image_pin_allow == '1') {
$pin_image_show '1';
$pin_image_show_info '0';
$pin_image_show_access '0';
} elseif (
$config['pin_image_show'] == 'yes4' && $user_info['user_level'] >= USER && $image_pin_allow == '1') {
$pin_image_show '1';
$pin_image_show_info '0';
$pin_image_show_access '0';
} else {
$pin_image_show '0';
$pin_image_show_info '0';
$pin_image_show_access '0';
}

if (
$config['pin_image_smilie'] == && $config['pin_image_captcha'] == 0) {
$pin_window_height '280';
}
elseif (
$config['pin_image_smilie'] == && $config['pin_image_captcha'] == 0) {
$pin_window_height '320';
}
elseif (
$config['pin_image_smilie'] == && $config['pin_image_captcha'] == 1) {
$pin_window_height '510';
}

if (
$config['pin_image_show'] == 'yes' || $config['pin_image_show'] == 'yes1' || $config['pin_image_show'] == 'yes2' || $config['pin_image_show'] == 'yes3' || $config['pin_image_show'] == 'yes4') {
$sql "SELECT * FROM ".PIN_TABLE."
        WHERE pin_image_id = 
$image_id
        ORDER BY pin_id DESC"
;
        
$result=mysql_query($sql);

 
$pin_image "\n";
 
$pin_image .= "<div id=\"image_content\">\n";
 
$pin_image .= "<div class=pgdiv>\n";
 for (
$i=0$i<mysql_num_rows($result); $i++) {
 
mysql_data_seek ($result$i);
 
$row mysql_fetch_row($result);
 
$pin_id=$row[0];
 
$pin_image_id=$row[1];
 
$pin_user_id=$row[2];
 
$pin_user_name=$row[3];
 
$pin_art=$row[4];
 
$pin_col=$row[5];
 
$pin_headline=$row[6];
 
$pin_text=$row[7];
 
$pin_date format_date($config['date_format']." ".$config['time_format'],$row[9]);
 
$pin_x=$row[10];
 
$pin_y=$row[11];

// ---- Start Admin Pin Links --------------------------------------------------
$admin_pin_links "";
if (
$user_info['user_level'] == ADMIN) {
  
$admin_pin_links .= "<a href='admin/pins.php?action=editpin&pin_id=".$pin_id."' target='_blank'>(Edit)</a>&nbsp;";
  
$admin_pin_links .= "<a href='admin/pins.php?action=removepin&pin_id=".$pin_id."' target='_blank'>(Delete)</a>";
}
// ---- END Admin Pin Links ----------------------------------------------------
// ---- Start replace smilie codes ---------------------------------------------
if ($config['pin_image_smilie'] != 0) {
  
$search_smilie  = array("#)""#-D""#(""#-o""#?#""#?""#-)""#-x""#-p""#-*""#*-(""#3-(""#roll#""#wink#""#-|""#o""#3-)""#lol#""LOL""#!#""#idea#");
  
$replace_smilie = array("smile""biggrin""sad""eek""question""confused""cool""mad""razz""redface""cry""evil""rolleyes""wink""neutral""surprised""twisted""lol""lol""exclaim""idea");
  for(
$smile=0;$smile<count($search_smilie);$smile++) {
  
$pin_headline str_replace($search_smilie[$smile],"<img src='".TEMPLATE_PATH."/smilies/icon_".$replace_smilie[$smile].".gif'>",$pin_headline);
  
$pin_text str_replace($search_smilie[$smile],"<img src='".TEMPLATE_PATH."/smilies/icon_".$replace_smilie[$smile].".gif'>",$pin_text);
  }
}
// ---- End replace smilie codes -----------------------------------------------
// ---- Start pin text Umbruch -------------------------------------------------
 
$pin_text wordwrap($pin_text17"\n"TRUE);
// ---- END pin text Umbruch ---------------------------------------------------
 
if ($pin_user_id != -1) {
 
$pin_image .= "<a style=\"cursor:pointer;\"><img src=\"".TEMPLATE_PATH."/images/pin/pin".$pin_art.".png\" border=\"0\" style=\"position:absolute; left:".($pin_x-($config['pin_position_x']))."; top:".($pin_y-($config['pin_position_y'])).";\" title=\"header=[".$pin_headline."] body=[".$pin_text."<p><small>".$lang['pin_from']."<br /><a href='member.php?action=showprofile&user_id=".$pin_user_id."'><u>".$pin_user_name."</u></a><br />(".$pin_date.")".$admin_pin_links."</small></p>] fade=[on] fadespeed=[0.06] requireclick=[off] singleclickstop=[on] doubleclickstop=[off]\"></a>\n";
 }
 else {
 
$pin_image .= "<a style=\"cursor:pointer;\"><img src=\"".TEMPLATE_PATH."/images/pin/pin".$pin_art.".png\" border=\"0\" style=\"position:absolute; left:".($pin_x-($config['pin_position_x']))."; top:".($pin_y-($config['pin_position_y'])).";\" title=\"header=[".$pin_headline."] body=[".$pin_text."<p><small>".$lang['pin_from']."<br />".$pin_user_name."<br />(".$pin_date.")".$admin_pin_links."</small></p>] fade=[on] fadespeed=[0.06] requireclick=[off] singleclickstop=[on] doubleclickstop=[off]\"></a>\n";
 }
}
 
$pin_image .= "<script src=\"".TEMPLATE_PATH."/pin_images.js\"></script> \n";
 
$pin_image .= "</div>\n";
 
$pin_image .= "</div>\n";
}
$site_template->register_vars(array(
  
"pin_image" => $pin_image,
  
"pin_window_height" => $pin_window_height,
  
"pin_image_show" => $pin_image_show,
  
"lang_pin_info" => $lang['pin_info'],
  
"pin_image_show_info" => $pin_image_show_info,
  
"lang_pin_info_access" => $lang['pin_info_access'],
  
"pin_image_show_access" => $pin_image_show_access,
  
"url_pin_images" => $site_sess->url(ROOT_PATH."pin_images.php?pin=1"),
  
"lang_pin_post" => $lang['pin_post']
));
unset(
$pin_image);
//-----------------------------------------------------
//--- End mod: pin images -----------------------------
//-----------------------------------------------------

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
//######################################### Start MOD: Calendar Print  #####################################################
  
"calendar_print_button_popup" => $calendar_print_button_popup,
  
"lang_calendar_image_tip" => $lang['calendar_image_tip'],
  
"lang_calendar_help" => $lang['calendar_help'],
  
"lang_calendar_paper_tip" => $lang['calendar_paper_tip'],
  
"lang_calendar_select_mounth_tip" => $lang['calendar_select_mounth_tip'],
  
"lang_calendar_remind_tip" => $lang['calendar_remind_tip'],
  
"lang_calendar_print_tip_1" => $lang['calendar_print_tip_1'],
  
"lang_calendar_print_tip_2" => $lang['calendar_print_tip_2'],
//########################################### End MOD: Calendar Print  #####################################################
  
"lang_category" => $lang['category'],
  
"lang_added_by" => $lang['added_by'],
  
"lang_description" => $lang['description'],
  
"lang_keywords" => $lang['keywords'],
  
"lang_date" => $lang['date'],
  
"lang_hits" => $lang['hits'],
  
"lang_downloads" => $lang['downloads'],
  
"lang_rating" => $lang['rating'],
  
"lang_votes" => $lang['votes'],
  
"lang_author" => $lang['author'],
  
"lang_comment" => $lang['comment'],
  
"lang_prev_image" => $lang['prev_image'],
  
"lang_next_image" => $lang['next_image'],
  
"lang_file_size" => $lang['file_size']
));

$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>


Edit: Es kommt einfach keine Mail an! Was ist denn da falsch gelaufen?
« Last Edit: August 02, 2008, 12:01:02 PM by Phisker B »

Offline redlich

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #161 on: November 21, 2008, 07:43:25 PM »
Works perfect  :D

I got email from the past

Date: 01.01.1970 01:00   8O

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #162 on: December 11, 2008, 07:54:40 PM »
vraxor, thank you very much!!
works perfect! good job!!!  :thumbup: :thumbup:

Offline gborislav

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #163 on: December 14, 2008, 02:57:33 AM »
Hi to all.

Why admins do not receive comments for their images?
I'm using 1.7.4

Thanks.

UPDATE : Fix it . Thanks
« Last Edit: December 14, 2008, 03:23:41 PM by gborislav »

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: [Mod] Mail Owner of image when Comment is Posted
« Reply #164 on: December 14, 2008, 09:02:03 AM »
Maybe admin's email is wrong?
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)