From f1324d535989205477e37d701c910b12c045687b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Apr 2003 17:55:09 +0000 Subject: mason is more strict about variables - patch from Richard Siddall, thanks --- httemplate/edit/part_export.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 839a114fb..4defbc86f 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -60,7 +60,7 @@ my $widget = new HTML::Widgets::SelectLayers( foreach my $select_option ( @{$optinfo->{options}} ) { #if ( ref($select_option) ) { #} else { - $selected = $select_option eq $value ? ' SELECTED' : ''; + my $selected = $select_option eq $value ? ' SELECTED' : ''; $html .= qq!!; #} -- cgit v1.2.1 From a741f52db660b39a3f3c12acd0623d87bfc9108a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Apr 2003 18:46:52 +0000 Subject: properly deprecate ancient apache & sendmail config options --- FS/FS/Conf.pm | 30 +++++++++++++++--------------- httemplate/config/config-view.cgi | 4 ++-- httemplate/config/config.cgi | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index d0ecf32a6..84b3c26ed 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -228,8 +228,8 @@ httemplate/docs/config.html { 'key' => 'apacheip', - 'section' => 'apache', - 'description' => 'The current IP address to assign to new virtual hosts', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add an apache export instead. Used to be the current IP address to assign to new virtual hosts', 'type' => 'text', }, @@ -242,8 +242,8 @@ httemplate/docs/config.html { 'key' => 'apachemachines', - 'section' => 'apache', - 'description' => 'Your Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf\', which can be included in your Apache configuration via the Include directive.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add an apache export instead. Used to be Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf\', which can be included in your Apache configuration via the Include directive.', 'type' => 'textarea', }, @@ -382,8 +382,8 @@ httemplate/docs/config.html { 'key' => 'erpcdmachines', - 'section' => '', - 'description' => 'Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, ERPCD is no longer supported. Used to be ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd\' and `/usr/annex/acp_dialup\'', 'type' => 'textarea', }, @@ -418,21 +418,21 @@ httemplate/docs/config.html { 'key' => 'icradius_mysqldest', 'section' => 'deprecated', - 'description' => 'DEPRECATED, add an sqlradius https://billing.crosswind.net/freeside/browse/part_export.cgi">export instead. Used to be the destination directory for the MySQL databases, on the ICRADIUS/FreeRADIUS machines. Defaults to "/usr/local/var/".', + 'description' => 'DEPRECATED, add an sqlradius export instead. Used to be the destination directory for the MySQL databases, on the ICRADIUS/FreeRADIUS machines. Defaults to "/usr/local/var/".', 'type' => 'text', }, { 'key' => 'icradius_mysqlsource', 'section' => 'deprecated', - 'description' => 'DEPRECATED, add an sqlradius https://billing.crosswind.net/freeside/browse/part_export.cgi">export instead. Used to be the source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside".', + 'description' => 'DEPRECATED, add an sqlradius export instead. Used to be the source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside".', 'type' => 'text', }, { 'key' => 'icradius_secrets', 'section' => 'deprecated', - 'description' => 'DEPRECATED, add an sqlradius https://billing.crosswind.net/freeside/browse/part_export.cgi">export instead. This option used to specify a database for ICRADIUS/FreeRADIUS export. Three lines: DBI data source, username and password.', + 'description' => 'DEPRECATED, add an sqlradius export instead. This option used to specify a database for ICRADIUS/FreeRADIUS export. Three lines: DBI data source, username and password.', 'type' => 'textarea', }, @@ -576,22 +576,22 @@ httemplate/docs/config.html { 'key' => 'sendmailconfigpath', - 'section' => 'mail', - 'description' => 'Sendmail configuration file path. Defaults to `/etc\'. Many newer distributions use `/etc/mail\'.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add a sendmail export instead. Used to be sendmail configuration file path. Defaults to `/etc\'. Many newer distributions use `/etc/mail\'.', 'type' => 'text', }, { 'key' => 'sendmailmachines', - 'section' => 'mail', - 'description' => 'Your sendmail machines, one per line. This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add a sendmail export instead. Used to be sendmail machines, one per line. This enables export of `/etc/virtusertable\' and `/etc/sendmail.cw\'.', 'type' => 'textarea', }, { 'key' => 'sendmailrestart', - 'section' => 'mail', - 'description' => 'If defined, the command which is run on sendmail machines after files are copied.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, add a sendmail export instead. Used to define the command which is run on sendmail machines after files are copied.', 'type' => 'text', }, diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index bafe5a8e7..9a0006792 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -5,13 +5,13 @@ <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> <% foreach my $section ( qw(required billing username password UI session - shell mail apache BIND + shell BIND ), '', 'deprecated') { %> <% foreach my $nav_section ( qw(required billing username password UI session - shell mail apache BIND + shell BIND ), '', 'deprecated') { %> <% if ( $section eq $nav_section ) { %> diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index fd9a82958..409869e11 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -25,13 +25,13 @@ function SafeOnsubmit() {
<% foreach my $section ( qw(required billing username password UI session - shell mail apache BIND + shell BIND ), '', 'deprecated') { %> <% foreach my $nav_section ( qw(required billing username password UI session - shell mail apache BIND + shell BIND ), '', 'deprecated') { %> <% if ( $section eq $nav_section ) { %> -- cgit v1.2.1 From 970a86aec45df2ab579ac54fc67cba475c7c013b Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 23 Apr 2003 04:53:17 +0000 Subject: DBD::Pg doesn't handle char types very well. --- FS/bin/freeside-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 8ec014186..518a2ad42 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -471,7 +471,7 @@ sub tables_hash_hack { 'last', 'varchar', '', $char_d, # 'middle', 'varchar', 'NULL', $char_d, 'first', 'varchar', '', $char_d, - 'ss', 'char', 'NULL', 11, + 'ss', 'varchar', 'NULL', 11, 'company', 'varchar', 'NULL', $char_d, 'address1', 'varchar', '', $char_d, 'address2', 'varchar', 'NULL', $char_d, @@ -823,7 +823,7 @@ sub tables_hash_hack { #'reczone', 'varchar', '', $char_d, 'reczone', 'varchar', '', 255, 'recaf', 'char', '', 2, - 'rectype', 'char', '', 5, + 'rectype', 'varchar', '', 5, #'recdata', 'varchar', '', $char_d, 'recdata', 'varchar', '', 255, ], -- cgit v1.2.1 From f3b99e9676baf155c46d37d56a5da4db57536072 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 23 Apr 2003 05:36:24 +0000 Subject: Missing comma. --- httemplate/search/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index fe4ec5d05..5b39a09f2 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -469,7 +469,7 @@ sub cardsearch { $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n"; my($payinfo)=$1; - [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}) + [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}), qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'DCRD'}) ]; } -- cgit v1.2.1 From 40dfd062e7bf133824287d432812b51c6ea3456a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Apr 2003 22:16:55 +0000 Subject: might not be necessary, but to be safe... --- FS/FS/part_export.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index f99dc6341..a6a67d2db 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -885,7 +885,7 @@ tie my %forward_shellcommands_options, 'Tie::IxHash', 'sqlmail' => { 'desc' => 'Real-time export to SQL-backed mail server', 'options' => \%sqlmail_options, - 'nodomain' => 'N', + 'nodomain' => '', 'notes' => 'Database schema can be made to work with Courier IMAP and Exim. Others could work but are untested. (...extended description from pc-intouch?...)', }, -- cgit v1.2.1 From 344596452274c17c2c60bf2b002c9358cbd510a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Apr 2003 23:12:57 +0000 Subject: compatible with mason 1.1! closes: bug#492 --- Makefile | 5 ++ htetc/handler.pl | 27 +++++--- htetc/handler.pl-1.0x | 161 +++++++++++++++++++++++++++++++++++++++++++ httemplate/docs/install.html | 9 ++- 4 files changed, 186 insertions(+), 16 deletions(-) create mode 100644 htetc/handler.pl-1.0x diff --git a/Makefile b/Makefile index 3362ca832..92f82067b 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ TEMPLATE = asp #TEMPLATE = mason ASP_GLOBAL = /usr/local/etc/freeside/asp-global +MASON_HANDLER = /usr/local/etc/freeside/handler.pl +MASONDATA = /usr/local/etc/freeside/masondata #deb, others? FREESIDE_DOCUMENT_ROOT = /var/www/freeside @@ -115,6 +117,9 @@ install-docs: docs [ "${TEMPLATE}" = "asp" -a ! -e ${ASP_GLOBAL} ] && mkdir ${ASP_GLOBAL} || true [ "${TEMPLATE}" = "asp" ] && chown -R freeside ${ASP_GLOBAL} || true [ "${TEMPLATE}" = "asp" ] && cp htetc/global.asa ${ASP_GLOBAL} || true + [ "${TEMPLATE}" = "mason" ] && cp htetc/handler.pl ${MASON_HANDLER} || true + [ "${TEMPLATE}" = "mason" -a ! -e ${MASONDATA} ] && mkdir ${MASONDATA} || true + [ "${TEMPLATE}" = "mason" ] && chown -R freeside ${MASONDATA} || true perl-modules: cd FS; \ diff --git a/htetc/handler.pl b/htetc/handler.pl index 768ebffec..9f2a483c2 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -28,20 +28,25 @@ use strict; # Create Mason objects # -my $parser = new HTML::Mason::Parser; -my $interp = new HTML::Mason::Interp (parser=>$parser, - comp_root=>'/var/www/masondocs', - data_dir=>'/home/ivan/freeside_current/masondata', - out_mode=>'stream', - ); -my $ah = new HTML::Mason::ApacheHandler ( interp => $interp, - #auto_send_headers => 0, - ); + +#my $parser = new HTML::Mason::Parser; +#my $interp = new HTML::Mason::Interp (parser=>$parser, +# comp_root=>'/var/www/masondocs', +# data_dir=>'/usr/local/etc/freeside/masondata', +# out_mode=>'stream', +# ); +my $ah = new HTML::Mason::ApacheHandler ( + #interp => $interp, + #auto_send_headers => 0, + comp_root=>'/var/www/masonside', + data_dir=>'/usr/local/etc/freeside/masondata', + #out_mode=>'stream', +); # Activate the following if running httpd as root (the normal case). # Resets ownership of all files created by Mason at startup. # -chown (Apache->server->uid, Apache->server->gid, $interp->files_written); +#chown (Apache->server->uid, Apache->server->gid, $interp->files_written); sub handler { @@ -121,7 +126,7 @@ sub handler *CGI::redirect = sub { my( $self, $location ) = @_; - + use vars qw($m); #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect $m->clear_buffer; # The next two lines are necessary to stop Apache from re-reading diff --git a/htetc/handler.pl-1.0x b/htetc/handler.pl-1.0x new file mode 100644 index 000000000..768ebffec --- /dev/null +++ b/htetc/handler.pl-1.0x @@ -0,0 +1,161 @@ +#!/usr/bin/perl +# +# This is a basic, fairly fuctional Mason handler.pl. +# +# For something a little more involved, check out session_handler.pl + +package HTML::Mason; + +# Bring in main Mason package. +use HTML::Mason; + +# Bring in ApacheHandler, necessary for mod_perl integration. +# Uncomment the second line (and comment the first) to use +# Apache::Request instead of CGI.pm to parse arguments. +use HTML::Mason::ApacheHandler; +# use HTML::Mason::ApacheHandler (args_method=>'mod_perl'); + +# Uncomment the next line if you plan to use the Mason previewer. +#use HTML::Mason::Preview; + +use strict; + +# List of modules that you want to use from components (see Admin +# manual for details) +#{ package HTML::Mason::Commands; +# use CGI; +#} + +# Create Mason objects +# +my $parser = new HTML::Mason::Parser; +my $interp = new HTML::Mason::Interp (parser=>$parser, + comp_root=>'/var/www/masondocs', + data_dir=>'/home/ivan/freeside_current/masondata', + out_mode=>'stream', + ); +my $ah = new HTML::Mason::ApacheHandler ( interp => $interp, + #auto_send_headers => 0, + ); + +# Activate the following if running httpd as root (the normal case). +# Resets ownership of all files created by Mason at startup. +# +chown (Apache->server->uid, Apache->server->gid, $interp->files_written); + +sub handler +{ + my ($r) = @_; + + # If you plan to intermix images in the same directory as + # components, activate the following to prevent Mason from + # evaluating image files as components. + # + #return -1 if $r->content_type && $r->content_type !~ m|^text/|i; + + #rar + { package HTML::Mason::Commands; + use strict; + use vars qw( $cgi $p ); + use CGI; + #use CGI::Carp qw(fatalsToBrowser); + use Date::Format; + use Date::Parse; + use Time::Local; + use Tie::IxHash; + use HTML::Entities; + use IO::Handle; + use IO::File; + use String::Approx qw(amatch); + use Chart::LinesPoints; + use HTML::Widgets::SelectLayers 0.02; + use FS::UID qw(cgisuidsetup dbh getotaker datasrc driver_name); + use FS::Record qw(qsearch qsearchs fields dbdef); + use FS::Conf; + use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot + small_custview myexit http_header); + use FS::Msgcat qw(gettext geterror); + + use FS::agent; + use FS::agent_type; + use FS::domain_record; + use FS::cust_bill; + use FS::cust_bill_pay; + use FS::cust_credit; + use FS::cust_credit_bill; + use FS::cust_main; + use FS::cust_main_county; + use FS::cust_pay; + use FS::cust_pkg; + use FS::cust_refund; + use FS::cust_svc; + use FS::nas; + use FS::part_bill_event; + use FS::part_pkg; + use FS::part_referral; + use FS::part_svc; + use FS::part_svc_router; + use FS::pkg_svc; + use FS::port; + use FS::queue qw(joblisting); + use FS::raddb; + use FS::session; + use FS::svc_acct; + use FS::svc_acct_pop qw(popselector); + use FS::svc_acct_sm; + use FS::svc_domain; + use FS::svc_forward; + use FS::svc_www; + use FS::router; + use FS::part_router_field; + use FS::router_field; + use FS::addr_block; + use FS::part_sb_field; + use FS::sb_field; + use FS::svc_broadband; + use FS::type_pkgs; + use FS::part_export; + use FS::part_export_option; + use FS::export_svc; + use FS::msgcat; + + *CGI::redirect = sub { + my( $self, $location ) = @_; + + #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect + $m->clear_buffer; + # The next two lines are necessary to stop Apache from re-reading + # POSTed data. + $r->method('GET'); + $r->headers_in->unset('Content-length'); + $r->content_type('text/html'); + #$r->err_header_out('Location' => $location); + $r->header_out('Location' => $location); + $r->header_out('Content-Type' => 'text/html'); + $m->abort(302); + + ''; + }; + + $cgi = new CGI; + &cgisuidsetup($cgi); + #&cgisuidsetup($r); + $p = popurl(2); + } + + $r->content_type('text/html'); + #eorar + + my $headers = $r->headers_out; + $headers->{'Pragma'} = $headers->{'Cache-control'} = 'no-cache'; + #$r->no_cache(1); + $headers->{'Expires'} = '0'; + +# $r->send_http_header; + + my $status = $ah->handle_request($r); + + $status; +} + +1; diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index ed419a1ca..533decb7b 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -47,7 +47,7 @@ Before installing, you need:
  • Net-SSH
  • String-ShellQuote
  • Net-SCP -
  • Apache::ASP or HTML::Mason (use version 1.0x - Freeside is not yet compatible with version 1.1x) +
  • Apache::ASP or HTML::Mason
  • Tie-IxHash
  • Time-Duration
  • HTML-Widgets-SelectLayers @@ -143,11 +143,10 @@ PerlSetVar Debug 2
      -
    • (use version 1.0x - Freeside is not yet compatible with version 1.1x)
    • Run make masondocs
    • Copy masondocs/ to your web server's document space. -
    • Copy htetc/handler.pl to your web server's configuration directory. -
    • Edit handler.pl and set an appropriate data_dir, such as /usr/local/etc/freeside/mason-data +
    • Copy htetc/handler.pl to an appropriate directory (use htetc/handler.pl-1.0x for Mason versions before 1.10). +
    • Edit handler.pl and set an appropriate data_dir, such as /usr/local/etc/freeside/masondata
    • Configure Apache to use the handler.pl file and to execute .cgi files using HTML::Mason. For example:
       PerlModule HTML::Mason
      @@ -157,7 +156,7 @@ AddHandler perl-script .cgi
       PerlHandler HTML::Mason
       </Files>
       <Perl>
      -require "/usr/local/apache/conf/handler.pl";
      +require "/usr/local/etc/freeside/handler.pl";
       </Perl>
       </Directory>
       
      -- cgit v1.2.1