richter 2003/01/01 23:39:44
Modified: . Changes.pod epcgiinit.c epdat2.h mod_embperl.c
eg/web base.epl
eg/web/db epwebapp.pl list.epl newpw.mail newuser.mail
updateditem.mail
xsbuilder/maps ep_structure.map
Log:
-> param -> server_addr + website updates
Revision Changes Path
1.194 +1 -0 embperl/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -r1.193 -r1.194
--- Changes.pod 23 Dec 2002 20:47:35 -0000 1.193
+++ Changes.pod 2 Jan 2003 07:39:43 -0000 1.194
@@ -50,6 +50,7 @@
generated tags to contains a closing slash, so they are valid XML/XHTML.
- Fix make test to ignore different idention of newer versions of
libxslt.
+ - Added server_addr to the request param object.
=head1 2.0b8 (BETA) 25. Juni 2002
1.4 +35 -1 embperl/epcgiinit.c
Index: epcgiinit.c
===================================================================
RCS file: /home/cvs/embperl/epcgiinit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- epcgiinit.c 26 Nov 2002 10:03:40 -0000 1.3
+++ epcgiinit.c 2 Jan 2003 07:39:44 -0000 1.4
@@ -268,6 +268,10 @@
tThreadData * pThread = pApp -> pThread ;
eptTHX_
char * p ;
+ char buf[20] ;
+ char * sHost ;
+ int nPort ;
+ char * scheme ;
pParam -> sFilename = GetHashValueStrDup (aTHX_ pPool, pThread -> pEnvHash,
"PATH_TRANSLATED", "") ;
pParam -> sUnparsedUri = GetHashValueStrDup (aTHX_ pPool, pThread -> pEnvHash,
"REQUEST_URI", "") ;
@@ -293,6 +297,36 @@
embperl_String2HV(pApp, p, ';', pHV) ;
}
+
+
+ buf[0] = '\0' ;
+ nPort = GetHashValueInt (aTHX_ pThread -> pEnvHash, "SERVER_PORT", 80) ;
+ if (GetHashValueStr (aTHX_ pThread -> pEnvHash, "HTTPS", NULL))
+ {
+ scheme = "https" ;
+ if (nPort != 443)
+ sprintf (buf, ":%d", nPort) ;
+ }
+ else
+ {
+ scheme = "http" ;
+ if (nPort != 80)
+ sprintf (buf, ":%d", nPort) ;
+ }
+
+ if (!(sHost = GetHashValueStr (aTHX_ pThread -> pEnvHash, "HTTP_HOST", NULL)))
+ {
+ sHost = GetHashValueStr (aTHX_ pThread -> pEnvHash, "SERVER_NAME", "") ;
+
+ pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ sHost, buf, "//", NULL) ;
+ }
+ else
+ {
+ pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ sHost, "//", NULL) ;
+ }
+
return ok ;
}
1.4 +2 -1 embperl/epdat2.h
Index: epdat2.h
===================================================================
RCS file: /home/cvs/embperl/epdat2.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- epdat2.h 26 Nov 2002 10:03:40 -0000 1.3
+++ epdat2.h 2 Jan 2003 07:39:44 -0000 1.4
@@ -119,6 +119,7 @@
char * sFilename ;
char * sUnparsedUri ;
char * sUri ;
+ char * sServerAddr ; /**< protocol://server:port */
char * sPathInfo ;
char * sQueryInfo ;
char * sLanguage ; /**< Language for the current request */
1.4 +25 -1 embperl/mod_embperl.c
Index: mod_embperl.c
===================================================================
RCS file: /home/cvs/embperl/mod_embperl.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mod_embperl.c 26 Nov 2002 10:03:42 -0000 1.3
+++ mod_embperl.c 2 Jan 2003 07:39:44 -0000 1.4
@@ -924,6 +924,9 @@
epaTHX_
char * p ;
struct addcookie s ;
+ char buf[20] ;
+ char * scheme ;
+
s.pApp = a ;
s.pParam = pParam ;
@@ -944,6 +947,27 @@
}
ap_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie", NULL) ;
+
+ buf[0] = '\0' ;
+#ifdef EAPI
+ if (ap_ctx_get (r -> connection -> client -> ctx, "ssl"))
+ {
+ scheme = "https" ;
+ if (r -> server -> port != 443)
+ sprintf (buf, ":%d", r -> server -> port) ;
+ }
+ else
+#endif
+ {
+ scheme = "http" ;
+ if (r -> server -> port != 80)
+ sprintf (buf, ":%d", r -> server -> port) ;
+ }
+
+
+ pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ r -> hostname?r -> hostname:r -> server -> server_hostname, buf,
"//", NULL) ;
+
return ok ;
}
1.4 +1 -0 embperl/eg/web/base.epl
Index: base.epl
===================================================================
RCS file: /home/cvs/embperl/eg/web/base.epl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- base.epl 26 Nov 2002 10:03:44 -0000 1.3
+++ base.epl 2 Jan 2003 07:39:44 -0000 1.4
@@ -36,6 +36,7 @@
.cPodH1 {[+ $base18 +] padding-left: 15px; padding-right:
15px; background: #fefcad; color: #000000; font-weight: bold; }
.cPodH1Link {[+ $base12 +] padding-left: 15px; padding-right:
15px; background: #fefcad; color: #000000; text-align: right ;}
.cPodH2 {[+ $base14 +] padding-left: 15px; padding-right:
15px; background: #D2E9F5; color: #000000; font-weight: bold; }
+ .cPodH2Link {[+ $base10 +] padding-left: 15px; padding-right:
15px; background: #D2E9F5; color: #000000; font-weight: bold; }
.cTopLink {[+ $base10 +] }
.cListOnlyText {[+ $base12 +] }
1.5 +11 -2 embperl/eg/web/db/epwebapp.pl
Index: epwebapp.pl
===================================================================
RCS file: /home/cvs/embperl/eg/web/db/epwebapp.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- epwebapp.pl 20 Nov 2002 21:29:38 -0000 1.4
+++ epwebapp.pl 2 Jan 2003 07:39:44 -0000 1.5
@@ -3,6 +3,7 @@
use DBIx::Recordset ;
use Data::Dumper ;
use Embperl::Mail ;
+use File::Basename ;
BEGIN { Execute ({isa => '../epwebapp.pl', syntax => 'Perl'}) ; }
@@ -256,8 +257,10 @@
my $usermail = Embperl::Mail::Execute ({
inputfile => 'newuser.mail',
+ from => $r->{config}->{emailfrom},
to => $fdat{user_email},
subject => $r->gettext('mail_subj_newuser'),
+ param => [$user_password],
errors => \@errors_user});
if ($usermail)
{
@@ -271,6 +274,7 @@
my $adminmail = Embperl::Mail::Execute ({
inputfile => 'newuser.admin.mail',
+ from => $r->{config}->{emailfrom},
to => $r->{config}->{adminemail},
subject => ($r->{error} ?
"Error while creating new Embperl website user
'$fdat{user_email}'" :
@@ -292,12 +296,15 @@
my $set = DBIx::Recordset -> Update ({'!DataSource' => $r -> {db},
'!Table' => 'user',
'password' => $user_password,
- 'email' => $fdat{user_email}}) ;
+ 'email' => $fdat{user_email}},
+ {'id' => $user -> {id}}) ;
my $newpw_mail = Embperl::Mail::Execute ({
inputfile => 'newpw.mail',
+ from => $r->{config}->{emailfrom},
to => $fdat{user_email},
subject => $r->gettext('mail_subj_newpw'),
+ param => [$user_password],
errors => \@errors_pw});
if ($newpw_mail)
{
@@ -442,6 +449,7 @@
my @errors;
my $newitemmail = Embperl::Mail::Execute ({
inputfile => 'updateditem.mail',
+ from => $r->{config}->{emailfrom},
to => $r->{config}->{adminemail},
subject => 'New item on Embperl Website (Category
'.$r->{category_set}{category}.')'.($udat{user_email}?" by $udat{user_email}":''),
errors => \@errors});
@@ -540,6 +548,7 @@
$r->{is_update} = 1;
my $newitemmail = Embperl::Mail::Execute ({
inputfile => 'updateditem.mail',
+ from => $r->{config}->{emailfrom},
to => $r->{config}->{adminemail},
subject => 'Updated item on Embperl Website (Category
'.$r->{category_set}{category}.')'.($udat{user_email}?" by $udat{user_email}":''),
errors => \@errors});
@@ -651,7 +660,7 @@
my $dest = join ('&', map { $_ . '=' . $r -> Escape (ref
($params{$_})?join("\t", @{$params{$_}}):$params{$_} , 2) } keys %params) ;
#$http_headers_out{'location'} = "show.epl?$dest";
- Apache -> request -> err_header_out('location', "show.epl?$dest") ;
+ Apache -> request -> err_header_out('location', $r -> server_addr . dirname ($r
-> uri) ."show.epl?$dest") ;
return 301 ;
}
1.3 +7 -6 embperl/eg/web/db/list.epl
Index: list.epl
===================================================================
RCS file: /home/cvs/embperl/eg/web/db/list.epl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- list.epl 20 Nov 2002 06:56:27 -0000 1.2
+++ list.epl 2 Jan 2003 07:39:44 -0000 1.3
@@ -10,7 +10,8 @@
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
-<td class="cPodH1">[+ $r -> {category_set}{category} +] ([= items_of =] [+ $r ->
{user_email} +][+ $r->{user_admin}?"[admin]":'' +])</td>
+<td class="cPodH1">[+ $r -> {category_set}{category} +]<br>
+ ([= items_of =] [+ $r -> {user_email} +][+
$r->{user_admin}?"[admin]":'' +])</td>
<td class="cPodH1Link"><a href="add.epl?category_id=[+ $fdat{category_id} +]">[=
add_item =]</a></td>
</tr>
<tr><td colspan="2" height="5"></td></tr>
@@ -31,15 +32,15 @@
$date = $r -> param -> language eq 'de'?"$3.$2.$1":"$2/$3/$1" ;
-]
-<tr bgcolor="#D2E9F5">
- <td colspan="2" nowrap><font size="2" face="Verdana, Arial, Helvetica,
sans-serif" color="#000000"><b>
+<tr>
+ <td colspan="2" class="cPodH2">
[$ if $cy->{$title_type} =~ /pulldown/ $]
[+ $r->app->get_title($r,$title_type,$rec->{$title_type}) +]
[$ else $]
[+ $rec -> {$title_type} +]
[$ endif $]
- </b></font></td>
- <td align="right" nowrap><font size="1">
+ </td>
+ <td align="right" nowrap class="cPodH2Link">
[
[+ $date +]
[$ if ($r->{user_id} && $r->{user_id} == $rec->{user_id}) || $r->{user_admin}
$]
@@ -51,7 +52,7 @@
|
<a href="#top">Top</a>
]
- </font></td>
+ </td>
</tr>
1.3 +2 -2 embperl/eg/web/db/newpw.mail
Index: newpw.mail
===================================================================
RCS file: /home/cvs/embperl/eg/web/db/newpw.mail,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- newpw.mail 20 Nov 2002 06:56:27 -0000 1.2
+++ newpw.mail 2 Jan 2003 07:39:44 -0000 1.3
@@ -2,10 +2,10 @@
[= mail_pw =]
-[= mail_your_pw_is =] '[+ $fdat{user_password} +]' [= mail_note_quotes =].
+[= mail_your_pw_is =] '[+ $param[0] +]' [= mail_note_quotes =].
[= mail_note_login =]
-http://[+ $ENV{SERVER_NAME} +]:[+ $ENV{SERVER_PORT} +][+ $r->{config}->{basepath}
+]db/login.epl
+http://[+ $ENV{SERVER_NAME} +][#:[+ $ENV{SERVER_PORT} +]#][+
$r->{config}->{baseuri} +]db/login.epl?user_email=[+ do { local $escmode=2;
$fdat{user_email}} +]
[#
DEBUGGING:
1.3 +2 -2 embperl/eg/web/db/newuser.mail
Index: newuser.mail
===================================================================
RCS file: /home/cvs/embperl/eg/web/db/newuser.mail,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- newuser.mail 20 Nov 2002 06:56:27 -0000 1.2
+++ newuser.mail 2 Jan 2003 07:39:44 -0000 1.3
@@ -5,10 +5,10 @@
[= mail_note1 =]
'[+ $fdat{user_email} +]' [= mail_note2 =]
-[= mail_your_pw_is =] '[+ $fdat{user_password} +]' [= mail_note_quotes =].
+[= mail_your_pw_is =] '[+ $param[0] +]' [= mail_note_quotes =].
[= mail_note_login =]
-http://[+ $ENV{SERVER_NAME} +]:[+ $ENV{SERVER_PORT} +][+ $r->{config}->{basepath}
+]db/login.epl
+http://[+ $ENV{SERVER_NAME} +][#:[+ $ENV{SERVER_PORT} +]#][+
$r->{config}->{baseuri} +]db/login.epl?user_email=[+ do { local $escmode=2;
$fdat{user_email}} +]
[#
DEBUGGING:
1.3 +1 -1 embperl/eg/web/db/updateditem.mail
Index: updateditem.mail
===================================================================
RCS file: /home/cvs/embperl/eg/web/db/updateditem.mail,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- updateditem.mail 20 Nov 2002 06:56:27 -0000 1.2
+++ updateditem.mail 2 Jan 2003 07:39:44 -0000 1.3
@@ -6,7 +6,7 @@
[$ else $]
There's a [+ $r->{is_update} ? 'updated' : 'new' +] item on your Embperl Website by
[+ $udat{user_email} || '[Unknown user]' +].
[$ endif $]
-For details see http://[+ $ENV{SERVER_NAME} +]:[+ $ENV{SERVER_PORT} +][+
$r->{config}->{basepath} +]db/add.epl?[+ $r->{category_set}{table_type} +]_id=[+
$fdat{item_id} +]&-edit_item=1&category_id=[+ $fdat{category_id} +]
+For details see http://[+ $ENV{SERVER_NAME} +][#:[+ $ENV{SERVER_PORT} +]#][+
$r->{config}->{baseuri} +]db/add.epl?[+ $r->{category_set}{table_type} +]_id=[+
$fdat{item_id} +]&-edit_item=1&category_id=[+ $fdat{category_id} +]
---- Category "[+ $r->{category_set}{category} +]" ----
1.4 +1 -0 embperl/xsbuilder/maps/ep_structure.map
Index: ep_structure.map
===================================================================
RCS file: /home/cvs/embperl/xsbuilder/maps/ep_structure.map,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ep_structure.map 26 Nov 2002 10:03:45 -0000 1.3
+++ ep_structure.map 2 Jan 2003 07:39:44 -0000 1.4
@@ -243,6 +243,7 @@
sFilename | filename
sUnparsedUri | unparsed_uri
sUri | uri
+ sServerAddr | server_addr
sPathInfo | path_info
sQueryInfo | query_info
sLanguage | language
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]