psnGallery2 1.2.1 changes overview

Well, I know it is always annoying to wait for news…. So here are some… 🙂

The most important addition/change with the release is the fact that all the configuration parameters are now stored in a table in the “wordpress” database (see below to have further information).

Here are the differents news functionnalities available with psnGallery2 1.2.1 :

  • User Defined tags for posting where you associate a tag to php code
  • Coppermine Albums viewer within WP-Admin area
  • Coppermine Pictures viewer within WP-Admin area
  • psnGallery2 parameters viewer within WP-Admin area
  • Fix of few bugs
  • etc…

In the future versions, I will add a “online” configuration of psnGallery2.

Here below, the new table structure :

#
# Table structure for table `wp_psnGallery`
#

CREATE TABLE `wp_psnGallery` (
`ID` int(11) NOT NULL auto_increment,
`kind` enum('TAG','CONFIG') NOT NULL default 'TAG',
`key` varchar(64) NOT NULL default '',
`value` text NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `kind` (`kind`,`key`)
) TYPE=MyISAM COMMENT='WP psnGallery2 Tags configuration' AUTO_INCREMENT=58 ;

The default values for the psnGallery2 configuration parameters.
It is very important to have them correct before activating the psnGalley plugin.

INSERT INTO `wp_psnGallery` VALUES (1, 'CONFIG', 'DBSERVER', 'localhost'); // database server usually 'localhost'
INSERT INTO `wp_psnGallery` VALUES (2, 'CONFIG', 'DBUSER', 'username'); // database user name
INSERT INTO `wp_psnGallery` VALUES (3, 'CONFIG', 'DBPASS', 'password'); // database password (not crypted for the moment)
INSERT INTO `wp_psnGallery` VALUES (4, 'CONFIG', 'DBNAME', 'database'); // Coppermine database name
INSERT INTO `wp_psnGallery` VALUES (5, 'CONFIG', 'TBLPREFIX', 'cpg11d_'); // Coppermine table prefix
INSERT INTO `wp_psnGallery` VALUES (6, 'CONFIG', 'DEBUGFLAG', '0'); // debug flag (only for DEV purpose)
INSERT INTO `wp_psnGallery` VALUES (7, 'CONFIG', 'MAXPICT', '200'); // Maximum number of pictures displayed per album
INSERT INTO `wp_psnGallery` VALUES (8, 'CONFIG', 'EXIF', '0'); // EXIF support (not yet supported)
INSERT INTO `wp_psnGallery` VALUES (9, 'CONFIG', 'CPG_TAG_PREFIX', 'cpg_'); // user defined tag prefix
INSERT INTO `wp_psnGallery` VALUES (10, 'CONFIG', 'TABLE_PICTURES', 'pictures');
INSERT INTO `wp_psnGallery` VALUES (11, 'CONFIG', 'TABLE_ALBUMS', 'albums');
INSERT INTO `wp_psnGallery` VALUES (12, 'CONFIG', 'TABLE_COMMENTS', 'comments');
INSERT INTO `wp_psnGallery` VALUES (13, 'CONFIG', 'TABLE_CATEGORIES', 'categories');
INSERT INTO `wp_psnGallery` VALUES (14, 'CONFIG', 'TABLE_CONFIG', 'config');
INSERT INTO `wp_psnGallery` VALUES (15, 'CONFIG', 'TABLE_USERGROUPS', 'usergroups');
INSERT INTO `wp_psnGallery` VALUES (16, 'CONFIG', 'TABLE_VOTES', 'votes');
INSERT INTO `wp_psnGallery` VALUES (17, 'CONFIG', 'TABLE_USERS', 'users');

And finally the user defined tags ! You only have to defined a tag and associated to it a call to an existing function. Be carefull ! There is not limitation except the “CPG_TAG_PREFIX” for the tag itself.

The principle is very simple : You add a record in the table and the tag is active ! Each time, a post contains that specific tag, the associated php function will be executed (whatever is the function….)
SO BE VERY CAREFULL !!!! COULD BE VERY DANGEROUS !

One default tag exists : the tag “gallery” which will execute the CPGRndPicture function.

In the example below, once you have the parameter ‘album’, in fact the tag to use in the post will be : cpg_album. Indeed, the configura
tion parameter “CPG_TAG_PREFIX” is added in front of all the user-defined tags !

INSERT INTO `wp_psnGallery` VALUES (50, 'TAG', 'gallery', 'CPGRndPicture($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);');
INSERT INTO `wp_psnGallery` VALUES (51, 'TAG', 'album', 'CPGAlbum($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);');
INSERT INTO `wp_psnGallery` VALUES (52, 'TAG', 'albumthumb', 'CPGAlbumThumb($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]); ');
INSERT INTO `wp_psnGallery` VALUES (53, 'TAG', 'albumname', 'CPGAlbumName($elems[0]) ;');
INSERT INTO `wp_psnGallery` VALUES (54, 'TAG', 'categoryname', 'CPGCategoryName($elems[0]) ;');
INSERT INTO `wp_psnGallery` VALUES (55, 'TAG', 'albumpiccount', 'CPGAlbumPicCount($elems[0]);');
INSERT INTO `wp_psnGallery` VALUES (56, 'TAG', 'albumcatlist', 'CPGAlbumListCategory($elems[0], $elems[1], $elems[2], $elems[3], $elems[4]) ');
INSERT INTO `wp_psnGallery` VALUES (57, 'TAG', 'picture', 'CPGPicture($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);)');

Normally the new version will be out tonight