diff -r 0944c9354e9c -r 7c6e2e97aa08 plugins/Gallery.php --- a/plugins/Gallery.php Sat Aug 21 23:25:41 2010 -0400 +++ b/plugins/Gallery.php Sat Aug 21 23:32:06 2010 -0400 @@ -1,13 +1,13 @@ This version of Snapr requires Enano 1.1.6 or later.

'); + $fn = basename(__FILE__); + setConfig("plugin_$fn", '0'); + die_semicritical('Snapr can\'t load on this site', '

This version of Snapr requires Enano 1.1.6 or later.

'); } $magick_path = getConfig('imagemagick_path', '/usr/bin/convert'); $have_gd_scale_support = function_exists('imagecreatetruecolor') && function_exists('imagejpeg') && function_exists('imagecopyresampled'); if ( (!file_exists($magick_path) || !is_executable($magick_path)) && !$have_gd_scale_support ) { - $fn = basename(__FILE__); - // set disabled flag with new plugin system - if ( defined('ENANO_ATLEAST_1_1') && defined('PLUGIN_DISABLED') ) - { - $q = $db->sql_query('UPDATE ' . table_prefix . "plugins SET plugin_flags = plugin_flags | " . PLUGIN_DISABLED . " WHERE plugin_filename = 'Gallery.php';"); - if ( !$q ) - $db->_die(); + $fn = basename(__FILE__); + // set disabled flag with new plugin system + if ( defined('ENANO_ATLEAST_1_1') && defined('PLUGIN_DISABLED') ) + { + $q = $db->sql_query('UPDATE ' . table_prefix . "plugins SET plugin_flags = plugin_flags | " . PLUGIN_DISABLED . " WHERE plugin_filename = 'Gallery.php';"); + if ( !$q ) + $db->_die(); - // kill off cache - global $cache; - $cache->purge('plugins'); - } - else - { - // old plugin system - setConfig("plugin_$fn", '0'); - } - - die_semicritical('Snapr can\'t load on this site', '

You must have ImageMagick or GD installed and working to use this plugin. The plugin has been disabled, please setup ImageMagick and then re-enable it.

'); + // kill off cache + global $cache; + $cache->purge('plugins'); + } + else + { + // old plugin system + setConfig("plugin_$fn", '0'); + } + + die_semicritical('Snapr can\'t load on this site', '

You must have ImageMagick or GD installed and working to use this plugin. The plugin has been disabled, please setup ImageMagick and then re-enable it.

'); } +$plugins->attachHook('pgsql_set_serial_list', '$primary_keys[table_prefix."gallery"] = "img_id";'); + /**!install dbms="mysql"; ** CREATE TABLE {{TABLE_PREFIX}}gallery( @@ -59,6 +61,7 @@ img_filename varchar(255) NOT NULL, img_time_upload int(12) NOT NULL DEFAULT 0, img_time_mod int(12) NOT NULL DEFAULT 0, + img_author int(12) NOT NULL DEFAULT 1, img_tags longtext, PRIMARY KEY ( img_id ) ); @@ -91,6 +94,14 @@ /**!upgrade dbms="mysql"; from="0.1 beta 3"; to="0.1b3"; ** **!*/ +/**!upgrade dbms="mysql"; from="0.1b3"; to="0.1b4"; ** +ALTER TABLE {{TABLE_PREFIX}}gallery ADD COLUMN img_author int(12) NOT NULL DEFAULT 1; +ALTER TABLE {{TABLE_PREFIX}}gallery ADD COLUMN processed tinyint(1) NOT NULL DEFAULT 1; +-- Set all images to authorship by the first administrator we can find +UPDATE {{TABLE_PREFIX}}gallery SET img_author = ( SELECT user_id FROM {{TABLE_PREFIX}}users WHERE user_level = 9 ORDER BY user_id DESC LIMIT 1 ), processed = 1; + +**!*/ + require( ENANO_ROOT . '/plugins/gallery/functions.php' ); require( ENANO_ROOT . '/plugins/gallery/nssetup.php' ); require( ENANO_ROOT . '/plugins/gallery/viewimage.php' );