version 1.976.2.4, 2008/12/31 18:26:53
|
version 1.981, 2008/12/21 19:03:10
|
Line 73 package Apache::lonnet;
|
Line 73 package Apache::lonnet;
|
use strict; |
use strict; |
use LWP::UserAgent(); |
use LWP::UserAgent(); |
use HTTP::Date; |
use HTTP::Date; |
|
use Image::Magick; |
|
|
# use Date::Parse; |
# use Date::Parse; |
use vars qw(%perlvar %spareid %pr %prp $memcache %packagetab $tmpdir |
use vars qw(%perlvar %spareid %pr %prp $memcache %packagetab $tmpdir |
$_64bit %env %protocol); |
$_64bit %env %protocol); |
Line 97 use LONCAPA::Configuration;
|
Line 99 use LONCAPA::Configuration;
|
my $readit; |
my $readit; |
my $max_connection_retries = 10; # Or some such value. |
my $max_connection_retries = 10; # Or some such value. |
|
|
|
my $upload_photo_form = 0; #Variable to check when user upload a photo 0=not 1=true |
|
|
require Exporter; |
require Exporter; |
|
|
our @ISA = qw (Exporter); |
our @ISA = qw (Exporter); |
Line 2011 sub clean_filename {
|
Line 2015 sub clean_filename {
|
return $fname; |
return $fname; |
} |
} |
|
|
|
#Wrapper function for userphotoupload |
|
sub userphotoupload |
|
{ |
|
my($formname,$subdir) = @_; |
|
$upload_photo_form = 1; |
|
return &userfileupload($formname,undef,$subdir); |
|
} |
|
|
# --------------- Take an uploaded file and put it into the userfiles directory |
# --------------- Take an uploaded file and put it into the userfiles directory |
# input: $formname - the contents of the file are in $env{"form.$formname"} |
# input: $formname - the contents of the file are in $env{"form.$formname"} |
# the desired filenam is in $env{"form.$formname.filename"} |
# the desired filenam is in $env{"form.$formname.filename"} |
Line 2137 sub finishuserfileupload {
|
Line 2149 sub finishuserfileupload {
|
return '/adm/notfound.html'; |
return '/adm/notfound.html'; |
} |
} |
close(FH); |
close(FH); |
|
if($upload_photo_form==1) |
|
{ |
|
my $ima = Image::Magick->new; |
|
$ima->Read($filepath.'/'.$file); |
|
if($ima->Get('width') > 300) |
|
{ |
|
my $factor = $ima->Get('width')/300; |
|
$ima->Scale( width=>300, height=>$ima->Get('height')/$factor ); |
|
} |
|
if($ima->Get('height') > 400) |
|
{ |
|
my $factor = $ima->Get('height')/400; |
|
$ima->Scale( width=>$ima->Get('width')/$factor, height=>400); |
|
} |
|
|
|
|
|
$ima->Write($filepath.'/'.$file); |
|
$upload_photo_form = 0; |
|
} |
} |
} |
if ($parser eq 'parse') { |
if ($parser eq 'parse') { |
my $parse_result = &extract_embedded_items($filepath.'/'.$file,$allfiles, |
my $parse_result = &extract_embedded_items($filepath.'/'.$file,$allfiles, |
Line 4392 sub usertools_access {
|
Line 4423 sub usertools_access {
|
if (($udom eq $env{'user.domain'}) && ($uname eq $env{'user.name'})) { |
if (($udom eq $env{'user.domain'}) && ($uname eq $env{'user.name'})) { |
if ($action ne 'reload') { |
if ($action ne 'reload') { |
return $env{'environment.availabletools.'.$tool}; |
return $env{'environment.availabletools.'.$tool}; |
} |
} |
} |
} |
|
|
my ($toolstatus,$inststatus); |
my ($toolstatus,$inststatus); |