Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Integrating Plogger into sNews...  (Read 26093 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Integrating Plogger into sNews...
« on: May 16, 2006, 06:44:08 PM »

Okidoki... I know most of you know this or could easily find out and then do it, but I have gotten a few mails about how to integrate the Plogger gallery into snews, so I posted how I did on my little site: http://p-ahlqvist.com/home/integrating_plogger_into_snews/

I just wanted to tell those who didn't know ;)


UPDATING THIS POST - 06 11 28 due to questions on integrating Plogger into version 15RC3...

THIS IS REGARDING INTEGRATING PLOGGER INTO A SPECIFIC TEMPLATE 
NAMELY: http://p-ahlqvist.com/snews_15/morph/
- But the concept is the same in whatever template this is used...

Ok, I've mailed you Nazboy -Bart, and I'll post here aswell so others can read what you've gotten to know... Hehe, if anyone would ever understand my writing :)

Now lets see. Check if you did all these steps:

1. Created a copy of index.php (place it inside plogger folder)
2. Made appropriate changes such as entering correct path to snews.php (eg: ../snews.php)
3. Inserted the <?php include("gallery.php"); ?> in the top of file and the <?php the_gallery_head(); ?> inside head tag and finally <?php the_gallery(); ?> in the center class. (or centerwide class in this case)

Then it should work. In you're index file (which now should be a copy, that is an  index.php placed inside plogger directory) there are some errors.
Error nr 1
Quote
<? session_start();
include ("snews.php");
should be:
Quote
<? session_start();
include ("../snews.php");
If your plogger is placed in a subfolder to you're snews site, which it should be.

Error nr 2 is that the center function which in your file looks like this:
Quote
<? if (get_id('article') == "" AND get_id('category') == "" AND get_id('archives') <> "contact" AND $_GET['action'] == "") {?>
                <div id="center"> <?php center();?>
<?php the_gallery(); ?>
                    <h3 class="sidetitle2"></h3>
                    <p></p>
                </div>
                <? }else{ ?>
                <div id="centerwide">
        <h3 class="sidetitle_cat">
            <div id="breadcrumbs">
            <? breadcrumbs(); ?>
            </div></h3>
           
            <?php center(); ?>
        </div>
                <? } ?>
That is still having the centerfunction alongside with the gallery. Remove that red marked function, and possibly the center class altogether so that the gallery is in the centerwide mode, like this:
Quote
<div id="content">
    <div class="holder">
        <div class="header" >
            <div class="searchbox">
            <? searchform(); ?>
            </div>
                <p>An sNews version 1.5 template</p>
            <div id="menu">   
                <ul> <?php pages(); ?></ul>
            </div>
        </div>   
       
        <div class="subheader">
            <div id="menu2">
            <ul><?php categories(); ?></ul>
            </div>
        </div>
       
        <div id="left">       
            <h3 class="sidetitle1">New, past, Comments:</h3>       
            <h2>New Articles: </h2>
            <ul><?php menu_articles(0, 3); ?></ul>
            <h2>Past Articles: </h2>
            <ul><?php menu_articles(3, 3); ?></ul>
            <h2>New Comments: </h2>
            <ul><?php new_comments(3,20); ?></ul>
        </div>
 
        <div id="centerwide">
            <h3 class="sidetitle_cat"><div id="breadcrumbs">
            <? breadcrumbs(); ?></h3>                                   
        <h3 class="sidetitle2">Gallery</h3>
            <?php the_gallery(); ?>
        </div>

     
    <div id="clearfooter"></div>
    </div>
    </div>
            <div id="footer">
              <p><a href="http://www.webstandards.org/upgrade/" title="Download a browser that complies with Web standards.">web standards</a> -
    <a href="http://p-ahlqvist.com/snews_15/sweden/rss/" title="RSS Feed is still offline">RSS Feed</a> -
    <a href="http://jigsaw.w3.org/css-validator/check/referer" title="Validate CSS">CSS</a> -
    <a href="http://validator.w3.org/check/referer" title="Validate XHTML">XHTML</a> - Powered by
    <a href="http://snews.solucija.com/" title="Single file CSS and XHTML valid CMS">sNews
    </a>
© Copyright 2006
    <a href="http://p-ahlqvist.com/" title="p-ahlqvist.com">p-ahlqvist.com</a> - All rights
    reserved. - <?php login_link(); ?>
            </p>     
        </div>
Here the only thing between header, menu systems and footer is in fact the gallery.

So, again,  your file structure should be like this:

snews folder
      |
         index.php
        snews.php
        and all the rest in snews install such as CSS-, images-, img folders and .htaccess
                       |
                       (AS A FOLDER WITHIN SNEWS FOLDER)
                                                             - plogger folder (With all it's content)
                                                                          |
                                                                            HERE you place a an actual copy of the snews index file !!!
                                                                            In this file you put this (delete to original plogger index.php):

Quote
<?php include("gallery.php"); ?>
<? session_start();
include ("../snews.php[/b]");   ----- HEY, CORRECT PATH !!!
ob_start("ob_gzhandler"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <?php the_gallery_head(); ?>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="Content-Language" content="English" />
    <meta name="Author" content="Patric Ahlqvist" />
    <meta name="Robots" content="index,follow" />
    <meta name="Description" content="A site based on sNews single file CMS - Design Patric Ahlqvist" />
    <meta name="Keywords" content="snews, simple, cms, css, xhtml, valid" />
    <? title(); ?>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss/" />
    <!-- Following is here due to IE's incapabilities to hover as it should, read more: http://www.xs4all.nl/~peterned/csshover.html -->
        <title>paginabart</title>
    </head>
<body>

    <div id="content">
    <div class="holder">
                <div class="header">
                    <div class="searchbox">
                        <? searchform(); ?></div>
                    <p><font class="header" color="#7d7d7d">Bart en Klaudia Ingelaere-Vanackere</font></p>
                    <div id="menu">
                        <ul>
                            <?php pages(); ?>
                        </ul>
                    </div>
                </div>
                <div class="subheader">
            <div id="menu2">
            <ul><?php categories(); ?></ul>
            </div>
           
        </div>
                <div id="left">       
            <h3 class="sidetitle1">Berichten:</h3>       
            <h2>Nieuwe:</h2>
            <ul><?php menu_articles(0, 3); ?></ul>
            <h2>Oude:</h2>
            <ul><?php menu_articles(3, 3); ?></ul>
            <h2>Reakties:</h2>
            <ul><?php new_comments(3,20); ?></ul>
        </div>

        <div id="centerwide">
            <h3 class="sidetitle_cat"><div id="breadcrumbs">
            <? breadcrumbs(); ?></h3>                                   
        <h3 class="sidetitle2">Gallery</h3>

            <?php the_gallery(); ?>
        </div>

       

<div id="clearfooter"></div>
    </div>
    </div>
            <div id="footer">
              <p><a href="http://www.webstandards.org/upgrade/" title="Download a browser that complies with Web standards.">web standards</a> -
    <a href="http://p-ahlqvist.com/snews_15/sweden/rss/" title="RSS Feed is still offline">RSS Feed</a> -
    <a href="http://jigsaw.w3.org/css-validator/check/referer" title="Validate CSS">CSS</a> -
    <a href="http://validator.w3.org/check/referer" title="Validate XHTML">XHTML</a> - Powered by
    <a href="http://snews.solucija.com/" title="Single file CSS and XHTML valid CMS">sNews
    </a>
© Copyright 2006
    <a href="http://p-ahlqvist.com/" title="p-ahlqvist.com">p-ahlqvist.com</a> - All rights
    reserved. - <?php login_link(); ?>
            </p>
           
        </div>
   
</body>
</html>
And now you should have a page like (I say like as I haven't done it to work all the way, just an example) example two undernieth:
Example 1 (in center mode with side columns - Nono ;) ):
index with all side columns which isn't good as the plogger needs more width to present the bigger images.

Example 2 (in the centerwide mode, Yesyes ;) ):
index with all extras gone (same as the content of post)

Patric.

Regards - Patric.
« Last Edit: September 20, 2009, 11:12:47 AM by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

Mikhail

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
    • http://trustme.tk
Integrating Plogger into sNews...
« Reply #1 on: May 21, 2006, 03:26:31 AM »

I have installed plogger and successfully integrated him (or her :)), but have "small" trouble,-when I'm click on image in thumb view to make him bigger(image) I receiving that message: "Forbidden
You don't have permission to access /gallery/images/gallery/fotos/candle-screenshot.jpg on this server." ,maybe I need smth like .htaccess file,any ideas.Thanks in advance.
P.S.Here is my problem
Logged

ketut

  • Full Member
  • ***
  • Karma: 0
  • Posts: 115
    • Book Bali Hotels
Integrating Plogger into sNews...
« Reply #2 on: May 21, 2006, 04:51:33 AM »

yes, conflict with .htaccess (snews), I am sure! because I also got that problem!

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Integrating Plogger into sNews...
« Reply #3 on: May 21, 2006, 09:16:46 AM »

Mhm... I haven't got that problem. And I haven't changed a bit...
Logged
"It's only dead fish that goes with the flow... "
Updated

Mikhail

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
    • http://trustme.tk
Integrating Plogger into sNews...
« Reply #4 on: May 21, 2006, 11:31:54 PM »

maybe because they are both using mod rewrite,and its depend on server config,Ill try on the other server ^^,and post results here if it would helpfully for someone,maybe in the future.Also I know that bramsyuur is very hardskilled in .htaccess things.

P.S. I have reinstalled plogger and... it's ok,all good and fully functional,but described problem is interesting to loose,when I found an answer I'll post it here.
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Integrating Plogger into sNews...
« Reply #5 on: September 08, 2006, 04:07:31 AM »

I just installed Plogger (have not integrate it with sNews yet) and have the same problem as mikhail.  The following message:
Quote
Forbidden
You don't have permission to access /diario/galeria/images/fotos/zucye/5.jpg on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/1.3.34 Server at www.peterbustamante.com Port 80
Link to the gallery is as follows
http://www.peterbustamante.com/diario/galeria/
« Last Edit: September 20, 2009, 10:40:50 PM by philmoz »
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Integrating Plogger into sNews...
« Reply #6 on: September 08, 2006, 04:23:21 AM »

** A sugestion:  Shouldn't this topic be under MODS & ADDONS??

Also, I translated the gallery.php to spanish, in case someone is interested.  It wasn't as bad as I though, but it took me a while to figure out which variables to change

Code: [Select]
#error_reporting(E_ALL);

include("plog-functions.php");
include("plog-globals.php");


global $inHead;
global $config;

$baseurl = $config["baseurl"];
$inHead = <<

EOT;

// process path here - is set if mod_rewrite is in use
if (!empty($_REQUEST["path"])) {
// the followling line calculates the path in the album and excludes any subdirectories if
// Plogger is installed in one
$path = join("/",array_diff(explode("/",$_SERVER["REQUEST_URI"]),explode("/",$_SERVER["PHP_SELF"])));
$resolved_path = resolve_path($path);
if (is_array($resolved_path)) {
$_GET["level"] = $resolved_path["level"];
$_GET["id"] = $resolved_path["id"];

// get page number from url, if present
$parts = parse_url($_SERVER["REQUEST_URI"]);
if (isset($parts["query"])) {
parse_str($parts["query"],$query_parts);
if (!empty($query_parts["page"])) $_GET["page"] = $query_parts["page"];
};
$path = $parts["path"];
};
};

if ($_GET["level"] == "slideshow")
$inHead .= generate_slideshow_js($_GET["id"], "album");
/*
else if ($level == "slideshow")
$inHead .= generate_slideshow_js($id, "album");
*/

// Set sorting session variables if they are passed
if (isset($_GET['sortby'])) $_SESSION['plogger_sortby'] = $_GET['sortby'];
if (isset($_GET['sortdir'])) $_SESSION['plogger_sortdir'] = $_GET['sortdir'];

// This file contains the main gallery function the_gallery();
// this function is placed in the HTML document directly.
// The function does not take any arguments, it reads directly from
// the HTTP_GET_VARS array.

// The three GET parameters that it accepts are
// $level = "collection", "album", or "picture"
// $id = id number of collection, album, or picture
// $n = starting element (for pagination) go from n to n + max_thumbs (in global config)

function the_gallery_head() {
global $inHead;
echo $inHead;
}

function the_gallery(){

$start = microtime();

global $TABLE_PREFIX;
global $config;


$output = '';

$level = isset($_GET["level"]) ? $_GET["level"] : '';
$allowed_levels = array('collection','album','picture','slideshow','search');
if (!in_array($level,$allowed_levels)) {
$level = 'collections';
};
$id = isset($_GET["id"]) ? intval($_GET["id"]) : 0;
$_REQUEST["id"] = $id;
$_REQUEST["level"] = $level;
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
$num = 0;

// this is needed to get pagination work
$total_items = 0;


// Output highest level container division
$output .= '

'.generate_header().''.generate_jump_menu().generate_search_box().'
';

if ($level != "picture"){
$output .= '';
}

$output .= '

';

if ($level == "picture"){


// first lets load the thumbnail of the picture at the correct size
$sql = "SELECT *, UNIX_TIMESTAMP(`date_submitted`) AS `unix_date_submitted`, UNIX_TIMESTAMP(`EXIF_date_taken`) AS `unix_exif_date_taken` FROM `".$TABLE_PREFIX."pictures` WHERE id = $id";
$result = run_query($sql);
$row = mysql_fetch_assoc($result);

// generate a list of all image id-s so proper prev/next links can be created. This should be a
// fast query, even for big albums.
$image_list = array();
$sql = "SELECT id FROM `".$TABLE_PREFIX."pictures` WHERE parent_album = ".$row["parent_album"];

// determine sort ordering
switch ($_SESSION["plogger_sortby"]){
case 'number_of_comments':
$sql .= " ORDER BY `num_comments`";
break;
case 'caption':
$sql .= " ORDER BY `caption` ";
break;
case 'date_taken':
$sql .= " ORDER BY `EXIF_date_taken` ";
break;
case 'filename':
$sql .= " ORDER BY `path` ";
break;
case 'date':
default:
$sql .= " ORDER BY `date_submitted` ";
break;
}

switch ($_SESSION["plogger_sortdir"]){
case 'ASC':
$sql .= " ASC";
break;
case 'DESC':
case 'default':
$sql .= " DESC";
break;
}

$result = run_query($sql);
while ($image = mysql_fetch_assoc($result)) {
$image_list[] = $image["id"];
};

$current_picture = array_search($id,$image_list);

$prev_link = $next_link = "";

if ($current_picture > 0) {
$prev_link = '« Anterior';
};

if ($current_picture < sizeof($image_list)-1)
{
$next_link = 'Siguiente »';
};

$date_taken = !empty($row["unix_exif_date_taken"]) ? $row["unix_exif_date_taken"] : $row["unix_date_submitted"];
$output .= '








'.date($config["date_format"],$date_taken).'



';

$output .= (trim($row["caption"]) != '') ? stripslashes($row["caption"]) : '';

$output .= '


';


$thumburl = generate_thumb($row['path'], $row['id'], 'large');

// generate XHTML with thumbnail and link to picture view.
$img_link = $config["baseurl"] . $row["path"];

// generate XHTML with thumbnail and link to picture view.
$imgtag = ''.$row[';

if (!$_SESSION["plogger_details"]){
$detail_url = 'Mostrar Detalles';
}
else{
$detail_url = 'Esconder Detalles';
}

$output .= '






'.$prev_link.'

'.$next_link.'
';

$output .= '
';

$output .= '




'.$detail_url.'

';


$output .= generate_exif_table($row["id"]);

// display comments for selected picture
$output .= display_comments($row["id"]);


$output .= '

';

}
else{
// so basicly, this whole block gets to run only if I'm not showing a picture
$output .= '
';

if ($level == "slideshow") {

$output .= '

';

$output .= generate_slideshow_interface();
$output .= '
';

$num_items = 1;
}

elseif ($level == "search"){
$output .= '';

$terms = $_REQUEST["searchterms"];
$terms = explode(" ",$terms);

$query = "SELECT `caption`,`path`,p.`id`,c.`comment` FROM `".$TABLE_PREFIX."pictures` p LEFT JOIN `".$TABLE_PREFIX."comments` c
ON p.`id` = c.`parent_id` ";
if ((count($terms) != 1) || ($terms[0] != '')){
$query .= " WHERE ( ";
foreach ($terms as $term) {
$query .= "
`path` LIKE '%".mysql_escape_string($term)."%' OR
`comment` LIKE '%".mysql_escape_string($term)."%' OR
`caption` LIKE '%".mysql_escape_string($term)."%' OR ";
}

$query = substr($query, 0, strlen($query) - 3) .") ";
}
else{
// no search terms? no results either
$query .= " WHERE 1 = 0";
}

$query .= " GROUP BY p.`id`ORDER BY `date_submitted` DESC";
$result = run_query($query);

if (mysql_num_rows($result) > 0){
$output .= '
    ';
    $counter = 0;

    $from = ($page - 1) * $config["thumb_num"];

    mysql_data_seek($result, $from);

    $i = $page;

    // Loop through each album in the set.
    while(($row = mysql_fetch_assoc($result)) && ($i++ < ($page + $config["thumb_num"]))){
    // display thumbnails within album
    $thumbpath = generate_thumb($row['path'], $row['id'], 'small');

    // generate XHTML with thumbnail and link to picture view.
    $imgtag = ''.htmlspecialchars($row[';

    // Tables are a necessary evil for getting the interface done...

    $comment_query = "SELECT COUNT(*) AS `num_comments` FROM `".$TABLE_PREFIX."comments` WHERE `parent_id`='".$row["id"]."'";
    $comment_result = run_query($comment_query);
    $num_comments = mysql_result($comment_result, 0, 'num_comments');


    $output .= '

  • '.$imgtag.'
    ';


    if ($config["allow_dl"])
    $output .= '';

    $filename = basename($row["path"]);
    if (strlen($filename) > $config["truncate"] && $config["truncate"] != 0)
    $filename = substr($filename, 0, $config["truncate"])."...";

    $output .= $filename.'
    ';

    if ($config["allow_comments"]) {
      $output.= '
    ('.$num_comments.' comentario';
     
      if ($num_comments != 1) $output .= 's';
      $output .= ')
    ';

    }

    $output.='
  • ';

    $counter++;

    }

    $output .= '
';
}
else{
$output .= '
No existen imágenes compatibles con los detalles de su búsqueda.
';
}

$num_items = mysql_num_rows($result);
}
elseif ($level == "album") {
// Album level display mode (display all pictures within album)
$output .= '';
$count_sql = "SELECT COUNT(*) AS num_items FROM `".$TABLE_PREFIX."pictures` WHERE parent_album = '$id'";
$result = mysql_query($count_sql);
$num_items = mysql_result($result, 'num_items');
$num = $num_items;

$sql = "SELECT `".$TABLE_PREFIX."pictures`.`id`,`path`,`caption`, COUNT(`comment`) AS `num_comments` FROM `".$TABLE_PREFIX."pictures` LEFT JOIN `".$TABLE_PREFIX."comments` ON `".$TABLE_PREFIX."pictures`.`id`=`".$TABLE_PREFIX."comments`.`parent_id`  WHERE `".$TABLE_PREFIX."pictures`.`parent_album` = ".$id." GROUP BY `".$TABLE_PREFIX."pictures`.`id`";

// query database and retreive all pictures withing selected album
switch ($_SESSION["plogger_sortby"]){
case 'number_of_comments':
$sql .= " ORDER BY `num_comments`";
break;
case 'caption':
$sql .= " ORDER BY `caption` ";
break;
case 'date_taken':
$sql .= " ORDER BY `EXIF_date_taken` ";
break;
case 'filename':
$sql .= " ORDER BY `path` ";
break;
case 'date':
default:
$sql .= " ORDER BY `date_submitted` ";
break;
}

switch ($_SESSION["plogger_sortdir"]){
case 'ASC':
$sql .= " ASC";
break;
case 'DESC':
case 'default':
$sql .= " DESC";
break;
}

$from = ($page - 1) * $config["thumb_num"];

$sql .= ",`".$TABLE_PREFIX."pictures`.`id` DESC ";
$sql .= " LIMIT ".$from.",".$config["thumb_num"];
$result = run_query($sql);

if (mysql_num_rows($result) > 0){
$output .= '
    ';
    $counter = 0;

    // Loop through each album in the set.
    while($row = mysql_fetch_assoc($result)) {
    // display thumbnails within album
    $thumbpath = generate_thumb($row['path'], $row['id'], 'small');

    // generate XHTML with thumbnail and link to picture view.
    $imgtag = ''.htmlspecialchars($row[';

    $num_comments = $row['num_comments'];

    $output .= '
  • ' . $imgtag . "
    ";


    if ($config["allow_dl"])
    $output .= '';

    $filename = basename($row["path"]);

    if (strlen($filename) > $config["truncate"] && $config["truncate"] != 0)
    $filename = substr($filename, 0, $config["truncate"])."...";

    $output .= $filename.'
    ';

    if ($config["allow_comments"]) {
      $output.= '
    ('.$num_comments.' Comentario';
     
      if ($num_comments != 1) $output .= 's';
      $output .= ')
    ';

    }

    $output.='
  • ';
    $counter++;
    }


    $output .= '
';
}
else{
$output .= '
No hay Imágenes en este Álbum.
';
}
}
else if ($level == "collection") {
$sql = "SELECT COUNT(DISTINCT `parent_album`) AS `num_items` FROM `".$TABLE_PREFIX."pictures` WHERE `parent_collection` = '" . $id . "'";
$result = run_query($sql);
$num_items = mysql_result($result, 'num_items');
$num = $num_items;

// create a list of all non-empty albums. Could be done with subqueries, but
// MySQL 4.0 does not support those

// -1 is just for the case there are no albums at all. Shouldn't happen if user
// follows links, but let's deal with it anyway
$image_count = array(-1 => -1);
// 1. create a list of all albums with at least one photo
$sql = "SELECT parent_album,COUNT(*) AS imagecount FROM `".$TABLE_PREFIX."pictures` GROUP BY parent_album";
$result = run_query($sql);
while($row = mysql_fetch_assoc($result)) {
$image_count[$row["parent_album"]] = $row["imagecount"];
};

$output .= '';
$imlist = join(",",array_keys($image_count));

$from = ($page - 1) * $config["thumb_num"];

$sql = "SELECT * FROM `".$TABLE_PREFIX."albums` WHERE `parent_id` = '$id' AND id IN ($imlist) ORDER BY `name` DESC LIMIT ".$from.",".$config["thumb_num"];
$result = run_query($sql);

$output .= '';

if (mysql_num_rows($result) > 0){
$output .= '
    ';
    $counter = 0;

    while ($row = mysql_fetch_array($result)){
    // Display a thumbnail of the first picture in the album

    if ($row["thumbnail_id"]) {
    $thumb_query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE id='".$row["thumbnail_id"] . "'";
    } else {
    $thumb_query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE `parent_album`='".$row["id"]."' ORDER BY `date_submitted` DESC LIMIT 1";
    };
    $thumb_result = run_query($thumb_query);
    $thumb_row = mysql_fetch_assoc($thumb_result);


    if (mysql_num_rows($thumb_result) > 0){
    $thumbpath = generate_thumb($thumb_row['path'], $thumb_row['id'], 'small');

    $numquery = "SELECT COUNT(*) AS `num_pictures` FROM `".$TABLE_PREFIX."pictures` WHERE `parent_album`='".$row["id"]."'";
    $numresult = run_query($numquery);
    $num_pictures = mysql_result($numresult, 'num_pictures');


    $output .= '
  • ';

    // generate XHTML with thumbnail and link to picture view.
    $imgtag = ''.htmlspecialchars($row[';

    $output .= $imgtag;

    $output .= '


    ';

    if ($config["allow_dl"])
    $output .= '';

    $output.= $row["name"].'

    ('.$num_pictures.' imagen';

    if ($num_pictures != 1) $output .= 'es';

    $output .= ')

  • ';



    $counter++;
    }
    }


    $output .= '
';
}
} // collections mode (show all albums within a collection)
else {
// Show all of the collections
// How many non-empty collections are there?

$sql = "SELECT COUNT(DISTINCT `parent_collection`) AS `num_items` FROM `".$TABLE_PREFIX."pictures`";
$result = run_query($sql);
$num_items = mysql_result($result, 'num_items');
$num = $num_items;
       
// create a list of all non-empty collections. Could be done with subqueries, but
// MySQL 4.0 does not support those

// -1 is just for the case there are no collections at all
$image_count = array(-1 => -1);
// 1. create a list of all albums with at least one photo
$sql = "SELECT parent_collection,COUNT(*) AS imagecount FROM `".$TABLE_PREFIX."pictures` GROUP BY parent_collection";
$result = run_query($sql);
while($row = mysql_fetch_assoc($result)) {
$image_count[$row["parent_collection"]] = $row["imagecount"];
};

$output .= '';
$imlist = join(",",array_keys($image_count));

// I need to determine correct arguments for LIMIT from the given page number

$from = ($page - 1) * $config["thumb_num"];

$sql = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE id IN ($imlist) LIMIT ".$from.",".$config["thumb_num"];
$result = run_query($sql);

if (mysql_num_rows($result) > 0){
$output .= '
    ';
    $counter = 0;

    while ($row = mysql_fetch_array($result)){
    $numquery = "SELECT COUNT(*) AS `num_albums` FROM `".$TABLE_PREFIX."albums` WHERE `parent_id`='".$row["id"]."'";
    $numresult = run_query($numquery);
    $num_albums = mysql_result($numresult, 'num_albums');

    if ($row["thumbnail_id"]) {
    $thumb_query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE id='".$row["thumbnail_id"]."'";
    } else {
    $thumb_query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE `parent_collection`='".$row["id"]."' LIMIT 1";
    };
    $thumb_result = run_query($thumb_query);

    if (mysql_num_rows($thumb_result) > 0){
    $thumb_row = mysql_fetch_assoc($thumb_result);

    $output .= '
  • ';

    $thumbpath = generate_thumb($thumb_row['path'], $thumb_row['id'], 'small');

    // generate XHTML with thumbnail and link to picture view.
    $imgtag = ''.htmlspecialchars($row[';

    $output .= $imgtag;

    $output .= '

    ';


    if ($config["allow_dl"])
    $output .= '';

    $output .= $row["name"].'

    ('.$num_albums.' albun';

    if ($num_albums != 1) $output .= 'es';

    $output .= ')

  • ';

    $counter++;
    }
    }

    $output .= '
';
}
}

// change the tooltip message to reflect the nature of the RSS aggregate link.
if ($level != "")
$rss_tooltip = "RSS 2.0 subscribe to this $level";
else
$rss_tooltip = "RSS 2.0 subscribe to all images";
 

if ($config["use_mod_rewrite"]) {
global $path;
if (isset($path))
$rss_link .= "http://".$_SERVER["SERVER_NAME"]."/".SmartStripSlashes(substr($path,1))."/feed/";
else
$rss_link .= $config['baseurl']."feed/";

} else {
$rss_link .= "plog-rss.php?level=$level&id=$id";
};

if ($level == "search") { // append the search terms
$separator = $config["use_mod_rewrite"] ? "?" : "&";
$rss_link .= $separator . "searchterms=".urlencode($_GET["searchterms"]);
};

if ($level == "search") {
$searchterms = urlencode($_GET["searchterms"]);
$p_url = $_SERVER["PHP_SELF"]."?level=search&searchterms=$searchterms&id=$id";
}
else {
if ($level) {
$p_url = generate_url($level,$id);
if ($config["use_mod_rewrite"]) {
$p_url .= "/";
};
}
else {
$p_url = $config["baseurl"];
};
};

$ss_tag = $ss_cap_tag = $rss_tag = "";

if ($level == "album") {
$ss_url = $_SERVER["PHP_SELF"]."?level=slideshow&mode=$level&id=$id";
if ($config["use_mod_rewrite"]) {
$ss_url = generate_url($level,$id) . "/slideshow";
};
$ss_tag = "Ver como en formato de Pelicula";
}

if ($level != "slideshow")
$rss_tag = 'RSS <span style= 2.0 Feed" style="margin:0; padding:0; display:inline" />';
else
$ss_cap_tag = ' ';


$output .= '

';

$end = microtime();
$t2 = (getmicrotime($end) - getmicrotime($start));

$output .= '

';
}

$output .= '

';

echo $output;
}

function generate_breadcrumb($level, $id){
global $TABLE_PREFIX;
switch ($level){

case 'collection':
$query = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE `id`='".$id."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);

$breadcrumbs = ' Galerias » ' . $row["name"] . '';
if ($level == "slideshow") $breadcrumbs .= ' » Slideshow';

break;
case 'slideshow':
case 'album':
$query = "SELECT * FROM `".$TABLE_PREFIX."albums` WHERE `id`='".$id."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);

$album_name = $row["name"];
$album_link = generate_url("album",$row["id"],$row["name"]);

$query = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE `id`='".$row["parent_id"]."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);

$collection_link = '' . $row["name"] . '';

if ($level == "slideshow")
$breadcrumbs = ' Galerias » ' . $collection_link . ' » '
. ''.$album_name.' » ' . ' Formato de Pelicula';
else
$breadcrumbs = ' Galerias » ' . $collection_link . ' » ' . ''.$album_name.'';

break;

case 'picture':
$query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE `id`='".$id."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);
$picture_name = basename($row["path"]);

$query = "SELECT * FROM `".$TABLE_PREFIX."albums` WHERE `id`='".$row["parent_album"]."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);

//$album_link = ''.$row["name"].'';
$album_link = '' . $row["name"] . '';

$query = "SELECT * FROM `".$TABLE_PREFIX."collections` WHERE `id`='".$row["parent_id"]."'";
$result = run_query($query);
$row = mysql_fetch_assoc($result);

//$collection_link = ''.$row["name"].'';
$collection_link = '' . $row["name"] . '';

$breadcrumbs = ' Galerias » ' . $collection_link . ' » ' . $album_link . ' » ' . ''.$picture_name.'';
if ($level == "slideshow") $breadcrumbs .= ' » Slideshow';

break;
case 'search':
$breadcrumbs = 'You searched for '.htmlspecialchars($_GET["searchterms"]).'.';
break;
default:
$breadcrumbs = ' Galerias';
}

return '';
}

function generate_jump_menu() {
global $TABLE_PREFIX;
    global $config;

$output = '';

$output .=  '
';
$output .=  '';
$output .=  '
';
return $output;

}

function generate_exif_table($id, $condensed=0){
global $TABLE_PREFIX;
global $config;

$query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE `id`='".$id."'";
$result = run_query($query);

if (mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);
foreach($row as $key => $val) if (trim($row[$key]) == '') $row[$key] = ' ';

$table_data = '

if (!$_SESSION["plogger_details"]){
$table_data .= ' style="display: none;"';
}

// get image size
$img = $config['basedir'] . 'images/' . $row['path'];
list($width, $height, $type, $attr) = getimagesize($img);
$size = round(filesize($img)/1024,2);

if (!$condensed) {
$table_data .= '>




























Dimensiones'.$width .' x ' .$height.'
Tamaño del Archivo'.$size.' kbytes
Fecha de Origen'.$row["EXIF_date_taken"].'
Modelo de la Cámara'.$row["EXIF_camera"].'
Velocidad de la toma'.$row["EXIF_shutterspeed"].'
Lente Focal'.$row["EXIF_focallength"].'
Apertura'.$row["EXIF_aperture"].'
';
}
else {
$table_data .= '>Dimensiones'.$width .' x ' .$height.'Tamaño del Archivo'.$size.' kbytesFecha de Origen'.$row["EXIF_date_taken"].'Modelo de la Cámara'.$row["EXIF_camera"].'Velocidad de la toma'.$row["EXIF_shutterspeed"].'Lente Focal'.$row["EXIF_focallength"].'Apertura'.$row["EXIF_aperture"].'
';
}
}

return $table_data;
}

function display_comments($id) {
global $TABLE_PREFIX;
global $config;
$output = "";
$error_message = "";


if ($config["allow_comments"] == 1) {
    // this function takes the photo id and selects all relevent comments
      // it then displays them with an ordered HTML list.
      // get comments from table
      $query = "SELECT *, UNIX_TIMESTAMP(`date`) AS `unix_date` FROM `".$TABLE_PREFIX."comments` WHERE parent_id = '$id'";
      $result = run_query($query) or die(mysql_error());
     
      $output .= "

Comentarios:

";
     
      if (mysql_num_rows($result) == 0) {
    $output .= "

Aun no existen Comentarios.

";
      }
      else {
      $output .= "
    ";
          while($row = mysql_fetch_assoc($result)) {
    $url = htmlspecialchars($row["url"]);
    $author = htmlspecialchars($row["author"]);

            $output .= "
  1. ";
           
            $output .= "

    ".htmlspecialchars($row["comment"])."

    ";
            $output .= "Comentario por: ";
                    $output .= (trim($url) != '') ? "$author" : "$author";
                    $output .= "- Incluido: ".date($config["date_format"],$row["unix_date"]);
           
            $output .= "
  2. ";
            }
        $output .= "
";
    }
   
   
    $query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE id = '$id'";
      $result = run_query($query) or die(mysql_error());
      $row = mysql_fetch_assoc($result);
     
    if ($row["allow_comments"]) {
   
if (isset($_SESSION['comment_post_error'])) {
$error_message = "

" . $_SESSION['comment_post_error'] . "

";
unset($_SESSION['comment_post_error']);
};
   
    $output .= '
   

Incluye Tu-Comentario:


    '.$error_message.'
   

   


   
    (requerido)
   
   


   


   
    (requerido, pero no será publicado)
   


   


   
   
   


   


   
   

   


   


   
   


   
';
    }
    else
    $output .= '

Lo Sentimos, pero los comentarios están cerrados

';
    }

return $output;

}


// generate header produces the Gallery Name, The Jump Menu, and the Breadcrumb trail at the top of the image

function generate_header() {
global $config;

$output = '

'.stripslashes($config["gallery_name"]).'

';

return $output;
}


function generate_sortby($level,$id){
$output = '';

if ($level == "album"){

$output .= '

Ordenar por:

';
}

return $output;
}

function generate_sortdir($level,$id){
$output = '';

if ($level == "album") {

$output .= '


';
}

return $output;
}

function generate_search_box(){
$output = '




';
return $output;
}

// generates correclt urls depending on whether mod_rewrite is in use or not
// level - type of the url to generate
// id - used for id=xx urls
// name - used for mod_rewrite URL-s, both should be passed as arguments, so this
// function doesn't have to query the database


// benchmark timing
function getmicrotime($t) {
list($usec, $sec) = explode(" ",$t);
return ((float)$usec + (float)$sec);
}

function generate_slideshow_interface() {
global $config;
$large_link = ' ["baseurl"].'graphics/search.gif" width="16" height="16">';

$prev_url = ' href="javascript: slides.previous();"> width="16" height="16">';

$next_url = ' href="javascript: slides.next();"> width="16" height="16">';

$stop_url = ' href="javascript: slides.pause();"> width="16" height="16">';

$play_url = ' href="javascript: slides.play();"> width="16" height="16">';

$output = '

  '.$large_link.$prev_url.$stop_url.$play_url.$next_url.'
';
/*  
$imgtag = '  title="'.$row["caption"].'" alt="'.$row["caption"].'" />';
*/
$imgtag = '  title="" alt="" />';
 
$output .= '
';

// activate slideshow object using javascript block
$output .= '';

return $output;
}

// function for generating the slideshow javascript
function generate_slideshow_js($id, $mode) {
global $TABLE_PREFIX;
global $config;

// output the link to the slideshow javascript
$output = '';


// get all pictures within album sorted by default sort order
if ($mode == "collection")
$sql = "SELECT * FROM ".$TABLE_PREFIX."pictures WHERE parent_collection = '".$id."'";
elseif ($mode == "album")
$sql = "SELECT * FROM ".$TABLE_PREFIX."pictures WHERE parent_album = '".$id."'";
else
$sql = "SELECT * FROM ".$TABLE_PREFIX."Pictures";

// determine sort ordering
switch ($_SESSION["plogger_sortby"]){
case 'number_of_comments':
$sql .= " ORDER BY `num_comments`";
break;
case 'caption':
$sql .= " ORDER BY `caption` ";
break;
case 'date_taken':
$sql .= " ORDER BY `EXIF_date_taken` ";
break;
case 'filename':
$sql .= " ORDER BY `path` ";
break;
case 'date':
default:
$sql .= " ORDER BY `date_submitted` ";
break;
}

switch ($_SESSION["plogger_sortdir"]){
case 'ASC':
$sql .= " ASC";
break;
case 'DESC':
case 'default':
$sql .= " DESC";
break;
}

$result = run_query($sql);

$output .= '';

return $output;
}
 

?>
Also on the plog-load_config.php the charset setting should be changed to 'iso-8859-1'
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Integrating Plogger into sNews...
« Reply #7 on: September 08, 2006, 07:28:55 AM »

OK, I found the solucija (solution), well, it worked for me.
THe images have to be CHMOD 755 and unfortunately seems like it has to be done 1 at a time.  Try doing the folder and did not work.

Also in the Plogger forum, the following was sugested (but it did not work for me):
Code: [Select]
in plog-admin-functions.php
line 60

if (!rename($tmpname,$final_fqfn)) {
$result['errors'] .= 'Could not move file! ' . $tmpname .' to '.$final_fqfn;
return $result;
}
else{chmod ($final_fqfn, 0755);} // add this code
But I put it in, just to see if it works with future uploads.
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Integrating Plogger into sNews...
« Reply #8 on: September 08, 2006, 07:34:28 AM »

Just tested, the code changes for the plog-admin-functions.php, works for future uploads.

Also if you want the full size picture to popup in another window do the following:
Code: [Select]
In gallery.php on line 237 the code is:

'.$imgtag.'

Replace with the code below to open last level pic in new window:

'.$imgtag.'
Almost done!
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Integrating Plogger into sNews...
« Reply #9 on: November 28, 2006, 04:16:55 PM »

first post updated with integration into a ver 15 template, and a specific template, but it will work on what ever template you're integrating it to...
Logged
"It's only dead fish that goes with the flow... "
Updated

mantra

  • Newbie
  • *
  • Karma: 0
  • Posts: 16
Re: Integrating Plogger into sNews...
« Reply #10 on: September 20, 2009, 08:12:22 AM »

is this Integrating still work? i will try in snews v 1.7
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Integrating Plogger into sNews...
« Reply #11 on: September 20, 2009, 11:14:21 AM »

Well, as this was an 1.5 post... You'll have to find out yourself. I'm not using Plogger no more it's all Zenphoto
Logged
"It's only dead fish that goes with the flow... "
Updated

mantra

  • Newbie
  • *
  • Karma: 0
  • Posts: 16
Re: Integrating Plogger into sNews...
« Reply #12 on: September 30, 2009, 08:11:19 AM »

thanks
Logged
Pages: [1]
« previous next »