$maxchar){ break; }else{ $newtext=$newtext." ".$split[$i]; $i++; } } if (strlen($text) < strlen($newtext)){ return $newtext; } else{ return $newtext." ..."; } } function notizia($row, $field, $tag_title, $title_link, $lung_abstract, $w_thumb='150', $h_thumb='120', $bg_color='FFFFFF', $hiddenphoto=''){ if (is_array($row)){ $f=explode(',',$field); $s.=custom_categoria($row['categoria'],'start'); $s.=custom_sub_categoria($row['sottocat'],'start'); // verifica se l'immagine si trova nella vecchia libreria o nella nuova e crea il giusto url $pos = strpos($row['immagine'], '/'); if ($pos === false) { $myimg = "/upload/foto/$row[immagine]"; } else{ $myimg = "/upload/immagini/$row[immagine]"; } foreach ($f as $key => $value) { switch ($value) { case 'titolo': if ($title_link==true){ $s.="<$tag_title>". $row['titolo'] .""; } else{ $s.="<$tag_title>". htmlspecialchars_decode($row['titolo']) .""; } break; case 'tipo': if ($row['tipo'] != ''){ $s.="".$row['tipo'].""; } break; case 'luogo': //if ($row['luogo']!='Orvieto' and $row['luogo']!='orvieto'){ $myluogo = get_luogo_nome_from_id($row['luogo']); if ($myluogo != ''){ $s.=" ".$myluogo.""; } //} break; case 'data': $s.="
".utf8_encode(strftime('%A %e %B %Y',strtotime($row['data_pubblicazione'])))."
"; break; case 'abstract': if (!empty($row['abstract'])){ $s.="
".html_entity_decode(strip_tags($row['abstract']),ENT_QUOTES)."
"; } else{ // recupero impostagione globale settata su impostazioni $var = mysql_fetch_array(mysql_query("SELECT * FROM ak_impostazioni WHERE nome = 'abstract-automatico' ")); if ($var['valore'] == 'checked'){ $t=strlen($row['titolo']); if ($t>'85'){$lung_abstract='180';} $s.="
".limit_text(strip_tags(html_entity_decode($row['testo'],ENT_QUOTES)),$lung_abstract)."
"; } } break; case 'abstract_field': $s.="
".html_entity_decode($_POST['abstract'],ENT_QUOTES)."
"; break; case 'more': $s.="
...
"; break; case 'testo': $s.=make_testo($row); //$s.="
$row[testo]
"; break; case 'facebook': $s.=facebook_likebutton($row); break; case 'facebook-easy': $s.= " "; break; case 'twitter': //horizontal - vertical $s.="Tweet"; break; case 'twitter-easy': //horizontal - vertical $s.= " "; break; case 'google': $s.=""; break; case 'thumb': if ($row['immagine']!=''){ $s.=" \"$row[titolo]\""; } break; case 'home-footer': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); if ($nrcomm== '0'){$nrcomm='';} $simbolo = "".categora_layout("$row[categoria]",'simbolo','1').""; $dc=" "; //$commenti = " $nrcomm "; $s.=""; break; case 'thumb-responsive': // if ($row['immagine']!=''){ // $s.="\"$row[titolo]\""; // } $s.=''; break; case 'immagine': if (file_exists($_SERVER['DOCUMENT_ROOT']."/upload/foto/$row[immagine]") and $row['immagine']!=''){ $s.=" \"$row[titolo]\""; } else{ $s.=''; } break; case 'immagine-carosello': if (file_exists($_SERVER['DOCUMENT_ROOT']."/upload/foto/$row[immagine]") and $row['immagine']!=''){ $s.=" \"$row[titolo]\""; } $s.=''; break; case 'categoria': $cat = $row[categoria]; $s.="
".categora_layout($cat,'simbolo','1')." $cat
"; break; case 'autore': if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } break; case 'footer': $res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); $nrcomm=mysql_num_rows($res); //if ($row['categoria']=='redazionali'){$c=' redaz';} $s.="
$row[categoria] ".strftime('%e %B %Y %H:%M',$row['data'])."
"; // Commenti ($nrcomm) //$c=''; break; case 'commenti': /* $res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); $nrcomm=mysql_num_rows($res); $s.=" "; */ break; case 'commenti_numero': /* $res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); $nrcomm=mysql_num_rows($res); $s.=" $nrcomm "; */ break; case 'date_comments': /* $res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); $nrcomm=mysql_num_rows($res); $s.="
".strftime('%e/%m/%Y %H:%M',$row['data'])." $nrcomm
"; */ break; case 'view': // il terzo parametro della funzione aggiunge un numero arbitrario di view $s.="
".views_show($row,'100','300')."
"; break; case 'correlate': $result = mysql_query("SELECT * FROM notizie where correlata='$row[id]' and status='online' and sottocat!='correlata-video' and sottocat!='correlata-foto' order by data desc"); while ($row2 = mysql_fetch_array($result)) { $s.="

$row2[titolo]"; if ($row2['autore']!=""){ $s.=" di ".$row2['autore'].""; } $s.="

"; } break; case 'correlate-contenuto': // usata per fotonotizia $result = mysql_query("SELECT * FROM notizie where correlata='$row[id]' and status='online'"); while ($row2 = mysql_fetch_array($result)) { $s.="

$row2[titolo]

"; if (file_exists($_SERVER['DOCUMENT_ROOT']."/upload/foto/$row2[immagine]") and $row2['immagine']!=''){ $s.=" \"$row2[titolo]\""; } $s.=''; $s.=make_testo($row2); } break; case 'correlata-foto-video': $result = mysql_query("SELECT * FROM notizie where correlata='$row[id]' and status='online' and (sottocat='correlata-video' or sottocat='correlata-foto') order by data desc"); $row_cnt = mysql_num_rows($result); if ($row_cnt == 2){$s.="
";} while ($row2 = mysql_fetch_array($result)) { // se c'è solo una correlata con video if ($row_cnt == 1 and $row2['sottocat']=='correlata-video'){ $s.="

VIDEO OrvietoTV"; $s.="

"; } // se c'è una correlata foto if ($row_cnt == 1 and $row2['sottocat']=='correlata-foto'){ $s.="

PHOTOGALLERY"; $s.="

"; } // se c'è sia foto che video if ($row_cnt == 2){ if($row2['sottocat']=='correlata-video'){ $s.="

VIDEO OrvietoTV

"; } if($row2['sottocat']=='correlata-foto'){ $s.="

PHOTOGALLERY

"; } } } if ($row_cnt == 2){$s.="
";} break; case 'pdf': $s.=" "; break; case 'advertising': if ($row['sottocat'] == 'sponsor'){ $s.="
advertising
"; } break; case 'media-object-1': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); $s.="
"; $s.= advertising('top', $row); if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $luogo=" ".$myluogo.""; } $s.= " $luogo \"$row[titolo]\"
<$tag_title class=\"media-heading\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } $s.= advertising('bottom', $row); $s.="
"; break; case 'media-object-2': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); $s.="
"; $s.= advertising('top', $row); if ($row['tipo'] != ''){ $s.=" $row[tipo]"; } if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } $s.= "\"\"
<$tag_title class=\"media-heading mo2\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } $s.= advertising('bottom', $row); $s.="
"; break; case 'media-object-3': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); $s.="
"; $s.= advertising('top', $row); if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } $s.= " \"\"
<$tag_title class=\"media-heading\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } $s.= advertising('bottom', $row); $s.="
"; break; case 'media-object-4': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); $s.="
"; $s.= advertising('top', $row); if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } $s.= " \"\"
<$tag_title class=\"media-heading\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } $s.= advertising('bottom', $row); $s.="
"; break; case 'media-object-home-centro': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } $s.= " \"\"
<$tag_title class=\"media-heading\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } break; case 'media-object-layout-2': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); if ($row['luogo']!='' and $row['luogo']!=''){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } if (!empty($row['abstract'])){ $abs.="
".html_entity_decode(strip_tags($row['abstract']),ENT_QUOTES)."
"; } else{ //$abs="
".limit_text(strip_tags(html_entity_decode($row['testo'],ENT_QUOTES)),200)."
"; } $correlate = correlate_view ($row['id']); $s.= " \"\"
<$tag_title class=\"media-heading\">".$row['titolo']." $abs $correlate
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } break; case 'media-object-layout-3': //$res = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$row[id]' and status=1"); //$nrcomm=mysql_num_rows($res); if ($row['luogo']!='Orvieto' and $row['luogo']!='orvieto'){ $myluogo = get_luogo_nome_from_id($row['luogo']); $s.=" ".$myluogo.""; } if (!empty($row['abstract'])){ $abs.="
".html_entity_decode(strip_tags($row['abstract']),ENT_QUOTES)."
"; } else{ $abs="
".limit_text(strip_tags(html_entity_decode($row['testo'],ENT_QUOTES)),100)."
"; } $correlate = correlate_view ($row['id']); $s.= " \"\"
<$tag_title class=\"media-heading\">".$row['titolo']."
"; if ($row['autore']!=""){ $s.="
di ".$row['autore']."
"; } $s.= "$correlate"; break; } } $s.=custom_sub_categoria($row['sottocat'],'end'); $s.=custom_categoria($row['categoria'],'end'); return $s; /* $s= "

$row[titolo]

"; */ } } function correlate_view ($id){ // correlate $result = mysql_query("SELECT * FROM notizie where correlata='$id' and status='online' and (sottocat!='correlata-video' or sottocat!='correlata-audio') order by data desc"); while ($row2 = mysql_fetch_array($result)) { $s.="

$row2[titolo]"; if ($row2['autore']!=""){ $s.=" di ".mb_convert_encoding($row2['autore'], "UTF-8", "HTML-ENTITIES").""; } $s.="

"; } return $s; } function custom_categoria($categoria,$se){ if ($categoria=='redazionali' and $se=='start'){ $i= "
"; } if ($categoria=='redazionali' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='cultura' and $se=='start'){ $i= "
"; } if ($categoria=='cultura' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='eventi' and $se=='start'){ $i= "
"; } if ($categoria=='eventi' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='sapori' and $se=='start'){ $i= "
"; } if ($categoria=='sapori' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='sociale' and $se=='start'){ $i= "
"; } if ($categoria=='sociale' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='ambiente' and $se=='start'){ $i= "
"; } if ($categoria=='ambiente' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='politica' and $se=='start'){ $i= "
"; } if ($categoria=='politica' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='cronaca' and $se=='start'){ $i= "
"; } if ($categoria=='cronaca' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='economia' and $se=='start'){ $i= "
"; } if ($categoria=='economia' and $se=='end'){ $i= "
"; } ///////// if ($categoria=='sport' and $se=='start'){ $i= "
"; } if ($categoria=='sport' and $se=='end'){ $i= "
"; } return $i; } function categora_layout($categoria,$tipo,$dimensione){ $categoria_layout = array( "cultura" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#5591DE", ), "eventi" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#329C9C" ), "sociale" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#DEC341" /*DEC341*/ ), "politica" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#7A3927" /*DE8909*/ ), "cronaca" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#E53628" ), "economia" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#D73285" ), "sport" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#E4757A" ), "opinioni" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#cccccc" ), "sapori" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#C7DE4E" /**/ ), "ambiente" => array( "simbolo" => htmlentities("",ENT_COMPAT), "colore" => "#DE8909" ) ); if ($tipo=='simbolo'){ return html_entity_decode($categoria_layout[$categoria]['simbolo']); } if ($tipo == 'colore'){ return $categoria_layout[$categoria]['colore']; } } function custom_sub_categoria($sub_categoria,$se){ if ($sub_categoria=='orvieto.tv' and $se=='start'){ $i= "
"; } if ($sub_categoria=='orvieto.tv' and $se=='end'){ $i= "
"; } if ($sub_categoria=='elezioni' and $se=='start'){ $i= "
"; } if ($sub_categoria=='elezioni' and $se=='end'){ $i= "
"; } return $i; } function href_print($row){ //$s="/it/index.php?id=$row[id]"; $dd=explode(' ',$row['data_pubblicazione']); $d=explode('-',$dd[0]); $s="/$row[categoria]/".$d[0]."/".$d[1]."/".$d[2]."/$row[nomepagina].html"; return $s; } function facebook_likebutton($row){ $s=""; return $s; } function id_verify($id){ $s=true; if (!is_numeric($id)){ $s=false; } if ($s==true){return $id;} else{ //echo "Il Contenuto che stai cercando non è disponibile"; return false; } } function author($a){ // //$var = mysql_fetch_array(mysql_query("SELECT * FROM ak_user WHERE utente='$a' ")); // if ($var['email']!=''){ // $s="di $var[email]"; // } // else{$s="di $a";} // return $s; } function show_comments($id_notizia){ $result = mysql_query("SELECT * FROM notizie_commenti WHERE id_notizia='$id_notizia' and status=1 order by data asc"); $i = 0; while ($row = mysql_fetch_array($result)){ if($row['testo_modificato']!=''){$testo=$row['testo_modificato'];} else{$testo=$row['testo'];} $testo=html_entity_decode($testo, ENT_COMPAT); $i++; echo"
Pubblicato da $row[autore] il ".strftime("%d %B %G alle ore %R",strtotime($row['data']))."
".nl2br(html_entity_decode($testo,ENT_QUOTES))."
"; } } function commento_inserito(){ $_POST==''; unset($_SESSION['mypost']); echo"

Il commento è stato correttamente memorizzato. Per ora è in attesa di valutazione da parte della redazione. Sarà pubblicato nel più breve tempo possibile.

Grazie per aver utilizzato i nostri servizi.

"; } function show_category($var){ $result = mysql_query("SELECT * FROM ak_conf_categoria WHERE status='visibile' order by posizione asc "); $s="
"; return $s; } function truncate_text ($text, $needle, $occurr, $part, $offset=0){ // $part: top/bottom $result = array(); for($i = $offset; $i= $i){ $i = $offset; $result[] = $offset; } } } $adv_position=$result[($occurr-1)]+strlen($needle); $top = substr($text, 0, $adv_position); $bottom = substr($text, $adv_position); if ($part=='top' and count($result)>=$occurr){ return $top; } elseif ($part=='top' and count($result)<$occurr){ return $text; } elseif ($part=='bottom' and count($result)>=$occurr){ return $bottom; } elseif ($part=='bottom' and count($result)<$occurr){ return ''; } } function preferiti($id){ $result = mysql_query("SELECT * FROM notizie_preferite WHERE id_notizia='$id' and cookie_utente='".$_COOKIE['_on_like']."'"); $n=mysql_num_rows($result); if ($n==1){ echo "
  • Aggiungi
  • Elimina
  • "; } else{ echo "
  • Aggiungi
  • Elimina
  • "; } // echo " //
  • Elimina
  • //
  • Aggiungi
  • // "; } function make_testo($var){ $ntesto = html_entity_decode($var['testo'], ENT_QUOTES); //$var['testo']=$var['testo']; $i= "
    "; $i.= truncate_text($ntesto, '

    ', '3', 'top' ); if ($var['categoria']!='redazionali' and $var['adv_inside']=='1'){ $i.= " "; } $i.= truncate_text($ntesto, '

    ', '3', 'bottom' ); $i.= "
    "; return $i; } function layout_detect(){ $result = mysql_query("SELECT * FROM ak_layout"); $c=1; while ($row = mysql_fetch_array($result)){ $t[$c]=$row['valore']; $c++; } return $t; } function orvietonews_story(){ //ciclo per anno $anno=date("Y",time()); $mese=date("m",time()); $giorno=date("d",time()); $mese2=strftime("%B",time()); echo"

    accadeva il $giorno $mese2

    "; $anno=$anno-1; while($anno>='2002'){ echo"

    $anno

    "; $q="SELECT * FROM notizie WHERE data_pubblicazione > '$anno-$mese-$giorno 0:0:0' and data_pubblicazione<'$anno-$mese-$giorno 23:59:59'"; //echo $q; $result = mysql_query($q); while ($row = mysql_fetch_array($result)){ //echo"

    ".mb_convert_encoding($row['titolo'], "UTF-8", "HTML-ENTITIES")."

    "; echo notizia($row,'titolo,comments','h3',true,'180'); } echo"
    "; $anno=$anno-1; } } ////// controlli sulla pagina function controlli_pagina($var){ $i=true; // controllo id if($var['id']=='' and !is_numeric($var['id'])){ $i=false; } // controllo categoria if($var['categoria']!=$_GET['categoria']){$i=false;} // controllo anno if (date("Y",strtotime($var['data_pubblicazione'])) != $_GET['anno']){$i=false;} //controllo mese if (date("m",strtotime($var['data_pubblicazione'])) != $_GET['mese']){$i=false;} //controllo giorno if (date("d",strtotime($var['data_pubblicazione'])) != $_GET['giorno']){$i=false;} return $i; } /////// controlli categorire function controlli_categorie($cat){ $result = mysql_query("SELECT * FROM ak_conf_categoria"); $i=false; while ($row = mysql_fetch_array($result)){ if ($row['nome']==$cat){$i=true;} } return $i; } ////////////////// vedi anche function vedi_anche($id){ // stampa il titolo solo se ci sono correlazioni $num1 = mysql_fetch_array(mysql_query("SELECT count(*) FROM notizie_correlazioni WHERE id_notizia='$id' ")); $num2 = mysql_fetch_array(mysql_query("SELECT * FROM notizie_correlazioni WHERE correlata='$id' ")); if ($num1['0']>0 or $num2>0){ echo "

    Vedi Anche

    "; } //correlazione diretta $s="SELECT * FROM notizie_correlazioni WHERE id_notizia='$id'"; $result = mysql_query($s); while ($row0 = mysql_fetch_array($result)){ $var = mysql_fetch_array(mysql_query("SELECT * FROM notizie WHERE id='".$row0['correlata']."' and status='online' and data_pubblicazione"; echo notizia($var,'titolo,autore,date_comments','h3',true,'280'); echo ""; $mycorr1[]= "$row0[correlata]"; } // correlazione indiretta quando cioè riprendo una notizia che non ha correlazioni ma è stata correlata da un'altra // per prima corsa cerca la notizia primaria che ha generato la correlazione sulla notizia corrente // faccio un ciclo while perché possono esistere due o più notizie che hanno generato una correlazione con la notizia corrente $p="SELECT * FROM notizie_correlazioni WHERE correlata='$id' "; $result = mysql_query($p); while ($row1 = mysql_fetch_array($result)){ // stampa subito la notizia primaria da cui è nata la correlazione // ma solo se non è presente nel precedente array di correlazione diretta if (is_array($mycorr1)){ if (!in_array($row1['id_notizia'],$mycorr1)){ $var1 = mysql_fetch_array(mysql_query("SELECT * FROM notizie WHERE id='".$row1['id_notizia']."' and status='online' and data_pubblicazione"; echo notizia($var1,'titolo,autore,date_comments','h3',true,'280'); echo ""; } } // per ogni notizia primaria trovata faccio un ciclo per stamparle le correlazioni $s="SELECT * FROM notizie_correlazioni WHERE id_notizia='$row1[id_notizia]' and correlata!='$id' "; $result = mysql_query($s); while ($row = mysql_fetch_array($result)){ $mycorr2[]= "$row[correlata]"; $var2 = mysql_fetch_array(mysql_query("SELECT * FROM notizie WHERE id='".$row['correlata']."' and status='online' and data_pubblicazione"; echo notizia($var2,'titolo,autore,date_comments','h3',true,'280'); echo ""; } } } function view_insert($var){ // scrive la riga dell'avvenuta visualizzazione nella tabella notizie_views $query="INSERT INTO notizie_views (data, id_notizie, user_cookie, ip, HTTP_USER_AGENT) VALUES ( now(), '$var[id]', '".$_COOKIE["orvietonews-user"]."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."' )"; //echo $query; mysql_query($query); } function views_show($var,$periodo,$correzione=0){ // $periodo e il limite di tempo espresso in giorni entro cui fare la ricerca, se si omette la fa su tutta la tabella if($periodo==''){ $w=''; } else{ $day_ago = mktime (date("H"),date("i"),date("s"),date("m"),date("d")-10, date("Y")); $datalimit = date("Y-m-d H:i:s",$day_ago); //echo $datalimit; $w=" and data > '".$datalimit."'"; } $datalimit=time()-(86400*10); // numero di views dalla tabella news_views //$q="SELECT count(*) FROM notizie_views WHERE id_notizie='$var[id]' $w"; $nr_views = mysql_fetch_array(mysql_query($q)); // numero delle views dall tabella notizie (quelle archiviate) $nr_view_old = $var['visualizzazioni']; // totale $tot_views= $nr_views[0] + $nr_view_old + $correzione; return $tot_views; } function topnews_array($maxday_ago,$maxnews){ // restituisce un array con l'id delle ultime notizie $day_ago = mktime (date("H"),date("i"),date("s"),date("m"),date("d")-$maxday_ago, date("Y")); $datalimit = date("Y-m-d H:i:s",$day_ago); $q="SELECT id_notizie, count(*) FROM notizie_views WHERE data > '".$datalimit."' GROUP BY id_notizie ORDER BY count(*) desc LIMIT $maxnews "; $result = mysql_query($q); while ($row = mysql_fetch_array($result)){ $topnews[]=$row['id_notizie']; } return $topnews; } function luoghi ($zona, $tipo){ $luoghi = array( "orvietano" => array( "allerona" => array( "id" => "allerona", "nome" => "Allerona", "latlng" => "42.8117251,11.9719811", ), "baschi" => array( "id" => "baschi", "nome" => "Baschi", "latlng" => "42.672957,12.2131383", ), "castelgiorgio" => array( "id" => "castelgiorgio", "nome" => "Castel Giorgio", "latlng" => "42.7073034,11.9689713", ), "castelviscardo" => array( "id" => "castelviscardo", "nome" => "Castel Viscardo", "latlng" => "42.7535843,11.9963176", ), "fabro" => array( "id" => "fabro", "nome" => "Fabro", "latlng" => "42.8691793,12.0081977", ), "ficulle" => array( "id" => "ficulle", "nome" => "Ficulle", "latlng" => "42.8353892,12.0627717", ), "montecchio" => array( "id" => "montecchio", "nome" => "Montecchio", "latlng" => "42.6627093,12.2838314", ), "montegabbione" => array( "id" => "montegabbione", "nome" => "Montegabbione", "latlng" => "42.9188383,12.0875271", ), "monteleone" => array( "id" => "monteleone", "nome" => "Monteleone", "latlng" => "42.9208585,12.0447229", ), "orvieto" => array( "id" => "orvieto", "nome" => "Orvieto", "latlng" => "42.717169, 12.112658", ), "parrano" => array( "id" => "parrano", "nome" => "Parrano", "latlng" => "42.8660557,12.1051866", ), "porano" => array( "id" => "porano", "nome" => "Porano", "latlng" => "42.6875399,12.0772403", ), "sanvenanzo" => array( "id" => "sanvenanzo", "nome" => "San Venanzo", "latlng" => "42.8692696,12.2632198", ) ), "altolazio" => array( "acquapendente" => array( "id" => "acquapendente", "nome" => "Acquapendente", "latlng" => "42.7431013,11.8615616", ), "bagnoregio" => array( "id" => "bagnoregio", "nome" => "Bagnoregio", "latlng" => "42.6285658,12.0824656", ), "bolsena" => array( "id" => "bolsena", "nome" => "Bolsena", "latlng" => "42.6427174,11.9755215", ), "bomarzo" => array( "id" => "bomarzo", "nome" => "Bomarzo", "latlng" => "42.4844884,12.2419697", ), "canepina" => array( "id" => "canepina", "nome" => "Canepina", "latlng" => "42.3820357,12.2275389", ), "canino" => array( "id" => "canino", "nome" => "Canino", "latlng" => "42.4664955,11.7428787", ), "capodimonte" => array( "id" => "capodimonte", "nome" => "Capodimonte", "latlng" => "42.5479206,11.9010763", ), "caprarola" => array( "id" => "caprarola", "nome" => "Caprarola", "latlng" => "42.3232027,12.2290929", ), "carbognano" => array( "id" => "carbognano", "nome" => "Carbognano", "latlng" => "42.3244295,12.2654627", ), "castiglioneinteverina" => array( "id" => "castiglioneinteverina", "nome" => "Castiglione in Teverina", "latlng" => "42.64909,12.1960493", ), "civitelladagliano" => array( "id" => "civitelladagliano", "nome" => "Civitella d'Agliano", "latlng" => "42.6033431,12.1812259", ), "celleno" => array( "id" => "celleno", "nome" => "Celleno", "latlng" => "42.560368,12.1222215", ), "farnese" => array( "id" => "farnese", "nome" => "Farnese", "latlng" => "42.5490766,11.7224939", ), "gradoli" => array( "id" => "gradoli", "nome" => "Gradoli", "latlng" => "42.6449053,11.8508898", ), "graffignano" => array( "id" => "graffignano", "nome" => "Graffignano", "latlng" => "42.5762425,12.1943219", ), "grottedicastro" => array( "id" => "grottedicastro", "nome" => "Grotte di Castro", "latlng" => "42.6766219,11.8592772", ), "ischiadicastro" => array( "id" => "ischiadicastro", "nome" => "Ischia di Castro", "latlng" => "42.5451613,11.7573843", ), "latera" => array( "id" => "latera", "nome" => "Latera", "latlng" => "42.6287317,11.8248346", ), "lubriano" => array( "id" => "lubriano", "nome" => "Lubriano", "latlng" => "42.6374058,12.1043023", ), "marta" => array( "id" => "marta", "nome" => "Marta", "latlng" => "42.532832,11.9176191", ), "montalto" => array( "id" => "montalto", "nome" => "Montalto di Castro", "latlng" => "42.3498509,11.6038204", ), "montefiascone" => array( "id" => "montefiascone", "nome" => "Montefiascone", "latlng" => "42.5395732,12.0149075", ), "onano" => array( "id" => "onano", "nome" => "Onano", "latlng" => "42.6909354,11.8106498", ), "orte" => array( "id" => "orte", "nome" => "Orte", "latlng" => "42.4603524,12.3743498", ), "piansano" => array( "id" => "piansano", "nome" => "Piansano", "latlng" => "42.5121548,11.8276736", ), "proceno" => array( "id" => "proceno", "nome" => "Proceno", "latlng" => "42.7832863,11.7793084", ), "ronciglione" => array( "id" => "ronciglione", "nome" => "Ronciglione", "latlng" => "42.2897496,12.2051137", ), "sanlorenzonuovo" => array( "id" => "sanlorenzonuovo", "nome" => "San Lorenzo Nuovo", "latlng" => "42.6863047,11.9020803", ), "sorianonelcimino" => array( "id" => "sorianonelcimino", "nome" => "Soriano nel Cimino", "latlng" => "42.4171817,12.2250887", ), "tarquinia" => array( "id" => "tarquinia", "nome" => "Tarquinia", "latlng" => "42.2465577,11.738633", ), "tuscania" => array( "id" => "tuscania", "nome" => "Tuscania", "latlng" => "42.4196432,11.8659433", ), "valentano" => array( "id" => "valentano", "nome" => "Valentano", "latlng" => "42.5639313,11.8185525", ), "vallerano" => array( "id" => "vallerano", "nome" => "Vallerano", "latlng" => "42.3837638,12.256542", ), "vasanello" => array( "id" => "vasanello", "nome" => "Vasanello", "latlng" => "42.4165271,12.3444", ), "vetralla" => array( "id" => "vetralla", "nome" => "Vetralla", "latlng" => "42.3128255,12.0657649,", ), "vignanello" => array( "id" => "vignanello", "nome" => "Vignanello", "latlng" => "42.3830826,12.2765261", ), "viterbo" => array( "id" => "viterbo", "nome" => "Viterbo", "latlng" => "42.4224989,12.0753709", ), "vitorchiano" => array( "id" => "vitorchiano", "nome" => "Vitorchiano", "latlng" => "42.4647688,12.1668739", ) ), "altri" => array( "abbadiasansalvatore" => array( "id" => "abbadiasansalvatore", "nome" => "Abbadia San Salvatore", "latlng" => "42.8827764,11.6655545", ), "acquasparta" => array( "id" => "acquasparta", "nome" => "Acquasparta", "latlng" => "42.6884551,12.5379588", ), "alviano" => array( "id" => "alviano", "nome" => "Alviano", "latlng" => "42.5918325,12.29008", ), "attigliano" => array( "id" => "attigliano", "nome" => "Attigliano", "latlng" => "42.5162133,12.2852976", ), "castiglionedellago" => array( "id" => "castiglionedellago", "nome" => "Castiglione del Lago", "latlng" => "43.1228462,12.0268378", ), "cittadellapieve" => array( "id" => "cittadellapieve", "nome" => "Città della Pieve", "latlng" => "42.9599326,11.9981836", ), "collazzone" => array( "id" => "collazzone", "nome" => "Collazzone", "latlng" => "42.8998849,12.4323346", ), "giove" => array( "id" => "giove", "nome" => "Giove", "latlng" => "42.5104639,12.3263177", ), "guardea" => array( "id" => "guardea", "nome" => "Guardea", "latlng" => "42.6248575,12.2919613", ), "lugnanointeverina" => array( "id" => "lugnanointeverina", "nome" => "Lugnano in Teverina", "latlng" => "42.575233,12.3294653", ), "magione" => array( "id" => "magione", "nome" => "Magione", "latlng" => "43.1349673,12.073113", ), "manciano" => array( "id" => "manciano", "nome" => "Manciano", "latlng" => "42.5904546,11.5131262", ), "marsciano" => array( "id" => "marsciano", "nome" => "Marsciano", "latlng" => "42.9128593,12.3230798", ), "massamartana" => array( "id" => "massamartana", "nome" => "Massa Martana", "latlng" => "42.7749999,12.5225215", ), "montecastellodivibio" => array( "id" => "montecastellodivibio", "nome" => "Monte Castello di Vibio", "latlng" => "42.840049,12.3495378", ), "paciano" => array( "id" => "paciano", "nome" => "Paciano", "latlng" => "43.0272359,12.0375775", ), "panicale" => array( "id" => "panicale", "nome" => "Panicale", "latlng" => "43.0277486,12.0942685", ), "passignanosultrasimeno" => array( "id" => "passignanosultrasimeno", "nome" => "Passignano sul Trasimeno", "latlng" => "43.1907563,12.1226279", ), "pennainteverina" => array( "id" => "pennainteverina", "nome" => "Penna in Teverina", "latlng" => "42.4946928,12.3570905", ), "perugia" => array( "id" => "perugia", "nome" => "Perugia", "latlng" => "43.0950757,12.3452191", ), "piancastagnaio" => array( "id" => "piancastagnaio", "nome" => "Piancastagnaio", "latlng" => "42.849907,11.6800056", ), "piegaro" => array( "id" => "piegaro", "nome" => "Piegaro", "latlng" => "42.9652335,12.0799871", ), "pitigliano" => array( "id" => "pitigliano", "nome" => "Pitigliano", "latlng" => "42.6364666,11.6686205", ), "sancascianodeibagni" => array( "id" => "sancascianodeibagni", "nome" => "San Casciano dei Bagni", "latlng" => "42.8702828,11.8720602", ), "sorano" => array( "id" => "sorano", "nome" => "Sorano", "latlng" => "42.6806453,11.711664", ), "terni" => array( "id" => "terni", "nome" => "Terni", "latlng" => "42.5620909,12.592978", ), "todi" => array( "id" => "todi", "nome" => "Todi", "latlng" => "42.7798397,12.3293229", ), "tuorosultrasimeno" => array( "id" => "tuorosultrasimeno", "nome" => "Tuoro sul Trasimeno", "latlng" => "43.2060041,12.0711732", ) ) ); foreach ($luoghi[$zona] as $key => $value) { $i[$key] = $value ; $value['all']=''; foreach ($value as $key2 => $value2){ $ii[$key] = $value[$tipo]; $iii[$key] = array ('nome' => $value['nome'], 'latlng' => $value['latlng']); } } if ($zona != '' and $tipo != 'all'){ return $ii; } if ($zona != '' and $tipo == 'all'){ return $iii; } else{ return $luoghi; } } function get_luogo_nome_from_id($id){ //echo '-->'.$id.'<--'; $luoghi = luoghi('orvietano','nome'); foreach ($luoghi as $key => $value) { //echo $key; if ($id == $key){ $i = $luoghi[$id]; } } $luoghi2 = luoghi('altolazio','nome'); foreach ($luoghi2 as $key2 => $value2) { //echo $key; if ($id == $key2){ $i = $luoghi2[$id]; } } $luoghi3 = luoghi('altri','nome'); foreach ($luoghi3 as $key3 => $value3) { //echo $key; if ($id == $key3){ $i = $luoghi3[$id]; } } return $i; } function rubrica($class, $nr_news_title, $pos1, $pos2, $limit, $adv=false){ $limi = "LIMIT $limit"; //conta le notizie presenti $nrn3 = "SELECT count(*) FROM notizie WHERE status='online' and data_pubblicazione=$pos1 and posizione<=$pos2 $limi"; $nrnt3 = mysql_fetch_array(mysql_query($nrn3)); // se ci sono le notizie crea il box if ($nrnt3['0']>=1){ echo"

    "; // stampa il titolo della rubrica contenuto nel testo della notizia $result = mysql_query("SELECT * FROM notizie WHERE id='".$nr_news_title."' "); while ($row = mysql_fetch_array($result)){ echo "".strip_tags(html_entity_decode($row['testo'])); } echo"

    "; // stampa le notizie $result = mysql_query("SELECT * FROM notizie WHERE status='online' and data_pubblicazione=$pos1 and posizione<=$pos2 ORDER BY posizione asc $limi"); while ($row = mysql_fetch_array($result)){ $layout= "media-object-".$row['layout']; echo "
    "; echo notizia($row,$layout,'h3',true,'100','120','100'); echo notizia($row,'correlate, home-footer','h2',true,'280'); echo "
    "; } echo "
    "; } // se non ci sono notizie in questa posizione stampa il banner // per ora questa funzione è disattivata /* else { echo "
    "; } */ } function advertising($posto, $row){ if($row['sottocat']=='sponsor' and $posto == 'top'){ $s="
    "; } if($row['sottocat']=='sponsor' and $posto == 'bottom'){ $s="
    "; } return $s; } function impostazioni_valore ($nome){ $var = mysql_fetch_array(mysql_query("SELECT * FROM ak_impostazioni WHERE nome = '$nome' ")); return $var[valore]; } ?>