Commit 2e107ba6 authored by Feu's avatar Feu

plein de choses: fusion page-wiki, versionnage fichiers, debut depreciation...

plein de choses: fusion page-wiki, versionnage fichiers, debut depreciation error_403, rennomages des pages en vue de la migration vers wiki2
parent d64e5694
......@@ -59,8 +59,8 @@ if ( $_REQUEST["action"] == "addonglet" )
$name = $_REQUEST["nom_page"];
$page = new page ($site->db,$site->dbrw);
$page->load_by_name(CMS_PREFIX.$_REQUEST["nom_page"]);
$page->save($page->title, $page->texte, CMS_PREFIX.$name );
$page->load_by_pagename(CMS_PREFIX.$_REQUEST["nom_page"]);
$page->save($site->user,$page->title, $page->texte, CMS_PREFIX.$name );
}
elseif ( $_REQUEST["typepage"] == "crearticle" && $_REQUEST["name"] != "accueil" )
{
......@@ -68,7 +68,7 @@ if ( $_REQUEST["action"] == "addonglet" )
$name = $_REQUEST["name"];
$page = new page ($site->db,$site->dbrw);
$page->load_by_name(CMS_PREFIX.$name);
$page->load_by_pagename(CMS_PREFIX.$name);
if ( !$page->is_valid() )
{
......@@ -76,10 +76,10 @@ if ( $_REQUEST["action"] == "addonglet" )
$page->id_groupe = $site->asso->get_membres_group_id();
$page->id_groupe_admin = $site->asso->get_bureau_group_id();
$page->droits_acces = 0x311;
$page->add(CMS_PREFIX.$name, $_REQUEST["title"], "", CMS_PREFIX.$name);
$page->add($site->user,CMS_PREFIX.$name, $_REQUEST["title"], "", CMS_PREFIX.$name);
}
else
$page->save($page->title, $page->texte, CMS_PREFIX.$name );
$page->save($site->user,$page->title, $page->texte, CMS_PREFIX.$name );
}
elseif ( $_REQUEST["typepage"] == "aedrive" )
{
......@@ -121,17 +121,17 @@ elseif ( $_REQUEST["action"] == "addbox" )
{
$name = $_REQUEST["name"];
$page = new page ($site->db,$site->dbrw);
$page->load_by_name(CMS_PREFIX."boxes:".$name);
$page->load_by_pagename(CMS_PREFIX."boxes:".$name);
if ( !$page->is_valid() )
{
$page->id_utilisateur = $site->user->id;
$page->id_groupe = $site->asso->get_membres_group_id();
$page->id_groupe_admin = $site->asso->get_bureau_group_id();
$page->droits_acces = 0x311;
$page->add(CMS_PREFIX."boxes:".$name, $_REQUEST["title"], "", CMS_PREFIX."accueil");
$page->add($site->user,CMS_PREFIX."boxes:".$name, $_REQUEST["title"], "", CMS_PREFIX."accueil");
}
else
$page->save($_REQUEST["title"], $page->texte, CMS_PREFIX."accueil" );
$page->save($site->user,$_REQUEST["title"], $page->texte, CMS_PREFIX."accueil" );
}
else//if ( $_REQUEST["typebox"] == "calendrier" )
......@@ -278,7 +278,7 @@ elseif ( $_REQUEST["action"] == "down" && isset($_REQUEST["box_name"]) )
elseif ( $_REQUEST["action"] == "edit" )
{
$page = new page ($site->db,$site->dbrw);
$page->load_by_name(CMS_PREFIX."boxes:".$_REQUEST["box_name"]);
$page->load_by_pagename(CMS_PREFIX."boxes:".$_REQUEST["box_name"]);
if ($page->is_valid() )
{
$site->start_page(CMS_PREFIX."config","Edition boite :".$page->titre);
......@@ -297,12 +297,12 @@ elseif ( $_REQUEST["action"] == "edit" )
elseif ( $_REQUEST["action"] == "save" )
{
$page = new page ($site->db,$site->dbrw);
$page->load_by_name(CMS_PREFIX."boxes:".$_REQUEST["box_name"]);
$page->load_by_pagename(CMS_PREFIX."boxes:".$_REQUEST["box_name"]);
if ($page->is_valid() )
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->save( $_REQUEST['title'], $_REQUEST['texte'], CMS_PREFIX."accueil" );
$page->save($site->user, $_REQUEST['title'], $_REQUEST['texte'], CMS_PREFIX."accueil" );
}
}
elseif( $_REQUEST["action"] == "setcss" )
......
......@@ -37,10 +37,8 @@ if ( isset($_REQUEST["id_file"]))
if ( $file->is_valid() )
{
if ( !$file->is_right($site->user,DROIT_LECTURE) )
{
Header("Location: index.php?name=403");
exit();
}
$site->error_forbidden(CMS_PREFIX."fichiers","group",$file->id_groupe);
$folder->load_by_id($file->id_folder);
}
else
......@@ -108,7 +106,7 @@ if ( !$folder->is_valid() )
}
if ( !$folder->is_right($site->user,DROIT_LECTURE) )
error_403();
$site->error_forbidden(CMS_PREFIX."fichiers","group",$folder->id_groupe);
if ( $_REQUEST["action"] == "cut" )
{
......@@ -142,7 +140,7 @@ elseif ( $folder->is_valid() && $_REQUEST["action"] == "delete" )
if ( !$folder->is_valid() )
$folder->load_by_id(1);
if ( !$folder->is_right($site->user,DROIT_LECTURE) )
error_403();
$site->error_forbidden(CMS_PREFIX."fichiers","group",$folder->id_groupe);
}
}
......
......@@ -249,7 +249,7 @@ class aecms extends site
function get_box ( $name )
{
$page = new page ($this->db);
$page->load_by_name(CMS_PREFIX."boxes:".$name);
$page->load_by_pagename(CMS_PREFIX."boxes:".$name);
if ( !$page->is_valid() || !$page->is_right($this->user,DROIT_LECTURE) )
return null;
......
......@@ -41,18 +41,18 @@ if ( $site->is_user_admin() )
if ( $_REQUEST['action'] == "new" )
{
if ( !$_REQUEST["name"] || !$_REQUEST["title"] || !$_REQUEST["texte"] || $page->load_by_name($_REQUEST["name"]) )
if ( !$_REQUEST["name"] || !$_REQUEST["title"] || !$_REQUEST["texte"] || $page->load_by_pagename($_REQUEST["name"]) )
$_REQUEST['page'] = "new";
else
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->add(CMS_PREFIX.$_REQUEST["name"], $_REQUEST["title"], $_REQUEST['texte'], $_REQUEST['section']);
$page->add($site->user,CMS_PREFIX.$_REQUEST["name"], $_REQUEST["title"], $_REQUEST['texte'], $_REQUEST['section']);
}
}
if ( $_REQUEST['action'] == "delete" )
{
if ( $page->load_by_name(CMS_PREFIX.$_REQUEST["name"]) )
if ( $page->load_by_pagename(CMS_PREFIX.$_REQUEST["name"]) )
{
if ( $site->is_sure ( "","Suppression de la page ".$page->titre,"page".$page->nom, 1 ) )
{
......@@ -89,14 +89,14 @@ if ( isset($_REQUEST["name"]) )
{
if ( $_REQUEST["name"]{0} == ":" )
{
$page->load_by_name(substr($_REQUEST["name"],1));
$page->load_by_pagename(substr($_REQUEST["name"],1));
$noedit=true;
}
else
$page->load_by_name(CMS_PREFIX.$_REQUEST["name"]);
$page->load_by_pagename(CMS_PREFIX.$_REQUEST["name"]);
}
else
$page->load_by_name(CMS_PREFIX."home");
$page->load_by_pagename(CMS_PREFIX."home");
if ( !$page->is_valid() )
{
......@@ -141,7 +141,7 @@ if ( ($page->is_right($site->user,DROIT_ECRITURE) || $site->is_user_admin()) &&
if ( $_REQUEST['action'] == "save" )
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->save( $_REQUEST['title'], $_REQUEST['texte'], $_REQUEST['section'] );
$page->save( $site->user, $_REQUEST['title'], $_REQUEST['texte'], $_REQUEST['section'] );
$section = $page->section;
}
if ( $_REQUEST['page'] == "edit" )
......
......@@ -470,7 +470,7 @@ if ( $_REQUEST["view"] == "add" && $cat->is_right($site->user,DROIT_AJOUTITEM) )
$cts->add_paragraph("<br/>Si vous voulez ajouter de nombreuses photos, " .
"nous vous conseillons d'utiliser le logiciel UBPT Transfert qui " .
"vous permet d'envoyer plusieurs photos en même temps de façon automatisée.<br/> " .
"<a href=\"../article.php?name=sas-transfert\">Télécharger UBPT Transfert</a> (Disponible pour Windows, Mac OS X et Linux)");
"<a href=\"../article.php?name=sas:transfert\">Télécharger UBPT Transfert</a> (Disponible pour Windows, Mac OS X et Linux)");
$cts->add_paragraph("Après avoir ajout&eactute; vos photos, il faut <b>IMPERATIVEMENT renseigner les noms des personnes</b> " .
"se trouvant sur les photos pour que ces dernières puissent être visibles de tous.<br/>");
......
......@@ -42,12 +42,12 @@ if ( $site->user->is_valid() && $site->user->is_in_group("moderateur_site") )
if ( $_REQUEST['action'] == "new" )
{
if ( !$_REQUEST["name"] || !$_REQUEST["title"] || !$_REQUEST["texte"] || $page->load_by_name($_REQUEST["name"]) )
if ( !$_REQUEST["name"] || !$_REQUEST["title"] || !$_REQUEST["texte"] || $page->load_by_pagename($_REQUEST["name"]) )
$_REQUEST['page'] = "new";
else
{
$page->set_rights($site->user,$_REQUEST['rights'],$_REQUEST['rights_id_group'],$_REQUEST['rights_id_group_admin']);
$page->add($_REQUEST["name"], $_REQUEST["title"], $_REQUEST['texte'], $_REQUEST['section']);
$page->add($site->user, $_REQUEST["name"], $_REQUEST["title"], $_REQUEST['texte'], $_REQUEST['section']);
}
}
......@@ -81,9 +81,9 @@ if ( $site->user->is_valid() && $site->user->is_in_group("moderateur_site") )
if ( isset($_REQUEST["name"]) )
{
if ( $_REQUEST["name"]{0} == ":" )
$page->load_by_name(substr($_REQUEST["name"],1));
$page->load_by_pagename(substr($_REQUEST["name"],1));
else
$page->load_by_name($_REQUEST["name"]);
$page->load_by_pagename($_REQUEST["name"]);
}
if ( !$page->is_valid() )
......@@ -117,7 +117,7 @@ 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( $_REQUEST['title'], $_REQUEST['texte'], $_REQUEST['section'] );
$page->save( $site->user, $_REQUEST['title'], $_REQUEST['texte'], $_REQUEST['section'] );
$section = $page->section;
}
if ( $_REQUEST['page'] == "edit" )
......@@ -153,7 +153,7 @@ if ( $page->nom == "services" /*|| $page->nom == "planning"*/ )
$site->add_box("connexion", $site->get_connection_contents());
}
if ( ereg("^activites-(.*)$", $page->nom,$regs ))
if ( ereg("^activites-(.*)$", $page->nom,$regs )) // LEGACY SUPPORT
{
$asso = new asso($site->db);
$asso->load_by_unix_name($regs[1]);
......@@ -164,6 +164,18 @@ if ( ereg("^activites-(.*)$", $page->nom,$regs ))
}
}
if ( ereg("^activites:(.*)$", $page->nom,$regs ))
{
$asso = new asso($site->db);
$asso->load_by_unix_name($regs[1]);
if ( $asso->id > 0 )
{
header("Location: asso.php?id_asso=".$asso->id);
exit();
}
}
$site->start_page($section,$page->titre);
$cts = $page->get_contents();
......
......@@ -190,7 +190,7 @@ else if ( isset($_REQUEST["id_asso"]) )
$cts = new contents($asso->get_html_path());
if ( $site->user->is_in_group("moderateur_site") || $asso->is_member_role( $site->user->id, ROLEASSO_MEMBREBUREAU ) )
$cts->set_toolbox(new toolbox(array("article.php?page=edit&name=activites-".$asso->nom_unix=>"Editer Présentation","asso.php?page=edit&id_asso=".$asso->id=>"Editer")));
$cts->set_toolbox(new toolbox(array("article.php?page=edit&name=activites:".$asso->nom_unix=>"Editer Présentation","asso.php?page=edit&id_asso=".$asso->id=>"Editer")));
$cts->add(new tabshead($asso->get_tabs($site->user),"info"));
......@@ -218,7 +218,7 @@ else if ( isset($_REQUEST["id_asso"]) )
$cts->add(new image($asso->nom, $img, "newsimg"));*/
$page = new page($site->db);
$page->load_by_name("activites-".$asso->nom_unix);
$page->load_by_pagename("activites:".$asso->nom_unix);
if ( $page->id > 0 )
{
$cts->add_title(2,"Pr&eacute;sentation");
......@@ -226,7 +226,7 @@ else if ( isset($_REQUEST["id_asso"]) )
}
elseif ( $site->user->is_in_group("moderateur_site") )
$cts->add_paragraph("<a href=\"article.php?page=edit&amp;name=activites-".$asso->nom_unix."\">Creer l'article de pr&eacute;sentation</a>");
$cts->add_paragraph("<a href=\"article.php?page=edit&amp;name=activites:".$asso->nom_unix."\">Creer l'article de pr&eacute;sentation</a>");
$req = new requete($site->db,
"SELECT `id_asso`, `nom_asso`, `nom_unix_asso` " .
......
......@@ -514,7 +514,7 @@ if ( $_REQUEST["view"] == "" )
{
require_once($topdir."include/entities/page.inc.php");
$page = new page ($site->db);
$page->load_by_name("biblio-indexinfo");
$page->load_by_pagename("info:biblio");
if ( $page->id != -1 )
$site->add_contents($page->get_contents());
}
......
......@@ -51,19 +51,19 @@ switch ($_REQUEST["domain"])
if ( !$site->user->is_valid() )
{
header("Location: article.php?name=site-wrongpassoruser");
header("Location: article.php?name=site:wrongpassoruser");
exit();
}
if ( $site->user->hash != "valid" )
{
header("Location: article.php?name=site-activate");
header("Location: article.php?name=site:activate");
exit();
}
if ( !$site->user->is_password($_POST["password"]) )
{
header("Location: article.php?name=site-wrongpassoruser");
header("Location: article.php?name=site:wrongpassorduser");
exit();
}
......
......@@ -49,11 +49,14 @@ $section="fichiers";
if ( isset($_REQUEST["id_file"]))
{
$file->load_by_id($_REQUEST["id_file"]);
if ( isset($_REQUEST["rev"]))
$file->load_by_id_and_rev($_REQUEST["id_file"],$_REQUEST["rev"]);
else
$file->load_by_id($_REQUEST["id_file"]);
if ( $file->is_valid() )
{
if ( !$file->is_right($site->user,DROIT_LECTURE) )
$site->error_forbidden($section,"group",$file->id_groups);
$site->error_forbidden($section,"group",$file->id_groupe);
$folder->load_by_id($file->id_folder);
}
......@@ -65,6 +68,7 @@ if ( isset($_REQUEST["id_file"]))
// "Exception"
if ( $_REQUEST["action"] == "download" && $file->is_valid() )
{
session_write_close();
if ( $_REQUEST["download"] == "thumb" )
{
$filename = $file->get_thumb_filename();
......@@ -167,7 +171,7 @@ elseif ( $folder->is_valid() && $_REQUEST["action"] == "delete" )
if ( !$folder->is_valid() )
$folder->load_by_id(1);
if ( !$folder->is_right($site->user,DROIT_LECTURE) )
error_403();
$site->error_forbidden($section,"group",$folder->id_groupe);
}
}
......@@ -445,8 +449,55 @@ if ( $file->is_valid() )
}
}
$cts->add_title(2,"Historique");
$req = new requete($site->db,"SELECT ".
"id_rev_file, date_rev_file, comment_rev_file, ".
"COALESCE(alias_utl,CONCAT(`utilisateurs`.`prenom_utl`,' ',`utilisateurs`.`nom_utl`)) AS `nom_utilisateur` ".
"FROM d_file_rev ".
"INNER JOIN utilisateurs ON ( d_file_rev_file.id_utilisateur_rev=utilisateurs.id_utilisateur) ".
"WHERE id_file='".$file->id."' ".
"ORDER BY date_rev_file DESC");
$list = new itemlist(false,"wikihist");
while ( $row = $req->get_row() )
{
$list->add(
"<span class=\"wdate\">".date("Y/m/d H:i",strtotime($row['date_rev_file']))."</span> ".
"<a class=\"wpage\" href=\"?id_file=".$file->id."&amp;rev=".$row['id_rev_file']."&amp;action=download\">Révision ".$row['id_rev_file']."</a> ".
"- <span class=\"wuser\">".htmlentities($row['nom_utilisateur'],ENT_NOQUOTES,"UTF-8")."</span> ".
"<span class=\"wlog\">".htmlentities($row['comment_rev_file'],ENT_NOQUOTES,"UTF-8")."</span>");
}
$cts->add($list);
$cts->add_title(2,"Références");
$req = new requete($site->db,"SELECT fullpath_wiki, title_rev ".
"FROM wiki_ref_file ".
"INNER JOIN wiki ON ( wiki.id_wiki=wiki_ref_wiki.id_wiki) ".
"INNER JOIN `wiki_rev` ON (".
"`wiki`.`id_wiki`=`wiki_rev`.`id_wiki` ".
"AND `wiki`.`id_rev_last`=`wiki_rev`.`id_rev` ) ".
"WHERE wiki_ref_file.id_file='".$file->id."' ".
"ORDER BY fullpath_wiki");
if ( $req->lines )
{
$cts->add_title(3,"Pages wiki2");
$list = new itemlist(null,"wikirefpages");
while ( $row = $req->get_row() )
{
$list->add(
"<a class=\"wpage\" href=\"wiki2/?name=".$row['fullpath_wiki']."\">".
($row['fullpath_wiki']?$row['fullpath_wiki']:"(racine)")."</a> ".
" : <span class=\"wtitle\">".htmlentities($row['title_rev'],ENT_NOQUOTES,"UTF-8")."</span> ");
}
$cts->add($list);
}
$cts->add_title(3,"Tags");
$cts->add(new taglist($file));
$cts->add(new taglist($file),true);
$site->add_contents($cts);
$site->end_page();
......
......@@ -2,7 +2,7 @@
/** @file
*
* @brief la page des lections
* @brief la page des Elections
*
*/
......@@ -58,7 +58,7 @@ if ( isset($_REQUEST["id_election"]))
if ( $_REQUEST["page"] == "results" )
{
if ( $elec->fin >= time() && !$site->user->is_in_group("gestion_ae") )
error_403();
$site->error_forbidden("none","group",9);
$site->start_page("main","Resultats: ".$elec->nom);
......@@ -172,7 +172,7 @@ if ( isset($_REQUEST["id_election"]))
}
elseif( !$site->user->is_valid() )
{
error_403();
$site->allow_only_logged_users("main");
}
elseif ( !$site->user->is_in_group_id($elec->id_groupe) )
{
......
......@@ -30,7 +30,7 @@ include($topdir. "include/entities/page.inc.php");
$site = new site ();
$page = new page ($site->db);
$page->load_by_name("site-i-info");
$page->load_by_pagename("info:imode");
$site->start_page("services","Informations sur la version mobile du site");
$cts = new contents();
......
......@@ -55,16 +55,28 @@ class dfile extends fs
/** Taille en octets du fichier */
var $taille;
/** ID de la revision en cours */
var $id_rev_file;
/** utilisateur ayant fait cette révision */
var $id_utilisateur_rev_file;
/** Date de la revision */
var $date_rev_file;
/** Charge un fichier par son ID
/**
* Charge un fichier par son ID
* @param $id ID du fichier
* @return false en cas d'erreur, sinon true
*/
function load_by_id ( $id )
{
$req = new requete($this->db, "SELECT * FROM `d_file`
WHERE `id_file` = '" . mysql_real_escape_string($id) . "'
LIMIT 1");
$req = new requete($this->db, "SELECT * FROM `d_file` ".
"INNER JOIN d_file_rev ON ".
"(d_file.id_file=d_file_rev.id_file ".
"AND d_file_rev.id_rev_file=d_file.id_rev_file_last ) ".
"WHERE `id_file` = '" . mysql_real_escape_string($id) . "' ".
"LIMIT 1");
if ( $req->lines == 1 )
{
$this->_load($req->get_row());
......@@ -75,9 +87,43 @@ class dfile extends fs
return false;
}
/**
* Charge un fichier par son ID et sa revision
* @param $id ID du fichier
* @param $rev Revision du fichier
* @return false en cas d'erreur, sinon true
*/
function load_by_id_and_rev ( $id, $rev )
{
$req = new requete($this->db, "SELECT * FROM `d_file` ".
"INNER JOIN d_file_rev ON ".
"(d_file.id_file=d_file_rev.id_file ".
"AND d_file_rev.id_rev_file='".mysql_real_escape_string($rev)."' ) ".
"WHERE `id_file` = '".mysql_real_escape_string($id)."' ".
"LIMIT 1");
if ( $req->lines == 1 )
{
$this->_load($req->get_row());
return true;
}
$this->id = null;
return false;
}
/**
* Charge un fichier par son nom "logique"
* @param $id_parent Id du dossier parent
* @param $nom_fichier Nom du fichier
* @return false en cas d'erreur, sinon true
*/
function load_by_nom_fichier ( $id_parent, $nom_fichier )
{
$req = new requete($this->db, "SELECT * FROM `d_file` ".
"INNER JOIN d_file_rev ON ".
"(d_file.id_file=d_file_rev.id_file ".
"AND d_file_rev.id_rev_file=d_file.id_rev_file_last ) ".
"WHERE `nom_fichier_file` = '" . mysql_real_escape_string($nom_fichier) . "' ".
"AND id_folder ='".mysql_real_escape_string($id_parent)."' ".
"LIMIT 1");
......@@ -96,6 +142,7 @@ class dfile extends fs
*/
function _load ( $row )
{
// File
$this->id = $row['id_file'];
$this->nom_fichier = $row['nom_fichier_file'];
$this->titre = $row['titre_file'];
......@@ -106,19 +153,25 @@ class dfile extends fs
$this->date_modif = strtotime($row['date_modif_file']);
$this->id_asso = $row['id_asso'];
$this->nb_telechargement = $row['nb_telechargement_file'];
$this->mime_type = $row['mime_type_file'];
$this->taille = $row['taille_file'];
/*$this->mime_type = $row['mime_type_file'];
$this->taille = $row['taille_file'];*/
// BaseDB
$this->id_utilisateur = $row['id_utilisateur'];
$this->id_groupe = $row['id_groupe'];
$this->id_groupe_admin = $row['id_groupe_admin'];
$this->droits_acces = $row['droits_acces_file'];
$this->modere = $row['modere_file'];
// Revision
$this->id_rev_file = $row['id_rev_file'];
$this->id_utilisateur_rev_file = $row['id_utilisateur_rev_file'];
$this->date_rev_file = $row['date_rev_file'];
$this->mime_type = $row['mime_type_rev_file'];
$this->taille = $row['filesize_rev_file'];
}
/**
* Ajoute un fichier.
* Vous DEVEZ avoir fait appel à herit et set_rights avant !
......@@ -177,7 +230,9 @@ class dfile extends fs
$this->id = null;
return;
}
$this->_new_revision ( $this->id_utilisateur, $filesize, $mime_type, "Created" );
move_uploaded_file ( $file['tmp_name'], $this->get_real_filename() );
$this->generate_thumbs();
......@@ -249,13 +304,18 @@ class dfile extends fs
return;
}
$this->_new_revision ( $this->id_utilisateur, $filesize, $mime_type, "Import/Copy" );
copy ( $localfile, $this->get_real_filename() );
$this->generate_thumbs();
}
/**
* Génère, si possible, les miniatures
*
*/
function generate_thumbs()
{
if ( ereg("image/(.*)",$this->mime_type) )
......@@ -296,32 +356,42 @@ class dfile extends fs
}
/**
* Insère une nouvelle révision du fichier à partir d'un élément de $_FILES (pas totalement implémenté)
* Insère une nouvelle révision du fichier à partir d'un élément de $_FILES
* Fonction à usage interne
* @param $user Utilisateur faisant la révision
* @param $id_utilisateur Utilisateur faisant la révision
* @param $filesize Taille du nouveau fichier
* @param $mime_type Type MIME du nouveau fichier
* @param $comment Commentaire
* @todo Implementer la gestion des résivions (table d_file_rev)
*/
function _new_revision ( &$user, $filesize, $mime_type, $comment="" )
function _new_revision ( $id_utilisateur, $filesize, $mime_type, $comment="" )
{
$this->backup_for_overwrite();
$this->date_modif = time();
$this->modere=0;
$this->id_utilisateur_rev_file = $id_utilisateur;
$this->date_rev_file = time();
$this->taille=$filesize;
$this->mime_type=$mime_type;
$sql = new insert($this->dbrw, "d_file_rev", array(
"id_file"=>$this->id,
"id_utilisateur_rev_file"=>$this->id_utilisateur_rev_file,
"date_rev_file"=>date("Y-m-d H:i:s",$this->date_rev_file),
"filesize_rev_file"=>$this->taille,
"mime_type_rev_file"=>$this->mime_type,
"comment_rev_file"=>$comment));
$this->id_rev_file = $sql->get_id();
$this->date_modif=time();
$this->modere=0;
$this->nb_telechargement=0;
$sql = new update ($this->dbrw,
"d_file",
array(
"mime_type_file"=>$this->mime_type,
"mime_type_file"=>$this->mime_type, // LEGACY SUPPORT
"date_modif_file"=>date("Y-m-d H:i:s",$this->date_modif),
"taille_file"=>$this->taille,
"taille_file"=>$this->taille, // LEGACY SUPPORT
"nb_telechargement_file"=>$this->nb_telechargement,
"modere_file"=>$this->modere
"modere_file"=>$this->modere,
"id_rev_file_last"=>$this->id_rev_file
),
array("id_file"=>$this->id)
);
......@@ -329,7 +399,7 @@ class dfile extends fs
}
/**