header('Content-type: text/html; charset=iso-8859-1'); //
echo "";
$vars = array_merge($HTTP_POST_VARS,$HTTP_GET_VARS);
//$tipo = $_GET['tipo'];
$uid=$vars[uid];
$doc=$vars[doc];
$id=$vars[id];
$height=$vars[height];
$width=$vars[width];
$scroll=$vars[scroll];
include_once 'includes/pnAPI.php';
pnInit();
list($dbconn) = pnDBGetConn();
header('Content-type: text/html; charset=iso-8859-1'); //
$non_attivo=" Per la visualizzazione è necessario completare la procedura, attiva il servizio collegandoti alla sezione 'Servizi dottor Lex' su www.dottorlex.it.";
$ok=0;
$result = $dbconn->Execute("SELECT stato FROM servizi where uid=$uid and tipo='$doc'");
if ($result!=NULL) {
$row = $result->GetRowAssoc(false);
if ( $row[stato]==2 ) $ok=1;
}
if ($ok!=1) echo $non_attivo;
if ($doc=="faq0" and $ok==1) freeFAQ();
if ($doc=="news0" and $ok==1) freeNEWS();
if ($doc=="faq" and $ok==1) FAQ();
if ($doc=="news" and $ok==1)NEWS();
/////////////////////////////////////////////////////////////////
function freeNEWS(){
global $dbconn;
$result = $dbconn->Execute("SELECT fonti_normative,argomento,pn_sid FROM md_stories order by pn_time desc LIMIT 0,3");
$content="";
while(!$result->EOF) {
$row = $result->GetRowAssoc(false);
$content.="• $row[fonti_normative] - $row[argomento] ";
$result->MoveNext();
}
//$content=str_replace("'", "\'", $content);
$mmmm="";
//include ("scorre_o.php");
}
///////////////////////////////////////////////////////////////////////
function NEWS(){
//visualizzo 3 FAQ
global $dbconn;
global $uid;
global $id;
$numero_news=0;
global $scroll;
$result = $dbconn->Execute("select numeronews from utenti_profilo where uid=$uid");
$row = $result->GetRowAssoc(false);
$numero_news=$row[numeronews];
if ($id!="") $and="and pn_sid=$id";
$result = $dbconn->Execute("SELECT fonti_normative,argomento,pn_sid,pn_bodytext,pn_time FROM md_stories where 1=1 $and order by pn_time desc LIMIT 0,$numero_news");
$content="";
while(!$result->EOF) {
$row = $result->GetRowAssoc(false);
$testodoc=LinkTesto($row[pn_sid]);
$piu="modules.php?op=modload&name=News&file=article&sid=$row[pn_sid]&mode=thread&order=0&thold=0";
if ($id!="") {$testodoc=LinkTesto($row[pn_sid]); include ("esterni/news.php");}
else $content.="• $row[fonti_normative] - $row[argomento]
";
$result->MoveNext();
}
$mmmm="";
else echo $content;
}
//////////////////////////////////////////////////////////////////////
function freeFAQ(){
//visualizzo 3 FAQ
global $dbconn;
$query = "SELECT pn_question,idtermine,pn_id,pn_id_cat FROM md_faqanswer left join termini on idtermine=pn_id_cat order by data_stesura desc, pn_id desc LIMIT 0,3";
$result = $dbconn->Execute($query);
$content="";
while(!$result->EOF) {
$row = $result->GetRowAssoc(false);
$content.=" • $row[pn_question]";
$result->MoveNext();
}
//$content=str_replace("'", "\'", $content);
$mmmm="";
}
///////////////////////////////////////////////////////////////////////
function FAQ(){
global $dbconn;
global $id;
global $uid;
global $scroll;
if ($id!="") $and="and pn_id=$id";
if ($uid!="") $and.=" and u.uid=$uid";
$query = "SELECT pn_question,idtermine,pn_id,pn_id_cat,pn_answer FROM uidfaq u,md_faqanswer f left join termini on idtermine=pn_id_cat where u.idfaq=f.pn_id $and";
$result = $dbconn->Execute($query);
$content="";
while(!$result->EOF) {
$row = $result->GetRowAssoc(false);
if ($id!="") include ("esterni/faq.php");
else $content.="• $row[pn_question]
";
$result->MoveNext();
}
$mmmm="";
else echo $content;
}
function LinkTesto($sid) {
$rr="";
global $dbconn;
$query="select f.tipoFile,f.nomeFile,f.noteFile,d.idfile from DocumentiFile d,file f where d.idfile=f.idfile and tipo='news' and testodeldoc like '%>>%' and iddocumento=$sid";
$result = $dbconn->Execute($query);
$query2="select riferimento, note from riferimentiesterni where iddocumento=$sid and tipo='news' and note like '%>>%'";
$result2 = $dbconn->Execute($query2);
if ($result != NULL){
if ($result->PO_RecordCount()>0){
$row = $result->GetRowAssoc(false);
return "allegati\\$row[idfile].$row[tipofile]";
}
}
if ($result2 != NULL){
if ($result2->PO_RecordCount()>0){
$row = $result2->GetRowAssoc(false);
return "$row[riferimento]";
}
}
return "";
}
?>