Commit 00aa9cbe authored by ayolo's avatar ayolo

bleh

parent a42eb20c
<?php
/* Copyright 2009
*
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
$topdir="./";
require_once($topdir. "include/site.inc.php");
require_once($topdir. "include/entities/page.inc.php");
require_once($topdir. "include/entities/club.inc.php");
$conf['maxtoclevel']=4;
$conf['maxseclevel']=6;
$site = new site ();
$page = new page ($site->db);
$site->add_css("css/articles.css");
$site->add_css("css/doku.css");
if ( $site->user->is_valid() && $site->user->is_in_group("moderateur_site") )
{
$page->id_utilisateur = 0;
$page->id_groupe = 8;
$page->id_groupe_admin = 8;
$page->droits_acces = 0x311;
if ( $_REQUEST['action'] == "new" )
{
if ( !$_REQUEST["name"] || !preg_match("#^([a-z0-9\-_:]+)$#",$_REQUEST["name"]) )
$Erreur = "Nom invalide";
elseif ( !$_REQUEST["title"] || !$_REQUEST["texte"] )
$Erreur = "Veuillez préciser un titre et/ou un contenu";
elseif ( $page->load_by_pagename($_REQUEST["name"]) )
$Erreur = "Cette page existe déjà";
else
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->add($site->user, $_REQUEST["name"], $_REQUEST["title"], $_REQUEST['texte'], $_REQUEST['section']);
}
}
if ( $_REQUEST['page'] == "new" || isset($Erreur) )
{
foreach ($site->tab_array as $entry)
$sections[$entry[0]] = $entry[2];
$site->start_page("none","Nouveau");
$frm = new form("newarticle","article.php",true,"POST","Nouvelle page");
if ( isset($Erreur) )
$frm->error($Erreur);
$frm->add_hidden("action","new");
$frm->add_text_field("name","Nom",$_REQUEST["name"],true);
$frm->add_text_field("title","Titre","",true);
//$frm->add_entity_select("groupid","Groupe",$site->db,"group" );
$frm->add_select_field("section","Section",$sections,"presentation");
$frm->add_rights_field($page,false,$page->is_admin($site->user),"pages");
$frm->add_dokuwiki_toolbar('texte');
$frm->add_text_area("texte","Contenu","",80,20,true);
$frm->add_submit("save","Ajouter");
$site->add_contents($frm);
$site->add_contents(new wikihelp());
$site->end_page();
exit();
}
}
if ( isset($_REQUEST["name"]) && ereg("^activites-(.*)$",$_REQUEST["name"],$regs )) // LEGACY SUPPORT
{
$club = new club($site->db);
$club->load_by_unix_name($regs[1]);
if ( $club->id > 0 )
{
header("Location: club.php?id_club=".$club->id);
exit();
}
}
if ( isset($_REQUEST["name"]) )
{
if ( $_REQUEST["name"]{0} == ":" )
$page->load_by_pagename(substr($_REQUEST["name"],1));
else
$page->load_by_pagename($_REQUEST["name"]);
}
if ( !$page->is_valid() )
{
$site->start_page("none","Erreur");
$err = new error("Page inconnue","Merci de vérifier le lien que vous avez emprunté");
if ( $site->user->is_in_group("moderateur_site") )
$err->set_toolbox(new toolbox(array("article.php?page=new&name=".
$_REQUEST["name"] => "Creer la page")));
$site->add_contents($err);
$site->end_page();
exit();
}
if ( !$page->is_right($site->user,DROIT_LECTURE) )
$site->error_forbidden();
$section = "presentation";
if ( $page->section )
$section = $page->section;
if( $section == "presentation" )
$site->add_css("css/presentation.css");
if ( $page->is_right($site->user,DROIT_ECRITURE) )
{
if ( $_REQUEST['action'] == "save" )
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->save( $site->user, $_REQUEST['title'], $_REQUEST['texte'], $_REQUEST['section'] );
$section = $page->section;
}
if ( $_REQUEST['page'] == "edit" )
{
foreach ($site->tab_array as $entry)
$sections[$entry[0]] = $entry[2];
$site->start_page($section,"Edition :".$page->titre);
$frm = new form("editarticle","article.php?name=".$page->nom,true,"POST","Edition : ".$page->nom);
$frm->add_hidden("action","save");
$frm->add_text_field("title","Titre",$page->titre,true);
//$frm->add_entity_select("groupid","Groupe",$site->db,"group",$page->id_groupe );
$frm->add_select_field("section","Section",$sections,$page->section);
$frm->add_rights_field($page,false,$page->is_admin($site->user),"pages");
$frm->add_dokuwiki_toolbar('texte');
$frm->add_text_area("texte","Contenu",$page->texte,80,20,true);
$frm->add_submit("save","Enregistrer");
$site->add_contents($frm);
$site->add_contents(new wikihelp());
$site->end_page();
exit();
}
$can_edit = true;
}
else
$can_edit = false;
if ( $page->nom == "services" /*|| $page->nom == "planning"*/ )
{
$site->set_side_boxes("left",array("calendrier","connexion"));
$site->add_box("calendrier",new calendar($site->db));
$site->add_box("connexion", $site->get_connection_contents());
}
if ( ereg("^activites:(.*)$", $page->nom,$regs ))
{
$club = new club($site->db);
$club->load_by_unix_name($regs[1]);
if ( $club->id > 0 )
{
header("Location: club.php?id_club=".$club->id);
exit();
}
}
$site->start_page($section,$page->titre);
$cts = $page->get_contents();
if ( count($cts->wiki->index["childs"]) )
{
function make_index($itm)
{
if ( is_null( $itm["title"] ) )
$lst = new itemlist("Index");
else
$lst = new itemlist("<a href=\"#".$itm["ancre"]."\">".$itm["title"]."</a>");
foreach($itm["childs"] as $sitm)
{
if (count($sitm["childs"]) )
$lst->add(make_index(&$sitm));
else
$lst->add("<a href=\"#".$sitm["ancre"]."\">".$sitm["title"]."</a>");
}
return $lst;
}
$site->sides["left"] = array_merge (array("wikiindex"),$site->sides["left"]);
$site->add_box("wikiindex", make_index($cts->wiki->index));
}
if ( $can_edit )
$cts->set_toolbox(new toolbox(array("article.php?page=edit&name=".$page->nom=>"Editer","article.php?page=new"=>"Ajouter une page")));
$site->add_contents($cts);
$site->end_page();
?>
This diff is collapsed.
<?php
/* Copyright 2009
*
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/**
* @file
*/
/**
* Donnés sur les différents objets traités.
*
* Chaque nom de classe est associée à un tableau :
* - [0] Nom du champ SQL d'identification
* - [1] Nom du champ SQl du nom (ou alias systèmatiquement utilisé)
* - [2] Fichier d'iconne associée (du dossier images/icons/(16|32)/)
* - [3] Url de la page d'information
* - [4] Nom de table SQL (facultatif)
* - [5] Fichier où est déclarée la classe (facultatif)
* - [6] Nom de la table pour associer des tags aux objets de l'entité (facultatif)
*
* @ingroup stdentity
*/
$GLOBALS['entitiescatalog'] = array (
'utilisateur' => array ('id_utilisateur', 'nom_utilisateur'/*alias*/, 'user.png', 'user.php', null, 'utilisateur.inc.php'),
'page' => array ('id_page', 'titre_page', 'page.png', 'article.php'),
'club' => array ('id_club', 'nom_club', 'club.png', 'club.php', 'club', 'club.inc.php'),
'group' => array ('id_groupe', 'nom_groupe', 'group.png', 'group.php', 'groupe' ),
// Localisation
'pays' => array ('id_pays', 'nom_pays', 'pays.png', 'loc.php', 'loc_pays','pays.inc.php'),
'ville' => array ('id_ville', 'nom_ville', 'ville.png', 'loc.php', 'loc_ville','ville.inc.php'),
'lieu' => array ('id_lieu', 'nom_geopoint', 'lieu.png', 'loc.php', 'loc_lieu','lieu.inc.php'),
// Nouvelles
'nouvelle' => array ('id_nouvelle', 'titre_nvl', 'misc.png', 'news.php', 'nvl_nouvelles', 'news.inc.php', 'nvl_nouvelles_tag'),
'canalnouvelles' => array ('id_canal', 'nom_canal', 'misc.png', 'news.php', 'nvl_canal', 'news.inc.php')
);
?>
<?php
/* Copyright 2009
*
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
define("CACHE_DIR",$topdir."var/cache/contents/");
......
This diff is collapsed.
<?php
/** @file
*
*
*/
/* Copyright 2005,2006
* - Julien Etelain < julien at pmad dot net >
/* Copyright 2009
*
* Ce fichier fait partie du site de l'Association des Étudiants de
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
......@@ -26,6 +20,11 @@
* 02111-1307, USA.
*/
/** @file
*
*
*/
require_once($topdir."include/lib/dokusyntax.inc.php");
require_once($topdir."include/catalog.inc.php");
require_once($topdir."include/entities/group.inc.php");
......
<?php
/* Copyright 2004-2007
* - Julien Etelain < julien at pmad dot net >
/* Copyright 2009
*
* Ce fichier fait partie du site de l'Association des Étudiants de
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
......@@ -20,7 +19,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/**
* @file
*/
......@@ -47,7 +45,6 @@ define("DROIT_MASKITEM",0x331);
/**
* Gère un objet à droits d'accés et modéré
* @ingroup stdentity
* @author Julien Etelain
*/
abstract class basedb extends stdentity
{
......@@ -75,7 +72,6 @@ abstract class basedb extends stdentity
/**
* Instancie un objet à droits d'accés.
* @param $db Accés à la base de donnés en lecture seule.
* @param $dbrw Accés à la base de donnés en lecture et ecriture.
*/
function basedb ( &$db )
{
......
<?php
/* Copyright 2009
*
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/**
* @file
* Gestion des cartes BDS
*/
define("CETAT_ATTENTE",0);
define("CETAT_EN_PRODUCTION",2);
define("CETAT_IMPRIMEE",4);
define("CETAT_AU_BUREAU_BDS",6);
define("CETAT_CIRCULATION",8);
define("CETAT_EXPIRE",10);
define("CETAT_PERDUE",12);
define("CETAT_VOLEE",14);
$EtatsCarteBDS = array (
CETAT_ATTENTE => "Attente de fabrication",
CETAT_EN_PRODUCTION => "En fabrication",
CETAT_IMPRIMEE => "Fabriquée, en cours d'acheminement",
CETAT_AU_BUREAU_BDS => "Au bureau BDS (GM,TC: Sévenans; EDIM : Montbéliard; IMAP,GI,GESC,Autres: Belfort)",
CETAT_CIRCULATION => "En circulation",
CETAT_EXPIRE => "Expirée",
CETAT_PERDUE => "Perdue",
CETAT_VOLEE => "Volée"
);
/**
* Une carte BDS
* @see cotisation
*/
class cartebds extends stdentity
{
/** Id de la cotisation rattachée à cette carte */
var $id_cotisation;
/** Etat de la carte
* @see $EtatsCarteBDS
*/
var $etat_vie_carte;
/** Date d'expiration de la carte (timestamp),
* corresponds à la fin de la cotisation associée
*/
var $date_expiration;
/** Lettre complémentaire au numéro de la carte pour éviter les erreurs de saisie */
var $cle;
function load_by_id ( $id )
{
$req = new requete($this->db, "SELECT * FROM `bds_carte`
WHERE `id_carte_bds` = '" . mysql_real_escape_string($id) . "'
LIMIT 1");
if ( $req->lines == 1 )
{
$this->_load($req->get_row());
return true;
}
$this->id = null;
return false;
}
/** Charge une carte en fonction de son code barre
* $this->id est égal à null en cas d'erreur
* @param $num code barre de la carte, ou numéro + clé, ou numéro
* @return true en cas de succès, false sinon
*/
function load_by_cbarre ( $num )
{
if ( ereg("^([0-9]+)([a-zA-Z]{1})$", $num, $regs) )
{
if ( !$this->load_by_id($regs[1]) )
return false;
if ( strtoupper($this->cle) != strtoupper($regs[2]) ) // Verifie la cle de contrôle
{
$this->id=null;
$this->id_cotisation=null;
return false;
}
return true;
}
elseif ( ereg("^([0-9]+) ([a-zA-Z\\-]{1,6})\\.([a-zA-Z\\-]{1,6})$", $num, $regs) )
{
return $this->load_by_id($regs[1]);
}
return $this->load_by_id(intval($num));
}
/** Charge une carte en fonction de l'id de son propriétaire
* $this->id est égal à null en cas d'erreur
* @param $id id de l'utilisateur
* @return true en cas de succès, false sinon
*/
function load_by_utilisateur ( $id )
{
$req = new requete($this->db, "SELECT * FROM `bds_carte` " .
"INNER JOIN `bds_cotisations` ON `ae_cotisations`.`id_cotisation`=`ae_carte`.`id_cotisation` " .
"WHERE `bds_cotisations`.`id_utilisateur` = '" . mysql_real_escape_string($id) . "' " .
"AND `bds_carte`.`etat_vie_carte_ae`<=".CETAT_EXPIRE." " .
"ORDER BY `bds_carte`.`date_expiration` DESC ".
"LIMIT 1");
if ( $req->lines == 1 )
$this->_load($req->get_row());
else
$this->id = null;
}
/**
* Détermine si la carte chargée est valide
* @return true si la carte est valide, false sinon
*/
function is_validcard()
{
return !is_null($this->id) && ($this->etat_vie_carte == CETAT_CIRCULATION && $this->date_expiration >= date('Y-m-d'));
}
function _load ( $row )
{
$this->id = $row['id_carte_bds'];
$this->id_cotisation = $row['id_cotisation'];
$this->etat_vie_carte = $row['etat_vie_carte_bds'];
$this->date_expiration = $row['date_expiration'];
$this->cle = $row['cle_cartebds'];
}
/**
* Crée une nouvelle carte BDS
* @param $id_cotisation Id de la cotisantion
* @param $expire Date d'expiration (timestamp)
*/
function add ( $id_cotisation, $expire )
{
$this->id_cotisation = $id_cotisation;
$this->etat_vie_carte = CETAT_ATTENTE;
$this->date_expiration = $expire;
$this->cle = chr(ord('A')+rand(0,25));
$sql = new insert ($this->db,
"bds_carte",
array(
"id_cotisation" => $this->id_cotisation,
"etat_vie_carte_bds" => $this->etat_vie_carte,
"date_expiration" => date("Y-m-d",$this->date_expiration),
"cle_cartebds" => $this->cle
)
);
if ( $sql )
$this->id = $sql->get_id();
else
$this->id = null;
}
/**
* Prolonge le carte en l'association à une autre cotisation.
* @param $id_cotisation Id de la nouvelle cotisantion
* @param $expire Nouvelle date d'expiration (timestamp)
*/
function prolongate ( $id_cotisation, $expire )
{
$this->id_cotisation = $id_cotisation;
$this->etat_vie_carte = CETAT_ATTENTE;
$this->date_expiration = $expire;
$sql = new update ($this->db,
"bds_carte",
array(
"id_cotisation" => $this->id_cotisation,
"etat_vie_carte_bds" => $this->etat_vie_carte,
"date_expiration" => date("Y-m-d",$this->date_expiration)
),
array(
"id_carte_bds"=>$this->id
)
);
}
/**
* Modifie l'etat de la carte
* @param $state Nouvel etat de la carte
* @return true en cas de succès, false sinon
*/
function set_state ( $state )
{
$this->etat_vie_carte = $state;
$verif_state = new requete($this->db,"SELECT * FROM `bds_carte` WHERE `id_carte_ae` = '".intval($this->id)."' AND `etat_vie_carte_ae` = '".intval($state)."' LIMIT 1");
if ($verif_state->lines == 0)
{
$sql = new update ($this->db,
"bds_carte",
array(
"etat_vie_carte_bds" => $this->etat_vie_carte,
),
array(
"id_carte_bds"=>$this->id
)
);
return TRUE;
}
else
return FALSE;
}
}
?>
<?php
/** @file Gestion des clubs et clubs
*
*/
/* Copyright 2005-2007
* - Julien Etelain <julien CHEZ pmad POINT net>
/* Copyright 2009
*
* Ce fichier fait partie du site de l'Association des étudiants de
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
......@@ -26,6 +20,10 @@
* 02111-1307, USA.
*/
/** @file Gestion des clubs et clubs
*
*/
define("ROLECLUB_RESPONSABLE",10);
define("ROLECLUB_VICEPRESIDENT",9);
define("ROLECLUB_MEMBREACTIF",1);
......@@ -122,11 +120,10 @@ class club extends stdentity
* @param $nom Nom du club
* @param $nom_unix Nom UNIX du club
* @param $id_parent ID du club parent, false si non applicable
* @param $email Adresse email du club
*/
function add_club ( $nom, $nom_unix, $id_parent = null, $email="" )
{
if ( is_null($this->db) ) return; // "Read Only" mode
$this->nom = $nom;
$this->nom_unix = $nom_unix;
$this->id_parent = $id_parent;
......@@ -153,11 +150,10 @@ class club extends stdentity
* @param $nom Nom du club
* @param $nom_unix Nom UNIX du club
* @param $id_parent ID du club parent, false si non applicable
* @param $email Adresse email du club
*/
function update_club ( $nom, $nom_unix, $id_parent = null, $email=null )
{
if ( is_null($this->db) ) return; // "Read Only" mode
$old_allow = $this->is_mailing_allowed();
$old_id_parent = $this->id_parent;
$this->id_parent = $id_parent;
......@@ -348,7 +344,6 @@ class club extends stdentity
*/
function remove_member ( $id_utl, $date_debut )
{
if ( is_null($this->db) ) return; // "Read Only" mode
$prevrole = $this->member_role($id_utl);
$sql = new delete ($this->db,
"club_membre",
......
<?php
/* Copyright 2009
*
* Ce fichier est adapté du site de l'association des étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License a
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
require_once("cartebds.inc.php");
/** Modes paiement cotisation :
- 1 : cheque
- 2 : carte bleue
- 3 : liquide
- 4 : administration
- 5 : eboutic */
class cotisation extends stdentity
{
var $id_utilisateur;
var $date_cotis;
var $date_fin_cotis;
var $a_pris_cadeau;
var $a_pris_carte;
var $mode_paiement_cotis;
var $prix_paye_cotis;
/** Charge une carte en fonction de son id
* $this->id est égal à -1 en cas d'erreur
* @param $id id de la fonction
*/
function load_by_id ( $id )
{
$req = new requete($this->db, "SELECT * FROM `cotisations`
WHERE `id_cotisation` = '" . mysql_real_escape_string($id) . "'