version 1.679.2.6, 2008/09/29 22:58:41
|
version 1.680, 2008/09/05 15:48:08
|
Line 1507 sub create_text_file {
|
Line 1507 sub create_text_file {
|
$fh = Apache::File->new('>/home/httpd'.$filename); |
$fh = Apache::File->new('>/home/httpd'.$filename); |
if (! defined($fh)) { |
if (! defined($fh)) { |
$r->log_error("Couldn't open $filename for output $!"); |
$r->log_error("Couldn't open $filename for output $!"); |
$r->print(&mt('Problems occurred in creating the output file. ' |
$r->print("Problems occured in creating the output file. ". |
.'This error has been logged. ' |
"This error has been logged. ". |
.'Please alert your LON-CAPA administrator.')); |
"Please alert your LON-CAPA administrator."); |
} |
} |
return ($fh,$filename) |
return ($fh,$filename) |
} |
} |
Line 2987 sub preferred_languages {
|
Line 2987 sub preferred_languages {
|
} |
} |
} |
} |
} |
} |
return &get_genlanguages(@languages); |
|
} |
|
|
|
sub get_genlanguages { |
|
my (@languages) = @_; |
|
# turn "en-ca" into "en-ca,en" |
# turn "en-ca" into "en-ca,en" |
my @genlanguages; |
my @genlanguages; |
foreach my $lang (@languages) { |
foreach my $lang (@languages) { |
unless ($lang=~/\w/) { next; } |
unless ($lang=~/\w/) { next; } |
push(@genlanguages,$lang); |
push(@genlanguages,$lang); |
if ($lang=~/(\-|\_)/) { |
if ($lang=~/(\-|\_)/) { |
push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); |
push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); |
} |
} |
} |
} |
#uniqueify the languages list |
#uniqueify the languages list |
my %count; |
my %count; |
Line 3353 sub pprmlink {
|
Line 3348 sub pprmlink {
|
|
|
|
|
sub timehash { |
sub timehash { |
my ($thistime) = @_; |
my @ltime=localtime(shift); |
my $timezone = &Apache::lonlocal::gettimezone(); |
return ( 'seconds' => $ltime[0], |
my $dt = DateTime->from_epoch(epoch => $thistime) |
'minutes' => $ltime[1], |
->set_time_zone($timezone); |
'hours' => $ltime[2], |
my $wday = $dt->day_of_week(); |
'day' => $ltime[3], |
if ($wday == 7) { $wday = 0; } |
'month' => $ltime[4]+1, |
return ( 'second' => $dt->second(), |
'year' => $ltime[5]+1900, |
'minute' => $dt->minute(), |
'weekday' => $ltime[6], |
'hour' => $dt->hour(), |
'dayyear' => $ltime[7]+1, |
'day' => $dt->day_of_month(), |
'dlsav' => $ltime[8] ); |
'month' => $dt->month(), |
|
'year' => $dt->year(), |
|
'weekday' => $wday, |
|
'dayyear' => $dt->day_of_year(), |
|
'dlsav' => $dt->is_dst() ); |
|
} |
} |
|
|
sub utc_string { |
sub utc_string { |
Line 3377 sub utc_string {
|
Line 3367 sub utc_string {
|
|
|
sub maketime { |
sub maketime { |
my %th=@_; |
my %th=@_; |
my ($epoch_time,$timezone,$dt); |
|
$timezone = &Apache::lonlocal::gettimezone(); |
|
eval { |
|
$dt = DateTime->new( year => $th{'year'}, |
|
month => $th{'month'}, |
|
day => $th{'day'}, |
|
hour => $th{'hour'}, |
|
minute => $th{'minute'}, |
|
second => $th{'second'}, |
|
time_zone => $timezone, |
|
); |
|
}; |
|
if (!$@) { |
|
$epoch_time = $dt->epoch; |
|
if ($epoch_time) { |
|
return $epoch_time; |
|
} |
|
} |
|
return POSIX::mktime( |
return POSIX::mktime( |
($th{'seconds'},$th{'minutes'},$th{'hours'}, |
($th{'seconds'},$th{'minutes'},$th{'hours'}, |
$th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1)); |
$th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1)); |
Line 3775 sub blocking_status {
|
Line 3747 sub blocking_status {
|
|
|
############################################### |
############################################### |
|
|
sub check_ip_acc { |
|
my ($acc)=@_; |
|
&Apache::lonxml::debug("acc is $acc"); |
|
if (!defined($acc) || $acc =~ /^\s*$/ || $acc =~/^\s*no\s*$/i) { |
|
return 1; |
|
} |
|
my $allowed=0; |
|
my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'}; |
|
|
|
my $name; |
|
foreach my $pattern (split(',',$acc)) { |
|
$pattern =~ s/^\s*//; |
|
$pattern =~ s/\s*$//; |
|
if ($pattern =~ /\*$/) { |
|
#35.8.* |
|
$pattern=~s/\*//; |
|
if ($ip =~ /^\Q$pattern\E/) { $allowed=1; } |
|
} elsif ($pattern =~ /(\d+\.\d+\.\d+)\.\[(\d+)-(\d+)\]$/) { |
|
#35.8.3.[34-56] |
|
my $low=$2; |
|
my $high=$3; |
|
$pattern=$1; |
|
if ($ip =~ /^\Q$pattern\E/) { |
|
my $last=(split(/\./,$ip))[3]; |
|
if ($last <=$high && $last >=$low) { $allowed=1; } |
|
} |
|
} elsif ($pattern =~ /^\*/) { |
|
#*.msu.edu |
|
$pattern=~s/\*//; |
|
if (!defined($name)) { |
|
use Socket; |
|
my $netaddr=inet_aton($ip); |
|
($name)=gethostbyaddr($netaddr,AF_INET); |
|
} |
|
if ($name =~ /\Q$pattern\E$/i) { $allowed=1; } |
|
} elsif ($pattern =~ /\d+\.\d+\.\d+\.\d+/) { |
|
#127.0.0.1 |
|
if ($ip =~ /^\Q$pattern\E/) { $allowed=1; } |
|
} else { |
|
#some.name.com |
|
if (!defined($name)) { |
|
use Socket; |
|
my $netaddr=inet_aton($ip); |
|
($name)=gethostbyaddr($netaddr,AF_INET); |
|
} |
|
if ($name =~ /\Q$pattern\E$/i) { $allowed=1; } |
|
} |
|
if ($allowed) { last; } |
|
} |
|
return $allowed; |
|
} |
|
|
|
############################################### |
|
|
|
=pod |
=pod |
|
|
=head1 Domain Template Functions |
=head1 Domain Template Functions |
Line 4575 table.LC_docs_path td.LC_docs_path_compo
|
Line 4493 table.LC_docs_path td.LC_docs_path_compo
|
td.LC_table_cell_checkbox { |
td.LC_table_cell_checkbox { |
text-align: center; |
text-align: center; |
} |
} |
|
#changed in a new style. see at the end of the css deklaration LC_mainmenu_col__fieldset |
table#LC_mainmenu td.LC_mainmenu_column { |
table#LC_mainmenu td.LC_mainmenu_column { |
vertical-align: top; |
vertical-align: top; |
} |
} |
Line 4589 table#LC_mainmenu td.LC_mainmenu_column
|
Line 4507 table#LC_mainmenu td.LC_mainmenu_column
|
.LC_menubuttons_link { |
.LC_menubuttons_link { |
text-decoration: none; |
text-decoration: none; |
} |
} |
|
#2008--9-5: new menu style sheet.Changed category |
.LC_menubuttons_category { |
.LC_menubuttons_category { |
color: $font; |
color: $font; |
background: $pgbg; |
background: $pgbg; |
Line 5446 img.stift{
|
Line 5364 img.stift{
|
border-width:0; |
border-width:0; |
vertical-align:middle; |
vertical-align:middle; |
} |
} |
|
|
|
#Styles for main menu |
|
table#LC_mainmenu td.LC_mainmenu_col_fieldset{ |
|
vertical-align: top; |
|
width: 45%; |
|
} |
|
.LC_mainmenu_fieldset_category { |
|
color: $font; |
|
background: $pgbg; |
|
font-family: $sans; |
|
font-size: small; |
|
font-weight: bold; |
|
} |
|
fieldset#LC_mainmenu_fieldset { |
|
margin:0px 0px 10px 0px; |
|
|
|
} |
END |
END |
} |
} |
|
|
Line 8330 sub build_recipient_list {
|
Line 8265 sub build_recipient_list {
|
} elsif ($origmail ne '') { |
} elsif ($origmail ne '') { |
push(@recipients,$origmail); |
push(@recipients,$origmail); |
} |
} |
if (defined($defmail)) { |
if ($defmail ne '') { |
if ($defmail ne '') { |
push(@recipients,$defmail); |
push(@recipients,$defmail); |
|
} |
|
} |
} |
if ($otheremails) { |
if ($otheremails) { |
my @others; |
my @others; |
Line 9353 sub init_user_environment {
|
Line 9286 sub init_user_environment {
|
} |
} |
# Give them a new cookie |
# Give them a new cookie |
my $id = ($args->{'robot'} ? 'robot'.$args->{'robot'} |
my $id = ($args->{'robot'} ? 'robot'.$args->{'robot'} |
: $now.$$.int(rand(10000))); |
: $now); |
$cookie="$username\_$id\_$domain\_$authhost"; |
$cookie="$username\_$id\_$domain\_$authhost"; |
|
|
# Initialize roles |
# Initialize roles |