} spl_autoload_register("classLoad"); include 'config.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav'])) { //les sources $idProjet = 0; $idSociete = $_GET['idSociete']; $projetManager = new ProjetManager($pdo); $societeManager = new SocieteManager($pdo); $societe = $societeManager->getSocieteById($idSociete); if (isset($_GET['idProjet']) and $_GET['idProjet'] > 0 and $_GET['idProjet'] <= $projetManager->getLastId()) { $idProjet = $_GET['idProjet']; $projet = $projetManager->getProjetById($idProjet); $piecesProjetManager = new PiecesProjetManager($pdo); $piecesProjet = $piecesProjetManager->getPiecesProjetByIdProjet($idProjet); } ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]--> <!-- BEGIN HEAD --> <head> <meta charset="utf-8" /> <title>GELM - Management Application</title> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta content="" name="description" /> <meta content="" name="author" /> <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
function classLoad($myClass) { if (file_exists('../model/' . $myClass . '.php')) { include '../model/' . $myClass . '.php'; } elseif (file_exists('../controller/' . $myClass . '.php')) { include '../controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include '../config.php'; include '../lib/image-processing.php'; //classes loading end session_start(); $idProjet = htmlentities($_POST['idProjet']); $idSociete = htmlentities($_POST['idSociete']); if (file_exists($_FILES['urlPieceProjet']['tmp_name']) || is_uploaded_file($_FILES['urlPieceProjet']['tmp_name'])) { $url = imageProcessing($_FILES['urlPieceProjet'], '/pieces/pieces_projet/'); echo $url; $description = htmlentities($_POST['descriptionProjet']); $pieceProjet = new PiecesProjet(array('url' => $url, 'description' => $description, 'idProjet' => $idProjet, 'createdBy' => $_SESSION['userMerlaTrav']->login(), 'created' => date('Y-m-d'))); $piecesProjetManager = new PiecesProjetManager($pdo); $piecesProjetManager->add($pieceProjet); $_SESSION['pieces-add-success'] = "<strong>Opération valide : </strong>Le document a été ajouté avec succès."; } else { $_SESSION['pieces-add-error'] = "<strong>Erreur Ajout Documents : </strong>Vous devez ajouté un document."; } $redirect = "Location:../projects-by-company.php?idSociete=" . $idSociete; if (isset($_GET['source']) and $_GET['source'] == 2) { $redirect = "Location:../projet-details.php?idProjet=" . $idProjet . "&idSociete=" . $idSociete; } header($redirect);
<?php //classes loading begin function classLoad($myClass) { if (file_exists('../model/' . $myClass . '.php')) { include '../model/' . $myClass . '.php'; } elseif (file_exists('../controller/' . $myClass . '.php')) { include '../controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include '../config.php'; //classes loading end session_start(); //post input processing $idProjet = htmlentities($_POST['idProjet']); $idSociete = htmlentities($_POST['idSociete']); $idPiece = htmlentities($_POST['idPiece']); $piecesManager = new PiecesProjetManager($pdo); $piecesManager->delete($idPiece); $_SESSION['pieces-delete-success'] = "<strong>Opération valide : </strong>Le document est supprimé avec succès."; header('Location:../projet-details.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete);