Commit initial
This commit is contained in:
10
server/webplatform/apps/CameraMonitor/Config/config.ini
Normal file
10
server/webplatform/apps/CameraMonitor/Config/config.ini
Normal file
@ -0,0 +1,10 @@
|
||||
;Configuration
|
||||
|
||||
[Installation]
|
||||
root = /
|
||||
host = 'cam.wildsparksoftware.com'
|
||||
|
||||
[BD]
|
||||
dsn = 'mysql:host=localhost;dbname=projetl3;charset=utf8'
|
||||
login = root
|
||||
mdp =
|
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Controller/ControllerSecureUserCam.php';
|
||||
require_once $GLOBALS['app_path'].'Model/ModelCamera.php';
|
||||
require_once $GLOBALS['app_path'].'Model/ModelUser.php';
|
||||
require_once $GLOBALS['app_path'].'Model/Entity/Camera.php';
|
||||
|
||||
|
||||
|
||||
class ControllerCamera extends ControllerSecureUserCam {
|
||||
|
||||
public function index()
|
||||
{
|
||||
$modelUser = new ModelUser();
|
||||
$user = $modelUser->getUserById($this->request->getSession()->getAttribute('user_id'));
|
||||
$modelCamera = new ModelCamera();
|
||||
$camera = $modelCamera->getCamera($this->request->getParameter('id'),$this->request->getSession()->getAttribute('user_id'));
|
||||
$headScript = '<script src="jwplayer/jwplayer.js"></script><script>jwplayer.key="xEPI8DEypoE2gSBetC0/Vecoos0JKOx8WLKNMw==";</script>';
|
||||
$this->generateView(array('camera' => $camera, 'headScript' => $headScript, 'user'=> $user));
|
||||
}
|
||||
|
||||
public function swapState()
|
||||
{
|
||||
$whereController = "default";
|
||||
$whereAction = null;
|
||||
if($this->request->existParameter('whereController'))
|
||||
$whereController = $this->request->getParameter('whereController');
|
||||
if($this->request->existParameter('whereAction'))
|
||||
$whereAction = $this->request->getParameter('whereAction');
|
||||
|
||||
if($this->request->existParameter('swap'))
|
||||
{
|
||||
$command = null;
|
||||
$modelUser = new ModelUser();
|
||||
$modelCamera = new ModelCamera();
|
||||
$camera = $modelCamera->getCamera($this->request->getParameter('id'),$this->request->getSession()->getAttribute('user_id'));
|
||||
$login = $this->request->getSession()->getAttribute('login');
|
||||
$password = $modelUser->getUserById($this->request->getSession()->getAttribute('user_id'))->getPassword();
|
||||
$swap = $this->request->getParameter('swap');
|
||||
|
||||
if($swap == 'enable' && $camera->getEnabled() == false)
|
||||
$command = "enable";
|
||||
else
|
||||
if($swap == 'disable' && $camera->getEnabled() == true)
|
||||
$command = 'disable';
|
||||
if($command != null)
|
||||
$this->sendCommand($login,$password,$camera->getId(),$command);
|
||||
}
|
||||
$this->redirect($whereController,$whereAction);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$modelUser = new ModelUser();
|
||||
$modelUser->deleteCam($this->request->getSession()->getAttribute('user_id'),$this->request->getParameter('id'));
|
||||
$this->redirect('default','settings');
|
||||
}
|
||||
|
||||
private function sendCommand($login,$password,$camera_id,$command)
|
||||
{
|
||||
$s = socket_create(AF_INET,SOCK_STREAM,0);
|
||||
if($s == false)
|
||||
throw new Exception("Creation de socket echoue");
|
||||
$addr = gethostbyname(Configuration::get('host'));
|
||||
if($addr == Configuration::get('host'))
|
||||
{
|
||||
socket_close($s);
|
||||
throw new Exception("Recuperation IP impossible ");
|
||||
}
|
||||
$result = socket_connect($s,$addr,40550);
|
||||
if($result == false)
|
||||
{
|
||||
socket_close($s);
|
||||
throw new Exception("Connection socket échoue");
|
||||
}
|
||||
$str = $login.":".$password.":".$command.":".$camera_id; //Command = enable|disable|disconnect
|
||||
$buf = $str."\0";
|
||||
$size = socket_write($s,$buf,strlen($str)+1);
|
||||
if($size != strlen($buf))
|
||||
{
|
||||
socket_close($s);
|
||||
throw new Exception("Ecriture dans la socket impossible");
|
||||
}
|
||||
$data = "";
|
||||
$ret = socket_recv($s, $data, 1, MSG_WAITALL);
|
||||
while($ret == 1 && $data != "\0")
|
||||
{
|
||||
$buf .= $data;
|
||||
$data = "";
|
||||
$ret = socket_recv($s, $data, 1, MSG_WAITALL);
|
||||
}
|
||||
|
||||
if($ret != 1 && strlen($buf) == 0)
|
||||
{
|
||||
socket_close($s);
|
||||
throw new Exception('Erreur rien à lire dans la socket');
|
||||
}
|
||||
|
||||
socket_close($s);
|
||||
}
|
||||
|
||||
public function delayed()
|
||||
{
|
||||
$videos = array();
|
||||
$records_path = "Content/records/".$this->request->getParameter("id");
|
||||
if(file_exists($records_path))
|
||||
{
|
||||
$files = scandir($records_path);
|
||||
if($files != false)
|
||||
{
|
||||
$i = 0;
|
||||
foreach($files as $file)
|
||||
{
|
||||
$path = $records_path."/".$file;
|
||||
|
||||
if(is_file($path))
|
||||
{
|
||||
$regex_results = array();
|
||||
if(preg_match("/^([0-9]|[1-9][0-9]*)_([0-9]|[1-9][0-9]*)\.mp4$/",$file,$regex_results) == 1)
|
||||
{
|
||||
$videos[$i]["path"] = $path;
|
||||
$videos[$i]["begin"] = date('j/n/Y H:i:s',$regex_results[1]);
|
||||
$videos[$i]["end"] = date('j/n/Y H:i:s',$regex_results[2]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$headScript = '<script src="jwplayer/jwplayer.js"></script><script>jwplayer.key="xEPI8DEypoE2gSBetC0/Vecoos0JKOx8WLKNMw==";</script>';
|
||||
$this->generateView(array('videos' => $videos, 'headScript' => $headScript));
|
||||
}
|
||||
else
|
||||
throw new Exception("Fichier '".$records_path."' inconnue");
|
||||
}
|
||||
else
|
||||
throw new Exception("Dossier '".$records_path."' inconnue");
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
require_once $GLOBALS['app_path'].'Framework/Controller.php';
|
||||
require_once $GLOBALS['app_path'].'Model/ModelUser.php';
|
||||
|
||||
class ControllerConnexion extends Controller
|
||||
{
|
||||
private $modelUser;
|
||||
public function __construct()
|
||||
{
|
||||
$this->modelUser = new ModelUser();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$this->generateView();
|
||||
}
|
||||
public function logOn()
|
||||
{
|
||||
if ($this->request->existParameter("login") && $this->request->existParameter("password")) {
|
||||
$login = $this->request->getParameter("login");
|
||||
$password = sha1($this->request->getParameter("password"));
|
||||
if ($this->modelUser->exist($login, $password))
|
||||
{
|
||||
$user = $this->modelUser->getUser($login, $password);
|
||||
$this->request->getSession()->setAttribute("user_id",
|
||||
$user->getId());
|
||||
$this->request->getSession()->setAttribute("login",
|
||||
$user->getLogin());
|
||||
|
||||
if($login == "root")
|
||||
$this->redirect('default','admin');
|
||||
else
|
||||
$this->redirect("default");
|
||||
}
|
||||
else
|
||||
$this->generateView(array('msgError' => 'Login ou mot de passe incorrects'),
|
||||
"index");
|
||||
}
|
||||
else
|
||||
throw new Exception("Action impossible : login ou mot de passe non défini");
|
||||
}
|
||||
|
||||
public function registration()
|
||||
{
|
||||
$this->generateView();
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
if ($this->request->existParameter("login") && $this->request->existParameter("password") && $this->request->existParameter("passwordBis")) {
|
||||
$login = $this->request->getParameter("login");
|
||||
$password = sha1($this->request->getParameter("password"));
|
||||
$passwordBis = sha1($this->request->getParameter("passwordBis"));
|
||||
if ($password == $passwordBis) {
|
||||
if(!$this->modelUser->exist($login,$password))
|
||||
{
|
||||
$this->modelUser->addUser($login, $password);
|
||||
$this->redirect("default");
|
||||
}
|
||||
else
|
||||
$this->generateView(array('msgError' => 'Utilisateur déja existant'),
|
||||
"registration");
|
||||
}
|
||||
else
|
||||
$this->generateView(array('msgError' => 'Les mots de passes doivent être identiques'),
|
||||
"registration");
|
||||
}
|
||||
else
|
||||
throw new Exception("Action impossible : login ou mot de passe non défini");
|
||||
}
|
||||
|
||||
public function disconnect()
|
||||
{
|
||||
$this->request->getSession()->destruct();
|
||||
$this->redirect("connexion");
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Controller/ControllerSecure.php';
|
||||
require_once $GLOBALS['app_path'].'Model/ModelCamera.php';
|
||||
require_once $GLOBALS['app_path'].'Model/Entity/Camera.php';
|
||||
require_once $GLOBALS['app_path'].'Model/ModelUser.php';
|
||||
|
||||
|
||||
|
||||
|
||||
class ControllerDefault extends ControllerSecure {
|
||||
|
||||
public function index()
|
||||
{
|
||||
$modelCamera = new ModelCamera();
|
||||
$cameras = $modelCamera->getAllCameraByUser($this->request->getSession()->getAttribute('user_id'));
|
||||
$this->generateView(array('cameras' => $cameras));
|
||||
}
|
||||
|
||||
public function settings()
|
||||
{
|
||||
$modelCamera = new ModelCamera();
|
||||
$modelUser = new ModelUser();
|
||||
$user_id = $this->request->getSession()->getAttribute('user_id');
|
||||
$user = $modelUser->getUserById($user_id);
|
||||
$cameras = $modelCamera->getAllCameraByUser($user_id);
|
||||
$this->generateView(array('cameras' => $cameras, 'user' => $user));
|
||||
}
|
||||
|
||||
public function updateLogin()
|
||||
{
|
||||
$messageInfo = "";
|
||||
$modelUser = new ModelUser();
|
||||
$modelCamera = new ModelCamera();
|
||||
$user_id = $this->request->getSession()->getAttribute('user_id');
|
||||
$user = $modelUser->getUserById($user_id);
|
||||
$cameras = $modelCamera->getAllCameraByUser($user_id);
|
||||
|
||||
if($this->request->existParameter('login'))
|
||||
{
|
||||
$login = $this->request->getParameter('login');
|
||||
if($user->getLogin() != $login)
|
||||
{
|
||||
if(!$modelUser->exist($login, $user->getPassword()))
|
||||
{
|
||||
$modelUser->update($user->getId(),$login,$user->getPassword());
|
||||
$messageInfo = "Modification effectué";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Ce login existe déja";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Ce Login est déja le vôtre";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Login manquant";
|
||||
|
||||
$this->generateView(array('cameras' => $cameras, 'user' => $user, 'messageInfo' => $messageInfo ),'settings');
|
||||
}
|
||||
|
||||
public function updatePassword()
|
||||
{
|
||||
$messageInfo = "";
|
||||
$modelUser = new ModelUser();
|
||||
$modelCamera = new ModelCamera();
|
||||
$user_id = $this->request->getSession()->getAttribute('user_id');
|
||||
$user = $modelUser->getUserById($user_id);
|
||||
$cameras = $modelCamera->getAllCameraByUser($user_id);
|
||||
|
||||
if($this->request->existParameter('password') && $this->request->existParameter('passwordBis'))
|
||||
{
|
||||
$password = $this->request->getParameter('password');
|
||||
$passwordBis = $this->request->getParameter('passwordBis');
|
||||
if($password == $passwordBis)
|
||||
{
|
||||
if ($user->getPassword() != $password)
|
||||
{
|
||||
$modelUser->update($user->getId(), $user->getLogin(), $password);
|
||||
$messageInfo = "Modification effectué";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Ce mot de passe est déja le vôtre";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Les deux mot de passe doivent être les mêmes";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Les deux champs mot de passe doivent être remplies";
|
||||
|
||||
$this->generateView(array('cameras' => $cameras, 'user' => $user, 'messageInfo' => $messageInfo ),'settings');
|
||||
}
|
||||
|
||||
public function addCam()
|
||||
{
|
||||
$messageInfo = "";
|
||||
$modelUser = new ModelUser();
|
||||
$modelCamera = new ModelCamera();
|
||||
$user_id = $this->request->getSession()->getAttribute('user_id');
|
||||
$user = $modelUser->getUserById($user_id);
|
||||
|
||||
if($this->request->existParameter('name') && $this->request->existParameter('camera_id'))
|
||||
{
|
||||
$name = $this->request->getParameter('name');
|
||||
$camera_id = $this->request->getParameter('camera_id');
|
||||
if($modelCamera->exist($camera_id))
|
||||
{
|
||||
if (!$modelUser->haveCam($user->getId(), $camera_id))
|
||||
{
|
||||
$modelUser->addCam($user->getId(), $camera_id, $name);
|
||||
$messageInfo = "Modification effectué";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Vous avez déja accès à cette caméra";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Le numéro de série ne correspond à aucune caméra";
|
||||
}
|
||||
else
|
||||
$messageInfo = "Les champs name et numéro de série doivent être remplies";
|
||||
|
||||
$cameras = $modelCamera->getAllCameraByUser($user_id);
|
||||
|
||||
$this->generateView(array('cameras' => $cameras, 'user' => $user, 'messageInfo' => $messageInfo ),'settings');
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
if($this->request->getSession()->getAttribute('login') == "root")
|
||||
{
|
||||
$this->generateView();
|
||||
}
|
||||
else
|
||||
throw new Exception('Vous n\'avez pas accès à cette page');
|
||||
}
|
||||
|
||||
public function addCamAdmin()
|
||||
{
|
||||
if($this->request->getSession()->getAttribute('login') == "root")
|
||||
{
|
||||
$modelCamera = new ModelCamera();
|
||||
$id = uniqid("",false).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9);
|
||||
$product_key = sha1(strval(rand()));
|
||||
$modelCamera->addCamera($id,$product_key,0,0,"");
|
||||
$this->generateView(array("id"=>$id, "product_key"=>$product_key),"admin");
|
||||
}
|
||||
else
|
||||
throw new Exception('Vous n\'avez pas accès à cette page');
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
require_once $GLOBALS['app_path'].'Framework/Controller.php';
|
||||
|
||||
abstract class ControllerSecure extends Controller
|
||||
{
|
||||
public function executeAction($action)
|
||||
{
|
||||
if ($this->request->getSession()->existAttribute("user_id")) {
|
||||
parent::executeAction($action);
|
||||
}
|
||||
else {
|
||||
$this->redirect("connexion");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require_once $GLOBALS['app_path'].'Framework/Controller.php';
|
||||
|
||||
abstract class ControllerSecureUserCam extends Controller
|
||||
{
|
||||
public function executeAction($action)
|
||||
{
|
||||
if ($this->request->getSession()->existAttribute("user_id"))
|
||||
{
|
||||
$user_id = $this->request->getSession()->getAttribute("user_id");
|
||||
if($this->request->existParameter('id'))
|
||||
{
|
||||
$camera_id = $this->request->getParameter('id');
|
||||
$modelCamera = new ModelCamera();
|
||||
if($modelCamera->userCanAccessCam($user_id,$camera_id))
|
||||
parent::executeAction($action);
|
||||
else
|
||||
throw new Exception('Vous n\'avez pas accès à cette caméra');
|
||||
}
|
||||
else
|
||||
throw new Exception('Id caméra non spécifié');
|
||||
}
|
||||
else {
|
||||
$this->redirect("connexion");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class Configuration {
|
||||
|
||||
private static $parameters;
|
||||
|
||||
public static function get($nom, $default = null) {
|
||||
if (isset(self::getParameters()[$nom])) {
|
||||
$value = self::getParameters()[$nom];
|
||||
}
|
||||
else {
|
||||
$value = $default;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
private static function getParameters() {
|
||||
if (self::$parameters == null) {
|
||||
$pathFile = $GLOBALS['app_path']."Config/config.ini";
|
||||
|
||||
if (!file_exists($pathFile)) {
|
||||
throw new Exception("Aucun fichier de configuration trouvé");
|
||||
}
|
||||
else {
|
||||
self::$parameters = parse_ini_file($pathFile);
|
||||
}
|
||||
}
|
||||
return self::$parameters;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Framework/Request.php';
|
||||
require_once $GLOBALS['app_path'].'Framework/View.php';
|
||||
|
||||
abstract class Controller {
|
||||
|
||||
private $action;
|
||||
|
||||
protected $request;
|
||||
|
||||
public function setRequest(Request $request) {
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function executeAction($action) {
|
||||
if (method_exists($this, $action)) {
|
||||
$this->action = $action;
|
||||
$this->{$this->action}();
|
||||
}
|
||||
else {
|
||||
$classController = get_class($this);
|
||||
throw new Exception("Action '$action' non définie dans la classe $classController");
|
||||
}
|
||||
}
|
||||
|
||||
public abstract function index();
|
||||
|
||||
protected function generateView($dataView = array(), $action = null) {
|
||||
|
||||
$actionView = $this->action;
|
||||
if ($action != null)
|
||||
$actionView = $action;
|
||||
|
||||
$classController = get_class($this);
|
||||
$controller = str_replace("Controller", "", $classController);
|
||||
$vue = new View($actionView, $controller);
|
||||
$vue->generate($dataView);
|
||||
}
|
||||
|
||||
protected function redirect($controller, $action = null)
|
||||
{
|
||||
$root = Configuration::get("root", "/");
|
||||
header("Location:" . $root . $controller . "/" . $action);
|
||||
}
|
||||
}
|
32
server/webplatform/apps/CameraMonitor/Framework/Model.php
Normal file
32
server/webplatform/apps/CameraMonitor/Framework/Model.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once $GLOBALS['app_path'].'Framework/Configuration.php';
|
||||
|
||||
abstract class Model
|
||||
{
|
||||
|
||||
private static $bdd;
|
||||
|
||||
protected function executeRequest($sql, $params = null)
|
||||
{
|
||||
if ($params == null) {
|
||||
$result = self::getBdd()->query($sql);
|
||||
}
|
||||
else {
|
||||
$result = self::getBdd()->prepare($sql);
|
||||
$result->execute($params);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function getBdd()
|
||||
{
|
||||
if (self::$bdd === null) {
|
||||
$dsn = Configuration::get("dsn");
|
||||
$login = Configuration::get("login");
|
||||
$mdp = Configuration::get("mdp");
|
||||
self::$bdd = new PDO($dsn, $login, $mdp,
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
}
|
||||
return self::$bdd;
|
||||
}
|
||||
}
|
31
server/webplatform/apps/CameraMonitor/Framework/Request.php
Normal file
31
server/webplatform/apps/CameraMonitor/Framework/Request.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Framework/Session.php';
|
||||
|
||||
class Request {
|
||||
|
||||
private $parameters;
|
||||
private $session;
|
||||
|
||||
|
||||
public function __construct($parameters) {
|
||||
$this->parameters = $parameters;
|
||||
$this->session = new Session();
|
||||
}
|
||||
|
||||
public function existParameter($nom) {
|
||||
return (isset($this->parameters[$nom]) && $this->parameters[$nom] != "");
|
||||
}
|
||||
|
||||
public function getParameter($nom) {
|
||||
if ($this->existParameter($nom)) {
|
||||
return $this->parameters[$nom];
|
||||
}
|
||||
else
|
||||
throw new Exception("Paramètre '$nom' absent de la requête");
|
||||
}
|
||||
|
||||
public function getSession(){
|
||||
return $this->session;
|
||||
}
|
||||
}
|
58
server/webplatform/apps/CameraMonitor/Framework/Router.php
Normal file
58
server/webplatform/apps/CameraMonitor/Framework/Router.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Framework/Request.php';
|
||||
require_once $GLOBALS['app_path'].'Framework/View.php';
|
||||
|
||||
class Router {
|
||||
|
||||
public function routingRequest() {
|
||||
try {
|
||||
$request = new Request(array_merge($_GET, $_POST));
|
||||
|
||||
$controller = $this->createController($request);
|
||||
$action = $this->createAction($request);
|
||||
|
||||
$controller->executeAction($action);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
private function createController($request) {
|
||||
$controller = "Default";
|
||||
if ($request->existParameter('controller')) {
|
||||
$controller = $request->getParameter('controller');
|
||||
$controller = ucfirst(strtolower($controller));
|
||||
}
|
||||
|
||||
$classController = "Controller" . $controller;
|
||||
$fileController = $GLOBALS['app_path']."Controller/" . $classController . ".php";
|
||||
if (file_exists($fileController)) {
|
||||
|
||||
require($fileController);
|
||||
$controller = new $classController();
|
||||
$controller->setRequest($request);
|
||||
return $controller;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Fichier '$fileController' introuvable");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function createAction(Request $request) {
|
||||
$action = "index";
|
||||
if ($request->existParameter('action')) {
|
||||
$action = $request->getParameter('action');
|
||||
}
|
||||
return $action;
|
||||
}
|
||||
|
||||
private function error($exception) {
|
||||
$view = new View('error');
|
||||
$view->generate(array('msgError' => $exception->getMessage()));
|
||||
}
|
||||
|
||||
}
|
35
server/webplatform/apps/CameraMonitor/Framework/Session.php
Normal file
35
server/webplatform/apps/CameraMonitor/Framework/Session.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Session
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
session_start();
|
||||
}
|
||||
|
||||
public function destruct()
|
||||
{
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
public function setAttribute($name, $value)
|
||||
{
|
||||
$_SESSION[$name] = $value;
|
||||
}
|
||||
|
||||
public function existAttribute($name)
|
||||
{
|
||||
return (isset($_SESSION[$name]) && $_SESSION[$name] != "");
|
||||
}
|
||||
|
||||
public function getAttribute($name)
|
||||
{
|
||||
if ($this->existAttribute($name)) {
|
||||
return $_SESSION[$name];
|
||||
}
|
||||
else {
|
||||
throw new Exception("Attribut '$name' absent de la session");
|
||||
}
|
||||
}
|
||||
}
|
49
server/webplatform/apps/CameraMonitor/Framework/View.php
Normal file
49
server/webplatform/apps/CameraMonitor/Framework/View.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require_once $GLOBALS['app_path'].'Framework/Configuration.php';
|
||||
|
||||
class View {
|
||||
|
||||
private $file;
|
||||
|
||||
public function __construct($action, $controller = "") {
|
||||
$file = $GLOBALS['app_path']."View/";
|
||||
if ($controller != "") {
|
||||
$file = $file . $controller . "/";
|
||||
}
|
||||
$this->file = $file . $action . ".php";
|
||||
}
|
||||
|
||||
public function generate($data) {
|
||||
$content = $this->generateFile($this->file, $data);
|
||||
|
||||
$title = "";
|
||||
$headScript = "";
|
||||
if(isset($data['title']))
|
||||
$title = $data['title'];
|
||||
if(isset($data['headScript']))
|
||||
$headScript = $data['headScript'];
|
||||
|
||||
$root = Configuration::get("root", "/");
|
||||
$vue = $this->generateFile($GLOBALS['app_path'].'View/template.php',
|
||||
array('headScript'=> $headScript, 'title' => $title, 'content' => $content,
|
||||
'root' => $root));
|
||||
echo $vue;
|
||||
}
|
||||
|
||||
private function generateFile($file, $data) {
|
||||
if (file_exists($file)) {
|
||||
extract($data);
|
||||
ob_start();
|
||||
require $file;
|
||||
return ob_get_clean();
|
||||
}
|
||||
else {
|
||||
throw new Exception("Fichier '$file' introuvable");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function clean($value) {
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
}
|
122
server/webplatform/apps/CameraMonitor/Model/Entity/Camera.php
Normal file
122
server/webplatform/apps/CameraMonitor/Model/Entity/Camera.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
class Camera
|
||||
{
|
||||
|
||||
private $id;
|
||||
private $name;
|
||||
private $product_key;
|
||||
private $available;
|
||||
private $enabled;
|
||||
private $rtmp_handle;
|
||||
|
||||
function __construct($id, $name, $product_key, $available, $enabled, $rtmp_handle)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->available = $available;
|
||||
$this->enabled = $enabled;
|
||||
$this->id = $id;
|
||||
$this->product_key = $product_key;
|
||||
$this->rtmp_handle = $rtmp_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRtmpHandle()
|
||||
{
|
||||
return $this->rtmp_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $rtmp_handle
|
||||
*/
|
||||
public function setRtmpHandle($rtmp_handle)
|
||||
{
|
||||
$this->rtmp_handle = $rtmp_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductKey()
|
||||
{
|
||||
return $this->product_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $product_key
|
||||
*/
|
||||
public function setProductKey($product_key)
|
||||
{
|
||||
$this->product_key = $product_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAvailable()
|
||||
{
|
||||
return $this->available;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $available
|
||||
*/
|
||||
public function setAvailable($available)
|
||||
{
|
||||
$this->available = $available;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEnabled()
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $enabled
|
||||
*/
|
||||
public function setEnabled($enabled)
|
||||
{
|
||||
$this->enabled = $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
64
server/webplatform/apps/CameraMonitor/Model/Entity/User.php
Normal file
64
server/webplatform/apps/CameraMonitor/Model/Entity/User.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
class User {
|
||||
|
||||
private $id;
|
||||
private $login;
|
||||
private $password;
|
||||
|
||||
public function __construct($id, $login, $password) {
|
||||
$this->id = $id;
|
||||
$this->login = $login;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLogin()
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $login
|
||||
*/
|
||||
public function setLogin($login)
|
||||
{
|
||||
$this->login = $login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $password
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
|
||||
}
|
85
server/webplatform/apps/CameraMonitor/Model/ModelCamera.php
Normal file
85
server/webplatform/apps/CameraMonitor/Model/ModelCamera.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Framework/Model.php';
|
||||
require_once $GLOBALS['app_path'].'Model/Entity/Camera.php';
|
||||
|
||||
class ModelCamera extends Model{
|
||||
|
||||
public function getCamera($camera_id, $user_id)
|
||||
{
|
||||
$sql = "select * from camera where id=?";
|
||||
$result = $this->executeRequest($sql, array($camera_id));
|
||||
if ( $result->rowCount() == 1)
|
||||
{
|
||||
$result = $result->fetch();
|
||||
$name = $this->getNameCameraByUser($user_id, $camera_id);
|
||||
return new Camera($result['id'], $name, $result['product_key'],$result['available'],$result['enabled'],$result['rtmp_handle']);
|
||||
}
|
||||
else
|
||||
throw new Exception("Aucune caméra ne correspond à cet identifiant");
|
||||
}
|
||||
|
||||
public function getNameCameraByUser($user_id, $camera_id)
|
||||
{
|
||||
$sql = "select name from user_camera where user_id=? and camera_id=?";
|
||||
$result = $this->executeRequest($sql, array($user_id, $camera_id));
|
||||
if($result->rowCount() == 1)
|
||||
return $result->fetch()['name'];
|
||||
else
|
||||
throw new Exception("Cet utilisateur n'as pas accès à cet caméra");
|
||||
}
|
||||
|
||||
public function addCamera($id, $product_key, $available, $enabled, $rtmp_handle)
|
||||
{
|
||||
$sql = "insert into camera values(?,?,?,?,?)";
|
||||
$this->executeRequest($sql, array($id, $product_key, $available, $enabled, $rtmp_handle));
|
||||
}
|
||||
|
||||
public function getAllCameraByUser($user_id)
|
||||
{
|
||||
$sql = "select * from user_camera where user_id=?";
|
||||
$result = $this->executeRequest($sql, array($user_id));
|
||||
$result = $result->fetchAll();
|
||||
$cameras = null;
|
||||
foreach($result as $cam)
|
||||
{
|
||||
$cameras[] = $this->getCamera($cam['camera_id'], $user_id);
|
||||
}
|
||||
|
||||
return $cameras;
|
||||
}
|
||||
|
||||
public function userCanAccessCam($user_id, $camera_id)
|
||||
{
|
||||
$sql = "select name from user_camera where user_id=? and camera_id=?";
|
||||
$result = $this->executeRequest($sql, array($user_id, $camera_id));
|
||||
return $result->rowCount() == 1;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$sql = "delete from camera where id=?";
|
||||
$this->executeRequest($sql,array($id));
|
||||
}
|
||||
|
||||
public function exist($camera_id)
|
||||
{
|
||||
$sql = "select * from camera where id=? ";
|
||||
$result = $this->executeRequest($sql, array($camera_id));
|
||||
return ($result->rowCount() == 1);
|
||||
}
|
||||
|
||||
public function getCameraOnly($camera_id)
|
||||
{
|
||||
$sql = "select * from camera where id=?";
|
||||
$result = $this->executeRequest($sql, array($camera_id));
|
||||
if ( $result->rowCount() == 1)
|
||||
{
|
||||
$result = $result->fetch();
|
||||
return new Camera($result['id'], "", $result['product_key'],$result['available'],$result['enabled'],$result['rtmp_handle']);
|
||||
}
|
||||
else
|
||||
throw new Exception("Aucune caméra ne correspond à cet identifiant");
|
||||
}
|
||||
|
||||
}
|
75
server/webplatform/apps/CameraMonitor/Model/ModelUser.php
Normal file
75
server/webplatform/apps/CameraMonitor/Model/ModelUser.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
require_once $GLOBALS['app_path'].'Framework/Model.php';
|
||||
require_once $GLOBALS['app_path'].'Model/Entity/User.php';
|
||||
|
||||
class ModelUser extends Model{
|
||||
|
||||
public function exist($login, $password)
|
||||
{
|
||||
$sql = "select id from user where login=? and password=?";
|
||||
$user = $this->executeRequest($sql, array($login, $password));
|
||||
return ($user->rowCount() == 1);
|
||||
}
|
||||
|
||||
public function getUser($login, $password)
|
||||
{
|
||||
$sql = "select * from user where login=? and password=?";
|
||||
$result = $this->executeRequest($sql, array($login, $password));
|
||||
if ( $result->rowCount() == 1)
|
||||
{
|
||||
$result = $result->fetch();
|
||||
return new User($result['id'],$result['login'],$result['password']);
|
||||
}
|
||||
else
|
||||
throw new Exception("Aucun utilisateur ne correspond aux identifiants fournis");
|
||||
}
|
||||
|
||||
public function addUser($login, $password)
|
||||
{
|
||||
$sql = "insert into user values('',?,?)";
|
||||
$this->executeRequest($sql, array($login, $password));
|
||||
}
|
||||
|
||||
public function getUserById($id)
|
||||
{
|
||||
$sql = "select * from user where id=?";
|
||||
$result = $this->executeRequest($sql, array($id));
|
||||
if ( $result->rowCount() == 1)
|
||||
{
|
||||
$result = $result->fetch();
|
||||
return new User($result['id'],$result['login'],$result['password']);
|
||||
}
|
||||
else
|
||||
throw new Exception("Aucun utilisateur ne correspond à l'id fournis");
|
||||
}
|
||||
|
||||
public function update($id,$login,$password)
|
||||
{
|
||||
$sql = "update user Set login=?, password=? where id=?";
|
||||
$this->executeRequest($sql, array($login,$password,$id));
|
||||
}
|
||||
|
||||
public function deleteCam($user_id, $camera_id)
|
||||
{
|
||||
$sql = "delete from user_camera where user_id=? and camera_id=?";
|
||||
$this->executeRequest($sql,array($user_id,$camera_id));
|
||||
}
|
||||
|
||||
public function addCam($user_id, $camera_id, $name)
|
||||
{
|
||||
$sql = "insert into user_camera values(?,?,?)";
|
||||
$this->executeRequest($sql, array($user_id, $camera_id, $name));
|
||||
}
|
||||
|
||||
public function haveCam($user_id, $camera_id)
|
||||
{
|
||||
$sql = "select * from user_camera where user_id=? and camera_id=?";
|
||||
$result = $this->executeRequest($sql,array($user_id, $camera_id));
|
||||
|
||||
if($result->rowCount() == 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<form method="get" action="default">
|
||||
<button type="submit">Retour</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="connexion/disconnect">
|
||||
<button type="submit">Deconnexion</button>
|
||||
</form>
|
||||
|
||||
<?php foreach($videos as $i => $video): ?>
|
||||
<h5>Du <?=$video["begin"]?> au <?=$video["end"]?></h5>
|
||||
<div id="rtmp-player-container-<?=$i?>"></div>
|
||||
<script>
|
||||
jwplayer("rtmp-player-container-<?=$i?>").setup({
|
||||
file: "<?=$video['path']?>",
|
||||
preload: false
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
37
server/webplatform/apps/CameraMonitor/View/Camera/index.php
Normal file
37
server/webplatform/apps/CameraMonitor/View/Camera/index.php
Normal file
@ -0,0 +1,37 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<form method="get" action="default">
|
||||
<button type="submit">Retour</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="connexion/disconnect">
|
||||
<button type="submit">Deconnexion</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="camera/swapState/<?=$this->clean($camera->getId())?>">
|
||||
<h2>Caméra : <?= $this->clean($camera->getName())?></h2>
|
||||
|
||||
<?php if($this->clean($camera->getAvailable()) == true):?> Joignable -
|
||||
<?php else: ?> Non joignable -
|
||||
<?php endif ?>
|
||||
|
||||
<?php if($this->clean($camera->getEnabled()) == true):?> Activée <button type="submit">Désactiver</button>
|
||||
<?php $swap = "disable";?>
|
||||
<?php else: ?> Désactivée <button type="submit">Activer</button>
|
||||
<?php $swap = "enable";?>
|
||||
<?php endif ?>
|
||||
<a href="camera/delayed/<?=$this->clean($camera->getId())?>"><button type="button">Regarder le différé</button></a>
|
||||
<input type="hidden" name="whereController" value="camera">
|
||||
<input type="hidden" name="whereAction" value="index/<?=$this->clean($camera->getId())?>">
|
||||
<input type="hidden" name="swap" value="<?=$swap?>">
|
||||
</form>
|
||||
<br>
|
||||
<div id="rtmp-player-container"></div>
|
||||
<script>
|
||||
jwplayer("rtmp-player-container").setup({
|
||||
file: "rtmp://<?=Configuration::get('host')?>:1935/livecam/<?=$this->clean($camera->getId())?>?login=<?=$this->clean($user->getLogin())?>&password=<?=$this->clean($user->getPassword())?>",
|
||||
controls: false,
|
||||
autostart: true,
|
||||
preload: "none"
|
||||
});
|
||||
</script>
|
@ -0,0 +1,17 @@
|
||||
<?php $this->title = " Connexion" ?>
|
||||
|
||||
<p>Vous devez être connecté pour accéder au site.</p>
|
||||
|
||||
<form action="connexion/logOn" method="post">
|
||||
<input name="login" type="text" placeholder="Entrez votre login" required autofocus>
|
||||
<input name="password" type="password" placeholder="Entrez votre mot de passe" required>
|
||||
<button type="submit">Connexion</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="connexion/registration">
|
||||
<button type="submit">Inscription</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($msgError)): ?>
|
||||
<p><?= $msgError ?></p>
|
||||
<?php endif; ?>
|
@ -0,0 +1,23 @@
|
||||
<?php $this->title = "Inscription" ?>
|
||||
|
||||
<p>Enregistrez vous pour avoir accès au site</p>
|
||||
|
||||
<form action="connexion/register" method="post" >
|
||||
<label>Login</label>
|
||||
<input type="text" name="login" size="30" placeholder="Entrez votre login" required autofocus/> <br/>
|
||||
|
||||
<label>Mot de passe</label>
|
||||
<input type="password" name="password" size="30" placeholder="Entrez votre Mot de passe" required /> <br/>
|
||||
|
||||
<label>Retapez votre mot de passe</label>
|
||||
<input type="password" name="passwordBis" size="30" placeholder="Entrez votre Mot de passe" required /> <br/>
|
||||
<button type="submit">Valider l'inscription</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="connexion">
|
||||
<button type="submit">Annuler l'inscription</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($msgError)): ?>
|
||||
<p><?= $msgError ?></p>
|
||||
<?php endif; ?>
|
10
server/webplatform/apps/CameraMonitor/View/Default/admin.php
Normal file
10
server/webplatform/apps/CameraMonitor/View/Default/admin.php
Normal file
@ -0,0 +1,10 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<a href="connexion/disconnect"><button type="submit">Deconnexion</button></a>
|
||||
|
||||
<a href="default/addCamAdmin"><button type="submit">Ajouter une caméra</button></a>
|
||||
|
||||
<?php if(isset($id) && isset($product_key)):?>
|
||||
<p>Numéro de série de la caméra : <?= $this->clean($id) ?></p>
|
||||
<p>Clé produit de la caméra : <?= $this->clean($product_key) ?></p>
|
||||
<?php endif?>
|
34
server/webplatform/apps/CameraMonitor/View/Default/index.php
Normal file
34
server/webplatform/apps/CameraMonitor/View/Default/index.php
Normal file
@ -0,0 +1,34 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<a href="connexion/disconnect"><button type="submit">Deconnexion</button></a>
|
||||
<a href="default/settings"><button type="submit">Paramètre</button></a>
|
||||
|
||||
<h2>Mes caméras</h2>
|
||||
|
||||
<?php if($cameras != null): ?>
|
||||
<ul>
|
||||
<?php foreach($cameras as $camera): ?>
|
||||
<li>
|
||||
<form method="post" action="camera/swapState/<?=$camera->getId()?>">
|
||||
<a href="<?= "camera/" . $this->clean($camera->getId()) ?>">
|
||||
<?= $camera->getName() ?>
|
||||
</a>
|
||||
|
||||
<?php if($camera->getAvailable() == true):?> Joignable -
|
||||
<?php else: ?> Non joignable -
|
||||
<?php endif ?>
|
||||
|
||||
<?php if($camera->getEnabled() == true):?> Activée <button type="submit">Désactiver</button>
|
||||
<?php $swap = "disable";?>
|
||||
<?php else: ?> Désactivée <button type="submit">Activer</button>
|
||||
<?php $swap = "enable";?>
|
||||
<?php endif ?>
|
||||
<a href="camera/delayed/<?=$camera->getId()?>"><button type="button">Regarder le différé</button></a>
|
||||
<input type="hidden" name="swap" value="<?=$swap?>">
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Vous n'avez accès à aucune caméra</p>
|
||||
<?php endif ?>
|
18
server/webplatform/apps/CameraMonitor/View/Default/live.php
Normal file
18
server/webplatform/apps/CameraMonitor/View/Default/live.php
Normal file
@ -0,0 +1,18 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<form method="get" action="default">
|
||||
<button type="submit">Retour</button>
|
||||
</form>
|
||||
|
||||
<form method="get" action="connexion/disconnect">
|
||||
<button type="submit">Deconnexion</button>
|
||||
</form>
|
||||
|
||||
<h2>Caméra : <?= $this->clean($camera->getName())?></h2>
|
||||
|
||||
<div id="rtmp-player-container"></div>
|
||||
<script>
|
||||
jwplayer("rtmp-player-container").setup({
|
||||
file: "rtmp://cam.wildsparksoftware.com:1935/livecam/<?=$this->clean($camera->getId())?>"
|
||||
});
|
||||
</script>
|
@ -0,0 +1,61 @@
|
||||
<h1>Site web Projet L3</h1>
|
||||
|
||||
<a href="connexion/disconnect"><button type="submit">Deconnexion</button></a>
|
||||
<a href="default"><button type="submit">Retour</button></a>
|
||||
|
||||
<h3>Mes informations</h3>
|
||||
|
||||
<?php if(isset($messageInfo)): ?>
|
||||
<p><?= $messageInfo ?></p>
|
||||
<?php endif ?>
|
||||
<h4>Mes identifiants :</h4>
|
||||
<form method="post" action="default/updateLogin">
|
||||
<label>Login :</label>
|
||||
<input type="text" name="login" placeholder="Login" required>
|
||||
<button type="submit">Modifier</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="default/updatePassword">
|
||||
<label>Mot de passe :</label>
|
||||
<input type="password" name="password" placeholder="Mot de passe" required>
|
||||
<label>Vérification :</label>
|
||||
<input type="password" name="passwordBis" placeholder="Mot de passe" required>
|
||||
<button type="submit">Modifier</button>
|
||||
</form>
|
||||
|
||||
<h4>Mes caméras :</h4>
|
||||
<?php if($cameras != null): ?>
|
||||
<ul>
|
||||
<?php foreach($cameras as $camera): ?>
|
||||
<li>
|
||||
<form method="post" action="camera/swapState/<?=$camera->getId()?>">
|
||||
<a href="<?= "camera/" . $this->clean($camera->getId()) ?>">
|
||||
<?= $camera->getName() ?>
|
||||
</a>
|
||||
|
||||
<?php if($camera->getAvailable() == true):?> Joignable -
|
||||
<?php else: ?> Non joignable -
|
||||
<?php endif ?>
|
||||
|
||||
<?php if($camera->getEnabled() == true):?> Activée <button type="submit">Désactiver</button>
|
||||
<?php $swap = "disable";?>
|
||||
<?php else: ?> Désactivée <button type="submit">Activer</button>
|
||||
<?php $swap = "enable";?>
|
||||
<?php endif ?>
|
||||
<input type="hidden" name="swap" value="<?=$swap?>">
|
||||
<input type="hidden" name="whereAction" value="settings">
|
||||
<a href="camera/delete/<?=$camera->getId()?>"><button type="button">Supprimer</button></a>
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Vous n'avez accès à aucune caméra</p>
|
||||
<?php endif ?>
|
||||
<form method="post" action="default/addCam">
|
||||
<label>Nom :</label>
|
||||
<input type="text" name="name" placeholder="Entrez un nom" required>
|
||||
<label>Numéro de série :</label>
|
||||
<input type="text" name="camera_id" placeholder="Entrez le numéro de série" required>
|
||||
<button type="submit">Ajouter Caméra</button>
|
||||
</form>
|
18
server/webplatform/apps/CameraMonitor/View/error.php
Normal file
18
server/webplatform/apps/CameraMonitor/View/error.php
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Erreur</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>ERREUR !!!!!</h1>
|
||||
<?php
|
||||
if (isset($msgError))
|
||||
echo $msgError;
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
15
server/webplatform/apps/CameraMonitor/View/template.php
Normal file
15
server/webplatform/apps/CameraMonitor/View/template.php
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<base href="<?= $root ?>" >
|
||||
<link rel="stylesheet" href="Content/myStyle.css" />
|
||||
<title><?= $title ?></title>
|
||||
<?= $headScript ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user