<%flags> inherit => undef <%args> $control => 'photogallerylist' $catID => undef $subcatID => undef <%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; <%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"); } } <& $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; <%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); % my $opencat = $IARGS{'opencat'}; leftmargin=0> % if ($hash_ref->{'guest_upload_enabled'}) {
% my $font = $hash_ref->{'guest_upload_font'}; % my $size = $hash_ref->{'guest_upload_size'}; % my $style = $hash_ref->{'guest_upload_style'}; % my $color = $hash_ref->{'guest_upload_color'}; <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%> > <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> Upload a Photo <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%>
% } % if ($isAdmin) {
Administration
% } <& defCategoryListing &> % if ($isAdmin) {
New Category
% } <%def defCategoryListing> <%init> my $cat_sth; my $subcat_sth; my $cat_hashref; my $subcat_hashref; %#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); % while ($cat_hashref = $cat_sth->fetchrow_hashref) { % my $leftpad = $cat_hashref->{'cat_leftpadding'}; % my $toppad = $cat_hashref->{'cat_toppadding'};
{'cat_icon'}) ? "style=\"padding-left:$leftpad\"" : "")%> <% ($toppad ? "style=\"padding-top:$toppad\"" : "") %>> % if ($isAdmin) { % } % if ($cat_hashref->{'cat_icon'}) { \ % } % if ($isAdmin) { % } {'cat_icon'}) ? "style=\"padding-left:$leftpad\"" : "")%> <% ($toppad ? "style=\"padding-top:$toppad\"" : "") %>> % if ($isAdmin) { % } % my $font = $cat_hashref->{'cat_font'}; % my $size = $cat_hashref->{'cat_size'}; % my $style = $cat_hashref->{'cat_style'}; % my $color = $cat_hashref->{'cat_color'}; % my $overColor = $cat_hashref->{'cat_mouseover_color'}; % if ($isAdmin || !$cat_hashref->{'cat_is_hidden'}) { <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%> onMouseOver="this.style.cursor='hand'; this.style.color= '<%$overColor%>'; <% ($cat_hashref->{'cat_mouseover_underline'} ? 'this.style.textDecoration=\'underline\';' : "") %>" onMouseOut="this.style.color= '<%$color%>'; this.style.textDecoration='none';" onClick="toggleVis('idnum<% $cat_hashref->{'cat_id'} %>')"> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% ($cat_hashref->{'cat_name'} ? $cat_hashref->{'cat_name'} : "blank")%> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> %}
%#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'}); % while ($subcat_hashref = $subcat_sth->fetchrow_hashref) { % $leftpad = $subcat_hashref->{'cat_leftpadding'}; % $toppad = $subcat_hashref->{'cat_toppadding'};
<% ($toppad ? "style=\"padding-top:$toppad\"" : "") %>> % if ($subcat_hashref->{'cat_icon'}) { \ % } {'cat_icon'}) ? "style=\"padding-left:$leftpad\"" : "")%> <% ($toppad ? "style=\"padding-top:$toppad\"" : "") %>> % $font = $subcat_hashref->{'cat_font'}; % $size = $subcat_hashref->{'cat_size'}; % $style = $subcat_hashref->{'cat_style'}; % $color = $subcat_hashref->{'cat_color'}; % $overColor = $subcat_hashref->{'cat_mouseover_color'}; % if ($isAdmin || !$subcat_hashref->{'cat_is_hidden'}) { <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%> onMouseOver="this.style.fontWeight='bold'; this.style.color= '<%$overColor%>'; <% ($cat_hashref->{'cat_mouseover_underline'} ? 'this.style.textDecoration=\'underline\';' : "") %>" onMouseOut="this.style.fontWeight='normal'; this.style.color= '<%$color%>'; this.style.textDecoration='none';"> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% ($subcat_hashref->{'cat_name'} ? $subcat_hashref->{'cat_name'} : "blank" )%> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> %}
% } #Edn SubCat loop % if ($isAdmin) {
New Sub
% }
% } #end Cat loop <%perl> $cat_sth->finish; $subcat_sth->finish if ($subcat_sth); <%def siteimage> <%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 ($hash_ref->{'logo_data'} ne '') { % } <%def gallery> <%init> my $nextControl = $IARGS{'nextControl'}; $nextControl = 'gallerysplash' if ($IARGS{'nextControl'} eq ''); my ($resize,$color,$width) = $dbh->selectrow_array("Select cat_frame_resize,cat_frame_border_color,cat_frame_border_width From Photogallery_categories Where cat_id = ?",undef,$IARGS{subcatID}); my $hash_ref; my $sth = $dbh->prepare("Select rightframe_height From Photogallery_defaults Where photogallery_id = ?"); $sth->execute($pgid); $hash_ref = $sth->fetchrow_hashref; $sth->finish; if ($nextControl eq 'newphotoadmin') { $resize='1'; $color='red'; $width=3; } " border=0 frameborder="1" rows="<% $hash_ref->{'rightframe_height'} %>,*"> frameborder="0" target="" src="<% $file %>?control=piclisting&subcatID=<% $IARGS{'subcatID'} %>&pg_id=<%$pgid%>" bordercolor="<% $color%>"> <%def gallerysplash> <%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 ($hash_ref->{'startup_html_choose'} eq 'html') { <% $hash_ref->{'startup_html'} %> % } else { % my $getURL = $hash_ref->{'startup_html_url'}; % #print $getURL; % my $printHTML = $m->comp("defGetHTMLFromURL", URL => $getURL); % print $printHTML; % #($printHTML) = ($printHTML =~ /(.*)<\/body>/i); % #print $printHTML; % } <%def catcontent> %if ($isAdmin) { <& defCatContentAdmin &> % } else { <& defCatContentShowPic &> % } <%def defCatContentAdmin> <%init> my $sth = $dbh->prepare("Select * from Photogallery_categories Where cat_id = ?"); $sth->execute($IARGS{'subcatID'}); my $subcat_ref = $sth->fetchrow_hashref; $sth->finish; my %styleHash= ('none' => 'None', 'both' => 'Bold and Italic', 'italic' => 'Italic', 'bold'=>'Bold'); my %mouseHash= ('0' => 'No', '1' => 'Yes'); my $hash_ref; $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 $user_low_settings = 1; if ($optionEnabled eq '2') { $user_low_settings = 0; $optionEnabled = 0; }
% if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($user_low_settings) { % }
<% $subcat_ref->{'cat_name'} %> Properties
Edit Category Name
Category Position
Edit Category Icon
Properties of <% $subcat_ref->{'cat_name'} %>
Category Visibility
Delete This Category?

Edit Category Name

Category Position

% if ($optionEnabled) {
Edit Category Icon
% if ($subcat_ref->{'cat_icon'}){ \ % } else { No Icon % }
% }
% if ($optionEnabled) {
Properties of <% $subcat_ref->{'cat_name'} %>
Font:
Text Size:
Text Color:
Text Mouseover Color:
Text Mouseover Underline:
Text Style:
Pixel Padding from Left:
Pixel Padding from Top:
%}
% if ($user_low_settings) {
%}
Category Visibiliity
Make this Category hidden to viewers?

Delete this Category?
          
<%def defCatContentShowPic> <%init> Picture <%def subcatcontent> %if ($IARGS{'override'} eq '1') { <& defSubCatShowPic &> % } elsif ($isAdmin && ($IARGS{'picid'} eq '')) { <& defSubCatAdmin &> % } elsif ($isAdmin && ( $IARGS{'picid'} ne '')) { <& defSubCatPicAdmin &> % } elsif ($IARGS{picid}) { <& defSubCatShowPic &> % } else { <& subcathtml &> % } <%def defSubCatPicAdmin> <%init> my $pic_hash; my $picsth = $dbh->prepare("Select * From Photogallery_pictures WHERE pic_id = ?"); $picsth->execute($IARGS{'picid'}); $pic_hash= $picsth->fetchrow_hashref; $picsth->finish; 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 %styleHash= ('none' => 'None', 'both' => 'Bold and Italic', 'italic' => 'Italic', 'bold'=>'Bold'); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled'); my %monthHash= ('01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December'); my $optionEnabled = $dbh->selectrow_array("Select options_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); my ($subcat_name,$parent_id) = $dbh->selectrow_array("Select cat_name,parent_id FROM Photogallery_categories WHERE cat_id = ? AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef,$pic_hash->{'pic_category_id'},$pgid,$set_id); my $parent_name = $dbh->selectrow_array("Select cat_name From Photogallery_categories WHERE cat_id = ? AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef,$parent_id,$pgid,$set_id); my $sth3 = $dbh->prepare("Select cat_id,cat_name,parent_id FROM Photogallery_categories WHERE parent_id != 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?"); $sth3->execute($pgid,$set_id); my ($subcat_hashref,$cat_hashref,@validCat); while ($subcat_hashref = $sth3->fetchrow_hashref){ my $sth2 = $dbh->prepare("Select cat_name FROM Photogallery_categories WHERE cat_id =?"); $sth2->execute($subcat_hashref->{'parent_id'}); $cat_hashref = $sth2->fetchrow_hashref; push (@validCat, {'cat_name' => $cat_hashref->{'cat_name'}, 'subcat_name' => $subcat_hashref->{'cat_name'}, 'cat_id' => $subcat_hashref->{'cat_id'} }); $sth2->finish; } $sth3->finish; my $user_low_settings = 1; if ($optionEnabled eq '2') { $optionEnabled = 0; $user_low_settings = 0; }
Display as User

Magnifier
Magnifier is:    

Picture Movement
Current Category:    <%$parent_name%> - <%$subcat_name%>
Move To Category:   

?control=updatedesc&pg_id=<%$pgid%>>
Url: http://
Description:
Desc Font:
Desc Size:
Desc Color:
Desc Style:

% if ($user_low_settings) { ?control=addextrahtml&pg_id=<%$pgid%>>
Extra HTML
% }
% if ($user_low_settings) { ?control=timerupdate&pg_id=<%$pgid%>>
Picture Timer
Timer: 

Begin:
 
End:
 
%}
<%def defSubCatAdmin> <%init> my $sth = $dbh->prepare("Select * from Photogallery_categories Where cat_id = ?"); $sth->execute($IARGS{'subcatID'}); my $subcat_ref = $sth->fetchrow_hashref; $sth->finish; my $parent_name; ($parent_name) = $dbh->selectrow_array("Select cat_name from Photogallery_categories Where cat_id = ?",undef,$subcat_ref->{'parent_id'}); $sth = $dbh->prepare("Select cat_name, cat_id from Photogallery_categories Where parent_id = 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?"); $sth->execute($pgid,$set_id); my $cat_arrayref = my $unSortedArray_ref = $sth->fetchall_arrayref({}); my %styleHash= ('none' => 'None', 'both' => 'Bold and Italic', 'italic' => 'Italic', 'bold'=>'Bold'); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled'); my %sizeHash= ( 'none' => 'None', 'absolute' => 'Absolute', 'resizewidth' => 'Resize to Width', 'resizeheight' => 'Resize to Height', 'resizewh' => 'Resize to Width or Height'); my %mouseHash = ('0' => 'No', '1' => 'Yes'); my $hash_ref; $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 $user_low_settings = 1; if ($optionEnabled eq '2') { $user_low_settings = 0; $optionEnabled = 0; }
% if ($optionEnabled) { % } % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($optionEnabled) { %} % if ($user_low_settings) { % }
<% $subcat_ref->{'cat_name'} %> Properties
HTML For This Subcateogry
Edit Subcategory Name
Subcategory Position
Edit Subcategory Icon
Properties of <% $subcat_ref->{'cat_name'} %>
Picture Listing Information
Content Settings
Frameset Info
Image Sizes for this Subcategory
Guest Upload
Subcategory Visibility
Delete This Subategory?

% if ($user_low_settings) {
Edit the Subcategory HTML
% }
Edit Subcategory Name

Subcategory Position

% if ($optionEnabled) {
Edit Subcategory Icon
% if ($subcat_ref->{'cat_icon'}) { \ % } else { No Icon % }
      
%}
% if ($optionEnabled) {
Properties of <% $subcat_ref->{'cat_name'} %>
Current Category:
Font:
Text Size:
Text Color:
Text Mouseover Color:
Text Mouseover Underline:
Text Style:
Pixel Padding from Left:
Pixel Padding from Top:
%}
% if ($optionEnabled) {
?control=piclistprop&pg_id=<%$pgid%>>
Picture Listing Info
Title:
Title Font:
Title Size:
Title Color:
Title Style:
Title Alignment
Top: Left:
Thumbnail Arrangement
Rows: Cols:
Image Positioning
Top: Left:
Space between Images
Pixels:
Thumbnail Border Width:
Thumbnail Border Color:
Thumbnail Pages
Thumbnail Pages are
Thumbnails Per Page:
List Page Numbers at
%}

% if ($optionEnabled) {
?control=contentupdate&pg_id=<%$pgid%>>
Content Settings
Image Position
Top:          Left:
Image Border Width:
Image Border Color:
Description Position
Top:          Left:
Description Width:
%}
% if ($optionEnabled) {
Frameset Info
Resize:
Border Color:
Border Width:
%}
% if ($optionEnabled) {
Image Sizes for this SubCategory
Thumbnail Size Width: Height:
Image Resize Width: Height:
%}
% if ($optionEnabled) {
Guest Upload
Guest upload to this subcategory is
%}
% if ($user_low_settings) {
% }
Subcategory Visibiliity
Make this Subcategory hidden to viewers?

Delete this Subcategory?
              
<%def listpages> <%args> $ID $pics_per_page => 1 <%init> my $count = $dbh->selectrow_array("Select COUNT(pic_id) From Photogallery_pictures WHERE pic_category_id =?",undef,$ID); my $pages = (int($count / ($pics_per_page || 1))) + 1; #print (int($count / $pics_per_page)) + 1; % foreach (1..$pages) { href="?control=piclisting&subcatID=2&pg_id=<%$pgid%>&page=<%$_%>"><%$_%>  % } <%def defPicListingNormal> <%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 $subcat_ref = $dbh->selectrow_hashref("Select * From Photogallery_categories WHERE cat_id =?",undef,$IARGS{subcatID}); #$IARGS{subcatID}; my $startingrow = ($IARGS{page} - 1) * $subcat_ref->{cat_thumbs_per_page}; my $linesperpage = $subcat_ref->{cat_thumbs_per_page}; $subcat_ref->{'cat_piclist_cols'} = 1 if ($subcat_ref->{'cat_piclist_cols'} == 0); $subcat_ref->{'cat_piclist_cols'} = $subcat_ref->{cat_thumbs_per_page} if ((!$isAdmin) && ($subcat_ref->{cat_thumbnail_pages_enabled})); #$subcat_ref->('cat_piclist_rows'} = 1 if ($subcat_ref->{'cat_piclist_rows'} == 0); my $prev = 0; my $next = 0; my $count; #print $cols;

% my $font = $subcat_ref->{'cat_piclist_title_font'}; % my $size = $subcat_ref->{'cat_piclist_title_size'}; % my $style = $subcat_ref->{'cat_piclist_title_style'}; % my $color = $subcat_ref->{'cat_piclist_title_color'}; <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%>> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% $subcat_ref->{'cat_piclist_title'} %> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%>

cellspacing=0 cellpadding="<% $subcat_ref->{'cat_piclist_padding'}%>"> % if ($IARGS{subcatID} && (!$isAdmin) && ($subcat_ref->{'cat_page_numbers'} eq 'above')) { <& listpages,'ID' => $IARGS{subcatID},'pics_per_page'=>$subcat_ref->{cat_thumbs_per_page}&> % } % my $piclist_ref; % $count =0; % my $picsh; % if ($isAdmin) { % $picsh = $dbh->prepare("Select * from Photogallery_pictures WHERE pic_category_id = ? AND pic_who_uploaded = 'admin'"); % } else { % my $current_date = sprintf("%d%02d%02d",Today); % my $limit =''; % $limit = "LIMIT $startingrow,$linesperpage" if ($subcat_ref->{'cat_thumbnail_pages_enabled'}); % $picsh = $dbh->prepare("Select * from Photogallery_pictures WHERE pic_category_id = ? AND pic_who_uploaded = 'admin' AND (pic_timer = 1 AND ($current_date >= pic_begin_time AND $current_date < pic_end_time) OR pic_timer = 0) $limit"); % } % $picsh->execute($IARGS{'subcatID'}); % while ($piclist_ref = $picsh->fetchrow_hashref) { <% ( ($count % $subcat_ref->{'cat_piclist_cols'}) ? "" : ( $count == 0 ? "" : "") )%> % if ($subcat_ref->{'cat_thumbnail_pages_enabled'} && ($prev ==0) &&($IARGS{page} > 1)) { % $prev++; %} % if ($isAdmin) { % } %$count++; %} % $picsh->finish; % if ($subcat_ref->{'cat_thumbnail_pages_enabled'} && ($next ==0) && ($count >= $subcat_ref->{cat_thumbs_per_page})) { % $next++; %}
% if (!$isAdmin) { % if ($hash_ref->{'prev_page_image'}) { % } else { Prev % } % }
% if ($piclist_ref->{'pic_is_file'}){ <%$piclist_ref->{'pic_file_name'}%> % } else { % } %if ($isAdmin) {
      
% }
% if (!$isAdmin) { % if ($hash_ref->{'next_page_image'}) { % } else { Next % } % }
<%def piclisting> % if ($IARGS{'subcatID'} eq '-1') { <& defPicListingNewPhoto &> % } else { <& defPicListingNormal &> % } <%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; % 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 login>
Photogallery Login
ID:
Login:
Pass:
<%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'}); % 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) { %}
% my $font = $pic_ref->{'pic_desc_font'}; % my $size = $pic_ref->{'pic_desc_size'}; % my $style = $pic_ref->{'pic_desc_style'}; % my $color = $pic_ref->{'pic_desc_color'}; <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%>> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% $pic_ref->{'pic_desc'} %> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%>
<% $pic_ref->{'pic_extra_html'} %> <%def loginsubmit> <%init> my $sth; my $login_ref; $sth = $dbh->prepare("Select login_name,login_pass From Photogallery_defaults Where login_name=? AND photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($IARGS{'login_name'},$IARGS{'login_id'},$set_id); $login_ref = $sth->fetchrow_hashref; $sth->finish; if ( $IARGS{'login_name'} eq '') { $m->redirect("$file?control=badlogin"); } if ( $login_ref->{'login_name'} ne $IARGS{'login_name'} ){ $m->redirect("$file?control=badlogin"); } if ($login_ref->{'login_pass'} ne $IARGS{'login_pass'}) { $m->redirect("$file?control=badlogin"); } my $cookie = Apache::Cookie->new( $r, -name => $cookieName."1", -value => $IARGS{login_id}, -expires => '+100h', -domain => $domainName, -path => '/', ); $cookie->bake; $cookie = Apache::Cookie->new( $r, -name => $cookieName."2", -value => $IARGS{login_name}, -expires => '+100h', -domain => $domainName, -path => '/', ); $cookie->bake; #$m->redirect("$file"); <%def defAdminOptions> Photogallery <%def badlogin> %$m->comp("error_noreturn",message => "Your login name or pass is invalid"); <%def logout> <%init> my $cookie = Apache::Cookie->new( $r, -name => $cookieName . "1", -value => -1, -expires => '-100h', -domain => $domainName, -path => '/', ); $cookie->bake; $cookie = Apache::Cookie->new( $r, -name => $cookieName . "2", -value => -1, -expires => '-100h', -domain => $domainName, -path => '/', ); $cookie->bake; "> <%def newcategory> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); my $hash_ref; my $position; ($position) = $dbh->selectrow_array("Select MAX(cat_position) From Photogallery_categories Where parent_id = 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef,$pgid,$set_id); $position++; #print $hash_ref->{'MAX(cat_position)'}; #$m->flush_buffer; #$m->abort; $dbh->do("Insert into Photogallery_categories set cat_name=?,cat_position = ?,cat_photogallery_id = ?,cat_photogallery_set_id = ?",undef,$IARGS{'new_category'},$position,$pgid,$set_id); my $last_id = $dbh->selectrow_array("Select LAST_INSERT_ID()"); $m->comp('do_category_defaults', last_id => $last_id); $m->redirect("$file?control=categories&pg_id=$pgid"); <%def do_thumbnail_listing_defaults> <%init> my $config_id = $dbh->selectrow_array("Select config_id from Photogallery_defaults where photogallery_id = ? and photogallery_set_id = ?",undef,$pgid,$set_id); my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_id = ?",undef,$config_id); $dbh->do("Update Photogallery_categories set cat_piclist_title_font = ?, cat_piclist_title_size = ?, cat_piclist_title_color = ?, cat_piclist_title_style = ?, cat_piclist_title_xposition = ?, cat_piclist_title_yposition = ? where cat_id = ?", undef, $config->{config_piclisting_title_font}, $config->{config_piclisting_title_size}, $config->{config_piclisting_title_color}, $config->{config_piclisting_title_style}, $config->{config_piclisting_title_xposition}, $config->{config_piclisting_title_yposition}, $ARGS{last_id}); $dbh->do("Update Photogallery_categories set cat_piclist_cols = ?, cat_piclist_rows = ?, cat_piclist_top = ?, cat_piclist_left = ?, cat_piclist_padding = ?, cat_thumbnail_border = ?, cat_thumbnail_border_color = ? where cat_id = ?", undef, $config->{config_piclisting_cols}, $config->{config_piclisting_rows}, $config->{config_piclisting_top}, $config->{config_piclisting_left}, $config->{config_piclisting_space}, $config->{config_piclisting_border_width}, $config->{config_piclisting_border_color}, $ARGS{last_id} ); $dbh->do("Update Photogallery_categories set cat_thumbnail_pages_enabled = ?, cat_thumbs_per_page = ?, cat_page_numbers = ? where cat_id = ?", undef, $config->{config_pages_enabled}, $config->{config_pages_thumbs_per_page}, $config->{config_pages_list_where}, $ARGS{last_id}); $dbh->do("Update Photogallery_categories set cat_image_xposition = ?, cat_image_yposition = ?, cat_image_border = ?, cat_image_border_color =? where cat_id = ?", undef, $config->{config_image_left}, $config->{config_image_top}, $config->{config_image_border_width}, $config->{config_image_border_color}, $ARGS{last_id}); $dbh->do("Update Photogallery_categories set cat_description_xposition = ?, cat_description_yposition = ?, cat_description_width = ? where cat_id = ?", undef, $config->{config_description_left}, $config->{config_description_top}, $config->{config_description_width}, $ARGS{last_id}); $dbh->do("Update Photogallery_categories set cat_frame_resize = ?, cat_frame_border_color = ?, cat_frame_border_width = ? where cat_id = ?", undef, $config->{config_frameset_resize}, $config->{config_frameset_border_color}, $config->{config_frameset_border_width}, $ARGS{last_id}); $dbh->do("Update Photogallery_categories set cat_thumbnail_att = ?, cat_thumbnail_height = ?, cat_thumbnail_width = ?, cat_image_width = ?, cat_image_height = ?, cat_image_att = ? where cat_id = ?", undef, $config->{config_thumbnail_resize}, $config->{config_thumbnail_height}, $config->{config_thumbnail_width}, $config->{config_picture_width}, $config->{config_picture_height}, $config->{config_picture_resize}, $ARGS{last_id}); <%def do_subcategory_defaults> <%args> <%init> my $config_id = $dbh->selectrow_array("Select config_id from Photogallery_defaults where photogallery_id = ? and photogallery_set_id = ?",undef,$pgid,$set_id); my $config_data = $dbh->selectrow_hashref("Select * from Photogallery_config where config_id = ?",undef,$config_id); $dbh->do("Update Photogallery_categories set cat_font = ?, cat_size = ?, cat_color = ?, cat_mouseover_color = ?, cat_leftpadding = ?, cat_toppadding = ?, cat_style = ?, cat_icon = ?, cat_icon_mime = ?, cat_mouseover_underline = ? where cat_id = ?", undef, $config_data->{config_subcat_font} || 'Arial', $config_data->{config_subcat_font_size} ||'4', $config_data->{config_subcat_font_color} || 'gray', $config_data->{config_subcat_font_mouseover_color} || 'gray', $config_data->{config_subcat_left} || 0, $config_data->{config_subcat_top} || 0, $config_data->{config_subcat_font_style} || 'bold', $config_data->{config_subcat_icon_data} || '', $config_data->{config_subcat_icon_mime} || '', $config_data->{config_subcat_font_mouseover_underline} || 0, $ARGS{last_id} ); <%def do_category_defaults> <%args> <%init> my $config_id = $dbh->selectrow_array("Select config_id from Photogallery_defaults where photogallery_id = ? and photogallery_set_id = ?",undef,$pgid,$set_id); my $config_data = $dbh->selectrow_hashref("Select * from Photogallery_config where config_id = ?",undef,$config_id); $dbh->do("Update Photogallery_categories set cat_font = ?, cat_size = ?, cat_color = ?, cat_mouseover_color = ?, cat_leftpadding = ?, cat_toppadding = ?, cat_style = ?, cat_icon = ?, cat_icon_mime = ?, cat_mouseover_underline = ? where cat_id = ?", undef, $config_data->{config_cat_font} || 'Arial', $config_data->{config_cat_font_size} ||'4', $config_data->{config_cat_font_color} || 'gray', $config_data->{config_cat_font_mouseover_color} || 'gray', $config_data->{config_cat_left} || 0, $config_data->{config_cat_top} || 0, $config_data->{config_cat_font_style} || 'bold', $config_data->{config_cat_icon_data} || '', $config_data->{config_cat_icon_mime} || '', $config_data->{config_cat_font_mouseover_underline} || 0, $ARGS{last_id} ); <%def newsubcategory> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); my $position; ($position) = $dbh->selectrow_array("Select MAX(cat_position) From Photogallery_categories Where parent_id = ?",undef,$IARGS{'parent_category_id'}); $position++; $dbh->do("Insert into Photogallery_categories set cat_name=?, parent_id=?, cat_position=?, cat_photogallery_id =?, cat_photogallery_set_id = ?, cat_size = ?, cat_color = ?, cat_mouseover_color = ?, cat_mouseover_underline = ?, cat_style = ?, cat_leftpadding = ?, cat_font = ?", undef, $IARGS{'new_subcategory'}, $IARGS{'parent_category_id'}, $position, $pgid, $set_id, 3, 'white', 'yellow', 0, 'bold', 15, ''); my $parent = $IARGS{'parent_category_id'}; my $last_id = $dbh->selectrow_array("Select LAST_INSERT_ID()"); $m->comp('do_subcategory_defaults', last_id => $last_id); $m->comp('do_thumbnail_listing_defaults', last_id => $last_id); $m->redirect("$file?control=categories&opencat=$parent&pg_id=$pgid"); <%def defSubCategoryGallery> <%init> <%def subcatname> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_name=? Where cat_id=?",undef,$IARGS{'cat_name'},$IARGS{'cat_id'}); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$id"); <%def subcatproperties> <%init> #$dbh->do("Update Photogallery_categories set #cat_size = $IARGS{cat_size} #Where #cat_id = $IARGS{cat_id} #",undef); $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_size = ?, cat_font = ?, cat_color = ?, cat_mouseover_color = ?, cat_leftpadding = ?, cat_toppadding = ?, cat_style = ?, parent_id = ? Where cat_id = ? ",undef, $IARGS{cat_size}, $IARGS{cat_font}, $IARGS{cat_color}, $IARGS{cat_mouseover_color}, $IARGS{cat_leftpadding}, $IARGS{cat_toppadding}, $IARGS{cat_style}, $IARGS{parent_id}, $IARGS{cat_id}); my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$id"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def send_default_cat_icon> <%init> my $hash_ref; my $sth = $dbh->prepare("Select config_cat_icon_data,config_cat_icon_mime From Photogallery_config Where config_id = ?"); $sth->execute($IARGS{'id'}); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'config_cat_icon_mime'}); $r->send_http_header; print $hash_ref->{'config_cat_icon_data'}; $m->flush_buffer; $m->abort; <%def caticon> <%init> my $hash_ref; my $sth = $dbh->prepare("Select cat_icon,cat_icon_mime From Photogallery_categories Where cat_id = ?"); $sth->execute($IARGS{'iconID'}); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'cat_icon_mime'}); $r->send_http_header; print $hash_ref->{'cat_icon'}; $m->flush_buffer; $m->abort; <%def subcaticonupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print $IARGS{'cat_icon'}; #$m->flush_buffer; #$m->abort; if ($IARGS{'cat_icon_delete'} ne '') { $dbh->do("Update Photogallery_categories set cat_icon=?, cat_icon_mime=? Where cat_id=?",undef, '', '', $IARGS{'cat_id'}); } if ($IARGS{'cat_icon'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_categories set cat_icon=?, cat_icon_mime=? Where cat_id=?",undef, $IncommingImage, $image_mime, $IARGS{'cat_id'}); } my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$redirect"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def caticonupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print $IARGS{'cat_icon'}; #$m->flush_buffer; #$m->abort; if ($IARGS{'cat_icon_delete'} ne '') { $dbh->do("Update Photogallery_categories set cat_icon=?, cat_icon_mime=? Where cat_id=?",undef, '', '', $IARGS{'cat_id'}); } if ($IARGS{'cat_icon'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_categories set cat_icon=?, cat_icon_mime=? Where cat_id=?",undef, $IncommingImage, $image_mime, $IARGS{'cat_id'}); } my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=catcontent&subcatID=$redirect"); <%def options> <%init> my $optionEnabled; ($optionEnabled) = $dbh->selectrow_array("Select options_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); $m->redirect("$file?control=noaccess") if (!$optionEnabled); 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 %colorHash; $colorHash{"00FFFF"}="Aqua"; $colorHash{"000000"} ="Black"; $colorHash{"0000FF"} ="Blue"; $colorHash{"FF00FF"} ="Fuchsia"; $colorHash{"BEBEBE"} ="Gray"; $colorHash{"008000"} ="Green"; $colorHash{"00FF00"} ="Lime"; $colorHash{"800000"} ="Maroon"; $colorHash{"000080"} ="Navy"; $colorHash{"808000"} ="Olive"; $colorHash{"800080"} ="Purple"; $colorHash{"FF0000"} ="Red"; $colorHash{"C0C0C0"} ="Silver"; $colorHash{"336666"} ="Teal"; $colorHash{"FFFFFF"} ="White"; $colorHash{"FFFF00"} ="Yellow"; my %scrollHash = ('fixed' => 'Fixed', 'scroll' => 'Scroll'); my %repeatHash = ('no-repeat' => 'No Repeat', 'repeat' => 'Horizontally and Vertically', 'repeat-x' => 'Horizontally', 'repeat-y' => 'Vertically'); my %vposHash = ('top' => 'Top', 'center' => 'Center', 'bottom' => 'Bottom'); my %hposHash = ('left' => 'Left', 'center' => 'Center', 'right' => 'Right'); my %styleHash= ('none' => 'None', 'both' => 'Bold and Italic', 'italic' => 'Italic', 'bold'=>'Bold');
Options
Background Upload
Site Image
Frameset Information
Category Background Image
Category Background Properties
Guest Photo Upload
Piclisting Background Image
Piclisting Background Properties
Content Background Image
Content Background Properties
Scrollbar Customization
File Font Color
Next Button Image
Prev Button Image
Page List Font

Background Upload
If the image is smaller than your frameset,
then the image will be used for the site image, piclisting, category,
and content backgrounds.
   URL:
     File:

Site Image
% if ($hash_ref->{'logo_data'}) { % } else { No Image % }
URL:
     

Frameset Information
Vertical Divide {'mainframe_width'}%>>
Category Horizontal Divide {'leftframe_height'}%>>
Gallery Horizontal Divide {'rightframe_height'}%>>

Category Background Image
% if ($hash_ref->{'cateogry_background_image'}) { % } else { No Image % }
     

Category Background Properties
Background Color
Background Scrolling
Background Repeat
Background Position
If Custom Top: Left:

Guest Photo Upload
Is Currently
Font:
Text Size:
Text Color:
Text Style:

Piclisting Background Image
% if ($hash_ref->{'piclisting_bg_image'}) { % } else { No Image % }
    

Piclisting Background Properties
Background Color
Background Scrolling
Background Repeat
Background Position
If Custom Top: Left:

Content Background Image
% if ($hash_ref->{'content_bg_image'}) { % } else { No Image % }
     

Content Background Properties
Background Color
Background Scrolling
Background Repeat
Background Position
If Custom Top: Left:

?control=scrollupdate&pg_id=<%$pgid%>>
Scrollbar Customization
Scroll 3dlight Color
Scroll Arrow Color
Scroll Base Color
Scroll Darkshadow Color
Scroll Face Color
Scroll Highlight Color
Scroll Shadow Color

File Font Color
Color:  

Next Button Image
% if ($hash_ref->{'next_page_image'}){ %} else { No Image Uploaded % }
     

Previous Button Image
% if ($hash_ref->{'prev_page_image'}){ %} else { No Image Uploaded % }
     

Page Listing Font
Font:
Text Size:
Text Color:
Text Style:
<%def catproperties> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_size = ?, cat_font = ?, cat_color = ?, cat_mouseover_color = ?, cat_mouseover_underline = ?, cat_leftpadding = ?, cat_toppadding = ?, cat_style = ? Where cat_id = ? ",undef, $IARGS{cat_size}, $IARGS{cat_font}, $IARGS{cat_color}, $IARGS{cat_mouseover_color}, $IARGS{cat_mouseover_underline}, $IARGS{cat_leftpadding}, $IARGS{cat_toppadding}, $IARGS{cat_style}, $IARGS{cat_id}); my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=catcontent&subcatID=$id"); <%def catname> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_name=? Where cat_id=?",undef,$IARGS{'cat_name'},$IARGS{'cat_id'}); my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=catcontent&subcatID=$id"); <%def logoupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print 'a'; #$m->flush_buffer; #$m->abort; if ($IARGS{'logo_delete'} ne '') { $dbh->do("Update Photogallery_defaults set logo_data=?, logo_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', '', $pgid, $set_id); } if ($IARGS{'bgimage'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_defaults set logo_data=?, logo_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IncommingImage, $image_mime, $pgid, $set_id); } if ($IARGS{'logo_url'} ne '') { $dbh->do("Update Photogallery_defaults set logo_url=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IARGS{'logo_url'}, $pgid, $set_id); } #$m->redirect("$file?control=options"); <%def sendlogo> <%init> my $hash_ref; my $sth = $dbh->prepare("Select logo_data,logo_mime From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'logo_mime'}); $r->send_http_header; print $hash_ref->{'logo_data'}; $m->flush_buffer; $m->abort; <%def frameupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set mainframe_width=?, leftframe_height=?, rightframe_height=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IARGS{'middle'}, $IARGS{'left'}, $IARGS{'right'}, $pgid, $set_id); #$m->redirect("$file?control=options"); <%def catbgupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print 'a'; #$m->flush_buffer; #$m->abort; if ($IARGS{'delete_catbgimage'} ne '') { $dbh->do("Update Photogallery_defaults set cateogry_background_image=?, cateogry_background_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', '', $pgid, $set_id); } if ($IARGS{'bgimage'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_defaults set cateogry_background_image=?, cateogry_background_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IncommingImage, $image_mime, $pgid, $set_id); } #$m->redirect("$file?control=options"); <%def catbgimage> <%init> my $hash_ref; my $sth = $dbh->prepare("Select cateogry_background_image,cateogry_background_mime From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'cateogry_background_mime'}); $r->send_http_header; print $hash_ref->{'cateogry_background_image'}; $m->flush_buffer; $m->abort; <%def catbgpropupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set category_background_color=?, cat_bg_scrolling=?, cat_bg_repeat=?, cat_bg_vposition=?, cat_bg_hposition=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, ($IARGS{'catbg_color'} eq 'custom' ? $IARGS{'custom_color'} : $IARGS{'catbg_color'}), $IARGS{'catbg_scroll'}, $IARGS{'catbg_repeat'}, ($IARGS{'catbg_vposition'} eq 'custom' ? $IARGS{'catbg_cust_vpos'} : $IARGS{'catbg_vposition'}), ($IARGS{'catbg_hposition'} eq 'custom' ? $IARGS{'catbg_cust_hpos'} : $IARGS{'catbg_hposition'}), $pgid, $set_id); <%def guestuploadupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set guest_upload_enabled=?, guest_upload_font=?, guest_upload_size=?, guest_upload_style=?, guest_upload_color=? Where photogallery_id = ? AND photogallery_set_id = ?", undef, $IARGS{'guest_upload'}, $IARGS{'guest_upload_font'}, $IARGS{'guest_upload_size'}, $IARGS{'guest_upload_style'}, $IARGS{'guest_upload_color'}, $pgid, $set_id); <%def uploadphotodialog> <%init> my $cat_hashref; my $subcat_hashref; my @validCat; my $sth; my $inGallery; my $maxPics; ($inGallery, $maxPics) = $dbh->selectrow_array("Select pic_count,max_pics from Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid, $set_id); $m->comp("maxpicsreached") if (($inGallery >= $maxPics) && ($maxPics ne '')); if (!$isAdmin) { $sth = $dbh->prepare("Select cat_id,cat_name,parent_id FROM Photogallery_categories WHERE cat_guest_upload =? AND parent_id != 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?"); $sth->execute("1",$pgid,$set_id); } if ($isAdmin) { $sth = $dbh->prepare("Select cat_id,cat_name,parent_id FROM Photogallery_categories WHERE parent_id != 0 AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?"); $sth->execute($pgid,$set_id); } if ($IARGS{'override'} eq '') { while ($subcat_hashref = $sth->fetchrow_hashref){ my $sth2 = $dbh->prepare("Select cat_name FROM Photogallery_categories WHERE cat_id =?"); $sth2->execute($subcat_hashref->{'parent_id'}); $cat_hashref = $sth2->fetchrow_hashref; push (@validCat, {'cat_name' => $cat_hashref->{'cat_name'}, 'subcat_name' => $subcat_hashref->{'cat_name'}, 'cat_id' => $subcat_hashref->{'cat_id'} }); $sth2->finish; } } my ($id,$subcat,$parent); if ($IARGS{'override'} ne '') { ($id,$subcat) = $dbh->selectrow_array("Select parent_id, cat_name from Photogallery_categories WHERE cat_id = ?",undef,$IARGS{'override'}); ($parent) = $dbh->selectrow_array("Select cat_name from Photogallery_categories Where cat_id = ?",undef,$id); } $sth->finish; my $hash_ref; $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 (!$isAdmin) { % }
Photo Upload
This is the guest photo upload area.
Your picture will not be listed until the
administrator has approved the submittal.
 
Supported Picture Upload Formats:
JPEG · GIF · Bitmap · PNG
Select Subcategory: % if ($IARGS{'override'} ne '') { <% $parent %> - <% $subcat %> % } else { % if ($#validCat > -1) { % } else { Please Create a Subcategory % } % }
Picture Upload:
(Optional)  Url: http://
(Optional)  Description:
(Optional)  Desc Font:
Desc Size:
Desc Color:
Desc Style:
% if (($#validCat > -1) || ($IARGS{'override'} ne '')) { % }
<%def subcatguestupload> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_guest_upload=? Where cat_id=?", undef, $IARGS{'guest_upload'}, $IARGS{'cat_id'}); #print $IARGS{'guest_upload'}; #print $IARGS{'cat_ic'}; #print %IARGS; #$m->flush_buffer; #$m->abort; my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$redirect"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def subcatimageprop> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_thumbnail_width=?, cat_thumbnail_height=?, cat_thumbnail_att=?, cat_image_width=?, cat_image_height=?, cat_image_att=? Where cat_id=?", undef, $IARGS{'thumbnail_width'}, $IARGS{'thumbnail_height'}, $IARGS{'thumbnail_att'}, $IARGS{'imagesize_width'}, $IARGS{'imagesize_height'}, $IARGS{'imagesize_att'}, $IARGS{'cat_id'}); #print "a".$IARGS{'thumbnail_width'}; #print "b".$IARGS{'thumbnail_height'}; #print "c".$IARGS{'thumbnail_att'}; #print "d".$IARGS{'imagesize_width'}; #print "e".$IARGS{'imagesize_height'}; #print "f".$IARGS{'imagesize_att'}; #print "g".$IARGS{'cat_id'}; #$m->flush_buffer; #$m->abort; my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$redirect"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def piclistbgupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print 'a'; #$m->flush_buffer; #$m->abort; if ($IARGS{'delete_catbgimage'} ne '') { $dbh->do("Update Photogallery_defaults set piclisting_bg_image=?, piclisting_bg_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', '', $pgid, $set_id); } if ($IARGS{'bgimage'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_defaults set piclisting_bg_image=?, piclisting_bg_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IncommingImage, $image_mime, $pgid, $set_id); } #$m->redirect("$file?control=options"); <%def piclistbgimage> <%init> my $hash_ref; my $sth = $dbh->prepare("Select piclisting_bg_image,piclisting_bg_mime From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'piclisting_bg_mime'}); $r->send_http_header; print $hash_ref->{'piclisting_bg_image'}; $m->flush_buffer; $m->abort; <%def piclistbgpropupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set piclisting_bg_color=?, piclisting_bg_scrolling=?, piclisting_bg_repeat=?, piclisting_bg_vposition=?, piclisting_bg_hposition=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, ($IARGS{'catbg_color'} eq 'custom' ? $IARGS{'custom_color'} : $IARGS{'catbg_color'}), $IARGS{'catbg_scroll'}, $IARGS{'catbg_repeat'}, ($IARGS{'catbg_vposition'} eq 'custom' ? $IARGS{'catbg_cust_vpos'} : $IARGS{'catbg_vposition'}), ($IARGS{'catbg_hposition'} eq 'custom' ? $IARGS{'catbg_cust_hpos'} : $IARGS{'catbg_hposition'}), $pgid, $set_id); <%def contentbgupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); use File::MMagic; my $mm = File::MMagic->new(); my $IncommingImage; my $image_mime; #print 'a'; #$m->flush_buffer; #$m->abort; if ($IARGS{'delete_catbgimage'} ne '') { $dbh->do("Update Photogallery_defaults set content_bg_image=?, content_bg_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', '', $pgid, $set_id); } if ($IARGS{'bgimage'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $image_mime = $mm->checktype_contents($IncommingImage); $dbh->do("Update Photogallery_defaults set content_bg_image=?, content_bg_mime=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, $IncommingImage, $image_mime, $pgid, $set_id); } #$m->redirect("$file?control=options"); <%def contentbgimage> <%init> my $hash_ref; my $sth = $dbh->prepare("Select content_bg_image,content_bg_mime From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'content_bg_mime'}); $r->send_http_header; print $hash_ref->{'content_bg_image'}; $m->flush_buffer; $m->abort; <%def contentbgpropupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set content_bg_color=?, content_bg_scrolling=?, content_bg_repeat=?, content_bg_vposition=?, content_bg_hposition=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, ($IARGS{'catbg_color'} eq 'custom' ? $IARGS{'custom_color'} : $IARGS{'catbg_color'}), $IARGS{'catbg_scroll'}, $IARGS{'catbg_repeat'}, ($IARGS{'catbg_vposition'} eq 'custom' ? $IARGS{'catbg_cust_vpos'} : $IARGS{'catbg_vposition'}), ($IARGS{'catbg_hposition'} eq 'custom' ? $IARGS{'catbg_cust_hpos'} : $IARGS{'catbg_hposition'}), $pgid, $set_id); <%def catposmove> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); my $array_ref; my $sth; my $position =0; my %moveHash = ('Move Up One' => '-1', 'Move Down One' => '1'); $sth = $dbh->prepare("Select cat_position,cat_id From Photogallery_categories Where cat_photogallery_id =? AND cat_photogallery_set_id = ? AND parent_id = 0 ORDER BY cat_position"); $sth->execute($IARGS{pg_id},$set_id); $array_ref =$sth->fetchall_arrayref({}); $sth->finish; foreach (@$array_ref) { last if ( $_->{'cat_id'} eq $IARGS{'cat_id'} ); $position++; } my $addedIndex = $moveHash{$IARGS{'move'}}+$position; if ( ( $addedIndex >= 0) && ($addedIndex <= $#$array_ref) ) { my $nextID = @$array_ref[$addedIndex]->{'cat_id'}; #move original one to the next one $dbh->do("Update Photogallery_categories set cat_position=? Where cat_id =?",undef, @$array_ref[$addedIndex]->{'cat_position'}, $IARGS{'cat_id'}); #next, move the other one to the original $dbh->do("Update Photogallery_categories set cat_position=? Where cat_id =?",undef, @$array_ref[$position]->{'cat_position'}, $nextID); } my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=catcontent&subcatID=$id"); <%def subcatposmove> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); my $array_ref; my $sth; my $position =0; my %moveHash = ('Move Up One' => '-1', 'Move Down One' => '1'); $sth = $dbh->prepare("Select cat_position,cat_id From Photogallery_categories Where parent_id =? ORDER BY cat_position"); $sth->execute(($IARGS{'parent_id'} eq '' ? "0" : $IARGS{'parent_id'})); $array_ref =$sth->fetchall_arrayref({}); $sth->finish; foreach (@$array_ref) { last if ( $_->{'cat_id'} eq $IARGS{'cat_id'} ); $position++; } my $addedIndex = $moveHash{$IARGS{'move'}}+$position; if ( ( $addedIndex >= 0) && ($addedIndex <= $#$array_ref) ) { my $nextID = @$array_ref[$addedIndex]->{'cat_id'}; #move original one to the next one $dbh->do("Update Photogallery_categories set cat_position=? Where cat_id =?",undef, @$array_ref[$addedIndex]->{'cat_position'}, $IARGS{'cat_id'}); #next, move the other one to the original $dbh->do("Update Photogallery_categories set cat_position=? Where cat_id =?",undef, @$array_ref[$position]->{'cat_position'}, $nextID); } my $id = $IARGS{'cat_id'}; #$m->redirect("$file?control=catcontent&subcatID=$id"); <%def uploadphotoaccept> <%init> use File::MMagic; my $IncommingImage; my %picHash = ('image/jpeg' => 'defDoPhotoUpload_noreturn', 'image/gif' => 'defDoPhotoUpload_noreturn', 'image/bmp' => 'defDoPhotoUpload_noreturn', 'image/png' => 'defDoPhotoUpload_noreturn'); my $files_enabled = $dbh->selectrow_array("Select files_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); if ($IARGS{'photo_file'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } } else { $m->redirect("$file?control=uploadphotodialog&pg_id=$pgid"); } my $amm = File::MMagic->new(); my $type = $amm->checktype_contents($IncommingImage); $m->comp($picHash{$type} || "defDoFileUpload_noreturn", 'imagedata' => \$IncommingImage) if ($files_enabled); $m->comp("defDoPhotoUpload_noreturn", 'imagedata' => \$IncommingImage) if ($picHash{$type});
!
File type not supported
<%def sendphoto> <%init> if ($pgid eq '0') { $m->comp('error_noreturn',message => "Invalid photogallery"); $m->flush_buffer; $m->abort; } my $hash_ref; my $sth = $dbh->prepare("Select pic_data,pic_data_mime From Photogallery_pictures WHERE pic_id = ?"); $sth->execute($IARGS{'picid'}); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'pic_data_mime'}); $r->send_http_header; print $hash_ref->{'pic_data'}; $m->flush_buffer; $m->abort; <%def sendthumbnail> <%init> if ($pgid eq '0') { $m->comp('error_noreturn',message => "Invalid photogallery"); $m->flush_buffer; $m->abort; } my $hash_ref; my $sth = $dbh->prepare("Select pic_thumb,pic_thumb_mime From Photogallery_pictures WHERE pic_id = ?"); $sth->execute($IARGS{'picid'}); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'pic_thumb_mime'}); $r->send_http_header; print $hash_ref->{'pic_thumb'}; $m->flush_buffer; $m->abort; <%def delphoto> <%init> $dbh->do("Delete From Photogallery_pictures Where pic_id = ? AND pic_who_uploaded = ?",undef,$IARGS{'delphotoid'},'guest'); <%def piclistprop> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_piclist_rows=?, cat_piclist_cols=?, cat_piclist_top=?, cat_piclist_left=?, cat_piclist_padding=?, cat_thumbnail_border=?, cat_thumbnail_border_color=?, cat_piclist_title=?, cat_piclist_title_font=?, cat_piclist_title_size=?, cat_piclist_title_color=?, cat_piclist_title_style=?, cat_piclist_title_xposition=?, cat_piclist_title_yposition=?, cat_thumbnail_pages_enabled =?, cat_thumbs_per_page=?, cat_page_numbers=? Where cat_id=?", undef, $IARGS{'piclist_rows'}, $IARGS{'piclist_cols'}, $IARGS{'piclist_top'}, $IARGS{'piclist_left'}, $IARGS{'piclist_padding'}, $IARGS{'thumbnail_border_width'}, $IARGS{'thumbnail_border_color'}, $IARGS{'piclist_title'}, $IARGS{'piclist_title_font'}, $IARGS{'piclist_title_size'}, $IARGS{'piclist_title_color'}, $IARGS{'piclist_title_style'}, $IARGS{'piclist_title_xpos'}, $IARGS{'piclist_title_ypos'}, $IARGS{'thumbnail_pages_enabled'}, $IARGS{'thumbnail_thumbs_per_page'}, $IARGS{'thumbnail_page_listing'}, $IARGS{'cat_id'}); #print "a".$IARGS{'thumbnail_width'}; #print "b".$IARGS{'thumbnail_height'}; #print "c".$IARGS{'thumbnail_att'}; #print "d".$IARGS{'imagesize_width'}; #print "e".$IARGS{'imagesize_height'}; #print "f".$IARGS{'imagesize_att'}; #print "g".$IARGS{'cat_id'}; #$m->flush_buffer; #$m->abort; my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$redirect"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def contentupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_image_xposition=?, cat_image_yposition=?, cat_description_width=?, cat_description_xposition=?, cat_description_yposition=?, cat_image_border=?, cat_image_border_color=? Where cat_id=?", undef, $IARGS{'image_xpos'}, $IARGS{'image_ypos'}, $IARGS{'desc_width'}, $IARGS{'desc_xpos'}, $IARGS{'desc_ypos'}, $IARGS{'image_border_width'}, $IARGS{'image_border_color'}, $IARGS{'cat_id'}); #print "a".$IARGS{'thumbnail_width'}; #print "b".$IARGS{'thumbnail_height'}; #print "c".$IARGS{'thumbnail_att'}; #print "d".$IARGS{'imagesize_width'}; #print "e".$IARGS{'imagesize_height'}; #print "f".$IARGS{'imagesize_att'}; #print "g".$IARGS{'cat_id'}; #$m->flush_buffer; #$m->abort; my $redirect = $IARGS{'cat_id'}; #$m->redirect("$file?control=subcatcontent&subcatID=$redirect"); my $parent; ($parent) = $dbh->selectrow_array("Select parent_id From Photogallery_categories Where cat_id = ?",undef,$IARGS{'cat_id'}); <%def updatedesc> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_pictures set pic_who_uploaded = ?, pic_desc = ?, pic_desc_size = ?, pic_desc_style = ?, pic_desc_font = ?, pic_desc_color = ?, pic_url = ? WHERE pic_id = ?", undef, ( $isAdmin ? "admin" : "guest"), $IARGS{'photo_desc'}, $IARGS{'photo_size'}, $IARGS{'photo_style'}, $IARGS{'photo_font'}, $IARGS{'photo_color'}, $IARGS{'photo_url'}, $IARGS{'pic_id'}); <%def scrollupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set scroll_3dlight_color = ?, scroll_arrow_color = ?, scroll_base_color = ?, scroll_darkshadow_color = ?, scroll_face_color = ?, scroll_highlight_color = ?, scroll_shadow_color = ?", undef, $IARGS{'scroll_3dlight_color'}, $IARGS{'scroll_arrow_color'}, $IARGS{'scroll_base_color'}, $IARGS{'scroll_darkshadow_color'}, $IARGS{'scroll_face_color'}, $IARGS{'scroll_highlight_color'}, $IARGS{'scroll_shadow_color'}); <%def delphotoadmin> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); #print $IARGS{check_delete} . " " . $IARGS{del_pic_id}; #$m->flush_buffer; #$m->abort; if ($IARGS{check_delete} eq $IARGS{'del_pic_id'}) { $dbh->do("Delete From Photogallery_pictures Where pic_id = ?",undef,$IARGS{'del_pic_id'}); } $m->comp("defUpdatePicCount"); <%def delsubcatadmin> <%init> #Delete Pics $m->redirect("$file?control=noaccess") if (!$isAdmin); my ($parent, $pos); ($parent, $pos) = $dbh->selectrow_array("Select parent_id,cat_position From Photogallery_categories Where cat_id = ?",undef,$IARGS{'del_sub_id'}); if ( $IARGS{del_sub_id} eq $IARGS{del_checkbox} ) { $dbh->do("DELETE From Photogallery_pictures WHERE pic_category_id = ?",undef,$IARGS{'del_sub_id'}); $dbh->do("UPDATE Photogallery_categories set cat_position = cat_position - 1 WHERE parent_id = ? AND cat_position > ? AND pic_photogallery_id = ?",undef,$parent,$pos,$pgid); $dbh->do("DELETE From Photogallery_categories WHERE cat_id = ?",undef,$IARGS{'del_sub_id'}); } $m->comp("defUpdatePicCount"); #Delete SubCat <%def delcatadmin> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); if ( $IARGS{del_cat_id} eq $IARGS{del_checkbox} ) { my $sub_array_ref; my $pos; ($pos) = $dbh->selectrow_array("Select cat_position From Photogallery_categories Where cat_id = ?",undef,$IARGS{'del_cat_id'}); $sub_array_ref = $dbh->selectall_arrayref("SELECT cat_id FROM Photogallery_categories WHERE parent_id = ?",undef, $IARGS{del_cat_id}); #foreach (@$sub_array_ref) { #print $_->[0]; #} #$m->flush_buffer; #$m->abort; foreach (@$sub_array_ref) { $dbh->do("DELETE From Photogallery_pictures WHERE pic_category_id = ?",undef,$_->[0]); $dbh->do("DELETE From Photogallery_categories WHERE cat_id = ?",undef,$_->[0]); } $dbh->do("UPDATE Photogallery_categories set cat_position = cat_position - 1 WHERE parent_id = 0 AND cat_position > ? AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef,$pos,$pgid,$set_id); $dbh->do("DELETE From Photogallery_categories WHERE cat_id = ?",undef,$IARGS{'del_cat_id'}); } $m->comp("defUpdatePicCount"); <%def newphotoadmin> <%init> $m->redirect("$file?control=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 $inGallery; my $maxPics; ($inGallery, $maxPics) = $dbh->selectrow_array("Select pic_count,max_pics from Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid, $set_id);
Picture Quota
In Gallery: <% $inGallery %>
Avaliable: <% ($maxPics ? ($maxPics - $inGallery) : "Unlimited") %>
Maximum: <% ($maxPics ? $maxPics : "Unlimited")%>
<% ($maxPics ? int(($inGallery/$maxPics)*100) : "0") %>% Used
<%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'}); % if ($IARGS{picid}) {
{'pic_url'} ne '' ? "href=\"http:\/\/$pic_ref->{'pic_url'}\" target=_new" : "")%> > % }
% my $font = $pic_ref->{'pic_desc_font'}; % my $size = $pic_ref->{'pic_desc_size'}; % my $style = $pic_ref->{'pic_desc_style'}; % my $color = $pic_ref->{'pic_desc_color'}; <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%>> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% $pic_ref->{'pic_desc'} %> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%>
Uploaded To Category <% $parent %> • Subcateogory <% $subcat_ref->{'cat_name'}%>
<%def newphotoaccept> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); if ($IARGS{'accept_photo'} ne '') { $dbh->do("Update Photogallery_pictures set pic_who_uploaded = ? Where pic_id = ?",undef,'admin',$IARGS{'pic_id'}); } if ($IARGS{'decline_photo'} ne '') { $dbh->do("Delete From Photogallery_pictures Where pic_id = ?",undef,$IARGS{'pic_id'}); } $m->comp("defUpdatePicCount"); <%def frameresize> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_frame_resize = ?, cat_frame_border_color = ?, cat_frame_border_width = ? WHERE cat_id = ?", undef, $IARGS{'frame_resize'}, $IARGS{'frame_border_color'}, $IARGS{'frame_border_width'}, $IARGS{'sub_cat_id'}); <%def addextrahtml> <%init> #print $IARGS{'pic_extra_html'}; #print $IARGS{pic_id}; #$m->flush_buffer; #$m->abort; $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_pictures set pic_extra_html = ? Where pic_id =?",undef, $IARGS{'pic_extra_html'}, $IARGS{'pic_id'}); <%def timerupdate> <%init> #print $IARGS{pic_timer}; #print $IARGS{begin_year}. " " .$IARGS{begin_month}. " ".$IARGS{begin_day}; #print $IARGS{end_year}. " " .$IARGS{end_month}." ".$IARGS{end_day}; #print $IARGS{pic_id}; #$m->flush_buffer; #$m->abort; $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_pictures set pic_timer = ?, pic_begin_time = ?, pic_end_time = ? Where pic_id =?", undef, $IARGS{pic_timer}, $IARGS{begin_year}.$IARGS{begin_month}.$IARGS{begin_day}, $IARGS{end_year}.$IARGS{end_month}.$IARGS{end_day}, $IARGS{pic_id}); <%def photogallerylist> <%init> my %searchHash = ('searchbyname' => 'defPhotoListByName', 'searchbyid' => 'defPhotoListByID', 'listall' => 'defPhotoListAll', '' => 'defPhotoListStartUp', 'pictures' => 'defPhotoListPics'); my $searchReturn = $m->comp($searchHash{$IARGS{'search_control'}}); my $photogallery_sth = $searchReturn->{'sth'}; #my $photogallery_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? ORDER BY photogallery_id"); $photogallery_sth->execute($set_id); my ($list_enabled,$setName) = $dbh->selectrow_array("Select list_enabled,photogallery_set_name From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,0,$set_id); $m->redirect("$file?control=notpubliclist") if ( (!$isAdmin) && (!$list_enabled)); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled');
Search the Photogalleries
Search:
>By Name >By ID# >List All >Listing >Pictures

%if ($page > 1) { <• Prev %} else { <• Prev %} %if ($IARGS{search_control} ne 'listall') { Listing <% ($searchReturn->{'count'} eq 0 ? "0" : (($page-1)*$lines_per_page)+1 )%> to <% ( (($page)*$lines_per_page) > $searchReturn->{'count'} ? $searchReturn->{'count'} : (($page)*$lines_per_page) )%> of  <% $searchReturn->{'count'} %> Galleries % } else { Listing <% $searchReturn->{'count'} %> Galleries % } % if ( (($page)*$lines_per_page) < $searchReturn->{'count'} && ($IARGS{search_control} ne 'listall')) { Next •> % } else { Next •> % }
% foreach (1..($searchReturn->{'count'} / 10)+1){ <%$_%> %}

% while ( my $ph_href = $photogallery_sth->fetchrow_hashref) { % if ($isAdmin) { '> % } %if ($isAdmin) { % } % }
<% $setName %>
 
Modify    <% $ph_href->{'photogallery_id'} %>    <% $ph_href->{'pic_count'} %> <% ($ph_href->{'max_pics'} eq '' ? "" : "/") %> <% $ph_href->{'max_pics'} %> <% $ph_href->{'photogallery_name'} %>

% if ($isAdmin) {
Set Information
Add Photogallery
Logout
% }
<%def newphotogallery> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin);
New Photogallery
Name:     
Login:     
Pass:     
User Control:     
Max Pictures:     
Back to Listing
<%def addnewphotogallery> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); 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, Photogallery_config WRITE"); my ($nextPhotogallery) = $dbh->selectrow_array("Select MAX(photogallery_id) From Photogallery_defaults Where photogallery_set_id = ?",undef,$set_id); $dbh->do("Insert into Photogallery_config set config_photogallery_id = ? , config_photogallery_set_id = ?",undef,int($nextPhotogallery + 1),$set_id); my $config_id = $dbh->selectrow_array("Select LAST_INSERT_ID()"); $dbh->do("Insert into Photogallery_defaults set photogallery_id = ?, photogallery_set_id = ?, photogallery_name = ?, login_name = ?, login_pass = ?, max_pics = ?, options_enabled = ?, config_id = ?", undef, int($nextPhotogallery) + 1, $set_id, $IARGS{'ph_name'}, $IARGS{'ph_login'}, $IARGS{'ph_pass'}, $IARGS{'ph_maxpic'}, $IARGS{'optioncontrol'}, $config_id); #$dbh->do("UNLOCK TABLES"); if ($URL ne '') { my $imageBinary = $m->comp("defGetImageFromURL",'URL' => $URL); $m->comp("defAutomaticBackground",'data' => $imageBinary,'gallery_id' => int($nextPhotogallery)+1); } $m->redirect("$file"); <%def modifyphotogallery> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); my $pg_ref = $dbh->selectrow_hashref("Select magnifier_enabled,files_enabled,photogallery_name, max_pics,login_name,login_pass,options_enabled,basic_control From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); my %userHash= ('1' => 'High', '0' => 'Medium', '2' => 'Low'); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled'); my $config_id = $dbh->selectrow_array("Select config_id from Photogallery_defaults where photogallery_id = ? and photogallery_set_id = ?",undef, $pgid,$set_id); my $pg_id = $dbh->selectrow_array("Select config_photogallery_id from Photogallery_config where config_id = ?",undef,$config_id); my $point_to_pg = $dbh->selectrow_array("Select photogallery_name from Photogallery_defaults where photogallery_id = ? and photogallery_set_id = ?",undef,$pg_id,$set_id); my $temp_sth = $dbh->prepare("Select config_id,pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? ORDER BY photogallery_name"); $temp_sth->execute($set_id);
Photogallery Information
Name:     
Login:     
Pass:     
User Control:     
File Uploads:     
Magnifier Glass:     
Max Pictures:     
Back to Listing


Defaults

WARNING
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 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); <%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"); <%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"); <%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); }
% if (!$PGIDzero && ($databaseLogin eq 'Success') && $CategoryExist && $DefaultExist && $PicExist) { % }
Photogallery Setup
Setting up this Photogallery for this database:
<%$database%>
Step 1: Config File
Config File <%(-e $filePath.$configFileName ? "Exists" : "Doesnt Exist")%>
% if (-e $filePath.$configFileName) { No need to create the config file, it already exists here: %} else { Create the config file here: %}
<%$filePath%><%$configFileName%>
Contents of the config file
databasename
databaseLoginName
databaseLoginPass
Full Domain Name - ex: www.google.com
Set ID
Returns or Spaces or Tabs are the field delimiters
Step 2: Database Diagnostics
Database Login: <%$databaseLogin%>
Categories Table: <% ($CategoryExist ? "Exists" : "Doesnt Exist") %>
Defaults Table: <% ($DefaultExist ? "Exists" : "Doesnt Exist") %>
Pictures Table: <% ($PicExist ? "Exists" : "Doesnt Exist") %>
% if ($CategoryExist && $DefaultExist && $PicExist) { All Tables Exist % } elsif ($databaseLogin ne 'Success') { Database login is incorrect % } else { Some tables do not exist
% }
Step 3: Photogallery Set Administration
Set Admin Info: <% ($PGIDzero ? "Exists" : "Doesnt Exist") %>
Set ID:  <%$set_id%>
If this is incorrect, please change it to the correct set ID number
Set Admin Login Name:
Set Admin Pass:
Final Step
If all of the steps have passed the diagnostics,
activate the photogallery by adding a
1 to the end of the config file.
databasename
databaseLoginName
databaseLoginPass
Full Domain Name - ex: www.google.com
Set ID
1
%$m->flush_buffer; %$m->abort; % $dbh->disconnect if ($dbh); <%def noaccess>
!
Function Denied
<%def notpubliclist>
!
The Photogalleries are
not for public listing.
<%def updatephotolist> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set list_enabled=? Where photogallery_id = ? AND photogallery_set_id = ?",undef,$IARGS{publicphotolist},0,$set_id); $m->redirect("$file"); <%def defUpdatePicCount> <%init> my $pic_count; #print $IARGS{pg_id}; #print $pgid; ($pic_count) = $dbh->selectrow_array("SELECT COUNT(*) From Photogallery_pictures Where pic_photogallery_id = ? AND pic_photogallery_set_id = ?",undef,$pgid,$set_id); $dbh->do("Update Photogallery_defaults set pic_count = ? Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pic_count,$pgid,$set_id); <%def maxpicsreached>
!
This Gallery has reached its
maximum picture count
%$m->flush_buffer; %$m->abort; <%def nofunction>
!
Function Undefined
<%def defPhotoListByName> <%init> my $temp_startrow = $lines_per_page*($page-1); my $temp_string = $IARGS{s_string}; my $temp_count = $dbh->selectrow_array("Select COUNT(*) FROM Photogallery_defaults WHERE photogallery_id >= 1 AND photogallery_set_id = ? AND photogallery_name like '\%$temp_string\%'",undef,$set_id); my $temp_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? AND photogallery_name like '\%$temp_string\%' ORDER BY photogallery_id LIMIT $temp_startrow, $lines_per_page"); my %returnHash = ('sth' => $temp_sth, 'count' => $temp_count); return \%returnHash; <%def defPhotoListByID> <%init> my $temp_startrow = $lines_per_page*($page-1); my $temp_string = ($IARGS{s_string} eq 0 ? "1" : $IARGS{s_string}); my $temp_count = $dbh->selectrow_array("Select COUNT(*) FROM Photogallery_defaults WHERE photogallery_id = $temp_string AND photogallery_set_id = ?",undef,$set_id); my $temp_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id = $temp_string AND photogallery_set_id = ? ORDER BY photogallery_id LIMIT $temp_startrow, $lines_per_page"); my %returnHash = ('sth' => $temp_sth, 'count' => $temp_count); return \%returnHash; <%def defPhotoListStartUp> <%init> my $temp_startrow = $lines_per_page*($page-1); my $temp_count = $dbh->selectrow_array("Select COUNT(*) FROM Photogallery_defaults WHERE photogallery_id >= 1 AND photogallery_set_id = ?",undef,$set_id); my $temp_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? ORDER BY photogallery_id LIMIT $temp_startrow, $lines_per_page"); my %returnHash = ('sth' => $temp_sth, 'count' => $temp_count); return \%returnHash; <%def defPhotoListAll> <%init> my $temp_count = $dbh->selectrow_array("Select COUNT(*) FROM Photogallery_defaults WHERE photogallery_id >= 1 AND photogallery_set_id = ?",undef,$set_id); my $temp_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? ORDER BY photogallery_id"); my %returnHash = ('sth' => $temp_sth, 'count' => $temp_count); return \%returnHash; <%def defPhotoListPics> <%init> my $temp_count = $dbh->selectrow_array("Select COUNT(*) FROM Photogallery_defaults WHERE photogallery_id >= 1 AND photogallery_set_id = ?",undef,$set_id); my $temp_sth = $dbh->prepare("Select pic_count,max_pics,photogallery_id, photogallery_name From Photogallery_defaults Where photogallery_id >= 1 AND photogallery_set_id = ? AND pic_count > 0 ORDER BY photogallery_id"); my %returnHash = ('sth' => $temp_sth, 'count' => $temp_count); return \%returnHash; <%def defAutomaticBackground> <%args> $data => undef $gallery_id => 1 <%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); #print $mainframe; #print $leftframe; #print $rightframe; #$m->flush_buffer; #$m->abort; #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); #$m->clear_buffer; #$r->content_type($image_mime2); #$r->send_http_header; #print $croppedImage2; #$m->flush_buffer; #$m->abort; $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); <%def defGetImageFromURL> <%args> $URL => '' <%init> use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $response = $ua->get($URL); return $response->content; <%def editsetinfo> <%init> my ($list_enabled,$set_name,$background_url,$faq_url) = $dbh->selectrow_array("Select list_enabled,photogallery_set_name,background_url,faq_url From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,0,$set_id); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled');
Set Information
Set Name:
Default Background URL
Public Photogallery Listing is
Link to FAQ:
Back to Listing
<%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"); <%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); } <%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); } <%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"); <%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"); <%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"); <%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');
User Information Update
Current User Name:
Current Password:
New Username:
New Password:
Retype Password:

Photogallery Password Protection
Password Protection is
Login:
Pass:
<%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;
User Information has been Updated
<%method EXTERNAL_AddNewPhotogallery> <%args> #$set_id => undef #$dbh => undef <%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; <%def internalAutomaticBackground> <%args> $data => undef $gallery_id => 1 $dbh => undef $set_id => undef <%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); <%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; } % if ($isAdmin) {
% if ($optionEnabled) { % } % if ($user_low_settings) { % } % if ($user_low_settings) { % } % if ($faq_url ne '') { % } %if ($optionEnabled) { % } % if ($user_low_settings) { % }
Administration
Upload a Photo
Options
New Photos
User Info
FAQ
Startup HTML
News
Logout
% } <%def pgprotectupdate> <%init> $m->comp("noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set photogallery_view_login = ?, photogallery_view_pass = ?, photogallery_view_protected = ? Where photogallery_id = ? AND Photogallery_set_id =?", undef, $IARGS{pg_protect_login}, $IARGS{pg_protect_pass}, $IARGS{pg_protect}, $pgid, $set_id); $m->redirect("$file?control=userinfoadmin&pg_id=$pgid"); <%def defProtectedPhotogalleryLogin> <%init>
Protected Login
This Photogallery is view protected
Login:
Pass:
<%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"); <%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; <%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");
Thumbnail
What you will see
% my $font = $IARGS{'photo_font'}; % my $size = $IARGS{'photo_size'}; % my $style = $IARGS{'photo_style'}; % my $color = $IARGS{'photo_color'}; <% ($size ne '' ? "size=$size" : "")%> <% ($color ne '' ? "color=$color" : "")%> > <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%> <% $IARGS{'photo_desc'} %> <% ($style eq 'italic' ? "" : "" )%> <% ($style eq 'bold' ? "" : "") %> <% ($style eq 'both' ? "" : "" )%>
% if (!$isAdmin) { % } else { % }
Upload a photo to this Subcategory
Upload a photo to another Subcateogry
I'm Done Uploading
Your information has been submitted
If this information is incorrect, please decline.
%$m->flush_buffer; %$m->abort; <%def defDoFileUpload_noreturn> <%init> use File::MMagic; my $data = $ARGS{'imagedata'}; $data = $$data; my ($filename) = ($IARGS{'photo_file'} =~ /.*\\(.*)/); my $mm =File::MMagic->new(); my $image_mime = $mm->checktype_contents($data); $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_photogallery_id = ?, pic_photogallery_set_id = ?, pic_is_file = ?, pic_file_name = ?", undef, $data, '', $image_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'}, $pgid, $set_id, '1', $filename); $dbh->do("UNLOCK TABLES"); my ($lastID) = $dbh->selectrow_array("SELECT LAST_INSERT_ID() FROM Photogallery_pictures"); 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");
File Upload
 
<%$filename%>

was successfully uploaded

% if (!$isAdmin) { % } else { % }
Upload a file to this Subcategory
Upload a file to another Subcateogry
I'm Done Uploading
Your information has been submitted
If this information is incorrect, please decline.
%$m->flush_buffer; %$m->abort; <%def downloadfile> <%init> my ($data,$filename) = $dbh->selectrow_array("Select pic_data,pic_file_name from Photogallery_pictures Where pic_id = ?",undef,$IARGS{'picid'}); $m->clear_buffer; $r->header_out("Content-Disposition", "attachment;filename=\"$filename\""); print $data; $m->flush_buffer; $m->abort; <%def movepic> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_pictures set pic_category_id = ? Where pic_id = ? AND pic_photogallery_id = ? AND pic_photogallery_set_id = ?", undef, $IARGS{move_cat}, $IARGS{move_id}, $pgid, $set_id ); <%def error_noreturn> <%args> $message => 'Error' <%init>
!
<%$message%>
%$m->flush_buffer; %$m->abort; <%def updatefilecolor> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set file_font_color = ? Where photogallery_id = ? AND photogallery_set_id = ?", undef, $IARGS{'file_color'}, $pgid, $set_id); $m->redirect("$file?control=options&pg_id=$pgid"); <%def updateviscat> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_is_hidden = ? Where cat_id = ? AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef, $IARGS{cat_vis}, $IARGS{vis_cat_id}, $pgid, $set_id); $m->redirect("$file?control=catcontent&subcatID=$IARGS{vis_cat_id}&pg_id=$pgid"); <%def updatevissubcat> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_is_hidden = ? Where cat_id = ? AND cat_photogallery_id = ? AND cat_photogallery_set_id = ?",undef, $IARGS{subcat_vis}, $IARGS{vis_subcat_id}, $pgid, $set_id); $m->redirect("$file?control=subcatcontent&subcatID=$IARGS{vis_subcat_id}&pg_id=$pgid"); <%def startuphtml> <%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 ($url,$choose,$html) = $dbh->selectrow_array("Select startup_html_url,startup_html_choose,startup_html From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); my %chooseHash = ('html' => 'this HTML', 'url' => 'the URL');
Choose Startup HTML
Use for the startup HTML
URL:

Display as User

HTML
<%def updatechoosehtml> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set startup_html_url = ?, startup_html_choose = ? Where photogallery_id = ? AND photogallery_set_id = ?",undef, $IARGS{startup_url}, $IARGS{choose_html}, $pgid, $set_id); $m->redirect("$file?control=startuphtml&pg_id=$pgid"); <%def updatestartuphtml> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set startup_html = ? Where photogallery_id = ? AND photogallery_set_id = ?",undef, $IARGS{startup_html}, $pgid, $set_id); $m->redirect("$file?control=startuphtml&pg_id=$pgid"); <%def defGetHTMLFromURL> <%args> $URL => '' <%init> use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $response = $ua->get($URL); return $response->content; <%def topredirect> <%init> $m->redirect("$file?control=topframe&pg_id=$pgid"); <%def editnews> <%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 $news = $dbh->selectrow_array("Select startup_news From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id);
Startup News Section

Display as User
<%def updatenews> <%init> my $news = $IARGS{startup_news}; $news =~ s/\<|\>//g; #print $news; #$m->flush_buffer; #$m->abort; $dbh->do("Update Photogallery_defaults set startup_news = ? Where photogallery_id = ? AND photogallery_set_id = ?",undef,$news,$pgid,$set_id); $m->redirect("$file?control=editnews&pg_id=$pgid"); <%method EXTERNAL_getnews> <%args> $pg_id #$path <%init> #my $databaseInfo = $m->comp("get_ConfigFile"); #if ($databaseInfo == 0) { #print "News Database Error"; #$m->flush_buffer; #$m->abort; #} my $databaseInfo = $m->comp('defConnectToDatabase'); #$dbh = DBI->connect("DBI:mysql:$databaseInfo->{database}", $databaseInfo->{database_login}, $databaseInfo->{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 $news = $dbh->selectrow_array("Select startup_news From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pg_id,$databaseInfo->{set_id}); #print $news . "|".$pg_id."|".$databaseInfo->{set_id}; #$m->flush_buffer; #$m->abort; return $news; <%def get_ConfigFile> <%args> #$path <%init> my $path = $m->current_comp->path; my ($filePath2) = ($path =~ /(.*\/)/); my ($configFileName2) = ($path =~ /([\w\d]*)\./); $configFileName2 .= "\.mas"; #return 0 if (! -e $filePath2.$configFileName2); #print "aa" if (! -e $filePath2.$configFileName2); my $configFileData = $m->file($configFileName2); #my $string = $configFileName2; #my @ascii = unpack("C*", $string); #print join(", ", @ascii); my $run = 0; ($database,$database_login,$database_pass,$domainName,$set_id,$run) = ($configFileData =~ /([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)[\s]*([\S]*)/); my %loginInfo = ( database => $database, database_login => $database_login, database_pass => $database_pass, set_id => $set_id); return \%loginInfo if ($run); return 0; <%def defConnectToDatabase> <%init> my $databaseInfo = $m->comp("get_ConfigFile"); $dbh = DBI->connect("DBI:mysql:$databaseInfo->{database}", $databaseInfo->{database_login}, $databaseInfo->{database_pass}) || $m->comp("error_noreturn", message => "The config file is set to run,
but either the database name,
login, or password is incorrect."); return $databaseInfo; <%def htmlsubcatadmin> <%init> $m->redirect("$file?control=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 ($optionEnabled) = $dbh->selectrow_array("Select options_enabled From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?",undef,$pgid,$set_id); my ($url,$choose,$html) = $dbh->selectrow_array("Select cat_startup_html_url,cat_startup_html_choose,cat_startup_html From Photogallery_categories Where cat_photogallery_id = ? AND cat_photogallery_set_id = ? AND cat_id = ?",undef,$pgid,$set_id,$IARGS{'subcatID'}); my %chooseHash = ('html' => 'this HTML', 'url' => 'the URL');
Choose Startup HTML
Use for the startup HTML
URL:

Display as User

HTML
<%def updatesubcathtml> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_categories set cat_startup_html = ? Where cat_photogallery_id = ? AND cat_photogallery_set_id = ? AND cat_id = ?",undef, $IARGS{startup_html}, $pgid, $set_id, $IARGS{subcatID}); $m->redirect("$file?control=htmlsubcatadmin&pg_id=$pgid&subcatID=$IARGS{subcatID}"); <%def updatesubcatchoosehtml> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); #print $IARGS{startup_url}." ".$IARGS{choose_html} . " ".$IARGS{subcatID}; #$m->flush_buffer; #$m->abort; $dbh->do("Update Photogallery_categories set cat_startup_html_url = ?, cat_startup_html_choose = ? Where cat_photogallery_id = ? AND cat_photogallery_set_id = ? AND cat_id = ?",undef, $IARGS{startup_url}, $IARGS{choose_html}, $pgid, $set_id, $IARGS{subcatID}); $m->redirect("$file?control=htmlsubcatadmin&pg_id=$pgid&subcatID=$IARGS{subcatID}"); <%def subcathtml> <%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 ($url,$choose,$html) = $dbh->selectrow_array("Select cat_startup_html_url,cat_startup_html_choose,cat_startup_html From Photogallery_categories Where cat_photogallery_id = ? AND cat_photogallery_set_id = ? AND cat_id = ?",undef,$pgid,$set_id,$IARGS{'subcatID'}); %if ($choose eq 'html') { <% $html %> % } else { % my $getURL = $url; % #print $getURL; % my $printHTML = $m->comp("defGetHTMLFromURL", URL => $getURL); % print $printHTML; % #($printHTML) = ($printHTML =~ /(.*)<\/body>/i); % #print $printHTML; % } <%cleanup> if ($dbh) { $dbh->disconnect; } <%def nextimageupdate> <%args> <%init> my $IncommingImage; if ($IARGS{'delete_nextimage'} ne '') { $dbh->do("Update Photogallery_defaults set next_page_image=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', $pgid, $set_id); } if ($IARGS{'photo_file'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $dbh->do("Update Photogallery_defaults set next_page_image = ? where photogallery_id = ? AND photogallery_set_id = ?",undef,$IncommingImage,$pgid,$set_id); } $m->redirect("?control=options&pg_id=$pgid"); <%def previousimageupdate> <%args> <%init> my $IncommingImage; if ($IARGS{'delete_previmage'} ne '') { $dbh->do("Update Photogallery_defaults set prev_page_image=? Where photogallery_id = ? AND photogallery_set_id = ?" ,undef, '', $pgid, $set_id); } if ($IARGS{'photo_file'}){ my $data = $r->upload->fh; while (<$data>) { $IncommingImage .= $_ } $dbh->do("Update Photogallery_defaults set prev_page_image = ? where photogallery_id = ? AND photogallery_set_id = ?",undef,$IncommingImage,$pgid,$set_id); } $m->redirect("?control=options&pg_id=$pgid"); <%def sendprevimage> <%init> use File::MMagic; my $mm = File::MMagic->new(); my $hash_ref; my $sth = $dbh->prepare("Select prev_page_image From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($mm->checktype_contents($hash_ref->{'prev_page_image'})); $r->send_http_header; print $hash_ref->{'prev_page_image'}; $m->flush_buffer; $m->abort; <%def sendnextimage> <%init> use File::MMagic; my $mm = File::MMagic->new(); my $hash_ref; my $sth = $dbh->prepare("Select next_page_image From Photogallery_defaults Where photogallery_id = ? AND photogallery_set_id = ?"); $sth->execute($pgid,$set_id); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($mm->checktype_contents($hash_ref->{'next_page_image'})); $r->send_http_header; print $hash_ref->{'next_page_image'}; $m->flush_buffer; $m->abort; <%def pagelistupdate> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_defaults set page_list_font=?, page_list_size=?, page_list_style=?, page_list_color=? Where photogallery_id = ? AND photogallery_set_id = ?", undef, $IARGS{'page_list_font'}, $IARGS{'page_list_size'}, $IARGS{'page_list_style'}, $IARGS{'page_list_color'}, $pgid, $set_id); <%def photogallery_defaults> <%init> print "Check to see if set admin!"; my ($file_prefix) = ($r->filename =~ /([\w\d]*)\./); $file_prefix .= ".css"; my $menu = "blank"; $menu = $m->request_args->{menu}."_menu" if ($m->request_args->{menu}); my $sub = "blank"; $sub = $m->request_args->{menu}."_".$m->request_args->{sub} if ($m->request_args->{sub});
<&defaults_menu&>
<& $menu&>
<&$sub&>
<%def defaults_menu> <%init>
<%"photogallery name"%> Defaults
Options Defaults
Category Defaults
Subcategory Defaults
Thumbnail Listing
Picture Defaults
Frameset Defaults
Upload Resizing Defaults
<%def default_options_background_upload> <%init>
Background Upload
If the image is smaller than your frameset, then the image will be used for the site image, piclisting, category, and content backgrounds.
<%def default_frameset_menu>
Frameset Defaults
Frameset
<%def default_upload_resizing_menu>
Upload Resizing
Thumbnail
Image
<%def default_options_menu>
Menu
Changing anything in the options
menu needs to be done from within
the photogallery.
<%def blank> <%def default_button_menu>
Button Defaults
Next Button Image
Previous Button Image
<%def default_content_menu>
Content Defaults
Content Icon
Content Background
Content Position
<%def default_scrollbar_menu>
Scrollbar Defaults
Scrollbar Color
Scrollbar Lighting
<%def default_picture_menu>
Picture Defaults
Image Position
Description Position
<%def default_upload_resizing_thumbnail> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id); my %sizeHash= ( 'none' => 'None', 'absolute' => 'Absolute', 'resizewidth' => 'Resize to Width', 'resizeheight' => 'Resize to Height', 'resizewh' => 'Resize to Width or Height');
Upload Thumbnail Resizing
Width
Height
<%def default_upload_resizing_image> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id); my %sizeHash= ( 'none' => 'None', 'absolute' => 'Absolute', 'resizewidth' => 'Resize to Width', 'resizeheight' => 'Resize to Height', 'resizewh' => 'Resize to Width or Height');
Upload Image Resizing
Width
Height
<%def default_frameset_frameset> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled');
Frameset
Resize
Border Color
Border Width
<%def default_picture_image_position> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
Image Position
Top
Left
Image Border
Width
Color
<%def default_picture_description_position> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
Description Position
Top
Left
Width
<%def default_thumbnail_listing_menu>
Thumbnail Listing
Title Font
Thumbnail Arrangement
Pages
<%def default_thumbnail_listing_pages> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id); my %enableHash= ('1' => 'Enabled', '0' => 'Disabled');
Pages
Pages are
Thumbs per page
List pages
<%def default_thumbnail_listing_arrangement> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
Thumbnail Arrangement
Rows
Columns
 
Where the thumbnail listing starts
Top
Left
Space Between Images
Pixels
 
Thumbnail Border
Width
Color
<%def default_thumbnail_listing_title_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');
Title Font
Title Font
Title Size
Title Color
Title Style
Padding Left
Padding Top
<%def default_subcategory_menu>
Subcategory Defaults
Subcategory Icon
Subcategory Font
Subcategory Position
<%def default_subcategory_subcategory_icon> <%init> my $config = $dbh->selectrow_hashref("Select * from Photogallery_config where config_photogallery_id = ? and config_photogallery_set_id = ?",undef, $pgid,$set_id);
Subcategory Icon
%if($config->{config_subcat_icon_data}) { %} else { Currently no icon is used %}
<%def default_category_menu>
Category Defaults
Category Icon
Category Font
Category Position
<%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);
Category Icon
%if($config->{config_cat_icon_data}) { %} else { Currently no icon is used %}
<%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');
Subcategory Font
Font
Size
Color
Style
Mouseover Color
Mouseover Underline
<%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');
Category Font
Font
Size
Color
Style
Mouseover Color
Mouseover Underline
<%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);
Subcategory Position
Padding from the left
Padding from the top
<%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);
Category Position
Padding from the left
Padding from the top
<%def default_picture_picture_icon>
Picture Icon
Currently no icon is used
<%def default_picture_picture_font>
Picture Background
Color
Scrolling
Repeat
<%def default_picture_picture_position>
Picture Position
Padding from the left
Padding from the top
<%def default_content_content_icon>
Content Icon
Currently no icon is used
<%def default_content_content_font>
Content Background
Color
Scrolling
Repeat
<%def default_content_content_position>
Content Position
Padding from the left
Padding from the top
<%def default_scrollbar_scrollbar_color>
Scrollbar Color
Arrow color
Base color
Face color
<%def default_scrollbar_scrollbar_lighting>
Scrollbar Lighting
3 D light
Dark shadow
Highlight
Shadow
<%def default_button_button_next>
Next button
Currently no button is being used
<%def default_button_button_previous>
Previous Button
Currently no button is being used
<%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}); <%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'});
% if ($IARGS{picid}) { {'pic_url'} ne '' ? "href=\"http:\/\/$pic_ref->{'pic_url'}\" target=_new" : "")%> > % } <% $pic_ref->{'pic_extra_html'} %> <%cleanup> if ($dbh) { $dbh->disconnect; } <%def sendlargephoto> <%init> if ($pgid eq '0') { $m->comp('error_noreturn',message => "Invalid photogallery"); $m->flush_buffer; $m->abort; } my $hash_ref; my $sth = $dbh->prepare("Select pic_large_data,pic_large_mime From Photogallery_pictures WHERE pic_id = ?"); $sth->execute($IARGS{'picid'}); $hash_ref = $sth->fetchrow_hashref; $sth->finish; $m->clear_buffer; $r->content_type($hash_ref->{'pic_large_mime'}); $r->send_http_header; print $hash_ref->{'pic_large_data'}; $m->flush_buffer; $m->abort; <%def updatemagnifier> <%init> $m->redirect("$file?control=noaccess") if (!$isAdmin); $dbh->do("Update Photogallery_pictures set pic_magnifier_enabled = ? Where pic_id = ? AND pic_photogallery_id = ? AND pic_photogallery_set_id = ?", undef, $IARGS{magnifier_enabled}, $IARGS{move_id}, $pgid, $set_id );