Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #21  
Old 02-15-2005, 08:03 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
forgot to tell. If you wanna see this category photoblog you can see my blog now it is installed there!
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #22  
Old 02-15-2005, 08:06 PM
Zlato Offline
pp regular
 
Join Date: Feb 2005
Location: Paris - FRANCE
Posts: 43
Another great job here, i will try further on my site... :wink:
__________________
A. Zlatogorov
Ecrivain de lumière
Reply With Quote
  #23  
Old 02-15-2005, 08:07 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
Quote:
Originally Posted by Zlato
ive just think about that the count is made within the list and in fact it cannot count the "All" statement which is always equal to nothing (it's not a true category)...

Am i right ? ops:
there is no "all" category. to count all you should eliminate the "where category=" form mysql query.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #24  
Old 02-15-2005, 08:13 PM
-okapi-'s Avatar
-okapi- Offline
pixelpost guru
 
Join Date: Feb 2005
Location: Vienna, Austria
Posts: 252
oh man, you're a genius!
this is exactly what i was talking about!
incredible!

although it doesn't work for me yet (blanc screen after changing the index.php) i can see it working with your site! so this is only a matter of time to get it working for me too.

absolutely great, ramin!
__________________
a visual notebook
michael singer photography
http://www.a-visual-notebook.at
Reply With Quote
  #25  
Old 02-15-2005, 08:14 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
Oh yeah! I think I have used my quota of Pixelpost[ing] for a month!!
haha... I've installed mysql server and pixelpost on my local computer (windows) only 3 days ago. I think I'm over excited with it....




__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #26  
Old 02-15-2005, 08:17 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
Quote:
Originally Posted by -okapi-
oh man, you're a genius!
this is exactly what i was talking about!
incredible!

although it doesn't work for me yet (blanc screen after changing the index.php) i can see it working with your site! so this is only a matter of time to get it working for me too.

absolutely great, ramin!
oops maybe there is some error in that index.php I uploaded.
try this stable one
Code:
<?php

/*

Pixelpost version 1.3
index.php version 1.7

Pixelpost www: http://www.pixelpunk.se/software/
Contact: pixelpost@pixelpunk.se
Copyright (c) 2004 shapestyle graphic design + code<http://www.shapestyle.se>
License: http://www.gnu.org/copyleft/gpl.html

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

error_reporting(0);

// Set cookie for visitor counter, re-count a person after 60 mins
setcookie("lastvisit","expires in 60 minutes",time() +60*60);

// save user info if requested
if($_POST['vcookie'] == "set") {
    $name = clean($_POST['name']);
    $url = clean($_POST['url']);
    setcookie("visitorinfo","$name%$url",time() +60*60*24*30); // save cookie 30 days
    }

require("admin/pixelpost.php");
require("admin/markdown.php");
require_once("exifer/exif.php"); 


/* start up mysql */ 
mysql_connect($pixelpost_db_host, $pixelpost_db_user, $pixelpost_db_pass) || die("Error: ". mysql_error());
mysql_select_db($pixelpost_db_pixelpost) || die("Error: ". mysql_error());

// get config
if($cfgquery = mysql_query("select * from ".$pixelpost_db_prefix."config")) {
$cfgrow = mysql_fetch_array($cfgquery);
$upload_dir = $cfgrow['imagepath'];
} else {
    echo "pixelpost does not seem to be installed yet.";
    exit;
    }
// get the language file
require("language/lang-".$cfgrow['langfile'].".php");
    
$pixelpost_site_title = $cfgrow['sitetitle'];
// read the template file

switch ($_GET['x']) {
    case "":
    $tpl = file_get_contents("templates/".$cfgrow['template']."/image_template.html");
    break;
    case "ref":
    $tpl = file_get_contents("templates/".$cfgrow['template']."/referer_template.html");
    break;
    case "browse":
    $tpl = file_get_contents("templates/".$cfgrow['template']."/browse_template.html");
    break;
    case "about":
    $tpl = file_get_contents("templates/".$cfgrow['template']."/about_template.html");
    break;
    case "category":
    $tpl = file_get_contents("templates/".$cfgrow['template']."/image_template.html");
    break;

    }
if($_GET['popup'] == "comment") {
    $tpl = file_get_contents("templates/".$cfgrow['template']."/comment_template.html");
    }
    
// book a visitor
$datetime = date("Y-m-d H:i:s");
$cdate = $datetime; // for future posting
$host = $_SERVER['HTTP_HOST'];
$referer = $_SERVER['HTTP_REFERER'];

// don't book a referer from self
$refererhost = parse_url($referer);
$refererhost = $refererhost['host'];
if($refererhost == $host) {
    $referer = "";
    }
$ua = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
$ruri = $_SERVER['REQUEST_URI'];
// ### if cookie lastvisit not set, count the people!
if(!isset($_COOKIE['lastvisit'])) {
	$query = "insert into ".$pixelpost_db_prefix."visitors(id,datetime,host,referer,ua,ip,ruri)
	VALUES('NULL','$datetime','$host','$referer','$ua','$ip','$ruri')";
    $result = mysql_query($query);
    }
// Get visitor count
$visitors = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."visitors");
$row = mysql_fetch_array($visitors);
$pixelpost_visitors = $row['count'];
// Get number of photos in database
$photonumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where datetime<='$datetime'");
$row = mysql_fetch_array($photonumb);
$pixelpost_photonumb = $row['count'];

// images/main site
if($_GET['x'] == "" | $_GET['x'] == "category") {
// Get Current Image.
if($_GET['showimage'] == "" & $_GET['categoryid'] == "" ) {
	$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by datetime DESC limit 0,1");

	} else {
		if($_GET['categoryid'] =="" ){
			$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where (id='".$_GET['showimage']."')");
		}
		else
		{
		  if ($_GET['imageid'] != ""){    	$where = " id='" .$_GET['imageid']."' and (category='".$_GET['categoryid']."')";
		}else
        {$where = " (category='".$_GET['categoryid']."')";};
        $query = "select * from ".$pixelpost_db_prefix."pixelpost where  $where order by datetime desc";

    	$query = mysql_query($query);
    }


	}

$row = mysql_fetch_array($query);
if(!$row['image']) {
    echo "Coming Soon!";
    exit;
    }
$image_name         = $row['image'];
$image_title        = pullout($row['headline']);
$image_id           = $row['id'];
$image_datetime     = $row['datetime'];
$image_datetime_formatted = strtotime($image_datetime);
$image_datetime_formatted = date($cfgrow['dateformat'],$image_datetime_formatted);
$image_category = $row['category'];

// ramin added
$store_image_cat_id = $image_category ;
$image_date         = substr($row['datetime'],0,10);
$image_time         = substr($row['datetime'],11,5);
$image_date_year_full   = substr($row['datetime'],0,4);
$image_date_year   = substr($row['datetime'],2,2);
$image_date_month = substr($row['datetime'],5,2);
$image_date_day = substr($row['datetime'],8,2);
//changed by ramin
$image_notes        = pullout($row['body']);
list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
$image_thumbnail = "<a href='$PHP_SELF?showimage=$image_id'><img src='thumbnails/thumb_$image_name' alt='$image_title' title='$image_title' width='$local_width' height='$local_height' /></a>";
$query = mysql_query("select name from ".$pixelpost_db_prefix."categories where id='$image_category'");
$image_category = mysql_fetch_array($query);
$image_category = pullout($image_category['name']);

// get previous image id and name
if ($_GET['x'] !="category")
{$previous_query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,1");}
else
{$previous_query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,1");};


$previous_row = mysql_fetch_array($previous_query);
$image_previous_name = $previous_row['image'];
$image_previous_id = $previous_row['id'];
$image_previous_title = pullout($previous_row['headline']);
$image_previous_link = "<a href='index.php?showimage=$image_previous_id'>$lang_previous</a>";
list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
$image_previous_thumbnail = "<a href='$PHP_SELF?showimage=$image_previous_id'><img src='thumbnails/thumb_$image_previous_name' width='$local_width' height='$local_height' alt='$image_previous_title' title='$image_previous_title' /></a>";
if($image_previous_id == "") {
    $image_previous_id = $image_id;
    $image_previous_title = "$lang_no_previous";
    $image_previous_link = "";
    $image_previous_thumbnail = "";
    }


// get next image id and name


if ($_GET['x'] !="category"){
$next_query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime > '$image_datetime') and (datetime<='$cdate') order by datetime asc limit 0,1");
}
else
{$next_query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime > '$image_datetime') and (datetime<='$cdate') order by datetime asc limit 0,1");}
$next_row = mysql_fetch_array($next_query);
$image_next_name = $next_row['image'];
$image_next_id = $next_row['id'];
$image_next_title = pullout($next_row['headline']);
$image_next_link = "<a href='index.php?showimage=$image_next_id'>$lang_next</a>";
list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
$image_next_thumbnail = "<a href='$PHP_SELF?showimage=$image_next_id'><img src='thumbnails/thumb_$image_next_name' alt='$image_next_title' width='$local_width' height='$local_height' title='$image_next_title' /></a>";
if($image_next_id == "") {
    $image_next_id = $image_id;
    $image_next_title = "$lang_no_next";
    $image_next_link = "";
    $image_next_thumbnail = "";
    }

if(function_exists(gd_info)) {
    $gd_info = gd_info();
    if($gd_info != "") { // check that gd is here before this
        // thumbnail row, 5 thumbs

        if ($_GET['x'] !="category"){
        $aheadnumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where (datetime > '$image_datetime') and (datetime<='$cdate')");
        }
        else
        {$aheadnumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime > '$image_datetime') and (datetime<='$cdate')");};
        $aheadnumb = mysql_fetch_array($aheadnumb);
        $aheadnumb = $aheadnumb['count'];
        if ($_GET['x'] !="category"){
        $behindnumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where (datetime < '$image_datetime') and (datetime<='$cdate')");
        }
        else
        {$behindnumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime < '$image_datetime') and (datetime<='$cdate')");};
        $behindnumb = mysql_fetch_array($behindnumb);
        $behindnumb = $behindnumb['count'];
        $aheadlimit = round(($cfgrow['thumbnumber']-1)/2);
        $behindlimit = round(($cfgrow['thumbnumber']-1)/2);
        if($aheadnumb <= "1") {
            $behindlimit = ($cfgrow['thumbnumber']-1)-$aheadnumb;
            $aheadlimit = $aheadnumb;
            }
        if($behindnumb <= "1") {
            $aheadlimit = ($cfgrow['thumbnumber']-1)-$behindnumb;
            $behindlimit = $behindnumb;
            }
        $totalthumbcounter = 0; // will count up to four no matter what
        $ahead_thumbs = "";

// Ramin: Bug fixed from forum http://www.pixelpost.org/forum/viewtopic.php?t=328
//        $thumbs_ahead = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime > '$image_datetime') and (datetime<='$cdate') order by datetime asc limit 0,$aheadlimit");

       if ($_GET['x'] !="category"){
       $thumbs_ahead = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime >= '$image_datetime') and (datetime<='$cdate') and id!=".$image_id." order by datetime asc limit 0,$aheadlimit");
       }
       else
       {$thumbs_ahead = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime >= '$image_datetime') and (datetime<='$cdate') and id!=".$image_id." order by datetime asc limit 0,$aheadlimit");};

			if ($_GET['x'] !="category"){
	        while(list($id,$headline,$image) = mysql_fetch_row($thumbs_ahead)) {
					list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	            $ahead_thumbs .= "<a href='$PHP_SELF?showimage=$id'><img src='thumbnails/thumb_$image' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>";
	            $totalthumbcounter++;
	            }
	        $behind_thumbs = "";
	        if ($_GET['x'] !="category"){
	        $thumbs_behind = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,$behindlimit");
	        }
	        else
	        {$thumbs_behind = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,$behindlimit");};
	        while(list($id,$headline,$image) = mysql_fetch_row($thumbs_behind)) {
					list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	            $behind_thumbs = "<a href='$PHP_SELF?showimage=$id'><img src='thumbnails/thumb_$image' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>$behind_thumbs";
	            }
    			list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	        $thumbnail_row = "$behind_thumbs<a href='$PHP_SELF?showimage=$image_id'><img src='thumbnails/thumb_$image_name' alt='$image_title' title='$image_title' class='current_thumbnail' width='$local_width' height='$local_height' /></a>$ahead_thumbs";

        }else
        {
        	////
          while(list($id,$headline,$image) = mysql_fetch_row($thumbs_ahead)) {
					list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	            $ahead_thumbs .= "<a href='$PHP_SELF?x=category&categoryid=$store_image_cat_id&imageid=$id'><img src='thumbnails/thumb_$image' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>";
	            $totalthumbcounter++;
	            }
	        $behind_thumbs = "";
	        if ($_GET['x'] !="category"){
	        $thumbs_behind = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,$behindlimit");
	        }
	        else
	        {$thumbs_behind = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where category='".$store_image_cat_id ."' and (datetime < '$image_datetime') and (datetime<='$cdate') order by datetime desc limit 0,$behindlimit");};
	        while(list($id,$headline,$image) = mysql_fetch_row($thumbs_behind)) {
					list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	            $behind_thumbs = "<a href='$PHP_SELF?x=category&categoryid=$store_image_cat_id&imageid=$image_id''><img src='thumbnails/thumb_$image' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>$behind_thumbs";
	            }
     			list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	        $thumbnail_row = "$behind_thumbs<a href='$PHP_SELF?x=category&categoryid=$store_image_cat_id&imageid=$id'><img src='thumbnails/thumb_$image_name' alt='$image_title' title='$image_title' class='current_thumbnail' width='$local_width' height='$local_height' /></a>$ahead_thumbs";

        	////
        	
        }


        $tpl = ereg_replace("<IMAGE_THUMBNAIL_ROW>",$thumbnail_row,$tpl);



        } // gd_info()
    } // func exist
$tpl = ereg_replace("<IMAGE_DATE_YEAR_FULL>",$image_date_year_full,$tpl);
$tpl = ereg_replace("<IMAGE_DATE_YEAR>",$image_date_year,$tpl);
$tpl = ereg_replace("<IMAGE_DATE_MONTH>",$image_date_month,$tpl);
$tpl = ereg_replace("<IMAGE_DATE_DAY>",$image_date_day,$tpl);
$tpl = ereg_replace("<IMAGE_THUMBNAIL>",$image_thumbnail,$tpl);
$tpl = ereg_replace("<IMAGE_DATE>",$image_date,$tpl);
$tpl = ereg_replace("<IMAGE_TIME>",$image_time,$tpl);
$tpl = ereg_replace("<IMAGE_NAME>",$image_name,$tpl);
$tpl = ereg_replace("<IMAGE_TITLE>",$image_title,$tpl);
$tpl = ereg_replace("<IMAGE_DATETIME>",$image_datetime_formatted,$tpl);
$tpl = ereg_replace("<IMAGE_NOTES>",$image_notes,$tpl);
$tpl = ereg_replace("<IMAGE_ID>",$image_id,$tpl);
$tpl = ereg_replace("<IMAGE_CATEGORY>",$image_category,$tpl);
$tpl = ereg_replace("<IMAGE_PREVIOUS_LINK>",$image_previous_link,$tpl);
$tpl = ereg_replace("<IMAGE_PREVIOUS_THUMBNAIL>",$image_previous_thumbnail,$tpl);
$tpl = ereg_replace("<IMAGE_PREVIOUS_ID>",$image_previous_id,$tpl);
$tpl = ereg_replace("<IMAGE_PREVIOUS_TITLE>",$image_previous_title,$tpl);
$tpl = ereg_replace("<IMAGE_NEXT_ID>",$image_next_id,$tpl);
$tpl = ereg_replace("<IMAGE_NEXT_TITLE>",$image_next_title,$tpl);
$tpl = ereg_replace("<IMAGE_NEXT_THUMBNAIL>",$image_next_thumbnail,$tpl);
$tpl = ereg_replace("<IMAGE_NEXT_LINK>",$image_next_link,$tpl);

// get number of comments
$cnumb = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."comments where parent_id='$image_id'");
$cnumb_row = mysql_fetch_array($cnumb);
$image_comments_number = $cnumb_row['count'];

// get latest comment
$latest_comment = mysql_query("select parent_id from ".$pixelpost_db_prefix."comments order by id desc limit 0,1");
$latest_comment = mysql_fetch_array($latest_comment);
$latest_comment = $latest_comment['parent_id'];
$query = mysql_query("select headline from ".$pixelpost_db_prefix."pixelpost where id='$latest_comment'");
$queryrow = mysql_fetch_array($query);
$latest_comment_name = pullout($queryrow['headline']);

// build a string with all comments
if(($_GET['x'] == "") or ($_GET['popup'] == "comment")) {
    if($_GET['comment'] == "save") {
        $datetime = date("Y-m-d H:i:s");
        $ip = $_SERVER['REMOTE_ADDR'];
        $parent_id = $_POST['parent_id'];
        $message = clean($_POST['message']);
        $name = clean($_POST['name']);
        $url = clean($_POST['url']);
        if($parent_id == "") {
	        $extra_message = "<b>$lang_message_missing_image</b><p />";
	        }
        if($message == "") {
	        $extra_message = "<b>$lang_message_missing_comment</b><p />";
	        }
        if(($parent_id != "") and ($message != "")) {
	        $query = "insert into ".$pixelpost_db_prefix."comments(id,parent_id,datetime,ip,message,name,url)
	        VALUES('NULL','$parent_id','$datetime','$ip','$message','$name','$url')";
	        $result = mysql_query($query);
	        }
        }
// visitor information in comments
$vinfo_name = "";
$vinfo_url = "";
if(isset($_COOKIE['visitorinfo'])) {
    // do stuff
    list($vinfo_name,$vinfo_url) = split("%",$_COOKIE['visitorinfo']);
    }
$tpl = ereg_replace("<VINFO_NAME>",$vinfo_name,$tpl);
$tpl = ereg_replace("<VINFO_URL>",$vinfo_url,$tpl);

    $comment_count = 0;
    $image_comments = "<ul>"; // comments stored in this string
    if($_GET['showimage'] == "") { $imageid = $image_id; } else { $imageid = $_GET['showimage']; }
    $cquery = mysql_query("select datetime, message, name, url from ".$pixelpost_db_prefix."comments where parent_id='".$imageid."' order by id asc");
    while(list($comment_datetime, $comment_message, $comment_name, $comment_url) = mysql_fetch_row($cquery)) {
	    $comment_message = pullout($comment_message);
	    $comment_name = pullout($comment_name);
	    if($comment_url != "") {
	    	$comment_url = "http://$comment_url"; // i'm running for president...
	    	$comment_url = str_replace("http://http://","http://",$comment_url); // you see?
	    	$comment_name = "<a href='$comment_url' title='$lang_visit_homepage'>$comment_name</a>";
	    	}
	    $comment_datetime = strtotime($comment_datetime);
        $comment_datetime = date($cfgrow['dateformat'],$comment_datetime);
	    $image_comments .= "<li>$comment_message<br />$comment_name @ $comment_datetime</li>";
	    $comment_count++;
	    }
    // print out comments or a message saying there ain't no fucking comments
    if($comment_count == 0) { $image_comments .= "<li>$lang_no_comments_yet</li>"; }
    $image_comments .= "</ul>";
    $tpl = ereg_replace("<IMAGE_COMMENTS>",$image_comments,$tpl);
    if(($_GET['popup'] == "comment") AND ($_GET['x'] != "save_comment")) { echo $tpl; exit; }
    } // end if comment
} // end imageprint
// fix a popuplink

// EXIF STUFF
//if(extension_loaded(exif)) {
if(true) {
	$curr_image = "images/$image_name";
	        $exif = read_exif_data_raw($curr_image,1); 
        $exposure = $exif['SubIFD']['ExposureTime']; 
        $aperture = $exif['SubIFD']['FNumber']; 
        $capture_date = $exif['SubIFD']['DateTimeOriginal']; 
        $flash = $exif['SubIFD']['Flash']; 
        if ($flash != null && strpos($flash, "No Flash") === false) { 
                $flash = $lang_flash_fired; 
        } else { 
                $flash = $lang_flash_not_fired; 
        } 
        $focal = $exif['SubIFD']['FocalLength']; 
        $info_camera_manu = $exif['IFD0']['Make']; 
        $info_camera_model = $exif['IFD0']['Model']; 
		$iso = $exif['SubIFD']['ISOSpeedRatings']; 

        $wide = $exif['SubIFD']['MakerNote']['Settings 1']['ShortFocalLength']; 
        $long = $exif['SubIFD']['MakerNote']['Settings 1']['LongFocalLength']; 

        foreach($lenses as $l) { 
                if ($wide == $long) { 
                        if (strpos($l, " $wide"."mm") !== false) { 
                                $lens = $l; 
                                break; 
                        } 
                } 
                else if (strpos($l, "$wide-$long"."mm") !== false) { 
                        $lens = $l; 
                        break; 
                } 
        } 


    if($exposure != "") { $exposure = "$lang_exposure $exposure"; }
    if($aperture != "") { $aperture = "$lang_aperture $aperture"; }
    if($capture_date != "") { $capture_date = "$lang_capture_date $capture_date"; }
    if($focal != "") { $focal = "$lang_focal $focal"; }
    if($info_camera_manu != "") { $info_camera_manu = "$lang_camera_maker $info_camera_manu"; }
    if($info_camera_model != "") { $info_camera_model = "$lang_camera_model $info_camera_model"; }
	// ramin added
	if($iso != "") { $iso = "$lang_iso $iso"; }
	
    $tpl = ereg_replace("<EXIF_EXPOSURE_TIME>",$exposure,$tpl);
    $tpl = ereg_replace("<EXIF_APERTURE>",$aperture,$tpl);
    $tpl = ereg_replace("<EXIF_CAPTURE_DATE>",$capture_date,$tpl);
    $tpl = ereg_replace("<EXIF_FLASH>",$flash,$tpl);
    $tpl = ereg_replace("<EXIF_FOCAL_LENGTH>",$focal,$tpl);
    $tpl = ereg_replace("<EXIF_CAMERA_MAKE>",$info_camera_manu,$tpl);
    $tpl = ereg_replace("<EXIF_CAMERA_MODEL>",$info_camera_model,$tpl);
    $tpl = ereg_replace("<EXIF_LENS>",$lens,$tpl);
	$tpl = ereg_replace("<EXIF_ISO>",$iso,$tpl); 
    }

// refererlog
if($_GET['x'] == "ref") {
    $referer_print = "<ul>";
    // only count referers from the last seven days
    $from_date = mktime(0,0,0,date("m"),date("d")-7,date("Y"));
    $from_date = strftime("%Y-%m-%d", $from_date);
    $from_date = "$from_date 00:00:00";
    // get referers no
    $referer = "";
    $query = mysql_query("select distinct referer from ".$pixelpost_db_prefix."visitors where (referer!='') AND (datetime>'$from_date')");
    while(list($nreferer) = mysql_fetch_row($query)) {
        $nreferer = htmlentities($nreferer);
	    $referer .= "!".$nreferer;
    	}
    $referer = split("!",$referer);
    $ref_biglist = "";
    foreach($referer as $value) {
	    // $value holds the referer
	    if($value != "") {
	    	$query = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."visitors where (referer='$value') AND (datetime>'$from_date')");
	    	$row = mysql_fetch_array($query);
            $refnumb = $row['count'];
	    	$ref_biglist .= "$refnumb@$value!";
            }
	    }
    $ref_biglist = split("!",$ref_biglist);
    rsort($ref_biglist,SORT_NUMERIC);
    foreach($ref_biglist as $value) {
	    list($numb,$referer) = explode("@",$value);
	    if($numb > "0") {
	    	if($numb < "10") { $numb = "0$numb"; }
	    // take down the length as urls can be quite long
		$referername = $referer;

		$length = strlen($referername);
		if($length > 50) { $referername = substr($referername,0,50); $referername = "$referername..."; }
		$referer_print .= "<li><a href='$referer'>$numb     $referername</a></li>";
		}
	}
	$referer_print .= "</ul>";
    $tpl = ereg_replace("<REFERERS>",$referer_print,$tpl);
    } // end refererlog

if($_GET['x'] == "browse") {
    $thumb_output = "";
    $where = "";
    if($_GET['category'] != "") { $where = "and (category='".$_GET['category']."')"; }
    $query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') $where order by datetime desc");
    while(list($id,$title,$name) = mysql_fetch_row($query)) {
        $title = pullout($title);
        $thumbnail = "thumbnails/thumb_$name";
        $thumb_output .= "<a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
        }
    $tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
    }
    
// build browse menu
$browse_select = "<select name='browse' 
onChange='self.location.href=this.options[this.selectedIndex].value;'><option value=''>$lang_browse_select_category</option><option value='?x=browse&category='>$lang_browse_all</option>";
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
    $name = pullout($name);
    $browse_select .= "<option value='?x=browse&category=$id'>$name</option>";
    }
$browse_select .= "</select>";

// Ramin: for categories as text links 
/*
// build browse menu
$browse_select = " <a href='?x=browse'> $lang_browse_all </a><br>";
$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name");
while(list($id,$name) = mysql_fetch_row($query)) {
    $name = pullout($name);
    $browse_select .= "<a href='?x=browse&category=$id'>$name</a><br>";
    };
*/

// ##########################################################################################//
// RSS 2.0 FEED
// ##########################################################################################//
if($_GET['x'] == "rss") {
	pullout($cfgrow['sitetitle']);
	
    $output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
    <rss version=\"2.0\">
    <channel>
    <title>".$cfgrow['sitetitle']."</title>
    <link>".$cfgrow['siteurl']."</link>
    <description>".$cfgrow['sitetitle']." photoblog</description>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>pixelpost</generator>
    ";
    $query = mysql_query("select id,datetime,headline,body,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc");
    while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query)) {
        $headline = pullout($headline);
        $body = pullout($body);
        $image = $cfgrow['siteurl']."thumbnails/thumb_$image";
        
        $datetime = strtotime($datetime);
        $datetime = date("r",$datetime);
        $body = stripslashes($body);
        $body = htmlentities($body);
        $body = ereg_replace("\n","<br />",$body);
        $output .= "
        <item>
        <title>$headline</title>
        <link>".$cfgrow['siteurl']."?showimage=$id</link>
        <description><img src="$image" align="right"> $body</description>
        <pubDate>$datetime</pubDate>
        </item>
        ";
        }
    $output .= "
        </channel>
        </rss>";
    header("Content-type:application/rss+xml");
    echo $output;
    exit;
    }
// ##########################################################################################//
// ATOM FEED - re and triple check the encoding please please please
// ##########################################################################################//
if($_GET['x'] == "atom") {
    header("content-type: application/atom+xml");
    $tzone = substr(date("O"),0,3);
    $tzone = "$tzone:00";
	pullout($cfgrow['sitetitle']);
    $atom = "<?xml version='1.0' encoding='utf8'?>
    <feed
    version='0.3'
    xml:lang='en-US'
    xmlns='http://purl.org/atom/ns#'>
    <title>".$cfgrow['sitetitle']."</title>
    <link rel='alternate' type='text/html' href='".$cfgrow['siteurl']."' title='".$cfgrow['sitetitle']."' />
    <author>
    <name>".$cfgrow['sitetitle']."</name>
    <url>".$cfgrow['siteurl']."</url>
    </author>
    <generator
    url='http://www.pixelpunk.se/software/'
    version='1.3'>Pixelpost</generator>
    <modified>".date("Y-m-d\TH:i:s$tzone")."</modified>
    ";
    $query = mysql_query("select id,datetime,headline,body,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc");
    while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query)) {
        $headline = pullout($headline);
        $body = pullout($body);
        $image = $cfgrow['siteurl']."thumbnails/thumb_$image";
        $datetime = strtotime($datetime);
        $issued = $datetime;
        $tzone = substr(date("O"),0,3);
        $tzone = "$tzone:00";
        $datetime = date("Y-m-d\TH:i:s$tzone",$datetime);
        $issued = date("Y-m-d\TH:i:s$tzone",$issued);
        $atom .= "
        <entry>
        <title
            type='text/html'
            mode='escaped'>
            $headline</title>
        <link rel='alternate' 
            type='text/html' 
            href='".$cfgrow['siteurl']."?showimage=$id' 
            title='$headline' />
        <id>".$cfgrow['siteurl']."?showimage=$id</id>
        <content type='text/xhtml'>
        <img src='$image' /><br />
        $body
        </content>
        <issued>$issued</issued>
        <modified>$datetime</modified>
        </entry>
        ";
        }
    $atom .= "</feed>";
    echo $atom;
    exit;
    }
$tpl = ereg_replace("<SITE_RSS_LINK>","<a href='index.php?x=rss'>RSS 2.0</a>",$tpl);
$tpl = ereg_replace("<SITE_TITLE>",$pixelpost_site_title,$tpl);
$tpl = ereg_replace("<SITE_REFLINK>","index.php?x=ref",$tpl);
$tpl = ereg_replace("<SITE_BROWSELINK>","index.php?x=browse",$tpl);
$tpl = ereg_replace("<SITE_PHOTONUMBER>",$pixelpost_photonumb,$tpl);
$tpl = ereg_replace("<SITE_VISITORNUMBER>",$pixelpost_visitors,$tpl);
$tpl = ereg_replace("<IMAGE_COMMENTS_NUMBER>",$image_comments_number,$tpl);
$tpl = ereg_replace("<LATEST_COMMENT_ID>",$latest_comment,$tpl);
$tpl = ereg_replace("<LATEST_COMMENT_NAME>",$latest_comment_name,$tpl);
//$tpl = ereg_replace("<COMMENT_POPUP>","<a href='#' onclick=\"window.open('index.php?popup=comment&showimage=$image_id','Comments','width=480,height=540');\">$lang_comment_popup</a>",$tpl);
// Ramin changed to the modification by turnover at http://www.pixelpost.org/index.php?x=downloads&details=35
$tpl = ereg_replace("<COMMENT_POPUP>","<a href=\"index.php?popup=comment&showimage=$image_id\" onclick=\"window.open(this.href, 'Comments', 'height=540, width=480, top=10, left=10, toolbar=no, menubar=no, location=no, resizable=no, scrollbars=yes, status=no'); return false;\"><img src=\"images/inf_com.jpg\" alt=\"Infos and comments\"></a>",$tpl);
$tpl = ereg_replace("<BROWSE_CATEGORIES>",$browse_select,$tpl);

// ##########################################################################################//
// EMAIL NOTE ON COMMENTS
// ##########################################################################################//
if($cfgrow['commentemail'] == "yes") {
if($_GET['x'] == "save_comment") {
    $admin_email = $cfgrow['email'];
    $comment_name = clean($_POST['name']);
    $comment_image_id = $_POST['parent_id'];
    $comment_message = clean($_POST['message']);
    
    $link_to_comment = $cfgrow['siteurl']."?showimage=$comment_image_id";
    
    $subject = "Pixelpost - New Comment Made";
    $sent_date = date("Y-m-d");
    $sent_time = date("H:i");
$body = "Hello,\r\n
A new comment has been made at your photoblog.
$link_to_comment

The Comment is 
----------------------------------------------------------------------
$comment_message
by $comment_name
----------------------------------------------------------------------    
Email Sent by pixelpost
";

    $headers = "To: admin <$admin_email>\r\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
    $headers .= "From: PIXELPOST <$admin_email>\r\n";
    mail($recipient_email,$subject,$body,$headers);
    }
} // commentemail yes
// ##########################################################################################//
// SAVE COMMENT
// ##########################################################################################//
if($_GET['x'] == "save_comment") {
$datetime = date("Y-m-d H:i:s");
$ip = $_SERVER['REMOTE_ADDR'];
$parent_id = $_POST['parent_id'];
$message = clean($_POST['message']);
$name = clean($_POST['name']);
$url = clean($_POST['url']);
if($parent_id == "") {
	$extra_message = "<b>$lang_message_missing_image</b><p />";
	}
if($message == "") {
	$extra_message = "<b>$lang_message_missing_comment</b><p />";
	}
if(($parent_id != "") and ($message != "")) {
	$query = "insert into ".$pixelpost_db_prefix."comments(id,parent_id,datetime,ip,message,name,url)
	VALUES('NULL','$parent_id','$datetime','$ip','$message','$name','$url')";
	$result = mysql_query($query);
	}
?>
<!-- pixelpost saving comment -->
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title><?php echo $lang_comment_page_title; ?></title>
<!-- meta -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- no meta -->
<style type="text/css">
body {
    font-family:Helvetica, Verdana, sans-serif;
    text-align:center;
    margin:40px 0px;
    font-size:12px;
    }
a {
    text-decoration:none;
    color:#444;
    }
a:hover {
    background:#f5f5f5;
    }
</style>
</head>
<body>

<?php
echo "$lang_comment_thank_you<p />$extra_message";
if(!$_GET['popup']) {
    echo "<a href='index.php?showimage=$parent_id'>$lang_comment_redirect</a>";
        } else {
        echo "<a href='index.php?popup=comment&showimage=$parent_id'>$lang_comment_redirect</a>";
        }
    echo "</body></html>";
    }

// ##########################################################################################//
// SUCK IN ADDONS
// ##########################################################################################//
// addons read in, please get this straighten out
$dir = "addons/";
if($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if($file != "." && $file != "..") {
            $ftype = strtolower(end(explode('.', $file)));
            if($ftype == "php") {
                include($dir.$file);
                }
            }
        }
    closedir($handle);
    }
// done

// ##########################################################################################//
// END - ECHO TEMPLATE
// ##########################################################################################//
// spit it out unless its a special case like comment included here
// script is getting ugly, i dont like those hacks
if($_GET['x'] != "save_comment") {
    echo $tpl;
    }
    
// ##########################################################################################//
// functions
// ##########################################################################################//
function clean($string) {
    $string = utf8_encode($string);
	$string = addslashes($string);
    return $string;
	}
function pullout($string) {
	$string = stripslashes($string);
	$string = utf8_decode($string);
	//$string = nl2br($string);
	return $string;
	}
?>
and this a little changed category_links.php
Code:
<?php
/*

Requires Pixelpost version 1.3
Category List of Links (vertical)
Written by: Ramin Mehran
Contact: raminia@yahoo.com 


Pixelpost www: http://www.pixelpunk.se/software/
License: http://www.gnu.org/copyleft/gpl.html

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

$addon_name = "Category List of Links";
$addon_description = "This addon will enables the tags:<br>
 <CATEGORY_LINKS_AS_LIST> :A vertical List of category names with link to each and number of photos in it (normal pixelpost).
<br>
 <CATEGORY_LINKS_AS_LIST_NOBROWSE><br>
 A vertical List of category names with link to each and number of photos in it with category priority (modified pixelpost 1.3).
  <CATEGORY_LINKS_AS_LIST_NOBROWSE_hr><br>
  A horizontal version of the above.";
 

$addon_version = "0.1";

	// Get the number of thumbnails shown at once from the admin config
	$cfgquery = mysql_query("select * from ".$pixelpost_db_prefix."config");
	$cfgrow = mysql_fetch_array($cfgquery);

	//---------------------------
	
	$browse_select = " <a href='?x=browse'> $lang_browse_all </a><br>"; 
	$query = mysql_query("select * from ".$pixelpost_db_prefix."categories order by name"); 
	while(list($id,$name) = mysql_fetch_row($query)) { 
        $count = mysql_query("select count(*) as count from ".$pixelpost_db_prefix."pixelpost where category=".$id);
        $count = mysql_fetch_array($count);
        $count= $count['count'];
		    $name = pullout($name); 

		    $catname_count = $name ." (" .$count .")";

    		$category_Link_List .= "<a href='?x=browse&category=$id'>$catname_count</a><br>"; 
    		$category_Link_List_noBrowse .= "<a href='?x=category&categoryid=$id'>$catname_count</a><br>"; 
    		$category_Link_List_noBrowse_hr .= " <a href='?x=category&categoryid=$id'>$catname_count</a>"; 
    };


  $tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
  $tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST_NOBROWSE>",$category_Link_List_noBrowse,$tpl);
  $tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST_NOBROWSE_hr>",$category_Link_List_noBrowse_hr,$tpl);
	    

?>
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #27  
Old 02-15-2005, 08:31 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
sorry for bugs, I'm posting it as it cames out of oven and that's the result.
replace line 278 to 291 of the last post's index.php with this one
Code:
list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	            $behind_thumbs = "<a href='$PHP_SELF?x=category&categoryid=$store_image_cat_id&imageid=$id''><img src='thumbnails/thumb_$image' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>$behind_thumbs";
	            }
     			list($local_width,$local_height,$type,$attr) = getimagesize("thumbnails/thumb_$image_name");
	        $thumbnail_row = "$behind_thumbs<a href='$PHP_SELF?x=category&categoryid=$store_image_cat_id&imageid=$image_id'><img src='thumbnails/thumb_$image_name' alt='$image_title' title='$image_title' class='current_thumbnail' width='$local_width' height='$local_height' /></a>$ahead_thumbs";
ok ... bye for now
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #28  
Old 02-15-2005, 08:36 PM
-okapi-'s Avatar
-okapi- Offline
pixelpost guru
 
Join Date: Feb 2005
Location: Vienna, Austria
Posts: 252
doesn't work yet for me.
all i get is a blanc screen.

by the way, the local server invironment that i'm using is MSAS (mambo standanlone server). a single exe, two other files, one folder. absolutely no installation. can even be taken along with an usb stick. i love it.
__________________
a visual notebook
michael singer photography
http://www.a-visual-notebook.at
Reply With Quote
  #29  
Old 02-15-2005, 08:44 PM
-okapi-'s Avatar
-okapi- Offline
pixelpost guru
 
Join Date: Feb 2005
Location: Vienna, Austria
Posts: 252
no way for me yet to get it working...

could you please post a download link for the index.php that is working with your site?
__________________
a visual notebook
michael singer photography
http://www.a-visual-notebook.at
Reply With Quote
  #30  
Old 02-15-2005, 08:48 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
nice local server!
I use Abyss web server. I search for a webserver under windows (not IIS!) and I downloaded the first one

you see a blank page with no message? even a "comming soon!" message?
Strange!
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 03:07 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs