git subrepo commit (merge) mailcow/src/mailcow-dockerized

subrepo: subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "c7b1dc37"
upstream: origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "a366494c"
git-subrepo: version:  "0.4.6"
  origin:   "???"
  commit:   "???"
Change-Id: Id574ecd4e02e3c4fbf8a1efd49be11c0b6d19a3f
diff --git a/mailcow/src/mailcow-dockerized/data/web/json_api.php b/mailcow/src/mailcow-dockerized/data/web/json_api.php
index 79b6bfd..b375bc8 100644
--- a/mailcow/src/mailcow-dockerized/data/web/json_api.php
+++ b/mailcow/src/mailcow-dockerized/data/web/json_api.php
@@ -2,9 +2,9 @@
 /*

    see /api

 */

-

-header('Content-Type: application/json');

 require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';

+cors("set_headers");

+header('Content-Type: application/json');

 error_reporting(0);

 

 function api_log($_data) {

@@ -288,6 +288,18 @@
         case "domain-admin":

           process_add_return(domain_admin('add', $attr));

         break;

+        case "sso":

+          switch ($object) {

+            case "domain-admin":

+              $data = domain_admin_sso('issue', $attr);

+              if($data) {

+                echo json_encode($data);

+                exit(0);

+              }

+              process_add_return($data);

+            break;

+          }

+        break;

         case "admin":

           process_add_return(admin('add', $attr));

         break;

@@ -561,6 +573,15 @@
                   echo '{}';

                 }

               break;

+              default:

+                $password_complexity_rules = password_complexity('get');

+                if ($password_complexity_rules !== false) {

+                  process_get_return($password_complexity_rules);

+                }

+                else {

+                  echo '{}';

+                }

+              break;

             }

           break;

 

@@ -1544,14 +1565,15 @@
                   } 

                   else if ($extra == "ip") {

                     // get public ips

+                    

                     $curl = curl_init();

-                    curl_setopt($curl, CURLOPT_URL, 'http://ipv4.mailcow.email');

                     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

                     curl_setopt($curl, CURLOPT_POST, 0);

+                    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);

+                    curl_setopt($curl, CURLOPT_TIMEOUT, 15);

+                    curl_setopt($curl, CURLOPT_URL, 'http://ipv4.mailcow.email');

                     $ipv4 = curl_exec($curl);

                     curl_setopt($curl, CURLOPT_URL, 'http://ipv6.mailcow.email');

-                    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

-                    curl_setopt($curl, CURLOPT_POST, 0);

                     $ipv6 = curl_exec($curl);

                     $ips = array(

                       "ipv4" => $ipv4,

@@ -1845,6 +1867,9 @@
         case "quota_notification_bcc":

           process_edit_return(quota_notification_bcc('edit', $attr));

         break;

+        case "domain-wide-footer":

+          process_edit_return(mailbox('edit', 'domain_wide_footer', $attr));

+        break;

         case "mailq":

           process_edit_return(mailq('edit', array_merge(array('qid' => $items), $attr)));

         break;

@@ -1913,6 +1938,9 @@
         case "ui_texts":

           process_edit_return(customize('edit', 'ui_texts', $attr));

         break;

+        case "ip_check":

+          process_edit_return(customize('edit', 'ip_check', $attr));

+        break;

         case "self":

           if ($_SESSION['mailcow_cc_role'] == "domainadmin") {

             process_edit_return(domain_admin('edit', $attr));

@@ -1921,6 +1949,9 @@
             process_edit_return(edit_user_account($attr));

           }

         break;

+        case "cors":

+          process_edit_return(cors('edit', $attr));

+        break;

         // return no route found if no case is matched

         default:

           http_response_code(404);