diff --git a/config.php b/config.php
index 0d18a58..20c4747 100644
--- a/config.php
+++ b/config.php
@@ -12,6 +12,13 @@
// Default password (NOT RECOMMENDED - DANGEROUS)
// $user_pass = 'goodpassword';
+/**
+ * Security settings
+ */
+// Allowed frame ancestors e.g. your cloud URL incl. https:// (if you want to open the script from external sites app)
+// Multiple URLs can be set by separating them with a space
+// $frame_ancestors = 'https://cloud.example.com';
+
/**
* Folder settings
*/
diff --git a/email.php b/email.php
index 23732fc..2b767fd 100644
--- a/email.php
+++ b/email.php
@@ -1,9 +1,11 @@
✔'
: null;
- $percent_used = round($groupfolder['size'] / $groupfolder['quota'] * 100,2);
+ $percent_used = $groupfolder['quota'] == -3
+ ? 'N/A'
+ : round($groupfolder['size'] / $groupfolder['quota'] * 100, 1);
+
+ $color_text = $percent_used === "N/A"
+ ? "style='color: grey;'"
+ : "";
$table_groupfolder_data .= "
".utf8_decode($groupfolder['id'])." |
- ".$groupfolder['mount_point']." |
+ {$groupfolder['mount_point']} |
$groups |
".format_size($groupfolder['size'])." |
- ".round($percent_used, 1)." |
+ $percent_used |
".format_size($groupfolder['quota'])." |
$acl |
$manager |
";
@@ -1142,9 +1147,7 @@ function build_groupfolder_data($array = null) {
foreach($_SESSION['raw_groupfolders_data']['ocs']['data'] as $groupfolder) {
$groups = build_csv_line($groupfolder['groups'], true, ', ');
- $manager = null;
- foreach($groupfolder['manage'] as $item)
- $manager = $item['id'];
+ $manager = build_csv_line($groupfolder['manage'], false, ', ', 'id', 'type');
if(!$array)
$acl = ($groupfolder['acl'])
@@ -1153,7 +1156,7 @@ function build_groupfolder_data($array = null) {
else
$acl = $groupfolder['acl'];
- $percent_used = round(($groupfolder['size'] / $groupfolder['quota'] * 100),1);
+ $percent_used = round($groupfolder['size'] / $groupfolder['quota'] * 100, 1);
$groupfolder_data = [$groupfolder['id'],$groupfolder['mount_point'],
$groups,format_size($groupfolder['size']),$percent_used,
@@ -1180,12 +1183,21 @@ function build_groupfolder_data($array = null) {
* @return $csv_line CSV formatted string
*
*/
-function build_csv_line($array = null, $return_key = false, $delimiter = ',') {
+function build_csv_line($array = null, $return_key = false, $delimiter = ',',
+ $subarray_id = null, $subarray_type = null) {
+
$array = $array ?? $_SESSION['data_choices'];
$i = 0;
foreach($array as $key => $item) {
- if ($return_key)
+
+ if($subarray_id)
+ $item = $subarray_type
+ ? "{$item[$subarray_id]} ({$item[$subarray_type]})"
+ : $item[$subarray_id];
+
+
+ if($return_key)
$csv_line .= ($i === 0)
? $key
: $delimiter.$key;
@@ -1194,8 +1206,10 @@ function build_csv_line($array = null, $return_key = false, $delimiter = ',') {
? $item
: $delimiter.$item;
$i++;
+
}
return $csv_line;
+
}
/**
@@ -1208,10 +1222,12 @@ function build_csv_line($array = null, $return_key = false, $delimiter = ',') {
*
*/
function format_size($size) {
- if ($size === 0)
+ if($size === 0)
return "0 MB";
- if ($size === null)
+ if($size === null)
return '-';
+ if($size == -3)
+ return '∞ GB';
$s = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$e = floor(log($size, 1024));
@@ -1250,3 +1266,22 @@ function random_str(
$pieces []= $keyspace[random_int(0, $max)];
return implode('', $pieces);
}
+
+function set_security_headers() {
+
+ include 'config.php';
+
+ header("X-Content-Type-Options: nosniff");
+ header("Content-Security-Policy: frame-ancestors 'self' $frame_ancestors");
+ header("X-Robots-Tag: none");
+ header("Referrer-Policy: same-origin");
+
+}
+
+function session_secure_start() {
+
+ session_set_cookie_params(
+ '3600', '/', $_SERVER['SERVER_NAME'], isset($_SERVER["HTTPS"]), true);
+ session_start();
+
+}
diff --git a/groupfolders.php b/groupfolders.php
index 2988f02..8acece0 100644
--- a/groupfolders.php
+++ b/groupfolders.php
@@ -1,9 +1,11 @@
";
diff --git a/groupfolders_detail.php b/groupfolders_detail.php
index 64e1d09..af97528 100644
--- a/groupfolders_detail.php
+++ b/groupfolders_detail.php
@@ -1,9 +1,11 @@
";
diff --git a/groups_detail.php b/groups_detail.php
index 9a1ecee..fdec4a2 100644
--- a/groups_detail.php
+++ b/groups_detail.php
@@ -1,9 +1,11 @@
";
?>
diff --git a/statistics.php b/statistics.php
index d3f5ade..bd65b98 100644
--- a/statistics.php
+++ b/statistics.php
@@ -1,9 +1,11 @@
"
diff --git a/users.php b/users.php
index 90425e8..603e19c 100644
--- a/users.php
+++ b/users.php
@@ -1,9 +1,11 @@
'.L10N_CONNECTION_NEEDED);