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 - alekseyn1

Pages: [1]
1
Dear friends,

I felt like my site needed an urgent need for threaded comments.
One level of comments or even two level only (with YouTube-like comments available with one of the Mods) was not enogh for my needs so I decided to do something different....

I found a class online and adjusted it to fit the 4images structure....
If the admins or code gurus of 4images will create a MOD out of it that would be great... I feel that it's much much simpler than the YouTube like commening MOD...

So after a week of struggle (I am not a pro PHP programmer :lol:) I made it work... sample screen shot attached.

Thanks guys for 4images and I thought I'd share something with the community!

Here is the code from details.php
It needs to be cleaned from my other MODs, so for those of you who just follow the instructions - DO NOT USE MY CODE before you clean it... and ALWAYS BACKUP your files before changing anythig:

you will need and additional field in your comments table... please try to make a MOD out of it for everyone, since I really do not have any more time for this ))))


//-----------------------------------------------------
//--- Show Comments NEW STYLE--------------------------
//-----------------------------------------------------

if ($image_allow_comments == 1) {

  
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_response, c.response, 
          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.full_name, c.comment_rating,c.comment_votes,c.comment_rating_users, c.comment_parent
          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 "
.(COMMENTS_ORDER "DESC" "ASC")."";
//        LIMIT $offset, $commentperpage"; line for paging comments

  
$result $site_db->query($sql);
  
debug($sql);
  
$comment_row1 = array();
  while (
$row $site_db->fetch_array($result)) {
    
$comment_row1[] = $row;
  }
  
//$site_db->free_result($result);
  
$num_comments1 sizeof($comment_row1);

  
class 
Threaded_comments  {  // thanks to http://www.jongales.com/blog/2009/01/27/php-class-for-threaded-comments/
	
 var 
$one_comment"";
	
 var 
$all_out"";
     public 
$parents  = array();  
     public 
$children = array();  

     
//  @param array $comments       
     
function __construct($comments) {
         foreach (
$comments as $comment)  
         {
             if (
$comment['comment_parent'] == 0)  
             {  
                 
$this->parents[$comment['comment_id']][] = $comment;  
             }  
             else  
             {  
                 
$this->children[$comment['comment_parent']][] = $comment;  
             }  
         }  
     }  
   
      
//@param array $comment 
      //@param int $depth 
     
Private function format_comment($comment_row$depth)  {

	
 
//include(ROOT_PATH."ajaxcomments.php");

	
 global 
$site_db$site_sess$site_template$config$user_table_fields$image_row$lang$user_info$image_allow_comments$row_bg_number$cat_id;
	
 
//**********************************************************************
	
 
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
	
  
	
  
$comment_by_owner = ($image_row['user_id'] == $comment_row['user_id']) ? 0;
	
  
      
$comment_user_email "";
      
$comment_user_email_save "";
      
$comment_user_mailform_link "";
      
$comment_user_email_button "";
      
$comment_user_homepage_button "";
      
$comment_user_icq_button "";
      
$comment_user_profile_button "";
      
$comment_user_status_img REPLACE_EMPTY;
      
$comment_user_name format_text($comment_row['comment_user_name'], 2);
      
$comment_full_name $comment_row['full_name'];
      
$comment_user_info $lang['userlevel_guest'];
      
$comment_headline format_text($comment_row['comment_headline'], 0$config['wordwrap_comments'], 00);
      
$comment_user_id $comment_row['user_id'];
  
    
// for comments avatars
    
$sql2 "SELECT user_id, user_avatar, user_avatar_type, user_avatar_width,
    user_avatar_height FROM phpbb_users
    WHERE username = '"
.$comment_row['comment_user_name']."'";
    
$result2 $site_db->query($sql2);
	
$row2 $site_db->fetch_array($result2);
  
	
if (empty (
$row2['user_avatar'])) {
	
	
//$comment_user_avatar = get_user_avatar($row2['user_avatar'], $row2['user_avatar_type'], $row2['user_avatar_width'], $row2['user_avatar_height']); 
	
	
$comment_user_avatar "";
	
	

	
	
else {
	
	

	
	
if (
$row2['user_avatar_type'] == 1) {
	
	
$comment_user_avatar "<img src='".PHPBB3_URL."/download/file.php?avatar=".$row2['user_avatar']."'>";
                } else {
                
$comment_user_avatar "<img src='".$row2['user_avatar']."'>";
                }
        }       
    
// end comment avatars
	

	
//PM link
	
$phpbbuser $row2['user_id'];
	

	
$send_pm_comment = ($user_info['user_level'] != GUEST) ? "<a href='/forum/ucp.php?i=pm&mode=compose&u=".$phpbbuser."' target='blank'>".$lang['send_pm']."</a>" "";
	

	
  if (isset(
$comment_row[$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        
	
	
$comment_user_name format_text($comment_row[$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[$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$user_table_fields['user_invisible']]) && $comment_row[$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[$user_table_fields['user_homepage']])) ? format_url($comment_row[$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>";
        }
	
	

	
	

	
	
//new option - full name from phpBB
        
$comment_full_name = (isset($comment_row[$user_table_fields['full_name']])) ? $comment_row[$user_table_fields['full_name']] : "";
        if (!empty(
$comment_full_name)) {
          
$comment_user_full_name iconv('utf-8''windows-1251'$comment_full_name);
        }
	
	
//end new option - full name from phpBB
	
	

	
	

	
	
$comment_user_icq = (isset($comment_row[$user_table_fields['user_icq']])) ? format_text($comment_row[$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[$user_table_fields['user_email']]) && (!isset($comment_row[$user_table_fields['user_showemail']]) || (isset($comment_row[$user_table_fields['user_showemail']]) && $comment_row[$user_table_fields['user_showemail']] == 1))) {
          
$comment_user_email format_text($comment_row[$user_table_fields['user_email']]);
          
$comment_user_email_save format_text(str_replace("@"" at "$comment_row[$user_table_fields['user_email']]));
          if (!empty(
$url_mailform)) {
            
$comment_user_mailform_link $site_sess->url(preg_replace("/{user_id}/"$comment_user_id$url_mailform));
          }
          else {
            
$comment_user_mailform_link $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
          }
          
$comment_user_email_button "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
        }

        if (!isset(
$comment_row[$user_table_fields['user_level']]) || (isset($comment_row[$user_table_fields['user_level']]) && $comment_row[$user_table_fields['user_level']] == USER)) {
          
$comment_user_level $lang['userlevel_user'];
        }
        elseif (
$comment_row[$user_table_fields['user_level']] == ADMIN) {
          
$comment_user_level $lang['userlevel_admin'];
        }
        elseif (
$comment_row[$user_table_fields['user_level']] == MODERADOR) { 
          
$comment_user_level $lang['userlevel_moderador']; 
        } 

        
$comment_user_info = (isset($comment_row[$user_table_fields['user_joindate']])) ? $lang['join_date']." ".format_date($config['date_format'], $comment_row[$user_table_fields['user_joindate']]) : "";
        
$comment_user_info .= (isset($comment_row[$user_table_fields['user_comments']])) ? " | <a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments&user_id=".$comment_user_id)."\">".$lang['comments']." ".$comment_row[$user_table_fields['user_comments']]."</a>" "";
      }

      
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row['comment_ip'] : "";

      
$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['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['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }
      
//removed below so that the owner of the image can not edit or delete comments to his photos
	
  
//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>";
      //}
	
  
	
  if (
$comment_by_owner == && $hide_author == 1) {
	
	
	
$show_comment 0
	
  } else { 
	
	
	
$show_comment 1
	
	
	
}
	
	
$spacer="";
	
	

         for (
$depth$depth 0$depth--) {  
             
$spacer .= "<td width=\"20\" valign=\"top\"><img src=\"./templates/dark/images/spacer.gif\" width=\"19\" height=\"19\"/></td>"
         }
	
	
	

      
$site_template->register_vars(array(
        
"comment_id" => $comment_row['comment_id'],
	
    
"lang_comments_per_page" => $lang['comments_per_page'],
        
"comment_user_id" => $comment_user_id,
	
	
"spacer" => $spacer,
        
"comment_user_status_img" => $comment_user_status_img,
        
"comment_user_name" => $comment_user_name,
        
"comment_user_info" =>  ($show_comment  == 0) ? "" $comment_user_info,
        
"comment_user_level" => $comment_user_level,
        
"comment_user_profile_button" => ($show_comment  == 0) ? "" $comment_user_profile_button,
	
	
"comment_user_profile_link" => $comment_user_profile_link,
        
"comment_user_email" => $comment_user_email,
        
"comment_user_email_save" => $comment_user_email_save,
        
"comment_user_mailform_link" => $comment_user_mailform_link,
        
"comment_user_email_button" => ($show_comment  == 0) ? "" $comment_user_email_button,
        
"comment_user_avatar" => $comment_user_avatar//new line
        
"comment_user_homepage_button" => ($show_comment  == 0) ? "" $comment_user_homepage_button,
        
"comment_user_icq_button" => ($show_comment  == 0) ? "" $comment_user_icq_button,
        
"comment_user_ip" => $comment_user_ip,
        
"comment_headline" => $comment_headline,
	
	
"comment_author_PM" => ($hide_author == 1) ? "" $send_pm_comment,
	
	

        
"responses" => $responses,
        
"response_to_id" => $response_to_id,
        
"lang_post_response" => $lang['post_response'],
	
	
"lang_comment_voters" => $lang['comment_voters'],
	
	
"lang_comment_vote" => $lang['comment_vote'],
	
	
"lang_comment_hidden" => $lang['comment_hidden'],
	
	
"lang_comment_date" => $lang['comment_date'],
        
"comment_text" => format_text($comment_row['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row['comment_date']),
        
"row_bg_number" => $row_bg_number,
        
"admin_links" => $admin_links,
        
//new field - full name
        
"comment_full_name" => $comment_full_name,
	
	
//unite all comment user fields to easily hide them
	
	
"hide_author" => $hide_author,
	
	
"comment_user_box" => ($show_comment  == 0) ? "< &#1040;&#1074;&#1090;&#1086;&#1088; &#1060;&#1086;&#1090;&#1086; >" "<a href=".$comment_user_profile_link."><b>".$comment_full_name."</b><br/>(".$comment_user_name.")<br />".$comment_user_avatar."<br />".$comment_user_level."</a>"
      
));

      if (
COMMENT_RATING_ENABLE)   {
        
$comment_row['cat_id'] = $cat_id;
        
$comment_row['image_allow_comments'] = $image_allow_comments;
	
	
  
$comment_row['comment_rating'] = (int)$comment_row['comment_rating'];
	
	
  
$links comment_rating_links($comment_row['comment_id'], $comment_row);
	
	
  
$site_template->register_vars(array(
	
	
	
"comment_rating" => $comment_row['comment_rating'],
	
	
	
"comment_rating_str" => (($comment_row['comment_rating'] > 0) ? "+" "").$comment_row['comment_rating'],
	
	
	
"comment_votes" => $comment_row['comment_votes'],
	
	
	
"comment_rating_link_good" => $links[0],
	
	
	
"comment_rating_link_bad" => $links[1],
	
	
	
"comment_class" => ($comment_row['comment_rating'] > "1" : ($comment_row['comment_rating'] < "2" "0")),
	
	
	
"comment_hide" => ($comment_row['comment_rating'] <= COMMENT_RATING_HIDE) ? 0,
	
	
	
"comment_vote_tooltip" => $lang['comment_rating_check'][$links[2]],
	
	
  ));
	
	
  
	
	
  
$site_template->register_vars(array(
	
	
  
"lang_author" => $lang['author'],
	
	
  
"lang_comment" => $lang['comment'],
	
	
  
"commentratinghide" => COMMENT_RATING_HIDE,
	
	
  
"comment_rating_enable" => COMMENT_RATING_ENABLE,
	
	
  
"ajaxcommentsurl" => $site_sess->url(ROOT_PATH."ajaxcomments.php""&"),
	
	
  
"lang_comment_rating" => $lang['comment_rating'],
	
	
  
"lang_votes" => $lang['votes'],
	
	
  
"url_id" => URL_ID,
	
	
));

	
	
$still_to_vote comment_rating_links($comment_row['comment_id'], $comment_row);
	
	
  
//check if owner rated all comments
	
	
  if (
$still_to_vote[2] == 0){
	
	
	
	
$show_reminder 1;
	
	
  } 
	
	
//end check if owner rated all comments  
	
	

	
	

	
	

	
	
}

	
	
$this->one_comment $site_template->parse_template("comment_bit_new");
	
	
$this->all_out .= $this->one_comment;
	
	
//debug ($comments);
	
	
}
   
      
//@param array $comment 
      //@param int $depth 
     
Private function print_parent($comment$depth 0) {  
         foreach (
$comment as $c)  
         {  
             
$this->format_comment($c$depth);
             if (isset(
$this->children[$c['comment_id']]))  
             {  
                 
$this->print_parent($this->children[$c['comment_id']], $depth 1);  
             }  
         }  
     }  
   
     Public function 
print_comments()  {
         foreach (
$this->parents as $c)  
         {
             
$this->print_parent($c);  
         }
	
	
 return 
$this->all_out;
	
 }
   
   } 
//end of class
	
  

	
  
  if (!
$num_comments1) {
    
$comments1 "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
  }
  else {
    
$bgcounter 0;
	
$comments1 .= "<table width=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: 1px solid grey;\">\n";
	
$comments_new = new Threaded_comments($comment_row1);
	
$comments1 .= $comments_new->print_comments();
	
$comments1 .= "</table>\n";
	


  } 
//end else

  //debug($comments1);
  
  
$site_template->register_vars(array(
    
"comments" => $comments1,
    
"comments_num" => $num_comments,
    
"commentbg" => (isset($row_bg_number)) ? $row_bg_number 0,
    
"page" => $page,
    
"perpage" => $commentperpage,
  ));

  unset(
$comments1);
  unset(
$hide_author);
  
  
// MOD: Notify comments by email.
	
$sql1 "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($sql1);
      
     while (
$notify_row $site_db->fetch_array($result1)) {
          
//$field_id = $notify_row['field_id'];
          
$comment_notify_status $notify_row['comment_notify_status'];
      }
// EBD MOD: Notify comments by email.
  
  
  //-----------------------------------------------------
  //--- 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_form1 "";
  }
  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) : "";
	
$response_to = (isset($HTTP_POST_VARS['response_to']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['response_to'])), 2) : "";

    
$site_template->register_vars(array(
      
"bbcode" => $bbcode,
      
"user_name" => $user_name,
      
"comment_headline" => $comment_headline,
      
"comment_text" => $comment_text,
	
  
"response_to" => $response_to,
      
"lang_clear" => $lang['clear'],
      
"lang_clear_desc" => $lang['clear_desc'],
      
"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,
	
  
	
	
"lang_comment_note" => $lang['comment_note'],
	
	
"lang_comment_tips" => $lang['comment_tips'],
	
	
"lang_comment_tip1" => $lang['comment_tip1'],
	
	
"lang_comment_tip2" => $lang['comment_tip2'],
	
	
"lang_comment_tip3" => $lang['comment_tip3'],
	
	
"lang_comment_tip4" => $lang['comment_tip4'],
	
	
"lang_comment_tip5" => $lang['comment_tip5']
	
  
    ));
    
$comment_form1 $site_template->parse_template("comment_form");
  }
  
$site_template->register_vars("comment_form"$comment_form1);
  unset(
$comment_form1);
// end if allow_comments


The comment_bit_new.html that works for me is below. Again, it needs cleaning and adjusting to your needs:
Code: [Select]
<tr>
<td width="100%">

<!-- uncomment and place this div where you want messages related to comment rating to be showed (additionally to tooltips), you can use this div to display floating messages -->
<div id="commentratingmsg"></div>
<!--mod ajax comments insert end-->

<!-- style="border: 1px solid grey;" -->
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
{spacer}
<td width="100%">

<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
  <td width="160px" class="commentrow{row_bg_number}" valign="top" align="center">
    <a name="comment{comment_id}"></a>
{comment_user_box}<br />
{if comment_user_ip}
<b>IP:</b>{comment_user_ip}
{endif comment_user_ip}
  </td>
  
  <td class="commentrow{row_bg_number}" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
         <td valign="top"><b>{comment_headline}</b></td>
<td valign="top" align="right">


<table width="100%">
<tr>
<td>
<span class="smalltext">{lang_comment_date} {comment_date}</span>
</td>
<!--mod ajax comments insert start -->
<td align="right">
{if comment_rating_enable}<span class="smalltext">{lang_comment_vote}</span>
<span id="cmsg{comment_id}" title="{comment_vote_tooltip}">
<span id="cr{comment_id}" class="comment_rating{comment_class}">{comment_rating_str}</span>
{comment_rating_link_good} {comment_rating_link_bad}
<span id="crv{comment_id}">{comment_votes}</span> <span class="smalltext">{lang_votes}</span> - <a href="javascript:showvotes({comment_id});"><span class="smalltext">{lang_comment_voters}</span></a>  <a href="http://www.fotodvor.com/blog/golovaniya-za-kommentarii-802" target="_blank"><span class="smalltext">Как голосовать?</span></a>
</span>
{endif comment_rating_enable}
<!--mod ajax comments insert end -->

{if admin_links}{admin_links}{endif admin_links}
</td>
</tr>
</table>
</td>
      </tr>
    </table>
    <hr size="1" />
<!--mod ajax comments insert start -->
<a href="#" id="cilh{comment_id}" onClick="return aCTog({comment_id});" style="{if comment_hide}display:inline;{endif comment_hide}{ifno comment_hide}display:none;{endifno comment_hide}">{lang_comment_hidden}<img id="cih{comment_id}" src="{template_image_url}/plus.png" border="0" /></a>
<div id="commentbox{comment_id}"{if comment_hide} style="display:none;"{endif comment_hide}>
<!--mod ajax comments insert end -->
{if is_admin}({comment_id}){endif is_admin}
    <div id="translate_comment_{comment_id}">{comment_text}</div>

<!-- <a href="#comment_form" onClick="get_link('{comment_headline}', '{response_to_id}')" /><b><span class="smalltext">{lang_post_response}</span></b></a> -->
{if user_loggedin}
<a href="#comment_form" onClick="get_link('{comment_headline}', '{comment_id}')" /><b><span class="smalltext">{lang_post_response}</span></b></a>
{endif user_loggedin}

{if responses}<br />{responses}<br />{endif responses}
<!--mod ajax comments insert start -->
</div>
<!--mod ajax comments insert end -->
</td>
</tr>

{if show_comment}
<tr>
  <td width="160px" class="commentrow{row_bg_number}" align="center">
    <span class="smalltext">{comment_user_status_img}</span>
  </td>
  <td class="commentrow{row_bg_number}">
    <table width="100%">
<tr>

<td align="left"><span class="smalltext">
{comment_author_PM}  |  {comment_user_info}  |  {comment_user_profile_button}  |  {comment_user_email_button}  |  {comment_user_homepage_button}  |  {comment_user_icq_button}  |  </span>
</td>

<td align="right">
<span class="smalltext">Translate: </span>
<a href="javascript:google_translate('en','comment',{comment_id});"><img src="{template_url}/images/flags/gb.png" border="0"></a>
<a href="javascript:google_translate('de','comment',{comment_id});"><img src="{template_url}/images/flags/de.png" border="0"></a>
<a href="javascript:google_translate('fr','comment',{comment_id});"><img src="{template_url}/images/flags/fr.png" border="0"></a>
<a href="javascript:google_translate('ru','comment',{comment_id});"><img src="{template_url}/images/flags/ru.png" border="0"></a>
<!-- http://www.famfamfam.com/lab/icons/flags/ -->
</td>

</tr>
</table>

  </td>
</tr>
{endif show_comment}
</table>

</td>
</tr>
</table>

</td>
</tr>


2
Mods & Plugins (Requests & Discussions) / Cyrillic filenames
« on: May 20, 2010, 06:30:31 AM »
Gents,

I have a problem with my 4images site... I run version 1.7.7 and a lot of my users are trying to upload files named either with Cyrillic names or (probably) containing spaces....

I have a huge number of MODs installed already so downgrading or anything like that is not an option.

Is there a MOD that actually checks the file names? or is there a mod that renames files automatically after the upload (I really would like this one)? or is there a fix that allows 4images to work with non-latin filenames?

My system hangs when trying to either resize (I have an autoresize module installed) or annotate... (no matter if I use GD or ImageMagic)... database entries are added, but the image is not showing properly...

Any hits would be greatly appreciated!

3
Discussion & Troubleshooting / email users in UTF-8
« on: February 07, 2010, 06:41:23 PM »
Hello everybody!

I have an issue that I can not resolve on my own (not enough knowledge)...

I need to send any outgoing e-mail from my 4images installation in UFT-8 format... I have modified the email.php as follows. (I use mail function of PHP and not SMTP)

Code: [Select]
....

$this->subject = iconv('windows-1251', 'UTF-8', $subject);

....

$header .= 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n";

.....

// in function prepare_text($message) {

    return iconv('windows-1251', 'UTF-8', $message);

...

function send_email() {
    if ($this->use_smtp) {
      return ($this->smtp_mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
    }
    else {
      //original line was - return (mail($this->to, $this->subject, $this->body, $this->create_header())) ? 1 : 0;
 return (mail($this->to, '=?UTF-8?B?'.base64_encode($this->subject).'?=', $this->body, $this->create_header())) ? 1 : 0;
 
    }
  }


I hope there are pro-s out there who could help me out with this.... because in MS Oulook for example it works great, in AOL and Gmail.... but most of my users are on Mail.ru servers and those DO NOT display messages send using the above modifications correctly....

Any suggestions or hints would be greatly appreciated!
Aleksey

4
Discussion & Troubleshooting / 500 error
« on: December 28, 2009, 01:09:13 PM »
Gents,

I have stumbled upon a very interesting issue...

my gallery runs well... very few server errors... but sometimes they do occur.... but today, one of the users uploaded an image... it shows under new photos, the thumb gets created, but when anyone attempts to view it, the error 500 occurs...

here is what the tech support from the provider gave me...

Quote
Hello,
I'm sorry, but the system appears to be segfaulting when trying to load that one image. I'm not certain why. It's possible there is a memory issue, if the image is unusually large in dimension (although it is not unusually large in file size). Here is the segfault in process execution trace:
time(NULL) = 1261997397
open("/home/.../data/media/4/2962016_large.jpeg", O_RDONLY) = 6
fstat64(6, {st_mode=S_IFREG|0666, st_size=109869, ...}) = 0
lseek(6, 0, SEEK_CUR) = 0
time(NULL) = 1261997397
stat64("/home/.../data/media/4/2962016_large.jpeg", {st_mode=S_IFREG|0666, st_size=109869, ...}) = 0
lseek(6, 0, SEEK_SET) = 0
read(6, "\377\330\377\340\0\20JFIF\0\1\2\1\0`\0`\0\0\377\341+\235Exif\0\0II"..., 8192) = 8192
read(6, "sj\223\v\270-\21\227l~fIb;q\322\200=#\341E\375\315\226\250\326\27O\30\16\236b"..., 8192) = 8192
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 20152 detached

And the backtrace from the core dump:
#0 0x46cf47dc in memcpy () from /lib/libc.so.6
#1 0x08311953 in _estrndup (s=0xb4bb18e4 <Address 0xb4bb18e4 out of bounds>, length=3032160484) at /home/cpeasyapache/src/php-5.2.9/Zend/zend_alloc.c:2439
#2 0x0810d50a in exif_iif_add_tag (image_info=0xbfd804a4, section_index=147914252, name=0xbfd80014 "UndefinedTag:0x000D", tag=13, format=7, length=3072,
value=0xb4bb18e4, tsrm_ls=0x8865730) at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:1723
#3 0x0810e427 in exif_process_IFD_TAG (ImageInfo=0xbfd804a4, dir_entry=0x8d0d518 "\r", offset_base=0xb4bb1568 <Address 0xb4bb1568 out of bounds>,
IFDlength=11157, displacement=30, section_index=13, ReadNextIFD=0, tag_table=0x847d440, tsrm_ls=0x8865730)
at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3120
#4 0x0810f30e in exif_process_IFD_TAG (ImageInfo=0xbfd804a4, dir_entry=<value optimized out>, offset_base=0xb4bb1568 <Address 0xb4bb1568 out of bounds>,
IFDlength=11157, displacement=30, section_index=7, ReadNextIFD=1, tag_table=0x847ca20, tsrm_ls=0x8865730)
at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:2807
#5 0x0810e007 in exif_process_IFD_in_JPEG (ImageInfo=0xbfd804a4, dir_start=<value optimized out>, offset_base=0x8d0d26c "II*", IFDlength=11157,
displacement=30, section_index=7, tsrm_ls=0x8865730) at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3148
#6 0x0810f120 in exif_process_IFD_TAG (ImageInfo=0xbfd804a4, dir_entry=<value optimized out>, offset_base=0x8d0d26c "II*", IFDlength=11157,
displacement=30, section_index=3, ReadNextIFD=1, tag_table=0x847ca20, tsrm_ls=0x8865730) at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3111
#7 0x0810e007 in exif_process_IFD_in_JPEG (ImageInfo=0xbfd804a4, dir_start=<value optimized out>, offset_base=0x8d0d26c "II*", IFDlength=11157,
displacement=30, section_index=3, tsrm_ls=0x8865730) at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3148
#8 0x08110d04 in exif_read_file (ImageInfo=0xbfd804a4, FileName=<value optimized out>, read_thumbnail=0, read_all=0, tsrm_ls=0x8865730)
at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3225
#9 0x08111fa6 in zif_exif_read_data (ht=2, return_value=0x8b20714, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, tsrm_ls=0x8865730)
at /home/cpeasyapache/src/php-5.2.9/ext/exif/exif.c:3972

Unfortunately, at this time there is nothing we can do to assist in getting this picture viewable. I have attempted to increase memory - although we were already at the maximum allotment for our shared servers - temporarily, and that did not make a difference. If this file is unusually large in dimension, you may wish to scale it down before uploading it to the site.

Cheers,
Linux Systems Administration


this happens with ONLY ONE picture so far... other pics show well with no problems.... strange....

5
Programming / number of new photos in categories
« on: December 22, 2009, 06:46:40 PM »
Gents,

I have been trying to show the number of new images in every category...

I came up with this modification of function.php (

Code: [Select]
function get_categories($cat_id = 0) {
  ....

  foreach ($visible_cat_cache as $key => $category_id) {
    $categories .= "<tr>\n<td valign=\"top\">\n";

    $is_new = (isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0) ? 1 : 0;

$num_images = (isset($cat_cache[$category_id]['num_images'])) ? $cat_cache[$category_id]['num_images'] : 0;
    $num_new_images = (isset($new_image_cache[$category_id]['new_images'])) ? $new_image_cache[$category_id]['new_images'] : 0;

$subcat_ids = array();
    get_subcat_ids($category_id, $category_id, $cat_parent_cache);

    if (isset($subcat_ids[$category_id])) {
      foreach ($subcat_ids[$category_id] as $val) {
        if (isset($new_image_cache[$val]) && $new_image_cache[$val] > 0) {
          $is_new = 1;
  $num_new_images += $new_image_cache[$val]['new_images']; 
        }
        if (isset($cat_cache[$val]['num_images'])) {
          $num_images += $cat_cache[$val]['num_images'];

        }
      }
    }

  ....

  "num_new_images" => $num_new_images
    ...

  }



but for some reason some categories do not properly show the number of new images....
anyone has a better solution?



6
Dear all,

this MOD is inspired by Joss in his mod

[MOD] Last topics from phpBB3 forum to index page (php)
http://www.4homepages.de/forum/index.php?topic=26170.0

here is my version: I took the PHPBB hack from one of the forums and made this...

Step 1.

make new file and call it for example recent_phpbb.php

this should be the content of this file:

Code: [Select]
<?php
/*-------------------------------------------------------------------------
|  PHPBB 3.x.x Last Posts Table with Permissions 0.1 (for center block) 10.12.2009 
|  for 4images 1.7.7 with bridge to PHPBB 3.x.x
|  by alekseyn1 <Aleksey Napolskih>
|  http://www.napolskih.com
|  Base on the following code by visiblesoul
/*-------------------------------------------------------------------------
|  MKPortal PHPBB 3.x.x Last Posts Table with Permissions 0.1 (for center block) 26.07.2008 
|  for MKP C 1.x with PHPBB 3.x.x
|  by mike16os <Khan-Cin Hau>
|  http://www.yamc.info/
|  Base on the following code by visiblesoul
/*-------------------------------------------------------------------------
|  MKPortal IPB 2.1.x Last Posts Table with Permissions 2.1 (for center block) 17.05.2006 
|  for MKP 1.1 x IPB 2.1.x
|  by visiblesoul <visiblesoul.net>
|  Support: http://www.visiblesoul.net/resources/forum/
+--------------------------------------------------------------------------*/

global $db$config;

/*---------------------------------------------------------------------------
Config:
--------------------------------------------------------------------------*/
$limit         10 // Number of forum posts to show in block 
$cutoff        60 // Number of characters to display in title
/*------------------------------------------------------------------------
Forum images Config:
--------------------------------------------------------------------------*/
$img_first_topic    ="";
$img_last_topic     ="";
//empty images canbe used by "" eg: $img_first_topic ="";
  
/*-------------------------------------------------------------------------
Language Setting:
--------------------------------------------------------------------------*/
$lang_topic_title        ="Topic Title";
$lang_last_post          ="Last Post";
$lang_last_post_date     ="posted on";
$lang_views              ="Views";
$lang_replies            ="Replies";
$lang_go_to_last_post    ="go to last post...";
$lang_topic_started_by   ="Topic started by";
$lang_on                 ="on";
$lang_by                 ="by";
$lang_last_poster        ="Last poster:";
/*------------------------------------------------------------------------*/

$content "
<tr>
  <td>

    <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">
      <tr>
<td valign=\"top\" class=\"head1\">
$lang_topic_title</td>
<td valign=\"top\" class=\"head1\" align=\"center\">
$lang_last_post</td>
<td valign=\"top\" class=\"head1\" align=\"center\">
$lang_last_post_date</td>
<td valign=\"top\" class=\"head1\" align=\"center\">
$lang_views</td>
<td valign=\"top\" class=\"head1\" align=\"center\">
$lang_replies</td>
      </tr>
"
;

$sql "SELECT forum_id, forum_password FROM ".FORUMS_TABLE."";
 
$result $db->sql_query($sql);

while($f $db->sql_fetchrow($result)) {
 
if ($f['forum_password'] != "" ) {
            
$bad[] = $f['forum_id'];
        
} else {
         
$good[] = $f['forum_id'];
        
}
    
}

 
if ( count($bad) > ) {
     
$qe " AND forum_id NOT IN(".implode(','$bad ).") ";
    
}

$sql1 "SELECT t.topic_last_post_id, t.topic_id, t.topic_title, t.topic_views, t.topic_replies, t.topic_time, t.topic_last_post_time, t.topic_first_poster_name, t.topic_last_poster_name, topic_poster, t.forum_id
    FROM "
.TOPICS_TABLE." t
    LEFT JOIN "
.FORUMS_TABLE." f ON (t.forum_id = f.forum_id)
    WHERE topic_approved != 0 AND topic_approved = 1 AND (topic_moved_id = 0 or topic_moved_id='') 
$qe
    GROUP BY t.topic_title
    ORDER BY t.topic_last_post_id DESC LIMIT 0,
$limit";

$result1 $db->sql_query($sql1);
while ( $post $db->sql_fetchrow($result1)) {
$post['title'] = strip_tags($post['title']);
$post['topic_title'] = str_replace"!" "!" $post['topic_title'] );
$post['topic_title'] = str_replace"&quot;""\""$post['topic_title'] );
if (strlen($post['topic_title']) > $cutoff) {
$post['topic_title'] = substr$post['topic_title'],0,($cutoff 3) ) . "...";
$post['topic_title'] = preg_replace'/&(#(\d+;?)?)?(\.\.\.)?$/''...',$post['topic_title'] );


$title utf8_to_cp1251($post['topic_title']);
 
$tid utf8_to_cp1251($post['topic_id']);
$tlastid utf8_to_cp1251($post['topic_last_post_id']);
                
$views $post['topic_views'];
$posts $post['topic_replies'];
$starter $post['topic_first_poster_name'];
$lastname $post['topic_last_poster_name'];
$lastid $post['topic_poster'];
$forum_id $post['forum_id'];
$startdate  $post['topic_time'];
$lastdate  $post['topic_last_post_time'];

$content .= "
<!-- topic begin -->
      <tr>
<td class=\"row1\" align=\"left\">
  
$img_first_topic <a href=\"./forum/viewtopic.php?f=$forum_id&t=$tid\" title=\"$lang_topic_started_by $starter $lang_on ".format_date($config['date_format']." ".$config['time_format'], $startdate)."\" target = \"_blank\">$title</a>
</td>
<td class=\"row2\" align=\"center\">
  <a href=\"./forum/viewtopic.php?f=
$forum_id&t=$tid&p=$tlastid#p$tlastid\" title=\"$lang_go_to_last_post\" target = \"_blank\">$img_last_topic $lang_last_post</a> $lang_by <a href=\"./forum/memberlist.php?mode=viewprofile&u=$lastid\" title=\"$lang_last_poster $lastname\" target = \"_blank\"><b>$lastname</b></a>
</td>
<td class=\"row1\" align=\"center\">"
.format_date($config['date_format']." ".$config['time_format'], $lastdate)."</td>
<td class=\"row2\" align=\"center\"> 
$views </td>
<td class=\"row1\" align=\"center\"> 
$posts </td>     
</td>
      </tr>
<!-- topic end -->   
"
;
}

$content .= "
    </table>

  </td>
</tr>
"
;  

        
          unset(
$limit);
          unset(
$cutoff);
          unset(
$perms);
          unset(
$good);
          unset(
$bad);
          unset(
$qe);
          unset(
$post);
          unset(
$tid);
          unset(
$title);
          unset(
$views);
          unset(
$posts);
          unset(
$startdate);
          unset(
$lastdate);
          unset(
$starter);
          unset(
$lastname);
          unset(
$lastid);
          unset(
$tlastid);
          unset(
$forum_id);
          unset(
$img_last_topic);
          unset(
$img_first_topic);
          unset(
$lang_topic_title);
          unset(
$lang_last_post);
          unset(
$lang_last_post_date);
          unset(
$lang_views);
          unset(
$lang_replies);
          unset(
$lang_go_to_last_post);
          unset(
$lang_topic_started_by);
          unset(
$lang_on);
          unset(
$lang_by);
          unset(
$lang_last_poster);
                     
echo 
$content;

function 
utf8_to_cp1251($s)
        {
            for (
$c=0;$c<strlen($s);$c++)
            {
               
$i=ord($s[$c]);
               if (
$i<=127$out.=$s[$c];
                   if (
$byte2){
                       
$new_c2=($c1&3)*64+($i&63);
                       
$new_c1=($c1>>2)&5;
                       
$new_i=$new_c1*256+$new_c2;
                   if (
$new_i==1025){
                       
$out_i=168;
                   } else {
                       if (
$new_i==1105){
                           
$out_i=184;
                       } else {
                           
$out_i=$new_i-848;
                       }
                   }
                   
$out.=chr($out_i);
                   
$byte2=false;
                   }
               if ((
$i>>5)==6) {
                   
$c1=$i;
                   
$byte2=true;
               }
            }
            return 
$out;
}

?>

Step 2.


in your home.html file (in your template directory) include this string in the place where you want your table to show up:

Code: [Select]
 <!--last forum posts -->

 <table width="100%" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td class="head1" valign="top" colspan="5">Last forum posts</td>
                          </tr>
 
 <tr>
                            <td class="row1" valign="top" colspan="5"><?php include(ROOT_PATH."/recent_phpbb.php"); ?></td>
                          </tr>

                        </table>
                      </td>
                    </tr>
                  </table>
                  <br />
<!--end last forum posts -->


Notes:

1. In include/constants.php you must set the value to "1" in this define:  define('EXEC_PHP_CODE', 1);
2. This particular version of the code is designed for the database in UTF8 and your 4images site in other encoding (cp1251 in my case). I have only included the function to recode utf8 into windows 1251 - russian encoding. I am sure you can find other functions to recode into your codepage if required
3. you need to modify all occurrences of this code
Code: [Select]
<a href=\"./forum/ to reflect the correct path of your phpBB3 installation
4. of course you are more than welcom to improve and modify this code. Please post your improvements here for everybody's benefit.

see attachment for demo...

7
The trouble is by just refreshing the page with an image, the counter of views keeps adding up...
this is not always good, because if you run a proper large photo community site with ratings being important, then, it's pretty easy to get to the top of the charts as the most viewed image.

Any ideas on how to fix that?

8
Dear all,

I have searched the forum and have not found anything even close related to what I would like to have on my gallery.

The idea is to have a button under every image of the gallery so that the users can crop the image (and save the suggestion in comments) using something like this (look under the image) _http://www.samara-photo.ru/photo/id.35456.html

EDIT

OK... I have done it. Posting the MOD here (Admins, please move it once confirmed as functional with other users. I have this MOD running on version 1.7.7 with many mods implemented on the same site.

Demo here
http://www.fotodvor.com/details.php?image_id=801

Notes to consider before installation:

1. This MOD uses <div> to show your images... so you should control your images or table width in the template accordingly (I use default_full theme and it works great for me).

2. There probably are many improvements to this MOD, so guys with the better knowledge of PHP please suggest improvements and corrections (espesially to the issue with {template_url} not showing properly in functions.php (you'll see later on...

3. I have looked at the code from the site mentioned above, so part of the Javascript is probably theirs, part is in the open under the GPL licence.

4. I could not get the Black and White filter to work... maybe someone has a solution to this. Or maybe it's just my browser...

So, let's begin...

[MOD] Image crop suggestions by users incerted into comments

Step 1.
In details.php find:
Code: [Select]
"prepend_head_title"        => $image_name . " - "
));

and REPLACE with:
Code: [Select]
"prepend_head_title"        => $image_name . " - ",
            "image_address" => "./".MEDIA_DIR."/".$cat_id."/".$image_row['image_media_file']
));

Step 2.
In header.html find:
Code: [Select]
{if has_rss}
and add BEFORE:
Code: [Select]
<script type="text/javascript" src="{template_url}/js/imageCropper.js"></script>
<script type="text/javascript" src="{template_url}/js/functions.js"></script>

Step 3.
In details.html find:
Code: [Select]
{image}

and REPLACE with:
Code: [Select]

<div class="center" id="ipad" style="margin: 0px; padding: 20px; background-color: #aaaaaa">
<div id="holdr" style="position: absolute; left: 20px; top: 190px;"><a name="image"></a>
<img style="height: {height}px; width: {width}px;" src="{image_address}" id="im" onDblClick="maxArea(event);"></div>
<br/>

<!-- PhotoTools Pad -->
<style type="text/css">
img {
border: 0;
}
table.instruments {
background: #fff;
}
table.instruments td {
padding: 3px 6px; background: #e3e3e3; color: #2d2d2d; font: bold 11px Tahoma;
}
span.gradient {
padding: 3px 1px 3px 4px; cursor: pointer;
}
</style>

<center id="panel">
<table cellpadding="0" cellspacing="1" class="instruments">
<tr>
<td>Background:</td>
<td>
               <span onClick="setBG(this);" class="gradient" style="background-color:#000000;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#111111;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#222222;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#333333;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#444444;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#555555;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#666666;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#777777;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#888888;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#999999;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#AAAAAA;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#BBBBBB;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#CCCCCC;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#DDDDDD;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#EEEEEE;">&nbsp;
</span><span onClick="setBG(this);" class="gradient" style="background-color:#FFFFFF;">&nbsp;
</span>
</td>
<td>Image Brightness:</td>
<td>
               <span onClick="setBrightness(-10);" class="gradient" style="background-color:#000000;">&nbsp;
</span><span onClick="setBrightness( -9);" class="gradient" style="background-color:#080808;">&nbsp;
</span><span onClick="setBrightness( -8);" class="gradient" style="background-color:#111111;">&nbsp;
</span><span onClick="setBrightness( -7);" class="gradient" style="background-color:#181818;">&nbsp;
</span><span onClick="setBrightness( -6);" class="gradient" style="background-color:#222222;">&nbsp;
</span><span onClick="setBrightness( -5);" class="gradient" style="background-color:#333333;">&nbsp;
</span><span onClick="setBrightness( -4);" class="gradient" style="background-color:#444444;">&nbsp;
</span><span onClick="setBrightness( -3);" class="gradient" style="background-color:#555555;">&nbsp;
</span><span onClick="setBrightness( -2);" class="gradient" style="background-color:#666666;">&nbsp;
</span><span onClick="setBrightness( -1);" class="gradient" style="background-color:#777777;">&nbsp;
</span><span onClick="setBrightness(  0);" class="gradient" style="background-color:#888888;">&bull;
</span><span onClick="setBrightness(  1);" class="gradient" style="background-color:#999999;">&nbsp;
</span><span onClick="setBrightness(  2);" class="gradient" style="background-color:#AAAAAA;">&nbsp;
</span><span onClick="setBrightness(  3);" class="gradient" style="background-color:#BBBBBB;">&nbsp;
</span><span onClick="setBrightness(  4);" class="gradient" style="background-color:#CCCCCC;">&nbsp;
</span><span onClick="setBrightness(  5);" class="gradient" style="background-color:#D4D4D4;">&nbsp;
</span><span onClick="setBrightness(  6);" class="gradient" style="background-color:#DDDDDD;">&nbsp;
</span><span onClick="setBrightness(  7);" class="gradient" style="background-color:#E4E4E4;">&nbsp;
</span><span onClick="setBrightness(  8);" class="gradient" style="background-color:#EEEEEE;">&nbsp;
</span><span onClick="setBrightness(  9);" class="gradient" style="background-color:#F4F4F4;">&nbsp;
</span><span onClick="setBrightness( 10);" class="gradient" style="background-color:#FFFFFF;">&nbsp;
</span>
</td>
<td><a href="javascript:switchCropper();"><img id="b_cr" src="{template_url}/js/icon_crop_off.gif" alt="Crop"></a></td>
<td><a href="javascript:switchBW();"><img id="b_bw" src="{template_url}/js/icon_bw_off.gif" alt="Black and White"></a></td>
<td><a href="javascript:switchGoldS();"><img id="b_gs" src="{template_url}/js/icon_gold_off.gif" alt="Gold Sections"></a></td>
<td><a href="javascript:saveState();"><img id="b_ss" src="{template_url}/js/icon_paste.gif" alt="Incert into comments"></a></td>
</tr>
</table>
</center>
</div>

<form id="fo" name="fo"></form>
<script type="text/javascript" language="javascript">
imageCropper.useForm("fo");
imageCropper.addCroper('im','1','1',null,'fff', 'holdr');
imageCropper.hideMe();
var showCropper = false;
imageCropper.maximizeArea();
imas = dom.gI('im');
var isBW = false;
imas.style.filter = "Gray";
var showGoldS = false;
imageCropper.hideGoldS();
if (imas.filters)
{
imas.filters["Gray"].enabled = isBW;
}
var vOff = 0;
if (imas.width == 0)
{
vOff = 40;
}
if (navigator.userAgent.indexOf('Opera') != -1)
{
vOff = -8;
}
dom.gI('panel').style.marginTop = parseInt(imas.style.height) + 3 + vOff + 'px';
centerImage();
</script>

Step 4.
In file functions.php find function format_text and within it find:
Code: [Select]
$text = str_replace("\\'", "'", $text);

and ADD after:
Code: [Select]
//crop suggestion mod - template plug {template_url} does not function here for some reason
$crop_code_ = array("/\[CROP\:(.*?)\]/is" => "<a href=\"javascript:loadState($1)\"><img src=\"templates/default_full/js/icon_load.gif\"></a>");
$text = preg_replace(array_keys($crop_code_), array_values($crop_code_), $text);
//crop suggestion mod

in this case I could not find the solution to use {template_url} so I settled with the code above. Make sure you change the name of the path to your template.

Step 5.
Upload the attached file and unzip it into your active template folder

I hope I did not forget anything and I hope that you will like this MOD )))

9
I run a web portal based on RunCMS 1.5.3 and I need to integrate the latest release of 4images gallery version 1.7.7 as a CMS module.

main requirements for the module:

1. gallery should use users from RunCMS
2. gallery should use user groups from RunCMS
3. (optional) random and / or latest images image block for the main page - to be shown considering the user (group) access rights
4. (optional) latest comments block - to be shown considering the user (group) access rights

(there is an existing integration of a vesrion 1.7 of 4images, but the users are not identified properly - sessions or cookies problem, in any case it could be helpful to the coder)

If anyone ready to do the job, please let me know the price, and timing or work.
will pay by Paypal (or propose your payment method)

10
Discussion & Troubleshooting / Very strange problem - 1.7 within Runcms
« on: October 17, 2009, 01:00:59 AM »
Hi everybody!

I have installed a module into my RunCms. The integration is based on 1.7 version.

The problem is the following:

When a logged in user tries to click on any page within a list of images in a category (the link is like this - http://www.napolskih.com/modules/4images/categories.php?cat_id=50&page=6) nothing happens (page just reloads) and a user stays on page 1...

but when you are a guest, everything works perfectly...

Could anyone please help me with this... where do I start digging....?

11
Installation, Update & Configuration / Sessions
« on: January 11, 2007, 05:34:23 AM »
Hello everyone!

I have a question/request:  is it possible to turn off sessions in 4images, or maybe make them blank or something? Because I have a problem described here, and I can not resolve it (http://www.4homepages.de/forum/index.php?topic=15939.0)

Restoring original files from my mod download does not help ( I am running the gallery as a mod under e-xoops/runcms). So I figure it could be the conflict of sessions.

12
Discussion & Troubleshooting / Problem with Paging line....
« on: December 26, 2006, 06:55:35 AM »
Hi everybody...

I have a weird problem....

I am running my 1.7 gallery from within the e-xoops version (actually it's runcms 1.5) on the WinXP computer for the intranet purposes...

Now here is the problem.... in the course of work on the video thumbnals problem (http://www.4homepages.de/forum/index.php?topic=12272.msg85074#msg85074) i have ended up with the problem of links to pages in categories lead to the beginning on the Gallery...

For example:

When the user is logged off the line "1  2  3  4  5  »  last page" works just great and has "4images/categories.php?cat_id=45&sessionid=a:3:&page=5" etc... but when the user logs on... then the link is just "4images/" and the rest is missing....

Have no idea where to start digging....

Pages: [1]