[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [515] trunk/common.pl
- Subject: SF.net SVN: ledger-smb: [515] trunk/common.pl
- From: ..hidden..
- Date: Fri, 10 Nov 2006 21:44:10 -0800
Revision: 515
http://svn.sourceforge.net/ledger-smb/?rev=515&view=rev
Author: einhverfr
Date: 2006-11-10 21:44:08 -0800 (Fri, 10 Nov 2006)
Log Message:
-----------
Adding common.pl
Added Paths:
-----------
trunk/common.pl
Added: trunk/common.pl
===================================================================
--- trunk/common.pl (rev 0)
+++ trunk/common.pl 2006-11-11 05:44:08 UTC (rev 515)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+#
+######################################################################
+# LedgerSMB Accounting and ERP
+
+# http://www.ledgersmb.org/
+#
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission.
+#
+# This file contains source code included with or based on SQL-Ledger which
+# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
+# under the GNU General Public License version 2 or, at your option, any later
+# version. For a full list including contact information of contributors,
+# maintainers, and copyright holders, see the CONTRIBUTORS file.
+#
+#####################################################################
+#
+# Common script handling routines for menu.pl, admin.pl, login.pl
+#
+#####################################################################
+
+use LedgerSMB::Sysconfig;
+
+sub redirect {
+ use List::Util qw(first);
+ my ($script, $argv) = split(/\?/, $form->{callback});
+
+ my @common_attrs = qw(dbh login favicon stylesheet titlebar password);
+
+ $form->error($locale->text("Invalid Redirect"))
+ unless first {$_ eq $script} @{LedgerSMB::Sysconfig::scripts};
+
+ $oldform = $form;
+ require "bin/$script";
+ $form = new Form($argv);
+
+ for (@common_attrs){
+ $form->{$_} = $oldform->{$_};
+ }
+ if (!$myconfig){ # needed for login
+ %myconfig = %{LedgerSMB::User->fetch_config($form->{login})};
+ }
+ if (!$form->{dbh}){
+ $form->db_init(\%myconfig);
+ }
+
+ &{$form->{action}};
+}
+
+1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.