Branch 'kolab-webadmin-3.1' - 2 commits - lib/api lib/ext lib/kolab_api_service.php lib/kolab_html.php
Aleksander Machniak
machniak at kolabsys.com
Wed Oct 2 15:14:52 CEST 2013
lib/api/kolab_api_service_form_value.php | 17 ++++++++---------
lib/ext/Net/LDAP3.php | 7 ++-----
lib/kolab_api_service.php | 2 +-
lib/kolab_html.php | 2 +-
4 files changed, 12 insertions(+), 16 deletions(-)
New commits:
commit 32d3a28486b96239c0e87cc3d8c9ccb75e86013b
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Oct 2 15:14:32 2013 +0200
Fix various validation inconsistences and empty value checks
Conflicts:
lib/api/kolab_api_service_form_value.php
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index e79c526..7fe315c 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1096,8 +1096,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_alias($value)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1116,15 +1116,11 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
+ return 'OK';
}
private function validate_associateddomain($value)
{
- return $value;
-
- $auth = Auth::get_instance();
- $conf = Conf::get_instance();
-
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1132,7 +1128,6 @@ class kolab_api_service_form_value extends kolab_api_service
//console("form_value.validate_associateddomain(\$value)", $value);
return $value;
-
}
private function validate_astaccountrealmedpassword($value, $postdata)
@@ -1154,8 +1149,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_mail($value)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1173,6 +1168,8 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
}
+
+ return 'OK';
}
private function validate_mailquota($value)
@@ -1191,8 +1188,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_mailalternateaddress($value)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1210,6 +1207,8 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
}
+
+ return 'OK';
}
private function _highest_of_two($one, $two)
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index 6e0ccc6..c81cf6f 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -1234,7 +1234,6 @@ class Net_LDAP3
// Compare each attribute value of the old attrs with the corresponding value
// in the new attrs, if any.
foreach ($old_attrs as $attr => $old_attr_value) {
-
if (is_array($old_attr_value)) {
if (count($old_attr_value) == 1) {
$old_attrs[$attr] = $old_attr_value[0];
@@ -1243,7 +1242,6 @@ class Net_LDAP3
}
if (array_key_exists($attr, $new_attrs)) {
-
if (is_array($new_attrs[$attr])) {
if (count($new_attrs[$attr]) == 1) {
$new_attrs[$attr] = $new_attrs[$attr][0];
@@ -1321,7 +1319,7 @@ class Net_LDAP3
}
} else {
- if (empty($new_attrs[$attr])) {
+ if (!isset($new_attrs[$attr]) || $new_attrs[$attr] === '' || (is_array($new_attrs[$attr]) && empty($new_attrs[$attr]))) {
switch ($attr) {
case "userpassword":
break;
@@ -1354,7 +1352,6 @@ class Net_LDAP3
}
if (array_key_exists($attr, $old_attrs)) {
-
if (is_array($old_attrs[$attr])) {
if (count($old_attrs[$attr]) == 1) {
$old_attrs[$attr] = $old_attrs[$attr][0];
@@ -1371,7 +1368,7 @@ class Net_LDAP3
$_sort2 = false;
}
- if (empty($value)) {
+ if ($value === null || $value === '' || (is_array($value) && empty($value))) {
if (!array_key_exists($attr, $mod_array['del'])) {
switch ($attr) {
case 'userpassword':
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index a154f7d..1cc46c9 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -286,7 +286,7 @@ abstract class kolab_api_service
$special_attr_validate = Array();
foreach ($validate_result as $attr_name => $value) {
- if (!empty($value) && $value !== "OK" && $value !== 0) {
+ if ($value !== false && $value !== '' && $value !== null && $value !== "OK") {
$special_attr_validate[$attr_name] = $value;
}
}
commit 6891db5325215d212fc086cef33e26bec9a40cce
Author: Aleksander Machniak <alec at alec.pl>
Date: Wed Oct 2 14:51:48 2013 +0200
Fix mailquota value formatting (Bug #2309)
diff --git a/lib/kolab_html.php b/lib/kolab_html.php
index d54eabc..8b296f8 100644
--- a/lib/kolab_html.php
+++ b/lib/kolab_html.php
@@ -170,7 +170,7 @@ class kolab_html
$attribs['value'] /= 1024;
$unit = 'mb';
}
- if ($attribs['value'] >= 1024) {
+ if ($attribs['value'] % 1024 == 0 && $attribs['value'] >= 1024) {
$attribs['value'] /= 1024;
$unit = 'gb';
}
More information about the commits
mailing list