/** * Save the workgroup and redirect the user or display the form with errors * @param array $params the parameters for the request * @return array the vars and template for the form */ public function saveWorkgroup($params) { $openSRS = new openSRS_mail($params["configoption1"], $params["configoption2"], $params["configoption3"], $params["configoption4"], $params["configoption5"]); $success = false; $workgroup = $this->getVar("workgroup"); if (empty($workgroup)) { $this->vars["error"][] = "The name cannot be empty."; } elseif (strlen($workgroup) > 30) { $this->vars["error"][] = "Maximum 30 characters are allowed for workgroup name."; } elseif (!preg_match("/^[a-zA-Z0-9_\\-]+\$/", $workgroup)) { $this->vars["error"][] = "The workgroup name cannot contain space and special characters. (Only allowed Alphnumerics, Hyphen and Underscore.)"; } else { $result = $openSRS->createWorkgroup($params["domain"], $workgroup); if ($result["is_success"]) { $success = true; } else { $this->vars["error"][] = $result["response_text"]; } } if ($success) { header("Location: /clientarea.php?action=productdetails&id=" . $params["serviceid"] . "&modaction=workgroups&added=true"); } else { return $this->addWorkgroup($params); } }
/** * Save the workgroup and redirect the user or display the form with errors * @param array $params the parameters for the request * @return array the vars and template for the form */ public function saveWorkgroup($params) { $openSRS = new openSRS_mail($params["configoption1"], $params["configoption2"], $params["configoption3"], $params["configoption4"], $params["configoption5"]); $success = false; $workgroup = $this->getVar("workgroup"); if (empty($workgroup)) { $this->vars["error"][] = "The name cannot be empty."; } else { $result = $openSRS->createWorkgroup($params["domain"], $workgroup); if ($result["is_success"]) { $success = true; } else { $this->vars["error"][] = $result["response_text"]; } } if ($success) { header("Location: clientarea.php?action=productdetails&id=" . $params["serviceid"] . "&modaction=workgroups&added=true"); } else { return $this->addWorkgroup($params); } }