Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

initial commmit de la branche Nude with composer

git authored on 14/03/2019 16:48:02
Showing 13 changed files
1 1
similarity index 59%
2 2
rename from application/class/application.class.php
3 3
rename to application/class/Application.php
... ...
@@ -1,12 +1,8 @@
1 1
 <?php
2 2
 
3
-define( "CONTROLLERS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs");
4
-define( "OBJETS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "objets");
3
+namespace MVC\Classe;
5 4
 
6
-require CLASSES_PATH.DIRECTORY_SEPARATOR."url.class.php";
7
-require CLASSES_PATH.DIRECTORY_SEPARATOR."controlleur.class.php";
8
-require CLASSES_PATH.DIRECTORY_SEPARATOR."bdd.class.php";
9
-require CLASSES_PATH.DIRECTORY_SEPARATOR."dumper.class.php";
5
+define( "CONTROLLERS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs");
10 6
 
11 7
 require APPLICATION_PATH . DIRECTORY_SEPARATOR . "parameters.php";
12 8
 
13 9
similarity index 96%
14 10
rename from application/class/bdd.class.php
15 11
rename to application/class/Bdd.php
... ...
@@ -1,5 +1,7 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
3 5
 class Bdd
4 6
 {
5 7
     public $bdd;
6 8
similarity index 77%
7 9
rename from application/class/controlleur.class.php
8 10
rename to application/class/Controlleur.php
... ...
@@ -1,13 +1,12 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
3 5
 define( "MODELS_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "modeles");
4 6
 define( "VIEW_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "vues");
5 7
 define( "CONTROLLER_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "controlleurs");
6 8
 define( "TRAITEMENT_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements");
7 9
 
8
-require CLASSES_PATH.DIRECTORY_SEPARATOR."modele.class.php";
9
-require CLASSES_PATH.DIRECTORY_SEPARATOR."vue.class.php";
10
-
11 10
 class Controlleur{
12 11
 	
13 12
 	public $modele;
... ...
@@ -19,8 +18,8 @@ class Controlleur{
19 18
             $url_params = $application->url->page['params'];
20 19
 	        require TRAITEMENT_PATH . DIRECTORY_SEPARATOR . $application->url->page['name'] . '.php';
21 20
         } else {
22
-            $this->modele = new Modele($application->url->page);
23
-            $this->vue = new Vue($this);
21
+            $this->modele = new modele($application->url->page);
22
+            $this->vue = new vue($this);
24 23
         }
25 24
 	}
26 25
 	
27 26
similarity index 84%
28 27
rename from application/class/dumper.class.php
29 28
rename to application/class/Dumper.php
... ...
@@ -1,5 +1,8 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
5
+
3 6
 class Dumper{
4 7
 
5 8
     public static function dump($var){
6 9
similarity index 96%
7 10
rename from application/class/modele.class.php
8 11
rename to application/class/Modele.php
... ...
@@ -1,5 +1,7 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
3 5
 class Modele{
4 6
 	
5 7
 	public $page;
6 8
similarity index 65%
7 9
rename from application/class/tri.class.php
8 10
rename to application/class/Tri.php
... ...
@@ -1,10 +1,7 @@
1 1
 <?php
2
-/**
3
- * Created by PhpStorm.
4
- * User: roy
5
- * Date: 05/03/2019
6
- * Time: 16:08
7
- */
2
+
3
+namespace MVC\Classe;
4
+
8 5
 class Tri{
9 6
 
10 7
     public static function cmp($a,$b){
11 8
similarity index 86%
12 9
rename from application/class/url.class.php
13 10
rename to application/class/Url.php
... ...
@@ -1,5 +1,7 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
3 5
 class Url
4 6
 {
5 7
 	public $page;
... ...
@@ -19,14 +21,15 @@ class Url
19 21
 	$urlTrim = trim( $url['path'] , '/' );
20 22
 	$urlParts = explode('/' , $urlTrim );
21 23
 
22
-	array_shift($urlParts);
23
-	array_shift($urlParts);
24
-
25 24
 	//print_r($urlParts);
26
-	//Récupération du nom de la page
27
-	($urlParts[0] == 'index' || $urlParts[0] == '' ) ? $page['name']='accueil' : $page['name']=$urlParts[0];
25
+    if(isset($urlParts[0])) {
26
+        //Récupération du nom de la page
27
+        ($urlParts[0] == 'index' || $urlParts[0] == '') ? $page['name'] = 'accueil' : $page['name'] = $urlParts[0];
28 28
         //array_shift($urlParts);
29 29
         unset($urlParts[0]);
30
+    }else{
31
+        $page['name'] = 'accueil';
32
+    }
30 33
 
31 34
 	if($page['name'] == 'control'){
32 35
 	    $page['control'] = true;
33 36
similarity index 95%
34 37
rename from application/class/vue.class.php
35 38
rename to application/class/Vue.php
... ...
@@ -1,5 +1,7 @@
1 1
 <?php
2 2
 
3
+namespace MVC\Classe;
4
+
3 5
 define( "LAYOUT_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout");
4 6
 
5 7
 
... ...
@@ -1,7 +1,2 @@
1
-<h1>Page de gestion des adresses IP</h1>
2
-<br /><br /><br />
3
-<h2>Possibilités d'afficher toutes les adresses par VLAN et Zone d'adresse</h2>
4
-<h2>Ainsi que de faire des recherches par nom de machine, profil et adresse ip</h2>
5
-<h2>Possibilité d'ajouter/supprimer des VLAN dans la base de données</h2>
6
-<h2>Possibilité de supprimer les adresses ip qui ne sont pas modifiées par Abitop</h2>
7
-<h3>Historisation des ajouts et des suppressions</h3>
8 1
\ No newline at end of file
2
+<h1>Accueil</h1>
3
+<br /><br />
9 4
\ No newline at end of file
... ...
@@ -1,7 +1,7 @@
1 1
 <div>
2 2
     <h2>Menu Experiments</h2>
3 3
     <ul>
4
-        <li><a href="<?php echo PATH_URL; ?>acceuil">Acceuil</a></li>
4
+        <li><a href="<?php echo PATH_URL; ?>accueil">Accueil</a></li>
5 5
         <li><a href="<?php echo PATH_URL; ?>error">Error</a></li>
6 6
     </ul>
7 7
 </div>
... ...
@@ -8,4 +8,4 @@ define('DSN_BDD2',"mysql:host=localhost;dbname=db2");
8 8
 define('USER_BDD2',"user2");
9 9
 define('PASS_BDD2',"pass2");
10 10
 
11
-define('PATH_URL',"http://ssdom.domain.tld/public/");
12 11
\ No newline at end of file
12
+define('PATH_URL',"http://vlan.localhost/");
13 13
\ No newline at end of file
14 14
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+{
2
+    "autoload": {
3
+        "psr-4": {
4
+            "MVC\\Classe\\":"./application/class",
5
+            "MVC\\Objets\\":"./application/objets"
6
+        }
7
+    }
8
+}
... ...
@@ -4,10 +4,10 @@ error_reporting(-1);
4 4
 ini_set('display_errors', 1);
5 5
 
6 6
 define("APPLICATION_PATH", dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."application");
7
-define("CLASSES_PATH", APPLICATION_PATH.DIRECTORY_SEPARATOR."class");
7
+define("VENDOR_PATH", dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."vendor");
8 8
 
9
+//require APPLICATION_PATH.DIRECTORY_SEPARATOR."autoloader.php";
10
+require VENDOR_PATH.DIRECTORY_SEPARATOR."autoload.php";
9 11
 
10
-require CLASSES_PATH.DIRECTORY_SEPARATOR."application.class.php";
11
-
12
-$poo_v1 = new Application();
12
+$poo_v1 = new \MVC\Classe\Application();
13 13
 $poo_v1->launch();