''"; $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); $res = ''; if (!$err) { while ($obj = FetchObj($QryHnd)) { $curr_valore = strip_tags(html_entity_decode($obj->VALORE)); if ($res) $res .= '#'; $res .= $curr_valore; } } FreeQuery($QryHnd); return $res; } // ############################################################### // restituisce un array degli id dei link esterni di una scheda // ############################################################### function ListSkExternalLinks($sk_id) { $SqlString = " SELECT ID_SK_2 FROM " . TBL_LINKS . " WHERE ID_SK_1 = '$sk_id' AND ". " TYPE_SK_1 = 'S' AND ". " TYPE_SK_2 = 'E' AND " . " ROLE = 'E'"; $external_links_id_array = SimpleList($SqlString); return $external_links_id_array; } // ############################################################### // restituisce la descrizione di un link esterno // ############################################################### function GetExternalLinkDescription($external_link_id) { $SqlString = " SELECT DESCRIZIONE FROM " . TBL_EXTERNAL_LINKS . " WHERE ID = '$external_link_id'"; $external_link_description = SimpleField($SqlString); return $external_link_description; } function CountFullTextField($id, $table_name, $language) { $SqlStringCount = " SELECT COUNT(*) FROM " . TBL_CAMPI . " WHERE TABLE_NAME = '$table_name' AND ". " FIELD_NAME = 'FULL_TEXT_SEARCH' AND ". " LINGUA = '$language' AND ". " ID = $id"; return SimpleField($SqlStringCount); } // ############################################################### // crea campo di accumulo per ricerca libera // ############################################################### function CreateFullTextField($id, $table_name, $language) { //$table_name = strtoupper($table_name); $dateString = GetCurrentDate(); $timeString = GetCurrentTime(); $newFullTextValue = GetFieldValues($id, $table_name, $language); $external_links_id_array = ListSkExternalLinks($id); foreach ($external_links_id_array as $value) $newFullTextValue .= '#'.GetExternalLinkDescription($value); $newFullTextValue = ReplaceWrongChars($newFullTextValue); $count = CountFullTextField($id, $table_name, $language); $err = ''; if ($count > 0) { $SqlStringUpdate = " UPDATE " . TBL_CAMPI . " SET " . " VALORE = '$newFullTextValue', " . " ULTIMA_MODIFICA = '$dateString', " . " ULTIMA_MODIFICA_TIME = '$timeString', " . " ID_USER_LAST_MODIFY =" . $_SESSION['ID_USER'] . " WHERE LOWER(TABLE_NAME) = '".strtolower($table_name)."' AND ". " FIELD_NAME = 'FULL_TEXT_SEARCH' AND ". " LINGUA = '$language' AND ". " ID = $id"; $err = VoidQuery($SqlStringUpdate); //print($SqlStringUpdate . "->" . $err); //exit(); } else { $SqlStringInsert = " INSERT INTO " . TBL_CAMPI . " (ID, TABLE_NAME, FIELD_NAME, LINGUA, VALORE, VALIDITA, ULTIMA_MODIFICA, ULTIMA_MODIFICA_TIME, ID_USER_LAST_MODIFY) " . " VALUES " . " ('$id', '".strtolower($table_name)."', 'FULL_TEXT_SEARCH', '$language', '$newFullTextValue', 'F', '$dateString', '$timeString', '" . $_SESSION['ID_USER'] . "') "; $err = VoidQuery($SqlStringInsert); //print($SqlStringInsert . "->" . $err); //exit(); } return $err; } // ############################################################### // scrive il debug // ############################################################### function Debug($testo) { $testo = str_replace("'", "''", $testo); //data odierna $month = date('m'); $day = date('d'); $year = date('Y'); //ora corrente $hour = date('H'); $min = date('i'); $data_invio = $year . "-" . $month . "-" . $day; $ora_invio = $hour . ":" . $min; if (USE_DEBUG_TABLE) { //intanto inserisco nella tabella di LOG l'SMS inviato... $sqlDebug = " INSERT INTO " . TBL_DEBUG . " (DATA, ORA, TESTO) ". " VALUES " . " ('$data_invio', '$ora_invio', '$testo')"; $res = VoidQuery($sqlDebug); } if (USE_DEBUG_SCREEN) { print("

"); print("" . $data_invio . " " . $ora_invio . ""); print("
" . $testo); } return $res; } // ############################################################### // invia la richiesta di approvazione // ############################################################### function SendRequest($id) { global $site_staff_address; $curr_mail_address = $site_staff_address[$_SESSION['PROJECT_ID']]; $curr_oggetto = 'richiesta approvazione'; $curr_mail_text = "Richiesta di approvazione da parte di " . $_SESSION['NAME_USER'] . " " . $_SESSION['SURNAME_USER'] . " per la scheda con id: " . $id; $intestazioni = "From: " . $_SESSION['NAME_USER'] . " " . $_SESSION['SURNAME_USER'] . " <" . $curr_mail_address . ">\r\n"; $result = @mail($curr_mail_address, $curr_oggetto, $curr_mail_text, $intestazioni); //print("

".$curr_mail_text); //exit(); $errorMsg = ''; if (!$result) { $errorMsg = "Errore durante l'invio della mail a " . $curr_mail_address . "

" . "Testo della mail:" . "

" . "" . $curr_mail_text . "" . "

" . "L'avviso è stato memorizzato ma non è stato possibile spedire una mail al supervisore." . "
" . "Assicurarsi che sia attivo un SMTP server."; } return $errorMsg; } // ############################################################### // controllo se sono nel modulo di gestione: devo cambiare il path delle immagini // ############################################################### $script_name = $_SERVER['SCRIPT_NAME']; $idx_gestione = strpos($script_name, "/gestione/"); $curr_script_path = ""; if ($idx_gestione) $curr_script_path = "../"; // ############################################################### // controllo se un indirizzo email contiene caratteri "strani" // ############################################################### function ValidCharsInMail($mail_address) { $length = strlen($mail_address); for ($i = 0; $i < $length; $i++) { $char = $mail_address[$i]; if (strpos(";_-@abcdefghilmnopqrstuvzxyjkw.1234567890ABCDEFGHILMNOPQRSTUVZXYJKW", $char) === false) return false; } return true; } // ############################################################### // restituisce il num. di schede con richiesta di approvazione in corso // ############################################################### function CountRequestedPages() { $SqlString = "SELECT COUNT(*) FROM " . TBL_SCHEDE . " WHERE REQUESTED = 'T' AND ID_GROUP = " . $_SESSION['GROUP_USER']; return SimpleField($SqlString); } // ############################################################### // restituisce il num. di schede ancora invisibili // ############################################################### function CountInvisiblePages() { $SqlString = "SELECT COUNT(*) FROM " . TBL_SCHEDE . " WHERE VISIBLE = 'F' AND ID_GROUP = " . $_SESSION['GROUP_USER']; return SimpleField($SqlString); } // ############################################################### // restituisce il num. di schede visibili senza richiesta di approvazione // ############################################################### function CountVisibleNotRequestedPages() { $SqlString = "SELECT COUNT(*) FROM " . TBL_SCHEDE . " WHERE VISIBLE = 'T' AND REQUESTED = 'F' AND ID_GROUP = " . $_SESSION['GROUP_USER']; return SimpleField($SqlString); } // ############################################################### // elenco tipologie di pagine abilitate per l'utente connesso // ############################################################### function UserIsEnabledForAllTypes() { //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; //prima di tutto controllo se l'utente ha privilegio massimo su tutte le sezioni del sito $SqlString = "SELECT " . READ_RIGHT . " FROM " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND FIELD_NAME = 'ALL' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

UserIsEnabledForAllTypes:
".$SqlString . "
//-->" . $diritto); $res = false; if ($diritto == 'T') $res = true; return $res; } // ############################################################### // elenco tipologie di pagine abilitate per l'utente connesso // ############################################################### function getEnabledPageTypes() { $res = ''; //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; $SqlString = "SELECT DISTINCT FIELD_NAME FROM " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND ID_PRIVILEGIO = " . $level_user; $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); if (!$err) { while ($obj = FetchObj($QryHnd)) { $curr_type = $obj->FIELD_NAME; $curr_type = str_replace("'", "''", $curr_type); if ($res) $res .= ', '; $res .= "'" . $curr_type . "'"; } } //print("

getEnabledPageTypes:
".$SqlString . "
//-->" . $res); FreeQuery($QryHnd); return $res; } // ############################################################### // controlla i diritti su una sezione del sito // ############################################################### function CheckRight($right, $what) { $res = false; //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; //prima di tutto controllo se l'utente ha privilegio massimo su tutte le sezioni del sito $SqlString = "SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE WHAT = 'ALL' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; else { //controllo se l'utente ha il privilegio sulla sezione desiderata $SqlString = "SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE WHAT = '" . $what . "' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; } return $res; } // ############################################################### // controlla i diritti su una tipologia di pagina // ############################################################### function GetFirstPageTypeRight() { $res = NEW_PAGE_TYPE; //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; //prima di tutto controllo se l'utente ha privilegio massimo su tutte le tipologie di pagina $SqlString = "SELECT " . WRITE_RIGHT . " FROM . " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND FIELD_NAME = 'ALL' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = NEW_PAGE_TYPE; else { //controllo se l'utente ha il privilegio sulla tipologia di pagina desiderata $SqlString = "SELECT FIELD_NAME FROM " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND " . WRITE_RIGHT . " = 'T' AND ID_PRIVILEGIO = " . $level_user; $tipo_disp = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $tipo_disp); //exit(); if ($tipo_disp) $res = $tipo_disp; } return $res; } // ############################################################### // controlla i diritti su una tipologia di pagina // ############################################################### function CheckPageTypeRight($right, $page_type) { $res = false; //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; //prima di tutto controllo se l'utente ha privilegio massimo su tutte le tipologie di pagina $SqlString = "SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND FIELD_NAME = 'ALL' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; else { //controllo se l'utente ha il privilegio sulla tipologia di pagina desiderata $SqlString = "SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE TABLE_NAME = 'PAGE_TYPE' AND FIELD_NAME = '" . $page_type . "' AND ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; } return $res; } // ############################################################### // controlla i diritti su tabelle/campi // ############################################################### function CheckTableFieldRight($right, $table_name, $field_name) { $res = false; //controllo se l'utente ha cambiato progetto... if ($_SESSION['PROJECT_ID'] != PROJECT_ID) return false; $level_user = $_SESSION['LEVEL_USER']; //prima di tutto controllo se l'utente ha privilegio massimo su tutte la tabelle $SqlString = " SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE " . " TABLE_NAME = 'ALL'" . " AND " . " ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; else { //controllo se l'utente ha il privilegio massimo su tutti i campi della tabella desiderata $SqlString = " SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE " . " TABLE_NAME = '" . $table_name . "'" . " AND " . " FIELD_NAME = 'ALL'" . " AND " . " ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; else { //controllo se l'utente ha il privilegio massimo su tutti i campi della tabella desiderata $SqlString = " SELECT " . $right . " FROM " . TBL_PRIVILEGI . " WHERE " . " TABLE_NAME = '" . $table_name . "'" . " AND " . " FIELD_NAME = '" . $field_name. "'" . " AND " . " ID_PRIVILEGIO = " . $level_user; $diritto = SimpleField($SqlString); //print("

".$SqlString . "
//-->" . $diritto); if ($diritto == 'T') $res = true; } } return $res; } // ############################################################### // se per il gruppo corrente sono definiti // alcuni parametri (come path del sito e delle immagini) // sostituisce i relativi valori alle variabili di sistema // presenti in "_projects.inc" // ############################################################### function SetEnvironmentVariables() { global $projects_path; global $wawe_path; global $upload_path; global $css_name; global $images_path; global $images_path_prw; global $images_path_nrm; global $images_path_big; global $images_path_ext; global $use_pagine; global $use_live_cm; global $use_immagini; global $use_rubrica; global $use_rubrica_extended; global $use_pubblicazioni; global $use_external_links; global $use_sql; global $use_sms; global $use_stats; global $use_internal_stats; global $use_HTML_editor; global $use_gestione; global $use_united_nome_cognome; global $use_images_in_rubrica; global $use_alpha_id; global $use_alpha_id_2; global $use_primo_piano; global $use_agata_links; global $use_wawe_upload; global $use_versioning; global $use_workflow; global $use_site_subscription; global $use_owner_check; $SqlString = "SELECT * FROM " . TBL_GRUPPI . " WHERE ID = " . $_SESSION['GROUP_USER']; $obj = SimpleObj($SqlString); $new_site_path = ''; $new_img_path = ''; if ($obj) { $new_site_path = $obj->WWW; $new_upload_path = $obj->UPLOAD_PATH; $new_wawe_path = $obj->WAWE_PATH; $new_css_name = $obj->CSS_NAME; $new_img_path = $obj->IMAGES_PATH; $new_img_path_prw = $obj->IMAGES_PATH_PRW; $new_img_path_nrm = $obj->IMAGES_PATH_NRM; $new_img_path_big = $obj->IMAGES_PATH_BIG; $new_img_path_ext = $obj->IMAGES_PATH_EXT; //impostazioni SI/NO del sistema: di default tutto a FALSE $new_use_pag = false; $new_use_live_cm = false; $new_use_fot = false; $new_use_rub = false; $new_use_rub_ext = false; $new_use_pub = false; $new_use_ext = false; $new_use_sql = false; $new_use_sms = false; $new_use_stats = false; $new_use_internal_stats = false; $new_use_html = false; $new_use_gest = false; $new_use_nomcogn = false; $new_use_imginrubr = false; $new_use_alphaid = false; $new_use_alphaid2 = false; $new_use_primopiano = false; $new_use_agatalinks = false; $new_use_waweupload = false; $new_use_versioning = false; $new_use_workflow = false; $new_use_site_subscription = false; $new_use_owner_check = false; //leggo valori effettivi dal db if ($obj->USE_PAGINE == 'T') $new_use_pag = true; if ($obj->USE_LIVE_CM == 'T') $new_use_live_cm = true; if ($obj->USE_FOTO == 'T') $new_use_fot = true; if ($obj->USE_RUBRICA == 'T') $new_use_rub = true; if ($obj->USE_RUBRICA_EXTENDED == 'T') $new_use_rub_ext = true; if ($obj->USE_PUBBLICAZIONI == 'T') $new_use_pub = true; if ($obj->USE_EXT_LINKS == 'T') $new_use_ext = true; if ($obj->USE_SQL == 'T') $new_use_sql = true; if ($obj->USE_SMS == 'T') $new_use_sms = true; if ($obj->USE_STATS == 'T') $new_use_stats = true; if ($obj->USE_INTERNAL_STATS == 'T') $new_use_internal_stats = true; if ($obj->USE_HTML_EDITOR == 'T') $new_use_html = true; if ($obj->USE_GESTIONE == 'T') $new_use_gest = true; if ($obj->USE_NOME_COGNOME_UNITI == 'T') $new_use_nomcogn = true; if ($obj->USE_IMMAGINI_IN_RUBRICA == 'T') $new_use_imginrubr = true; if ($obj->USE_ALPHA_ID == 'T') $new_use_alphaid = true; if ($obj->USE_ALPHA_ID_2 == 'T') $new_use_alphaid2 = true; if ($obj->USE_PRIMO_PIANO == 'T') $new_use_primopiano = true; if ($obj->USE_AGATA_LINKS == 'T') $new_use_agatalinks = true; if ($obj->USE_WAWE_UPLOAD == 'T') $new_use_waweupload = true; if ($obj->USE_VERSIONING == 'T') $new_use_versioning = true; if ($obj->USE_WORKFLOW == 'T') $new_use_workflow = true; if ($obj->USE_SITE_SUBSCRIPTION == 'T') $new_use_site_subscription = true; if ($obj->USE_OWNER_CHECK == 'T') $new_use_owner_check = true; //imposto le variabili globali di conseguenza... $projects_path[$_SESSION['PROJECT_ID']] = trim($new_site_path,'/').'/'; $wawe_path[$_SESSION['PROJECT_ID']] = $new_wawe_path; $upload_path[$_SESSION['PROJECT_ID']] = trim($new_upload_path,'/').'/'; $css_name[$_SESSION['PROJECT_ID']] = $new_css_name; $images_path[$_SESSION['PROJECT_ID']] = trim($new_img_path,'/').'/'; $images_path_prw[$_SESSION['PROJECT_ID']] = trim($new_img_path_prw,'/').'/'; $images_path_nrm[$_SESSION['PROJECT_ID']] = trim($new_img_path_nrm,'/').'/'; $images_path_big[$_SESSION['PROJECT_ID']] = trim($new_img_path_big,'/').'/'; $images_path_ext[$_SESSION['PROJECT_ID']] = trim($new_img_path_ext,'/').'/'; //valori SI/NO $use_pagine[$_SESSION['PROJECT_ID']] = $new_use_pag; $use_live_cm[$_SESSION['PROJECT_ID']] = $new_use_live_cm; $use_immagini[$_SESSION['PROJECT_ID']] = $new_use_fot; $use_rubrica[$_SESSION['PROJECT_ID']] = $new_use_rub; $use_rubrica_extended[$_SESSION['PROJECT_ID']] = $new_use_rub_ext; $use_pubblicazioni[$_SESSION['PROJECT_ID']] = $new_use_pub; $use_external_links[$_SESSION['PROJECT_ID']] = $new_use_ext; $use_sql[$_SESSION['PROJECT_ID']] = $new_use_sql; $use_sms[$_SESSION['PROJECT_ID']] = $new_use_sms; $use_stats[$_SESSION['PROJECT_ID']] = $new_use_stats; $use_internal_stats[$_SESSION['PROJECT_ID']] = $new_use_internal_stats; $use_HTML_editor[$_SESSION['PROJECT_ID']] = $new_use_html; $use_gestione[$_SESSION['PROJECT_ID']] = $new_use_gest; $use_united_nome_cognome[$_SESSION['PROJECT_ID']] = $new_use_nomcogn; $use_images_in_rubrica[$_SESSION['PROJECT_ID']] = $new_use_imginrubr; $use_alpha_id[$_SESSION['PROJECT_ID']] = $new_use_alphaid; $use_alpha_id_2[$_SESSION['PROJECT_ID']] = $new_use_alphaid2; $use_primo_piano[$_SESSION['PROJECT_ID']] = $new_use_primopiano; $use_agata_links[$_SESSION['PROJECT_ID']] = $new_use_agatalinks; $use_wawe_upload[$_SESSION['PROJECT_ID']] = $new_use_waweupload; $use_versioning[$_SESSION['PROJECT_ID']] = $new_use_versioning; $use_workflow[$_SESSION['PROJECT_ID']] = $new_use_workflow; $use_site_subscription[$_SESSION['PROJECT_ID']] = $new_use_site_subscription; $use_owner_check[$_SESSION['PROJECT_ID']] = $new_use_owner_check; } /* print("project path: " . $projects_path[$_SESSION['PROJECT_ID']]); print("
"); print("uploads path: " . $upload_path[$_SESSION['PROJECT_ID']]); print("
"); print("wawes path: " . $wawe_path[$_SESSION['PROJECT_ID']]); print("
"); print("images path: " . $images_path[$_SESSION['PROJECT_ID']]); print("
"); print("images path prw: " . $images_path_prw[$_SESSION['PROJECT_ID']]); print("
"); print("images path nrm: " . $images_path_nrm[$_SESSION['PROJECT_ID']]); print("
"); print("images path big: " . $images_path_big[$_SESSION['PROJECT_ID']]); print("
"); print("images path ext: " . $images_path_ext[$_SESSION['PROJECT_ID']]); print("
"); print("usa pagine: " . $use_pagine[$_SESSION['PROJECT_ID']]); print("
"); print("usa Live CM: " . $use_live_cm[$_SESSION['PROJECT_ID']]); print("
"); print("usa img.: " . $use_immagini[$_SESSION['PROJECT_ID']]); print("
"); print("usa rubr.: " . $use_rubrica[$_SESSION['PROJECT_ID']]); print("
"); print("usa rubr. ext.: " . $use_rubrica_extended[$_SESSION['PROJECT_ID']]); print("
"); print("usa pubbl.: " . $use_pubblicazioni[$_SESSION['PROJECT_ID']]); print("
"); print("usa external links.: " . $use_external_links[$_SESSION['PROJECT_ID']]); print("
"); print("usa SQL: " . $use_sql[$_SESSION['PROJECT_ID']]); print("
"); print("usa statistiche: " . $use_stats[$_SESSION['PROJECT_ID']]); print("
"); print("usa HTML editor: " . $use_HTML_editor[$_SESSION['PROJECT_ID']]); print("
"); print("usa gestione: " . $use_gestione[$_SESSION['PROJECT_ID']]); print("
"); print("use_united_nome_cognome: " . $use_united_nome_cognome[$_SESSION['PROJECT_ID']]); print("
"); print("use_images_in_rubrica: " . $use_images_in_rubrica[$_SESSION['PROJECT_ID']]); print("
"); print("use_alpha_id: " . $use_alpha_id[$_SESSION['PROJECT_ID']]); print("
"); print("use_alpha_id_2: " . $use_alpha_id_2[$_SESSION['PROJECT_ID']]); print("
"); print("use_primo_piano: " . $use_primo_piano[$_SESSION['PROJECT_ID']]); print("
"); print("use_agata_links: " . $use_agata_links[$_SESSION['PROJECT_ID']]); print("
"); print("use_wawe_upload: " . $use_wawe_upload[$_SESSION['PROJECT_ID']]); print("
"); print("use_versioning: " . $use_versioning[$_SESSION['PROJECT_ID']]); print("
"); print("use_workflow: " . $use_workflow[$_SESSION['PROJECT_ID']]); print("
"); print("use_internal_stats: " . $use_internal_stats[$_SESSION['PROJECT_ID']]); print("
"); print("use_site_subscription: " . $use_site_subscription[$_SESSION['PROJECT_ID']]); print("
"); print("use_owner_check: " . $use_owner_check[$_SESSION['PROJECT_ID']]); */ } // ############################################################### // scrive una riga di statitica // ############################################################### function Stats($idx_menu = 0, $idx_subMenu = 0, $ID_scheda = 0) { $month = JQuote(date('m')); $day = JQuote(date('d')); $year = JQuote(date('Y')); $time = JQuote(date('H:i:s')); $idx_menu = JQuote($idx_menu); $idx_subMenu = JQuote($idx_subMenu); $ID_scheda = JQuote($ID_scheda); $id_connected_user = "''"; if (isset($_SESSION['ID_USER'])) $id_connected_user = JQuote($_SESSION['ID_USER']); $ip_address = "''"; if (isset($_SERVER['REMOTE_ADDR'])) $ip_address = JQuote($_SERVER['REMOTE_ADDR']); $referer = "''"; if (isset($_SERVER['HTTP_REFERER'])) $referer = JQuote($_SERVER['HTTP_REFERER']); $script_name = "''"; if (isset($_SERVER['SCRIPT_NAME'])) $script_name = JQuote($_SERVER['SCRIPT_NAME']); $idx = strpos($script_name, "list_stats.php"); if ( (!$idx) && ($ip_address != JQuote(EXCLUDE_IP_ADDRESS)) ) { $SqlString = "INSERT INTO " . TBL_STATS . " (IP_ADDRESS, REFERER, DATE_AAAA, DATE_MM, DATE_GG, DATE_TIME, IDX_PAGE, IDX_SUBPAGE, ID_SCHEDA, ID_USER, SCRIPT_NAME)". "VALUES ($ip_address, $referer, $year, $month, $day, $time, $idx_menu, $idx_subMenu, $ID_scheda, $id_connected_user, $script_name)"; $err = VoidQuery($SqlString); /* if ($err) {?> errore: errore nella scrittura delle statistiche.
errore:


0); } else return true; } // ############################################################### // controlla se devo stampare il campo "data" per la tipologia // di scheda corrente (testando l'array $use_date in "_projects.inc") // ############################################################### function MustPrintDate($typology) { global $use_date; $use_date_array = explode('|', $use_date[PROJECT_ID]); $in_array = in_array ($typology, $use_date_array); return $in_array; } // ############################################################### // stampa il titolo della colonna "sensibile" per ordinamento elenchi // ############################################################### function PrintOrderByLabel($fieldName, $label) { global $orderBy; global $ascDesc; global $curr_script_path; $newAscDesc = 'ASC'; $ascDescSymbol = ''; if ( ($fieldName == $orderBy) && ($ascDesc == 'ASC') ) { $newAscDesc = 'DESC'; $ascDescSymbol = ''; } if ($fieldName != $orderBy) $ascDescSymbol = ''; ?>  
".$sqlString); $result = VoidQuery($sqlString); } } } // ############################################################### // invia la pagina corrente alla newsletter-SMS (con "versioni") // ############################################################### function SendToSMSSchedaFieldWithVersions($id,$tr_class=false) { global $languages; global $curr_script_path; $languages_array = explode('|', $languages[PROJECT_ID]); if (count($languages_array)) { for ($idx = 0; $idx < count($languages_array); $idx++) { $curr_language = $languages_array[$idx]; if ($_SESSION['LANGUAGE_' . $curr_language]) {?> > () <?=Translate('invia con SMS')?> <?=Translate('spedizione con SMS non consentita')?> > () <?=Translate('invia con newsletter')?> <?=Translate('spedizione con newsletter non consentita')?> $item) { $sk_field_names_currtype = $sk_field_names[PROJECT_ID][$key]; $sk_field_names_array = explode('|', $sk_field_names_currtype); $in_sk = $in_sk || in_array ($fieldName, $sk_field_names_array); } $img_field_names_array = explode('|', $img_field_names[PROJECT_ID]); $per_field_names_array = explode('|', $per_field_names[PROJECT_ID]); $in_img = in_array ($fieldName, $img_field_names_array); $in_per = in_array ($fieldName, $per_field_names_array); return ( $in_img || $in_per || $in_sk ); } // ############################################################### // controlla se una tabella ha campi con "versioni" // ############################################################### function TableHasFieldsWithVersions($page_type, $table_name) { global $sk_field_names; global $img_field_names; global $per_field_names; if ($table_name == TBL_SCHEDE) { if (!isset($sk_field_names[$_SESSION['PROJECT_ID']][$page_type])) $page_type = DEFAULT_PAGE_TYPE; $field_names_array = explode('|', $sk_field_names[$_SESSION['PROJECT_ID']][$page_type]); } if ($table_name == TBL_GALLERY) { $field_names_array = explode('|', $img_field_names[$_SESSION['PROJECT_ID']]); } if ($table_name == TBL_RUBRICA) { $field_names_array = explode('|', $per_field_names[$_SESSION['PROJECT_ID']]); } $num_of_fields = count($field_names_array); //print('

' . $table_name . ' -> num = ' . $num_of_fields . '
'); //print_r($field_names_array); return ($num_of_fields > 1); } // ############################################################### // stampa l'elenco dei campi con "versioni" di una tabella // ############################################################### function PrintSchedaFieldsWithVersions($page_type, $table_name, $id, $use_HTML_Editor, $tr_class=false) { global $sk_field_names; global $sk_field_labels; global $sk_field_types; global $img_field_names; global $img_field_labels; global $img_field_types; global $per_field_names; global $per_field_labels; global $per_field_types; if ($table_name == TBL_SCHEDE) { if (!isset($sk_field_names[$_SESSION['PROJECT_ID']][$page_type])) $page_type = DEFAULT_PAGE_TYPE; $field_names_array = explode('|', $sk_field_names[$_SESSION['PROJECT_ID']][$page_type]); $field_labels_array = explode('|', $sk_field_labels[$_SESSION['PROJECT_ID']][$page_type]); $field_types_array = explode('|', $sk_field_types[$_SESSION['PROJECT_ID']][$page_type]); } if ($table_name == TBL_GALLERY) { $field_names_array = explode('|', $img_field_names[$_SESSION['PROJECT_ID']]); $field_labels_array = explode('|', $img_field_labels[$_SESSION['PROJECT_ID']]); $field_types_array = explode('|', $img_field_types[$_SESSION['PROJECT_ID']]); } if ($table_name == TBL_RUBRICA) { $field_names_array = explode('|', $per_field_names[$_SESSION['PROJECT_ID']]); $field_labels_array = explode('|', $per_field_labels[$_SESSION['PROJECT_ID']]); $field_types_array = explode('|', $per_field_types[$_SESSION['PROJECT_ID']]); } $num_of_fields = count($field_names_array); if ($num_of_fields >= 1) { for ($idx = 0; $idx < $num_of_fields; $idx++) { $curr_type = EDIT_FIELD; if ($field_types_array[$idx] == "EDIT_FIELD") $curr_type = EDIT_FIELD; if ($field_types_array[$idx] == "NUMBER_FIELD") $curr_type = NUMBER_FIELD; if ($field_types_array[$idx] == "COMBO_FIELD") $curr_type = COMBO_FIELD; if ($field_types_array[$idx] == "MEMO_FIELD") $curr_type = MEMO_FIELD; if ($field_types_array[$idx] == "BOOL_FIELD") $curr_type = BOOL_FIELD; if ($field_types_array[$idx] == "HIDE_FIELD") $curr_type = HIDE_FIELD; if ($field_types_array[$idx] == "SINGLE_DATE_FIELD") $curr_type = SINGLE_DATE_FIELD; if ($field_types_array[$idx] == "MULTICOMBO_FIELD") $curr_type = MULTICOMBO_FIELD; if ($field_types_array[$idx] == "MULTICHECKBOX_FIELD") $curr_type = MULTICHECKBOX_FIELD; $field_name = $field_names_array[$idx]; if ($field_name) PrintSchedaFieldWithVersions($table_name, $id, $field_name, $field_labels_array[$idx], $curr_type, $use_HTML_Editor, true, $tr_class); } } } // ############################################################### // stampa un campo di una tabella (con "versioni") // ############################################################### function PrintSchedaFieldWithVersions($table_name, $id, $fieldName, $fieldLabel, $fieldType, $use_HTML_Editor, $insertLastUpdate, $tr_class=false) { if (!CheckTableFieldRight(READ_RIGHT, $table_name, $fieldName)) return; global $languages; global $use_wawe_upload; global $use_versioning; $languages_array = explode('|', $languages[PROJECT_ID]); $num_of_languages = count($languages_array); //uso la forma tebellare se le lingue sono pi di una o se c' il versionamento $forma_tabellare = ( ($num_of_languages > 1) || ($use_versioning[PROJECT_ID]) ); if ($num_of_languages >= 1) { if ($forma_tabellare) { // ######################### FORMA TABELLARE ######################## ?> = 1) $SqlString = " SELECT * FROM " . TBL_CAMPI . $whereString . $validitaString . " ORDER BY ID_PROG DESC"; else $SqlString = " SELECT * FROM " . TBL_CAMPI . $whereString . " AND VALIDITA = 'T' ORDER BY ID_PROG DESC"; //print($SqlString); } $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); if (!$err) { while ($obj = FetchObj($QryHnd)) { $id_prog = $obj->ID_PROG; $currVal = $obj->VALORE; PrintSchedaField($table_name, $id, $fieldName, $field_label, $currVal, $fieldType, $use_HTML_Editor, $insertLastUpdate, true, $curr_language, false, $id_prog, $tr_class); } } FreeQuery($QryHnd); } else { // ### caso semplice: senza "versioning" PrintSchedaField($table_name, $id, $fieldName, $field_label, $curr_field_val, $fieldType, $use_HTML_Editor, $insertLastUpdate, true, $curr_language, false, 0, $tr_class); } } } if ($forma_tabellare) { // ######################### FORMA TABELLARE ######################## ?>
".$err); if ($err) return false; else return true; } // ############################################################### // stampa stato iscrizione di un utente // ############################################################### function PrintStatus($status) { switch ($status) { case '0': $res = 'not subscribed'; break; case '1': $res = 'waiting'; break; case '2': $res = 'subscribed'; break; } return $res; } // ############################################################### // stampa un campo di una tabella // ############################################################### function PrintSchedaField($table_name, $id, $fieldName, $fieldLabel, $fieldValue, $fieldType, $use_HTML_Editor, $insertLastUpdate, $fieldWithVersions, $curr_language, $translate = true, $id_prog = 0, $tr_class=false) { if (!CheckTableFieldRight(READ_RIGHT, $table_name, $fieldName)) return; if ($fieldType == HIDE_FIELD) return; $fieldName = Trim($fieldName); if ($translate) $fieldLabel = Translate($fieldLabel); global $idx_gestione; global $curr_script_path; global $last_record; global $orderBy; global $ascDesc; global $anno_search; global $type; global $use_wawe_upload; if (!$curr_language) $curr_language = ITALIAN_LANGUAGE; //print("curr lang[$fieldName]:".$curr_language); $insertLastUpdateString = ''; if ($insertLastUpdate) $insertLastUpdateString = "&last_update=T"; // ******************************************** // se il campo di tipo MEMO allora tronco dopo n caratteri // ******************************************** if ($fieldType == MEMO_FIELD) $fieldValue = CutString($fieldValue, 1000); // ******************************************** // se il campo NON E' di tipo HTML allora trasformo gli accopo in
// ******************************************** if ( (!$idx_gestione) && ( ( ($fieldWithVersions) && (GetHtmlProperty($table_name, $id, $fieldName, $curr_language) == 'F') ) || ( (!$fieldWithVersions) && ($fieldType == MEMO_FIELD) ) ) ) $fieldValue = nl2br($fieldValue); $colspan = ''; // ******************************************** // campo cronologia // ******************************************** if ($fieldType == DATE_FIELD) { if ($fieldValue) $fieldValue = PrintChrono($fieldValue); $colspan = 'colspan="3"'; } // ******************************************** // campo cronologia singola // ******************************************** if ($fieldType == SINGLE_DATE_FIELD) { if ($fieldValue) $fieldValue = PrintChrono($fieldValue); } // ******************************************** // campo orario // ******************************************** if ($fieldType == TIME_FIELD) { $colspan = 'colspan="3"'; } // ******************************************** // campo x dati utente // ******************************************** if ($fieldType == USER_FIELD) { if ($fieldValue) { $user_name1 = GetFieldValue($fieldValue, TBL_UTENTI, 'NOME'); $user_name2 = GetFieldValue($fieldValue, TBL_UTENTI, 'COGNOME'); if ( ($user_name1 != SIMPLE_SQL_EOF) && ($user_name2 != SIMPLE_SQL_EOF) ) $fieldValue = $user_name1 . " " . $user_name2; else $fieldValue = 'deleted user (id = ' . $fieldValue . ')'; } $colspan = 'colspan="3"'; } // ******************************************** // campo gruppo // ******************************************** if ($fieldType == GROUP_FIELD) { if ($fieldValue) $fieldValue = PrintGroup($fieldValue); $colspan = 'colspan="3"'; } // ******************************************** // campo boolean // ******************************************** if ( ($fieldName != 'VISIBLE') && ($fieldName != 'REQUESTED') && ($fieldType == BOOL_FIELD) ) $fieldValue = Translate(PrintBool($fieldValue)); // ******************************************** // campo "stato utente" // ******************************************** if ($fieldName == 'Status') { $fieldValue = PrintStatus($fieldValue); } // ******************************************** // campo visibilit // ******************************************** if ($fieldName == 'VISIBLE') { if ($fieldValue == 'T') $fieldValue = "" . Translate("visibile") . ""; else $fieldValue = "" . Translate("invisibile") . ""; } // ******************************************** // campo richiesta approvazione // ******************************************** if ($fieldName == 'REQUESTED') { if ($fieldValue == 'T') $fieldValue = "" . Translate("inviata") . ""; else $fieldValue = "" . Translate("non inviata") . ""; } $singleDate = ''; $simpleDate = ''; if ($fieldType == SINGLE_DATE_FIELD) { $singleDate = '&single=T'; $simpleDate = '&simple=T'; } if ($idx_gestione) include('gestione/field_single_gestione.inc'); else { if (!$fieldWithVersions) { if (!CheckTableField($table_name, $fieldName)) return; include('field_single.inc'); } else include('field_multiple.inc'); } } // ############################################################### // stampa il livello di accesso di un utente // ############################################################### function PrintUserLevel($level) { $SqlString = "SELECT NOME FROM " . TBL_PRIVILEGI_NOMI . " WHERE ID = " . $level; return SimpleField($SqlString); } // ############################################################### // Restituisce la directory che contiene gli script // ############################################################### function GetScriptDir() { return getcwd(); } // ############################################################### // stampa elenco schede che usano un'immagine come thumbnail // ############################################################### function PrintLinkedSkThumb($imgId, $textSize, $tableName = TBL_SCHEDE) { $SqlString = "SELECT * FROM " . $tableName . " where " . " MAIN_IMG = $imgId"; $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); if (!$err) {?>
AUDIO_DIGIT; $id_prog = $obj->ID_PROG; $additionalRole = '
'; $languages_array = explode('|', $languages[$_SESSION['PROJECT_ID']]); $num_of_languages = count($languages_array); for ($idx = 0; $idx < $num_of_languages; $idx++) { $audio_grammar = GetSpecialFieldValue($id_prog, TBL_LINKS, 'AUDIO_GRAMMAR', $languages_array[$idx], true); $audio_text = GetSpecialFieldValue($id_prog, TBL_LINKS, 'AUDIO_TEXT', $languages_array[$idx], true); if ($additionalRole) $additionalRole .= '
'; if ($audio_grammar) $additionalRole .= '
grammatica (' . $languages_array[$idx] . '): ' . $audio_grammar; if ($audio_text) $additionalRole .= '
testo audio (' . $languages_array[$idx] . '): ' . nl2br($audio_text); } if ($audio_digit) $additionalRole .= '
digit: ' . $audio_digit; if ($additionalRole) $additionalRole = "" . $additionalRole . ''; return $additionalRole; } // ############################################################### // stampa ruolo // ############################################################### function PrintRole($obj, $textSize, $role, $url, $verso) { global $use_agata_links; $versoStr = ''; if ($verso == 'INVERSO') $versoStr = " (" . Translate("inverso") . ")"; $printRole = "" . TranslateRole($role) . "" . $versoStr; $url .= "&curr_role=" . $role; $res = "" . Translate("motivo") . ": " . $printRole; //stampa dati correnti (nella versione x AGATA) if ($use_agata_links[PROJECT_ID]) $res .= PrintAGATARole($obj, $textSize); if ((CheckRight(WRITE_RIGHT, EDIT_ROLE)) && ($verso != 'INVERSO')) $res .= "

> " . Translate("modifica questo link") . "
"; return $res; } // ############################################################### // stampa links di una scheda // ############################################################### function PrintLinkedSk($id, $sk_type_master, $sk_type_detail, $textSize) { global $last_record; global $orderBy; global $ascDesc; global $use_agata_links; $targetTable = TBL_SCHEDE; if ($sk_type_detail == LINKS_SK_TYPE) $targetTable = TBL_SCHEDE; if ($sk_type_detail == LINKS_IMG_TYPE) $targetTable = TBL_GALLERY; if ($sk_type_detail == LINKS_RUB_TYPE) $targetTable = TBL_RUBRICA; if ($sk_type_detail == LINKS_PUB_TYPE) $targetTable = TBL_PUBBLICAZIONI; if ($sk_type_detail == LINKS_EXT_TYPE) $targetTable = TBL_EXTERNAL_LINKS; $SqlString = "(" . " SELECT 'NORMALE' AS VERSO, A.*, B.* FROM " . TBL_LINKS . " A, " . $targetTable . " B WHERE A.ID_SK_1 = $id AND A.TYPE_SK_1 = '$sk_type_master' AND A.TYPE_SK_2 = '$sk_type_detail' AND B.ID = A.ID_SK_2" . " ) UNION (" . " SELECT 'INVERSO' AS VERSO, A.*, B.* FROM " . TBL_LINKS . " A, " . $targetTable . " B WHERE A.ID_SK_2 = $id AND A.TYPE_SK_2 = '$sk_type_master' AND A.TYPE_SK_1 = '$sk_type_detail' AND B.ID = A.ID_SK_1" . " )"; if ($sk_type_detail == LINKS_SK_TYPE) $SqlString .= " ORDER BY ALPHA_ID"; if ($sk_type_detail == LINKS_EXT_TYPE) $SqlString .= " ORDER BY TIPO, PRIORITA, ANCHOR"; if ($sk_type_detail == LINKS_IMG_TYPE) $SqlString .= " ORDER BY ORDINAMENTO, IMG_NAME"; //print($SqlString); $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); if (!$err) {?> '; while ($obj = FetchObj($QryHnd)) { $num_of_sk++; $verso = $obj->VERSO; $linked_id = $obj->ID; $role = $obj->ROLE; // ************************************************************ // ********** LINK VERSO SCHEDE ************ // ************************************************************ if ($sk_type_detail == LINKS_SK_TYPE) { $alpha_id = $obj->ALPHA_ID; $alpha_id_2 = $obj->ALPHA_ID_2; $url = "id=" . $id . "&type_sk_1=" . $sk_type_master . "&type_sk_2=" . LINKS_SK_TYPE . "&linked_id=" . $linked_id; PrintAbstractGivenRecord($obj, true, false, $textSize, false); $almenoUno = false; ?>
codice pagina linkata: '; $almenoUno = true; ?> codice alt. pagina linkata: SCHEDE if ( ($verso != 'INVERSO') && (CheckRight(WRITE_RIGHT, EDIT_PAGINE)) && ($sk_type_master == LINKS_SK_TYPE) ) { if ($almenoUno) echo '
'; $almenoUno = true; ?> SCHEDE if ( ($verso != 'INVERSO') && (CheckRight(WRITE_RIGHT, EDIT_RUBRICA)) && ($sk_type_master == LINKS_RUB_TYPE) ) { if ($almenoUno) echo '
'; ?>
PUBBLICAZIONI if ( (CheckRight(WRITE_RIGHT, EDIT_PAGINE)) && ($sk_type_master == LINKS_SK_TYPE) ) {?> PUBBLICAZIONI if ( (CheckRight(WRITE_RIGHT, EDIT_RUBRICA)) && ($sk_type_master == LINKS_RUB_TYPE) ) {?>
IMMAGINI if ( (CheckRight(WRITE_RIGHT, EDIT_PAGINE)) && ($sk_type_master == LINKS_SK_TYPE) ) {?>

EXTERNAL if ( (CheckRight(WRITE_RIGHT, LINKS_EXTENDED)) && ($sk_type_master == LINKS_SK_TYPE) ) {?>
EXTERNAL if ( (CheckRight(WRITE_RIGHT, LINKS_EXTENDED)) && ($sk_type_master == LINKS_RUB_TYPE) ) {?>

RUBRICA if ( (CheckRight(WRITE_RIGHT, EDIT_PAGINE)) && ($sk_type_master == LINKS_SK_TYPE) ) {?>
$lenght) { $str = substr($str, 0, $lenght); $idx = strrpos($str, " "); $str = substr($str, 0, $idx); $str = $str. " ..."; } return $str; } // ############################################################### // Abilita gli utenti attualmente selezionati alla spedizione // della prossima newsletter // ############################################################### function EnableOrDisableSelectedUsersToSendNewsletter($flag, $dateString) { global $use_rubrica_extended; $filter = BuildUpFilter(SECTION_LIST_RUBRICA, false); $additionalFrom = ''; if ( ($use_rubrica_extended[$_SESSION['PROJECT_ID']]) && (ExtendedRubricaCondition()) ) $additionalFrom = ', ' . TBL_RUBRICA_EXTENDED . ' B '; $SqlString = "SELECT DISTINCT A.ID FROM ". TBL_RUBRICA . " A " . $additionalFrom . $filter; //print($SqlString); $QryHnd = null; $array = SimpleList($SqlString, $QryHnd); if (count($array)) { //print_r($array); $string = implode(",", $array); $sqlUpdate = "UPDATE " . TBL_RUBRICA . " SET SendNewsletter = '" . $flag . "', DataIscrizione = '$dateString' WHERE ID IN (" . $string . ")"; $result = VoidQuery($sqlUpdate); //print($sqlUpdate); } } // ############################################################### // redireziona la pagina (se non sono ancora stati spediti degli header) // ############################################################### function PageRedirect($url, $fullPath = true) { /* $server_port = ''; if (isset($_SERVER['SERVER_PORT'])) $server_port = ":" . $_SERVER['SERVER_PORT']; // se il parametro fullpath falso, si assume che l'indirizzo sia // relativo all'URL corrente if (!$fullPath) { $prefix = 'http://'; // i tentativi che vengono fatti sono relativi, nell'ordine, a // un'eventuale riscrittura dell'indirizzo da un web server che // funge da gateway, quindi a seconda del nome del server e, // infine, in relazione all'IP (deh, quello ci sar!) if (array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER)) $prefix .= $_SERVER['HTTP_X_FORWARDED_HOST']; else if (array_key_exists('HTTP_HOST', $_SERVER)) $prefix .= $_SERVER['HTTP_HOST'] . $server_port; else if (array_key_exists('LOCAL_ADDR', $_SERVER)) $prefix .= $_SERVER['LOCAL_ADDR'] . $server_port; $prefix .= dirname($_SERVER['PHP_SELF']); $url = $prefix . '/' . $url; } */ header("Location: $url"); exit(1); } // ############################################################### // restituisce il valore di un dato campo di una scheda (con "versioni") // ############################################################### function GetSpecialFieldValueAttibs($id_prog) { //stampa il valore $SqlString = " SELECT ID_USER_LAST_MODIFY, ULTIMA_MODIFICA, ULTIMA_MODIFICA_TIME, VALIDITA FROM " . TBL_CAMPI . " WHERE ID_PROG = $id_prog"; //print("GetSpecialFieldValueAttibs: " . $SqlString); $obj = SimpleObj($SqlString); $id_user = $obj->ID_USER_LAST_MODIFY; $ultima_modifica = $obj->ULTIMA_MODIFICA; $ultima_modifica_time = $obj->ULTIMA_MODIFICA_TIME; $validita = $obj->VALIDITA; return $id_user . "|" . $ultima_modifica . "|" . $validita . "|" . $ultima_modifica_time; } // ############################################################### // restituisce il valore di un dato campo di una scheda (con "versioni") // ############################################################### function GetSpecialFieldValueGivenIdProg($id_prog) { return SimpleField("SELECT VALORE FROM " . TBL_CAMPI . " WHERE ID_PROG = " . $id_prog); } // ############################################################### // restituisce il valore di un dato campo di una scheda (con "versioni") // ############################################################### function GetSpecialFieldValue($id, $tn, $fn, $fver, $createIfNotExists=false) { //data odierna $dateString = GetCurrentDate(); if ($createIfNotExists) { //controlla prima se esiste un record relativo in TBL_CAMPI $SqlCountString = " SELECT COUNT(*) AS NUMERO FROM " . TBL_CAMPI . " WHERE LOWER(TABLE_NAME) = '" . strtolower($tn) . "' AND ". " FIELD_NAME = '$fn' AND ". " LINGUA = '$fver' AND ". " ID = $id AND " . " VALIDITA = 'T'"; //print("

GetSpecialFieldValue
".$SqlCountString); $numOfRecords = SimpleField($SqlCountString); //se non esiste lo crea... if ($numOfRecords == 0) { $SqlInsertString = " INSERT INTO " . TBL_CAMPI . " (ID, TABLE_NAME, FIELD_NAME, LINGUA, ID_USER_LAST_MODIFY, ULTIMA_MODIFICA) ". " VALUES " . " ($id, '".strtolower($tn)."', '$fn', '$fver', " . $_SESSION['ID_USER']. ", '" . $dateString . "')"; //print("

GetSpecialFieldValue
".$SqlInsertString); VoidQuery($SqlInsertString); } //se ne esiste pi di uno li elimino tutti tranne il pi recente (quello con id maggiore) else if ($numOfRecords > 1) { $SqlMaxIdString = "SELECT MAX(ID_PROG) FROM " . TBL_CAMPI . " WHERE LOWER(TABLE_NAME) = '" . strtolower($tn) . "' AND ". " FIELD_NAME = '$fn' AND ". " LINGUA = '$fver' AND ". " ID = '$id' AND " . " VALIDITA = 'T'"; $max_id = SimpleField($SqlMaxIdString); $SqlNotMaxIdString = "DELETE FROM " . TBL_CAMPI . " WHERE LOWER(TABLE_NAME) = '" . strtolower($tn) . "' AND ". " FIELD_NAME = '$fn' AND ". " LINGUA = '$fver' AND ". " ID = '$id' AND " . " VALIDITA = 'T'" . " AND ID_PROG != '".$max_id."'"; VoidQuery($SqlNotMaxIdString); } } //stampa il valore $SqlString = " SELECT VALORE, ID_USER_LAST_MODIFY, ULTIMA_MODIFICA FROM " . TBL_CAMPI . " WHERE LOWER(TABLE_NAME) = '".strtolower($tn)."' AND ". " FIELD_NAME = '$fn' AND ". " LINGUA = '$fver' AND ". " ID = $id AND " . " VALIDITA = 'T'"; //print("

GetSpecialFieldValue $tn, $fn: " . $SqlString . "
"); $obj = SimpleObj($SqlString); $valore=''; if (is_object($obj)) { $valore = $obj->VALORE; $id_user = $obj->ID_USER_LAST_MODIFY; $ultima_modifica = $obj->ULTIMA_MODIFICA; //se non definito l'utente dell'ultima modifica lo setta... if ( (!$id_user) && (isset($_SESSION['ID_USER'])) ) { $SqlInsertString = " UPDATE " . TBL_CAMPI . " SET ID_USER_LAST_MODIFY = " . $_SESSION['ID_USER'] . " , ULTIMA_MODIFICA = '" . $dateString . "'" . " WHERE LOWER(TABLE_NAME) = '".strtolower($tn)."' AND ". " FIELD_NAME = '$fn' AND ". " LINGUA = '$fver' AND ". " ID = $id"; VoidQuery($SqlInsertString); } } return $valore; } // ############################################################### // restituisce il valore di un dato campo di una scheda // ############################################################### function GetFieldValue($id, $tn, $fn) { $SqlString = "SELECT $fn FROM $tn WHERE ID = $id"; //print("GetFieldValue: " . $SqlString); return SimpleField($SqlString); } // ############################################################### // stampo dati di un utente // ############################################################### function PrintUserData($id) { $res = ''; if (!$id) return $res; $SqlString = "SELECT * FROM " . TBL_UTENTI. " WHERE ID = $id"; $obj = SimpleObj($SqlString); if (is_object($obj)) { $nome = $obj->NOME; $cognome = $obj->COGNOME; $res = $nome . " " . $cognome; } else $res = 'user deleted
[id: ' . $id . ']'; return $res; } // ############################################################### // stampa i diritti di un utente // ############################################################### function PrintUserRight($id_utente) { global $last_record; global $orderBy; global $ascDesc; $SqlString = "SELECT * FROM " . TBL_DIRITTI. " WHERE ID_UTENTE = $id_utente"; $QryHnd = null; $err = SetupQuery($SqlString, $QryHnd); $count = 0; if (!$err) { ?> ID_GRUPPO; $livello = $obj->LIVELLO; ?>
: > |
>
NOME; } // ############################################################### // controlla se un utente esiste e ne memorizza l'ID nella sessione // ############################################################### function CheckIfUserExists($login, $password) { $_SESSION['ID_USER'] = 0; $_SESSION['GROUP_USER'] = 0; $user_info = GetUserInfo($login, $password); if (is_object($user_info)) { $_SESSION['ID_USER'] = $user_info->ID; $_SESSION['NAME_USER'] = $user_info->NOME; $_SESSION['SURNAME_USER'] = $user_info->COGNOME; } } // ############################################################### // controlla se un utente registrato e ne restituisce ID e LEVEL // ############################################################### function GetUserInfo($login, $password) { //per evitare l'hakeraggio... $login = str_replace("'", "#", $login); $password = str_replace("'", "#", $password); $login = str_replace("&", "#", $login); $password = str_replace("&", "#", $password); $login = str_replace("%", "#", $login); $password = str_replace("%", "#", $password); $login = str_replace(";", "#", $login); $password = str_replace(";", "#", $password); if (USEMYSQL) $SqlString = "SELECT ID, NOME, COGNOME FROM ".TBL_UTENTI." WHERE LOGIN LIKE BINARY '$login' AND PWD LIKE BINARY '$password'"; else $SqlString = "SELECT ID, NOME, COGNOME FROM ".TBL_UTENTI." WHERE LOGIN LIKE '$login' AND PWD LIKE '$password'"; //print($SqlString); return SimpleObj($SqlString); } // ############################################################### // se un utente registrato scrive i suoi dati nella sessione // ############################################################### function CheckUser($id_utente, $id_gruppo) { $_SESSION['LEVEL_USER'] = 0; $_SESSION['GROUP_USER'] = 0; $_SESSION['ALPHA_ID_FILTER_USER'] = ''; $SqlString = " SELECT A.LIVELLO, B.ALPHA_ID_FILTER FROM " . TBL_DIRITTI. " A, " . TBL_PRIVILEGI_NOMI . " B " . " WHERE A.ID_UTENTE = $id_utente " . " AND A.ID_GRUPPO = $id_gruppo " . " AND A.LIVELLO = B.ID"; $livello = SimpleObj($SqlString); if ($livello) { $_SESSION['LEVEL_USER'] = $livello->LIVELLO; $_SESSION['GROUP_USER'] = $id_gruppo; $_SESSION['ALPHA_ID_FILTER_USER'] = $livello->ALPHA_ID_FILTER; } } // ########################################################### // restituisce l'ultimo ID di scheda // ############################################################### function GetMaxID($tableName) { $SqlString = "SELECT MAX(ID) AS NUMERO FROM $tableName"; $obj = SimpleObj($SqlString); return $obj->NUMERO; } // ############################################################### // restituisce il record della scheda di cui si specifica l'ID // ############################################################### function GetSchedaInfo($id_prod) { $SqlString = 'SELECT * FROM ' . TBL_SCHEDE . ' WHERE ID = ' . $id_prod; return SimpleObj($SqlString); } // ############################################################### // restituisce il record dell'immagine di cui si specifica l'ID // ############################################################### function GetImgInfo($id_img) { $SqlString = 'SELECT * FROM ' . TBL_GALLERY . ' WHERE ID = ' . $id_img; return SimpleObj($SqlString); } // ############################################################### // compone il tag delle immagini // ############################################################### function GetImgTag($imgName, $path, $additionalPath, $showLink, $substitutiveURL, $ExtIncluded, $nonDefImgName, $nonDisImgName, $alt, $className = '') { global $projects_path; global $images_path_big; $alt = strip_tags($alt); /* print("
imgName: " . $imgName); print("
path: " . $path); print("
additionalPath: " . $additionalPath); print("
showLink: " . $showLink); print("
substitutiveURL: " . $substitutiveURL); print("
ExtIncluded: " . $ExtIncluded); print("
nonDefImgName: " . $nonDefImgName); print("
nonDisImgName: " . $nonDisImgName); print("
alt: " . $alt); print("
className: " . $className); */ if ($className) $className = ' class="' . $className . '"'; $res = ''; if ( ($imgName) && ($imgName != NEW_IMG_NAME) ) { $imgName_1 = $imgName; $imgName_2 = $imgName; $imgName_3 = $imgName; if (!$ExtIncluded) { $imgName_1 = $imgName . strtoupper(IMG_EXT); $imgName_2 = $imgName . strtolower(IMG_EXT); $imgName_3 = $imgName . strtolower(IMG_EXT); } $full_file_name_1 = $path . $additionalPath . $imgName_1; $full_file_name_2 = $path . $additionalPath . $imgName_2; $full_file_name_3 = $path . $additionalPath . $imgName_3; $exists_1 = file_exists($full_file_name_1); $exists_2 = file_exists($full_file_name_2); $exists_3 = file_exists($full_file_name_3); //print($full_file_name_1);; if (!$exists_1) { $exists_1 = file_exists ($path . $additionalPath . $imgName . strtoupper(IMG_EXT_GIF)); if ($exists_1) { $imgName_1 = $imgName . strtoupper(IMG_EXT_GIF); $full_file_name_1 = $path . $additionalPath . $imgName_1; } } if (!$exists_2) { $exists_2 = file_exists ($path . $additionalPath . $imgName . strtolower(IMG_EXT_GIF)); if ($exists_2) { $imgName_2 = $imgName . strtolower(IMG_EXT_GIF); $full_file_name_2 = $path . $additionalPath . $imgName_2; } } if (!$exists_3) { $exists_3 = file_exists ($path . $additionalPath . $imgName . strtolower(IMG_EXT_PNG)); if ($exists_3) { $imgName_3 = $imgName . strtolower(IMG_EXT_PNG); $full_file_name_3 = $path . $additionalPath . $imgName_3; } } //print("
ex1: " . $exists_1); //print("
ex2: " . $exists_2); //print("
ex2: " . $exists_3); if ($exists_1 || $exists_2 || $exists_3) { if ($exists_1) $imgName = $imgName_1; if ($exists_2) $imgName = $imgName_2; if ($exists_3) $imgName = $imgName_3; $res = "\"""; if ($showLink) { $bigPath = IMG_BIG_PATH; if ( (isset($_SESSION['LEVEL_USER'])) && (CheckRight(WRITE_RIGHT, FILE_UPLOAD)) ) $bigPath = $images_path_big[$_SESSION['PROJECT_ID']]; $big_full_file_name = $path . $bigPath . $imgName; $exists_big = file_exists($big_full_file_name); //controlla se c' da sostituire l'url if ($substitutiveURL) $res = "" . $res . ""; else { if ($exists_big) { $url = ""; $res = $url . $res . ""; } } } } else { //print("
img non trovata: " . $full_file_name_1); $res = ''; } } else $res = ''; return $res; } // ############################################################### // stampa l'abstract di una scheda avendo i suoi dati // ############################################################### function PrintAbstract($id_scheda, $tipo, $img, $titolo, $abstract, $testo, $periodo, $printAdminUrl, $printImg, $visible, $textSize, $openInNewWindow, $printSkType=true) { global $curr_script_path; global $images_path; global $images_path_prw; global $projects_path; /* if ( (CheckRight(WRITE_RIGHT, EDIT_PAGINE)) && ($visible == 'F') ) return; */ if (!$titolo) $titolo = "titolo non specificato"; if (($printImg) && ($img)) { $imgData = GetImgInfo($img); $imgFileName = $imgData->IMG_NAME; $imgString = '' . ''. '
'. GetImgTag($imgFileName, $images_path[$_SESSION['PROJECT_ID']], $images_path_prw[$_SESSION['PROJECT_ID']], true, null, false, CM_NON_DEFINITA_IMG, CM_NON_DISPONIBILE_IMG, 'ingrandisci immagine') . '
'; } else $imgString = ''; $periodoString = ''; if ($periodo) $periodoString = "
" . Translate("periodo") . ": $periodo"; $dataString = ''; if (MustPrintDate($tipo) && (!$periodoString)) { $dataString = PrintSkDate($id_scheda); if ($dataString) { $dataString = str_replace(" ", " ", $dataString); $dataString = "
[" . $dataString . "] "; } } $titolo_interno = GetFieldValue($id_scheda, TBL_SCHEDE, 'TITOLO'); $titoloInternoString = ''; if ($titolo_interno) $titoloInternoString = "
" . Translate("titolo interno") . ": $titolo_interno"; $tipoString = ''; if ( ($printSkType) && ($tipo) ) $tipoString = "" . Translate("tipo pagina") . ": $tipo"; $abstractString = ''; /* if ($abstract) $abstractString = $abstract; else $abstractString = CutString($testo); $abstractString = strip_tags($abstractString); if (!$abstractString) $abstractString = "" . Translate("nessun contenuto") . ""; if ($abstractString) $abstractString = "
" . $abstractString; */ ?> <?=Translate('modifica la scheda')?> 
' . $anchor . ''; $descrString = ''; if ($descr) $descrString = '
' . nl2br($descr); $tipoString = ''; if ($tipo) $tipoString = '
(' . $tipo . ')'; $prioritaString = ''; if ($priorita) $prioritaString = '
priorità:' . $priorita; $targetString = ''; if ($target) $targetString = '
target:' . $target; ?> ' . Translate('modifica la scheda'). '
'; } ?> ' . Translate('modifica la scheda'). ''; } $idString = ''; if ($imgId) $idString = '
' . Translate('id'). ': ' . $imgId; $didascaliaString = ''; if ($didascalia) $didascaliaString = '
' . nl2br($didascalia); $imgNameString = ''; if ($imgName) $imgNameString = '
' . Translate('nome file'). ': ' . $imgName; $categoriaString = ''; if ($categoria) $categoriaString = '
' . Translate('categoria'). ': ' . $categoria; ?>   ' . Translate('modifica la scheda') . '
'; } $titoloString = ''; if ($titolo) $titoloString = 'titolo: ' . $titolo; $autoriString = ''; if ($autori) $autoriString = '
autori: ' . $autori; $collocString = ''; if ($colloc) $collocString = '
rivista/collocazione: ' . $colloc; $dataString = ''; if ($data1) $dataString = '
data: ' . PrintChronoInterval($data1, $data2); ?> ID; $img = $obj->MAIN_IMG; $titolo = GetSpecialFieldValue($id_scheda, TBL_SCHEDE, 'TITOLO_DA_STAMPARE', $first_language); $abstract = GetSpecialFieldValue($id_scheda, TBL_SCHEDE, 'ABSTRACT', $first_language); $testo = GetSpecialFieldValue($id_scheda, TBL_SCHEDE, 'TESTO', $first_language); $periodo = GetSpecialFieldValue($id_scheda, TBL_SCHEDE, 'PERIODO', $first_language); $visible = $obj->VISIBLE; $tipo = $obj->TIPO; $tipo_titolo = GetFieldType($tipo, 'TITOLO_DA_STAMPARE'); if ($tipo_titolo == "HIDE_FIELD") $titolo = $tipo; PrintAbstract($id_scheda, $tipo, $img, $titolo, $abstract, $testo, $periodo, $printAdminUrl, $printImg, $visible, $textSize, $openInNewWindow, $printSkType); } // ############################################################### // restituisce il tipo di un campo definito in projects.inc dato il suo nome // ############################################################### function GetFieldType($tipo, $nome_campo) { global $sk_field_names; global $sk_field_types; if (isset($sk_field_names[$_SESSION['PROJECT_ID']][$tipo])) { $field_names_array = explode('|', $sk_field_names[$_SESSION['PROJECT_ID']][$tipo]); $field_types_array = explode('|', $sk_field_types[$_SESSION['PROJECT_ID']][$tipo]); for($idx = 0; $idx < count($field_names_array); $idx++) { if ($field_names_array[$idx] == 'TITOLO_DA_STAMPARE') { $tipo = $field_types_array[$idx]; return $tipo; } } } return ''; } // ############################################################### // stampa l'abstract di una voce di rubrica avendo il suo record // ############################################################### function PrintRubricaAbstractGivenRecord($obj, $printAdminUrl, $textSize, $openInNewWindow) { $extId = $obj->ID; $nomeCognome = $obj->NomeCognome; $nome = $obj->Nome; $cognome = $obj->Cognome; if (!isset($use_united_nome_cognome)) $use_united_nome_cognome=array(); if (!array_key_exists($_SESSION['PROJECT_ID'],$use_united_nome_cognome)) $nomeCognome = $nome . ' ' . $cognome; PrintRubricaAbstract($extId, $nomeCognome, $printAdminUrl, $textSize, $openInNewWindow); } // ############################################################### // stampa l'abstract di un'immagine avendo il suo record // ############################################################### function PrintImageAbstractGivenRecord($obj, $printAdminUrl, $textSize, $openInNewWindow) { global $languages; $languages_array = explode('|', $languages[$_SESSION['PROJECT_ID']]); $first_language = 'it'; if (count($languages_array)) $first_language = $languages_array[0]; $imgId = $obj->ID; $imgName = $obj->IMG_NAME; $didascalia = GetSpecialFieldValue($imgId, TBL_GALLERY, 'DIDASCALIA', $first_language); $categoria = GetSpecialFieldValue($imgId, TBL_GALLERY, 'CATEGORIA', $first_language); PrintImageAbstract($imgId, $imgName, $didascalia, $categoria, $printAdminUrl, $textSize, $openInNewWindow); } // ############################################################### // stampa l'abstract di un link esterno avendo il suo record // ############################################################### function PrintExtLinkAbstractGivenRecord($obj, $printAdminUrl, $textSize, $openInNewWindow) { $extId = $obj->ID; $tipo = $obj->TIPO; $anchor = $obj->ANCHOR; $url = $obj->URL; $descr = $obj->DESCRIZIONE; $priorita = $obj->PRIORITA; $target = $obj->TARGET; PrintExtLinkAbstract($extId, $tipo, $anchor, $url, $descr, $priorita, $target, $printAdminUrl, $textSize, $openInNewWindow); } // ############################################################### // stampa l'abstract di un'immagine avendo il suo record // ############################################################### function PrintPubblAbstractGivenRecord($obj, $printAdminUrl, $textSize, $openInNewWindow) { $pubId = $obj->ID; $titolo = $obj->TITOLO; $autori = $obj->AUTORI; $colloc = $obj->RIVISTA_COLLOCAZIONE; $data1 = $obj->DATA1; $data2 = $obj->DATA2; PrintPubblAbstract($pubId, $titolo, $autori, $colloc, $data1, $data2, $printAdminUrl, $textSize, $openInNewWindow); } // ############################################################### // gestione rubrica estesa: stampa azioni // ############################################################### function PrintActions($id_rubrica, $editable) { global $use_rubrica_extended; global $last_record; global $orderBy; global $ascDesc; if (!$use_rubrica_extended[$_SESSION['PROJECT_ID']]) return; $SqlString = "SELECT * FROM " . TBL_RUBRICA_EXTENDED. " WHERE ID_RUBRICA = $id_rubrica"; $QryHnd = null; //print($SqlString); $err = SetupQuery($SqlString, $QryHnd); if (!$err) { while ($obj = FetchObj($QryHnd)) { $id_azione = $obj->ID; $azione = $obj->AZIONE; $esito = $obj->ESITO; $data1 = $obj->DATA1; $data2 = $obj->DATA2; $note = $obj->NOTE; $url = $obj->URL; $data = PrintChronoInterval($data1, $data2); if ($azione) $azione = " - " . Translate('azione') . ": " . $azione . ""; if ($esito) $esito = " - " . Translate('esito') . ": " . $esito . ""; if ($note) $note = "
" . Translate('note') . ":
" . nl2br(CutString($note)); if ($url) $url = "
" . $url . ""; ?> > | > ATTENZIONE: la directory non ha i permessi di scrittura;
per impostazioni di sicurezza non stato possible modificarli.
'; else chmod($directory,0777); } } else { if ($safe_mode) $safe_mode_warning='
ATTENZIONE: la directory non esiste;
per impostazioni di sicurezza non stato possible crearla.
'; else { if (@mkdir($directory)) chmod($directory,0777); else $safe_mode_warning='
ATTENZIONE: vi è un errore nel percorso;
controllare i vari PATH in "admin -> utenti & privilegi -> Gruppi di lavoro".
'; } } } return $safe_mode_warning; } function resetSectionMask() { $_SESSION['SECTION_MASK']='00000000000|100000|000000'; } function setSectionMask($key,$value) { $section_mask_length=strlen($_SESSION['SECTION_MASK']); $section_mask_array=preg_split('//',$_SESSION['SECTION_MASK']); unset($section_mask_array[0]); unset($section_mask_array[$section_mask_length+1]); $section_mask_array=array_values($section_mask_array); $section_mask_array[$key]=$value; $_SESSION['SECTION_MASK']=implode($section_mask_array); } function getSectionMask($key) { $section_mask_length=strlen($_SESSION['SECTION_MASK']); $section_mask_array=preg_split('//',$_SESSION['SECTION_MASK']); unset($section_mask_array[0]); unset($section_mask_array[$section_mask_length+1]); $section_mask_array=array_values($section_mask_array); return $section_mask_array[$key]; } Fatal error: Call to undefined function GetFieldValue() in /var/www/vhosts/ursusbiliardi.com/httpdocs/_dbsite_include.inc on line 79