$admit_bed = CValue::request("admit_bed"); $admit_attending_doctor = CValue::request("admit_attending_doctor"); $admit_referring_doctor = CValue::request("admit_referring_doctor"); $admit_consulting_doctor = CValue::request("admit_consulting_doctor"); $admit_admitting_doctor = CValue::request("admit_admitting_doctor"); $admit_id_number = CValue::request("admit_id_number"); $admit_namespace_id = CValue::request("admit_namespace_id"); $admit_universal_id = CValue::request("admit_universal_id"); $admit_universal_id_type = CValue::request("admit_universal_id_type"); $admit_identifier_type_code = CValue::request("admit_identifier_type_code"); $continue = CValue::request("continue"); $cancel = CValue::request("cancel"); $domains_returned_namespace_id = CValue::request("domains_returned_namespace_id"); $domains_returned_universal_id = CValue::request("domains_returned_universal_id"); $domains_returned_universal_id_type = CValue::request("domains_returned_universal_id_type"); $quantity_limited_request = CValue::request("quantity_limited_request", "1"); $patient_naissance = null; if ($patient_year || $patient_month || $patient_day) { $patient_naissance = "on"; } $naissance = null; if ($patient_naissance == "on") { $year = $patient_year ? "{$patient_year}-" : "____-"; $month = $patient_month ? "{$patient_month}-" : "__-"; $day = $patient_day ? "{$patient_day}" : "__"; if ($day != "__") { $day = str_pad($day, 2, "0", STR_PAD_LEFT); } $naissance = $year . $month . $day; } $patient = new CPatient();
<?php /** * Import CExchangeDataFormatConfig * * @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $actor_guid = CValue::request("actor_guid"); $format_config_guid = CValue::request("format_config_guid"); $file = isset($_FILES['import']) ? $_FILES['import'] : null; if (!empty($file) && ($contents = file_get_contents($file['tmp_name']))) { $actor = CMbObject::loadFromGuid($actor_guid); $format_config = CMbObject::loadFromGuid($format_config_guid); if (!$format_config->sender_class || !$format_config->sender_id) { $format_config->sender_class = $actor->_class; $format_config->sender_id = $actor->_id; } $dom = new CMbXMLDocument(); $dom->loadXML($contents); $root_name = $dom->documentElement->nodeName; $fields = $format_config->getPlainFields(); unset($fields[$format_config->_spec->key]); unset($fields["sender_id"]); unset($fields["sender_class"]); if ($root_name == $format_config->_class) {
<?php /** * dPccam * * @category Ccam * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:\$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $keywords = CValue::request("_codes_ccam", "%%"); $date = CMbDT::date(null, CValue::request("date", CMbDT::date())); $codes = array(); $code = new CDatedCodeCCAM(); foreach ($code->findCodes($keywords, $keywords) as $_code) { $_code_value = $_code["CODE"]; $code = CDatedCodeCCAM::get($_code_value, $date); if ($code->code != "-") { $codes[$_code_value] = $code; } } // Création du template $smarty = new CSmartyDP(); $smarty->debugging = false; $smarty->assign("keywords", $keywords); $smarty->assign("codes", $codes); $smarty->assign("nodebug", true); $smarty->display("httpreq_do_ccam_autocomplete.tpl");
/** * Login function, handling standard login, loginas, LDAP connection * Preferences get loaded on success * * @param bool $force_login To allow admin users to login as someone else * * @return boolean Job done */ static function login($force_login = false) { $ldap_connection = CAppUI::conf("admin LDAP ldap_connection"); $allow_login_as_ldap = CAppUI::conf("admin LDAP allow_login_as_admin"); // Login as $loginas = trim(CValue::request("loginas")); $passwordas = trim(CValue::request("passwordas")); // LDAP $ldap_guid = trim(CValue::get("ldap_guid")); // Standard login $username = trim(CValue::request("username")); $password = trim(CValue::request("password")); // Token sign-in $token_hash = trim(CValue::request("token")); // Test login and password validity $user = new CUser(); $user->_is_logging = true; // -------------- Login as: no need to provide a password for administrators if ($loginas) { if (self::$instance->user_type != 1 && !$force_login) { self::setMsg("Auth-failed-loginas-admin", UI_MSG_ERROR); return false; } $username = $loginas; $password = $ldap_connection ? $passwordas : null; if (self::$instance->user_type == 1 && $allow_login_as_ldap) { $password = null; } $user->user_username = $username; $user->_user_password = $password; } elseif ($ldap_connection && $ldap_guid) { try { $user = CLDAP::getFromLDAPGuid($ldap_guid); } catch (Exception $e) { self::setMsg($e->getMessage(), UI_MSG_ERROR); return false; } } elseif ($token_hash) { $token = CViewAccessToken::getByHash($token_hash); if (!$token->isValid()) { self::setMsg("Auth-failed-invalidToken", UI_MSG_ERROR); return false; } $token->useIt(); $token->applyParams(); $user->load($token->user_id); self::$instance->auth_method = "token"; } elseif (self::$auth_info && self::$auth_info->user_id) { $auth = self::$auth_info; $user->load($auth->user_id); self::$instance->auth_method = $auth->auth_method; } else { if (!$username) { self::setMsg("Auth-failed-nousername", UI_MSG_ERROR); return false; } if (!$password) { self::setMsg("Auth-failed-nopassword", UI_MSG_ERROR); return false; } $user->user_username = $username; $user->_user_password = $password; self::$instance->weak_password = self::checkPasswordWeakness($user); } if (!$user->_id) { $user->loadMatchingObject(); self::$instance->auth_method = "basic"; } // User template case if ($user->template) { self::setMsg("Auth-failed-template", UI_MSG_ERROR); return false; } // LDAP case (when not using a ldap_guid), we check is the user in the LDAP directory is still allowed // TODO we shoud check it when using ldap_guid too if ($ldap_connection && $username) { $user_ldap = new CUser(); $user_ldap->user_username = $username; $user_ldap->loadMatchingObject(); $idex = $user_ldap->loadLastId400(CAppUI::conf("admin LDAP ldap_tag")); // The user in linked to the LDAP if ($idex->_id) { $ldap_guid = $idex->id400; $user_ldap->_user_password = $password; $user_ldap->_bound = false; try { $user = CLDAP::login($user_ldap, $ldap_guid); if (!$user->_bound) { self::setMsg("Auth-failed-combination", UI_MSG_ERROR); return false; } } catch (CMbInvalidCredentialsException $e) { self::setMsg($e->getMessage(), UI_MSG_WARNING); return false; } catch (CMbException $e) { // No UI_MSG_ERROR nor $e->stepAjax as it needs to run through! self::setMsg($e->getMessage(), UI_MSG_WARNING); } } } if (!$user->_bound && !self::checkPasswordAttempt($user)) { return false; } $user->user_login_errors = 0; $user->store(); // Put user_group in AppUI self::$instance->user_remote = 1; $ds = CSQLDataSource::get("std"); // We get the user's group if the Mediusers module is installed if ($ds->loadTable("users_mediboard") && $ds->loadTable("groups_mediboard")) { $sql = "SELECT `remote` FROM `users_mediboard` WHERE `user_id` = '{$user->_id}'"; self::$instance->user_remote = $ds->loadResult($sql); $sql = "SELECT `groups_mediboard`.`group_id`\n FROM `groups_mediboard`, `functions_mediboard`, `users_mediboard`\n WHERE `groups_mediboard`.`group_id` = `functions_mediboard`.`group_id`\n AND `functions_mediboard`.`function_id` = `users_mediboard`.`function_id`\n AND `users_mediboard`.`user_id` = '{$user->_id}'"; self::$instance->user_group = $ds->loadResult($sql); } // Test if remote connection is allowed // Get the client and the proxy IP $adress = get_remote_address(); self::$instance->ip = $adress["client"]; self::$instance->proxy = $adress["proxy"]; self::$instance->_is_intranet = is_intranet_ip(self::$instance->ip) && self::$instance->ip != self::conf("system reverse_proxy"); if (!self::$instance->_is_intranet && self::$instance->user_remote == 1 && $user->user_type != 1) { self::setMsg("Auth-failed-user-noremoteaccess", UI_MSG_ERROR); return false; } self::$instance->user_id = $user->_id; // save the last_login dateTime CUserAuthentication::logAuth($user); // <DEPRECATED> self::$instance->user_first_name = $user->user_first_name; self::$instance->user_last_name = $user->user_last_name; self::$instance->user_email = $user->user_email; self::$instance->user_type = $user->user_type; self::$instance->user_last_login = $user->getLastLogin(); // </DEPRECATED> // load the user preferences self::buildPrefs(); return true; }
/** * Select merge fields EAI * * @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CApp::setTimeLimit(240); CApp::setMemoryLimit("512M"); CCanDo::checkAdmin(); $d1_id = CValue::request("domain_1_id"); $d2_id = CValue::request("domain_2_id"); $idex_ids = CValue::request("idex_ids", array()); /* Traitement prélable pour passer en "trash" les idexs en erreurs */ foreach ($idex_ids as $_idex => $idex_id) { $idex = new CIdSante400(); $idex->load($idex_id); $idex->tag = "trash_{$idex->tag}"; $idex->store(); } /* checkMerge */ $domains_id = array($d1_id, $d2_id); $domains = array(); $checkMerge = array(); if (count($domains_id) != 2) { $checkMerge[] = CAppUI::tr("mergeTooFewObjects"); } foreach ($domains_id as $domain_id) {
/** * Enforce the current view to be rerouted on a slave SQL server if slave datasource is available * * @return void */ static function enforceSlave() { // Enslaved views are supposably session stallers so close session preventively CSessionHandler::writeClose(); // URL param enslave prevention if (CValue::request("enslave") === "0") { return; } // Test wether a slave datasource has been configured if (!CAppUI::conf("db slave dbhost")) { return; } // Check connection to the slave datasource or abandon std datasource rerouting if (!CSQLDataSource::get("slave", true)) { return; } self::$enslaved = true; self::$slavestate = true; self::rerouteStdDS(); }
<?php /** * $Id$ * * @package Mediboard * @subpackage patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCanDo::check(); $needle = CValue::request('_search_constants', 0); $list_constantes = CConstantesMedicales::$list_constantes; $results = array(); if ($needle) { foreach ($list_constantes as $_constant => $params) { if (strpos($_constant, 'cumul') !== false) { continue; } $search_elements = array(); $search_elements[] = CMbString::removeDiacritics(strtolower($_constant)); $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}"))); $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}-court"))); $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}-desc"))); if (strpos(implode('|', $search_elements), $needle) !== false) { $results[] = $_constant; } } }
$index = $info; $info = 1; } // Output the charset header in case of an ajax request if ($ajax = CValue::request("ajax")) { $suppressHeaders = 1; $index = $ajax; $ajax = 1; } // Raw output for export purposes if ($raw = CValue::request("raw")) { $suppressHeaders = 1; $index = $raw; } // Check if we are in the dialog mode if ($dialog = CValue::request("dialog")) { $index = $dialog; $dialog = 1; } CAppUI::$dialog =& $dialog; // clear out main url parameters $m = $a = $u = $g = ""; CMbPerformance::mark("input"); // Locale require __DIR__ . "/locales/core.php"; if (empty($locale_info["names"])) { $locale_info["names"] = array(); } setlocale(LC_TIME, $locale_info["names"]); if (empty($locale_info["charset"])) { $locale_info["charset"] = "UTF-8";
<?php /** * $Id$ * * @package Mediboard * @subpackage System * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkAdmin(); $object_config_guid = CValue::request("object_config_guid"); $file = isset($_FILES['import']) ? $_FILES['import'] : null; if (!empty($file) && ($contents = file_get_contents($file['tmp_name']))) { $object_config = CMbObject::loadFromGuid($object_config_guid); $object = $object_config->loadRefObject(); $dom = new CMbXMLDocument(); $dom->loadXML($contents); $root_name = $dom->documentElement->nodeName; $fields = $object_config->getPlainFields(); unset($fields[$object_config->_spec->key]); unset($fields["object_id"]); if ($root_name == $object_config->_class) { $xpath = new CMbXPath($dom); $nodeList = $xpath->query("//{$root_name}/*"); $array_configs = array(); foreach ($nodeList as $_node) { $config = $xpath->getValueAttributNode($_node, "config"); $value = $xpath->getValueAttributNode($_node, "value"); $array_configs[$config] = $value;
* @category SIP * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id: ajax_refresh_exchange.php 15880 2012-06-15 08:14:36Z phenxdesign $ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $person_id_number = CValue::request("person_id_number"); $person_namespace_id = CValue::request("person_namespace_id"); $person_universal_id = CValue::request("person_universal_id"); $person_universal_id_type = CValue::request("person_universal_id_type"); $person_identifier_type_code = CValue::request("person_identifier_type_code"); $domains_returned_namespace_id = CValue::request("domains_returned_namespace_id"); $domains_returned_universal_id = CValue::request("domains_returned_universal_id"); $domains_returned_universal_id_type = CValue::request("domains_returned_universal_id_type"); $cn_receiver_guid = CValue::sessionAbs("cn_receiver_guid"); /** @var CReceiverHL7v2 $receiver_hl7v2 */ if ($cn_receiver_guid) { $receiver_hl7v2 = CStoredObject::loadFromGuid($cn_receiver_guid); } else { $receiver_hl7v2 = new CReceiverHL7v2(); $receiver_hl7v2->actif = 1; $receiver_hl7v2->group_id = CGroups::loadCurrent()->_id; $receiver_hl7v2->loadObject(); } if (!$receiver_hl7v2 || !$receiver_hl7v2->_id) { CAppUI::stepAjax("No receiver", UI_MSG_WARNING); return; } CAppUI::stepAjax("From: " . $receiver_hl7v2->nom);
* @category Webservices * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ global $m, $a; CCanDo::checkRead(); // première étape : désactiver le cache lors de la phase de test ini_set("soap.wsdl_cache_enabled", "0"); $wsdl = CValue::get('wsdl'); $username = CValue::request('username'); $password = CValue::request('password'); $classname = CValue::request('class', "CEAISoapHandler"); $wsdl_mode = CValue::request('wsdl_mode', "CWSDLRPCEncoded"); // Génération du fichier WSDL if (isset($wsdl)) { if (!$classname || !class_exists($classname, true)) { return; } $class = new $classname(); header('Content-Type: application/xml; charset=iso-8859-1'); $wsdlFile = new $wsdl_mode(); // Pour garder en référence les fonctions a decrire $wsdlFile->_soap_handler = $class; $wsdlFile->addTypes(); $wsdlFile->addMessage(); $wsdlFile->addPortType(); $wsdlFile->addBinding(); $wsdlFile->addService($username, $password, $m, $a, $classname);