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  

[TESTING] Selectable Album Random Block
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Blocks View previous topicPrinter friendly versionView next topic
Author Message
GJSchaller

User
User


Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA

PostPosted: Fri Apr 29, 2005 2:14 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Still no errors - same result.
Back to top
Offline View user's profile Send private message Visit poster's website
AdBot
   Post subject: Re: [TESTING] Selectable Album Random Block  

Back to top
drmike

Wizard
Wizard


Joined: Mar 20, 2005
Posts: 232
Location: Charlotte, NC

PostPosted: Fri Apr 29, 2005 3:00 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Stats aren't showing up either.

http://www.knightrealms.com/modules.php ... s&op=Stats

-drmike
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
GJSchaller

User
User


Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA

PostPosted: Fri Apr 29, 2005 3:03 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Hmmm.... that's odd - I don't think it's related (since the page closes out, and does not end abruptly like the Block does), but it's worth noting. It's not as important to me as the Image Block, though. (We have a HUGE Gallery, and want to filter out some of the suff that just doesn't work in the block.)
Back to top
Offline View user's profile Send private message Visit poster's website
drmike

Wizard
Wizard


Joined: Mar 20, 2005
Posts: 232
Location: Charlotte, NC

PostPosted: Fri Apr 29, 2005 3:07 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

I'm wondering if something's corrupt in the database. Try running a REPAIR and then an OPTIMIZE on it.

The pic block is set to be visible to everybody and all that, right? I'm assuming you've checked all that already.

-drmike
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
GJSchaller

User
User


Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA

PostPosted: Fri Apr 29, 2005 3:10 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

It's Admin Only for testing, since it wa ssupposed ot generate error codes - but since it's not, I can turn it back on for everyone now.

I just ran Sentinels' DB checks recently, woudl that work? Are you referring to runing the repair & optimize form Nuke's CP, or from another source such as phpMyAdmin?
Back to top
Offline View user's profile Send private message Visit poster's website
drmike

Wizard
Wizard


Joined: Mar 20, 2005
Posts: 232
Location: Charlotte, NC

PostPosted: Fri Apr 29, 2005 3:13 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

GJSchaller wrote: › phpMyAdmin?


phpMyAdmin. The optimize you can use from PHPNuke's backend as well but I'd run a repair on it as well. Usually when blocks go missing, it's an issue with a corrupt database. At least that was what my expereince was when I modded on phpnuke.org.

*shrug* Wouldn't hurt.

-drmike
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
GJSchaller

User
User


Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA

PostPosted: Fri Apr 29, 2005 3:50 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

I have the PHP fles uploaded for viewing at:

http://www.knightrealms.com/Pics/

I have the original, non-selectable ones there as well for comparison.
Back to top
Offline View user's profile Send private message Visit poster's website
drmike

Wizard
Wizard


Joined: Mar 20, 2005
Posts: 232
Location: Charlotte, NC

PostPosted: Fri Apr 29, 2005 5:10 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Please kindly change the extentions to .txt. Your server is trying to serve them. Smile

-drmike
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
GJSchaller

User
User


Joined: Aug 04, 2004
Posts: 37
Location: Valhalla, NY, USA

PostPosted: Sun May 01, 2005 6:05 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Done - thank you!
Back to top
Offline View user's profile Send private message Visit poster's website
whitefantom

Beginner
Beginner


Joined: May 05, 2005
Posts: 3

PostPosted: Thu May 05, 2005 11:53 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

dari wrote: › ah, add $admin to the global list up top...


Evidently I'm just thick, because no one else seemed confused by this bit of information, but I have no idea where you mean by "up top." If you mean in the global variables listing at the top of one or more of the three files that make up the selectable block, I've done that (on all three files), and I still only see the random images when I'm logged in as Admin, not the ability to select albums. If you meant to add $admin to a global variables list somewhere else other than at the top of the block files, then I have no idea where I'm supposed to add it. Can anyone clarify?

--Jennifer
Back to top
Offline View user's profile Send private message
whitefantom

Beginner
Beginner


Joined: May 05, 2005
Posts: 3

PostPosted: Fri May 06, 2005 12:47 am    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

SpecialEd wrote: › I see this in the block and nothing else

Quote: › Please create your cache file.


how do I create a cache file?


Actually, I'm now having the problem above. I deleted the cache file, hoping that would help me start fresh, and now I'm getting the "Please create your cache file" message. Was the question above about how to create the cache file ever answered?

--Jennifer
Back to top
Offline View user's profile Send private message
whitefantom

Beginner
Beginner


Joined: May 05, 2005
Posts: 3

PostPosted: Fri May 06, 2005 11:19 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

whitefantom wrote: ›
dari wrote: › ah, add $admin to the global list up top...


Evidently I'm just thick, because no one else seemed confused by this bit of information, but I have no idea where you mean by "up top." If you mean in the global variables listing at the top of one or more of the three files that make up the selectable block, I've done that (on all three files), and I still only see the random images when I'm logged in as Admin, not the ability to select albums. If you meant to add $admin to a global variables list somewhere else other than at the top of the block files, then I have no idea where I'm supposed to add it. Can anyone clarify?

--Jennifer



And now I'm back to this again. I tried simply creating a blank document and naming it block-random.cache, but doing that caused the block to crash with errors (I don't remember what the errors were at the moment, but I can easily recreate the problem and generate the errors again if necessary).

So instead of trying to manually create the file, I re-enabled the old random images block (the one without the album select option, which I had installed previous to installing the selectable version), and by displaying the old block, the cache file was re-created automatically, though with all albums present because it was generated by the old random images block. This caused the selectable images block to display images again (because it was working from the same cache file the non-selectable block had just generated), but as before, I don't get any album selection options when logged into PHPNuke as admin. All I see is the block randomly displaying images. I've added $admin to every global variables list I can find in the three files associated with this block, but it makes no difference. What am I doing--or not doing--that's preventing me from getting the album selection options, and how do I fix it?

--Jennifer
Back to top
Offline View user's profile Send private message
tpaljr

Beginner
Beginner


Joined: Jun 16, 2005
Posts: 10

PostPosted: Tue Jun 28, 2005 7:26 pm    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Warning: main(public_html/blocks/block-NG-RandomPhotoSelectTest_functions.php): failed to open stream: No such file or directory in /home/xxxx/public_html/block-NG-AutoPhoto.php on line 6

Warning: main(public_html/blocks/block-NG-RandomPhotoSelectTest_functions.php): failed to open stream: No such file or directory in /home/xxxx/public_html/block-NG-AutoPhoto.php on line 6

Warning: main(): Failed opening 'public_html/blocks/block-NG-RandomPhotoSelectTest_functions.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/xxxx/public_html/block-NG-AutoPhoto.php on line 6

Fatal error: Call to undefined function: get_photo() in /home/xxxx/public_html/block-NG-AutoPhoto.php on line 18

Dari,
When in admin mode I can see the box as it was designed to do, but when I log out and login normally(non admin mode) the block where the pics suppose to be shows this error ...any ideas? I could pm you the files again if need be.
Back to top
Offline View user's profile Send private message
racer25

Novice
Novice


Joined: Jul 22, 2004
Posts: 21

PostPosted: Tue Oct 11, 2005 2:25 am    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

Hi Guys,

I have the following error message in the block on the our site

Please create your cache file. - The site www.unp-df.com

Below is the code from our block I have checked the paths' with Analyzer to be sure but other than that quite puzzled.

Any ideas would be great

Using PHP 4.3.11, Nuke 7.5 Patched, Gallery 1.5

Anything else please let me know.

Thx

Code: › <?php

/*
 * 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.
 *
 * Developed by Dariush Molavi at NukedGallery.net
 * Version 2.0
 * 13 December 2003
 */

 if (eregi("NG-RandomPhotoSelectTest_functions.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME, $Version_Num;

/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing /          */
/*******************************************************************/
$GALLERY_BASEDIR = "/home/keller/public_html/modules/gallery/";

/*******************************************************************/
/* The module name of your Gallery, default is "gallery"           */
/*******************************************************************/
$GALLERY_MODULENAME = "gallery";

/*******************************************************************/
/* Time, in seconds, to refresh random photo cache. Default is     */
/* 86400 (check it daily)                                          */
/*******************************************************************/
define(CACHE_EXPIRED, 86400);

/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/home/keller/public_html/albums/");



/*******************************************************************/
/*          STOP!! DO NOT EDIT ANYTHING BELOW THIS POINT           */
/*******************************************************************/
define(CACHE_FILE, ALBUM_DIRECTORY."block-random.cache");

$GALLERY_EMBEDDED_INSIDE = "nuke";
$GALLERY_EMBEDDED_INSIDE_TYPE = "phpnuke";

require_once($GALLERY_BASEDIR . "init.php");

function createBlockContent($album,$index,$scale,$auto=0) {
   global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME;

   $id = $album->getPhotoId($index);
   $caption = $album->getCaption($index);
   $photo = $album->getPhoto($index);
   $dir = $album->getAlbumDirURL("full");
   $image = $photo->image;
   $PHOTO_URL = makeAlbumUrl($album->fields['name'], $id);
   $ALBUM_URL = makeAlbumUrl($album->fields['name']);
   if($scale == 0) {
                        if($auto == 0) {
                                $IMG = "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index)."</a><br>";
                        }
                        else {
                                $IMG = "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index)."</a><br>";
                        }
   } else {
                        if($auto == 0) {
                                $IMG = "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
                        else {
                                $IMG = "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
   }
   $FROM = "From: <a href=\"$ALBUM_URL\">" . $album->fields['title'] . '</a>';
   $blockContent .=  "\t$IMG\n";
   $blockContent .= "\t$caption<br />\n";
   $blockContent .= "\t$FROM\n</center>";
   return $blockContent;
}

function get_photo($interval, $scale,$auto=0) {
   global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME;

   switch ($interval) {
      case 0:
         list($album,$index) = get_random_photo_id();
         while($album->getAlbumName($index)) {
            list($album,$index) = get_random_photo_id();
         }
         $blockContent = createBlockContent($album,$index,$scale,$auto);
         return $blockContent;
         break;
      case 1:
         if (file_exists($gallery->app->albumDir."/hourly.txt")) {
            $stat=stat($gallery->app->albumDir."/hourly.txt");
            $modtime = $stat['mtime'];
            if(date("G", $modtime) != date("G", time())) {            
               list($album,$index) = get_random_photo_id();
                              while($album->getAlbumName($index)) {
                                      list($album,$index) = get_random_photo_id();
                              }
               $blockContent = createBlockContent($album,$index,$scale);
               $fp = fopen($gallery->app->albumDir."/hourly.txt","w");
               fwrite($fp,$album->fields['name']."/".$index);
               fclose($fp);
               return $blockContent;
            }
            else {
               $fp = fopen($gallery->app->albumDir."/hourly.txt","r");
               $line = explode("/",fgets($fp));
               $albumName = $line[0];
               $album = new Album();
               $album->load($albumName);
               $index = $line[1];
               $blockContent = createBlockContent($album,$index,$scale);
               return $blockContent;
            }
         }
         else {
            list($album,$index) = get_random_photo_id();
                           while($album->getAlbumName($index)) {
                                   list($album,$index) = get_random_photo_id();
                           }
            $blockContent = createBlockContent($album,$index,$scale);
            $fp = fopen($gallery->app->albumDir."/hourly.txt","w");
            fwrite($fp,$album->fields['name']."/".$index);
            fclose($fp);
            return $blockContent;
         }
         break;
      case 24:
         if (file_exists($gallery->app->albumDir."/daily.txt")) {
            $stat=stat($gallery->app->albumDir."/daily.txt");
            $modtime = $stat['mtime'];
            if(date("d", $modtime) != date("d", time())) {            
               list($album,$index) = get_random_photo_id();
                              while($album->getAlbumName($index)) {
                                      list($album,$index) = get_random_photo_id();
                              }
               $blockContent = createBlockContent($album,$index,$scale);
               $fp = fopen($gallery->app->albumDir."/daily.txt","w");
               fwrite($fp,$album->fields['name']."/".$index);
               fclose($fp);
               return $blockContent;
            }
            else {
               $fp = fopen($gallery->app->albumDir."/daily.txt","r");
               $line = explode("/",fgets($fp));
               $albumName = $line[0];
               $album = new Album();
               $album->load($albumName);
               $index = $line[1];
               $blockContent = createBlockContent($album,$index,$scale);
               return $blockContent;
            }
         }
         else {
            list($album,$index) = get_random_photo_id();
                           while($album->getAlbumName($index)) {
                                   list($album,$index) = get_random_photo_id();
                           }
            $blockContent = createBlockContent($album,$index,$scale);
            $fp = fopen($gallery->app->albumDir."/daily.txt","w");
            fwrite($fp,$album->fields['name']."/".$index);
            fclose($fp);
            return $blockContent;
         }
         break;
   }
}

function get_random_photo_id(){
      /* Initializing the seed */
      srand ((double) microtime() * 1000000);

      readcache();

      $album = choosealbum();

      if ($album) {
         $index = choosephoto($album);
      }
      return array($album,$index);
}

function savecache($chosenArray = '') {
    global $cache;
    if($chosenArray) {
   $cache = $chosenArray;
    }
    $fd = fopen(CACHE_FILE, "w");
    foreach ($cache as $key => $val) {
   fwrite($fd, "$key/$val\n");
    }
    fclose($fd);
}

function readcache() {
    global $cache;
    if ($fd = fs_fopen(CACHE_FILE, "r")) {
      while ($line = fgets($fd, 4096)) {
         list($key, $val) = explode("/", $line);
         $cache[$key] = $val;
      }
      fclose($fd);
    }
}

function choosephoto($album) {
    global $cache, $gallery;

    $count = $cache[$album->fields["name"]];

    if ($count == 0) {
      // Shouldn't happen
      return null;
    } else if ($count == 1) {
      $choose = 1;
    } else {
      $count = floatval($count);
      $choose = rand(1, $count);
      $wrap = 0;
      if ($album->isHidden($choose)) {
         $choose++;
         if ($choose > $album->numPhotos(1)) {
            $choose = 1;
            $wrap++;
            if ($wrap = 2) {
               return null;
            }
         }
      }
    }
    return $choose;
}

function choosealbum() {
    global $cache;

    /*
     * The odds that an album will be selected is proportional
     * to the number of (visible) items in the album.
     */

    $total = 0;
    foreach ($cache as $name => $count) {
      if (!$choose) {
         $choose = $name;
      }

      $total += $count;
      if ($total != 0 && ($total == 1 || rand(1, $total) <= $count)) {
         $choose = $name;
      }
    }

    if ($choose) {
      $album = new Album();
      $album->load($choose);
      return $album;
    } else {
      return null;
    }
}

function scanalbums() {
    global $cache;
    global $gallery;

    $cache = array();
    $everybody = $gallery->userDB->getEverybody();
    $albumDB = new AlbumDB();
    foreach ($albumDB->albumList as $tmpAlbum) {
      if ($everybody->canReadAlbum($tmpAlbum)) {
         $seeHidden = $everybody->canWriteToAlbum($tmpAlbum);
         $numPhotos = $tmpAlbum->numPhotos($seeHidden);
         $name = $tmpAlbum->fields["name"];
         if ($numPhotos > 0) {
            $cache[$name] = $numPhotos;
         }
      }
    }
}

function createAdminList($albumName,$depth=0){
        global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_MODULENAME;

        $printedHeader = 0;
        $myAlbum = new Album();
        $myAlbum->load($albumName);
        $numPhotos = $myAlbum->numPhotos(1);
        for ($i=1; $i <= $numPhotos; $i++) {
                $myName = $myAlbum->getAlbumName($i);
                if ($myName && !$myAlbum->isHidden($i)) {
                        $nestedAlbum = new Album();
                        $nestedAlbum->load($myName);
                        if ($gallery->user->canReadAlbum($nestedAlbum)) {
                                $val2 = $nestedAlbum->fields['title'];
            $photoCount = $nestedAlbum->numPhotos(1);
                                $content .= "<div style=\"margin: 0px 0px 0px 20px\">";
                                $content .= "<span class=fineprint>";
            $content .= "<input type=\"checkbox\" value=\"$photoCount\" name=\"$albumName\">";
                                $content .= "<a href=\"";
                                $content .= makeAlbumUrl($myName);
                                $content .= "\">$val2</a>\n";
                                $content .= createAdminList($myName,$depth+1);
                                $content .= "</span>";
                                $content .= "</div>";
                        }
                }
        }
        return $content;
}

?>
Back to top
Offline View user's profile Send private message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6318
Location: Washington Township, NJ, USA

PostPosted: Tue Oct 11, 2005 7:00 am    Post subject: Re: [TESTING] Selectable Album Random Block Reply with quote

did you create the cache file when you installed the block and are still getting this error?
Back to top
Offline View user's profile Send private message Visit poster's website
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
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next

 
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: Dedicated ServersDomain NamesWeb HostingDomain Name RegistrationDedicated Web HostingWeb Design New YorkSearch Engine OptimisationCompare VoIPSEO IndiaWeb Design Melbournemiami web designSEO IndiaLink BuildingPhoenix SEOPhoenix Web MarketingSEOManual Directory Submission Serviceflorida web design companyScottsdale Interior Designweb marketing servicesScottsdale SEOHome Appliances

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