case 'modify_offert_execution':
# Controllo che nessuno dei settaggi sia vuoto o nullo.
if (!(is_not_null_not_blank($_POST['nome_offert']) &&
is_not_null_not_blank($_POST['ordine_offert']))) {
echo(management_message('Attenzione!', 'Tutti i campi sono obbligatori.'));
# Impostazione del valore di $error, per creare correttamente
# il tasto di reindirizzamento a fondo pagina.
$error = TRUE;
break;
}
# Reimpostazione vera e propria dei settaggi.
try {
$nome_offert = trim($_POST['nome_offert']); $ordine_offert = $_POST['ordine_offert'];
$descrizione_offert = trim($_POST['descrizione_offert']); $id_offert = $_POST['activity_id'];
$id_remove_offert = $_POST['activity_remove'];
if (is_not_null_not_blank($id_offert))
{
if (is_not_null_not_blank($id_remove_offert))
{
$file_offert_array = $db->query_objects_array("SELECT * FROM files WHERE files.attribute_id = $id_offert");
# Recupero la path
$pathimage = substr($_SERVER['SCRIPT_FILENAME'], 0
, strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], "/"))); //RIGA 2286
foreach ($file_offert_array as $file_offert_array_element)
{
unlink("$pathimage/files/$file_offert_array_element->name"); $db->query_no_result("DELETE FROM files WHERE file_id = $file_offert_array_element->file_id");
}
$db->query_no_result("DELETE FROM attributes WHERE attribute_id = $id_offert");
}
else
$db->query_no_result("UPDATE attributes SET title = '$nome_offert', priority = '$ordine_offert', description = '$descrizione_offert' WHERE attribute_id = $id_offert");
}
else
$db->query_no_result("INSERT INTO attributes (title,description,priority,sector_id) VALUES ('$nome_offert','$descrizione_offert',$ordine_offert,3)");
echo(management_message('Operazione completata',
'Modifica dela offerta eseguita con successo.<br /><br />'));
} catch(Exception $e) {
echo(management_message('Attenzione!', 'Modifica del messaggio chi siamo eseguita senza successo.' .
'<br />' . $e->getMessage()));
# Impostazione del valore di $error, per creare correttamente
# il tasto di reindirizzamento a fondo pagina.
$error = TRUE;
}
break;