x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
categories.pl - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\LITTLELEV\ImageFolioLite\admin\categories.pl
Girar
Efecto
Propiedad
Historial
############################################################################### # BizDesign ImageFolio Lite Edition 4.2 (Four-dot-Two) ############################################################################### # # ## ### VERSION : 4.2 # #### ## ## RELEASED ON : 02/15/2007 # ## ## ## LAST MODIFIED : 02/15/2007 # ########## ## # ## ### ## # ## ### ######## # ############################################################################### # Released by BizDesign, Inc. # written by Dirk Koppers and Greg Raaum of BizDesign # # Purchasing : http://imagefolio.com/purchase/ # Support : http://imagefolio.com/support/ # Phone : (214) 642-9787 # Email : sales@bizdesign.com ############################################################################### # COPYRIGHT AND LICENSE INFORMATION : # # Copyright (c) 1999-2007 BizDesign, Inc. All rights reserved. # # Selling or distributing the code for this program without prior written # consent is expressly forbidden. # # One licensed copy of the program may reside on a single server, in use by a # single domain. For each installed instance of the program, a separate # license is required. # # Licensed users may alter or modify this software, at their own risk, of # course. They may also hire others to modify their own copy of the code, as # long as the code is not transferred to or retained by the individual who is # hired (unless he/she is also a license holder). Although license-holders # may modify the code for their use, modified code may NOT be resold or # distributed. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BIZDESIGN, # INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # BizDesign, Inc. is not liable for any conduct associated with image gallery # activity, nor for any binary media posted using this program, including but # not imited to images, photographs, movies, and clipart. # # The user must assume the entire risk of using the program. Although this # program has been thoroughly tested on BizDesign's servers, BizDesign does not # warrant that it works on all servers and will not be held liable for anything, # including but not limited to, misusage, error, or loss of data. ANY # LIABILITY OF THE SELLER WILL BE LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT # OR REFUND OF PURCHASE PRICE. Use at your own risk! ############################################################################### # Do not modify below this line unless you know what you are doing. ############################################################################### use File::Path; ############################################################################### # ADD # Add a new category ############################################################################### sub add_category { $ADDCATEGORY = "active"; if ($catstep eq "final") { if (!$catname) { &Error ("You must enter a Category Name."); } if (!$type) { &Error ("You must select a Category Type."); } $catname =~ s/^\s+//g; # Trim leading blanks... $catname =~ s/\s+$//g; # Trim trailing blanks... $catname =~ s/\s+\s+/ /g; # Change two spaces to one. $catname =~ s/\s+/_/g; # Change spaces to underscores $newcatname = $catname; $newcatname =~ s/_/ /g; if ($type eq "main") { $createcat = "$image_directory/$catname"; $pagetitle = "New Category Added"; $comment = qq|<$admin_font>
The category
$newcatname
has been added.
|; } elsif ($type eq "sub") { if (!$category) { &Error ("You must select a Parent Category."); } $createcat = "$image_directory/$category/$catname"; $pagetitle = "New Subcategory Added"; $comment = qq|<$admin_font>
The subcategory
$newcatname
has been added in
$category
.
|; } else { &Error ("Something strange happened here. Please check your categories.pl or admin.cgi files for errors!"); } &check_dir ($catname, $createcat); unless ($admin_demo_mode) { mkdir ("$createcat", "0777") or &Error ("Unable to create category, $createcat. Reason: $!"); chmod(0777,"$createcat") or &Error ("Could not set permissions on category, $createcat. Reason: $!"); } $newcatdirect = $createcat; $newcatdirect =~ s/$image_directory\///g; unless ($admin_demo_mode) { open(CATEGORIES,">>$catfile") or &Error ("Could not open index file, $catfile. Try rebuilding the index. Reason: $!"); if ($useflock) { flock(CATEGORIES, 2); } print CATEGORIES $newcatdirect . "\t" . "0" . "\n";; if ($useflock) { flock(CATEGORIES, 8); } close(CATEGORIES); } &show_new_category; } else { $pagetitle = "Add Category"; &show_new_category; } } ############################################################################### # SHOW NEW CATEGORY # Shows the add a new category form ############################################################################### sub show_new_category { &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Add Category
<$admin_big_font>
Step 1 of 1
<$admin_small_font>
C A T E G O R Y N A M E
<$admin_small_font>
C A T E G O R Y T Y P E
<$admin_small_font>Main Category
Subcategory
<$admin_small_font>
P A R E N T C A T E G O R Y
(if Subcategory)
$catlist
|; &get_footer; } ############################################################################### # RENAME CATEGORY # This one is difficult because we have to rename the category in four places: # the directory itself, the captions file, in the image index, and the category # index. ############################################################################### sub rename_category { $RENAMECATEGORY = "active"; if ($catstep eq "final") { if (!$catname) { &Error ("You must enter a New Category Name."); } if (!$category) { &Error ("You must select a Category to Rename."); } $catname =~ s/^\s+//g; # Trim leading blanks... $catname =~ s/\s+$//g; # Trim trailing blanks... $catname =~ s/\s+\s+/ /g; # Change two spaces to one. $catname =~ s/\s+/_/g; # Change spaces to underscores @categories = split (/\//, $category); $replacetxt = pop @categories; $bounce = $category; $bounce =~ s/$replacetxt$/$catname/g; $renamecat = "$image_directory/$category"; $newname = "$image_directory/$bounce"; &check_dir ($catname, $newname); $pagetitle = "Category Renamed"; $oldcatname = $category; $oldcatname =~ s/_/ /g; $newcatname = $bounce; $newcatname =~ s/_/ /g; $comment = qq|<$admin_font>
The category
$oldcatname
has been globally renamed. The new category name is
$newcatname
.
|; unless ($admin_demo_mode) { # FIRST WE RENAME THE DIRECTORY rename ("$renamecat", "$newname") or &Error ("Could not rename category, $renamecat. Reason: $!"); # SECOND, WE RENAME ALL INSTANCES OF THE OLD CATEGORY IN THE IMAGE INDEX open (FILE,"$indexfile") or &Error ("Could not open $indexfile, is it created. Reason: $!"); my(@LINES)=
; close(FILE); chomp @LINES; $SIZE=@LINES; open (INDEX,">$indexfile") or &Error ("Could not open $indexfile, is it created. Reason: $!"); if ($useflock) { flock(INDEX, 2); } for ($i=0;$i<=$SIZE;$i++) { $_=$LINES[$i]; my ($filename, $path, $blah1, $iptc, $keywords, $blah2, $blah3) = split(/\|/, $_); /^#/ and next; # Skip comment Lines. /^\s*$/ and next; # Skip blank lines. if ($path =~ /^$category\//g or $path eq $category) { $snicker = $path; $snicker =~ s/^$category/$bounce/g; print INDEX "$filename\|$snicker\|\$blah|$iptc|$keywords|$blah2|$blah3|\n"; } else { print INDEX $_ . "\n"; } } if ($useflock) { flock(INDEX, 8); } close(INDEX); chmod(0666,"$indexfile") or &Error ("Could not set permissions on index, $indexfile. Reason: $!"); # THIRD, WE RENAME THE CAPTIONS AND THUMBNAIL CAPTIONS $ncat = $category; $ncat =~ s/\//\./g; # Generate filename for our existing captions file $rncat = $bounce; $rncat =~ s/\//\./g; # Generate filename for our new captions file @old_files = (); opendir (CACHE, "$data_directory") or &Error("Can't Open $data_directory: $!"); @old_files = grep { /^$ncat\./i } readdir(CACHE); closedir (CACHE); foreach $old_file (@old_files) { $adding = $old_file; $adding =~ s/^$ncat//g; $new_file = $rncat . $adding; rename ("$data_directory/$old_file", "$data_directory/$new_file") or &Error ("Could not rename data file, $old_file. Reason: $!"); chmod(0666,"$data_directory/$new_file") or &Error ("Could not set permissions on data file, $new_file. Reason: $!"); } # FORTH, WE RENAME ALL INSTANCES OF THE OLD CATEGORY IN THE USER ACCESS DATABASE if ($using_multiuser_mod && ($admin_directory !~ /\//)){ require "$libpath/users_access.pl"; sub read_access_line { my $split_line = shift; &split_if_groupline($split_line); if ($group_cat_access){ @users_cat = split(/::/,$group_cat_access); $group_cat_access = (); foreach $users_cat (@users_cat) { if ($users_cat eq $category){ $access_found = 1; $group_cat_access .= $bounce . "::"; } else { $group_cat_access .= $users_cat . "::"; } } $group_cat_access =~ s/::$//g; } if ($group_post_access){ @users_post = split(/::/,$group_post_access); $group_post_access = (); foreach $users_post (@users_post) { if ($users_post eq $category){ $access_post_found = 1; $group_post_access .= $bounce . "::"; } else { $group_post_access .= $users_post . "::"; } } $group_post_access =~ s/::$//g; } &populate_if_groupline; $newgroupdb .= $if_groupline; if ($readgroupdb) {$newgroupdb .= "\n";} } open (GROUPDB,"$groupdb") or &Error ("Could not open $groupdb, is it created. Reason: $!"); my (@LINES)=
; close(GROUPDB); chomp @LINES; $readgroupdb = 1; foreach $accessfiledata (@LINES) { &read_access_line($accessfiledata); } if ($access_cat_found or $access_post_found) { open(GROUPDB, ">$groupdb"); if ($useflock) { flock(GROUPDB, 2); } print GROUPDB "$newgroupdb"; close(GROUPDB); chmod(0666,"$groupdb"); } opendir (IDS, "$sessions_dir"); my @sessions = grep { /\.user/ } readdir(IDS); closedir (IDS); $NUMSESSIONS = @sessions; if ($NUMSESSIONS > 1) { $readgroupdb = (); foreach $session (@sessions) { $access_cat_found = (); $access_post_found = (); $newgroupdb = (); open (SESSION,"$sessions_dir/$session"); my (@SESSIONLINE)=
; close(SESSION); chomp @SESSIONLINE; my ($userline, $groupline) = @SESSIONLINE[0] =~ /\[(.*?)\]/g; &read_access_line($groupline); if ($access_cat_found or $access_post_found) { open(SESSION, ">$sessions_dir/$session"); if ($useflock) { flock(SESSION, 2); } print SESSION "[$userline][$newgroupdb]\n"; close(SESSION); chmod(0666,"$sessions_dir/$session"); } } } } # FIVE, WE RENAME ALL INSTANCES OF THE OLD CATEGORY IN THE CATEGORY INDEX open (CATFILE,"$catfile") or &Error ("Could not open $catfile, is it created. Reason: $!"); my(@CATS)=
; close(CATFILE); chomp @CATS; $SIZE=@CATS; open (CATINDEX,">$catfile") or &Error ("Could not open $catfile, is it created. Reason: $!"); if ($useflock) { flock(CATINDEX, 2); } for ($i=0;$i<=$SIZE;$i++) { $_=$CATS[$i]; my ($direct, $cnt, $catdate) = split(/\t/, $_); /^#/ and next; # Skip comment Lines. /^\s*$/ and next; # Skip blank lines. if ($direct =~ /^$category\//g or $direct eq $category) { $doodle = $direct; $doodle =~ s/^$category/$bounce/g; print CATINDEX $doodle . "\t" . $cnt . "\t" . $catdate . "\t\n"; } else { print CATINDEX $_ . "\n"; } } if ($useflock) { flock(CATINDEX, 8); } close(CATINDEX); chmod(0666,"$catfile") or &Error ("Could not set permissions on index file, $catfile. Reason: $!"); # SIX, AND FINALLY, WE RENAME ALL INSTANCES OF THE OLD CATEGORY DESCRIPTIONS if (-e $catdesc){ open (CATFILE,"$catdesc") or &Error ("Could not open $catdesc, is it created. Reason: $!"); my(@CATS)=
; close(CATFILE); chomp @CATS; $SIZE=@CATS; open (CATINDEX,">$catdesc") or &Error ("Could not open $catdesc, is it created. Reason: $!"); if ($useflock) { flock(CATINDEX, 2); } for ($i=0;$i<=$SIZE;$i++) { $_=$CATS[$i]; my ($direct, $cnt) = split(/\t/, $_); /^#/ and next; # Skip comment Lines. /^\s*$/ and next; # Skip blank lines. if ($direct =~ /^$category\//g or $direct eq $category) { $doodle = $direct; $doodle =~ s/^$category/$bounce/g; print CATINDEX $doodle . "\t" . $cnt . "\n"; } else { print CATINDEX $_ . "\n"; } } if ($useflock) { flock(CATINDEX, 8); } close(CATINDEX); chmod(0666,"$catdesc") or &Error ("Could not set permissions on index file, $catfile. Reason: $!"); } } &show_rename; } else { $pagetitle = "Rename Category"; &show_rename; } } ############################################################################### # SHOW RENAME # Prints a form for the renaming of an existing category ############################################################################### sub show_rename { &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Rename Category
<$admin_big_font>
Step 1 of 1
<$admin_small_font>
N E W C A T E G O R Y N A M E
<$admin_small_font>
C A T E G O R Y T O R E N A M E
$catlist
|; &get_footer; } ############################################################################### # DELETE CATEGORY # Deletes a category an all associated images from the Web server. Does not # remove category from the database and user must Build the Image Index for # this to take place. ############################################################################### sub delete_category { $DELETECATEGORY = "active"; if ($catstep eq "final") { if (!$category) { &Error ("You must select a category for deletion."); } $deletecat = "$image_directory/$category"; $pagetitle = "Category Deleted"; $newcatname = $category; $newcatname =~ s/_/ /g; my $added_coment = qq| You will need to re-Build your Image Index before this category can be completely deleted from the database.| unless $admin_demo_mode; $comment = qq|<$admin_font>
The category
$newcatname
has been deleted from your Web space.$added_coment
|; rmtree($deletecat) or &Error("Could not delete category, $category. Reason: $!") unless $admin_demo_mode; &show_delete; } elsif ($catstep eq "2") { if (!$category) { &Error("You must select a category for deletion."); } $pagetitle = "Delete Category : Confirmation"; &get_header; print qq|
<$admin_font color="#ffffff">
Warning!
<$admin_font>
You are about to delete the category '$category' and all of its associated images. Are you sure you want to do this?
If not, please click the Cancel button below.
<$admin_font>
|; &get_footer; } else { $pagetitle = "Delete Category"; &show_delete; } } ############################################################################### # ADD CAT DESC # Shows the form for adding category descriptions ############################################################################### sub add_cat_desc { $ADDDESCRIPTIONS = "active"; if ($catstep eq "final") { $catfound = ""; my @LINES; $description =~ s/^\s+//g; # Trim leading blanks... $description =~ s/\s+$//g; # Trim trailing blanks... $description =~ s/\r\n/ /g; # Change newline to a space. $description =~ s/\r//g; # Remove Windows linefeed character. $description =~ s/\n/ /g; # Change newline to a space. $description =~ s/\s+\s+/ /g; # Change two spaces to one. $description =~ s/\s+\s+/ /g; # Change two spaces to one again. if (-e $catdesc) { open (DESC,"<$catdesc"); while (
) { chomp; next if /^\s*$/; # skip blank lines next if /^#/; # skip comment lines push(@LINES, $_); } close(DESC); } $SIZE = @LINES; unless ($admin_demo_mode) { open (INDEX,">$catdesc") or &Error ("Could not open $catdesc. Reason: $!"); if ($useflock) { flock(INDEX, 2); } for ($i=0; $i<=$SIZE; $i++) { $_ = $LINES[$i]; my ($catgname, $catgdesc) = split(/\t/, $_); if ($catgname eq $category) { $catfound = 1; print INDEX $category . "\t" . $description . "\n"; } else { print INDEX $_ . "\n"; } } if (!$catfound) { print INDEX $category . "\t" . $description . "\n"; } if ($useflock) { flock(INDEX, 8); } close(INDEX); } # here we open up catdesc.txt and save current results, then overwrite the file # with the new description $pagetitle = "Category Description Added"; $newcatname = $category; $newcatname =~ s/_/ /g; $comment = qq|<$admin_font>
The description for
$newcatname
has been added successfully.
|; &show_add; } elsif ($catstep eq "2") { # here we open up catdesc.txt and check to see if a description already exists my $cat_desc; $newcategory = $category; $newcategory =~ s/_/ /g; $newcategory =~ s/\// \> /g; if (-e $catdesc) { open (DESC,"< $catdesc"); while (
) { chomp; next if /^\s*$/; # skip blank lines next if /^#/; # skip comment lines push(@desc, $_); } close(DESC); foreach $line (@desc) { my ($catname, $catdescription) = split(/\t/, $line); $catdescription =~ s/^\s+//g; # trim leading blanks... $catdescription =~ s/\s+$//g; # trim trailing blanks... next if (!$catdescription); # skip line if no description if ($catname eq $category) { $cat_desc = $catdescription; last; } } } $pagetitle = "Add Category Descriptions : Enter Category Description"; &get_header; print qq|
<$admin_big_font>
Enter Category Description
<$admin_big_font>
Step 2 of 2
<$admin_small_font>$newcategory
$cat_desc
|; &get_footer; } else { $pagetitle = "Add Category Descriptions : Select a Category"; &show_add; } } sub batch_thumbnail { $BATCHTHUMBNAIL = "active"; $pagetitle = "Batch Thumbnail : Select a Category"; &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Select A Category
<$admin_big_font>
Step 1 of 2
$catlist
|; &get_footer; } sub build_index { $REBUILDINDEX = "active"; $pagetitle = "Rebuild Index: Select a Category"; &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Select A Category
<$admin_big_font>
Step 1 of 2
$catlist
|; &get_footer; } ############################################################################### # SHOW ADD # Shows the form for adding category descriptions ############################################################################### sub show_add { &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Select A Category
<$admin_big_font>
Step 1 of 2
$catlist
|; &get_footer; } ############################################################################### # SHOW DELETE # Shows the category form so we can select a category for deletion ############################################################################### sub show_delete { &get_header; &get_catlist; print qq|$comment
<$admin_big_font>
Select A Category to Delete
<$admin_big_font>
Step 1 of 2
$catlist
|; &get_footer; } ############################################################################### # CHECK DIR # Make sure we have valid characters in the directory name before building it ############################################################################### sub check_dir { my ($dirname, $dir) = @_; if ($dirname =~ /[$deny_chars]/i) { &Error("Invalid characters in category name '$dirname'. A Category cannot contain any of the following characters:
$deny_characters"); } if (-e $dir) { &Error ("The category '$dirname' already exists, try using another!"); } return $input; } 1;
categories.pl
Dirección de la página
Dirección del archivo
Anterior
7/27
Siguiente
Descargar
( 30 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10