Code: ›
<?php
/*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2006 Bharat Mediratta
*
* 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Gallery 2 image block for PHPNuke.
* @version $Revision: 13543 $ $Date: 2006-04-27 13:58:37 -0500 (Thu, 27 Apr 2006) $
* @author Dariush Molavi <dari@nukedgallery.net>
*/
/* Scrolling Mod added by Nomad76 -
boss@nomad76.com ,
www.nomad76.com
* @version 1.5; 24 May 2006
*/
/****************************************************************************/
/* This is your configuration section of your Gallery 2 image block. */
/* */
/* 1. Select which blocks you want to show from the list below: */
/* */
/* randomImage : A random image is shown */
/* recentImage : The most recent image is shown */
/* viewedImage : The most popular image is shown */
/* randomAlbum : The highlight from a random album is shown */
/* recentAlbum : The highlight from the most recent album is shown */
/* viewedAlbum : The highlight from the most popular album is shown */
/* dailyImage : A new image each day */
/* weeklyImage : A new image each week */
/* monthlyImage : A new image each month */
/* dailyAlbum : A new album highlight each day */
/* weeklyAlbum : A new album highlight each week */
/* monthlyAlbum : A new album highlight each month */
/* */
$block1 = "randomImage";
$block2 = "recentImage";
$block3 = "viewedImage";
$block4 = "randomImage";
$block5 = "dailyImage";
/* 2. Comment Out The Blocks You Dont Want, and don't forget to */
/* go down to the '$content' Section and comment out the blocks */
/* there, also. (labeled as $b1 - $b5) */
/* 3. Select what album/image properties you want displayed: */
/* >>>Important!<<<< */
/* For Horizontal Scroll, you can only select 'none' or 'full size' */
/* For Vertical Scroll, you have the regular options, and you can */
/* display more than one, but separate them by | (the pipe symbol) */
/* */
/* title : Show the title */
/* views : Show how many views the item has */
/* date : Show the capture/upload date */
/* owner : Show the item owner */
/* heading : Show the item heading ("Random Image","Daily Image", etc) */
/* fullSize: Show the full sized item (not a thumbnail) */
/* none : Don't show anything, just the thumbnail */
$display1 = "none";
/* 4. What size image do you want displayed? If you want the default */
/* thumbnail, leave this empty, otherwise, enter the max pixel size. */
/* IF YOU SPECIFY A SIZE LARGER THAN THE DEFAULT THUMBNAIL SIZE, YOU */
/* MUST ALSO ADD "fullSize" TO THE $display1 VARIABLE ABOVE. */
$maxSize='120';
/* 5. Configure the scroll parameters */
/* "$scroll = 1" turns on the scroll; $scroll = '0' turns it off. */
/* $direction: 'left' , 'right', 'up', 'down' */
/* $speed: the distance the scroll hops (makes it faster) */
/* $delay: the time between hops (makes it slower) */
/* $scrwidth: the size of the scroll window (left to right) */
/* $scrheight: the size of the scroll window (top to bottom) */
/* $pad, $pad2: It is used to cut out the image */
/* Adjusting this could make or break the block. */
/* A value of 23 & -7 works (respectivly). */
$scroll = 1;
$direction = "left";
$speed = 3;
$delay = 50;
$scrwidth = 600; // also effects block width
$scrheight = 130; // also effects block height
$pad = 23;
$pad2 = -7;
/* 6. Add a message to be displayed in the block. */
/* Otherwise, leave it blank (i.e..$message = ""). */
$message = "<center><h2>Check out my latest photos!</h2></center>";
/* 7. The Table background color is set as $bgcolor1. To change this, */
/* just scroll down and edit it, it is marked "Background color" */
/* */
/****************************************************************************/
if (eregi("block-G2_ImageScrollBlock.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php");
die();
}
global $admin, $user, $cookie, $db, $prefix;
define("_G2_EMBED_PHP_FILE","embed.php");
define("_G2_CONFIGURATION_NOT_DONE","The module has not yet been configured.");
$g2result = $db->sql_query("SELECT * FROM ".$prefix."_g2config");
list($embedUri, $g2Uri, $activeUserId, $cookiepath, $showSidebar, $g2configurationDone, $embedVersion) = $db->sql_fetchrow($g2result);
if ($g2configurationDone != 1) {
$content = _G2_CONFIGURATION_NOT_DONE;
return;
}
preg_match("/^(.*)?(modules\/.*)/i", $g2Uri, $matches);
require_once($matches[2]._G2_EMBED_PHP_FILE);
if (is_admin($admin)) {
$uid='admin';
}
else {
if (is_user($user)) {
cookiedecode($user);
$uid='';
if (is_user($user)) {
$uid = $cookie[0];
}
}
}
$ret = GalleryEmbed::init(array(
'embedUri' => $embedUri,
'g2Uri' => $g2Uri,
'activeUserId' => "$uid",
'fullInit' => true));
//if ($showSidebar) {
//$content = "The Gallery2 sidebar is enabled.<br>You should disable it before using this block.";
// return true;
//}
list($ret, $modulestatus) = GalleryCoreApi::fetchPluginStatus('module');
if($modulestatus['imageblock']['active'] != '1') {
$content = 'You need to install and/or activate the ImageBlock module in Gallery 2 before using this block';
return true;
}
$g2moddata = GalleryEmbed::handleRequest();
if(intval($maxSize) > 0) {
list($ret,$html1, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block1, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid','maxSize' => $maxSize));
list($ret,$html2, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block2, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid','maxSize' => $maxSize));
list($ret,$html3, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block3, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid','maxSize' => $maxSize));
list($ret,$html4, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block4, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid','maxSize' => $maxSize));
list($ret,$html5, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block5, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid','maxSize' => $maxSize));
}
else {
list($ret,$html1, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block1, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid'));
list($ret,$html2, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block2, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid'));
list($ret,$html3, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block3, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid'));
list($ret,$html4, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block4, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid'));
list($ret,$html5, $head) = GalleryEmbed::getImageBlock(array('blocks'=>$block5, 'show'=>$display1,'itemFrame'=>'solid','albumFrame'=>'solid'));
}
if (!isset($g2moddata['isDone'])) {
echo 'isDone is not defined, something very bad must have happened.';
exit;
}
if ($g2moddata['isDone']) {
exit;
}
// Displays the message
$content = $message;
$pad2 = -7;
// This Code Extracts the Image & Link
$b1 = substr($html1,$pad,$pad2);
$b2 = substr($html2,$pad,$pad2);
$b3 = substr($html3,$pad,$pad2);
$b4 = substr($html4,$pad,$pad2);
$b5 = substr($html5,$pad,$pad2);
//Background color
$content .="<tr bgcolor='$bgcolor1'><td align='center'>";
//Start of Scroll Code
If (($direction=="left") or ($direction=="right"))
{
$orientation = 1;
}
else
{
$orientation = 0;
}
If ($orientation ==1)
{
if ($scroll==1)
{
$content .= " <A name= \"scrollpic\"></A><MARQUEE behavior= \"scroll\" align= \"center\" direction= \"".$direction."\" height=\"".$scrheight."\" width=\"".$scrwidth."\" scrollamount= \"".$speed."\" scrolldelay= \"".$delay."\" onmouseover='this.stop()' onmouseout='this.start()'>";
}
else
{
$content .="";
}
//Block Content Horizontal - Use as many as needed, comment out those you don't need.
$content .="<TT> --$block1--></TT>".$b1;
$content .="<TT> --$block2--></TT>".$b2;
$content .="<TT> --$block3--></TT>".$b3;
$content .="<TT> --$block4--></TT>".$b4;
$content .="<TT> --$block5--></TT>".$b5;
if ($scroll==1)
{
$content .="</MARQUEE>";
$content .="</td></tr>\n";
}
else
{
//$content .="</td></tr>/n";
}
}
else
{
if ($scroll==1)
{
$content .= " <A name= \"scrollpic\"></A><MARQUEE behavior= \"scroll\" align= \"center\" direction= \"".$direction."\" height=\"".$scrheight."\" width=\"".$scrwidth."\" scrollamount= \"".$speed."\" scrolldelay= \"".$delay."\" onmouseover='this.stop()' onmouseout='this.start()'>";
}
else
{
$content .= "";
}
//Block Content Vertical - Use as many as needed, comment out those you don't need.
$content .="<center>";
$content .=$b1;
$content .="__________".$b2;
$content .="__________".$b3;
$content .="__________".$b4;
$content .="__________".$b5;
$content .="</center>";
if ($scroll==1)
{
$content .="</MARQUEE>";
$content .="</td></tr>\n";
}
else
{
//$content .="</td></tr>\n";
}
}
?>