SPGM (Simple Picture Gallery Manager)

From phpCMS

Jump to: navigation, search

Contents

[edit] What is it?

"SPGM is a PHP script that displays picture galleries on the web. It is intended to provide a very simple way to set up online photo albums: creating directories, filling them with pictures and uploading to your website."

The following information is based on SPGM version 1.4.2 released 2004/12/27

[edit] How to proceed

Download and install SPGM as described in the install instructions.
Only after it is running to your satisfaction go to the next step!

[edit] The usual first steps

Create a template file (.tpl) for your gallery and put a field like

{SCRIPT_01}

into it.

Create a content file (.htm[l]) for your gallery and put your content plus this

{SCRIPT_01} ./spgm.php

into it. (Adapt the path to "spgm.php" if necessary.)

[edit] The problem

When calling a gallery from the gallery overview via phpCMS when in Secure Stealth Mode (or pictures from a gallery thumb view), you will get an error message like this:

This is phpCMS 1.2.1 in Secure Stealth Mode.
You cannot access files via the parser!
Access denied!

The error message comes from phpCMS when in Secure Stealth Mode, where any attempt to put a variable named "file" via GET or POST to the content page results in this error message.
That is to avoid that someone tries to call your files by "http://yourserver/parser/parser.php?file="/path/to/content/file.htm " because in some cases this might be a security risc.
This will even not work with deactivated Secure Stealth Mode because phpCMS uses this URI parameter (or variable) to parse the correct contentfile.

But SPGM is using exactly this form to call the gallery, the pictures etc.
So you have to replace it.

[edit] The solution

You have to find all the place(s) within the script where it prints out "file=" and replace it by something else (e.g. "page=") and of course you have to find the place(s) where the script reads that parameter, and change them accordingly.

But with SPGM those places are not easy to find as all is hidden in variables.

To run SPGM under phpCMS do the following:

In the file "spgm.php" look for the line (about line no. 221, in SPGM version 1.4.7 from line 1870) reading:

   if (substr($key, 0, strlen(PARAM_PREFIX)) != PARAM_PREFIX) {

and insert this after it:

   if (substr($key, 0, strlen('file')) == 'file') {   // addition for phpCMS - start
      $key = str_replace('file', 'page', $key);       // for phpCMS replace 'file' by 'page'
   }                                                  // addition for phpCMS - end

so that this:

foreach ($_GET as $key => $value) {
   if (substr($key, 0, strlen(PARAM_PREFIX)) != PARAM_PREFIX) {
      $cfg['global']['URLExtraParams'] .= '&'.$key.'='.$value;
   }
}

becomes this:

foreach ($_GET as $key => $value) {
   if (substr($key, 0, strlen(PARAM_PREFIX)) != PARAM_PREFIX) {
      if (substr($key, 0, strlen('file')) == 'file') {   // addition for phpCMS - start
         $key = str_replace('file', 'page', $key);       // for phpCMS replace 'file' by 'page'
      }                                                  // addition for phpCMS - end
      $cfg['global']['URLExtraParams'] .= '&'.$key.'='.$value;
   }
}

The file "index.php" is then no longer needed, but it may help you to build your template.tpl and maybe even a special header.tpl for your gallery.

Harald 15:01, 1 Jan 2005 (CET) (with explanations by Martin Jahn and "joe" in the phpCMS Forum)


Main Page: Main Page | Top Page: Tutorials MainPage

Personal tools