commit f6a9c3617a835719a05054265be6519ce09c9825
parent 9529dc5d8df84f1db5176f44684d139c9065870d
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Thu, 5 Aug 2010 01:29:53 +0200
Un peu d'enjolivage
Diffstat:
7 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/__cms__/TODO b/__cms__/TODO
@@ -1,2 +1,4 @@
Sécurité : les noms de propriétés passés à stockage ne doivent pas
contenir de '/' (doivent valider "nettoyer_segment()".
+Les actions ne devraient être que des POST... ça pose problème sur certains liens (connexion, ...).
+Les titres devraient renomer _+_ set_prop (sachant que le renomage peut déteriorer le texte du titre (sécurité sur le chemin)).
+\ No newline at end of file
diff --git a/__cms__/code/cms/page.php b/__cms__/code/cms/page.php
@@ -3,8 +3,9 @@
class Page {
public $contenu = "";
public $titre = "";
- public $sendfile_chemin = "";
- public $sendfile_prop = "";
+ public $sendfile_fichier = "";
+ public $sendprop_chemin = "";
+ public $sendprop_prop = "";
public $redirect_destination = "";
public $type = "page";
@@ -12,7 +13,9 @@ class Page {
if ($type == "page") {
$this->set_page($a, $b);
} else if ($type == "sendfile") {
- $this->set_sendfile($a, $b);
+ $this->set_sendfile($a);
+ } else if ($type == "sendprop") {
+ $this->set_sendprop($a, $b);
} else if ($type == "raw") {
$this->set_raw($a, $b);
} else if ($type == "redirect") {
@@ -26,11 +29,16 @@ class Page {
$this->type = "page";
}
- public function set_sendfile($chemin, $prop) {
- $this->sendfile_chemin = $chemin;
- $this->sendfile_prop = $prop;
+ public function set_sendfile($fichier) {
+ $this->sendfile_fichier = $fichier;
$this->type = "sendfile";
}
+
+ public function set_sendprop($chemin, $prop) {
+ $this->sendprop_chemin = $chemin;
+ $this->sendprop_prop = $prop;
+ $this->type = "sendprop";
+ }
public function set_raw($données, $mime) {
$this->raw_données = $données;
@@ -49,7 +57,9 @@ class Page {
if ($this->type == "page") {
echo Squelette::enrober($this);
} else if ($this->type == "sendfile") {
- Stockage::get_prop_sendfile($this->sendfile_chemin, $this->sendfile_prop);
+ Système_fichiers::envoyer_fichier_directement($this->sendfile_fichier);
+ } else if ($this->type == "sendprop") {
+ Stockage::get_prop_sendfile($this->sendprop_chemin, $this->sendprop_prop);
} else if ($this->type == "raw") {
header("Content-Type: " . $this->raw_mime);
echo $this->raw_données;
diff --git a/__cms__/code/modules/galerie/galerie-index.php b/__cms__/code/modules/galerie/galerie-index.php
@@ -27,8 +27,9 @@ class GalerieIndex {
}
public static function vue($chemin, $vue = "normal") {
- $ret = '';
if ($vue == "normal") {
+ $ret = '';
+
if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
$ret .= '<h2><input type="text" name="titre" value="' . Stockage::get_prop($chemin, "titre") . '" /></h2>';
$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "message");
@@ -56,6 +57,7 @@ class GalerieIndex {
if (Permissions::vérifier_permission($chemin, "nouvelle_page", Authentification::get_utilisateur())) {
$ret .= '<li>';
$ret .= '<div class="miniature">';
+ $ret .= '<img src="' . $chemin->get_url("?vue=image_nouvelle_periode") . '" />';
$ret .= '</div>';
$ret .= '<div class="titre">';
@@ -71,8 +73,12 @@ class GalerieIndex {
$ret .= '</ul>';
$ret .= '<div class="clearboth"></div>';
$ret .= '</div>';
+
+ return new Page($ret, Stockage::get_prop($chemin, "titre"));
+ } else if ($vue == "image_nouvelle_periode") {
+ // Houlàlà ça sent le hack pas beau !
+ return new Page(Path::combine(Config::get("chemin_base"), "/code/site/nouvelle_image.jpg"), null, "sendfile");
}
- return new Page($ret, Stockage::get_prop($chemin, "titre"));
}
}
diff --git a/__cms__/code/modules/galerie/galerie-photo.php b/__cms__/code/modules/galerie/galerie-photo.php
@@ -51,9 +51,9 @@ class GaleriePhoto {
return new Page($ret, Stockage::get_prop($chemin, "titre"));
} else if ($vue == "image") {
- return new Page($chemin, "image", "sendfile");
+ return new Page($chemin, "image", "sendprop");
} else if ($vue == "image_mini") {
- return new Page($chemin, "image_mini", "sendfile");
+ return new Page($chemin, "image_mini", "sendprop");
}
return new Page('',''); // TODO : devrait renvoyer une page d'erreur !
}
diff --git a/__cms__/code/site/css.php b/__cms__/code/site/css.php
@@ -50,8 +50,7 @@ function get_css() {
float: left;
margin: 1em;
padding: 0;
- padding: 0.1em;
- width: 7em;
+ width: 9em;
text-align: center;
}
@@ -61,6 +60,7 @@ function get_css() {
.galerie.photos .miniature {
border: thin solid gray;
+ height: 70px;
}
.galerie.photos img {
@@ -68,13 +68,16 @@ function get_css() {
}
.galerie.photos .titre {
- border: thin solid gray;
- border-top: none;
padding: 0.2em 0.4em;
+ height: 5em;
+}
+
+.galerie.photos li:hover .miniature {
+ border-color: #ff6;
}
-.galerie.photos a:hover .titre {
- background-color: #ff6;
+.galerie.photos li:hover .titre {
+ color: #7f7f33;
}
.clearboth {
diff --git a/__cms__/code/site/nouvelle_image.jpg b/__cms__/code/site/nouvelle_image.jpg
Binary files differ.
diff --git a/__cms__/code/site/nouvelle_image.xcf b/__cms__/code/site/nouvelle_image.xcf
Binary files differ.