diff options
| author | polo <ordipolo@gmx.fr> | 2022-03-02 04:54:24 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-03-02 04:54:24 +0100 |
| commit | 9a28c38adb3585e55caeecd64d2171832a3684e9 (patch) | |
| tree | 0119caaaa405d0e1dc248611a3e9b4e5f2470548 | |
| parent | 91af604a44d016b4b56fd45266d6928ba3108e9e (diff) | |
| download | melaine-9a28c38adb3585e55caeecd64d2171832a3684e9.tar.gz melaine-9a28c38adb3585e55caeecd64d2171832a3684e9.tar.bz2 melaine-9a28c38adb3585e55caeecd64d2171832a3684e9.zip | |
detection poids max php.ini
| -rw-r--r-- | config.php | 22 | ||||
| -rw-r--r-- | controller/backup.php | 4 | ||||
| -rw-r--r-- | controller/installation.php | 30 | ||||
| -rw-r--r-- | data/index.html | 0 | ||||
| -rw-r--r-- | lib/.htaccess | 1 | ||||
| -rw-r--r-- | lib/ckeditor5/build/index.html | 0 | ||||
| -rw-r--r-- | lib/ckeditor5/build/translations/index.html | 0 | ||||
| -rw-r--r-- | lib/ckeditor5/index.html | 0 | ||||
| -rw-r--r-- | lib/ckeditor5/src/index.html | 0 | ||||
| -rw-r--r-- | lib/htmlawed/.htaccess (renamed from data/.htaccess) | 0 | ||||
| -rw-r--r-- | lib/index.html | 0 | ||||
| -rw-r--r-- | model/Image.php | 35 | ||||
| -rw-r--r-- | public/accueil/index.html | 0 | ||||
| -rw-r--r-- | public/css/accueil.css | 4 | ||||
| -rw-r--r-- | public/css/index.html | 0 | ||||
| -rw-r--r-- | public/css/pages_articles_simples.css | 4 | ||||
| -rw-r--r-- | public/fonts/index.html | 0 | ||||
| -rw-r--r-- | public/header_images/index.html | 0 | ||||
| -rw-r--r-- | public/menu/index.html | 0 | ||||
| -rw-r--r-- | view/courriel.php | 2 | ||||
| -rw-r--r-- | view/pageArticlesSimples.php | 2 |
21 files changed, 72 insertions, 32 deletions
| @@ -12,11 +12,25 @@ $imageLibrary = 'imagick'; | |||
| 12 | $archiveFormat = 'zip'; | 12 | $archiveFormat = 'zip'; |
| 13 | // seul zip est supporté pour l'instant | 13 | // seul zip est supporté pour l'instant |
| 14 | 14 | ||
| 15 | // taille max des fichiers à adapter au php.ini | ||
| 16 | $maxWeight = 2000000; | ||
| 17 | |||
| 18 | // mode de stockage des données | 15 | // mode de stockage des données |
| 19 | // écrire 'files' ou 'database' | 16 | // écrire 'files' ou 'database' |
| 20 | $storage = 'files'; | 17 | $storage = 'files'; |
| 21 | // laisser 'files'!! | 18 | // laisser 'files'!! |
| 22 | // l'utilisation d'une BDD n'est pas prévue pour l'instant \ No newline at end of file | 19 | // l'utilisation d'une BDD n'est pas prévue pour l'instant |
| 20 | |||
| 21 | |||
| 22 | // actuellement inutile | ||
| 23 | // taille max des fichiers dans le php.ini (défaut = 2M) | ||
| 24 | /*function return_bytes ($size_str) | ||
| 25 | { | ||
| 26 | switch (substr ($size_str, -1)) | ||
| 27 | { | ||
| 28 | case 'M': case 'm': return (int)$size_str * 1048576; | ||
| 29 | case 'K': case 'k': return (int)$size_str * 1024; | ||
| 30 | case 'G': case 'g': return (int)$size_str * 1073741824; | ||
| 31 | default: return $size_str; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | $maxWeight = return_bytes(ini_get('upload_max_filesize'));*/ | ||
| 35 | /*ini_set('upload_max_filesize', '3M'); | ||
| 36 | echo(ini_get('upload_max_filesize')); die();*/ | ||
diff --git a/controller/backup.php b/controller/backup.php index 4fb01ef..1477c55 100644 --- a/controller/backup.php +++ b/controller/backup.php | |||
| @@ -156,8 +156,10 @@ function restaurer($from) | |||
| 156 | } | 156 | } |
| 157 | elseif(isset($_FILES['archive']) && $_FILES['archive']['error'] != 0) | 157 | elseif(isset($_FILES['archive']) && $_FILES['archive']['error'] != 0) |
| 158 | { | 158 | { |
| 159 | $message = '<p style="color: red;" >Erreur: Le fichier n\'a pas pu être téléchargé correctement."</p>'; | 159 | $message = '<p style="color: red;" >Erreur: Le fichier n\'a pas pu être téléchargé correctement.<br/> |
| 160 | Au fait, "upload_max_filesize" dans le php.ini vaut ' . ini_get('upload_max_filesize') . '.</p>'; | ||
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | require('view/backup.php'); | 163 | require('view/backup.php'); |
| 163 | } | 164 | } |
| 165 | |||
diff --git a/controller/installation.php b/controller/installation.php index bf6826d..7e3863b 100644 --- a/controller/installation.php +++ b/controller/installation.php | |||
| @@ -52,6 +52,7 @@ function installation() | |||
| 52 | 52 | ||
| 53 | // valeur en octal | 53 | // valeur en octal |
| 54 | $droitsDossiers = 0777; // mettre 0755 en production | 54 | $droitsDossiers = 0777; // mettre 0755 en production |
| 55 | $droitsFichiers = 0666; | ||
| 55 | 56 | ||
| 56 | if(!file_exists('data') && !mkdir('data')) | 57 | if(!file_exists('data') && !mkdir('data')) |
| 57 | { | 58 | { |
| @@ -67,6 +68,8 @@ function installation() | |||
| 67 | require('view/backup.php'); | 68 | require('view/backup.php'); |
| 68 | exit(); | 69 | exit(); |
| 69 | } | 70 | } |
| 71 | touch('data/index.html'); | ||
| 72 | chmod('data/index.html', $droitsFichiers); | ||
| 70 | 73 | ||
| 71 | $listePages = array('melaine', 'discographie', 'concerts', 'presse', 'ateliers', 'liens', 'peinture', 'archives'); | 74 | $listePages = array('melaine', 'discographie', 'concerts', 'presse', 'ateliers', 'liens', 'peinture', 'archives'); |
| 72 | foreach ($listePages as $page) | 75 | foreach ($listePages as $page) |
| @@ -76,16 +79,31 @@ function installation() | |||
| 76 | mkdir('data/' . $page); | 79 | mkdir('data/' . $page); |
| 77 | chmod('data/' . $page, $droitsDossiers); | 80 | chmod('data/' . $page, $droitsDossiers); |
| 78 | } | 81 | } |
| 82 | if(!file_exists('data/' . $page . 'index.html')) | ||
| 83 | { | ||
| 84 | touch('data/' . $page . '/index.html'); | ||
| 85 | chmod('data/' . $page . '/index.html', $droitsFichiers); | ||
| 86 | } | ||
| 79 | if(!file_exists('data/' . $page . '/html')) | 87 | if(!file_exists('data/' . $page . '/html')) |
| 80 | { | 88 | { |
| 81 | mkdir('data/' . $page . '/html'); | 89 | mkdir('data/' . $page . '/html'); |
| 82 | chmod('data/' . $page . '/html', $droitsDossiers); | 90 | chmod('data/' . $page . '/html', $droitsDossiers); |
| 83 | } | 91 | } |
| 92 | if(!file_exists('data/' . $page . '/html/index.html')) | ||
| 93 | { | ||
| 94 | touch('data/' . $page . '/html/index.html'); | ||
| 95 | chmod('data/' . $page . '/html/index.html', $droitsFichiers); | ||
| 96 | } | ||
| 84 | if(!file_exists('data/' . $page . '/images')) | 97 | if(!file_exists('data/' . $page . '/images')) |
| 85 | { | 98 | { |
| 86 | mkdir('data/' . $page . '/images'); | 99 | mkdir('data/' . $page . '/images'); |
| 87 | chmod('data/' . $page . '/images', $droitsDossiers); | 100 | chmod('data/' . $page . '/images', $droitsDossiers); |
| 88 | } | 101 | } |
| 102 | if(!file_exists('data/' . $page . '/images/index.html')) | ||
| 103 | { | ||
| 104 | touch('data/' . $page . '/images/index.html'); | ||
| 105 | chmod('data/' . $page . '/images/index.html', $droitsFichiers); | ||
| 106 | } | ||
| 89 | // if(!file_exists('data/' . $page . '/multimedia')) | 107 | // if(!file_exists('data/' . $page . '/multimedia')) |
| 90 | // { | 108 | // { |
| 91 | // mkdir('data/' . $page . '/multimedia'); | 109 | // mkdir('data/' . $page . '/multimedia'); |
| @@ -98,11 +116,22 @@ function installation() | |||
| 98 | mkdir('data/discographie/json'); | 116 | mkdir('data/discographie/json'); |
| 99 | chmod('data/discographie/json', $droitsDossiers); | 117 | chmod('data/discographie/json', $droitsDossiers); |
| 100 | } | 118 | } |
| 119 | if(!file_exists('data/discographie/json/index.html')) | ||
| 120 | { | ||
| 121 | touch('data/discographie/json/index.html'); | ||
| 122 | chmod('data/discographie/json/index.html', $droitsFichiers); | ||
| 123 | } | ||
| 101 | if(!file_exists('data/discographie/images-mini')) | 124 | if(!file_exists('data/discographie/images-mini')) |
| 102 | { | 125 | { |
| 103 | mkdir('data/discographie/images-mini'); | 126 | mkdir('data/discographie/images-mini'); |
| 104 | chmod('data/discographie/images-mini', $droitsDossiers); | 127 | chmod('data/discographie/images-mini', $droitsDossiers); |
| 105 | } | 128 | } |
| 129 | if(!file_exists('data/discographie/images-mini/index.html')) | ||
| 130 | { | ||
| 131 | touch('data/discographie/images-mini/index.html'); | ||
| 132 | chmod('data/discographie/images-mini/index.html', $droitsFichiers); | ||
| 133 | } | ||
| 134 | // le modèle donnera les droits 0666 (octal) aux nouveaux fichiers à l'intérieur des dossiers | ||
| 106 | 135 | ||
| 107 | // créer le melainePHP.zip | 136 | // créer le melainePHP.zip |
| 108 | if(!file_exists("data/melainePHP.zip")) | 137 | if(!file_exists("data/melainePHP.zip")) |
| @@ -110,7 +139,6 @@ function installation() | |||
| 110 | require('controller/backup.php'); | 139 | require('controller/backup.php'); |
| 111 | creerMelainePHP(); | 140 | creerMelainePHP(); |
| 112 | } | 141 | } |
| 113 | // le modèle donnera les droits 0666 (octal) aux nouveaux fichiers à l'intérieur des dossiers | ||
| 114 | 142 | ||
| 115 | // création d'un mot de passe si password.txt est vide | 143 | // création d'un mot de passe si password.txt est vide |
| 116 | createPassword(); | 144 | createPassword(); |
diff --git a/data/index.html b/data/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/index.html | |||
diff --git a/lib/.htaccess b/lib/.htaccess deleted file mode 100644 index 45552cb..0000000 --- a/lib/.htaccess +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | Options -Indexes \ No newline at end of file | ||
diff --git a/lib/ckeditor5/build/index.html b/lib/ckeditor5/build/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/ckeditor5/build/index.html | |||
diff --git a/lib/ckeditor5/build/translations/index.html b/lib/ckeditor5/build/translations/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/ckeditor5/build/translations/index.html | |||
diff --git a/lib/ckeditor5/index.html b/lib/ckeditor5/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/ckeditor5/index.html | |||
diff --git a/lib/ckeditor5/src/index.html b/lib/ckeditor5/src/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/ckeditor5/src/index.html | |||
diff --git a/data/.htaccess b/lib/htmlawed/.htaccess index 45552cb..45552cb 100644 --- a/data/.htaccess +++ b/lib/htmlawed/.htaccess | |||
diff --git a/lib/index.html b/lib/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/index.html | |||
diff --git a/model/Image.php b/model/Image.php index d94e95d..4cceb0f 100644 --- a/model/Image.php +++ b/model/Image.php | |||
| @@ -25,32 +25,27 @@ class Image | |||
| 25 | 25 | ||
| 26 | public function upload() | 26 | public function upload() |
| 27 | { | 27 | { |
| 28 | global $maxWeight; | ||
| 29 | |||
| 30 | // traitement et enregistrement de l'image | 28 | // traitement et enregistrement de l'image |
| 31 | if (isset($_FILES['upload']) AND $_FILES['upload']['error'] == 0) // 0 signifie ok | 29 | if (isset($_FILES['upload']) AND $_FILES['upload']['error'] == 0) // 0 signifie ok |
| 32 | { | 30 | { |
| 33 | if ($_FILES['upload']['size'] <= $maxWeight) | 31 | $this->pathInfos = pathinfo($_FILES['upload']['name']); |
| 34 | { | 32 | $extension = $this->pathInfos['extension']; |
| 35 | $this->pathInfos = pathinfo($_FILES['upload']['name']); | 33 | $extautorisées = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff'); |
| 36 | $extension = $this->pathInfos['extension']; | 34 | // on prend la même liste que celle côté javascript, le SVG est bloqué pour raison de sécurité (javascript à l'intérieur) |
| 37 | $extautorisées = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff'); | 35 | if (in_array($extension, $extautorisées)) |
| 38 | // on prend la même liste que celle côté javascript, le SVG est bloqué pour raison de sécurité (javascript à l'intérieur) | 36 | { |
| 39 | if (in_array($extension, $extautorisées)) | 37 | move_uploaded_file($_FILES['upload']['tmp_name'], $this->path . $_FILES['upload']['name']); |
| 40 | { | 38 | chmod($this->path . $_FILES['upload']['name'], 0666); |
| 41 | move_uploaded_file($_FILES['upload']['tmp_name'], $this->path . $_FILES['upload']['name']); | 39 | } |
| 42 | chmod($this->path . $_FILES['upload']['name'], 0666); | 40 | else |
| 43 | } | 41 | { |
| 44 | else{$this->erreur = 'mauvais format, veuillez utiliser une image comportant un de ces formats: jpg ou jpeg, png, gif, bmp, webp, tiff<br />le format svg n\'est pas supporté';} | 42 | $this->erreur = 'mauvais format, veuillez utiliser une image comportant un de ces formats: jpg ou jpeg, png, gif, bmp, webp, tiff<br />le format svg n\'est pas supporté'; |
| 45 | } | 43 | } |
| 46 | else | ||
| 47 | { | ||
| 48 | $this->erreur = 'erreur du serveur: le fichier téléchargé est trop lourd, poids max = ' . $maxWeight . ' octets'; | ||
| 49 | } | ||
| 50 | } | 44 | } |
| 51 | else | 45 | else |
| 52 | { | 46 | { |
| 53 | $this->erreur = 'erreur du serveur: le fichier téléchargé est trop lourd, poids max = ' . $maxWeight . ' octets'; | 47 | $this->erreur = 'Erreur: Le fichier n\'a pas pu être téléchargé correctement.<br/> |
| 48 | Au fait, "upload_max_filesize" dans le php.ini vaut ' . ini_get('upload_max_filesize') . '.'; | ||
| 54 | } | 49 | } |
| 55 | 50 | ||
| 56 | // retour des rêquetes AJAX | 51 | // retour des rêquetes AJAX |
diff --git a/public/accueil/index.html b/public/accueil/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/accueil/index.html | |||
diff --git a/public/css/accueil.css b/public/css/accueil.css index b95e818..b7dcf06 100644 --- a/public/css/accueil.css +++ b/public/css/accueil.css | |||
| @@ -116,7 +116,7 @@ form | |||
| 116 | #courriel | 116 | #courriel |
| 117 | { | 117 | { |
| 118 | padding-top: 30px; | 118 | padding-top: 30px; |
| 119 | font-size: 85%; | 119 | font-size: 90%; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | #courriel * | 122 | #courriel * |
| @@ -154,8 +154,6 @@ form | |||
| 154 | width: 700px; | 154 | width: 700px; |
| 155 | z-index: 2; | 155 | z-index: 2; |
| 156 | padding-top: 2px; | 156 | padding-top: 2px; |
| 157 | /*text-align: center;*/ | ||
| 158 | /*font-family: Sans-serif;*/ | ||
| 159 | } | 157 | } |
| 160 | 158 | ||
| 161 | #modeAdmin p | 159 | #modeAdmin p |
diff --git a/public/css/index.html b/public/css/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/css/index.html | |||
diff --git a/public/css/pages_articles_simples.css b/public/css/pages_articles_simples.css index 5f20753..124166b 100644 --- a/public/css/pages_articles_simples.css +++ b/public/css/pages_articles_simples.css | |||
| @@ -24,6 +24,10 @@ figure | |||
| 24 | { | 24 | { |
| 25 | border-bottom: 3px black double; | 25 | border-bottom: 3px black double; |
| 26 | } | 26 | } |
| 27 | .boutonNouvelArticle | ||
| 28 | { | ||
| 29 | font-size: 90%; | ||
| 30 | } | ||
| 27 | .boutonArticle a | 31 | .boutonArticle a |
| 28 | { | 32 | { |
| 29 | padding: 2px; | 33 | padding: 2px; |
diff --git a/public/fonts/index.html b/public/fonts/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/fonts/index.html | |||
diff --git a/public/header_images/index.html b/public/header_images/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/header_images/index.html | |||
diff --git a/public/menu/index.html b/public/menu/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/public/menu/index.html | |||
diff --git a/view/courriel.php b/view/courriel.php index 77a4eb0..3d401fb 100644 --- a/view/courriel.php +++ b/view/courriel.php | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <div id="courriel" > | 1 | <div id="courriel" > |
| 2 | <button ><a href="index.php?page=<?= $page ?>" >Remonter en haut de la page</a></button> | 2 | <button ><a href="index.php?page=<?= $page ?>" >Haut de la page</a></button> |
| 3 | <div> | 3 | <div> |
| 4 | <img src="public/timbre.png" alt="" ><br />Envoyez-moi un courriel à: <img src="public/courriel.png" > | 4 | <img src="public/timbre.png" alt="" ><br />Envoyez-moi un courriel à: <img src="public/courriel.png" > |
| 5 | </div> | 5 | </div> |
diff --git a/view/pageArticlesSimples.php b/view/pageArticlesSimples.php index a8c94d2..88cce4c 100644 --- a/view/pageArticlesSimples.php +++ b/view/pageArticlesSimples.php | |||
| @@ -81,7 +81,7 @@ if($_SESSION['admin'] == 1) | |||
| 81 | { | 81 | { |
| 82 | ?> | 82 | ?> |
| 83 | <div> | 83 | <div> |
| 84 | <p class="boutonArticle" > | 84 | <p class="boutonArticle boutonNouvelArticle" > |
| 85 | <a href="index.php?page=<?= $page ?>&action=editor" > | 85 | <a href="index.php?page=<?= $page ?>&action=editor" > |
| 86 | Nouvel article | 86 | Nouvel article |
| 87 | </a> | 87 | </a> |
