aboutsummaryrefslogtreecommitdiff
path: root/radicale_infcloud/web/auth/common.inc
diff options
context:
space:
mode:
authorUnrud <unrud@openaliasbox.org>2017-06-04 17:16:11 +0200
committerUnrud <unrud@openaliasbox.org>2017-06-04 17:16:36 +0200
commit10eef51a0f086ad148928ba965c330599b4765cb (patch)
treed0283e55f1b4e66c49bf17461b5fee211b78768a /radicale_infcloud/web/auth/common.inc
parentUpdate license (diff)
downloadradicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.tar.gz
radicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.tar.bz2
radicaleinfcloud-10eef51a0f086ad148928ba965c330599b4765cb.zip
Update package for new web plugin interface
Diffstat (limited to 'radicale_infcloud/web/auth/common.inc')
-rw-r--r--radicale_infcloud/web/auth/common.inc41
1 files changed, 41 insertions, 0 deletions
diff --git a/radicale_infcloud/web/auth/common.inc b/radicale_infcloud/web/auth/common.inc
new file mode 100644
index 0000000..419cefb
--- /dev/null
+++ b/radicale_infcloud/web/auth/common.inc
@@ -0,0 +1,41 @@
+<?php
+ function array_to_xml($array, $skip_top_closing=false, $level=0)
+ {
+ static $result="<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
+
+ foreach($array as $k => $v)
+ {
+ if(is_numeric($k))
+ array_to_xml($v, $skip_top_closing, $level);
+ else
+ {
+ for($j=0; $j<$level; $j++)
+ $result.=" ";
+
+ $result.="<".htmlspecialchars($k);
+ if($k=='resources')
+ $result.=" xmlns=\"urn:com.inf-it:configuration\"";
+ if($v=='')
+ $result.=" />\n";
+ else
+ {
+ $result.=">";
+
+ if(is_array($v))
+ {
+ $result.="\n";
+ array_to_xml($v, $skip_top_closing, $level+1);
+ for($j=0; $j<$level; $j++)
+ $result.=" ";
+ }
+ else
+ $result.=htmlspecialchars($v);
+
+ if($level!==0 || $skip_top_closing===false)
+ $result.="</".htmlspecialchars($k).">\n";
+ }
+ }
+ }
+ return $result;
+ }
+?> \ No newline at end of file
bgstack15