plugins/Gallery.php
author Dan
Wed, 25 Jul 2007 18:25:24 -0400
changeset 3 10d663f5ed88
parent 2 88c954d2846c
child 5 c0c324f0eeb5
permissions -rwxr-xr-x
Added check in upload wizard to prevent folders from being added to one of their children or to themselves (fatal error: maximum execution time of 600 seconds exceeded anyone?)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     1
<?php
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     2
/*
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     3
Plugin Name: Snapr
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     4
Plugin URI: http://enanocms.org/Enano.Img_Gallery
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     5
Description: Provides an intuitive image gallery system with a browser, viewer for individual images, upload interface, and comment system integration.
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     6
Author: Dan Fuhry
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     7
Version: 0.1 beta 1
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     8
Author URI: http://enanocms.org/
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     9
*/
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    10
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    11
global $db, $session, $paths, $template, $plugins; // Common objects
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    12
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    13
define('GALLERY_VERSION', '0.1b1');
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    14
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    15
$magick_path = getConfig('imagemagick_path');
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    16
if ( !file_exists($magick_path) || !is_executable($magick_path) )
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    17
{
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    18
  $fn = basename(__FILE__);
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    19
  setConfig("plugin_$fn", '0');
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    20
  die('Snapr: You must have ImageMagick installed and working to use this plugin. The plugin has been disabled, please setup ImageMagick and then re-enable it.');
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    21
}
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    22
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    23
if ( !getConfig('gallery_version') )
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    24
{
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    25
  $q = $db->sql_query('CREATE TABLE '.table_prefix.'gallery(
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    26
                        img_id int(12) NOT NULL auto_increment,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    27
                        is_folder tinyint(1) NOT NULL DEFAULT 0,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    28
                        folder_parent int(12) DEFAULT NULL,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    29
                        img_title varchar(255) NOT NULL DEFAULT \'\',
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    30
                        img_desc longtext NOT NULL DEFAULT \'\',
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    31
                        print_sizes longtext NOT NULL DEFAULT \'\',
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    32
                        img_filename varchar(255) NOT NULL,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    33
                        img_time_upload int(12) NOT NULL DEFAULT 0,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    34
                        img_time_mod int(12) NOT NULL DEFAULT 0,
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    35
                        PRIMARY KEY ( img_id )
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    36
                      );');
2
88c954d2846c Added search functionality (WiP); removed stray .marks file
Dan
parents: 0
diff changeset
    37
  
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    38
  if ( !$q )
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    39
    $db->_die();
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    40
  
2
88c954d2846c Added search functionality (WiP); removed stray .marks file
Dan
parents: 0
diff changeset
    41
  $q = $db->sql_query('CREATE FULLTEXT INDEX '.table_prefix.'gal_idx ON '.table_prefix.'gallery(img_title, img_desc);');
88c954d2846c Added search functionality (WiP); removed stray .marks file
Dan
parents: 0
diff changeset
    42
  
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    43
  setConfig('gallery_version', GALLERY_VERSION);
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    44
}
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    45
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    46
require( ENANO_ROOT . '/plugins/gallery/functions.php' );
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    47
require( ENANO_ROOT . '/plugins/gallery/nssetup.php' );
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    48
require( ENANO_ROOT . '/plugins/gallery/viewimage.php' );
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    49
require( ENANO_ROOT . '/plugins/gallery/browser.php' );
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    50
require( ENANO_ROOT . '/plugins/gallery/upload.php' );
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    51
require( ENANO_ROOT . '/plugins/gallery/fetcher.php' );
2
88c954d2846c Added search functionality (WiP); removed stray .marks file
Dan
parents: 0
diff changeset
    52
require( ENANO_ROOT . '/plugins/gallery/search.php' );
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    53
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    54
?>