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

Pages: [1] 2 3 4 5
1
Chit Chat / I am back ; )
« on: October 01, 2014, 06:45:59 AM »
Hi there,

good to see that 4images is still alive and kickin', even though there is nothing new released since 2012. I was missing for over two years!  :D

Anyway, for a new project of mine I decided to use 4images again instead of wordpress, so I guess you guys will see soon a template which is
responsive, has all those notifications etc, or let's just call it modern. It goes into the 500px direction in terms of user management and style. 
I will also start offering support for my mod's again, so if anyone has a problem with my mod's just shout me a PM or mail.

Feels good to be back in the family again ^^

George

2
Okay, I think the name of the MOD speaks for itself. I wasn't considering sharing it since I worked a lot on it, but since I love the 4images community I decided to share it and develop it further.
Please keep in mind that this is v0.1 of the MOD - I will release v0.2 soon (after getting some feedback of you).


WHAT

This MOD created something like the notification feed on facebook. If user A comments, votes or add's a photo of user B, user B will get notifications (on the site, not by mail).
A "New Notifications" - count is displayed in the user login info, showng your unseen notifications. After you click on it (and see your new notifications) this number is being reset
(like on facebook) automatically - you don't have to click on anything to mark a notification as read (unlike other similar mod's to mine) . You can browse old notifications.
Please see attached screen-shots to get a feeling (at the end of this topic) (last screenshot is how it can look like with a little customization).

This MOD put's everything that happens to your user's pictures into one place.




WARNING
1) This is the first release - I tested it, but it can contain bug's . Please post if you have any problems, I tested it with 4images 1.7.10 and PHP5.
2) I didn't use language tags, because I am too lazy to do it. If you want to use language tags you can add them yourself.
3) This MOD won't work properly with guests (at least I didn't test it)
4) The MOD assumes that all your userpic files are "*.jpg" - please check your upload settngs (for userpic) and don't allow other file types (only for userpicture)


NEEDED MODS

This MOD supposes you installed V@no's [MOD] Member personal photo v1.1.3. If you want to use my MOD without it with, you can, but it just looks better with it.

Please make sure that you did the step's required to add default user-image, if no user-image is uploaded (otherwise you'll get broken images)


NOTE
The way I did this MOD is certainly not perfect, but it works for the purpose of my website. Please be patient for the User Activity Feed, as of right now I am only uploading the Notification part.


FIXES

31.10.2011 - fixed comment formatting, please do STEP 9  
31.10.2011 - fixed getting notifications when commenting on own pictures, please redo STEP 4 (code updated).  






==================================================================

Okay, be sure to make a backup of your database and your files that are being changed.


STEP 1

run this query in your php-my-admin:

Code: [Select]
CREATE TABLE IF NOT EXISTS `4images_notifications` (
  `id` int(12) unsigned NOT NULL AUTO_INCREMENT,
  `from_id` int(10) unsigned NOT NULL DEFAULT '0',
  `to_id` int(10) unsigned NOT NULL DEFAULT '0',
  `from_username` varchar(255) NOT NULL,
  `to_username` varchar(255) NOT NULL,
  `what_pic` varchar(255) NOT NULL,
  `text1` varchar(255) NOT NULL,
  `text2` varchar(255) NOT NULL,
  `text3` varchar(255) NOT NULL,
  `content` text NOT NULL,
  `content_link` varchar(255) NOT NULL,
  `date` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `from_id` (`from_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;



then, run this sql in your php-my-admin:

Code: [Select]
ALTER TABLE `4images_users` ADD `user_notify` int(10) NOT NULL DEFAULT '0'



==================================================================

STEP 2

open includes/constants.php

find:
Code: [Select]
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');

add below
Code: [Select]
define('NOTIFY_TABLE', $table_prefix.'notifications');


==================================================================

STEP 3

open includes/functions.php


//including FAVORITES (LIGHTBOX) to be shown

find:
Code: [Select]
if (!in_array($id, $lightbox_array)) {

add below:
Code: [Select]

//activity
    $sql = "SELECT cat_id,image_media_file,image_name, image_id, user_id
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id = $id";
 $result = $site_db->query_firstrow($sql);
 $cat = $result['cat_id'];
          $media = $result['image_media_file'];
          $name = $result['image_name'];
 $image_id = $result['image_id'];
 $user_id = $result['user_id'];

        $sql = "INSERT INTO " . NOTIFY_TABLE . "
        (id, from_id, to_id, from_username, to_username, what_pic, text1, text2, text3, content, content_link, date)
        VALUES(NULL, '".$user_info['user_id']."', '" . $user_id . "', '".$user_info['user_name']."', '', '".$cat."' '/' '".$media."', 'added', '".$name."', 'as a favourite', '', 'details.php?image_id=' '".$image_id."', '" . time() . "')";
   $site_db->query($sql);


$sql = "UPDATE ".USERS_TABLE."
SET user_notify=user_notify+1 WHERE user_id = ".$user_id;
$site_db->query($sql);
//activity


//now we are including the rating to be shown


find:
Code: [Select]
function update_image_rating($image_id, $rating) {
  global $site_db;
  $sql = "SELECT cat_id, image_votes, image_rating


replace with:
Code: [Select]
function update_image_rating($image_id, $rating) {
  global $site_db, $user_info;
  $sql = "SELECT cat_id, image_votes, image_rating, user_id, image_media_file, image_name, image_id


find:
    
Code: [Select]
$new_rating = sprintf("%.2f", $new_rating);
insert below:
Code: [Select]
$rating_value = $rating;

find:

Code: [Select]
   $sql = "UPDATE ".IMAGES_TABLE."
            SET image_votes = ($old_votes + 1), image_rating = '$new_rating'
            WHERE image_id = $image_id";
    $site_db->query($sql);



add below:
Code: [Select]

//activity
 $cat = $image_row['cat_id'];
 $to_id = $image_row['user_id'];
          $media = $image_row['image_media_file'];
          $name = $image_row['image_name'];
 $image_id = $image_row['image_id'];
 $user_name = $user_info['user_name'];

$sql = "UPDATE ".USERS_TABLE."
SET user_notify=user_notify+1 WHERE user_id = ".$to_id;
$site_db->query($sql);  

   $sql = "INSERT INTO " . NOTIFY_TABLE . "
        (id, from_id, to_id, from_username, to_username, what_pic, text1, text2, text3, content, content_link, date)
        VALUES(NULL, '".$user_info['user_id']."', '$to_id', '$user_name', '0', '".$cat."' '/' '".$media."' , 'rated', '".$name."', 'with' ' ' '<b>' '$rating_value' '</b>' , '', 'details.php?image_id=' '".$image_id."', '" . time() . "')";
   $site_db->query($sql);
 //activity



==================================================================

STEP 4

open details.php (or ajaxcomments.php if you installed THIS MOD)

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

add below:

Code: [Select]

 //activity
    $sql = "SELECT cat_id,image_media_file,image_name, image_id, user_id
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id = $id";
 $result = $site_db->query_firstrow($sql);
 $cat = $result['cat_id'];
 $to_id = $result['user_id'];
          $media = $result['image_media_file'];
          $name = $result['image_name'];
 $image_id = $result['image_id'];

if ($user_info['user_id'] != $result['user_id']) {    
 
$sql = "UPDATE ".USERS_TABLE."
SET user_notify=user_notify+1 WHERE user_id = ".$to_id;
$site_db->query($sql);  
 
   $sql = "INSERT INTO " . NOTIFY_TABLE . "
        (id, from_id, to_id, from_username, to_username, what_pic, text1, text2, text3, content, content_link, date)
        VALUES(NULL, '".$user_info['user_id']."', '$to_id','$user_name', '0', '".$cat."' '/' '".$media."' , 'commented', '".$name."', '', '$comment_text', 'details.php?image_id=' '".$image_id."', '" . time() . "')";
   $site_db->query($sql);

}

 //activity



==================================================================

STEP 5

open includes/page_header.php

find:
 
Code: [Select]
"rss_url" => "",
add below:
Code: [Select]
"sess_user_notify" => $user_info['user_notify'],


==================================================================

STEP 6

open your_template/header.html


find:
Code: [Select]
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
add below:

Code: [Select]
» Notifications <a href="notifications.php?action=new">{sess_user_notify}</a><br />


==================================================================

STEP 7

Upload notifications.php to your 4images root folder
Upload member_notifications.html, member_notifications_bit.html and member_notifications_new.html to your 4images template folder

Files are attached to this post.



==================================================================

STEP 8
Do some testing. If everything works (yeah, it will) start customizing the *.html files to your personal design.



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

STEP 9 - FIXES

a - fix comment formatting (bbcode etc).
open notifications.php and find:

Code: [Select]
"content" => $content,

replace with:
Code: [Select]
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),

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



PLANNED FOR V0.2
- icons for each different notification
- activity wall
- paging for old notifications
- fix own notifications (when commenting own image) --- DONE
- support for guestbooks and various other MOD's




3
I am just wondering, if 4images supporting that? (I searched the whole site but didn't find any related topic)

For example, you have an image, with an additional image field (image_camera) with a value (for example) of "Canon". 

Then in details, we could use {if image_camera == "Canon"} some information {endif} witch will display the information only if image_camera is "Canon".
Hope you got the example.

So is 4images supporting this and I just don't see/find it?



4
I used 4images on a heavy visited site (almost 25.000 active members), and almost 50 MOD's here from the forum. If you are installing MOD's there will be at some point serious speed and load issues, no matter what.

If you are just about to launch your 4images website, than this thread can really help you avoid sped problems in near future. If you are already using 4images, and have issues than applying my way would be a little more difficult (but not impossible) for sure.

This is just a starter, I will update this thread every few weeks with more details.


1) Avoid *count anywhere you can!

A lot of mods are using this, mainly for paging and user statistics. Okay, we can't get rid of the paging, but we can do something about the statistics.
For example, you want to show how much images a user has in his lightbox. If we use the *count method we would use something like this in our member.php

Quote
    $sql = "SELECT *
         FROM ".LIGHTBOXES_TABLE."
         WHERE ".get_user_table_field("", "user_id")." = ".$user_row['user_id'];
     $user_lightbox_info = $site_db->query_firstrow($sql);
     $num_rows_all = 0;
     if (!empty($user_lightbox_info['lightbox_image_ids'])) {
     $image_id_sql = str_replace(" ", ",", trim($user_lightbox_info['lightbox_image_ids']));
     $sql = "SELECT COUNT(image_id) AS images
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN ($image_id_sql)";
     $result = $site_db->query_firstrow($sql);
     $num_rows_all = $result['images'];
    }

Basically, this query searches every entry in your lightbox-table for a specific user_id. On every profile visit! On every member! Imagine having 100.000 entries in your lightbox table - server load will rise to 20-30, even on a dedicated machine.

So that example gives us two choices to solve the problem:

1) Using cache
2) Using smarter coding

Using the cache is okay, but that really doesn't solve the queries since they are generated once every X minutes/hours/days.

Okay, so a smarter approach would be to create a field (INT9) in your members table, and let's say calling it "user_count_lightbox". That field will contain the value of ... yes, the total count value of images that user has in his lightbox.

So, in order to get a correct value, we have to add a sql everywhere where the lightbox is being updated or modified so that every time the user adds/removes an image from his lightbox the count in the table field we created adds 1 or subtracts 1.

So in this example we have to add some code in functions.php , in the function "function add_to_lightbox($id) {".

It looks now like this:

Code: [Select]
function add_to_lightbox($id) {

  global $user_info, $site_db;
  $id = intval($id);
  if (!$id) {
    return false;
  }
 
  $lightbox_ids = $user_info['lightbox_image_ids'];
  $lightbox_array = explode(" ", $lightbox_ids);
  if (!in_array($id, $lightbox_array)) {
    $lightbox_ids .= " ".$id;
  }
  $user_info['lightbox_image_ids'] = trim($lightbox_ids);
  $user_info['lightbox_lastaction'] = time();
 
  $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = ".$user_info['user_id'];


//thats our code  
   $site_db->query($sql);  
    $sql = "UPDATE ".USERS_TABLE."
      SET user_count_lightbox=user_count_lightbox+1 WHERE user_id = ".$user_info['user_id'];
//end
 
 
return ($site_db->query($sql)) ? 1 : 0;

}


For the next function we have to be more careful, because we are subtracting, so the line would look like this:

Code: [Select]
    $sql = "UPDATE ".USERS_TABLE."
      SET user_count_lightbox=user_count_lightbox-1 WHERE user_count_lightbox> 0 AND user_id = ".$user_info['user_id'];


The only thing left would be registering our new field in the member.php like this

Code: [Select]
"user_count_lightbox" => $user_row['user_count_lightbox'],

And now we can use the tag {user_count_lightbox} to show how much pictures someone has without counting them every time the profile is being opened
That will save a lot of resources, and your site will load faster.

That example can be appended on almost every mod that uses "counting on the fly". Just think while you are installing it.

That's for now, I hope this is of some help since it's critical if you expect a lot of visitors. 

5
Okay, I needed a fast and easy way to make pictures that users put in their lightboxes available for other users browsing their profile (via textlink).
Since on my site everything is public I don't need to bother my users with 100's of options.

If you need a more complex MOD where users can show/hide/create lightboxes, I suggest using V@no's [MOD] Multi-Lightboxes v1.03.2

Tested with 1.7.10

I didn't use $lang files, but if you want them you should be familiar how to add them if you are using 4images with MOD's.

PS: Modified @ 25.10.2011 due to security reasons (thx to V@no) - Please update your code if you installed the MOD


----------------------------------------------------------------------------------------------------------------------------------------------------------------
Okay, put that beer aside for a moment and tell your wife to cook you something tasty, while you follow my steps ;)


STEP 1

open notepad, and insert this:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: lightbox.php                                         *
 *        Copyright: (C) 2002-2011 Jan Sorgalla                           *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.10                                               *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) f&#1100;r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$templates_used 'lightbox_member,thumbnail_member_lightbox_bit';
$main_template 'lightbox_member';

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


//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
$imgtable_width ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

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



      
$sql "SELECT u.*, l.*
              FROM ("
.USERS_TABLE." u, ".LIGHTBOXES_TABLE." l)
              WHERE u.user_id='
$user_id' AND l.user_id='$user_id' ";
  $user_info_id $site_db->query_firstrow($sql);  

if (!empty(
$user_info_id['lightbox_image_ids']))  {
  
$image_id_sql str_replace(" "", "trim($user_info_id['lightbox_image_ids']));
  
$sql "SELECT COUNT(image_id) AS images
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN (
$image_id_sql) AND cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")";
  
$result $site_db->query_firstrow($sql);
  
$num_rows_all $result['images'];
}

$link_arg $site_sess->url(ROOT_PATH."lightbox_member.php?user_id=$user_id"); 
include(
ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
$offset $getpaging->get_offset();
$site_template->register_vars(array(
  
"paging" => $getpaging->get_paging(),
  
"paging_stats" => $getpaging->get_paging_stats()
));

if (
$num_rows_all) {

  
$sql "SELECT COUNT(image_id) AS images
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN (
$image_id_sql) AND cat_id NOT IN (".get_auth_cat_sql("auth_download""NOTIN").")";
  
$result $site_db->query_firstrow($sql);
  
$download_allowed intval($result['images']) > 0;

  
$additional_sql "";
  if (!empty(
$additional_image_fields)) {
    foreach (
$additional_image_fields as $key => $val) {
      
$additional_sql .= ", i.".$key;
    }
  }
  
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
          FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
          WHERE i.image_active = 1 AND i.image_id IN (
$image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")
          ORDER BY i."
.$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
          LIMIT 
$offset$perpage";
  
$result $site_db->query($sql);
  
$num_rows $site_db->get_numrows($result);
}

if (!
$num_rows)  {
  
$thumbnails "";
  
$msg .= ($msg != "") ? "<p>".$lang['lightbox_no_images'] : $lang['lightbox_no_images'];
}
else {
  
$user_info_id $user_id;
  
$thumbnails "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    if (!
$download_allowed && check_permission("auth_download"$image_row['cat_id'])) {
      
$download_allowed true;
    }

    if (
$count == 0) {

      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
  
   $site_template->register_vars(array(
"huhu" => $user_info_id,  
)); 
  
  
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    
show_image($image_row"lightbox");
    
$thumbnails .= $site_template->parse_template("thumbnail_lightbox_member_bit");
    
$thumbnails .= "\n</td>\n";

    
$count++;
    if (
$count == $config['image_cells']) {
      
$thumbnails .= "</tr>\n";
      
$count 0;
    }
  } 
// end while
  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover >= 1) {
      for (
$i 0$i $leftover$i++){
        
$thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$thumbnails .= "</tr>\n";
    }
  }
  
$thumbnails .= "</table>\n";
 
// end else

$site_template->register_vars(array(
  
"thumbnails" => $thumbnails,  
));
unset(
$thumbnails);

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

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------



$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream
  
"lang_lightbox" => $lang['lightbox'],
));

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



save it as lightbox_member.php and upload it to your 4images root folder



STEP 2

open notepad, and insert this:

Code: [Select]
<!-- you wish detail page in a small javascript open window, use {thumbnail_openwindow} -->
<a href="details.php?image_id={image_id}&mode=member_lightbox&user_id={huhu}"><img src="data/thumbnails/{cat_id}/{thumbnail_file_name}" width="" height="" border="0"></a>
<br />
<b>{image_name}</b> {if image_is_new}<sup class="new">{lang_new}</sup>{endif image_is_new} ({user_name_link})
<br />
<a href="{cat_url}">{cat_name}</a><br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />
{lightbox_button}

save it as thumbnail_lightbox_member_bit.html and upload it to your 4images template folder



STEP 3

open notepad and insert this:

Code: [Select]
{header}
<table width="960" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td width="100%" colspan="4"><table cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="6"><img src="{template_url}/images/header_top_left.gif" width="6" height="6" alt="" /></td>
        <td width="100%"><img src="{template_url}/images/header_top.gif" width="100%" height="6" alt="" /></td>
<td width="6"><img src="{template_url}/images/header_top_right.gif" width="6" height="6" alt="" /></td>
    </tr>
</table>
</td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="100%"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="100%" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
 </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box} </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
   <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" width="18" height="18" alt="" /></td>
                <td width="100%" valign="top"><br />
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><b class="title">{lang_lightbox}</b></td>

                    </tr>
                  </table>
                  <hr size="1" />
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>
   {paging_stats}

 </td>
                    </tr>
                  </table>
                  <br />
                  {if msg}<b>{msg}</b><br /><br />{endif msg}
 {if thumbnails}
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">{thumbnails}</td>
                    </tr>
                  </table>
                  {endif thumbnails}
                  <br />
 {paging}
                  <br />
 <br />
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>{category_dropdown_form}</td>
                      <td align="right">{setperpage_dropdown_form}</td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </td>
                <td width="20" valign="top"><img src="{template_url}/images/spacer.gif" width="19" height="19" alt="" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6" nowrap><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="100%"></td>
          <td width="6" nowrap><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}

save it as lightbox_member.html and upload it to your 4images template folder



STEP 4

open details.php

find:
Code: [Select]
elseif ($mode == "search") {


insert above
Code: [Select]
// mod member lightbox easy way
if ($mode == "member_lightbox") {

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


$huhu= $user_id;

      $sql = "SELECT u.*, l.*
              FROM (".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l)
              WHERE u.user_id = $user_id AND l.user_id = $user_id ";
      $user_info_id = $site_db->query_firstrow($sql);

  if (!empty($user_info_id['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ", ", trim($user_info_id['lightbox_image_ids']));
    $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM ".IMAGES_TABLE."
            WHERE image_active = 1 AND image_id IN ($image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
            ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
    $in_mode = 1;
  }
}
// mod member lightbox easy way


find:
Code: [Select]
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));


replace with:
Code: [Select]
// member lightbox easy way
 if ($mode == "member_lightbox") {
    $next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : "")."&user_id=$huhu");
}
 else {
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));
}
 // member lightbox easy way



find:
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));


replace with:
Code: [Select]
// member lightbox easy way
 if ($mode == "member_lightbox") {
    $prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : "")."&user_id=$huhu");
}
 else {
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));
}
 // member lightbox easy way


save it.

Thats it. You can now use linking to lightbox images, for example in member_profile.html

Code: [Select]
<a href="lightbox_member.php?user_id={user_id}">Show lightbox of {user_name}</a>



PS: Change the html files to suit your site design.
PPS:  I will extend this little MOD if there are any requests

PPPS: Yes, get that beer again on the table ;)



6
Hey there,

Ever choose an image to upload, fill in all the fields, send the form and realize you took the wrong picture? Yeah, it's a pain in the ***.
Well, use this MOD and your user's will be happy to get a preview of the image they choose to upload. Best thing is, it happens via AJAX and it's compatible
with all modern browsers.

What: This MOD displays the image a user chooses to upload below the "browse" button via AJAX $_Post, without sending the form.
Tested with: 4images 1.7.10 with Firefox 3.X, Chrome 14.X, Opera 11.52, Internet Explorer 8

So let's get this party started.


STEP 1

Create a folder named "preview" in your 4images/data/ directory (4images/data/preview) and CHMOD it to 777




STEP 2

open notepad and insert:

Code: [Select]
<?php
$upload_dir 
'data/preview/'
$preview_url 'http://yourdomain.com/4images/data/preview/';
$filename'';
$result 'ERROR';
$result_msg '';
$allowed_image = array ('image/gif''image/jpeg''image/jpg''image/pjpeg','image/png');
define('PICTURE_SIZE_ALLOWED'2242880); // bytes

if (isset($_FILES['media_file'])) 
{
 if (
$_FILES['media_file']['error'] == UPLOAD_ERR_OK)  
 {
 if (
in_array($_FILES['media_file']['type'], $allowed_image)) {
 if(
filesize($_FILES['media_file']['tmp_name']) <= PICTURE_SIZE_ALLOWED
 {
 
$filename $_FILES['media_file']['name'];
 
move_uploaded_file($_FILES['media_file']['tmp_name'], $upload_dir.$filename);

//phpclamav clamscan for scanning viruses
//passthru('clamscan -d /var/lib/clamav --no-summary '.$upload_dir.$filename, $virus_msg); //scan virus
$virus_msg 'OK'//assume clamav returing OK.
if ($virus_msg != 'OK') {
unlink($upload_dir.$filename);
$result_msg $filename." : ".FILE_VIRUS_AFFECTED;
$result_msg '<font color=red>'.$result_msg.'</font>';
$filename '';
}else {
// main action -- move uploaded file to $upload_dir
$result 'OK';
}
}else {
$filesize filesize($_FILES['media_file']['tmp_name']);
$filetype $_FILES['media_file']['type'];
$result_msg PICTURE_SIZE;
}
}else {
$result_msg SELECT_IMAGE;
}
}
elseif (
$_FILES['media_file']['error'] == UPLOAD_ERR_INI_SIZE)
$result_msg 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
else
$result_msg 'Unknown error';
}

// This is a PHP code outputing Javascript code.
echo '<script language="JavaScript" type="text/javascript">'."\n";
echo 
'var parDoc = window.parent.document;';
if (
$result == 'OK') {
echo 
'parDoc.getElementById("picture_error").innerHTML =  "";';
}
else {
echo 
"parDoc.getElementById('picture_error').innerHTML = '".$result_msg."';";
}

if(
$filename != '') {
echo 
"parDoc.getElementById('picture_preview').innerHTML = '<img src=\'$preview_url$filename\' id=\'preview_picture_tag\' name=\'preview_picture_tag\' width=\'100\' />';";
}

echo 
"\n".'</script>';
exit(); 
// do not go futher

?>


save the file as previewimage.php and upload it to your 4images installation root (like yoursite.com/4images/previewimage.php)



STEP 3

open previewimage.php

find:

Code: [Select]
$preview_url = 'http://yourdomain.com/4images/data/preview/';

and change the path corresponding to your installation

save previewimage.php


STEP 4

open your_template/header.html

find:
Code: [Select]
{if has_rss}


insert above
Code: [Select]
<script>
function ajaxFileUpload(upload_field)
{
// Checking file type
var re_text = /\.jpg|\.gif|\.jpeg/i;
var filename = upload_field.value;
if (filename.search(re_text) == -1) {
alert("File should be either jpg or gif or jpeg");
upload_field.form.reset();
return false;
}
document.getElementById('picture_preview').innerHTML = '<div><img src="progressbar.gif" border="0" /></div>';
upload_field.form.action = 'previewimage.php';
upload_field.form.target = 'upload_iframe';
upload_field.form.submit();
upload_field.form.action = '';
upload_field.form.target = '';
return true;
}
</script>

save your_template/header.html


STEP 5

open your_template/member_uploadform.html

find:
Code: [Select]
<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="uploadbutton.disabled=true;">


add above
Code: [Select]
<!-- iframe used for ajax file upload-->
<!-- debug: change it to style="display:block" -->
<iframe name="upload_iframe" id="upload_iframe" style="display:none;"></iframe>
<!-- iframe used for ajax file upload-->


find:
Code: [Select]
<input type="file" name="media_file" class="input" /><br />


replace with:
Code: [Select]
 <input type="file" name="media_file" id="picture" class="input" onchange="return ajaxFileUpload(this);" /><br />
 <span id="picture_error"></span>
 <div id="picture_preview"></div>


save your_template/member_uploadform.html


STEP 6



save this image and upload it to your root directory (yoursite.com/4images/progressbar.gif)


THATS IT ;)

Now, when you choose an image it have to look like this:





TWEAKS

1) You can edit the image size displayed in the previewimage.php (find "width=\'100\')
2) Empty once a week the folder "/preview" or do a cron-job to empty it


Viel Spass

Georgi, aka treZ

7
Hey there,

I am currently developing a web 2.0 template from scratch, involving several mods with a 1.7.10 installation of 4images. I just started one week ago, just finishing the details page. My goal is to transform 4images in a modern, photography orientated (yeah and social) template (almost full AJAX) since the original template is somewhat outdated - and most people don't realize the power of 4images, so here I am ;)

I-phone / I-pad development is also on its way, and I will post those mod's for free.

I will post here every few days until the site is ready and you can see it in action. I am not willing to share the whole template, but I will share mods, design modifications etc. with you. I will also need some beta testers when the project I am doing goes online. This topic will also include codes to small javascript and AJAX modifications, that are easy but get that "wow" effect for your website.

Here's a little sneak preview of the details:














Stay tuned ;)




8
Discussion & Troubleshooting / Valid search string?
« on: October 13, 2011, 07:05:51 PM »
PS: Nevermind, found the solution:
http://www.4homepages.de/forum/index.php?topic=26287.0;msg=142916

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


Hey,

I added various additional image fields to my search, but I can't figure out the search string.

For example, I have a field "image_ISO" and want to search for images with an ISO of "100". I don't want to click on advanced search, but rather use a link in the images details page like this:

Quote
http://domain.com/4images/search.php?search_keywords=100

Well, that works, but shows me also images witch have for example "100" in their description.

So need something like this:

Quote
http://domain.com/4images/search.php?search_field=image_ISO&value=100

I know it's possible, I just need someone to give me the right string :)

Thanks

(I'm kinda need to refresh my 4images skills again)

9
Chit Chat / I'm back!
« on: October 10, 2011, 09:42:18 AM »
Hey guys,

some of the people who were here before 2007 probably know me and my mod's. So almost 5 years later I am currently working on a very big project using 4images. I am more or less transforming it into an Web 2.0 / Ajax / HTML5 platform with all social gimmicks, designs, and so on. I will release part of the MOD's as well as parts of the design. You won't recognize it as 4images when it's done :)

Whatever, nice to be at the forum again.

George (treZ)

10
Hi there,

as much know, we are selling a lot of mod's, but would like to enter into the template design area too.
But we want to (and can) make real "design" templates, not the usual templates you see here.
My questions are:

- Are you interested in abstract/unusual/vector art 4images templates?
- Are you willing to pay for them?

Just a small check, if there is an interest we will publish some design studies for 4images soon. Price will be around 50-120$ each (or 300$+ for exclusive rights)

11
Random User Profile for internal/external sites by 2XG MEDIA

NOTE
Thank's for the compliment's I've received on my previous MOD's, that really keeps me motivated to post more MOD's and share them with you,
even if i can make them payed. But yet i decided to make this MOD free, because it's simple ;) Enjoy it.

WHAT DOES THIS MOD
Well, just use it if you have more than 50 users with userpics, otherwise i don't recommend it. The MOD allows you to show anywhere a random user (with userpicture, username and country) - even outside your site, outside your gallery. I use that MOD to advertise my page on other sites.

REQUIRED MOD's
You need to have installed the following MOD's in order to use that one:

[MOD] Member personal photo v1.1.1 by V@no
[MOD] Select country and gender with gif when register

VERSIONS
1.7.X

Installation
Simply follow the steps. No additional SQL fields are required :)


STEP ONE

Make a new file and call it "random_user.php" and upload it into your 4images root.
Insert the following code:

Code: [Select]
<?php

$templates_used 
'';
$main_template 'random_user';

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


if (isset(
$HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
  
$template = (isset($HTTP_POST_VARS['template'])) ? basename(stripslashes($HTTP_POST_VARS['template'])) : basename(stripslashes($HTTP_GET_VARS['template']));
  if (!
file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
    
$template "";
  }
  else {
    
$main_template $template;
  }
}
else {
  
$template "";
}

// random USER
          
$sql "SELECT ".get_user_table_field("u.""user_id").get_user_table_field(", u.""user_name").", u.user_gender, u.userpic, u.user_country
                  FROM "
.USERS_TABLE." u
              WHERE "
.get_user_table_field("u.""user_id")." > ".GUEST." and u.userpic <> ''
              ORDER BY rand()
                  LIMIT 1"
;
$random_USER_result $site_db->query_firstrow($sql);

$site_template->register_vars(array(
"random_USER" => '<center><a href="member.php?action=showprofile&user_id=' $random_USER_result['user_id'] . '" target="_new"><img src="' ROOT_PATH "data/userpic/" $random_USER_result['userpic'] . '" height="100" border="0"></a><br />' $random_USER_result['user_name'] . '<br>îò ' $random_USER_result['user_country'] . '</center>',
));


$site_template->print_template($site_template->parse_template($main_template));  


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


save and close the file.

STEP TWO

Make a new file and call it "random_user.html" and upload it into your 4images template folder (e.g. yoursite.com/4images/templates/default).
Insert the following code:

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>///</title>

<table width="150" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="your_css_class">
{random_USER}
</td>
</tr>
</table>

</html>

save and close the file.

Thats it.
Now you can use the following code, anywhere on the internet to show the random user:

Code: [Select]
<iframe src="http://www.YOURSITE.com/random_user.php" width="150"
height="135" marginheight="0" marginwidth="0" frameborder="0"
scrolling="no"></iframe>

Greetings,

George

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


If there are any questions feel free to write in this topic - DON'T send me PM's regarding this MOD.

Feel free to browse another 25 unreleased (payed) MOD's here: http://www.ggrec.com/mods


12
Mods & Plugins (Releases & Support) / [MOD] - MCP (Moderator Control Panel)
« on: February 23, 2007, 03:42:43 PM »
MODERATOR CONTROL PANEL (MCP) by 2XG MEDIA

Yes finally i've found a pleasant solution for having moderators on your site, without having to create usergroups etc.
Let's go :)

WHAT DOES THIS MOD
It gives you the ability to have moderators who can validate images on your site. This can be extended of course (edit images, comments, etc.) to your wishes
(Please look at the several additions at the end of this post for further customization)

IS IS SECURE?
Yes, because moderator won't have access to important files like "reset stats", "Settings" etc..

VERSIONS
1.7.X

Installation
Simply follow the steps. No additional SQL fields are required :)


STEP ONE

copy the whole folder "admin" to your harddrive, and rename it to "moderator". After that, upload the folder to your 4images root dir.

STEP TWO

open
yoursite.com/moderator/admin_global.php

find:
Code: [Select]
  else {
    if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
      $HTTP_COOKIE_VARS['adminon'] = 0;
    }
  }

change to:
Code: [Select]
  else {
    if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
      $HTTP_COOKIE_VARS['moderatoron'] = 0;
    }
  }

find:
Code: [Select]
  if (!isset($HTTP_COOKIE_VARS['adminon']) || $HTTP_COOKIE_VARS['adminon'] == 0) {
    $user_info['user_level'] = GUEST;
  }
  else {
    if ($user_info['user_level'] != GUEST  && $user_info['user_level'] == ADMIN && isset($HTTP_POST_VARS['loginusername'])) {
      setcookie("adminon", 1, 0, '/');
      $HTTP_COOKIE_VARS['adminon'] = 1;
    }
  }
}

change to:
Code: [Select]
  if (!isset($HTTP_COOKIE_VARS['moderatoron']) || $HTTP_COOKIE_VARS['moderatoron'] == 0) {
    $user_info['user_level'] = GUEST;
  }
  else {
    if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
      setcookie("moderatoron", 1, 0, '/');
      $HTTP_COOKIE_VARS['moderatoron'] = 1;
    }
  }
}

In the above code replace XXX with the userid of your user who would be the moderator

find:
Code: [Select]
if ($user_info['user_level'] != ADMIN) {
  show_admin_header();

change to:
Code: [Select]
if ($user_info['user_id'] != XXX) {
  show_admin_header();

In the above code replace XXX again with the userid of your user who would be the moderator

Save and close admin_global.php


STEP THREE

open
yoursite.com/moderator/index.php

find:
Code: [Select]
<?php

          show_nav_header
($lang['nav_categories_main']);

          
show_nav_option($lang['nav_categories_edit'], "categories.php?action=modifycats");

          
show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");



          
show_nav_header($lang['nav_images_main']);

          
show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");

          
show_nav_option($lang['nav_images_add'], "images.php?action=addimages");

          
show_nav_option($lang['nav_images_validate'], "validateimages.php?action=validateimages");

          
show_nav_option($lang['nav_images_check'], "checkimages.php?action=checkimages");

          
show_nav_option($lang['nav_images_thumbnailer'], "thumbnailer.php?action=checkthumbnails");

          
show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");



          
show_nav_header($lang['nav_comments_main']);

          
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");



          
show_nav_header($lang['nav_users_main']);

          
show_nav_option($lang['nav_users_edit'], "users.php?action=modifyusers");

          if (!
defined('USER_INTEGRATION')) {

            
show_nav_option($lang['nav_users_add'], "users.php?action=addusers");

          }

          
show_nav_option($lang['nav_usergroups'], "usergroups.php?action=modifygroups");

          if (!
defined('USER_INTEGRATION')) {

            
show_nav_option($lang['nav_users_email'], "email.php?action=emailusers");

          }



          
show_nav_header($lang['nav_general_main']);

          
show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");

          
show_nav_option($lang['nav_general_templates'], "templates.php?action=modifytemplates");

          
show_nav_option($lang['nav_general_backup'], "backup.php?action=modifybackups");

          
show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");

show_nav_option("phpinfo()""phpinfo.php");



          if (@
is_dir("plugins")) {

            
show_nav_header("PlugIns");

            
$handle = @opendir("plugins/");

            while (
$file = @readdir($handle)) {

              if (
eregi("^\.{1,2}$"$file) || !eregi("\.php$"$file)) {

                continue;

              }

              
$plugin_file file("./plugins/".$file);

              
$plugin_file[0] = trim($plugin_file[0]);

              if (
preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i"$plugin_file[0], $regs)) {

                
show_nav_option(trim($regs[1]), "./plugins/".$file);

              }

              else {

                
show_nav_option($file"./plugins/".$file);

              }

            }

            @
closedir($handle);

          }

          
?>

change to:

Code: [Select]
<?php

//          show_nav_header($lang['nav_categories_main']);

//          show_nav_option($lang['nav_categories_edit'], "categories.php?action=modifycats");

//          show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");



          
show_nav_header($lang['nav_images_main']);

//          show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");

//          show_nav_option($lang['nav_images_add'], "images.php?action=addimages");

          
show_nav_option($lang['nav_images_validate'], "validateimages.php?action=validateimages");

//          show_nav_option($lang['nav_images_check'], "checkimages.php?action=checkimages");

//          show_nav_option($lang['nav_images_thumbnailer'], "thumbnailer.php?action=checkthumbnails");

//          show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");

//          show_nav_header('DREAMBOARD');

//          show_nav_option('Board Manager', "board_admin.php");

//          show_nav_option('Config Board', "board_config.php");



          
show_nav_header($lang['nav_comments_main']);

          
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");



//          show_nav_header($lang['nav_users_main']);

//          show_nav_option($lang['nav_users_edit'], "users.php?action=modifyusers");

//          if (!defined('USER_INTEGRATION')) {

//            show_nav_option($lang['nav_users_add'], "users.php?action=addusers");

//          }

//          show_nav_option($lang['nav_usergroups'], "usergroups.php?action=modifygroups");

//          if (!defined('USER_INTEGRATION')) {

//            show_nav_option($lang['nav_users_email'], "email.php?action=emailusers");

//          }



//          show_nav_header($lang['nav_general_main']);

//          show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");

//   show_nav_option($lang['nav_ann_settings'], "ann_settings.php?action=modifysettings");

//          show_nav_option($lang['nav_general_templates'], "templates.php?action=modifytemplates");

//          show_nav_option($lang['nav_general_backup'], "backup.php?action=modifybackup");

//          show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");



/*          if (@is_dir("plugins")) {

            show_nav_header("PlugIns");

            $handle = @opendir("plugins/");

            while ($file = @readdir($handle)) {

              if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file)) {

                continue;

              }

              $plugin_file = file("./plugins/".$file);

              $plugin_file[0] = trim($plugin_file[0]);

              if (preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs)) {

                show_nav_option(trim($regs[1]), "./plugins/".$file);

              }

              else {

                show_nav_option($file, "./plugins/".$file);

              }

            }

            @closedir($handle);

          }
*/
          
?>

save and close index.php

Thats it.
Now you moderator can validate images with the following link:
YOURSITE.com/4images/moderator/index.php

The login will only work for the userid (the person) you specified in step two. You as an admin will continue to
use your normal /admin/index.php - the moderator won't have access to that. And you won't have access to the /moderator/ folder,
but you don't need to have to.

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

Additional Options for you moderator

If you want him to have access to more for example to edit comments or add pictures simply uncomment the regarding line in step 3.
For example, if you want him to to add images and have access to modify images simply change (in step three):

Code: [Select]
//          show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");

//          show_nav_option($lang['nav_images_add'], "images.php?action=addimages");

to:

Code: [Select]
          show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");

          show_nav_option($lang['nav_images_add'], "images.php?action=addimages");

I think the concept is understandable :)


Additional SECURITY for you moderator area
I recommend deleting the files you commented in step three for additional security, because if he knows the filename he can access it.

For example you want to be sure that your moderator don't have access to the site "settings", even if the line in step three is
commented --> simply delete moderators/settings.php

Do the same thing with other files, but be carefull deleting files like images.php, because it's used for 4 different actions.

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

ADDITONAL OPTION (added 25/02/2007)

Allow your moderator directly to delete/edit comments from your details.php

Well, deleting and editing comments for your moderator can be very sad, if he always have to login first to his MCP (Moderator Control Panel), search the comment by ID and so on.
SO this little addition to my MOD allows your moderator to directly delete and edit comments at the details.php (picture)

Have pHun :)

STEP ONE

open yoursite.com/4images/moderator/index.php

Make sure those lines...

Code: [Select]
         
show_nav_header($lang['nav_comments_main']);

show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");

... are uncommented (without a "//" on the left)
Be also sure that you haven't deleted the "comments.php" in your moderator folder.

Everything fine? Good, let's proceed....


STEP TWO

open
yoursite.com/4images/details.php

find:

Code: [Select]
      $admin_links = "";
      if ($user_info['user_level'] == ADMIN) {
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }

insert below

Code: [Select]
      $moderator_links = "";
      if ($user_info['user_id'] == XXX) {
        $moderator_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $moderator_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }

In the above code replace XXX again with the userid of your user who would be the moderator

Okay, now lets find:

Code: [Select]
        "row_bg_number" => $row_bg_number,
        "admin_links" => $admin_links
      ));

replace it with:

Code: [Select]
        "row_bg_number" => $row_bg_number,
        "admin_links" => $admin_links,
        "moderator_links" => $moderator_links
      ));


save and close details.php


STEP THREE

open
yoursite.com/4images/templates/yourtemplate/comment_bit.html

find:

Code: [Select]
{if admin_links}{admin_links}{endif admin_links}
add below

Code: [Select]
{if moderator_links}{moderator_links}{endif moderator_links}

save and close comment_bit.html

Thats it.
Now you moderator can delete and edit comments directly from your site.


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


If there are any questions feel free to write in this topic - DON'T send me PM's regarding this MOD.

Feel free to browse another 25 unreleased (payed) MOD's here: http://www.ggrec.com/mods


13
Discussion & Troubleshooting / Anti Hack Guidelines for a secure site
« on: February 15, 2007, 09:41:33 PM »
Well, at least 3 times a week i read about sites getting hacked, and i read every time the same
questions like "Did you install all bugfixes", "Do you have a secure password"

Yes we have!

But why is my site being hacked even if i did all the fixes etc?
Because you can do more!

I won't discuss server related things here, because most of you don't have root access to your server,
but some simple thing's you can do will do the job ;) Here we go:

Step ONE to a more secure site
Gettin' rid of the yoursite.com/admin directory

1. Make a new folder in your 4images and called it something like "87cfgh77FG1F0C"
2. Move all your files from your admin folder into the new folder you created
3. Insert an empty "index.html" file in your admin folder
4. Open now yoursite.com/87cfgh77FG1F0C/admin_global.php and search for:

Code: [Select]
include(ROOT_PATH.'admin2/admin_functions.php');
and replace "admin" with the name of your new folder

5. Save it.
6. You do the same modification in all files located in your former admin directory, wich include path to "admin"

7. Search google for "htaccess" and put an extra login to your new folder
------------

Now your admin area is securet twice, first with the new name of the admin folder, and second, with the additional login (using the htaccess)
DONT change your other php files to use direct links to that new folder. You have to manually enter the admin area with an bookmark, and
for example search for the image you want to modify. No direct link from your homepage anymore - witch makes it more difficult to administrate, but more secure.
Again, i can tell you how to directly link for example "edit image"/"delete image" to that new folder, but the changes we've made would have no effect.

TIP: If you want to edit something, simply copy the adress and replace "admin" with the name of your new folder.


Step TWO to a more secure site
Because you wife's name isn't hard to guess

Don't use ever normal passwords like "qwerty", "sexy69" or "paaasword" - You really don't know how smart current hackers are. There are so many ways
to hack or even guess such a password. Use password's like:

ab2j87ffe
c4v5hh7k

and so on. I know, it's hard to remember. But after 3-4 days you will remember the password.



Step THREE to a more secure site
Trojan horses and 4images

NEVER login into your 4images site from:

- public computers (most of them have keyloggers installed)
- your friend's computer (trust no one!)

Use only your own PC if possible. And when you use it, make sure you have a good anti virus program installed (kaspersky, norton).
Trojan horses are one of the top reasons sites get hacked! Someone mails you an "greeting card", and you open it because you're curious,
and that's it - a trojan horse on your computer. It mails now all passwords, onlinebanking details, EVERYTHING to the hacker!

So please be sure you use an every day updated anti virus program! This is VERY important!

Well that's it for now - i can assure you, that following those 3 steps will make your site 90% more secure!
If you have any questons please write in this thread, don't write me PM's about that topic.

Greetings,

George

14
Tweak MOD: Admin CP Validate Images Section

Supported versions: 1.7.X
Supported browsers: IE5+, FF1+, Opera 7+
Publisher/Copyright: 2XG Media (ggrec.com / CodeLifter.com)
Credits: drJeckyll, treZ

What was wrong:
Well, this MOD is more for big sites, where your users upload 100+ images daily. It's a mess to validate those images fast, since there was no good enough default sorting, preview was too small, no rotation function for the images, and if you wanted to check an image in it's original size it opens in a new window. Maybe the biggest problem was that 4images was loading the original images instead of the thumbnails, what slows down the validation enormous.

What does this MOD

- instead of loading the original images, validation is loading now just the thumbnails what makes it 10 times faster
- instead of opening the image on click in a new window, now a popup with the image opens when you move the mouse over the thumbnail. It fits automatically to the image size, showing the image and the image name. It changes when you move over an other thumbnail, so you'll have only one popup opened.


INSTALL

STEP ONE
open your /admin/admin_functions.php
and search for:

Code: [Select]
   <script type="text/javascript" language="javascript" src="<?php echo ROOT_PATH?>admin/browserSniffer.js"></script>
    <script type="text/javascript" language="javascript" src="<?php echo ROOT_PATH?>admin/calendar.js"></script>

insert ABOVE
Code: [Select]
<script>
// SETUP:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 10;
PositionY = 10;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');      
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();
}}

</script>

Edit the settings if needed after that save and close your admin_functions.php


STEP TWO
open your /admin/validateimages.php
and search for:
Code: [Select]
     echo "<td><a href=\"".$image_path."\" target=\"_blank\"><img src=\"".$file_src."\" border=\"1\" height=\"50\"></a></td>";
      echo "<td><b><a href=\"".$image_path."\" target=\"_blank\">".format_text($image_row['image_name'], 2)."</a></b> (".$image_row['image_media_file'];

replace it with:
Code: [Select]
     echo "<td><a href=\"javascript:popImage('".$file_src."','".htmlspecialchars($image_row['image_name'])."')\" onMouseOver=\"javascript:popImage('".$file_src."','".htmlspecialchars($image_row['image_name'])."')\">";
      echo "<img src=\"";
      echo "../data/tmp_thumbnails/".basename($file_src);
      echo "\" border=\"1\" height=\"50\"></a><br></td>";
      echo "<td><b><a href=\"".$image_path."\" target=\"_blank\">".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];


search for:
Code: [Select]
   $orderby = "i.image_date";
and replace it with:

Code: [Select]
   $orderby = "i.user_id";
save & close your validateimages.php

THATS IT :)
Go to your admin panel and try the validate images section, everything should be all right.

15
Requests for paid modifications / Jobbörse / Payed MOD's from 2XG Media
« on: February 03, 2007, 04:46:41 PM »
16 MOD's, more are following soon.

more information on www.ggrec.com/mods

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

Ignore User
Get bored of a user? Ignoring him will result in an "You are ignored" message if he tries to send you a PM. "Ignore Buttons" for pm.php , memberlist.php, and profile included. MOD comes with additional "Ignored Users" page, where you can cancel and add ignored and unignored users.


Gender Colors
If you installed the user-gender MOD, and have more than a hanfull visitors on your site, the overview in your whos_online doesn't look so good. Put some color in it! For example light-red for women and light-blue for men. Of course, the gendercolor takes effect on all pages in your 4images installation (if you want) such as in the profile, pm's etc

Search Box
"I'am a ..., searching for a ..., between .... and .... from .... , with photo" - Where the dots are gender/gender/age/country(city). This little box points directly to the (modified) memberlist, more explanation isn't needed right?


Welcome PM

"Hello you freak, welcome to our exiting site :D", oh i'am sorry - that wasn't a good example. Well, after a user registers this simple MOD sends him e predefined personal message (Welcome text, first steps) - as simple as that.


Who viewed my profile
Yet another important MOD, shows the logged in user on a seperate page who viewed his profile, fields are "How many times, last time viewed, send personal message and last but not least - userpic"



User Categories
On of our "most buyed" - Creates automaticly a user category for each new user. With direct link to "My Category" for viewing or uploading pictures. We use a better code than V@nos free mod since there were to much errors and security problems.


ADDON for User Categories

"Create Sub-Categories" ... you can limit how many each user can make, they can name their own categories, moving images from one to another etc.


User Profile Comments
Works like a guestbook for each user. Accessible from his profile, 3 new links (add/view comments) and for the logged in user a link (my comments)


ADDON for User Profile Comments
Comment notify, when a user posts a comment to a profile the user gets a PM with a link to the comment.


User Profile Rating system
Rating images is boring? Try rating users, increases hits by 20%! User rating is made from the user profile with a scale from 1 - 12 (or 1 - 6). Vote for the profile is displayed numeric and with a picture. Only registered users are allowed to vote to keep the reiting free from manipulation. Comes free with user male/female top100 statistics.


User Friends Module
(Add/Remove from friends) + on request with authorization for friend (3 sites, awaiting authorization/ friends / rejected offers). Friend's are shwon in Profile with small userpics. Additional showing of how much friends are online is possible.

PhpBB integration
Dreamboard sucks, PhpBB rules - full integration, everything stays the same, no doubble logins, troubble with sessions etc.


Total males/females
Total Females/Males stats with direct link to your memberlist


USERONLINE (extendet)
The whos_online is good, but not good enough - Useronline.php shows the user with userpicture/age/location, profile/pm/comments/add to friends/ignore link and much more. Sorting by gender/location/age is included.


Userpic shown in every PM page
This addon shows the userpic (from) on every private message page (e.g., message view, folders etc)


BATTLE Mod
2 Random userprofiles are choosen (if they contain userpic) and are "going to battle". Please view the demo for more information because it's hard to explain ;))

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


more information on www.ggrec.com/mods


Pages: [1] 2 3 4 5