[freeside-commits] branch master updated. 37805051fb90d22813cd3f5ad3995f92acdd9a72
Ivan
ivan at 420.am
Mon Jun 4 20:13:24 PDT 2012
The branch, master has been updated
via 37805051fb90d22813cd3f5ad3995f92acdd9a72 (commit)
via ade691aeadc1583d11ae2d09abecbce9fb15ad21 (commit)
from 17b4664d50ba04809cb8b68fa0f3b6146b0c8ff3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 37805051fb90d22813cd3f5ad3995f92acdd9a72
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Jun 4 20:13:23 2012 -0700
add logout timeout, RT#17057
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4e497c1..151e31c 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5077,6 +5077,13 @@ and customer address. Include units.',
'type' => 'checkbox',
},
+ {
+ 'key' => 'logout-timeout',
+ 'section' => 'UI',
+ 'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
+ 'type' => 'text',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html
index d0ab305..c6ad3c3 100644
--- a/httemplate/elements/header.html
+++ b/httemplate/elements/header.html
@@ -42,6 +42,12 @@ Example:
<% include('init_overlib.html') |n %>
<% include('rs_init_object.html') |n %>
<% include('logout.html') |n %>
+% my $timeout = $conf->config('logout-timeout');
+% if ( $timeout && $timeout =~ /^\s*\d+\s*$/ ) {
+ <script type="text/javascript">
+ setTimeout('logout()', <% 60000 * $timeout %>);
+ </script>
+% }
<% $head |n %>
commit ade691aeadc1583d11ae2d09abecbce9fb15ad21
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Jun 4 19:33:24 2012 -0700
add an example php class against selfservice-xmlrpcd with flatten, like ca.inter.net and corecomm
diff --git a/fs_selfservice/php/freeside.class.new.php b/fs_selfservice/php/freeside.class.new.php
new file mode 100644
index 0000000..b9d125e
--- /dev/null
+++ b/fs_selfservice/php/freeside.class.new.php
@@ -0,0 +1,71 @@
+<?php
+
+#pre-php 5.4 compatible version?
+function flatten($hash) {
+ if ( !is_array($hash) ) return $hash;
+ $flat = array();
+
+ array_walk($hash, function($value, $key, &$to) {
+ array_push($to, $key, $value);
+ }, $flat);
+
+ if ( PHP_VERSION_ID >= 50400 ) {
+
+ #php 5.4+ (deb 7+)
+ foreach ($hash as $key => $value) {
+ $flat[] = $key;
+ $flat[] = $value;
+ }
+
+ }
+
+ return($flat);
+}
+
+#php 5.4+?
+#function flatten($hash) {
+# if ( !is_array($hash) ) return $hash;
+#
+# $flat = array();
+#
+# foreach ($hash as $key => $value) {
+# $flat[] = $key;
+# $flat[] = $value;
+# }
+#
+# return($flat);
+#}
+
+class FreesideSelfService {
+
+ //Change this to match the location of your selfservice xmlrpc.cgi or daemon
+ #var $URL = 'https://localhost/selfservice/xmlrpc.cgi';
+ var $URL = 'http://localhost/selfservice/xmlrpc.cgi';
+
+ function FreesideSelfService() {
+ $this;
+ }
+
+ public function __call($name, $arguments) {
+
+ error_log("[FreesideSelfService] $name called, sending to ". $this->URL);
+
+ $request = xmlrpc_encode_request("FS.ClientAPI_XMLRPC.$name", flatten($arguments[0]));
+ $context = stream_context_create( array( 'http' => array(
+ 'method' => "POST",
+ 'header' => "Content-Type: text/xml",
+ 'content' => $request
+ )));
+ $file = file_get_contents($this->URL, false, $context);
+ $response = xmlrpc_decode($file);
+ if (xmlrpc_is_fault($response)) {
+ trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])");
+ } else {
+ //error_log("[FreesideSelfService] $response");
+ return $response;
+ }
+ }
+
+}
+
+?>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 7 +++
fs_selfservice/php/freeside.class.new.php | 71 +++++++++++++++++++++++++++++
httemplate/elements/header.html | 6 +++
3 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 fs_selfservice/php/freeside.class.new.php
More information about the freeside-commits
mailing list