Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - thunderstrike

Pages: 1 2 3 4 5 [6] 7
76
Feedback & Suggestions / [FIX] - postcards.php (3 action fix)
« on: September 08, 2007, 03:32:35 PM »
Detail: Ok so fix for postcard for check POST before use. Check user name, user email, recipient name, recipient email, headline and message valid chars. Before, no check (or minumum). This protect more.

For:

Quote
if ($action == "sendcard") {

Find:

Quote
$bg_color = un_htmlspecialchars(trim($HTTP_POST_VARS['bg_color']));
$border_color = un_htmlspecialchars(trim($HTTP_POST_VARS['border_color']));
$font_color = un_htmlspecialchars(trim($HTTP_POST_VARS['font_color']));
$font_face = un_htmlspecialchars(trim($HTTP_POST_VARS['font_face']));

$sender_name = un_htmlspecialchars(trim($HTTP_POST_VARS['sender_name']));
$sender_email = un_htmlspecialchars(trim($HTTP_POST_VARS['sender_email']));
$recipient_name = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_name']));
$recipient_email = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_email']));

$headline = un_htmlspecialchars(trim($HTTP_POST_VARS['headline']));
$message = un_htmlspecialchars(trim($HTTP_POST_VARS['message']));

replace:

Code: [Select]
$bg_color = (isset($HTTP_POST_VARS['bg_color']) && preg_match("/[\#A-Za-z0-9]/i", $HTTP_POST_VARS['bg_color'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['bg_color'])) : "";
$border_color = (isset($HTTP_POST_VARS['border_color']) && preg_match("/[\#A-Za-z0-9]/i", $HTTP_POST_VARS['border_color'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['border_color'])) : "";
$font_color = (isset($HTTP_POST_VARS['font_color']) && preg_match("/[\#A-Za-z0-9]/i", $HTTP_POST_VARS['font_color'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['font_color'])) : "";
$font_face = (isset($HTTP_POST_VARS['font_face']) && preg_match("/[\#A-Za-z0-9]/i", $HTTP_POST_VARS['border_color'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['font_face'])) : "";

$sender_name = (isset($HTTP_POST_VARS['sender_name']) && preg_match("/[A-Za-z0-9\-\_]/i", $HTTP_POST_VARS['sender_name'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['sender_name'])) : "";
$sender_email = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['sender_email']));
if (isset($sender_email)) {  
      if (function_exists('mailchek') && !function_exists('check_email') && mailchek($sender_email, 2)) {        
          } elseif (function_exists('check_email') && !function_exists('mailchek') && check_email($sender_email)) {              
      }              
}
$recipient_name = (isset($HTTP_POST_VARS['recipient_name'])  && preg_match("/[A-Za-z0-9\-\_]/i", $HTTP_POST_VARS['recipient_name'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['recipient_name'])) : "";
$recipient_email = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['recipient_email']));
if (isset($recipient_email)) {  
      if (function_exists('mailchek') && !function_exists('check_email') && mailchek($recipient_email, 2)) {        
          } elseif (function_exists('check_email') && !function_exists('mailchek') && check_email($recipient_email)) {              
      }              
}
$headline = (isset($HTTP_POST_VARS['headline']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['headline'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['headline'])) : "";
$message = (isset($HTTP_POST_VARS['message']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['message'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['message'])) : "";

Do same for previewcard and modifycard action.

77
Feedback & Suggestions / [FIX] - member.php send password
« on: September 08, 2007, 03:14:32 PM »
Detail: This for check valid email chars for user enter in textbox for recover.

Find:

Quote
$user_email = un_htmlspecialchars(trim($HTTP_POST_VARS['user_email'])); 

add after:

Code: [Select]
if (isset($user_email)) { 
      if (function_exists('mailchek') && !function_exists('check_email') && mailchek($user_email, 2)) {         
          } elseif (function_exists('check_email') && !function_exists('mailchek') && check_email($user_email)) {             
      }             
}

78
Feedback & Suggestions / [FIX] - member.php upload image
« on: September 08, 2007, 03:02:29 PM »
Detail: This for check variable and valid remote file use.

Find:

Quote
$remote_media_file = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_media_file'])));
$remote_thumb_file = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_thumb_file'])));

$image_name = un_htmlspecialchars(trim($HTTP_POST_VARS['image_name']));
$image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));

replace:

Code: [Select]
$remote_media_file = (isset($HTTP_POST_VARS['remote_media_file']) && is_remote($HTTP_POST_VARS['remote_media_file'])) ? format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_media_file']))) : "";
$remote_thumb_file = (isset($HTTP_POST_VARS['remote_thumb_file']) && is_remote($HTTP_POST_VARS['remote_thumb_file'])) ? format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_thumb_file']))) : "";

$image_name = (isset($HTTP_POST_VARS['image_name']) && preg_match("/[A-Za-z0-9\-\_\.]/i", $HTTP_POST_VARS['image_name'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name'])) : "";
$image_description = (isset($HTTP_POST_VARS['image_description']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['image_description'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_description'])) : "";
$image_keywords = (isset($HTTP_POST_VARS['image_keywords'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_keywords'])) : "";

79
Feedback & Suggestions / [FIX] - member.php update image
« on: September 08, 2007, 02:54:06 PM »
Detail: This for check variable and check valid chars for image_name, image_description.

Find:

Quote
$image_name = un_htmlspecialchars(trim($HTTP_POST_VARS['image_name']));
$image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));

replace:

Code: [Select]
$image_name = (isset($HTTP_POST_VARS['image_name']) && preg_match("/[A-Za-z0-9\-\_\.]/i", $HTTP_POST_VARS['image_name'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name'])) : "";
$image_description = (isset($HTTP_POST_VARS['image_description']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['image_description'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_description'])) : "";
$image_keywords = (isset($HTTP_POST_VARS['image_keywords'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_keywords'])) : "";

80
Feedback & Suggestions / [FIX] - member.php update comment
« on: September 08, 2007, 02:46:56 PM »
This for check variable. Check headline and text valid chars.

Find:

Quote
$comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

replace:

Code: [Select]
$comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['comment_headline'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_headline'])) : "";
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $HTTP_POST_VARS['comment_text'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_text'])) : "";

81
Chit Chat / Re: Hlep me Fig adder categories
« on: September 06, 2007, 09:45:02 PM »
Hum ... I sure post in here ...

In /docs/install.english.txt file, read all permission for right setting in FTP. (This time, I save topic Nicky).

82
Feedback & Suggestions / [TWEAK] - Sessions whos online
« on: September 06, 2007, 12:45:28 AM »
For HTML programmer (and $user_table_fields add),

In includes/sessions.php file,

find:

Quote
$time_out = time() - 300;

add after:

Code: [Select]
$additional_sql = "";
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
  foreach ($additional_user_fields as $key => $val) {
    $additional_sql .= ", u." . $key;   
  }
}

Find:

Quote
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible"). "

replace:

Code: [Select]
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible"). $additional_sql . "

Find:

Quote
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;

replace:

Code: [Select]
$site_template->register_vars(array(
          "user_profile_link" => (isset($url_show_profile) && !empty($url_show_profile)) ? preg_replace("/" . $site_template->start . "user_id" . $site_template->end . "/siU", $row['session_user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['session_user_id']),
          "session_user_id" => (isset($row['session_user_id'])) ? (int)$row['session_user_id'] : 0,
          "session_lastaction" => (isset($row['session_lastaction'])) ? $row['session_lastaction'] : "",
          "session_ip" => (isset($row['session_ip'])) ? $row['session_ip'] : "",
          "user_id" => (isset($row[$user_table_fields['user_id']])) ? (int)$row[$user_table_fields['user_id']] : 0,
          "user_invisible" => (isset($row[$user_table_fields['user_invisible']])) ? (int)$row[$user_table_fields['user_invisible']] : 0,
          "username" => $username,
          "invisibleuser" => $invisibleuser
          ));
          if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
              $additional_field_array = array();
              foreach ($additional_user_fields as $key => $val) {
                  $additional_field_array[$key] = (isset($row[$key]) && !empty($row[$key])) ? format_text(trim($row[$key]), 1) : REPLACE_EMPTY;
                  $additional_field_array['lang_'.$key] = $val[0];
              }
              if (isset($additional_field_array) && is_array($additional_field_array) && !empty($additional_field_array)) {
                $site_template->register_vars($additional_field_array);
             }
              unset ($additional_field_array);
          }
          $user_online_list .= $site_template->parse_template("whos_online_content");

In templates/your_template , create file: whos_online_content.html .

Add:

Code: [Select]
<a href="{user_profile_link}" class="link" />{username}</a>{invisibleuser}

No need for play in includes/sessions.php file no more. 8)

83
Feedback & Suggestions / [FIX] - Session user name
« on: September 06, 2007, 12:37:25 AM »
In includes/sessions.php file,

find:

Code: [Select]
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];

replace:

Code: [Select]
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", format_text(trim($row[$user_table_fields['user_name']]), 2)) : format_text(trim($row[$user_table_fields['user_name']]), 2);

84
Mods & Plugins (Releases & Support) / [MOD] - Comment users sessions
« on: August 31, 2007, 03:04:52 AM »
Hi, I create MOD for comment users sessions. Each user visit image can see session in detail foreach image ID (live) if post comment (and all poster of each image ID where session active). 8)

If image active - show.
If image no active - no show.
If user invisible - show * (same includes/sessions.php file). No show for user (is admin).
If user no post comment, no see in comment session. If post 1st, start see. ;)
No HTML in PHP - all HTML template.

/* New - [08/31/2007]: There are currently . . . xxx add. */ ;)

Test: Mr_LovaLove

// Step 1

In details.php file,

find:

Code: [Select]
// 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);
}

add after:

Code: [Select]
// MOD: Comment users sessions.
$comment_time_out = time() - 300;
$comment_guest_level_sessions_counter = 0;

$additional_sql = "";
$additional_sql_array = array();
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
    foreach ($additional_user_fields as $key => $val) {
        $additional_sql .= ", u." . $key;
        $additional_sql_array[] = $key;
    }
}

if (function_exists('get_comment_sessions_info') && $user_info['user_level'] == GUEST) {
    get_comment_sessions_info($site_sess->session_id, 'check_sessions_table');
}

if (function_exists('get_comment_sessions_info') && $user_info['user_level'] >= USER) {
    get_comment_sessions_info($user_info['user_id'], 'check_sessions_table');
}

$sql1 = "

SELECT s.session_user_id" . get_user_table_field(", u.", "user_name") . get_user_table_field(", u.", "user_level") . get_user_table_field(", u.", "user_invisible") . $additional_sql . "
FROM (" . COMMENTS_TABLE . " c, " . SESSIONS_TABLE . " s, " . COMMENTS_SESSIONS_TABLE . " ist)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = s.session_user_id)
WHERE ist.user_id = c.user_id AND c.user_id = s.session_user_id AND c.image_id = " . $image_id . " AND ist.comment_notify_microtime >= " . $comment_time_out . " AND s.session_user_id > '" . GUEST . "'
GROUP BY s.session_user_id
ORDER BY " . get_user_table_field("u.", "user_id") . " ASC, s.session_ip ASC";

$sessions_comment_result = $site_db->query($sql1);
$comment_num_rows = $site_db->get_numrows($sessions_comment_result);

if (isset($comment_num_rows) && $comment_num_rows > 0) {

$comment_sessions_template = "";

$comment_invisible_sessions_counter = 0;
$comment_registered_users_sessions_counter = 0;
while ($sessions_comment_row = $site_db->fetch_array($sessions_comment_result)) {
    if ($sessions_comment_row[$user_table_fields['user_invisible']] == 1) {
        $comment_invisible_sessions_counter++;
    }
    if ($sessions_comment_row[$user_table_fields['user_level']] >= USER) {
        $comment_registered_users_sessions_counter++;
    }
    $session_comment_user_id = $sessions_comment_row['session_user_id'];
    $session_comment_name = $sessions_comment_row[$user_table_fields['user_name']];
    $session_comment_invisible = $sessions_comment_row[$user_table_fields['user_invisible']];
    
    $site_template->register_vars(array(
    "session_comment_user_url" => $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $session_comment_user_id),
    "session_comment_user_id" => (int)$session_comment_user_id,
    "session_comment_name" => format_text(stripslashes($session_comment_name), 2),
    "session_comment_invisible" => ($session_comment_invisible == 1) ? 1 : 0,
    "invisible_comment_chars" => $lang['comments_notify_invisible_chars'],
    "need_separator" => (isset($comment_num_rows) && $comment_num_rows > 1) ? true : false
    ));
    
    if (isset($additional_sql_array) && is_array($additional_sql_array) && !empty($additional_sql_array)) {
        foreach ($additional_sql_array as $key => $val) {
            if ($val == $sessions_comment_row[$val]) {
                $site_template->register_vars($val, $sessions_comment_row[$val]);
            }
        }
    }
    $comment_sessions_template .= $site_template->parse_template("comment_sessions_content");
    
    }
    }
    
    $sql2 = "
    
    SELECT s.session_user_id" . $additional_sql . "
    FROM (" . COMMENTS_TABLE . " c, " . SESSIONS_TABLE . " s, " . COMMENTS_SESSIONS_TABLE . " ist)
    LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = s.session_user_id)
    WHERE ist.user_id = c.user_id AND c.user_id = s.session_user_id AND c.image_id = " . $image_id . " AND ist.comment_notify_microtime >= " . $comment_time_out . " AND s.session_user_id = '" . GUEST . "'
    GROUP BY s.session_ip";
    
    $sessions_guest_comment_result = $site_db->query($sql2);
    $sessions_guest_num_rows = $site_db->get_numrows($sessions_guest_comment_result);
    
    if (isset($sessions_guest_num_rows) && $sessions_guest_num_rows > 0) {
        while ($sessions_comment_guest_row = $site_db->fetch_array($sessions_guest_comment_result)) {
            $comment_guest_level_sessions_counter++;
        }
    }
    $total_comment_sessions = $comment_registered_users_sessions_counter + $comment_guest_level_sessions_counter;

// End of MOD: Comments users sessions.

Find:

Code: [Select]
"lang_file_size" => $lang['file_size'],  

add after:

Code: [Select]
// MOD: Comment users sessions.
  "lang_comment_notify_sessions_title" => $lang['comments_notify_sessions_title'],  
  "lang_comment_notify_current_sessions_title" => $lang['comments_notify_current_sessions_title'],
  "comment_sessions_template" => (isset($comment_sessions_template)) ? trim($comment_sessions_template) : "",    
  "sessions_comment_no_content_msg" => (isset($sessions_comment_no_content_msg)) ? $sessions_comment_no_content_msg : "",
  "total_invisible_comment_sessions" => (isset($comment_invisible_sessions_counter)) ? preg_replace("/" . $site_template->start . "invisible_count" . $site_template->end . "/siU", (int)$comment_invisible_sessions_counter, $lang['comments_notify_invisible_count']) : preg_replace("/" . $site_template->start . "invisible_count" . $site_template->end . "/siU", 0, $lang['comments_notify_invisible_count']),
  "total_registered_users_comment_sessions" => (isset($comment_registered_users_sessions_counter)) ? preg_replace("/" . $site_template->start . "registered_users_count" . $site_template->end . "/siU", (int)$comment_registered_users_sessions_counter, $lang['comments_notify_registered_users_count']) : preg_replace("/" . $site_template->start . "registered_users_count" . $site_template->end . "/siU", 0, $lang['comments_notify_registered_users_count']),
  "total_guest_level_comment_sessions" => (isset($comment_guest_level_sessions_counter)) ? preg_replace("/" . $site_template->start . "guest_level_count" . $site_template->end . "/siU", (int)$comment_guest_level_sessions_counter, $lang['comments_notify_guest_level_count']) : preg_replace("/" . $site_template->start . "guest_level_count" . $site_template->end . "/siU", 0, $lang['comments_notify_guest_level_count']),
  "total_comment_sessions" => (isset($total_comment_sessions)) ? (int)$total_comment_sessions : false,
  // End of MOD: Comment users sessions.

// Step 2

In lang/english/main.php file,

add top ?>:

Code: [Select]
// MOD: Comments sessions.
//-----------------------------------------------------
//--- Comments sessions -------------------------------
//-----------------------------------------------------
$lang['comments_notify_count'] = "Total: {count}";
$lang['comments_notify_sessions_title'] = "Currently active comment users: ";
$lang['comments_notify_no_sessions_content'] = "No comment users sessions found.";
$lang['comments_notify_invisible_chars'] = "*";
$lang['comments_notify_current_sessions_title'] = "There are currently ";
$lang['comments_notify_registered_users_count'] = "<b>{registered_users_count}</b> registered user(s) ";
$lang['comments_notify_invisible_count'] = "({invisible_count} among them invisible) ";
$lang['comments_notify_guest_level_count'] = "and <b>{guest_level_count}</b> guest(s) online.";

// Step 3

In templates/your_template, create: comment_sessions_content.html .

Add:

Code: [Select]
{if is_admin}{if session_comment_invisible}<a href="{session_comment_user_url}"><b>{session_comment_name}</b></a>{invisible_comment_chars}{if need_separator}, {endif need_separator}&nbsp;{endif session_comment_invisible}{endif is_admin}
{if user_loggedin}{ifnot session_comment_invisible}<a href="{session_comment_user_url}"><b>{session_comment_name}</b></a>{if need_separator}, {endif need_separator}&nbsp;{endifnot session_comment_invisible}{endif user_loggedin}

// Step 4

In templates/your_template/details.html file,

find:

Code: [Select]
{if allow_comments}
<a name="comments"></a>
<br />

add after:

Code: [Select]
 
{if is_admin}<! -- Comment users sessions -- >{endif is_admin}
 {if comment_allow_read}  
<table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td valign="top" class="head1">&nbsp;{lang_comment_notify_sessions_title} {total_comment_sessions}</td>
 </tr>
   </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>  
   <td class="row1">&nbsp;{lang_comment_notify_current_sessions_title} {total_registered_users_comment_sessions} {total_invisible_comment_sessions} {total_guest_level_comment_sessions}</td>
 </tr>
    </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>
  {if comment_sessions_template}<td width="100%" class="row1" />&nbsp;{comment_sessions_template}</td>{endif comment_sessions_template}
  {if sessions_comment_no_content_msg}{if allow_image_read}<td width="100%" class="row1" align="center" /><b>{sessions_comment_no_content_msg}</b></td>{endif allow_image_read}{endif sessions_comment_no_content_msg}
 </tr>  
                        </table>  
         {endif comment_allow_read}
 <br />
 {if is_admin}<! -- End of comment users sessions -- >{endif is_admin}

// Step 5

In includes/functions.php file,

add top ?>:

Code: [Select]
// MOD: Comment sessions user.
function get_comment_sessions_info($user_id = -1, $status = "") {
    global $site_db, $session_info, $image_id, $user_table_fields, $table_prefix;    

    if (!isset($user_id) || $user_id == -1) {
        return;
    }    

    if (!isset($status) || $status == "") {
        return;
    }    

    if (isset($user_id) && $user_id > 0) {
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);

        if ($user_row = get_user_info($user_id)) {
            if ($user_id != $user_row[$user_table_fields['user_id']]) {
                return;
            }
            unset ($user_row);
        }
        $status = preg_replace("/[^A-Za-z0-9\_]+/i", "", $status);

        

        $date = date('Y-m-d');
        $time = date('H:i:s');
        $microtime = time();        

        switch($status) {            

            case 'check_sessions_table' :            

            if (!defined('COMMENTS_SESSIONS_TABLE')) {                
                define('COMMENTS_SESSIONS_TABLE', $table_prefix . "comments_sessions");
            }              

                $sql = "              

                CREATE TABLE IF NOT EXISTS " . COMMENTS_SESSIONS_TABLE . " (
                field_id INT(11) NOT NULL AUTO_INCREMENT,
                user_id VARCHAR(32) NOT NULL DEFAULT '0',
                image_id INT(11) NOT NULL DEFAULT '0',
                comment_notify_date VARCHAR(48) NOT NULL DEFAULT '0000-00-00',
                comment_notify_time VARCHAR(48) NOT NULL DEFAULT '00:00:00',
                comment_notify_microtime VARCHAR(255) NOT NULL DEFAULT '0',
                comment_notify_ip VARCHAR(48) NOT NULL DEFAULT '0.0.0.0',
                PRIMARY KEY (field_id)
                ) TYPE=MyISAM;              

                ";              

                $result = $site_db->query($sql);

                $sql = "SELECT user_id, image_id FROM " . COMMENTS_SESSIONS_TABLE . " WHERE user_id = " . $user_id . " AND image_id = " . $image_id;
                $result = $site_db->query($sql);
                $num_rows = $site_db->get_numrows($result);
                
                if (isset($num_rows) && $num_rows <= 0) {
                    
                    $comment_sessions_ip = $session_info['session_ip'];

                    $sql1 = "                  

                    INSERT INTO " . COMMENTS_SESSIONS_TABLE . "
                    (field_id, user_id, image_id, comment_notify_date, comment_notify_time, comment_notify_microtime, comment_notify_ip)
                    VALUES (NULL, '" . $user_id . "', '" . $image_id . "', '" . $date . "', '" . $time . "', '" . $microtime . "', '" . $comment_sessions_ip . "')

                    ";                  

                    $result = $site_db->query($sql1);                    
                }
                
                $get_sessions_microtime = $microtime - 300;
                
                if (isset($num_rows) && $num_rows > 0) {                    
                        $site_db->query("DELETE FROM " . COMMENTS_SESSIONS_TABLE . " WHERE comment_notify_microtime < " . $get_sessions_microtime);
                        //$site_db->query("UPDATE " . COMMENTS_SESSIONS_TABLE . " SET comment_notify_microtime = '" . $microtime . "', image_id = '" . $image_id . "' WHERE user_id = '" . $user_id . "'");
                }
                
                return $user_id;
                break;        
        }
    }
}
// End of MOD: Comment sessions user.

// Step 6

In includes/constants.php file,

find:

Code: [Select]
define('COMMENTS_TABLE', $table_prefix.'comments');

add after:

Code: [Select]
define('COMMENTS_SESSIONS_TABLE', $table_prefix.'comments_sessions');

// Step 7 (09/09/2007)

In includes/sessions.php file,

find:

Quote
$this->current_time = time();

add before:

Code: [Select]
$this->current_date = date('Y-m-d');
$this->current_clocktime = date('H:i:s');

Find:

Quote
function logout($user_id) {
    global $site_db;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = " . $user_id;
    $site_db->query($sql);
  
    $this->set_cookie_data("userpass", "", 0);
    $this->set_cookie_data("userid", GUEST);

    $this->session_info = array();

    return true;
  }

replace:

Code: [Select]
function logout($user_id) {
    global $site_db;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = " . $user_id;
    $site_db->query($sql);    
    $sql = "DELETE FROM " . COMMENTS_SESSIONS_TABLE . "
            WHERE user_id = '" . addslashes($this->session_id) ."' OR user_id = " . $user_id;
    $site_db->query($sql);
    
    $this->set_cookie_data("userpass", "", 0);
    $this->set_cookie_data("userid", GUEST);

    $this->session_info = array();

    return true;
  }

Find:

Quote
function update_session() {
    global $site_db;

replace:

Code: [Select]
function update_session() {
    global $site_db, $image_id, $url;

Find:

Quote
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;

add after:

Code: [Select]
if (preg_match("/details.php/", $url)) {
    
    $sql = "REPLACE INTO " . COMMENTS_SESSIONS_TABLE . "
            (field_id, user_id, image_id, comment_notify_date, comment_notify_time, comment_notify_microtime)
            VALUES (NULL, '" . addslashes($this->session_id) . "', '" . $image_id . "', '" . $this->current_date . "', '" . $this->current_clocktime . "', $this->current_time)
            
           ";
    $site_db->query($sql);
    
}

Find:

Quote
if ($this->user_info['user_id'] != GUEST) {
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);            
}

replace:

Code: [Select]
if ($this->user_info['user_id'] != GUEST) {
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);          
      $sql2 = "DELETE FROM " . COMMENTS_SESSIONS_TABLE . " WHERE user_id = '" . GUEST . "' AND comment_notify_ip = '" . $this->user_ip . "'";
      $site_db->query($sql2);      
}

Go details (is active for image) and see. ;)

(For fix - reset table).

85
Mods & Plugins (Releases & Support) / [MOD] - Image users sessions
« on: August 31, 2007, 02:54:39 AM »
Hi, I create MOD for image users sessions. Each user visit image can see for session in detail foreach image ID (live). 8)

If image active - show.
If image no active - no show.
If user invisible - show * (same includes/sessions.php file). No show for user (is admin).
No HTML in PHP - all HTML template.

Test: Mr_LovaLove

// Step 1

In details.php file,

find:

Code: [Select]
// 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);
}

add after:

Code: [Select]
// MOD: Image users sessions.
$image_time_out = time() - 300;
$image_guest_level_sessions_counter = 0;

$additional_sql = "";
$additional_sql_array = array();
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
    foreach ($additional_user_fields as $key => $val) {
        $additional_sql .= ", u." . $key;
        $additional_sql_array[] = $key;
    }
}

if (function_exists('get_image_sessions_info') && $user_info['user_level'] == GUEST) {
    get_image_sessions_info($site_sess->session_id, 'check_sessions_table');
}

if (function_exists('get_image_sessions_info') && $user_info['user_level'] >= USER) {
    get_image_sessions_info($user_info['user_id'], 'check_sessions_table');
}

$sql1 = "

SELECT ist.image_id, s.session_user_id" . get_user_table_field(", u.", "user_name") . get_user_table_field(", u.", "user_level") . get_user_table_field(", u.", "user_invisible") . $additional_sql . "
FROM (" . SESSIONS_TABLE . " s, " . IMAGES_SESSIONS_TABLE . " ist)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = s.session_user_id)
WHERE ist.user_id = s.session_user_id AND ist.image_id = " . $image_id . " AND ist.image_sessions_microtime >= " . $image_time_out . " AND s.session_user_id > '" . GUEST . "'
GROUP BY s.session_user_id
ORDER BY " . get_user_table_field("u.", "user_id") . " ASC, s.session_ip ASC";

$sessions_image_result = $site_db->query($sql1);
$image_num_rows = $site_db->get_numrows($sessions_image_result);

if (isset($image_num_rows) && $image_num_rows > 0) {

$image_sessions_template = "";

$image_invisible_sessions_counter = 0;
$image_registered_users_sessions_counter = 0;
$session_image_id = 0;
while ($sessions_image_row = $site_db->fetch_array($sessions_image_result)) {
    if ($sessions_image_row[$user_table_fields['user_invisible']] == 1) {
        $image_invisible_sessions_counter++;
    }
    if ($sessions_image_row[$user_table_fields['user_level']] >= USER) {
        $image_registered_users_sessions_counter++;
    }    
    $session_image_user_id = $sessions_image_row['session_user_id'];
    $session_image_id .= $sessions_image_row['image_id'];
    $session_image_name = $sessions_image_row[$user_table_fields['user_name']];
    $session_image_invisible = $sessions_image_row[$user_table_fields['user_invisible']];        
    
    $site_template->register_vars(array(
    "session_image_user_url" => $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $session_image_user_id),
    "session_image_user_id" => (int)$session_image_user_id,    
    "session_image_name" => format_text(stripslashes($session_image_name), 2),
    "session_image_invisible" => ($session_image_invisible == 1) ? 1 : 0,
    "invisible_image_chars" => $lang['images_notify_invisible_chars'],
    "need_separator" => (isset($image_num_rows) && $image_num_rows > 1) ? true : false
    ));
    
    if (isset($additional_sql_array) && is_array($additional_sql_array) && !empty($additional_sql_array)) {
        foreach ($additional_sql_array as $key => $val) {
            if ($val == $sessions_image_row[$val]) {                
                $site_template->register_vars($val, $sessions_image_row[$val]);                                
            }
        }
    }
    $image_sessions_template .= $site_template->parse_template("details_sessions_content");
    
    }
    }

$sql2 = "

SELECT s.session_user_id" . $additional_sql . "
FROM (" . SESSIONS_TABLE . " s, " . IMAGES_SESSIONS_TABLE . " ist)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = s.session_user_id)
WHERE ist.image_id = " . $image_id . " AND ist.image_sessions_microtime >= " . $image_time_out . " AND s.session_user_id = '" . GUEST . "'
GROUP BY s.session_ip";

$sessions_guest_image_result = $site_db->query($sql2);
$sessions_guest_num_rows = $site_db->get_numrows($sessions_guest_image_result);

if (isset($sessions_guest_num_rows) && $sessions_guest_num_rows > 0) {
    while ($sessions_image_guest_row = $site_db->fetch_array($sessions_guest_image_result)) {
        $image_guest_level_sessions_counter++;
    }    
}
$total_image_sessions = $image_registered_users_sessions_counter + $image_guest_level_sessions_counter;

// End of MOD: Image users sessions.

Find:

Code: [Select]
"lang_file_size" => $lang['file_size'],  

add after:

Code: [Select]
// MOD: Image users sessions.  
  "lang_image_notify_sessions_title" => $lang['images_notify_sessions_title'],
  "lang_image_notify_current_sessions_title" => $lang['images_notify_current_sessions_title'],
  "image_sessions_template" => (isset($image_sessions_template)) ? trim($image_sessions_template) : "",
  "total_invisible_image_sessions" => (isset($image_invisible_sessions_counter)) ? preg_replace("/" . $site_template->start . "invisible_count" . $site_template->end . "/siU", (int)$image_invisible_sessions_counter, $lang['images_notify_invisible_count']) : preg_replace("/" . $site_template->start . "invisible_count" . $site_template->end . "/siU", 0, $lang['images_notify_invisible_count']),
  "total_registered_users_image_sessions" => (isset($image_registered_users_sessions_counter)) ? preg_replace("/" . $site_template->start . "registered_users_count" . $site_template->end . "/siU", (int)$image_registered_users_sessions_counter, $lang['images_notify_registered_users_count']) : preg_replace("/" . $site_template->start . "registered_users_count" . $site_template->end . "/siU", 0, $lang['images_notify_registered_users_count']),
  "total_guest_level_image_sessions" => (isset($image_guest_level_sessions_counter)) ? preg_replace("/" . $site_template->start . "guest_level_count" . $site_template->end . "/siU", (int)$image_guest_level_sessions_counter, $lang['images_notify_guest_level_count']) : preg_replace("/" . $site_template->start . "guest_level_count" . $site_template->end . "/siU", 0, $lang['images_notify_guest_level_count']),
  "total_image_sessions" => (isset($total_image_sessions)) ? (int)$total_image_sessions : false,
  // End of MOD: Image users sessions.

// Step 2

In lang/english/main.php file,

add top ?>:

Code: [Select]
// MOD: Images sessions.
//-----------------------------------------------------
//--- Images sessions -------------------------------
//-----------------------------------------------------
$lang['images_notify_count'] = "Total: {count}";
$lang['images_notify_sessions_title'] = "Currently active image users: ";
$lang['images_notify_invisible_chars'] = "*";
$lang['images_notify_current_sessions_title'] = "There are currently ";
$lang['images_notify_registered_users_count'] = "<b>{registered_users_count}</b> registered user(s) ";
$lang['images_notify_invisible_count'] = "({invisible_count} among them invisible) ";
$lang['images_notify_guest_level_count'] = "and <b>{guest_level_count}</b> guest(s) online.";

// Step 3

In templates/your_template/details.html file,

find:

Code: [Select]
{if allow_comments}
<a name="comments"></a>
<br />

add after:

Code: [Select]
{if is_admin}<! -- Image users sessions -- >{endif is_admin}
 {if image_allow_read}  
<table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td valign="top" class="head1">&nbsp;{lang_image_notify_sessions_title} {total_image_sessions}</td>
 </tr>
   </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>  
   <td class="row1">&nbsp;{lang_image_notify_current_sessions_title} {total_registered_users_image_sessions} {total_invisible_image_sessions} {total_guest_level_image_sessions}</td>
 </tr>
    </table>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>
  {if image_sessions_template}<td width="100%" class="row1" />&nbsp;{image_sessions_template}</td>{endif image_sessions_template}
  {if sessions_image_no_content_msg}{if allow_image_read}<td width="100%" class="row1" align="center" /><b>{sessions_image_no_content_msg}</b></td>{endif allow_image_read}{endif sessions_image_no_content_msg}
 </tr>  
                        </table>  
         {endif image_allow_read}
 <br />
 {if is_admin}<! -- End of image users sessions -- >{endif is_admin}

// Step 4

In templates/your_template folder, create: details_sessions_content.html.

Add:

Code: [Select]
{if is_admin}{if session_image_invisible}<a href="{session_image_user_url}"><b>{session_image_name}</b></a>{invisible_image_chars}{if need_separator}, {endif need_separator}&nbsp;{endif session_image_invisible}{endif is_admin}
{if user_loggedin}{ifnot session_image_invisible}<a href="{session_image_user_url}"><b>{session_image_name}</b></a>{if need_separator}, {endif need_separator}&nbsp;{endifnot session_image_invisible}{endif user_loggedin}

// Step 5

In includes/functions.php file,

add top ?>:

Code: [Select]
// MOD: Image sessions user.
function get_image_sessions_info($user_id = -1, $status = "") {
    global $site_db, $session_info, $image_id, $user_table_fields, $table_prefix;

    if (!isset($user_id) || $user_id == -1) {
        return;
    }    

    if (!isset($status) || $status == "") {
        return;
    }    

    if (isset($user_id) && $user_id > 0) {
        $user_id = preg_replace("/[^0-9]+/i", "", $user_id);

        if ($user_row = get_user_info($user_id)) {
            if ($user_id != $user_row[$user_table_fields['user_id']]) {
                return;
            }
            unset ($user_row);
        }
        $status = preg_replace("/[^A-Za-z0-9\_]+/i", "", $status);

        

        $date = date('Y-m-d');
        $time = date('H:i:s');
        $microtime = time();        

        switch($status) {            

            case 'check_sessions_table' :            

            if (!defined('IMAGES_SESSIONS_TABLE')) {                
                define('IMAGES_SESSIONS_TABLE', $table_prefix . "images_sessions");
            }              

                $sql = "              

                CREATE TABLE IF NOT EXISTS " . IMAGES_SESSIONS_TABLE . " (
                field_id INT(11) NOT NULL AUTO_INCREMENT,
                user_id VARCHAR(32) NOT NULL DEFAULT '0',
                image_id INT(11) NOT NULL DEFAULT '0',
                image_sessions_date VARCHAR(48) NOT NULL DEFAULT '0000-00-00',
                image_sessions_time VARCHAR(48) NOT NULL DEFAULT '00:00:00',
                image_sessions_microtime VARCHAR(255) NOT NULL DEFAULT '0',
                image_sessions_ip VARCHAR(48) NOT NULL DEFAULT '0.0.0.0',
                PRIMARY KEY (field_id)
                ) TYPE=MyISAM;              

                ";              

                $result = $site_db->query($sql);

                $sql = "SELECT user_id, image_id FROM " . IMAGES_SESSIONS_TABLE . " WHERE user_id = " . $user_id . " AND image_id = " . $image_id;
                $result = $site_db->query($sql);
                $num_rows = $site_db->get_numrows($result);
                
                if (isset($num_rows) && $num_rows <= 0) {
                    
                    $image_sessions_ip = $session_info['session_ip'];

                    $sql1 = "                  

                    INSERT INTO " . IMAGES_SESSIONS_TABLE . "
                    (field_id, user_id, image_id, image_sessions_date, image_sessions_time, image_sessions_microtime, image_sessions_ip)
                    VALUES (NULL, '" . $user_id . "', '" . $image_id . "', '" . $date . "', '" . $time . "', '" . $microtime . "', '" . $image_sessions_ip . "')

                    ";                  

                    $result = $site_db->query($sql1);                    
                }
                
                $get_sessions_microtime = $microtime - 300;
                
                if (isset($num_rows) && $num_rows > 0) {                    
                        $site_db->query("DELETE FROM " . IMAGES_SESSIONS_TABLE . " WHERE image_sessions_microtime < " . $get_sessions_microtime);
                        //$site_db->query("UPDATE " . IMAGES_SESSIONS_TABLE . " SET image_sessions_microtime = '" . $microtime . "', image_id = '" . $image_id . "' WHERE user_id = '" . $user_id . "'");
                }
                
                return $user_id;
                break;        
        }
    }
}
// End of MOD: Image sessions user.

// Step 6

In includes/constants.php file,

find:

Code: [Select]
define('IMAGES_TABLE', $table_prefix.'images');

add after:

Code: [Select]
define('IMAGES_SESSIONS_TABLE', $table_prefix.'images_sessions');

// Step 7 (09/09/2007)

In includes/sessions.php file,

find:

Quote
$this->current_time = time();

add before:

Code: [Select]
$this->current_date = date('Y-m-d');
$this->current_clocktime = date('H:i:s');

Find:

Quote
function logout($user_id) {
    global $site_db;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = " . $user_id;
    $site_db->query($sql);  
    
    $this->set_cookie_data("userpass", "", 0);
    $this->set_cookie_data("userid", GUEST);

    $this->session_info = array();

    return true;
  }

replace:

Code: [Select]
function logout($user_id) {
    global $site_db;
    $sql = "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = " . $user_id;
    $site_db->query($sql);    
    $sql = "DELETE FROM " . IMAGES_SESSIONS_TABLE . "
            WHERE user_id = '" . addslashes($this->session_id) ."' OR user_id = " . $user_id;
    $site_db->query($sql);    
    
    $this->set_cookie_data("userpass", "", 0);
    $this->set_cookie_data("userid", GUEST);

    $this->session_info = array();

    return true;
  }

Find:

Quote
function update_session() {
    global $site_db;

replace:

Code: [Select]
function update_session() {
    global $site_db, $image_id, $url;

Find:

Quote
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;

add after:

Code: [Select]
if (preg_match("/details.php/", $url)) {
    
    $sql = "REPLACE INTO " . IMAGES_SESSIONS_TABLE . "
            (field_id, user_id, image_id, image_sessions_date, image_sessions_time, image_sessions_microtime)
            VALUES (NULL, '" . addslashes($this->session_id) . "', '" . $image_id . "', '" . $this->current_date . "', '" . $this->current_clocktime . "', $this->current_time)                  
            
           ";          
    $site_db->query($sql);
    
}

Find:

Quote
if ($this->user_info['user_id'] != GUEST) {
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);            
}

replace:

Code: [Select]
if ($this->user_info['user_id'] != GUEST) {
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);      
      $sql1 = "DELETE FROM " . IMAGES_SESSIONS_TABLE . " WHERE user_id = '" . GUEST . "' AND image_sessions_ip = '" . $this->user_ip . "'";
      $site_db->query($sql1);    
}

Go details (is active for image) and see. ;)

(For fix - reset table).

86
Hi,

This MOD is for notify comment previous user for reply in details. Stats include for admin - see how user clicked in certain time.

1 - Make backup of gallery

2 - Here is MOD - (test in 4images v1.7.4):

// Step 1

In details.php file,

find:

Code: [Select]
$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

add after:

Code: [Select]
// MOD: Notify comments by email.
 if (function_exists('get_comments_notify_by_email')) {
     get_comments_notify_by_email($user_info['user_id'], 'check_table');    
 }
 // End of MOD: Notify comments by email.

Find:

Code: [Select]
unset($comments);

add after:

Code: [Select]
// MOD: Notify comments by email.
      $sql = "SELECT cn.field_id, cn.comment_notify_status
              FROM " . COMMENTS_NOTIFY_TABLE . " cn
              LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
              WHERE cn.image_id = " . $image_id . " AND cn.user_id = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'";
              
      $result1 = $site_db->query($sql);
      
      while ($notify_row = $site_db->fetch_array($result1)) {
          $field_id = $notify_row['field_id'];
          $comment_notify_status = $notify_row['comment_notify_status'];
      }

Find:

Code: [Select]
update_comment_count($id, $user_info['user_id']);

add after:

Code: [Select]
// MOD: Comments notify by email.
      if (function_exists('get_comments_notify_by_email')) {
          get_comments_notify_by_email($user_info['user_id'], 'notify');
          $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_reply_message_email_sent']);
      }
      // End of MOD: Comments notify by email.

Find:

Code: [Select]
unset($row);
unset($spam_row);
}

add after:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Update Comments Notify by Email -----------------
//-----------------------------------------------------
if ($action == "update_comment_notify_email") {    
    
    $field_id = (isset($HTTP_POST_VARS['field_id'])) ? intval(trim($HTTP_POST_VARS['field_id'])) : 0;    
    $notify_status = (isset($HTTP_POST_VARS['notify_status'])) ? intval(trim($HTTP_POST_VARS['notify_status'])) : "";
    
    if (!isset($field_id) || (isset($field_id) && empty($field_id))) {
        redirect($url);
    }
    
    $date = date('Y-m-d');
    $time = date('H:i:s');
    $microtime = time();      
    
    if (isset($notify_status) && $notify_status == 1) {
        $sql = "UPDATE " . COMMENTS_NOTIFY_TABLE . " SET comment_notify_status = comment_notify_status - 1, comment_notify_date = '" . $date . "', comment_notify_time = '" . $time . "', comment_notify_microtime = '" . $microtime . "' WHERE field_id = " . $field_id;
    } elseif (isset($notify_status) && $notify_status == 0) {        
        $sql = "UPDATE " . COMMENTS_NOTIFY_TABLE . " SET comment_notify_status = comment_notify_status + 1, comment_notify_date = '" . $date . "', comment_notify_time = '" . $time . "', comment_notify_microtime = '" . $microtime . "' WHERE field_id = " . $field_id;
    }
    $result = $site_db->query($sql);
    
    if ($notify_status == 0) {
        $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_update_notification_uncheck_message']);
    } elseif ($notify_status == 1) {
        $msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(stripslashes($user_info['user_name']), 2), $lang['comments_notify_update_notification_check_message']);
    }      
    
    if (preg_match("/comments_notify.php/", $url)) {
        redirect("comments_notify.php");
    } else {    
        redirect("details.php?image_id=" . $image_id);
    }
}
// End of MOD: Comments notify by email.

Find:

Code: [Select]
"lang_file_size" => $lang['file_size']

Replace:

Code: [Select]
// MOD: Notify comments by email.
  "lang_file_size" => $lang['file_size'],
  "comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
  "comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 1 : 0,
  "field_id" => (isset($field_id)) ? (int)$field_id : 0,
  "url_comment_notify_email" => $site_sess->url(ROOT_PATH . "details.php")
  // End of MOD: Notify comments by email.

// Step 2

In includes/constants.php file,

top of ?> - add:

Code: [Select]
// MOD: Comments notify by email.
// Comments notify by email.
define('COMMENTS_NOTIFY_DEBUG_ID', false); // Set true for debug comments reply to your current User ID.
define('COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS', true); // Set true for remove each SQL content status from comments_notify.php file (NO RECOVER !). If set false, user can use button again.

// Comments notify by email - statistics
define('COMMENTS_NOTIFY_STATS_TIME_GLOBAL', true); // Activate = true / De-activate = false.
define('COMMENTS_NOTIFY_STATS_TIME', 7); // Set number of day before send stats email to you.
// End of MOD: Comments notify by email.

// Step 3

In includes/functions.php file,

top of ?> - add:

Code: [Select]
// MOD: Comments notify by email.
function get_comments_notify_by_email($user_id = -1, $status = "") {
    global $site_db, $lang, $msg, $user_info, $config, $site_template, $additional_user_fields, $additional_image_fields;
    global $image_id, $id, $table_prefix, $user_table_fields, $script_url;    

    if (!isset($user_id) || $user_id == -1) {
        return;
    }    

    if (!isset($status) || $status == "") {
        return;
    }    

    if (isset($user_id) && $user_id > 0) {
        $user_id = preg_replace("/[^0-9]+/is", "", $user_id);
        if ($user_row = get_user_info($user_id)) {
            if ($user_id != $user_row[$user_table_fields['user_id']]) {
                return;
            }
            unset ($user_row);
        }
        $status = preg_replace("/[^A-Za-z0-9\_]+/is", "", $status);        

        $date = date('Y-m-d');
        $time = date('H:i:s');
        $microtime = time();      

        switch($status) {            

            case 'check_table' :            

            if (!defined('COMMENTS_NOTIFY_TABLE')) {                                
                define('COMMENTS_NOTIFY_TABLE', $table_prefix . "comments_notify");
            }              

                $sql = "                

                CREATE TABLE IF NOT EXISTS " . COMMENTS_NOTIFY_TABLE . " (
                field_id INT(11) NOT NULL AUTO_INCREMENT,
                user_id VARCHAR(32) NOT NULL DEFAULT '0',
                image_id INT(11) NOT NULL DEFAULT '0',
                comment_notify_date VARCHAR(48) NOT NULL DEFAULT '0000-00-00',
                comment_notify_time VARCHAR(48) NOT NULL DEFAULT '00:00:00',
                comment_notify_microtime VARCHAR(255) NOT NULL DEFAULT '0',
                comment_notify_status INT(1) NOT NULL DEFAULT '0',
                PRIMARY KEY (field_id)
                ) TYPE=MyISAM;              

                ";              

                $result = $site_db->query($sql);

                $sql = "SELECT user_id, image_id FROM " . COMMENTS_NOTIFY_TABLE . " WHERE user_id = " . $user_id . " AND image_id = " . $image_id;
                $result = $site_db->query($sql);
                $num_rows = $site_db->get_numrows($result);
                
                if (isset($num_rows) && $num_rows <= 0) {

                    $sql1 = "                  

                    INSERT INTO " . COMMENTS_NOTIFY_TABLE . "
                    (field_id, user_id, image_id, comment_notify_date, comment_notify_time, comment_notify_microtime, comment_notify_status)
                    VALUES (NULL, '" . $user_id . "', '" . $image_id . "', '" . $date . "', '" . $time . "', '" . $microtime . "', '1')                    

                    ";                  

                    $result = $site_db->query($sql1);                    
                }
                
                return $user_id;
                break;                  

                case 'notify' :                

                $additional_user_sql = "";
                $additional_user_sql_array = array();                
                if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
                    foreach ($additional_user_fields as $key => $val) {
                        $additional_user_sql .= ", u." . $key;
                        $additional_user_sql_array[] = $key;
                    }
                }                

                $additional_image_sql = "";
                $additional_image_sql_array = array();
                if (isset($additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
                    foreach ($additional_image_fields as $key => $val) {
                        $additional_image_sql .= ", i." . $key;
                        $additional_image_sql_array[] = $key;
                    }
                }
                $debug_id = (defined('COMMENTS_NOTIFY_DEBUG_ID') && COMMENTS_NOTIFY_DEBUG_ID == true && isset($user_id) && $user_info['user_level'] == ADMIN) ? "AND cn.user_id = " . $user_info['user_id'] : "";                

            $sql = "            

            SELECT c.comment_headline" . get_user_table_field(", u.", "user_name") . get_user_table_field(", u.", "user_email") . $additional_user_sql . $additional_image_sql . "
            FROM (" . IMAGES_TABLE . " i, " . COMMENTS_TABLE . " c, " . COMMENTS_NOTIFY_TABLE . " cn)
            LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = cn.user_id)
            WHERE cn.image_id = " . $id . " AND c.user_id = " . $user_id . " AND cn.user_id <> " . $user_id . ((isset($debug_id)) ? trim($debug_id) : "") . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "' AND cn.comment_notify_status = 1
            ORDER BY cn.comment_notify_date, cn.comment_notify_time ASC";
    
            $result = $site_db->query($sql);
            $num_rows = $site_db->get_numrows($result);            

            if (isset($num_rows) && $num_rows > 0) {              

                $subject_counter = 0;
                while ($notify_row = $site_db->fetch_array($result)) {
                    $subject_counter++;
                    $user_name = $notify_row[$user_table_fields['user_name']];
                    $user_email = $notify_row[$user_table_fields['user_email']];
                    $reply_subject = $notify_row['comment_headline'];
                }

                

                if (isset($site_email) && !empty($site_email)) {
                    unset ($site_email);
                }
                @include_once(ROOT_PATH . "includes/email.php");
                $site_email = new Email();              

                $site_email->set_to(stripslashes($user_email));
                $site_email->set_from(stripslashes($config['site_email']));
$site_email->set_subject(str_replace(array("{site_name}", "{reply_subject}", "{subject_counter}"), array(format_text(stripslashes($config['site_name']), 2), ((isset($reply_subject)) ? stripslashes($reply_subject) : ""), intval(trim($subject_counter))), $lang['comments_notify_new_reply_message_email_subject_title']));
                $site_email->register_vars(array(
                "user_name" => format_text(stripslashes($user_name), 2),
                "comments_notify_url" => format_url($script_url . "/details.php?image_id=" . $id),
                "comment_user_name" => format_text(stripslashes($user_info['user_name']), 2),
                "site_name" => format_text(stripslashes($config['site_name']), 2),
                "site_email" => stripslashes($config['site_email'])
                ));

                if (isset($additional_user_sql_array) && is_array($additional_user_sql_array) && !empty($additional_user_sql_array)) {
                    foreach ($additional_user_sql_array as $key => $val) {
                        if ($val == $notify_row[$val]) {
                            $site_email->register_vars($val, $notify_row[$val]);
                        }
                    }
                }

                if (isset($additional_image_sql_array) && is_array($additional_image_sql_array) && !empty($additional_image_sql_array)) {
                    foreach ($additional_image_sql_array as $key => $val) {
                        if ($val == $notify_row[$val]) {
                            $site_email->register_vars($val, $notify_row[$val]);
                        }
                    }
                }
                $site_email->set_body("comments_notify_new_reply_message", $config['language_dir_default']);
                $site_email->send_email();              

                unset ($additional_user_sql);
                unset ($additional_user_sql_array);
                unset ($additional_image_sql);
                unset ($additional_image_sql_array);
                unset ($subject_counter);
                
                return $user_id;
            }

            break;          

            case 'comments_notify_statistics' :          

            if (defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true) {          

            $stats_time = time() - 60 * 60 * 24 * (defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true && defined('COMMENTS_NOTIFY_STATS_TIME') && (int)COMMENTS_NOTIFY_STATS_TIME > 0) ?  " AND comment_notify_microtime < " . COMMENTS_NOTIFY_STATS_TIME : "";            

            $sql = "SELECT COUNT(comment_notify_status) AS total_notify
                    FROM " . COMMENT_NOTIFY_TABLE . "
                    WHERE comment_notify_status = 1" . $stats_time;
            $row = $site_db->query_firstrow($sql);
            $check_notify = (isset($row['total_notify'])) ? $row['total_notify'] : 0;            

            $sql = "          

            SELECT " . get_user_table_field("", "user_name") . get_user_table_field(", ", "user_email") . "
            FROM " . USERS_TABLE . "
            WHERE " . get_user_table_field("", "user_id") . " = '1'";
            $get_webmaster_info = $site_db->query_firstrow($sql);            

            if (isset($site_email) && !empty($site_email)) {
                unset ($site_email);
            }
            @include_once(ROOT_PATH . "includes/email.php");
            $site_email = new Email();          

            $site_email->set_to(stripslashes($get_webmaster_info[$user_table_fields['user_email']]));
            $site_email->set_from(stripslashes($config['site_email']));
            $site_email->set_subject(preg_replace("/" . $site_template->start . "site_name" . $site_template->end . "/siU", format_text(stripslashes($config['site_name']), 2), $lang['comments_notify_statistic_report_email_subject']));
            $site_email->register_vars(array(
            "admin_name" => format_text(trim($get_webmaster_info[$user_table_fields['user_name']]), 2),
            "stats_value" => (isset($check_notify) && $check_notify > 0) ? (int)$check_notify : 0,
            "site_name" => format_text(trim($config['site_name']), 2)
            ));
            $site_email->set_body("comments_notify_statistic_message", $config['language_dir_default']);
            $site_email->send_email();          

            return $user_id;
            }          

        } // End switch.              
    }
}
// End of MOD: Comments notify by email.

// Step 4

In includes/page_header.php file,

find:

Code: [Select]
//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);

add after:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Comments notify by email - statistic ------------
//-----------------------------------------------------
if ($user_info['user_id'] == 1 && defined('COMMENTS_NOTIFY_STATS_TIME_GLOBAL') && COMMENTS_NOTIFY_STATS_TIME_GLOBAL == true && defined('COMMENTS_NOTIFY_STATS_TIME') && (int)COMMENTS_NOTIFY_STATS_TIME > 0 && function_exists('get_comment_notify_by_email')) {
    get_comment_notify_by_email($user_info['user_id'], 'comments_notify_statistics');
}
// End of MOD: Comments notify by email.

// Step 5

In lang/english/main.php file,

add top of ?>:

Code: [Select]
// MOD: Comments notify by email.
//-----------------------------------------------------
//--- Comments notify by email ------------------------
//-----------------------------------------------------
$lang['comments_notify_undefined_table'] = "{table_name} table is NOT defined in includes/constants.php file.";
$lang['comments_notify_email_subject_welcome_message'] = "{site_name} - New feature: Comments notify by email.";
$lang['comments_notify_new_reply_message_email_subject_title'] = "{site_name} - Reply notification: {reply_subject} on post: {subject_counter}.";
$lang['comments_notify_reply_message_email_sent'] = "Thanks {user_name}. Notification reply by email has just been sent to users who wishes to be notified.";
$lang['comments_notify_update_notification_uncheck_message'] = "Thanks {user_name}. Notification has been unchecked for these comments.";
$lang['comments_notify_update_notification_check_message'] = "Thanks {user_name}. Notification has just been checked for these comments.";
$lang['comments_notify_statistic_report_email_subject'] = "{site_name} - Latest statistics.";
// End of MOD: Comments notify by email.

// Step 6

In lang/english/email,

create 3 files: comments_notify_new_reply_message.html, comments_notify_statistic_message.html .

Content per order:

Code: [Select]
Dear {user_name},

{comment_user_name} has just replied to your message.

Comment URL: {comments_notify_url}

Note:

This is an automated message reply system. If you see this message,
it's because you chosed the 'Notify by Email' button option from one
(or many) images you visited in our gallery.

{site_name} does NOT send out email messages on purpose. Emails are
being sent as per users preferences.

Best wishes.
{site_name}

2nd:

Code: [Select]
Dear {admin_name},

You are receiving this email message since you activated
the statistics for the comments notify by email.

Here are the latest stats of all users that checked
the 'Notify by email' button: {stats_value}

Best wishes.
{site_name} .

// Step 7

In templates/your_template/details.html file,

find:

Code: [Select]
<td valign="top" class="head1">{lang_comment}</td>

add after:

Code: [Select]
{if is_admin}<! -- Comment notify by email foreach user -- >{endif is_admin}
   {if user_loggedin}{if comment_num_rows}{if comment_notify_button}<td valign="top" class="head1">
           <form method="post" action="{url_comment_notify_email}">
           <input type="hidden" name="action" value="update_comment_notify_email">            
   <input type="hidden" name="field_id" value="{field_id}">
           <input type="hidden" name="notify_status" value="{comment_notify_value}">
           <input type="hidden" name="image_id" value="{image_id}">
           <input type="image" src="{comment_notify_button}">
           </form>            
           </td>{endif comment_notify_button}{endif comment_num_rows}{endif user_loggedin}
             {if is_admin}<! -- End comment notify by email foreach user -- >{endif is_admin}

// Step 8

In includes/constants.php file,

find:

Code: [Select]
define('COMMENTS_TABLE, $table_prefix.'comments');

add after:

Code: [Select]
define('COMMENTS_NOTIFY_TABLE', $table_prefix.'comments_notify');

Must keep comments_notify at end.

Is all. Thank to Mawenzi for button:

http://www.4homepages.de/forum/index.php?topic=18491.msg99168#msg99168

Upload in templates/your_template/images_english folder. Should all work. ;)

And thank to Mr_Lovalove for test on server.

================================================================
====  New Version  == 08-29-2007 ========================================
===============================================================

Upgrade from before (must use 1st version for 2nd).

// Step 1

In details.php file,

Code: [Select]
// MOD: Notify comments by email.
  "comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
  "comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 1 : 0,
  "url_comment_notify_email" => $site_sess->url(ROOT_PATH . "details.php")
  // End of MOD: Notify comments by email.

add before:

Code: [Select]
"comments_notify_go_back" => (preg_match("/comments_notify.php/", $url)) ? preg_replace("/" . $site_template->start. "go_back" . $site_template->end . "/siU", $site_sess->url(ROOT_PATH . "comments_notify.php"), $lang['comments_notify_go_back']) : "",

Find:

Code: [Select]
redirect("details.php?image_id=" . $image_id);

replace:

Code: [Select]
if (preg_match("/comments_notify.php/", $url)) {
redirect("comments_notify.php");
} else {
redirect("details.php?image_id=" . $image_id);
}

// Step 2 [09/14/2007]

In member.php file,

find:

Code: [Select]
"lang_edit_profile_msg" => $edit_profile_msg,

add after:

Code: [Select]
"lang_comments_notify_ask_question" => $lang['comments_notify_ask_question'],
"lang_comments_notify_ask_question_url_name" => preg_replace("/" . $site_template->start . "click_here" . $site_template->end . "/siU", $site_sess->url(ROOT_PATH . "comments_notify.php"), $lang['comments_notify_ask_question_url_name']),

// Step 3

In lang/english/main.php file,

find:

Code: [Select]
$lang['comments_notify_statistic_report_email_subject'] = "{site_name} - Latest statistics.";

add after:

Code: [Select]
$lang['comments_notify_clickstream_title'] = "Comments notify";
$lang['comments_notify_no_content'] = "No comments notify.";
$lang['comments_notify_title'] = "Comments notify";
$lang['comments_notify_go_back'] = "<a href=\"{go_back}\"><span class=\"smalltext\">[ Go back ]</span></a>";
$lang['comments_notify_image_uploader'] = "Image uploader";
$lang['comments_notify_image_name'] = "Image name";
$lang['comments_notify_comment_status'] = "Notify status";
$lang['comments_notify_date_n_time'] = "Date & time";
$lang['comments_notify_ask_question'] = "Configure my comment notify list:";
$lang['comments_notify_ask_question_url_name'] = "<a href=\"{click_here}\">[ Click here ]</a>";

// Step 4

In templates/your_template/details.html file,

find:

Code: [Select]
<b class="title"><br />{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif

replace:

Code: [Select]
<b class="title">{if comments_notify_go_back}{comments_notify_go_back}{endif comments_notify_go_back}<br /><br />{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif

// Step 5

In ROOT_PATH, create new file: comments_notify.php .

Add:

Code: [Select]
<?php

$main_template 
"comment_notify";

define('ROOT_PATH''./');
include(
ROOT_PATH 'global.php');
require(
ROOT_PATH 'includes/sessions.php');
include(
ROOT_PATH 'includes/page_header.php');

if (
$user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {
    
redirect($url);
}

if (
$action == "") {
    
$action "show_comments_notify";
}

if (
$action == "show_comments_notify") {
    
    
$comments_notify_overwrite_button_status = (defined('COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS') && COMMENTS_NOTIFY_OVERWRITE_BUTTON_STATUS == true) ? "cn.comment_notify_status = 1 AND " "";
    
    
$additional_user_sql "";
    
$additional_user_sql_array = array();
    if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
        foreach (
$additional_user_fields as $key => $val) {
            
$additional_user_sql .= ", u." $key;
            
$additional_user_sql_array[] = $key;
        }
    }
    
    
$additional_image_sql "";
    
$additional_image_sql_array = array();
    if (isset(
$additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
        foreach (
$additional_image_fields as $key => $val) {
            
$additional_image_sql .= ", i." $key;
            
$additional_image_sql_array[] = $key;
        }
    }    
    
    
$sql "
    
    SELECT i.user_id, i.cat_id, i.image_id, i.image_name, i.image_active, i.image_allow_comments, cn.field_id, cn.comment_notify_status, cn.comment_notify_date, cn.comment_notify_time" 
get_user_table_field(", u.""user_name") . $additional_user_sql $additional_image_sql "
    FROM (" 
IMAGES_TABLE " i, " COMMENTS_NOTIFY_TABLE " cn)
    LEFT JOIN " 
USERS_TABLE " u ON (" get_user_table_field("u.""user_id") . " = i.user_id)    
    WHERE " 
. ((isset($comments_notify_overwrite_button_status)) ? trim($comments_notify_overwrite_button_status) : "") . " i.image_id = cn.image_id AND cn.user_id = " $user_info['user_id'];    
    
    
$result $site_db->query($sql);
    
$notify_num_rows $site_db->get_numrows($result);
    
    if (isset(
$notify_num_rows) && $notify_num_rows <= 0) {
        
$msg $lang['comments_notify_no_content'];
        
    } elseif (isset(
$notify_num_rows) && $notify_num_rows 0) {
        
        
$comments_notify_template "";
        
$bgcounter 0;        
        
        while (
$image_row $site_db->fetch_array($result)) {
            
$row_count = ($bgcounter++ % == 0) ? 2;
                            
            
$user_id $image_row['user_id'];
            
$image_id $image_row['image_id'];
            
$field_id $image_row['field_id'];
            
$image_name $image_row['image_name'];
            
$image_active $image_row['image_active'];
            
$image_allow_comments $image_row['image_allow_comments'];
            
$user_name $image_row[$user_table_fields['user_name']];
            
$cat_id $image_row['cat_id'];
            
$comment_notify_status $image_row['comment_notify_status'];
            
$comment_notify_date $image_row['comment_notify_date'];
            
$comment_notify_time $image_row['comment_notify_time'];
            
            
$site_template->register_vars(array(
            
"user_id" => (isset($user_id)) ? (int)$user_id 0,
            
"image_id" => (isset($image_id)) ? (int)$image_id 0,
            
"field_id" => (isset($field_id)) ? (int)$field_id 0,
            
"uploader_user_url" => (isset($user_id) && isset($user_name)) ? $site_sess->url(ROOT_PATH "member.php?action=showprofile&" URL_USER_ID "=" $user_id) : "",
            
"url_comment_notify_email" => $site_sess->url(ROOT_PATH "details.php"),
            
"uploader_user_name" => (isset($user_name)) ? format_text(stripslashes($user_name), 2) : "",
            
"image_active" => (isset($image_active) && $image_active == 1) ? true false,
            
"allow_comments" => (isset($image_allow_comments) && $image_allow_comments == 1) ? true false,
            
"image_name" => format_text(stripslashes($image_name), 2),            
            
"comment_notify_button" => (isset($comment_notify_status) && $comment_notify_status == 1) ? get_gallery_image("notify_check.gif") : get_gallery_image("notify_uncheck.gif"),
            
"comment_notify_value" => (isset($comment_notify_status) && $comment_notify_status == 1) ? 0,
            
"comment_notify_date" => (isset($comment_notify_date)) ? trim($comment_notify_date) : "",
            
"comment_notify_time" => (isset($comment_notify_time)) ? trim($comment_notify_time) : "",
            
"row_count" => (isset($row_count) && $row_count 0) ? true false,
            
"image_url" => (isset($image_id)) ? $site_sess->url(ROOT_PATH "details.php?" URL_IMAGE_ID "=" $image_id) : format_text(stripslashes($image_name), 2)
            ));
            if (isset(
$additional_user_sql_array) && is_array($additional_user_sql_array) && !empty($additional_user_sql_array)) {
                foreach (
$additional_user_sql_array as $key => $val) {
                    if (
$val == $image_row[$val]) {
                        
$site_template->register_vars($val$image_row[$val]);
                    }
                }
            }
            if (isset(
$additional_image_sql_array) && is_array($additional_image_sql_array) && !empty($additional_image_sql_array)) {
                foreach (
$additional_image_sql_array as $key => $val) {
                    if (
$val == $image_row[$val]) {
                        
$site_template->register_vars($val$image_row[$val]);
                    }
                }
            }
            
$comments_notify_template .= $site_template->parse_template("comment_notify_content");            
        }        
    }
}

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

$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"msg" => trim($msg),
"comments_notify_template" => trim($comments_notify_template),
"num_rows" => (isset($notify_num_rows) && $notify_num_rows 0) ? true false,
"lang_comments_notify_title" => $lang['comments_notify_title'],
"lang_comments_notify_image_uploader" => $lang['comments_notify_image_uploader'],
"lang_comments_notify_image_name" => $lang['comments_notify_image_name'],
"lang_comments_notify_comment_status" => $lang['comments_notify_comment_status'],
"lang_comments_notify_date_n_time" => $lang['comments_notify_date_n_time']
));
$site_template->print_template($site_template->parse_template($main_template));

include(
ROOT_PATH 'includes/page_footer.php');
?>


// Step 6

No place post here so attach file and upload in templates/your_template folder.

- User can selek / no selek notify button and see headline from. No more run for notify button foreach detail page.
- Image active and allow comment - auto-detek. Image active off: 2 link off. Allow comment (with image active on) - 1 link off.

Thank to Mr_Lovalove for test on server. ;)

Screenshot - see attach.

87
Feedback & Suggestions / [FIX] - Details for comments - end statement.
« on: August 23, 2007, 12:03:01 AM »
In details.php file,

Replace:

Quote
$comments .= $site_template->parse_template("comment_bit");
    } // end while

for:

Quote
$comments .= $site_template->parse_template("comment_bit");
    } // end for

Got lost when code . . .

88
@Mawenzi:

is possible to create a new button say: Notify By Email ? Sorry for ask ... I no good artist ... 
(checkbox design with sqware for check / uncheck). 8)

89
In categories.php file,

find:

Quote
ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."

replace:

Quote
ORDER BY ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."

90
Feedback & Suggestions / PHP v5.2 announce from php.net
« on: August 21, 2007, 03:42:24 AM »
Greets,

I ask someone to correct structure of my text - important announce. Good english. :)
--------------------------------------------------------------------------------------------------------------------------

* VERY IMPORTANT *

Hi,

it has been noticed on this forum that most users encountered some problems with 4images MODs. Lately, PHP manufacturer has officially announced PHP v5.2 as stable from their website (to be released on January 2008). Support for PHP v4.x will no longer be available in about 5 months. Right now, several thousands of users might still be using PHP v4.x - using 4images v1.7.x. Starting from PHP v4.4.6 release, issues started to bounced on this solid gallery.

During the past year, V@no posted patches for PHP v5.x (and mySQL v5.x). Since then, things started to run normally.

Solution: Ask your web hosting service provider to install PHP v5.2x (minimum) as quickly as possible. Security issues are very important to consider as for the safety of your gallery (especially for users who asked for adding their galleries on the showcase of this site). According to PHP manufacturer, several tests has been done with PHP v5.2x and should be prior with 4images starting to v1.7.4 release.

For the upgrade operation, only web hosting services can execute this task. Backup your entire gallery before submitting a support ticket to partys. Make a good backup of your mySQL database in case of any failure that might be encountered during the upgrade operation. Hosts will certainly ignore their actions for targeting your site (if they fail).
If succeeded, you should receive an update email message - mentioning the success of the upgrade operation.

This step can no longer be ignored. PHP v5.2x has been known so far as the most stable and solid version of it's kind and must be used with this unique product of: 4images. Jan has done very good work on this product as, for sure, none of us would want to loose what has been accomplished so far.

In January 2008, everyone will see the result (for the good or for the bad).

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

This is note. Only 4 month before change to PHP v5.2x. No miss.

Pages: 1 2 3 4 5 [6] 7