18 changed files with 1750 additions and 46 deletions
Binary file not shown.
@ -0,0 +1,86 @@ |
|||||
|
<div class="row"> |
||||
|
<div class="col-12"> |
||||
|
<div class="section-title">Aggiungi notizia</div> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
|
||||
|
<div class="sheet-box p-4"> |
||||
|
|
||||
|
<?php |
||||
|
if($_POST['go']){ |
||||
|
|
||||
|
// echo "<pre>"; |
||||
|
// print_r(reArrayFiles($_FILES['files'])); |
||||
|
// echo "</pre>"; |
||||
|
|
||||
|
$append = array(); |
||||
|
|
||||
|
if($_FILES['files']){ |
||||
|
$files = reArrayFiles($_FILES['files']); |
||||
|
foreach ($files as $index => $file) { |
||||
|
if(is_uploaded_file($file['tmp_name'])){ |
||||
|
$filename = preg_replace('/[^a-zA-Z0-9\-\._]/','', $file['name']); |
||||
|
$filesize = ($file['size'] < 1000000) ? round($file['size'] / 1000)."k" : round($file['size'] / 1000000)."M"; |
||||
|
move_uploaded_file($file['tmp_name'], "../docs/files/news/$filename"); |
||||
|
$qf=mysqli_query($conn, "INSERT INTO files VALUES(null, '$filename', '$filename', '/docs/files/news', NOW(), '$filesize')"); |
||||
|
$append[$index] = mysqli_insert_id($conn); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$q=mysqli_query($conn, "INSERT INTO news VALUES(null, |
||||
|
'".addslashes(trim($_POST['title']))."', '".addslashes(trim($_POST['text']))."', |
||||
|
'".trim(conv_date_en($_POST['date']))."','".implode(',',$append)."')"); |
||||
|
|
||||
|
echo "INSERT INTO news VALUES(null, |
||||
|
'".addslashes(trim($_POST['title']))."', '".addslashes(trim($_POST['text']))."', |
||||
|
'".trim(conv_date_en($_POST['date']))."','".implode(',',$append)."')"; |
||||
|
|
||||
|
echo '<div class="col-10 text-center mx-auto my-5"> |
||||
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p> |
||||
|
Notizia aggiunto correttamente! |
||||
|
</div>'; |
||||
|
|
||||
|
|
||||
|
}else{ |
||||
|
?> |
||||
|
<form method="post" enctype="multipart/form-data"> |
||||
|
<div class="row"> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Data</span> |
||||
|
<input type="text" name="date" class="datepicker" value="<?= date("d/m/Y");?>"> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
<span class="font-12">Titolo notizia</span> |
||||
|
<input type="text" name="title"> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
<span class="font-12">Testo notizia</span> |
||||
|
<textarea cols="40" rows="6" name="text" class="mce"></textarea> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Allegato/i</span> |
||||
|
<div class="files-list"> |
||||
|
<div class="list"> |
||||
|
<input type="file" name="files[]" class="file"><label></label> |
||||
|
</div> |
||||
|
<button class="button button-small add-file"><i class="fa fa-plus"></i> aggiungi riga</button> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div class="col-12 text-right"> |
||||
|
<button type="submit" name="go" value="1">Aggiungi notizia</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
@ -0,0 +1,153 @@ |
|||||
|
<div class="row"> |
||||
|
<div class="col-12"> |
||||
|
<div class="section-title">Elimina notizia</div> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
|
||||
|
<div class="sheet-box p-4"> |
||||
|
|
||||
|
<?php |
||||
|
if($_POST['go']){ |
||||
|
|
||||
|
$q=mysqli_query($conn, "DELETE FROM news WHERE id=".trim($getQ[3]).""); |
||||
|
|
||||
|
echo '<div class="col-10 text-center mx-auto my-5"> |
||||
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p> |
||||
|
Notizia eliminato correttamente! |
||||
|
</div>'; |
||||
|
|
||||
|
}else{ |
||||
|
|
||||
|
if($getQ[3]){ |
||||
|
|
||||
|
$q=mysqli_query($conn, "SELECT * FROM news WHERE id = ".trim($getQ[3])); |
||||
|
if(mysqli_num_rows($q)==0){ |
||||
|
echo '<div class="col-10 text-center mx-auto my-5"> |
||||
|
<p><i class="fa fa-exclamation-triangle font-alert p-4"></i></p> |
||||
|
<p>ATENZIONE: Utente non trovato!</p> |
||||
|
<p><a href="'.$BASE_URL.'/sheets/news/del" class="button">Torna indietro</a></p> |
||||
|
</div>'; |
||||
|
}else{ |
||||
|
|
||||
|
$r=mysqli_fetch_array($q); |
||||
|
?> |
||||
|
<form method="post"> |
||||
|
<div class="row"> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">N° Iscrizione all'Albo</span> |
||||
|
<p><?= $r['id'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Data di iscrizione all'Albo</span> |
||||
|
<p><?= $r['register_date'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Email</span> |
||||
|
<p><?= $r['email'];?></p> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12"><hr></div> |
||||
|
|
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Cognome</span> |
||||
|
<p><?= $r['last_name'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Nome</span> |
||||
|
<p><?= $r['first_name'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Data di nascita</span> |
||||
|
<p><?= $r['birth_date'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Luogo di nascita</span> |
||||
|
<p><?= $r['birth_place'];?></p> |
||||
|
</div> |
||||
|
<div class="col-9 col-sm-9"> |
||||
|
<span class="font-12 text-grey">Indirizzo</span> |
||||
|
<p><?= $r['address'];?></p> |
||||
|
</div> |
||||
|
<div class="col-3 col-sm-3"> |
||||
|
<span class="font-12 text-grey">C.A.P.</span> |
||||
|
<p><?= $r['zip_code'];?></p> |
||||
|
</div> |
||||
|
<div class="col-8 col-sm-8"> |
||||
|
<span class="font-12 text-grey">Comune</span> |
||||
|
<p><?= $r['city'];?></p> |
||||
|
</div> |
||||
|
<div class="col-4 col-sm-4"> |
||||
|
<span class="font-12 text-grey">Provincia</span> |
||||
|
<p><?= $r['province'];?></p> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12"><hr></div> |
||||
|
|
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Laureato/a a</span> |
||||
|
<p><?= $r['degree_place'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Laureato/a il</span> |
||||
|
<p><?= $r['degree_date'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Laureato/a in</span> |
||||
|
<p><?= $r['degree'];?></p> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12 text-grey">Abilitato/a nel</span> |
||||
|
<p><?= $r['qualification_date'];?></p> |
||||
|
</div> |
||||
|
<div class="col-9 col-sm-9"> |
||||
|
<span class="font-12 text-grey">Abilitato/a presso</span> |
||||
|
<p><?= $r['qualification_place'];?></p> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="col-12"> |
||||
|
<span class="font-12 text-grey">Specializzazioni</span> |
||||
|
<p><?= strip_tags($r['specializations']);?></p> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="col-12 text-right"> |
||||
|
<button type="submit" name="go" value="1">Conferma eliminazione</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<?php |
||||
|
} |
||||
|
}else{ |
||||
|
|
||||
|
?> |
||||
|
<form method="post" class="form-mod" data-path="<?= $BASE_URL;?>/sheets/news/del"> |
||||
|
<div class="col-12 col-sm-6 mx-auto"> |
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<span class="font-12">N° Iscrizione all'Albo</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<input type="text" class="id" name="id"> |
||||
|
</div> |
||||
|
<div class="col-auto"> |
||||
|
<button type="submit">Elimina</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<?php |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
@ -0,0 +1,174 @@ |
|||||
|
<div class="row"> |
||||
|
<div class="col-12"> |
||||
|
<div class="section-title">Modifica notizia</div> |
||||
|
</div> |
||||
|
<div class="col-12"> |
||||
|
|
||||
|
<div class="sheet-box p-4"> |
||||
|
|
||||
|
<?php |
||||
|
if($_POST['go']){ |
||||
|
|
||||
|
$q=mysqli_query($conn, "UPDATE news SET id=".trim($_POST['id']).", |
||||
|
email='".addslashes(trim($_POST['email']))."', last_name='".addslashes(trim($_POST['last_name']))."', |
||||
|
first_name='".addslashes(trim($_POST['first_name']))."', birth_date='".addslashes(trim($_POST['birth_date']))."', |
||||
|
birth_place='".addslashes(trim($_POST['birth_place']))."', register_date='".addslashes(trim($_POST['register_date']))."', |
||||
|
address='".addslashes(trim($_POST['address']))."', zip_code='".addslashes(trim($_POST['zip_code']))."', |
||||
|
city='".addslashes(trim($_POST['city']))."', province='".addslashes(trim($_POST['province']))."', |
||||
|
degree_place='".addslashes(trim($_POST['degree_place']))."', degree_date='".addslashes(trim($_POST['degree_date']))."', |
||||
|
degree='".addslashes(trim($_POST['degree']))."', qualification_date='".addslashes(trim($_POST['qualification_date']))."', |
||||
|
qualification_place='".addslashes(trim($_POST['qualification_place']))."', enabled=".$_POST['enabled'].", |
||||
|
specializations='".addslashes(nl2br($_POST['specializations']))."' |
||||
|
WHERE id=".trim($getQ[3]).""); |
||||
|
|
||||
|
echo '<div class="col-10 text-center mx-auto my-5"> |
||||
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p> |
||||
|
Notizia modificata correttamente! |
||||
|
</div>'; |
||||
|
|
||||
|
}else{ |
||||
|
|
||||
|
if($getQ[3]){ |
||||
|
|
||||
|
$q=mysqli_query($conn, "SELECT * FROM news WHERE id = ".trim($getQ[3])); |
||||
|
$r=mysqli_fetch_array($q); |
||||
|
?> |
||||
|
<form method="post"> |
||||
|
<div class="row"> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">N° Iscrizione all'Albo</span> |
||||
|
<input type="text" name="id" value="<?= $r['id'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Data di iscrizione all'Albo</span> |
||||
|
<input type="text" name="register_date" class="datepicker" value="<?= $r['register_date'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Username <span class="font-10">(modificabile solo dall'utente)</span></span> |
||||
|
<input type="text" name="usr" value="<?= $r['usr'];?>" readonly disabled> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Password <span class="font-10">(modificabile solo dall'utente)</span></span> |
||||
|
<input type="text" value="" placeholder="[password nascosta]" readonly disabled> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Email</span> |
||||
|
<input type="text" name="email" value="<?= $r['email'];?>"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12"><hr></div> |
||||
|
|
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Cognome</span> |
||||
|
<input type="text" name="last_name" value="<?= $r['last_name'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Nome</span> |
||||
|
<input type="text" name="first_name" value="<?= $r['first_name'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Data di nascita</span> |
||||
|
<input type="text" name="birth_date" class="datepicker" value="<?= $r['birth_date'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Luogo di nascita</span> |
||||
|
<input type="text" name="birth_place" value="<?= $r['birth_place'];?>"> |
||||
|
</div> |
||||
|
<div class="col-9 col-sm-9"> |
||||
|
<span class="font-12">Indirizzo</span> |
||||
|
<input type="text" name="address" value="<?= $r['address'];?>"> |
||||
|
</div> |
||||
|
<div class="col-3 col-sm-3"> |
||||
|
<span class="font-12">C.A.P.</span> |
||||
|
<input type="text" name="zip_code" value="<?= $r['zip_code'];?>"> |
||||
|
</div> |
||||
|
<div class="col-8 col-sm-8"> |
||||
|
<span class="font-12">Comune</span> |
||||
|
<input type="text" name="city" value="<?= $r['city'];?>"> |
||||
|
</div> |
||||
|
<div class="col-4 col-sm-4"> |
||||
|
<span class="font-12">Provincia</span> |
||||
|
<input type="text" name="province" value="<?= $r['province'];?>"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12"><hr></div> |
||||
|
|
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Laureato/a a</span> |
||||
|
<input type="text" name="degree_place" value="<?= $r['degree_place'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Laureato/a il</span> |
||||
|
<input type="text" name="degree_date" class="datepicker" value="<?= $r['degree_date'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Laureato/a in</span> |
||||
|
<input type="text" name="degree" value="<?= $r['degree'];?>"> |
||||
|
</div> |
||||
|
<div class="col-12 col-sm-6"> |
||||
|
<span class="font-12">Abilitato/a nel</span> |
||||
|
<select name="qualification_date"> |
||||
|
<?php for($i=date('Y');$i>=date('Y')-70;$i--){ |
||||
|
echo "<option value=\"$i\" "; |
||||
|
if($r['qualification_date']==$i){echo "selected";} |
||||
|
echo ">$i</option>";} |
||||
|
?> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="col-9 col-sm-9"> |
||||
|
<span class="font-12">Abilitato/a presso</span> |
||||
|
<input type="text" name="qualification_place" value="<?= $r['qualification_place'];?>"> |
||||
|
</div> |
||||
|
<div class="col-3 col-sm-3"> |
||||
|
<span class="font-12">Attivazione account</span> |
||||
|
<select name="enabled"> |
||||
|
<option value="1" <?php if($r['enabled']==1){echo "selected";}?>>Account attivo</option> |
||||
|
<option value="0" <?php if($r['enabled']==0){echo "selected";}?>>Account NON attivo</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-12"> |
||||
|
<span class="font-12">Specializzazioni</span> |
||||
|
<textarea cols="40" rows="6" name="specializations"><?= strip_tags($r['specializations']);?></textarea> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="col-12 text-right"> |
||||
|
<button type="submit" name="go" value="1">Modifica utente</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<?php |
||||
|
}else{ |
||||
|
|
||||
|
?> |
||||
|
<form method="post" class="form-mod" data-path="<?= $BASE_URL;?>/sheets/news/mod"> |
||||
|
<div class="col-12 col-sm-6 mx-auto"> |
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<span class="font-12">N° Iscrizione all'Albo</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col"> |
||||
|
<input type="text" class="id" name="id"> |
||||
|
</div> |
||||
|
<div class="col-auto"> |
||||
|
<button type="submit">Modifica</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<?php |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,24 @@ |
|||||
|
# GitFlowSlides |
||||
|
|
||||
|
LinuxDay Salerno 2017 - |
||||
|
GitFlow - |
||||
|
Carmine De Rosa |
||||
|
|
||||
|
**START** |
||||
|
|
||||
|
``` |
||||
|
npm index.js |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
**Client (slides)** |
||||
|
|
||||
|
``` |
||||
|
http://localhost:3000 |
||||
|
``` |
||||
|
|
||||
|
**Server (controller)** |
||||
|
|
||||
|
``` |
||||
|
http://localhost:3000/control.html |
||||
|
``` |
@ -0,0 +1,17 @@ |
|||||
|
|
||||
|
const express = require('express'); |
||||
|
const app = express(); |
||||
|
const http = require('http').Server(app); |
||||
|
const io = require('socket.io')(http); |
||||
|
const port = process.env.PORT || 3000; |
||||
|
|
||||
|
app.use(express.static(__dirname + '/public')); |
||||
|
|
||||
|
function onConnection(socket){ |
||||
|
socket.on('key', (data) => socket.broadcast.emit('key', data)); |
||||
|
socket.on('slidesLen', (data) => socket.broadcast.emit('slidesLen', data)); |
||||
|
} |
||||
|
|
||||
|
io.on('connection', onConnection); |
||||
|
|
||||
|
http.listen(port, () => console.log('listening on port ' + port)); |
Binary file not shown.
File diff suppressed because it is too large
Binary file not shown.
Loading…
Reference in new issue