aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-03-17 12:33:32 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-03-17 12:33:32 +0100
commit6429cb3f90a23fd1aae0d2298c54e8a88d213bcf (patch)
treeec078a915c5bd04446a59893766a4cbdf0b652d7
parent53a5f6b267b1deb8c5f10973c1a238ff74a33e5a (diff)
downloadwcms-6429cb3f90a23fd1aae0d2298c54e8a88d213bcf.tar.gz
wcms-6429cb3f90a23fd1aae0d2298c54e8a88d213bcf.zip
Added app class and reorganisation of the folders
-rw-r--r--class/class.app.php30
-rw-r--r--class/class.art.php (renamed from class/art.php)0
-rw-r--r--public/index.php (renamed from index.php)0
-rw-r--r--public/rsc/css/style.css (renamed from style.css)0
-rw-r--r--public/w/art.php (renamed from w/art.php)0
-rw-r--r--public/w/art_create.php (renamed from w/art_create.php)0
-rw-r--r--public/w/art_delete.php (renamed from w/art_delete.php)0
-rw-r--r--public/w/art_display.php (renamed from w/art_display.php)0
-rw-r--r--public/w/art_edit.php (renamed from w/art_edit.php)0
-rw-r--r--public/w/index.php (renamed from w/index.php)3
10 files changed, 32 insertions, 1 deletions
diff --git a/class/class.app.php b/class/class.app.php
new file mode 100644
index 0000000..4078c17
--- /dev/null
+++ b/class/class.app.php
@@ -0,0 +1,30 @@
+<?php
+class App
+{
+ protected $bdd;
+
+ public function __construct($config)
+ {
+ $host = $config['host'];
+ $dbname = $config['dbname'];
+ $user = $config['user'];
+ $password = $config['password'];
+ try {
+ $this->bdd = new PDO('mysql:host=' . $host . ';dbname=' . $dbname . ';charset=utf8', $user, $password);
+ } catch (Exeption $e) {
+ die('Erreur : ' . $e->getMessage());
+ }
+ }
+
+ public function getBdd()
+ {
+ return $this->bdd;
+ }
+
+ public function createfrombdd($id, $bdd)
+ {
+
+ }
+
+}
+?> \ No newline at end of file
diff --git a/class/art.php b/class/class.art.php
index 6b126ea..6b126ea 100644
--- a/class/art.php
+++ b/class/class.art.php
diff --git a/index.php b/public/index.php
index e69de29..e69de29 100644
--- a/index.php
+++ b/public/index.php
diff --git a/style.css b/public/rsc/css/style.css
index e69de29..e69de29 100644
--- a/style.css
+++ b/public/rsc/css/style.css
diff --git a/w/art.php b/public/w/art.php
index e69de29..e69de29 100644
--- a/w/art.php
+++ b/public/w/art.php
diff --git a/w/art_create.php b/public/w/art_create.php
index e69de29..e69de29 100644
--- a/w/art_create.php
+++ b/public/w/art_create.php
diff --git a/w/art_delete.php b/public/w/art_delete.php
index e69de29..e69de29 100644
--- a/w/art_delete.php
+++ b/public/w/art_delete.php
diff --git a/w/art_display.php b/public/w/art_display.php
index e69de29..e69de29 100644
--- a/w/art_display.php
+++ b/public/w/art_display.php
diff --git a/w/art_edit.php b/public/w/art_edit.php
index e69de29..e69de29 100644
--- a/w/art_edit.php
+++ b/public/w/art_edit.php
diff --git a/w/index.php b/public/w/index.php
index ebf7106..6299fd1 100644
--- a/w/index.php
+++ b/public/w/index.php
@@ -12,8 +12,9 @@ session();
// fin de in
+$app = new App($config);
$art = new Art;
-$art->createfrombdd($id, bddconnect($config['host'], $config['dbname'], $config['user'], $config['password']));
+$art->createfrombdd($id, $app->getBdd());
include($root . '/head.php')