-- http://www.phpmyadmin.net\r
--\r
-- Serveur: localhost\r
--- Généré le : Mer 13 Février 2013 à 23:03\r
--- Version du serveur: 5.1.67\r
--- Version de PHP: 5.3.2-1ubuntu4.18\r
+-- Généré le : Dim 26 Mai 2013 à 15:46\r
+-- Version du serveur: 5.1.69\r
+-- Version de PHP: 5.3.2-1ubuntu4.19\r
\r
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";\r
\r
-- --------------------------------------------------------\r
\r
--\r
--- Structure de la table `mw_action_status`\r
+-- Structure de la table `mw_actions_roles`\r
--\r
\r
-CREATE TABLE IF NOT EXISTS `mw_actions_roles` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `action` varchar(255) NOT NULL,
- `id_role` int(11) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
-
---
--- Contenu de la table `mw_actions_roles`
---
-
-INSERT INTO `mw_actions_roles` (`id`, `action`, `id_role`) VALUES
-(13, 'admin', 1),
-(14, 'users', 2),
-(15, 'users/identification', 0);
+CREATE TABLE IF NOT EXISTS `mw_actions_roles` (\r
+ `id` int(11) NOT NULL AUTO_INCREMENT,\r
+ `action` varchar(255) NOT NULL,\r
+ `id_role` int(11) NOT NULL,\r
+ PRIMARY KEY (`id`),\r
+ KEY `id_role` (`id_role`)\r
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=21 ;\r
+\r
+--\r
+-- Contenu de la table `mw_actions_roles`\r
+--\r
+\r
+INSERT INTO `mw_actions_roles` (`id`, `action`, `id_role`) VALUES\r
+(13, 'admin', 1),\r
+(14, 'users', 2),\r
+(19, 'users/identification', 0),\r
+(20, 'config', 3);\r
\r
-- --------------------------------------------------------\r
\r
`key` varchar(255) NOT NULL,\r
`value` text NOT NULL,\r
PRIMARY KEY (`id`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=30 ;\r
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=38 ;\r
\r
--\r
-- Contenu de la table `mw_config`\r
(6, 'contact_form', '0'),\r
(8, 'email', ''),\r
(9, 'captcha', '0'),\r
-(29, 'default_allow', '1'),\r
-(22, 'out_colonne', 'on'),\r
(16, 'start_action_params', ''),\r
-(20, 'out_navig_menu_top', 'on');\r
+(20, 'out_navig_menu_top', 'on'),\r
+(22, 'out_colonne', 'on'),\r
+(29, 'default_allow', '1'),\r
+(30, 'cache_actif', '0'),\r
+(31, 'cache_maj_auto', '0'),\r
+(32, 'cache_time', '72');\r
\r
-- --------------------------------------------------------\r
\r
`id` int(11) NOT NULL AUTO_INCREMENT,\r
`nom` varchar(255) NOT NULL,\r
`intitule` varchar(255) NOT NULL,\r
- PRIMARY KEY (`id`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;\r
+ KEY `id` (`id`)\r
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;\r
\r
--\r
-- Contenu de la table `mw_roles`\r
--\r
\r
INSERT INTO `mw_roles` (`id`, `nom`, `intitule`) VALUES\r
+(0, 'guest', 'invité'),\r
(1, 'admin', 'administrateur'),\r
-(2, 'membre', 'membre');\r
+(2, 'membre', 'membre'),\r
+(3, 'webmaster', 'webmaster');\r
\r
-- --------------------------------------------------------\r
\r
`password` varchar(255) NOT NULL,\r
`email` varchar(255) NOT NULL,\r
PRIMARY KEY (`id`)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ;\r
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ;\r
\r
--\r
-- Contenu de la table `mw_users`\r
--\r
\r
INSERT INTO `mw_users` (`id`, `login`, `password`, `email`) VALUES\r
-(17, 'admin', '25e4ee4e9229397b6b17776bfceaf8e7', 'admin@domain.tld');\r
+(19, 'admin', '25e4ee4e9229397b6b17776bfceaf8e7', 'admin@domain.tld');\r
\r
-- --------------------------------------------------------\r
\r
CREATE TABLE IF NOT EXISTS `mw_users_roles` (\r
`id_user` int(11) NOT NULL,\r
`id_role` int(11) NOT NULL,\r
- PRIMARY KEY (`id_user`,`id_role`)\r
+ PRIMARY KEY (`id_user`,`id_role`),\r
+ KEY `id_role` (`id_role`)\r
) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r
\r
--\r
--\r
\r
INSERT INTO `mw_users_roles` (`id_user`, `id_role`) VALUES\r
-(17, 1),\r
-(17, 2);\r
+(19, 1),\r
+(19, 2),\r
+(19, 3);\r
+\r
+--\r
+-- Contraintes pour les tables exportées\r
+--
+-- DECOMMENTER POUR AJOUTER LES CONTRAINTES\r
+\r
+--\r
+-- Contraintes pour la table `mw_actions_roles`\r
+--\r
+-- ALTER TABLE `mw_actions_roles`\r
+-- ADD CONSTRAINT `mw_actions_roles_ibfk_1` FOREIGN KEY (`id_role`) REFERENCES `mw_roles` (`id`);\r
+\r
+--\r
+-- Contraintes pour la table `mw_users_roles`\r
+--\r
+-- ALTER TABLE `mw_users_roles`\r
+-- ADD CONSTRAINT `mw_users_roles_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `mw_users` (`id`),\r
+-- ADD CONSTRAINT `mw_users_roles_ibfk_2` FOREIGN KEY (`id_role`) REFERENCES `mw_roles` (`id`);\r
-188
\ No newline at end of file
+189
\ No newline at end of file
--- /dev/null
+<tuple>
+ <action><![CDATA[config]]></action>
+ <id_role><![CDATA[3]]></id_role>
+</tuple>
--- /dev/null
+<tuple>
+ <nom><![CDATA[guest]]></nom>
+ <intitule><![CDATA[invité]]></intitule>
+</tuple>
--- /dev/null
+<tuple>
+ <nom><![CDATA[webmaster]]></nom>
+ <intitule><![CDATA[webmaster]]></intitule>
+</tuple>
-32
\ No newline at end of file
+33
\ No newline at end of file
--- /dev/null
+<tuple>
+ <id_user><![CDATA[18]]></id_user>
+ <id_role><![CDATA[3]]></id_role>
+</tuple>
<action name="index" />
</al>
</controleur>
+ <controleur name="templates" title="Templates">
+ <al title="Gestion des templates">
+ <action name="index" />
+ <action name="options" />
+ </al>
+ </controleur>
+ <controleur name="roles" title="Roles">
+ <al title="Gestion des roles">
+ <action name="index" />
+ <action name="set_default_allow" />
+ <action name="add_role" />
+ <action name="edit_role" />
+ <action name="save_role" />
+ <action name="del_role" />
+ </al>
+ </controleur>
<controleur name="plugins" title="Plugins">
- <al title="Gerer les plugins">
+ <al title="Gestion les plugins">
<action name="index" />
<action name="install" />
<action name="uninstall" />
--- /dev/null
+<?php
+
+ class mw_data_users_files extends mw_data{
+
+ function check_user_uploads_dir($id_user = null){
+ $env = $this->env();
+ if(!isset($id_user)){
+ $user = $env->user();
+ if(isset($user["id"])) $id_user = $user["id"];
+ }
+ if(!isset($id_user) || !$id_user) return false;
+ if(!preg_match("/^[0-9]+$/", $id_user)) return false;
+ $user_dir = $env->path("content")."uploads/".$id_user;
+ if(!file_exists($user_dir)) @mkdir($user_dir);
+ return file_exists($user_dir);
+ }
+
+ }
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+ class mw_data_users_sessions extends mw_data{
+
+ var $user;
+
+ function login($login, $password){
+ if(($user = $this->user($login)) !== false){
+ if($this->password_ok($user, $password)){
+ if(!$this->set_session($user)) $user = false;
+ }
+ else{
+ $this->clear_session();
+ $user = array();
+ }
+ }
+ return $user;
+ }
+
+ function logout(){
+ return $this->clear_session();
+ }
+
+ function user_ok($user){
+ return
+ strcmp(md5($user["password"].$_SESSION["id"]), $_SESSION["pass"]) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ function password_ok($user, $password){
+ if(!$user) return false;
+ return
+ strcmp(md5($user["password"].$_SESSION["id"]), $password) == 0
+ && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
+ }
+
+ # ----------------------------------------------------------------------------------------
+ # session
+ #
+
+ function load_session(){
+ @session_start();
+ if(!isset($_SESSION["id"])) $this->clear_session();
+ $user = array();
+ if(isset($_SESSION["user"])){
+ $user = $this->user($_SESSION["user"]);
+ }
+ elseif(isset($_COOKIE["user"]) && isset($_COOKIE["pass"])){
+ if($user = $this->user($_COOKIE["user"])){
+ $user["password"] = $_COOKIE["pass"];
+ $this->set_session($user);
+ }
+ }
+ if($user){
+ if(!$this->user_ok($user)){
+ $this->clear_session();
+ $user = array();
+ }
+ }
+ else $user = array();
+ $this->user = $user;
+ return $user;
+ }
+
+ function set_session($user){
+ $_SESSION["user"] = $user["login"];
+ $_SESSION["pass"] = md5($user["password"].$_SESSION["id"]);
+ $env = $this->env();
+ return
+ setcookie("user", $user["login"], time() + (60 * 60 * 24 * 7), $env->path("web"))
+ && setcookie("pass", $user["password"], time() + (60 * 60 * 24 * 7), $env->path("web"));
+ }
+
+ function clear_session(){
+ unset($_SESSION["user"]);
+ unset($_SESSION["pass"]);
+ $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
+ $_SESSION["id"] = md5(rand());
+ $env = $this->env();
+ return
+ setcookie("user", "", 0, $env->path("web"))
+ && setcookie("pass", "", 0, $env->path("web"));
+ }
+
+ function get_session_user(){
+ return $this->user;
+ }
+
+ }
+
+?>
\ No newline at end of file
return array();
}
- # ----------------------------------------------------------------------------------------
- # log in / out
- #
-
- function login($login, $password){
- if(($user = $this->user($login)) !== false){
- if($this->password_ok($user, $password)){
- if(!$this->set_session($user)) $user = false;
- }
- else{
- $this->clear_session();
- $user = array();
- }
- }
- return $user;
- }
-
- function logout(){
- return $this->clear_session();
- }
-
- function user_ok($user){
- return
- strcmp(md5($user["password"].$_SESSION["id"]), $_SESSION["pass"]) == 0
- && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
- }
-
- function password_ok($user, $password){
- if(!$user) return false;
- return
- strcmp(md5($user["password"].$_SESSION["id"]), $password) == 0
- && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
- }
-
- # ----------------------------------------------------------------------------------------
- # session
- #
-
- function load_session(){
- @session_start();
- if(!isset($_SESSION["id"])) $this->clear_session();
- $user = array();
- if(isset($_SESSION["user"])){
- $user = $this->user($_SESSION["user"]);
- }
- elseif(isset($_COOKIE["user"]) && isset($_COOKIE["pass"])){
- if($user = $this->user($_COOKIE["user"])){
- $user["password"] = $_COOKIE["pass"];
- $this->set_session($user);
- }
- }
- if($user){
- if(!$this->user_ok($user)){
- $this->clear_session();
- $user = array();
- }
- }
- else $user = array();
- $this->user = $user;
- return $user;
- }
-
- function set_session($user){
- $_SESSION["user"] = $user["login"];
- $_SESSION["pass"] = md5($user["password"].$_SESSION["id"]);
- $env = $this->env();
- return
- setcookie("user", $user["login"], time() + (60 * 60 * 24 * 7), $env->path("web"))
- && setcookie("pass", $user["password"], time() + (60 * 60 * 24 * 7), $env->path("web"));
- }
-
- function clear_session(){
- unset($_SESSION["user"]);
- unset($_SESSION["pass"]);
- $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
- $_SESSION["id"] = md5(rand());
- $env = $this->env();
- return
- setcookie("user", "", 0, $env->path("web"))
- && setcookie("pass", "", 0, $env->path("web"));
- }
-
- function get_session_user(){
- return $this->user;
- }
-
- # ----------------------------------------------------------------------------------------
- # uploads
- #
-
- function check_user_uploads_dir($user = null){
- $env = $this->env();
- if((!isset($user) || !$user) && !isset($this->user["id"])) return false;
- $user_dir = $env->path("content")."uploads/".(isset($user) && $user ? $user : $this->user["id"]);
- if(!file_exists($user_dir)) @mkdir($user_dir);
- return file_exists($user_dir);
- }
-
}
?>
\ No newline at end of file
return array();
}
- # ----------------------------------------------------------------------------------------
- # log in / out
- #
-
- function login($login, $password){
- if(($user = $this->user($login)) !== false){
- if($this->password_ok($user, $password)){
- if(!$this->set_session($user)) $user = false;
- }
- else{
- $this->clear_session();
- $user = array();
- }
- }
- return $user;
- }
-
- function logout(){
- return $this->clear_session();
- }
-
- function user_ok($user){
- return
- strcmp(md5($user["password"].$_SESSION["id"]), $_SESSION["pass"]) == 0
- && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
- }
-
- function password_ok($user, $password){
- if(!$user) return false;
- return
- strcmp(md5($user["password"].$_SESSION["id"]), $password) == 0
- && $_SESSION["ip"] == $_SERVER["REMOTE_ADDR"];
- }
-
- # ----------------------------------------------------------------------------------------
- # session
- #
-
- function load_session(){
- session_start();
- if(!isset($_SESSION["id"])) $this->clear_session();
- if(
- $user = (
- isset($_COOKIE["user"]) || isset($_SESSION["user"]) ?
- $this->user(isset($_COOKIE["user"]) ? $_COOKIE["user"] : $_SESSION["user"])
- : array()
- )
- ){
- if(isset($_COOKIE["user"])) $this->set_session($user);
- if(!$this->user_ok($user)){
- $this->clear_session();
- $user = array();
- }
- }
- $this->user = $user;
- return $user;
- }
-
- function set_session($user){
- $_SESSION["user"] = $user["login"];
- $_SESSION["pass"] = md5($user["password"].$_SESSION["id"]);
- $env = $this->env();
- return setcookie("user", $user["login"], time() + (60 * 60 * 24 * 7), $env->path("web"));
- }
-
- function clear_session(){
- unset($_SESSION["user"]);
- unset($_SESSION["pass"]);
- $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
- $_SESSION["id"] = md5(rand());
- $env = $this->env();
- return setcookie("user", "", 0, $env->path("web"));
- }
-
- function get_session_user(){
- return $this->user;
- }
-
- # ----------------------------------------------------------------------------------------
- # uploads
- #
-
- function check_user_uploads_dir($user = null){
- $env = $this->env();
- if((!isset($user) || !$user) && !isset($this->user["id"])) return false;
- $user_dir = $env->path("content")."uploads/".(isset($user) && $user ? $user : $this->user["id"]);
- if(!file_exists($user_dir)) @mkdir($user_dir);
- return file_exists($user_dir);
- }
-
}
?>
\ No newline at end of file