From 2b06fa90c9868eeab1fde211d3d9a30383066fab Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Sun, 28 Jan 2018 17:20:44 +0300 Subject: [PATCH] fonts task added in gulp --- .gitignore | 1 + gulpfile.js | 25 +++++- include/grids.php | 206 ---------------------------------------------- 3 files changed, 24 insertions(+), 208 deletions(-) delete mode 100644 include/grids.php diff --git a/.gitignore b/.gitignore index 9a1fc58..0b13e98 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /composer.lock /package-lock.json /public/css/ +/public/fonts/ /public/js/ /public/img/ /public/client-conf/ diff --git a/gulpfile.js b/gulpfile.js index b995a6c..f7c279e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ var gulp = require('gulp'); var copy = require('gulp-copy'); var del = require('del'); -gulp.task('default', ['img', 'css', 'js']); +gulp.task('default', ['img', 'css', 'font', 'js']); gulp.task('clean:img', function () { return del(['public/img']); @@ -31,11 +31,32 @@ gulp.task('css', ['clean:css'], function () { .pipe(gulp.dest('public/css')); }); +gulp.task('clean:font', function() { + return del(['public/fonts']); +}); + +gulp.task('font', ['clean:font'], function() { + return gulp.src([ + 'node_modules/bootstrap/dist/fonts/*', + ]).pipe(gulp.dest('public/fonts')); +}); + gulp.task('clean:js', function () { - return del(['public/assets/js']); + return del(['public/js']); }); gulp.task('js', ['clean:js'], function () { gulp.src(['resources/js/**/*.js']) .pipe(gulp.dest('public/js')); + + gulp + .src([ + 'node_modules/jquery/dist/jquery.min.js', + 'node_modules/bootstrap/dist/js/bootstrap.min.js', + 'node_modules/bootstrap-table/dist/bootstrap-table.min.js', + 'node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js', + 'node_modules/bootstrap-table/dist/extensions/editable/bootstrap-table-editable.min.js', + 'node_modules/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.js' + ]) + .pipe(gulp.dest('public/js')); }); diff --git a/include/grids.php b/include/grids.php deleted file mode 100644 index 68a1138..0000000 --- a/include/grids.php +++ /dev/null @@ -1,206 +0,0 @@ -prepare('SELECT * FROM user'); - $req->execute(); - - if($data = $req->fetch()) { - do { - $list[] = array("user_id" => $data['user_id'], - "user_pass" => $data['user_pass'], - "user_mail" => $data['user_mail'], - "user_phone" => $data['user_phone'], - "user_online" => $data['user_online'], - "user_enable" => $data['user_enable'], - "user_start_date" => $data['user_start_date'], - "user_end_date" => $data['user_end_date']); - } while($data = $req->fetch()); - - echo json_encode($list); - } - // If it is an empty answer, we need to encore an empty json object - else{ - $list = array(); - echo json_encode($list); - } - } - - // Select the logs - else if($_GET['select'] == "log" && isset($_GET['offset'], $_GET['limit'])){ - $offset = intval($_GET['offset']); - $limit = intval($_GET['limit']); - - // Creation of the LIMIT for build different pages - $page = "LIMIT $offset, $limit"; - - // Select the logs - $req_string = "SELECT *, (SELECT COUNT(*) FROM log) AS nb FROM log ORDER BY log_id DESC $page"; - $req = $bdd->prepare($req_string); - $req->execute(); - - $list = array(); - - $data = $req->fetch(); - - if($data) { - $nb = $data['nb']; - - do { - // Better in Kb or Mb - $received = ($data['log_received'] > 1000000) ? $data['log_received']/1000000 . " Mo" : $data['log_received']/1000 . " Ko"; - $sent = ($data['log_send'] > 1000000) ? $data['log_send']/1000000 . " Mo" : $data['log_send']/1000 . " Ko"; - - // We add to the array the new line of logs - array_push($list, array( - "log_id" => $data['log_id'], - "user_id" => $data['user_id'], - "log_trusted_ip" => $data['log_trusted_ip'], - "log_trusted_port" => $data['log_trusted_port'], - "log_remote_ip" => $data['log_remote_ip'], - "log_remote_port" => $data['log_remote_port'], - "log_start_time" => $data['log_start_time'], - "log_end_time" => $data['log_end_time'], - "log_received" => $received, - "log_send" => $sent)); - - - } while ($data = $req->fetch()); - } - else { - $nb = 0; - } - - // We finally print the result - $result = array('total' => intval($nb), 'rows' => $list); - - echo json_encode($result); - } - - // Select the admins - else if($_GET['select'] == "admin"){ - $req = $bdd->prepare('SELECT * FROM admin'); - $req->execute(); - - if($data = $req->fetch()) { - do{ - $list[] = array( - "admin_id" => $data['admin_id'], - "admin_pass" => $data['admin_pass'] - ); - } while($data = $req->fetch()); - - echo json_encode($list); - } - else{ - $list = array(); - echo json_encode($list); - } - } - } - - // ---------------- ADD USER ---------------- - else if(isset($_POST['add_user'], $_POST['user_id'], $_POST['user_pass'])){ - // Put some default values - $id = $_POST['user_id']; - $pass = hashPass($_POST['user_pass']); - $mail = ""; - $phone = ""; - $online = 0; - $enable = 1; - $start = NULL; - $end = NULL; - - $req = $bdd->prepare('INSERT INTO user (user_id, user_pass, user_mail, user_phone, user_online, user_enable, user_start_date, user_end_date) - VALUES (?, ?, ?, ?, ?, ?, ?, ?)'); - $req->execute(array($id, $pass, $mail, $phone, $online, $enable, $start, $end)); - - $res = array("user_id" => $id, - "user_pass" => $pass, - "user_mail" => $mail , - "user_phone" => $phone, - "user_online" => $online, - "user_enable" => $enable, - "user_start_date" => $start, - "user_end_date" => $end - ); - - echo json_encode($res); - } - - // ---------------- UPDATE USER ---------------- - else if(isset($_POST['set_user'])){ - $valid = array("user_id", "user_pass", "user_mail", "user_phone", "user_enable", "user_start_date", "user_end_date"); - - $field = $_POST['name']; - $value = $_POST['value']; - $pk = $_POST['pk']; - - if (!isset($field) || !isset($pk) || !in_array($field, $valid)) { - return; - } - - if ($field === 'user_pass') { - $value = hashPass($value); - } - else if (($field === 'user_start_date' || $field === 'user_end_date') && $value === '') { - $value = NULL; - } - - // /!\ SQL injection: field was checked with in_array function - $req_string = 'UPDATE user SET ' . $field . ' = ? WHERE user_id = ?'; - $req = $bdd->prepare($req_string); - $req->execute(array($value, $pk)); - } - - // ---------------- REMOVE USER ---------------- - else if(isset($_POST['del_user'], $_POST['del_user_id'])){ - $req = $bdd->prepare('DELETE FROM user WHERE user_id = ?'); - $req->execute(array($_POST['del_user_id'])); - } - - // ---------------- ADD ADMIN ---------------- - else if(isset($_POST['add_admin'], $_POST['admin_id'], $_POST['admin_pass'])){ - $req = $bdd->prepare('INSERT INTO admin(admin_id, admin_pass) VALUES (?, ?)'); - $req->execute(array($_POST['admin_id'], hashPass($_POST['admin_pass']))); - } - - // ---------------- UPDATE ADMIN ---------------- - else if(isset($_POST['set_admin'])){ - $valid = array("admin_id", "admin_pass"); - - $field = $_POST['name']; - $value = $_POST['value']; - $pk = $_POST['pk']; - - if (!isset($field) || !isset($pk) || !in_array($field, $valid)) { - return; - } - - if ($field === 'admin_pass') { - $value = hashPass($value); - } - - $req_string = 'UPDATE admin SET ' . $field . ' = ? WHERE admin_id = ?'; - $req = $bdd->prepare($req_string); - $req->execute(array($value, $pk)); - } - - // ---------------- REMOVE ADMIN ---------------- - else if(isset($_POST['del_admin'], $_POST['del_admin_id'])){ - $req = $bdd->prepare('DELETE FROM admin WHERE admin_id = ?'); - $req->execute(array($_POST['del_admin_id'])); - } - -?>