function get_blog_posts($max_num_posts, $offset = 0) { $body_posts_query = <<<SQL select bp.blog_post, bp.title, bp.body, to_char( bp.created, 'Day, Month DD, YYYY HH:MI:SS AM' ) as created, m.first_name || ' ' || m.last_name as author, r.name as role, me.first_name || ' ' || me.last_name as editor, to_char( bp.edited, 'Day, Month DD, YYYY HH:MI:SS AM' ) as edited, re.name as editor_role from tb_blog_post bp join tb_member m on bp.creator = m.member join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role left join tb_member me on bp.editor = me.member left join tb_member_role mre on me.member = mre.member left join tb_role re on mre.role = re.role order by bp.blog_post desc limit ?limit? offset ?offset? SQL; $params = ['limit' => $max_num_posts, 'offset' => $offset]; $result = query_execute($body_posts_query, $params); return query_success($result) ? query_fetch_all($result) : false; }
function get_webpage_access_allowed($page_name) { $session_member = SessionLib::get('user_member.member'); $params = ['page_name' => $page_name]; if ($session_member == -1) { $get_access_query = <<<SQL select access_allowed_by_default as access_allowed from tb_webpage where ?page_name? ilike base_uri_glob SQL; } else { $get_access_query = <<<SQL select tt.access_allowed from tb_member_role rm, fn_get_page_permissions_for_role( rm.role ) tt join tb_webpage w using ( webpage ) where rm.member = ?member? and ?page_name? ilike w.base_uri_glob SQL; $params['member'] = $session_member; } $result = query_execute($get_access_query, $params); if (query_success($result)) { $row = query_fetch_one($result); return $row['access_allowed'] == 't'; } return false; }
function get_blog_post($blog_post) { $get_blog_post_query = <<<SQL select bp.blog_post, bp.title, bp.body, to_char( bp.created, 'Day, Month DD, YYYY HH:MI:SS AM' ) as created, m.first_name || ' ' || m.last_name as author, r.name as role, me.first_name || ' ' || me.last_name as editor, to_char( bp.edited, 'Day, Month DD, YYYY HH:MI:SS AM' ) as edited, re.name as editor_role from tb_blog_post bp join tb_member m on bp.creator = m.member join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role left join tb_member me on bp.editor = me.member left join tb_member_role mre on me.member = mre.member left join tb_role re on mre.role = re.role where bp.blog_post = ?blog_post? SQL; $params = ['blog_post' => $blog_post]; $result = query_execute($get_blog_post_query, $params); return query_success($result) ? query_fetch_one($result) : false; }
function delete_member_session_by_key($key) { $delete_blog_post_query = <<<SQL delete from tb_member_session where key = ?key? SQL; $params = ['key' => $key]; $delete = query_execute($delete_blog_post_query, $params); return query_success($delete); }
function delete_stale_member_sessions($seconds) { $delete_query = <<<SQL delete from tb_member_session where accessed < now() - interval '?seconds? seconds' SQL; $params = ['seconds' => $seconds]; $delete = query_execute($delete_blog_post_query, $params); return query_success($delete); }
function get_max_and_min_blog_post() { $get_max_min_query = <<<SQL select max( blog_post ) as max, min( blog_post ) as min from tb_blog_post SQL; $result = query_execute($get_max_min_query); return query_success($result) ? query_fetch_one($result) : false; }
function delete_blog_post($blog_post) { $delete_blog_post_query = <<<SQL delete from tb_blog_post where blog_post = ?blog_post? SQL; $params = ['blog_post' => $blog_post]; $delete = query_execute($delete_blog_post_query, $params); return query_success($delete); }
function get_role_by_abbreviation($abbreviation) { $description_query = <<<SQL select * from tb_role where abbreviation = ?abbreviation? SQL; $params = ['abbreviation' => $abbreviation]; $result = query_execute($description_query, $params); return query_success($result) ? query_fetch_one($result) : false; }
function get_member_session_by_key($key) { $get_session_query = <<<SQL select member_session, member, accessed, value, extract( epoch from now() - accessed ) as age_seconds from tb_member_session where key = ?key? SQL; $params = ['key' => $key]; $result = query_execute($get_session_query, $params); return query_success($result) ? query_fetch_one($result) : false; }
function get_member_by_gatech_email($gatech_email) { $get_member_query = <<<SQL select m.*, r.is_admin from tb_member m join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role where m.gatech_email_address = ?gatech_email? SQL; $params = ['gatech_email' => $gatech_email]; $result = query_execute($get_member_query, $params); return query_success($result) ? query_fetch_one($result) : false; }
function create_member($gatech_email, $first_name, $last_name, $password) { $insert_member = <<<SQL insert into tb_member ( first_name, last_name, gatech_email_address, display_email_address, password_hash ) values ( ?first_name?, ?last_name?, ?gatech_email?, ?gatech_email?, crypt( ?password?, gen_salt( 'bf' ) ) ) returning member SQL; $params = ['first_name' => $first_name, 'last_name' => $last_name, 'gatech_email' => $gatech_email, 'password' => $password]; begin_transaction(); $insert = query_execute($insert_member, $params); if (query_success($insert)) { $member_created = query_fetch_one($insert); $member_pk = $member_created['member']; $insert_role = <<<SQL insert into tb_member_role ( member, role ) values ( ?member?, ?role? ) SQL; $params = ['member' => $member_pk, 'role' => ROLE_MEMBER]; $result = query_execute($insert_role, $params); if (query_success($result)) { commit_transaction(); return $member_pk; } } rollback_transaction(); return false; }
function get_member($member) { $get_member_query = <<<SQL select m.*, m.first_name || ' ' || m.last_name as name, r.is_admin from tb_member m join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role where m.member = ?member? SQL; $params = ['member' => $member]; $result = query_execute($get_member_query, $params); return query_success($result) ? query_fetch_one($result) : false; }
function get_officer_info($role) { $get_officer_info_query = <<<SQL select m.member, m.first_name || ' ' || m.last_name as officer_name, m.display_email_address from tb_member m join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role where r.role = ?role? SQL; $params = ['role' => $role]; $result = query_execute($get_officer_info_query, $params); // query_fetch_all because there may be more than one officer per position return query_success($result) ? query_fetch_all($result) : false; }
function get_equipment_manager_email() { $email_query = <<<SQL select m.display_email_address from tb_member m join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role where r.role = ?role? SQL; $params = ['role' => ROLE_EQUIPMENT_MANAGER]; $result = query_execute($email_query, $params); if (query_success($result)) { $row = query_fetch_one($result); return $row['display_email_address']; } else { return false; } }
function create_or_update_member_session_by_key($key, $param_map) { $query = <<<SQL select fn_insert_or_update_row ( 'tb_member_session', ?param_json?::json, array[ 'key' ] ) as member_session SQL; $param_map['key'] = $key; $param_json = json_encode($param_map); $params = ['param_json' => $param_json]; $upsert = query_execute($query, $params); if (query_success($upsert)) { $retval = query_fetch_one($upsert); return $retval['member_session']; } else { return false; } }
<?php # ------------------------------------------------------------------------------------ # MARIS XDS REPOSITORY # Copyright (C) 2007 - 2010 MARiS Project # Dpt. Medical and Diagnostic Sciences, University of Padova - csaccavini@rad.unipd.it # This program is distributed under the terms and conditions of the GPL # Contributor(s): # A-thon srl <*****@*****.**> # Alberto Castellini # See the LICENSE files for details # ------------------------------------------------------------------------------------ include_once './config/config.php'; include_once './lib/functions_' . $database . '.php'; $Login = $_POST['login']; $Password = crypt($_POST['password2'], 'xds'); $deleteUSER = "******"; $USER_delete = query_execute($deleteUSER); $insertUSER = "******"; $USER_insert = query_execute($insertUSER); header('location: setup.php');
//echo $insertREG; $REG_insert = query_execute($insertREG); $REP_host_post = $_POST['repository_host']; $REP_port_post = $_POST['repository_port']; $REP_http_post = $_POST['repository_http']; $deleteREP = "DELETE FROM REPOSITORY"; $REP_delete = query_execute($deleteREP); $insertREP = "INSERT INTO REPOSITORY (ID,HOST,PORT,SERVICE,ACTIVE,HTTP) VALUES ('1','{$REP_host_post}','{$REP_port_post}','SUBMISSION','A','{$REP_http_post}')"; //echo $insertREP; $REP_insert = query_execute($insertREP); $REP_www_post = $_POST['repository_www']; $REP_log_post = $_POST['repository_log']; $REP_cache_post = $_POST['repository_cache']; $REP_files_post = $_POST['repository_files']; $REP_uniqueID = $_POST['repository_uniqueid']; $REP_status = $_POST['repository_status']; $REP_crypt = $_POST['repository_crypt']; $deleteREP_config = "DELETE FROM CONFIG_B"; $REP_delete_config = query_execute($deleteREP_config); $insertREP_config = "INSERT INTO CONFIG_B (WWW,LOG,CACHE,FILES,UNIQUEID,STATUS,CRYPT) VALUES ('{$REP_www_post}','{$REP_log_post}','{$REP_cache_post}','{$REP_files_post}','{$REP_uniqueID}','{$REP_status}','{$REP_crypt}')"; //echo $insertREP_config; $REP_insert_config = query_execute($insertREP_config); $ATNA_status = $_POST['repository_atna_status']; $ATNA_host = $_POST['repository_atna_host']; $ATNA_port = $_POST['repository_atna_port']; $deleteATNA = "DELETE FROM ATNA"; $ATNA_delete = query_execute($deleteATNA); $insertATNA = "INSERT INTO ATNA (ID,HOST,PORT,ACTIVE,DESCRIPTION) VALUES ('1','{$ATNA_host}','{$ATNA_port}','{$ATNA_status}','ATNA NODE')"; //echo $insertREP; $ATNA_insert = query_execute($insertATNA); header('location: setup.php');
<?php # ------------------------------------------------------------------------------------ # MARIS XDS REPOSITORY # Copyright (C) 2007 - 2010 MARiS Project # Dpt. Medical and Diagnostic Sciences, University of Padova - csaccavini@rad.unipd.it # This program is distributed under the terms and conditions of the GPL # Contributor(s): # A-thon srl <*****@*****.**> # Alberto Castellini # See the LICENSE files for details # ------------------------------------------------------------------------------------ include_once './config/config.php'; include_once './lib/functions_' . $database . '.php'; $REP_source_id = $_POST['source_id']; $REP_source_action = $_POST['source_action']; $REP_source_name = $_POST['source_name']; $REP_source_description = $_POST['source_description']; if ($REP_source_action == "delete") { $deleteREP_source = "DELETE FROM KNOWN_SOUCES_IDS WHERE ID='{$REP_source_id}'"; $REP_delete_source = query_execute($deleteREP_source); } if ($REP_source_action == "add") { $insertREP_source = "INSERT INTO KNOWN_SOUCES_IDS (XDSSUBMISSIONSET_SOURCEID,SOURCE_DESCRIPTION) VALUES ('{$REP_source_name}','{$REP_source_description}')"; $REP_insert_source = query_execute($insertREP_source); } header('location: setup.php');
$registry_response = $registry_response_arr[0]; if ($save_files) { #### N.B. NELLA RISPOSTA DAL REGISTRY HO HEADERS + BODY ## 5- scrivo in locale la RISPOSTA DAL REGISTRY writeTmpFiles($registry_response, $idfile . "-da_registry-" . $idfile); //============= END OF FORWARDING AL REGISTRY del NIST ===============// } // Se la risposta del registry รจ errata cancello il documento creato nel repository if (strpos(strtoupper($registry_response), "ERROR") || strpos(strtoupper($registry_response), "FAILURE")) { if ($windows > 0) { exec('del ' . $document_URI2 . ' /q'); } else { exec('rm -f ' . $document_URI2); } $deleteDocument = "DELETE FROM DOCUMENTS WHERE KEY_PROG = {$next_token}"; $res_delete = query_execute($deleteDocument); } #### XML RICEVUTO IN RISPOSTA DAL REGISTRY //$body = trim((substr($da_registry,strpos($da_registry,"<SOAP-ENV:Envelope")))); if (preg_match('([^\\t\\n\\r\\f\\v";][:]*+ENVELOPE)', strtoupper($registry_response))) { writeTimeFile($idfile . "--Repository: Ho trovato SOAPENV:ENVELOPE"); preg_match('(<([^\\t\\n\\r\\f\\v";<]+:)?(ENVELOPE))', strtoupper($registry_response), $matches_reg); $presoap_reg = $matches_reg[1]; writeTimeFile($idfile . "--Repository: Ho trovato {$presoap}"); $body = substr($registry_response, strpos(strtoupper($registry_response), "<" . $presoap_reg . "ENVELOPE")); //risposta DEL REGISTRY writeTmpFiles($body, $idfile . "-body_response_reg-" . $idfile); // Devo sostituire urn:ihe:iti:2007:RegisterDocumentSet-bResponse con urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse $search = "urn:ihe:iti:2007:RegisterDocumentSet-bResponse"; $replace = "urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse"; $body_response = str_replace($search, $replace, $body);
} } #### PARAMETRO DI AUTORIZZAZIONE $action = $_POST['delete_repository']; #### ESEGUO if ($action == "database") { #### COMANDI $query_DOCUMENTS = "TRUNCATE TABLE DOCUMENTS"; $query_AuditableEvent = "TRUNCATE TABLE AUDITABLEEVENT"; #### CREO L'ARRAY DEI COMANDI DA ESEGUIRE $svuota_array = array($query_DOCUMENTS, $query_AuditableEvent); $i = 0; while ($i < count($svuota_array)) { $comando = $svuota_array[$i]; //echo("<br><b>- ESEGUO: $comando </b>"); $ris = query_execute($comando); /*if($ris==1) { echo("<b> ===>> OK -</b><br>"); } echo("-----------------------------------------------------------------------------------------");*/ $i = $i + 1; } //END OF while($i<count($svuota_array)) #### ATTENZIONE //echo("<br><br><br><b>- ATTENZIONE: SI SONO PERSE TUTTE LE INFORMAZIONI SUI DOCUMENTI !!!! -</b><br>"); header('location: ../setup.php'); } //END OF if($truncDb=="A") if ($action == "tmp") { $system = PHP_OS;