• [MOD] Histogram 4 0 5 1
Currently:  

Author Topic: [MOD] Histogram  (Read 222380 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Histogram
« Reply #135 on: October 19, 2008, 09:35:34 AM »
login as administrator, it should show you more details about the error.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Histogram
« Reply #136 on: October 19, 2008, 03:42:35 PM »
unfortunately the error log shows no information, no matter how many times i try to access that link.

Could someone try and translate Mawenzi's installation notes to english?

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Histogram
« Reply #137 on: October 19, 2008, 04:16:18 PM »
Hi sigma,

http://www.cydonian.com/photos/histo.php?hist_image_id=1758
is working  :wink:
But not in page  8O

Modcode:
Quote
3.1 Der folgende Code ist aus der histo.php zu löschen.
=> Delete the following code in histo.php


Quote
3.2 Alle folgenden Tags in der histo.php sind wie folgt umzubenennen.
=> Rename the following tags in histo.php


Kurt

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Histogram
« Reply #138 on: October 19, 2008, 06:22:11 PM »
This is what my histo.php looks like. Downloaded from Mawenzi's website yesterday. Renamed histogramm.php to histo.php

Dont see what I should delete. Looks like Mawenzi updated the php recently?


Edit by mawenzi :

Wenn man etwas von meiner Website herunterläd, dann sollte man es auch komplett machen ... incl. aller erforderlichen Dateien und Änderungen die dort angeboten sind und dann natürlich auch die dazugehörige Einbauanleitung beachten. Wie vorne zu lesen ist, habe ich die Modifikation "Histogramm" optmiert und biete sie komplett zum Download auf meiner Seite an. Und wie Kurt einige Post später schon richtig festgestellt hat, handelt es sich dabei um eine andere Versionen als die zum Anfang dieses Threads zu finden ist.

Also nicht Äpfel mit Birnen verwechseln und sich noch darüber beschweren, dass die Birne nach Apfel schmeckt ... ;)
« Last Edit: October 19, 2008, 09:09:14 PM by mawenzi »

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Histogram
« Reply #139 on: October 19, 2008, 06:41:47 PM »
Code: [Select]
$hist_image_id=$_GET['hist_image_id'];
where does the histo.php found this value  :?: => not in the histo.php link from details.php :wink:


i thing, this are 2 different versions for the histogram....

test this in details.php
search:
Code: [Select]
   $histogramm_image = "<img src='histo.php?hist_image=".$hist_image."&hist_file=".$hist_file."&hist_path=".$hist_path."' border=\"1\">";replace with:
Code: [Select]
   $histogramm_image = "<img src=\"histo.php?hist_image_id=".$image_row['image_id]."\" border=\"1\">";

Kurt

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Histogram
« Reply #140 on: October 19, 2008, 06:53:01 PM »
Code: [Select]
Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/cydonian/public_html/photos/details.php on line 85
:(

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Histogram
« Reply #141 on: October 19, 2008, 06:59:34 PM »
sorry
Code: [Select]
$histogramm_image = "<img src=\"histo.php?hist_image_id=".$image_row['image_id']."\" border=\"1\">";

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: [MOD] Histogram
« Reply #142 on: October 19, 2008, 07:01:59 PM »
Works! Thank you Kurt!

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Histogram
« Reply #143 on: October 19, 2008, 07:02:36 PM »
 :wink:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Histogram
« Reply #144 on: October 19, 2008, 07:38:53 PM »
You might want add proper headers as well:
aboveif (file_exists($hist_path $hist_file)) {

insert
header'Content-type: image/png' );
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Histogram
« Reply #145 on: March 10, 2009, 10:27:30 AM »
Im having big problems with 1.7.6 and using php5

site:
http://www.thelifephotography.com/details.php?image_id=184

histo.php in root:
Code: [Select]
<?php
//&#160; &#160; &#160; Histogram creation
//&#160; &#160; &#160; Created by Anton Sparrius (Spaz) 6/9/05&#160; anton_spaz@yahoo.com
//&#160; &#160; &#160; Free to use and change, provided you keep these lines :)
//


&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if (file_exists($hist_path.$hist_file)) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im=imagecreatefromPNG($hist_path . $hist_file);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagePNG($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagedestroy($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; } else {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im=imagecreatefromjpeg($hist_path.$hist_image);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($i=0;$i<imagesx($im);$i+=2)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($j=0;$j<imagesy($im);$j++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $rrggbb=imagecolorsforindex ($im, imagecolorat($im,$i,$j));
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $r[$rrggbb['red']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $g[$rrggbb['green']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $b[$rrggbb['blue']]+=1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for ($i=0;$i<256;$i++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max[$i]=($r[$i]+$g[$i]+$b[$i])/3;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max_value=max($max)/150;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[0]=max($r);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[1]=max($b);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $m[2]=max($g);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $max_rgb=max($m)/150;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im_out = imageCreate (280, 164);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $background = imageColorAllocate($im_out,70,70,70);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $hist=ImageColorAllocate($im_out,0,0,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $white=ImageColorAllocate($im_out,143,143,134);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $red=ImageColorAllocate($im_out,255,0,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $green=ImageColorAllocate($im_out,0,255,0);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $blue=ImageColorAllocate($im_out,0,0,255);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $ry=107;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $gy=107;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $by=107;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; for($i=0;$i<256;$i++)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+14, 157, $i+14, 157-($max[$i]/$max_value),$white);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $ry, $i+14, 157-($r[$i]/$max_rgb), $red);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $gy, $i+14, 157-($g[$i]/$max_rgb), $green);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out, $i+13, $by, $i+14, 157-($b[$i]/$max_rgb), $blue);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $ry=157-($r[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $gy=157-($g[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $by=157-($b[$i]/$max_rgb);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,158,270,158,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,6,270,6,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,13,6,13,158,$hist);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageLine($im_out,270,6,270,158,$hist);

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagePNG($im_out,$hist_path . $hist_file);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imageDestroy($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagedestroy($im_out);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $im=imagecreatefromPNG($hist_path . $hist_file);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagePNG($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; imagedestroy($im);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
?>


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

$main_template 'details';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');
/*
&#160; MOD AJAX COMMENTS
&#160; BEGIN INSERT
*/
include(ROOT_PATH."ajaxcomments.php");
/*
&#160; MOD AJAX COMMENTS
&#160; END INSERT
*/
if (!$image_id) {
&
#160; &#160; redirect($url);
}

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

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

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

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

//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------

//--- Start Histogramm 27.02.2006 ----------------------
$hist_image $image_row['image_media_file'] ;
$hist_file"hist_".substr($hist_image,0,strlen($hist_image)-4).".png";
$hist_path "data/histo/";

$ext substr($hist_imagestrpos($hist_image".")+1strlen($hist_image));
$AutorisedImageType = array ("jpg""jpeg""JPG""JPEG");&#160; // Dateitypen f&#252;r die das Histogramm gezeigt werden soll

if (in_array($ext$AutorisedImageType)) {
 
$histogramm_image "<img src=\"histo.php?hist_image_id=".$image_row['image_id']."\" border=\"1\">"
} else {
&
#160;  $histogramm_image = REPLACE_EMPTY;
}

$site_template->register_vars(array(
&
#160;  "histogramm" => "Histogramm:",
&#160;  "histogramm_image" => $histogramm_image
));
//--- Ende Histogramm 27.02.2006 ------------------------

$image_allow_comments = (check_permission("auth_readcomment"$cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name format_text($image_row['image_name'], 2);
show_image($image_row$mode01);

$in_mode 0;

$sql "";
if (
$mode == "lightbox") {
&
#160; if (!empty($user_info['lightbox_image_ids'])) {
&#160; &#160; $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
&#160; &#160; $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
&#160; &#160; &#160; &#160; &#160; &#160; FROM ".IMAGES_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; 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")."))
&#160; &#160; &#160; &#160; &#160; &#160; ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
&#160; &#160; $in_mode = 1;
&#160; }
}
elseif (
$mode == "search") {
&
#160; if (!isset($session_info['searchid']) || empty($session_info['searchid'])) {
&#160; &#160; $session_info['search_id'] = $site_sess->get_session_var("search_id");
&#160; }

&#160; if (!empty($session_info['search_id'])) {
&#160; &#160; $search_id = unserialize($session_info['search_id']);
&#160; }

&#160; $sql_where_query = "";

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

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

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

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

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

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

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

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

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

if (!empty(
$next_prev_cache[$prev_image_id])) {
&
#160; $prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
&#160; $prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));
&#160; if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $prev_image_file = ICON_PATH."/404.gif";
&#160; }
&#160; else {
&#160; &#160; $prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
&#160; }
&#160; if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
&#160; &#160; $prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
&#160; }
&#160; else {
&#160; &#160; $prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
&#160; }
}
else {
&
#160; $prev_image_name = REPLACE_EMPTY;
&#160; $prev_image_url = REPLACE_EMPTY;
&#160; $prev_image_file = REPLACE_EMPTY;
&#160; $prev_thumb_file = REPLACE_EMPTY;
}

$site_template->register_vars(array(
&
#160; "next_image_id" => $next_image_id,
&#160; "next_image_name" => $next_image_name,
&#160; "next_image_url" => $next_image_url,
&#160; "next_image_file" => $next_image_file,
&#160; "next_thumb_file" => $next_thumb_file,
&#160; "prev_image_id" => $prev_image_id,
&#160; "prev_image_name" => $prev_image_name,
&#160; "prev_image_url" => $prev_image_url,
&#160; "prev_image_file" => $prev_image_file,
&#160; "prev_thumb_file" => $prev_thumb_file
));
unset(
$next_prev_cache);
/*--------------------------------------------- Start MOD: Photo Preview Hack ----------------------------------------- */
$result $site_db->query($sql);

while(
$row $site_db->fetch_array($result)){
&
#160; &#160; $image_preview[] = $row['image_id'];
&#160; &#160; $preview_row[$row['image_id']] = $row;
}
$lastPage count($image_preview);
$t_template "<table height=\"0\"width=\"600\"&#160; border=\"0\" cellspacing=\"5\" cellpadding=\"3\" align=\"center\"><tr>\n";
if(
$lastPage 6){
&
#160; &#160; $start = 0;
&#160; &#160; $end = $lastPage -1;
} elseif ($act_key == || $act_key == 1){
&
#160; &#160; $start = 0;
&#160; &#160; $end&#160;  = 4;
} elseif ($act_key == $lastPage-|| $act_key == $lastPage -2){
&
#160; &#160; $start = $lastPage - 5;
&#160; &#160; $end = $lastPage - 1;
} else {
&
#160; &#160; $start = $act_key -2;
&#160; &#160; $end&#160;  = $act_key +2;
}
$sizeTimes 0.5;
for(
$i=$start$i<=$end$i++){
&
#160; &#160; if ($preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
&#160; &#160; $t_template .= "<td style=\"border: 1px dashed #004C75; text-align:center; padding: .1cm \">\n";
&#160; &#160; } else {
&#160; &#160; $t_template .= "<td style=text-align:center; padding: .1cm\">\n";
&#160; &#160; }
&#160; &#160; $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
&#160; &#160; $oriWidth = substr($tag, strpos($tag, "width")+7, strpos($tag, "\" height")-strlen($tag));
&#160; &#160; $oriHeight = substr($tag, strpos($tag, "height")+8, strpos($tag, " alt")-strlen($tag)-1);
&#160; &#160; $tag = str_replace('width="'.$oriWidth.'"', 'width="'.$oriWidth*$sizeTimes.'"', $tag);
&#160; &#160; $tag = str_replace('height="'.$oriHeight.'"', 'height="'.$oriHeight*$sizeTimes.'"', $tag);
&#160; &#160; $t_template .= $tag."<br>\n";
&#160; &#160; $t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n";
}
$t_template .= "</td></table>\n";
$site_template->register_vars("preview_box"$t_template);
unset(
$image_preview);
/*--- End MOD: Photo Preview Hack&#160; ------------------------------------------ */
//-----------------------------------------------------
//--- Show Count Lightbox -----------------------------
//-----------------------------------------------------

$sql "SELECT COUNT(*) AS counter
&#160; &#160; &#160; &#160; FROM "
.LIGHTBOXES_TABLE."
&#160; &#160; &#160; &#160; WHERE lightbox_image_ids REGEXP '([^0-9]|^)"
.$image_row['image_id']."([^0-9]|$)'";
&
#160; &#160; &#160; &#160; 
$lightbox_count $site_db->query_firstrow($sql);

$site_template->register_vars(array(
&
#160; "lang_image_lightbox_count" => $lang['image_lightbox_count'],
&#160; "lightbox_count" => (isset($lightbox_count['counter']) && $lightbox_count['counter']) ? $lightbox_count['counter'] : 0
));

unset(
$lightbox_count);

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

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

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

&#160; &#160; // Flood Check
&#160; &#160; $sql = "SELECT comment_ip, comment_date
&#160; &#160; &#160; &#160; &#160; &#160; FROM ".COMMENTS_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; WHERE image_id = $id
&#160; &#160; &#160; &#160; &#160; &#160; ORDER BY comment_date DESC
&#160; &#160; &#160; &#160; &#160; &#160; LIMIT 1";
&#160; &#160; $spam_row = $site_db->query_firstrow($sql);
&#160; &#160; $spamtime = $spam_row['comment_date'] + 180;

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

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

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

&#160; &#160; if (!$error)&#160; {
&#160; &#160; &#160; $sql = "INSERT INTO ".COMMENTS_TABLE."
&#160; &#160; &#160; &#160; &#160; &#160; &#160; (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; VALUES
&#160; &#160; &#160; &#160; &#160; &#160; &#160; ($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
&#160; &#160; &#160; $site_db->query($sql);
&#160; &#160; &#160; $commentid = $site_db->get_insert_id();
&#160; &#160; &#160; update_comment_count($id, $user_info['user_id']);
&#160; &#160; &#160; $msg = $lang['comment_success'];
&#160; &#160; }
&#160; }
&#160; unset($row);
&#160; unset($spam_row);
}

//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($image_allow_comments == 1) {
&
#160; $site_template->register_vars(array(
&#160; &#160; &#160; "has_rss"&#160;  => true,
&#160; &#160; &#160; "rss_title" => "RSS Feed: ".$image_name." (".str_replace(':', '', $lang['comments']).")",
&#160; &#160; &#160; "rss_url"&#160;  => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
&#160; ));

&#160; $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").", u.userpic


,
c.comment_rating,c.comment_votes,c.comment_rating_users
&#160; &#160; &#160; &#160; &#160; FROM ".COMMENTS_TABLE." c
&#160; &#160; &#160; &#160; &#160; LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
&#160; &#160; &#160; &#160; &#160; WHERE c.image_id = $image_id
&#160; &#160; &#160; &#160; &#160; 


ORDER BY c.comment_date ".(COMMENTS_ORDER ? "DESC" : "ASC")."";
&#160; 
$result = $site_db->query($sql);

&#160; 
$comment_row = array();
&#160; while (
$row = $site_db->fetch_array($result)) {
&#160; &#160; 
$comment_row[] = $row;
&#160; }
&#160; 
$site_db->free_result($result);
&#160; 
$num_comments = sizeof($comment_row);

&#160; if (!
$num_comments) {
&#160; &#160; 
$comments = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
&
#160; }
&#160; else {
&#160; &#160; $comments = "";
&#160; &#160; $bgcounter = 0;
&#160; &#160; for ($i = 0; $i < $num_comments; $i++) {
&#160; &#160; &#160; $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

&#160; &#160; &#160; $comment_user_email = "";
&#160; &#160; &#160; $comment_user_email_save = "";
&#160; &#160; &#160; $comment_user_mailform_link = "";
&#160; &#160; &#160; $comment_user_email_button = "";
&#160; &#160; &#160; $comment_user_homepage_button = "";
&#160; &#160; &#160; $comment_user_icq_button = "";
&#160; &#160; &#160; $comment_user_profile_button = "";
&#160; &#160; &#160; $comment_user_status_img = REPLACE_EMPTY;
&#160; &#160; &#160; $comment_user_name = format_text($comment_row[$i]['comment_user_name'], 2);
&#160; &#160; &#160; $comment_user_info = $lang['userlevel_guest'];

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

&#160; &#160; &#160; &#160; $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);
&#160; &#160; &#160; &#160; $comment_user_profile_button = "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";

&#160; &#160; &#160; &#160; $comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";

&#160; &#160; &#160; &#160; $comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
&#160; &#160; &#160; &#160; if (!empty($comment_user_homepage)) {
&#160; &#160; &#160; &#160; &#160; $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>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; $comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
&#160; &#160; &#160; &#160; if (!empty($comment_user_icq)) {
&#160; &#160; &#160; &#160; &#160; $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>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
&#160; &#160; &#160; &#160; &#160; $comment_user_email = format_text($comment_row[$i][$user_table_fields['user_email']]);
&#160; &#160; &#160; &#160; &#160; $comment_user_email_save = format_text(str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]));
&#160; &#160; &#160; &#160; &#160; if (!empty($url_mailform)) {
&#160; &#160; &#160; &#160; &#160; &#160; $comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
&#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; else {
&#160; &#160; &#160; &#160; &#160; &#160; $comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
&#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; $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>";
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
&#160; &#160; &#160; &#160; &#160; $comment_user_info = $lang['userlevel_user'];
&#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
&#160; &#160; &#160; &#160; &#160; $comment_user_info = $lang['userlevel_admin'];
&#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; $comment_user_info .= "<br />";
&#160; &#160; &#160; &#160; $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
&#160; &#160; &#160; &#160; $comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
&#160; &#160; &#160; }

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

&#160; &#160; &#160; $admin_links = "";
&#160; &#160; &#160; if ($user_info['user_level'] == ADMIN) {
&#160; &#160; &#160; &#160; $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;";
&#160; &#160; &#160; &#160; $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>";
&#160; &#160; &#160; }
&#160; &#160; &#160; elseif ($is_image_owner) {
&#160; &#160; &#160; &#160; $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;";
&#160; &#160; &#160; &#160; $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>";
&#160; &#160; &#160; }

&#160; &#160; &#160; //--- Kommentar-Autor COUNTRY FLAGS ---
&#160; &#160; if (!class_exists("GeoIP"))
&#160; &#160; {
&#160; &#160; &#160; include(ROOT_PATH."includes/geoip.inc");
&#160; &#160; }
&#160; &#160; $gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
&#160; &#160; $countries = array();
&#160; &#160; $cid = geoip_country_code_by_addr($gi, $comment_row[$i]['comment_ip']);
&#160; &#160; if (empty($cid)) $cid = "lan";
&#160; &#160; $countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
&#160; &#160; $comment_user_flag = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0>";
//--- Kommentar-Autor COUNTRY FLAGS ---

&#160; &#160; &#160; $site_template->register_vars(array(
&#160; &#160; &#160; &#160; "comment_id" => $comment_row[$i]['comment_id'],
&#160; &#160; &#160; &#160; "comment_user_flag" => $comment_user_flag,
&#160; &#160; &#160; &#160; "comment_user_id" => $comment_user_id,
&#160; &#160; &#160; &#160; "comment_user_status_img" => $comment_user_status_img,
&#160; &#160; &#160; &#160; "comment_user_name" => $comment_user_name,
&#160; &#160; &#160; &#160; "comment_user_info" => $comment_user_info,
&#160; &#160; &#160; &#160; "comment_user_profile_button" => $comment_user_profile_button,
&#160; &#160; &#160; &#160; "comment_user_email" => $comment_user_email,
&#160; &#160; &#160; &#160; "comment_user_email_save" => $comment_user_email_save,
&#160; &#160; &#160; &#160; "comment_user_mailform_link" => $comment_user_mailform_link,
&#160; &#160; &#160; &#160; "comment_user_email_button" => $comment_user_email_button,
&#160; &#160; &#160; &#160; "comment_user_homepage_button" => $comment_user_homepage_button,
&#160; &#160; &#160; &#160; "comment_user_icq_button" => $comment_user_icq_button,
&#160; &#160; &#160; &#160; "comment_user_ip" => $comment_user_ip,
&#160; &#160; &#160; &#160; "comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
&#160; &#160; &#160; &#160; "comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
&#160; &#160; &#160; &#160; "comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
&#160; &#160; &#160; &#160; "comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
&#160; &#160; &#160; &#160; "row_bg_number" => $row_bg_number,
&#160; &#160; &#160; &#160; "admin_links" => $admin_links
&#160; &#160; &#160; ));
&#160; &#160; &#160; /*
&#160; MOD AJAX COMMENTS
&#160; BEGIN INSERT
*/
&
#160; &#160; &#160; if (COMMENT_RATING_ANABLE)
&#160; &#160; &#160; {
&#160; &#160; &#160; &#160; $comment_row[$i]['cat_id'] = $cat_id;
&#160; &#160; &#160; &#160; $comment_row[$i]['image_allow_comments'] = $image_allow_comments;
&#160; &#160; &#160; &#160; comment_rating_template($comment_row[$i]);
&#160; &#160; &#160; }
/*
&#160; MOD AJAX COMMENTS
&#160; END INSERT
*/
&#160; &#160; &#160; $comments .= $site_template->parse_template("comment_bit");
&#160; &#160; } // end while
&#160; } //end else
&#160; /*
&#160; MOD AJAX COMMENTS
&#160; START REPLACE
*/
&
#160; $site_template->register_vars(array(
&#160; &#160; "comments" => $comments,
&#160; &#160; "comments_num" => $num_comments,
&#160; &#160; "commentbg" => (isset($row_bg_number)) ? $row_bg_number : 0,
&#160; &#160; "page" => $page,
&#160; &#160; "perpage" => $commentperpage,
&#160; ));

/*
&#160; MOD AJAX COMMENTS
&#160; END REPLACE
*/
&#160; unset($comments);

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

&#160; if (!$allow_posting) {
&#160; &#160; $comment_form = "";
&#160; }
&#160; else {
&#160; &#160; $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) : "");
&#160; &#160; $comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
&#160; &#160; $comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

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

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

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

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

if (
$mode == "lightbox" && $in_mode) {
&
#160; $page_url = "";
 
if (preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
&
#160; &#160; if (!empty($regs[1]) && $regs[1] != 1) {
&#160; &#160; &#160; $page_url = "?".URL_PAGE."=".$regs[1];
&#160; &#160; }
&#160; }
&#160; $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
}
elseif (
$mode == "search" && $in_mode) {
&
#160; $page_url = "";
&#160; if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
&#160; &#160; if (!empty($regs[1]) && $regs[1] != 1) {
&#160; &#160; &#160; $page_url = "&amp;".URL_PAGE."=".$regs[1];
&#160; &#160; }
&#160; }
&#160; $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
&
#160; $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $image_name."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
&
#160; "msg" => $msg,
&#160; "clickstream" => $clickstream,
&#160; "lang_category" => $lang['category'],
&#160; "lang_added_by" => $lang['added_by'],
&#160; "lang_description" => $lang['description'],
&#160; "lang_keywords" => $lang['keywords'],
&#160; "lang_date" => $lang['date'],
&#160; "lang_hits" => $lang['hits'],
&#160; "lang_downloads" => $lang['downloads'],
&#160; "lang_rating" => $lang['rating'],
&#160; "lang_votes" => $lang['votes'],
&#160; "lang_author" => $lang['author'],
&#160; "lang_comment" => $lang['comment'],
&#160; "lang_prev_image" => $lang['prev_image'],
&#160; "lang_next_image" => $lang['next_image'],
&#160; "lang_file_size" => $lang['file_size']
));

$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Histogram
« Reply #146 on: March 10, 2009, 10:31:19 AM »
continuing from previous post


I have created the data/histo directory
I have uploaded the background.php file to the root directory

I get a broken image.... if I try to view the broken image I get a ton of errors pages long. I think this is a cool mod if anyone has =any idea....

As long as I can finish my site before I die.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Histogram
« Reply #147 on: March 10, 2009, 10:48:07 AM »
hey Robert ...

... there is something wrong with your php-editor or something else ...
... try the code download for histogramm.php (not histo.php) and details.php again ... and use another php-editor ...
... you are the first downloader who presented such a code after downloading ... ;)
... and please use for reading the installation instruction : Google-Translator ...
...
... your problems have nothing to do with version 1.7.6 and using php5 ...

... edit ...
... and please read this here ...
« Last Edit: March 10, 2009, 11:10:48 AM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Histogram
« Reply #148 on: March 10, 2009, 05:29:11 PM »
Wow... dont know where those characters came from.. I use ultraedit... weird I think that was a forum error ... my files dont look like that . sorry...


I lived in Brotterode Thuringen for many years... So my German is not that bad.... Aber ich haub keine lust fur schreiben ich weisse meine deutsche ich sehr schreklische und hwssiliche und unbekkant. Naja///

So you see it is cool when I read German and speaking it probably sounds funny enough... but I still think it is better than my Chinese :) THAnk god 4images is  not Chinese as I cant read it at all even after 8 years...

ANyways the problem I made was I created the directory in the wrong directory. I was confused as you have support in the forum on your download page, and people replying to the original thread on this page/// It seems like they are replying to the original threads modifications and not to the modifications made to the version on your site. SO I was not sure what was up and tried to follow through using the original one in the thread.....


I think you shouls put the changes in the mod from your forum onto this one so people could follow the changes and know which is the one to troubleshoot. Right now it is like two different mods in one thread.. or two threads in two forums...  8O
As long as I can finish my site before I die.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Histogram
« Reply #149 on: March 11, 2009, 09:56:13 AM »
@ AntiNSA2

... I saw ... the histogram is installed ... with german discription ... ;)
... almost perfect ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...