| Server IP : 89.46.109.6 / Your IP : 216.73.217.116 Web Server : Apache System : Linux hlpi1ws-c284s07.ad.aruba.it 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : ID19067310 ( 19067310) PHP Version : 5.3.29 Disable Function : system,popen,dl,passthru,proc_open,shell_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /web/htdocs/www.edizacco.it/home/pannello/ |
Upload File : |
<?php
ob_start();
@session_start();
require_once('../include/connect_db.php');
require_once('include/templates.php');
include('include/sessione.inc.php');
require_once 'include/class.ycpager.php';
$meta_title = TITLE;
$_SESSION['page'] = "comunicati";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo"$meta_title | Area Riservata"; ?></title>
<link href="css/master.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link href="css/paginazione.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function checkUncheck(check)
{
var checks = document.getElementsByName('check[]');
for(i = 0; i < checks.length; i++)
{
checks[i].checked = check.checked;
}
}
</script>
<link rel="stylesheet" href="js/sortable_table/themes/style.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript" src="js/sortable_table/js/jquery-latest.js"></script>
<script type="text/javascript" src="js/sortable_table/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(function() {
$("#tablesorter-demo").tablesorter({sortList:[[0,0]]});
});
</script>
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
</head>
<body>
<!-- WRAPPER INIZIO -->
<div id="wrapper">
<!-- WRAPPER HEADER INIZIO-->
<div id="wrapper_header">
<div id="header"><?php select_header(); ?></div>
</div>
<!-- WRAPPER HEADER FINE-->
<!-- WRAPPER CONTAINER INIZIO-->
<div id="wrapper_container">
<!-- MENU INIZIO-->
<div id="menu"><?php select_menu(); ?></div>
<!-- MENU FINE-->
<!-- CONTENUTI INIZIO-->
<div id="contenuto">
<?php
// GESTIONE PAGINA
if ( isset($_REQUEST['action']) ) { $action = $_REQUEST['action']; } else { $action = "news"; }
switch ($action) {
case 'news': news(); break;
case 'modulo': modulo(); break;
case 'save': save(); break;
case 'delete': delete(); break;
case 'delete_group': delete_group(); break;
case 'stato': stato(); break;
case 'readd': readd(); break;
case 'duply': duply(); break;
case 'cerca': cerca(); break;
default: news(); break;
}
///////////////////////////////////////////////////////////////////////////////////////////
/// NEWS //////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function news(){
$prefix = PREFIX;
$server = SERVER;
$tipo = $_REQUEST['tipo'];
$pages = $_REQUEST['pages'];
echo'<h1>GESTIONE COMUNICATI:</h1>';
if( $tipo == 'tutte' ){
$active_tutte = ' active'; $active_attive = ''; $active_nascoste = '';
$where = "";
}elseif( $tipo == 'attive' ){
$active_tutte = ''; $active_attive = ' active'; $active_nascoste = '';
$where = "WHERE stato = '1'";
}elseif( $tipo == 'nascoste' ) {
$active_tutte = ''; $active_attive = ''; $active_nascoste = ' active';
$where = "WHERE stato = '0'";
}
$total = mysql_query( "SELECT id_news FROM ".$prefix."_comunicati $where ");
$numero_notizie = mysql_num_rows( $total );
echo'
<div id="submenu">
<ul id="navsub">
<li>
<form name="form" id="form">
<label class="label">Visualizza per pagina: </label>
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu(\'parent\',this,0)">
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=12" ';if($pages=='12'){echo' selected="selected"';}else{echo'';} echo' >12</option>
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=24" ';if($pages=='24'){echo' selected="selected"';}else{echo'';} echo' >24</option>
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=36" ';if($pages=='36'){echo' selected="selected"';}else{echo'';} echo' >36</option>
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=48" ';if($pages=='48'){echo' selected="selected"';}else{echo'';} echo' >48</option>
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=60" ';if($pages=='60'){echo' selected="selected"';}else{echo'';} echo' >60</option>
<option value="gestione_comunicati.php?tipo='.$tipo.'&pages=100" ';if($pages=='100'){echo' selected="selected"';}else{echo'';} echo' >100</option>
</select>
</form>
</li>
<li><a href="gestione_comunicati.php?tipo=tutte&pages='.$pages.'" class="tutte'.$active_tutte.'">TUTTE</a></li>
<li><a href="gestione_comunicati.php?tipo=attive&pages='.$pages.'" class="attive'.$active_attive.'">ATTIVE</a></li>
<li><a href="gestione_comunicati.php?tipo=nascoste&pages='.$pages.'" class="nascoste'.$active_nascoste.'">NASCOSTE</a></li>
<li class="num">Totale Comunicati: <b>'.$numero_notizie.'</b></li>
</ul>
</div>
<div id="submenu">
<ul id="navsub">
<li><a href="gestione_comunicati.php?tipo=tutte&pages=12" title="RESET ARCHIVIO"><img src="images/btn_reset.png" alt="RESET ARCHIVIO" class="btn_reset"/></a></li>
<li>
<form action="gestione_comunicati.php?action=cerca" enctype="multipart/form-data" name="form" id="form" method="post" >
<input name="tipo" type="hidden" value="'.$tipo.'" /><input name="pages" type="hidden" value="'.$pages.'" />
<label class="label">Cerca: </label><input name="search" type="text" class="input" />
<input type="submit" name="submit" id="submit" value="CERCA" />
</form>
</li>
</ul>
</div>
';
if( $pages == "" ){ $num_pages = '12'; }else{ $num_pages = $pages; }
if( $numero_notizie > 0 ) {
$limite = $num_pages; // NUMERO VISUALIZZAIONI PER PAGINA
$p = !empty($_GET['p']) ? $_GET['p'] : 1;
$redirect_to = 'gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'&'; // NOME PAGINA
$pager = new YCPager( $p, $numero_notizie, $limite, $redirect_to );
$offset = $pager->getQueryOffset();
echo'
<form action="gestione_comunicati.php?action=delete_group" method="post" enctype="multipart/form-data" name="modulo" id="modulo">
<input name="tipo" type="hidden" value="'.$tipo.'" /><input name="pages" type="hidden" value="'.$pages.'" />
<table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th width="25" align="center" style="background-image:none; margin:0px;padding:0px;"><input type="checkbox" onclick="checkUncheck(this)" /></td>
<th width="80" align="center"><b>Azione</b></td>
<th width="70" align="center" axis="number"><b>Data</b></td>
<th align="left" axis="string"><b>Titolo</b></td>
<th width="60" align="center" ><b>Stato</b></td>
</tr>
</thead>
<tbody>
';
$carica = mysql_query( "SELECT * FROM ".$prefix."_comunicati $where ORDER BY id_news DESC LIMIT $limite OFFSET $offset ");
while( $row_carica = mysql_fetch_assoc($carica)) {
$id_news = $row_carica['id_news'];
$titolo = stripslashes($row_carica['titolo']);
$testo = substr(strip_tags(stripslashes($row_carica['testo'])), 0, 120);
$gg=substr($row_carica['data'],8,2);
$mm=substr($row_carica['data'],5,2);
$aa=substr($row_carica['data'],0,4);
$data_corretta="$gg/$mm/$aa";
$stato = stripslashes($row_carica['stato']);
if( $stato == '1' ){
$tag_stato = '<a href="gestione_comunicati.php?action=stato&tipo='.$tipo.'&pages='.$pages.'&stato=0&id_news='.$id_news.'" title="NASCONDERE QUESTA NEWS" onclick="return confirm(\'ATTENZIONE. NASCONDERE QUESTO COMUNICATO?\')"><img src="images/btn_stato_vedi.png" alt="NASCONDI QUESTO COMUNICATO" border="0"/></a>';
}elseif( $stato == '0' ){
$tag_stato = '<a href="gestione_comunicati.php?action=stato&tipo='.$tipo.'&pages='.$pages.'&stato=1&id_news='.$id_news.'" title="ATTIVARE QUESTA NEWS" onclick="return confirm(\'ATTENZIONE. ATTIVARE QUESTO COMUNICATO?\')"><img src="images/btn_stato_nascondi.png" alt="ATTIVARE QUESTO COMUNICATO" border="0"/></a>';
}
echo'
<tr id="'.$id_news.'" >
<td><input type="checkbox" name="check[]" value="'.$id_news.'" style="margin:3px 0px 0px 3px;"/></td>
<td align="center">
<a href="gestione_comunicati.php?action=modulo&act=edit&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="MODIFICA COMUNICATO"><img src="images/btn_edit.png" alt="MODIFICA QUESTO COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=readd&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="RIPUBBLICARE COMUNICATO" onclick="return confirm(\'ATTENZIONE. RIPUBBLICARE QUESTO COMUNICATO?\')"><img src="images/btn_readd.png" alt="RIPUBBLICARE COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=duply&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="DUPLICARE COMUNICATO" onclick="return confirm(\'ATTENZIONE. DUPLICARE QUESTO COMUNICATO?\')"><img src="images/btn_copy.png" alt="DUPLICARE COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=delete&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="ELIMINA COMUNICATO" onclick="return confirm(\'ATTENZIONE. ELIMINARE QUESTO COMUNICATO?\')"><img src="images/btn_delete.png" alt="ELIMINA COMUNICATO" border="0"/></a>
</td>
<td>'.$data_corretta.'</td>
<td><a href="'.$server.'/comunicati_leggi.php?id_news='.$id_news.'" target="_blank">'.$titolo.'</a><br />'.$testo.' <i>[...]</i></td>
<td align="center">'.$tag_stato.'</td>
</tr>
';
}
echo'
</tbody>
<tfoot>
<tr>
<th align="center" colspan="2"><input type="submit" name="submit" id="submit" value="ELIMINA" /></td>
<th align="center"><b>Data</b></td>
<th align="left"><b>Titolo</b></td>
<th align="center"><b>Stato</b></td>
</tr>
</tfoot>
</table>
</form>
<p class="add_style"><a href="gestione_comunicati.php?action=modulo&act=add&tipo='.$tipo.'&pages='.$pages.'" class="add_button">Aggiungi Comunicato</a></p>
';
if ( $numero_notizie > $num_pages ) { $pager->getPager(); }else{ echo''; }
}else{
echo'';
}
}
///////////////////////////////////////////////////////////////////////////////////////////
/// MODULO ////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function modulo(){
$prefix = PREFIX;
$directory = COMUNICATIDIRECTORY;
$dimensioni = COMUNICATIDIMENSIONI;
$act = $_REQUEST['act'];
$tipo = $_REQUEST['tipo'];
$pages = $_REQUEST['pages'];
if( $act == "add" ){
$tag_h1 = 'NUOVO';
$value_titolo = '';
$value_testo = '';
$value_keyword = '';
$value_allegato = '';
$value_stato = '1';
$tag_submit = 'AGGIUNGI';
$tag_hidden_id = '';
$tag_act = '<input name="act" type="hidden" value="add" />';
}elseif ( $act == "edit" ){
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
$carica_news = mysql_fetch_assoc(mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'"));
$tag_h1 = 'MODIFICA';
$value_titolo = 'value="'.htmlspecialchars(stripslashes($carica_news['titolo'])).'"';
$value_testo = ''.htmlspecialchars(stripslashes($carica_news['testo'])).'';
$value_keyword = ''.htmlspecialchars(stripslashes($carica_news['keyword'])).'';
if( $carica_news['allegato'] != "" ){
$value_allegato = '
<div class="edit_allegato" style="width:170px;"> <a href="../'.$directory.'/'.$carica_news['allegato'].'" target="_blank"><img src="images/pdf.png" alt="" class="images" /></a> [ <input name="del_all" type="checkbox" class="checkbox" value="1" /> ELIMINA ]</p>
</div>
';
}else{ $value_allegato = ''; }
$value_stato = $carica_news['stato'];
$tag_submit = 'MODIFICA';
$tag_hidden_id = '<input name="id_news" type="hidden" value="'.$id_news.'" />';
$tag_act = '<input name="act" type="hidden" value="edit" />';
}
echo'
<h1>GESTIONE COMUNICATI > <b>'.$tag_h1.' COMUNICATO</b></h1>
<form action="gestione_comunicati.php?action=save" method="post" enctype="multipart/form-data" name="modulo" id="modulo" onsubmit="return OkNews(this)">
<p><label class="label">Titolo:</label><input name="titolo" type="text" class="input" style="width:535px;" '.$value_titolo.'/></p>
<p>
<label class="label" style="height:490px;">Testo:</label>
<div style="width:538px; padding:0px; margin:2px; float:left;">
<textarea id="descrizione" name="testo" >'.$value_testo.'</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( \'testo\',{
toolbar : \'News\',
height: 350,
skin : \'kama\',
extraPlugins : \'docprops\',
extraPlugins : \'youtube\',
filebrowserBrowseUrl : \'ckfinder/ckfinder.html\',
filebrowserImageBrowseUrl : \'ckfinder/ckfinder.html?Type=Images\',
filebrowserFlashBrowseUrl : \'ckfinder/ckfinder.html?Type=Flash\',
filebrowserUploadUrl : \'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
filebrowserImageUploadUrl : \'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
filebrowserFlashUploadUrl : \'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\',
});
//]]>
</script>
</div>
</p>
<p><label class="label" style="height:75px; line-height:75px;">Keyword:</label><textarea name="keyword" cols="" rows="" class="textarea" style="width:535px;" >'.$value_keyword.'</textarea><span class="text"><i><b>(Scrivere parola o frase separato dalla virgola! es. keyword, frase keyword)</b></i></span></p>
<p>
<label class="label" style="height:27px; line-height:27px;">Allegato:</label>
'.$value_allegato.'
<div class="edit_allegato" style="width:351px; padding:1px;"><p><input name="allegato" type="file" class="file" size="30" /></p></div>
</p>
<p>
<label class="label">Stato:</label>
<input type="radio" name="stato" value="1" class="radio"';if($value_stato=='1'){echo' checked="checked"';}else{echo'';} echo'/><span class="text_radio">ATTIVO</span>
<input type="radio" name="stato" value="0" class="radio"';if($value_stato=='0'){echo' checked="checked"';}else{echo'';} echo'/><span class="text_radio">NASCOSTO</span>
</p>
<p> '.$tag_hidden_id.''.$tag_act.'<input name="tipo" type="hidden" value="'.$tipo.'" /><input name="pages" type="hidden" value="'.$pages.'" /></p>
<p><label class="label"></label><input type="submit" name="submit" id="submit" value="'.$tag_submit.'" /></p>
</form>
<p class="back_style"><a href="gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'" class="back_button">Torna Indietro</a></p>
';
}
///////////////////////////////////////////////////////////////////////////////////////////
/// SAVE //////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function save(){
$prefix = PREFIX;
$directory = COMUNICATIDIRECTORY;
$act = addslashes($_POST['act']);
$tipo = addslashes($_POST['tipo']);
$pages = addslashes($_POST['pages']);
$titolo = addslashes($_POST['titolo']);
$testo = addslashes($_POST['testo']);
$keyword = addslashes($_POST['keyword']);
$stato = addslashes($_POST['stato']);
if( $act == 'add' ) {
$data = date('Y-m-d G:i:s');
$insert = "INSERT INTO ".$prefix."_comunicati (titolo, testo, keyword, stato, data) VALUES ('$titolo', '$testo', '$keyword', '$stato', '$data')";
echo'<h1>GESTIONE COMUNICATI > <b>NUOVA COMUNICATO</b></h1>';
if(mysql_query($insert)){ echo status_ok(); }else{ echo status_errore(); }
$id_news = mysql_insert_id();
// UPLOAD ALLEGATO /////////////////////////////////
if ( isset($_FILES['allegato']) && !empty($_FILES['allegato']['name']) ) {
$error_allegato = "";
$prefix_allegato = 'news_all_'.$id_news.'_'.$_FILES['allegato']['name'];
$public_allegato = '../'.$directory.'/'.$prefix_allegato;
if ( empty($error_immagine) ) {
move_uploaded_file($_FILES['allegato']['tmp_name'], $public_allegato);
mysql_query("UPDATE ".$prefix."_comunicati SET allegato = '$prefix_allegato' WHERE id_news = '$id_news'");
} else { die($error_allegato); }
}
// UPLOAD ALLEGATO /////////////////////////////////
}elseif( $act == 'edit' ){
$id_news = $_POST['id_news'];
$del_all = $_POST['del_all'];
$update = "UPDATE ".$prefix."_comunicati SET titolo = '$titolo', testo = '$testo', keyword = '$keyword', stato = '$stato' WHERE id_news = '$id_news'";
echo'<h1>GESTIONE COMUNICATI > <b>MODIFICATO</b></h1>';
if(mysql_query($update)){ echo status_ok(); }else{ echo status_errore(); }
// UPLOAD ALLEGATO /////////////////////////////////
if ($del_all == '1') {
$del_all_1 = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_del_all_1 = @mysql_fetch_array($del_all_1) ) { $allegato = $row_del_all_1['allegato']; unlink('../'.$directory.'/'.$allegato.''); }
mysql_query("UPDATE ".$prefix."_comunicati SET allegato = '' WHERE id_news = '$id_news'");
}else{ echo''; }
if ( isset($_FILES['allegato']) && !empty($_FILES['allegato']['name']) ) {
$error_allegato = "";
$prefix_allegato = 'news_all_'.$id_news.'_'.$_FILES['allegato']['name'];
$public_allegato = '../'.$directory.'/'.$prefix_allegato;
if ( empty($error_allegato) ) {
$del_all_2 = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_del_all_2 = @mysql_fetch_array($del_all_2) ) { $allegato = $row_del_all_2['allegato']; if ( $allegato != "" ) { unlink('../'.$directory.'/'.$allegato.''); } }
move_uploaded_file($_FILES['allegato']['tmp_name'], $public_allegato);
mysql_query("UPDATE ".$prefix."_comunicati SET allegato = '$prefix_allegato' WHERE id_news = '$id_news'");
} else { die($error_allegato); }
}
// UPLOAD ALLEGATO /////////////////////////////////
}elseif( $act == 'readd' ){
$data = date('Y-m-d G:i:s');
$readd = "INSERT INTO ".$prefix."_comunicati (titolo, testo, keyword, stato, data) VALUES ('$titolo', '$testo', '$keyword', '$stato', '$data')";
echo'<h1>GESTIONE COMUNICATI > <b>RIPUBBLICA COMUNICATO</b></h1>';
if(mysql_query($readd)){ echo status_ok(); }else{ echo status_errore(); }
$id_news = mysql_insert_id();
}
header('Refresh: 1; URL=gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'');
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// DELETE ////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function delete(){
$prefix = PREFIX;
$directory = COMUNICATIDIRECTORY;
$tipo = addslashes($_REQUEST['tipo']);
$pages = addslashes($_REQUEST['pages']);
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
$carica = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_carica = @mysql_fetch_array($carica) ) {
$allegato = $row_carica['allegato']; if ( $allegato != "" ) { unlink('../'.$directory.'/'.$allegato.''); }
}
$delete = "DELETE FROM ".$prefix."_comunicati WHERE id_news = '$id_news'" ;
echo'<h1>GESTIONE COMUNICATI > <b>ELIMINA COMUNICATO</b></h1>';
if(mysql_query($delete)){ echo status_ok(); }else{ echo status_errore(); }
header('Refresh: 1; URL=gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'');
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// DELETE GROUP //////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function delete_group(){
$prefix = PREFIX;
$directory = COMUNICATIDIRECTORY;
$tipo = addslashes($_REQUEST['tipo']);
$pages = addslashes($_REQUEST['pages']);
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
$count = count($_POST['check'.$i]);
if (isset($_POST['check'.$i])) {
$error = "";
foreach ($_POST['check'.$i++] as $_POST['check'.$i]) {
if ( empty($error) ) {
$id_news = $_POST['check'.$i];
$carica = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_carica = @mysql_fetch_array($carica) ) {
$allegato = $row_carica['allegato']; if ( $allegato != "" ) { unlink('../'.$directory.'/'.$allegato.''); }
}
$delete = "DELETE FROM ".$prefix."_comunicati WHERE id_news = '$id_news'" ;
if(mysql_query($delete)){ }else{ echo status_errore(); }
} else {
die($error);
}
}
}
header("Location: gestione_comunicati.php?tipo=$tipo&pages=$pages");
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// STATO /////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function stato(){
$prefix = PREFIX;
$tipo = $_REQUEST['tipo'];
$stato = $_REQUEST['stato'];
$pages = $_REQUEST['pages'];
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
if( $stato == '1' ) { $tag_stato = 'COMUNICATO ATTIVATO'; }elseif( $stato == '0' ){ $tag_stato = 'COMUNICATO NASCOSTO'; }
$update = "UPDATE ".$prefix."_comunicati SET stato = '$stato' WHERE id_news = '$id_news'" ;
echo'<h1>GESTIONE COMUNICATI > <b>'.$tag_stato.'</b></h1>';
if(mysql_query($update)){ echo status_ok(); }else{ echo status_errore(); }
header('Refresh: 1; URL=gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'');
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// READD /////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function readd(){
$prefix = PREFIX;
$tipo = $_REQUEST['tipo'];
$pages = $_REQUEST['pages'];
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
$carica = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_carica = @mysql_fetch_array($carica) ) {
$titolo = addslashes($row_carica['titolo']);
$testo = addslashes($row_carica['testo']);
$keyword = addslashes($row_carica['keyword']);
$data = date('Y-m-d G:i:s');
$allegato = addslashes($row_carica['allegato']);
$stato = $row_carica['stato'];
}
$insert = "INSERT INTO ".$prefix."_comunicati (titolo, testo, keyword, data, allegato, stato) VALUES ('$titolo', '$testo', '$keyword', '$data', '$allegato', '$stato')";
echo'<h1>GESTIONE COMUNICATI > <b>RIPUBBLICA COMUNICATO</b></h1>';
if(mysql_query($insert)){
$delete = "DELETE FROM ".$prefix."_comunicati WHERE id_news = '$id_news'" ;
if(mysql_query($delete)){ echo status_ok(); }else{ echo status_errore(); }
}else{ echo status_errore(); }
header('Refresh: 1; URL=gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'');
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// DUPLY /////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function duply(){
$prefix = PREFIX;
$directory = COMUNICATIDIRECTORY;
$tipo = $_REQUEST['tipo'];
$pages = $_REQUEST['pages'];
$id_news = isset($_GET['id_news']) ? (int)$_GET['id_news'] : 0;
$carica = mysql_query("SELECT * FROM ".$prefix."_comunicati WHERE id_news = '$id_news'");
while ( $row_carica = @mysql_fetch_array($carica) ) {
$titolo = 'DUPLICATO - '.addslashes($row_carica['titolo']);
$testo = addslashes($row_carica['testo']);
$keyword = addslashes($row_carica['keyword']);
$data = date('Y-m-d G:i:s');
$allegato = addslashes($row_carica['allegato']);
$stato = '0';
if($allegato != ""){
$server_allegato = '../'.$directory.'/'.$allegato.'';
$db_allegato = 'dup_'.$allegato.'';
copy($server_allegato, "../".$directory."/".$db_allegato); //Copia in /temp/text.txt
}else{ }
}
$insert = "INSERT INTO ".$prefix."_comunicati (titolo, testo, keyword, data, allegato, stato) VALUES ('$titolo', '$testo', '$keyword', '$data', '$db_allegato', '$stato')";
echo'<h1>GESTIONE COMUNICATI > <b>DUPLICA COMUNICATO</b></h1>';
if(mysql_query($insert)){ echo status_ok(); }else{ echo status_errore(); }
header('Refresh: 1; URL=gestione_comunicati.php?tipo=nascoste&pages='.$pages.'');
ob_end_flush();
}
///////////////////////////////////////////////////////////////////////////////////////////
/// CERCA /////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
function cerca(){
$prefix = PREFIX;
$server = SERVER;
$tipo = $_POST['tipo'];
$pages = $_POST['pages'];
$search = mysql_real_escape_string($_POST['search']);
$search1 = strtolower($search);
$search2 = strtoupper($search);
echo'<h1>GESTIONE COMUNICATI > CERCA > <b>'.stripslashes($_REQUEST['search']).'</b></h1>';
if( $tipo == 'tutte' ){
$active_tutte = ' active'; $active_attive = ''; $active_nascoste = '';
$where = "";
}elseif( $tipo == 'attive' ){
$active_tutte = ''; $active_attive = ' active'; $active_nascoste = '';
$where = "WHERE stato = '1'";
}elseif( $tipo == 'nascoste' ) {
$active_tutte = ''; $active_attive = ''; $active_nascoste = ' active';
$where = "WHERE stato = '0'";
}
$total = mysql_query("SELECT *, MATCH ( titolo, testo, keyword) AGAINST('$search1 $search2' IN BOOLEAN MODE) AS attinenza FROM ".$prefix."_comunicati WHERE MATCH( titolo, testo, keyword ) AGAINST('$search1 $search2' IN BOOLEAN MODE) ");
$numero_notizie = mysql_num_rows( $total );
echo'
<div id="submenu">
<ul id="navsub">
<li>
<form name="form" id="form">
<label class="label">Visualizza per pagina: </label>
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu(\'parent\',this,0)">
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=12&search='.$search1.'" ';if($pages=='12'){echo' selected="selected"';}else{echo'';} echo' >12</option>
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=24&search='.$search1.'" ';if($pages=='24'){echo' selected="selected"';}else{echo'';} echo' >24</option>
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=36&search='.$search1.'" ';if($pages=='36'){echo' selected="selected"';}else{echo'';} echo' >36</option>
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=48&search='.$search1.'" ';if($pages=='48'){echo' selected="selected"';}else{echo'';} echo' >48</option>
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=60&search='.$search1.'" ';if($pages=='60'){echo' selected="selected"';}else{echo'';} echo' >60</option>
<option value="gestione_comunicati.php?action=cerca&tipo='.$tipo.'&pages=100&search='.$search1.'" ';if($pages=='100'){echo' selected="selected"';}else{echo'';} echo' >100</option>
</select>
</form>
</li>
<li><a href="gestione_comunicati.php?action=cerca&tipo=tutte&pages='.$pages.'&search='.$search1.'" class="tutte'.$active_tutte.'">TUTTE</a></li>
<li><a href="gestione_comunicati.php?action=cerca&tipo=attive&pages='.$pages.'&search='.$search1.'" class="attive'.$active_attive.'">ATTIVE</a></li>
<li><a href="gestione_comunicati.php?action=cerca&tipo=nascoste&pages='.$pages.'&search='.$search1.'" class="nascoste'.$active_nascoste.'">NASCOSTE</a></li>
<li class="num">Totale Comunicati: <b>'.$numero_notizie.'</b></li>
</ul>
</div>
<div id="submenu">
<ul id="navsub">
<li><a href="gestione_comunicati.php?tipo=tutte&pages=12" title="RESET ARCHIVIO"><img src="images/btn_reset.png" alt="RESET ARCHIVIO" class="btn_reset"/></a></li>
<li>
<form action="gestione_comunicati.php?action=cerca" enctype="multipart/form-data" name="form" id="form" method="post" >
<input name="tipo" type="hidden" value="'.$tipo.'" /><input name="pages" type="hidden" value="'.$pages.'" />
<label class="label">Cerca: </label><input name="search" type="text" class="input" />
<input type="submit" name="submit" id="submit" value="CERCA" />
</form>
</li>
</ul>
</div>
';
if( $pages == "" ){ $num_pages = '12'; }else{ $num_pages = $pages; }
if( $numero_notizie > 0 ) {
$limite = $num_pages; // NUMERO VISUALIZZAIONI PER PAGINA
$p = !empty($_GET['p']) ? $_GET['p'] : 1;
$redirect_to = 'gestione_comunicati.php?tipo='.$tipo.'&pages='.$pages.'&'; // NOME PAGINA
$pager = new YCPager( $p, $numero_notizie, $limite, $redirect_to );
$offset = $pager->getQueryOffset();
echo'
<form action="gestione_comunicati.php?action=delete_group" method="post" enctype="multipart/form-data" name="modulo" id="modulo">
<input name="tipo" type="hidden" value="'.$tipo.'" /><input name="pages" type="hidden" value="'.$pages.'" />
<table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th width="25" align="center" style="background-image:none; margin:0px;padding:0px;"><input type="checkbox" onclick="checkUncheck(this)" /></td>
<th width="80" align="center"><b>Azione</b></td>
<th width="70" align="center" axis="number"><b>Data</b></td>
<th align="left" axis="string"><b>Titolo</b></td>
<th width="60" align="center" ><b>Stato</b></td>
</tr>
</thead>
<tbody>
';
$carica = mysql_query("SELECT *, MATCH ( titolo, testo, keyword) AGAINST('$search1 $search2' IN BOOLEAN MODE) AS attinenza FROM ".$prefix."_comunicati WHERE MATCH( titolo, testo, keyword ) AGAINST('$search1 $search2' IN BOOLEAN MODE) LIMIT $limite OFFSET $offset");
while( $row_carica = mysql_fetch_assoc($carica)) {
$id_news = $row_carica['id_news'];
$titolo = stripslashes($row_carica['titolo']);
$testo = substr(strip_tags(stripslashes($row_carica['testo'])), 0, 120);
$gg=substr($row_carica['data'],8,2);
$mm=substr($row_carica['data'],5,2);
$aa=substr($row_carica['data'],0,4);
$data_corretta="$gg/$mm/$aa";
$stato = stripslashes($row_carica['stato']);
if( $stato == '1' ){
$tag_stato = '<a href="gestione_comunicati.php?action=stato&tipo='.$tipo.'&pages='.$pages.'&stato=0&id_news='.$id_news.'" title="NASCONDERE QUESTO COMUNICATO" onclick="return confirm(\'ATTENZIONE. NASCONDERE QUESTO COMUNICATO?\')"><img src="images/btn_stato_vedi.png" alt="NASCONDI QUESTO COMUNICATO" border="0"/></a>';
}elseif( $stato == '0' ){
$tag_stato = '<a href="gestione_comunicati.php?action=stato&tipo='.$tipo.'&pages='.$pages.'&stato=1&id_news='.$id_news.'" title="ATTIVARE QUESTO COMUNICATO" onclick="return confirm(\'ATTENZIONE. ATTIVARE QUESTO COMUNICATO?\')"><img src="images/btn_stato_nascondi.png" alt="QUESTO COMUNICATO" border="0"/></a>';
}
echo'
<tr id="'.$id_news.'" >
<td><input type="checkbox" name="check[]" value="'.$id_news.'" style="margin:3px 0px 0px 3px;"/></td>
<td align="center">
<a href="gestione_comunicati.php?action=modulo&act=edit&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="MODIFICA QUESTO COMUNICATO"><img src="images/btn_edit.png" alt="MODIFICA QUESTO COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=readd&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="RIPUBBLICARE QUESTO COMUNICATO" onclick="return confirm(\'ATTENZIONE. RIPUBBLICARE QUESTO COMUNICATO?\')"><img src="images/btn_readd.png" alt="RIPUBBLICARE QUESTO COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=duply&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="DUPLICARE QUESTO COMUNICATO" onclick="return confirm(\'ATTENZIONE. DUPLICARE QUESTO COMUNICATO?\')"><img src="images/btn_copy.png" alt="DUPLICARE QUESTO COMUNICATO" border="0"/></a>
<a href="gestione_comunicati.php?action=delete&tipo='.$tipo.'&pages='.$pages.'&id_news='.$id_news.'" title="ELIMINA QUESTO COMUNICATO" onclick="return confirm(\'ATTENZIONE. ELIMINARE QUESTO COMUNICATO?\')"><img src="images/btn_delete.png" alt="ELIMINA QUESTO COMUNICATO" border="0"/></a>
</td>
<td>'.$data_corretta.'</td>
<td><a href="'.$server.'/news_leggi.php?id_news='.$id_news.'" target="_blank">'.$titolo.'</a><br />'.$testo.' <i>[...]</i></td>
<td align="center">'.$tag_stato.'</td>
</tr>
';
}
echo'
</tbody>
<tfoot>
<tr>
<th align="center" colspan="2"><input type="submit" name="submit" id="submit" value="ELIMINA" /></td>
<th align="center"><b>Data</b></td>
<th align="left"><b>Titolo</b></td>
<th align="center"><b>Stato</b></td>
</tr>
</tfoot>
</table>
</form>
<p class="add_style"><a href="gestione_comunicati.php?action=modulo&act=add&tipo='.$tipo.'&pages='.$pages.'" class="add_button">Aggiungi Comunicato</a></p>
';
if ( $numero_notizie > $num_pages ) { $pager->getPager(); }else{ echo''; }
}else{
echo'';
}
}
?>
</div>
<!-- CONTENUTI FINE-->
</div>
<!-- WRAPPER CONTAINER FINE-->
<div class="push"></div>
</div>
<!-- WRAPPER FINE -->
<!-- WRAPPER FOOTER INIZIO-->
<div id="wrapper_footer"><?php select_footer(); ?></div>
<!-- WRAPPER FOOTER FINE-->
</body>
</html>