Beispiel #1
0
 /**
  * api_del function.
  *
  * @access public
  * @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);
 }
Beispiel #2
0
 /** 管理员
  * sso_admin function.
  *
  * @access public
  * @param mixed $str_adminName
  * @param mixed $str_adminPass
  * @return void
  */
 function sso_admin($str_adminName, $str_adminPass)
 {
     $_arr_sso = array("act_post" => "admin", "admin_name" => $str_adminName, "admin_pass" => md5($str_adminPass));
     $_arr_ssoData = array_merge($this->arr_data, $_arr_sso);
     //合并数组
     $_arr_get = fn_http(BG_SITE_URL . BG_URL_SSO . "api/api.php?mod=install", $_arr_ssoData, "post");
     //提交
     $_arr_result = $this->result_process($_arr_get);
     if ($_arr_result["alert"] != "y020101") {
         return $_arr_result;
         exit;
     }
     $_arr_ssoData = array("act_post" => "over", "app_name" => "baigo ADS", "app_notice" => BG_SITE_URL . BG_URL_API . "api.php?mod=notice");
     $_arr_get = fn_http(BG_SITE_URL . BG_URL_SSO . "api/api.php?mod=install", $_arr_ssoData, "post");
     //提交
     $_arr_result = $this->result_process($_arr_get);
     if ($_arr_result["alert"] != "y030408") {
         return $_arr_result;
         exit;
     }
     $this->appInstall = array("sso_url" => $_arr_result["sso_url"], "app_id" => $_arr_result["app_id"], "app_key" => $_arr_result["app_key"]);
     $_str_content = "<?php" . PHP_EOL;
     $_str_content .= "define(\"BG_SSO_URL\", \"" . $_arr_result["sso_url"] . "\");" . PHP_EOL;
     $_str_content .= "define(\"BG_SSO_APPID\", " . $_arr_result["app_id"] . ");" . PHP_EOL;
     $_str_content .= "define(\"BG_SSO_APPKEY\", \"" . $_arr_result["app_key"] . "\");" . PHP_EOL;
     $_str_content .= "define(\"BG_SSO_SYNC\", \"on\");" . PHP_EOL;
     $_num_size = file_put_contents(BG_PATH_CONFIG . "opt_sso.inc.php", $_str_content);
     if ($_num_size > 0) {
         $_str_alert = "y060101";
     } else {
         $_str_alert = "x060101";
     }
     $_arr_return = array("alert" => $_str_alert);
     return $_arr_result;
 }
Beispiel #3
0
 /**
  * ajax_notice function.
  *
  * @access public
  * @return void
  */
 function ajax_notice()
 {
     $_num_appId = fn_getSafe(fn_post("app_id_notice"), "int", 0);
     if ($_num_appId == 0) {
         $this->obj_ajax->halt_alert("x050203");
     }
     if (!isset($this->adminLogged["admin_allow"]["app"]["browse"])) {
         $this->obj_ajax->halt_alert("x050301");
     }
     $_arr_appRow = $this->mdl_app->mdl_read($_num_appId);
     if ($_arr_appRow["alert"] != "y050102") {
         $this->obj_ajax->halt_alert($_arr_appRow["alert"]);
     }
     $_tm_time = time();
     $_str_rand = fn_rand();
     $_str_sign = fn_baigoSignMk($_tm_time, $_str_rand);
     $_str_echo = fn_rand();
     $_arr_data = array("act_get" => "test", "time" => $_tm_time, "random" => $_str_rand, "signature" => $_str_sign, "echostr" => $_str_echo, "app_id" => $_arr_appRow["app_id"], "app_key" => $_arr_appRow["app_key"]);
     if (stristr($_arr_appRow["app_notice"], "?")) {
         $_str_conn = "&";
     } else {
         $_str_conn = "?";
     }
     $_arr_notice = fn_http($_arr_appRow["app_notice"] . $_str_conn . "mod=notice", $_arr_data, "get");
     //print_r($_arr_notice);
     //exit;
     if ($_arr_notice["ret"] == $_str_echo) {
         $_str_alert = "y050401";
     } else {
         $_str_alert = "x050401";
         $_arr_targets[] = array("app_id" => $_num_appId);
         $_str_targets = json_encode($_arr_targets);
         $_str_notice = htmlentities($_arr_notice["ret"], ENT_QUOTES, "UTF-8");
         //exit($_str_notice);
         $this->mdl_log->mdl_submit($_str_targets, "app", $this->log["app"]["noticeTest"], $_str_notice, "admin", $this->adminLogged["admin_id"]);
         //exit("test");
     }
     $this->obj_ajax->halt_alert($_str_alert);
 }
Beispiel #4
0
 /**
  * ajax_notify function.
  *
  * @access public
  * @return void
  */
 function ajax_notify()
 {
     $_num_appId = fn_getSafe(fn_post("app_id_notify"), "int", 0);
     if ($_num_appId < 1) {
         $this->obj_ajax->halt_alert("x050203");
     }
     if (!isset($this->adminLogged["admin_allow"]["app"]["browse"]) && !$this->is_super) {
         $this->obj_ajax->halt_alert("x050301");
     }
     $_arr_appRow = $this->mdl_app->mdl_read($_num_appId);
     if ($_arr_appRow["alert"] != "y050102") {
         $this->obj_ajax->halt_alert($_arr_appRow["alert"]);
     }
     $_tm_time = time();
     $_str_echo = fn_rand();
     $_arr_data = array("act_get" => "test", "time" => $_tm_time, "echostr" => $_str_echo, "app_id" => $_arr_appRow["app_id"], "app_key" => $_arr_appRow["app_key"]);
     $_arr_data["signature"] = $this->obj_sign->sign_make($_arr_data);
     if (stristr($_arr_appRow["app_url_notify"], "?")) {
         $_str_conn = "&";
     } else {
         $_str_conn = "?";
     }
     $_arr_notify = fn_http($_arr_appRow["app_url_notify"] . $_str_conn . "mod=notify", $_arr_data, "get");
     if ($_arr_notify["ret"] == $_str_echo) {
         $_str_alert = "y050401";
     } else {
         $_str_alert = "x050401";
         $_arr_targets[] = array("app_id" => $_num_appId);
         $_str_targets = json_encode($_arr_targets);
         $_str_notify = fn_htmlcode($_arr_notify["ret"]);
         //exit($_str_notify);
         $_arr_logData = array("log_targets" => $_str_targets, "log_target_type" => "app", "log_title" => $this->log["app"]["notifyTest"], "log_result" => $_str_notify, "log_type" => "admin");
         $this->mdl_log->mdl_submit($_arr_logData, $this->adminLogged["admin_id"]);
         //exit("test");
     }
     $this->obj_ajax->halt_alert($_str_alert);
 }
Beispiel #5
0
 function ver_process($method = "auto")
 {
     $_arr_data = array("name" => "baigoADS", "ver" => PRD_ADS_VER, "referer" => fn_forward(fn_server("SERVER_NAME") . BG_URL_ROOT), "method" => $method);
     $_str_ver = fn_http(PRD_VER_CHECK, $_arr_data, "get");
     $this->obj_dir->put_file(BG_PATH_CACHE . "sys/latest_ver.json", $_str_ver["ret"]);
 }
Beispiel #6
0
 /** 检查 Email
  * sso_chkmail function.
  *
  * @access public
  * @param mixed $str_userMail Email
  * @param int $num_userId (default: 0) 当前用户ID(默认为0,忽略)
  * @return 解码后数组 检查结果
  */
 function sso_chkmail($str_userMail, $num_userId = 0)
 {
     $_arr_sso = array("act_get" => "check_mail", "user_mail" => $str_userMail, "user_id" => $num_userId);
     $_arr_ssoData = array_merge($this->arr_data, $_arr_sso);
     $_arr_get = fn_http(BG_SSO_URL . "?mod=user", $_arr_ssoData, "get");
     //提交
     $_arr_result = $this->result_process($_arr_get);
     if ($_arr_result["alert"] != "y010211") {
         return $_arr_result;
         //返回错误信息
         exit;
     }
     //$this->sso_decode();
     $_arr_decode["alert"] = $_arr_result["alert"];
     return $_arr_decode;
 }
Beispiel #7
0
 /** 通知
  * api_notice function.
  *
  * @access public
  * @param mixed $arr_data
  * @param mixed $arr_appRows
  * @return void
  */
 function api_notice($arr_data, $arr_appRows, $method = "post")
 {
     foreach ($arr_appRows as $_key => $_value) {
         $_tm_time = time();
         $_str_rand = fn_rand();
         $_str_sign = fn_baigoSignMk($_tm_time, $_str_rand);
         $_arr_query = array("time" => $_tm_time, "random" => $_str_rand, "signature" => $_str_sign, "app_id" => $_value["app_id"], "app_key" => $_value["app_key"]);
         $_arr_data = array_merge($arr_data, $_arr_query);
         if (stristr($_value["app_notice"], "?")) {
             $_str_conn = "&";
         } else {
             $_str_conn = "?";
         }
         $_arr_return[$_key] = fn_http($_value["app_notice"] . $_str_conn . "mod=notice", $_arr_data, $method);
     }
     return $_arr_return;
 }