API_USER::api_del PHP Method

api_del() public method

api_del function.
public api_del ( ) : void
return void
    function api_del()
    {
        $this->app_check("post");
        if (!isset($this->appAllow["user"]["del"])) {
            $_arr_return = array("alert" => "x050309");
            $_arr_logTarget[] = array("app_id" => $this->appRequest["app_id"]);
            $_arr_logType = array("user", "del");
            $this->log_do($_arr_logTarget, "app", $_arr_return, $_arr_logType);
            $this->obj_api->halt_re($_arr_return);
        }
        $_arr_userIds = $this->mdl_user->input_ids_api();
        $_arr_sign = array("act_post" => $GLOBALS["act_post"], "user_ids" => $_arr_userIds["str_userIds"]);
        if (!$this->obj_sign->sign_check(array_merge($this->appRequest, $_arr_sign), $this->appRequest["signature"])) {
            $_arr_return = array("alert" => "x050403");
            $this->obj_api->halt_re($_arr_return);
        }
        if (!isset($this->appAllow["user"]["global"])) {
            $_arr_search = array("app_id" => $this->appRequest["app_id"], "user_ids" => $_arr_userIds["user_ids"]);
            $_arr_users = $this->mdl_belong->mdl_list(1000, 0, $_arr_search);
        } else {
            $_arr_users = $_arr_userIds;
        }
        $_arr_userDel = $this->mdl_user->mdl_del($_arr_users);
        if ($_arr_userDel["alert"] == "y010104") {
            foreach ($_arr_userIds["user_ids"] as $_key => $_value) {
                $_arr_targets[] = array("user_id" => $_value);
                $_str_targets = json_encode($_arr_targets);
            }
            $_arr_logData = array("log_targets" => $_str_targets, "log_target_type" => "user", "log_title" => $this->log["user"]["del"], "log_result" => $_str_result, "log_type" => "app");
            $this->mdl_log->mdl_submit($_arr_logData, $this->appRequest["app_id"]);
        }
        $_tm_time = time();
        $_str_src = fn_jsonEncode($_arr_userIds, "encode");
        $_str_code = $this->obj_crypt->encrypt($_str_src, $this->appRow["app_key"]);
        foreach ($this->appRows as $_key => $_value) {
            $_arr_data = array("act_post" => "del", "code" => $this->obj_crypt->encrypt($_str_src, $_value["app_key"]), "time" => $_tm_time, "app_id" => $_value["app_id"], "app_key" => $_value["app_key"]);
            $_arr_data["signature"] = $this->obj_sign->sign_make($_arr_data);
            if (stristr($_value["app_url_notify"], "?")) {
                $_str_conn = "&";
            } else {
                $_str_conn = "?";
            }
            if (stristr($_value["app_url_notify"], "?")) {
                $_str_conn = "&";
            } else {
                $_str_conn = "?";
            }
            fn_http($_value["app_url_notify"] . $_str_conn . "mod=notify", $_arr_data, "post");
        }
        $this->obj_api->halt_re($_arr_userDel);
    }

Usage Example

Example #1
0
     $api_user->api_login();
     break;
 case "edit":
     $api_user->api_edit();
     break;
 case "mailbox":
     $api_user->api_mailbox();
     break;
 case "nomail":
     $api_user->api_nomail();
     break;
 case "forgot":
     $api_user->api_forgot();
     break;
 case "del":
     $api_user->api_del();
     break;
 default:
     switch ($GLOBALS["act_get"]) {
         case "get":
         case "read":
             $api_user->api_read();
             break;
         case "chkname":
         case "check_name":
             $api_user->api_chkname();
             break;
         case "chkmail":
         case "check_mail":
             $api_user->api_chkmail();
             break;