Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

G2 Sidebar

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Blocks View previous topicPrinter friendly versionView next topic
Author Message
fkelly

Novice
Novice


Joined: Dec 03, 2005
Posts: 28

PostPosted: Sat Oct 11, 2008 11:21 am    Post subject: G2 Sidebar Reply with quote

I have been having a problem running slideshows in embedded mode. There is another long thread on this. I have also posted some code for mainfile in Nuke that lets you only show the G2 Sidebar when Gallery is the "main" module.

I'm not sure what is happening with the slideshow. While I was working on the Sidebar block it just "started working" on my system but I don't know that I made any changes to enable it. However with error reporting running I found a number of undefined variables and constants being defined that were already defined. On the Ravennuke project we are eliminating these as we go so I will post a version of G2 Sidebar that eliminates these "problems". I also changed the style of quotes (we use single quotes because they are faster for saying something like $var = 'some text'). A nit but it adds up over thousands of lines of code.

My changes are:

the eregi that is at the top of each block file has been replaced in modern Ravennuke and I believe in Nuke's patched series with a check for a constant. I put that in.

$content should be initialized so the first reference doesn't generate a warning when you say $content .= 'xxx' or whatever.

In some cases the array $css is not set but you are trying to run a foreach on it. I put in a test before the foreach.

I freely admit that I don't understand what all the code does. If anyone else wants to hack with this feel free with all the usual caveats about having a good backup of the official code. If Dari can take a look sometime that would be great. Here is a revised version:

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 sidebar block for PHPNuke.
 * @version $Revision: 15219 $ $Date: 2006-11-17 14:49:54 +0100 (Fri, 17 Nov 2006) $
 * @author Dariush Molavi <dari@nukedgallery.net>
 */

if ( !defined('BLOCK_FILE') ) {
    Header('Location: ../index.php');
    die();
}
global $admin, $user, $cookie,$db,$prefix, $g2moddata;
$content = '';
if (!defined(_G2_EMBED_PHP_FILE)) {
   define(_G2_EMBED_PHP_FILE,'embed.php');
}
if (!defined(_G2_CONFIGURATION_NOT_DONE)) {
   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;
}

GalleryCapabilities::set('showSidebarBlocks', false);

if(!isset($g2moddata)) {
   $g2moddata = GalleryEmbed::handleRequest();
   $newG2 = 1;
}

if (isset($g2moddata['headHtml'])) {
   list($title, $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
}

if(!isset($g2moddata['sidebarBlocksHtml'])) {
   $content = "You need to enable sidebar blocks in your Gallery 2 configuration.";
}
else {
   $num_blocks = count($g2moddata['sidebarBlocksHtml']) - 1;
   if (isset($css)) {
      foreach($css as $stylesheet) {
         $content .= $stylesheet;
   }
   }
   $content .= "<div id=\"gsSidebar\">";
   for($i = 0; $i <= $num_blocks; $i++) {
      if($i != $num_blocks) {
         $content .= $g2moddata['sidebarBlocksHtml'][$i]."<hr size=\"1\" noshade>";
      }
      else {
         $content .= $g2moddata['sidebarBlocksHtml'][$i];
      }
   }
   $content .= "</div>";
}

if(!isset($newG2)) {
   $ret = GalleryEmbed::done();
}

?>
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: G2 Sidebar  

Back to top
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Blocks View previous topicPrinter friendly versionView next topic

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDedicated ServersDomain NamesDomain Name RegistrationDedicated Web HostingSEO Search Engine OptimisationSEOWeb Design New YorkSEO Web DesignWeb hosting AustraliaCheap Web Design

6th year online! 2003-2009
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia