View Full Version : browsing a specific category?
-okapi-
02-15-2005, 10:58 AM
after raminia's fabulous work i feel encouraged to ask another question...
(please don't bite my head off)
what could actually be done to enable visitors to browse only one specific category? i mean, without having to go back to the archive each time and choosing the desired category again and clicking a thumbnail.
what, if there were links to categories (one or more, or a dropdown field) right on the image_template page, and one could browse continuously through a choosen category via the navigation thumbs, until other selection?
an example:
let's say i have 600 photos in total. 300 in the category "animals", and 300 in the category "people". what, if i want to browse only "animals" for a while, without going back to the archive all the time?
but maybe this would be asked a little bit too much, and couldn't be done without touching the core code...?
raminia
02-15-2005, 12:36 PM
;)
Did you see this thread?
http://www.pixelpost.org/forum/viewtopic.php?t=403
I've made the following addon from the code I wrote there but I don't put it in the addon section now. Copy/paste the following code in an empty php file and use this addon and tell me what's ur opinion about.
$addon_name = "Category List of Links";
$addon_description = "This addon will enables the tag &ltCATEGORY_LINKS_AS_LIST>
A vertical List of category names with link to each.";
$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)) {
$name = pullout($name);
$category_Link_List .= "<a href='?x=browse&category=$id'>$name</a><br>";
};
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
Zlato
02-15-2005, 12:54 PM
Hi Ramin ! Great achievement ! in addition to this I've tried to add a count of pictures by category, but something goes wrong, the statement in Mysql is good but i miss something in PHP.
So it will look like
cat1 (12)
cat2(7)
cat3(0)
and so on...
can you help :oops:
Regards
raminia
02-15-2005, 01:16 PM
partial answer
modify the index.php at about line 113
// images/main site
if($_GET['x'] == "" ) {
// Get Current Image.
if($_GET['showimage'] == "" ) {
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by datetime DESC limit 0,1");
} else {
if($_GET['categoryid'] =="" ){
echo $_GET['categoryid'];
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where (id='".$_GET['showimage']."')");
}
else
{
$where = " (category='".$_GET['categoryid']."')";
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where $where order by datetime desc");
}
}
and use this new addon
<?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 tag &ltCATEGORY_LINKS_AS_LIST&gt;
A vertical List of category names with link to each.";
$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)) {
$name = pullout($name);
$category_Link_List .= "<a href='?showimage=0&categoryid=$id'>$name</a><br>";
};
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
?>
and then write some code to produce thumbnails according to the category id. (it's simple)
but in this way this would not be a photoblog anymore but just a photo album!
-okapi-
02-15-2005, 01:58 PM
you're amazing me again...
i can't test your code right now, but actually i'm not sure, if i have found the right words to express exactly what i want to achieve:
let me try it in other words:
i want to temporarily modify the behaviour of the (four) navigation thumbs (image_template) in that way, that, if enabled, thumbnail navigation in only one specific category is available. a "back" button or a "view all" button should disable this functionality.
just to be able to browse through one category via the thumbnail navigation of the main page, not to have to go to the archive page again and again.
raminia
02-15-2005, 02:03 PM
this need a hack on index.php almost very deep!
raminia
02-15-2005, 02:04 PM
Hi Ramin ! Great achievement ! in addition to this I've tried to add a count of pictures by category, but something goes wrong, the statement in Mysql is good but i miss something in PHP.
So it will look like
cat1 (12)
cat2(7)
cat3(0)
and so on...
can you help :oops:
Regards
This is for you.
download it from the addon section
http://www.pixelpost.org/index.php?x=downloads&details=42
I give up! I have to do some work on my MSc project but I'm facinated by PHP coding.... I give up for now and I'll go do some research on my thesis subject....;)
Zlato
02-15-2005, 03:12 PM
Another time to say T-H-A-N-K-S, i know, it's not enough, but how can I do some more ?
You're my best.
Hope i could help you one day or another (not with PHP at the moment, i think, but i'll try to become better and better...)...
:D
Alexander Zlatogorov
-okapi-
02-15-2005, 03:25 PM
ramin, you did it again!
you made me happy!
:)
the latest updates of random thumbnails and random image work perfectly!
i think these addons mean a great encrease of flexibility for pixelpost users again.
thank you for spending your time, your knowledge and your energy to create features for pixelpost, we photobloggers are longing for...!
---
just a note:
for me random image works fine with:
<a href='index.php?showimage=<IMAGE_RANDOM>'>Random photo</a>
but not with:
<a href='$PHP_SELF?showimage=<IMAGE_RANDOM>' >Random photo</a>
---
thanks again,
michael
-okapi-
02-15-2005, 04:58 PM
this need a hack on index.php almost very deep!
i think, this would be definitly not worth the effort, if it can't be done as an addon.
but you know, people always want some more... ;)
Zlato
02-15-2005, 06:51 PM
Hello again Ramin, i have a strange behaviour ( I'm really an idiot I know !) concerning the addon, it works well :D , but the category "All" has disappeared ?
http://www.zlatogorov.com/pixelpost/index.php?x=browse
I've searched in your coding and don't see nothing that can explain this...
And good luck for your thesis ( I know, I know, it's not luck, only working 24/7, i knew that .. :wink: )
-okapi-
02-15-2005, 07:00 PM
@Zlato:
for me it hasn't disappeared... it's there.
?
Zlato
02-15-2005, 07:19 PM
Hi Michael,
by the way i like your site and it is in my favourites for weeks... i didn't point this, reading your posts...
Ok, ok it's obvious i'm an idiot ! :oops: i have paste the Ramin addon in index.php and put as usual the tag <CATEGORY_LINKS_AS_LIST> in my browse_template.html, what is wrong ?
here is the index.php part where i includ the addon
// ################################################## ########################################//
// BUILDING ARCHIVE MENU - BY CATEGORY AS COMBO BOX
// ################################################## ########################################//
// build archive menu /* WITH COMBO BOX
$thismonth = date("Y-m");
$select_display_thismonth=date("F, Y",strtotime($thismonth."-01"));
$archive_select = "<select name='archive'
onChange='self.location.href=this.options[this.sel ectedIndex].value;'><option value=''>Archives by Date</option><option value='?x=browse&amp;archivedate=$thismonth'>$select_display_thismonth</option>";
$query = mysql_query("select DISTINCT DATE_FORMAT(datetime, '%Y-%m') from ".$pixelpost_db_prefix."pixelpost order by datetime desc");
while(list($thedate) = mysql_fetch_row($query)) {
if ($thedate == $thismonth) {continue;}
$select_display_date=date("F, Y",strtotime($thedate."-01"));
$archive_select .= "<option value='?x=browse&amp;archivedate=$thedate'>$select_display_date</option>";
}
$archive_select .= "</select>";
// ################################################## ########################################//
// ADD-ON - THANX TO RAMINIA ! / LIST BY CATEGORY + COUNT OF PICS IN EACH CATEGORY
// ################################################## ########################################//
$addon_name = "Category List of Links";
$addon_description = "This addon will enables the tag &lt;CATEGORY_LINKS_AS_LIST&gt;
A vertical List of category names with link to each and number of photos in it.";
$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 .= "<a href='?showimage=0&categoryid=$id'>$catname_count</a><br>";
};
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
Thank You if you can help... :D
raminia
02-15-2005, 07:30 PM
maybe there is a variable confusion. two variables with the same name....
raminia
02-15-2005, 07:32 PM
this need a hack on index.php almost very deep!
i think, this would be definitly not worth the effort, if it can't be done as an addon.
but you know, people always want some more... ;)
done with deep hach of index.php and failed to do it with addon.
index.php
<?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_formatt ed);
$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=$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','$mes sage','$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 &nbsp;&nbsp;&nbsp; $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.sel ectedIndex].value;'><option value=''>$lang_browse_select_category</option><option value='?x=browse&amp;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&amp;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","&lt;br /&gt;",$body);
$output .= "
<item>
<title>$headline</title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description>&lt;img src=&quot;$image&quot; align=&quot;right&quot;&gt; $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&amp;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&amp;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','$mes sage','$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 updated category_links addon with added new tag for this very purpose.
<?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 tag &lt;CATEGORY_LINKS_AS_LIST&gt;
A vertical List of category names with link to each and number of photos in it.";
$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>";
};
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST_NOBROWSE>",$category_Link_List_noBrowse,$tpl);
?>
place <CATEGORY_LINKS_AS_LIST_NOBROWSE> in your template where you want the category list without brosing feature apear. This special tag links to the main page for a special category. Then the main page appears with the latest image of the specified category and the thumb row shows the previose and next series of images in the same category with link are changed navigate through categories only. To come out of this mode you could use home link.
I made it but I don't like my code.
Ramin
Zlato
02-15-2005, 07:33 PM
Thanks and look your private mesagery...
raminia
02-15-2005, 07:37 PM
I'll coment on that later but in few words
1) I added a new x=category option and this point to the main page but with category priority.
2) links to main page with category priority should be like this
index.php?x=category&categoryid=3
3) in every query to DB I checked if there is a category priority or not. If so I added a "where" command for the selected category
4) Links in the generated thumbnail row is also affected by category priority and they are managed as described in 1
-okapi-
02-15-2005, 07:47 PM
Hi Michael,
by the way i like your site and it is in my favourites for weeks... i didn't point this, reading your posts...
Ok, ok it's obvious i'm an idiot ! :oops: i have paste the Ramin addon in index.php and put as usual the tag <CATEGORY_LINKS_AS_LIST> in my browse_template.html, what is wrong ?
here is the index.php part where i includ the addon
// ################################################## ########################################//
// BUILDING ARCHIVE MENU - BY CATEGORY AS COMBO BOX
// ################################################## ########################################//
// build archive menu /* WITH COMBO BOX
$thismonth = date("Y-m");
$select_display_thismonth=date("F, Y",strtotime($thismonth."-01"));
$archive_select = "<select name='archive'
onChange='self.location.href=this.options[this.sel ectedIndex].value;'><option value=''>Archives by Date</option><option value='?x=browse&amp;archivedate=$thismonth'>$select_display_thismonth</option>";
$query = mysql_query("select DISTINCT DATE_FORMAT(datetime, '%Y-%m') from ".$pixelpost_db_prefix."pixelpost order by datetime desc");
while(list($thedate) = mysql_fetch_row($query)) {
if ($thedate == $thismonth) {continue;}
$select_display_date=date("F, Y",strtotime($thedate."-01"));
$archive_select .= "<option value='?x=browse&amp;archivedate=$thedate'>$select_display_date</option>";
}
$archive_select .= "</select>";
// ################################################## ########################################//
// ADD-ON - THANX TO RAMINIA ! / LIST BY CATEGORY + COUNT OF PICS IN EACH CATEGORY
// ################################################## ########################################//
$addon_name = "Category List of Links";
$addon_description = "This addon will enables the tag &lt;CATEGORY_LINKS_AS_LIST&gt;
A vertical List of category names with link to each and number of photos in it.";
$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 .= "<a href='?showimage=0&categoryid=$id'>$catname_count</a><br>";
};
$tpl = ereg_replace("<CATEGORY_LINKS_AS_LIST>",$category_Link_List,$tpl);
Thank You if you can help... :D
thank you for your words to my site!
unfortunately i don't understand the code posted above...?
seems to be a kind of code medley ;)
you have copy the file "category_links.php" into your "addons" folder.
then put " <CATEGORY_LINKS_AS_LIST>" into image_template where you want to have it to appear. this should now call the function.
unfortunately it doesn't work for me either. it always links only to the default category, ignoring the others. but i'm sure, this problem will be solved in no time...!
sorry, maybe this hasn't been a big help for you now...
don't worry, i am what you call an i...t too!
:lol: :lol:
Zlato
02-15-2005, 08:00 PM
yet i've done like you say : put ramin's addon in addons folder and the tag in my template but no changes ...
But the night is long and i will found sooner or....very later :wink:
or maybe never :roll:
Zlato
02-15-2005, 08:03 PM
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 ? :oops:
raminia
02-15-2005, 08:03 PM
forgot to tell. If you wanna see this category photoblog you can see my blog now it is installed there!
Zlato
02-15-2005, 08:06 PM
Another great job here, i will try further on my site... :wink:
raminia
02-15-2005, 08:07 PM
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 ? :oops:
there is no "all" category. to count all you should eliminate the "where category=" form mysql query.
-okapi-
02-15-2005, 08:13 PM
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!
raminia
02-15-2005, 08:14 PM
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....
;)
raminia
02-15-2005, 08:17 PM
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
<?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_formatt ed);
$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','$mes sage','$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 &nbsp;&nbsp;&nbsp; $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.sel ectedIndex].value;'><option value=''>$lang_browse_select_category</option><option value='?x=browse&amp;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&amp;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","&lt;br /&gt;",$body);
$output .= "
<item>
<title>$headline</title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description>&lt;img src=&quot;$image&quot; align=&quot;right&quot;&gt; $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&amp;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&amp;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','$mes sage','$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
<?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>
&lt;CATEGORY_LINKS_AS_LIST&gt; :A vertical List of category names with link to each and number of photos in it (normal pixelpost).
<br>
&lt;CATEGORY_LINKS_AS_LIST_NOBROWSE&gt;<br>
A vertical List of category names with link to each and number of photos in it with category priority (modified pixelpost 1.3).
&lt;CATEGORY_LINKS_AS_LIST_NOBROWSE_hr&gt;<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);
?>
raminia
02-15-2005, 08:31 PM
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
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;)
-okapi-
02-15-2005, 08:36 PM
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.
-okapi-
02-15-2005, 08:44 PM
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?
raminia
02-15-2005, 08:48 PM
nice local server!
I use Abyss web server. I search for a webserver under windows (not IIS!) and I downloaded the first one:D
you see a blank page with no message? even a "comming soon!" message?
Strange!
raminia
02-15-2005, 08:52 PM
Those two php files are packed here;)
www.raminia.com/temp/index.zip
-okapi-
02-16-2005, 04:36 AM
good morning, ramin!
thank you!
i know now, why it didn't work for me...
it was due to the exif stuff:
require_once("exifer/exif.php");
because i have no folder "exifer" and no "exif.php".
so i commented it out to get the index.php working. the same with:
// 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);
}
but now it works!
a big thank you for your hard work!
i'm really happy with it, because now pixelpost works as a photoblog as well as a gallery. this is unique. i don't think that there's another software that can do this.
but why did you actually say, you didn't like your code?
---
btw:
<CATEGORY_LINKS_AS_LIST_NOBROWSE>
gets me a category and takes me to the archive
<CATEGORY_LINKS_AS_LIST_NOBROWSE_hr>
gets a me category and shows the images on the image_template, exactly as requested and as it works on your site too.
it that ok?
have a nice day!
michael
-okapi-
02-16-2005, 04:51 AM
me again... ;)
ramin, would it produce problems if your hack gets combined with Theron Parlin's one? (it's because i wouldn't like to miss the <THISMONTH> tag):
/*This is a hacked version of pixel post with added features such as
archives by date, and various new tags such as:
<IMAGE_THUMBNAIL_NOLINK> // for use in comment template
<ARCHIVES> // New archive functionality
<THISMONTH> // link for archives page, <a href="<THISMONTH>">Archives</a>
<ARCHIVEDATE> // Show the date for the current archive being viewed
<THISMONTH> // Used to build the select drop down
<IMAGE_CATEGORY_LINK> // For showing and linking to the category of a
picture on the home page
Also added the inclusion of an about page, can be used like this:
<a href="index.php?x=about">About + Links</a>
To see this all in action, view my blog at http://www.thoughtmechanics.com/photos/
Theron Parlin
tparlin@ctjive.com*/
before i mess up everything, i thought it would be better to ask you...
Connie
02-16-2005, 05:12 AM
dear OKAPI,
just one question: please don't demand too much, or be very aware of what you change in the index-file, how will you be able to update Pixelpost at the next release-update without problems?
I fear if the index.php is modified so much, an update will not be possible without problems, I fear that many people will cry "It's not working anymore..." :(
just one reminder or suggestion ;=)
-okapi-
02-16-2005, 05:34 AM
hi connie,
i absolutely agree with you. i'm aware of this.
when ramin said, the latest functionality couldn't be made as an addon, i knew that this could cause problems for the future.
but now, as it is done... i really like it. ramin did a great job!
what you say is true for every hack of the core code. people should be careful with it.
raminia
02-16-2005, 05:50 AM
me again... ;)
ramin, would it produce problems if your hack gets combined with Theron Parlin's one? (it's because i wouldn't like to miss the <THISMONTH> tag):
I didn't see that before. If you want them both I think you need to hak Parlin's code to be able to do that or atleast copy paste and modify the code.
About the code and why I told I don't like it:
It's bulky and non-modular and full of "If statements", no comments.
It would have problems with compatibility but I think the next version of pixel post should consider all modification of this period and decided to add which modification to the official pixelpost.
cheers,
Ramin
raminia
02-16-2005, 05:56 AM
BTW, My mod could be an add-on but the addon will be similar to the most of index.php!!!
raminia
02-16-2005, 06:11 AM
---
btw:
<CATEGORY_LINKS_AS_LIST_NOBROWSE>
gets me a category and takes me to the archive
<CATEGORY_LINKS_AS_LIST_NOBROWSE_hr>
gets a me category and shows the images on the image_template, exactly as requested and as it works on your site too.
it that ok?
have a nice day!
michael
NO it's not ok! Both of them here act the same and only the category list appearnce differs.
This is was I put in the addon
$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>";
u see the both have the same code without <br>
raminia
02-16-2005, 06:28 AM
I didn't see that before. If you want them both I think you need to hak Parlin's code to be able to do that or atleast copy paste and modify the code.
some modification in the where statement in my mod could make it similar to Theron's
These are the Theron's codes that should be considered for that purpose (almost all)
if($_GET['x'] == "browse") {
$thumb_output = "";
$where = "";
$archivedate = "";
if($_GET['category'] != "") { $where = "and (category='".$_GET['category']."')"; }
if($_GET['archivedate'] != "") {
$where = "and (DATE_FORMAT(datetime, '%Y-%m')='".$_GET['archivedate']."')"; //DATE_FORMAT(foo, '%Y-%m-%d')
}
$query = mysql_query("select id,headline,image, datetime from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') $where order by datetime desc");
$thumb_output .= "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>";
$i = 0;
while(list($id,$title,$name, $mydate) = mysql_fetch_row($query)) {
$i++;
$title = pullout($title);
$thumbnail = "thumbnails/thumb_$name";
$mydate = date("F d, Y",strtotime($mydate));
$thumb_output .= "<td align=\"center\"><a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a><br />$title<br />$mydate</td>";
if ($i == 5) {$i=0; $thumb_output .= "</td></tr><tr><td align=\"center\">";}
}
$thumb_output .= "</td></tr></table>";
$tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
}
$tpl = ereg_replace("<ARCHIVES>",$archive_select,$tpl);
$tpl = ereg_replace("<THISMONTH>","index.php?x=browse&amp;archivedate=".$thismonth,$tpl);
if($_GET['archivedate'] != "") { $displaydate=date("F, Y",strtotime($_GET['archivedate']."-01")); $tpl = ereg_replace("<ARCHIVEDATE>","Archives for " . $displaydate,$tpl); }
-okapi-
02-16-2005, 08:16 AM
---
btw:
<CATEGORY_LINKS_AS_LIST_NOBROWSE>
gets me a category and takes me to the archive
<CATEGORY_LINKS_AS_LIST_NOBROWSE_hr>
gets a me category and shows the images on the image_template, exactly as requested and as it works on your site too.
it that ok?
have a nice day!
michael
NO it's not ok! Both of them here act the same and only the category list appearnce differs.
This is was I put in the addon
$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>";
u see the both have the same code without <br>
yes, this is what i assumed. nonetheless <CATEGORY_LINKS_AS_LIST_NOBROWSE> takes me to the archive. i'll have a deeper look at it in the evening...
thanks anyway!
-okapi-
02-16-2005, 08:45 AM
BTW, My mod could be an add-on but the addon will be similar to the most of index.php!!!
oh, well...!
just a question... considering future upgrades, wouldn't an addon, if it can be done, always be a better choice? on the other hand, addons are written for the current version, they presumptively won't work with future versions...?
i think this last mod is a very useful feature, it would be great, if the developpers consider implementing it in the next version...
i hope, that with future versions one could at least keep the database...
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.