msg["no_configuration_required"]; return $result; } function update_config_from_form() { return; } function instantiate_source_class($source_id) { return new apijsonrpc_source($this, $source_id, $this->msg); } //On chargera nous même les messages si on en a besoin function need_global_messages() { return false; } function process($source_id, $pmb_user_id) { global $base_path; $apijsonrpc_jsonrpcserver = new apijsonrpc_jsonrpcserver($this); $apijsonrpc_jsonrpcserver->process($source_id, $pmb_user_id, $this->json_input); //Rien return; } function return_json_error($message, $request) { $response = array ( 'id' => $request['id'], 'result' => NULL, 'error' => $message ); // output the response if (!empty($request['id'])) { // notifications don't want response header('content-type: text/javascript'); echo json_encode($response); } die(); } function get_running_pmb_userid($source_id) { $user_id = 1; $this->json_input = json_decode(file_get_contents('php://input'),true); if (!$this->json_input) return 1; $credentials_user = ''; $credentials_password = ''; if (isset($this->json_input["auth_user"])) { $credentials_user = $this->json_input["auth_user"]; $credentials_password = isset($this->json_input["auth_pw"]) ? $this->json_input["auth_pw"] : ''; } if (isset($_SERVER['PHP_AUTH_USER'])) { $credentials_user = $_SERVER['PHP_AUTH_USER']; $credentials_password = $_SERVER['PHP_AUTH_PW']; } if (!$credentials_user) { //Si on ne nous fourni pas de credentials, alors on teste l'utilisateur anonyme $user_id = connector_out_check_credentials('', '', $source_id); if ($user_id === false) { $this->return_json_error('Access with no credentials is forbidden.', $this->json_input); } } else { $user_id = connector_out_check_credentials($credentials_user, $credentials_password, $source_id); if ($user_id === false) { $this->return_json_error('Bad credentials.', $this->json_input); } } return $user_id; } } class apijsonrpc_source extends connecteur_out_source { function get_config_form() { global $charset; $result = parent::get_config_form(); $api_catalog = new es_catalog(); $api_functions = array(); foreach ($api_catalog->groups as $agroup) { foreach ($agroup->methods as $amethod) { $api_functions[$agroup->name][] = $amethod->name; } } if (!isset($this->config["exported_functions"])) $this->config["exported_functions"] = array(); $selected_functions = array(); foreach ($this->config["exported_functions"] as $afunction) { $selected_functions[] = $afunction["group"]."|_|".$afunction["name"]; } //Adresse d'utilisation global $database; $result .= '