diff --git a/.gitignore b/.gitignore index 486982132..c07006940 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ docker-compose.* acake2php*.zip /app/Config/database.php* /app/Config/database.sql* -/app/Config/Schema/schema_*.php +/app/Config/Schema/schema.php* /app/tmp /app/Vendor/ !/app/Vendor/autoload.php diff --git a/Scripts/config_app_database.sh b/Scripts/config_app_database.sh index 5a81dc370..407a2b5b4 100755 --- a/Scripts/config_app_database.sh +++ b/Scripts/config_app_database.sh @@ -27,9 +27,9 @@ wd="$TOPDIR/app/Config" while [[ "$#" -gt 0 ]]; do case $1 in *.php) dbfile=$1 - outfile=$(echo "$dbfile" | cut -d . -f 1) + file=$(echo "$dbfile" | cut -d . -f 1) # shellcheck source=cp_bkp_old.sh - . "${TOPDIR}/Scripts/cp_bkp_old.sh" "$wd" "$dbfile" "${outfile}.php" + . "${TOPDIR}/Scripts/cp_bkp_old.sh" "$wd" "$dbfile" "${file}.php" ;; *.sock ) if [ -n "$(command -v mysql)" ]; then diff --git a/Scripts/lib/shell_prompt.sh b/Scripts/lib/shell_prompt.sh index fcd0e2e39..2ede9ba29 100755 --- a/Scripts/lib/shell_prompt.sh +++ b/Scripts/lib/shell_prompt.sh @@ -50,7 +50,7 @@ patches() { } #; export -f patches cakephp() { - "${TOPDIR}/app/Console/cake" -working "${TOPDIR}/app" "$@" + "${TOPDIR}/app/Console/cake.php" "$@" } #; export -f cakephp docker_name() { diff --git a/app/Config/Schema/schema.cms.php b/app/Config/Schema/schema.cms.php index b5df1bb75..f07cb9f06 100644 --- a/app/Config/Schema/schema.cms.php +++ b/app/Config/Schema/schema.cms.php @@ -1,4 +1,11 @@ -u +* pour mettre à jour la base données */ class AppSchema extends CakeSchema { public $file = 'schema.php'; @@ -11,18 +18,28 @@ public function after($event = array()) { } public $achat = array( - 'fk_reference_commande' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'key' => 'primary'), - 'fk_reference_facture' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_magasin' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'id_commande' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'key' => 'primary'), + 'id_facture' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary'), + 'id_magasin' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary'), 'indexes' => array( - 'PRIMARY' => array('column' => array('fk_reference_commande', 'fk_reference_facture', 'fk_reference_magasin'), 'unique' => 1) + 'PRIMARY' => array('column' => array('id_commande', 'id_facture', 'id_magasin'), 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + + public $cake_sessions = array( + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'primary'), + 'data' => array('type' => 'text', 'null' => true, 'default' => null), + 'expires' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $categorie = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'autoIncrement' => true), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 50, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'nom' => array('type' => 'string', 'null' => false, 'length' => 50, 'key' => 'primary'), 'parent' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 3, 'unsigned' => false, 'key' => 'index'), 'image' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'indexes' => array( @@ -33,53 +50,55 @@ public function after($event = array()) { ); public $classification = array( - 'reference_classe' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_categorie' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), + 'id' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary'), + 'nom' => array('type' => 'string', 'null' => false, 'length' => 30), + 'id_categorie' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), 'indexes' => array( - 'PRIMARY' => array('column' => 'reference_classe', 'unique' => 1) + 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); - public $client = array( - 'identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'email' => array('type' => 'string', 'null' => false, 'length' => 60, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_id_mdp' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 32, 'key' => 'unique', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'prenom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + public $clients = array( + 'id' => array('type' => 'string', 'null' => false, 'length' => 50, 'key' => 'primary'), + 'email' => array('type' => 'string', 'null' => false, 'length' => 255), + 'id_motdepasse' => array('type' => 'string', 'null' => true, 'length' => 255), + 'nom' => array('type' => 'string', 'null' => false, 'length' => 30), + 'prenom' => array('type' => 'string', 'null' => false, 'length' => 30), 'annee_de_naissance' => array('type' => 'text', 'null' => false, 'length' => 4), - 'adresse' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'ville' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pays' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'numero_tel' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 20, 'unsigned' => false), + 'adresse' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 30), + 'codepostal' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), + 'ville' => array('type' => 'string', 'null' => false, 'length' => 40), + 'pays' => array('type' => 'string', 'null' => false, 'length' => 20), + 'telephone' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 20, 'unsigned' => false), + 'role' => array('type' => 'string', 'null' => false, 'length' => 20), + 'cree' => array('type' => 'date', 'null' => false), + 'modifie' => array('type' => 'date', 'null' => false), 'indexes' => array( - 'PRIMARY' => array('column' => 'identifiant', 'unique' => 1), - 'fk_id_mdp' => array('column' => 'fk_id_mdp', 'unique' => 1), - 'fk_id_mdp_2' => array('column' => 'fk_id_mdp', 'unique' => 1) + 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $commande = array( - 'reference' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'date_de_commande' => array('type' => 'date', 'null' => false, 'key' => 'index'), - 'fk_reference_produit' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_promotion' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), + 'id_produit' => array('type' => 'string', 'null' => false, 'length' => 20), + 'id_promotion' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), 'indexes' => array( - 'PRIMARY' => array('column' => 'reference', 'unique' => 1), + 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'date_de_commande' => array('column' => 'date_de_commande', 'unique' => 0) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $compte = array( - 'fk_identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'id' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary'), 'nb_de_produits_achetes' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'montant_d_achat_total' => array('type' => 'decimal', 'null' => false, 'default' => '0.0', 'length' => '6,1', 'unsigned' => false), 'date_ouverture_du_compte' => array('type' => 'date', 'null' => false), 'indexes' => array( - 'PRIMARY' => array('column' => 'fk_identifiant', 'unique' => 1), + 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'nb_de_produits_achetes' => array('column' => array('nb_de_produits_achetes', 'montant_d_achat_total', 'date_ouverture_du_compte'), 'unique' => 0) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') @@ -87,30 +106,30 @@ public function after($event = array()) { public $articles = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'entete' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_categorie' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'corps' => array('type' => 'text', 'null' => false, 'length' => 4, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'entete' => array('type' => 'string', 'null' => false, 'length' => 250), + 'id_categorie' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'corps' => array('type' => 'text', 'null' => false, 'length' => 4), 'date' => array('type' => 'date', 'null' => false), - 'published' => array('type' => 'date', 'null' => false), - 'indexes' => array( + 'published' => array('type' => 'date', 'null' => false), + 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $disponibilite = array( - 'fk_id_produit' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false, 'key' => 'primary'), - 'fk_reference_exemplaire' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false, 'key' => 'primary'), + 'id_exemplaire' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary'), 'indexes' => array( - 'PRIMARY' => array('column' => array('fk_id_produit', 'fk_reference_exemplaire'), 'unique' => 1) + 'PRIMARY' => array('column' => array('id', 'id_exemplaire'), 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $editeur = array( - 'code_editeur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'code_editeur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary'), 'image' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 5, 'unsigned' => false), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'nom' => array('type' => 'string', 'null' => false, 'length' => 20), 'indexes' => array( 'PRIMARY' => array('column' => 'code_editeur', 'unique' => 1) ), @@ -118,9 +137,9 @@ public function after($event = array()) { ); public $exemplaire = array( - 'code_reference' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'code_reference' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary'), 'date_de_livraison' => array('type' => 'date', 'null' => false), - 'fk_id_produit' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false), + 'id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'code_reference', 'unique' => 1) ), @@ -128,25 +147,25 @@ public function after($event = array()) { ); public $facture = array( - 'reference' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'reference' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary'), 'montant_facture' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '6,1', 'unsigned' => false), 'date_de_facturation' => array('type' => 'date', 'null' => false), - 'mode_de_paiement' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'mode_de_paiement' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'index'), + 'id' => array('type' => 'string', 'null' => false, 'length' => 20), 'indexes' => array( 'PRIMARY' => array('column' => 'reference', 'unique' => 1), - 'mode_de_paiement' => array('column' => array('mode_de_paiement', 'fk_identifiant'), 'unique' => 0) + 'mode_de_paiement' => array('column' => array('mode_de_paiement', 'id'), 'unique' => 0) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $fournisseur = array( - 'code_fournisseur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'adresse' => array('type' => 'string', 'null' => false, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'code_fournisseur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary'), + 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'key' => 'index'), + 'adresse' => array('type' => 'string', 'null' => false, 'length' => 40), 'numero_tel' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 20, 'unsigned' => false), - 'ville' => array('type' => 'string', 'null' => false, 'length' => 15, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pays' => array('type' => 'string', 'null' => false, 'length' => 15, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'ville' => array('type' => 'string', 'null' => false, 'length' => 15), + 'pays' => array('type' => 'string', 'null' => false, 'length' => 15), 'indexes' => array( 'PRIMARY' => array('column' => 'code_fournisseur', 'unique' => 1), 'nom' => array('column' => array('nom', 'ville', 'pays'), 'unique' => 0) @@ -156,10 +175,10 @@ public function after($event = array()) { public $image = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'nom' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'nom' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 250), 'image' => array('type' => 'mediumbinary', 'null' => false, 'default' => null), - 'mime' => array('type' => 'string', 'null' => false, 'default' => 'image/png', 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'mime' => array('type' => 'string', 'null' => false, 'default' => 'image/png', 'length' => 250), + 'description' => array('type' => 'text', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), @@ -169,13 +188,13 @@ public function after($event = array()) { public $info = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'categorie' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'titre' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'auteur' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'contenu' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'langue' => array('type' => 'string', 'null' => false, 'length' => 32, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'titre' => array('type' => 'text', 'null' => false, 'default' => null), + 'auteur' => array('type' => 'string', 'null' => false, 'length' => 250), + 'contenu' => array('type' => 'text', 'null' => false, 'default' => null), + 'langue' => array('type' => 'string', 'null' => false, 'length' => 32), 'date' => array('type' => 'date', 'null' => false), 'published' => array('type' => 'date', 'null' => false), - 'images' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 35, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'images' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 35), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), @@ -184,9 +203,9 @@ public function after($event = array()) { public $messages = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'titre' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'texte' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pseudo' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'titre' => array('type' => 'string', 'null' => false, 'length' => 250), + 'texte' => array('type' => 'text', 'null' => false, 'default' => null), + 'id_client' => array('type' => 'string', 'null' => false, 'length' => 255), 'date' => array('type' => 'date', 'null' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), @@ -195,21 +214,24 @@ public function after($event = array()) { 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); - public $motdepasse = array( - 'id_unique' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'motdepasse' => array('type' => 'string', 'null' => false, 'length' => 8, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + public $motdepasses = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'autoIncrement' => true), + 'password' => array('type' => 'string', 'null' => false, 'length' => 255), + 'password_confirm' => array('type' => 'string', 'null' => false, 'length' => 255), + 'cree' => array('type' => 'date', 'null' => false), + 'modifie' => array('type' => 'date', 'null' => false), 'indexes' => array( - 'PRIMARY' => array('column' => 'id_unique', 'unique' => 1) + 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $php4u_bookmarks = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), - 'dbase' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'user' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'label' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'query' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'dbase' => array('type' => 'string', 'null' => false, 'length' => 128), + 'user' => array('type' => 'string', 'null' => false, 'length' => 128), + 'label' => array('type' => 'string', 'null' => false, 'length' => 128), + 'query' => array('type' => 'text', 'null' => false, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), diff --git a/app/Config/Schema/schema.php b/app/Config/Schema/schema.php deleted file mode 100644 index b5df1bb75..000000000 --- a/app/Config/Schema/schema.php +++ /dev/null @@ -1,219 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false, 'key' => 'primary'), - 'fk_reference_facture' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_magasin' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => array('fk_reference_commande', 'fk_reference_facture', 'fk_reference_magasin'), 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $categorie = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary', 'autoIncrement' => true), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 50, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'parent' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 3, 'unsigned' => false, 'key' => 'index'), - 'image' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => array('id', 'nom'), 'unique' => 1), - 'parent' => array('column' => 'parent', 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $classification = array( - 'reference_classe' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_categorie' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'reference_classe', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $client = array( - 'identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'email' => array('type' => 'string', 'null' => false, 'length' => 60, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_id_mdp' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 32, 'key' => 'unique', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'prenom' => array('type' => 'string', 'null' => false, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'annee_de_naissance' => array('type' => 'text', 'null' => false, 'length' => 4), - 'adresse' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'ville' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pays' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'numero_tel' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 20, 'unsigned' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'identifiant', 'unique' => 1), - 'fk_id_mdp' => array('column' => 'fk_id_mdp', 'unique' => 1), - 'fk_id_mdp_2' => array('column' => 'fk_id_mdp', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $commande = array( - 'reference' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'date_de_commande' => array('type' => 'date', 'null' => false, 'key' => 'index'), - 'fk_reference_produit' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_promotion' => array('type' => 'integer', 'null' => false, 'default' => '0', 'unsigned' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'reference', 'unique' => 1), - 'date_de_commande' => array('column' => 'date_de_commande', 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $compte = array( - 'fk_identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nb_de_produits_achetes' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), - 'montant_d_achat_total' => array('type' => 'decimal', 'null' => false, 'default' => '0.0', 'length' => '6,1', 'unsigned' => false), - 'date_ouverture_du_compte' => array('type' => 'date', 'null' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'fk_identifiant', 'unique' => 1), - 'nb_de_produits_achetes' => array('column' => array('nb_de_produits_achetes', 'montant_d_achat_total', 'date_ouverture_du_compte'), 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $articles = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'entete' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_reference_categorie' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'corps' => array('type' => 'text', 'null' => false, 'length' => 4, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'date' => array('type' => 'date', 'null' => false), - 'published' => array('type' => 'date', 'null' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $disponibilite = array( - 'fk_id_produit' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false, 'key' => 'primary'), - 'fk_reference_exemplaire' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => array('fk_id_produit', 'fk_reference_exemplaire'), 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $editeur = array( - 'code_editeur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'image' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 5, 'unsigned' => false), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'code_editeur', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $exemplaire = array( - 'code_reference' => array('type' => 'string', 'null' => false, 'length' => 20, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'date_de_livraison' => array('type' => 'date', 'null' => false), - 'fk_id_produit' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 5, 'unsigned' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'code_reference', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $facture = array( - 'reference' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'montant_facture' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '6,1', 'unsigned' => false), - 'date_de_facturation' => array('type' => 'date', 'null' => false), - 'mode_de_paiement' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'fk_identifiant' => array('type' => 'string', 'null' => false, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'reference', 'unique' => 1), - 'mode_de_paiement' => array('column' => array('mode_de_paiement', 'fk_identifiant'), 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $fournisseur = array( - 'code_fournisseur' => array('type' => 'string', 'null' => false, 'length' => 4, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'nom' => array('type' => 'string', 'null' => false, 'length' => 30, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'adresse' => array('type' => 'string', 'null' => false, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'numero_tel' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 20, 'unsigned' => false), - 'ville' => array('type' => 'string', 'null' => false, 'length' => 15, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pays' => array('type' => 'string', 'null' => false, 'length' => 15, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'code_fournisseur', 'unique' => 1), - 'nom' => array('column' => array('nom', 'ville', 'pays'), 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB', 'comment' => 'Fournisseurs des produits') - ); - - public $image = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'nom' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'image' => array('type' => 'mediumbinary', 'null' => false, 'default' => null), - 'mime' => array('type' => 'string', 'null' => false, 'default' => 'image/png', 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'description' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $info = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'categorie' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'titre' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'auteur' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'contenu' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'langue' => array('type' => 'string', 'null' => false, 'length' => 32, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'date' => array('type' => 'date', 'null' => false), - 'published' => array('type' => 'date', 'null' => false), - 'images' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 35, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $messages = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'titre' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'texte' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'pseudo' => array('type' => 'string', 'null' => false, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'date' => array('type' => 'date', 'null' => false), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1), - 'date' => array('column' => 'date', 'unique' => 0) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $motdepasse = array( - 'id_unique' => array('type' => 'string', 'null' => false, 'length' => 32, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'motdepasse' => array('type' => 'string', 'null' => false, 'length' => 8, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id_unique', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - - public $php4u_bookmarks = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), - 'dbase' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'user' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'label' => array('type' => 'string', 'null' => false, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'query' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1) - ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') - ); - -} diff --git a/app/Config/email.php b/app/Config/email.php new file mode 100644 index 000000000..132c32b0f --- /dev/null +++ b/app/Config/email.php @@ -0,0 +1,28 @@ + 'Mail', + 'from' => 'webmaster@localhost', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ); + public $gmail = array( + 'host' => 'smtp.gmail.com', + 'port' => 465, + 'username' => 'my@gmail.com', + 'password' => 'secret', + 'transport' => 'Smtp', + 'tls' => true + ); + public function __construct() { + $this->default['from'] = getenv('SERVER_NAME') ? 'no-reply@' . getenv('SERVER_NAME') : $this->default['from']; + } +} + ?> diff --git a/app/Config/routes.php b/app/Config/routes.php index e59e20bcc..14b15f3f3 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -29,6 +29,30 @@ * views are prefixed with "admin/" => admin_action() */ Router::connect('/admin/e14/:action/*', array('controller' => 'e14', 'admin' => true)); +/** + *************************************************** ArticleController routing + * the one star(*) wildcard is for one-to-one passed arguments separated by the slash '/' + */ +Router::connect('/users/psd/:action/*', array('controller' => 'MotDePasse')); +/** + * the two stars(**) wildcard is for many-to-one argument passed as a whole string + */ +Router::connect('/users/psd/**', array('controller' => 'MotDePasse', 'action' => 'index')); +/** + */ +Router::connect('/admin/users/psd/:action/*', array('controller' => 'MotDePasse', 'admin' => true)); +/** + *************************************************** ArticleController routing + * the one star(*) wildcard is for one-to-one passed arguments separated by the slash '/' + */ +Router::connect('/users/:action/*', array('controller' => 'client')); +/** + * the two stars(**) wildcard is for many-to-one argument passed as a whole string + */ +Router::connect('/users/**', array('controller' => 'client', 'action' => 'index')); +/** + */ +Router::connect('/admin/users/:action/*', array('controller' => 'client', 'admin' => true)); /** *************************************************** ArticleController routing * the one star(*) wildcard is for one-to-one passed arguments separated by the slash '/' diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 1814dfbf1..49e4da5a4 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -21,7 +21,7 @@ */ App::uses('Controller', 'Controller'); App::uses('Index', 'Cms'); - +App::uses('AuthComponent', 'Controller/Component/'); /** * Application Controller * @@ -38,12 +38,44 @@ class AppController extends Controller { */ public $components = array('DebugKit.Toolbar', 'Flash' => array( - 'className' => 'MyFlash')); + 'className' => 'MyFlash' + ), + 'Auth' => array( + 'loginRedirect' => array('controller' => 'clients', 'action' => 'index'), + 'logoutRedirect' => array('controller' => 'e14', 'action' => 'index'), + 'authError' => "Veuillez vous authentifier, s'il-vous-plaît.", + 'authenticate' => array( + AuthComponent::ALL => array( + 'userModel' => 'Client', + 'fields' => array( + 'username' => 'id', // 'username' par défaut + 'password' => 'id_motdepasse' // 'password' par défaut + ) + ), + 'Basic', + 'Form' + ), + 'authorize' => array('Controller') + ) + ); + + /** Gestion simple des acces controlés par role. Un 'controller' dépendant de cette méthode pour + * définir l'autorisation Client pour une action donnée + */ + public function isAuthorized($user) { + /* Admin peut accéder à toute action */ + if (isset($user['role']) && $user['role'] === 'admin') { + return true; + } + + /* Refus par défaut */ + return false; + } public $helpers = array('Info' => array( 'index' => null, 'countPerPage' => '10', 'md' => true - ), 'Markdown.Markdown' => true, 'Form', 'Html', 'Js', 'Time', 'Flash'); + ), 'Markdown.Markdown' => true, 'Text', 'Form', 'Html', 'Js', 'Time', 'Flash'); protected $_r; public function __construct($request = null, $response = null) { @@ -55,8 +87,13 @@ public function __construct($request = null, $response = null) { } public function beforeFilter() { + parent::beforeFilter(); /* internationalisation (i18n) */ Configure::write('Config.language', $this->_r->getLanguage()); + /* AuthComponent de ne pas exiger un login pour toutes les actions index et view*/ + $this->Auth->allow( + 'index', + 'view'); } /** diff --git a/app/Controller/ArticleController.php b/app/Controller/ArticleController.php index 8e29bb290..c8a9fab30 100644 --- a/app/Controller/ArticleController.php +++ b/app/Controller/ArticleController.php @@ -40,11 +40,11 @@ function publierImages() { ) ); - public function index($fk_reference_categorie = null) { - if ($fk_reference_categorie === null) { + public function index($id__categorie = null) { + if ($id__categorie === null) { $this->set('articles', $this->Article->find('all')); } else { - $this->set('articles', $this->Article->find($fk_reference_categorie)); + $this->set('articles', $this->Article->find($id__categorie)); } $this->set("pIndex", "activites__index"); $this->render(null, "default-e14"); diff --git a/app/Controller/ClientController.php b/app/Controller/ClientController.php new file mode 100644 index 000000000..3fea9ee28 --- /dev/null +++ b/app/Controller/ClientController.php @@ -0,0 +1,159 @@ +Auth->allow('add', 'logout'); + } + + public function admin_login() { + $this->Auth->redirectUrl(array('action' => 'index', 'admin' => true)); + return $this->redirect(array('action' => 'login', 'admin' => false)); + } + public function login() { + if ($this->request->is('post')) { + if ($this->Auth->login()) { + return $this->redirect($this->Auth->redirectUrl()); + } else { + $this->Flash->error(__("Invalid username or password")); + } + } + $this->set('pIndex', 'users__login'); + $this->render(null, 'default-e14'); + } + + public function admin_logout() { + return $this->redirect(array('action' => 'logout', 'admin' => false)); + } + public function logout() { + return $this->redirect($this->Auth->logout()); + } + + public function index() { + $this->set('pIndex', 'users__index'); + $this->render(null, 'default-e14'); + } + + public function admin_index() { + $this->Client->recursive = 0; + $this->set('clients', $this->paginate()); + $this->set('pIndex', 'users__adminindex'); + $this->render(null, 'admin_default-e14'); + } + + public function admin_view($id = 0) { + return $this->redirect(array('action' => 'view', 'admin' => false, $id)); + } + public function view($id = 0) { + if (!$id) { + return $this->redirect(array("action" => "index")); + } + if (!$this->Client->exists($id)) { + throw new NotFoundException(__('Invalid username')); + } + $this->set('client', $this->Client->findById($id)); + $this->set('pIndex', 'users__view'); + $this->render(null, 'default-e14'); + } + public function admin_add() { + return $this->redirect(array('action' => 'add', 'admin' => false)); + } + public function add() { + if ($this->request->is('post')) { + $this->Client->create(); + if ($this->Client->save($this->request->data)) { + $this->Flash->success(__('Subscription success')); + $id = $this->Client->id; + $this->request->data['Client'] = array_merge( + $this->request->data['Client'], + array('id' => $id) + ); + /* Desaffectaction du 'password' en requete, + pour éviter la sauvegarde en session en clair du mot de passe en appelant login. + unset($this->request->data['Client']['id_motdepasse']);*/ + $this->Auth->login($this->request->data['Client']); + /* Le mot de passe sera cree ensuite */ + return $this->redirect(array('controller' => 'MotDePasse', 'action' => 'add', $id)); + } else { + $this->Flash->error(__('Failed to subscribe. Please try again')); + } + } + $this->set('pIndex', 'users__add'); + $this->render(null, 'default-e14'); + } + public function admin_edit($id = null, $id_motdepasse = null) { + return $this->redirect(array('action' => 'edit', 'admin' => false, $id, $id_motdepasse)); + } + public function edit($id = null, $id_motdepasse = null) { + $this->Client->id = $id; + if (!$this->Client->exists()) { + throw new NotFoundException(__('Invalid username')); + } + if(isset($id_motdepasse)) { + $this->Client->id_motdepasse = $id_motdepasse; + } + if ($this->request->is('post') || $this->request->is('put')) { + if ($this->Client->save($this->request->data)) { + $this->Flash->success(__('Saved changes success!')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Flash->error(__('Failed to save changes. Please try again')); + } + } else { + $this->request->data = $this->Client->findById($id); + /* Desaffectaction du 'password' en requete, + pour éviter la sauvegarde en session en clair du mot de passe en appelant login. */ + unset($this->request->data['Client']['id_motdepasse']); + } + $this->set('pIndex', 'users__edit'); + $this->render(null, 'default-e14'); + } + public function admin_delete($id = null) { + return $this->redirect(array('action' => 'delete', 'admin' => false)); + } + + public function delete($id = null) { + // Avant 2.5, utilisez + // $this->request->onlyAllow('post'); + + $this->request->allowMethod('post'); + + $this->Client->id = $id; + if (!$this->Client->exists()) { + throw new NotFoundException(__('Invalid username')); + } + if ($this->Client->delete()) { + $this->Flash->success(__('Subscription was removed')); + return $this->redirect(array('action' => 'index')); + } + $this->Flash->error(__('Subscription could NOT be removed')); + return $this->redirect(array('action' => 'index')); + } + + public function admin_recovery() { + return $this->redirect(array('action' => 'recovery', 'admin' => false)); + } + public function recovery() { + $this->set('client', $this->Client); + $Email = new CakeEmail(); + $Email->helpers(array('Html', 'Text')); + /* app/view/Emails*/ + $Email->template('recovery', 'default') + ->emailFormat('html') + ->to($this->Client->email) + ->send(); + } + +} +?> diff --git a/app/Controller/Component/MyFlashComponent.php b/app/Controller/Component/MyFlashComponent.php index d02e30b14..bf6f59750 100644 --- a/app/Controller/Component/MyFlashComponent.php +++ b/app/Controller/Component/MyFlashComponent.php @@ -31,18 +31,23 @@ public function beforeRender(Controller $controller) { public function shutDown(Controller $controller) { parent::shutdown($controller); - + } public function beforeRedirect(Controller $controller, $url, $status = null, $exit = true) { parent::beforeRedirect($controller, $url, $status, $exit); } - - public function success($message) { + + public function success($message) { $this->set($message, array('params' => array('class' => 'success'))); } - + public function error($message) { $this->set($message, array('params' => array('class' => 'error'))); } + + public function notice($message) { + $this->set($message, array('params' => array('class' => 'notice'))); + } + } diff --git a/app/Controller/E14Controller.php b/app/Controller/E14Controller.php index 313107f8c..4da7d1f39 100644 --- a/app/Controller/E14Controller.php +++ b/app/Controller/E14Controller.php @@ -22,6 +22,9 @@ public function __construct($request = null, $response = null) { $route = Router::currentRoute(); i_debug($route); } + public function beforeFilter() { + $this->Auth->allow(); + } /** @param string $p page filename.php (optional) */ public function index($p = NULL, $images = NULL) { diff --git a/app/Controller/MessageController.php b/app/Controller/MessageController.php index 882fa38db..9f4ef0c92 100644 --- a/app/Controller/MessageController.php +++ b/app/Controller/MessageController.php @@ -11,11 +11,15 @@ */ class MessageController extends AppController { - public function index($fk_identifiant = null) { - if ($fk_identifiant === null) { + public function __construct($request = null, $response = null) { + parent::__construct($request, $response); + } + + public function index($id = null) { + if ($id === null) { $this->set('messages', $this->Message->find('all')); } else { - $this->set('messages', $this->Message->find($fk_identifiant)); + $this->set('messages', $this->Message->find($id)); } $this->set("pIndex","contactus__index"); $this->render(null, "default-e14"); @@ -25,8 +29,6 @@ public function index($fk_identifiant = null) { * @param String $p method name */ public function admin_index($p = null) { - //debug($this->request->params); - //debug($GLOBALS); $this->set('pIndex', 'admin__contactus'); $this->set('pMethod', $p); $this->render(null, "default-e14"); @@ -49,15 +51,80 @@ public function view($id) { public function add($id = null) { if (empty($this->request->data)) { $this->request->data = $this->Message->findById($id); - } else { - /* sauvegarde du message */ - include_once APP . $r->r['include__php_constantes.inc']; - /* ajouter dans la base de donnees */ - $sql = new SQL(SERVEUR, BASE, CLIENT, CLIENT_MDP); - } + } else if ($this->request->is('post')) { + $this->Message->create(); + $this->request->data['Message']['id'] = $this->Auth->user('id'); + if ($this->Message->save($this->request->data)) { + $this->Flash->success(__('Message posted')); + return $this->redirect(array('action' => 'index')); + } + $this->Flash->error(__('Unable to post the message')); + } $this->set("pIndex","contactus__write"); $this->render(null, "default-e14"); } + + public function edit($id = null) { + if (!$id) { +/* throw new NotFoundException(__('Invalid message'));*/ + return $this->redirect(array('action' => 'add')); + } + + $post = $this->Message->findById($id); + if (!$post) { + throw new NotFoundException(__('Invalid message')); + } + + if ($this->request->is(array('post', 'put'))) { + $this->Message->id = $id; + if ($this->Message->save($this->request->data)) { + $this->Flash->success(__('Message was successfully updated')); + return $this->redirect(array('action' => 'index')); + } + $this->Flash->error(__('Impossible to modify the message')); + } + + if (!$this->request->data) { + $this->request->data = $post; + } + $this->set("pIndex","contactus__edit"); + $this->render(null, "default-e14"); +} + public function delete($id) { + /* devier les requetes delete?id= */ + if ($this->request->is('get')) { + throw new MethodNotAllowedException(); + } + + if ($this->Message->delete($id)) { + $this->Flash->success( + __('Message %s was successfully removed.', h($id)) + ); + } else { + $this->Flash->error( + __('Message %s could NOT be removed', h($id)) + ); + } + + return $this->redirect(array('action' => 'index')); + } + + public function isAuthorized($client) { + /* Tous les users inscrits peuvent ajouter les posts */ + if ($this->action === 'add') { + return true; + } + + /* Le propriétaire du post peut l'éditer et le supprimer */ + if (in_array($this->action, array('edit', 'delete'))) { + $messageId = (int) $this->request->params['pass'][0]; + if ($this->Message->isOwnedBy($messageId, $client['id'])) { + return true; + } + } + + return parent::isAuthorized($client); + } } ?> diff --git a/app/Controller/MotDePasseController.php b/app/Controller/MotDePasseController.php new file mode 100644 index 000000000..6504e03c9 --- /dev/null +++ b/app/Controller/MotDePasseController.php @@ -0,0 +1,107 @@ +Auth->allow('add', 'delete'); + } + + public function index() { + $this->set('pIndex', 'users__index'); + $this->render(null, 'default-e14'); + } + public function add($id = null) { + if ($this->request->is('post')) { + $this->MotDePasse->create(); + if ($this->MotDePasse->save($this->request->data)) { + $this->Flash->success(__('Password was NOT saved')); + if(!isset($id)) { + $id = $this->Auth->user('id'); + } + $client = Client::findById($id); + $this->Flash->message(__('Subscription saving %s...', $client)); + /* Desaffectaction du 'password' en requete, + pour éviter la sauvegarde en session en clair du mot de passe en appelant login. */ + unset($this->request->data['MotDePasse']['password']); + unset($this->request->data['MotDePasse']['password_confirm']); + if($client !== false) { + return $this->redirect(array('controller' => 'Client', 'action' => 'edit', $id, $this->MotDePasse->id)); + } else { + return $this->redirect(array('controller' => 'MotDePasse', 'action' => 'index')); + } + } else { + $this->Flash->error(__('Password could NOT be saved. Please try again')); + } + } + $this->set('pIndex', 'users__add'); + $this->render(null, 'default-e14'); + } + + public function edit($id = null, $id = null) { + $this->MotDePasse->id = $id; + if (!$this->MotDePasse->exists()) { + throw new NotFoundException(__('Invalid password')); + } + if ($this->request->is('post') || $this->request->is('put')) { + if(!isset($id)) { + $id = $this->Auth->user('id'); + } + $client = Client::findById($id); + if ($client !== false && $client->isOwnedBy($this->MotDePasse->id, $id) && $this->MotDePasse->save($this->request->data)) { + $this->Flash->success(__('Password was saved')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Flash->error(__('Password could NOT be saved. Please try again')); + } + } else { + $this->request->data = $this->MotDePasse->findById($id); + unset($this->request->data['MotDePasse']['password']); + unset($this->request->data['MotDePasse']['password_confirm']); + } + $this->set('pIndex', 'users__edit'); + $this->render(null, 'default-e14'); + } + + public function delete($id = null, $id = null) { + // Avant 2.5, utilisez + // $this->request->onlyAllow('post'); + + $this->request->allowMethod('post', 'put'); + + $this->MotDePasse->id = $id; + if (!$this->MotDePasse->exists()) { + throw new NotFoundException(__('Invalid password')); + } + if(!isset($id)) { + $id = $this->Auth->user('id'); + } + $client = Client::findById($id); + if ($client !== false && $client->isOwnedBy($this->MotDePasse->id, $id) && $this->MotDePasse->delete()) { + $this->Flash->success(__('Password was removed')); + return $this->redirect(array('action' => 'add', $id)); + } + if(!$client) { + $this->Flash->error(__("Invalid '%s' subscription", $id)); + } else { + $this->Flash->error(__("Subscription '%s' doesn\'t match the password", $id)); + } + $this->Flash->error(__('Password could NOT be removed')); + return $this->redirect(array('action' => 'index')); + } +} diff --git a/app/Locale/article.pot b/app/Locale/article.pot index 6195f8242..a578450bf 100644 --- a/app/Locale/article.pot +++ b/app/Locale/article.pot @@ -13,28 +13,104 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: View/Article/add.ctp:3 +#: Controller/ArticleController.php:70;97;102 +msgid "Invalid article" +msgstr "" + +#: Controller/ArticleController.php:85 +msgid "Your article has been saved." +msgstr "" + +#: Controller/ArticleController.php:89 +msgid "Unable to add your article." +msgstr "" + +#: Controller/ArticleController.php:109 +msgid "Your article has been updated." +msgstr "" + +#: Controller/ArticleController.php:113 +msgid "Unable to update your article." +msgstr "" + +#: Controller/ArticleController.php:130 +msgid "Article with id : %s was deleted." +msgstr "" + +#: Controller/ArticleController.php:134 +msgid "Article with id: %s couldn't be deleted." +msgstr "" + +#: View/Article/add.ctp:9 +msgid "Upload some images" +msgstr "" + +#: View/Article/add.ctp:15;20 +#: View/Article/edit.ctp:11;16 +msgid "Upload" +msgstr "" + +#: View/Article/add.ctp:17 +#: View/Article/edit.ctp:13 +msgid "file format image/%s" +msgstr "" + +#: View/Article/add.ctp:24 #: View/Article/index.ctp:22 msgid "Add an article" msgstr "" -#: View/Article/add.ctp:6 +#: View/Article/add.ctp:26 +#: View/Article/edit.ctp:22 msgid "Header" msgstr "" -#: View/Article/add.ctp:7 +#: View/Article/add.ctp:27 +#: View/Article/edit.ctp:23 msgid "Published" msgstr "" -#: View/Article/add.ctp:8 +#: View/Article/add.ctp:28 +#: View/Article/edit.ctp:24 msgid "Body" msgstr "" -#: View/Article/add.ctp:9 -msgid "Created" +#: View/Article/add.ctp:30 +msgid "Save and continue with images" +msgstr "" + +#: View/Article/add.ctp:15 +#: View/Article/edit.ctp:11 +msgid "%s image" +msgid_plural "images" +msgstr[0] "" +msgstr[1] "" + +#: View/Article/edit.ctp:8 +msgid "Upload more images" +msgstr "" + +#: View/Article/edit.ctp:20 +msgid "Edit an article" +msgstr "" + +#: View/Article/edit.ctp:26 +msgid "Save this article" +msgstr "" + +#: View/Article/index.ctp:4 +msgid "db_articles" +msgstr "" + +#: View/Article/index.ctp:5 +msgid "categorie" +msgstr "" + +#: View/Article/index.ctp:5 +msgid "article" msgstr "" -#: View/Article/add.ctp:10 -msgid "Save an article" +#: View/Article/index.ctp:5 +msgid "published" msgstr "" diff --git a/app/Locale/cake.pot b/app/Locale/cake.pot index 0d4558b14..9579672fc 100644 --- a/app/Locale/cake.pot +++ b/app/Locale/cake.pot @@ -15,6 +15,8 @@ msgstr "" #: View/Errors/error400.ctp:10 #: View/Errors/error500.ctp:10 +#: View/Errors/missing_connection.ctp:2 +#: View/Errors/missing_datasource_config.ctp:2 msgid "Error" msgstr "" diff --git a/app/Locale/cake_dev.pot b/app/Locale/cake_dev.pot index 4a7ee1225..d153a679b 100644 --- a/app/Locale/cake_dev.pot +++ b/app/Locale/cake_dev.pot @@ -19,6 +19,7 @@ msgstr "" #: Plugin/Markdown/View/Errors/missing_markdown.ctp:3;7 #: View/Errors/fatal_error.ctp:19 +#: View/Errors/pdo_error.ctp:19 msgid "Error" msgstr "" @@ -50,6 +51,18 @@ msgstr "" msgid "Line" msgstr "" +#: View/Errors/pdo_error.ctp:17 +msgid "Database Error" +msgstr "" + +#: View/Errors/pdo_error.ctp:24 +msgid "SQL Query" +msgstr "" + +#: View/Errors/pdo_error.ctp:29 +msgid "SQL Query Params" +msgstr "" + #: View/Layouts/default.ctp:8 #: View/Layouts/error.ctp:8 msgid "CakePHP: the rapid development php framework" diff --git a/app/Locale/cms.pot b/app/Locale/cms.pot new file mode 100644 index 000000000..cc8133990 --- /dev/null +++ b/app/Locale/cms.pot @@ -0,0 +1,30 @@ +# LANGUAGE translation of CakePHP Application +# Copyright YEAR NAME +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" +"Last-Translator: NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: View/Errors/missing_connection.ctp:5 +#: View/Errors/missing_datasource_config.ctp:5 +msgid "Please review your configuration file " +msgstr "" + +#: View/Errors/missing_connection.ctp:6 +#: View/Errors/missing_datasource_config.ctp:6 +#: View/Errors/pdo_error.ctp:33 +msgid "In a server shell prompt" +msgstr "" + +#: View/Errors/pdo_error.ctp:32 +msgid "Please review your configuration (" +msgstr "" + diff --git a/app/Locale/debug_kit.pot b/app/Locale/debug_kit.pot index 8f5b6f066..a845d6b01 100644 --- a/app/Locale/debug_kit.pot +++ b/app/Locale/debug_kit.pot @@ -13,31 +13,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:41 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:38 msgid "-> Testing :url" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:67 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:64 msgid "Total Requests made: :requests" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:68 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:65 msgid "Total Time elapsed: :duration (seconds)" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:72 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:69 msgid "Requests/Second: :rps req/sec" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:76 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:73 msgid "Average request time: :average-time seconds" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:80 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:77 msgid "Standard deviation of average request time: :std-dev" msgstr "" -#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:84 +#: Plugin/DebugKit/Console/Command/BenchmarkShell.php:81 msgid "Longest/shortest request: :longest sec/:shortest sec" msgstr "" @@ -54,7 +54,7 @@ msgid "Number of iterations to perform." msgstr "" #: Plugin/DebugKit/Console/Command/BenchmarkShell.php:148 -msgid "Maximum total time for all iterations, in seconds.If a single iteration takes more than the tiemout, only one request will be made" +msgid "Maximum total time for all iterations, in seconds.If a single iteration takes more than the timeout, only one request will be made" msgstr "" #: Plugin/DebugKit/Console/Command/BenchmarkShell.php:152 @@ -89,19 +89,19 @@ msgstr "" msgid "Could not load DebugToolbar panel %s" msgstr "" -#: Plugin/DebugKit/Lib/DebugTimer.php:133 +#: Plugin/DebugKit/Lib/DebugTimer.php:127 msgid "Core Processing (Derived from $_SERVER[\"REQUEST_TIME\"])" msgstr "" -#: Plugin/DebugKit/Lib/FireCake.php:315 +#: Plugin/DebugKit/Lib/FireCake.php:309 msgid "Headers already sent in %s on line %s. Cannot send log data to FirePHP." msgstr "" -#: Plugin/DebugKit/Lib/FireCake.php:336 +#: Plugin/DebugKit/Lib/FireCake.php:330 msgid "Incorrect parameter count for FireCake::fb()" msgstr "" -#: Plugin/DebugKit/Lib/FireCake.php:415 +#: Plugin/DebugKit/Lib/FireCake.php:409 msgid "Maximum number (99,999) of messages reached!" msgstr "" @@ -109,19 +109,19 @@ msgstr "" msgid "There are no active panels. You must enable a panel to see its output." msgstr "" -#: Plugin/DebugKit/View/Elements/environment_panel.ctp:20 +#: Plugin/DebugKit/View/Elements/environment_panel.ctp:21 msgid "App Constants" msgstr "" -#: Plugin/DebugKit/View/Elements/environment_panel.ctp:36 +#: Plugin/DebugKit/View/Elements/environment_panel.ctp:37 msgid "CakePHP Constants" msgstr "" -#: Plugin/DebugKit/View/Elements/environment_panel.ctp:52 +#: Plugin/DebugKit/View/Elements/environment_panel.ctp:53 msgid "PHP Environment" msgstr "" -#: Plugin/DebugKit/View/Elements/environment_panel.ctp:70 +#: Plugin/DebugKit/View/Elements/environment_panel.ctp:71 msgid "Hidef Environment" msgstr "" @@ -186,19 +186,31 @@ msgstr "" msgid "Sql Logs" msgstr "" -#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:38 +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:39 +msgid "No query logs when debug < 2." +msgstr "" + +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:41 +msgid "No query logs." +msgstr "" + +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:58 msgid "Total Time: %s ms
Total Queries: %s queries" msgstr "" -#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:47 +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:67 +msgid "%s duplicate queries run." +msgstr "" + +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:70 msgid "Query Explain:" msgstr "" -#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:50 +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:73 msgid "Click an \"Explain\" link above, to see the query explanation." msgstr "" -#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:55 +#: Plugin/DebugKit/View/Elements/sql_log_panel.ctp:79 msgid "No active database connections" msgstr "" @@ -238,7 +250,7 @@ msgstr "" msgid "View Variables" msgstr "" -#: Plugin/DebugKit/View/Helper/DebugTimerHelper.php:45 +#: Plugin/DebugKit/View/Helper/DebugTimerHelper.php:44 msgid "Rendering View" msgstr "" @@ -246,11 +258,11 @@ msgstr "" msgid "Rendering %s" msgstr "" -#: Plugin/DebugKit/View/Helper/DebugTimerHelper.php:86 +#: Plugin/DebugKit/View/Helper/DebugTimerHelper.php:88 msgid "View render complete" msgstr "" -#: Plugin/DebugKit/View/Helper/HtmlToolbarHelper.php:205 +#: Plugin/DebugKit/View/Helper/HtmlToolbarHelper.php:231 msgid "Explain" msgstr "" @@ -262,7 +274,7 @@ msgstr "" msgid "No markup errors found" msgstr "" -#: Plugin/DebugKit/View/Helper/ToolbarHelper.php:189 +#: Plugin/DebugKit/View/Helper/ToolbarHelper.php:190 msgid "maybe slow" msgstr "" diff --git a/app/Locale/default.pot b/app/Locale/default.pot index 016f6fa4c..d81f7919b 100644 --- a/app/Locale/default.pot +++ b/app/Locale/default.pot @@ -13,15 +13,457 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: Controller/ArticleController.php:52 -msgid "Invalid article" +#: Controller/ClientController.php:29 +msgid "Invalid username or password" msgstr "" -#: Controller/ArticleController.php:62 -msgid "Your article has been saved." +#: Controller/ClientController.php:63;101;134 +msgid "Invalid username" msgstr "" -#: Controller/ArticleController.php:65 -msgid "Unable to add your article." +#: Controller/ClientController.php:76 +msgid "Subscription success" +msgstr "" + +#: Controller/ClientController.php:89 +msgid "Failed to subscribe. Please try again" +msgstr "" + +#: Controller/ClientController.php:108 +msgid "Saved changes success!" +msgstr "" + +#: Controller/ClientController.php:111 +msgid "Failed to save changes. Please try again" +msgstr "" + +#: Controller/ClientController.php:137 +msgid "Subscription was removed" +msgstr "" + +#: Controller/ClientController.php:140 +msgid "Subscription could NOT be removed" +msgstr "" + +#: Controller/MessageController.php:39;44;76 +msgid "Invalid message" +msgstr "" + +#: Controller/MessageController.php:58 +msgid "Message posted" +msgstr "" + +#: Controller/MessageController.php:61 +msgid "Unable to post the message" +msgstr "" + +#: Controller/MessageController.php:82 +msgid "Message was successfully updated" +msgstr "" + +#: Controller/MessageController.php:85 +msgid "Impossible to modify the message" +msgstr "" + +#: Controller/MessageController.php:102 +msgid "Message %s was successfully removed." +msgstr "" + +#: Controller/MessageController.php:106 +msgid "Message %s could NOT be removed" +msgstr "" + +#: Controller/MotDePasseController.php:33 +msgid "Password was NOT saved" +msgstr "" + +#: Controller/MotDePasseController.php:38 +msgid "Subscription saving %s..." +msgstr "" + +#: Controller/MotDePasseController.php:49;70 +msgid "Password could NOT be saved. Please try again" +msgstr "" + +#: Controller/MotDePasseController.php:59;89 +msgid "Invalid password" +msgstr "" + +#: Controller/MotDePasseController.php:67 +msgid "Password was saved" +msgstr "" + +#: Controller/MotDePasseController.php:96 +msgid "Password was removed" +msgstr "" + +#: Controller/MotDePasseController.php:100 +msgid "Invalid '%s' subscription" +msgstr "" + +#: Controller/MotDePasseController.php:102 +msgid "Subscription '%s' doesn't match the password" +msgstr "" + +#: Controller/MotDePasseController.php:104 +msgid "Password could NOT be removed" +msgstr "" + +#: Plugin/Datasources/Model/Datasource/ArraySource.php:125 +msgid "No records found in model." +msgstr "" + +#: Plugin/Datasources/Model/Datasource/CouchdbSource.php:80 +msgid "CouchDB Error: connection failed" +msgstr "" + +#: Plugin/Datasources/Model/Datasource/XmlrpcSource.php:133 +msgid "Transport error - could not open socket" +msgstr "" + +#: Plugin/Datasources/Model/Datasource/XmlrpcSource.php:136 +msgid "Transport error - HTTP status code was not 200" +msgstr "" + +#: Plugin/Datasources/Model/Datasource/XmlrpcSource.php:180 +msgid "Parse error. Not well formed" +msgstr "" + +#: View/Client/add.ctp:4 +msgid "Add a new subscription" +msgstr "" + +#: View/Client/add.ctp:6 +#: View/Client/edit.ctp:6 +#: View/Client/view.ctp:4 +msgid "My username" +msgstr "" + +#: View/Client/add.ctp:7 +#: View/Client/edit.ctp:7 +#: View/Client/view.ctp:9 +msgid "My email address" +msgstr "" + +#: View/Client/add.ctp:9 +#: View/Client/edit.ctp:9 +#: View/Client/view.ctp:14 +msgid "My first name" +msgstr "" + +#: View/Client/add.ctp:10 +#: View/Client/edit.ctp:10 +#: View/Client/view.ctp:19 +msgid "My name" +msgstr "" + +#: View/Client/add.ctp:11 +#: View/Client/edit.ctp:11 +#: View/Client/view.ctp:24 +msgid "My birthday" +msgstr "" + +#: View/Client/add.ctp:12 +#: View/Client/edit.ctp:12 +#: View/Client/view.ctp:29 +msgid "My street address" +msgstr "" + +#: View/Client/add.ctp:13 +#: View/Client/edit.ctp:13 +#: View/Client/view.ctp:34 +msgid "My city code" +msgstr "" + +#: View/Client/add.ctp:14 +#: View/Client/edit.ctp:14 +#: View/Client/view.ctp:39 +msgid "My city" +msgstr "" + +#: View/Client/add.ctp:15 +#: View/Client/edit.ctp:15 +#: View/Client/view.ctp:44 +msgid "My country" +msgstr "" + +#: View/Client/add.ctp:26 +#: View/Client/edit.ctp:26 +msgid "Continue" +msgstr "" + +#: View/Client/add.ctp:29 +#: View/Client/admin_index.ctp:20;70 +#: View/Client/edit.ctp:29 +#: View/Client/index.ctp:5 +#: View/Client/login.ctp:14 +#: View/Client/view.ctp:72 +#: View/Emails/html/recovery.ctp:5 +#: View/Emails/text/recovery.ctp:5 +#: View/MotDePasse/add.ctp:19 +#: View/MotDePasse/edit.ctp:19 +#: View/MotDePasse/index.ctp:4 +#: View/MotDePasse/view.ctp:32 +msgid "Actions" +msgstr "" + +#: View/Client/add.ctp:31 +msgid "My subscription" +msgstr "" + +#: View/Client/admin_index.ctp:2 +msgid "Profils clients" +msgstr "" + +#: View/Client/admin_index.ctp:45 +msgid "View" +msgstr "" + +#: View/Client/admin_index.ctp:46 +msgid "Modify" +msgstr "" + +#: View/Client/admin_index.ctp:47 +#: View/Client/edit.ctp:32 +msgid "Unsubscribe" +msgstr "" + +#: View/Client/admin_index.ctp:49 +#: View/Client/view.ctp:78 +msgid "Are you sure to unsubscribe # %s?" +msgstr "" + +#: View/Client/admin_index.ctp:58 +msgid "Page {:page} of {:pages}, display from {:current} records out of {:count}, starting from record {:start}, until {:end}" +msgstr "" + +#: View/Client/admin_index.ctp:63 +msgid "previous" +msgstr "" + +#: View/Client/admin_index.ctp:65 +msgid "next" +msgstr "" + +#: View/Client/admin_index.ctp:72 +msgid "Subscribe" +msgstr "" + +#: View/Client/edit.ctp:4 +msgid "Modify my profile information" +msgstr "" + +#: View/Client/edit.ctp:31 +#: View/Client/view.ctp:81 +msgid "Change my password" +msgstr "" + +#: View/Client/edit.ctp:32 +msgid "Are you sure you want to remove # %s?" +msgstr "" + +#: View/Client/edit.ctp:33 +msgid "Member list" +msgstr "" + +#: View/Client/index.ctp:2 +msgid "Dashboard" +msgstr "" + +#: View/Client/index.ctp:7 +msgid "Connect" +msgstr "" + +#: View/Client/index.ctp:8 +#: View/Client/login.ctp:15 +msgid "New subscription" +msgstr "" + +#: View/Client/login.ctp:6 +msgid "Please enter an username" +msgstr "" + +#: View/Client/login.ctp:12 +msgid "Sign in" +msgstr "" + +#: View/Client/login.ctp:16 +msgid "Forgot my password ?" +msgstr "" + +#: View/Client/view.ctp:2 +msgid "Client" +msgstr "" + +#: View/Client/view.ctp:49 +msgid "My phone number" +msgstr "" + +#: View/Client/view.ctp:54 +msgid "My role" +msgstr "" + +#: View/Client/view.ctp:59 +msgid "Created on" +msgstr "" + +#: View/Client/view.ctp:64 +msgid "Modified on" +msgstr "" + +#: View/Client/view.ctp:74 +msgid "Modify subscription" +msgstr "" + +#: View/Client/view.ctp:75 +msgid "Remove subscription" +msgstr "" + +#: View/Emails/html/recovery.ctp:1 +#: View/Emails/text/recovery.ctp:1 +msgid "Cher utilisateur %s" +msgstr "" + +#: View/Emails/html/recovery.ctp:2 +#: View/Emails/text/recovery.ctp:2 +msgid "Vous avez demandé la récupération de votre mot de passe. Par sécurité, nous vous recommandons de réinitialiser celui-ci." +msgstr "" + +#: View/Emails/html/recovery.ctp:3 +#: View/Emails/text/recovery.ctp:3 +msgid "Si vous n'êtes pas l'auteur de cette demande, vous pouvez ignorer ce message." +msgstr "" + +#: View/Emails/html/recovery.ctp:7 +#: View/Emails/text/recovery.ctp:6 +msgid "Réinitialiser le mot de passe" +msgstr "" + +#: View/Emails/html/recovery.ctp:12 +#: View/Emails/text/recovery.ctp:9 +msgid "Ce message est généré à la demande de l'utilisateur." +msgstr "" + +#: View/Message/add.ctp:4 +#: View/Message/edit.ctp:4 +msgid "Sujet de votre message" +msgstr "" + +#: View/Message/add.ctp:7 +#: View/Message/edit.ctp:7 +msgid "Contenu du message" +msgstr "" + +#: View/Message/add.ctp:9 +msgid "Auteur" +msgstr "" + +#: View/Message/add.ctp:11 +#: View/Message/edit.ctp:11 +msgid "Date" +msgstr "" + +#: View/Message/add.ctp:13 +msgid "Poster un ticket" +msgstr "" + +#: View/Message/edit.ctp:2 +#: View/Message/index.ctp:20 +msgid "Modifier un message" +msgstr "" + +#: View/Message/edit.ctp:9 +msgid "Pseudonyme" +msgstr "" + +#: View/Message/edit.ctp:14 +msgid "Sauvegarder" +msgstr "" + +#: View/Message/index.ctp:5 +msgid "Poster un message" +msgstr "" + +#: View/Message/index.ctp:8 +msgid "Tableau de bord" +msgstr "" + +#: View/Message/index.ctp:9 +#: View/Message/view.ctp:5 +msgid "date" +msgstr "" + +#: View/Message/index.ctp:9 +#: View/Message/view.ctp:5 +msgid "titre" +msgstr "" + +#: View/Message/index.ctp:9 +msgid "id" +msgstr "" + +#: View/Message/index.ctp:24 +msgid "Supprimer" +msgstr "" + +#: View/Message/view.ctp:4 +msgid "Ticket view" +msgstr "" + +#: View/MotDePasse/add.ctp:4 +msgid "Créer mon mot de passe" +msgstr "" + +#: View/MotDePasse/add.ctp:16 +#: View/MotDePasse/edit.ctp:16 +msgid "Soumettre" +msgstr "" + +#: View/MotDePasse/add.ctp:21 +#: View/MotDePasse/edit.ctp:28 +msgid "Mon profil" +msgstr "" + +#: View/MotDePasse/edit.ctp:4 +#: View/MotDePasse/index.ctp:6 +#: View/MotDePasse/view.ctp:34 +msgid "Modifier mon mot de passe" +msgstr "" + +#: View/MotDePasse/edit.ctp:22 +#: View/MotDePasse/index.ctp:7 +#: View/MotDePasse/view.ctp:35 +msgid "Réinitialiser mon mot de passe" +msgstr "" + +#: View/MotDePasse/edit.ctp:26 +#: View/MotDePasse/index.ctp:11 +#: View/MotDePasse/view.ctp:39 +msgid "Êtes-vous certain de réinitialiser votre mot de passe ?" +msgstr "" + +#: View/MotDePasse/index.ctp:2 +#: View/MotDePasse/view.ctp:2;9 +msgid "Mot de passe" +msgstr "" + +#: View/MotDePasse/index.ctp:13 +msgid "Modifier le profil" +msgstr "" + +#: View/MotDePasse/view.ctp:4 +msgid "Id" +msgstr "" + +#: View/MotDePasse/view.ctp:14 +msgid "Confirmation du mot de passe" +msgstr "" + +#: View/MotDePasse/view.ctp:19 +msgid "Créé le" +msgstr "" + +#: View/MotDePasse/view.ctp:24 +msgid "Modifié le" msgstr "" diff --git a/app/Locale/formulaire.pot b/app/Locale/formulaire.pot new file mode 100644 index 000000000..8a19a53e3 --- /dev/null +++ b/app/Locale/formulaire.pot @@ -0,0 +1,71 @@ +# LANGUAGE translation of CakePHP Application +# Copyright YEAR NAME +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" +"Last-Translator: NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: Model/Client.php:validation for field id +msgid "Username required" +msgstr "" + +#: Model/Client.php:validation for field id +msgid "Name already exists" +msgstr "" + +#: Model/Client.php:validation for field nom +msgid "Last name required" +msgstr "" + +#: Model/Client.php:validation for field prenom +msgid "First name required" +msgstr "" + +#: Model/Client.php:validation for field ville +msgid "City required" +msgstr "" + +#: Model/Client.php:validation for field codepostal +msgid "City code required" +msgstr "" + +#: Model/Client.php:validation for field role +msgid "Please choose a valid role" +msgstr "" + +#: Model/Client.php:validation for field telephone +msgid "e.g. +999 8811 2022" +msgstr "" + +#: Model/Message.php:validation for field titre;validation for field texte +msgid "No HTML tags" +msgstr "" + +#: Model/Message.php:validation for field titre;validation for field texte +msgid "Requis" +msgstr "" + +#: Model/Message.php:validation for field id_client +msgid "Only alphabetic or numerical characters or dash or underscores." +msgstr "" + +#: Model/Motdepasse.php:validation for field password +msgid "Pasword required" +msgstr "" + +#: Model/Motdepasse.php:validation for field password_confirm +msgid "Confirm password" +msgstr "" + +#: Model/Motdepasse.php:validation for field cree;validation for field modifie +msgid "date" +msgstr "" + diff --git a/app/Model/Client.php b/app/Model/Client.php new file mode 100644 index 000000000..e46533661 --- /dev/null +++ b/app/Model/Client.php @@ -0,0 +1,89 @@ + array( + 'foreignKey' => 'id_motdepasse' + ) + ); + public $displayField = 'email'; + public $validate = array( + 'id' => array( + 'required' => array( + 'rule' => 'alphaNumericDashUnderscore', + 'message' => 'Username required', + 'allowEmpty' => false + ), + 'unique' => array( + 'rule' => 'isUnique', + 'message' => 'Name already exists' + ) + ), + 'nom' => array( + 'required' => array( + 'rule' => 'alphaDash', + 'message' => 'Last name required', + 'allowEmpty' => false + ) + ), + 'prenom' => array( + 'required' => array( + 'rule' => 'alphaDash', + 'message' => 'First name required', + 'allowEmpty' => false + ) + ), + 'ville' => array( + 'required' => array( + 'rule' => 'alphaDash', + 'message' => 'City required', + 'allowEmpty' => false + ) + ), + 'codepostal' => array( + 'required' => array( + 'rule' => array('postal', '/^[0-9]+$/', 'eu'), + 'message' => 'City code required', + 'allowEmpty' => false + ) + ), + 'role' => array( + 'valid' => array( + 'rule' => array('inList', array('admin', 'visiteur')), + 'message' => 'Please choose a valid role', + 'allowEmpty' => false + ) + ), + 'telephone' => array( + 'valid' => array( + 'rule' => 'numeric', + 'message' => 'e.g. +999 8811 2022' + ) + ) + ); + public function alphaNumericDashUnderscore($check) { + $valeur = array_values($check); + return !preg_match('/^[0-9a-zA-Z_-\@\.]*$/', $valeur[0]); + } + public function alphaDash($check) { + $valeur = array_values($check); + return !preg_match('/^[a-zA-Z-\',\s]*$/', $valeur[0]); + } + + public function numeric($check) { + $valeur = array_values($check); + return !preg_match('/^[0-9\+\(\)\s]*$/', $valeur[0]); + } + + public function isOwnedBy($client, $motdepasse) { + return $this->field('id', array('id' => $client, 'id_motdepasse' => $motdepasse)) !== false; + } +} +?> diff --git a/app/Model/Datasource/Database/MysqlCms.php b/app/Model/Datasource/Database/MysqlCms.php index 1a5434a03..238c59e82 100644 --- a/app/Model/Datasource/Database/MysqlCms.php +++ b/app/Model/Datasource/Database/MysqlCms.php @@ -52,8 +52,8 @@ public function column($real) { * @throws MissingConnectionException */ public function connect() { - if (Configure::read('debug') > 1) { - var_dump($this->config); + if (Configure::read('debug') > 2) { + debug($this->config); } try { parent::connect(); diff --git a/app/Model/Message.php b/app/Model/Message.php new file mode 100644 index 000000000..b8518ac12 --- /dev/null +++ b/app/Model/Message.php @@ -0,0 +1,55 @@ + + */ +class Message extends AppModel { + public $validationDomain = 'formulaire'; + public $belongsTo = array( + 'Client' => array( + 'foreignKey' => 'id_client' + ) + ); + public $validate = array( + 'titre' => array( + 'rule2' => array( + 'rule' => 'notags', + 'message' => 'No HTML tags', + 'last' => true), + 'Requis' => array('rule' => 'notBlank') + ), + 'texte' => array( + 'rule3' => array( + 'rule' => 'notags', + 'message'=>'No HTML tags', + 'last' => true), + 'Requis' => array('rule' => 'notBlank') + ), + 'id_client' => array( + 'rule' => 'alphaNumericDashUnderscore', + 'message' => "Only alphabetic or numerical characters or dash or underscores." + ) + ); + + public function alphaNumericDashUnderscore($check) { + $valeur = array_values($check); + return !preg_match('/^[0-9a-zA-Z_-\@\.]*$/', $valeur[0]); + } + + public function notags($check) { + $texte = array_values($check); + return !preg_match('/<[^>]+>?(.*)/', $texte[0]); + } + + public function isOwnedBy($message, $client) { + return $this->field('id', array('id' => $message, 'id_client' => $client)) !== false; + } +} diff --git a/app/Model/Motdepasse.php b/app/Model/Motdepasse.php new file mode 100644 index 000000000..acdd8a474 --- /dev/null +++ b/app/Model/Motdepasse.php @@ -0,0 +1,76 @@ + array( + 'foreignKey' => 'id_motdepasse' + )); +/** + * Validation rules + * + * @var array + */ + public $validate = array( + 'password' => array( + 'required' => array( + 'rule' => 'alphaNumericDashUnderscore', + 'message' => 'Pasword required', + 'allowEmpty' => false + ) + ), + 'password_confirm' => array( + 'confirme' => array( + 'rule' => 'fieldIsConfirmed', + 'message' => 'Confirm password' + ) + ), + 'cree' => array( + 'date' => array( + 'rule' => array('date'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + 'modifie' => array( + 'date' => array( + 'rule' => array('date'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + ); + public function alphaNumericDashUnderscore($check) { + $valeur = array_values($check); + return !preg_match('/^[0-9a-zA-Z_-\@\.]*$/', $valeur[0]); + } + + public function fieldIsConfirmed($check) { + $valeur = array_values($check); + return $this->data[$this->alias]['password'] === $valeur[0]; + } + + public function beforeSave($options = array()) { + foreach (array_keys($this->data[$this->alias]) as $key) { + if (preg_match('/^password.*/', $key) && !empty($this->data[$this->alias][$key])) { + $passwordHasher = new BlowfishPasswordHasher(); + $this->data[$this->alias][$key] = $passwordHasher->hash( + $this->data[$this->alias][$key] + ); + } + } + return true; + } + +} diff --git a/app/Test/Case/Controller/ClientsControllerTest.php b/app/Test/Case/Controller/ClientsControllerTest.php new file mode 100644 index 000000000..7b5ae6c11 --- /dev/null +++ b/app/Test/Case/Controller/ClientsControllerTest.php @@ -0,0 +1,19 @@ +MotDePasse = ClassRegistry::init('MotDePasse'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->MotDePasse); + + parent::tearDown(); + } + +} diff --git a/app/Test/Fixture/ClientFixture.php b/app/Test/Fixture/ClientFixture.php new file mode 100644 index 000000000..ec0848f91 --- /dev/null +++ b/app/Test/Fixture/ClientFixture.php @@ -0,0 +1,57 @@ + array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'email' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'id_motdepasse' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'nom' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'prenom' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'annee_de_naissance' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'adresse' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 30, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'codepostal' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), + 'ville' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'pays' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'telephone' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 20, 'unsigned' => false), + 'role' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 20, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'cree' => array('type' => 'date', 'null' => false, 'default' => null), + 'modifie' => array('type' => 'date', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => 'Lorem ipsum dolor sit amet', + 'email' => 'Lorem ipsum dolor sit amet', + 'id_motdepasse' => 'Lorem ipsum dolor sit amet', + 'nom' => 'Lorem ipsum dolor sit amet', + 'prenom' => 'Lorem ipsum dolor sit amet', + 'annee_de_naissance' => 'Lorem ipsum dolor sit amet', + 'adresse' => 'Lorem ipsum dolor sit amet', + 'codepostal' => 1, + 'ville' => 'Lorem ipsum dolor ', + 'pays' => 'Lorem ipsum dolor ', + 'telephone' => 1, + 'role' => 'Lorem ipsum dolor ', + 'cree' => '2018-12-30', + 'modifie' => '2018-12-30' + ), + ); + +} diff --git a/app/Test/Fixture/MotdepasseFixture.php b/app/Test/Fixture/MotdepasseFixture.php new file mode 100644 index 000000000..223826d3c --- /dev/null +++ b/app/Test/Fixture/MotdepasseFixture.php @@ -0,0 +1,39 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'password' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'password_confirm' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'cree' => array('type' => 'date', 'null' => false, 'default' => null), + 'modifie' => array('type' => 'date', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id_mdp', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => 1, + 'password' => 'Lorem ipsum dolor sit amet', + 'password_confirm' => 'Lorem ipsum dolor sit amet', + 'cree' => '2018-12-29', + 'modifie' => '2018-12-29' + ), + ); + +} diff --git a/app/View/Article/index.ctp b/app/View/Article/index.ctp index 6a81f0442..c3f44ca9e 100644 --- a/app/View/Article/index.ctp +++ b/app/View/Article/index.ctp @@ -8,7 +8,7 @@ $t->setContenu_Ligne(0, array(__d('article', "categorie"), __d('article', "artic for ($i = 1; $i < count($articles) + 1; $i++) { $article = $articles[$i - 1]; - $t->setContenu_Cellule($i, 0, $article['Article']['fk_reference_categorie']); + $t->setContenu_Cellule($i, 0, $article['Article']['id__categorie']); $t->setContenu_Cellule($i, 1, $this->Html->link($article['Article']['id'], array('controller' => 'article', 'action' => 'view', array($article['Article']['id']))) diff --git a/app/View/Client/add.ctp b/app/View/Client/add.ctp new file mode 100644 index 000000000..ca106a4e7 --- /dev/null +++ b/app/View/Client/add.ctp @@ -0,0 +1,33 @@ +
+Form->create('Client'); ?> +
+ + Form->input('id', array('label' => __('My username'))); + echo $this->Form->input('email', array('label' => __('My email address'))); + echo $this->Form->hidden('id_motdepasse'); + echo $this->Form->input('prenom', array('label' => __('My first name'))); + echo $this->Form->input('nom', array('label' => __('My name'))); + echo $this->Form->input('annee_de_naissance', array('label' => __('My birthday'))); + echo $this->Form->input('adresse', array('label' => __('My street address'))); + echo $this->Form->input('codepostal', array('label' => __('My city code'))); + echo $this->Form->input('ville', array('label' => __('My city'))); + echo $this->Form->input('pays', array('label' => __('My country'))); + echo $this->Form->input('telephone', array('label' => 'My phone number')); + echo $this->Form->input('role', array( + 'label' => 'Choose a role', + 'options' => array('admin' => 'Member', 'visiteur' => 'Free') + ) + ); + echo $this->Form->input('cree', array('label' => 'Profile creation date')); + echo $this->Form->input('modifie', array('label' => 'Profile modification date')); + ?> +
+Form->end(__('Continue')); ?> +
+
+

+
    +
  • Html->link(__('My subscription'), array('action' => 'index')); ?>
  • +
+
diff --git a/app/View/Client/admin_index.ctp b/app/View/Client/admin_index.ctp new file mode 100644 index 000000000..d99fe7f6c --- /dev/null +++ b/app/View/Client/admin_index.ctp @@ -0,0 +1,74 @@ +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Paginator->sort('id'); ?>Paginator->sort('email'); ?>Paginator->sort('id_motdepasse'); ?>Paginator->sort('nom'); ?>Paginator->sort('prenom'); ?>Paginator->sort('annee_de_naissance'); ?>Paginator->sort('adresse'); ?>Paginator->sort('codepostal'); ?>Paginator->sort('ville'); ?>Paginator->sort('pays'); ?>Paginator->sort('telephone'); ?>Paginator->sort('role'); ?>Paginator->sort('cree'); ?>Paginator->sort('modifie'); ?>
   + Html->link(strlen($client['MotDePasse']['password']), array( + 'controller' => 'Motdepasse', 'action' => 'view', $client['MotDePasse']['id'] + )); ?> +             + Html->link(__('View'), array('action' => 'view', $client['Client']['id'])); ?> + Html->link(__('Modify'), array('action' => 'edit', $client['Client']['id'])); ?> + Form->postLink(__('Unsubscribe'), array( + 'action' => 'delete', $client['Client']['id']), array( + 'confirm' => __('Are you sure to unsubscribe # %s?', $client['Client']['id']))); ?> +
+

+ Paginator->counter(array( + 'format' => __('Page {:page} of {:pages}, display from {:current} records out of {:count}, starting from record {:start}, until {:end}') + )); + ?>

+
+ Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled')); + echo $this->Paginator->numbers(array('separator' => '')); + echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled')); + ?> +
+
+
+

+
    +
  • Html->link(__('Subscribe'), array('action' => 'add')); ?>
  • +
+
diff --git a/app/View/Client/edit.ctp b/app/View/Client/edit.ctp new file mode 100644 index 000000000..39f081af5 --- /dev/null +++ b/app/View/Client/edit.ctp @@ -0,0 +1,35 @@ +
+Form->create('Client'); ?> +
+ + Form->input('id', array('label' => __('My username'))); + echo $this->Form->input('email', array('label' => __('My email address'))); + echo $this->Form->hidden('id_motdepasse'); + echo $this->Form->input('prenom', array('label' => __('My first name'))); + echo $this->Form->input('nom', array('label' => __('My name'))); + echo $this->Form->input('annee_de_naissance', array('label' => __('My birthday'))); + echo $this->Form->input('adresse', array('label' => __('My street address'))); + echo $this->Form->input('codepostal', array('label' => __('My city code'))); + echo $this->Form->input('ville', array('label' => __('My city'))); + echo $this->Form->input('pays', array('label' => __('My country'))); + echo $this->Form->input('telephone', array('label' => 'My phone number')); + echo $this->Form->input('role', array( + 'label' => 'Choose a role', + 'options' => array('admin' => 'Member', 'visiteur' => 'Free') + ) + ); + echo $this->Form->input('cree', array('label' => 'Profile creation date')); + echo $this->Form->input('modifie', array('label' => 'Profile modification date')); + ?> +
+Form->end(__('Continue')); ?> +
+
+

+
    +
  • Html->link(__('Change my password'), array('controller' = > 'Motdepasse', 'action' => 'edit', $client['Motdepasse']['id'])); ?>
  • +
  • Form->postLink(__('Unsubscribe'), array('action' => 'delete', $this->Form->value('Client.id')), array('confirm' => __('Are you sure you want to remove # %s?', $this->Form->value('Client.id')))); ?>
  • +
  • Html->link(__('Member list'), array('action' => 'index')); ?>
  • +
+
diff --git a/app/View/Client/index.ctp b/app/View/Client/index.ctp new file mode 100644 index 000000000..27a3e0b31 --- /dev/null +++ b/app/View/Client/index.ctp @@ -0,0 +1,10 @@ +
+

+
+
+

+
    +
  • Html->link(__('Connect'), array('action' => 'login')); ?>
  • +
  • Html->link(__('New subscription'), array('action' => 'add')); ?>
  • +
+
diff --git a/app/View/Client/login.ctp b/app/View/Client/login.ctp new file mode 100644 index 000000000..99369551e --- /dev/null +++ b/app/View/Client/login.ctp @@ -0,0 +1,20 @@ +
+Flash->render('auth'); ?> +Form->create('Client'); ?> +
+ + + + Form->input('id'); + echo $this->Form->input('motdepasse', array('type' => 'password')); + ?> +
+ Form->end(__('Sign in')); ?> +
+

+
  • Html->link(__('New subscription'), array('action' => 'add')); ?>
  • +
  • Form->postLink(__('Forgot my password ?'), array( + 'action' => 'recovery' + )); ?>
  • +
+ diff --git a/app/View/Client/view.ctp b/app/View/Client/view.ctp new file mode 100644 index 000000000..3dc6a6ad2 --- /dev/null +++ b/app/View/Client/view.ctp @@ -0,0 +1,83 @@ +
+

+
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+
+

+
    +
  • Html->link(__('Modify subscription'), array('action' => 'edit', $client['Client']['id'])); ?>
  • +
  • Form->postLink(__('Remove subscription'), array( + 'action' => 'delete', $client['Client']['id']), + array( + 'confirm' => __('Are you sure to unsubscribe # %s?', $client['Client']['id']) + ) + ); ?>
  • +
  • Html->link(__('Change my password'), array('controller' => 'motdepasse', 'action' => 'index')); ?>
  • +
+
diff --git a/app/View/Emails/html/recovery.ctp b/app/View/Emails/html/recovery.ctp new file mode 100644 index 000000000..0bc7a5425 --- /dev/null +++ b/app/View/Emails/html/recovery.ctp @@ -0,0 +1,12 @@ +

,
+

+

+
+

+
    +
  • Html->link(__('Réinitialiser le mot de passe'), array( + 'controller' => 'MotDePasse', 'action' => 'delete', $client['MotDePasse']['id']) + );?>
  • +
+
+

diff --git a/app/View/Emails/send.ctp b/app/View/Emails/send.ctp index b02dd337d..6375ff5f4 100644 --- a/app/View/Emails/send.ctp +++ b/app/View/Emails/send.ctp @@ -4,7 +4,7 @@
request->data)) { - $this->Html->link('Continue...', array("Controller" => 'E13', 'action' => 'index')); + $this->Html->link('Continue...', array("Controller" => 'e14', 'action' => 'index')); echo $this->Form->create('Email', array('type' => 'post', 'url' => '/emails/send')); } else { echo $this->Form->input('email', array('class' => 'email_form', 'label' => 'To: ', 'value' => $email)); @@ -16,4 +16,3 @@
- diff --git a/app/View/Emails/text/recovery.ctp b/app/View/Emails/text/recovery.ctp new file mode 100644 index 000000000..02af5b705 --- /dev/null +++ b/app/View/Emails/text/recovery.ctp @@ -0,0 +1,9 @@ +, +

+ +- - - - - - - - - - - - - - - - - - - - - - - + + * Html->link(__('Réinitialiser le mot de passe'), array( + 'controller' => 'MotDePasse', 'action' => 'delete', $client['MotDePasse']['id']) + );?> + diff --git a/app/View/Errors/pdo_error.ctp b/app/View/Errors/pdo_error.ctp new file mode 100644 index 000000000..913e9aff9 --- /dev/null +++ b/app/View/Errors/pdo_error.ctp @@ -0,0 +1,37 @@ + +

+

+ : + +

+queryString)) : ?> +

+ : + queryString); ?> +

+ +params)) : ?> + : + params); ?> + +

: Schema/myschema.php +:

./configure.sh -d -u -p<sql-root-password>
+

+element('exception_stack_trace'); +?> diff --git a/app/View/Message/add.ctp b/app/View/Message/add.ctp index 3017dc18d..84ffba8b5 100644 --- a/app/View/Message/add.ctp +++ b/app/View/Message/add.ctp @@ -1,14 +1,14 @@ Form->create('Message'); - echo $this->Form->input('titre', array('label' => $r->lang('titre', 'contactus'), + echo $this->Form->create('Message'); + echo $this->Form->input('titre', array('label' => __('Sujet de votre message'), 'required' => true)); - echo $this->Form->input('texte', array('label' => $r->lang('texte', 'contactus'), + echo $this->Form->input('texte', array( + 'label' => __('Contenu du message'), 'required' => true)); - echo $this->Form->input('fk_identifiant', array('label' => $r->lang('identifiant', 'contactus'), + echo $this->Form->input('id', array('label' => __('Auteur'), 'required' => true)); - echo $this->Form->input('date', array('label' => $r->lang('date', 'contactus'), + echo $this->Form->input('date', array('label' => __('Date'), 'required' => true)); - echo $this->Form->end($r->lang('write', 'contactus')); -?> \ No newline at end of file + echo $this->Form->end(__('Poster un ticket')); +?> diff --git a/app/View/Message/edit.ctp b/app/View/Message/edit.ctp new file mode 100644 index 000000000..c63505d67 --- /dev/null +++ b/app/View/Message/edit.ctp @@ -0,0 +1,15 @@ +Form->create('Message'); +echo $this->Form->input('titre', array('label' => __('Sujet de votre message'), + 'required' => true)); +echo $this->Form->input('texte', array( + 'label' => __('Contenu du message'), + 'required' => true)); +echo $this->Form->input('id', array('label' => __('Pseudonyme'), + 'required' => true)); +echo $this->Form->input('date', array('label' => __('Date'), + 'required' => true)); +echo $this->Form->input('id', array('hidden' => true)); +echo $this->Form->end(__('Sauvegarder')); +?> diff --git a/app/View/Message/index.ctp b/app/View/Message/index.ctp index c39bae0f2..1c809ed88 100644 --- a/app/View/Message/index.ctp +++ b/app/View/Message/index.ctp @@ -1,20 +1,30 @@ lang("contactus")); -$t->setContenu_Ligne(0, $r->lang(array("date", "titre", "identifiant"), "contactus")); +require APP . $r->r['include__php_tbl.class.inc']; +echo $this->Html->link( + __('Poster un message'), + array('controller' => 'message', 'action' => 'add') +); +$t = new Tableau(count($messages) + 1, 5, __('Tableau de bord')); +$t->setContenu_Ligne(0, array(__('date'), __('titre'), __('id'))); /* On fait un tour des $messages array */ for ($i = 1; $i < count($messages) + 1; $i++) { $message = $messages[$i - 1]; - $t->setContenu_Cellule($i, 0, $message['Message']['fk_identifiant']); - $t->setContenu_Cellule($i, 1, $this->Html->link($message['Message']['id'], array('controller' => 'message', - 'action' => 'view', - array($message['Message']['id']))) + $t->setContenu_Cellule($i, 0, $message['Message']['date']); + $t->setContenu_Cellule($i, 1, $this->Html->link($message['Message']['titre'], array( + 'action' => 'view', $message['Message']['id'])) + ); + $t->setContenu_Cellule($i, 2, $this->Text->autoLinkEmails($message['Message']['id'])); + $t->setContenu_Cellule($i, 3, $this->Html->link(__('Modifier un message'), array( + 'action' => 'edit', $message['Message']['id'])) + ); + $t->setContenu_Cellule($i, 4, $this->Form->postLink( + __('Supprimer'), + array('action' => 'delete', $message['Message']['id']), + array('confirm' => 'Êtes-vous sûr ?')) ); - $t->setContenu_Cellule($i, 2, $message['Message']['published']); } -echo $t->fin(); +echo $t->fin(4); ?> diff --git a/app/View/Message/view.ctp b/app/View/Message/view.ctp index 9c6d35451..cf939920f 100644 --- a/app/View/Message/view.ctp +++ b/app/View/Message/view.ctp @@ -1,12 +1,12 @@ lang("view", "contactus")); - $t->setContenu_Colonne(0, $r->lang(array("date", "titre", "texte"), "contactus")); + require APP . $r->r['include__php_tbl.class.inc']; + $t = new Tableau(3, 2, __('Ticket view')); + $t->setContenu_Colonne(0, array(__('date'), __('titre'), + $this->Text->autoLinkEmails($message['id']) + )); $t->setContenu_Cellule(0, 1, $message['Message']['date']); $t->setContenu_Cellule(1, 1, $message['Message']['titre']); - $t->setContenu_Cellule(2, 2, $message['Message']['texte']); - $t->fin(1); - + $t->setContenu_Cellule(2, 1, $this->Markdown->transform($this->Text->autoLink($message['Message']['texte']))); + echo $t->fin(4); ?> diff --git a/app/View/MotDePasse/add.ctp b/app/View/MotDePasse/add.ctp new file mode 100644 index 000000000..ec5d1e03b --- /dev/null +++ b/app/View/MotDePasse/add.ctp @@ -0,0 +1,23 @@ +
+Form->create('MotDePasse'); ?> +
+ + Form->input('id'); + echo $this->Form->input('password', array('label' => 'Entrez un mot de passe')); + echo $this->Form->input('password_confirm', array( + 'type' => 'password', + 'label' => 'Confirmez le mot de passe') + ); + echo $this->Form->input('cree'); + echo $this->Form->input('modifie'); + ?> +
+Form->end(__('Soumettre')); ?> +
+
+

+
    +
  • Html->link(__('Mon profil'), array('controller' => 'Client', 'action' => 'index')); ?>
  • +
+
diff --git a/app/View/MotDePasse/edit.ctp b/app/View/MotDePasse/edit.ctp new file mode 100644 index 000000000..c83dedc88 --- /dev/null +++ b/app/View/MotDePasse/edit.ctp @@ -0,0 +1,30 @@ +
+Form->create('MotDePasse'); ?> +
+ + Form->input('id'); + echo $this->Form->input('password', array('label' => 'Entrez un mot de passe')); + echo $this->Form->input('password_confirm', array( + 'type' => 'password', + 'label' => 'Confirmez le mot de passe') + ); + echo $this->Form->input('cree'); + echo $this->Form->input('modifie'); + ?> +
+Form->end(__('Soumettre')); ?> +
+
+

+
    + +
  • Form->postLink(__('Réinitialiser mon mot de passe'), array( + 'action' => 'delete', + $this->Form->value('MotDePasse.id') + ), array( + 'confirm' => __('Êtes-vous certain de réinitialiser votre mot de passe ?') + )); ?>
  • +
  • Html->link(__('Mon profil'), array('controller' => 'Client', 'action' => 'index')); ?>
  • +
+
diff --git a/app/View/MotDePasse/index.ctp b/app/View/MotDePasse/index.ctp new file mode 100644 index 000000000..f4b08dba6 --- /dev/null +++ b/app/View/MotDePasse/index.ctp @@ -0,0 +1,18 @@ +
+

+
+

+
    +
  • Html->link(__('Modifier mon mot de passe'), array('action' => 'edit', $motdepasse['Motdepasse']['id'])); ?>
  • +
  • Form->postLink(__('Réinitialiser mon mot de passe'), array( + 'action' => 'delete', + $this->Form->value('Motdepasse.id') + ), array( + 'confirm' => __('Êtes-vous certain de réinitialiser votre mot de passe ?') + )); ?>
  • +
  • Html->link(__('Modifier le profil'), + array( + 'action' => 'edit', AuthComponent::user('id') + )); ?>
  • +
+
diff --git a/app/View/MotDePasse/view.ctp b/app/View/MotDePasse/view.ctp new file mode 100644 index 000000000..fbffb20eb --- /dev/null +++ b/app/View/MotDePasse/view.ctp @@ -0,0 +1,42 @@ +
+

+
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+ +   +
+
+
+
+

+
    +
  • Html->link(__('Modifier mon mot de passe'), array('action' => 'edit', $motdepasse['Motdepasse']['id'])); ?>
  • +
  • Form->postLink(__('Réinitialiser mon mot de passe'), array( + 'action' => 'delete', + $this->Form->value('Motdepasse.id') + ), array( + 'confirm' => __('Êtes-vous certain de réinitialiser votre mot de passe ?') + )); ?>
  • +
+
diff --git a/app/webroot/php-cms b/app/webroot/php-cms index 7aa64600f..33a7ba3e4 160000 --- a/app/webroot/php-cms +++ b/app/webroot/php-cms @@ -1 +1 @@ -Subproject commit 7aa64600f1c3dac02527bce4510d50b79a83dfc2 +Subproject commit 33a7ba3e40cf48d7b12649267bcb19224654a509 diff --git a/composer.json b/composer.json index 73d0f85a2..d643fcedd 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "betothreeprod/acake2php", + "name": "b23prodtm/myphpcms", "description": "CMS featuring CakePHP Framework", "homepage": "https://www.sourceforge.net/projects/pohse", "license": "MIT", @@ -21,24 +21,24 @@ "cakephp/debug_kit": "2.2.9", "betothreeprod/markdown-plugin": "dev-master", "betothreeprod/updateshell": "dev-development", - "cakephp/datasources": "2.3.x-dev" + "cakephp/datasources": "2.3.x-dev", + "facebook/graph-sdk": "^5.7", + "google/apiclient": "^2.2" }, "suggest": { "ext-openssl": "You need to install ext-openssl or ext-mcrypt to use AES-256 encryption", "ext-mcrypt": "You need to install ext-openssl or ext-mcrypt to use AES-256 encryption" }, "require-dev": { - "phpunit/phpunit": "^5 || ^8", - "phpunit/phpcov": "^3", - "cakephp/cakephp-codesniffer": "^3 || ^4", - "php-coveralls/php-coveralls": "^2.2" + "phpunit/phpunit": "^3 || ^4", + "php-coveralls/php-coveralls": "^1 || ^2.1", + "phpunit/phpcov": "^1 || ^2.0", + "cakephp/cakephp-codesniffer": "^1 || ^3" }, "extra": { "installer-paths": { - "app/Plugin/Markdown": ["betothreeprod/markdown-plugin"], - "app/Plugin/DebugKit": ["cakephp/debug_kit"], - "app/Plugin/UpdateShell": ["betothreeprod/updateshell"], - "app/Plugin/Datasources": ["cakephp/datasources"] + "app/Plugin/Markdown": ["b23prodtm/markdown-plugin"], + "app/Plugin/DebugKit": ["cakephp/debug_kit"] } }, "config": { @@ -46,14 +46,14 @@ "process-timeout": 0 }, "bin": [ - "app/Console/cake" + "lib/Cake/Console/cake" ], "scripts": { "check": [ "@cs-check", "@test" ], - "cs-check": "PHP_CS=1 ./test-cake.sh", - "test": "./test-cake.sh" + "cs-check": "./app/Vendor/bin/phpcs -p --extensions=php --standard=CakePHP ./lib/Cake", + "test": "./lib/Cake/Console/cake test core AllTests --stderr" } } diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 682c742f1..498785f0b 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -132,6 +132,7 @@ class Mysql extends DboSource { 'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'), 'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'), 'binary' => array('name' => 'blob'), + 'mediumbinary' => array('name' => 'mediumblob'), 'boolean' => array('name' => 'tinyint', 'limit' => '1') ); @@ -811,6 +812,9 @@ public function column($real) { if (strpos($col, 'blob') !== false || $col === 'binary') { return 'binary'; } + if (strpos($col, 'mediumblob') !== false || $col === 'mediumbinary') { + return 'mediumbinary'; + } if (strpos($col, 'float') !== false || strpos($col, 'double') !== false) { return 'float'; } diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index f81bee5b3..6568ad4e5 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -69,6 +69,7 @@ class Postgres extends DboSource { 'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'), 'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'), 'binary' => array('name' => 'bytea'), + 'mediumbinary' => array('name' => 'bytea'), 'boolean' => array('name' => 'boolean'), 'number' => array('name' => 'numeric'), 'inet' => array('name' => 'inet'), diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index 487868be4..c8277d8a2 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -81,6 +81,7 @@ class Sqlite extends DboSource { 'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'), 'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'), 'binary' => array('name' => 'blob'), + 'mediumbinary' => array('name' => 'mediumblob'), 'boolean' => array('name' => 'boolean') ); @@ -289,6 +290,9 @@ public function column($real) { if (in_array($col, array('blob', 'clob'))) { return 'binary'; } + if (in_array($col, array('mebiumblob', 'mediumclob'))) { + return 'mediumbinary'; + } if (strpos($col, 'numeric') !== false || strpos($col, 'decimal') !== false) { return 'decimal'; }