%flags>
inherit => undef
%flags>
<%args>
$control => 'photogallerylist'
$catID => undef
$subcatID => undef
%args>
<%shared>
#Editable Information
#my $database = 'clubroundtable';
#my $database_login = 'clubroundtable';
#my $database_pass = 'redbeard23';
#my $set_id = 2;
#my $cookieName = 'CRTPHOTO';
#my $path = '/www/clubroundtable/photogallery/bandphotogallery.htm';
#End Edit Info
#EXTERNAL vars
my $EXTERNAL_dbh;
#---
my $database;
my $database_login;
my $database_pass;
my $set_id;
my $cookieName;
my $domainName;
my $lines_per_page = 10;
my $page;
my ($filePath) = ($r->filename =~ /(.*\/)/);
my ($file) = ($r->filename =~ /.*\/(.*)/);
my $pgid = 0;
my %IARGS;
my $dbh;
my $isAdmin = 0;
my $configFileName;
%shared>
<%init>
use DBI;
%IARGS = %ARGS;
$page = ($IARGS{page} < 1 ? 1 : $IARGS{page});
$pgid = $IARGS{'pg_id'} if ($IARGS{'pg_id'} ne '');
$IARGS{page} = 1 if ($IARGS{page} eq '');
#check to see if there IS a config gile
#Gets the filename before the first period
($configFileName) = ($r->filename =~ /([\w\d]*)\./);
#set the cookie name to the file name
$cookieName = $configFileName;
#tac on .mas
$configFileName .= "\.mas";
#$m->comp("defStartupCheck") if (! -e $filePath.$configFileName);
$m->comp("defStartupCheck") if (!$m->comp("defReadConfigFile"));
use Date::Calc qw(:all);
#$m->comp("defStartupCheck") if ($r->filename ne $path);
$dbh = DBI->connect("DBI:mysql:$database", $database_login, $database_pass) || $m->comp("error_noreturn", message => "The config file is set to run, but either the database name, login, or password is incorrect.");
my $pg_ref;
if ($control ne 'photogallerylist'){
$pg_ref = $dbh->selectrow_hashref("Select photogallery_set_id, photogallery_view_protected,photogallery_view_login from Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id);
}
if ($control eq 'photogallerylist') {
$pg_ref = $dbh->selectrow_hashref("Select photogallery_set_id from Photogallery_defaults Where photogallery_set_id = ?",undef,$set_id);
}
#my $setidExists = $dbh->selectrow_array("Select photogallery_set_id from Photogallery_defaults Where photogallery_set_id = ?",undef,$set_id);
$m->comp("defStartupCheck") if ($pg_ref->{'photogallery_set_id'} ne $set_id);
my %cookies = Apache::Cookie->fetch;
if ($cookies{$cookieName."1"}) {
my $cookie_id = $cookies{$cookieName."1"}->value;
my $cookie_name = $cookies{$cookieName."2"}->value;
#my $sth;
#my $login_ref;
my $login_ref = $dbh->selectrow_hashref("Select login_name From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$cookie_id,$set_id);
if ($login_ref->{'login_name'} eq $cookie_name) {
if (($pgid eq $cookie_id) || ($cookie_id eq '0')){
$isAdmin = 1;
}
}
}
if (!$isAdmin && $pg_ref->{'photogallery_view_protected'} && ($control ne 'protectloginsubmit') && ($control ne 'topredirect')) {
if ( !$cookies{$cookieName."PROTECT"} || ($cookies{$cookieName."PROTECT"}->value ne $pg_ref->{'photogallery_view_login'})){
$m->comp("defProtectedPhotogalleryLogin");
}
}
%init>
<& $control &>
<%def topframe>
<%init>
my $hash_ref;
my $sth = $dbh->prepare("Select mainframe_width,leftframe_height From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?");
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
%init>
%def>
<%def categories>
<%init>
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my ($optionEnabled) = $dbh->selectrow_array("Select options_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id);
my ($faq_url) = $dbh->selectrow_array("Select faq_url From Photogallery_defaults Where photogallery_id = 0 AND photogallery_set_id = ?",undef,$set_id);
%init>
% my $opencat = $IARGS{'opencat'};
leftmargin=0>
% if ($hash_ref->{'guest_upload_enabled'}) {
% }
<& defCategoryListing &>
% if ($isAdmin) {
% }
%def>
<%def defCategoryListing>
<%init>
my $cat_sth;
my $subcat_sth;
my $cat_hashref;
my $subcat_hashref;
%init>
%#Begin Category loop
<%perl>
$cat_sth = $dbh->prepare("Select * From Photogallery_categories Where parent_id = 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ? ORDER BY cat_position");
$cat_sth->execute($pgid,$set_id);
%perl>
% while ($cat_hashref = $cat_sth->fetchrow_hashref) {
% my $leftpad = $cat_hashref->{'cat_leftpadding'};
% my $toppad = $cat_hashref->{'cat_toppadding'};
%#Begin SubCategory loop
<%perl>
$subcat_sth = $dbh->prepare("Select * From Photogallery_categories Where parent_id = ? ORDER BY cat_position");
$subcat_sth->execute($cat_hashref->{'cat_id'});
%perl>
% while ($subcat_hashref = $subcat_sth->fetchrow_hashref) {
% if (!$isAdmin) {
% if ($hash_ref->{'prev_page_image'}) {
% } else {
Prev
% }
% }
% $prev++;
%}
% if ($isAdmin) {
%def>
<%def piclisting>
% if ($IARGS{'subcatID'} eq '-1') {
<& defPicListingNewPhoto &>
% } else {
<& defPicListingNormal &>
% }
%def>
<%def defPicListingNewPhoto>
<%init>
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
%init>
% my $piclist_ref;
% my $count =0;
% my $picsh = $dbh->prepare("Select * from Photogallery_pictures WHERE pic_who_uploaded = 'guest' AND pic_photogallery_id = ?");
% $picsh->execute($pgid);
% while ($piclist_ref = $picsh->fetchrow_hashref) {
<% ( ($count % 4) ? "" : ( $count == 0 ? "
" : "
") )%>
%$count++;
%}
% $picsh->finish;
%def>
<%def login>
Photogallery Login
%def>
<%def defSubCatShowPic>
<%init>
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my $pic_ref = $dbh->selectrow_hashref("Select * From Photogallery_pictures Where pic_id =?",undef,$IARGS{'picid'});
my $subcat_ref = $dbh->selectrow_hashref("Select * From Photogallery_categories Where cat_id = ?",undef,$pic_ref->{'pic_category_id'});
%init>
% if ($IARGS{picid}) {
{'pic_url'} ne '' ? "href=\"http:\/\/$pic_ref->{'pic_url'}\" target=_new" : "")%> >
% }
% my $magnifier_enabled = $dbh->selectrow_array("Select pic_magnifier_enabled from Photogallery_pictures where pic_id = ?",undef,$IARGS{'picid'});
% if ($magnifier_enabled) {
%}
<% ($maxPics ? int(($inGallery/$maxPics)*100) : "0") %>% Used
%def>
<%def newphotoshow>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults');
$sth->execute;
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my $pic_ref = $dbh->selectrow_hashref("Select * From Photogallery_pictures Where pic_id =?",undef,$IARGS{'picid'});
my $subcat_ref = $dbh->selectrow_hashref("Select * From Photogallery_categories Where cat_id = ?",undef,$pic_ref->{'pic_category_id'});
my $parent;
($parent) = $dbh->selectrow_array("Select cat_name From Photogallery_categories Where cat_id = ?",undef,$subcat_ref->{'parent_id'});
%init>
% if ($IARGS{picid}) {
{'pic_url'} ne '' ? "href=\"http:\/\/$pic_ref->{'pic_url'}\" target=_new" : "")%> >
% }
The defaults are setup like this. Below is a dropdown that you may change that will allow THIS photogallery that you currently are modifying to use the defaults of another photogallery.
Use defaults from the photogallery below:
%def>
<%def change_default>
<%init>
my $config_id = $dbh->selectrow_array("Select config_id from Photogallery_config where config_photogallery_id = ? AND config_photogallery_set_id = ?",undef, $m->request_args->{change_to_pgid}, $set_id);
$dbh->do("Update Photogallery_defaults set config_id = ? where photogallery_id = ? and photogallery_set_id = ?",undef,$config_id,$pgid, $set_id);
$m->redirect("?control=modifyphotogallery&pg_id=".$pgid);
%init>
%def>
<%def updatephotogallery>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
#$dbh->do("LOCK TABLES Photogallery_defaults WRITE");
#print $pgid . $set_id;
#$m->flush_buffer;
#$m->abort;
#my ($nextPhotogallery) = $dbh->selectrow_array("Select MAX(photogallery_id) From Photogallery_defaults Where photogallery_set_id = ?",undef,$set_id);
$dbh->do("Update Photogallery_defaults set
photogallery_name = ?,
login_name = ?,
login_pass = ?,
max_pics = ?,
options_enabled =?,
files_enabled = ?,
basic_control = ?,
magnifier_enabled = ?
Where
photogallery_id = ? AND photogallery_set_id = ?",
undef,
$IARGS{'ph_name'},
$IARGS{'ph_login'},
$IARGS{'ph_pass'},
$IARGS{'ph_maxpic'},
$IARGS{'optioncontrol'},
$IARGS{'filecontrol'},
$IARGS{'basiccontrol'},
$IARGS{'magenabled'},
$pgid,
$set_id);
$m->redirect("$file");
%init>
%def>
<%def delphotogallery>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
if ( ($IARGS{del_id_checkbox} eq $IARGS{del_id}) && ($IARGS{del_set_checkbox} eq $set_id)) {
#print $IARGS{del_id}, $set_id;
#$m->flush_buffer;
#$m->abort;
$dbh->do("Delete From Photogallery_pictures Where pic_photogallery_id = ? AND pic_photogallery_set_id = ?",undef,$IARGS{del_id},$set_id);
$dbh->do("Delete From Photogallery_categories Where cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef,$IARGS{del_id},$set_id);
$dbh->do("Delete From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$IARGS{del_id},$set_id);
}
$m->comp("defUpdatePicCount");
$m->redirect("$file");
%init>
%def>
<%def defStartupCheck>
<%init>
my $databaseLogin = 'Failed';
my $bad_login = 0;
$bad_login = 1 if ($database eq '' || $database_login eq '' || $database_pass eq '');
$dbh = DBI->connect("DBI:mysql:$database", $database_login, $database_pass) || (
$bad_login = 1);
my %defStartupCall = ('maketables' => 'defMakeTables',
'makesetadmin' => 'defMakeSetAdmin');
$m->comp($defStartupCall{$IARGS{'control'}}) if ($defStartupCall{$IARGS{'control'}} ne '');
my $CategoryExist = 0;
my $DefaultExist = 0;
my $PicExist = 0;
my $PGIDzero = 0;
if (!$bad_login) {
$databaseLogin = 'Success';
$PicExist = $dbh->selectrow_array("SHOW TABLES LIKE 'Photogallery_pictures'");
$CategoryExist = $dbh->selectrow_array("SHOW TABLES LIKE 'Photogallery_categories'");
$DefaultExist = $dbh->selectrow_array("SHOW TABLES LIKE 'Photogallery_defaults'");
#$CategoryExist = $dbh->selectrow_hashref("Select cat_id From Photogallery_categories");
#$DefaultExist = $dbh->selectrow_hashref("Select photogallery_set_id From Photogallery_defaults");
#$PicExist = $dbh->selectrow_hashref("Select pic_id From Photogallery_pictures");
$PGIDzero = $dbh->selectrow_hashref("Select login_name, login_pass From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,0,$set_id);
}
%init>
% if ($CategoryExist && $DefaultExist && $PicExist) {
All Tables Exist
% } elsif ($databaseLogin ne 'Success') {
Database login is incorrect
% } else {
Some tables do not exist
%def>
<%def updatesetinfo>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
$dbh->do("Update Photogallery_defaults set
list_enabled=?,
photogallery_set_name =?,
background_url = ?,
faq_url = ?
Where photogallery_id = ?
AND
photogallery_set_id = ?",
undef,
$IARGS{publicphotolist},
$IARGS{set_name},
$IARGS{background_url},
$IARGS{faq_url},
0,
$set_id);
$m->redirect("$file");
%init>
%def>
<%def filebackground>
<%init>
use File::MMagic;
my $IncommingImage;
if ($IARGS{'background_file'}){
my $data = $r->upload->fh;
while (<$data>) { $IncommingImage .= $_ }
$m->comp("defAutomaticBackground",'data' => $IncommingImage,'gallery_id' => $pgid);
}
%init>
%def>
<%def urlbackground>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
if ($IARGS{background_url}) {
my $imageBinary = $m->comp("defGetImageFromURL",'URL' => $IARGS{background_url});
$m->comp("defAutomaticBackground",'data' => $imageBinary,'gallery_id' => $pgid);
}
%init>
%def>
<%def declinephotoadmin>
<%init>
$m->redirect("$file?control=noaccess") if (!$isAdmin);
#print $IARGS{check_delete} . " " . $IARGS{del_pic_id};
#$m->flush_buffer;
#$m->abort;
$dbh->do("Delete From Photogallery_pictures Where pic_id = ?",undef,$IARGS{'delphotoid'});
$m->comp("defUpdatePicCount");
%init>
%def>
<%def defMakeTables>
<%init>
$dbh->do("DROP TABLE IF EXISTS Photogallery_config");
$dbh->do("CREATE TABLE Photogallery_config (
config_id double NOT NULL auto_increment,
config_cat_icon_data blob NOT NULL,
config_cat_font varchar(100) NOT NULL default 'arial',
config_cat_font_size varchar(100) NOT NULL default '4',
config_cat_font_color varchar(100) NOT NULL default 'gray',
config_cat_font_style varchar(100) NOT NULL default 'bold',
config_cat_font_mouseover_color varchar(100) NOT NULL default 'gray',
config_cat_font_mouseover_underline varchar(100) NOT NULL default '1',
config_cat_left varchar(100) NOT NULL default '10',
config_cat_top varchar(100) NOT NULL default '0',
config_subcat_icon_data varchar(100) NOT NULL default '',
config_subcat_font varchar(100) NOT NULL default 'arial',
config_subcat_font_size varchar(100) NOT NULL default '3',
config_subcat_font_color varchar(100) NOT NULL default 'gray',
config_subcat_font_style varchar(100) NOT NULL default 'bold',
config_subcat_font_mouseover_color varchar(100) NOT NULL default 'gray',
config_subcat_font_mouseover_underline varchar(100) NOT NULL default '1',
config_subcat_left varchar(100) NOT NULL default '15',
config_subcat_top varchar(100) NOT NULL default '0',
config_piclisting_title_font varchar(100) NOT NULL default 'arial',
config_piclisting_title_color varchar(100) NOT NULL default 'gray',
config_piclisting_title_size varchar(100) NOT NULL default '2',
config_piclisting_title_style varchar(100) NOT NULL default 'bold',
config_piclisting_rows varchar(100) NOT NULL default '0',
config_piclisting_cols varchar(100) NOT NULL default '4',
config_piclisting_top varchar(100) NOT NULL default '5',
config_piclisting_left varchar(100) NOT NULL default '5',
config_piclisting_space varchar(100) NOT NULL default '5',
config_piclisting_border_width varchar(100) NOT NULL default '1',
config_piclisting_border_color varchar(100) NOT NULL default 'gray',
config_pages_enabled varchar(100) NOT NULL default '0',
config_pages_thumbs_per_page varchar(100) NOT NULL default '4',
config_pages_list_where varchar(100) NOT NULL default 'none',
config_image_border_width varchar(100) NOT NULL default '1',
config_image_border_color varchar(100) NOT NULL default 'gray',
config_image_top varchar(100) NOT NULL default '5',
config_image_left varchar(100) NOT NULL default '5',
config_description_width varchar(100) NOT NULL default '300',
config_description_top varchar(100) NOT NULL default '200',
config_description_left varchar(100) NOT NULL default '5',
config_frameset_resize varchar(100) NOT NULL default '0',
config_frameset_border_color varchar(100) NOT NULL default 'gray',
config_frameset_border_width varchar(100) NOT NULL default '2',
config_thumbnail_resize varchar(100) NOT NULL default 'resizewh',
config_thumbnail_width varchar(100) NOT NULL default '150',
config_thumbnail_height varchar(100) NOT NULL default '120',
config_picture_resize varchar(100) NOT NULL default 'resizeheight',
config_picture_width varchar(100) NOT NULL default '350',
config_picture_height varchar(100) NOT NULL default '400',
config_cat_icon_mime varchar(100) NOT NULL default '',
config_photogallery_id varchar(100) NOT NULL default '',
config_photogallery_set_id varchar(100) NOT NULL default '',
config_piclisting_title_xposition varchar(100) NOT NULL default '0',
config_piclisting_title_yposition varchar(100) NOT NULL default '0',
PRIMARY KEY (config_id)
) TYPE=MyISAM;");
$dbh->do("DROP TABLE IF EXISTS Photogallery_categories");
$dbh->do("CREATE TABLE Photogallery_categories (
cat_id int(11) NOT NULL auto_increment,
cat_name varchar(100) NOT NULL default 'blank',
parent_id int(11) default '0',
cat_font varchar(30) NOT NULL default 'Arial',
cat_size tinyint(4) NOT NULL default '3',
cat_color varchar(15) NOT NULL default 'red',
cat_mouseover_color varchar(15) NOT NULL default 'yellow',
cat_leftpadding tinyint(4) NOT NULL default '15',
cat_toppadding tinyint(4) NOT NULL default '0',
cat_style varchar(10) NOT NULL default 'bold',
cat_position int(11) NOT NULL default '0',
cat_icon blob NOT NULL,
cat_icon_mime varchar(100) NOT NULL default '',
cat_thumbnail_width int(11) NOT NULL default '0',
cat_thumbnail_height int(11) NOT NULL default '110',
cat_thumbnail_att varchar(100) NOT NULL default 'resizeheight',
cat_image_width int(11) NOT NULL default '0',
cat_image_height int(11) NOT NULL default '350',
cat_image_att varchar(100) NOT NULL default 'resizeheight',
cat_guest_upload tinyint(1) NOT NULL default '0',
cat_mouseover_underline tinyint(1) NOT NULL default '1',
cat_piclist_rows int(11) NOT NULL default '0',
cat_piclist_cols int(11) NOT NULL default '5',
cat_thumbnail_border int(11) NOT NULL default '2',
cat_thumbnail_border_color varchar(100) NOT NULL default 'red',
cat_image_border int(11) NOT NULL default '3',
cat_image_border_color varchar(100) NOT NULL default 'red',
cat_piclist_top int(11) NOT NULL default '5',
cat_piclist_left int(11) NOT NULL default '0',
cat_piclist_padding int(11) NOT NULL default '3',
cat_piclist_title varchar(100) NOT NULL default '',
cat_piclist_title_font varchar(100) NOT NULL default 'Arial',
cat_piclist_title_size int(11) NOT NULL default '2',
cat_piclist_title_color varchar(100) NOT NULL default 'red',
cat_piclist_title_style varchar(100) NOT NULL default 'bold',
cat_piclist_title_xposition int(11) NOT NULL default '3',
cat_piclist_title_yposition int(11) NOT NULL default '0',
cat_image_xposition int(11) NOT NULL default '4',
cat_image_yposition int(11) NOT NULL default '4',
cat_description_width int(11) NOT NULL default '194',
cat_description_xposition int(11) NOT NULL default '516',
cat_description_yposition int(11) NOT NULL default '0',
cat_frame_resize tinyint(1) NOT NULL default '1',
cat_frame_border_color varchar(100) NOT NULL default 'red',
cat_frame_border_width int(11) NOT NULL default '3',
cat_photogallery_id varchar(100) NOT NULL default '',
cat_photogallery_set_id varchar(100) NOT NULL default '',
cat_startup_html longtext NOT NULL,
cat_is_hidden tinyint(1) NOT NULL default '0',
cat_startup_html_url varchar(200) NOT NULL default '',
cat_startup_html_choose varchar(100) NOT NULL default 'html',
cat_thumbnail_pages_enabled varchar(100) NOT NULL default '',
cat_thumbs_per_page varchar(100) NOT NULL default '',
cat_page_numbers varchar(100) NOT NULL default 'none',
PRIMARY KEY (cat_id),
UNIQUE KEY Photogallery_categories_index (cat_id)
) TYPE=MyISAM;");
$dbh->do("DROP TABLE IF EXISTS Photogallery_defaults");
$dbh->do("CREATE TABLE Photogallery_defaults (
logo_data longblob NOT NULL,
logo_mime varchar(100) NOT NULL default '',
cateogry_background_image longblob NOT NULL,
category_background_color varchar(100) NOT NULL default 'FFFFFF',
cateogry_background_mime varchar(100) NOT NULL default '',
piclisting_rows int(11) NOT NULL default '0',
piclisting_cols int(11) NOT NULL default '0',
mainframe_width int(11) NOT NULL default '200',
leftframe_height int(11) NOT NULL default '150',
login_name varchar(100) NOT NULL default '',
login_pass varchar(100) NOT NULL default '',
logo_url varchar(250) NOT NULL default 'http://www.clubroundtable.com',
cateogry_order varchar(100) NOT NULL default '',
sub_category_order varchar(100) NOT NULL default '',
rightframe_height int(11) NOT NULL default '150',
piclisting_bg_color varchar(100) NOT NULL default 'FFFFFF',
content_bg_color varchar(100) NOT NULL default 'FFFFFF',
cat_bg_scrolling varchar(100) NOT NULL default 'fixed',
cat_bg_repeat varchar(100) NOT NULL default 'repeat-y',
cat_bg_vposition varchar(100) NOT NULL default '',
cat_bg_hposition varchar(100) NOT NULL default '',
guest_upload_enabled tinyint(1) NOT NULL default '0',
guest_upload_font varchar(100) NOT NULL default 'Arial',
guest_upload_size varchar(100) NOT NULL default '3',
guest_upload_style varchar(100) NOT NULL default 'bold',
guest_upload_color varchar(100) NOT NULL default 'green',
content_bg_image longblob NOT NULL,
content_bg_mime varchar(100) NOT NULL default '',
piclisting_bg_image longblob NOT NULL,
piclisting_bg_mime varchar(100) NOT NULL default '',
piclisting_bg_scrolling varchar(100) NOT NULL default 'fixed',
piclisting_bg_repeat varchar(100) NOT NULL default 'repeat-x',
piclisting_bg_vposition varchar(100) NOT NULL default '',
piclisting_bg_hposition varchar(100) NOT NULL default '',
content_bg_scrolling varchar(100) NOT NULL default 'fixed',
content_bg_repeat varchar(100) NOT NULL default 'no-repeat',
content_bg_vposition varchar(100) NOT NULL default '',
content_bg_hposition varchar(100) NOT NULL default '',
scroll_3dlight_color varchar(100) NOT NULL default 'none',
scroll_arrow_color varchar(100) NOT NULL default 'none',
scroll_base_color varchar(100) NOT NULL default 'none',
scroll_darkshadow_color varchar(100) NOT NULL default 'none',
scroll_face_color varchar(100) NOT NULL default 'none',
scroll_highlight_color varchar(100) NOT NULL default 'none',
scroll_shadow_color varchar(100) NOT NULL default 'none',
photogallery_id double NOT NULL default '0',
photogallery_set_id varchar(100) NOT NULL default '',
photogallery_name varchar(100) NOT NULL default '',
photogallery_set_name varchar(100) NOT NULL default '',
max_pics varchar(100) NOT NULL default '',
options_enabled tinyint(4) NOT NULL default '1',
list_enabled tinyint(4) NOT NULL default '1',
pic_count double NOT NULL default '0',
background_url varchar(200) NOT NULL default '',
faq_url varchar(200) NOT NULL default '',
photogallery_view_login varchar(100) NOT NULL default '',
photogallery_view_pass varchar(100) NOT NULL default '',
photogallery_view_protected tinyint(4) NOT NULL default '0',
files_enabled tinyint(4) NOT NULL default '0',
file_font_color varchar(100) NOT NULL default '',
startup_html longtext NOT NULL,
startup_html_url varchar(200) NOT NULL default '',
startup_html_choose varchar(100) NOT NULL default 'url',
startup_news longtext NOT NULL,
default_id int(11) NOT NULL auto_increment,
next_page_image blob NOT NULL,
prev_page_image blob NOT NULL,
page_list_font varchar(100) NOT NULL default 'Arial',
page_list_style varchar(100) NOT NULL default 'none',
page_list_color varchar(100) NOT NULL default 'FFFFFF',
page_list_size varchar(100) NOT NULL default '2',
basic_control tinyint(4) NOT NULL default '0',
config_id varchar(100) NOT NULL default '',
magnifier_enabled tinyint(4) NOT NULL default '0',
PRIMARY KEY (default_id),
KEY photogallery_set_id (photogallery_set_id),
KEY photogallery_id (photogallery_id)
) TYPE=MyISAM;");
$dbh->do("DROP TABLE IF EXISTS Photogallery_pictures");
$dbh->do("CREATE TABLE Photogallery_pictures (
pic_id int(11) NOT NULL auto_increment,
pic_data longblob,
pic_thumb blob,
pic_data_mime varchar(100) NOT NULL default '',
pic_thumb_mime varchar(100) NOT NULL default '',
pic_who_uploaded varchar(100) NOT NULL default '',
pic_desc text NOT NULL,
pic_desc_size varchar(100) NOT NULL default '',
pic_desc_style varchar(100) NOT NULL default '',
pic_desc_font varchar(100) NOT NULL default '',
pic_desc_color varchar(100) NOT NULL default '',
pic_url varchar(250) NOT NULL default '',
pic_category_id int(11) NOT NULL default '0',
pic_extra_html longtext NOT NULL,
pic_timer tinyint(1) NOT NULL default '0',
pic_begin_time varchar(100) NOT NULL default '',
pic_end_time varchar(100) NOT NULL default '',
pic_photogallery_id varchar(100) NOT NULL default '',
pic_photogallery_set_id varchar(100) NOT NULL default '',
pic_is_file tinyint(1) NOT NULL default '0',
pic_file_name varchar(100) NOT NULL default '',
pic_large_data longblob NOT NULL,
pic_large_mime varchar(100) NOT NULL default '',
pic_magnifier_enabled tinyint(4) NOT NULL default '0',
PRIMARY KEY (pic_id),
UNIQUE KEY Photogallery_pictures_index (pic_id)
) TYPE=MyISAM;");
$m->redirect("$file");
%init>
%def>
<%def defMakeSetAdmin>
<%init>
$dbh->do("Insert Into Photogallery_defaults set
login_name=?,
login_pass=?,
photogallery_id =?,
photogallery_set_id=?
",
undef,
$IARGS{login_name},
$IARGS{login_pass},
0,
$set_id);
$m->redirect("$file");
%init>
%def>
<%def userinfoadmin>
<%init>
$m->redirect("noaccess") if (!$isAdmin);
my $hash_ref;
my $sth = $dbh->prepare("Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?");
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my %enableHash= ('1' => 'Enabled',
'0' => 'Disabled');
%init>
User Information Update
Current User Name:
Current Password:
New Username:
New Password:
Retype Password:
Photogallery Password Protection
Password Protection is
Login:
Pass:
%def>
<%def userinfoupdate>
<%init>
$m->redirect("noaccess") if (!$isAdmin);
my ($login_name,$login_pass) = $dbh->selectrow_array("Select login_name,login_pass From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef, $pgid,$set_id);
if ($IARGS{new_user} eq '') {
$m->comp('error_noreturn',message => "New User was blank.");
$m->flush_buffer;
$m->abort;
}
if ($IARGS{new_pass} eq '' ) {
$m->comp('error_noreturn',message => "New Password was blank.");
$m->flush_buffer;
$m->abort;
}
if ($login_name ne $IARGS{current_user}) {
$m->comp('error_noreturn',message => "Current login name is invalid.");
$m->flush_buffer;
$m->abort;
}
if ($login_pass ne $IARGS{current_pass}) {
$m->comp('error_noreturn',message => "Current login password is invalid.");
$m->flush_buffer;
$m->abort;
}
if ($IARGS{new_retype} ne $IARGS{new_pass}) {
$m->comp('error_noreturn',message => "Current New Password and the Retyped Password do not match");
$m->flush_buffer;
$m->abort;
}
$dbh->do("Update Photogallery_defaults set
login_name = ?,
login_pass = ?
Where
photogallery_id = ?
AND
Photogallery_set_id =?",
undef,
$IARGS{new_user},
$IARGS{new_pass},
$pgid,
$set_id);
$m->redirect("noaccess") if (!$isAdmin);
my $hash_ref;
my $sth = $dbh->prepare("Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?");
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
%init>
User Information has been Updated
%def>
<%method EXTERNAL_AddNewPhotogallery>
<%args>
#$set_id => undef
#$dbh => undef
%args>
<%init>
#can use the config file now to connect to the database, should not need to send sth
#if (!$set_id) {
#print "No Set_id sent, or Set_id is blank";
#$m->flush_buffer;
#$m->abort;
#}
#if (!$dbh) {
#print "No Database handle sent";
#$m->flush_buffer;
#$m->abort;
#}
my $databaseInfo = $m->comp("defConnectToDatabase");
my ($URL) = $dbh->selectrow_array("SELECT background_url FROM Photogallery_defaults WHERE photogallery_set_id = ? AND photogallery_id = ?",undef,$set_id,0);
$dbh->do("LOCK TABLES Photogallery_defaults WRITE");
my ($nextPhotogallery) = $dbh->selectrow_array("Select MAX(photogallery_id) From Photogallery_defaults Where photogallery_set_id = ?",undef,$set_id);
my $bandID = $ARGS{ph_bandid};
my $plusOne = int($nextPhotogallery)+1;
my $html_url = "http://www.clubroundtable.com/photogallery/splashpage.htm?band_id=$bandID&pg_id=$plusOne";
$dbh->do("Insert into Photogallery_defaults set
photogallery_id = ?,
photogallery_set_id = ?,
photogallery_name = ?,
login_name = ?,
login_pass = ?,
max_pics = ?,
options_enabled = ?,
startup_html_url = ?",
undef,
int($nextPhotogallery)+1,
$set_id,
$ARGS{'ph_name'},
$ARGS{'ph_login'},
$ARGS{'ph_pass'},
$ARGS{'ph_maxpic'},
$ARGS{'optioncontrol'},
$html_url);
$dbh->do("UNLOCK TABLES");
if ($URL ne '') {
my $imageBinary = $m->comp("defGetImageFromURL",'URL' => $URL);
$m->comp("internalAutomaticBackground",'data' => $imageBinary,'gallery_id' => int($nextPhotogallery)+1,'dbh' => $dbh, 'set_id' => $set_id);
}
return int($nextPhotogallery)+1;
%init>
%method>
<%def internalAutomaticBackground>
<%args>
$data => undef
$gallery_id => 1
$dbh => undef
$set_id => undef
%args>
<%init>
use File::MMagic;
use Image::Magick;
my $mm = File::MMagic->new();
#####temp
#my $dbh = DBI->connect("DBI:mysql:clubroundtable", "clubroundtable", "redbeard23");
#my $set_id = 2;
#####EndTemp
#Takes an image (Blob) and crops it to fill in the 4 backgrounds
#pull frame info
my ($mainframe,$leftframe,$rightframe) = $dbh->selectrow_array("Select mainframe_width,leftframe_height,rightframe_height From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$gallery_id,$set_id);
#logo
#x=>0 y=>0 width=>mainfram height=>leftframe
my $logo = Image::Magick->new();
$logo->BlobToImage($data);
$logo->Crop(x=>0,y=>0,width=>$mainframe,height=>$leftframe);
my $croppedImage = $logo->ImageToBlob;
my $image_mime = $mm->checktype_contents($croppedImage);
#$m->clear_buffer;
#$r->content_type($image_mime);
#$r->send_http_header;
#print $croppedImage;
#$m->flush_buffer;
#$m->abort;
$dbh->do("Update Photogallery_defaults set
logo_data=?,
logo_mime=?
Where photogallery_id = ? AND photogallery_set_id = ?"
,undef,
$croppedImage,
$image_mime,
$gallery_id,
$set_id);
#piclist
#x=>mainframe+1 y=>0 width=>1500 height=>rightframe
my $piclist = Image::Magick->new();
$piclist->BlobToImage($data);
$piclist->Crop(x=>$mainframe+1,y=>0,width=>2000,height=>$rightframe);
my $croppedImage2 = $piclist->ImageToBlob;
my $image_mime2 = $mm->checktype_contents($croppedImage2);
$dbh->do("Update Photogallery_defaults set
piclisting_bg_image=?,
piclisting_bg_mime=?
Where photogallery_id = ? AND photogallery_set_id = ?"
,undef,
$croppedImage2,
$image_mime2,
$gallery_id,
$set_id);
#category
#x=>0 y=>leftframe+1 width=>mainframe height=>1500
my $cat = Image::Magick->new();
$cat->BlobToImage($data);
$cat->Crop(x=>0,y=>$leftframe+1,width=>$mainframe,height=>2000);
my $croppedImage3 = $cat->ImageToBlob;
my $image_mime3 = $mm->checktype_contents($croppedImage3);
$dbh->do("Update Photogallery_defaults set
cateogry_background_image=?,
cateogry_background_mime=?
Where photogallery_id = ? AND photogallery_set_id = ?"
,undef,
$croppedImage3,
$image_mime3,
$gallery_id,
$set_id);
#content
#x=>mainframe+1 y=>rightframe+1 width=>1500 height=>1500
my $content = Image::Magick->new();
$content->BlobToImage($data);
$content->Crop(x=>$mainframe+1,y=>$rightframe+1,width=>2000,height=>2000);
my $croppedImage4 = $content->ImageToBlob;
my $image_mime4 = $mm->checktype_contents($croppedImage4);
$dbh->do("Update Photogallery_defaults set
content_bg_image=?,
content_bg_mime=?
Where photogallery_id = ? AND photogallery_set_id = ?"
,undef,
$croppedImage4,
$image_mime4,
$gallery_id,
$set_id);
%init>
%def>
<%def adminpage>
<%init>
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my ($optionEnabled) = $dbh->selectrow_array("Select options_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id);
my ($faq_url) = $dbh->selectrow_array("Select faq_url From Photogallery_defaults Where photogallery_id = 0 AND photogallery_set_id = ?",undef,$set_id);
my $user_low_settings = 1;
if ($optionEnabled eq '2') {
$user_low_settings = 0;
$optionEnabled = 0;
}
%init>
% if ($isAdmin) {
%def>
<%def protectloginsubmit>
<%init>
my $hash_ref;
my $sth = $dbh->prepare("Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?");
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
if ($IARGS{login_name} ne $hash_ref->{photogallery_view_login}) {
$m->comp('error_noreturn',message => "Login Name or Pass is Invalid");
$m->flush_buffer;
$m->abort;
}
if ($IARGS{login_pass} ne $hash_ref->{photogallery_view_pass}) {
$m->comp('error_noreturn',message => "Login Name or Pass is Invalid");
$m->flush_buffer;
$m->abort;
}
#print "making cookie" . $IARGS{login_name};
#my $cookie = Apache::Cookie->new(
# $r,
# -name => '1'."1",
# -value => $IARGS{login_name},
## -expires => '+15h',
# -domain => $domainName,
# -path => '/',
# );
#
#$cookie->bake;
my $cookie = Apache::Cookie->new(
$r,
-name => $cookieName."PROTECT",
-value => $IARGS{login_name},
-expires => '+100h',
-domain => $domainName,
-path => '/',
);
$cookie->bake;
#$cookie = Apache::Cookie->new(
# $r,
# -name => $cookieName."PROTECT",
# -value => $IARGS{login_name},
# -expires => '-99h',
# -domain => $domainName,
# -path => '/',
# );
#
#$cookie->bake;
#
#$cookie = Apache::Cookie->new(
# $r,
# -name => $cookieName."1",
# -value => "1".$IARGS{login_id},
# -expires => '+100h',
# -domain => $domainName,
# -path => '/',
# );
#$cookie->bake;
#$cookie = Apache::Cookie->new(
# $r,
# -name => $cookieName."2",
# -value => "2".$IARGS{login_name},
# -expires => '+100h',
# -domain => $domainName,
# -path => '/',
# );
#$cookie->bake;
#$m->redirect("$file?control=topredirect&pg_id=$pgid");
%init>
%def>
<%def defReadConfigFile>
<%init>
return 0 if (! -e $filePath.$configFileName);
open (inConfig,$filePath.$configFileName);
my $configFileData;
$configFileData .= $_ while ();
my $run = 0;
($database,$database_login,$database_pass,$domainName,$set_id,$run) = ($configFileData =~ /([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)/);
return 1 if ($run);
return 0;
%init>
%def>
<%def defDoPhotoUpload_noreturn>
<%init>
use File::MMagic;
use Image::Magick;
my $IncommingImage = $ARGS{'imagedata'};
$IncommingImage = $$IncommingImage;
my $subcat_ref;
my $thumbWidth;
my $thumbHeight;
my $thumb_data;
my $thumb_mime;
my $imageWidth;
my $imageHeight;
my $image_mime;
my $image_data;
my $lastID;
$subcat_ref = $dbh->selectrow_hashref("Select * from Photogallery_categories Where cat_id = ?",undef,$IARGS{'upload_cat'});
my $name = $subcat_ref->{'cat_name'};
if ( ( $subcat_ref->{'cat_thumbnail_att'} eq '' ) || ( $subcat_ref->{'cat_image_att'} eq '') ) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail and/or Image size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
#Thumbnail resize First
if ($subcat_ref->{'cat_thumbnail_att'} eq 'absolute') {
$thumbWidth = $subcat_ref->{'cat_thumbnail_width'};
$thumbHeight = $subcat_ref->{'cat_thumbnail_height'};
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
$image->Scale(height => $thumbHeight, width => $thumbWidth);
$thumb_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_thumbnail_att'} eq 'resizewidth') {
$thumbWidth = $subcat_ref->{'cat_thumbnail_width'};
if ($thumbWidth == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail width size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( ($tempWidth / $thumbWidth) == 0) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a width of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
$tempHeight = $tempHeight / ($tempWidth / $thumbWidth);
$image->Scale(height => $tempHeight, width => $thumbWidth);
$thumb_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_thumbnail_att'} eq 'resizeheight') {
$thumbHeight = $subcat_ref->{'cat_thumbnail_height'};
if ($thumbHeight == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail height size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( ($tempHeight / $thumbHeight) == 0) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a height of zero. Please upload another image.");
$m->flush_buffer;
$m->abort;
}
$tempWidth = $tempWidth / ($tempHeight / $thumbHeight);
$image->Scale(height => $thumbHeight, width => $tempWidth);
$thumb_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_thumbnail_att'} eq 'resizewh') {
$thumbWidth = $subcat_ref->{'cat_thumbnail_width'};
$thumbHeight = $subcat_ref->{'cat_thumbnail_height'};
if ($thumbWidth == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail width size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
if ($thumbHeight == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail height size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( !$tempWidth || !$thumbWidth ) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a width of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
if ($tempHeight >= $tempWidth){
#this means to resize the width
$tempWidth = $tempWidth / ($tempHeight / $thumbHeight);
$image->Scale(height => $thumbHeight, width => $tempWidth);
$thumb_data = $image->ImageToBlob();
}
if ($tempWidth > $tempHeight){
#this means to resize the height
$tempHeight = $tempHeight / ($tempWidth / $thumbWidth);
$image->Scale(height => $tempHeight, width => $thumbWidth);
$thumb_data = $image->ImageToBlob();
}
}
# image next
if ($subcat_ref->{'cat_image_att'} eq 'resizewh') {
$imageWidth = $subcat_ref->{'cat_image_width'};
$imageHeight = $subcat_ref->{'cat_image_height'};
if ($imageWidth == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail width size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
if ($imageHeight == 0) {
$m->comp('error_noreturn',message => "Subcategory $name Thumbnail height size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( !$tempWidth || !$imageWidth ) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a width of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
if ($tempHeight > $subcat_ref->{'cat_image_height'}){
#this means to resize the width
$tempWidth = $tempWidth / ($tempHeight / $imageHeight);
$image->Scale(height => $imageHeight, width => $tempWidth);
$image_data = $image->ImageToBlob();
}
$tempHeight = $image->Get('height');
if ($tempWidth > $subcat_ref->{'cat_image_width'}){
#this means to resize the height
$tempHeight = $tempHeight / ($tempWidth / $imageWidth);
$image->Scale(height => $tempHeight, width => $imageWidth);
$image_data = $image->ImageToBlob();
}
}
if ($subcat_ref->{'cat_image_att'} eq 'absolute') {
$imageWidth = $subcat_ref->{'cat_image_width'};
$imageHeight = $subcat_ref->{'cat_image_height'};
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( (!$tempWidth) || (!$tempHeight)) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a width of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
$image->Scale(height => $imageHeight, width => $imageWidth);
$image_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_image_att'} eq 'resizewidth') {
$imageWidth = $subcat_ref->{'cat_image_width'};
if ($imageWidth == 0) {
$m->comp('error_noreturn',message => "Subcategory $name image width size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( ($tempWidth / $imageWidth) == 0) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a width of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
$tempHeight = $tempHeight / ($tempWidth / $imageWidth);
$image->Scale(height => $tempHeight, width => $imageWidth);
$image_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_image_att'} eq 'resizeheight') {
$imageHeight = $subcat_ref->{'cat_image_height'};
if ($imageHeight == 0) {
$m->comp('error_noreturn',message => "Subcategory $name image height size has not been set, please contatct the Administartor for this error");
$m->flush_buffer;
$m->abort;
}
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( ($tempHeight / $imageHeight) == 0) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a height of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
$tempWidth = $tempWidth / ($tempHeight / $imageHeight);
$image->Scale(height => $imageHeight, width => $tempWidth);
$image_data = $image->ImageToBlob();
}
if ($subcat_ref->{'cat_image_att'} eq 'none') {
my $image = Image::Magick->new();
$image->BlobToImage($IncommingImage);
my $tempHeight = $image->Get('height');
my $tempWidth = $image->Get('width');
if ( (!$tempHeight) || (!$tempWidth) ) {
$m->comp('error_noreturn',message => "The picture that was uploaded has a height of zero or the image format uploaded is not supported. Please upload either GIF, JPG, or Bitmap images.");
$m->flush_buffer;
$m->abort;
}
$image_data = $image->ImageToBlob();
}
#Image Resize last
my $mm = File::MMagic->new();
$thumb_mime = $mm->checktype_contents($thumb_data);
$image_mime = $mm->checktype_contents($image_data);
my $magnifier_enabled = $dbh->selectrow_array("Select magnifier_enabled from Photogallery_defaults where photogallery_id= ? and photogallery_set_id = ?",undef, $pgid,$set_id);
$dbh->do("LOCK TABLES Photogallery_pictures WRITE");
$dbh->do("Insert Into Photogallery_pictures set
pic_data = ?,
pic_thumb = ?,
pic_data_mime = ?,
pic_thumb_mime = ?,
pic_who_uploaded = ?,
pic_desc = ?,
pic_desc_size = ?,
pic_desc_style = ?,
pic_desc_font = ?,
pic_desc_color = ?,
pic_url = ?,
pic_category_id = ?,
pic_magnifier_enabled = ?,
pic_photogallery_id = ?,
pic_photogallery_set_id = ?",
undef,
$image_data,
$thumb_data,
$image_mime,
$thumb_mime,
( $isAdmin ? "admin" : "guest"),
$IARGS{'photo_desc'},
$IARGS{'photo_size'},
$IARGS{'photo_style'},
$IARGS{'photo_font'},
$IARGS{'photo_color'},
$IARGS{'photo_url'},
$IARGS{'upload_cat'},
$magnifier_enabled,
$pgid,
$set_id);
if ($magnifier_enabled) {
my $last_id = $dbh->selectrow_array("Select LAST_INSERT_ID()");
$dbh->do("Update Photogallery_pictures set
pic_large_data = ?,
pic_large_mime = ?
Where
pic_id = ?",
undef,
$IncommingImage,
$mm->checktype_contents($IncommingImage),
$last_id);
}
($lastID) = $dbh->selectrow_array("SELECT LAST_INSERT_ID() FROM Photogallery_pictures");
$dbh->do("UNLOCK TABLES");
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
$m->comp("defUpdatePicCount");
%init>
%deF>
<%def default_category_category_icon>
<%init>
my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
%init>
Category Icon
%if($config->{config_cat_icon_data}) {
%} else {
Currently no icon is used
%}
%def>
<%def default_subcategory_subcategory_font>
<%init>
my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
my %styleHash= ('none' => 'None',
'both' => 'Bold and Italic',
'italic' => 'Italic',
'bold'=>'Bold');
my %mouseHash= ('0' => 'No',
'1' => 'Yes');
%init>
Subcategory Font
Font
Size
Color
Style
Mouseover Color
Mouseover Underline
%def>
<%def default_category_category_font>
<%init>
my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
my %styleHash= ('none' => 'None',
'both' => 'Bold and Italic',
'italic' => 'Italic',
'bold'=>'Bold');
my %mouseHash= ('0' => 'No',
'1' => 'Yes');
%init>
Category Font
Font
Size
Color
Style
Mouseover Color
Mouseover Underline
%def>
<%def default_subcategory_subcategory_position>
<%init>
my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
%init>
Subcategory Position
Padding from the left
Padding from the top
%def>
<%def default_category_category_position>
<%init>
my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
%init>
Category Position
Padding from the left
Padding from the top
%def>
<%def default_picture_picture_icon>
Picture Icon
Currently no icon is used
%def>
<%def default_picture_picture_font>
Picture Background
Color
Scrolling
Repeat
%def>
<%def default_picture_picture_position>
Picture Position
Padding from the left
Padding from the top
%def>
<%def default_content_content_icon>
Content Icon
Currently no icon is used
%def>
<%def default_content_content_font>
Content Background
Color
Scrolling
Repeat
%def>
<%def default_content_content_position>
Content Position
Padding from the left
Padding from the top
%def>
<%def default_scrollbar_scrollbar_color>
Scrollbar Color
Arrow color
Base color
Face color
%def>
<%def default_scrollbar_scrollbar_lighting>
Scrollbar Lighting
3 D light
Dark shadow
Highlight
Shadow
%def>
<%def default_button_button_next>
Next button
Currently no button is being used
%def>
<%def default_button_button_previous>
Previous Button
Currently no button is being used
%def>
<%def update_defaults>
<%init>
foreach my $key (keys %{$m->request_args}) {
if ($key =~ /^f_/) {
my ($column) = ($key =~ /^f_(.*)/);
print $column . "=" . $m->request_args->{$key};
$dbh->do("Update Photogallery_config set $column = ? where config_photogallery_id = ? AND config_photogallery_set_id = ?",undef, $m->request_args->{$key},$pgid, $set_id);
}
}
if ($m->request_args->{f_config_cat_icon_data}) {
use File::MMagic;
my $mm = File::MMagic->new();
my $fh = $r->upload->fh;
my $data;
while (<$fh>) {
$data .= $_;
}
my $mime = $mm->checktype_contents($data);
$dbh->do("Update Photogallery_config set config_cat_icon_data = ?, config_cat_icon_mime = ? where config_photogallery_id =? AND config_photogallery_set_id = ?",undef,$data,$mime, $pgid, $set_id);
}
if ($m->request_args->{f_config_subcat_icon_data}) {
use File::MMagic;
my $mm = File::MMagic->new();
my $fh = $r->upload->fh;
my $data;
while (<$fh>) {
$data .= $_;
}
my $mime = $mm->checktype_contents($data);
$dbh->do("Update Photogallery_config set config_subcat_icon_data = ?, config_subcat_icon_mime = ? where config_photogallery_id =? AND config_photogallery_set_id = ?",undef,$data,$mime, $pgid, $set_id);
}
$m->redirect("?control=photogallery_defaults&menu=".$m->request_args->{menu}."&sub=".$m->request_args->{sub}."&pg_id=".$m->request_args->{pg_id});
%init>
%deF>
<%def subcatcontentmagnify>
<%init>
my $hash_ref;
my $sth = $dbh->prepare('Select * From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?');
$sth->execute($pgid,$set_id);
$hash_ref = $sth->fetchrow_hashref;
$sth->finish;
my $pic_ref = $dbh->selectrow_hashref("Select * From Photogallery_pictures Where pic_id =?",undef,$IARGS{'picid'});
my $subcat_ref = $dbh->selectrow_hashref("Select * From Photogallery_categories Where cat_id = ?",undef,$pic_ref->{'pic_category_id'});
%init>