Subversion Repositories Applications.papyrus

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1633 → Rev 1976

/branches/v2.0-narmer/client/phorum/configuration/phorum.config.inc.php
New file
0,0 → 1,96
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Fichier de configuration du phorum
*
* A éditer de façon spécifique à chaque déploiement
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Outils-Reseaux 2006-2010
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
 
//===================================== CHEMINS ====================================
/** Chemin des sources de l'application phorum (mettre un / à la fin) */
define ('PHO_CHEMIN_SOURCES_APPLI', PAP_CHEMIN_RACINE.'client/phorum/bibliotheque/phorum/');
// set the Phorum install dir
$PHORUM_DIR=PHO_CHEMIN_SOURCES_APPLI;
 
 
// needed to really load the alternate db-config in common.php
define("PHORUM_WRAPPER",1);
 
//teste si l'on est dans l'application Papyrus
if (!defined('PAP_VERSION')) { //pas dans Papyrus
//================================ BASE DE DONNEES =================================
$PHORUM['DBCONFIG']=array(
// Database connection.
'type' => 'mysql',
'name' => 'papyrus',
'server' => 'localhost',
'user' => 'root',
'password' => 'fs1980',
'table_prefix' => 'phorum',
'mysql_use_ft' => '1'
);
} else { //dans Papyrus
//================================ BASE DE DONNEES =================================
/** Variable globale contenant l'objet d'accès à la base de données de l'application, un objet DB*/
$GLOBALS['_PHORUM_']['db'] =& $GLOBALS['_GEN_commun']['pear_db'];
// set the databse settings for this Phorum Install
$PHORUM['DBCONFIG']=array(
// Database connection.
'type' => $GLOBALS['_PHORUM_']['db']->dsn['dbsyntax'],
'name' => $GLOBALS['_PHORUM_']['db']->dsn['database'],
'server' => $GLOBALS['_PHORUM_']['db']->dsn['hostspec'],
'user' => $GLOBALS['_PHORUM_']['db']->dsn['username'],
'password' => $GLOBALS['_PHORUM_']['db']->dsn['password'],
'table_prefix' => 'phorum',
'mysql_use_ft' => '1'
);
//=========================AUTHENTIFICATION=================================
/** Variable globale contenant l'objet d'authentification de l'application, un objet AUTH*/
$GLOBALS['_PHORUM_']['AUTH'] =& $GLOBALS['_GEN_commun']['pear_auth'];
//==================================== LES URLS ====================================
/** Variable globale contenant l'objet d'accès à l'URL de base de l'application, un objet Net_URL*/
$GLOBALS['_PHORUM_']['url'] =& $GLOBALS['_GEN_commun']['url'];
 
//===================================== LANGUES ====================================
/** Choix de la langue par défaut de l'application */
define ('PHO_LANGUE_DEFAUT', $GLOBALS['_GEN_commun']['i18n']) ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/phorum/phorum.admin.php
New file
0,0 → 1,95
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Phorum
*
* *Administration de l'application de forums
*
*@package inscription
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*
*@copyright Outils-Reseaux 2006-2010
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
// create a namespace for Phorum
function phorum_namespace($page)
{
global $PHORUM; // globalize the $PHORUM array
include_once("./$page.php");
}
 
function phorum_custom_get_url ($page, $query_items, $suffix)
{
// on défini l'URL de tous les liens (qui conservent les GET) et rajoute les pages
$url_reecrite = $_SERVER['REQUEST_URI'];
$decoupe=explode("&param=",$url_reecrite);
$url_reecrite = $decoupe[0];
$url = "$url_reecrite&param=$page";
 
if(count($query_items)) $url.=",".implode(",", $query_items);
 
if(!empty($suffix)) $url.=$suffix;
return $url;
}
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
class phorum_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction afficherContenuCorps() - Affiche la partie administration
*
*
* @return string Le HTML
*/
function afficherContenuCorps() {
global $PHORUM;
$sortie_xhtml = '' ;
ob_start();
include_once 'configuration/phorum.config.inc.php';
chdir($PHORUM_DIR);
$_SERVER["PHP_SELF"]=$_SERVER["PHP_SELF"].$_SERVER["REQUEST_URI"];
if(file_exists('./admin.php')){
phorum_namespace('admin');
}
$sortie_xhtml .= ob_get_clean();
return $sortie_xhtml ;
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/thread_info.php
New file
0,0 → 1,79
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
/**
* This is the callback-function for removing hidden messages from an array of messages
*/
function phorum_remove_hidden($val)
{
return ($val['status'] > 0);
}
 
/**
* This function sets the stats for a thread like count, timestamp, etc.
*/
 
function phorum_update_thread_info($thread)
{
$PHORUM = $GLOBALS["PHORUM"];
$messages=phorum_db_get_messages($thread);
//these are not needed here
unset($messages['users']);
// remove hidden/unapproved messages from the array
$filtered_messages=array_filter($messages, "phorum_remove_hidden");
$thread_count=count($filtered_messages);
 
if($thread_count>0){
 
$message_ids=array_keys($filtered_messages);
$parent_message=$filtered_messages[$thread];
if (isset($PHORUM["reverse_threading"]) && $PHORUM["reverse_threading"]) {
reset($filtered_messages);
$recent_message=current($filtered_messages);
} else {
$recent_message=end($filtered_messages);
}
// prep the message to save
$message["thread_count"]=$thread_count;
$message["modifystamp"]=$recent_message["datestamp"];
$message["meta"]=$parent_message["meta"];
$message["meta"]["recent_post"]["user_id"]=$recent_message["user_id"];
$message["meta"]["recent_post"]["author"]=$recent_message["author"];
$message["meta"]["recent_post"]["message_id"]=$recent_message["message_id"];
$message["meta"]["message_ids"]=$message_ids;
// used only for mods
$message["meta"]["message_ids_moderator"]=array_keys($messages);
 
phorum_db_update_message($thread, $message);
}
 
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/.htaccess
New file
0,0 → 1,0
Deny from all
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/timing.php
New file
0,0 → 1,57
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// This library contains some functions that can be used for
// code benchmarking. It is not actively in use in the Phorum
// core, but its functions are used by the developers once
// in a while.
 
if(!defined("PHORUM")) return;
 
function timing_start($key="default")
{
$GLOBALS["_TIMING"][$key]["start"]=microtime();
}
function timing_mark($mark, $key="default")
{
$GLOBALS["_TIMING"][$key][$mark]=microtime();
}
 
function timing_print($key="default")
{
echo '<table border="1" cellspacing="0" cellpadding="2">';
echo "<tr><th>Mark</th><th>Time</th><th>Elapsed</th></tr>";
foreach($GLOBALS["_TIMING"][$key] as $mark => $mt){
$thistime=array_sum(explode(" ", $mt));
if(isset($lasttime)){
$elapsed=round($thistime-$start, 4);
$curr=round($thistime-$lasttime, 4);
echo "<tr><td>$mark</td><td>$curr sec.</td><td>$elapsed sec.</td></tr>";
 
 
} else {
$start=$thistime;
}
$lasttime=$thistime;
}
echo "</table>";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/profile_functions.php
New file
0,0 → 1,219
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
 
function phorum_gen_password($charpart=4, $numpart=3)
{
$vowels = array("a", "e", "i", "o", "u");
$cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", "cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl");
 
$num_vowels = count($vowels);
$num_cons = count($cons);
 
$password="";
 
for($i = 0; $i < $charpart; $i++){
$password .= $cons[mt_rand(0, $num_cons - 1)] . $vowels[mt_rand(0, $num_vowels - 1)];
}
 
$password = substr($password, 0, $charpart);
 
if($numpart){
$max=(int)str_pad("", $numpart, "9");
$min=(int)str_pad("1", $numpart, "0");
 
$num=(string)mt_rand($min, $max);
}
 
return strtolower($password.$num);
}
 
// ----------------------------------------------------------------------------
// Banlist checking
// ----------------------------------------------------------------------------
 
/**
* This function can perform multiple banlist checks at once and will
* automatically generate an appropriate error message when a banlist
* match is found.
* @param bans - an array of bans to check. Each element in this array is an
* array itself with two elements: the value to check and the
* type of banlist to check against. One special case:
* if the type if PHORUM_BAD_IPS, the value may be NULL.
* In that case the IP/hostname of the client will be checked.
* @return - An error message in case a banlist match was found or NULL
* if no match was found.
*/
function phorum_check_bans($bans)
{
$PHORUM = $GLOBALS["PHORUM"];
 
// A mapping from bantype -> error message to return on match.
$phorum_bantype2error = array (
PHORUM_BAD_NAMES => "ErrBannedName",
PHORUM_BAD_EMAILS => "ErrBannedEmail",
PHORUM_BAD_USERID => "ErrBannedUser",
PHORUM_BAD_IPS => "ErrBannedIP",
PHORUM_BAD_SPAM_WORDS => "ErrBannedContent",
);
 
// These language strings are set dynamically, so the language
// tool won't recognize them automatically. Therefore they are
// mentioned here.
// $PHORUM["DATA"]["LANG"]["ErrBannedName"]
// $PHORUM["DATA"]["LANG"]["ErrBannedEmail"]
// $PHORUM["DATA"]["LANG"]["ErrBannedUser"]
// $PHORUM["DATA"]["LANG"]["ErrBannedIP"]
 
// Load the ban lists.
if (! isset($GLOBALS["PHORUM"]["banlists"]))
$GLOBALS["PHORUM"]["banlists"] = phorum_db_get_banlists();
if(! isset($GLOBALS['PHORUM']['banlists'])) return NULL;
 
// Run the checks.
for (;;) {
// An array for adding ban checks on the fly.
$add_bans = array();
 
foreach ($bans as $ban) {
// Checking IP/hostname, but no value set? Then add the IP-address
// and hostname (if DNS lookups are enabled) to the end of the checking
// queue and continue with the next check.
if ($ban[1] == PHORUM_BAD_IPS && $ban[0] == NULL) {
$add_bans[] = array($_SERVER["REMOTE_ADDR"], PHORUM_BAD_IPS);
if ($PHORUM["dns_lookup"]) {
$resolved = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
if (!empty($resolved) && $resolved != $_SERVER["REMOTE_ADDR"]) {
$add_bans[] = array($resolved, PHORUM_BAD_IPS);
}
}
continue;
}
 
// Do a single banlist check. Return an error if we find a match.
if (! phorum_check_ban_lists($ban[0], $ban[1])) {
$msg = $PHORUM["DATA"]["LANG"][$phorum_bantype2error[$ban[1]]];
// Replace %name% with the blocked string.
$msg = str_replace('%name%', htmlspecialchars($ban[0]), $msg);
return $msg;
}
}
 
// Bans added on the fly? Then restart the loop.
if (count($add_bans) == 0) {
break;
} else {
$bans = $add_bans;
}
}
 
return NULL;
}
 
/**
* Check a single banlist for a match.
* @param value - The value to check.
* @param type - The type of banlist to check the value against.
* @return True if all is okay. False if a match has been found.
*/
function phorum_check_ban_lists($value, $type)
{
// Load the ban lists.
if (! isset($GLOBALS["PHORUM"]["banlists"]))
$GLOBALS["PHORUM"]["banlists"] = phorum_db_get_banlists();
if(! isset($GLOBALS['PHORUM']['banlists'])) return true;
 
$banlists = $GLOBALS['PHORUM']['banlists'];
 
$value = trim($value);
 
if (!empty($value)) {
if (isset($banlists[$type]) && is_array($banlists[$type])) {
foreach($banlists[$type] as $item) {
if ( !empty($item['string']) && (
($item["pcre"] && @preg_match("/\b".$item['string']."\b/i", $value)) ||
(!$item["pcre"] && stristr($value , $item["string"]) && $type != PHORUM_BAD_USERID) ||
($type == PHORUM_BAD_USERID && $value == $item["string"])) ) {
return false;
}
}
}
}
 
return true;
}
 
 
/*
 
function phorum_dyn_profile_html($field, $value="")
{
 
// $PHORUM["PROFILE_FIELDS"][]=array("name"=>"real_name", "type"=>"text", "length"=>100, "required"=>0);
// $PHORUM["PROFILE_FIELDS"][]=array("name"=>"email", "type"=>"text", "length"=>100, "required"=>1);
// $PHORUM["PROFILE_FIELDS"][]=array("name"=>"hide_email", "type"=>"bool", "default"=>1);
// $PHORUM["PROFILE_FIELDS"][]=array("name"=>"sig", "type"=>"text", "length"=>0, "required"=>0);
 
 
$PHORUM=$GLOBALS["PHORUM"];
 
$html="";
 
switch ($field["type"]){
 
case "text":
if($field["length"]==0){
$html="<textarea name=\"$field[name]\" rows=\"15\" cols=\"50\" style=\"width: 100%\">$value</textarea>";
} else {
$html="<input type=\"text\" name=\"$field[name]\" size=\"30\" maxlength=\"$field[length]\" value=\"$value\" />";
}
break;
case "check":
$html ="<input type=\"checkbox\" name=\"$field[name]\" value=\"1\" ";
if($value) $html.="checked ";
$html.="/> $field[caption]";
break;
case "radio":
foreach($field["options"] as $option){
$html.="<input type=\"radio\" name=\"$field[name]\" value=\"$option\" ";
if($value==$option) $html.="checked ";
$html.="/> $option&nbsp;&nbsp;";
}
break;
case "select":
$html ="<select name=\"$field[name]\" size=\"1\">";
foreach($field["options"] as $option){
$html.="<option value=\"$option\"";
if($value==$option) $html.=" selected";
$html.=">$option</option>";
}
$html.="</select>";
break;
 
}
 
return $html;
 
}
 
*/
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/cache_memcached.php
New file
0,0 → 1,105
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
/*
* Memcached-based caching-layer
* Memcached -> http://www.danga.com/memcached/
* using the pecl-module for accessing memcached
* -> http://pecl.php.net/package/memcache/
*/
if(!defined("PHORUM")) return;
 
$PHORUM['memcache_obj'] = new Memcache;
$PHORUM['memcache_obj']->connect('127.0.0.1', 11211);
//$PHORUM['memcache_obj'] = memcache_connect('127.0.0.1', 11211);
 
 
 
/*
* This function returns the cached data for the given key
* or NULL if no data is cached for this key
*/
function phorum_cache_get($type,$key) {
if(is_array($key)) {
$getkey=array();
foreach($key as $realkey) {
$getkey[]=$type."_".$realkey;
}
} else {
$getkey=$type."_".$key;
}
 
$ret=$GLOBALS['PHORUM']['memcache_obj']->get($getkey);
// rewriting them as we need to strip out the type :(
if(is_array($getkey)) {
$typelen=(strlen($type)+1);
foreach($ret as $retkey => $retdata) {
$ret[substr($retkey,$typelen)]=$retdata;
unset($ret[$retkey]);
}
}
if($ret === false || (is_array($ret) && count($ret) == 0))
$ret=NULL;
return $ret;
}
 
/*
* Puts some data into the cache
* returns number of bytes written (something 'true') or false ...
* depending of the success of the function
*/
function phorum_cache_put($type,$key,$data,$ttl=PHORUM_CACHE_DEFAULT_TTL) {
$ret=$GLOBALS['PHORUM']['memcache_obj']->set($type."_".$key, $data, 0, $ttl);
return $ret;
}
 
 
/*
* Removes a key from the cache
*/
function phorum_cache_remove($type,$key) {
 
$ret=$GLOBALS['PHORUM']['memcache_obj']->delete( $type."_".$key, 0);
return $ret;
}
 
/*
* Clears all data from the cache
*/
function phorum_cache_clear() {
$ret=$GLOBALS['PHORUM']['memcache_obj']->flush();
return $ret;
}
 
/*
type can be nearly each value to specify a group of data
used are currently:
'user'
'message'
*/
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/moderation_functions.php
New file
0,0 → 1,93
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
include_once("./include/thread_info.php");
 
/**
* just returns to the list and exits the program
*/
function phorum_return_to_list()
{
$PHORUM=$GLOBALS["PHORUM"];
if(!empty($PHORUM["forum_id"])){
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
}else{
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
}
exit();
}
 
/* A function to get moderator_data from the user's profile.
* Without an argument, all moderator_data is returned. With a key as
* argument, the data for that key is returned or NULL in case the
* key does not exist.
*/
function phorum_moderator_data_get($key = null)
{
$PHORUM = $GLOBALS['PHORUM'];
$user_data =phorum_user_get($PHORUM['DATA']['USERINFO']['user_id'], false);
if( $user_data['moderator_data'] ) {
$moderator_data =unserialize($user_data['moderator_data']);
} else {
$moderator_data =array();
}
if (is_null($key)) {
return $moderator_data;
} else {
return isset($moderator_data[$key]) ? $moderator_data[$key] : NULL;
}
}
 
/* A function to save moderator_data in the user's profile. */
function phorum_moderator_data_save($moderator_data)
{
$PHORUM = $GLOBALS["PHORUM"];
// Clear value in case no data is left in $moderator_data.
$value = count($moderator_data) ? serialize($moderator_data) : '';
phorum_user_save_simple(array(
"user_id" => $PHORUM['user']['user_id'],
"moderator_data" => $value,
));
}
 
/* A function to place a key/value pair in the moderator_data. */
function phorum_moderator_data_put($key, $val)
{
$moderator_data = phorum_moderator_data_get();
$moderator_data[$key] = $val;
phorum_moderator_data_save($moderator_data);
}
 
/* A function to remove a key/value pair from the moderator_data. */
function phorum_moderator_data_remove($key)
{
$moderator_data = phorum_moderator_data_get();
unset($moderator_data[$key]);
phorum_moderator_data_save($moderator_data);
}
 
 
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/groups.php
New file
0,0 → 1,109
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
// if we have a request to join a group, try and do it
if (isset($_POST["joingroup"]) && $_POST["joingroup"] > 0){
// get the group, and the group list of the user trying to join
$group = phorum_db_get_groups($_POST["joingroup"]);
$usergroup = phorum_user_get_groups($PHORUM["user"]["user_id"]);
// the user can't already be a member of the group, and the group must allow join requests
if (!isset($usergroup[$_POST["joingroup"]])){
if ($group[$_POST["joingroup"]]["open"] == PHORUM_GROUP_OPEN){
$usergroup[$_POST["joingroup"]] = PHORUM_USER_GROUP_APPROVED;
phorum_user_save_groups($PHORUM["user"]["user_id"], $usergroup);
$PHORUM['DATA']['Message'] = $PHORUM['DATA']['LANG']['GroupJoinSuccess'];
}
elseif ($group[$_POST["joingroup"]]["open"] == PHORUM_GROUP_REQUIRE_APPROVAL){
$usergroup[$_POST["joingroup"]] = PHORUM_USER_GROUP_UNAPPROVED;
phorum_user_save_groups($PHORUM["user"]["user_id"], $usergroup);
$PHORUM['DATA']['Message'] = $PHORUM['DATA']['LANG']['GroupJoinSuccessModerated'];
}
else
{
$PHORUM['DATA']['Message'] = $PHORUM['DATA']['LANG']['GroupJoinFail'];
}
}
else{
$PHORUM['DATA']['Message'] = $PHORUM['DATA']['LANG']['GroupJoinFail'];
}
}
 
$template = "cc_groups";
$PHORUM['DATA']['Groups'] = phorum_readable_groups();
$PHORUM['DATA']['JOINGROUP'] = phorum_joinable_groups();
$PHORUM["DATA"]["GROUP"]["url"] = phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MEMBERSHIP);
 
/* --------------------------------------------------------------- */
 
function phorum_readable_groups()
{
$PHORUM=$GLOBALS['PHORUM'];
$readablegroups = array();
$groups = phorum_user_get_groups($PHORUM["user"]["user_id"]);
// print_r(array_keys($groups));
// print_r(array_values($groups));
foreach($groups as $groupid => $perm){
$group = phorum_db_get_groups($groupid);
switch ($perm){
case PHORUM_USER_GROUP_SUSPENDED:
$readablegroups[] = array('groupname' => $group[$groupid]["name"], 'perm' => $PHORUM['DATA']['LANG']['Suspended']);
break;
case PHORUM_USER_GROUP_UNAPPROVED:
$readablegroups[] = array('groupname' => $group[$groupid]["name"], 'perm' => $PHORUM['DATA']['LANG']['Unapproved']);
break;
 
case PHORUM_USER_GROUP_APPROVED:
$readablegroups[] = array('groupname' => $group[$groupid]["name"], 'perm' => $PHORUM['DATA']['LANG']['Approved']);
break;
 
case PHORUM_USER_GROUP_MODERATOR:
$readablegroups[] = array('groupname' => $group[$groupid]["name"], 'perm' => $PHORUM['DATA']['LANG']['PermGroupModerator']);
break;
 
// something weird happened
default:
$readablegroups[] = array('groupname' => $group[$groupid]["name"], 'perm' => '?');
break;
}
}
return $readablegroups;
}
 
function phorum_joinable_groups()
{
$PHORUM = $GLOBALS["PHORUM"];
$joinablegroups = array();
$groups = phorum_db_get_groups();
$memberof = phorum_user_get_groups($PHORUM["user"]["user_id"]);
foreach ($groups as $group){
if (!isset($memberof[$group["group_id"]])){
if ($group["open"] == PHORUM_GROUP_OPEN){
$joinablegroups[] = array("group_id" => $group["group_id"], "name" => $group["name"]);
}
elseif ($group["open"] == PHORUM_GROUP_REQUIRE_APPROVAL){
$joinablegroups[] = array("group_id" => $group["group_id"], "name" => $group["name"] . " (*)");
}
}
}
return $joinablegroups;
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/users.php
New file
0,0 → 1,69
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if (!$PHORUM["DATA"]["USER_MODERATOR"]) {
phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL));
exit();
}
 
$users=phorum_db_user_get_unapproved();
 
if(!empty($_POST["user_ids"])){
 
foreach($_POST["user_ids"] as $user_id){
 
if(!isset($_POST["approve"])){
$userdata["active"]=PHORUM_USER_INACTIVE;
} else {
$user=phorum_user_get($user_id);
if($user["active"]==PHORUM_USER_PENDING_BOTH){
$userdata["active"]=PHORUM_USER_PENDING_EMAIL;
} else {
$userdata["active"]=PHORUM_USER_ACTIVE;
// send reg approved message
$maildata["mailsubject"]=$PHORUM["DATA"]["LANG"]["RegApprovedSubject"];
$maildata["mailmessage"]=wordwrap($PHORUM["DATA"]["LANG"]["RegApprovedEmailBody"], 72);
phorum_email_user(array($user["email"]), $maildata);
}
}
 
$userdata["user_id"]=$user_id;
 
phorum_db_user_save($userdata);
}
}
 
if(empty($users)){
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedUsers"];
} else {
 
// get a fresh list to update any changes
$users=phorum_db_user_get_unapproved();
 
$PHORUM["DATA"]["USERS"]=$users;
 
$PHORUM["DATA"]["ACTION"]=phorum_get_url( PHORUM_CONTROLCENTER_ACTION_URL );
$PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
 
$template = "cc_users";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/files.php
New file
0,0 → 1,104
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if ($PHORUM["file_uploads"] || $PHORUM["user"]["admin"]) {
 
if(!empty($_FILES) && is_uploaded_file($_FILES["newfile"]["tmp_name"])){
 
if($PHORUM["max_file_size"]>0 && $_FILES["newfile"]["size"]>$PHORUM["max_file_size"]*1024){
$error_msg = true;
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileTooLarge"];
}
 
if(!empty($PHORUM["file_types"])){
$ext=strtolower(substr($_FILES["newfile"]["name"], strrpos($_FILES["newfile"]["name"], ".")+1));
$allowed_exts=explode(";", $PHORUM["file_types"]);
if(!in_array($ext, $allowed_exts)){
$error_msg = true;
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileWrongType"];
}
}
 
if($PHORUM["file_space_quota"]>0 && phorum_db_get_user_filesize_total($PHORUM["user"]["user_id"])+$_FILES["newfile"]["size"]>=$PHORUM["file_space_quota"]*1024){
$error_msg = true;
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileOverQuota"];
}
 
if(empty($error_msg)){
 
// read in the file
$fp=fopen($_FILES["newfile"]["tmp_name"], "r");
$buffer=base64_encode(fread($fp, $_FILES["newfile"]["size"]));
fclose($fp);
 
$file_id=phorum_db_file_save($PHORUM["user"]["user_id"], $_FILES["newfile"]["name"], $_FILES["newfile"]["size"], $buffer);
 
}
 
} elseif(!empty($_POST["delete"])) {
 
foreach($_POST["delete"] as $file_id){
 
phorum_db_file_delete($file_id);
 
}
 
}
 
$files = phorum_db_get_user_file_list($PHORUM["user"]["user_id"]);
 
$total_size=0;
 
foreach($files as $key => $file) {
$files[$key]["filesize"] = phorum_filesize($file["filesize"]);
$files[$key]["dateadded"]=phorum_date($PHORUM["short_date"], $file["add_datetime"]);
 
$files[$key]["url"]=phorum_get_url(PHORUM_FILE_URL, "file=$key");
 
$total_size+=$file["filesize"];
}
 
$template = "cc_files";
 
if($PHORUM["max_file_size"]){
$PHORUM["DATA"]["FILE_SIZE_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileSizeLimits"] . ' ' . phorum_filesize($PHORUM["max_file_size"]*1024);
}
 
if($PHORUM["file_types"]){
$PHORUM["DATA"]["FILE_TYPE_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileTypeLimits"];
}
 
if($PHORUM["file_space_quota"]){
$PHORUM["DATA"]["FILE_QUOTA_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileQuotaLimits"] . ' ' . phorum_filesize($PHORUM["file_space_quota"]*1024);;
}
 
$PHORUM["DATA"]["FILES"] = $files;
 
$PHORUM["DATA"]["TOTAL_FILES"] = count($files);
$PHORUM["DATA"]["TOTAL_FILE_SIZE"] = phorum_filesize($total_size);
 
} else {
$template = "message";
 
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["UploadNotAllowed"];
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/password.php
New file
0,0 → 1,35
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if(count($_POST)) {
if((isset($_POST["password"]) && !empty($_POST["password"]) && $_POST["password"] != $_POST["password2"]) || !isset($_POST["password"]) || empty($_POST['password'])) {
$error = $PHORUM["DATA"]["LANG"]["ErrPassword"];
} else {
$_POST['password_temp']=$_POST['password'];
list($error,$okmsg) = phorum_controlcenter_user_save($panel);
}
}
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["ChangePassword"];
$PHORUM['DATA']['PROFILE']['CHANGEPASSWORD'] = 1;
$template = "cc_usersettings";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/sig.php
New file
0,0 → 1,33
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if(count($_POST)) {
list($error,$okmsg) = phorum_controlcenter_user_save($panel);
$PHORUM["DATA"]["PROFILE"]["signature"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["signature"]);
}
 
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditSignature"];
 
$PHORUM['DATA']['PROFILE']['SIGSETTINGS'] = 1;
$template = "cc_usersettings";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/subthreads.php
New file
0,0 → 1,88
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
// remove threads fromlist
if(isset($_POST["delthreads"])){
foreach($_POST["delthreads"] as $thread){
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
}
}
 
// change any email settings
if(isset($_POST["sub_type"])){
foreach($_POST["sub_type"] as $thread=>$type){
if($type!=$_POST["old_sub_type"][$thread]){
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
phorum_user_subscribe( $PHORUM['user']['user_id'], $_POST["thread_forum_id"][$thread], $thread, $type );
}
}
}
 
// the number of days to show
if (isset($_POST['subdays']) && is_numeric($_POST['subdays'])) {
$subdays = $_POST['subdays'];
} elseif(isset($PHORUM['args']['subdays']) && !empty($PHORUM["args"]['subdays']) && is_numeric($PHORUM["args"]['subdays'])) {
$subdays = $PHORUM['args']['subdays'];
} else {
$subdays = 2;
}
 
$PHORUM['DATA']['SELECTED'] = $subdays;
 
// reading all subscriptions to messages
$subscr_array = phorum_db_get_message_subscriptions($PHORUM['user']['user_id'], $subdays);
 
// reading all forums
$forum_ids = $subscr_array['forum_ids'];
unset($subscr_array['forum_ids']);
$forums_arr = phorum_db_get_forums($forum_ids,-1,$PHORUM['vroot']);
$subscr_array_final = array();
foreach($subscr_array as $dummy => $data) {
if ($data['forum_id'] == 0) {
$data['forum'] = $PHORUM['DATA']['LANG']['Announcement'];
} else {
$data['forum'] = $forums_arr[$data['forum_id']]['name'];
}
 
$data['datestamp'] = phorum_date($PHORUM["short_date"], $data["modifystamp"]);
$data['readurl'] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $data["forum_id"], $data["thread"]);
 
if(!empty($data["user_id"])) {
$data["profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $data["user_id"]);
// we don't normally put HTML in this code, but this makes it easier on template builders
$data["linked_author"] = "<a href=\"".$data["profile_url"]."\">".htmlspecialchars($data["author"])."</a>";
} elseif(!empty($data["email"])) {
$data["email_url"] = phorum_html_encode("mailto:$data[email]");
// we don't normally put HTML in this code, but this makes it easier on template builders
$data["linked_author"] = "<a href=\"".$data["email_url"]."\">".htmlspecialchars($data["author"])."</a>";
} else {
$data["linked_author"] = htmlspecialchars($data["author"]);
}
 
$data["subject"]=htmlspecialchars($data["subject"]);
 
$subscr_array_final[] = $data;
}
 
$PHORUM['DATA']['subscriptions'] = $subscr_array_final;
$template = "cc_subscriptions";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/email.php
New file
0,0 → 1,115
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM_CONTROL_CENTER" ) ) return;
// need this for banlist-checks
include_once("./include/profile_functions.php");
 
// email-verification
if($PHORUM['registration_control']) {
//$PHORUM['DATA']['PROFILE']['email_temp']="email_address@bogus.com|bla";
if (!empty($PHORUM['DATA']['PROFILE']['email_temp'])) {
list($PHORUM['DATA']['PROFILE']['email_temp_part'],$bogus)=explode("|",$PHORUM['DATA']['PROFILE']['email_temp']);
}
}
 
if ( count( $_POST ) ) {
 
if ( empty( $_POST["email"] ) ) {
$error = $PHORUM["DATA"]["LANG"]["ErrRequired"];
} elseif (!phorum_valid_email( $_POST["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
} elseif ($PHORUM['user']['email'] != $_POST["email"] && phorum_user_check_email($_POST["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrEmailExists"];
} elseif (!phorum_check_ban_lists($_POST["email"], PHORUM_BAD_EMAILS)) {
$error = $PHORUM["DATA"]["LANG"]["ErrBannedEmail"];
} elseif (isset($PHORUM['DATA']['PROFILE']['email_temp_part']) && !empty($_POST['email_verify_code']) && $PHORUM['DATA']['PROFILE']['email_temp_part']."|".$_POST['email_verify_code'] != $PHORUM['DATA']['PROFILE']['email_temp']) {
$error = $PHORUM['DATA']['LANG']['ErrWrongMailcode'];
} else {
// flip this due to db vs. UI wording.
$_POST["hide_email"] = ( isset($_POST["hide_email"]) ) ? 0 : 1;
 
$_POST['moderation_email'] = ( isset($_POST['moderation_email']) && phorum_user_moderate_allowed(PHORUM_MODERATE_ALLOWED_ANYWHERE) ) ? 1 : 0;
 
// Remember this for the template.
if (isset($PHORUM['DATA']['PROFILE']['email_temp_part'])) {
$email_temp_part = $PHORUM['DATA']['PROFILE']['email_temp_part'];
}
 
// do we need to send a confirmation-mail?
if(isset($PHORUM['DATA']['PROFILE']['email_temp_part']) && !empty($_POST['email_verify_code']) && $PHORUM['DATA']['PROFILE']['email_temp_part']."|".$_POST['email_verify_code'] == $PHORUM['DATA']['PROFILE']['email_temp']) {
$_POST['email']=$PHORUM['DATA']['PROFILE']['email_temp_part'];
$_POST['email_temp']="";
unset($email_temp_part);
} elseif($PHORUM['registration_control'] && !empty($_POST['email']) && strtolower($_POST['email']) != strtolower($PHORUM["DATA"]["PROFILE"]['email'])) {
// ... generate the confirmation-code ... //
$conf_code= mt_rand ( 1000000, 9999999);
$_POST['email_temp']=$_POST['email']."|".$conf_code;
// ... send email ... //
$maildata=array(
'mailmessage' => wordwrap($PHORUM['DATA']['LANG']['EmailVerifyBody'], 72),
'mailsubject' => $PHORUM['DATA']['LANG']['EmailVerifySubject'],
'uname' => $PHORUM['DATA']['PROFILE']['username'],
'newmail' => $_POST['email'],
'mailcode' => $conf_code,
'cc_url' => phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_MAIL)
);
phorum_email_user(array($_POST['email']),$maildata);
 
// Remember this for the template.
$email_temp_part = $_POST['email'];
unset($_POST['email']);
}
list($error,$okmsg) = phorum_controlcenter_user_save( $panel );
}
}
 
if (isset($email_temp_part)) {
$PHORUM['DATA']['PROFILE']['email_temp_part'] = $email_temp_part;
}
 
// flip this due to db vs. UI wording.
if ( !empty( $PHORUM['DATA']['PROFILE']["hide_email"] ) ) {
$PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = "";
} else {
// more html stuff in the code. yuck.
$PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = " checked=\"checked\"";
}
 
if(phorum_user_moderate_allowed(PHORUM_MODERATE_ALLOWED_ANYWHERE)){
$PHORUM["DATA"]["PROFILE"]["show_moderate_options"] = true;
 
if ( !empty( $PHORUM['DATA']['PROFILE']["moderation_email"] ) ) {
$PHORUM["DATA"]["PROFILE"]["moderation_email_checked"] = " checked=\"checked\"";
} else {
$PHORUM["DATA"]["PROFILE"]["moderation_email_checked"] = "";
}
} else {
$PHORUM["DATA"]["PROFILE"]["show_moderate_options"] = false;
}
 
$PHORUM["DATA"]["PROFILE"]["EMAIL_CONFIRM"]=$PHORUM["registration_control"];
 
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditMailsettings"];
 
$PHORUM['DATA']['PROFILE']['MAILSETTINGS'] = 1;
$template = "cc_usersettings";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/messages.php
New file
0,0 → 1,108
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if (!$PHORUM["DATA"]["MESSAGE_MODERATOR"]) {
phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL));
exit();
}
 
// the number of days to show
if (isset($_POST['moddays']) && is_numeric($_POST['moddays'])) {
$moddays = (int)$_POST['moddays'];
} elseif(isset($PHORUM['args']['moddays']) && !empty($PHORUM["args"]['moddays']) && is_numeric($PHORUM["args"]['moddays'])) {
$moddays = (int)$PHORUM['args']['moddays'];
} else {
$moddays = 2;
}
 
 
if (isset($_POST['onlyunapproved']) && is_numeric($_POST['onlyunapproved'])) {
$showwaiting = (int)$_POST['onlyunapproved'];
} elseif(isset($PHORUM['args']['onlyunapproved']) && !empty($PHORUM["args"]['onlyunapproved']) && is_numeric($PHORUM["args"]['onlyunapproved'])) {
$showwaiting = (int)$PHORUM['args']['onlyunapproved'];
} else {
$showwaiting = 0;
}
$PHORUM['DATA']['SELECTED'] = $moddays;
$PHORUM['DATA']['SELECTED_2'] = $showwaiting?true:false;
 
// some needed vars
$numunapproved = 0;
$oldforum = $PHORUM['forum_id'];
 
$mod_forums = phorum_user_access_list(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
$gotforums = (count($mod_forums) > 0);
 
$PHORUM['DATA']['PREPOST'] = array();
 
if ($gotforums)
$foruminfo = phorum_db_get_forums($mod_forums,-1,$PHORUM['vroot']);
else
$foruminfo = array();
 
// Make sure we have a forum name for unapproved announcements.
$foruminfo[0] = array (
'name' => $PHORUM["DATA"]["LANG"]["Announcement"]
);
 
foreach($mod_forums as $forum => $rest) {
$checkvar = 1;
// Get the threads
$rows = array();
// get the thread set started
$rows = phorum_db_get_unapproved_list($forum,$showwaiting,$moddays);
// loop through and read all the data in.
foreach($rows as $key => $row) {
$numunapproved++;
$rows[$key]['forumname'] = $foruminfo[$forum]['name'];
$rows[$key]['checkvar'] = $checkvar;
if ($checkvar)
$checkvar = 0;
$rows[$key]['forum_id'] = $forum;
$rows[$key]["url"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $forum, $row["thread"], $row['message_id']);
// we need to fake the forum_id here
$PHORUM["forum_id"] = $forum;
$rows[$key]["approve_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
$rows[$key]["approve_tree_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
$rows[$key]["delete_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum);
$PHORUM["forum_id"] = $oldforum;
$rows[$key]["short_datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
 
if ($row["user_id"]) {
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
$rows[$key]["profile_url"] = $url;
$rows[$key]["linked_author"] = "<a href=\"$url\">$row[author]</a>";
} else {
$rows[$key]["profile_url"] = "";
$rows[$key]["linked_author"] = $row["author"];
}
}
// $PHORUM['DATA']['FORUMS'][$forum]['forum_id']=$forum;
$PHORUM['DATA']['PREPOST'] = array_merge($PHORUM['DATA']['PREPOST'], $rows);
}
 
 
if (!$numunapproved) {
$PHORUM["DATA"]["UNAPPROVEDMESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedMessages"];
}
 
$template = "cc_prepost";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/forum.php
New file
0,0 → 1,115
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM_CONTROL_CENTER" ) ) return;
 
function phorum_cc_get_language_info()
{
$langs = phorum_get_language_info();
$f_langs = array();
$profile = $GLOBALS['PHORUM']['DATA']['PROFILE'];
if ( !isset( $profile['user_language'] ) )
$defsel = " selected=\"selected\"";
else
$defsel = "";
$f_langs[] = array( 'file' => '', 'name' => $GLOBALS['PHORUM']['DATA']['LANG']['Default'], 'sel' => $defsel );
 
foreach( $langs as $entry => $name ) {
$sel = "";
if ( isset( $profile['user_language'] ) && $profile['user_language'] == $entry ) {
$sel = " selected=\"selected\"";
}
$f_langs[] = array( 'file' => $entry, 'name' => $name, 'sel' => $sel );
}
return $f_langs;
}
 
function phorum_cc_get_template_info()
{
$langs = phorum_get_template_info();
$profile = $GLOBALS['PHORUM']['DATA']['PROFILE'];
 
$f_langs = array();
if ( !isset( $profile['user_template'] ) )
$defsel = " selected=\"selected\"";
else
$defsel = "";
$f_langs[] = array( 'file' => '', 'name' => $GLOBALS['PHORUM']['DATA']['LANG']['Default'], 'sel' => $defsel );
 
foreach( $langs as $entry => $name ) {
$sel = "";
if ( isset( $profile['user_template'] ) && $profile['user_template'] == $entry ) {
$sel = " selected=\"selected\"";
}
$f_langs[] = array( 'file' => $entry, 'name' => $name, 'sel' => $sel );
}
return $f_langs;
}
 
if ( count( $_POST ) ) {
// dst is time + 1 hour
if(isset($_POST['tz_offset']) && $_POST['tz_offset'] != -99) {
if($_POST['tz_offset'] && isset($_POST['is_dst']) && $_POST['is_dst']) {
$_POST['tz_offset']=++$_POST['tz_offset']."";
}
}
// unsetting dst if not checked
if(!isset($_POST['is_dst'])) {
$_POST['is_dst']=0;
}
list($error,$okmsg) = phorum_controlcenter_user_save( $panel );
}
 
if ( isset( $PHORUM["user_time_zone"] ) ) {
$PHORUM['DATA']['PROFILE']['TZSELECTION'] = $PHORUM["user_time_zone"];
}
// compute the tz-array
if ( !isset( $PHORUM['DATA']['PROFILE']['tz_offset'] ) || $PHORUM['DATA']['PROFILE']['tz_offset'] == -99 ) {
$defsel = " selected=\"selected\"";
} else {
$defsel = "";
}
 
// remove dst from tz_offset
if(isset($PHORUM['DATA']['PROFILE']['is_dst']) && $PHORUM['DATA']['PROFILE']['is_dst']) {
$PHORUM['DATA']['PROFILE']['tz_offset']=--$PHORUM['DATA']['PROFILE']['tz_offset']."";
}
 
$PHORUM["DATA"]["TIMEZONE"][] = array( 'tz' => '-99', 'str' => $PHORUM['DATA']['LANG']['Default'], 'sel' => $defsel );
foreach( $PHORUM['DATA']['LANG']['TIME'] as $tz => $str ) {
if ( isset($PHORUM['DATA']['PROFILE']['tz_offset']) && $PHORUM['DATA']['PROFILE']['tz_offset'] === "$tz" ) {
$sel = " selected";
} else {
$sel = "";
}
$PHORUM["DATA"]["TIMEZONE"][] = array( 'tz' => $tz, 'str' => $str, 'sel' => $sel );
}
 
$PHORUM['DATA']['LANGUAGES'] = phorum_cc_get_language_info();
if ( isset( $PHORUM["user_template"] ) ) {
$PHORUM['DATA']['PROFILE']['TMPLSELECTION'] = $PHORUM["user_template"];
}
$PHORUM['DATA']['TEMPLATES'] = phorum_cc_get_template_info();
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditBoardsettings"];
$PHORUM['DATA']['PROFILE']['BOARDSETTINGS'] = 1;
$template = "cc_usersettings";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/groupmod.php
New file
0,0 → 1,160
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if (isset($PHORUM["args"]["group"])){
$perm = phorum_user_allow_moderate_group($PHORUM["args"]["group"]);
}
else{
$perm = $PHORUM["DATA"]["GROUP_MODERATOR"];
}
 
if (!$perm) {
phorum_redirect_by_url(phorum_get_url(PHORUM_CONTROLCENTER_URL));
exit();
}
 
// figure out what the user is trying to do, in this case we have a group to list (and maybe some commands)
if (isset($PHORUM["args"]["group"])){
// if adding a new user to the group
if (isset($_REQUEST["adduser"])){
$userid = phorum_db_user_check_field("username", $_REQUEST["adduser"]);
// load the users groups, add the new group, then save again
$groups = phorum_user_get_groups($userid);
// make sure the user isn't already a member of the group
if (!isset($groups[$PHORUM["args"]["group"]])){
$groups[$PHORUM["args"]["group"]] = PHORUM_USER_GROUP_APPROVED;
phorum_user_save_groups($userid, $groups);
$PHORUM["DATA"]["Message"] = $PHORUM["DATA"]["LANG"]["UserAddedToGroup"];
}
}
 
// if changing the existing members of the group
if (isset($_REQUEST["status"])){
foreach ($_REQUEST["status"] as $userid => $status){
// load the users groups, make the change, then save again
$groups = phorum_user_get_groups($userid);
// we can't set someone to be a moderator from here
if ($status != PHORUM_USER_GROUP_MODERATOR){
$groups[$PHORUM["args"]["group"]] = $status;
}
if ($status == PHORUM_USER_GROUP_REMOVE){
unset($groups[$PHORUM["args"]["group"]]);
}
phorum_user_save_groups($userid, $groups);
}
$PHORUM["DATA"]["Message"] = $PHORUM["DATA"]["LANG"]["ChangesSaved"];
}
 
$group = phorum_db_get_groups($PHORUM["args"]["group"]);
$PHORUM["DATA"]["GROUP"]["name"] = $group[$PHORUM["args"]["group"]]["name"];
$PHORUM["DATA"]["USERS"] = array();
$PHORUM["DATA"]["GROUP"]["url"] = phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"]);
$PHORUM["DATA"]["FILTER"] = array();
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["None"],
"enable" => !(!isset($PHORUM["args"]["filter"])),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"]));
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["Approved"],
"enable" => !(isset($PHORUM["args"]["filter"]) && $PHORUM["args"]["filter"] == PHORUM_USER_GROUP_APPROVED),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"], "filter=" . PHORUM_USER_GROUP_APPROVED));
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["PermGroupModerator"],
"enable" => !(isset($PHORUM["args"]["filter"]) && $PHORUM["args"]["filter"] == PHORUM_USER_GROUP_MODERATOR),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"], "filter=" . PHORUM_USER_GROUP_MODERATOR));
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["Suspended"],
"enable" => !(isset($PHORUM["args"]["filter"]) && $PHORUM["args"]["filter"] == PHORUM_USER_GROUP_SUSPENDED),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"], "filter=" . PHORUM_USER_GROUP_SUSPENDED));
$PHORUM["DATA"]["FILTER"][] = array("name" => $PHORUM["DATA"]["LANG"]["Unapproved"],
"enable" => !(isset($PHORUM["args"]["filter"]) && $PHORUM["args"]["filter"] == PHORUM_USER_GROUP_UNAPPROVED),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $PHORUM["args"]["group"], "filter=" . PHORUM_USER_GROUP_UNAPPROVED));
 
$PHORUM["DATA"]["STATUS_OPTIONS"] = array();
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_REMOVE, "name" => "&lt; " . $PHORUM["DATA"]["LANG"]["RemoveFromGroup"] . " &gt;");
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_APPROVED, "name" => $PHORUM["DATA"]["LANG"]["Approved"]);
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_UNAPPROVED, "name" => $PHORUM["DATA"]["LANG"]["Unapproved"]);
$PHORUM["DATA"]["STATUS_OPTIONS"][] = array("value" => PHORUM_USER_GROUP_SUSPENDED, "name" => $PHORUM["DATA"]["LANG"]["Suspended"]);
 
$groupmembers = phorum_db_get_group_members($PHORUM["args"]["group"]);
$usersingroup = array_keys($groupmembers);
$users = phorum_user_get($usersingroup);
$memberlist = array();
foreach ($groupmembers as $userid => $status){
// if we have a filter, check that the user is in it
if (isset($PHORUM["args"]["filter"])){
if ($PHORUM["args"]["filter"] != $status){
continue;
}
}
 
$disabled = false;
$statustext = "";
// moderators can't edit other moderators
if ($status == PHORUM_USER_GROUP_MODERATOR){
$disabled = true;
$statustext = $PHORUM["DATA"]["LANG"]["PermGroupModerator"];
}
 
$PHORUM["DATA"]["USERS"][$userid] = array("userid" => $userid,
"name" => $users[$userid]["username"],
"displayname" => $users[$userid]["username"],
"status" => $status,
"statustext" => $statustext,
"disabled" => $disabled,
"flag" => ($status < PHORUM_USER_GROUP_APPROVED),
"profile" => phorum_get_url(PHORUM_PROFILE_URL, $userid)
);
}
 
$PHORUM["DATA"]["USERS"] = phorum_hook("user_list", $PHORUM["DATA"]["USERS"]);
 
// if the option to build a dropdown list is enabled, build the list of members that could be added
if ($PHORUM["enable_dropdown_userlist"]){
$userlist = phorum_user_get_list();
$PHORUM["DATA"]["NEWMEMBERS"] = array();
 
foreach ($userlist as $userid => $userinfo){
if (!in_array($userid, $usersingroup)){
$PHORUM["DATA"]["NEWMEMBERS"][] = $userinfo;
}
}
}
}
 
 
// if they aren't doing anything, show them a list of groups they can moderate
else{
$PHORUM["DATA"]["GROUPS"] = array();
$groups = phorum_user_get_moderator_groups();
// put these things in order so the user can read them
asort($groups);
foreach ($groups as $groupid => $groupname){
// get the group members who are unapproved, so we can count them
$members = phorum_db_get_group_members($groupid, PHORUM_USER_GROUP_UNAPPROVED);
$PHORUM["DATA"]["GROUPS"][] = array("id" => $groupid,
"name" => $groupname,
"unapproved" => count($members),
"unapproved_url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $groupid, "filter=" . PHORUM_USER_GROUP_UNAPPROVED),
"url" => phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $groupid)
);
}
}
 
$template = "cc_groupmod";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/privacy.php
New file
0,0 → 1,53
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if(count($_POST)) {
 
// these two are flipped as we store if hidden in the db, but we ask if allowed in the UI
$_POST["hide_email"] = (isset($_POST["hide_email"]) && $_POST["hide_email"]) ? 0 : 1;
$_POST["hide_activity"] = (isset($_POST["hide_activity"]) && $_POST["hide_activity"]) ? 0 : 1;
list($error,$okmsg) = phorum_controlcenter_user_save($panel);
}
 
 
// these two are flipped as we store if hidden in the db, but we ask if allowed in the UI
 
if (!empty($PHORUM['DATA']['PROFILE']["hide_email"])) {
$PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = "";
} else {
// more html stuff in the code. yuck.
$PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = " checked=\"checked\"";
}
 
if (!empty($PHORUM['DATA']['PROFILE']["hide_activity"])) {
$PHORUM["DATA"]["PROFILE"]["hide_activity_checked"] = "";
} else {
// more html stuff in the code. yuck.
$PHORUM["DATA"]["PROFILE"]["hide_activity_checked"] = " checked=\"checked\"";
}
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditPrivacy"];
 
$PHORUM['DATA']['PROFILE']['PRIVACYSETTINGS'] = 1;
$template = "cc_usersettings";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/summary.php
New file
0,0 → 1,72
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
$template = "cc_start";
$PHORUM['DATA']['UserPerms'] = phorum_readable_permissions();
$PHORUM['DATA']['PROFILE']['date_added'] = phorum_date( $PHORUM['short_date'], $PHORUM['DATA']['PROFILE']['date_added']);
if( $PHORUM["track_user_activity"] &&
(!empty($PHORUM["user"]["admin"]) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS)) ||
!$user["hide_activity"])){
 
$PHORUM["DATA"]["PROFILE"]["date_last_active"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_last_active"]);
} else {
unset($PHORUM["DATA"]["PROFILE"]["date_last_active"]);
}
 
$PHORUM["DATA"]["PROFILE"]["username"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["username"]);
 
$PHORUM["DATA"]["PROFILE"] = phorum_hook("profile", $PHORUM["DATA"]["PROFILE"]);
/* --------------------------------------------------------------- */
 
function phorum_readable_permissions()
{
$PHORUM = $GLOBALS['PHORUM'];
$newperms = array();
 
if (isset($PHORUM["user"]["permissions"])) {
$forums = phorum_db_get_forums(array_keys($PHORUM["user"]["permissions"]));
 
foreach($PHORUM["user"]["permissions"] as $forum => $perms) {
if(isset($forums[$forum])) {
if($perms & PHORUM_USER_ALLOW_MODERATE_MESSAGES){
$newperms[] = array('forum' => $forums[$forum]["name"], 'perm' => $PHORUM['DATA']['LANG']['PermModerator']);
}
 
if($perms & PHORUM_USER_ALLOW_READ){
$newperms[] = array('forum' => $forums[$forum]["name"], 'perm' => $PHORUM['DATA']['LANG']['PermAllowRead']);
}
 
if($perms & PHORUM_USER_ALLOW_REPLY){
$newperms[] = array('forum' => $forums[$forum]["name"], 'perm' => $PHORUM['DATA']['LANG']['PermAllowReply']);
}
 
if($perms & PHORUM_USER_ALLOW_NEW_TOPIC){
$newperms[] = array('forum' => $forums[$forum]["name"], 'perm' => $PHORUM['DATA']['LANG']['PermAllowPost']);
}
}
}
}
 
return $newperms;
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/controlcenter/user.php
New file
0,0 → 1,36
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_CONTROL_CENTER")) return;
 
if(count($_POST)) {
list($error,$okmsg) = phorum_controlcenter_user_save($panel);
}
 
foreach($PHORUM["DATA"]["PROFILE"] as $key => $data) {
if(!is_array($data)) {
$PHORUM["DATA"]["PROFILE"][$key]=htmlspecialchars($data);
}
}
 
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditUserinfo"];
$PHORUM['DATA']['PROFILE']['USERPROFILE'] = 1;
$template = "cc_usersettings";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/lang/french.php
New file
0,0 → 1,657
<?php
## Traduction française pour Phorum 5.1.6a
## -----------------------------------------------------------------
## Version : 5.1.6a-FR-1.1.0
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 18/01/2006
## Modifications :
## * Modifications pour la version 5.1.6a
## * Les entrées données comme 'Deprecated' ont été maintenues
## * car elles sont dans english.php livré avec la 5.1.6a
## * et certaines sont nouvelles !?!
## * Quelques corrections d'orthographe et de sens
## -----------------------------------------------------------------
## Version : 5.0.20-FR-1.0.11
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 01/12/2005
## Modifications :
## * Remplacement de mél par adresse électronique ou courriel selon le contexte
## -----------------------------------------------------------------
## Version : 5.0.20-FR-1.0.10
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 22/11/2005
## Modifications :
## * Modification locale pour fr_FR
## -----------------------------------------------------------------
## Version : 5.0.20-FR-1.0.9
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 14/11/2005
## Modifications :
## * Correction orthographe : MsgRedirect
## * Remplacement de prévisualisation par aperçu
## * Modification de YouWantToFollow
## -----------------------------------------------------------------
## Version : 5.0.20-FR-1.0.8
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 24/10/2005
## Modifications :
## * Validation Phorum 5.0.20
## -----------------------------------------------------------------
## Version : 5.0.19-FR-1.0.7
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 24/10/2005
## Modifications :
## * Modification ConfirmReportMessage
## -----------------------------------------------------------------
## Version : 5.0.19-FR-1.0.6
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 19/10/2005
## Modifications :
## * Modification ViewJoinGroups
## * Modification DateActive
## * Modification DateReg
## -----------------------------------------------------------------
## Version : 5.0.19-FR-1.0.5
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 19/10/2005
## Modifications :
## * Validation sur Phorum 5.0.19
## -----------------------------------------------------------------
## Version : 5.0.16-FR-1.0.4
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 19/10/2005
## Modifications :
## * Remplacement de Unbookmark par Enlever le signet
## * Correction de quelques coquilles
## -----------------------------------------------------------------
## Version : 5.0.16-FR-1.0.2
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 15/07/2005
## Modifications :
## * Remplacement de "Soumettre" par "Appliquer"
## * Remplacement de "Conversation" par "Discussion"
## * Correction de quelques fautes d'orthographe
## * Modification de "VerifyRegEmailSubject"
## * Modification de "ViewJoinGroups"
## * Modification de "Anouncement"
## * Remplacement de "présider" par "modérer" (moins pompeux 8))
## -----------------------------------------------------------------
## Version : 5.0.15a-FR-1.0.11
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 23 avril 2005
## Modifications :
## * Modification des formats de date
## * Modification de la valeur pour "LOCALE"
## * Modif "ListForums"
## * Modif "ListThreads"
## -----------------------------------------------------------------
## Version : 5.0.15a-FR-1.0.10
## Auteur : Renaud Flavigny
## Contact : renaud dot flavigny at free dot fr
## Date : 22 avril 2005
## Modifications :
## * Remplacement de Informations personnelles par Profil pour faire plus court
## * Correction d'accentuation et de fautes d'orthographes
## * Remplacement de encore par Ressaisir pour le mot clef again utilisé pour la saisie du mot de passe
$language="Français";
// uncomment this to hide this language from the user-select-box
//$language_hide=1;
// check the php-docs for the syntax of these entries (http://www.php.net/manual/en/function.strftime.php)
// One tip, don't use T for showing the time zone as users can change their time zone.
$PHORUM['long_date']="%a %e %B %Y %H:%M:%S";
$PHORUM['short_date']="%d/%m/%y %H:%M";
// locale setting for localized times/dates
// see that page: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
// for the needed string
$PHORUM['locale']="fr_FR";
// charset for use in converting html into safe valid text
// also used in the header template for the <xml> and for
// the Content-Type header. for a list of supported charsets, see
// http://www.php.net/manual/en/function.htmlentities.php
// you may also need to set a meta tag with a charset in it.
$PHORUM["DATA"]['CHARSET']="iso-8859-1";
 
// some languages need additional meta tags
// to set encoding, etc.
$PHORUM["DATA"]['LANG_META']="";
 
// encoding set for outgoing mails
$PHORUM["DATA"]["MAILENCODING"]="8bit";
 
/*-----------------------------------------------------*/
 
$PHORUM["DATA"]["LANG"]=array(
 
"AccountSummaryTitle" => "Mes préférences",
"Action" => "Action",
"Activity" => "Montrer seulement les envois de moins de",
"Add" => "Ajouter",
"AddSig" => "Ajouter ma signature à cet envoi.",
"AddSigDefault" => "Choisir &quot;Ajouter ma signature&quot; par défaut",
"AddToGroup" => "Ajouter un nouveau membre au groupe :",
"AdminOnlyMessage" => "Ce forum est actuellement indisponible. Cette situation est temporaire. Réessayez plus tard.",
"again" => "Ressaisir",
"AllDates" => "Toutes les dates",
"AllNotShown" => "Tous les messages cachés",
"AllowReplies" => "Les réponses sont autorisées",
"AllWords" => "Tous les mots",
"AllowSeeActivity" => "Permettre que les autres voient lorsque je suis connecté",
"AllowSeeEmail" => "Permettre que les autres voient mon adresse électronique",
"Announcement" => "Avis ",
"AnonymousUser" => "Utilisateur anonyme",
"AnyWord" => "Mot quelconque",
"Approved" => "Validé",
"ApproveUser" => "Valider",
"ApproveMessageShort" => "Valider",
"ApproveMessage" => "Valider le message",
"ApproveMessageReplies" => "Valider le message et les réponses",
"AreYouSure" => "&Ecirc;tes-vous sûr ?",
"Attach" => "Joindre",
"AttachAFile" => "Joindre un fichier",
"AttachAnotherFile" => "Joindre un autre fichier",
"AttachCancel" => "Votre envoi a été refusé.",
"AttachDone" => "Les fichiers ont été joints",
"AttachFiles" => "Joindre des fichiers",
"AttachFileTypes" => "Types de fichier autorisés :",
"AttachFileSize" => "La taille d'un fichier ne peut pas excéder",
"AttachMaxAttachments" => "%count% fichiers supplémentaires peuvent être joints à ce message",
"AttachTotalFileSize" => "L'ensemble des fichiers ne peut excéder %size%",
"AttachInstructions" => "Après avoir joint les fichiers, cliquez sur Envoyer",
"AttachInvalidType" => "Ce fichier n'est pas autorisé",
"AttachFull" => "Vous avez atteint le nombre maximum de pièces jointes.",
"AttachInfo" => "Votre envoi sera sauvegardé sur le serveur. Vous avez la possibilité de le modifier à nouveau avant qu'il ne soit publié.",
"AttachmentAdded" => "Votre fichier a été joint au message",
"Attachments" => "Pièces jointes",
"AttachmentsMissing" => "L'adjonction de fichiers a échoué, recommencez.",
"AttachNotAllowed" => "Désolé, vous ne pouvez pas joindre de fichiers à ce message.",
"Author" => "Auteur",
 
"BacktoForum" => "Retourner au Forum",
"BackToForumList" => "Retourner à la liste des forums",
"BackToList" => "Cliquer pour retourner à la liste des messages.",
"BackToThread" => "Cliquer pour retourner à la discussion.",
"BackToSearch" => "Cliquer pour retourner à la recherche.",
"BookmarkedThread" => "Vous suivez la discussion dans votre centre de commande.",
"Buddies" => "Contacts",
"Buddy" => "Contact",
"BuddyAdd" => "Ajouter l'utilisateur à mes contacts",
"BuddyAddFail" => "L'utilisateur ne peut être ajouté à vos contacts",
"BuddyAddSuccess" => "L'utilisateur a été ajouté à vos contacts",
"BuddyListIsEmpty" => "Votre liste de contacts est vide.<br/>Pour ajouter un utilisateur, allez dans son profil et cliquez sur \"Ajouter l'utilisateur à mes contacts\".",
"by" => "par",
"Cancel" => "Annuler",
"CancelConfirm" => "&Ecirc;tes-vous sûr de vouloir annuler ?",
"CannotBeRunFromBrowser" => "Cette procédure ne peut être exécutée depuis un butineur.",
"ChangeEMail" => "Changer d'adresse électronique",
"ChangePassword" => "Changer de mot de passe",
"ChangesSaved" => "Les modifications n'ont pas été enregistrées.",
"CheckToDelete" => "Cocher pour supprimer",
"ClickHereToLogin" => "Cliquer ici pour s'identifier",
"CloseThread" => "Fermer cette discussion",
"ConfirmDeleteMessage" => "&Ecirc;tes vous sûr de vouloir supprimer ce message ?",
"ConfirmDeleteThread" => "&Ecirc;tes vous sûr de vouloir supprimer cette discussion ?",
"ConfirmReportMessage" => "&Ecirc;tes vous sûr de vouloir signaler cet envoi ?",
"CurrentPage" => "Page courante",
 
"Date" => "Date",
"DateActive" => "Dernière connexion",
"DateAdded" => "Date ajoutée",
"DatePosted" => ", envoyé dernièrement",
"DateReg" => "Date d'enregistrement",
"Day" => "Jour",
"Days" => "Jours",
"Default" => "Défaut",
"DeleteAnnouncementForbidden" => "Désolé, seul un administrateur peut supprimer un avis.",
"MoveAnnouncementForbidden" => "Les avis ne peuvent être déplacés.",
"DeleteMessage" => "Supprimer le message",
"DeleteMessageShort" => "Suppr",
"DelMessReplies" => "Supprimer le message et les réponses",
"DelMessRepliesShort" => "Suppr+",
"Delete" => "Supprimer",
"DeletePost" => "Supprimer l'envoi",
"DeleteThread" => "Supprimer la discussion",
"DenyUser" => "Refuser",
"Detach" => "Supprimer",
"EditBoardsettings" => "Options de Forum",
"EditFolders" => "Modifier les dossiers",
"EditPost" => "Modifier l'envoi",
"EditPostForbidden" => "Vous n'avez pas la permission de modifier cet envoi. Si l'administrateur a limité la période de modification, elle est peut-être expirée.",
"EditedMessage" => "Modifié %count% fois. Dernière modification le %lastedit% par %lastuser%.",
"EditMailsettings" => "Modifier mon adresse électronique",
"EditMyFiles" => "Modifier mes fichiers",
"EditPrivacy" => "Modifier mes options privées",
"EditSignature" => "Modifier ma signature",
"EditUserinfo" => "Modifier mon profil",
"EmailReplies" => "Envoyer les réponses à cette discussion via ma messagerie électronique",
"Email" => "Adresse électroniques",
"EmailConfirmRequired" => "Confirmation par courriel obligatoire.",
"EmailVerify" => "Contrôle de courriel",
"EmailVerifyDesc" => "Contrôle des nouvelles adresses électroniques",
"EmailVerifyEnterCode" => "Entrez le code de contrôle qui vous a été fourni.",
"EmailVerifySubject" => "Contrôle de votre nouvelle adresse électronique",
"EmailVerifyBody" => "Bonjour %uname%,\n\nCe message vous parvient car vous avez demandé une modification de votre adresse électronique dans votre profil. Pour confirmer que cette adresse est valide, ce message contient un code de confirmation.\nN'en tenez pas compte si vous n'étes pas %uname%.\n\nLa nouvelle adresse électronique est : %newmail%\nLe code de confirmation est : %mailcode%\n\nSaisissez ce code dans votre profil pour confirmer cette adresse électronique :\n\t\t<%cc_url%>",
"EnableNotifyDefault" => "Activer la notification par courriel par défaut",
"EnterToChange" => "Entrer pour changer",
"Error" => "Erreur",
"ErrInvalid" => "Les données sont invalides.",
"ErrAuthor" => "Renseignez le champ Auteur.",
"ErrSubject" => "Renseignez le champ Sujet.",
"ErrBody" => "Renseignez le corps du message.",
"ErrBodyTooLarge" => "Réduisez vos messages, le corps est trop grand.",
"ErrEmail" => "L'adresse électronique saisie semble incorrecte. Essayez à nouveau.",
"ErrEmailExists" => "L'adresse électronique saisie est enregistrée avec un autre utilisateur.",
"ErrUsername" => "Renseignez le champ Utilisateur.",
"ErrPassword" => "Soit le champ Mot de passe est vide soit il est incorrect. Recommencez.",
"ErrUserAddUpdate" => "Utilisateur non ajouté ou modifié. Erreur inconnue.",
"ErrRequired" => "Renseignez tous les champs obligatoires.",
"ErrBannedContent" => 'Un mot utilisé dans votre envoi est interdit. Utilisez un mot différent ou contactez les administrateurs.',
"ErrBannedIP" => "Vous ne pouvez pas faire d'envois car votre adresse IP ou votre FAI a été bloqué. Contactez les administrateurs du forum.",
"ErrBannedName" => "Vous ne pouvez pas faire d'envois car le nom utilisé est banni. Utilisez un nom différent ou contactez les administrateurs.",
"ErrBannedEmail" => "Vous ne pouvez pas faire d'envois car l'adresse électronique utilisée est bannie. Utilisez une autre adresse électronique ou contactez les administrateurs.",
"ErrBannedUser" => 'L\'utilisateur "%name%" a été interdit.',
 
"ErrRegisterdEmail" => "L'adresse électronique saisie est utilisée par un utilisateur enregistré. Si vous étes cet utilisateur, identifiez vous, sinon utilisez une autre adresse électronique.",
"ErrRegisterdName" => "Le nom saisi est utilisé par un autre utilisateur enregistré. Si vous êtes cet utilisateur, identifiez vous, sinon utilisez un autre nom.",
"ExactPhrase" => "Phrase exacte",
 
"FileForbidden" => "Les liens vers les fichiers de ce forum ne sont pas autorisés depuis l'extérieur du forum.",
"FileSizeLimits" => "Merci de ne pas transférer de fichiers supérieurs à {$PHORUM['max_file_size']}k.",
"FileQuotaLimits" => "Vous ne pouvez pas stocker plus de {$PHORUM['file_space_quota']}k sur le serveur.",
"FileTypeLimits" => "Seuls les types de fichiers suivants peuvent être transférés : " . str_replace(";", ", ", $PHORUM['file_types']) . ".",
"Filename" => "Nom du fichier",
"FileOverQuota" => "Votre fichier ne peut être transféré. La taille de ce fichier vous fait dépasser votre quota. Vous ne pouvez stocker plus de {$PHORUM['file_space_quota']}k sur le serveur.",
"Files" => "Mes fichiers",
"Filesize" => "Taille du fichier",
"FileTooLarge" => "le fichier est trop grand pour être transféré. Ne tranférez pas de fichiers plus grands que {$PHORUM['max_file_size']}k",
"FileWrongType" => "Le serveur ne permet pas le transfert de fichiers de ce type. Les types permis sont : " . str_replace(";", ", ", $PHORUM['file_types']) . ".",
"Filter" => "Filtre",
"FirstPage" => "Première page",
"Folders" => "Dossiers",
"FollowExplanation" => "Les discussions suivies sont dans votre centre de commande.<br />Vous pouvez choisir de recevoir un courriel lorsque la discussion est mise à jour.",
"FollowExplination" => "Les discussions suivies sont dans votre centre de commande.<br />Vous pouvez choisir de recevoir un courriel lorsque la discussion est mise à jour.",
"FollowThread" => "Suivre cette discussion",
"FollowWithEmail" => "Voulez vous recevoir un courriel lorsque cette discussion sera mise à jour ?",
"Forum" => "Forum",
"ForumFolder" => "Répertoire de forum",
"Forums" => "Forums",
"ForumList" => "Liste des Forums",
"From" => "De",
 
"Go" => "Aller",
"GoToTop" => "Messages récents",
"Goto" => "Aller à",
"GoToNew" => "Voir les nouveautés",
"GotoThread" => "Aller à une discussion",
"Group" => "Groupe",
"GroupJoinFail" => "Votre inscription au groupe a échoué.",
"GroupJoinSuccess" => "Vous avez rejoint le groupe.",
"GroupJoinSuccessModerated" => "Vous avez rejoint le groupe. Comme c'est un groupe modéré, votre participation doit être approuvée avant de prendre effet.",
"GroupMembership" => "Mes groupes",
"GroupMemberList" => "Liste des membres du groupe : ",
 
"Hidden" => "Caché",
"HideEmail" => "Cacher mon adresse électronique aux autres utilisateurs",
"HideMessage" => "Cacher le message et les réponses",
"HowToFollowThreads" => "Vous pouvez suivre la discussion en cliquant \"Suivre cette discussion\" lorsque vous lisez un message. De plus, si vous sélectionnez \"Envoyer les réponses à cette discussion via un courriel \" lorsque vous créez un envoi, le message sera ajouté à la liste des discussion que vous suivez.",
 
"INBOX" => "Boîte de réception",
"InReplyTo" => "En réponse à",
"InvalidLogin" => "Cet identifiant / mot de passe est introuvable ou inactif. Recommencez.",
"IPLogged" => "Adresse IP journalisée",
"IsDST" => "DST actif",
 
"Join" => "Rejoindre",
"JoinAGroup" => "Rejoindre un groupe",
"JoinGroupDescription" => "Pour rejoindre un groupe, sélectionner le dans la liste. Les groupes marqués d'un * sont modérés, votre adhésion devra être approuvée par un modérateur du groupe pour prendre effet.",
 
"KeepCopy" => "Garder une copie de mes éléments envoyés",
"Language" => "Langage",
"Last30Days" => "30 derniers jours",
"Last90Days" => "90 derniers jours",
"Last365Days" => "année dernière",
 
"LastPost" => "Dernier envoi",
"LastPostLink" => "Dernier envoi",
"LastPage" => "Dernière page",
"ListForums" => "Voir les forums",
"ListThreads" => "Voir les discussions suivies",
"LogIn" => "Identification",
"LogOut" => "Désidentification",
"LoginTitle" => "Saisissez votre nom d'utilisateur et votre mot de passe pour vous identifier.",
"LostPassword" => "Avez vous oublié votre mot de passe ?",
"LostPassError" => "L'adresse électronique saisie est introuvable.",
"LostPassInfo" => "Saisissez votre adresse électronique ci-dessous et un nouveau mot de passe vous sera transmis.",
"LostPassEmailSubject" => "Votre identification sur $PHORUM[title]",
"LostPassEmailBody1" => "Quelqu'un (nous espérons vous) a demandé un nouveau mot de passe pour votre compte sur $PHORUM[title]. Si ce n'est pas vous, ignorez ce courriel et continuez d'utiliser votre ancien mot de passe.\n\nSi c'est vous, voici votre nouvelle identification sur le forum.",
"LostPassEmailBody2" => "Vous pouvez vous identifier sur $PHORUM[title] à ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nMerci, $PHORUM[title]",
"LostPassSent" => "Un nouveau mot de passe a été envoyé à l'adresse fournie.",
 
"MakeSticky" => "Note",
"MakeAnnouncement" => "Avis",
"MarkForumRead" => "Marquer le forum comme lu",
"MarkRead" => "Marquer tous les messages comme lus",
"MarkThreadRead" => "Marquer la discussion comme lue",
"MatchAllForums" => "Chercher dans tous les forums",
"MatchThisForum" => "Chercher seulement dans ce forum",
"MatchAll" => "Tous les mots",
"MatchAny" => "N'importe quel mot",
"MatchPhrase" => "La phrase exacte",
"MembershipType" => "Type d'adhésion",
"MergeThread" => "Fusionner la discussion",
"MergeThreadCancel" => "Annuler la fusion",
"MergeThreads" => "Fusionner les discussions",
"MergeThreadAction" => "Les discussions suivantes peuvent être fusionnées en une seule",
"MergeThreadInfo" => "Maintenant, allez sur la discussion qui doit être fusionnée avec la discussion sélectionnée et faites 'Fusionner la discussion' à nouveau.",
"MergeThreadWith" => "Fusionner la discussion avec",
"MessageList" => "Liste des messages",
"MessageNotFound" => "Désolé, le message demandé est introuvable.",
"Message" => "Message",
"Moderate" => "Modérer",
"Moderator" => "Modérateur",
"ModeratedForum" => "C'est un forum modéré. Votre message restera caché jusqu'à ce qu'il soit approuvé par un modérateur ou un administrateur.",
"ModFuncs" => "Fonctions du modérateur",
"ModerationMessage" => "Modération",
"Month" => "Mois",
"Months" => "Mois",
"MoreMatches" => "Plus de correspondances",
"MovedSubject" => "Déplacé",
"MovedMessage" => "Cette discussion a été déplacée. Vous allez être redirigé vers son nouvel emplacement.",
"MovedMessageTo" => "Vers l'emplacement actuel de cette discussion.",
"MoveNotification" => "Laisser un avis de déplacement",
"MoveThread" => "Déplacer la discussion",
"MoveThreadTo" => "Déplacer la discussion vers le forum",
"MsgApprovedOk" => "Message(s) approuvé(s)",
"MsgDeletedOk" => "Message(s) supprimé(s)",
"MsgHiddenOk" => "Message(s) caché(s)",
"MsgMergeCancel" => "'Fusionner les discussions' a été annulé.",
"MsgMergeOk" => "Les discussions ont été fusionnées en une seule.",
"MsgMoveOk" => "La discussion a été déplacée vers le forum indiqué.",
"MsgRedirect" => "Vous allez être redirigé pour continuer. Cliquez ici si vous n'étes pas redirigé automatiquement.",
"MsgModEdited" => "Le message modifié a été enregistré.",
"MsgSplitOk" => "La discussion a été scindée en deux.",
"Mutual" => "Mutuel",
"MyProfile" => "Mon Centre de Commande",
 
"Navigate" => "Navigation",
"NewMessage" => "Nouveau Message",
"NewModeratedMessage" => "Un nouveau message a été envoyé sur un forum que vous modérez.\nLe sujet est %subject%\nIl peut être relu et approuvé sur l'URL suivant\n%approve_url%\n\n",
"NewModeratedSubject" => "Nouveau message dans un forum modéré",
"NewUnModeratedMessage" => "Un nouveau message a été envoyé sur un forum que vous modérez.\nLe message a été envoyé par %author% Le sujet est %subject%\n. Il peut être lu sur l'URL suivant\n%read_url%\n\n",
"NewPrivateMessages" => "Vous avez de nouveaux messages privés",
"NewReplyMessage" => "Bonjour,\n\nVous recevez ce courriel car vous suivez la discussion :\n\n %subject%\n <%read_url%>\n\nPour arrêter de recevoir cette discussion, cliquez ici :\n<%remove_url%>\n\nPour arrêter de recevoir des courriels mais laisser cette discussion dans votre liste de suivi, cliquez ici :\n<%noemail_url%>\n\nPour voir les discussions que vous suivez, cliquez ici :\n<%followed_threads_url%>",
"NewReplySubject" => "[%forumname%] Nouvelle réponse: %subject%",
"NewTopic" => "Nouveau sujet",
"NewerMessages" => "Messages plus récents",
"NewerThread" => "Discussion plus récente",
"newflag" => "Nouveau",
"NextMessage" => "Message suivant",
"NextPage" => "Suivant",
"No" => "Non",
"NoForums" => "Désolé, aucun forum n'est visible ici.",
"NoMoreEmails" => "Vous ne recevrez plus de courriels quand cette discussion sera mise à jour.",
"None" => "Tout",
"NoPost" => "Désolé, vous n'avez pas la permission d'envoyer ou de répondre dans ce forum.",
"NoPrivateMessages" => "Vous n'avez pas de nouveau message privé",
"NoRead" => "Désolé, vous n'avez pas la permission de lire ce forum",
"NotRegistered" => "Pas encore enregistré ? Cliquez ici pour vous enregistrer maintenant.",
"NoResults" => "Aucun résultat trouvé.",
"NoResultsHelp" => "Votre recherche ne correspond à aucun message.<br /><br />Suggestions:<ul><li>Vérifiez que tous les mots sont correctement orthographiés.</li><li>Essayez des mots clefs différents.</li><li>Essayez des mots clefs plus généraux.</li><li>Essayez moins de mots clefs.</li></ul>",
"NoUnapprovedMessages" => "Il n'y a pas de messages non approuvés",
"NoUnapprovedUsers" => "Il n'y a pas d'utilisateurs non approuvés",
"OlderMessages" => "Messages plus anciens",
"OlderThread" => "Discussion plus ancienne",
"on" => "le", // as in: Posted by user on 01-01-01 01:01pm
"of" => "parmi", // as in: 1 - 5 of 458
"Options" => "Options",
 
"Pages" => "Aller à la Page",
"Password" => "Mot de passe",
"Past180Days" => "Depuis 180 jours",
"Past30Days" => "Depuis 30 jours",
"Past60Days" => "Depuis 60 jours",
"Past90Days" => "Depuis 90 jours",
"PastYear" => "Depuis un an",
"PeriodicLogin" => "Pour votre protection, vous devez confirmer votre identification lorsque vous avez quitter le site.",
"PermAdministrator" => "Vous êtes administrateur.",
"PermAllowPost" => "Permission d'envoyer",
"PermAllowRead" => "Permission de lire",
"PermAllowReply" => "Permission de répondre",
"PermGroupModerator" => "Modérateur pour l'adhésion au Groupe",
"Permission" => "Permission",
"PermModerator" => "Modérateur",
"PersProfile" => "Profil personnel",
"PleaseLoginPost" => "Désolé, seuls les utilisateurs enregistrés peuvent envoyer dans ce forum.",
"PleaseLoginRead" => "Désolé, seuls les utilisateurs enregistrés peuvent lire dans ce forum.",
"PMAddRecipient" => "Ajouter un destinataire",
"PMCloseMessage" => "Fermer",
"PMDeleteMessage" => "Supprimer ce message",
"PMDisabled" => "La messagerie privée est inactive.",
"PMFolderCreate" => "Créer un nouveau dossier",
"PMFolderExistsError" => "Impossible de créer le dossier, il existe déjà.",
"PMFolderCreateSuccess" => "Le dossier a été créé.",
"PMFolderIsEmpty" => "Il n'y a pas de message dans ce dossier.",
"PMFolderDelete" => "Supprimer le dossier",
"PMFolderDeleteExplain" => "<b>Attention :</b> Si vous supprimez un dossier, tous les messages contenus seront aussi supprimés ! Une fois supprimés, il ne sera pas possible de les récupérer. Si vous désirez conserver les messages, vous devez les déplacer dans un autre dossier.",
"PMFolderDeleteConfirm" => "&Ecirc;tes vous sûr de supprimer le dossier et tous les messages qu'il contient ?",
"PMFolderDeleteSuccess" => "Le dossier a été supprimé",
"PMFolderNotAvailable" => "Le dossier demandé n'est pas disponible",
"PMFolderRename" => "Renommer le dossier",
"PMFolderRenameTo" => "en",
"PMFolderRenameSuccess" => "Le dossier a été renommé",
"PMNoRecipients" => "Votre message n'a pas de destinataire",
"PMNotAvailable" => "Le message privé demandé n'est pas disponible.",
"PMNotifyEnableSetting" => "Prévenir par couriel des messages privés",
"PMNotifyMessage" => "Vous avez reçu un nouveau message privé.\n\n&Eacute;metteur : %author%\nSujet : %subject%\n\nVous pouvez lire ce message sur la page suivante :\n\n%read_url%\n\nThanks, $PHORUM[title]",
"PMNotifySubject" => "Nouveau message privé sur $PHORUM[title]",
"PMRead" => "Lu",
"PMUnread" => "Non lu",
"PMReply" => "Répondre",
"PMReplyToAll" => "Répondre à tous",
"PMRequiredFields" => "Vous devez fournir le sujet et le message.",
"PMSelectAFolder" => "Choisir un dossier ...",
"PMSelectARecipient" => "Choisir un destinataire ...",
"PMFromMailboxFull" => "Vous ne pouvez pas garder une copie de ce message.<br/>Votre boîte aux lettres est pleine.",
"PMMoveToFolder" => "Déplacer",
"PMNotSent" => "Votre message privé n'a pas été émis. Erreur inconnue.",
"PMSent" => "Votre message privé a été émis.",
"PMReadMessage" => "Lire le message",
"PMSpaceLeft" => "Vous pouvez encore enregistrer %pm_space_left% message(s) privé(s).",
"PMSpaceFull" => "Votre boîte aux lettres est pleine.",
"PMToMailboxFull" => "Le message ne peut être émis.<br/>La boîte aux lettres du destinataire '%recipient%' est pleine.",
"Post" => "Envoyer",
"Posted" => "Envoyé",
"Postedby" => "Envoyé par", // as in: Posted by user on 01-01-01 01:01pm
"PostErrorOccured" => "Une erreur est survenue durant l'envoi de ce message.",
"Posts" => "Envois",
"Preview" => "Aperçu",
"PreviewExplain" => "Aperçu avant publication.",
"PreviewNoClickAttach" => "Les pièces jointes ne peuvent pas être ouvertes depuis l'aperçu",
"PreviousMatches" => "Correspondances précédentes",
"PreviousMessage" => "Message précédent",
"PrevPage" => "Page précédente",
"PrivateMessages" => "Messages privés",
"PrivateReply" => "Répondre par message privé",
"ProfileUpdatedOk" => "Profil correctement mis à jour.",
 
"OnlyUnapproved" => "seulement les messages non approuvés",
 
"Quote" => "Citation",
"QuoteMessage" => "Citer ce Message",
 
"read" => "lu",
"ReadOnlyMessage" => "Ce forum est en lecture seule. C'est une situation temporaire. Réessayez plus tard.",
"ReadPrivateMessages" => "Lire les messages privés",
"RealName" => "Vrai nom",
"Received" => "Reçu",
"ReceiveModerationMails"=> "Je veux recevoir les couriels de modération",
"Recipients" => "destinataires",
"RegApprovedSubject" => "Votre compte a été approuvé.",
"RegApprovedEmailBody" => "Votre compte sur $PHORUM[title] a été approuvé. Vous pouvez vous identifier sur $PHORUM[title] à ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nMerci, $PHORUM[title]",
"RegAcctActive" => "Votre compte est maintenant actif.",
"RegBack" => "Cliquez ici pour vous identifier.",
"Register" => "Créer un nouveau profil",
"RegThanks" => "Merci de vous être enregistré.",
"RegVerifyEmail" => "Merci de vous être enregistré. Vous aller recevoir un courriel avec des instructions pour activer votre compte.",
"RegVerifyFailed" => "Désolé, il y a une erreur de vérification de votre compte. Assurez vous d'avoir bien utiliser la totalité de l'URL que vous avez reçu par courriel.",
"RegVerifyMod" => "Merci de vous être enregistré. L'approbation d'un modérateur est nécessaire à l'activation de votre compte. Vous recevrez un courriel après qu'un modérateur ait validé vos informations.",
"RemoveFollowed" => "Vous ne suivez plus cette discussion.",
"RemoveFromGroup" => "Retirer du groupe",
"ReopenThread" => "Réouvrir cette discussion",
"Reply" => "Repondre à ce message",
"ReportPostEmailBody" => "%reportedby% a signalé le message suivant..\n\n<%url%>\n------------------------------------------------------------------------\nForum: %forumname%\nSujet: %subject%\nAuteur: %author%\nIP: %ip%\nDate: %date%\n\n%body%\n\n------------------------------------------------------------------------\nPour supprimer ce message cliquer ici :\n<%delete_url%>\n\nPour cacher ce message cliquer ici :\n<%hide_url%>\n\nPour modifier ce message cliquer ici :\n<%edit_url%>\n\nLe profil personnel de %reportedby% est ici :\n<%reporter_url%>",
"ReportPostEmailSubject"=> "[%forumname%] Envoi signalé aux modérateurs",
"ReportPostExplanation" => "Vous pouvez joindre une explication au signalement de cet envoi. Elle sera transmise aux modérateurs avec l'alerte. Elle peut aider le modérateur a comprendre pourqoi vous signalez cet envoi.",
"ReportPostNotAllowed" => "Vous devez être identifié pour signaler un envoi.",
"ReportPostSuccess" => "Cet envoi a été signalé aux modérateurs du forum.",
"Required" => "éléments obligatoires",
"Results" => "Résultats",
"Report" => "Signaler ce message",
"RSS" => "RSS",
 
"SaveChanges" => "Enregistrer les modifications",
"ScriptUsage" => "Utilisation : php script.php [--module=<module_name> | --scheduled] [options]
--module=<module_name> Exécute le module spécifié.
--scheduled Exécute tous les modules qui ne nécessitent pas d'entrées (modules planifiés).
[options] Lors de l'exécution, ces options sont passées au module.
Consultez la documentation du module pour connaitre ses options.
Avec --scheduled, elles sont ignorées.\n",
"Search" => "Chercher",
"SearchAuthor" => "Auteur",
"SearchAuthors" => "Auteurs",
"SearchBody" => "Texte",
"SearchMessages" => "Chercher dans les messages",
"SearchResults" => "Résultats de recherche",
"SearchRunning" => "Recherche en cours, patientez.",
"SearchSubject" => "Sujet",
"SearchTip" => "AND est l'opérateur par défaut. Ainsi, une recherche pour chien et chat trouvera tous les messages qui contiennent ces mots n'importe où.<br /><br />Les guillemets (\") permettent la recherche de phrases. De cette façon, une recherche avec \"chien chat\" trouvera les messages qui contiennent la phrase exacte avec l'espace.<br /><br />Le moins (-) élimine des mots. Une recherche avec chien et -chat trouvera tous les messages qui contiennent chien mais pas chat. On peut utiliser le moins avec une phrase entre guillemets. Par exemple : chien -\"chat siamois\".<br /><br />Le moteur est insensible à la casse et recherche sur le titre, le corps et l'auteur.",
"SearchTips" => "Astuces de recherche",
"SelectGroupMod" => "Sélectionner un groupe à modérer",
"SelectForum" => "Sélectionner le Forum ...",
"SendPM" => "Envoyer un message privé",
"SentItems" => "Eléments envoyés",
"Showing" => "Montrer",
"ShowOnlyMessages" => "Montrer les messages",
"Signature" => "Signature",
"Special" => "Spécial",
"SplitThread" => "Scinder la discussion",
"SplitThreadInfo" => "Faire de ce message et de ses réponses une discussion.",
"SrchMsgBodies" => "Corps des messages (plus lent)",
"StartedBy" => "Commencé par",
"Sticky" => "Note ",
"Subject" => "Sujet",
"Submit" => "Appliquer",
"Subscribe" => "S'inscrire à ce Forum",
"Subscriptions" => "Discussions suivies",
"Suspended" => "Suspendu",
 
"Template" => "Modèle",
"ThankYou" => "Merci",
"ThreadAnnouncement" => "Vous ne pouvez pas répondre aux avis.",
"ThreadClosed" => "Cette discussion a été fermée",
"ThreadClosedOk" => "La discussion a été fermée.",
"Thread" => "Discussion",
"Threads" => "Discussions",
"ThreadReopenedOk" => "La discussion a été réouverte.",
"ThreadViewList" => "Survol des discussions - Liste",
"ThreadViewRead" => "Survol des discussions - Lues",
"Timezone" => "Fuseau horaire de l'utilisateur",
"To" => "à",
"Today" => "Aujourd'hui",
"Total" => "Total",
"TotalFiles" => "Total des fichiers",
"TotalFileSize" => "Espace utilisé",
"Unapproved" => "Non approuvé",
"UnapprovedGroupMembers" => "Il y a des adhésions non approuvées",
"UnapprovedMessage" => "Message non approuvé",
"UnapprovedMessages" => "Messages non approuvés",
"UnapprovedMessagesLong" => "Il y a des messages non approuvés",
"UnapprovedUsers" => "Utilisateurs non approuvés",
"UnapprovedUsersLong" => "Il y a des utilisateurs non approuvés",
"Unbookmark" => "Enlever le signet",
"UnknownUser" => "Cet utilisateur n'existe pas",
"Unsubscribe" => "Désabonner",
"UnsubscribeError" => "Vous ne pouvez pas vous désabonner de cette discussion.",
"UnsubscribeOk" => "Vous avez été désabonné de la discussion.",
"Update" => "Mettre à jour",
"UploadFile" => "Transférer un nouveau fichier",
"UploadNotAllowed" => "Vous n'étes pas autorisé à transférer des fichiers sur ce serveur.",
"UserAddedToGroup" => "L'utilisateur a été ajouté au groupe.",
"Username" => "Nom d'utilisateur",
"UserNotFound" => "Le destinataire de votre message est introuvable. Vérifiez le nom et recommencez.",
"UserPermissions" => "Permissions de l'utilisateur",
"UserProfile" => "Informations personnelles",
"UserSummary" => "Mon panneau de commande",
 
"VerifyRegEmailSubject" => "Validez votre inscription",
"VerifyRegEmailBody1" => "Pour valider votre compte sur $PHORUM[title], cliquer sur l'URL ci-dessous.",
"VerifyRegEmailBody2" => "Une fois controlé, vous pourrez vous identifier sur $PHORUM[title] à ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nMerci, $PHORUM[title]",
"ViewFlat" => "Vue à plat",
"ViewJoinGroups" => "Rejoindre un groupe",
"ViewProfile" => "Voir mon profil",
"ViewThreaded" => "Voir par discussion",
"Views" => "Vues",
 
"WrittenBy" => "Ecrit par",
"ErrWrongMailcode" => "Vous avez saisi un code de confirmation erroné. Recommencez !",
"Wrote" => "&Eacute;crivait",
 
"Year" => "Année",
"Yes" => "Oui",
"YourEmail" => "Votre adresse électronique",
"YourName" => "Votre nom",
"YouWantToFollow" => "Vous avez souhaité suivre cette discussion.",
);
// timezone-variables
$PHORUM["DATA"]["LANG"]["TIME"]=array(
"-12" => "(GMT - 12:00 hours) Enitwetok, Kwajalien",
"-11" => "(GMT - 11:00 hours) Midway Island, Samoa",
"-10" => "(GMT - 10:00 hours) Hawaii",
"-9" => "(GMT - 9:00 hours) Alaska",
"-8" => "(GMT - 8:00 hours) Pacific Time (US &amp; Canada)",
"-7" => "(GMT - 7:00 hours) Mountain Time (US &amp; Canada)",
"-6" => "(GMT - 6:00 hours) Central Time (US &amp; Canada), Mexico City",
"-5" => "(GMT - 5:00 hours) Eastern Time (US &amp; Canada), Bogota, Lima, Quito",
"-4" => "(GMT - 4:00 hours) Atlantic Time (Canada), Caracas, La Paz",
"-3.5" => "(GMT - 3:30 hours) Newfoundland",
"-3" => "(GMT - 3:00 hours) Brazil, Buenos Aires, Georgetown, Falkland Is.",
"-2" => "(GMT - 2:00 hours) Mid-Atlantic, Ascention Is., St Helena",
"-1" => "(GMT - 1:00 hours) Azores, Cape Verde Islands",
"0" => "(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia",
"1" => "(GMT + 1:00 hours) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome, Warsaw",
"2" => "(GMT + 2:00 hours) Kaliningrad, South Africa",
"3" => "(GMT + 3:00 hours) Baghdad, Riyadh, Moscow, Nairobi",
"3.5" => "(GMT + 3:30 hours) Tehran",
"4" => "(GMT + 4:00 hours) Abu Dhabi, Baku, Muscat, Tbilisi",
"4.5" => "(GMT + 4:30 hours) Kabul",
"5" => "(GMT + 5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent",
"5.5" => "(GMT + 5:30 hours) Bombay, Calcutta, Madras, New Delhi",
"6" => "(GMT + 6:00 hours) Almaty, Colomba, Dhakra",
"7" => "(GMT + 7:00 hours) Bangkok, Hanoi, Jakarta",
"8" => "(GMT + 8:00 hours) Beijing, Hong Kong, Perth, Singapore, Taipei",
"9" => "(GMT + 9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk",
"9.5" => "(GMT + 9:30 hours) Adelaide, Darwin",
"10" => "(GMT + 10:00 hours) Melbourne, Papua New Guinea, Sydney, Vladivostok",
"11" => "(GMT + 11:00 hours) Magadan, New Caledonia, Solomon Islands",
"12" => "(GMT + 12:00 hours) Auckland, Wellington, Fiji, Marshall Island",
);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/lang/english.php
New file
0,0 → 1,549
<?php
 
$language="English (American)";
// uncomment this to hide this language from the user-select-box
//$language_hide=1;
 
// check the php-docs for the syntax of these entries (http://www.php.net/manual/en/function.strftime.php)
// One tip, don't use T for showing the time zone as users can change their time zone.
$PHORUM['long_date']="%B %d, %Y %I:%M%p";
$PHORUM['short_date']="%m/%d/%Y %I:%M%p";
 
// locale setting for localized times/dates
// see that page: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
// for the needed string
$PHORUM['locale']="EN";
 
// charset for use in converting html into safe valid text
// also used in the header template for the <xml> and for
// the Content-Type header. for a list of supported charsets, see
// http://www.php.net/manual/en/function.htmlentities.php
// you may also need to set a meta tag with a charset in it.
$PHORUM["DATA"]['CHARSET']="iso-8859-1";
 
// some languages need additional meta tags
// to set encoding, etc.
$PHORUM["DATA"]['LANG_META']="";
 
// encoding set for outgoing mails
$PHORUM["DATA"]["MAILENCODING"]="8bit";
 
/*-----------------------------------------------------*/
 
$PHORUM["DATA"]["LANG"]=array(
 
"AccountSummaryTitle" => "My Settings",
"Action" => "Action",
"Activity" => "Only Show Post With Activity In The Last",
"Add" => "Add",
"AddSig" => "Add my signature to this post.",
"AddSigDefault" => "Enable &quot;Add my signature&quot; as default",
"AddToGroup" => "Add New Member To Group:",
"AdminOnlyMessage" => "This forum is currently disabled. This is a temporary situation. Please check back later.",
"again" => "again",
"AllDates" => "All Dates",
"AllNotShown" => "all hidden messages",
"AllowReplies" => "Replies are allowed",
"AllWords" => "All Words",
"AllowSeeActivity" => "Allow other users to see when I am logged in",
"AllowSeeEmail" => "Allow other users to see my email address",
"Announcement" => "Announcement",
"AnonymousUser" => "Anonymous User",
"AnyWord" => "Any Word",
"Approved" => "Approved",
"ApproveUser" => "Approve",
"ApproveMessageShort" => "Approve",
"ApproveMessage" => "Approve Message",
"ApproveMessageReplies" => "Approve +Replies",
"AreYouSure" => "Are you sure?",
"Attach" => "Attach",
"AttachAFile" => "Attach a file",
"AttachAnotherFile" => "Attach another file",
"AttachCancel" => "You post has been canceled.",
"AttachFiles" => "Attach Files",
"AttachFileTypes" => "Valid attachments: %types%",
"AttachFileSize" => "No file can be larger than %size%",
"AttachMaxAttachments" => "%count% more file(s) can be attached to this message",
"AttachTotalFileSize" => "All files together cannot be larger than %size%",
"AttachInstructions" => "When you are done attaching files, click Post",
"AttachInvalidType" => "That file is not a valid attachment.",
"AttachFull" => "You have reached the maximum allowed number of attachments.",
"AttachInfo" => "Your post will be saved on the server now. You will have the option to edit it again before it appears on the forum.",
"AttachmentAdded" => "Your file was successfully attached to your message",
"Attachments" => "Attachments",
"AttachmentsMissing" => "You failed to attach any files, please try again.",
"AttachNotAllowed" => "Sorry, you cannot attach files to this message.",
"Author" => "Author",
 
"BacktoForum" => "Back to Forum",
"BackToForumList" => "Back to Forum List",
"BackToList" => "Click here to return to the message list.",
"BackToThread" => "Click here to return to the thread.",
"BackToSearch" => "Click here to return to the search screen.",
"BookmarkedThread" => "You are now following this thread in your Control Center.",
"Buddies" => "Buddies",
"Buddy" => "Buddy",
"BuddyAdd" => "Add user to my buddy list",
"BuddyAddFail" => "The user could not be added to your buddy list",
"BuddyAddSuccess" => "The user has been added to your buddy list successfully",
"BuddyListIsEmpty" => "Your buddy list is empty.<br/>To add users, view their profile and click \"Add user to my buddy list\".",
"by" => "by",
 
"Cancel" => "Cancel",
"CancelConfirm" => "Are you sure you want to cancel?",
"CannotBeRunFromBrowser" => "This script cannot be run from a web browser.",
"ChangeEMail" => "Change Email",
"ChangePassword" => "Change Password",
"ChangesSaved" => "The changes have been saved.",
"CheckToDelete" => "Check To Delete",
"ClickHereToLogin" => "Click here to login",
"CloseThread" => "Close this Thread",
"ConfirmDeleteMessage" => "Are you sure you want to delete this message?",
"ConfirmDeleteThread" => "Are you sure you want to delete this thread?",
"ConfirmReportMessage" => "Are you sure you want to report this post?",
"CurrentPage" => "Current Page",
 
"Date" => "Date",
"DateActive" => "Last Activity",
"DateAdded" => "Date Added",
"DatePosted" => ", posted in the last",
"DateReg" => "Date Registered",
"Day" => "Day",
"Days" => "Days",
"Default" => "Default",
"DeleteAnnouncementForbidden" => "Sorry, only an Administrator may delete an announcement.",
"DeleteMessage" => "Delete Message",
"DeleteMessageShort" => "Del",
"DelMessReplies" => "Delete Message And Replies",
"DelMessRepliesShort" => "Del+",
"Delete" => "Delete",
"DeletePost" => "Delete Post",
"DeleteThread" => "Delete Thread",
"DenyUser" => "Deny",
"Detach" => "Delete",
 
"EditBoardsettings" => "Forum Settings",
"EditFolders" => "Edit Folders",
"EditPost" => "Edit Post",
"EditPostForbidden" => "You do not have permission to edit this post. If the administrator has set a time limit on editing, it may have expired.",
"EditedMessage" => "Edited %count% time(s). Last edit at %lastedit% by %lastuser%.",
"EditMailsettings" => "Edit Email Settings",
"EditMyFiles" => "Edit My Files",
"EditPrivacy" => "Edit My Privacy Options",
"EditSignature" => "Edit Signature",
"EditUserinfo" => "Edit My Profile",
"EmailReplies" => "Send replies to this thread to me via email",
"Email" => "Email",
"EmailConfirmRequired" => "Email confirmation required.",
"EmailVerify" => "Email Verification",
"EmailVerifyDesc" => "Verification of the new email-address",
"EmailVerifyEnterCode" => "Please enter the verification code you got",
"EmailVerifySubject" => "Verification of your new email-address",
"EmailVerifyBody" => "Hello %uname%,\n\nThis email is sent to you because you requested to change your email-address in your profile. To confirm that this is a valid email-address you are receiving this mail with your confirmation-code. You can simply ignore this mail if you are not %uname%.\n\nThe new email-address is: %newmail%\nThe confirmation code is: %mailcode%\n\nPlease enter the code in your profile to confirm the change:\n\n<%cc_url%>\n\nThanks, $PHORUM[title]",
"EnableNotifyDefault" => "Enable email-notification as default",
"EnterToChange" => "Enter To Change",
"Error" => "Error",
"ErrInvalid" => "Invalid data submitted.",
"ErrAuthor" => "Please fill in the author field.",
"ErrSubject" => "Please fill in the subject.",
"ErrBody" => "Please fill in the message body.",
"ErrBodyTooLarge" => "Please shorten your messages, the body is too large.",
"ErrEmail" => "The email address you entered does not appear to be a valid email address. Please try again.",
"ErrEmailExists" => "The email address you entered is already listed with another user.",
"ErrUsername" => "Please fill in the username field.",
"ErrPassword" => "Either the password field is empty or the passwords do not match. Please try again.",
"ErrUserAddUpdate" => "User not added/updated. Unknown error.",
"ErrRequired" => "Please fill in all required fields.",
"ErrBannedContent" => 'A word you have used in your post has been banned from use. Please use a different word or contact the forum administrators.',
"ErrBannedIP" => "Your IP address, domain or ISP has been blocked. Please contact the forum administrators.",
"ErrBannedName" => 'The (user)name "%name%" has been banned from use. Please use a different name or contact the forum administrators.',
"ErrBannedEmail" => 'The e-mail address "%name%" has been banned from use. Please use a different email address or contact the forum administrators.',
"ErrBannedUser" => 'The user "%name%" has been banned from use.',
 
"ErrRegisterdEmail" => "The email address you entered is listed with a currently registered user. If you are that user, please login. Otherwise, please use another email address.",
"ErrRegisterdName" => "The name you entered is already registered by another user. If you are that user, please login. Otherwise, please use another name.",
"ExactPhrase" => "Exact Phrase",
 
"FileForbidden" => "Linking to files in this forum is not allowed from outside the forum.",
"FileSizeLimits" => "Please do not upload files larger than",
"FileQuotaLimits" => "The maximum amount of diskspace you may use for storing files is",
"FileTypeLimits" => "Only the following file types may be uploaded: " . str_replace(";", ", ", $PHORUM['file_types']) . ".",
"Filename" => "File Name",
"FileOverQuota" => "Your file could not be uploaded. The size of this file would put you over your quota. You may not store more than {$PHORUM['file_space_quota']}k on the server.",
"Files" => "My Files",
"Filesize" => "File Size",
"FileTooLarge" => "The file you attempted to upload exceeds the maximum upload size. Please do not upload files larger than {$PHORUM['max_file_size']}k",
"FileWrongType" => "This server does not allow uploading of files of this type. Files types that are accepted: " . str_replace(";", ", ", $PHORUM['file_types']) . ".",
"Filter" => "Filter",
"FirstPage" => "First",
"Folders" => "Folder List",
"FollowExplanation" => "Followed threads are listed in your Control Center.<br />You can select to receive an email when the thread is updated.",
"FollowThread" => "Follow This Thread",
"FollowWithEmail" => "Email me when this thread is updated",
"Forum" => "Forum",
"ForumFolder" => "Forum Folder",
"Forums" => "Forums",
"ForumList" => "Forum List",
"From" => "From",
 
"Go" => "Go",
"GoToTop" => "Newest Messages",
"Goto" => "Goto",
"GoToNew" => "Go to new",
"GotoThread" => "Goto Thread",
"Group" => "Group",
"GroupJoinFail" => "Group could not be joined.",
"GroupJoinSuccess" => "Group joined successfully.",
"GroupJoinSuccessModerated" => "Group joined successfully. As this is a moderated group, your membership will need to be approved before taking effect.",
"GroupMembership" => "Group Membership",
"GroupMemberList" => "Group Member List: ",
 
"Hidden" => "Hidden",
"HideEmail" => "Hide my email address from other users",
"HideMessage" => "Hide Message and Replies",
"HowToFollowThreads" => "You can follow a thread by clicking \"Follow This Thread\" when reading a message. Also, if you select \"Send replies to this thread to me via email\" when creating a post, the message will be added to your followed thread list.",
 
"INBOX" => "Inbox",
"InReplyTo" => "In reply to",
"InvalidLogin" => "That username/password was not found or is inactive. Please try again.",
"IPLogged" => "IP Logged",
"IsDST" => "DST currently active",
 
"Join" => "Join",
"JoinAGroup" => "Join a Group",
"JoinGroupDescription" => "To join a group, select it from this list. Groups marked with an * are moderated, your membership request will require the approval of a Group Moderator to take effect.",
 
"KeepCopy" => "Keep A Copy In My Sent Items",
 
"Language" => "Language",
"Last30Days" => "Last 30 Days",
"Last90Days" => "Last 90 Days",
"Last365Days" => "Last Year",
 
"LastPost" => "Last Post",
"LastPostLink" => "Last Post",
"LastPage" => "Last",
"ListForums" => "List Forums",
"ListThreads" => "Show Followed Threads",
"LogIn" => "Log In",
"LogOut" => "Log Out",
"LoginTitle" => "Enter your username and password to log in.",
"LostPassword" => "Did you forget your password?",
"LostPassError" => "The email address you entered could not be found.",
"LostPassInfo" => "Enter your email address below and a new password will be sent to you.",
"LostPassEmailSubject" => "Your login information for the $PHORUM[title]",
"LostPassEmailBody1" => "Someone (hopefully you) has requested a new password for your account at $PHORUM[title]. If it was not you, you can ignore this email and continue using your old password.\n\nIf it was you, here is your new login for the forums.",
"LostPassEmailBody2" => "You can login to $PHORUM[title] at ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nThanks, $PHORUM[title]",
"LostPassSent" => "A new password has been sent to the email address you provided.",
 
"MakeSticky" => "Make Sticky",
"MakeAnnouncement" => "Make Announcement",
"MarkForumRead" => "Mark Forum Read",
"MarkRead" => "Mark All Messages Read",
"MarkThreadRead" => "Mark Thread Read",
"MatchAllForums" => "Search All Forums",
"MatchThisForum" => "Search Only This Forum",
"MatchAll" => "All Words",
"MatchAny" => "Any Words",
"MatchPhrase" => "Exact Phrase",
"MembershipType" => "Membership Type",
"MergeThread" => "Merge Thread",
"MergeThreadCancel" => "Cancel Merge Thread",
"MergeThreads" => "Merge Threads",
"MergeThreadAction" => "The following threads can be merged into one thread",
"MergeThreadInfo" => "Now go to the thread which should be merged with the selected thread and select 'Merge Thread' again.",
"MergeThreadWith" => "Merge Thread with",
"MessageList" => "Message List",
"MessageNotFound" => "Sorry, the message you have requested could not be found.",
"Message" => "Message",
"Moderate" => "Moderate",
"Moderator" => "Moderator",
"ModeratedForum" => "This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator",
"ModFuncs" => "Moderator Functions",
"ModerationMessage" => "Moderation",
"Month" => "Month",
"Months" => "Months",
"MoreMatches" => "More Matches",
"MoveAnnouncementForbidden" => "Announcement threads cannot be moved.",
"MovedSubject" => "Moved",
"MovedMessage" => "This thread has been moved. You will be redirected to its current location.",
"MovedMessageTo" => "To the current location of this thread.",
"MoveNotification" => "Leave behind a move notification",
"MoveThread" => "Move Thread",
"MoveThreadTo" => "Move Thread to Forum",
"MsgApprovedOk" => "Message(s) approved",
"MsgDeletedOk" => "Message(s) deleted",
"MsgHiddenOk" => "Message(s) hidden.",
"MsgMergeCancel" => "'Merge Threads' has been cancelled.",
"MsgMergeOk" => "The threads have been merged into one thread.",
"MsgMoveOk" => "The Thread was moved to the given Forum.",
"MsgRedirect" => "You are being redirected to continue, click here if you are not automatically redirected",
"MsgModEdited" => "The changed message has been saved.",
"MsgSplitOk" => "The Thread has been successfully split into two threads.",
"Mutual" => "Mutual",
"MyProfile" => "My Control Center",
 
"Navigate" => "Navigate",
"NewMessage" => "New Message",
"NewModeratedMessage" => "There has been a new message sent to a forum which you are moderating.\nThe message has the subject %subject%\nand it can be reviewed and approved through the following URL\n%approve_url%\n\n",
"NewModeratedSubject" => "New message in moderated forum",
"NewUnModeratedMessage" => "There has been a new message sent to a forum which you are moderating.\nThe message has been posted by %author% with the subject %subject%\nand it can be read through the following URL\n%read_url%\n\n",
"NewPrivateMessages" => "You have new private messages",
"NewReplyMessage" => "Hello,\n\nYou are receiving this email because you are following the thread:\n\n %subject%\n <%read_url%>\n\nTo stop following this thread click here:\n<%remove_url%>\n\nTo stop receiving emails, but leave this thread on your follow list, click here:\n<%noemail_url%>\n\nTo view your followed threads, click here:\n<%followed_threads_url%>",
"NewReplySubject" => "[%forumname%] New reply: %subject%",
"NewTopic" => "New Topic",
"NewerMessages" => "Newer Messages",
"NewerThread" => "Newer Thread",
"newflag" => "new",
"NextMessage" => "Next Message",
"NextPage" => "Next",
"No" => "No",
"NoForums" => "Sorry, no forums to show here.",
"NoMoreEmails" => "You will no longer receive emails when this thread is updated.",
"None" => "None",
"NoPost" => "Sorry, you do not have permission to post/reply in this forum.",
"NoPrivateMessages" => "You have no new private messages",
"NoRead" => "Sorry, you do not have permission to read this forum.",
"NotRegistered" => "Not Registered? Click here to register now.",
"NoResults" => "No results were found.",
"NoResultsHelp" => "Your search did not match any messages.<br /><br />Suggestions:<ul><li>Make sure all words are spelled correctly.</li><li>Try different keywords.</li><li>Try more general keywords.</li><li>Try fewer keywords.</li></ul>",
"NoUnapprovedMessages" => "There are currently no unapproved mesages",
"NoUnapprovedUsers" => "There are currently no unapproved users",
 
"OlderMessages" => "Older Messages",
"OlderThread" => "Older Thread",
"on" => "on", // as in: Posted by user on 01-01-01 01:01pm
"of" => "of", // as in: 1 - 5 of 458
"Options" => "Options",
 
"Pages" => "Goto Page",
"Password" => "Password",
"Past180Days" => "Past 180 Days",
"Past30Days" => "Past 30 Days",
"Past60Days" => "Past 60 Days",
"Past90Days" => "Past 90 Days",
"PastYear" => "Past Year",
"PeriodicLogin" => "For your protection, you are required to confirm your login information when you have been away from the site.",
"PermAdministrator" => "You are an Administrator.",
"PermAllowPost" => "post-permission",
"PermAllowRead" => "read-permission",
"PermAllowReply" => "reply-permission",
"PermGroupModerator" => "Group Membership Moderator",
"Permission" => "Permission",
"PermModerator" => "Moderator",
"PersProfile" => "Personal Profile",
"PleaseLoginPost" => "Sorry, only registered users may post in this forum.",
"PleaseLoginRead" => "Sorry, only registered users may read this forum.",
"PMAddRecipient" => "Add recipient",
"PMCloseMessage" => "Close",
"PMDeleteMessage" => "Delete This Message",
"PMDisabled" => "Private Messaging is disabled.",
"PMFolderCreate" => "Create new folder",
"PMFolderExistsError" => "Can't create folder. The folder already exists.",
"PMFolderCreateSuccess" => "The folder has been created successfully.",
"PMFolderIsEmpty" => "There are no messages in this folder.",
"PMFolderDelete" => "Delete folder",
"PMFolderDeleteExplain" => "<b>Warning:</b> if you delete a folder, all messages in the folder will be deleted as well! Once deleted, you will not be able to restore those messages. If you want to keep the messages, then you must move them to another folder.",
"PMFolderDeleteConfirm" => "Are you sure you want to delete the selected folder, including all messages in it?",
"PMFolderDeleteSuccess" => "The folder has been deleted successfully",
"PMFolderNotAvailable" => "The folder you requested is not available",
"PMFolderRename" => "Rename folder",
"PMFolderRenameTo" => "to",
"PMFolderRenameSuccess" => "The folder has been renamed successfully",
"PMNoRecipients" => "You have not specified any recipients for your message",
"PMNotAvailable" => "The private message you requested is not available.",
"PMNotifyEnableSetting" => "Enable e-mail notification for private messages",
"PMNotifyMessage" => "You have received a new private message.\n\nSent by : %author%\nSubject : %subject%\n\nYou can read the message at the following page:\n\n%read_url%\n\nThanks, $PHORUM[title]",
"PMNotifySubject" => "New private message on $PHORUM[title]",
"PMRead" => "Read",
"PMUnread" => "Unread",
"PMReply" => "Reply",
"PMReplyToAll" => "Reply to All",
"PMRequiredFields" => "Please provide a subject and a message.",
"PMSelectAFolder" => "Select folder ...",
"PMSelectARecipient" => "Select recipient ...",
"PMFromMailboxFull" => "You cannot keep a copy of this message.<br/>Your mail storage space is full.",
"PMMoveToFolder" => "Move",
"PMNotSent" => "Your private message was not sent. There was an unknown error.",
"PMSent" => "Your private message was sent successfully",
"PMReadMessage" => "Read message",
"PMSpaceLeft" => "You can store %pm_space_left% more private message(s).",
"PMSpaceFull" => "The storage space for your private messages is full.",
"PMToMailboxFull" => "The message could not be sent.<br/>The mail storage space for user '%recipient%' is full.",
"Post" => "Post message",
"Posted" => "Posted",
"Postedby" => "Posted by", // as in: Posted by user on 01-01-01 01:01pm
"PostErrorOccured" => "An error occured while trying to post this message.",
"Posts" => "Posts",
"Preview" => "Preview",
"PreviewExplain" => "This is how your message will appear in the forum.",
"PreviewNoClickAttach" => "Attachments can not be opened from the preview",
"PreviousMatches" => "Previous Matches",
"PreviousMessage" => "Previous Message",
"PrevPage" => "Previous",
"PrivateMessages" => "Private Messages",
"PrivateReply" => "Reply via PM",
"ProfileUpdatedOk" => "Profile successfully updated.",
"OnlyUnapproved" => "only unapproved messages",
"Quote" => "Quote",
"QuoteMessage" => "Quote This Message",
 
"read" => "read",
"ReadOnlyMessage" => "This forum is currently read only. This is a temporary situation. Please check back later.",
"ReadPrivateMessages" => "Read Private Messages",
"RealName" => "Real Name",
"Received" => "Received",
"ReceiveModerationMails"=> "I want to receive moderation emails",
"Recipients" => "recipients",
"RegApprovedSubject" => "Your account has been approved.",
"RegApprovedEmailBody" => "Your $PHORUM[title] account has been approved. You can login to $PHORUM[title] at ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nThanks, $PHORUM[title]",
"RegAcctActive" => "Your account is now active.",
"RegBack" => "Click here to login.",
"Register" => "Create A New Profile",
"RegThanks" => "Thank you for registering.",
"RegVerifyEmail" => "Thank you for registering. You will receive an email shortly with instruction for activating your account.",
"RegVerifyFailed" => "Sorry, there was an error verifying your account. Please make sure you used the entire URL included in the email you received.",
"RegVerifyMod" => "Thank you for registering. Approval from a moderator is required to activate your account. You will receive an email after a moderator has reviewed your information.",
"RemoveFollowed" => "You are no longer following this thread.",
"RemoveFromGroup" => "Remove From Group",
"ReopenThread" => "Reopen this Thread",
"Reply" => "Reply To This Message",
"ReportPostEmailBody" => "%reportedby% has reported a message. The reason given was: \n------------------------------------------------------------------------\n%explanation%\n\n<%url%>\n------------------------------------------------------------------------\nForum: %forumname%\nSubject: %subject%\nAuthor: %author%\nIP: %ip%\nDate: %date%\n\n%body%\n\n------------------------------------------------------------------------\nTo delete this message click here:\n<%delete_url%>\n\nTo hide this message click here:\n<%hide_url%>\n\nTo edit this message click here:\n<%edit_url%>\n\nThe profile for %reportedby% is here:\n<%reporter_url%>",
"ReportPostEmailSubject"=> "[%forumname%] Post reported to the moderators",
"ReportPostExplanation" => "You may optionally give an explanation for why this post was reported, which will be sent to the moderators along with the report. This can help the moderator to understand why you reported the post.",
"ReportPostNotAllowed" => "You must be logged in to report a post.",
"ReportPostSuccess" => "This post has been reported to the forum moderators.",
"Required" => "Required Items",
"Results" => "Results",
"Report" => "Report This Message",
"RSS" => "RSS",
 
"SaveChanges" => "Save Changes",
"ScriptUsage" => "\nUsage: php script.php [--module=<module_name> | --scheduled] [options]
 
--module=<module_name> Run the 'external' hook in the specified module.
--scheduled Run the 'scheduled' hooks in all available modules.
[options] When running a specific module, these options
are passed to the module. Consult the module
documentation for information on what options
it has. When using --scheduled, these are ignored.
 
Read docs/creating_mods.txt in your distribution for information on how
to write Phorum modules and on how to use the external and scheduled hooks.\n\n",
"SearchAuthors" => "Search Authors",
"SearchResults" => "Search Results",
"Search" => "Search",
"SearchMessages" => "Search Messages",
"SearchRunning" => "Your search is running, please be patient.",
"SelectGroupMod" => "Select a group to moderate",
"SelectForum" => "Select the Forum ...",
"SendPM" => "Send A Private Message",
"SentItems" => "Sent Items",
"Showing" => "Showing",
"ShowOnlyMessages" => "Show",
"Signature" => "Signature",
"Special" => "Special",
"SplitThread" => "Split Thread",
"SplitThreadInfo" => "Move this message and its replies to be its own thread",
"SrchMsgBodies" => "Message Bodies (slower)",
"StartedBy" => "Started By",
"Sticky" => "Sticky",
"Subject" => "Subject",
"Submit" => "Submit",
"Subscribe" => "Subscribe To This Forum",
"Subscriptions" => "Followed Threads",
"Suspended" => "Suspended",
 
"Template" => "Template",
"ThankYou" => "Thank You",
"ThreadAnnouncement" => "You can't reply to announcements.",
"ThreadClosed" => "This Thread has been closed",
"ThreadClosedOk" => "The Thread has been closed.",
"Thread" => "Thread",
"Threads" => "Threads",
"ThreadReopenedOk" => "The Thread has been reopened.",
"ThreadViewList" => "Thread Override - List",
"ThreadViewRead" => "Thread Override - Read",
"Timezone" => "User-Timezone",
"To" => "To",
"Today" => "Today",
"Total" => "Total",
"TotalFiles" => "Total Files",
"TotalFileSize" => "Space Used",
 
"Unapproved" => "Unapproved",
"UnapprovedGroupMembers" => "There are unapproved group memberships",
"UnapprovedMessage" => "Unapproved Message",
"UnapprovedMessages" => "Unapproved Messages",
"UnapprovedMessagesLong" => "There are unapproved messages",
"UnapprovedUsers" => "Unapproved Users",
"UnapprovedUsersLong" => "There are unapproved users",
"Unbookmark" => "Unbookmark",
"UnknownUser" => "This user doesn't exist or has been deactivated.",
"Unsubscribe" => "Unsubscribe",
"UnsubscribeError" => "You couldn't get unsubscribed from that thread.",
"UnsubscribeOk" => "You were unsubscribed from the given thread.",
"Update" => "Save changes",
"UploadFile" => "Upload A New File",
"UploadNotAllowed" => "You are not allowed to upload files to this server.",
"UserAddedToGroup" => "The user has been added to the group.",
"Username" => "Username",
"UserNotFound" => "The user you want to send a message to could not be found. Please check the name and try again.",
"UserPermissions" => "User Permissions",
"UserProfile" => "User Profile",
"UserSummary" => "My Control Panel",
 
"VerifyRegEmailSubject" => "Please verify your account",
"VerifyRegEmailBody1" => "To validate your $PHORUM[title] account, please click on the URL below.",
"VerifyRegEmailBody2" => "Once verified, you can login to $PHORUM[title] at ".phorum_get_url(PHORUM_LOGIN_URL)."\n\nThanks, $PHORUM[title]",
"ViewFlat" => "View Flat",
"ViewJoinGroups" => "View and Join Groups",
"ViewProfile" => "View My Profile",
"ViewThreaded" => "View Threaded",
"Views" => "Views",
 
"WrittenBy" => "Written By",
"ErrWrongMailcode" => "You've entered a wrong email-confirmation-code. Try again!",
"Wrote" => "Wrote",
 
"Year" => "Year",
"Yes" => "Yes",
"YourEmail" => "Your Email",
"YourName" => "Your Name",
"YouWantToFollow" => "You have indicated you want to follow the thread",
);
// timezone-variables
$PHORUM["DATA"]["LANG"]["TIME"]=array(
"-12" => "(GMT - 12:00 hours) Enitwetok, Kwajalien",
"-11" => "(GMT - 11:00 hours) Midway Island, Samoa",
"-10" => "(GMT - 10:00 hours) Hawaii",
"-9" => "(GMT - 9:00 hours) Alaska",
"-8" => "(GMT - 8:00 hours) Pacific Time (US &amp; Canada)",
"-7" => "(GMT - 7:00 hours) Mountain Time (US &amp; Canada)",
"-6" => "(GMT - 6:00 hours) Central Time (US &amp; Canada), Mexico City",
"-5" => "(GMT - 5:00 hours) Eastern Time (US &amp; Canada), Bogota, Lima, Quito",
"-4" => "(GMT - 4:00 hours) Atlantic Time (Canada), Caracas, La Paz",
"-3.5" => "(GMT - 3:30 hours) Newfoundland",
"-3" => "(GMT - 3:00 hours) Brazil, Buenos Aires, Georgetown, Falkland Is.",
"-2" => "(GMT - 2:00 hours) Mid-Atlantic, Ascention Is., St Helena",
"-1" => "(GMT - 1:00 hours) Azores, Cape Verde Islands",
"0" => "(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia",
"1" => "(GMT + 1:00 hours) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome, Warsaw",
"2" => "(GMT + 2:00 hours) Kaliningrad, South Africa",
"3" => "(GMT + 3:00 hours) Baghdad, Riyadh, Moscow, Nairobi",
"3.5" => "(GMT + 3:30 hours) Tehran",
"4" => "(GMT + 4:00 hours) Abu Dhabi, Baku, Muscat, Tbilisi",
"4.5" => "(GMT + 4:30 hours) Kabul",
"5" => "(GMT + 5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent",
"5.5" => "(GMT + 5:30 hours) Bombay, Calcutta, Madras, New Delhi",
"6" => "(GMT + 6:00 hours) Almaty, Colomba, Dhakra",
"7" => "(GMT + 7:00 hours) Bangkok, Hanoi, Jakarta",
"8" => "(GMT + 8:00 hours) Beijing, Hong Kong, Perth, Singapore, Taipei",
"9" => "(GMT + 9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk",
"9.5" => "(GMT + 9:30 hours) Adelaide, Darwin",
"10" => "(GMT + 10:00 hours) Melbourne, Papua New Guinea, Sydney, Vladivostok",
"11" => "(GMT + 11:00 hours) Magadan, New Caledonia, Solomon Islands",
"12" => "(GMT + 12:00 hours) Auckland, Wellington, Fiji, Marshall Island",
);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/action_cancel.php
New file
0,0 → 1,34
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// Clean up unlinked attachments from the database.
foreach ($message["attachments"] as $info) {
if (! $info["linked"]) {
phorum_db_file_delete($info["file_id"]);
}
}
 
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["AttachCancel"];
$PHORUM["DATA"]["BACKMSG"] = $PHORUM["DATA"]["LANG"]["BackToList"];
$PHORUM["DATA"]["URL"]["REDIRECT"] = phorum_get_url(PHORUM_LIST_URL);
 
$error_flag = true;
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/action_edit.php
New file
0,0 → 1,168
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// For phorum_update_thread_info().
include_once("./include/thread_info.php");
 
// Create a message which can be used by the database library.
$dbmessage = array(
"message_id" => $message["message_id"],
"thread" => $message["thread"],
"parent_id" => $message["parent_id"],
"forum_id" => $message["forum_id"],
"author" => $message["author"],
"subject" => $message["subject"],
"email" => $message["email"],
"status" => $message["status"],
"closed" => ! $message["allow_reply"],
"body" => $message["body"],
"meta" => $message["meta"],
);
 
// Update sort setting, if allowed. This can only be done
// when editing the thread starter message.
if ( $message["parent_id"]==0 ) {
 
if ($PHORUM["DATA"]["OPTION_ALLOWED"]["sticky"] && $message["special"]=="sticky") {
$dbmessage["sort"] = PHORUM_SORT_STICKY;
} elseif ($PHORUM["DATA"]["OPTION_ALLOWED"]["announcement"] && $message["special"] == "announcement") {
$dbmessage["forum_id"] = $PHORUM["vroot"] ? $PHORUM["vroot"] : 0;
$dbmessage["sort"] = PHORUM_SORT_ANNOUNCEMENT;
} else {
// Not allowed to edit. Keep existing sort value.
switch ($message["special"]) {
case "sticky": $sort = PHORUM_SORT_STICKY; break;
case "announcement": $sort = PHORUM_SORT_ANNOUNCEMENT; break;
default: $sort = PHORUM_SORT_DEFAULT; break;
}
$dbmessage["sort"] = $sort;
}
 
} else {
 
// set some key fields to the same values as the first message in the thread
$dbmessage["forum_id"] = $top_parent["forum_id"];
$dbmessage["sort"] = $top_parent["sort"];
 
}
 
// Update the editing info in the meta data.
$dbmessage["meta"]["show_signature"] = $message["show_signature"];
$dbmessage["meta"]["edit_count"] =
isset($message["meta"]["edit_count"])
? $message["meta"]["edit_count"]+1 : 1;
$dbmessage["meta"]["edit_date"] = time();
$dbmessage["meta"]["edit_username"] = $PHORUM["user"]["username"];
 
// Update attachments in the meta data, link active attachments
// to the message and delete stale attachments.
$dbmessage["meta"]["attachments"] = array();
foreach ($message["attachments"] as $info)
{
if ($info["keep"])
{
$dbmessage["meta"]["attachments"][] = array(
"file_id" => $info["file_id"],
"name" => $info["name"],
"size" => $info["size"],
);
 
phorum_db_file_link(
$info["file_id"],
$message["message_id"],
PHORUM_LINK_MESSAGE
);
} else {
phorum_db_file_delete($info["file_id"]);
}
}
if (!count($dbmessage["meta"]["attachments"])) {
unset($dbmessage["meta"]["attachments"]);
}
 
// Update the data in the database and run pre and post editing hooks.
$dbmessage = phorum_hook("pre_edit", $dbmessage);
phorum_db_update_message($message["message_id"], $dbmessage);
phorum_hook("post_edit", $dbmessage);
 
// Update children to the same sort setting and forum_id.
// The forum_id update is needed for switching between
// announcements and other types of messages.
if (! $message["parent_id"] &&
$origmessage["sort"] != $dbmessage["sort"])
{
$messages = phorum_db_get_messages($message["thread"], 0);
unset($messages["users"]);
foreach($messages as $message_id => $msg){
if($msg["sort"]!=$dbmessage["sort"] ||
$msg["forum_id"] != $dbmessage["forum_id"]) {
$msg["sort"]=$dbmessage["sort"];
$msg["forum_id"]=$dbmessage["forum_id"];
phorum_db_update_message($message_id, $msg);
}
}
 
// The forum stats have to be updated. Announcements aren't
// counted in the thread_count, so if switching to or
// from announcement, the thread_count will change.
phorum_db_update_forum_stats(true);
}
 
// Update all thread messages to the same closed setting.
if (! $message["parent_id"] &&
$origmessage["closed"] != $dbmessage["closed"]) {
if ($dbmessage["closed"]) {
phorum_db_close_thread($message["thread"]);
} else {
phorum_db_reopen_thread($message["thread"]);
}
}
 
// Update thread info.
phorum_update_thread_info($message['thread']);
 
// Update thread subscription or unsubscription.
if ($message["user_id"])
{
if ($message["email_notify"])
{
phorum_user_subscribe(
$message["user_id"], $PHORUM["forum_id"],
$message["thread"], PHORUM_SUBSCRIPTION_MESSAGE
);
} else {
phorum_user_unsubscribe(
$message["user_id"],
$message["thread"],
$message["forum_id"]
);
}
}
 
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["MsgModEdited"];
$PHORUM['DATA']["BACKMSG"] = $PHORUM['DATA']["LANG"]["BackToThread"];
$PHORUM["DATA"]["URL"]["REDIRECT"] = phorum_get_url(
PHORUM_READ_URL,
$message["thread"],
$message["message_id"]
);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/action_post.php
New file
0,0 → 1,229
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// For phorum_update_thread_info().
include_once("./include/thread_info.php");
 
// For phorum_email_moderators() and phorum_email_notice().
include_once("./include/email_functions.php");
 
// Set some values.
$message["moderator_post"] = $PHORUM["DATA"]["MODERATOR"] ? 1 : 0;
$message["sort"] = PHORUM_SORT_DEFAULT;
$message["closed"] = $message["allow_reply"] ? 0 : 1;
 
// Determine and set the user's IP address.
$user_ip = $_SERVER["REMOTE_ADDR"];
if ($PHORUM["dns_lookup"]) {
$resolved = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
if (!empty($resolved)) {
$user_ip = $resolved;
}
}
$message["ip"] = $user_ip;
 
// For replies, inherit the closed parameter of our top parent.
// Only for rare race conditions, since you cannot reply to
// closed threads.
if ($mode == "reply") {
$message["closed"] = $top_parent["closed"];
$message["allow_reply"] = ! $top_parent["closed"];
}
 
// Check if allow_reply can be set.
if ($mode == "post" && ! $PHORUM["DATA"]["OPTION_ALLOWED"]["allow_reply"]) {
$message["closed"] = 0;
$message["allow_reply"] = 1;
}
 
// For sticky and announcement theads set the sort parameter
// for replies to the correct value, so threaded views will work.
if ($mode == "reply")
{
if ($top_parent["sort"] == PHORUM_SORT_STICKY) {
$message["sort"] = PHORUM_SORT_STICKY;
} elseif ($top_parent["sort"] == PHORUM_SORT_ANNOUNCEMENT) {
$message["sort"] = PHORUM_SORT_ANNOUNCEMENT;
$message["forum_id"] = $top_parent["forum_id"];
}
}
 
// Do specific actions for new threads with a "special" flag.
if ($mode == "post" && isset($message["special"]))
{
if ($message["special"]=="sticky" && $PHORUM["DATA"]["OPTION_ALLOWED"]["sticky"]) {
$message["sort"] = PHORUM_SORT_STICKY;
} elseif ($message["special"] == "announcement" && $PHORUM["DATA"]["OPTION_ALLOWED"]["announcement"]) {
$message["sort"] = PHORUM_SORT_ANNOUNCEMENT;
$message["forum_id"]= $PHORUM["vroot"] ? $PHORUM["vroot"] : 0;
}
}
 
if ($PHORUM["DATA"]["LOGGEDIN"] && $message["show_signature"]) {
$message["meta"]["show_signature"] = 1;
}
 
// Put messages on hold in case the forum is moderated.
if ($PHORUM["DATA"]["MODERATED"]) {
$message["status"] = PHORUM_STATUS_HOLD;
} else {
$message["status"] = PHORUM_STATUS_APPROVED;
}
 
// Create a unique message id.
$suffix = preg_replace("/[^a-z0-9]/i", "", $PHORUM["name"]);
$message["msgid"] = md5(uniqid(rand())) . ".$suffix";
 
// Run pre post mods.
$message = phorum_hook("pre_post", $message);
 
// Add attachments to meta data.
$message["meta"]["attachments"] = array();
foreach ($message["attachments"] as $info) {
if ($info["keep"]) {
$message["meta"]["attachments"][] = array(
"file_id" => $info["file_id"],
"name" => $info["name"],
"size" => $info["size"],
);
}
}
if (!count($message["meta"]["attachments"])) {
unset($message["meta"]["attachments"]);
}
 
// Keep a copy of the message we have got now.
$message_copy = $message;
 
// Store the message in the database.
$success = phorum_db_post_message($message);
 
if ($success)
{
// Handle linking and deleting of attachments to synchronize
// the message attachments with the working copy list
// of attachments.
foreach ($message_copy["attachments"] as $info) {
if ($info["keep"]) {
phorum_db_file_link(
$info["file_id"],
$message["message_id"],
PHORUM_LINK_MESSAGE
);
} else {
phorum_db_file_delete($info["file_id"]);
}
}
 
// Retrieve the message again to have it in the correct
// format (otherwise it's a bit messed up in the
// post-function). Do merge back data which is not
// stored in the database, but which we might need later on.
$message = phorum_db_get_message($message["message_id"]);
foreach ($message_copy as $key => $val) {
if (! isset($message[$key])) {
$message[$key] = $val;
}
}
 
phorum_update_thread_info($message["thread"]);
 
// Subscribe user to the thread if requested.
if ($message["email_notify"] && $message["user_id"]) {
phorum_user_subscribe(
$message["user_id"], $PHORUM["forum_id"],
$message["thread"], PHORUM_SUBSCRIPTION_MESSAGE
);
}
 
// Mark own message read.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
phorum_db_newflag_add_read(array(0=>array(
"id" => $message["message_id"],
"forum" => $message["forum_id"],
)));
phorum_user_addpost();
}
 
// Actions for messages which are approved.
if ($message["status"] > 0)
{
// Update forum statistics.
phorum_db_update_forum_stats(false, 1, $message["datestamp"]);
 
// Mail subscribed users.
phorum_email_notice($message);
}
 
// Mail moderators.
if ($PHORUM["email_moderators"] == PHORUM_EMAIL_MODERATOR_ON) {
phorum_email_moderators($message);
}
 
// Run after post mods.
$message = phorum_hook("post_post", $message);
 
// Posting is completed. Take the user back to the forum.
if ($PHORUM["redirect_after_post"] == "read")
{
// To the end of the thread.
if (isset($top_parent)) { // not set for top parents themselves.
$readlen = $PHORUM["read_length"];
$pages = ceil(($top_parent["thread_count"]+1) / $readlen);
 
if ($pages > 1) {
$redir_url = phorum_get_url(
PHORUM_READ_URL, $message["thread"],
$message["message_id"], "page=$pages"
);
} else {
$redir_url = phorum_get_url(
PHORUM_READ_URL, $message["thread"],
$message["message_id"]
);
}
 
// wrap redirect because of IE
$redir_url = phorum_get_url(PHORUM_REDIRECT_URL, 'phorum_redirect_to=' . urlencode($redir_url));
 
} else {
 
$redir_url = phorum_get_url( PHORUM_READ_URL, $message["thread"] );
}
 
}
else
{
$redir_url = phorum_get_url(PHORUM_LIST_URL);
}
 
phorum_redirect_by_url($redir_url);
 
return;
}
 
// If we get here, the posting was not successful.
// Restore message and setup the data for displaying an error to the user.
$message = $message_copy;
$PHORUM["DATA"]["ERROR"] = $PHORUM["DATA"]["LANG"]["PostErrorOccured"];
$error_flag = true;
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/action_attachments.php
New file
0,0 → 1,181
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
if ($do_detach)
{
// Find the message to detach.
foreach ($message["attachments"] as $id => $info)
{
if ($info["file_id"] == $do_detach && $info["keep"])
{
// Attachments which are not yet linked to a message
// can be deleted immediately. Linked attachments should
// be kept in the db, in case the users clicks "Cancel".
if (! $info["linked"]) {
phorum_db_file_delete($info["file_id"]);
unset($message["attachments"][$id]);
} else {
$message["attachments"][$id]["keep"] = false;
}
 
// Run the after_detach hook.
list($message,$info) =
phorum_hook("after_detach", array($message,$info));
 
$attach_count--;
 
break;
}
}
}
 
// Attachment(s) uploaded.
elseif ($do_attach && ! empty($_FILES))
{
// The editor template that I use only supports one upload
// at a time. This code supports multiple uploads.
$attached = 0;
foreach ($_FILES as $file)
{
// Not too many attachments?
if ($attach_count >= $PHORUM["max_attachments"]) break;
 
// Check if the tempfile is an uploaded file?
if(! is_uploaded_file($file["tmp_name"])) continue;
 
// Some problems in uploading result in files which are
// zero in size. We asume that people who upload zero byte
// files will almost always have problems uploading.
if ($file["size"] == 0) continue;
 
// check with PHP and MySQL on attachment size
$php_limit = ini_get('upload_max_filesize')*1024;
$max_packetsize = phorum_db_maxpacketsize();
if ($max_packetsize == NULL) {
$db_limit = $php_limit;
} else {
$db_limit = $max_packetsize/1024*.6;
}
if($PHORUM["max_attachment_size"]==0){
$PHORUM["max_attachment_size"] = min($php_limit, $db_limit);
} else {
$PHORUM["max_attachment_size"] = min($PHORUM["max_attachment_size"], $php_limit, $db_limit);
}
 
// Isn't the attachment too large?
if ($PHORUM["max_attachment_size"] > 0 &&
$file["size"] > $PHORUM["max_attachment_size"]*1024) {
$PHORUM["DATA"]["ERROR"] = str_replace(
'%size%',
phorum_filesize($PHORUM["max_attachment_size"] * 1024),
$PHORUM["DATA"]["LANG"]["AttachFileSize"]
);
phorum_filesize($PHORUM["max_attachment_size"] * 1024);
$error_flag = true;
break;
}
 
// Isn't the total attachment size too large?
if ($PHORUM["max_totalattachment_size"] > 0 &&
($file["size"] + $attach_totalsize) > $PHORUM["max_totalattachment_size"]*1024) {
$PHORUM["DATA"]["ERROR"] = str_replace(
'%size%',
phorum_filesize($PHORUM["max_totalattachment_size"] * 1024),
$PHORUM["DATA"]["LANG"]["AttachTotalFileSize"]
);
$error_flag = true;
break;
}
 
// Is the type of file acceptable?
if(! empty($PHORUM["allow_attachment_types"]))
{
$ext=substr($file["name"], strrpos($file["name"], ".")+1);
$allowed_exts=explode(";", $PHORUM["allow_attachment_types"]);
if (! in_array(strtolower($ext), $allowed_exts)) {
$PHORUM["DATA"]["ERROR"] =
$PHORUM["DATA"]["LANG"]["AttachInvalidType"] . " ".
str_replace('%types%', str_replace(";", ", ", $PHORUM["allow_attachment_types"]), $PHORUM["DATA"]["LANG"]["AttachFileTypes"]);
$error_flag = true;
break;
}
}
 
// Read in the file.
$fp = fopen($file["tmp_name"], "r");
if (! $fp) continue;
$file["data"] = base64_encode(fread($fp, $file["size"]));
fclose($fp);
 
// copy the current user_id to the $file array for the hook
$file["user_id"]=$PHORUM["user"]["user_id"];
 
// Run the before_attach hook.
list($message, $file) =
phorum_hook("before_attach", array($message, $file));
 
// Add the file to the database. We add it using message_id
// 0 (zero). Only when the message gets saved definitely,
// the message_id will be updated to link the file to the
// forum message. This is mainly done so we can support
// attachments for new messages, which do not yet have
// a message_id assigned.
$file_id = phorum_db_file_save(
$PHORUM["user"]["user_id"],
$file["name"], $file["size"],
$file["data"], 0, PHORUM_LINK_EDITOR
);
 
// Create new attachment information.
$new_attachment = array(
"file_id" => $file_id,
"name" => $file["name"],
"size" => $file["size"],
"keep" => true,
"linked" => false,
);
 
// Run the after_attach hook.
list($message, $new_attachment) =
phorum_hook("after_attach", array($message, $new_attachment));
 
// Add the attachment to the message.
$message['attachments'][] = $new_attachment;
$attach_totalsize += $new_attachment["size"];
$attach_count++;
$attached++;
}
 
// Show a generic error message if nothing was attached and
// no specific message was set.
if (! $error_flag && ! $attached) {
$PHORUM["DATA"]["ERROR"] =
$PHORUM["DATA"]["LANG"]["AttachmentsMissing"];
$error_flag = true;
}
 
// Show a success message in case an attachment is added.
if (! $error_flag && $attached) {
$PHORUM["DATA"]["OKMSG"] = $PHORUM["DATA"]["LANG"]["AttachmentAdded"];
 
}
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/check_permissions.php
New file
0,0 → 1,187
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// Check if the user is allowed to post a new message or a reply.
if( ($mode == "post" && !phorum_user_access_allowed(PHORUM_USER_ALLOW_NEW_TOPIC)) ||
($mode == "reply" && !phorum_user_access_allowed(PHORUM_USER_ALLOW_REPLY)) ) { if ($PHORUM["DATA"]["LOGGEDIN"]) {
// If users are logged in and can't post, they don't have rights to do so.
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoPost"];
} else {
// Check if they could post if logged in. If so, let them know to log in.
if( ($mode == "reply" && $PHORUM["reg_perms"] & PHORUM_USER_ALLOW_REPLY) ||
($mode == "post" && $PHORUM["reg_perms"] & PHORUM_USER_ALLOW_NEW_TOPIC) ) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["PleaseLoginPost"];
} else {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoPost"];
}
}
$error_flag = true;
return;
 
// Check that they are logged in according to the security settings in
// the admin. If they aren't then either set a message with a login link
// (when running as include) or redirect to the login page.
} elseif($PHORUM["DATA"]["LOGGEDIN"] && !$PHORUM["DATA"]["FULLY_LOGGEDIN"]){
 
if (isset($PHORUM["postingargs"]["as_include"])) {
 
// Generate the URL to return to after logging in.
$args = array(PHORUM_REPLY_URL, $PHORUM["args"][1]);
if (isset($PHORUM["args"][2])) $args[] = $PHORUM["args"][2];
if (isset($PHORUM["args"]["quote"])) $args[] = "quote=1";
$redir = urlencode(call_user_func_array('phorum_get_url', $args));
$url = phorum_get_url(PHORUM_LOGIN_URL, "redir=$redir");
$PHORUM["DATA"]["URL"]["REDIRECT"] = $url;
$PHORUM["DATA"]["BACKMSG"] = $PHORUM["DATA"]["LANG"]["LogIn"];
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["PeriodicLogin"];
$error_flag = true;
return;
 
} else {
 
// Generate the URL to return to after logging in.
$args = array(PHORUM_POSTING_URL);
if (isset($PHORUM["args"][1])) $args[] = $PHORUM["args"][1];
if (isset($PHORUM["args"][2])) $args[] = $PHORUM["args"][2];
if (isset($PHORUM["args"]["quote"])) $args[] = "quote=1";
$redir = urlencode(call_user_func_array('phorum_get_url', $args));
 
phorum_redirect_by_url(phorum_get_url(PHORUM_LOGIN_URL,"redir=$redir"));
exit();
 
}
}
 
// Put read-only user info in the message.
if ($mode == "post" || $mode == "reply")
{
if ($PHORUM["DATA"]["LOGGEDIN"]){
$message["user_id"] = $PHORUM["user"]["user_id"];
$message["author"] = $PHORUM["user"]["username"];
} else {
$message["user_id"] = 0;
}
}
 
// On finishing up, find the original message data in case we're
// editing or replying. Put read-only data in the message to prevent
// data tampering.
if ($finish && ($mode == 'edit' || $mode == 'reply'))
{
$id = $mode == "edit" ? "message_id" : "parent_id";
$origmessage = phorum_db_get_message($message[$id]);
if (! $origmessage) {
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
exit();
}
 
// Copy read-only information for editing messages.
if ($mode == "edit") {
$message = phorum_posting_merge_db2form($message, $origmessage, READONLYFIELDS);
// Copy read-only information for replying to messages.
} else {
$message["parent_id"] = $origmessage["message_id"];
$message["thread"] = $origmessage["thread"];
}
}
 
// We never store the email address in the message in case it
// was posted by a registered user.
if ($message["user_id"]) {
$message["email"] = "";
}
 
// Find the startmessage for the thread.
if ($mode == "reply" || $mode == "edit") {
$top_parent = phorum_db_get_message($message["thread"]);
}
 
// Do permission checks for replying to messages.
if ($mode == "reply")
{
// Find the direct parent for this message.
if ($message["thread"] != $message["parent_id"]) {
$parent = phorum_db_get_message($message["parent_id"]);
} else {
$parent = $top_parent;
}
 
// If this thread is unapproved, then get out.
$unapproved =
empty($top_parent) ||
empty($parent) ||
$top_parent["closed"] ||
$top_parent["status"] != PHORUM_STATUS_APPROVED ||
$parent["status"] != PHORUM_STATUS_APPROVED;
 
if ($unapproved)
{
// In case we run the editor included in the read page,
// we should not redirect to the listpage for moderators.
// Else a moderator can never read an unapproved message.
if (isset($PHORUM["postingargs"]["as_include"])) {
if ($PHORUM["DATA"]["MODERATOR"]) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["UnapprovedMessage"];
$error_flag = true;
return;
}
}
 
// In other cases, redirect users that are replying to
// unapproved messages to the message list.
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit;
}
 
}
 
// Do permission checks for editing messages.
if ($mode == "edit")
{
// Check if the user is allowed to edit this post.
$timelim = $PHORUM["user_edit_timelimit"];
$useredit =
$message["user_id"] == $PHORUM["user"]["user_id"] &&
phorum_user_access_allowed(PHORUM_USER_ALLOW_EDIT) &&
! empty($top_parent) &&
! $top_parent["closed"] &&
(! $timelim || $message["datestamp"] + ($timelim * 60) >= time());
 
// Moderators are allowed to edit message, but not messages from
// announcement threads. Announcements may only be edited by users
// for which the option "announcement" is set as allowed.
$moderatoredit =
$PHORUM["DATA"]["MODERATOR"] &&
$message["forum_id"] == $PHORUM["forum_id"] &&
($message["special"] != "announcement" ||
$PHORUM["DATA"]["OPTION_ALLOWED"]["announcement"]);
 
if (!$useredit && !$moderatoredit) {
$PHORUM["DATA"]["MESSAGE"] =
$PHORUM["DATA"]["LANG"]["EditPostForbidden"];
$error_flag = true;
return;
}
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/check_banlist.php
New file
0,0 → 1,55
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// For phorum_check_ban_lists().
include_once("./include/profile_functions.php");
 
// Create a list of the bans that we want to check.
$bans = array();
 
// Add checks for registered users.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
$bans[] = array($PHORUM["user"]["username"], PHORUM_BAD_NAMES);
$bans[] = array($PHORUM["user"]["email"], PHORUM_BAD_EMAILS);
$bans[] = array($PHORUM["user"]["user_id"], PHORUM_BAD_USERID);
}
// Add checks for unregistered users.
else {
$bans[] = array($message["author"], PHORUM_BAD_NAMES);
$bans[] = array($message["email"], PHORUM_BAD_EMAILS);
}
 
// Add check for IP-address bans.
$bans[] = array(NULL, PHORUM_BAD_IPS);
 
// Add check for Illegal Content (SPAM) bans.
$bans[] = array($message["subject"], PHORUM_BAD_SPAM_WORDS);
$bans[] = array($message["body"], PHORUM_BAD_SPAM_WORDS);
 
 
// Run the checks.
$msg = phorum_check_bans($bans);
if (!is_null($msg)) {
$PHORUM["DATA"]["MESSAGE"] = $msg;
$error_flag = true;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/check_integrity.php
New file
0,0 → 1,67
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// For phorum_valid_email()
include_once("./include/email_functions.php");
 
$error = false;
 
// Post and reply checks for unregistered users.
if (! $PHORUM["DATA"]["LOGGEDIN"] &&
($mode == 'post' || $mode == 'reply'))
{
if (empty($message["author"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrAuthor"];
} elseif ((!defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') || (defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') && PHORUM_ENFORCE_UNREGISTERED_NAMES == true)) && phorum_user_check_username($message["author"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"];
} elseif (!empty($message["email"]) &&
phorum_user_check_email($message["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"];
}
}
 
// A hook entry for checking the data from a module.
if (! $error) {
list($message, $error) =
phorum_hook("check_post", array($message, $error));
}
 
// Data integrity checks for all messages.
if (! $error)
{
if (empty($message["subject"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrSubject"];
} elseif (empty($message["body"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrBody"];
} elseif (!empty($message["email"]) &&
!phorum_valid_email($message["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
} elseif (strlen($message["body"]) > 64000) {
$error = $PHORUM["DATA"]["LANG"]["ErrBodyTooLarge"];
}
}
 
if ($error) {
$PHORUM["DATA"]["ERROR"] = $error;
$error_flag = true;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/action_preview.php
New file
0,0 → 1,78
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
$previewmessage = $message;
 
if ($attach_count)
{
define('PREVIEW_NO_ATTACHMENT_CLICK',
"javascript:alert('" . $PHORUM["DATA"]["LANG"]["PreviewNoClickAttach"] . "')");
 
// Create the URL and formatted size for attachment files.
foreach ($previewmessage["attachments"] as $nr => $data) {
$previewmessage["attachments"][$nr]["url"] =
phorum_get_url(PHORUM_FILE_URL, "file={$data['file_id']}");
$previewmessage["attachments"][$nr]["size"] =
phorum_filesize($data["size"]);
}
}
 
// Format the message using the default formatting.
include_once("./include/format_functions.php");
$previewmessages = phorum_format_messages(array($previewmessage));
$previewmessage = array_shift($previewmessages);
 
// Recount the number of attachments. Formatting mods might have changed
// the number of attachments we have to display using default formatting.
$attach_count = 0;
if (isset($previewmessage["attachments"])) {
foreach ($previewmessage["attachments"] as $attachment) {
if ($attachment["keep"]) {
$attach_count ++;
}
}
}
 
if ($attach_count)
{
// Disable clicking on attachments in the preview (to prevent the
// browser from jumping to a viewing page, which might break the
// editing flow). This is not done in the previous loop where the
// URL is set, so the formatting code for things like inline
// attachments can be used.
foreach ($previewmessage["attachments"] as $nr => $data) {
$previewmessage["attachments"][$nr]["url"] = PREVIEW_NO_ATTACHMENT_CLICK;
}
} else {
unset($previewmessage["attachments"]);
}
 
// Fill the author name and datestamp for new postings.
if ($mode != "edit" && $PHORUM["DATA"]["LOGGEDIN"]) {
$previewmessage["author"] = $PHORUM["user"]["username"];
$previewmessage["datestamp"] = time();
}
 
// Format datestamp.
$previewmessage["datestamp"] = phorum_date($PHORUM["short_date"], $previewmessage["datestamp"]);
$PHORUM["DATA"]["PREVIEW"] = $previewmessage;
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/request_first.php
New file
0,0 → 1,105
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// Retrieve the message id to work with.
$message_id = 0;
 
if ($mode != "post") {
if (! isset($PHORUM["postingargs"][2])) {
die("Missing message_id parameter in request for mode $mode");
}
$message_id = $PHORUM["postingargs"][2];
}
 
// Create an initial message structure.
$message = array();
foreach ($PHORUM["post_fields"] as $key => $info) {
$message[$key] = $info[pf_INIT];
}
 
// Retrieve the message replied to or the message being edited.
if ($mode != "post")
{
// Check read access on the forum that we're handling.
if (!phorum_check_read_common()) exit;
 
// Retrieve the message from the database. If the message can't be
// retrieved, then return to the message list.
$dbmessage = phorum_db_get_message($message_id);
if (! $dbmessage) {
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit;
}
}
 
// Set message data for replying to posts.
if ($mode == "reply" || $mode == "quote")
{
// Set thread and parent information.
$message["parent_id"] = $dbmessage["message_id"];
$message["thread"] = $dbmessage["thread"];
 
// Create Re: subject prefix.
if (substr($dbmessage["subject"], 0, 4) != "Re: ") {
$dbmessage["subject"] = "Re: " . $dbmessage["subject"];
}
$message["subject"] = $dbmessage["subject"];
 
// Add a quoted version of the body for quoted reply messages.
if ($mode == "quote")
{
$quoted = phorum_hook("quote", array($dbmessage["author"], $dbmessage["body"]));
 
if (empty($quoted) || is_array($quoted))
{
$quoted = phorum_strip_body($dbmessage["body"]);
$quoted = str_replace("\n", "\n> ", $quoted);
$quoted = wordwrap(trim($quoted), 50, "\n> ", true);
$quoted = "{$dbmessage["author"]} " .
"{$PHORUM["DATA"]["LANG"]["Wrote"]}:\n" .
str_repeat("-", 55) . "\n> $quoted\n\n\n";
}
 
$message["body"] = $quoted;
}
}
 
// Set message data for editing posts.
if ($mode == "edit" || $mode == "moderation") {
// Transfer all database fields to the form fields.
$message = phorum_posting_merge_db2form($message, $dbmessage, ALLFIELDS);
}
 
// For new messages, set some default values for logged in users.
if (($mode == "post" || $mode == "reply" || $mode == "quote") && $PHORUM["DATA"]["LOGGEDIN"])
{
if (isset($PHORUM["user"]["show_signature"]) &&
$PHORUM["user"]["show_signature"]) {
$message["show_signature"] = 1;
}
 
if (isset($PHORUM["user"]["email_notify"]) &&
$PHORUM["user"]["email_notify"]) {
$message["email_notify"] = 1;
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/posting/request_followup.php
New file
0,0 → 1,59
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// Create an empty message structure.
$message = array();
 
// Inject form field data into the message structure. No checks
// are done on the data over here. Here we just take care of
// putting the data in the right format in the data structure.
foreach ($PHORUM["post_fields"] as $var => $spec)
{
// Format and store the data based on the configuration.
switch ($spec[pf_TYPE])
{
case "boolean":
$message[$var] = isset($_POST[$var]) && $_POST[$var] ? 1 : 0;
break;
 
case "integer":
$message[$var] = isset($_POST[$var]) ? (int) $_POST[$var] : NULL;
break;
 
case "array":
$message[$var] = isset($_POST[$var]) ? unserialize($_POST[$var]) : array();
break;
 
case "string":
$message[$var] = isset($_POST[$var]) ? trim($_POST[$var]) : '';
// Prevent people from impersonating others by using
// multiple spaces in the author name.
if ($var == 'author') {
$message[$var] = preg_replace('/\s+/', ' ', $message[$var]);
}
break;
 
default:
die ("Illegal field type used for field $var: " . $spec[pf_TYPE]);
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/templates.php
New file
0,0 → 1,380
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// For keeping track of include dependancies, which
// are used to let templates automatically rebuild
// in case an included subtemplate has been changed.
$include_level = 0;
$include_deps = array();
 
function phorum_import_template($tplfile, $outfile)
{
global $include_level, $include_deps;
$include_level++;
 
// Remember that we used this template.
$include_deps[$tplfile] = $outfile;
 
// In case we're handling 0 byte large files, we set $page
// directly. Running fread($fp, 0) gives a PHP warning.
if (filesize($tplfile)) {
$fp=fopen($tplfile, "r");
$page=fread($fp, filesize($tplfile));
fclose($fp);
} else {
$page = '';
}
 
preg_match_all("/\{[\!\/A-Za-z].+?\}/s", $page, $matches);
 
settype($oldloopvar, "string");
settype($loopvar, "string");
settype($olddatavar, "string");
settype($datavar, "string");
$loopvars = array();
 
foreach($matches[0] as $match){
unset($parts);
 
$string=substr($match, 1, -1);
 
$string = trim($string);
 
// pre-parse pointer variables
if(strstr($string, "->")){
$string=str_replace("->", "']['", $string);
}
 
$parts=explode(" ", $string);
 
switch(strtolower($parts[0])){
 
// Comment
case "!":
 
$repl="<?php // ".implode(" ", $parts)." ?>";
break;
 
 
case "include":
 
$repl = file_get_contents(phorum_get_template($parts[1],1));
break;
 
case "include_once":
 
$repl="<?php include_once phorum_get_template('$parts[1]'); ?>";
break;
 
case "include_var": // include a file given by a variable
 
$repl="<?php include_once phorum_get_template( \$PHORUM[\"DATA\"]['$parts[1]']); ?>";
break;
 
// A define is used to create vars for the engine to use.
case "define":
 
$repl="<?php \$PHORUM[\"TMP\"]['$parts[1]']='";
array_shift($parts);
array_shift($parts);
foreach($parts as $part){
$repl.=str_replace("'", "\\'", $part)." ";
}
$repl=trim($repl)."'; ?>";
break;
 
 
// A var is used to create vars for the template.
case "var":
 
$repl="<?php \$PHORUM[\"DATA\"]['$parts[1]']='";
array_shift($parts);
array_shift($parts);
foreach($parts as $part){
$repl.=str_replace("'", "\\'", $part)." ";
}
$repl=trim($repl)."'; ?>";
break;
 
// Run a Phorum hook. The first parameter is the name of the
// hook. Other parameters will be passed on as arguments for
// the hook function. On argument will be passed directly to
// the hook. Multiple arguments will be passed in an array.
case "hook":
 
// Setup hook arguments.
$hookargs = array();
for($i = 2; !empty($parts[$i]); $i++) {
// For supporting the following construct, where the
// loopvar is passed to the hook in full:
// {LOOP SOMELIST}
// {HOOK some_hook SOMELIST}
// {/LOOP SOMELIST}
if (isset($loopvars[$parts[$i]])) {
$hookargs[] = "\$PHORUM['TMP']['".addslashes($parts[$i])."']";
} else {
$index = phorum_determine_index($loopvars, $parts[$i]);
$hookargs[] = "\$PHORUM['$index']['".addslashes($parts[$i])."']";
}
}
 
// Build the replacement string.
$repl = "<?php if(isset(\$PHORUM['hooks']['".addslashes($parts[1])."'])) phorum_hook('".addslashes($parts[1])."'";
if (count($hookargs) == 1) {
$repl .= "," . $hookargs[0];
} elseif (count($hookargs) > 1) {
$repl .= ",array(" . implode(",", $hookargs) . ")";
}
$repl .= ");?>";
break;
 
// starts a loop
case "loop":
 
$loopvars[$parts[1]]=true;
$index=phorum_determine_index($loopvars, $parts[1]);
$repl="<?php \$phorum_loopstack[] = isset(\$PHORUM['TMP']['$parts[1]']) ? \$PHORUM['TMP']['$parts[1]']:NULL; if(isset(\$PHORUM['$index']['$parts[1]']) && is_array(\$PHORUM['$index']['$parts[1]'])) foreach(\$PHORUM['$index']['$parts[1]'] as \$PHORUM['TMP']['$parts[1]']){ ?>";
break;
 
 
// ends a loop
case "/loop":
 
if (!isset($parts[1])) print "<h3>Template warning: Missing argument for /loop statement in file '" . htmlspecialchars($tplfile) . "'</h3>";
$repl="<?php } if(isset(\$PHORUM['TMP']) && isset(\$PHORUM['TMP']['$parts[1]'])) unset(\$PHORUM['TMP']['$parts[1]']); \$phorum_loopstackitem=array_pop(\$phorum_loopstack); if (isset(\$phorum_loopstackitem)) \$PHORUM['TMP']['$parts[1]'] = \$phorum_loopstackitem;?>";
unset($loopvars[$parts[1]]);
break;
 
 
// if and elseif are the same accept how the line starts
case "if":
case "elseif":
 
// determine if or elseif
$prefix = (strtolower($parts[0])=="if") ? "if" : "} elseif";
 
// are we wanting == or !=
if(strtolower($parts[1])=="not"){
$operator="!=";
$parts[1]=$parts[2];
if(isset($parts[3])){
$parts[2]=$parts[3];
unset($parts[3]);
} else {
unset($parts[2]);
}
} else {
$operator="==";
}
 
$index=phorum_determine_index($loopvars, $parts[1]);
 
// if there is no part 2, check that the value is set and not empty
if(!isset($parts[2])){
if($operator=="=="){
$repl="<?php $prefix(isset(\$PHORUM['$index']['$parts[1]']) && !empty(\$PHORUM['$index']['$parts[1]'])){ ?>";
} else {
$repl="<?php $prefix(!isset(\$PHORUM['$index']['$parts[1]']) || empty(\$PHORUM['$index']['$parts[1]'])){ ?>";
}
 
// if it is numeric, a constant or a string, simply set it as is
} elseif(is_numeric($parts[2]) || defined($parts[2]) || preg_match('!"[^"]*"!', $parts[2])) {
$repl="<?php $prefix(isset(\$PHORUM['$index']['$parts[1]']) && \$PHORUM['$index']['$parts[1]']$operator$parts[2]){ ?>";
 
// we must have a template var
} else {
 
$index_part2=phorum_determine_index($loopvars, $parts[2]);
 
// this is a really complicated IF we are building.
 
$repl="<?php $prefix(isset(\$PHORUM['$index']['$parts[1]']) && isset(\$PHORUM['$index_part2']['$parts[2]']) && \$PHORUM['$index']['$parts[1]']$operator\$PHORUM['$index_part2']['$parts[2]']) { ?>";
 
}
 
// reset $prefix
$prefix="";
break;
 
 
// create an else
case "else":
 
$repl="<?php } else { ?>";
break;
 
 
// close an if
case "/if":
 
$repl="<?php } ?>";
break;
 
case "assign":
if(defined($parts[2]) || is_numeric($parts[2])){
$repl="<?php \$PHORUM[\"DATA\"]['$parts[1]']=$parts[2]; ?>";
} else {
$index=phorum_determine_index($loopvars, $parts[2]);
 
$repl="<?php \$PHORUM[\"DATA\"]['$parts[1]']=\$PHORUM['$index']['$parts[2]']; ?>";
}
break;
 
 
// this is just for echoing vars from DATA or TMP if it is a loopvar
default:
 
if(defined($parts[0])){
$repl="<?php echo $parts[0]; ?>";
} else {
 
$index=phorum_determine_index($loopvars, $parts[0]);
 
$repl="<?php echo \$PHORUM['$index']['$parts[0]']; ?>";
}
}
 
$page=str_replace($match, $repl, $page);
}
 
$include_level--;
 
// Did we finish processing our top level template? Then write out
// the compiled template to the cache.
//
// For storing the compiled template, we use two files. The first one
// has some code for checking if one of the dependant files has been
// updated and for rebuilding the template if this is the case.
// This one loads the second file, which is the template itself.
//
// This two-stage loading is needed to make sure that syntax
// errors in a template file won't break the depancy checking process.
// If both were in the same file, the complete file would not be run
// at all and the user would have to clean out the template cache to
// reload the template once it was fixed. This way user intervention
// is never needed.
if ($include_level == 0)
{
// Find the template name for the top level template.
$pathparts = preg_split('[\\/]', $outfile);
$fileparts = explode('-', preg_replace('/^.*\//', '', $pathparts[count($pathparts)-1]));
$this_template = addslashes($fileparts[2]);
 
// Determine first and second stage cache filenames.
$stage1_file = $outfile;
$fileparts[3] = "toplevel_stage2";
unset($pathparts[count($pathparts)-1]);
$stage2_file = implode('/', $pathparts) . '/' . implode('-', $fileparts);
 
// Create code for automatic rebuilding of rendered templates
// in case of changes. This is done by checking if one of the
// templates in the dependancy list has been updated. If this
// is the case, all dependant rendered subtemplates are deleted.
// After that phorum_get_template() is called on the top level
// template to rebuild all needed templates.
 
$check_deps =
"<?php\n" .
'$mymtime = @filemtime("' . addslashes($stage1_file) . '");' . "\n" .
"\$update_count = 0;\n" .
"\$need_update = (\n";
foreach ($include_deps as $tpl => $out) {
$qtpl = addslashes($tpl);
$check_deps .= " @filemtime(\"$qtpl\") > \$mymtime ||\n";
}
$check_deps = substr($check_deps, 0, -4); // strip trailing " ||\n"
$check_deps .=
"\n" .
");\n" .
"if (\$need_update) {\n";
foreach ($include_deps as $tpl => $out) {
$qout = addslashes($out);
$check_deps .= " @unlink(\"$qout\");\n";
}
$check_deps .=
" \$tplfile = phorum_get_template(\"$this_template\");\n" .
"}\n" .
"include(\"" . addslashes($stage2_file) . "\");\n" .
"?>\n";
 
// Reset dependancy list for the next phorum_import_template() call.
$include_deps = array();
 
// Write out data to the cache.
phorum_write_templatefile($stage1_file, $check_deps);
phorum_write_templatefile($stage2_file, $page, true);
}
else
{
// Write out subtemplate to the cache.
phorum_write_templatefile($outfile, $page);
}
 
 
}
 
function phorum_write_templatefile($filename, $content, $is_toplevel = false)
{
if($fp=fopen($filename, "w")) {
fputs($fp, "<?php if(!defined(\"PHORUM\")) return; ?>\n");
if ($is_toplevel) {
fputs($fp, "<?php \$phorum_loopstack = array() ?>\n");
}
fputs($fp, $content);
if (! fclose($fp)) {
die("Error on closing $filename. Is your disk full?");
}
// Some very unusual thing might happen. On Windows2000 we have seen
// that the webserver can write a message to the cache directory,
// but that it cannot read it afterwards. Probably due to
// specific NTFS file permission settings. So here we have to make
// sure that we can open the file that we just wrote.
$checkfp = fopen($filename, "r");
if (! $checkfp) {
die("Failed to write a usable compiled template to $filename. " .
"The file was was created successfully, but it could not " .
"be read by the webserver afterwards. This is probably " .
"caused by the file permissions on your cache directory.");
}
fclose($checkfp);
} else {
die("Failed to write a compiled template to $filename. This is " .
"probably caused by the file permissions on your cache " .
"directory.");
}
}
 
function phorum_determine_index($loopvars, $varname)
{
if(isset($loopvars) && count($loopvars)){
while(strstr($varname, "]")){
$varname=substr($varname, 0, strrpos($varname, "]")-1);
if(isset($loopvars[$varname])){
return "TMP";
break;
}
}
}
 
return "DATA";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/mysqli.php
New file
0,0 → 1,4364
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// cvs-info: $Id$
 
if (!defined("PHORUM")) return;
 
/**
* The other Phorum code does not care how the messages are stored.
* The only requirement is that they are returned from these functions
* in the right way. This means each database can use as many or as
* few tables as it likes. It can store the fields anyway it wants.
* The only thing to worry about is the table_prefix for the tables.
* all tables for a Phorum install should be prefixed with the
* table_prefix that will be entered in include/db/config.php. This
* will allow multiple Phorum installations to use the same database.
*/
 
/**
* These are the table names used for this database system.
*/
 
// tables needed to be "partitioned"
$PHORUM["message_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_messages";
$PHORUM["user_newflags_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_newflags";
$PHORUM["subscribers_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_subscribers";
$PHORUM["files_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_files";
$PHORUM["search_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_search";
 
// tables common to all "partitions"
$PHORUM["settings_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_settings";
$PHORUM["forums_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_forums";
$PHORUM["user_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_users";
$PHORUM["user_permissions_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_permissions";
$PHORUM["groups_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_groups";
$PHORUM["forum_group_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_forum_group_xref";
$PHORUM["user_group_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_group_xref";
$PHORUM['user_custom_fields_table'] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_custom_fields";
$PHORUM["banlist_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_banlists";
$PHORUM["pm_messages_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_messages";
$PHORUM["pm_folders_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_folders";
$PHORUM["pm_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_xref";
$PHORUM["pm_buddies_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_buddies";
/*
* fields which are always strings, even if they contain only numbers
* used in post-message and update-message, otherwise strange things happen
*/
$PHORUM['string_fields']= array('author', 'subject', 'body', 'email');
 
/* A piece of SQL code that can be used for identifying moved messages. */
define('PHORUM_SQL_MOVEDMESSAGES', '(parent_id = 0 and thread != message_id)');
 
/**
* This function executes a query to select the visible messages from
* the database for a given page offset. The main Phorum code handles
* actually sorting the threads into a threaded list if needed.
*
* By default, the message body is not included in the fetch queries.
* If the body is needed in the thread list, $PHORUM['TMP']['bodies_in_list']
* must be set to "1" (for example using setting.tpl).
*
* NOTE: ALL dates should be returned as Unix timestamps
*
* @param offset - the index of the page to return, starting with 0
* @param messages - an array containing forum messages
*/
 
function phorum_db_get_thread_list($offset)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($offset, "int");
 
$conn = phorum_db_mysqli_connect();
 
$table = $PHORUM["message_table"];
 
// The messagefields that we want to fetch from the database.
$messagefields =
"$table.author,
$table.datestamp,
$table.email,
$table.message_id,
$table.meta,
$table.moderator_post,
$table.modifystamp,
$table.parent_id,
$table.sort,
$table.status,
$table.subject,
$table.thread,
$table.thread_count,
$table.user_id,
$table.viewcount,
$table.closed";
if(isset($PHORUM['TMP']['bodies_in_list']) && $PHORUM['TMP']['bodies_in_list'] == 1) {
$messagefields .= "\n,$table.body";
}
 
// The sort mechanism to use.
if($PHORUM["float_to_top"]){
$sortfield = "modifystamp";
$index = "list_page_float";
} else{
$sortfield = "thread";
$index = "list_page_flat";
}
 
// Initialize the return array.
$messages = array();
 
// The groups of messages we want to fetch from the database.
$groups = array();
if ($offset == 0) $groups[] = "specials";
$groups[] = "threads";
if ($PHORUM["threaded_list"]) $groups[] = "replies";
 
// for remembering message ids for which we want to fetch the replies.
$replymsgids = array();
 
// Process all groups.
foreach ($groups as $group) {
 
 
$sql = NULL;
 
switch ($group) {
 
// Announcements and stickies.
case "specials":
 
$sql = "select $messagefields
from $table
where
status=".PHORUM_STATUS_APPROVED." and
((parent_id=0 and sort=".PHORUM_SORT_ANNOUNCEMENT."
and forum_id={$PHORUM['vroot']})
or
(parent_id=0 and sort=".PHORUM_SORT_STICKY."
and forum_id={$PHORUM['forum_id']}))
order by
sort, $sortfield desc";
break;
 
// Threads.
case "threads":
 
if ($PHORUM["threaded_list"]) {
$limit = $PHORUM['list_length_threaded'];
$extrasql = '';
} else {
$limit = $PHORUM['list_length_flat'];
}
$start = $offset * $limit;
 
$sql = "select $messagefields
from $table use index ($index)
where
$sortfield > 0 and
forum_id = {$PHORUM["forum_id"]} and
status = ".PHORUM_STATUS_APPROVED." and
parent_id = 0 and
sort > 1
order by
$sortfield desc
limit $start, $limit";
break;
 
// Reply messages.
case "replies":
 
// We're done if we did not collect any messages with replies.
if (! count($replymsgids)) break;
 
$sortorder = "sort, $sortfield desc, message_id";
if(isset($PHORUM["reverse_threading"]) && $PHORUM["reverse_threading"])
$sortorder.=" desc";
 
$sql = "select $messagefields
from $table
where
status = ".PHORUM_STATUS_APPROVED." and
thread in (" . implode(",",$replymsgids) .")
order by $sortorder";
break;
 
} // End of switch ($group)
 
// Continue with the next group if no SQL query was formulated.
if (is_null($sql)) continue;
 
// Fetch the messages for the current group.
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
$rows = mysqli_num_rows($res);
if($rows > 0){
while ($rec = mysqli_fetch_assoc($res)){
$messages[$rec["message_id"]] = $rec;
$messages[$rec["message_id"]]["meta"] = array();
if(!empty($rec["meta"])){
$messages[$rec["message_id"]]["meta"] = unserialize($rec["meta"]);
}
 
// We need the message ids for fetching reply messages.
if ($group == 'threads' && $rec["thread_count"] > 1) {
$replymsgids[] = $rec["message_id"];
}
}
}
}
 
return $messages;
}
 
/**
* This function executes a query to get the recent messages for
* all forums the user can read, a particular forum, or a particular
* thread, and and returns an array of the messages order by message_id.
*
* In reality, this function is not used in the Phorum core as of the time
* of its creationg. However, several modules have been written that created
* a function like this. Therefore, it has been added to aid in module development
*
* The bulk of this function came from Jim Winstead of mysql.com
*/
function phorum_db_get_recent_messages($count, $forum_id = 0, $thread = 0, $threads_only = 0)
{
$PHORUM = $GLOBALS["PHORUM"];
settype($count, "int");
settype($forum_id, "int");
settype($thread, "int");
$arr = array();
 
$conn = phorum_db_mysqli_connect();
 
// we need to differentiate on which key to use
// last_post_time is for sort by modifystamp
// forum_max_message is for sort by message-id
if($threads_only) {
$use_key='last_post_time';
} else {
$use_key='post_count';
}
 
$sql = "SELECT {$PHORUM['message_table']}.* FROM {$PHORUM['message_table']} USE KEY($use_key) WHERE status=".PHORUM_STATUS_APPROVED;
 
// have to check what forums they can read first.
// even if $thread is passed, we have to make sure
// the user can read the forum
if($forum_id <= 0) {
$allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ);
 
// if they are not allowed to see any forums, return the emtpy $arr;
if(empty($allowed_forums))
return $arr;
} else {
// only single forum, *much* fast this way
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_READ,$forum_id)) {
return $arr;
}
}
 
if($forum_id > 0){
$sql.=" and forum_id=$forum_id";
} else {
$sql.=" and forum_id in (".implode(",", $allowed_forums).")";
}
 
if($thread){
$sql.=" and thread=$thread";
}
 
if($threads_only) {
$sql.= " and parent_id = 0";
$sql.= " ORDER BY thread DESC";
} else {
$sql.= " ORDER BY message_id DESC";
}
 
if($count){
$sql.= " LIMIT $count";
}
 
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($rec = mysqli_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
 
// convert meta field
if(empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"]=array();
} else {
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
if(empty($arr['users'])) $arr['users']=array();
if($rec["user_id"]){
$arr['users'][]=$rec["user_id"];
}
 
}
 
return $arr;
}
 
 
/**
* This function executes a query to select messages from the database
* and returns an array. The main Phorum code handles actually sorting
* the threads into a threaded list if needed.
*
* NOTE: ALL dates should be returned as Unix timestamps
* @param forum - the forum id to work with. Omit or NULL for all forums.
* You can also pass an array of forum_id's.
* @param waiting_only - only take into account messages which have to
* be approved directly after posting. Do not include
* messages which are hidden by a moderator.
*/
 
function phorum_db_get_unapproved_list($forum = NULL, $waiting_only=false,$moddays=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$table = $PHORUM["message_table"];
 
$arr = array();
 
$sql = "select
$table.*
from
$table ";
 
if (is_array($forum)){
$sql .= "where forum_id in (" . implode(",", $forum) . ") and ";
} elseif (! is_null($forum)){
settype($forum, "int");
$sql .= "where forum_id = $forum and ";
} else {
$sql .= "where ";
}
 
if($moddays > 0) {
$checktime=time()-(86400*$moddays);
$sql .=" datestamp > $checktime AND";
}
 
if($waiting_only){
$sql.=" status=".PHORUM_STATUS_HOLD;
} else {
$sql="($sql status=".PHORUM_STATUS_HOLD.") " .
"union ($sql status=".PHORUM_STATUS_HIDDEN.")";
}
 
 
$sql .=" order by thread, message_id";
 
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($rec = mysqli_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
$arr[$rec["message_id"]]["meta"] = array();
if(!empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"] = unserialize($rec["meta"]);
}
}
 
return $arr;
}
 
 
/**
* This function posts a message to the tables.
* The message is passed by reference and message_id and thread are filled
*/
 
function phorum_db_post_message(&$message,$convert=false){
$PHORUM = $GLOBALS["PHORUM"];
$table = $PHORUM["message_table"];
 
$conn = phorum_db_mysqli_connect();
 
$success = false;
 
foreach($message as $key => $value){
if (is_numeric($value) && !in_array($key,$PHORUM['string_fields'])){
$message[$key] = (int)$value;
} elseif(is_array($value)) {
$message[$key] = mysqli_real_escape_string ($conn, serialize($value));
} else{
$message[$key] = mysqli_real_escape_string ($conn, $value);
}
}
 
if(!$convert) {
$NOW = time();
} else {
$NOW = $message['datestamp'];
}
 
// duplicate-check
if(isset($PHORUM['check_duplicate']) && $PHORUM['check_duplicate'] && !$convert) {
// we check for dupes in that number of minutes
$check_minutes=60;
$check_timestamp =$NOW - ($check_minutes*60);
// check_query
$chk_query="SELECT message_id FROM $table WHERE forum_id = {$message['forum_id']} AND author='{$message['author']}' AND subject='{$message['subject']}' AND body='{$message['body']}' AND datestamp > $check_timestamp";
$res = mysqli_query($conn, $chk_query);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $chk_query");
if(mysqli_num_rows($res))
return 0;
}
 
if(isset($message['meta'])){
$metaval=",meta='{$message['meta']}'";
} else {
$metaval="";
}
 
$sql = "Insert into $table set
forum_id = {$message['forum_id']},
datestamp=$NOW,
thread={$message['thread']},
parent_id={$message['parent_id']},
author='{$message['author']}',
subject='{$message['subject']}',
email='{$message['email']}',
ip='{$message['ip']}',
user_id={$message['user_id']},
moderator_post={$message['moderator_post']},
status={$message['status']},
sort={$message['sort']},
msgid='{$message['msgid']}',
body='{$message['body']}',
closed={$message['closed']}
$metaval";
 
// if in conversion we need the message-id too
if($convert && isset($message['message_id'])) {
$sql.=",message_id=".$message['message_id'];
}
 
if(isset($message['modifystamp'])) {
$sql.=",modifystamp=".$message['modifystamp'];
}
 
if(isset($message['viewcount'])) {
$sql.=",viewcount=".$message['viewcount'];
}
 
 
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if ($res){
$message["message_id"] = mysqli_insert_id($conn);
 
if(!empty($message["message_id"])){
 
$message["datestamp"]=$NOW;
 
if ($message["thread"] == 0){
$message["thread"] = $message["message_id"];
$sql = "update $table set thread={$message['message_id']} where message_id={$message['message_id']}";
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// start ft-search stuff
$search_text="$message[author] | $message[subject] | $message[body]";
$sql="insert delayed into {$PHORUM['search_table']} set message_id={$message['message_id']}, forum_id={$message['forum_id']}, search_text='$search_text'";
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// end ft-search stuff
 
$success = true;
// some data for later use, i.e. email-notification
$GLOBALS['PHORUM']['post_returns']['message_id']=$message["message_id"];
$GLOBALS['PHORUM']['post_returns']['thread_id']=$message["thread"];
}
}
 
return $success;
}
 
/**
* This function deletes messages from the messages table.
*
* @param message $ _id the id of the message which should be deleted
* mode the mode of deletion, PHORUM_DELETE_MESSAGE for reconnecting the children, PHORUM_DELETE_TREE for deleting the children
*/
 
function phorum_db_delete_message($message_id, $mode = PHORUM_DELETE_MESSAGE)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($message_id, "int");
 
$threadset = 0;
// get the parents of the message to delete.
$sql = "select forum_id, message_id, thread, parent_id from {$PHORUM['message_table']} where message_id = $message_id ";
$res = mysqli_query( $conn, $sql);
$rec = mysqli_fetch_assoc($res);
 
if($mode == PHORUM_DELETE_TREE){
$mids = phorum_db_get_messagetree($message_id, $rec['forum_id']);
}else{
$mids = $message_id;
}
 
// unapprove the messages first so replies will not get posted
$sql = "update {$PHORUM['message_table']} set status=".PHORUM_STATUS_HOLD." where message_id in ($mids)";
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$thread = $rec['thread'];
if($thread == $message_id && $mode == PHORUM_DELETE_TREE){
$threadset = 1;
}else{
$threadset = 0;
}
 
if($mode == PHORUM_DELETE_MESSAGE){
$count = 1;
// change the children to point to their parent's parent
// forum_id is in here for speed by using a key only
$sql = "update {$PHORUM['message_table']} set parent_id=$rec[parent_id] where forum_id=$rec[forum_id] and parent_id=$rec[message_id]";
mysqli_query( $conn, $sql);
}else{
$count = count(explode(",", $mids));
}
 
// delete the messages
$sql = "delete from {$PHORUM['message_table']} where message_id in ($mids)";
mysqli_query( $conn, $sql);
 
// start ft-search stuff
$sql="delete from {$PHORUM['search_table']} where message_id in ($mids)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
// end ft-search stuff
 
// it kind of sucks to have this here, but it is the best way
// to ensure that it gets done if stuff is deleted.
// leave this include here, it needs to be conditional
include_once("./include/thread_info.php");
phorum_update_thread_info($thread);
 
// we need to delete the subscriptions for that thread too
$sql = "DELETE FROM {$PHORUM['subscribers_table']} WHERE forum_id > 0 AND thread=$thread";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// this function will be slow with a lot of messages.
phorum_db_update_forum_stats(true);
 
return explode(",", $mids);
}
 
/**
* gets all attached messages to a message
*
* @param id $ id of the message
*/
function phorum_db_get_messagetree($parent_id, $forum_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($parent_id, "int");
settype($forum_id, "int");
 
$conn = phorum_db_mysqli_connect();
 
$sql = "Select message_id from {$PHORUM['message_table']} where forum_id=$forum_id and parent_id=$parent_id";
 
$res = mysqli_query( $conn, $sql);
 
$tree = "$parent_id";
 
while($rec = mysqli_fetch_row($res)){
$tree .= "," . phorum_db_get_messagetree($rec[0],$forum_id);
}
 
return $tree;
}
 
/**
* This function updates the message given in the $message array for
* the row with the given message id. It returns non 0 on success.
*/
 
function phorum_db_update_message($message_id, $message)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($message_id, "int");
 
if (count($message) > 0){
$conn = phorum_db_mysqli_connect();
 
foreach($message as $field => $value){
if (is_numeric($value) && !in_array($field,$PHORUM['string_fields'])){
$fields[] = "$field=$value";
}elseif (is_array($value)){
$value = mysqli_real_escape_string ($conn, serialize($value));
$fields[] = "$field='$value'";
$message[$field] = $value;
}else{
$value = mysqli_real_escape_string ($conn, $value);
$fields[] = "$field='$value'";
$message[$field] = $value;
}
}
 
$sql = "update {$PHORUM['message_table']} set " . implode(", ", $fields) . " where message_id=$message_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if($res){
// start ft-search stuff
if(isset($message["author"]) && isset($message["subject"]) && isset($message["body"])){
$search_text="$message[author] | $message[subject] | $message[body]";
$sql="replace delayed into {$PHORUM['search_table']} set message_id={$message_id}, forum_id={$message['forum_id']}, search_text='$search_text'";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
// end ft-search stuff
}
 
return ($res > 0) ? true : false;
 
}else{
trigger_error("\$message cannot be empty in phorum_update_message()", E_USER_ERROR);
}
}
 
 
/**
* This function executes a query to get the row with the given value
* in the given field and returns the message in an array.
*/
 
function phorum_db_get_message($value, $field="message_id", $ignore_forum_id=false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$field=mysqli_real_escape_string($conn, $field);
$multiple=false;
 
$forum_id_check = "";
if (!$ignore_forum_id && !empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) and";
}
 
if(is_array($value)) {
$checkvar="$field IN('".implode("','",$value)."')";
$multiple=true;
} else {
$value=mysqli_real_escape_string( $conn, $value);
$checkvar="$field='$value'";
}
 
 
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check $checkvar";
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$ret = $multiple ? array() : NULL;
 
if(mysqli_num_rows($res)){
if($multiple) {
while($rec=mysqli_fetch_assoc($res)) {
// convert meta field
if(empty($rec["meta"])){
$rec["meta"]=array();
} else {
$rec["meta"]=unserialize($rec["meta"]);
}
$ret[$rec['message_id']]=$rec;
}
} else {
$rec = mysqli_fetch_assoc($res);
 
// convert meta field
if(empty($rec["meta"])){
$rec["meta"]=array();
} else {
$rec["meta"]=unserialize($rec["meta"]);
}
$ret=$rec;
}
}
 
return $ret;
}
 
/**
* This function executes a query to get the rows with the given thread
* id and returns an array of the message.
*/
function phorum_db_get_messages($thread,$page=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread, "int");
 
$conn = phorum_db_mysqli_connect();
 
$forum_id_check = "";
if (!empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) and";
}
 
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
}
 
if($page > 0) {
$start=$PHORUM["read_length"]*($page-1);
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval order by message_id LIMIT $start,".$PHORUM["read_length"];
} else {
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval order by message_id";
if(isset($PHORUM["reverse_threading"]) && $PHORUM["reverse_threading"]) $sql.=" desc";
}
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$arr = array();
 
while ($rec = mysqli_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
 
// convert meta field
if(empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"]=array();
} else {
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
if(empty($arr['users'])) $arr['users']=array();
if($rec["user_id"]){
$arr['users'][]=$rec["user_id"];
}
 
}
 
if(count($arr) && $page != 0) {
// selecting the thread-starter
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check message_id=$thread $approvedval";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
if(mysqli_num_rows($res) > 0) {
$rec = mysqli_fetch_assoc($res);
$arr[$rec["message_id"]] = $rec;
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
}
return $arr;
}
 
/**
* this function returns the index of a message in a thread
*/
function phorum_db_get_message_index($thread=0,$message_id=0) {
$PHORUM = $GLOBALS["PHORUM"];
 
// check for valid values
if(empty($message_id) || empty($message_id)) {
return 0;
}
 
settype($thread, "int");
settype($message_id, "int");
 
$approvedval="";
$forum_id_check="";
 
$conn = phorum_db_mysqli_connect();
 
if (!empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) AND";
}
 
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
}
 
$sql = "select count(*) as msg_index from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval AND message_id <= $message_id order by message_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$rec = mysqli_fetch_assoc($res);
 
return $rec['msg_index'];
}
 
/**
* This function searches the database for the supplied search
* criteria and returns an array with two elements. One is the count
* of total messages that matched, the second is an array of the
* messages from the results based on the $start (0 base) given and
* the $length given.
*/
 
function phorum_db_search($search, $offset, $length, $match_type, $match_date, $match_forum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$start = $offset * $PHORUM["list_length"];
 
$arr = array("count" => 0, "rows" => array());
 
$conn = phorum_db_mysqli_connect();
 
// have to check what forums they can read first.
$allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ);
// if they are not allowed to search any forums, return the emtpy $arr;
if(empty($allowed_forums) || ($PHORUM['forum_id']>0 && !in_array($PHORUM['forum_id'], $allowed_forums)) ) return $arr;
 
// Add forum 0 (for announcements) to the allowed forums.
$allowed_forums[] = 0;
 
if($PHORUM['forum_id']!=0 && $match_forum!="ALL"){
$forum_where=" and forum_id={$PHORUM['forum_id']}";
} else {
$forum_where=" and forum_id in (".implode(",", $allowed_forums).")";
}
 
if($match_type=="AUTHOR"){
 
$id_table=$PHORUM['search_table']."_auth_".md5(microtime());
 
$search = mysqli_real_escape_string($conn,$search);
 
$sql = "create temporary table $id_table (key(message_id)) ENGINE=HEAP select message_id from {$PHORUM['message_table']} where author='$search' $forum_where";
if($match_date>0){
$ts=time()-86400*$match_date;
$sql.=" and datestamp>=$ts";
}
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
} else {
 
if($match_type=="PHRASE"){
$terms = array('"'.$search.'"');
} else {
$quote_terms=array();
if ( strstr( $search, '"' ) ){
//first pull out all the double quoted strings (e.g. '"iMac DV" or -"iMac DV"')
preg_match_all( '/-*"(.*?)"/', $search, $match );
 
$search = preg_replace( '/-*".*?"/', '', $search );
 
$quote_terms = $match[0];
}
 
//finally pull out the rest words in the string
$terms = preg_split( "/\s+/", $search, 0, PREG_SPLIT_NO_EMPTY );
 
//merge them all together and return
$terms = array_merge( $terms, $quote_terms);
}
 
if(count($terms)){
 
$use_key="";
$extra_where="";
 
/* using this code on larger forums has shown to make the search faster.
However, on smaller forums, it does not appear to help and in fact
appears to slow down searches.
 
if($match_date){
$min_time=time()-86400*$match_date;
$sql="select min(message_id) as min_id from {$PHORUM['message_table']} where datestamp>=$min_time";
$res=mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
$min_id=mysql_result($res, 0, "min_id");
$use_key=" use key (primary)";
$extra_where="and message_id>=$min_id";
}
*/
 
$id_table=$PHORUM['search_table']."_ft_".md5(microtime());
 
if($PHORUM["DBCONFIG"]["mysql_use_ft"]){
 
if($match_type=="ALL" && count($terms)>1){
$against="+".mysqli_real_escape_string($conn, implode(" +", $terms));
} else {
$against=mysqli_real_escape_string($conn, implode(" ", $terms));
}
 
$clause="MATCH (search_text) AGAINST ('$against' IN BOOLEAN MODE)";
 
} else {
 
if($match_type=="ALL"){
$conj="and";
} else {
$conj="or";
}
 
// quote strings correctly
foreach ($terms as $id => $term) {
$terms[$id] = mysqli_real_escape_string($conn,$term);
}
 
$clause = "( search_text like '%".implode("%' $conj search_text like '%", $terms)."%' )";
 
}
 
$sql = "create temporary table $id_table (key(message_id)) ENGINE=HEAP select message_id from {$PHORUM['search_table']} $use_key where $clause $extra_where";
$res = mysqli_query($conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
}
}
 
 
if(isset($id_table)){
 
// create a temporary table of the messages we want
$table=$PHORUM['search_table']."_".md5(microtime());
$sql="create temporary table $table (key (forum_id, status, datestamp)) ENGINE=HEAP select {$PHORUM['message_table']}.message_id, {$PHORUM['message_table']}.datestamp, status, forum_id from {$PHORUM['message_table']} inner join $id_table using (message_id) where status=".PHORUM_STATUS_APPROVED." $forum_where";
 
if($match_date>0){
$ts=time()-86400*$match_date;
$sql.=" and datestamp>=$ts";
}
 
$res=mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$sql="select count(*) as count from $table";
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$total_count=$tmp_row[0];
 
$sql="select message_id from $table order by datestamp desc limit $start, $length";
$res = mysqli_query($conn, $sql, MYSQLI_USE_RESULT );
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$idstring="";
while ($rec = mysqli_fetch_row($res)){
$idstring.="$rec[0],";
}
mysqli_free_result ( $res );
 
$idstring=substr($idstring, 0, -1);
 
if($idstring){
$sql="select * from {$PHORUM['message_table']} where message_id in ($idstring) order by datestamp desc";
$res = mysqli_query($conn, $sql, MYSQLI_USE_RESULT);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$rows = array();
 
while ($rec = mysqli_fetch_assoc($res)){
$rows[$rec["message_id"]] = $rec;
}
 
mysqli_free_result ( $res );
 
$arr = array("count" => $total_count, "rows" => $rows);
}
}
 
return $arr;
}
 
/**
* This function returns the closest thread that is greater than $thread
*/
 
function phorum_db_get_newer_thread($key){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($key, "int");
 
$conn = phorum_db_mysqli_connect();
 
$keyfield = ($PHORUM["float_to_top"]) ? "modifystamp" : "thread";
 
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && $PHORUM["moderation"] == PHORUM_MODERATE_ON) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
} else {
$approvedval="AND {$PHORUM['message_table']}.parent_id = 0";
}
 
$sql = "select thread from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} $approvedval and $keyfield>$key order by $keyfield limit 1";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)) {
$tmp_row=mysqli_fetch_row($res);
$retid=$tmp_row[0];
} else {
$retid=0;
}
 
return $retid;
}
 
/**
* This function returns the closest thread that is less than $thread
*/
 
function phorum_db_get_older_thread($key){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($key, "int");
 
$conn = phorum_db_mysqli_connect();
 
$keyfield = ($PHORUM["float_to_top"]) ? "modifystamp" : "thread";
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && $PHORUM["moderation"] == PHORUM_MODERATE_ON) {
$approvedval="AND {$PHORUM['message_table']}.status=".PHORUM_STATUS_APPROVED;
} else {
$approvedval="AND {$PHORUM['message_table']}.parent_id = 0";
}
 
$sql = "select thread from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} $approvedval and $keyfield<$key order by $keyfield desc limit 1";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)) {
$tmp_row=mysqli_fetch_row($res);
$retid=$tmp_row[0];
} else {
$retid=0;
}
 
return $retid;
}
 
/**
* This function executes a query to get bad items of type $type and
* returns an array of the results.
*/
 
function phorum_db_load_settings(){
global $PHORUM;
 
 
$conn = phorum_db_mysqli_connect();
 
$sql = "select * from {$PHORUM['settings_table']}";
 
$res = mysqli_query( $conn, $sql);
if(!$res && !defined("PHORUM_ADMIN")){
if (mysqli_errno($conn)==1146){
// settings table does not exist
return;
} elseif(($err = mysqli_error($conn))){
phorum_db_mysqli_error("$err: $sql");
}
}
 
if (empty($err) && $res){
while ($rec = mysqli_fetch_assoc($res)){
 
// only load the default forum options in the admin
if($rec["name"]=="default_forum_options" && !defined("PHORUM_ADMIN")) continue;
 
if ($rec["type"] == "V"){
if ($rec["data"] == 'true'){
$val = true;
}elseif ($rec["data"] == 'false'){
$val = false;
}elseif (is_numeric($rec["data"])){
$val = $rec["data"];
}else{
$val = "$rec[data]";
}
}else{
$val = unserialize($rec["data"]);
}
 
$PHORUM[$rec['name']]=$val;
$PHORUM['SETTINGS'][$rec['name']]=$val;
}
}
}
 
/**
* This function executes a query to get bad items of type $type and
* returns an array of the results.
*/
 
function phorum_db_update_settings($settings){
global $PHORUM;
 
if (count($settings) > 0){
$conn = phorum_db_mysqli_connect();
 
foreach($settings as $field => $value){
if (is_numeric($value)){
$type = 'V';
}elseif (is_string($value)){
$value = mysqli_real_escape_string ( $conn, $value);
$type = 'V';
}else{
$value = mysqli_real_escape_string ( $conn, serialize($value));
$type = 'S';
}
 
$sql = "replace into {$PHORUM['settings_table']} set data='$value', type='$type', name='$field'";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
return ($res > 0) ? true : false;
}else{
trigger_error("\$settings cannot be empty in phorum_db_update_settings()", E_USER_ERROR);
}
}
 
/**
* This function executes a query to select all forum data from
* the database for a flat/collapsed display and returns the data in
* an array.
*/
 
 
function phorum_db_get_forums($forum_ids = 0, $parent_id = -1, $vroot = null, $inherit_id = null){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($parent_id, "int");
 
$conn = phorum_db_mysqli_connect();
 
if (is_array($forum_ids)) {
$int_ids = array();
foreach ($forum_ids as $id) {
settype($id, "int");
$int_ids[] = $id;
}
$forum_ids = implode(",", $int_ids);
} else {
settype($forum_ids, "int");
}
 
$sql = "select * from {$PHORUM['forums_table']} ";
if ($forum_ids){
$sql .= " where forum_id in ($forum_ids)";
} elseif ($inherit_id !== null) {
$sql .= " where inherit_id = $inherit_id";
if(!defined("PHORUM_ADMIN")) $sql.=" and active=1";
} elseif ($parent_id >= 0) {
$sql .= " where parent_id = $parent_id";
if(!defined("PHORUM_ADMIN")) $sql.=" and active=1";
} elseif($vroot !== null) {
$sql .= " where vroot = $vroot";
} else {
$sql .= " where forum_id <> 0";
}
 
$sql .= " order by display_order ASC, name";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$forums = array();
 
while ($row = mysqli_fetch_assoc($res)){
$forums[$row["forum_id"]] = $row;
}
 
return $forums;
}
 
/**
* This function updates the forums stats. If refresh is true, it pulls the
* numbers from the table.
*/
 
function phorum_db_update_forum_stats($refresh=false, $msg_count_change=0, $timestamp=0, $thread_count_change=0, $sticky_count_change=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
// always refresh on small forums
if (isset($PHORUM["message_count"]) && $PHORUM["message_count"]<1000) {
$refresh=true;
}
 
if($refresh || empty($msg_count_change)){
$sql = "select count(*) as message_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and status=".PHORUM_STATUS_APPROVED;
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
 
$message_count = (int)$tmp_row[0];
} else {
$message_count="message_count+$msg_count_change";
}
 
if($refresh || empty($timestamp)){
 
$sql = "select max(modifystamp) as last_post_time from {$PHORUM['message_table']} where status=".PHORUM_STATUS_APPROVED." and forum_id={$PHORUM['forum_id']}";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$last_post_time = (int)$tmp_row[0];
} else {
 
$last_post_time = $timestamp;
}
 
if($refresh || empty($thread_count_change)){
 
$sql = "select count(*) as thread_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and parent_id=0 and status=".PHORUM_STATUS_APPROVED;
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$thread_count = (int)$tmp_row[0];
 
} else {
 
$thread_count="thread_count+$thread_count_change";
}
 
if($refresh || empty($sticky_count_change)){
 
$sql = "select count(*) as sticky_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and sort=".PHORUM_SORT_STICKY." and parent_id=0 and status=".PHORUM_STATUS_APPROVED;
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$sticky_count = (int)$tmp_row[0];
 
} else {
 
$sticky_count="sticky_count+$sticky_count_change";
}
 
$sql = "update {$PHORUM['forums_table']} set thread_count=$thread_count, message_count=$message_count, sticky_count=$sticky_count, last_post_time=$last_post_time where forum_id={$PHORUM['forum_id']}";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
}
 
/**
* actually moves a thread to the given forum
*/
function phorum_db_move_thread($thread_id, $toforum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
settype($toforum, "int");
 
if($toforum > 0 && $thread_id > 0){
$conn = phorum_db_mysqli_connect();
// retrieving the messages for the newflags and search updates below
$thread_messages=phorum_db_get_messages($thread_id);
 
// just changing the forum-id, simple isn't it?
$sql = "UPDATE {$PHORUM['message_table']} SET forum_id=$toforum where thread=$thread_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// we need to update the number of posts in the current forum
phorum_db_update_forum_stats(true);
 
// and of the new forum
$old_id=$GLOBALS["PHORUM"]["forum_id"];
$GLOBALS["PHORUM"]["forum_id"]=$toforum;
phorum_db_update_forum_stats(true);
$GLOBALS["PHORUM"]["forum_id"]=$old_id;
 
// move the new-flags and the search records for this thread
// to the new forum too
unset($thread_messages['users']);
 
$new_newflags=phorum_db_newflag_get_flags($toforum);
$message_ids = array();
$delete_ids = array();
$search_ids = array();
foreach($thread_messages as $mid => $data) {
// gather information for updating the newflags
if($mid > $new_newflags['min_id']) { // only using it if its higher than min_id
$message_ids[]=$mid;
} else { // newflags to delete
$delete_ids[]=$mid;
}
 
// gather the information for updating the search table
$search_ids[] = $mid;
}
 
if(count($message_ids)) { // we only go in if there are messages ... otherwise an error occured
 
$ids_str=implode(",",$message_ids);
 
// then doing the update to newflags
$sql="UPDATE IGNORE {$PHORUM['user_newflags_table']} SET forum_id = $toforum where message_id IN($ids_str)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// then doing the update to subscriptions
$sql="UPDATE {$PHORUM['subscribers_table']} SET forum_id = $toforum where thread IN($ids_str)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
}
 
if(count($delete_ids)) {
$ids_str=implode(",",$delete_ids);
// then doing the delete
$sql="DELETE FROM {$PHORUM['user_newflags_table']} where message_id IN($ids_str)";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
if (count($search_ids)) {
$ids_str = implode(",",$search_ids);
// then doing the search table update
$sql = "UPDATE {$PHORUM['search_table']} set forum_id = $toforum where message_id in ($ids_str)";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
}
}
 
/**
* closes the given thread
*/
function phorum_db_close_thread($thread_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
 
if($thread_id > 0){
$conn = phorum_db_mysqli_connect();
 
$sql = "UPDATE {$PHORUM['message_table']} SET closed=1 where thread=$thread_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
}
 
/**
* (re)opens the given thread
*/
function phorum_db_reopen_thread($thread_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
 
if($thread_id > 0){
$conn = phorum_db_mysqli_connect();
 
$sql = "UPDATE {$PHORUM['message_table']} SET closed=0 where thread=$thread_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
}
 
/**
* This function executes a query to insert a forum into the forums
* table and returns the forums id on success or 0 on failure.
*/
 
function phorum_db_add_forum($forum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
foreach($forum as $key => $value){
if (is_numeric($value)){
$value = (int)$value;
$fields[] = "$key=$value";
} elseif($value=="NULL") {
$fields[] = "$key=$value";
}else{
$value = mysqli_real_escape_string($conn, $value);
$fields[] = "$key='$value'";
}
}
 
$sql = "insert into {$PHORUM['forums_table']} set " . implode(", ", $fields);
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$forum_id = 0;
 
if ($res){
$forum_id = mysqli_insert_id($conn);
}
 
return $forum_id;
}
 
/**
* This function executes a query to remove a forum from the forums
* table and its messages.
*/
 
function phorum_db_drop_forum($forum_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$conn = phorum_db_mysqli_connect();
 
$tables = array (
$PHORUM['message_table'],
$PHORUM['user_permissions_table'],
$PHORUM['user_newflags_table'],
$PHORUM['subscribers_table'],
$PHORUM['forum_group_xref_table'],
$PHORUM['forums_table'],
$PHORUM['banlist_table'],
$PHORUM['search_table']
);
 
foreach($tables as $table){
$sql = "delete from $table where forum_id=$forum_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
$sql = "select file_id from {$PHORUM['files_table']} left join {$PHORUM['message_table']} using (message_id) where {$PHORUM['files_table']}.message_id > 0 AND link='" . PHORUM_LINK_MESSAGE . "' AND {$PHORUM['message_table']}.message_id is NULL";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
while($rec=mysqli_fetch_assoc($res)){
$files[]=$rec["file_id"];
}
if(isset($files)){
$sql = "delete from {$PHORUM['files_table']} where file_id in (".implode(",", $files).")";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
 
}
 
/**
* This function executes a query to remove a folder from the forums
* table and change the parent of its children.
*/
 
function phorum_db_drop_folder($forum_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$conn = phorum_db_mysqli_connect();
 
$sql = "select parent_id from {$PHORUM['forums_table']} where forum_id=$forum_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$new_parent_id = $tmp_row[0];
 
$sql = "update {$PHORUM['forums_table']} set parent_id=$new_parent_id where parent_id=$forum_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$sql = "delete from {$PHORUM['forums_table']} where forum_id=$forum_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
/**
* This function executes a query to update a forum in the forums
* table and returns non zero on success or 0 on failure.
*/
 
function phorum_db_update_forum($forum){
$PHORUM = $GLOBALS["PHORUM"];
 
$res = 0;
 
if (!empty($forum["forum_id"])){
 
// this way we can also update multiple forums at once
if(is_array($forum["forum_id"])) {
$forumwhere="forum_id IN (".implode(",",$forum["forum_id"]).")";
} else {
$forumwhere="forum_id=".$forum["forum_id"];
}
 
unset($forum["forum_id"]);
 
$conn = phorum_db_mysqli_connect();
 
foreach($forum as $key => $value){
if (is_numeric($value)){
$value = (int)$value;
$fields[] = "$key=$value";
} elseif($value=="NULL") {
$fields[] = "$key=$value";
} else {
$value = mysqli_real_escape_string($conn, $value);
$fields[] = "$key='$value'";
}
}
 
$sql = "update {$PHORUM['forums_table']} set " . implode(", ", $fields) . " where $forumwhere";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}else{
trigger_error("\$forum[forum_id] cannot be empty in phorum_update_forum()", E_USER_ERROR);
}
 
return $res;
}
 
/**
*
*/
 
function phorum_db_get_groups($group_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysqli_connect();
 
settype($group_id, "integer");
 
$sql="select * from {$PHORUM['groups_table']}";
if($group_id!=0) $sql.=" where group_id=$group_id";
 
$res = mysqli_query( $conn, $sql);
 
$groups=array();
while($rec=mysqli_fetch_assoc($res)){
 
$groups[$rec["group_id"]]=$rec;
$groups[$rec["group_id"]]["permissions"]=array();
}
 
$sql="select * from {$PHORUM['forum_group_xref_table']}";
if($group_id!=0) $sql.=" where group_id=$group_id";
 
$res = mysqli_query( $conn, $sql);
 
while($rec=mysqli_fetch_assoc($res)){
 
$groups[$rec["group_id"]]["permissions"][$rec["forum_id"]]=$rec["permission"];
 
}
 
return $groups;
 
}
 
/**
* Get the members of a group.
* @param group_id - can be an integer (single group), or an array of groups
* @param status - a specific status to look for, defaults to all
* @return array - users (key is userid, value is group membership status)
*/
 
function phorum_db_get_group_members($group_id, $status = PHORUM_USER_GROUP_REMOVE)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysqli_connect();
 
if(is_array($group_id)){
$group_id=implode(",", $group_id);
} else {
settype($group_id, "int");
}
 
// this join is only here so that the list of users comes out sorted
// if phorum_db_user_get() sorts results itself, this join can go away
$sql="select {$PHORUM['user_group_xref_table']}.user_id, {$PHORUM['user_group_xref_table']}.status from {$PHORUM['user_table']}, {$PHORUM['user_group_xref_table']} where {$PHORUM['user_table']}.user_id = {$PHORUM['user_group_xref_table']}.user_id and group_id in ($group_id)";
if ($status != PHORUM_USER_GROUP_REMOVE) $sql.=" and {$PHORUM['user_group_xref_table']}.status = $status";
$sql .=" order by username asc";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
$users=array();
while($rec=mysqli_fetch_assoc($res)){
$users[$rec["user_id"]]=$rec["status"];
}
 
return $users;
 
}
 
/**
*
*/
 
function phorum_db_save_group($group)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysqli_connect();
 
$ret=false;
 
if(isset($group["name"])){
$sql="update {$PHORUM['groups_table']} set name='{$group['name']}', open={$group['open']} where group_id={$group['group_id']}";
 
$res=mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
}
 
if(!$err){
 
if(isset($group["permissions"])){
$sql="delete from {$PHORUM['forum_group_xref_table']} where group_id={$group['group_id']}";
 
$res=mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
foreach($group["permissions"] as $forum_id=>$permission){
$sql="insert into {$PHORUM['forum_group_xref_table']} set group_id={$group['group_id']}, permission=$permission, forum_id=$forum_id";
$res=mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
if(!$res) break;
}
}
}
 
if($res>0) $ret=true;
 
return $ret;
 
}
 
function phorum_db_delete_group($group_id)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysqli_connect();
 
settype($group_id, "int");
 
$sql = "delete from {$PHORUM['groups_table']} where group_id = $group_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// delete things associated with groups
$sql = "delete from {$PHORUM['user_group_xref_table']} where group_id = $group_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$sql = "delete from {$PHORUM['forum_group_xref_table']} where group_id = $group_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
/**
* phorum_db_add_group()
*
* @param $group_name $group_id
* @return
**/
function phorum_db_add_group($group_name,$group_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysqli_connect();
 
settype($group_id, "int");
 
if($group_id > 0) { // only used in conversion
$sql="insert into {$PHORUM['groups_table']} (group_id,name) values ($group_id,'$group_name')";
} else {
$sql="insert into {$PHORUM['groups_table']} (name) values ('$group_name')";
}
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$group_id = 0;
 
if ($res) {
$group_id = mysqli_insert_id($conn);
}
 
return $group_id;
}
 
/**
* This function returns all moderators for a particular forum
*/
function phorum_db_user_get_moderators($forum_id,$ignore_user_perms=false,$for_email=false) {
 
$PHORUM = $GLOBALS["PHORUM"];
$userinfo=array();
 
$conn = phorum_db_mysqli_connect();
 
settype($forum_id, "int");
 
if(!$ignore_user_perms) { // sometimes we just don't need them
if(!$PHORUM['email_ignore_admin']) {
$admincheck=" OR user.admin=1";
} else {
$admincheck="";
}
 
 
$sql="SELECT DISTINCT user.user_id, user.email, user.moderation_email FROM {$PHORUM['user_table']} as user LEFT JOIN {$PHORUM['user_permissions_table']} as perm ON perm.user_id=user.user_id WHERE (perm.permission >= ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." AND (perm.permission & ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." > 0) AND perm.forum_id=$forum_id)$admincheck";
 
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_row($res)){
if(!$for_email || $row[2] == 1)
$userinfo[$row[0]]=$row[1];
}
 
}
 
// get users who belong to groups that have moderator access
$sql = "SELECT DISTINCT user.user_id, user.email, user.moderation_email FROM {$PHORUM['user_table']} AS user, {$PHORUM['groups_table']} AS groups, {$PHORUM['user_group_xref_table']} AS usergroup, {$PHORUM['forum_group_xref_table']} AS forumgroup WHERE user.user_id = usergroup.user_id AND usergroup.group_id = groups.group_id AND groups.group_id = forumgroup.group_id AND forum_id = $forum_id AND permission & ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." > 0 AND usergroup.status >= ".PHORUM_USER_GROUP_APPROVED;
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_row($res)){
if(!$for_email || $row[2] == 1)
$userinfo[$row[0]]=$row[1];
}
return $userinfo;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
*/
 
function phorum_db_user_get($user_id, $detailed)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if(is_array($user_id)){
$user_ids=implode(",", $user_id);
} else {
$user_ids=(int)$user_id;
}
 
$users = array();
 
$sql = "select * from {$PHORUM['user_table']} where user_id in ($user_ids)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)){
while($rec=mysqli_fetch_assoc($res)){
$users[$rec["user_id"]] = $rec;
}
 
if ($detailed){
// get the users' permissions
$sql = "select * from {$PHORUM['user_permissions_table']} where user_id in ($user_ids)";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_assoc($res)){
$users[$row["user_id"]]["forum_permissions"][$row["forum_id"]] = $row["permission"];
}
 
// get the users' groups and forum permissions through those groups
$sql = "select user_id, {$PHORUM['user_group_xref_table']}.group_id, forum_id, permission from {$PHORUM['user_group_xref_table']} left join {$PHORUM['forum_group_xref_table']} using (group_id) where user_id in ($user_ids) AND {$PHORUM['user_group_xref_table']}.status >= ".PHORUM_USER_GROUP_APPROVED;
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_assoc($res)){
$users[$row["user_id"]]["groups"][$row["group_id"]] = $row["group_id"];
if(!empty($row["forum_id"])){
if(!isset($users[$row["user_id"]]["group_permissions"][$row["forum_id"]])) {
$users[$row["user_id"]]["group_permissions"][$row["forum_id"]] = 0;
}
$users[$row["user_id"]]["group_permissions"][$row["forum_id"]] = $users[$row["user_id"]]["group_permissions"][$row["forum_id"]] | $row["permission"];
}
}
 
}
$sql = "select * from {$PHORUM['user_custom_fields_table']} where user_id in ($user_ids)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_assoc($res)){
if(isset($PHORUM["PROFILE_FIELDS"][$row['type']])) {
if($PHORUM["PROFILE_FIELDS"][$row['type']]['html_disabled']) {
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = htmlspecialchars($row["data"]);
} else { // not html-disabled
if(substr($row["data"],0,6) == 'P_SER:') {
// P_SER (PHORUM_SERIALIZED) is our marker telling this field is serialized
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = unserialize(substr($row["data"],6));
} else {
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = $row["data"];
}
}
}
}
 
}
 
if(is_array($user_id)){
return $users;
} else {
return isset($users[$user_id]) ? $users[$user_id] : NULL;
}
 
}
 
/*
* Generic function to retrieve a couple of fields from the user-table
* for a couple of users or only one of them
*
* result is always an array with one or more users in it
*/
 
function phorum_db_user_get_fields($user_id, $fields)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
// input could be either array or string
if(is_array($user_id)){
$user_ids=implode(",", $user_id);
} else {
$user_ids=(int)$user_id;
}
 
 
if(is_array($fields)) {
$fields_str=implode(",",$fields);
} else {
$fields_str=$fields;
}
 
$users = array();
 
 
 
$sql = "select user_id,$fields_str from {$PHORUM['user_table']} where user_id in ($user_ids)";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)){
while($rec=mysqli_fetch_assoc($res)){
$users[$rec["user_id"]] = $rec;
}
}
 
return $users;
 
}
 
/**
* This function gets a list of all the active users.
* @return array - (key: userid, value: array (username, displayname)
*/
function phorum_db_user_get_list(){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$users = array();
$sql = "select user_id, username from {$PHORUM['user_table']} order by username asc";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while ($row = mysqli_fetch_assoc($res)){
$users[$row["user_id"]] = array("username" => $row["username"], "displayname" => $row["username"]);
}
 
return $users;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
*/
 
function phorum_db_user_check_pass($username, $password, $temp_password=false){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$username = mysqli_real_escape_string($conn, $username);
 
$password = mysqli_real_escape_string($conn, $password);
 
$pass_field = ($temp_password) ? "password_temp" : "password";
 
$sql = "select user_id from {$PHORUM['user_table']} where username='$username' and $pass_field='$password'";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if($res && mysqli_num_rows($res)) {
$tmp_row=mysqli_fetch_row($res);
$retval=$tmp_row[0];
} else {
$retval=0;
}
return $retval;
}
 
/**
* This function executes a query to check for the given field in the
* user tableusername and return the user_id of the user it matches or 0
* if no match is found.
*
* The parameters can be arrays. If they are, all must be passed and all
* must have the same number of values.
*
* If $return_array is true, an array of all matching rows will be returned.
* Otherwise, only the first user_id from the results will be returned.
*/
 
function phorum_db_user_check_field($field, $value, $operator="=", $return_array=false){
$PHORUM = $GLOBALS["PHORUM"];
 
$ret = 0;
 
$conn = phorum_db_mysqli_connect();
 
if(!is_array($field)){
$field=array($field);
}
 
if(!is_array($value)){
$value=array($value);
}
 
if(!is_array($operator)){
$operator=array($operator);
}
 
foreach($field as $key=>$name){
$value[$key] = mysqli_real_escape_string($conn, $value[$key]);
$clauses[]="$name $operator[$key] '$value[$key]'";
}
 
$sql = "select user_id from {$PHORUM['user_table']} where ".implode(" and ", $clauses);
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if ($res && mysqli_num_rows($res)){
if($return_array){
$ret=array();
while($row=mysqli_fetch_assoc($res)){
$ret[$row["user_id"]]=$row["user_id"];
}
} else {
$tmp_row=mysqli_fetch_row($res);
$ret = $tmp_row[0];
}
}
 
return $ret;
}
 
 
/**
* This function executes a query to add the given user data to the
* database and returns the userid or 0
*/
 
function phorum_db_user_add($userdata){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if (isset($userdata["forum_permissions"]) && !empty($userdata["forum_permissions"])){
$forum_perms = $userdata["forum_permissions"];
unset($userdata["forum_permissions"]);
}
 
if (isset($userdata["user_data"]) && !empty($userdata["user_data"])){
$user_data = $userdata["user_data"];
unset($userdata["user_data"]);
}
 
 
$sql = "insert into {$PHORUM['user_table']} set ";
 
$values = array();
 
foreach($userdata as $key => $value){
if (!is_numeric($value)){
$value = mysqli_real_escape_string($conn, $value);
$values[] = "$key='$value'";
}else{
$values[] = "$key=$value";
}
}
 
$sql .= implode(", ", $values);
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$user_id = 0;
if ($res){
$user_id = mysqli_insert_id($conn);
}
 
if ($res){
if(isset($forum_perms)) {
// storing forum-permissions
foreach($forum_perms as $fid => $p){
$sql = "insert into {$PHORUM['user_permissions_table']} set user_id=$user_id, forum_id=$fid, permission=$p";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
break;
}
}
}
if(isset($user_data)) {
/* storing custom-fields */
foreach($user_data as $key => $val){
if(is_array($val)) { /* arrays need to be serialized */
$val = 'P_SER:'.serialize($val);
/* P_SER: (PHORUM_SERIALIZED is our marker telling this Field is serialized */
} else { /* other vars need to be escaped */
$val = mysqli_real_escape_string($conn, $val);
}
$sql = "insert into {$PHORUM['user_custom_fields_table']} (user_id,type,data) VALUES($user_id,$key,'$val')";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
break;
}
}
}
}
 
return $user_id;
}
 
 
/**
* This function executes a query to update the given user data in the
* database and returns the true or false
*/
function phorum_db_user_save($userdata){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if(isset($userdata["permissions"])){
unset($userdata["permissions"]);
}
 
if (isset($userdata["forum_permissions"])){
$forum_perms = $userdata["forum_permissions"];
unset($userdata["forum_permissions"]);
}
 
if (isset($userdata["groups"])){
$groups = $userdata["groups"];
unset($userdata["groups"]);
unset($userdata["group_permissions"]);
}
if (isset($userdata["user_data"])){
$user_data = $userdata["user_data"];
unset($userdata["user_data"]);
}
 
$user_id = $userdata["user_id"];
unset($userdata["user_id"]);
 
if(count($userdata)){
 
$sql = "update {$PHORUM['user_table']} set ";
 
$values = array();
 
foreach($userdata as $key => $value){
$values[] = "$key='".mysqli_real_escape_string($conn, $value)."'";
}
 
$sql .= implode(", ", $values);
 
$sql .= " where user_id=$user_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
if (isset($forum_perms)){
 
$sql = "delete from {$PHORUM['user_permissions_table']} where user_id = $user_id";
$res=mysqli_query( $conn, $sql);
 
foreach($forum_perms as $fid=>$perms){
$sql = "insert into {$PHORUM['user_permissions_table']} set user_id=$user_id, forum_id=$fid, permission=$perms";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
}
}
if(isset($user_data)) {
// storing custom-fields
$sql = "delete from {$PHORUM['user_custom_fields_table']} where user_id = $user_id";
$res=mysqli_query( $conn, $sql);
 
if(is_array($user_data)) {
foreach($user_data as $key => $val){
if(is_array($val)) { /* arrays need to be serialized */
$val = 'P_SER:'.serialize($val);
/* P_SER: (PHORUM_SERIALIZED is our marker telling this Field is serialized */
} else { /* other vars need to be escaped */
$val = mysqli_real_escape_string($conn, $val);
}
 
$sql = "insert into {$PHORUM['user_custom_fields_table']} (user_id,type,data) VALUES($user_id,$key,'$val')";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
break;
}
}
}
}
 
return (bool)$res;
}
 
/**
* This function saves a users group permissions.
*/
function phorum_db_user_save_groups($user_id, $groups)
{
$PHORUM = $GLOBALS["PHORUM"];
if (!$user_id > 0){
return false;
}
 
settype($user_id, "int");
 
// erase the group memberships they have now
$conn = phorum_db_mysqli_connect();
$sql = "delete from {$PHORUM['user_group_xref_table']} where user_id = $user_id";
$res=mysqli_query( $conn, $sql);
 
foreach($groups as $group_id => $group_perm){
$sql = "insert into {$PHORUM['user_group_xref_table']} set user_id=$user_id, group_id=$group_id, status=$group_perm";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
break;
}
}
return (bool)$res;
}
 
/**
* This function executes a query to subscribe a user to a forum/thread.
*/
 
function phorum_db_user_subscribe($user_id, $forum_id, $thread, $type)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($user_id, "int");
settype($forum_id, "int");
settype($thread, "int");
settype($type, "int");
 
$conn = phorum_db_mysqli_connect();
 
$sql = "replace into {$PHORUM['subscribers_table']} set user_id=$user_id, forum_id=$forum_id, sub_type=$type, thread=$thread";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function increases the post-counter for a user by one
*/
function phorum_db_user_addpost() {
 
$conn = phorum_db_mysqli_connect();
 
$sql="UPDATE ".$GLOBALS['PHORUM']['user_table']." SET posts=posts+1 WHERE user_id = ".$GLOBALS['PHORUM']['user']['user_id'];
$res=mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function executes a query to unsubscribe a user to a forum/thread.
*/
 
function phorum_db_user_unsubscribe($user_id, $thread, $forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($user_id, "int");
settype($forum_id, "int");
settype($thread, "int");
 
$conn = phorum_db_mysqli_connect();
 
$sql = "DELETE FROM {$PHORUM['subscribers_table']} WHERE user_id=$user_id AND thread=$thread";
if($forum_id) $sql.=" and forum_id=$forum_id";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function will return a list of groups the user
* is a member of, as well as the users permissions.
*/
function phorum_db_user_get_groups($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
$groups = array();
 
if (!$user_id > 0){
return $groups;
}
 
settype($user_id, "int");
 
$conn = phorum_db_mysqli_connect();
$sql = "SELECT group_id, status FROM {$PHORUM['user_group_xref_table']} WHERE user_id = $user_id ORDER BY status DESC";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while($row = mysqli_fetch_assoc($res)){
$groups[$row["group_id"]] = $row["status"];
}
 
return $groups;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
* If $search is empty, all users should be returned.
*/
 
function phorum_db_search_users($search)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$users = array();
 
$search = trim($search);
 
$sql = "select user_id, username, email, active, posts, date_last_active from {$PHORUM['user_table']} where username like '%$search%' or email like '%$search%'order by username";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)){
while ($user = mysqli_fetch_assoc($res)){
$users[$user["user_id"]] = $user;
}
}
 
return $users;
}
 
 
/**
* This function gets the users that await approval
*/
 
function phorum_db_user_get_unapproved()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$sql="select user_id, username, email from {$PHORUM['user_table']} where active in(".PHORUM_USER_PENDING_BOTH.", ".PHORUM_USER_PENDING_MOD.") order by username";
$res=mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
$users=array();
if($res){
while($rec=mysqli_fetch_assoc($res)){
$users[$rec["user_id"]]=$rec;
}
}
 
return $users;
 
}
/**
* This function deletes a user completely
* - entry in the users-table
* - entries in the permissions-table
* - entries in the newflags-table
* - entries in the subscribers-table
* - entries in the group_xref-table
* - entries in the private-messages-table
* - entries in the files-table
* - sets entries in the messages-table to anonymous
*
*/
function phorum_db_user_delete($user_id) {
$PHORUM = $GLOBALS["PHORUM"];
 
// how would we check success???
$ret = true;
 
settype($user_id, "int");
 
$conn = phorum_db_mysqli_connect();
// user-table
$sql = "delete from {$PHORUM['user_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// permissions-table
$sql = "delete from {$PHORUM['user_permissions_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// newflags-table
$sql = "delete from {$PHORUM['user_newflags_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// subscribers-table
$sql = "delete from {$PHORUM['subscribers_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// group-xref-table
$sql = "delete from {$PHORUM['user_group_xref_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// private messages
$sql = "select * from {$PHORUM["pm_xref_table"]} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
while ($row = mysqli_fetch_assoc($res)) {
$folder = $row["pm_folder_id"] == 0 ? $row["special_folder"] : $row["pm_folder_id"];
phorum_db_pm_delete($row["pm_message_id"], $folder, $user_id);
}
 
// pm_buddies
$sql = "delete from {$PHORUM["pm_buddies_table"]} where user_id=$user_id or buddy_user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// private message folders
$sql = "delete from {$PHORUM["pm_folders_table"]} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// files-table
$sql = "delete from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// custom-fields-table
$sql = "delete from {$PHORUM['user_custom_fields_table']} where user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// messages-table
if(PHORUM_DELETE_CHANGE_AUTHOR) {
$sql = "update {$PHORUM['message_table']} set user_id=0,email='',author='".mysqli_real_escape_string($conn,$PHORUM['DATA']['LANG']['AnonymousUser'])."' where user_id=$user_id";
} else {
$sql = "update {$PHORUM['message_table']} set user_id=0,email='' where user_id=$user_id";
}
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return $ret;
}
 
 
/**
* This function gets the users file list
*/
 
function phorum_db_get_user_file_list($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($user_id, "int");
 
$files=array();
 
$sql="select file_id, filename, filesize, add_datetime from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
if($res){
while($rec=mysqli_fetch_assoc($res)){
$files[$rec["file_id"]]=$rec;
}
}
 
return $files;
}
 
 
/**
* This function gets the message's file list
*/
 
function phorum_db_get_message_file_list($message_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$files=array();
 
$sql="select file_id, filename, filesize, add_datetime from {$PHORUM['files_table']} where message_id=$message_id and link='" . PHORUM_LINK_MESSAGE . "'";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
if($res){
while($rec=mysqli_fetch_assoc($res)){
$files[$rec["file_id"]]=$rec;
}
}
 
return $files;
}
 
 
/**
* This function retrieves a file from the db
*/
 
function phorum_db_file_get($file_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($file_id, "int");
 
$file=array();
 
$sql="select * from {$PHORUM['files_table']} where file_id=$file_id";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
if($res){
$file=mysqli_fetch_assoc($res);
}
 
return $file;
}
 
 
/**
* This function saves a file to the db
*/
 
function phorum_db_file_save($user_id, $filename, $filesize, $buffer, $message_id=0, $link=null)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if (is_null($link)) {
$link = $message_id ? PHORUM_LINK_MESSAGE : PHORUM_LINK_USER;
} else {
$link = addslashes($link);
}
 
$conn = phorum_db_mysqli_connect();
 
$file_id=0;
 
settype($user_id, "int");
settype($message_id, "int");
settype($filesize, "int");
 
$filename=addslashes($filename);
 
$sql="insert into {$PHORUM['files_table']} set user_id=$user_id, message_id=$message_id, link='$link', filename='$filename', filesize=$filesize, file_data='$buffer', add_datetime=".time();
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
if($res){
$file_id=mysqli_insert_id($conn);
}
 
return $file_id;
}
 
 
/**
* This function saves a file to the db
*/
 
function phorum_db_file_delete($file_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($file_id, "int");
 
$sql="delete from {$PHORUM['files_table']} where file_id=$file_id";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
return $res;
}
 
/**
* This function links a file to a specific message
*/
 
function phorum_db_file_link($file_id, $message_id, $link = null)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if (is_null($link)) {
$link = $message_id ? PHORUM_LINK_MESSAGE : PHORUM_LINK_USER;
} else {
$link = addslashes($link);
}
 
$conn = phorum_db_mysqli_connect();
 
settype($file_id, "int");
settype($message_id, "int");
 
$sql="update {$PHORUM['files_table']} " .
"set message_id=$message_id, link='$link' " .
"where file_id=$file_id";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
return $res;
}
 
/**
* This function reads the current total size of all files for a user
*/
 
function phorum_db_get_user_filesize_total($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($user_id, "int");
 
$total=0;
 
$sql="select sum(filesize) as total from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}
 
if($res){
$tmp_row=mysqli_fetch_row($res);
$total=$tmp_row[0];
}
 
return $total;
 
}
 
/**
* This function is used for cleaning up stale files from the
* database. Stale files are files that are not linked to
* anything. These can for example be caused by users that
* are writing a message with attachments, but never post
* it.
* @param live_run - If set to false (default), the function
* will return a list of files that will
* be purged. If set to true, files will
* be purged.
*/
function phorum_db_file_purge_stale_files($live_run = false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$where = "link='" . PHORUM_LINK_EDITOR. "' " .
"and add_datetime<". (time()-PHORUM_MAX_EDIT_TIME);
 
// Purge files.
if ($live_run) {
 
// Delete files that are linked to the editor and are
// added a while ago. These are from abandoned posts.
$sql = "delete from {$PHORUM['files_table']} " .
"where $where";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return true;
 
// Only select a list of files that can be purged.
} else {
 
// Select files that are linked to the editor and are
// added a while ago. These are from abandoned posts.
$sql = "select file_id, filename, filesize, add_datetime " .
"from {$PHORUM['files_table']} " .
"where $where";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$purge_files = array();
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
$row["reason"] = "Stale editor file";
$purge_files[$row["file_id"]] = $row;
}
}
 
return $purge_files;
}
}
 
/**
* This function returns the newinfo-array for markallread
*/
 
function phorum_db_newflag_allread($forum_id=0)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysqli_connect();
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
// delete all newflags for this user and forum
phorum_db_newflag_delete(0,$forum_id);
 
// get the maximum message-id in this forum
$sql = "select max(message_id) from {$PHORUM['message_table']} where forum_id=$forum_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
phorum_db_mysqli_error("$err: $sql");
}elseif (mysqli_num_rows($res) > 0){
$row = mysqli_fetch_row($res);
if($row[0] > 0) {
// set this message as min-id
phorum_db_newflag_add_read(array(0=>array('id'=>$row[0],'forum'=>$forum_id)));
}
}
 
}
 
 
/**
* This function returns the read messages for the current user and forum
* optionally for a given forum (for the index)
*/
function phorum_db_newflag_get_flags($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$read_msgs=array('min_id'=>0);
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
$sql="SELECT message_id,forum_id FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id IN({$forum_id},{$PHORUM['vroot']})";
 
$conn = phorum_db_mysqli_connect();
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
while($row=mysqli_fetch_row($res)) {
// set the min-id if given flag is set
if($row[1] != $PHORUM['vroot'] && ($read_msgs['min_id']==0 || $row[0] < $read_msgs['min_id'])) {
$read_msgs['min_id']=$row[0];
} else {
$read_msgs[$row[0]]=$row[0];
}
}
 
return $read_msgs;
}
 
 
/**
* This function returns the count of unread messages the current user and forum
* optionally for a given forum (for the index)
*/
function phorum_db_newflag_get_unread_count($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
// get the read message array
$read_msgs = phorum_db_newflag_get_flags($forum_id);
 
if($read_msgs["min_id"]==0) return array(0,0);
 
$sql="SELECT count(*) as count FROM ".$PHORUM['message_table']." WHERE message_id NOT in (".implode(",", $read_msgs).") and message_id > {$read_msgs['min_id']} and forum_id in ({$forum_id},0) and status=".PHORUM_STATUS_APPROVED." and not ".PHORUM_SQL_MOVEDMESSAGES;
 
$conn = phorum_db_mysqli_connect();
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$counts[] = $tmp_row[0];
 
$sql="SELECT count(*) as count FROM ".$PHORUM['message_table']." WHERE message_id NOT in (".implode(",", $read_msgs).") and message_id > {$read_msgs['min_id']} and forum_id in ({$forum_id},0) and parent_id=0 and status=".PHORUM_STATUS_APPROVED." and not ".PHORUM_SQL_MOVEDMESSAGES;
 
$conn = phorum_db_mysqli_connect();
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$tmp_row=mysqli_fetch_row($res);
$counts[] = $tmp_row[0];
 
return $counts;
}
 
 
/**
* This function marks a message as read
*/
function phorum_db_newflag_add_read($message_ids) {
$PHORUM = $GLOBALS["PHORUM"];
 
$num_newflags=phorum_db_newflag_get_count();
 
// maybe got just one message
if(!is_array($message_ids)) {
$message_ids=array(0=>(int)$message_ids);
}
// deleting messages which are too much
$num_end=$num_newflags+count($message_ids);
if($num_end > PHORUM_MAX_NEW_INFO) {
phorum_db_newflag_delete($num_end - PHORUM_MAX_NEW_INFO);
}
// building the query
$values=array();
$cnt=0;
 
foreach($message_ids as $id=>$data) {
if(is_array($data)) {
$values[]="({$PHORUM['user']['user_id']},{$data['forum']},{$data['id']})";
} else {
$values[]="({$PHORUM['user']['user_id']},{$PHORUM['forum_id']},$data)";
}
$cnt++;
}
if($cnt) {
$insert_sql="INSERT IGNORE INTO ".$PHORUM['user_newflags_table']." (user_id,forum_id,message_id) VALUES".join(",",$values);
 
// fire away
$conn = phorum_db_mysqli_connect();
$res = mysqli_query($conn, $insert_sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $insert_sql");
}
}
 
/**
* This function returns the number of newflags for this user and forum
*/
function phorum_db_newflag_get_count($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
$sql="SELECT count(*) FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id={$forum_id}";
 
// fire away
$conn = phorum_db_mysqli_connect();
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$row=mysqli_fetch_row($res);
 
return $row[0];
}
 
/**
* This function removes a number of newflags for this user and forum
*/
function phorum_db_newflag_delete($numdelete=0,$forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($numdelete, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
if($numdelete>0) {
$lvar=" ORDER BY message_id ASC LIMIT $numdelete";
} else {
$lvar="";
}
// delete the number of newflags given
$del_sql="DELETE FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id={$forum_id}".$lvar;
// fire away
$conn = phorum_db_mysqli_connect();
$res = mysqli_query($conn, $del_sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $del_sql");
}
 
/**
* This function executes a query to get the user ids of the users
* subscribed to a forum/thread.
*/
 
function phorum_db_get_subscribed_users($forum_id, $thread, $type){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($thread, "int");
settype($type, "int");
 
$conn = phorum_db_mysqli_connect();
 
$userignore="";
if ($PHORUM["DATA"]["LOGGEDIN"])
$userignore="and b.user_id != {$PHORUM['user']['user_id']}";
 
$sql = "select DISTINCT(b.email),user_language from {$PHORUM['subscribers_table']} as a,{$PHORUM['user_table']} as b where a.forum_id=$forum_id and (a.thread=$thread or a.thread=0) and a.sub_type=$type and b.user_id=a.user_id $userignore";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$arr=array();
 
while ($rec = mysqli_fetch_row($res)){
if(!empty($rec[1])) // user-language is set
$arr[$rec[1]][] = $rec[0];
else // no user-language is set
$arr[$PHORUM['language']][]= $rec[0];
}
 
return $arr;
}
 
/**
* This function executes a query to get the subscriptions of a user-id,
* together with the forum-id and subjects of the threads
*/
 
function phorum_db_get_message_subscriptions($user_id,$days=2){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$userignore="";
if ($PHORUM["DATA"]["LOGGEDIN"])
$userignore="and b.user_id != {$PHORUM['user']['user_id']}";
 
if($days > 0) {
$timestr=" AND (".time()." - b.modifystamp) <= ($days * 86400)";
} else {
$timestr="";
}
 
$sql = "select a.thread, a.forum_id, a.sub_type, b.subject,b.modifystamp,b.author,b.user_id,b.email from {$PHORUM['subscribers_table']} as a,{$PHORUM['message_table']} as b where a.user_id=$user_id and b.message_id=a.thread and (a.sub_type=".PHORUM_SUBSCRIPTION_MESSAGE." or a.sub_type=".PHORUM_SUBSCRIPTION_BOOKMARK.")"."$timestr ORDER BY b.modifystamp desc";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$arr=array();
$forum_ids=array();
 
while ($rec = mysqli_fetch_assoc($res)){
$unsub_url=phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=".PHORUM_CC_SUBSCRIPTION_THREADS, "unsub_id=".$rec['thread'], "unsub_forum=".$rec['forum_id'], "unsub_type=".$rec['sub_type']);
$rec['unsubscribe_url']=$unsub_url;
$arr[] = $rec;
$forum_ids[]=$rec['forum_id'];
}
$arr['forum_ids']=$forum_ids;
 
return $arr;
}
 
/**
* This function executes a query to find out if a user is subscribed to a thread
*/
 
function phorum_db_get_if_subscribed($forum_id, $thread, $user_id, $type=PHORUM_SUBSCRIPTION_MESSAGE)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($thread, "int");
settype($user_id, "int");
settype($type, "int");
 
$conn = phorum_db_mysqli_connect();
 
$sql = "select user_id from {$PHORUM['subscribers_table']} where forum_id=$forum_id and thread=$thread and user_id=$user_id and sub_type=$type";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
$retval = true;
}else{
$retval = false;
}
 
return $retval;
}
 
 
/**
* This function retrieves the banlists for the current forum
*/
 
function phorum_db_get_banlists($ordered=false) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
$forumstr = "";
 
$conn = phorum_db_mysqli_connect();
 
if(isset($PHORUM['forum_id']) && !empty($PHORUM['forum_id']))
$forumstr = "WHERE forum_id = {$PHORUM['forum_id']} OR forum_id = 0";
 
if(isset($PHORUM['vroot']) && !empty($PHORUM['vroot']))
$forumstr .= " OR forum_id = {$PHORUM['vroot']}";
 
 
 
$sql = "SELECT * FROM {$PHORUM['banlist_table']} $forumstr";
 
if($ordered) {
$sql.= " ORDER BY type, string";
}
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
while($row = mysqli_fetch_assoc($res)) {
$retarr[$row['type']][$row['id']]=array('pcre'=>$row['pcre'],'string'=>$row['string'],'forum_id'=>$row['forum_id']);
}
}
return $retarr;
}
 
 
/**
* This function retrieves one item from the banlists
*/
 
function phorum_db_get_banitem($banid) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
 
$conn = phorum_db_mysqli_connect();
 
settype($banid, "int");
 
$sql = "SELECT * FROM {$PHORUM['banlist_table']} WHERE id = $banid";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
while($row = mysqli_fetch_assoc($res)) {
$retarr=array('pcre'=>$row['pcre'],'string'=>$row['string'],'forumid'=>$row['forum_id'],'type'=>$row['type']);
}
}
return $retarr;
}
 
 
/**
* This function deletes one item from the banlists
*/
 
function phorum_db_del_banitem($banid) {
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$sql = "DELETE FROM {$PHORUM['banlist_table']} WHERE id = $banid";
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if(mysqli_affected_rows($conn) > 0) {
return true;
} else {
return false;
}
}
 
 
/**
* This function adds or modifies a banlist-entry
*/
 
function phorum_db_mod_banlists($type,$pcre,$string,$forum_id,$id=0) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
 
$conn = phorum_db_mysqli_connect();
 
settype($type, "int");
settype($pcre, "int");
settype($forum_id, "int");
settype($id, "int");
 
if($id > 0) { // modifying an entry
$sql = "UPDATE {$PHORUM['banlist_table']} SET forum_id = $forum_id, type = $type, pcre = $pcre, string = '".mysqli_real_escape_string($conn, $string)."' where id = $id";
} else { // adding an entry
$sql = "INSERT INTO {$PHORUM['banlist_table']} (forum_id,type,pcre,string) VALUES($forum_id,$type,$pcre,'".mysqli_real_escape_string($conn, $string)."')";
}
 
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if(mysqli_affected_rows($conn) > 0) {
return true;
} else {
return false;
}
}
 
 
 
/**
* This function lists all private messages in a folder.
* @param folder - The folder to use. Either a special folder
* (PHORUM_PM_INBOX or PHORUM_PM_OUTBOX) or the
* id of a user's custom folder.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @param reverse - If set to a true value (default), sorting
* of messages is done in reverse (newest first).
*/
 
function phorum_db_pm_list($folder, $user_id = NULL, $reverse = true)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$folder_sql = "user_id = $user_id AND ";
if (is_numeric($folder)) {
$folder_sql .= "pm_folder_id=$folder";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql .= "pm_folder_id=0 AND special_folder='$folder'";
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "SELECT m.pm_message_id, from_user_id, from_username, subject, " .
"datestamp, meta, pm_xref_id, user_id, pm_folder_id, " .
"special_folder, read_flag, reply_flag " .
"FROM {$PHORUM['pm_messages_table']} as m, {$PHORUM['pm_xref_table']} as x " .
"WHERE $folder_sql " .
"AND x.pm_message_id = m.pm_message_id " .
"ORDER BY x.pm_message_id " . ($reverse ? "DESC" : "ASC");
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$list = array();
if (mysqli_num_rows($res) > 0){
while($row = mysqli_fetch_assoc($res)) {
 
// Add the recipient information unserialized to the message..
$meta = unserialize($row['meta']);
$row['recipients'] = $meta['recipients'];
 
$list[$row["pm_message_id"]]=$row;
}
}
 
return $list;
}
 
/**
* This function retrieves a private message from the database.
* @param pm_id - The id for the private message to retrieve.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @param folder_id - The folder to retrieve the message from or
* NULL if the folder does not matter.
*/
 
function phorum_db_pm_get($pm_id, $folder = NULL, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($pm_id, "int");
 
if (is_null($folder)) {
$folder_sql = '';
} elseif (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND ";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND ";
} else {
die ("Illegal folder '$folder' requested for message id '$pm_id'");
}
 
$sql = "SELECT * " .
"FROM {$PHORUM['pm_messages_table']} as m, {$PHORUM['pm_xref_table']} as x " .
"WHERE $folder_sql x.pm_message_id = $pm_id AND x.user_id = $user_id " .
"AND x.pm_message_id = m.pm_message_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
$row = mysqli_fetch_assoc($res);
 
// Add the recipient information unserialized to the message..
$meta = unserialize($row['meta']);
$row['recipients'] = $meta['recipients'];
 
return $row;
} else {
return NULL;
}
}
 
/**
* This function creates a new folder for a user.
* @param foldername - The name of the folder to create.
* @param user_id - The user to create the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_create_folder($foldername, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$sql = "INSERT INTO {$PHORUM['pm_folders_table']} SET " .
"user_id=$user_id, " .
"foldername='".mysqli_real_escape_string($conn, $foldername)."'";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
/**
* This function renames a folder for a user.
* @param folder_id - The id of the folder to rename.
* @param newname - The new name for the folder.
* @param user_id - The user to rename the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_rename_folder($folder_id, $newname, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($folder_id, "int");
 
$sql = "UPDATE {$PHORUM['pm_folders_table']} " .
"SET foldername = '".mysqli_real_escape_string($conn, $newname)."' " .
"WHERE pm_folder_id = $folder_id AND user_id = $user_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
 
 
/**
* This function deletes a folder for a user. Along with the
* folder, all contained messages are deleted as well.
* @param folder_id - The id of the folder to delete.
* @param user_id - The user to delete the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_delete_folder($folder_id, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($folder_id, "int");
 
// Get messages in this folder and delete them.
$list = phorum_db_pm_list($folder_id, $user_id);
foreach ($list as $id => $data) {
phorum_db_pm_delete($id, $folder_id, $user_id);
}
 
// Delete the folder itself.
$sql = "DELETE FROM {$PHORUM['pm_folders_table']} " .
"WHERE pm_folder_id = $folder_id AND user_id = $user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
/**
* This function retrieves the list of folders for a user.
* @param user_id - The user to retrieve folders for or NULL
* to use the current user (default).
* @param count_messages - Count the number of messages for the
* folders. Default, this is not done.
*/
function phorum_db_pm_getfolders($user_id = NULL, $count_messages = false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
// Setup the list of folders. Our special folders are
// not in the database, so these are added here.
$folders = array(
PHORUM_PM_INBOX => array(
'id' => PHORUM_PM_INBOX,
'name' => $PHORUM["DATA"]["LANG"]["INBOX"],
),
);
 
// Select all custom folders for the user.
$sql = "SELECT * FROM {$PHORUM['pm_folders_table']} " .
"WHERE user_id = $user_id ORDER BY foldername";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// Add them to the folderlist.
if (mysqli_num_rows($res) > 0){
while (($row = mysqli_fetch_assoc($res))) {
$folders[$row["pm_folder_id"]] = array(
'id' => $row["pm_folder_id"],
'name' => $row["foldername"],
);
}
}
 
// Add the outgoing box.
$folders[PHORUM_PM_OUTBOX] = array(
'id' => PHORUM_PM_OUTBOX,
'name' => $PHORUM["DATA"]["LANG"]["SentItems"],
);
 
// Count messages if requested.
if ($count_messages)
{
// Initialize counters.
foreach ($folders as $id => $data) {
$folders[$id]["total"] = $folders[$id]["new"] = 0;
}
 
// Collect count information.
$sql = "SELECT pm_folder_id, special_folder, " .
"count(*) as total, (count(*) - sum(read_flag)) as new " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE user_id = $user_id " .
"GROUP BY pm_folder_id, special_folder";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// Add counters to the folderlist.
if (mysqli_num_rows($res) > 0){
while (($row = mysqli_fetch_assoc($res))) {
$folder_id = $row["pm_folder_id"] ? $row["pm_folder_id"] : $row["special_folder"];
// If there are stale messages, we do not want them
// to create non-existant mailboxes in the list.
if (isset($folders[$folder_id])) {
$folders[$folder_id]["total"] = $row["total"];
$folders[$folder_id]["new"] = $row["new"];
}
}
}
}
 
return $folders;
}
 
/**
* This function computes the number of private messages a user has
* and returns both the total and the number unread.
* @param folder - The folder to use. Either a special folder
* (PHORUM_PM_INBOX or PHORUM_PM_OUTBOX), the
* id of a user's custom folder or
* PHORUM_PM_ALLFOLDERS for all folders.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
*/
 
function phorum_db_pm_messagecount($folder, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND";
} elseif ($folder == PHORUM_PM_ALLFOLDERS) {
$folder_sql = '';
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "SELECT count(*) as total, (count(*) - sum(read_flag)) as new " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE $folder_sql user_id = $user_id";
 
$messagecount=array("total" => 0, "new" => 0);
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
$row = mysqli_fetch_assoc($res);
$messagecount["total"] = $row["total"];
$messagecount["new"] = ($row["new"] >= 1) ? $row["new"] : 0;
}
 
return $messagecount;
}
 
/**
* This function does a quick check if the user has new private messages.
* This is useful in case you only want to know whether the user has
* new messages or not and when you are not interested in the exact amount
* of new messages.
*
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @return A true value, in case there are new messages available.
*/
function phorum_db_pm_checknew($user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$sql = "SELECT user_id " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE user_id = $user_id AND read_flag = 0 LIMIT 1";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
return mysqli_num_rows($res);
}
 
/**
* This function inserts a private message in the database. The return value
* is the pm_message_id of the created message.
* @param subject - The subject for the private message.
* @param message - The message text for the private message.
* @param to - A single user_id or an array of user_ids for the recipients.
* @param from - The user_id of the sender. The current user is used in case
* the parameter is set to NULL (default).
* @param keepcopy - If set to a true value, a copy of the mail will be put in
* the outbox of the user. Default value is false.
*/
function phorum_db_pm_send($subject, $message, $to, $from=NULL, $keepcopy=false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
// Prepare the sender.
if ($from == NULL) $from = $PHORUM['user']['user_id'];
settype($from, "int");
$fromuser = phorum_db_user_get($from, false);
if (! $fromuser) die("Unknown sender user_id '$from'");
 
// This array will be filled with xref database entries.
$xref_entries = array();
 
// Prepare the list of recipients.
$rcpts = array();
if (! is_array($to)) $to = array($to);
foreach ($to as $user_id) {
settype($user_id, "int");
$user = phorum_db_user_get($user_id, false);
if (! $user) die("Unknown recipient user_id '$user_id'");
$rcpts[$user_id] = array(
'user_id' => $user_id,
'username' => $user["username"],
'read_flag' => 0,
);
$xref_entries[] = array(
'user_id' => $user_id,
'pm_folder_id' => 0,
'special_folder' => PHORUM_PM_INBOX,
'read_flag' => 0,
);
}
 
// Keep copy of this message in outbox?
if ($keepcopy) {
$xref_entries[] = array(
'user_id' => $from,
'pm_folder_id' => 0,
'special_folder' => PHORUM_PM_OUTBOX,
'read_flag' => 1,
);
}
 
// Prepare message meta data.
$meta = mysqli_real_escape_string($conn, serialize(array(
'recipients' => $rcpts
)));
 
// Create the message.
$sql = "INSERT INTO {$PHORUM["pm_messages_table"]} SET " .
"from_user_id = $from, " .
"from_username = '".mysqli_real_escape_string($conn, $fromuser["username"])."', " .
"subject = '".mysqli_real_escape_string($conn, $subject)."', " .
"message = '".mysqli_real_escape_string($conn, $message)."', " .
"datestamp = '".time()."', " .
"meta = '$meta'";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) {
phorum_db_mysqli_error("$err: $sql");
return;
}
 
// Get the message id.
$pm_message_id = mysqli_insert_id($conn);
 
// Put the message in the recipient inboxes.
foreach ($xref_entries as $xref) {
$sql = "INSERT INTO {$PHORUM["pm_xref_table"]} SET " .
"user_id = {$xref["user_id"]}, " .
"pm_folder_id={$xref["pm_folder_id"]}, " .
"special_folder='{$xref["special_folder"]}', " .
"pm_message_id=$pm_message_id, " .
"read_flag = {$xref["read_flag"]}, " .
"reply_flag = 0";
mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) {
phorum_db_mysqli_error("$err: $sql");
return;
}
 
}
 
return $pm_message_id;
}
 
/**
* This function updates a flag for a private message.
* @param pm_id - The id of the message to update.
* @param flag - The flag to update. Options are PHORUM_PM_READ_FLAG
* and PHORUM_PM_REPLY_FLAG.
* @param value - The value for the flag (true or false).
* @param user_id - The user to set a flag for or NULL
* to use the current user (default).
*/
function phorum_db_pm_setflag($pm_id, $flag, $value, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($pm_id, "int");
 
if ($flag != PHORUM_PM_READ_FLAG && $flag != PHORUM_PM_REPLY_FLAG) {
trigger_error("Invalid value for \$flag in function phorum_db_pm_setflag(): $flag", E_USER_WARNING);
return 0;
}
 
$value = $value ? 1 : 0;
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
// Update the flag in the database.
$sql = "UPDATE {$PHORUM["pm_xref_table"]} " .
"SET $flag = $value " .
"WHERE pm_message_id = $pm_id AND user_id = $user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// Update message counters.
if ($flag == PHORUM_PM_READ_FLAG) {
phorum_db_pm_update_message_info($pm_id);
}
 
return $res;
}
 
/**
* This function deletes a private message from a folder.
* @param folder - The folder from which to delete the message
* @param pm_id - The id of the private message to delete
* @param user_id - The user to delete the message for or NULL
* to use the current user (default).
*/
function phorum_db_pm_delete($pm_id, $folder, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($pm_id, "int");
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND";
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "DELETE FROM {$PHORUM["pm_xref_table"]} " .
"WHERE $folder_sql " .
"user_id = $user_id AND pm_message_id = $pm_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// Update message counters.
phorum_db_pm_update_message_info($pm_id);
 
return $res;
}
 
/**
* This function moves a private message to a different folder.
* @param pm_id - The id of the private message to move.
* @param from - The folder to move the message from.
* @param to - The folder to move the message to.
* @param user_id - The user to move the message for or NULL
* to use the current user (default).
*/
function phorum_db_pm_move($pm_id, $from, $to, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
settype($pm_id, "int");
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($from)) {
$folder_sql = "pm_folder_id=$from AND";
} elseif ($from == PHORUM_PM_INBOX || $from == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$from' AND";
} else {
die ("Illegal source folder '$from' specified");
}
 
if (is_numeric($to)) {
$pm_folder_id = $to;
$special_folder = 'NULL';
} elseif ($to == PHORUM_PM_INBOX || $to == PHORUM_PM_OUTBOX) {
$pm_folder_id = 0;
$special_folder = "'$to'";
} else {
die ("Illegal target folder '$to' specified");
}
 
$sql = "UPDATE {$PHORUM["pm_xref_table"]} SET " .
"pm_folder_id = $pm_folder_id, " .
"special_folder = $special_folder " .
"WHERE $folder_sql user_id = $user_id AND pm_message_id = $pm_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
/**
* This function updates the meta information for a message. If it
* detects that no xrefs are available for the message anymore,
* the message will be deleted from the database. So this function
* has to be called after setting the read_flag and after deleting
* a message.
* PMTODO maybe we need some locking here to prevent concurrent
* updates of the message info.
*/
function phorum_db_pm_update_message_info($pm_id)
{
$PHORUM = $GLOBALS['PHORUM'];
 
$conn = phorum_db_mysqli_connect();
 
settype($pm_id, "int");
 
// Find the message record. Return immediately if no message is found.
$sql = "SELECT * " .
"FROM {$PHORUM['pm_messages_table']} " .
"WHERE pm_message_id = $pm_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
if (mysqli_num_rows($res) == 0) return $res;
$pm = mysqli_fetch_assoc($res);
 
// Find the xrefs for this message.
$sql = "SELECT * " .
"FROM {$PHORUM["pm_xref_table"]} " .
"WHERE pm_message_id = $pm_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
// No xrefs left? Then the message can be fully deleted.
if (mysqli_num_rows($res) == 0) {
$sql = "DELETE FROM {$PHORUM['pm_messages_table']} " .
"WHERE pm_message_id = $pm_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
// Update the read flags for the recipients in the meta data.
$meta = unserialize($pm["meta"]);
$rcpts = $meta["recipients"];
while ($row = mysqli_fetch_assoc($res)) {
// Only update if available. A kept copy in the outbox will
// not be in the meta list, so if the copy is read, the
// meta data does not have to be updated here.
if (isset($rcpts[$row["user_id"]])) {
$rcpts[$row["user_id"]]["read_flag"] = $row["read_flag"];
}
}
$meta["recipients"] = $rcpts;
 
// Store the new meta data.
$meta = mysqli_real_escape_string($conn, serialize($meta));
$sql = "UPDATE {$PHORUM['pm_messages_table']} " .
"SET meta = '$meta' " .
"WHERE pm_message_id = $pm_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
/* Take care of warning about deprecation of the old PM API functions. */
function phorum_db_get_private_messages($arg1, $arg2) {
phorum_db_pm_deprecated('phorum_db_get_private_messages'); }
function phorum_db_get_private_message($arg1) {
phorum_db_pm_deprecated('phorum_db_get_private_message'); }
function phorum_db_get_private_message_count($arg1) {
phorum_db_pm_deprecated('phorum_db_get_private_message_count'); }
function phorum_db_put_private_messages($arg1, $arg2, $arg3, $arg4, $arg5) {
phorum_db_pm_deprecated('phorum_db_put_private_messages'); }
function phorum_db_update_private_message($arg1, $arg2, $arg3){
phorum_db_pm_deprecated('phorum_db_update_private_message'); }
function phorum_db_pm_deprecated($func) {
die("${func}() has been deprecated. Please use the new private message API.");
}
 
/**
* This function checks if a certain user is buddy of another user.
* The function return the pm_buddy_id in case the user is a buddy
* or NULL in case the user isn't.
* @param buddy_user_id - The user_id to check for if it's a buddy.
* @param user_id - The user_id for which the buddy list must be
* checked or NULL to use the current user (default).
*/
function phorum_db_pm_is_buddy($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysqli_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
$sql = "SELECT pm_buddy_id FROM {$PHORUM["pm_buddies_table"]} " .
"WHERE user_id = $user_id AND buddy_user_id = $buddy_user_id";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
if (mysqli_num_rows($res)) {
$row = mysqli_fetch_array($res);
return $row[0];
} else {
return NULL;
}
}
 
/**
* This function adds a buddy for a user. It will return the
* pm_buddy_id for the new buddy. If the buddy already exists,
* it will return the existing pm_buddy_id. If a non existant
* user_id is used for the buddy_user_id, the function will
* return NULL.
* @param buddy_user_id - The user_id that has to be added as a buddy.
* @param user_id - The user_id the buddy has to be added for or
* NULL to use the current user (default).
*/
function phorum_db_pm_buddy_add($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysqli_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
// Check if the buddy_user_id is a valid user_id.
$valid = phorum_db_user_get($buddy_user_id, false);
if (! $valid) return NULL;
 
$pm_buddy_id = phorum_db_pm_is_buddy($buddy_user_id);
if (is_null($pm_buddy_id)) {
$sql = "INSERT INTO {$PHORUM["pm_buddies_table"]} SET " .
"user_id = $user_id, " .
"buddy_user_id = $buddy_user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
$pm_buddy_id = mysqli_insert_id($conn);
}
 
return $pm_buddy_id;
}
 
/**
* This function deletes a buddy for a user.
* @param buddy_user_id - The user_id that has to be deleted as a buddy.
* @param user_id - The user_id the buddy has to be delete for or
* NULL to use the current user (default).
*/
function phorum_db_pm_buddy_delete($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysqli_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
$sql = "DELETE FROM {$PHORUM["pm_buddies_table"]} WHERE " .
"buddy_user_id = $buddy_user_id AND user_id = $user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
return $res;
}
 
/**
* This function retrieves a list of buddies for a user.
* @param user_id - The user_id for which to retrieve the buddies
* or NULL to user the current user (default).
* @param find_mutual - Wheter to find mutual buddies or not (default not).
*/
function phorum_db_pm_buddy_list($user_id = NULL, $find_mutual = false)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysqli_connect();
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
// Get all buddies for this user.
$sql = "SELECT buddy_user_id FROM {$PHORUM["pm_buddies_table"]} " .
"WHERE user_id = $user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$buddies = array();
if (mysqli_num_rows($res)) {
while ($row = mysqli_fetch_array($res)) {
$buddies[$row[0]] = array (
'user_id' => $row[0]
);
}
}
 
// If we do not have to lookup mutual buddies, we're done.
if (! $find_mutual) return $buddies;
 
// Initialize mutual buddy value.
foreach ($buddies as $id => $data) {
$buddies[$id]["mutual"] = false;
}
 
// Get all mutual buddies.
$sql = "SELECT DISTINCT a.buddy_user_id " .
"FROM {$PHORUM["pm_buddies_table"]} as a, {$PHORUM["pm_buddies_table"]} as b " .
"WHERE a.user_id=$user_id " .
"AND b.user_id=a.buddy_user_id " .
"AND b.buddy_user_id=$user_id";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res)) {
while ($row = mysqli_fetch_array($res)) {
$buddies[$row[0]]["mutual"] = true;
}
}
 
return $buddies;
}
 
/**
* This function returns messages or threads which are newer or older
* than the given timestamp
*
* $time - holds the timestamp the comparison is done against
* $forum - get Threads from this forum
* $mode - should we compare against datestamp (1) or modifystamp (2)
*
*/
function phorum_db_prune_oldThreads($time,$forum=0,$mode=1) {
 
$PHORUM = $GLOBALS['PHORUM'];
 
$conn = phorum_db_mysqli_connect();
$numdeleted=0;
 
$compare_field = "datestamp";
if($mode == 2) {
$compare_field = "modifystamp";
}
 
$forummode="";
if($forum > 0) {
$forummode=" AND forum_id = $forum";
}
 
// retrieving which threads to delete
$sql = "select thread from {$PHORUM['message_table']} where $compare_field < $time AND parent_id=0 $forummode";
 
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$ret=array();
while($row=mysqli_fetch_row($res)) {
$ret[]=$row[0];
}
 
$thread_ids=implode(",",$ret);
 
if(count($ret)) {
// deleting the messages/threads
$sql="delete from {$PHORUM['message_table']} where thread IN ($thread_ids)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
$numdeleted = mysqli_affected_rows($conn);
if($numdeleted < 0) {
$numdeleted=0;
}
 
// deleting the associated notification-entries
$sql="delete from {$PHORUM['subscribers_table']} where thread IN ($thread_ids)";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
 
// optimizing the message-table
$sql="optimize table {$PHORUM['message_table']}";
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
}
 
return $numdeleted;
}
 
/**
* split thread
*/
function phorum_db_split_thread($message, $forum_id)
{
settype($message, "int");
settype($forum_id, "int");
 
if($message > 0 && $forum_id > 0){
// get message tree for update thread id
$tree =phorum_db_get_messagetree($message, $forum_id);
$queries =array();
$queries[0]="UPDATE {$GLOBALS['PHORUM']['message_table']} SET thread='$message', parent_id='0' WHERE message_id ='$message'";
$queries[1]="UPDATE {$GLOBALS['PHORUM']['message_table']} SET thread='$message' WHERE message_id IN ($tree)";
phorum_db_run_queries($queries);
}
}
 
/**
* This function returns the maximum message-id in the database
*/
function phorum_db_get_max_messageid() {
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
$maxid = 0;
 
$sql="SELECT max(message_id) from ".$PHORUM["message_table"];
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if (mysqli_num_rows($res) > 0){
$row = mysqli_fetch_row($res);
$maxid = $row[0];
}
 
return $maxid;
}
 
/**
* This function increments the viewcount for a post
*/
 
function phorum_db_viewcount_inc($message_id) {
if($message_id < 1 || !is_numeric($message_id)) {
return false;
}
 
$conn = phorum_db_mysqli_connect();
$sql="UPDATE ".$GLOBALS['PHORUM']['message_table']." SET viewcount=viewcount+1 WHERE message_id=$message_id";
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
 
return true;
 
}
 
 
function phorum_db_get_custom_field_users($field_id,$field_content,$match) {
 
$conn = phorum_db_mysqli_connect();
 
$field_id=(int)$field_id;
$field_content=mysqli_real_escape_string($conn, $field_content);
 
if($match) {
$compval="LIKE";
} else {
$compval="=";
}
 
$sql = "select user_id from {$GLOBALS['PHORUM']['user_custom_fields_table']} where type=$field_id and data $compval '$field_content'";
$res = mysqli_query( $conn, $sql);
 
if ($err = mysqli_error($conn)) phorum_db_mysqli_error("$err: $sql");
 
if(mysqli_num_rows($res)) {
$retval=array();
while ($row = mysqli_fetch_row($res)){
$retval[$row[0]]=$row[0];
}
} else {
$retval=NULL;
}
 
return $retval;
 
}
 
 
/**
* This function creates the tables needed in the database.
*/
 
function phorum_db_create_tables()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$retmsg = "";
 
$queries = array(
 
// create tables
"CREATE TABLE {$PHORUM['forums_table']} ( forum_id int(10) unsigned NOT NULL auto_increment, name varchar(50) NOT NULL default '', active smallint(6) NOT NULL default '0', description text NOT NULL default '', template varchar(50) NOT NULL default '', folder_flag tinyint(1) NOT NULL default '0', parent_id int(10) unsigned NOT NULL default '0', list_length_flat int(10) unsigned NOT NULL default '0', list_length_threaded int(10) unsigned NOT NULL default '0', moderation int(10) unsigned NOT NULL default '0', threaded_list tinyint(4) NOT NULL default '0', threaded_read tinyint(4) NOT NULL default '0', float_to_top tinyint(4) NOT NULL default '0', check_duplicate tinyint(4) NOT NULL default '0', allow_attachment_types varchar(100) NOT NULL default '', max_attachment_size int(10) unsigned NOT NULL default '0', max_totalattachment_size int(10) unsigned NOT NULL default '0', max_attachments int(10) unsigned NOT NULL default '0', pub_perms int(10) unsigned NOT NULL default '0', reg_perms int(10) unsigned NOT NULL default '0', display_ip_address smallint(5) unsigned NOT NULL default '1', allow_email_notify smallint(5) unsigned NOT NULL default '1', language varchar(100) NOT NULL default 'english', email_moderators tinyint(1) NOT NULL default '0', message_count int(10) unsigned NOT NULL default '0', sticky_count int(10) unsigned NOT NULL default '0', thread_count int(10) unsigned NOT NULL default '0', last_post_time int(10) unsigned NOT NULL default '0', display_order int(10) unsigned NOT NULL default '0', read_length int(10) unsigned NOT NULL default '0', vroot int(10) unsigned NOT NULL default '0', edit_post tinyint(1) NOT NULL default '1',template_settings text NOT NULL default '', count_views tinyint(1) unsigned NOT NULL default '0', display_fixed tinyint(1) unsigned NOT NULL default '0', reverse_threading tinyint(1) NOT NULL default '0',inherit_id int(10) unsigned NULL default NULL, PRIMARY KEY (forum_id), KEY name (name), KEY active (active,parent_id), KEY group_id (parent_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['message_table']} ( message_id int(10) unsigned NOT NULL auto_increment, forum_id int(10) unsigned NOT NULL default '0', thread int(10) unsigned NOT NULL default '0', parent_id int(10) unsigned NOT NULL default '0', author varchar(37) NOT NULL default '', subject varchar(255) NOT NULL default '', body text NOT NULL, email varchar(100) NOT NULL default '', ip varchar(255) NOT NULL default '', status tinyint(4) NOT NULL default '2', msgid varchar(100) NOT NULL default '', modifystamp int(10) unsigned NOT NULL default '0', user_id int(10) unsigned NOT NULL default '0', thread_count int(10) unsigned NOT NULL default '0', moderator_post tinyint(3) unsigned NOT NULL default '0', sort tinyint(4) NOT NULL default '2', datestamp int(10) unsigned NOT NULL default '0', meta mediumtext NOT NULL, viewcount int(10) unsigned NOT NULL default '0', closed tinyint(4) NOT NULL default '0', PRIMARY KEY (message_id), KEY thread_message (thread,message_id), KEY thread_forum (thread,forum_id), KEY special_threads (sort,forum_id), KEY status_forum (status,forum_id), KEY list_page_float (forum_id,parent_id,modifystamp), KEY list_page_flat (forum_id,parent_id,thread), KEY post_count (forum_id,status,parent_id), KEY dup_check (forum_id,author,subject,datestamp), KEY forum_max_message (forum_id,message_id,status,parent_id), KEY last_post_time (forum_id,status,modifystamp), KEY next_prev_thread (forum_id,status,thread) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['settings_table']} ( name varchar(255) NOT NULL default '', type enum('V','S') NOT NULL default 'V', data text NOT NULL, PRIMARY KEY (name)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['subscribers_table']} ( user_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0', sub_type int(10) unsigned NOT NULL default '0', thread int(10) unsigned NOT NULL default '0', PRIMARY KEY (user_id,forum_id,thread), KEY forum_id (forum_id,thread,sub_type)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_permissions_table']} ( user_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0', permission int(10) unsigned NOT NULL default '0', PRIMARY KEY (user_id,forum_id), KEY forum_id (forum_id,permission) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_table']} ( user_id int(10) unsigned NOT NULL auto_increment, username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '',cookie_sessid_lt varchar(50) NOT NULL default '', sessid_st varchar(50) NOT NULL default '', sessid_st_timeout int(10) unsigned NOT NULL default 0, password_temp varchar(50) NOT NULL default '', email varchar(100) NOT NULL default '', email_temp varchar(110) NOT NULL default '', hide_email tinyint(1) NOT NULL default '0', active tinyint(1) NOT NULL default '0', user_data text NOT NULL default '', signature text NOT NULL default '', threaded_list tinyint(4) NOT NULL default '0', posts int(10) NOT NULL default '0', admin tinyint(1) NOT NULL default '0', threaded_read tinyint(4) NOT NULL default '0', date_added int(10) unsigned NOT NULL default '0', date_last_active int(10) unsigned NOT NULL default '0', last_active_forum int(10) unsigned NOT NULL default '0', hide_activity tinyint(1) NOT NULL default '0',show_signature TINYINT( 1 ) DEFAULT '0' NOT NULL, email_notify TINYINT( 1 ) DEFAULT '0' NOT NULL, pm_email_notify TINYINT ( 1 ) DEFAULT '1' NOT NULL, tz_offset TINYINT( 2 ) DEFAULT '-99' NOT NULL,is_dst TINYINT( 1 ) DEFAULT '0' NOT NULL ,user_language VARCHAR( 100 ) NOT NULL default '',user_template VARCHAR( 100 ) NOT NULL default '', moderator_data text NOT NULL default '', moderation_email tinyint(2) unsigned not null default 1, PRIMARY KEY (user_id), UNIQUE KEY username (username), KEY active (active), KEY userpass (username,password), KEY sessid_st (sessid_st), KEY cookie_sessid_lt (cookie_sessid_lt), KEY activity (date_last_active,hide_activity,last_active_forum), KEY date_added (date_added), KEY email_temp (email_temp) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_newflags_table']} ( user_id int(11) NOT NULL default '0', forum_id int(11) NOT NULL default '0', message_id int(11) NOT NULL default '0', PRIMARY KEY (user_id,forum_id,message_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['groups_table']} ( group_id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL default '0', open tinyint(3) NOT NULL default '0', PRIMARY KEY (group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['forum_group_xref_table']} ( forum_id int(11) NOT NULL default '0', group_id int(11) NOT NULL default '0', permission int(10) unsigned NOT NULL default '0', PRIMARY KEY (forum_id,group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_group_xref_table']} ( user_id int(11) NOT NULL default '0', group_id int(11) NOT NULL default '0', status tinyint(3) NOT NULL default '1', PRIMARY KEY (user_id,group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['files_table']} ( file_id int(11) NOT NULL auto_increment, user_id int(11) NOT NULL default '0', filename varchar(255) NOT NULL default '', filesize int(11) NOT NULL default '0', file_data mediumtext NOT NULL default '', add_datetime int(10) unsigned NOT NULL default '0', message_id int(10) unsigned NOT NULL default '0', link varchar(10) NOT NULL default '', PRIMARY KEY (file_id), KEY add_datetime (add_datetime), KEY message_id_link (message_id,link)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['banlist_table']} ( id int(11) NOT NULL auto_increment, forum_id int(11) NOT NULL default '0', type tinyint(4) NOT NULL default '0', pcre tinyint(4) NOT NULL default '0', string varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY forum_id (forum_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['search_table']} ( message_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0',search_text mediumtext NOT NULL default '', PRIMARY KEY (message_id), KEY forum_id (forum_id), FULLTEXT KEY search_text (search_text) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_custom_fields_table']} ( user_id INT DEFAULT '0' NOT NULL , type INT DEFAULT '0' NOT NULL , data TEXT NOT NULL default '', PRIMARY KEY ( user_id , type )) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_messages_table']} ( pm_message_id int(10) unsigned NOT NULL auto_increment, from_user_id int(10) unsigned NOT NULL default '0', from_username varchar(50) NOT NULL default '', subject varchar(100) NOT NULL default '', message text NOT NULL default '', datestamp int(10) unsigned NOT NULL default '0', meta mediumtext NOT NULL default '', PRIMARY KEY(pm_message_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_folders_table']} ( pm_folder_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', foldername varchar(20) NOT NULL default '', PRIMARY KEY (pm_folder_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_xref_table']} ( pm_xref_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', pm_folder_id int(10) unsigned NOT NULL default '0', special_folder varchar(10), pm_message_id int(10) unsigned NOT NULL default '0', read_flag tinyint(1) NOT NULL default '0', reply_flag tinyint(1) NOT NULL default '0', PRIMARY KEY (pm_xref_id), KEY xref (user_id,pm_folder_id,pm_message_id), KEY read_flag (read_flag)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_buddies_table']} ( pm_buddy_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', buddy_user_id int(10) unsigned NOT NULL default '0', PRIMARY KEY pm_buddy_id (pm_buddy_id), UNIQUE KEY userids (user_id, buddy_user_id), KEY buddy_user_id (buddy_user_id)) TYPE=MyISAM",
 
);
foreach($queries as $sql){
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
$retmsg = "$err<br />";
phorum_db_mysqli_error("$err: $sql");
break;
}
}
 
return $retmsg;
}
 
// uses the database-dependant functions to escape a string
function phorum_db_escape_string($str) {
 
$conn = phorum_db_mysqli_connect();
 
$str_tmp=mysqli_real_escape_string($conn, $str);
 
return $str_tmp;
}
 
/**
* This function goes through an array of queries and executes them
*/
 
function phorum_db_run_queries($queries){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysqli_connect();
 
$retmsg = "";
 
foreach($queries as $sql){
$res = mysqli_query( $conn, $sql);
if ($err = mysqli_error($conn)){
// skip duplicate column name errors
if(!stristr($err, "duplicate column")){
$retmsg.= "$err<br />";
phorum_db_mysqli_error("$err: $sql");
}
}
}
 
return $retmsg;
}
 
/**
* This function checks that a database connection can be made.
*/
 
function phorum_db_check_connection(){
$conn = phorum_db_mysqli_connect();
 
return ($conn > 0) ? true : false;
}
 
/**
* handy little connection function. This allows us to not connect to the
* server until a query is actually run.
* NOTE: This is not a required part of abstraction
*/
 
function phorum_db_mysqli_connect(){
$PHORUM = $GLOBALS["PHORUM"];
 
static $conn;
if (empty($conn)){
$conn = mysqli_connect($PHORUM["DBCONFIG"]["server"], $PHORUM["DBCONFIG"]["user"], $PHORUM["DBCONFIG"]["password"], $PHORUM["DBCONFIG"]["name"]);
}
return $conn;
}
 
/**
* error handling function
* NOTE: This is not a required part of abstraction
*/
 
function phorum_db_mysqli_error($err){
 
if(isset($GLOBALS['PHORUM']['error_logging'])) {
$logsetting = $GLOBALS['PHORUM']['error_logging'];
} else {
$logsetting = "";
}
$adminemail = $GLOBALS['PHORUM']['system_email_from_address'];
$cache_dir = $GLOBALS['PHORUM']['cache'];
 
if (!defined("PHORUM_ADMIN")){
if($logsetting == 'mail') {
include_once("./include/email_functions.php");
 
$data=array('mailmessage'=>"An SQL-error occured in your phorum-installation.\n\nThe error-message was:\n$err\n\n",
'mailsubject'=>'Phorum: an SQL-error occured');
phorum_email_user(array($adminemail),$data);
 
} elseif($logsetting == 'file') {
$fp = fopen($cache_dir."/phorum-sql-errors.log",'a');
fputs($fp,time().": $err\n");
fclose($fp);
 
} else {
echo htmlspecialchars($err);
}
exit();
}else{
echo "<!-- $err -->";
}
}
 
/**
* This function is used by the sanity checking system in the
* admin interface to determine how much data can be transferred
* in one query. This is used to detect problems with uploads that
* are larger than the database server can handle.
* The function returns the size in bytes. For database implementations
* which do not have this kind of limit, NULL can be returned.
*/
function phorum_db_maxpacketsize ()
{
$conn = phorum_db_mysqli_connect();
$res = mysqli_query($conn, "SELECT @@global.max_allowed_packet");
if (! $res) return NULL;
if (mysqli_num_rows($res)) {
$row = mysqli_fetch_array($res);
return $row[0];
}
return NULL;
}
 
/**
* This function is used by the sanity checking system to let the
* database layer do sanity checks of its own. This function can
* be used by every database layer to implement specific checks.
*
* The return value for this function should be exactly the same
* as the return value expected for regular sanity checking
* function (see include/admin/sanity_checks.php for information).
*
* There's no need to load the sanity_check.php file for the needed
* constants, because this function should only be called from the
* sanity checking system.
*/
function phorum_db_sanitychecks()
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Retrieve the MySQL server version.
$conn = phorum_db_mysqli_connect();
$res = mysqli_query($conn, "SELECT @@global.version");
if (!$res) return array(
PHORUM_SANITY_WARN,
"The database layer could not retrieve the version of the
running MySQL server",
"This probably means that you are running a really old MySQL
server, which does not support \"SELECT @@global.version\"
as an SQL command. If you are not running a MySQL server
with version 4.0.18 or higher, then please upgrade your
MySQL server. Else, contact the Phorum developers to see
where this warning is coming from"
);
 
if (mysqli_num_rows($res))
{
$row = mysqli_fetch_array($res);
$ver = explode(".", $row[0]);
 
// Version numbering format which is not recognized.
if (count($ver) != 3) return array(
PHORUM_SANITY_WARN,
"The database layer was unable to recognize the MySQL server's
version number \"" . htmlspecialchars($row[0]) . "\". Therefore,
checking if the right version of MySQL is used is not possible.",
"Contact the Phorum developers and report this specific
version number, so the checking scripts can be updated."
);
 
settype($ver[0], 'int');
settype($ver[1], 'int');
settype($ver[2], 'int');
 
// MySQL before version 4.
if ($ver[0] < 4) return array(
PHORUM_SANITY_CRIT,
"The MySQL database server that is used is too old. The
running version is \"" . htmlspecialchars($row[0]) . "\",
while MySQL version 4.0.18 or higher is recommended.",
"Upgrade your MySQL server to a newer version. If your
website is hosted with a service provider, please contact
the service provider to upgrade your MySQL database."
);
 
// MySQL before version 4.0.18, with full text search enabled.
if ($PHORUM["DBCONFIG"]["mysql_use_ft"] &&
$ver[0] == 4 && $ver[1] == 0 && $ver[2] < 18) return array(
PHORUM_SANITY_WARN,
"The MySQL database server that is used does not
support all Phorum features. The running version is
\"" . htmlspecialchars($row[0]) . "\", while MySQL version
4.0.18 or higher is recommended.",
"Upgrade your MySQL server to a newer version. If your
website is hosted with a service provider, please contact
the service provider to upgrade your MySQL database."
);
 
// All checks are okay.
return array (PHORUM_SANITY_OK, NULL);
}
 
return array(
PHORUM_SANITY_CRIT,
"An unexpected problem was found in running the sanity
check function phorum_db_sanitychecks().",
"Contact the Phorum developers to find out what the problem is."
);
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004112601.php
New file
0,0 → 1,9
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="CREATE TABLE {$PHORUM['user_custom_fields_table']} (
user_id INT DEFAULT '0' NOT NULL ,
type INT DEFAULT '0' NOT NULL ,
data TEXT NOT NULL ,
PRIMARY KEY ( user_id , type )) TYPE=MyISAM";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004061400.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the user tables for email-changes
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD email_temp VARCHAR( 101 ) NOT NULL AFTER email" ;
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD INDEX ( email_temp ) ";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004073100.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} CHANGE email email VARCHAR( 100 ) NOT NULL";
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['message_table']} CHANGE email email VARCHAR( 100 ) NOT NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005102700.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['search_table']} ADD COLUMN forum_id int(10) UNSIGNED NOT NULL DEFAULT '0', ADD KEY forum_id (forum_id)";
$upgrade_queries[]="UPDATE {$PHORUM['search_table']}, {$PHORUM['message_table']} set {$PHORUM['search_table']}.forum_id={$PHORUM['message_table']}.forum_id where {$PHORUM['search_table']}.message_id={$PHORUM['message_table']}.message_id";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004112800.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD `vroot` INT( 10 ) DEFAULT '0' NOT NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004112602.php
New file
0,0 → 1,28
<?php
if(!defined("PHORUM_ADMIN")) return;
/*
ALTER TABLE {$PHORUM['user_table']} ADD `show_signature` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `email_notify` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `tz_offset` TINYINT( 2 ) DEFAULT NULL ,
ADD `is_dst` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `user_language` VARCHAR( 100 ) NOT NULL ,
ADD `user_template` VARCHAR( 100 ) NOT NULL ;
 
create additional table for custom-fields
 
*/
 
 
// converting custom-field settings
if(!isset($PHORUM['PROFILE_FIELDS']['num_fields'])) {
$new_profile_fields=array();
foreach($PHORUM['PROFILE_FIELDS'] as $id => $name) {
$new_profile_fields[$id]=array('name'=>$name,'length'=>255,'html_disabled'=>0);
}
$new_profile_fields['num_fields']=count($new_profile_fields);
$PHORUM['PROFILE_FIELDS']=$new_profile_fields;
// saving them
phorum_db_update_settings(array('PROFILE_FIELDS'=>$new_profile_fields));
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004112603.php
New file
0,0 → 1,70
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$cid=phorum_db_mysql_connect();
 
// converting the custom-fields
$res=mysql_query("SELECT user_id,user_data FROM {$PHORUM['user_table']}",$cid);
 
while($row=mysql_fetch_assoc($res)) {
$userdata=array('user_id'=>$row['user_id']);
$user_data_new=array();
$user_data_old=unserialize($row['user_data']);
// converting meta-data to fields
if(isset($user_data_old['show_signature']) && !empty($user_data_old['show_signature']))
$userdata['show_signature']=$user_data_old['show_signature'];
if(isset($user_data_old['email_notify']) && !empty($user_data_old['email_notify']))
$userdata['email_notify']=$user_data_old['email_notify'];
if(isset($user_data_old['tz_offset']) && !empty($user_data_old['tz_offset']))
$userdata['tz_offset']=$user_data_old['tz_offset'];
if(isset($user_data_old['is_dst']) && !empty($user_data_old['is_dst']))
$userdata['is_dst']=$user_data_old['is_dst'];
 
if(isset($user_data_old['user_language']) && !empty($user_data_old['user_language']))
$userdata['user_language']=$user_data_old['user_language'];
 
if(isset($user_data_old['user_template']) && !empty($user_data_old['user_template']))
$userdata['user_template']=$user_data_old['user_template'];
unset($user_data_old['user_template']);
unset($user_data_old['user_language']);
unset($user_data_old['is_dst']);
unset($user_data_old['tz_offset']);
unset($user_data_old['email_notify']);
unset($user_data_old['show_signature']);
// converting custom-fields now
if(is_array($user_data_old) && count($user_data_old)) {
foreach($user_data_old as $old_key => $old_val) {
$type=-1;
// find out which ID that custom-field has
foreach($PHORUM['PROFILE_FIELDS'] as $ctype => $cdata) {
if($cdata['name'] == $old_key) {
$type=$ctype;
break;
}
}
 
if($type != -1) { // store it only if we found it
if( $old_val!=="" ) {
if(!is_array($old_val)) {
$user_data_new[$type] = substr($old_val,0,$PHORUM['PROFILE_FIELDS'][$type]['length']);
} else {
$user_data_new[$type] = $old_val;
}
}
}
}
}
$userdata['user_data']=$user_data_new;
phorum_user_save($userdata);
}
// remove old column
//mysql_query("ALTER TABLE {$PHORUM['user_newflags_table']} DROP newflags",$cid);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005031900.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD `sessid` varchar(50) NOT NULL default '',add key sessid (sessid)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003091700.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop attachments";
$upgrade_queries[]="CREATE TABLE {$PHORUM['files_table']} ( file_id int(11) NOT NULL auto_increment, user_id int(11) NOT NULL default '0', filename varchar(255) NOT NULL default '', filesize int(11) NOT NULL default '0', file_data mediumtext NOT NULL, add_datetime int(10) unsigned NOT NULL default '0', PRIMARY KEY (file_id), KEY add_datetime (add_datetime) ) TYPE=MyISAM";
$upgrade_queries[]="CREATE TABLE {$PHORUM['message_files_xref_table']} ( message_id int(11) NOT NULL default '0', file_id int(11) NOT NULL default '0', PRIMARY KEY (message_id, file_id) ) TYPE=MyISAM";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003103000.php
New file
0,0 → 1,11
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} drop allow_html";
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} add registration_control tinyint(1) NOT NULL default '0'";
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} change sec_public pub_perms int(10) unsigned NOT NULL default '0'";
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} change sec_reg reg_perms int(10) unsigned NOT NULL default '0'";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003060100.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD password_temp varchar(50) NOT NULL default ''";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003022400.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD edit_post TINYINT unsigned NOT NULL DEFAULT 1";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003072000.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD check_duplicate tinyint(4) NOT NULL default '0'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005062000.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD `reverse_threading` tinyint(1) NOT NULL default '0'";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005101700.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} change column inherit_id inherit_id int(10) unsigned default NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003052600.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD template_settings text NOT NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005022800.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="CREATE TABLE {$PHORUM['search_table']} ( message_id int(10) unsigned NOT NULL default '0', search_text mediumtext NOT NULL, PRIMARY KEY (message_id), FULLTEXT KEY search_text (search_text) ) TYPE=MyISAM";
$upgrade_queries[]="insert into {$PHORUM['search_table']} select message_id, concat(author, ' | ', subject, ' | ', body) from {$PHORUM['message_table']}";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005070500.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} add column moderator_data text not null default '';";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080600.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['forums_table']} modify description text not null default ''";
$upgrade_queries[]="alter table {$PHORUM['user_newflags_table']} drop newflags";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004032900.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['private_message_table']} drop KEY read_flag";
$upgrade_queries[]="alter table {$PHORUM['private_message_table']} add KEY read_flag (to_user_id,read_flag,to_del_flag)";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005092200.php
New file
0,0 → 1,35
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// Check if all the tables from version 2005091400 were created,
// before dropping the old private messages table.
 
$old_table = "{$PHORUM['DBCONFIG']['table_prefix']}_private_messages";
 
$cid=phorum_db_mysql_connect();
 
$check_tables = array(
$PHORUM["pm_messages_table"] => 1,
$PHORUM["pm_folders_table"] => 1,
$PHORUM["pm_xref_table"] => 1,
);
 
$res = mysql_query("show tables");
if ($res) {
while (($row = mysql_fetch_array($res))) {
if (isset($check_tables[$row[0]])) {
unset($check_tables[$row[0]]);
}
}
}
 
if (count($check_tables)) { ?>
<br/>
<b>Warning: database upgrade 2005091400 does not seem to have
completed successfully. The old style private messages table
<?php print $old_table ?> will be kept for backup. <?php
} else {
$upgrade_queries[] = "DROP TABLE $old_table";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080601.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key post_count (forum_id,status,parent_id)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004032901.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="alter table {$PHORUM['forums_table']} drop registration_control;";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005062600.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD `inherit_id` int(10) unsigned default '0' not null";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005092201.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} add column pm_email_notify tinyint ( 1 ) default '1' not null";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004052900.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="alter table {$PHORUM['message_table']} add viewcount int(10) unsigned NOT NULL default '0'";
$upgrade_queries[]="alter table {$PHORUM['forums_table']} add count_views tinyint(1) unsigned NOT NULL default '0'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080800.php
New file
0,0 → 1,17
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add closed tinyint(4) NOT NULL default '0'";
 
$upgrade_queries[]="update {$PHORUM['message_table']} set closed=1, status=2 where status=1";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key dup_check (forum_id,author,subject,datestamp)";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop key message_id";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key forum_max_message (forum_id, message_id)";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key last_post_time (forum_id, status, modifystamp)";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005072600.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} CHANGE meta meta mediumtext NOT NULL";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005092400.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM['user_table']} add column cookie_sessid_lt varchar(50) NOT NULL default '',change column sessid sessid_st varchar(50) NOT NULL default '',add index sessid_st (sessid_st),add index cookie_sessid_lt (cookie_sessid_lt),drop index sessid";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005082800.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['forums_table']} add column max_totalattachment_size int(10) unsigned default 0";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003112001.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="CREATE TABLE {$PHORUM['private_message_table']} ( private_message_id int(10) unsigned NOT NULL auto_increment, from_username varchar(50) NOT NULL default '', to_username varchar(50) NOT NULL default '', from_user_id int(10) unsigned NOT NULL default '0', to_user_id int(10) unsigned NOT NULL default '0', subject varchar(100) NOT NULL default '', message text NOT NULL, datestamp int(10) unsigned NOT NULL default '0', read_flag tinyint(1) NOT NULL default '0', reply_flag tinyint(1) NOT NULL default '0', to_del_flag tinyint(1) NOT NULL default '0', from_del_flag tinyint(1) NOT NULL default '0', PRIMARY KEY (private_message_id), KEY to_user_id (to_user_id,to_del_flag,datestamp), KEY from_user_id (from_user_id,from_del_flag,datestamp), KEY to_del_flag (to_del_flag,from_del_flag) ) TYPE=MyISAM";
$upgrade_queries[]="alter table {$PHORUM['user_table']} modify active tinyint(1) NOT NULL default '0'";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005100300.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM["pm_buddies_table"]} add index buddy_user_id (buddy_user_id)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004071100.php
New file
0,0 → 1,8
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the message-table with an index for unapproved messages
$upgrade_queries[]="ALTER TABLE {$PHORUM['groups_table']} ADD open tinyint(3) NOT NULL default '0' AFTER name";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004061300.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="alter table {$PHORUM['user_group_xref_table']} add status tinyint(3) NOT NULL default '1'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003011801.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['message_table']} ADD edit_count TINYINT unsigned NOT NULL DEFAULT 0, ADD edit_date datetime NOT NULL default '0000-00-00 00:00:00'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005081000.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="insert into {$PHORUM['settings_table']} set name='installed', type='V', data='1'";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005100701.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['message_table']} ADD INDEX next_prev_thread ( forum_id , status , thread ) ";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004031700.php
New file
0,0 → 1,14
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="alter table {$PHORUM['user_table']} add `date_added` int(10) unsigned NOT NULL default '0'";
$upgrade_queries[]="alter table {$PHORUM['user_table']} add `date_last_active` int(10) unsigned NOT NULL default '0'";
$upgrade_queries[]="alter table {$PHORUM['user_table']} add `hide_activity` tinyint(1) NOT NULL default '0'";
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} add KEY `activity` (`date_last_active`,`hide_activity`)";
$upgrade_queries[]="alter table {$PHORUM['user_table']} add KEY `date_added` (`date_added`)";
$upgrade_queries[]="update {$PHORUM['user_table']} set date_last_active=UNIX_TIMESTAMP(NOW()), date_added=UNIX_TIMESTAMP(NOW())";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005071200.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} CHANGE ip ip VARCHAR( 255 ) NOT NULL";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004071500.php
New file
0,0 → 1,8
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the message-table with an index for unapproved messages
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} CHANGE list_length list_length_flat INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL";
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD list_length_threaded INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `list_length_flat` ";
$upgrade_queries[]="UPDATE {$PHORUM['forums_table']} SET list_length_threaded = list_length_flat/2 ";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005091400.php
New file
0,0 → 1,87
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// Create tables for the new PM system.
 
$upgrade_queries[]= "CREATE TABLE {$PHORUM["pm_messages_table"]} (
pm_message_id int(10) unsigned NOT NULL auto_increment,
from_user_id int(10) unsigned NOT NULL default '0',
from_username varchar(50) NOT NULL default '',
subject varchar(100) NOT NULL default '',
message text NOT NULL default '',
datestamp int(10) unsigned NOT NULL default '0',
meta mediumtext NOT NULL default '',
PRIMARY KEY (pm_message_id)
) TYPE=MyISAM";
 
$upgrade_queries[] = "CREATE TABLE {$PHORUM["pm_folders_table"]} (
pm_folder_id int(10) unsigned NOT NULL auto_increment,
user_id int(10) unsigned NOT NULL default '0',
foldername varchar(20) NOT NULL default '',
KEY user_id (user_id),
PRIMARY KEY (pm_folder_id)
) TYPE=MyISAM";
 
$upgrade_queries[] = "CREATE TABLE {$PHORUM["pm_xref_table"]} (
pm_xref_id int(10) unsigned NOT NULL auto_increment,
user_id int(10) unsigned NOT NULL default '0',
pm_folder_id int(10) unsigned NOT NULL default '0',
special_folder varchar(10),
pm_message_id int(10) unsigned NOT NULL default '0',
read_flag tinyint(1) NOT NULL default '0',
reply_flag tinyint(1) NOT NULL default '0',
PRIMARY KEY (pm_xref_id),
KEY xref (user_id,pm_folder_id,pm_message_id),
KEY read_flag (read_flag)
) TYPE=MyISAM";
 
// converting the old PM system to the new one.
$old_table = "{$PHORUM['DBCONFIG']['table_prefix']}_private_messages";
$res=mysql_query("SELECT * FROM $old_table");
while($row=mysql_fetch_assoc($res))
{
// Put the message in the message table.
$meta = serialize(array(
'recipients' => array(
$row["to_user_id"] => array (
'user_id' => $row["to_user_id"],
'username' => $row["to_username"],
'read_flag' => $row["read_flag"],
)
)
));
$sql = "INSERT INTO {$PHORUM["pm_messages_table"]} SET " .
"pm_message_id = {$row["private_message_id"]}, " .
"from_user_id = {$row["from_user_id"]}, " .
"from_username = '" . addslashes($row["from_username"]) . "', " .
"subject = '" . addslashes($row['subject']) . "', " .
"message = '" . addslashes($row['message']) . "', " .
"datestamp = {$row["datestamp"]}, " .
"meta = '" . addslashes($meta) . "'";
$upgrade_queries[] = $sql;
 
// Link message to recipient inbox.
if (! $row["to_del_flag"]) {
$sql = "INSERT INTO {$PHORUM["pm_xref_table"]} SET " .
"user_id = {$row["to_user_id"]}, " .
"pm_folder_id = 0, " .
"special_folder = '" . PHORUM_PM_INBOX . "', " .
"pm_message_id = {$row["private_message_id"]}, " .
"read_flag = {$row["read_flag"]}, " .
"reply_flag = {$row["reply_flag"]}";
$upgrade_queries[] = $sql;
}
 
// Link message to sender outbox.
if (! $row["from_del_flag"]) {
$sql = "INSERT INTO {$PHORUM["pm_xref_table"]} SET " .
"user_id = {$row["from_user_id"]}, " .
"pm_folder_id = 0, " .
"special_folder = '" . PHORUM_PM_OUTBOX . "', " .
"pm_message_id = {$row["private_message_id"]}, " .
"read_flag = 1, " .
"reply_flag = 0";
$upgrade_queries[] = $sql;
}
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004071900.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} ADD display_fixed TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004081900.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop key forum_max_message";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key forum_max_message (forum_id, message_id, status, parent_id)";
 
$upgrade_queries[]="insert into {$PHORUM['settings_table']} values ('show_new_on_index', 'V', '1')";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004012400.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
// altering the tables for the mixed mode
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} CHANGE threaded threaded_list TINYINT( 4 ) DEFAULT '0' NOT NULL, ADD threaded_read TINYINT( 4 ) DEFAULT '0' NOT NULL";
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} CHANGE threaded threaded_list TINYINT( 4 ) DEFAULT '0' NOT NULL, ADD threaded_read TINYINT( 4 ) DEFAULT '0' NOT NULL";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003082100.php
New file
0,0 → 1,17
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY parent_thread";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY modifystamp_thread";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY parent_status_mod";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY parent_status_thread";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY message_status_thread";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY message_status_mod";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY parent_id";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop KEY parent_status_forum";
$upgrade_queries[]="alter table {$PHORUM['message_table']} add KEY list_page_flat (thread,forum_id,status,parent_id,sort)";
$upgrade_queries[]="alter table {$PHORUM['message_table']} add KEY special_threads (sort,forum_id)";
$upgrade_queries[]="alter table {$PHORUM['message_table']} add KEY list_page_float (modifystamp,forum_id,status,parent_id,sort)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080300.php
New file
0,0 → 1,37
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// wow doing it all by hand this time :(
 
$cid=phorum_db_mysql_connect();
// adding the new field
mysql_query("ALTER TABLE {$PHORUM['user_newflags_table']} ADD message_id INT( 11 ) NOT NULL",$cid);
// removing old primary-key
mysql_query("ALTER TABLE {$PHORUM['user_newflags_table']} DROP PRIMARY KEY",$cid);
// adding new primary-key
mysql_query("ALTER TABLE {$PHORUM['user_newflags_table']} ADD PRIMARY KEY ( user_id , forum_id , message_id )",$cid);
 
// converting the newflags
$res=mysql_query("SELECT * FROM {$PHORUM['user_newflags_table']} where message_id=0",$cid);
$olduser=$GLOBALS['PHORUM']['user']['user_id'];
while($row=mysql_fetch_assoc($res)) {
$forum=$row['forum_id'];
$data=unserialize($row['newflags']);
$GLOBALS['PHORUM']['user']['user_id']=$row['user_id'];
$newdata=array();
foreach($data as $mid1 => $mid2) {
if(is_int($mid1)) {
$newdata[]=array("id"=>$mid1,"forum"=>$forum);
}
}
phorum_db_newflag_add_read($newdata);
unset($data);
unset($newdata);
}
$GLOBALS['PHORUM']['user']['user_id']=$olduser;
mysql_query("DELETE FROM {$PHORUM['user_newflags_table']} where message_id=0",$cid);
 
// remove old column
mysql_query("ALTER TABLE {$PHORUM['user_newflags_table']} DROP newflags",$cid);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003060600.php
New file
0,0 → 1,4
<?php
if(!defined("PHORUM_ADMIN")) return;
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD posts int(10) NOT NULL default '0'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005101800.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['forums_table']} add column sticky_count int(10) unsigned NOT NULL default '0'";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005101801.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// Refresh all forum statistics for making bringing thread_count up to date.
$forums = phorum_db_get_forums();
foreach ($forums as $forum) {
$GLOBALS["PHORUM"]["forum_id"] = $forum["forum_id"];
phorum_db_update_forum_stats(true);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080500.php
New file
0,0 → 1,11
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop key list_page_float";
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop key list_page_flat";
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key list_page_float (forum_id, parent_id, modifystamp)";
$upgrade_queries[]="alter table {$PHORUM['message_table']} add key list_page_flat (forum_id, parent_id, thread)";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005082300.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['files_table']} add column link varchar(10) NOT NULL DEFAULT ''";
$upgrade_queries[]="drop index message_id on {$PHORUM['files_table']}";
$upgrade_queries[]="create index message_id_link on {$PHORUM['files_table']} (message_id, link)";
$upgrade_queries[]="update {$PHORUM['files_table']} set link='message' where message_id != 0";
$upgrade_queries[]="update {$PHORUM['files_table']} set link='user' where message_id = 0";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004080700.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} CHANGE email_temp email_temp VARCHAR( 110 )";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005092300.php
New file
0,0 → 1,12
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "CREATE TABLE {$PHORUM["pm_buddies_table"]} (
pm_buddy_id int(10) unsigned NOT NULL auto_increment,
user_id int(10) unsigned NOT NULL,
buddy_user_id int(10) unsigned NOT NULL,
PRIMARY KEY pm_buddy_id (pm_buddy_id),
UNIQUE KEY userids (user_id, buddy_user_id)
) TYPE=MyISAM";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004090700.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} ADD last_active_forum INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL AFTER date_last_active";
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} drop key activity";
 
$upgrade_queries[]="alter table {$PHORUM['user_table']} add key activity (date_last_active,hide_activity,last_active_forum)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003092700.php
New file
0,0 → 1,5
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="CREATE TABLE {$PHORUM['banlist_table']} ( id int(11) NOT NULL auto_increment, forum_id int(11) NOT NULL default '0', type tinyint(4) NOT NULL default '0', pcre tinyint(4) NOT NULL default '0', string varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY forum_id (forum_id)) TYPE=MyISAM";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004031000.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="ALTER TABLE {$PHORUM['message_table']} drop index `search`";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004021200.php
New file
0,0 → 1,8
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="ALTER TABLE {$PHORUM['files_table']} add message_id int unsigned not null default 0";
$upgrade_queries[]="ALTER TABLE {$PHORUM['files_table']} add key (message_id)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004031200.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="UPDATE {$PHORUM['forums_table']} set active=1";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005100400.php
New file
0,0 → 1,12
<?php
 
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM["forums_table"]} modify inherit_id int(10) unsigned default '0'";
 
$upgrade_queries[]= "update {$PHORUM["forums_table"]} set inherit_id=NULL where inherit_id=0";
 
$upgrade_queries[]= "insert into {$PHORUM["settings_table"]} set name='default_forum_options', type='S', data='".mysql_escape_string('a:24:{s:8:"forum_id";s:1:"0";s:10:"moderation";s:1:"0";s:16:"email_moderators";s:1:"0";s:9:"pub_perms";i:1;s:9:"reg_perms";i:15;s:13:"display_fixed";i:0;s:8:"template";s:7:"default";s:8:"language";s:7:"english";s:13:"threaded_list";s:1:"0";s:13:"threaded_read";s:1:"0";s:17:"reverse_threading";s:1:"0";s:12:"float_to_top";s:1:"1";s:16:"list_length_flat";i:30;s:20:"list_length_threaded";i:30;s:11:"read_length";s:2:"30";s:18:"display_ip_address";s:1:"0";s:18:"allow_email_notify";s:1:"0";s:15:"check_duplicate";s:1:"1";s:11:"count_views";s:1:"2";s:15:"max_attachments";i:0;s:22:"allow_attachment_types";s:0:"";s:19:"max_attachment_size";i:0;s:24:"max_totalattachment_size";i:0;s:5:"vroot";i:0;}')."'";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004031201.php
New file
0,0 → 1,7
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the files tables
$upgrade_queries[]="ALTER TABLE {$PHORUM['private_message_table']} add key `read_flag` (`to_user_id`,`read_flag`)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005100600.php
New file
0,0 → 1,13
<?php
 
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM["user_table"]} add sessid_st_timeout int(10) unsigned not null default 0";
 
$upgrade_queries[]= "insert into {$PHORUM["settings_table"]} set name='short_session_timeout', type='V', data='60'";
 
$upgrade_queries[]= "insert into {$PHORUM["settings_table"]} set name='tight_security', type='V', data='0'";
 
$upgrade_queries[]= "insert into {$PHORUM["settings_table"]} set name='admin_session_salt', type='V', data='".microtime()."'";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004100700.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['message_table']} drop key post_count, add key post_count (forum_id, status, parent_id)";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2003112500.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="alter table {$PHORUM['forums_table']} drop email_outgoing_address, drop email_incoming_address, drop email_subject_tag";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004071000.php
New file
0,0 → 1,8
<?php
if(!defined("PHORUM_ADMIN")) return;
 
// altering the message-table with an index for unapproved messages
$upgrade_queries[]="ALTER TABLE {$PHORUM['message_table']} ADD INDEX status_forum ( status , forum_id )";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2005120400.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM["user_table"]} add moderation_email tinyint(2) unsigned not null default 1";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysql/2004112600.php
New file
0,0 → 1,10
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]="ALTER TABLE {$PHORUM['user_table']} ADD `show_signature` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `email_notify` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `tz_offset` TINYINT( 2 ) DEFAULT '-99' NOT NULL,
ADD `is_dst` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
ADD `user_language` VARCHAR( 100 ) NOT NULL ,
ADD `user_template` VARCHAR( 100 ) NOT NULL ";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysqli/2005120400.php
New file
0,0 → 1,6
<?php
if(!defined("PHORUM_ADMIN")) return;
 
$upgrade_queries[]= "alter table {$PHORUM["user_table"]} add moderation_email tinyint(2) unsigned not null default 1";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/upgrade/mysqli/2005102700.php
--- phorum/bibliotheque/phorum/include/db/config.php (revision 0)
+++ phorum/bibliotheque/phorum/include/db/config.php (revision 1976)
@@ -0,0 +1,89 @@
+<?php
+/*
+
+This file holds the configuration for letting Phorum connect to your
+database server. A detailed description of the used configuration fields
+can be found below.
+
+If you are running your site with a hosting provider and you do not
+know what to fill in here, please contact your hosting provider for
+advice.
+
+*/
+
+if(!defined('PHORUM')) return;
+
+$PHORUM['DBCONFIG']=array(
+
+ // Database connection.
+ 'type' => 'mysql',
+ 'name' => 'papyrus',
+ 'server' => 'localhost',
+ 'user' => 'root',
+ 'password' => 'fs1980',
+ 'table_prefix' => 'phorum',
+
+ // 'down_page' => 'http://www.example.com/phorum/down.html',
+
+ // 1=enabled, 0=disabled
+ // (always disable this option for MySQL versions prior to 4.0.18!)
+ 'mysql_use_ft' => '1'
+);
+
+/*
+
+DETAILED CONFIGURATION FIELD DESCRIPTION
+----------------------------------------
+
+* type:
+
+ The type of database. Typically 'mysql' (the only database type which
+ is officially supported by the Phorum distribution). Do not change this
+ value, unless you know what you are doing.
+
+* name:
+
+ The name of the database.
+
+* server:
+
+ The hostname or IP-address of the database server. You only need to
+ change this if the database server is running on a different system.
+
+* user:
+
+ The username which is used for accessing the database server. The
+ user must have full access rights to the database, for creating and
+ maintaining the needed tables.
+
+* password:
+
+ The password for the database user.
+
+* table_prefix:
+
+ This table prefix will be at the front of all table names that are
+ created and used by Phorum. You only need to change this in case you
+ are using the same database for multiple Phorum installations.
+ By changing the table prefix you can prevent the tables from the
+ installations from colliding. E.g. set the table prefix for one
+ installation to "phorum1" and the other to "phorum2".
+ Important: never change the table prefix for a running system.
+
+* down_page:
+
+ An optional URL for redirecting the user when database is down.
+ If you want to use this field, remove the "//" in front of it.
+
+* mysql_use_ft (MySQL-only option):
+
+ This field determines whether Phorum will use MySQL's full text
+ algorithm for searching postings. If enabled, your database will
+ grow larger (because of an extra table for storing search data),
+ but searching for postings will be much faster in return.
+ You will have to disable this feature in case you are running a
+ database version prior to MySQL 4.0.18.
+
+*/
+
+?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/db/mysql.php
New file
0,0 → 1,4341
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// cvs-info: $Id$
 
if (!defined("PHORUM")) return;
 
/**
* The other Phorum code does not care how the messages are stored.
* The only requirement is that they are returned from these functions
* in the right way. This means each database can use as many or as
* few tables as it likes. It can store the fields anyway it wants.
* The only thing to worry about is the table_prefix for the tables.
* all tables for a Phorum install should be prefixed with the
* table_prefix that will be entered in include/db/config.php. This
* will allow multiple Phorum installations to use the same database.
*/
 
/**
* These are the table names used for this database system.
*/
 
// tables needed to be "partitioned"
$PHORUM["message_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_messages";
$PHORUM["user_newflags_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_newflags";
$PHORUM["subscribers_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_subscribers";
$PHORUM["files_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_files";
$PHORUM["search_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_search";
 
// tables common to all "partitions"
$PHORUM["settings_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_settings";
$PHORUM["forums_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_forums";
$PHORUM["user_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_users";
$PHORUM["user_permissions_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_permissions";
$PHORUM["groups_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_groups";
$PHORUM["forum_group_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_forum_group_xref";
$PHORUM["user_group_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_group_xref";
$PHORUM['user_custom_fields_table'] = "{$PHORUM['DBCONFIG']['table_prefix']}_user_custom_fields";
$PHORUM["banlist_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_banlists";
$PHORUM["pm_messages_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_messages";
$PHORUM["pm_folders_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_folders";
$PHORUM["pm_xref_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_xref";
$PHORUM["pm_buddies_table"] = "{$PHORUM['DBCONFIG']['table_prefix']}_pm_buddies";
/*
* fields which are always strings, even if they contain only numbers
* used in post-message and update-message, otherwise strange things happen
*/
$PHORUM['string_fields']= array('author', 'subject', 'body', 'email');
 
/* A piece of SQL code that can be used for identifying moved messages. */
define('PHORUM_SQL_MOVEDMESSAGES', '(parent_id = 0 and thread != message_id)');
 
/**
* This function executes a query to select the visible messages from
* the database for a given page offset. The main Phorum code handles
* actually sorting the threads into a threaded list if needed.
*
* By default, the message body is not included in the fetch queries.
* If the body is needed in the thread list, $PHORUM['TMP']['bodies_in_list']
* must be set to "1" (for example using setting.tpl).
*
* NOTE: ALL dates should be returned as Unix timestamps
*
* @param offset - the index of the page to return, starting with 0
* @param messages - an array containing forum messages
*/
 
function phorum_db_get_thread_list($offset)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($offset, "int");
 
$conn = phorum_db_mysql_connect();
 
$table = $PHORUM["message_table"];
 
// The messagefields that we want to fetch from the database.
$messagefields =
"$table.author,
$table.datestamp,
$table.email,
$table.message_id,
$table.meta,
$table.moderator_post,
$table.modifystamp,
$table.parent_id,
$table.sort,
$table.status,
$table.subject,
$table.thread,
$table.thread_count,
$table.user_id,
$table.viewcount,
$table.closed";
if(isset($PHORUM['TMP']['bodies_in_list']) && $PHORUM['TMP']['bodies_in_list'] == 1) {
$messagefields .= "\n,$table.body\n,$table.ip";
}
 
// The sort mechanism to use.
if($PHORUM["float_to_top"]){
$sortfield = "modifystamp";
$index = "list_page_float";
} else{
$sortfield = "thread";
$index = "list_page_flat";
}
 
// Initialize the return array.
$messages = array();
 
// The groups of messages we want to fetch from the database.
$groups = array();
if ($offset == 0) $groups[] = "specials";
$groups[] = "threads";
if ($PHORUM["threaded_list"]) $groups[] = "replies";
 
// for remembering message ids for which we want to fetch the replies.
$replymsgids = array();
 
// Process all groups.
foreach ($groups as $group) {
 
 
$sql = NULL;
 
switch ($group) {
 
// Announcements and stickies.
case "specials":
 
$sql = "select $messagefields
from $table
where
status=".PHORUM_STATUS_APPROVED." and
((parent_id=0 and sort=".PHORUM_SORT_ANNOUNCEMENT."
and forum_id={$PHORUM['vroot']})
or
(parent_id=0 and sort=".PHORUM_SORT_STICKY."
and forum_id={$PHORUM['forum_id']}))
order by
sort, $sortfield desc";
break;
 
// Threads.
case "threads":
 
if ($PHORUM["threaded_list"]) {
$limit = $PHORUM['list_length_threaded'];
$extrasql = '';
} else {
$limit = $PHORUM['list_length_flat'];
}
$start = $offset * $limit;
 
$sql = "select $messagefields
from $table use index ($index)
where
$sortfield > 0 and
forum_id = {$PHORUM["forum_id"]} and
status = ".PHORUM_STATUS_APPROVED." and
parent_id = 0 and
sort > 1
order by
$sortfield desc
limit $start, $limit";
break;
 
// Reply messages.
case "replies":
 
// We're done if we did not collect any messages with replies.
if (! count($replymsgids)) break;
 
$sortorder = "sort, $sortfield desc, message_id";
if(isset($PHORUM["reverse_threading"]) && $PHORUM["reverse_threading"])
$sortorder.=" desc";
 
$sql = "select $messagefields
from $table
where
status = ".PHORUM_STATUS_APPROVED." and
thread in (" . implode(",",$replymsgids) .")
order by $sortorder";
break;
 
} // End of switch ($group)
 
// Continue with the next group if no SQL query was formulated.
if (is_null($sql)) continue;
 
// Fetch the messages for the current group.
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$rows = mysql_num_rows($res);
if($rows > 0){
while ($rec = mysql_fetch_assoc($res)){
$messages[$rec["message_id"]] = $rec;
$messages[$rec["message_id"]]["meta"] = array();
if(!empty($rec["meta"])){
$messages[$rec["message_id"]]["meta"] = unserialize($rec["meta"]);
}
 
// We need the message ids for fetching reply messages.
if ($group == 'threads' && $rec["thread_count"] > 1) {
$replymsgids[] = $rec["message_id"];
}
}
}
}
 
return $messages;
}
 
/**
* This function executes a query to get the recent messages for
* all forums the user can read, a particular forum, or a particular
* thread, and and returns an array of the messages order by message_id.
* You can optionally retrieve only new threads.
*
* The original version of this function came from Jim Winstead of mysql.com
*/
function phorum_db_get_recent_messages($count, $forum_id = 0, $thread = 0, $threads_only = 0)
{
$PHORUM = $GLOBALS["PHORUM"];
settype($count, "int");
settype($thread, "int");
$arr = array();
$allowed_forums = array();
 
$conn = phorum_db_mysql_connect();
 
// we need to differentiate on which key to use
if($thread) {
$use_key='thread_message';
} else {
$use_key='forum_max_message';
}
 
$sql = "SELECT {$PHORUM['message_table']}.* FROM {$PHORUM['message_table']} USE KEY($use_key) WHERE status=".PHORUM_STATUS_APPROVED;
 
// have to check what forums they can read first.
// even if $thread is passed, we have to make sure
// the user can read the forum
if($forum_id <= 0) {
$allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ);
 
// if they are not allowed to see any forums, return the emtpy $arr;
if(empty($allowed_forums))
return $arr;
} elseif(is_array($forum_id)) {
// for an array, check each one and return if none are allowed
foreach($forum_id as $id){
if(phorum_user_access_allowed(PHORUM_USER_ALLOW_READ,$id)) {
$allowed_forums[]=$id;
}
}
 
// if they are not allowed to see any forums, return the emtpy $arr;
if(empty($allowed_forums))
return $arr;
} else {
// only single forum, *much* fast this way
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_READ,$forum_id)) {
return $arr;
}
settype($forum_id, "int");
}
 
if(count($allowed_forums)){
$sql.=" and forum_id in (".implode(",", $allowed_forums).")";
} else {
$sql.=" and forum_id=$forum_id";
}
 
if($thread){
$sql.=" and thread=$thread";
}
 
if($threads_only) {
$sql.= " and parent_id = 0";
$sql.= " ORDER BY thread DESC";
} else {
$sql.= " ORDER BY message_id DESC";
}
 
if($count){
$sql.= " LIMIT $count";
}
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($rec = mysql_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
 
// convert meta field
if(empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"]=array();
} else {
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
if(empty($arr['users'])) $arr['users']=array();
if($rec["user_id"]){
$arr['users'][]=$rec["user_id"];
}
 
}
 
return $arr;
}
 
 
/**
* This function executes a query to select messages from the database
* and returns an array. The main Phorum code handles actually sorting
* the threads into a threaded list if needed.
*
* NOTE: ALL dates should be returned as Unix timestamps
* @param forum - the forum id to work with. Omit or NULL for all forums.
* You can also pass an array of forum_id's.
* @param waiting_only - only take into account messages which have to
* be approved directly after posting. Do not include
* messages which are hidden by a moderator.
*/
 
function phorum_db_get_unapproved_list($forum = NULL, $waiting_only=false,$moddays=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$table = $PHORUM["message_table"];
 
$arr = array();
 
$sql = "select
$table.*
from
$table ";
 
if (is_array($forum)){
$sql .= "where forum_id in (" . implode(",", $forum) . ") and ";
} elseif (! is_null($forum)){
settype($forum, "int");
$sql .= "where forum_id = $forum and ";
} else {
$sql .= "where ";
}
 
if($moddays > 0) {
$checktime=time()-(86400*$moddays);
$sql .=" datestamp > $checktime AND";
}
 
if($waiting_only){
$sql.=" status=".PHORUM_STATUS_HOLD;
} else {
$sql="($sql status=".PHORUM_STATUS_HOLD.") " .
"union ($sql status=".PHORUM_STATUS_HIDDEN.")";
}
 
 
$sql .=" order by thread, message_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($rec = mysql_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
$arr[$rec["message_id"]]["meta"] = array();
if(!empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"] = unserialize($rec["meta"]);
}
}
 
return $arr;
}
 
 
/**
* This function posts a message to the tables.
* The message is passed by reference and message_id and thread are filled
*/
 
function phorum_db_post_message(&$message,$convert=false){
$PHORUM = $GLOBALS["PHORUM"];
$table = $PHORUM["message_table"];
 
$conn = phorum_db_mysql_connect();
 
$success = false;
 
foreach($message as $key => $value){
if (is_numeric($value) && !in_array($key,$PHORUM['string_fields'])){
$message[$key] = (int)$value;
} elseif(is_array($value)) {
$message[$key] = mysql_escape_string(serialize($value));
} else{
$message[$key] = mysql_escape_string($value);
}
}
 
if(!$convert) {
$NOW = time();
} else {
$NOW = $message['datestamp'];
}
 
// duplicate-check
if(isset($PHORUM['check_duplicate']) && $PHORUM['check_duplicate'] && !$convert) {
// we check for dupes in that number of minutes
$check_minutes=60;
$check_timestamp =$NOW - ($check_minutes*60);
// check_query
$chk_query="SELECT message_id FROM $table WHERE forum_id = {$message['forum_id']} AND author='{$message['author']}' AND subject='{$message['subject']}' AND body='{$message['body']}' AND datestamp > $check_timestamp";
$res = mysql_query($chk_query, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $chk_query");
if(mysql_num_rows($res))
return 0;
}
 
if(isset($message['meta'])){
$metaval=",meta='{$message['meta']}'";
} else {
$metaval="";
}
 
$sql = "Insert into $table set
forum_id = {$message['forum_id']},
datestamp=$NOW,
thread={$message['thread']},
parent_id={$message['parent_id']},
author='{$message['author']}',
subject='{$message['subject']}',
email='{$message['email']}',
ip='{$message['ip']}',
user_id={$message['user_id']},
moderator_post={$message['moderator_post']},
status={$message['status']},
sort={$message['sort']},
msgid='{$message['msgid']}',
body='{$message['body']}',
closed={$message['closed']}
$metaval";
 
// if in conversion we need the message-id too
if($convert && isset($message['message_id'])) {
$sql.=",message_id=".$message['message_id'];
}
 
if(isset($message['modifystamp'])) {
$sql.=",modifystamp=".$message['modifystamp'];
}
 
if(isset($message['viewcount'])) {
$sql.=",viewcount=".$message['viewcount'];
}
 
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if ($res){
$message["message_id"] = mysql_insert_id($conn);
 
if(!empty($message["message_id"])){
 
$message["datestamp"]=$NOW;
 
if ($message["thread"] == 0){
$message["thread"] = $message["message_id"];
$sql = "update $table set thread={$message['message_id']} where message_id={$message['message_id']}";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// start ft-search stuff
$search_text="$message[author] | $message[subject] | $message[body]";
 
$sql="insert delayed into {$PHORUM['search_table']} set message_id={$message['message_id']}, forum_id={$message['forum_id']}, search_text='$search_text'";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// end ft-search stuff
 
$success = true;
// some data for later use, i.e. email-notification
$GLOBALS['PHORUM']['post_returns']['message_id']=$message["message_id"];
$GLOBALS['PHORUM']['post_returns']['thread_id']=$message["thread"];
}
}
 
return $success;
}
 
/**
* This function deletes messages from the messages table.
*
* @param message $ _id the id of the message which should be deleted
* mode the mode of deletion, PHORUM_DELETE_MESSAGE for reconnecting the children, PHORUM_DELETE_TREE for deleting the children
*/
 
function phorum_db_delete_message($message_id, $mode = PHORUM_DELETE_MESSAGE)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($message_id, "int");
 
$threadset = 0;
// get the parents of the message to delete.
$sql = "select forum_id, message_id, thread, parent_id from {$PHORUM['message_table']} where message_id = $message_id ";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$rec = mysql_fetch_assoc($res);
 
if($mode == PHORUM_DELETE_TREE){
$mids = phorum_db_get_messagetree($message_id, $rec['forum_id']);
}else{
$mids = $message_id;
}
 
// unapprove the messages first so replies will not get posted
$sql = "update {$PHORUM['message_table']} set status=".PHORUM_STATUS_HOLD." where message_id in ($mids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$thread = $rec['thread'];
if($thread == $message_id && $mode == PHORUM_DELETE_TREE){
$threadset = 1;
}else{
$threadset = 0;
}
 
if($mode == PHORUM_DELETE_MESSAGE){
$count = 1;
// change the children to point to their parent's parent
// forum_id is in here for speed by using a key only
$sql = "update {$PHORUM['message_table']} set parent_id=$rec[parent_id] where forum_id=$rec[forum_id] and parent_id=$rec[message_id]";
mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}else{
$count = count(explode(",", $mids));
}
 
// delete the messages
$sql = "delete from {$PHORUM['message_table']} where message_id in ($mids)";
mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// start ft-search stuff
$sql="delete from {$PHORUM['search_table']} where message_id in ($mids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
// end ft-search stuff
 
// it kind of sucks to have this here, but it is the best way
// to ensure that it gets done if stuff is deleted.
// leave this include here, it needs to be conditional
include_once("./include/thread_info.php");
phorum_update_thread_info($thread);
 
// we need to delete the subscriptions for that thread too
$sql = "DELETE FROM {$PHORUM['subscribers_table']} WHERE forum_id > 0 AND thread=$thread";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// this function will be slow with a lot of messages.
phorum_db_update_forum_stats(true);
 
return explode(",", $mids);
}
 
/**
* gets all attached messages to a message
*
* @param id $ id of the message
*/
function phorum_db_get_messagetree($parent_id, $forum_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($parent_id, "int");
settype($forum_id, "int");
 
$conn = phorum_db_mysql_connect();
 
$sql = "Select message_id from {$PHORUM['message_table']} where forum_id=$forum_id and parent_id=$parent_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$tree = "$parent_id";
 
while($rec = mysql_fetch_row($res)){
$tree .= "," . phorum_db_get_messagetree($rec[0],$forum_id);
}
 
return $tree;
}
 
/**
* This function updates the message given in the $message array for
* the row with the given message id. It returns non 0 on success.
*/
 
function phorum_db_update_message($message_id, $message)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($message_id, "int");
 
if (count($message) > 0){
$conn = phorum_db_mysql_connect();
 
foreach($message as $field => $value){
if (is_numeric($value) && !in_array($field,$PHORUM['string_fields'])){
$fields[] = "$field=$value";
}elseif (is_array($value)){
$value = mysql_escape_string(serialize($value));
$message[$field] = $value;
$fields[] = "$field='$value'";
}else{
$value = mysql_escape_string($value);
$message[$field] = $value;
$fields[] = "$field='$value'";
}
}
 
$sql = "update {$PHORUM['message_table']} set " . implode(", ", $fields) . " where message_id=$message_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if($res){
// start ft-search stuff
if(isset($message["author"]) && isset($message["subject"]) && isset($message["body"])){
$search_text="$message[author] | $message[subject] | $message[body]";
$sql="replace delayed into {$PHORUM['search_table']} set message_id={$message_id}, forum_id={$message['forum_id']}, search_text='$search_text'";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
// end ft-search stuff
}
 
return ($res > 0) ? true : false;
 
}else{
trigger_error("\$message cannot be empty in phorum_update_message()", E_USER_ERROR);
}
}
 
 
/**
* This function executes a query to get the row with the given value
* in the given field and returns the message in an array.
*/
 
function phorum_db_get_message($value, $field="message_id", $ignore_forum_id=false)
{
$PHORUM = $GLOBALS["PHORUM"];
$field=mysql_escape_string($field);
$multiple=false;
 
$conn = phorum_db_mysql_connect();
 
 
$forum_id_check = "";
if (!$ignore_forum_id && !empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) and";
}
 
if(is_array($value)) {
$checkvar="$field IN('".implode("','",$value)."')";
$multiple=true;
} else {
$value=mysql_escape_string($value);
$checkvar="$field='$value'";
}
 
 
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check $checkvar";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$ret = $multiple ? array() : NULL;
 
if(mysql_num_rows($res)){
if($multiple) {
while($rec=mysql_fetch_assoc($res)) {
// convert meta field
if(empty($rec["meta"])){
$rec["meta"]=array();
} else {
$rec["meta"]=unserialize($rec["meta"]);
}
$ret[$rec['message_id']]=$rec;
}
} else {
$rec = mysql_fetch_assoc($res);
 
// convert meta field
if(empty($rec["meta"])){
$rec["meta"]=array();
} else {
$rec["meta"]=unserialize($rec["meta"]);
}
$ret=$rec;
}
}
 
return $ret;
}
 
/**
* This function executes a query to get the rows with the given thread
* id and returns an array of the message.
*/
function phorum_db_get_messages($thread,$page=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread, "int");
 
$conn = phorum_db_mysql_connect();
 
$forum_id_check = "";
if (!empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) and";
}
 
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
}
 
if($page > 0) {
$start=$PHORUM["read_length"]*($page-1);
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval order by message_id LIMIT $start,".$PHORUM["read_length"];
} else {
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval order by message_id";
if(isset($PHORUM["reverse_threading"]) && $PHORUM["reverse_threading"]) $sql.=" desc";
}
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$arr = array();
 
while ($rec = mysql_fetch_assoc($res)){
$arr[$rec["message_id"]] = $rec;
 
// convert meta field
if(empty($rec["meta"])){
$arr[$rec["message_id"]]["meta"]=array();
} else {
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
if(empty($arr['users'])) $arr['users']=array();
if($rec["user_id"]){
$arr['users'][]=$rec["user_id"];
}
 
}
 
if(count($arr) && $page != 0) {
// selecting the thread-starter
$sql = "select {$PHORUM['message_table']}.* from {$PHORUM['message_table']} where $forum_id_check message_id=$thread $approvedval";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
if(mysql_num_rows($res) > 0) {
$rec = mysql_fetch_assoc($res);
$arr[$rec["message_id"]] = $rec;
$arr[$rec["message_id"]]["meta"]=unserialize($rec["meta"]);
}
}
return $arr;
}
 
/**
* this function returns the index of a message in a thread
*/
function phorum_db_get_message_index($thread=0,$message_id=0) {
$PHORUM = $GLOBALS["PHORUM"];
 
// check for valid values
if(empty($message_id) || empty($message_id)) {
return 0;
}
 
settype($thread, "int");
settype($message_id, "int");
 
$approvedval="";
$forum_id_check="";
 
$conn = phorum_db_mysql_connect();
 
if (!empty($PHORUM["forum_id"])){
$forum_id_check = "(forum_id = {$PHORUM['forum_id']} OR forum_id={$PHORUM['vroot']}) AND";
}
 
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
}
 
$sql = "select count(*) as msg_index from {$PHORUM['message_table']} where $forum_id_check thread=$thread $approvedval AND message_id <= $message_id order by message_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$rec = mysql_fetch_assoc($res);
 
return $rec['msg_index'];
}
 
/**
* This function searches the database for the supplied search
* criteria and returns an array with two elements. One is the count
* of total messages that matched, the second is an array of the
* messages from the results based on the $start (0 base) given and
* the $length given.
*/
 
function phorum_db_search($search, $offset, $length, $match_type, $match_date, $match_forum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$start = $offset * $PHORUM["list_length"];
 
$arr = array("count" => 0, "rows" => array());
 
$conn = phorum_db_mysql_connect();
 
// have to check what forums they can read first.
$allowed_forums=phorum_user_access_list(PHORUM_USER_ALLOW_READ);
// if they are not allowed to search any forums, return the emtpy $arr;
if(empty($allowed_forums) || ($PHORUM['forum_id']>0 && !in_array($PHORUM['forum_id'], $allowed_forums)) ) return $arr;
 
// Add forum 0 (for announcements) to the allowed forums.
$allowed_forums[] = 0;
 
if($PHORUM['forum_id']!=0 && $match_forum!="ALL"){
$forum_where=" and forum_id={$PHORUM['forum_id']}";
} else {
$forum_where=" and forum_id in (".implode(",", $allowed_forums).")";
}
 
if($match_type=="AUTHOR"){
 
$id_table=$PHORUM['search_table']."_auth_".md5(microtime());
 
$search=mysql_escape_string($search);
 
$sql = "create temporary table $id_table (key(message_id)) ENGINE=HEAP select message_id from {$PHORUM['message_table']} where author='$search' $forum_where";
if($match_date>0){
$ts=time()-86400*$match_date;
$sql.=" and datestamp>=$ts";
}
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
} else {
 
if($match_type=="PHRASE"){
$terms = array('"'.$search.'"');
} else {
$quote_terms=array();
if ( strstr( $search, '"' ) ){
//first pull out all the double quoted strings (e.g. '"iMac DV" or -"iMac DV"')
preg_match_all( '/-*"(.*?)"/', $search, $match );
$search = preg_replace( '/-*".*?"/', '', $search );
$quote_terms = $match[0];
}
 
//finally pull out the rest words in the string
$terms = preg_split( "/\s+/", $search, 0, PREG_SPLIT_NO_EMPTY );
 
//merge them all together and return
$terms = array_merge($terms, $quote_terms);
 
}
 
if(count($terms)){
 
$use_key="";
$extra_where="";
 
/* using this code on larger forums has shown to make the search faster.
However, on smaller forums, it does not appear to help and in fact
appears to slow down searches.
 
if($match_date){
$min_time=time()-86400*$match_date;
$sql="select min(message_id) as min_id from {$PHORUM['message_table']} where datestamp>=$min_time";
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$min_id=mysql_result($res, 0, "min_id");
$use_key=" use key (primary)";
$extra_where="and message_id>=$min_id";
}
*/
 
$id_table=$PHORUM['search_table']."_ft_".md5(microtime());
 
if($PHORUM["DBCONFIG"]["mysql_use_ft"]){
 
if($match_type=="ALL" && count($terms)>1){
$against="+".mysql_escape_string(implode(" +", $terms));
} else {
$against=mysql_escape_string(implode(" ", $terms));
}
 
$clause="MATCH (search_text) AGAINST ('$against' IN BOOLEAN MODE)";
 
} else {
 
if($match_type=="ALL"){
$conj="and";
} else {
$conj="or";
}
 
// quote strings correctly
foreach ($terms as $id => $term) {
$terms[$id] = mysql_escape_string($term);
}
 
$clause = "( search_text like '%".implode("%' $conj search_text like '%", $terms)."%' )";
 
}
 
$sql = "create temporary table $id_table (key(message_id)) ENGINE=HEAP select message_id from {$PHORUM['search_table']} $use_key where $clause $extra_where";
$res = mysql_unbuffered_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
}
}
 
 
if(isset($id_table)){
 
// create a temporary table of the messages we want
$table=$PHORUM['search_table']."_".md5(microtime());
$sql="create temporary table $table (key (forum_id, status, datestamp)) ENGINE=HEAP select {$PHORUM['message_table']}.message_id, {$PHORUM['message_table']}.datestamp, status, forum_id from {$PHORUM['message_table']} inner join $id_table using (message_id) where status=".PHORUM_STATUS_APPROVED." $forum_where";
 
if($match_date>0){
$ts=time()-86400*$match_date;
$sql.=" and datestamp>=$ts";
}
 
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$sql="select count(*) as count from $table";
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$total_count=mysql_result($res, 0, 0);
 
$sql="select message_id from $table order by datestamp desc limit $start, $length";
$res = mysql_unbuffered_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$idstring="";
while ($rec = mysql_fetch_row($res)){
$idstring.="$rec[0],";
}
$idstring=substr($idstring, 0, -1);
 
if($idstring){
$sql="select * from {$PHORUM['message_table']} where message_id in ($idstring) order by datestamp desc";
$res = mysql_unbuffered_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$rows = array();
 
while ($rec = mysql_fetch_assoc($res)){
$rows[$rec["message_id"]] = $rec;
}
 
$arr = array("count" => $total_count, "rows" => $rows);
}
}
 
return $arr;
}
 
/**
* This function returns the closest thread that is greater than $thread
*/
 
function phorum_db_get_newer_thread($key){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($key, "int");
 
$conn = phorum_db_mysql_connect();
 
$keyfield = ($PHORUM["float_to_top"]) ? "modifystamp" : "thread";
 
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && $PHORUM["moderation"] == PHORUM_MODERATE_ON) {
$approvedval="AND {$PHORUM['message_table']}.status =".PHORUM_STATUS_APPROVED;
} else {
$approvedval="AND {$PHORUM['message_table']}.parent_id = 0";
}
 
$sql = "select thread from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} $approvedval and $keyfield>$key order by $keyfield limit 1";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return (mysql_num_rows($res)) ? mysql_result($res, 0, "thread") : 0;
}
 
/**
* This function returns the closest thread that is less than $thread
*/
 
function phorum_db_get_older_thread($key){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($key, "int");
 
$conn = phorum_db_mysql_connect();
 
$keyfield = ($PHORUM["float_to_top"]) ? "modifystamp" : "thread";
// are we really allowed to show this thread/message?
$approvedval = "";
if(!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && $PHORUM["moderation"] == PHORUM_MODERATE_ON) {
$approvedval="AND {$PHORUM['message_table']}.status=".PHORUM_STATUS_APPROVED;
} else {
$approvedval="AND {$PHORUM['message_table']}.parent_id = 0";
}
 
$sql = "select thread from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} $approvedval and $keyfield<$key order by $keyfield desc limit 1";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return (mysql_num_rows($res)) ? mysql_result($res, 0, "thread") : 0;
}
 
/**
* This function executes a query to get bad items of type $type and
* returns an array of the results.
*/
 
function phorum_db_load_settings(){
global $PHORUM;
 
 
$conn = phorum_db_mysql_connect();
 
$sql = "select * from {$PHORUM['settings_table']}";
 
$res = mysql_query($sql, $conn);
if(!$res && !defined("PHORUM_ADMIN")){
if (mysql_errno($conn)==1146){
// settings table does not exist
return;
} elseif(($err = mysql_error())){
phorum_db_mysql_error("$err: $sql");
}
}
 
if (empty($err) && $res){
while ($rec = mysql_fetch_assoc($res)){
 
// only load the default forum options in the admin
if($rec["name"]=="default_forum_options" && !defined("PHORUM_ADMIN")) continue;
 
if ($rec["type"] == "V"){
if ($rec["data"] == 'true'){
$val = true;
}elseif ($rec["data"] == 'false'){
$val = false;
}elseif (is_numeric($rec["data"])){
$val = $rec["data"];
}else{
$val = "$rec[data]";
}
}else{
$val = unserialize($rec["data"]);
}
 
$PHORUM[$rec['name']]=$val;
$PHORUM['SETTINGS'][$rec['name']]=$val;
}
}
}
 
/**
* This function executes a query to get bad items of type $type and
* returns an array of the results.
*/
 
function phorum_db_update_settings($settings){
global $PHORUM;
 
if (count($settings) > 0){
$conn = phorum_db_mysql_connect();
 
foreach($settings as $field => $value){
if (is_numeric($value)){
$type = 'V';
}elseif (is_string($value)){
$value = mysql_escape_string($value);
$type = 'V';
}else{
$value = mysql_escape_string(serialize($value));
$type = 'S';
}
 
$sql = "replace into {$PHORUM['settings_table']} set data='$value', type='$type', name='$field'";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
return ($res > 0) ? true : false;
}else{
trigger_error("\$settings cannot be empty in phorum_db_update_settings()", E_USER_ERROR);
}
}
 
/**
* This function executes a query to select all forum data from
* the database for a flat/collapsed display and returns the data in
* an array.
*/
 
 
function phorum_db_get_forums($forum_ids = 0, $parent_id = -1, $vroot = null, $inherit_id = null){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($parent_id, "int");
 
$conn = phorum_db_mysql_connect();
 
if (is_array($forum_ids)) {
$int_ids = array();
foreach ($forum_ids as $id) {
settype($id, "int");
$int_ids[] = $id;
}
$forum_ids = implode(",", $int_ids);
} else {
settype($forum_ids, "int");
}
 
$sql = "select * from {$PHORUM['forums_table']} ";
if ($forum_ids){
$sql .= " where forum_id in ($forum_ids)";
} elseif ($inherit_id !== null) {
$sql .= " where inherit_id = $inherit_id";
if(!defined("PHORUM_ADMIN")) $sql.=" and active=1";
} elseif ($parent_id >= 0) {
$sql .= " where parent_id = $parent_id";
if(!defined("PHORUM_ADMIN")) $sql.=" and active=1";
} elseif($vroot !== null) {
$sql .= " where vroot = $vroot";
} else {
$sql .= " where forum_id <> 0";
}
 
$sql .= " order by display_order ASC, name";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$forums = array();
 
while ($row = mysql_fetch_assoc($res)){
$forums[$row["forum_id"]] = $row;
}
 
return $forums;
}
 
/**
* This function updates the forums stats. If refresh is true, it pulls the
* numbers from the table.
*/
 
function phorum_db_update_forum_stats($refresh=false, $msg_count_change=0, $timestamp=0, $thread_count_change=0, $sticky_count_change=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
// always refresh on small forums
if (isset($PHORUM["message_count"]) && $PHORUM["message_count"]<1000) {
$refresh=true;
}
 
if($refresh || empty($msg_count_change)){
$sql = "select count(*) as message_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and status=".PHORUM_STATUS_APPROVED;
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$message_count = (int)mysql_result($res, 0, "message_count");
} else {
$message_count="message_count+$msg_count_change";
}
 
if($refresh || empty($timestamp)){
 
$sql = "select max(modifystamp) as last_post_time from {$PHORUM['message_table']} where status=".PHORUM_STATUS_APPROVED." and forum_id={$PHORUM['forum_id']}";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$last_post_time = (int)mysql_result($res, 0, "last_post_time");
} else {
 
$last_post_time = $timestamp;
}
 
if($refresh || empty($thread_count_change)){
 
$sql = "select count(*) as thread_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and parent_id=0 and status=".PHORUM_STATUS_APPROVED;
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$thread_count = (int)mysql_result($res, 0, "thread_count");
 
} else {
 
$thread_count="thread_count+$thread_count_change";
}
 
if($refresh || empty($sticky_count_change)){
 
$sql = "select count(*) as sticky_count from {$PHORUM['message_table']} where forum_id={$PHORUM['forum_id']} and sort=".PHORUM_SORT_STICKY." and parent_id=0 and status=".PHORUM_STATUS_APPROVED;
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$sticky_count = (int)mysql_result($res, 0, "sticky_count");
 
} else {
 
$sticky_count="sticky_count+$sticky_count_change";
}
 
$sql = "update {$PHORUM['forums_table']} set thread_count=$thread_count, message_count=$message_count, sticky_count=$sticky_count, last_post_time=$last_post_time where forum_id={$PHORUM['forum_id']}";
mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
}
 
/**
* actually moves a thread to the given forum
*/
function phorum_db_move_thread($thread_id, $toforum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
settype($toforum, "int");
 
if($toforum > 0 && $thread_id > 0){
$conn = phorum_db_mysql_connect();
// retrieving the messages for the newflags and search updates below
$thread_messages=phorum_db_get_messages($thread_id);
 
// just changing the forum-id, simple isn't it?
$sql = "UPDATE {$PHORUM['message_table']} SET forum_id=$toforum where thread=$thread_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// we need to update the number of posts in the current forum
phorum_db_update_forum_stats(true);
 
// and of the new forum
$old_id=$GLOBALS["PHORUM"]["forum_id"];
$GLOBALS["PHORUM"]["forum_id"]=$toforum;
phorum_db_update_forum_stats(true);
$GLOBALS["PHORUM"]["forum_id"]=$old_id;
 
// move the new-flags and the search records for this thread
// to the new forum too
unset($thread_messages['users']);
 
$new_newflags=phorum_db_newflag_get_flags($toforum);
$message_ids = array();
$delete_ids = array();
$search_ids = array();
foreach($thread_messages as $mid => $data) {
// gather information for updating the newflags
if($mid > $new_newflags['min_id']) { // only using it if its higher than min_id
$message_ids[]=$mid;
} else { // newflags to delete
$delete_ids[]=$mid;
}
 
// gather the information for updating the search table
$search_ids[] = $mid;
}
 
if(count($message_ids)) { // we only go in if there are messages ... otherwise an error occured
 
$ids_str=implode(",",$message_ids);
 
// then doing the update to newflags
$sql="UPDATE IGNORE {$PHORUM['user_newflags_table']} SET forum_id = $toforum where message_id IN($ids_str)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// then doing the update to subscriptions
$sql="UPDATE {$PHORUM['subscribers_table']} SET forum_id = $toforum where thread IN($ids_str)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
}
 
if(count($delete_ids)) {
$ids_str=implode(",",$delete_ids);
// then doing the delete
$sql="DELETE FROM {$PHORUM['user_newflags_table']} where message_id IN($ids_str)";
mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
if (count($search_ids)) {
$ids_str = implode(",",$search_ids);
// then doing the search table update
$sql = "UPDATE {$PHORUM['search_table']} set forum_id = $toforum where message_id in ($ids_str)";
mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
}
}
 
/**
* closes the given thread
*/
function phorum_db_close_thread($thread_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
 
if($thread_id > 0){
$conn = phorum_db_mysql_connect();
 
$sql = "UPDATE {$PHORUM['message_table']} SET closed=1 where thread=$thread_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
}
 
/**
* (re)opens the given thread
*/
function phorum_db_reopen_thread($thread_id){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($thread_id, "int");
 
if($thread_id > 0){
$conn = phorum_db_mysql_connect();
 
$sql = "UPDATE {$PHORUM['message_table']} SET closed=0 where thread=$thread_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
}
 
/**
* This function executes a query to insert a forum into the forums
* table and returns the forums id on success or 0 on failure.
*/
 
function phorum_db_add_forum($forum)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
foreach($forum as $key => $value){
if (is_numeric($value)){
$value = (int)$value;
$fields[] = "$key=$value";
} elseif($value=="NULL") {
$fields[] = "$key=$value";
}else{
$value = mysql_escape_string($value);
$fields[] = "$key='$value'";
}
}
 
$sql = "insert into {$PHORUM['forums_table']} set " . implode(", ", $fields);
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$forum_id = 0;
 
if ($res){
$forum_id = mysql_insert_id($conn);
}
 
return $forum_id;
}
 
/**
* This function executes a query to remove a forum from the forums
* table and its messages.
*/
 
function phorum_db_drop_forum($forum_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$conn = phorum_db_mysql_connect();
 
$tables = array (
$PHORUM['message_table'],
$PHORUM['user_permissions_table'],
$PHORUM['user_newflags_table'],
$PHORUM['subscribers_table'],
$PHORUM['forum_group_xref_table'],
$PHORUM['forums_table'],
$PHORUM['banlist_table'],
$PHORUM['search_table']
);
 
foreach($tables as $table){
$sql = "delete from $table where forum_id=$forum_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
$sql = "select file_id from {$PHORUM['files_table']} left join {$PHORUM['message_table']} using (message_id) where {$PHORUM['files_table']}.message_id > 0 AND link='" . PHORUM_LINK_MESSAGE . "' AND {$PHORUM['message_table']}.message_id is NULL";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
while($rec=mysql_fetch_assoc($res)){
$files[]=$rec["file_id"];
}
if(isset($files)){
$sql = "delete from {$PHORUM['files_table']} where file_id in (".implode(",", $files).")";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
 
}
 
/**
* This function executes a query to remove a folder from the forums
* table and change the parent of its children.
*/
 
function phorum_db_drop_folder($forum_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$conn = phorum_db_mysql_connect();
 
$sql = "select parent_id from {$PHORUM['forums_table']} where forum_id=$forum_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$new_parent_id = mysql_result($res, 0, "parent_id");
 
$sql = "update {$PHORUM['forums_table']} set parent_id=$new_parent_id where parent_id=$forum_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$sql = "delete from {$PHORUM['forums_table']} where forum_id=$forum_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
/**
* This function executes a query to update a forum in the forums
* table and returns non zero on success or 0 on failure.
*/
 
function phorum_db_update_forum($forum){
$PHORUM = $GLOBALS["PHORUM"];
 
$res = 0;
 
if (!empty($forum["forum_id"])){
 
// this way we can also update multiple forums at once
if(is_array($forum["forum_id"])) {
$forumwhere="forum_id IN (".implode(",",$forum["forum_id"]).")";
} else {
$forumwhere="forum_id=".$forum["forum_id"];
}
 
unset($forum["forum_id"]);
 
$conn = phorum_db_mysql_connect();
 
foreach($forum as $key => $value){
if (is_numeric($value)){
$value = (int)$value;
$fields[] = "$key=$value";
} elseif($value=="NULL") {
$fields[] = "$key=$value";
} else {
$value = mysql_escape_string($value);
$fields[] = "$key='$value'";
}
}
 
$sql = "update {$PHORUM['forums_table']} set " . implode(", ", $fields) . " where $forumwhere";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}else{
trigger_error("\$forum[forum_id] cannot be empty in phorum_update_forum()", E_USER_ERROR);
}
 
return $res;
}
 
/**
*
*/
 
function phorum_db_get_groups($group_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysql_connect();
 
settype($group_id, "integer");
 
$sql="select * from {$PHORUM['groups_table']}";
if($group_id!=0) $sql.=" where group_id=$group_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$groups=array();
while($rec=mysql_fetch_assoc($res)){
 
$groups[$rec["group_id"]]=$rec;
$groups[$rec["group_id"]]["permissions"]=array();
}
 
$sql="select * from {$PHORUM['forum_group_xref_table']}";
if($group_id!=0) $sql.=" where group_id=$group_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while($rec=mysql_fetch_assoc($res)){
 
$groups[$rec["group_id"]]["permissions"][$rec["forum_id"]]=$rec["permission"];
 
}
 
return $groups;
 
}
 
/**
* Get the members of a group.
* @param group_id - can be an integer (single group), or an array of groups
* @param status - a specific status to look for, defaults to all
* @return array - users (key is userid, value is group membership status)
*/
 
function phorum_db_get_group_members($group_id, $status = PHORUM_USER_GROUP_REMOVE)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysql_connect();
 
if(is_array($group_id)){
$group_id=implode(",", $group_id);
} else {
settype($group_id, "int");
}
 
// this join is only here so that the list of users comes out sorted
// if phorum_db_user_get() sorts results itself, this join can go away
$sql="select {$PHORUM['user_group_xref_table']}.user_id, {$PHORUM['user_group_xref_table']}.status from {$PHORUM['user_table']}, {$PHORUM['user_group_xref_table']} where {$PHORUM['user_table']}.user_id = {$PHORUM['user_group_xref_table']}.user_id and group_id in ($group_id)";
if ($status != PHORUM_USER_GROUP_REMOVE) $sql.=" and {$PHORUM['user_group_xref_table']}.status = $status";
$sql .=" order by username asc";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$users=array();
while($rec=mysql_fetch_assoc($res)){
$users[$rec["user_id"]]=$rec["status"];
}
 
return $users;
 
}
 
/**
*
*/
 
function phorum_db_save_group($group)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysql_connect();
 
$ret=false;
 
if(isset($group["name"])){
$sql="update {$PHORUM['groups_table']} set name='{$group['name']}', open={$group['open']} where group_id={$group['group_id']}";
 
$res=mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
}
 
if(!$err){
 
if(isset($group["permissions"])){
$sql="delete from {$PHORUM['forum_group_xref_table']} where group_id={$group['group_id']}";
 
$res=mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
foreach($group["permissions"] as $forum_id=>$permission){
$sql="insert into {$PHORUM['forum_group_xref_table']} set group_id={$group['group_id']}, permission=$permission, forum_id=$forum_id";
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
if(!$res) break;
}
}
}
 
if($res>0) $ret=true;
 
return $ret;
 
}
 
function phorum_db_delete_group($group_id)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysql_connect();
 
settype($group_id, "int");
 
$sql = "delete from {$PHORUM['groups_table']} where group_id = $group_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// delete things associated with groups
$sql = "delete from {$PHORUM['user_group_xref_table']} where group_id = $group_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$sql = "delete from {$PHORUM['forum_group_xref_table']} where group_id = $group_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
/**
* phorum_db_add_group()
*
* @param $group_name $group_id
* @return
**/
function phorum_db_add_group($group_name,$group_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
$conn = phorum_db_mysql_connect();
 
settype($group_id, "int");
 
if($group_id > 0) { // only used in conversion
$sql="insert into {$PHORUM['groups_table']} (group_id,name) values ($group_id,'$group_name')";
} else {
$sql="insert into {$PHORUM['groups_table']} (name) values ('$group_name')";
}
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$group_id = 0;
 
if ($res) {
$group_id = mysql_insert_id($conn);
}
 
return $group_id;
}
 
/**
* This function returns all moderators for a particular forum
*/
function phorum_db_user_get_moderators($forum_id,$ignore_user_perms=false,$for_email=false) {
 
$PHORUM = $GLOBALS["PHORUM"];
$userinfo=array();
 
$conn = phorum_db_mysql_connect();
 
settype($forum_id, "int");
 
if(!$ignore_user_perms) { // sometimes we just don't need them
if(!$PHORUM['email_ignore_admin']) {
$admincheck=" OR user.admin=1";
} else {
$admincheck="";
}
 
 
$sql="SELECT DISTINCT user.user_id, user.email, user.moderation_email FROM {$PHORUM['user_table']} as user LEFT JOIN {$PHORUM['user_permissions_table']} as perm ON perm.user_id=user.user_id WHERE (perm.permission >= ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." AND (perm.permission & ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." > 0) AND perm.forum_id=$forum_id)$admincheck";
 
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_row($res)){
if(!$for_email || $row[2] == 1)
$userinfo[$row[0]]=$row[1];
}
 
}
 
// get users who belong to groups that have moderator access
$sql = "SELECT DISTINCT user.user_id, user.email, user.moderation_email FROM {$PHORUM['user_table']} AS user, {$PHORUM['groups_table']} AS groups, {$PHORUM['user_group_xref_table']} AS usergroup, {$PHORUM['forum_group_xref_table']} AS forumgroup WHERE user.user_id = usergroup.user_id AND usergroup.group_id = groups.group_id AND groups.group_id = forumgroup.group_id AND forum_id = $forum_id AND permission & ".PHORUM_USER_ALLOW_MODERATE_MESSAGES." > 0 AND usergroup.status >= ".PHORUM_USER_GROUP_APPROVED;
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_row($res)){
if(!$for_email || $row[2] == 1)
$userinfo[$row[0]]=$row[1];
}
return $userinfo;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
*/
 
function phorum_db_user_get($user_id, $detailed)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if(is_array($user_id)){
$user_ids=implode(",", $user_id);
} else {
$user_ids=(int)$user_id;
}
 
$users = array();
 
$sql = "select * from {$PHORUM['user_table']} where user_id in ($user_ids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res)){
while($rec=mysql_fetch_assoc($res)){
$users[$rec["user_id"]] = $rec;
}
 
if ($detailed){
// get the users' permissions
$sql = "select * from {$PHORUM['user_permissions_table']} where user_id in ($user_ids)";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_assoc($res)){
$users[$row["user_id"]]["forum_permissions"][$row["forum_id"]] = $row["permission"];
}
 
// get the users' groups and forum permissions through those groups
$sql = "select user_id, {$PHORUM['user_group_xref_table']}.group_id, forum_id, permission from {$PHORUM['user_group_xref_table']} left join {$PHORUM['forum_group_xref_table']} using (group_id) where user_id in ($user_ids) AND {$PHORUM['user_group_xref_table']}.status >= ".PHORUM_USER_GROUP_APPROVED;
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_assoc($res)){
$users[$row["user_id"]]["groups"][$row["group_id"]] = $row["group_id"];
if(!empty($row["forum_id"])){
if(!isset($users[$row["user_id"]]["group_permissions"][$row["forum_id"]])) {
$users[$row["user_id"]]["group_permissions"][$row["forum_id"]] = 0;
}
$users[$row["user_id"]]["group_permissions"][$row["forum_id"]] = $users[$row["user_id"]]["group_permissions"][$row["forum_id"]] | $row["permission"];
}
}
 
}
$sql = "select * from {$PHORUM['user_custom_fields_table']} where user_id in ($user_ids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_assoc($res)){
if(isset($PHORUM["PROFILE_FIELDS"][$row['type']])) {
if($PHORUM["PROFILE_FIELDS"][$row['type']]['html_disabled']) {
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = htmlspecialchars($row["data"]);
} else { // not html-disabled
if(substr($row["data"],0,6) == 'P_SER:') {
// P_SER (PHORUM_SERIALIZED) is our marker telling this field is serialized
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = unserialize(substr($row["data"],6));
} else {
$users[$row["user_id"]][$PHORUM["PROFILE_FIELDS"][$row['type']]['name']] = $row["data"];
}
}
}
}
 
}
 
if(is_array($user_id)){
return $users;
} else {
return isset($users[$user_id]) ? $users[$user_id] : NULL;
}
 
}
 
/*
* Generic function to retrieve a couple of fields from the user-table
* for a couple of users or only one of them
*
* result is always an array with one or more users in it
*/
 
function phorum_db_user_get_fields($user_id, $fields)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
// input could be either array or string
if(is_array($user_id)){
$user_ids=implode(",", $user_id);
} else {
$user_ids=(int)$user_id;
}
 
 
if(is_array($fields)) {
$fields_str=implode(",",$fields);
} else {
$fields_str=$fields;
}
 
$users = array();
 
 
 
$sql = "select user_id,$fields_str from {$PHORUM['user_table']} where user_id in ($user_ids)";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res)){
while($rec=mysql_fetch_assoc($res)){
$users[$rec["user_id"]] = $rec;
}
}
 
return $users;
 
}
 
/**
* This function gets a list of all the active users.
* @return array - (key: userid, value: array (username, displayname)
*/
function phorum_db_user_get_list(){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$users = array();
$sql = "select user_id, username from {$PHORUM['user_table']} order by username asc";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while ($row = mysql_fetch_assoc($res)){
$users[$row["user_id"]] = array("username" => $row["username"], "displayname" => $row["username"]);
}
 
return $users;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
*/
 
function phorum_db_user_check_pass($username, $password, $temp_password=false){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$username = mysql_escape_string($username);
 
$password = mysql_escape_string($password);
 
$pass_field = ($temp_password) ? "password_temp" : "password";
 
$sql = "select user_id from {$PHORUM['user_table']} where username='$username' and $pass_field='$password'";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return ($res && mysql_num_rows($res)) ? mysql_result($res, 0, "user_id") : 0;
}
 
/**
* This function executes a query to check for the given field in the
* user tableusername and return the user_id of the user it matches or 0
* if no match is found.
*
* The parameters can be arrays. If they are, all must be passed and all
* must have the same number of values.
*
* If $return_array is true, an array of all matching rows will be returned.
* Otherwise, only the first user_id from the results will be returned.
*/
 
function phorum_db_user_check_field($field, $value, $operator="=", $return_array=false){
$PHORUM = $GLOBALS["PHORUM"];
 
$ret = 0;
 
$conn = phorum_db_mysql_connect();
 
if(!is_array($field)){
$field=array($field);
}
 
if(!is_array($value)){
$value=array($value);
}
 
if(!is_array($operator)){
$operator=array($operator);
}
 
foreach($field as $key=>$name){
$value[$key] = mysql_escape_string($value[$key]);
$clauses[]="$name $operator[$key] '$value[$key]'";
}
 
$sql = "select user_id from {$PHORUM['user_table']} where ".implode(" and ", $clauses);
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if ($res && mysql_num_rows($res)){
if($return_array){
$ret=array();
while($row=mysql_fetch_assoc($res)){
$ret[$row["user_id"]]=$row["user_id"];
}
} else {
$ret = mysql_result($res, 0, "user_id");
}
}
 
return $ret;
}
 
 
/**
* This function executes a query to add the given user data to the
* database and returns the userid or 0
*/
 
function phorum_db_user_add($userdata){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if (isset($userdata["forum_permissions"]) && !empty($userdata["forum_permissions"])){
$forum_perms = $userdata["forum_permissions"];
unset($userdata["forum_permissions"]);
}
 
if (isset($userdata["user_data"]) && !empty($userdata["user_data"])){
$user_data = $userdata["user_data"];
unset($userdata["user_data"]);
}
 
 
$sql = "insert into {$PHORUM['user_table']} set ";
 
$values = array();
 
foreach($userdata as $key => $value){
if (!is_numeric($value)){
$value = mysql_escape_string($value);
$values[] = "$key='$value'";
}else{
$values[] = "$key=$value";
}
}
 
$sql .= implode(", ", $values);
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$user_id = 0;
if ($res){
$user_id = mysql_insert_id($conn);
}
 
if ($res){
if(isset($forum_perms)) {
// storing forum-permissions
foreach($forum_perms as $fid => $p){
$sql = "insert into {$PHORUM['user_permissions_table']} set user_id=$user_id, forum_id=$fid, permission=$p";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
break;
}
}
}
if(isset($user_data)) {
/* storing custom-fields */
foreach($user_data as $key => $val){
if(is_array($val)) { /* arrays need to be serialized */
$val = 'P_SER:'.serialize($val);
/* P_SER: (PHORUM_SERIALIZED is our marker telling this Field is serialized */
} else { /* other vars need to be escaped */
$val = mysql_escape_string($val);
}
$sql = "insert into {$PHORUM['user_custom_fields_table']} (user_id,type,data) VALUES($user_id,$key,'$val')";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
break;
}
}
}
}
 
return $user_id;
}
 
 
/**
* This function executes a query to update the given user data in the
* database and returns the true or false
*/
function phorum_db_user_save($userdata){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if(isset($userdata["permissions"])){
unset($userdata["permissions"]);
}
 
if (isset($userdata["forum_permissions"])){
$forum_perms = $userdata["forum_permissions"];
unset($userdata["forum_permissions"]);
}
 
if (isset($userdata["groups"])){
$groups = $userdata["groups"];
unset($userdata["groups"]);
unset($userdata["group_permissions"]);
}
if (isset($userdata["user_data"])){
$user_data = $userdata["user_data"];
unset($userdata["user_data"]);
}
 
$user_id = $userdata["user_id"];
unset($userdata["user_id"]);
 
if(count($userdata)){
 
$sql = "update {$PHORUM['user_table']} set ";
 
$values = array();
 
foreach($userdata as $key => $value){
$values[] = "$key='".mysql_escape_string($value)."'";
}
 
$sql .= implode(", ", $values);
 
$sql .= " where user_id=$user_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
if (isset($forum_perms)){
 
$sql = "delete from {$PHORUM['user_permissions_table']} where user_id = $user_id";
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
foreach($forum_perms as $fid=>$perms){
$sql = "insert into {$PHORUM['user_permissions_table']} set user_id=$user_id, forum_id=$fid, permission=$perms";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
}
}
if(isset($user_data)) {
// storing custom-fields
$sql = "delete from {$PHORUM['user_custom_fields_table']} where user_id = $user_id";
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if(is_array($user_data)) {
foreach($user_data as $key => $val){
if(is_array($val)) { /* arrays need to be serialized */
$val = 'P_SER:'.serialize($val);
/* P_SER: (PHORUM_SERIALIZED is our marker telling this Field is serialized */
} else { /* other vars need to be escaped */
$val = mysql_escape_string($val);
}
 
$sql = "insert into {$PHORUM['user_custom_fields_table']} (user_id,type,data) VALUES($user_id,$key,'$val')";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
break;
}
}
}
}
 
return (bool)$res;
}
 
/**
* This function saves a users group permissions.
*/
function phorum_db_user_save_groups($user_id, $groups)
{
$PHORUM = $GLOBALS["PHORUM"];
if (!$user_id > 0){
return false;
}
 
settype($user_id, "int");
 
// erase the group memberships they have now
$conn = phorum_db_mysql_connect();
$sql = "delete from {$PHORUM['user_group_xref_table']} where user_id = $user_id";
$res=mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
foreach($groups as $group_id => $group_perm){
$sql = "insert into {$PHORUM['user_group_xref_table']} set user_id=$user_id, group_id=$group_id, status=$group_perm";
mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
break;
}
}
return (bool)$res;
}
 
/**
* This function executes a query to subscribe a user to a forum/thread.
*/
 
function phorum_db_user_subscribe($user_id, $forum_id, $thread, $type)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($user_id, "int");
settype($forum_id, "int");
settype($thread, "int");
settype($type, "int");
 
$conn = phorum_db_mysql_connect();
 
$sql = "replace into {$PHORUM['subscribers_table']} set user_id=$user_id, forum_id=$forum_id, sub_type=$type, thread=$thread";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function increases the post-counter for a user by one
*/
function phorum_db_user_addpost() {
 
$conn = phorum_db_mysql_connect();
 
$sql="UPDATE ".$GLOBALS['PHORUM']['user_table']." SET posts=posts+1 WHERE user_id = ".$GLOBALS['PHORUM']['user']['user_id'];
$res=mysql_query($sql,$conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function executes a query to unsubscribe a user to a forum/thread.
*/
 
function phorum_db_user_unsubscribe($user_id, $thread, $forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($user_id, "int");
settype($forum_id, "int");
settype($thread, "int");
 
$conn = phorum_db_mysql_connect();
 
$sql = "DELETE FROM {$PHORUM['subscribers_table']} WHERE user_id=$user_id AND thread=$thread";
if($forum_id) $sql.=" and forum_id=$forum_id";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return (bool)$res;
}
 
/**
* This function will return a list of groups the user
* is a member of, as well as the users permissions.
*/
function phorum_db_user_get_groups($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
$groups = array();
 
if (!$user_id > 0){
return $groups;
}
 
settype($user_id, "int");
 
$conn = phorum_db_mysql_connect();
$sql = "SELECT group_id, status FROM {$PHORUM['user_group_xref_table']} WHERE user_id = $user_id ORDER BY status DESC";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while($row = mysql_fetch_assoc($res)){
$groups[$row["group_id"]] = $row["status"];
}
 
return $groups;
}
 
/**
* This function executes a query to select data about a user including
* his permission data and returns that in an array.
* If $search is empty, all users should be returned.
*/
 
function phorum_db_search_users($search)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$users = array();
 
$search = trim($search);
 
$sql = "select user_id, username, email, active, posts, date_last_active from {$PHORUM['user_table']} where username like '%$search%' or email like '%$search%'order by username";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res)){
while ($user = mysql_fetch_assoc($res)){
$users[$user["user_id"]] = $user;
}
}
 
return $users;
}
 
 
/**
* This function gets the users that await approval
*/
 
function phorum_db_user_get_unapproved()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$sql="select user_id, username, email from {$PHORUM['user_table']} where active in(".PHORUM_USER_PENDING_BOTH.", ".PHORUM_USER_PENDING_MOD.") order by username";
$res=mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
$users=array();
if($res){
while($rec=mysql_fetch_assoc($res)){
$users[$rec["user_id"]]=$rec;
}
}
 
return $users;
 
}
/**
* This function deletes a user completely
* - entry in the users-table
* - entries in the permissions-table
* - entries in the newflags-table
* - entries in the subscribers-table
* - entries in the group_xref-table
* - entries in the private-messages-table
* - entries in the files-table
* - sets entries in the messages-table to anonymous
*
*/
function phorum_db_user_delete($user_id) {
$PHORUM = $GLOBALS["PHORUM"];
 
// how would we check success???
$ret = true;
 
settype($user_id, "int");
 
$conn = phorum_db_mysql_connect();
// user-table
$sql = "delete from {$PHORUM['user_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// permissions-table
$sql = "delete from {$PHORUM['user_permissions_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// newflags-table
$sql = "delete from {$PHORUM['user_newflags_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// subscribers-table
$sql = "delete from {$PHORUM['subscribers_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// group-xref-table
$sql = "delete from {$PHORUM['user_group_xref_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// private messages
$sql = "select * from {$PHORUM["pm_xref_table"]} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
while ($row = mysql_fetch_assoc($res)) {
$folder = $row["pm_folder_id"] == 0 ? $row["special_folder"] : $row["pm_folder_id"];
phorum_db_pm_delete($row["pm_message_id"], $folder, $user_id);
}
 
// pm_buddies
$sql = "delete from {$PHORUM["pm_buddies_table"]} where user_id=$user_id or buddy_user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// private message folders
$sql = "delete from {$PHORUM["pm_folders_table"]} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// files-table
$sql = "delete from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// custom-fields-table
$sql = "delete from {$PHORUM['user_custom_fields_table']} where user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// messages-table
if(PHORUM_DELETE_CHANGE_AUTHOR) {
$sql = "update {$PHORUM['message_table']} set user_id=0,email='',author='".mysql_escape_string($PHORUM['DATA']['LANG']['AnonymousUser'])."' where user_id=$user_id";
} else {
$sql = "update {$PHORUM['message_table']} set user_id=0,email='' where user_id=$user_id";
}
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return $ret;
}
 
 
/**
* This function gets the users file list
*/
 
function phorum_db_get_user_file_list($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($user_id, "int");
 
$files=array();
 
$sql="select file_id, filename, filesize, add_datetime from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
if($res){
while($rec=mysql_fetch_assoc($res)){
$files[$rec["file_id"]]=$rec;
}
}
 
return $files;
}
 
 
/**
* This function gets the message's file list
*/
 
function phorum_db_get_message_file_list($message_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$files=array();
 
$sql="select file_id, filename, filesize, add_datetime from {$PHORUM['files_table']} where message_id=$message_id and link='" . PHORUM_LINK_MESSAGE . "'";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
if($res){
while($rec=mysql_fetch_assoc($res)){
$files[$rec["file_id"]]=$rec;
}
}
 
return $files;
}
 
 
/**
* This function retrieves a file from the db
*/
 
function phorum_db_file_get($file_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($file_id, "int");
 
$file=array();
 
$sql="select * from {$PHORUM['files_table']} where file_id=$file_id";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
if($res){
$file=mysql_fetch_assoc($res);
}
 
return $file;
}
 
 
/**
* This function saves a file to the db
*/
 
function phorum_db_file_save($user_id, $filename, $filesize, $buffer, $message_id=0, $link=null)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if (is_null($link)) {
$link = $message_id ? PHORUM_LINK_MESSAGE : PHORUM_LINK_USER;
} else {
$link = addslashes($link);
}
 
$conn = phorum_db_mysql_connect();
 
$file_id=0;
 
settype($user_id, "int");
settype($message_id, "int");
settype($filesize, "int");
 
$filename=addslashes($filename);
 
$sql="insert into {$PHORUM['files_table']} set user_id=$user_id, message_id=$message_id, link='$link', filename='$filename', filesize=$filesize, file_data='$buffer', add_datetime=".time();
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
if($res){
$file_id=mysql_insert_id($conn);
}
 
return $file_id;
}
 
 
/**
* This function saves a file to the db
*/
 
function phorum_db_file_delete($file_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($file_id, "int");
 
$sql="delete from {$PHORUM['files_table']} where file_id=$file_id";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
return $res;
}
 
/**
* This function links a file to a specific message
*/
 
function phorum_db_file_link($file_id, $message_id, $link = null)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if (is_null($link)) {
$link = $message_id ? PHORUM_LINK_MESSAGE : PHORUM_LINK_USER;
} else {
$link = addslashes($link);
}
 
$conn = phorum_db_mysql_connect();
 
settype($file_id, "int");
settype($message_id, "int");
 
$sql="update {$PHORUM['files_table']} " .
"set message_id=$message_id, link='$link' " .
"where file_id=$file_id";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
return $res;
}
 
/**
* This function reads the current total size of all files for a user
*/
 
function phorum_db_get_user_filesize_total($user_id)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($user_id, "int");
 
$total=0;
 
$sql="select sum(filesize) as total from {$PHORUM['files_table']} where user_id=$user_id and message_id=0 and link='" . PHORUM_LINK_USER . "'";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}
 
if($res){
$total=mysql_result($res, 0,"total");
}
 
return $total;
 
}
 
/**
* This function is used for cleaning up stale files from the
* database. Stale files are files that are not linked to
* anything. These can for example be caused by users that
* are writing a message with attachments, but never post
* it.
* @param live_run - If set to false (default), the function
* will return a list of files that will
* be purged. If set to true, files will
* be purged.
*/
function phorum_db_file_purge_stale_files($live_run = false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$where = "link='" . PHORUM_LINK_EDITOR. "' " .
"and add_datetime<". (time()-PHORUM_MAX_EDIT_TIME);
 
// Purge files.
if ($live_run) {
 
// Delete files that are linked to the editor and are
// added a while ago. These are from abandoned posts.
$sql = "delete from {$PHORUM['files_table']} " .
"where $where";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return true;
 
// Only select a list of files that can be purged.
} else {
 
// Select files that are linked to the editor and are
// added a while ago. These are from abandoned posts.
$sql = "select file_id, filename, filesize, add_datetime " .
"from {$PHORUM['files_table']} " .
"where $where";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$purge_files = array();
if (mysql_num_rows($res) > 0) {
while ($row = mysql_fetch_assoc($res)) {
$row["reason"] = "Stale editor file";
$purge_files[$row["file_id"]] = $row;
}
}
 
return $purge_files;
}
}
 
/**
* This function returns the newinfo-array for markallread
*/
 
function phorum_db_newflag_allread($forum_id=0)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysql_connect();
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
// delete all newflags for this user and forum
phorum_db_newflag_delete(0,$forum_id);
 
// get the maximum message-id in this forum
$sql = "select max(message_id) from {$PHORUM['message_table']} where forum_id=$forum_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
phorum_db_mysql_error("$err: $sql");
}elseif (mysql_num_rows($res) > 0){
$row = mysql_fetch_row($res);
if($row[0] > 0) {
// set this message as min-id
phorum_db_newflag_add_read(array(0=>array('id'=>$row[0],'forum'=>$forum_id)));
}
}
 
}
 
 
/**
* This function returns the read messages for the current user and forum
* optionally for a given forum (for the index)
*/
function phorum_db_newflag_get_flags($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
$read_msgs=array('min_id'=>0);
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
$sql="SELECT message_id,forum_id FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id IN({$forum_id},{$PHORUM['vroot']})";
 
$conn = phorum_db_mysql_connect();
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
while($row=mysql_fetch_row($res)) {
// set the min-id if given flag is set
if($row[1] != $PHORUM['vroot'] && ($read_msgs['min_id']==0 || $row[0] < $read_msgs['min_id'])) {
$read_msgs['min_id']=$row[0];
} else {
$read_msgs[$row[0]]=$row[0];
}
}
 
return $read_msgs;
}
 
 
/**
* This function returns the count of unread messages the current user and forum
* optionally for a given forum (for the index)
*/
function phorum_db_newflag_get_unread_count($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
// get the read message array
$read_msgs = phorum_db_newflag_get_flags($forum_id);
 
if($read_msgs["min_id"]==0) return array(0,0);
 
$sql="SELECT count(*) as count FROM ".$PHORUM['message_table']." WHERE message_id NOT in (".implode(",", $read_msgs).") and message_id > {$read_msgs['min_id']} and forum_id in ({$forum_id},0) and status=".PHORUM_STATUS_APPROVED." and not ".PHORUM_SQL_MOVEDMESSAGES;
 
$conn = phorum_db_mysql_connect();
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$counts[] = mysql_result($res, 0, "count");
 
$sql="SELECT count(*) as count FROM ".$PHORUM['message_table']." WHERE message_id NOT in (".implode(",", $read_msgs).") and message_id > {$read_msgs['min_id']} and forum_id in ({$forum_id},0) and parent_id=0 and status=".PHORUM_STATUS_APPROVED." and not ".PHORUM_SQL_MOVEDMESSAGES;
 
$conn = phorum_db_mysql_connect();
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$counts[] = mysql_result($res, 0, "count");
 
return $counts;
}
 
 
/**
* This function marks a message as read
*/
function phorum_db_newflag_add_read($message_ids) {
$PHORUM = $GLOBALS["PHORUM"];
 
$num_newflags=phorum_db_newflag_get_count();
 
// maybe got just one message
if(!is_array($message_ids)) {
$message_ids=array(0=>(int)$message_ids);
}
// deleting messages which are too much
$num_end=$num_newflags+count($message_ids);
if($num_end > PHORUM_MAX_NEW_INFO) {
phorum_db_newflag_delete($num_end - PHORUM_MAX_NEW_INFO);
}
// building the query
$values=array();
$cnt=0;
 
foreach($message_ids as $id=>$data) {
if(is_array($data)) {
$values[]="({$PHORUM['user']['user_id']},{$data['forum']},{$data['id']})";
} else {
$values[]="({$PHORUM['user']['user_id']},{$PHORUM['forum_id']},$data)";
}
$cnt++;
}
if($cnt) {
$insert_sql="INSERT IGNORE INTO ".$PHORUM['user_newflags_table']." (user_id,forum_id,message_id) VALUES".join(",",$values);
 
// fire away
$conn = phorum_db_mysql_connect();
$res = mysql_query($insert_sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $insert_sql");
}
}
 
/**
* This function returns the number of newflags for this user and forum
*/
function phorum_db_newflag_get_count($forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
$sql="SELECT count(*) FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id={$forum_id}";
 
// fire away
$conn = phorum_db_mysql_connect();
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$row=mysql_fetch_row($res);
 
return $row[0];
}
 
/**
* This function removes a number of newflags for this user and forum
*/
function phorum_db_newflag_delete($numdelete=0,$forum_id=0)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($numdelete, "int");
 
if(empty($forum_id)) $forum_id=$PHORUM["forum_id"];
 
if($numdelete>0) {
$lvar=" ORDER BY message_id ASC LIMIT $numdelete";
} else {
$lvar="";
}
// delete the number of newflags given
$del_sql="DELETE FROM ".$PHORUM['user_newflags_table']." WHERE user_id={$PHORUM['user']['user_id']} AND forum_id={$forum_id}".$lvar;
// fire away
$conn = phorum_db_mysql_connect();
$res = mysql_query($del_sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $del_sql");
}
 
/**
* This function executes a query to get the user ids of the users
* subscribed to a forum/thread.
*/
 
function phorum_db_get_subscribed_users($forum_id, $thread, $type){
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($thread, "int");
settype($type, "int");
 
$conn = phorum_db_mysql_connect();
 
$userignore="";
if ($PHORUM["DATA"]["LOGGEDIN"])
$userignore="and b.user_id != {$PHORUM['user']['user_id']}";
 
$sql = "select DISTINCT(b.email),user_language from {$PHORUM['subscribers_table']} as a,{$PHORUM['user_table']} as b where a.forum_id=$forum_id and (a.thread=$thread or a.thread=0) and a.sub_type=$type and b.user_id=a.user_id $userignore";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$arr=array();
 
while ($rec = mysql_fetch_row($res)){
if(!empty($rec[1])) // user-language is set
$arr[$rec[1]][] = $rec[0];
else // no user-language is set
$arr[$PHORUM['language']][]= $rec[0];
}
 
return $arr;
}
 
/**
* This function executes a query to get the subscriptions of a user-id,
* together with the forum-id and subjects of the threads
*/
 
function phorum_db_get_message_subscriptions($user_id,$days=2){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$userignore="";
if ($PHORUM["DATA"]["LOGGEDIN"])
$userignore="and b.user_id != {$PHORUM['user']['user_id']}";
 
if($days > 0) {
$timestr=" AND (".time()." - b.modifystamp) <= ($days * 86400)";
} else {
$timestr="";
}
 
$sql = "select a.thread, a.forum_id, a.sub_type, b.subject,b.modifystamp,b.author,b.user_id,b.email from {$PHORUM['subscribers_table']} as a,{$PHORUM['message_table']} as b where a.user_id=$user_id and b.message_id=a.thread and (a.sub_type=".PHORUM_SUBSCRIPTION_MESSAGE." or a.sub_type=".PHORUM_SUBSCRIPTION_BOOKMARK.")"."$timestr ORDER BY b.modifystamp desc";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$arr=array();
$forum_ids=array();
 
while ($rec = mysql_fetch_assoc($res)){
$unsub_url=phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=".PHORUM_CC_SUBSCRIPTION_THREADS, "unsub_id=".$rec['thread'], "unsub_forum=".$rec['forum_id'], "unsub_type=".$rec['sub_type']);
$rec['unsubscribe_url']=$unsub_url;
$arr[] = $rec;
$forum_ids[]=$rec['forum_id'];
}
$arr['forum_ids']=$forum_ids;
 
return $arr;
}
 
/**
* This function executes a query to find out if a user is subscribed to a thread
*/
 
function phorum_db_get_if_subscribed($forum_id, $thread, $user_id, $type=PHORUM_SUBSCRIPTION_MESSAGE)
{
$PHORUM = $GLOBALS["PHORUM"];
 
settype($forum_id, "int");
settype($thread, "int");
settype($user_id, "int");
settype($type, "int");
 
$conn = phorum_db_mysql_connect();
 
$sql = "select user_id from {$PHORUM['subscribers_table']} where forum_id=$forum_id and thread=$thread and user_id=$user_id and sub_type=$type";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
$retval = true;
}else{
$retval = false;
}
 
return $retval;
}
 
 
/**
* This function retrieves the banlists for the current forum
*/
 
function phorum_db_get_banlists($ordered=false) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
$forumstr = "";
 
$conn = phorum_db_mysql_connect();
 
if(isset($PHORUM['forum_id']) && !empty($PHORUM['forum_id']))
$forumstr = "WHERE forum_id = {$PHORUM['forum_id']} OR forum_id = 0";
 
if(isset($PHORUM['vroot']) && !empty($PHORUM['vroot']))
$forumstr .= " OR forum_id = {$PHORUM['vroot']}";
 
 
 
$sql = "SELECT * FROM {$PHORUM['banlist_table']} $forumstr";
 
if($ordered) {
$sql.= " ORDER BY type, string";
}
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
while($row = mysql_fetch_assoc($res)) {
$retarr[$row['type']][$row['id']]=array('pcre'=>$row['pcre'],'string'=>$row['string'],'forum_id'=>$row['forum_id']);
}
}
return $retarr;
}
 
 
/**
* This function retrieves one item from the banlists
*/
 
function phorum_db_get_banitem($banid) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
 
$conn = phorum_db_mysql_connect();
 
settype($banid, "int");
 
$sql = "SELECT * FROM {$PHORUM['banlist_table']} WHERE id = $banid";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
while($row = mysql_fetch_assoc($res)) {
$retarr=array('pcre'=>$row['pcre'],'string'=>$row['string'],'forumid'=>$row['forum_id'],'type'=>$row['type']);
}
}
return $retarr;
}
 
 
/**
* This function deletes one item from the banlists
*/
 
function phorum_db_del_banitem($banid) {
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$sql = "DELETE FROM {$PHORUM['banlist_table']} WHERE id = $banid";
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if(mysql_affected_rows($conn) > 0) {
return true;
} else {
return false;
}
}
 
 
/**
* This function adds or modifies a banlist-entry
*/
 
function phorum_db_mod_banlists($type,$pcre,$string,$forum_id,$id=0) {
$PHORUM = $GLOBALS["PHORUM"];
 
$retarr = array();
 
$conn = phorum_db_mysql_connect();
 
settype($type, "int");
settype($pcre, "int");
settype($forum_id, "int");
settype($id, "int");
 
if($id > 0) { // modifying an entry
$sql = "UPDATE {$PHORUM['banlist_table']} SET forum_id = $forum_id, type = $type, pcre = $pcre, string = '".mysql_escape_string($string)."' where id = $id";
} else { // adding an entry
$sql = "INSERT INTO {$PHORUM['banlist_table']} (forum_id,type,pcre,string) VALUES($forum_id,$type,$pcre,'".mysql_escape_string($string)."')";
}
 
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if(mysql_affected_rows($conn) > 0) {
return true;
} else {
return false;
}
}
 
 
 
/**
* This function lists all private messages in a folder.
* @param folder - The folder to use. Either a special folder
* (PHORUM_PM_INBOX or PHORUM_PM_OUTBOX) or the
* id of a user's custom folder.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @param reverse - If set to a true value (default), sorting
* of messages is done in reverse (newest first).
*/
 
function phorum_db_pm_list($folder, $user_id = NULL, $reverse = true)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$folder_sql = "user_id = $user_id AND ";
if (is_numeric($folder)) {
$folder_sql .= "pm_folder_id=$folder";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql .= "pm_folder_id=0 AND special_folder='$folder'";
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "SELECT m.pm_message_id, from_user_id, from_username, subject, " .
"datestamp, meta, pm_xref_id, user_id, pm_folder_id, " .
"special_folder, read_flag, reply_flag " .
"FROM {$PHORUM['pm_messages_table']} as m, {$PHORUM['pm_xref_table']} as x " .
"WHERE $folder_sql " .
"AND x.pm_message_id = m.pm_message_id " .
"ORDER BY x.pm_message_id " . ($reverse ? "DESC" : "ASC");
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$list = array();
if (mysql_num_rows($res) > 0){
while($row = mysql_fetch_assoc($res)) {
 
// Add the recipient information unserialized to the message..
$meta = unserialize($row['meta']);
$row['recipients'] = $meta['recipients'];
 
$list[$row["pm_message_id"]]=$row;
}
}
 
return $list;
}
 
/**
* This function retrieves a private message from the database.
* @param pm_id - The id for the private message to retrieve.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @param folder_id - The folder to retrieve the message from or
* NULL if the folder does not matter.
*/
 
function phorum_db_pm_get($pm_id, $folder = NULL, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($pm_id, "int");
 
if (is_null($folder)) {
$folder_sql = '';
} elseif (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND ";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND ";
} else {
die ("Illegal folder '$folder' requested for message id '$pm_id'");
}
 
$sql = "SELECT * " .
"FROM {$PHORUM['pm_messages_table']} as m, {$PHORUM['pm_xref_table']} as x " .
"WHERE $folder_sql x.pm_message_id = $pm_id AND x.user_id = $user_id " .
"AND x.pm_message_id = m.pm_message_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
$row = mysql_fetch_assoc($res);
 
// Add the recipient information unserialized to the message..
$meta = unserialize($row['meta']);
$row['recipients'] = $meta['recipients'];
 
return $row;
} else {
return NULL;
}
}
 
/**
* This function creates a new folder for a user.
* @param foldername - The name of the folder to create.
* @param user_id - The user to create the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_create_folder($foldername, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$sql = "INSERT INTO {$PHORUM['pm_folders_table']} SET " .
"user_id=$user_id, " .
"foldername='".mysql_escape_string($foldername)."'";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
/**
* This function renames a folder for a user.
* @param folder_id - The id of the folder to rename.
* @param newname - The new name for the folder.
* @param user_id - The user to rename the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_rename_folder($folder_id, $newname, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($folder_id, "int");
 
$sql = "UPDATE {$PHORUM['pm_folders_table']} " .
"SET foldername = '".mysql_escape_string($newname)."' " .
"WHERE pm_folder_id = $folder_id AND user_id = $user_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
 
 
/**
* This function deletes a folder for a user. Along with the
* folder, all contained messages are deleted as well.
* @param folder_id - The id of the folder to delete.
* @param user_id - The user to delete the folder for or
* NULL to use the current user (default).
*/
function phorum_db_pm_delete_folder($folder_id, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
settype($folder_id, "int");
 
// Get messages in this folder and delete them.
$list = phorum_db_pm_list($folder_id, $user_id);
foreach ($list as $id => $data) {
phorum_db_pm_delete($id, $folder_id, $user_id);
}
 
// Delete the folder itself.
$sql = "DELETE FROM {$PHORUM['pm_folders_table']} " .
"WHERE pm_folder_id = $folder_id AND user_id = $user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
/**
* This function retrieves the list of folders for a user.
* @param user_id - The user to retrieve folders for or NULL
* to use the current user (default).
* @param count_messages - Count the number of messages for the
* folders. Default, this is not done.
*/
function phorum_db_pm_getfolders($user_id = NULL, $count_messages = false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
// Setup the list of folders. Our special folders are
// not in the database, so these are added here.
$folders = array(
PHORUM_PM_INBOX => array(
'id' => PHORUM_PM_INBOX,
'name' => $PHORUM["DATA"]["LANG"]["INBOX"],
),
);
 
// Select all custom folders for the user.
$sql = "SELECT * FROM {$PHORUM['pm_folders_table']} " .
"WHERE user_id = $user_id ORDER BY foldername";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// Add them to the folderlist.
if (mysql_num_rows($res) > 0){
while (($row = mysql_fetch_assoc($res))) {
$folders[$row["pm_folder_id"]] = array(
'id' => $row["pm_folder_id"],
'name' => $row["foldername"],
);
}
}
 
// Add the outgoing box.
$folders[PHORUM_PM_OUTBOX] = array(
'id' => PHORUM_PM_OUTBOX,
'name' => $PHORUM["DATA"]["LANG"]["SentItems"],
);
 
// Count messages if requested.
if ($count_messages)
{
// Initialize counters.
foreach ($folders as $id => $data) {
$folders[$id]["total"] = $folders[$id]["new"] = 0;
}
 
// Collect count information.
$sql = "SELECT pm_folder_id, special_folder, " .
"count(*) as total, (count(*) - sum(read_flag)) as new " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE user_id = $user_id " .
"GROUP BY pm_folder_id, special_folder";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// Add counters to the folderlist.
if (mysql_num_rows($res) > 0){
while (($row = mysql_fetch_assoc($res))) {
$folder_id = $row["pm_folder_id"] ? $row["pm_folder_id"] : $row["special_folder"];
// If there are stale messages, we do not want them
// to create non-existant mailboxes in the list.
if (isset($folders[$folder_id])) {
$folders[$folder_id]["total"] = $row["total"];
$folders[$folder_id]["new"] = $row["new"];
}
}
}
}
 
return $folders;
}
 
/**
* This function computes the number of private messages a user has
* and returns both the total and the number unread.
* @param folder - The folder to use. Either a special folder
* (PHORUM_PM_INBOX or PHORUM_PM_OUTBOX), the
* id of a user's custom folder or
* PHORUM_PM_ALLFOLDERS for all folders.
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
*/
 
function phorum_db_pm_messagecount($folder, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND";
} elseif ($folder == PHORUM_PM_ALLFOLDERS) {
$folder_sql = '';
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "SELECT count(*) as total, (count(*) - sum(read_flag)) as new " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE $folder_sql user_id = $user_id";
 
$messagecount=array("total" => 0, "new" => 0);
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
$row = mysql_fetch_assoc($res);
$messagecount["total"] = $row["total"];
$messagecount["new"] = ($row["new"] >= 1) ? $row["new"] : 0;
}
 
return $messagecount;
}
 
/**
* This function does a quick check if the user has new private messages.
* This is useful in case you only want to know whether the user has
* new messages or not and when you are not interested in the exact amount
* of new messages.
*
* @param user_id - The user to retrieve messages for or NULL
* to use the current user (default).
* @return A true value, in case there are new messages available.
*/
function phorum_db_pm_checknew($user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
$sql = "SELECT user_id " .
"FROM {$PHORUM['pm_xref_table']} " .
"WHERE user_id = $user_id AND read_flag = 0 LIMIT 1";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
return mysql_num_rows($res);
}
 
/**
* This function inserts a private message in the database. The return value
* is the pm_message_id of the created message.
* @param subject - The subject for the private message.
* @param message - The message text for the private message.
* @param to - A single user_id or an array of user_ids for the recipients.
* @param from - The user_id of the sender. The current user is used in case
* the parameter is set to NULL (default).
* @param keepcopy - If set to a true value, a copy of the mail will be put in
* the outbox of the user. Default value is false.
*/
function phorum_db_pm_send($subject, $message, $to, $from=NULL, $keepcopy=false)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
// Prepare the sender.
if ($from == NULL) $from = $PHORUM['user']['user_id'];
settype($from, "int");
$fromuser = phorum_db_user_get($from, false);
if (! $fromuser) die("Unknown sender user_id '$from'");
 
// This array will be filled with xref database entries.
$xref_entries = array();
 
// Prepare the list of recipients.
$rcpts = array();
if (! is_array($to)) $to = array($to);
foreach ($to as $user_id) {
settype($user_id, "int");
$user = phorum_db_user_get($user_id, false);
if (! $user) die("Unknown recipient user_id '$user_id'");
$rcpts[$user_id] = array(
'user_id' => $user_id,
'username' => $user["username"],
'read_flag' => 0,
);
$xref_entries[] = array(
'user_id' => $user_id,
'pm_folder_id' => 0,
'special_folder' => PHORUM_PM_INBOX,
'read_flag' => 0,
);
}
 
// Keep copy of this message in outbox?
if ($keepcopy) {
$xref_entries[] = array(
'user_id' => $from,
'pm_folder_id' => 0,
'special_folder' => PHORUM_PM_OUTBOX,
'read_flag' => 1,
);
}
 
// Prepare message meta data.
$meta = mysql_escape_string(serialize(array(
'recipients' => $rcpts
)));
 
// Create the message.
$sql = "INSERT INTO {$PHORUM["pm_messages_table"]} SET " .
"from_user_id = $from, " .
"from_username = '".mysql_escape_string($fromuser["username"])."', " .
"subject = '".mysql_escape_string($subject)."', " .
"message = '".mysql_escape_string($message)."', " .
"datestamp = '".time()."', " .
"meta = '$meta'";
mysql_query($sql, $conn);
if ($err = mysql_error()) {
phorum_db_mysql_error("$err: $sql");
return;
}
 
// Get the message id.
$pm_message_id = mysql_insert_id($conn);
 
// Put the message in the recipient inboxes.
foreach ($xref_entries as $xref) {
$sql = "INSERT INTO {$PHORUM["pm_xref_table"]} SET " .
"user_id = {$xref["user_id"]}, " .
"pm_folder_id={$xref["pm_folder_id"]}, " .
"special_folder='{$xref["special_folder"]}', " .
"pm_message_id=$pm_message_id, " .
"read_flag = {$xref["read_flag"]}, " .
"reply_flag = 0";
mysql_query($sql, $conn);
if ($err = mysql_error()) {
phorum_db_mysql_error("$err: $sql");
return;
}
 
}
 
return $pm_message_id;
}
 
/**
* This function updates a flag for a private message.
* @param pm_id - The id of the message to update.
* @param flag - The flag to update. Options are PHORUM_PM_READ_FLAG
* and PHORUM_PM_REPLY_FLAG.
* @param value - The value for the flag (true or false).
* @param user_id - The user to set a flag for or NULL
* to use the current user (default).
*/
function phorum_db_pm_setflag($pm_id, $flag, $value, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($pm_id, "int");
 
if ($flag != PHORUM_PM_READ_FLAG && $flag != PHORUM_PM_REPLY_FLAG) {
trigger_error("Invalid value for \$flag in function phorum_db_pm_setflag(): $flag", E_USER_WARNING);
return 0;
}
 
$value = $value ? 1 : 0;
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
// Update the flag in the database.
$sql = "UPDATE {$PHORUM["pm_xref_table"]} " .
"SET $flag = $value " .
"WHERE pm_message_id = $pm_id AND user_id = $user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// Update message counters.
if ($flag == PHORUM_PM_READ_FLAG) {
phorum_db_pm_update_message_info($pm_id);
}
 
return $res;
}
 
/**
* This function deletes a private message from a folder.
* @param folder - The folder from which to delete the message
* @param pm_id - The id of the private message to delete
* @param user_id - The user to delete the message for or NULL
* to use the current user (default).
*/
function phorum_db_pm_delete($pm_id, $folder, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($pm_id, "int");
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($folder)) {
$folder_sql = "pm_folder_id=$folder AND";
} elseif ($folder == PHORUM_PM_INBOX || $folder == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$folder' AND";
} else {
die ("Illegal folder '$folder' requested for user id '$user_id'");
}
 
$sql = "DELETE FROM {$PHORUM["pm_xref_table"]} " .
"WHERE $folder_sql " .
"user_id = $user_id AND pm_message_id = $pm_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// Update message counters.
phorum_db_pm_update_message_info($pm_id);
 
return $res;
}
 
/**
* This function moves a private message to a different folder.
* @param pm_id - The id of the private message to move.
* @param from - The folder to move the message from.
* @param to - The folder to move the message to.
* @param user_id - The user to move the message for or NULL
* to use the current user (default).
*/
function phorum_db_pm_move($pm_id, $from, $to, $user_id = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
settype($pm_id, "int");
 
if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
settype($user_id, "int");
 
if (is_numeric($from)) {
$folder_sql = "pm_folder_id=$from AND";
} elseif ($from == PHORUM_PM_INBOX || $from == PHORUM_PM_OUTBOX) {
$folder_sql = "pm_folder_id=0 AND special_folder='$from' AND";
} else {
die ("Illegal source folder '$from' specified");
}
 
if (is_numeric($to)) {
$pm_folder_id = $to;
$special_folder = 'NULL';
} elseif ($to == PHORUM_PM_INBOX || $to == PHORUM_PM_OUTBOX) {
$pm_folder_id = 0;
$special_folder = "'$to'";
} else {
die ("Illegal target folder '$to' specified");
}
 
$sql = "UPDATE {$PHORUM["pm_xref_table"]} SET " .
"pm_folder_id = $pm_folder_id, " .
"special_folder = $special_folder " .
"WHERE $folder_sql user_id = $user_id AND pm_message_id = $pm_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
/**
* This function updates the meta information for a message. If it
* detects that no xrefs are available for the message anymore,
* the message will be deleted from the database. So this function
* has to be called after setting the read_flag and after deleting
* a message.
* PMTODO maybe we need some locking here to prevent concurrent
* updates of the message info.
*/
function phorum_db_pm_update_message_info($pm_id)
{
$PHORUM = $GLOBALS['PHORUM'];
 
$conn = phorum_db_mysql_connect();
 
settype($pm_id, "int");
 
// Find the message record. Return immediately if no message is found.
$sql = "SELECT * " .
"FROM {$PHORUM['pm_messages_table']} " .
"WHERE pm_message_id = $pm_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
if (mysql_num_rows($res) == 0) return $res;
$pm = mysql_fetch_assoc($res);
 
// Find the xrefs for this message.
$sql = "SELECT * " .
"FROM {$PHORUM["pm_xref_table"]} " .
"WHERE pm_message_id = $pm_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
// No xrefs left? Then the message can be fully deleted.
if (mysql_num_rows($res) == 0) {
$sql = "DELETE FROM {$PHORUM['pm_messages_table']} " .
"WHERE pm_message_id = $pm_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
// Update the read flags for the recipients in the meta data.
$meta = unserialize($pm["meta"]);
$rcpts = $meta["recipients"];
while ($row = mysql_fetch_assoc($res)) {
// Only update if available. A kept copy in the outbox will
// not be in the meta list, so if the copy is read, the
// meta data does not have to be updated here.
if (isset($rcpts[$row["user_id"]])) {
$rcpts[$row["user_id"]]["read_flag"] = $row["read_flag"];
}
}
$meta["recipients"] = $rcpts;
 
// Store the new meta data.
$meta = mysql_escape_string(serialize($meta));
$sql = "UPDATE {$PHORUM['pm_messages_table']} " .
"SET meta = '$meta' " .
"WHERE pm_message_id = $pm_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
/* Take care of warning about deprecation of the old PM API functions. */
function phorum_db_get_private_messages($arg1, $arg2) {
phorum_db_pm_deprecated('phorum_db_get_private_messages'); }
function phorum_db_get_private_message($arg1) {
phorum_db_pm_deprecated('phorum_db_get_private_message'); }
function phorum_db_get_private_message_count($arg1) {
phorum_db_pm_deprecated('phorum_db_get_private_message_count'); }
function phorum_db_put_private_messages($arg1, $arg2, $arg3, $arg4, $arg5) {
phorum_db_pm_deprecated('phorum_db_put_private_messages'); }
function phorum_db_update_private_message($arg1, $arg2, $arg3){
phorum_db_pm_deprecated('phorum_db_update_private_message'); }
function phorum_db_pm_deprecated($func) {
die("${func}() has been deprecated. Please use the new private message API.");
}
 
/**
* This function checks if a certain user is buddy of another user.
* The function return the pm_buddy_id in case the user is a buddy
* or NULL in case the user isn't.
* @param buddy_user_id - The user_id to check for if it's a buddy.
* @param user_id - The user_id for which the buddy list must be
* checked or NULL to use the current user (default).
*/
function phorum_db_pm_is_buddy($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysql_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
$sql = "SELECT pm_buddy_id FROM {$PHORUM["pm_buddies_table"]} " .
"WHERE user_id = $user_id AND buddy_user_id = $buddy_user_id";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
if (mysql_num_rows($res)) {
$row = mysql_fetch_array($res);
return $row[0];
} else {
return NULL;
}
}
 
/**
* This function adds a buddy for a user. It will return the
* pm_buddy_id for the new buddy. If the buddy already exists,
* it will return the existing pm_buddy_id. If a non existant
* user_id is used for the buddy_user_id, the function will
* return NULL.
* @param buddy_user_id - The user_id that has to be added as a buddy.
* @param user_id - The user_id the buddy has to be added for or
* NULL to use the current user (default).
*/
function phorum_db_pm_buddy_add($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysql_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
// Check if the buddy_user_id is a valid user_id.
$valid = phorum_db_user_get($buddy_user_id, false);
if (! $valid) return NULL;
 
$pm_buddy_id = phorum_db_pm_is_buddy($buddy_user_id);
if (is_null($pm_buddy_id)) {
$sql = "INSERT INTO {$PHORUM["pm_buddies_table"]} SET " .
"user_id = $user_id, " .
"buddy_user_id = $buddy_user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
$pm_buddy_id = mysql_insert_id($conn);
}
 
return $pm_buddy_id;
}
 
/**
* This function deletes a buddy for a user.
* @param buddy_user_id - The user_id that has to be deleted as a buddy.
* @param user_id - The user_id the buddy has to be delete for or
* NULL to use the current user (default).
*/
function phorum_db_pm_buddy_delete($buddy_user_id, $user_id = NULL)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysql_connect();
settype($buddyuser_id, "int");
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
$sql = "DELETE FROM {$PHORUM["pm_buddies_table"]} WHERE " .
"buddy_user_id = $buddy_user_id AND user_id = $user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
return $res;
}
 
/**
* This function retrieves a list of buddies for a user.
* @param user_id - The user_id for which to retrieve the buddies
* or NULL to user the current user (default).
* @param find_mutual - Wheter to find mutual buddies or not (default not).
*/
function phorum_db_pm_buddy_list($user_id = NULL, $find_mutual = false)
{
$PHORUM = $GLOBALS['PHORUM'];
$conn = phorum_db_mysql_connect();
if (is_null($user_id)) $user_id = $PHORUM["user"]["user_id"];
settype($user_id, "int");
 
// Get all buddies for this user.
$sql = "SELECT buddy_user_id FROM {$PHORUM["pm_buddies_table"]} " .
"WHERE user_id = $user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$buddies = array();
if (mysql_num_rows($res)) {
while ($row = mysql_fetch_array($res)) {
$buddies[$row[0]] = array (
'user_id' => $row[0]
);
}
}
 
// If we do not have to lookup mutual buddies, we're done.
if (! $find_mutual) return $buddies;
 
// Initialize mutual buddy value.
foreach ($buddies as $id => $data) {
$buddies[$id]["mutual"] = false;
}
 
// Get all mutual buddies.
$sql = "SELECT DISTINCT a.buddy_user_id " .
"FROM {$PHORUM["pm_buddies_table"]} as a, {$PHORUM["pm_buddies_table"]} as b " .
"WHERE a.user_id=$user_id " .
"AND b.user_id=a.buddy_user_id " .
"AND b.buddy_user_id=$user_id";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res)) {
while ($row = mysql_fetch_array($res)) {
$buddies[$row[0]]["mutual"] = true;
}
}
 
return $buddies;
}
 
/**
* This function returns messages or threads which are newer or older
* than the given timestamp
*
* $time - holds the timestamp the comparison is done against
* $forum - get Threads from this forum
* $mode - should we compare against datestamp (1) or modifystamp (2)
*
*/
function phorum_db_prune_oldThreads($time,$forum=0,$mode=1) {
 
$PHORUM = $GLOBALS['PHORUM'];
 
$conn = phorum_db_mysql_connect();
$numdeleted=0;
 
$compare_field = "datestamp";
if($mode == 2) {
$compare_field = "modifystamp";
}
 
$forummode="";
if($forum > 0) {
$forummode=" AND forum_id = $forum";
}
 
// retrieving which threads to delete
$sql = "select thread from {$PHORUM['message_table']} where $compare_field < $time AND parent_id=0 $forummode";
 
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$ret=array();
while($row=mysql_fetch_row($res)) {
$ret[]=$row[0];
}
 
$thread_ids=implode(",",$ret);
 
if(count($ret)) {
// deleting the messages/threads
$sql="delete from {$PHORUM['message_table']} where thread IN ($thread_ids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
$numdeleted = mysql_affected_rows($conn);
if($numdeleted < 0) {
$numdeleted=0;
}
 
// deleting the associated notification-entries
$sql="delete from {$PHORUM['subscribers_table']} where thread IN ($thread_ids)";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
 
// optimizing the message-table
$sql="optimize table {$PHORUM['message_table']}";
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
}
 
return $numdeleted;
}
 
/**
* split thread
*/
function phorum_db_split_thread($message, $forum_id)
{
settype($message, "int");
settype($forum_id, "int");
 
if($message > 0 && $forum_id > 0){
// get message tree for update thread id
$tree =phorum_db_get_messagetree($message, $forum_id);
$queries =array();
$queries[0]="UPDATE {$GLOBALS['PHORUM']['message_table']} SET thread='$message', parent_id='0' WHERE message_id ='$message'";
$queries[1]="UPDATE {$GLOBALS['PHORUM']['message_table']} SET thread='$message' WHERE message_id IN ($tree)";
phorum_db_run_queries($queries);
}
}
 
/**
* This function returns the maximum message-id in the database
*/
function phorum_db_get_max_messageid() {
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
$maxid = 0;
 
$sql="SELECT max(message_id) from ".$PHORUM["message_table"];
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if (mysql_num_rows($res) > 0){
$row = mysql_fetch_row($res);
$maxid = $row[0];
}
 
return $maxid;
}
 
/**
* This function increments the viewcount for a post
*/
 
function phorum_db_viewcount_inc($message_id) {
if($message_id < 1 || !is_numeric($message_id)) {
return false;
}
 
$conn = phorum_db_mysql_connect();
$sql="UPDATE ".$GLOBALS['PHORUM']['message_table']." SET viewcount=viewcount+1 WHERE message_id=$message_id";
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
 
return true;
 
}
 
 
function phorum_db_get_custom_field_users($field_id,$field_content,$match) {
 
 
$field_id=(int)$field_id;
$field_content=mysql_real_escape_string($field_content);
 
$conn = phorum_db_mysql_connect();
 
if($match) {
$compval="LIKE";
} else {
$compval="=";
}
 
$sql = "select user_id from {$GLOBALS['PHORUM']['user_custom_fields_table']} where type=$field_id and data $compval '$field_content'";
$res = mysql_query($sql, $conn);
 
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
 
if(mysql_num_rows($res)) {
$retval=array();
while ($row = mysql_fetch_row($res)){
$retval[$row[0]]=$row[0];
}
} else {
$retval=NULL;
}
 
return $retval;
 
}
 
 
/**
* This function creates the tables needed in the database.
*/
 
function phorum_db_create_tables()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$retmsg = "";
 
$queries = array(
 
// create tables
"CREATE TABLE {$PHORUM['forums_table']} ( forum_id int(10) unsigned NOT NULL auto_increment, name varchar(50) NOT NULL default '', active smallint(6) NOT NULL default '0', description text NOT NULL default '', template varchar(50) NOT NULL default '', folder_flag tinyint(1) NOT NULL default '0', parent_id int(10) unsigned NOT NULL default '0', list_length_flat int(10) unsigned NOT NULL default '0', list_length_threaded int(10) unsigned NOT NULL default '0', moderation int(10) unsigned NOT NULL default '0', threaded_list tinyint(4) NOT NULL default '0', threaded_read tinyint(4) NOT NULL default '0', float_to_top tinyint(4) NOT NULL default '0', check_duplicate tinyint(4) NOT NULL default '0', allow_attachment_types varchar(100) NOT NULL default '', max_attachment_size int(10) unsigned NOT NULL default '0', max_totalattachment_size int(10) unsigned NOT NULL default '0', max_attachments int(10) unsigned NOT NULL default '0', pub_perms int(10) unsigned NOT NULL default '0', reg_perms int(10) unsigned NOT NULL default '0', display_ip_address smallint(5) unsigned NOT NULL default '1', allow_email_notify smallint(5) unsigned NOT NULL default '1', language varchar(100) NOT NULL default 'english', email_moderators tinyint(1) NOT NULL default '0', message_count int(10) unsigned NOT NULL default '0', sticky_count int(10) unsigned NOT NULL default '0', thread_count int(10) unsigned NOT NULL default '0', last_post_time int(10) unsigned NOT NULL default '0', display_order int(10) unsigned NOT NULL default '0', read_length int(10) unsigned NOT NULL default '0', vroot int(10) unsigned NOT NULL default '0', edit_post tinyint(1) NOT NULL default '1',template_settings text NOT NULL default '', count_views tinyint(1) unsigned NOT NULL default '0', display_fixed tinyint(1) unsigned NOT NULL default '0', reverse_threading tinyint(1) NOT NULL default '0',inherit_id int(10) unsigned NULL default NULL, PRIMARY KEY (forum_id), KEY name (name), KEY active (active,parent_id), KEY group_id (parent_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['message_table']} ( message_id int(10) unsigned NOT NULL auto_increment, forum_id int(10) unsigned NOT NULL default '0', thread int(10) unsigned NOT NULL default '0', parent_id int(10) unsigned NOT NULL default '0', author varchar(37) NOT NULL default '', subject varchar(255) NOT NULL default '', body text NOT NULL, email varchar(100) NOT NULL default '', ip varchar(255) NOT NULL default '', status tinyint(4) NOT NULL default '2', msgid varchar(100) NOT NULL default '', modifystamp int(10) unsigned NOT NULL default '0', user_id int(10) unsigned NOT NULL default '0', thread_count int(10) unsigned NOT NULL default '0', moderator_post tinyint(3) unsigned NOT NULL default '0', sort tinyint(4) NOT NULL default '2', datestamp int(10) unsigned NOT NULL default '0', meta mediumtext NOT NULL, viewcount int(10) unsigned NOT NULL default '0', closed tinyint(4) NOT NULL default '0', PRIMARY KEY (message_id), KEY thread_message (thread,message_id), KEY thread_forum (thread,forum_id), KEY special_threads (sort,forum_id), KEY status_forum (status,forum_id), KEY list_page_float (forum_id,parent_id,modifystamp), KEY list_page_flat (forum_id,parent_id,thread), KEY post_count (forum_id,status,parent_id), KEY dup_check (forum_id,author,subject,datestamp), KEY forum_max_message (forum_id,message_id,status,parent_id), KEY last_post_time (forum_id,status,modifystamp), KEY next_prev_thread (forum_id,status,thread) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['settings_table']} ( name varchar(255) NOT NULL default '', type enum('V','S') NOT NULL default 'V', data text NOT NULL, PRIMARY KEY (name)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['subscribers_table']} ( user_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0', sub_type int(10) unsigned NOT NULL default '0', thread int(10) unsigned NOT NULL default '0', PRIMARY KEY (user_id,forum_id,thread), KEY forum_id (forum_id,thread,sub_type)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_permissions_table']} ( user_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0', permission int(10) unsigned NOT NULL default '0', PRIMARY KEY (user_id,forum_id), KEY forum_id (forum_id,permission) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_table']} ( user_id int(10) unsigned NOT NULL auto_increment, username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '',cookie_sessid_lt varchar(50) NOT NULL default '', sessid_st varchar(50) NOT NULL default '', sessid_st_timeout int(10) unsigned NOT NULL default 0, password_temp varchar(50) NOT NULL default '', email varchar(100) NOT NULL default '', email_temp varchar(110) NOT NULL default '', hide_email tinyint(1) NOT NULL default '0', active tinyint(1) NOT NULL default '0', user_data text NOT NULL default '', signature text NOT NULL default '', threaded_list tinyint(4) NOT NULL default '0', posts int(10) NOT NULL default '0', admin tinyint(1) NOT NULL default '0', threaded_read tinyint(4) NOT NULL default '0', date_added int(10) unsigned NOT NULL default '0', date_last_active int(10) unsigned NOT NULL default '0', last_active_forum int(10) unsigned NOT NULL default '0', hide_activity tinyint(1) NOT NULL default '0',show_signature TINYINT( 1 ) DEFAULT '0' NOT NULL, email_notify TINYINT( 1 ) DEFAULT '0' NOT NULL, pm_email_notify TINYINT ( 1 ) DEFAULT '1' NOT NULL, tz_offset TINYINT( 2 ) DEFAULT '-99' NOT NULL,is_dst TINYINT( 1 ) DEFAULT '0' NOT NULL ,user_language VARCHAR( 100 ) NOT NULL default '',user_template VARCHAR( 100 ) NOT NULL default '', moderator_data text NOT NULL default '', moderation_email tinyint(2) unsigned not null default 1, PRIMARY KEY (user_id), UNIQUE KEY username (username), KEY active (active), KEY userpass (username,password), KEY sessid_st (sessid_st), KEY cookie_sessid_lt (cookie_sessid_lt), KEY activity (date_last_active,hide_activity,last_active_forum), KEY date_added (date_added), KEY email_temp (email_temp) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_newflags_table']} ( user_id int(11) NOT NULL default '0', forum_id int(11) NOT NULL default '0', message_id int(11) NOT NULL default '0', PRIMARY KEY (user_id,forum_id,message_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['groups_table']} ( group_id int(11) NOT NULL auto_increment, name varchar(255) NOT NULL default '0', open tinyint(3) NOT NULL default '0', PRIMARY KEY (group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['forum_group_xref_table']} ( forum_id int(11) NOT NULL default '0', group_id int(11) NOT NULL default '0', permission int(10) unsigned NOT NULL default '0', PRIMARY KEY (forum_id,group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_group_xref_table']} ( user_id int(11) NOT NULL default '0', group_id int(11) NOT NULL default '0', status tinyint(3) NOT NULL default '1', PRIMARY KEY (user_id,group_id) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['files_table']} ( file_id int(11) NOT NULL auto_increment, user_id int(11) NOT NULL default '0', filename varchar(255) NOT NULL default '', filesize int(11) NOT NULL default '0', file_data mediumtext NOT NULL default '', add_datetime int(10) unsigned NOT NULL default '0', message_id int(10) unsigned NOT NULL default '0', link varchar(10) NOT NULL default '', PRIMARY KEY (file_id), KEY add_datetime (add_datetime), KEY message_id_link (message_id,link)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['banlist_table']} ( id int(11) NOT NULL auto_increment, forum_id int(11) NOT NULL default '0', type tinyint(4) NOT NULL default '0', pcre tinyint(4) NOT NULL default '0', string varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY forum_id (forum_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['search_table']} ( message_id int(10) unsigned NOT NULL default '0', forum_id int(10) unsigned NOT NULL default '0',search_text mediumtext NOT NULL default '', PRIMARY KEY (message_id), KEY forum_id (forum_id), FULLTEXT KEY search_text (search_text) ) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['user_custom_fields_table']} ( user_id INT DEFAULT '0' NOT NULL , type INT DEFAULT '0' NOT NULL , data TEXT NOT NULL default '', PRIMARY KEY ( user_id , type )) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_messages_table']} ( pm_message_id int(10) unsigned NOT NULL auto_increment, from_user_id int(10) unsigned NOT NULL default '0', from_username varchar(50) NOT NULL default '', subject varchar(100) NOT NULL default '', message text NOT NULL default '', datestamp int(10) unsigned NOT NULL default '0', meta mediumtext NOT NULL default '', PRIMARY KEY(pm_message_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_folders_table']} ( pm_folder_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', foldername varchar(20) NOT NULL default '', PRIMARY KEY (pm_folder_id)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_xref_table']} ( pm_xref_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', pm_folder_id int(10) unsigned NOT NULL default '0', special_folder varchar(10), pm_message_id int(10) unsigned NOT NULL default '0', read_flag tinyint(1) NOT NULL default '0', reply_flag tinyint(1) NOT NULL default '0', PRIMARY KEY (pm_xref_id), KEY xref (user_id,pm_folder_id,pm_message_id), KEY read_flag (read_flag)) TYPE=MyISAM",
"CREATE TABLE {$PHORUM['pm_buddies_table']} ( pm_buddy_id int(10) unsigned NOT NULL auto_increment, user_id int(10) unsigned NOT NULL default '0', buddy_user_id int(10) unsigned NOT NULL default '0', PRIMARY KEY pm_buddy_id (pm_buddy_id), UNIQUE KEY userids (user_id, buddy_user_id), KEY buddy_user_id (buddy_user_id)) TYPE=MyISAM",
 
);
foreach($queries as $sql){
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
$retmsg = "$err<br />";
phorum_db_mysql_error("$err: $sql");
break;
}
}
 
return $retmsg;
}
 
// uses the database-dependant functions to escape a string
function phorum_db_escape_string($str) {
$str_tmp=mysql_real_escape_string($str);
 
return $str_tmp;
}
 
/**
* This function goes through an array of queries and executes them
*/
 
function phorum_db_run_queries($queries){
$PHORUM = $GLOBALS["PHORUM"];
 
$conn = phorum_db_mysql_connect();
 
$retmsg = "";
 
foreach($queries as $sql){
$res = mysql_query($sql, $conn);
if ($err = mysql_error()){
// skip duplicate column name errors
if(!stristr($err, "duplicate column")){
$retmsg.= "$err<br />";
phorum_db_mysql_error("$err: $sql");
}
}
}
 
return $retmsg;
}
 
/**
* This function checks that a database connection can be made.
*/
 
function phorum_db_check_connection(){
$conn = phorum_db_mysql_connect();
 
return ($conn > 0) ? true : false;
}
 
/**
* handy little connection function. This allows us to not connect to the
* server until a query is actually run.
* NOTE: This is not a required part of abstraction
*/
 
function phorum_db_mysql_connect(){
$PHORUM = $GLOBALS["PHORUM"];
 
static $conn;
if (empty($conn)){
$conn = mysql_connect($PHORUM["DBCONFIG"]["server"], $PHORUM["DBCONFIG"]["user"], $PHORUM["DBCONFIG"]["password"], true);
mysql_select_db($PHORUM["DBCONFIG"]["name"], $conn);
}
return $conn;
}
 
/**
* error handling function
* NOTE: This is not a required part of abstraction
*/
 
function phorum_db_mysql_error($err){
 
if(isset($GLOBALS['PHORUM']['error_logging'])) {
$logsetting = $GLOBALS['PHORUM']['error_logging'];
} else {
$logsetting = "";
}
$adminemail = $GLOBALS['PHORUM']['system_email_from_address'];
$cache_dir = $GLOBALS['PHORUM']['cache'];
 
if (!defined("PHORUM_ADMIN")){
if($logsetting == 'mail') {
include_once("./include/email_functions.php");
 
$data=array('mailmessage'=>"An SQL-error occured in your phorum-installation.\n\nThe error-message was:\n$err\n\n",
'mailsubject'=>'Phorum: an SQL-error occured');
phorum_email_user(array($adminemail),$data);
 
} elseif($logsetting == 'file') {
$fp = fopen($cache_dir."/phorum-sql-errors.log",'a');
fputs($fp,time().": $err\n");
fclose($fp);
 
} else {
echo htmlspecialchars($err);
}
exit();
}else{
echo "<!-- $err -->";
}
}
 
/**
* This function is used by the sanity checking system in the
* admin interface to determine how much data can be transferred
* in one query. This is used to detect problems with uploads that
* are larger than the database server can handle.
* The function returns the size in bytes. For database implementations
* which do not have this kind of limit, NULL can be returned.
*/
function phorum_db_maxpacketsize ()
{
$conn = phorum_db_mysql_connect();
$res = mysql_query("SELECT @@global.max_allowed_packet",$conn);
if (!$res) return NULL;
if (mysql_num_rows($res)) {
$row = mysql_fetch_array($res);
return $row[0];
}
return NULL;
}
 
/**
* This function is used by the sanity checking system to let the
* database layer do sanity checks of its own. This function can
* be used by every database layer to implement specific checks.
*
* The return value for this function should be exactly the same
* as the return value expected for regular sanity checking
* function (see include/admin/sanity_checks.php for information).
*
* There's no need to load the sanity_check.php file for the needed
* constants, because this function should only be called from the
* sanity checking system.
*/
function phorum_db_sanitychecks()
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Retrieve the MySQL server version.
$conn = phorum_db_mysql_connect();
$res = mysql_query("SELECT @@global.version",$conn);
if (!$res) return array(
PHORUM_SANITY_WARN,
"The database layer could not retrieve the version of the
running MySQL server",
"This probably means that you are running a really old MySQL
server, which does not support \"SELECT @@global.version\"
as an SQL command. If you are not running a MySQL server
with version 4.0.18 or higher, then please upgrade your
MySQL server. Else, contact the Phorum developers to see
where this warning is coming from"
);
 
if (mysql_num_rows($res))
{
$row = mysql_fetch_array($res);
$ver = explode(".", $row[0]);
 
// Version numbering format which is not recognized.
if (count($ver) != 3) return array(
PHORUM_SANITY_WARN,
"The database layer was unable to recognize the MySQL server's
version number \"" . htmlspecialchars($row[0]) . "\". Therefore,
checking if the right version of MySQL is used is not possible.",
"Contact the Phorum developers and report this specific
version number, so the checking scripts can be updated."
);
 
settype($ver[0], 'int');
settype($ver[1], 'int');
settype($ver[2], 'int');
 
// MySQL before version 4.
if ($ver[0] < 4) return array(
PHORUM_SANITY_CRIT,
"The MySQL database server that is used is too old. The
running version is \"" . htmlspecialchars($row[0]) . "\",
while MySQL version 4.0.18 or higher is recommended.",
"Upgrade your MySQL server to a newer version. If your
website is hosted with a service provider, please contact
the service provider to upgrade your MySQL database."
);
 
// MySQL before version 4.0.18, with full text search enabled.
if ($PHORUM["DBCONFIG"]["mysql_use_ft"] &&
$ver[0] == 4 && $ver[1] == 0 && $ver[2] < 18) return array(
PHORUM_SANITY_WARN,
"The MySQL database server that is used does not
support all Phorum features. The running version is
\"" . htmlspecialchars($row[0]) . "\", while MySQL version
4.0.18 or higher is recommended.",
"Upgrade your MySQL server to a newer version. If your
website is hosted with a service provider, please contact
the service provider to upgrade your MySQL database."
);
 
// All checks are okay.
return array (PHORUM_SANITY_OK, NULL);
}
 
return array(
PHORUM_SANITY_CRIT,
"An unexpected problem was found in running the sanity
check function phorum_db_sanitychecks().",
"Contact the Phorum developers to find out what the problem is."
);
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/users.php
New file
0,0 → 1,854
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM" ) ) return;
 
/**
* These functions are Phorum's interface to the user data. If you want
* to use your own user data, just replace these functions.
*
* The functions do use Phorum's database layer. Of course, it is not
* required.
*/
// if you write your own user layer, set this to false
define( "PHORUM_ORIGINAL_USER_CODE", true );
 
define( "PHORUM_SESSION_LONG_TERM" , "phorum_session_v5" );
define( "PHORUM_SESSION_SHORT_TERM", "phorum_session_st" );
define( "PHORUM_SESSION_ADMIN", "phorum_admin_session" );
 
function phorum_user_check_session( $cookie = PHORUM_SESSION_LONG_TERM )
{
$PHORUM = $GLOBALS["PHORUM"];
 
// If we do URI based authentication, we will only look at the
// PHORUM_SESSION_LONG_TERM session (which is the session key that is
// stored in the URI). Here we rewrite requests for
// PHORUM_SESSION_SHORT_TERM so we will handle tighter security correctly.
if ( isset($PHORUM["use_cookies"]) && ! $PHORUM["use_cookies"] &&
$cookie == PHORUM_SESSION_SHORT_TERM) {
$cookie = PHORUM_SESSION_LONG_TERM;
}
 
if ( ( $cookie != PHORUM_SESSION_LONG_TERM || ( isset( $PHORUM["use_cookies"] ) && $PHORUM["use_cookies"] ) ) && isset( $_COOKIE[$cookie] ) ) { // REAL cookies ;)
$sessid = $_COOKIE[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=true;
} elseif ( isset( $PHORUM["args"][$cookie] ) ) { // in the p5-urls
$sessid = $PHORUM["args"][$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
} elseif ( isset( $_POST[$cookie] ) ) { // from post-forms
$sessid = $_POST[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
} elseif ( isset( $_GET[$cookie] ) ) { // should rarely happen but helps in some cases
$sessid = $_GET[$cookie];
$GLOBALS["PHORUM"]["use_cookies"]=false;
}
 
$success = false;
 
if ( !empty( $sessid ) && $GLOBALS["PHORUM"]["use_cookies"]) {
// this part is for cookie-authentication where we have username and password
list( $userid, $md5session ) = explode( ":", $sessid, 2 );
 
if(!is_numeric($userid)) {
phorum_user_clear_session( $cookie );
return false;
}
 
$user=phorum_user_get($userid, true, true);
if (empty($user)) {
phorum_user_clear_session( $cookie );
return false;
}
 
if ( ($cookie==PHORUM_SESSION_LONG_TERM && !empty($user['cookie_sessid_lt']) && $user['cookie_sessid_lt'] == $md5session) ||
($cookie==PHORUM_SESSION_SHORT_TERM && !empty($user['sessid_st']) && $user['sessid_st'] == $md5session) ||
($cookie==PHORUM_SESSION_ADMIN && !empty($user['cookie_sessid_lt']) && md5($user['cookie_sessid_lt'].$PHORUM["admin_session_salt"]) == $md5session) ) {
if ( $user["active"] ) {
// write access is false by default, need to check the st-cookie too
$user['write_access']=false;
 
$GLOBALS["PHORUM"]["user"] = $user;
$success = true;
 
phorum_user_create_session( $cookie );
} else {
phorum_user_clear_session( $cookie );
}
}
} elseif( !empty( $sessid ) && !$GLOBALS["PHORUM"]["use_cookies"]) {
// this part is for uri-authentication where we only have a session-id
$uri_session_id = urldecode( $sessid );
if ( $user_id = phorum_db_user_check_field('sessid_st',$uri_session_id,'=')) {
$user = phorum_user_get( $user_id, true, true );
if ( $user["active"] ) {
 
// write access is enabled for uri-authentication as thats requiring login at every visit
$user['write_access']=true;
 
$GLOBALS["PHORUM"]["user"] = $user;
$success = true;
phorum_user_create_session( $cookie, false, $user['sessid_st'] );
} else {
phorum_user_clear_session( $cookie );
}
}
}
 
// track user activity
if($success && $PHORUM["track_user_activity"] && $GLOBALS["PHORUM"]["user"]["date_last_active"] < time() - $PHORUM["track_user_activity"] ) {
$tmp_user["user_id"] = $GLOBALS["PHORUM"]["user"]["user_id"];
$tmp_user["date_last_active"] = time();
if(isset($PHORUM['forum_id'])) {
$tmp_user["last_active_forum"]= $PHORUM['forum_id'];
} else {
$tmp_user["last_active_forum"]= 0;
}
phorum_user_save_simple( $tmp_user);
}
 
return $success;
}
 
function phorum_user_create_session( $cookie = PHORUM_SESSION_LONG_TERM, $refresh = false, $uri_session_id = '' )
{
$PHORUM = $GLOBALS["PHORUM"];
 
// require that the global user exists
if ( !empty( $PHORUM["user"] ) ) {
$user = $PHORUM["user"];
 
if ( (isset( $PHORUM["use_cookies"] ) && $PHORUM["use_cookies"]) || $cookie == PHORUM_SESSION_ADMIN ) {
 
switch($cookie){
case PHORUM_SESSION_SHORT_TERM:
 
// creating a new shortterm-session-id if none exists yet or it has timed out
if($refresh || empty($user['sessid_st']) || $user["sessid_st_timeout"]<time()) {
$sessid=md5($user['username'].microtime().$user['password']);
$timeout = time() + $PHORUM["short_session_timeout"]*60;
$simple_user=array('user_id'=>$user['user_id'],'sessid_st'=>$sessid,'sessid_st_timeout'=>$timeout);
phorum_user_save_simple($simple_user);
 
// if the cookie is half expired, reset it.
} elseif(time() - $user["sessid_st_timeout"] < $PHORUM["short_session_timeout"]*60/2){
$sessid=$user['sessid_st'];
$timeout = time() + $PHORUM["short_session_timeout"]*60;
$simple_user=array('user_id'=>$user['user_id'],'sessid_st'=>$sessid,'sessid_st_timeout'=>$timeout);
phorum_user_save_simple($simple_user);
}
 
// if a timeout was set, we need to set a new cookie
if($timeout){
setcookie( $cookie, $user['user_id'].':'.$sessid, $timeout, $PHORUM["session_path"], $PHORUM["session_domain"] );
}
break;
 
case PHORUM_SESSION_LONG_TERM:
// creating a new longterm-session-id if none exists yet
if($refresh || empty($user['cookie_sessid_lt'])) {
$sessid=md5($user['username'].microtime().$user['password']);
$simple_user=array('user_id'=>$user['user_id'],'cookie_sessid_lt'=>$sessid);
phorum_user_save_simple($simple_user);
} else {
$sessid=$user['cookie_sessid_lt'];
}
 
if($PHORUM["session_timeout"]==0){
$timeout = 0;
} else {
$timeout = time() + 86400 * $PHORUM["session_timeout"];
}
 
setcookie( $cookie, $user['user_id'].':'.$sessid, $timeout, $PHORUM["session_path"], $PHORUM["session_domain"] );
 
break;
 
case PHORUM_SESSION_ADMIN:
// creating a new longterm-session-id if none exists yet
if(empty($user['cookie_sessid_lt'])) {
$sessid=md5($user['username'].microtime().$user['password']);
$simple_user=array('user_id'=>$user['user_id'],'cookie_sessid_lt'=>$sessid);
phorum_user_save_simple($simple_user);
} else {
$sessid=$user['cookie_sessid_lt'];
}
 
setcookie( $cookie, $user['user_id'].':'.md5($sessid.$PHORUM["admin_session_salt"]), 0, $PHORUM["session_path"], $PHORUM["session_domain"] );
 
break;
 
}
 
} else {
$sessid = $uri_session_id;
$GLOBALS["PHORUM"]["DATA"]["GET_VARS"][$cookie] = "$cookie=" . urlencode( $sessid );
$GLOBALS["PHORUM"]["DATA"]["POST_VARS"] .= "<input type=\"hidden\" name=\"$cookie\" value=\"$sessid\" />";
}
}
}
 
 
 
 
 
function phorum_user_clear_session( $cookie = PHORUM_SESSION_LONG_TERM )
{
setcookie( $cookie, "", time()-86400, $GLOBALS["PHORUM"]["session_path"], $GLOBALS["PHORUM"]["session_domain"] );
}
 
/**
* This function retrieves a user from the database, given the user id.
* If $user_id is an array of user ids, it will retrieve all of the users
* in the array. If $detailed is set to true, the function gets the users
* full information. Setting this to false omits permission data, pm counts,
* and group membership. $detailed is true by default and may be omitted.
* @param user_id - can be a single user id, or an array of user ids.
* @param detailed - get detailed user information (defaults to true).
* @param checknewpm - check for new private messages for the user (defaults to false).
* @return array - either an array representing a single user's information,
* or an array of users
*/
function phorum_user_get( $user_id, $detailed = true, $checkpm = false )
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( !is_array( $user_id ) ) {
$user_ids = array( $user_id );
} else {
$user_ids = $user_id;
}
 
if ( count( $user_ids ) ) {
$cache_users=array();
$tmp_users=array();
$cachecnt=0;
 
// get users from cache if enabled
if(isset($PHORUM['cache_users']) && $PHORUM['cache_users']) {
foreach($user_ids as $id => $cur_user_id) {
$data=phorum_cache_get('user',$cur_user_id);
if($data != null) { // null if no key found
$cache_users[$cur_user_id]=$data;
 
unset($user_ids[$id]);
$cachecnt++;
}
}
unset($data);
// we need to get the dynamic data too!
// only selecting date_last_active, forum_last_active,
// posts ... any more?
if($cachecnt > 0) {
$dynamic_data=phorum_db_user_get_fields(array_keys($cache_users),array('date_last_active','last_active_forum','posts'));
foreach($dynamic_data as $d_uid => $d_data) {
$cache_users[$d_uid]=array_merge($cache_users[$d_uid],$d_data);
}
 
}
}
 
if(count($user_ids)) {
$tmp_users = phorum_db_user_get( $user_ids, $detailed );
 
foreach( $tmp_users as $uid => $user ) {
 
if ( !$user["admin"] ) {
if ( isset( $user["group_permissions"] ) ) {
foreach( $user["group_permissions"] as $forum_id => $perm ) {
if(!isset($user["permissions"][$forum_id]))
$user["permissions"][$forum_id]=0;
 
$user["permissions"][$forum_id] = $user["permissions"][$forum_id] | $perm;
}
}
 
if ( isset( $user["forum_permissions"] ) ) {
foreach( $user["forum_permissions"] as $forum_id => $perm ) {
$user["permissions"][$forum_id] = $perm;
}
}
}
 
// check if the user has new private messages
if ( ($checkpm || (isset($PHORUM['cache_users']) && $PHORUM['cache_users'])) && $PHORUM["enable_pm"] && $PHORUM["enable_new_pm_count"] ) {
$user["new_private_messages"] = phorum_db_pm_checknew( $uid );
}
 
// store users in cache if enabled
if( $detailed && isset($PHORUM['cache_users']) && $PHORUM['cache_users']) {
phorum_cache_put('user',$uid,$user);
}
$tmp_users[$uid] = $user;
}
}
}
 
// merging cached and retrieved users
$ret = $tmp_users + $cache_users;
 
if ( !is_array( $user_id ) ) {
if (isset($ret[$user_id]))
$ret = $ret[$user_id];
else
$ret = NULL;
}
 
return $ret;
}
 
/**
* This function gets a list of all the active users.
* @return array of users (same format as phorum_user_get)
*/
function phorum_user_get_list()
{
return phorum_hook("user_list", phorum_db_user_get_list());
}
 
function phorum_user_save( $user )
{
if ( empty( $user["user_id"] ) ) return false;
 
$old_user = phorum_user_get( $user['user_id'] );
$db_user = phorum_user_prepare_data( $user, $old_user );
 
$ret = phorum_db_user_save( $db_user );
 
// remove that user from the cache
if(isset($GLOBALS["PHORUM"]['cache_users']) && $GLOBALS["PHORUM"]['cache_users']) {
phorum_cache_remove('user',$user['user_id']);
}
 
// Is this the currently logged in user?
// If so, re-get his stuff from the system.
if ( isset($GLOBALS["PHORUM"]["user"]) && $GLOBALS["PHORUM"]["user"]["user_id"] == $user["user_id"] ) {
$GLOBALS["PHORUM"]["user"] = phorum_user_get( $user["user_id"] );
}
 
 
return $ret;
}
/**
* This function quickly updates real columns without any further checks
* it just stores the data as fast as possible
*
*/
function phorum_user_save_simple($user)
{
if ( empty( $user["user_id"] ) ) return false;
 
// clear the cache only if we are not just updating the activity
if(isset($GLOBALS['PHORUM']['cache_users']) && $GLOBALS['PHORUM']['cache_users']) {
if(!(count($user) == 3 && isset($user['date_last_active'])))
phorum_cache_remove('user',$user['user_id']);
}
 
$ret = phorum_db_user_save( $user );
 
return $ret;
}
 
function phorum_user_check_login( $username, $password )
{
$ret = false;
$temp_check = false;
 
$user_id = phorum_db_user_check_pass( $username, md5( $password ) );
// regular password failed, try the temp password
if ( $user_id == 0 ) {
$user_id = phorum_db_user_check_pass( $username, md5( $password ), true );
$temp_check = true;
}
 
if ( $user_id > 0 ) {
// if this was a temp password, set the normal pass to the temp password
// do this before we get the user so the data is up to date.
// leave the temp password alone as setting to empty is bad.
if ( $temp_check ) {
$tmp_user["user_id"] = $user_id;
$tmp_user["password"] = $password;
phorum_user_save( $tmp_user );
}
 
$ret = phorum_user_set_current_user( $user_id );
}
 
return $ret;
}
 
function phorum_user_verify( $user_id, $tmp_pass )
{
$user_id = phorum_db_user_check_field( array( "user_id", "password_temp" ), array( $user_id, md5( $tmp_pass ) ), array( "=", "=" ) );
return $user_id;
}
 
function phorum_user_set_current_user( $user_id )
{
$ret = false;
 
$user = phorum_user_get( $user_id );
if ( $user["active"] == PHORUM_USER_ACTIVE ) {
$GLOBALS["PHORUM"]["user"] = $user;
$ret = true;
}
 
return $ret;
}
 
function phorum_user_check_username( $username )
{
return phorum_db_user_check_field( "username", $username );
}
 
function phorum_user_check_email( $email )
{
return phorum_db_user_check_field( "email", $email );
}
 
/**
* (generic) function for checking a user-field in the database
*/
function phorum_user_check_field( $field_name, $field_value)
{
return phorum_db_user_check_field( $field_name , $field_value );
}
 
/**
* function for adding a user to the database (using the db-layer)
*/
function phorum_user_add( $user, $pwd_unchanged = false )
{
if ( empty( $user["password_temp"] ) ) $user["password_temp"] = $user["password"];
$db_user = phorum_user_prepare_data( $user, array(), $pwd_unchanged );
if(empty($db_user["date_added"])) $db_user["date_added"]=time();
if(empty($db_user["date_last_active"])) $db_user["date_last_active"]=time();
return phorum_db_user_add( $db_user );
}
 
function phorum_user_prepare_data( $new_user, $old_user, $pwd_unchanged = false )
{
$PHORUM = $GLOBALS["PHORUM"];
// how the user appears to the app and how it is stored in the db are different.
// This function prepares the data for storage in the database.
// While this may seem like a crossing of database vs. front end, it is better that
// this is here as it is not directly related to database interaction.
// we need to preserve some data, therefore we use the old user
unset( $old_user['password'] );
unset( $old_user['password_temp'] );
if ( is_array( $old_user ) ) {
$user = $old_user;
} else {
$user = array();
}
foreach( $new_user as $key => $val ) {
$user[$key] = $val;
}
 
foreach( $user as $key => $val ) {
switch ( $key ) {
// these are all the actual fields in the user
// table. We don't need to do anything to them.
case "user_id":
case "username":
case "email":
case "email_temp":
case "hide_email":
case "active":
case "user_data":
case "signature":
case "threaded_list":
case "posts":
case "admin":
case "threaded_read":
case "hide_activity":
case "permissions":
case "forum_permissions":
case "date_added":
case "date_last_active":
case "group_permissions":
case "groups":
case "show_signature":
case "email_notify":
case "pm_email_notify":
case "tz_offset":
case "is_dst":
case "user_language":
case "user_template":
case "moderation_email":
break;
// the phorum built in user module stores md5 passwords.
case "password":
case "password_temp":
if ( !$pwd_unchanged ) {
$user[$key] = md5( $val );
} elseif ( $pwd_unchanged == -1 ) {
$user[$key] = $val;
}
break;
// everything that is not one of the above fields is stored in a
// serialized text field for dynamic profile variables.
// If the field is not in the PROFILE_FIELDS array, we don't add it.
default:
$type=-1;
// find out which ID that custom-field has
foreach($PHORUM['PROFILE_FIELDS'] as $ctype => $cdata) {
if($cdata['name'] == $key) {
$type=$ctype;
break;
}
}
if($type != -1) { // store it only if we found it
if( $val!=="") {
if(!is_array($val)) {
$user_data[$type] = substr($val,0,$PHORUM['PROFILE_FIELDS'][$type]['length']);
} else {
$user_data[$type] = $val;
}
} elseif(!isset($user_data)){
$user_data=array();
}
}
unset( $user[$key] );
}
// create the serialized var
if ( isset( $user_data ) ) {
$user["user_data"] = $user_data;
}
}
 
return $user;
}
 
function phorum_user_subscribe( $user_id, $forum_id, $thread, $type )
{
$list=phorum_user_access_list( PHORUM_USER_ALLOW_READ );
if(!in_array($forum_id, $list)) return;
return phorum_db_user_subscribe( $user_id, $forum_id, $thread, $type );
}
 
function phorum_user_unsubscribe( $user_id, $thread, $forum_id=0 )
{
if($forum_id){
return phorum_db_user_unsubscribe( $user_id, $thread, $forum_id );
} else {
return phorum_db_user_unsubscribe( $user_id, $thread );
}
}
 
/**
* This function returns true if the current user is allowed to moderate $forum_id or the user given through user_data
*/
 
function phorum_user_moderate_allowed( $forum_id = 0, $user_data = 0 )
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( $user_data == 0 ) {
$user_data = $PHORUM["user"];
}
// if this is an admin, stop now
if ( $user_data["admin"] ) return true;
 
// they have no special permissions, return
if(!isset($user_data["permissions"])){
return false;
}
 
// this sets up a check for moderation at any level
if ( $forum_id==PHORUM_MODERATE_ALLOWED_ANYWHERE ){
$perms = $user_data["permissions"];
} else {
// else we check only one forum
// if no forum_id passed, check current forum
if ( $forum_id==0 ){
$forum_id = $PHORUM["forum_id"];
}
if(isset($user_data["permissions"][$forum_id])){
$perms[$forum_id] = $user_data["permissions"][$forum_id];
} else {
return false;
}
}
 
// check the users permission array
foreach($perms as $forum_id => $perm) {
if ( $perm & PHORUM_USER_ALLOW_MODERATE_MESSAGES ) {
return true;
}
}
 
return false;
}
 
/**
* calls the db-function for listing all the moderators for a forum
* This returns an array of moderators, key as their userid, value as their email address.
*/
function phorum_user_get_moderators( $forum_id , $ignore_user_perms = false, $for_email = false)
{
$gotmods=false;
if(isset($GLOBALS["PHORUM"]['cache_users']) && $GLOBALS["PHORUM"]['cache_users']) {
$mods=phorum_cache_get('user','moderators-'.$forum_id.'-'.$ignore_user_perms);
if($mods != null) {
$gotmods=true;
}
}
if(!$gotmods) {
$mods=phorum_db_user_get_moderators( $forum_id , $ignore_user_perms, $for_email);
}
return $mods;
}
 
/**
* phorum_user_access_allowed()
*
* @param $permission Use the PHORUM_ALLOW_* constants
* @return bool
*/
function phorum_user_access_allowed( $permission, $forum_id = 0 )
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( empty( $forum_id ) ) $forum_id = $PHORUM["forum_id"];
 
$ret = false;
// user is an admin, he gets it all
if ( !empty( $PHORUM["user"]["admin"] ) ) {
$ret = true;
} else {
// user is logged in.
if ( $PHORUM["user"]["user_id"] > 0 ) {
// if the user has perms for this forum, use them.
if ( isset( $PHORUM["user"]["permissions"][$forum_id] ) ) {
$perms = $PHORUM["user"]["permissions"][$forum_id];
// else we use the forum's default perms
// for registered users
} elseif ( $forum_id ) {
if ( $forum_id != $PHORUM["forum_id"] ) {
$forums = phorum_db_get_forums( $forum_id );
$forum = array_shift( $forums );
} else {
$forum = $PHORUM;
}
$perms = $forum["reg_perms"];
}
// user is not logged in
// use the forum default perms for public users
} elseif ( $forum_id ) {
if ( $forum_id != $PHORUM["forum_id"] ) {
$forums = phorum_db_get_forums( $forum_id );
$forum = array_shift( $forums );
} else {
$forum = $PHORUM;
}
if(isset($forum['pub_perms']))
$perms = $forum["pub_perms"];
}
 
if ( !empty( $perms ) && ( $ret || ( $perms &$permission ) ) ) {
$ret = true;
} else {
$ret = false;
}
}
 
return $ret;
}
 
/**
* phorum_user_access_list()
*
* This function will return a list of forum ids in which
* the current user has $permission
*
* @param $permission Use the PHORUM_ALLOW_* constants
* @return bool
*/
 
function phorum_user_access_list( $permission )
{
$PHORUM = $GLOBALS["PHORUM"];
 
$forums = phorum_db_get_forums(0,-1,$PHORUM['vroot']);
$forum_list = array();
 
$field = ( $PHORUM["user"]["user_id"] > 0 ) ? "reg_perms" : "pub_perms";
 
foreach( $forums as $forum_id => $forum ) {
if ( $PHORUM["user"]["admin"] || $forum[$field] &$permission ) {
$forum_list[$forum_id] = $forum_id;
}
// if its a folder, they have read but nothing else
elseif ($forum["folder_flag"] && $permission == PHORUM_USER_ALLOW_READ){
$forum_list[$forum_id] = $forum_id;
}
}
 
if ( !$PHORUM["user"]["admin"] && !empty( $PHORUM["user"]["permissions"] ) ) {
foreach( $PHORUM["user"]["permissions"] as $forum_id => $perms ) {
if ( isset( $forum_list[$forum_id] ) ) unset( $forum_list[$forum_id] );
if ( $perms & $permission ) {
$forum_list[$forum_id] = $forum_id;
}
}
}
 
// Admins also have rights for forum_id 0 (announcements)
if ($PHORUM["user"]["admin"]) {
$forum_list[0] = 0;
}
 
return $forum_list;
}
 
/**
* phorum_user_allow_moderate_group()
*
* Return true if the current user is allowed to moderate
* a given group, or any group if no group is given.
*
* @param int - a group id to check (default, all)
* @return bool
*/
function phorum_user_allow_moderate_group($group_id = 0)
{
$groups = phorum_user_get_moderator_groups();
if ($group_id == 0 && count($groups) > 0){
return true;
}
elseif (isset($groups[$group_id])){
return true;
}
else{
return false;
}
}
 
/**
* phorum_user_get_moderator_groups()
*
* This function will return a list of the groups the current user
* is allowed to moderate. For admins, this will return all the groups.
*
* The array is of the form array[group_id] = groupname.
* @return array
*/
function phorum_user_get_moderator_groups()
{
$PHORUM=$GLOBALS["PHORUM"];
$groups = array();
$fullgrouplist = phorum_db_get_groups();
 
// if its an admin, return all groups as a moderator
if ($PHORUM["user"]["admin"]){
// the permission here is for a forum, we don't care about that
foreach ($fullgrouplist as $groupid => $groupperm){
$groups[$groupid] = $fullgrouplist[$groupid]["name"];
}
}
else {
$grouplist = phorum_user_get_groups($PHORUM["user"]["user_id"]);
foreach ($grouplist as $groupid => $perm){
if ($perm == PHORUM_USER_GROUP_MODERATOR){
$groups[$groupid] = $fullgrouplist[$groupid]["name"];
}
}
}
return $groups;
}
 
/**
* phorum_user_get_groups()
*
* This function will return a list of groups the user
* is a member of, as well as the users permissions.
*
* The returned list has the group id as the key, and
* the permission as the value. Permissions are the
* PHORUM_USER_GROUP constants.
* @param int - the users user_id
* @return array
*/
function phorum_user_get_groups($user_id)
{
return phorum_db_user_get_groups($user_id);
}
 
/**
* phorum_user_save_groups()
*
* This function saves a users group permissions. The data
* to save should be an array of the form array[group_id] = permission
* @param int - the users user_id
* @param array - group permissions to save
* @return bool - true if successful
*/
function phorum_user_save_groups($user_id, $groups)
{
if(isset($GLOBALS["PHORUM"]['cache_users']) && $GLOBALS["PHORUM"]['cache_users']) {
phorum_cache_remove('user',$user_id);
}
return phorum_db_user_save_groups($user_id, $groups);
}
 
function phorum_user_addpost()
{
return phorum_db_user_addpost();
}
 
function phorum_user_delete($user_id)
{
if(isset($GLOBALS["PHORUM"]['cache_users']) && $GLOBALS["PHORUM"]['cache_users']) {
phorum_cache_remove('user',$user_id);
}
return phorum_db_user_delete($user_id);
}
 
/**
* phorum_user_check_custom_field()
*
* This function takes a custom-fields name and content
* as arguments and returns an array of the user_ids found
* or NULL if no users are found
*
* optional match-parameter
* 0 - exact match
* 1 - like-clause
*/
function phorum_user_check_custom_field($field_name,$field_content,$match=0) {
 
$type=-1;
foreach($GLOBALS['PHORUM']['PROFILE_FIELDS'] as $ctype => $cdata) {
if($cdata['name'] == $field_name) {
$type=$ctype;
break;
}
}
if($type > -1) {
$retval=phorum_db_get_custom_field_users($type,$field_content,$match);
} else {
$retval=NULL;
}
 
return $retval;
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks/cache.php
New file
0,0 → 1,103
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check if the cache directory is available and if
// files and directories can be created in it. Also
// do a basic check on Phorums caching API.
 
$phorum_check = "Phorum cache";
 
function phorum_check_cache(){
$PHORUM = $GLOBALS["PHORUM"];
$dir = $PHORUM["cache"];
 
// Some general solution descriptions.
$solution_1 = "Change the Cache Directory setting under
General Settings.";
$solution_2 = "Change the Cache Directory setting under General
Settings or give your webserver more permissions
for the current cache directory.";
 
// Check if the cache directory exists.
if (! file_exists($dir) || ! is_dir($dir)) return array(
PHORUM_SANITY_CRIT,
"The system is unable to find the cache
directory \"".htmlspecialchars($dir)."\" on
your system.",
$solution_1
);
 
// Check if we can create files in the cache directory.
$fp = @fopen ("$dir/sanity_check_dummy_file", "w");
if (! $fp) return array (
PHORUM_SANITY_CRIT,
"The system is unable to write files
to your cache directory \"".htmlspecialchars($dir)."\".
The system error was:<br/><br/>".
htmlspecialchars($php_errormsg).".",
$solution_2
);
fclose($fp);
 
// Some very unusual thing might happen. On Windows2000 we have seen
// that the webserver can write a message to the cache directory,
// but that it cannot read it afterwards. Probably due to
// specific NTFS file permission settings. So here we have to make
// sure that we can open the file that we just wrote.
$checkfp = fopen("$dir/sanity_check_dummy_file", "r");
if (! $checkfp) return array(
PHORUM_SANITY_CRIT,
"The system was able to write a file to your cache directory
\"".htmlspecialchars($dir)."\", but afterwards the created
file could not be read by the webserver. This is probably
caused by the file permissions on your cache directory.",
$solution_2
);
 
unlink("$dir/sanity_check_dummy_file");
 
// Check if we can create directories in the cache directory.
if (! @mkdir("$dir/sanity_check_dummy_dir")) return array(
PHORUM_SANITY_CRIT,
"The system is unable to create directories
in your cache directory \"".htmlspecialchars($dir)."\".
The system error was:<br/><br/>".htmlspecialchars($php_errormsg).".",
$solution_2
);
rmdir("$dir/sanity_check_dummy_dir");
 
// All seems OK. Do a final system check where we check
// the caching system like the Phorum system will do.
phorum_cache_put('sanity_checks', 'dummy', 'dummy');
$entry = phorum_cache_get('sanity_checks', 'dummy');
phorum_cache_remove('sanity_checks', 'dummy');
if ($entry != 'dummy') return array(
PHORUM_SANITY_WARN,
"There might be a problem in Phorum's caching system.
Storing and retrieving a dummy key failed. If you
experience problems with your Phorum installation,
it might me because of this.",
"As a work around, you can disable the caching facilities
in the admin interface. Please contact the Phorum
developers to find out what the problem is.",
);
 
return array (PHORUM_SANITY_OK, NULL);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks/language.php
New file
0,0 → 1,67
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check if the files for all configured languages
// are available in the installation.
 
$phorum_check = "Language support";
 
function phorum_check_language() {
$PHORUM = $GLOBALS["PHORUM"];
 
$checked = array();
 
// Check for the default language file.
if (! file_exists("./include/lang/{$PHORUM["default_language"]}.php")) return array(
PHORUM_SANITY_WARN,
"Your default language is set to
\"".htmlspecialchars($PHORUM["default_language"])."\",
but the language file \"include/lang/".
htmlspecialchars($PHORUM["default_language"].".php")."\" is
not available on your system (anymore?).",
"Install the specified language file to make this default
language work or change the Default Language setting
under General Settings."
);
$checked[$PHORUM["default_language"]] = true;
 
// Check for the forum specific language file(s).
$forums = phorum_db_get_forums();
foreach ($forums as $id => $forum) {
if (!empty($forum["language"]) && !$checked[$forum["language"]] &&
!file_exists("./include/lang/{$forum["language"]}.php")) {
return array(
PHORUM_SANITY_WARN,
"The language for forum \"".
htmlspecialchars($forum["name"])."\" is set to
\"".htmlspecialchars($forum["language"])."\",
but the language file \"include/lang/".
htmlspecialchars($forum["language"].".php")."\" is
not available on your system (anymore?).",
"Install the specified language file to make this language
work or change the language setting for the forum."
);
}
$checked[$forum["language"]] = true;
}
 
// All checks are OK.
return array(PHORUM_SANITY_OK, NULL);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks/database.php
New file
0,0 → 1,62
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check the database connection and setup. We may want to have finer
// granulated checks here to give users with problem real good
// information about what should be fixed, but for that the
// database layer must be extended. For now it's just a simple
// connect check that will mostly just sit there and be pretty ;-)
//
// Extra checks to think about:
// - test if all needed permissions are set;
// - catch the error from the database on connection failure and
// try to give the user specific data for fixing the problem.
 
$phorum_check = "Database connection";
 
function phorum_check_database() {
$PHORUM = $GLOBALS["PHORUM"];
 
// Check if we have a database configuration available.
if (! isset($PHORUM["DBCONFIG"])) return array(
PHORUM_SANITY_CRIT,
"No database configuration was found in your environment.",
"You probably have not copied include/db/config.php.sample
to include/db/config.php. Read Phorum's install.txt for
installation instructions."
);
 
// Check if a connection can be made.
$connected = @phorum_db_check_connection();
if (! $connected) return array(
PHORUM_SANITY_CRIT,
"Connecting to the database failed.",
"Check your database settings in the file include/db/conf.php"
);
 
// Do a database layer specific check, if available.
if (function_exists("phorum_db_sanitychecks")) {
$res = phorum_db_sanitychecks();
if ($res[0] != PHORUM_SANITY_OK) return $res;
}
 
// All checks are OK.
return array(PHORUM_SANITY_OK, NULL);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks/upload_limits.php
New file
0,0 → 1,164
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check if the Phorum file uploading settings match the
// limits that are imposed by the system.
 
// TODO (document in faq / documentation)
// The upload size can be limited by Apache's LimitRequestBody directive,
// but we cannot check that one from PHP.
 
require_once('./include/format_functions.php'); // For phorum_filesize()
 
$phorum_check = "File uploading (personal files and attachments)";
 
function phorum_check_upload_limits() {
$PHORUM = $GLOBALS["PHORUM"];
 
// Keep track if uploads are used.
$upload_used = false;
 
// Get the maximum file upload size for PHP.
$php_max_upload = phorum_php_max_upload();
 
// Get the maximum packet size for the database.
// For determining the maximum allowed upload size,
// we have to take packet overhead into account.
$max_packetsize = phorum_db_maxpacketsize();
if ($max_packetsize == NULL) {
$db_max_upload = $php_max_upload;
} else {
$db_max_upload = phorum_db_maxpacketsize() * 0.6;
}
 
// Check limits for file uploading in personal profile.
if ($PHORUM["file_uploads"] && $PHORUM["max_file_size"]) {
$upload_used = true;
$res = phorum_single_check_upload_limits(
$PHORUM["max_file_size"]*1024,
"the Max File Size option for user file uploads " .
"(in their profile)",
$php_max_upload, $db_max_upload
);
if ($res != NULL) return $res;
}
 
// Check limits for attachment uploading in forums.
$forums = phorum_db_get_forums();
foreach ($forums as $id => $forum) {
if ($forum["max_attachments"] > 0 && $forum["max_attachment_size"]) {
$upload_used = true;
$res = phorum_single_check_upload_limits(
$forum["max_attachment_size"]*1024,
"the Max File Size option for uploading attachments
in the forum \"{$forum['name']}\"",
$php_max_upload, $db_max_upload
);
}
}
 
// No upload functionality found so far? Then we're done.
if (! $upload_used) return array(PHORUM_SANITY_OK, NULL);
 
// Check if the upload temp directory can be written.
$tmpdir = get_cfg_var('upload_tmp_dir');
if (!empty($tmpdir)) {
$fp = @fopen("$tmpdir/sanity_checks_dummy_uploadtmpfile", "w");
if (! $fp) return array(
PHORUM_SANITY_CRIT,
"The system is unable to write files
to PHP's upload tmpdir \"".htmlspecialchars($tmpdir)."\".
The system error was:<br/><br/>".
htmlspecialchars($php_errormsg).".",
"Change the upload_tmp_dir setting in your php.ini file
or give your webserver more permissions for the current
upload directory."
);
}
fclose($fp);
unlink("$tmpdir/sanity_checks_dummy_uploadtmpfile");
 
return array(PHORUM_SANITY_OK, NULL);
}
 
// ========================================================================
// Helper functions
// ========================================================================
 
// We have to check multiple upload limits. Using this function,
// we do not have to rebuild all error messages over and over
// again.
function phorum_single_check_upload_limits ($howmuch, $what, $maxphp, $maxdb)
{
// Check PHP limits.
if (!empty($maxphp) && $howmuch > $maxphp) return array(
PHORUM_SANITY_WARN,
"You have configured ".htmlspecialchars($what)." to ".
phorum_filesize($howmuch).". Your PHP installation only
supports ".phorum_filesize($maxphp).". Your users might
have problems with uploading their files because of this.",
"Raise the options post_max_size and upload_max_filesize in your
php.ini file to match the Max File Size option or lower this
configuration option for your forums."
);
 
// Check database limits.
if (!empty($maxdb) && $howmuch > $maxdb) return array(
PHORUM_SANITY_WARN,
"You have configured ".htmlspecialchars($what)." to ".
phorum_filesize($howmuch).". Your database only supports ".
phorum_filesize($maxdb).". Your users might have problems with
uploading their files because of this.",
"Configure your database to allow larger packets or lower the
Max File Size configuration option for your forums."
);
 
return NULL;
}
 
function phorum_php_max_upload()
{
// Determine the PHP system upload limit. The limit for
// maximum upload filesize is not the only thing we
// have to look at. We should also take the maximum
// POST size in account.
$pms = phorum_phpcfgsize2bytes(get_cfg_var('post_max_size'));
$umf = phorum_phpcfgsize2bytes(get_cfg_var('upload_max_filesize'));
$limit = ($umf > $pms ? $pms : $umf);
 
return $limit;
}
 
// Convert the size parameters that can be used in the
// PHP ini-file (e.g. 1024, 10k, 8M) to a number of bytes.
function phorum_phpcfgsize2bytes($val) {
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks/modules.php
New file
0,0 → 1,59
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check for possible collisions between modules.
 
$phorum_check = "Modules (hook collision checks)";
 
function phorum_check_modules() {
$PHORUM = $GLOBALS["PHORUM"];
 
// For some hooks, we only want one module enabled to
// prevent collision problems. This is a list of
// those specific hooks.
$only_single_mod_allowed = array(
'quote',
'send_mail',
);
 
// Check all hooks that only may appear once.
foreach ($only_single_mod_allowed as $hook) {
if (isset($PHORUM["hooks"][$hook]["mods"])) {
$mods = $PHORUM["hooks"][$hook]["mods"];
if (count($mods) > 1) return array(
PHORUM_SANITY_WARN,
"You have activated multiple modules that handle
Phorum's \"".htmlspecialchars($hook)."\" hook.
However, this hook is normally only handled by
one module at a time. Keeping all modules
activated might lead to some unexpected results.
The colliding modules are: ".
implode(" + ", $mods),
"You can ignore this message in case you
are sure that the modules can work together. Else,
make sure you have only one of these modules
enabled."
);
}
}
 
// All checks are OK.
return array(PHORUM_SANITY_OK, NULL);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/badwords.php
New file
0,0 → 1,131
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
$curr="NEW";
 
// retrieving the forum-info
$forum_list=phorum_get_forum_info(2);
 
$forum_list[0]="GLOBAL";
 
// conversion of old data if existing
if(isset($PHORUM["bad_words"]) && count($PHORUM['bad_words'])) {
print "upgrading badwords<br>";
foreach($PHORUM['bad_words'] as $key => $data) {
phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$data ,0 ,0);
unset($PHORUM["bad_words"][$key]);
}
phorum_db_update_settings(array("bad_words"=>$PHORUM["bad_words"]));
}
 
if(count($_POST) && $_POST["string"]!=""){
if($_POST["curr"]!="NEW"){
$ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,$_POST['curr']);
} else {
$ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,0);
}
 
if(!$ret){
$error="Database error while updating badwords.";
} else {
echo "Bad Word Added<br />";
}
}
 
if(isset($_GET["curr"])){
if(isset($_GET["delete"])){
phorum_db_del_banitem($_GET['curr']);
echo "Ban Item Deleted<br />";
} else {
$curr = $_GET["curr"];
}
}
if($curr!="NEW"){
extract(phorum_db_get_banitem($curr));
$title="Edit Bad Word Item";
$submit="Update";
} else {
settype($string, "string");
settype($type, "int");
settype($pcre, "int");
settype($forumid,"int");
$title="Add A Bad Word";
$submit="Add";
}
 
 
settype($string, "string");
settype($type, "int");
settype($pcre, "int");
 
if($error){
phorum_admin_error($error);
}
 
// load bad-words-list
$banlists=phorum_db_get_banlists();
$bad_words=$banlists[PHORUM_BAD_WORDS];
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post", $submit);
 
$frm->hidden("module", "badwords");
 
$frm->hidden("curr", "$curr");
 
$frm->addbreak($title);
 
$frm->addrow("Bad Word", $frm->text_box("string", $string, 50));
 
$frm->addrow("Valid for Forum", $frm->select_tag("forumid", $forum_list, $forumid));
 
$frm->show();
 
echo "<hr class=\"PhorumAdminHR\" />";
 
if(count($bad_words)){
 
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableHead\">Word</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
echo " <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
echo "</tr>\n";
 
foreach($bad_words as $key => $item){
$ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
echo "<tr>\n";
echo " <td class=\"".$ta_class."\">".htmlspecialchars($item[string])."</td>\n";
echo " <td class=\"".$ta_class."\">".$forum_list[$item["forum_id"]]."</td>\n";
echo " <td class=\"".$ta_class."\"><a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&delete=1\">Delete</a></td>\n";
echo "</tr>\n";
}
 
echo "</table>\n";
 
} else {
 
echo "No bad words in list currently.";
 
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/install.php
New file
0,0 → 1,353
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
if(!phorum_db_check_connection()){
echo "A database connection could not be established. Please edit include/db/config.php.";
return;
}
 
include_once "./include/admin/PhorumInputForm.php";
 
if(empty($_POST["step"])){
$step = 0;
} else {
$step = $_POST["step"];
}
 
if(count($_POST)){
 
// THIS IS THE WORK STEP
 
switch ($step){
 
case 5:
 
if(!empty($_POST["admin_user"]) && !empty($_POST["admin_pass"]) && !empty($_POST["admin_pass2"]) && !empty($_POST["admin_email"])){
if($_POST["admin_pass"]!=$_POST["admin_pass2"]){
echo "The password fields do not match<br />";
$step=4;
} elseif(phorum_user_check_login($_POST["admin_user"], $_POST["admin_pass"])){
if($PHORUM["user"]["admin"]){
echo "Admin user already exists and has permissions<br />";
} else {
echo "That user already exists but does not have admin permissions<br />";
$step=4;
}
} else {
 
// add the user
$user = array( "username"=>$_POST["admin_user"], "password"=>$_POST["admin_pass"], "email"=>$_POST["admin_email"], "active"=>1, "admin"=>1 );
 
if(!phorum_user_add($user)){
 
echo "There was an error adding the user.<br />";
$step=4;
}
 
// set the default http_path so we can continue.
if(!empty($_SERVER["HTTP_REFERER"])) {
$http_path=$_SERVER["HTTP_REFERER"];
} elseif(!empty($_SERVER['HTTP_HOST'])) {
$http_path="http://".$_SERVER['HTTP_HOST'];
$http_path.=$_SERVER['PHP_SELF'];
} else {
$http_path="http://".$_SERVER['SERVER_NAME'];
$http_path.=$_SERVER['PHP_SELF'];
}
phorum_db_update_settings(array("http_path"=>dirname($http_path)));
phorum_db_update_settings(array("system_email_from_address"=>$_POST["admin_email"]));
 
 
}
} else {
echo "Please fill in all fields.<br />";
$step=4;
}
 
break;
}
 
}
 
// THIS IS THE OUTPUT STEP
 
if($PHORUM["installed"]) $step=5;
 
switch ($step){
 
case 0:
 
$frm =& new PhorumInputForm ("", "post", "Continue ->");
$frm->addbreak("Welcome to Phorum");
$frm->addmessage("This wizard will setup Phorum on your server. The first step is to prepare the database. Phorum has already confirmed that it can connect to your database. Press continue when you are ready.");
$frm->hidden("module", "install");
$frm->hidden("step", "2");
$frm->show();
 
break;
 
case 2:
// ok, fresh install
 
$err=phorum_db_create_tables();
 
if($err){
$message="Could not create tables, database said:<blockquote>$err</blockquote>";
$message.="Your database user will need to have create table permissions. If you know what the error is (tables already exist, etc.) and want to continue, click the button below.";
} else {
$message="Tables created. Next we will check your cache settings. Press continue when ready.";
 
// setup vars for initial settings
$tmp_dir = (substr(__FILE__, 0, 1)=="/") ? "/tmp" : "C:\\Windows\\Temp";
 
$default_forum_options=array(
'forum_id'=>0,
'moderation'=>0,
'email_moderators'=>0,
'pub_perms'=>1,
'reg_perms'=>15,
'display_fixed'=>0,
'template'=>'default',
'language'=>'english',
'threaded_list'=>0,
'threaded_read'=>0,
'reverse_threading'=>0,
'float_to_top'=>1,
'list_length_flat'=>30,
'list_length_threaded'=>15,
'read_length'=>30,
'display_ip_address'=>0,
'allow_email_notify'=>0,
'check_duplicate'=>1,
'count_views'=>2,
'max_attachments'=>0,
'allow_attachment_types'=>'',
'max_attachment_size'=>0,
'max_totalattachment_size'=>0,
'vroot'=>0,
);
 
// insert the default module settings
// hooks
 
$hooks_initial=array(
'format'=>array(
'mods'=>array('smileys','bbcode'),
'funcs'=>array('phorum_mod_smileys','phorum_bb_code')
)
);
 
$mods_initial=array(
'html' =>0,
'replace'=>0,
'smileys'=>1,
'bbcode' =>1
);
 
// set initial settings
$settings=array(
"title" => "Phorum 5",
"cache" => "$tmp_dir",
"session_timeout" => "30",
"short_session_timeout" => "60",
"tight_security" => "0",
"session_path" => "/",
"session_domain" => "",
"admin_session_salt" => microtime(),
"cache_users" => "0",
"register_email_confirm" => "0",
"default_template" => "default",
"default_language" => "english",
"use_cookies" => "1",
"use_bcc" => "1",
"use_rss" => "1",
"internal_version" => "" . PHORUMINTERNAL . "",
"PROFILE_FIELDS" => array(array('name'=>"real_name",'length'=> 255, 'html_disabled'=>1)),
"enable_pm" => "1",
"user_edit_timelimit" => "0",
"enable_new_pm_count" => "1",
"enable_dropdown_userlist" => "1",
"enable_moderator_notifications" => "1",
"show_new_on_index" => "1",
"dns_lookup" => "1",
"tz_offset" => "0",
"user_time_zone" => "1",
"user_template" => "0",
"registration_control" => "1",
"file_uploads" => "0",
"file_types" => "",
"max_file_size" => "",
"file_space_quota" => "",
"file_offsite" => "0",
"system_email_from_name" => "",
"hide_forums" => "1",
"enable_new_pm_count" => "1",
"track_user_activity" => "86400",
"html_title" => "Phorum",
"head_tags" => "",
"cache_users" => 0,
"redirect_after_post" => "list",
"reply_on_read_page" => 1,
"status" => "normal",
"use_new_folder_style" => 1,
"default_forum_options" => $default_forum_options,
"hooks"=> $hooks_initial,
"mods" => $mods_initial
 
);
 
phorum_db_update_settings($settings);
 
// posting forum and test-message
 
// create a test forum
$forum=array(
"name"=>'Test Forum',
"active"=>1,
"description"=>'This is a test forum. Feel free to delete it or edit after installation.',
"template"=>'default',
"folder_flag"=>0,
"parent_id"=>0,
"list_length_flat"=>30,
"list_length_threaded"=>15,
"read_length"=>20,
"moderation"=>0,
"threaded_list"=>0,
"threaded_read"=>0,
"float_to_top"=>1,
"display_ip_address"=>0,
"allow_email_notify"=>1,
"language"=>'english',
"email_moderators"=>0,
"display_order"=>0,
"edit_post"=>1,
"pub_perms" => 1,
"reg_perms" => 15
);
 
$GLOBALS["PHORUM"]['forum_id']=phorum_db_add_forum($forum);
$GLOBALS["PHORUM"]['vroot']=0;
 
// create a test post
$test_message=array(
"forum_id" => $GLOBALS['PHORUM']["forum_id"],
"thread" => 0,
"parent_id" => 0,
"author" => 'Phorum Installer',
"subject" => 'Test Message',
"email" => '',
"ip" => '127.0.0.1',
"user_id" => 0,
"moderator_post" => 0,
"closed" => 0,
"status" => PHORUM_STATUS_APPROVED,
"sort" => PHORUM_SORT_DEFAULT,
"msgid" => '',
"body" => "This is a test message. You can delete it after install using the admin.\n\nPhorum 5 Team"
);
 
phorum_db_post_message($test_message);
 
include_once ("./include/thread_info.php");
 
phorum_update_thread_info($test_message["thread"]);
 
phorum_db_update_forum_stats(true);
 
}
 
$frm =& new PhorumInputForm ("", "post", "Continue ->");
$frm->addbreak("Creating tables....");
$frm->addmessage($message);
$frm->hidden("step", "6");
$frm->hidden("module", "install");
$frm->show();
 
break;
 
case 4:
 
$frm =& new PhorumInputForm ("", "post");
$frm->hidden("step", "5");
$frm->hidden("module", "install");
$frm->addbreak("Creating An Administrator");
$frm->addmessage("Please enter the following information. This can be your user information or you can create an administrator that is separate from yourself.<br /><br />Note: If you are using a pre-existing authentication database, please enter the username and password of the admin user that already exists.");
$admin_user = isset($_POST["admin_user"]) ? $_POST["admin_user"] : "";
$admin_email = isset($_POST["admin_email"]) ? $_POST["admin_email"] : "";
$frm->addrow("Admin User Name", $frm->text_box("admin_user", $admin_user, 30));
$frm->addrow("Admin Email Address", $frm->text_box("admin_email", $admin_email, 30));
$frm->addrow("Admin Password", $frm->text_box("admin_pass", "", 30, 0, true));
$frm->addrow("(again)", $frm->text_box("admin_pass2", "", 30, 0, true));
$frm->show();
 
break;
 
case 5:
 
phorum_db_update_settings( array("installed"=>1) );
echo "The setup is complete. You can now go to <a href=\"$_SERVER[PHP_SELF]\">the admin</a> and start making Phorum all your own.<br /><br /><strong>Here are some things you will want to look at:</strong><br /><br /><a href=\"$_SERVER[PHP_SELF]?module=settings\">The General Settings page</a><br /><br /><a href=\"$_SERVER[PHP_SELF]?module=mods\">Pre-installed modules</a><br /><br /><a href=\"docs/faq.txt\">The FAQ</a><br /><br /><a href=\"docs/performance.txt\">How to get peak performance from Phorum</a><br /><br /><strong>For developers:</strong><br /><br /><a href=\"docs/creating_mods.txt\">Module Creation</a><br /><br /><a href=\"docs/permissions.txt\">How Phorum permisssions work</a><br /><br /><a href=\"docs/CODING-STANDARDS\">The Phorum Team's codings standards</a>";
 
break;
 
case 6:
// try to figure out if we can write to the cache directory
$message = "";
error_reporting(0);
$err = false;
if ($fp = fopen($PHORUM["cache"] . "/phorum-install-test", "w+")) {
unlink($PHORUM["cache"] . "/phorum-install-test");
}
else {
// in this case the normal setting is wrong, so try ./cache
$PHORUM["cache"] = "./cache";
$settings = array("cache" => $PHORUM["cache"]);
if (!phorum_db_update_settings($settings)) {
$message .= "Database error updating settings.<br />";
$err = true;
}
elseif ($fp = fopen($PHORUM["cache"] . "/phorum-install-test", "w+")) {
unlink($PHORUM["cache"] . "/phorum-install-test");
}
else {
$err = true;
}
 
}
error_reporting(E_WARN);
if ($message == "") {
if($err){
$message.="Your cache directory is not writable. Please change the permissions on '/cache' inside the Phorum directory to allow writing. In Unix, you may have to use this command: chmod 777 cache<br /><br />If you want to continue anyway and set a cache directory manually, press continue. Note that you must do this, Phorum will not work without a valid cache.";
} else {
$message.="Cache directory set. Next we will create a user with administrator privileges. Press continue when ready.";
}
}
 
$frm =& new PhorumInputForm ("", "post", "Continue ->");
$frm->hidden("module", "install");
$frm->addbreak("Checking cache....");
$frm->addmessage($message);
$frm->hidden("step", "4");
$frm->show();
 
break;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/index.php
New file
0,0 → 1,25
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
exit();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/deleteforum.php
New file
0,0 → 1,68
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
if($_GET["confirm"]=="Yes"){
 
if($_GET["folder_flag"]){
$cur_folder_id=$_GET['forum_id'];
// handling vroots
$oldfolder_tmp=phorum_db_get_forums($cur_folder_id);
$oldfolder=array_shift($oldfolder_tmp);
 
if($oldfolder['parent_id'] > 0) { // is it a real folder?
$parent_folder=phorum_db_get_forums($oldfolder['parent_id']);
if($parent_folder[$oldfolder['parent_id']]['vroot'] > 0) { // is a vroot set?
// then set the vroot to the vroot of the parent-folder
phorum_admin_set_vroot($cur_folder_id,$parent_folder[$oldfolder['parent_id']]['vroot'],$cur_folder_id);
}
} else { // just default root ...
phorum_admin_set_vroot($cur_folder_id,0,$cur_folder_id);
}
// done with vroots
phorum_db_drop_folder($cur_folder_id);
$msg="The folder was deleted. All forums and folders in this folder have been moved to this folder's parent.";
} else {
phorum_db_drop_forum($_GET["forum_id"]);
$msg="The forum was deleted. All messages in that forum were deleted.";
}
 
} elseif($_GET["confirm"]=="No"){
 
$msg="No action was taken.";
 
} else {
 
$forums=phorum_db_get_forums((int)$_GET["forum_id"]);
$forum=array_shift($forums);
 
if($forum["folder_flag"]){
$msg="Are you sure you want to delete $forum[name]? All forums and folders in this folder will be moved to this folder's parent.";
} else {
$msg="Are you sure you want to delete $forum[name]? All messages in this forum will be deleted";
}
$msg.="<form action=\"$_SERVER[PHP_SELF]\" method=\"get\"><input type=\"hidden\" name=\"module\" value=\"$module\" /><input type=\"hidden\" name=\"forum_id\" value=\"$_GET[forum_id]\" /><input type=\"hidden\" name=\"folder_flag\" value=\"$forum[folder_flag]\" /><input type=\"submit\" name=\"confirm\" value=\"Yes\" />&nbsp;<input type=\"submit\" name=\"confirm\" value=\"No\" /></form>";
 
}
 
?>
<div class="PhorumInfoMessage"><?php echo $msg; ?></div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/file_purge.php
New file
0,0 → 1,62
<?php
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
include_once("./include/format_functions.php");
 
// Execute file purging.
if(count($_POST))
{
// Run a hook, so file purging can work for alternative
// file storage systems as well.
if (isset($PHORUM["hooks"]["admin_file_purge"])) {
$stale_files = phorum_db_file_purge_stale_files();
phorum_hook("admin_file_purge", $stale_files);
}
 
// Purge stale files from the database.
phorum_db_file_purge_stale_files(true);
}
 
// Get a list of stale files.
$purge_files = phorum_db_file_purge_stale_files();
 
include_once "./include/admin/PhorumInputForm.php";
$frm =& new PhorumInputForm ("", "post", count($purge_files) ? "Purge stale files now" : "Refresh screen");
 
$frm->hidden("module", "file_purge");
 
$frm->addbreak("Purging stale files...");
$frm->addmessage("If users write messages with attachments, but do not post them in the end, the attachment files will be left behind in the database. Using this maintenance tool, you can purge those stale files from your database.");
 
if (count($purge_files)) {
$frm->addbreak("There are currently " . count($purge_files) .
" stale files in the database");
foreach($purge_files as $id => $file) {
$frm->addrow(htmlspecialchars($file["filename"]), phorum_filesize($file["filesize"]));
}
} else {
$frm->addmessage("There are currently no stale files in the database");
}
 
$frm->show();
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/editfolder.php
New file
0,0 → 1,30
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
define("PHORUM_EDIT_FOLDER", 1);
 
if(empty($_REQUEST["forum_id"])){
phorum_admin_error("forum_id not set");
} else {
include "./include/admin/newfolder.php";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/status.php
New file
0,0 → 1,27
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
phorum_db_update_settings( array("status"=>$_POST["status"]) );
header("Location: $_SERVER[PHP_SELF]");
exit();
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/newfolder.php
New file
0,0 → 1,213
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
$setvroot=false; // is this folder set as vroot?
 
if(count($_POST)){
 
// set the defaults
 
foreach($_POST as $field=>$value){
 
switch($field){
 
case "name":
if(empty($value)){
$error="Please fill in Title";
}
break;
case "vroot":
// did we set this folder as vroot?
if($value > 0 &&
(isset($_POST['forum_id']) && $value != $_POST['forum_id'])) { // existing folder new vroot for everything below
$setvroot=true;
} elseif($value > 0 && !defined("PHORUM_EDIT_FOLDER")) { // new folder which is vroot for everything below
$setvroot=true;
}
break;
 
}
 
if($error) break;
 
}
 
if(empty($error)){
unset($_POST["module"]);
unset($_POST["vroot"]); // we set it separately below
 
if(defined("PHORUM_EDIT_FOLDER")){
$cur_folder_id=$_POST['forum_id'];
// we need the old folder for vroots ... see below
$oldfolder_tmp=phorum_db_get_forums($cur_folder_id);
$oldfolder=array_shift($oldfolder_tmp);
// update the folder
$res=phorum_db_update_forum($_POST);
} else {
$oldfolder=array('vroot'=>0,'parent_id'=>0);
// add the folder
$res=phorum_db_add_forum($_POST);
$cur_folder_id=$res;
}
 
if($res){ // other db-operations done, now doing the work for vroots
$cur_folder_tmp=phorum_db_get_forums($cur_folder_id);
$cur_folder=array_shift($cur_folder_tmp);
if(!$setvroot && (
($oldfolder['vroot'] && $oldfolder['vroot'] == $cur_folder_id) || // we had a vroot before but now we removed it
($oldfolder['parent_id'] != $cur_folder['parent_id']) // or we moved this folder somewhere else
)
)
{
// get the parent_id and set its vroot (if its a folder) to the desc folders/forums
if($cur_folder['parent_id'] > 0) { // is it a real folder?
$parent_folder=phorum_db_get_forums($cur_folder['parent_id']);
// then set the vroot to the vroot of the parent-folder (be it 0 or a real vroot)
phorum_admin_set_vroot($cur_folder_id,$parent_folder[$cur_folder['parent_id']]['vroot'],$cur_folder_id);
} else { // just default root ...
phorum_admin_set_vroot($cur_folder_id,0,$cur_folder_id);
}
// need to clear announcements in this vroot
$PHORUM['forum_id']=$oldfolder['vroot'];
$GLOBALS['PHORUM']['forum_id']=$oldfolder['vroot'];
$msg_array=phorum_db_get_message(PHORUM_SORT_ANNOUNCEMENT,'sort');
while(count($msg_array)) {
// set announcements to forum-id=0 and hidden ...
$new_msg=array('forum_id'=>0,'status'=>PHORUM_STATUS_HIDDEN);
phorum_db_update_message($msg_array['message_id'],$new_msg);
$msg_array=phorum_db_get_message(PHORUM_SORT_ANNOUNCEMENT,'sort');
}
 
// we have now set this folder as vroot
} elseif($setvroot && ($oldfolder['vroot']==0 || $oldfolder['vroot'] != $cur_folder_id)) {
if(!phorum_admin_set_vroot($cur_folder_id)) {
$error="Database error while setting virtual-root info.";
}
} // is there an else?
} else {
$error="Database error while adding/updating folder.";
}
}
 
if(empty($error)) {
phorum_redirect_by_url($_SERVER['PHP_SELF']);
exit();
}
 
foreach($_POST as $key=>$value){
$$key=$value;
}
 
} elseif(defined("PHORUM_EDIT_FOLDER")) {
 
$forum_settings = phorum_db_get_forums($_REQUEST["forum_id"]);
extract($forum_settings[$_REQUEST["forum_id"]]);
 
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post");
 
$folder_data=phorum_get_folder_info();
 
if(defined("PHORUM_EDIT_FOLDER")){
$frm->hidden("module", "editfolder");
$frm->hidden("forum_id", $forum_id);
$title="Edit Folder";
 
$this_folder=$folder_data[$_REQUEST["forum_id"]];
 
foreach($folder_data as $folder_id=> $folder){
 
// remove children from the list
if($folder_id!=$_REQUEST["forum_id"] && substr($folder, 0, strlen($this_folder)+2)!="$this_folder::"){
$folders[$folder_id]=$folder;
}
}
if($vroot == $forum_id) {
$vroot=1;
} else {
$foreign_vroot=$vroot;
$vroot=0;
}
 
} else {
$frm->hidden("module", "newfolder");
$title="Add A Folder";
 
$folders=$folder_data;
$vroot=0;
$active=1;
$template="default";
}
 
 
 
$frm->hidden("folder_flag", "1");
 
$frm->addbreak($title);
 
$frm->addrow("Folder Title", $frm->text_box("name", $name, 30));
 
$frm->addrow("Folder Description", $frm->textarea("description", $description, $cols=60, $rows=10, "style=\"width: 100%;\""), "top");
 
$frm->addrow("Folder", $frm->select_tag("parent_id", $folders, $parent_id));
 
$frm->addrow("Visible", $frm->select_tag("active", array("No", "Yes"), $active));
 
$frm->addbreak("Display Settings");
 
$frm->addrow("Template", $frm->select_tag("template", phorum_get_template_info(), $template));
 
$frm->addrow("Language", $frm->select_tag("language", phorum_get_language_info(), $language));
$frm->addrow("Virtual Root for descending forums/folders", $frm->checkbox("vroot","1","enabled",($vroot)?1:0));
if($foreign_vroot > 0) {
$frm->addrow("This folder is in the Virtual Root of:",$folders[$foreign_vroot]);
}
 
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/modadmin.php
New file
0,0 → 1,35
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
if(file_exists()){
 
$mod=$_REQUEST["mod"];
 
include_once("./mods/$mod/admin.php");
 
} else {
 
exit();
 
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/customprofile.php
New file
0,0 → 1,165
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
$curr="NEW";
$exists_already=false;
 
// reserved names for custom profile fields, extend as needed
$reserved_customfield_names=array('panel','name','value','error');
 
if(count($_POST) && $_POST["string"]!=""){
$_POST['string']=trim($_POST['string']);
 
 
if(!isset($_POST['html_disabled']))
$_POST['html_disabled']=0;
 
if($_POST['curr'] == 'NEW') {
// checking names of existing fields
foreach($PHORUM['PROFILE_FIELDS'] as $profile_field) {
if($profile_field['name'] == $_POST['string']) {
$exists_already = true;
break;
}
}
}
 
if(preg_match("/^[^a-z]/i", $_POST["string"]) || preg_match("/[^a-z0-9_]/i", $_POST["string"])){
$error="Field names can only contain letters, numbers and _. They must start with a letter.";
} elseif(in_array($_POST['string'],$reserved_customfield_names)) {
$error="This name is reserved for use in phorum itself. Please use a different name for your new custom profile-field.";
} elseif($exists_already) {
$error="A custom profile-field with that name exists. Please use a different name for your new custom profile-field.";
} else {
if(!isset($PHORUM['PROFILE_FIELDS']["num_fields"])) {
if(count($PHORUM['PROFILE_FIELDS'])) {
$PHORUM['PROFILE_FIELDS']["num_fields"]=count($PHORUM['PROFILE_FIELDS']);
} else {
$PHORUM['PROFILE_FIELDS']["num_fields"]=0;
}
}
 
if($_POST["curr"]!="NEW"){ // editing an existing field
$PHORUM["PROFILE_FIELDS"][$_POST["curr"]]['name']=$_POST["string"];
$PHORUM["PROFILE_FIELDS"][$_POST["curr"]]['length']=$_POST['length'];
$PHORUM["PROFILE_FIELDS"][$_POST["curr"]]['html_disabled']=$_POST['html_disabled'];
} else { // adding a new field
$PHORUM['PROFILE_FIELDS']["num_fields"]++;
$PHORUM["PROFILE_FIELDS"][$PHORUM['PROFILE_FIELDS']["num_fields"]]=array();
$PHORUM["PROFILE_FIELDS"][$PHORUM['PROFILE_FIELDS']["num_fields"]]['name']=$_POST["string"];
$PHORUM["PROFILE_FIELDS"][$PHORUM['PROFILE_FIELDS']["num_fields"]]['length']=$_POST['length'];
$PHORUM["PROFILE_FIELDS"][$PHORUM['PROFILE_FIELDS']["num_fields"]]['html_disabled']=$_POST['html_disabled'];
}
 
if(!phorum_db_update_settings(array("PROFILE_FIELDS"=>$PHORUM["PROFILE_FIELDS"]))){
$error="Database error while updating settings.";
} else {
echo "Profile Field Updated<br />";
}
 
}
 
}
 
if(isset($_GET["curr"])){
if(isset($_GET["delete"])){
unset($PHORUM["PROFILE_FIELDS"][$_GET["curr"]]);
phorum_db_update_settings(array("PROFILE_FIELDS"=>$PHORUM["PROFILE_FIELDS"]));
echo "Profile Field Deleted<br />";
} else {
$curr = $_GET["curr"];
}
}
 
 
if($curr!="NEW"){
$string=$PHORUM["PROFILE_FIELDS"][$curr]['name'];
$length=$PHORUM["PROFILE_FIELDS"][$curr]['length'];
$html_disabled=$PHORUM["PROFILE_FIELDS"][$curr]['html_disabled'];
$title="Edit Profile Field";
$submit="Update";
} else {
settype($string, "string");
$title="Add A Profile Field";
$submit="Add";
$length=255;
$html_disabled=1;
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post", $submit);
 
$frm->hidden("module", "customprofile");
 
$frm->hidden("curr", "$curr");
 
$frm->addbreak($title);
 
$frm->addrow("Field Name", $frm->text_box("string", $string, 50));
$frm->addrow("Field Length (Max. 65000)", $frm->text_box("length", $length, 50));
$frm->addrow("Disable HTML", $frm->checkbox("html_disabled",1,"Yes",$html_disabled));
 
$frm->show();
 
echo "This will only add the field to the list of allowed fields. You will need to edit the register and profile templates to actually allow users to use the fields. Use the name you enter here as the name property of the HTML form element.";
 
if($curr=="NEW"){
 
echo "<hr class=\"PhorumAdminHR\" />";
if(isset($PHORUM['PROFILE_FIELDS']["num_fields"]))
unset($PHORUM['PROFILE_FIELDS']["num_fields"]);
 
if(count($PHORUM["PROFILE_FIELDS"])){
 
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableHead\">Field</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Length</td>\n";
echo " <td class=\"PhorumAdminTableHead\">HTML disabled</td>\n";
echo " <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
echo "</tr>\n";
 
foreach($PHORUM["PROFILE_FIELDS"] as $key => $item){
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableRow\">".$item['name']."</td>\n";
echo " <td class=\"PhorumAdminTableRow\">".$item['length']."</td>\n";
echo " <td class=\"PhorumAdminTableRow\">".($item['html_disabled']?"Yes":"No")."</td>\n";
echo " <td class=\"PhorumAdminTableRow\"><a href=\"$_SERVER[PHP_SELF]?module=customprofile&curr=$key&?edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=customprofile&curr=$key&delete=1\">Delete</a></td>\n";
echo "</tr>\n";
}
 
echo "</table>\n";
 
} else {
 
echo "No custom fields currently allowed.";
 
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/footer.php
New file
0,0 → 1,27
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
?>
</div>
</td>
</tr>
</table>
</body>
</html>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/deletefolder.php
New file
0,0 → 1,24
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
include("./include/admin/deleteforum.php");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/editforum.php
New file
0,0 → 1,30
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
define("PHORUM_EDIT_FORUM", 1);
 
if(empty($_REQUEST["forum_id"])){
phorum_admin_error("forum_id not set");
} else {
include "./include/admin/newforum.php";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/settings.php
New file
0,0 → 1,301
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM_ADMIN" ) ) return;
 
$error = "";
 
if ( count( $_POST ) ) {
// set the defaults
foreach( $_POST as $field => $value ) {
switch ( $field ) {
case "title":
 
if ( empty( $value ) ) {
$_POST[$field] = "Phorum 5";
}
 
break;
 
case "http_path":
 
if ( empty( $value ) ) {
$_POST[$field] = dirname( $_SERVER["HTTP_REFERER"] );
} elseif ( !preg_match( "/^(http|https):\/\/(([a-z0-9][a-z0-9_-]*)(\.[a-z0-9][a-z0-9_-]*)+)(:(\d+))?/i", $value ) && !preg_match( "/^(http|https):\/\/[a-z0-9][a-z0-9_-]*(:\d+)?\//i", $value ) ) {
$error = "The provided HTTP Path is not a valid URL.";
}
 
break;
 
case "cache":
 
if ( empty( $value ) ) {
$_POST[$field] = "/tmp";
} elseif ( !file_exists( $value ) ) {
$error = "This cache directory does not exist. Please create it with the proper permissions.";
}
 
break;
 
case "session_timeout":
 
$_POST[$field] = (int)$_POST[$field];
 
break;
 
case "short_session_timeout":
 
$_POST[$field] = (int)$_POST[$field];
 
// impose a 5 minute minimum on this field for sanity reasons
if($_POST[$field]<5) $_POST[$field];
 
break;
 
case "session_path":
 
if ( empty( $value ) ) {
$_POST[$field] = "/";
} elseif ( $value[0] != "/" ) {
$error = "Session Path must start with a /";
}
 
break;
 
case "session_domain":
 
if ( !empty( $value ) && !stristr( $_POST["http_path"], $value ) ) {
$error = "Session Domain must be part of the domain in HTTP Path or empty.";
}
 
break;
 
case "system_email_from_address":
 
if ( empty( $value ) ) {
$error = "You must supply an email address for system emails to use as a from address.";
}
 
break;
 
case "max_file_size":
 
settype( $_POST[$field], "int" );
 
break;
 
case "file_space_quota":
 
settype( $_POST[$field], "int" );
 
break;
 
case "file_types":
 
$_POST[$field] = strtolower( $value );
 
break;
case "cache_users":
if ( empty( $value ) ) {
$_POST[$field] = 0;
}
 
}
 
if ( $error ) break;
}
 
if ( empty( $error ) ) {
unset( $_POST["module"] );
 
if ( phorum_db_update_settings( $_POST ) ) {
phorum_redirect_by_url($_SERVER['PHP_SELF']);
exit();
} else {
$error = "Database error while updating settings.";
}
}
}
 
if ( $error ) {
phorum_admin_error( $error );
}
// create the time zone drop down array
for( $x = -23;$x <= 23;$x++ ) {
$tz_range[$x] = $x;
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm = &new PhorumInputForm ( "", "post" );
 
$frm->addbreak( "Phorum General Settings" );
 
$frm->hidden( "module", "settings" );
 
$row=$frm->addrow( "Phorum Title", $frm->text_box( "title", $PHORUM["title"], 50 ) );
 
$row=$frm->addrow( "DNS Lookups", $frm->select_tag( "dns_lookup", array( "No", "Yes" ), $PHORUM["dns_lookup"] ) );
 
$row=$frm->addrow( "Use Cookies", $frm->select_tag( "use_cookies", array( "No", "Yes" ), $PHORUM["SETTINGS"]["use_cookies"] ) );
 
$row=$frm->addrow( "Hide Forums", $frm->select_tag( "hide_forums", array( "No", "Yes" ), $PHORUM["hide_forums"] ) );
$frm->addhelp($row, "Hide Forums", "By setting this to Yes, forums that users are not allowed to read will be hidden from them in the forums list." );
 
$row=$frm->addrow( "Show New Count in Forum List", $frm->select_tag( "show_new_on_index", array( "No", "Yes" ), $PHORUM["show_new_on_index"] ) );
 
$row=$frm->addrow( "Folder/Forum display style", $frm->select_tag( "use_new_folder_style", array( "Classic", "New" ), $PHORUM["use_new_folder_style"] ) );
$frm->addhelp($row, "Folder/Forum display style", "Since version 3, Phorum has included folders. Until version 5.1, forums inside folders did not show until you clicked on the folder. In 5.1, the list of forums in a folder can now be shown under that folder in the forum list. This allows admins to organize a large list of forums all on one page." );
 
$row=$frm->addrow( "Enable Moderator Notifications", $frm->select_tag( "enable_moderator_notifications", array( "No", "Yes" ), $PHORUM["enable_moderator_notifications"] ) );
$frm->addhelp($row, "Enable Moderator Notifications", "By setting this to Yes, Phorum will display notice to the various kinds of moderators when they have a new item that requires their attention. For example, message moderators will see a notice whenever there is an unapproved message." );
 
$row=$frm->addrow( "User Post Edit Time Limit (minutes)", $frm->text_box( "user_edit_timelimit", $PHORUM["user_edit_timelimit"], 10) );
$frm->addhelp($row, "User Post Edit Time Limit (minutes)", "If set to a value larger then 0, this acts as a time limit for post editing. Users will only be able to edit their own posts within this time limit. This only applies if a user has the necessary permissions to edit their post, and does not affect moderators." );
 
$row=$frm->addrow( "Reply form appears", $frm->select_tag( "reply_on_read_page", array( "1"=>"On the read page", "0"=>"On a separate page" ), $PHORUM["reply_on_read_page"] ) );
 
$row=$frm->addrow( "After posting goto", $frm->select_tag( "redirect_after_post", array( "list"=>"Message List Page", "read"=>"Message Read Page" ), $PHORUM["redirect_after_post"] ) );
 
$row=$frm->addrow( "Database error handling", $frm->select_tag( "error_logging", array( "screen"=>"Errors will be shown on the screen", "file"=>"Errors will go to a logfile (".$PHORUM['cache']."/phorum-sql-errors.log)", "mail"=> "Errors will be emailed to the system email address"), $PHORUM["error_logging"] ) );
 
$frm->addbreak( "HTML Settings" );
 
$row=$frm->addrow( "Phorum HTML Title", $frm->text_box( "html_title", $PHORUM["html_title"], 50 ) );
 
$row=$frm->addrow( "Phorum Head Tags", $frm->textarea( "head_tags", $PHORUM["head_tags"], 30, 5, "style='width: 100%'" ) );
 
$row=$frm->addrow( "Show and allow RSS-links", $frm->select_tag( "use_rss", array( "No", "Yes" ), $PHORUM["use_rss"] ) );
 
$frm->addbreak( "File/Path Settings" );
 
$row=$frm->addrow( "HTTP Path", $frm->text_box( "http_path", $PHORUM["http_path"], 30 ) );
$frm->addhelp($row, "HTTP Path", "This is the base url of your Phorum." );
 
$row=$frm->addrow( "Disabled URL", $frm->text_box( "disabled_url", $PHORUM["disabled_url"], 50 ) );
$frm->addhelp($row, "Disabled URL", "This url will be redirected to when the Phorum status is disabled. If no URL is given, a message in English will be displayed." );
 
$row=$frm->addrow( "Cache Directory", $frm->text_box( "cache", $PHORUM["cache"], 30 ) );
$frm->addhelp($row, "Cache Directory", "Phorum caches its templates for faster use later. This setting is the directory where Phorum stores that cache. Most users will be fine using their servers temp directory. If your server uses PHP Safe Mode, you will need to create a directory under your Phorum directory and make it writable by the web server." );
 
$frm->addbreak("Cache Settings");
$row=$frm->addrow( "Enable Caching Userdata:", $frm->select_tag( "cache_users", array( "No", "Yes" ), $PHORUM["cache_users"] ) );
//$row=$frm->addrow( "Enable Caching Newflags:", $frm->select_tag( "cache_newflags", array( "No", "Yes" ), $PHORUM["cache_newflags"] ) );
 
$frm->addbreak( "Date Options" );
 
$row=$frm->addrow( "Time Zone Offset", $frm->select_tag( "tz_offset", $tz_range, $PHORUM["tz_offset"] ) );
$frm->addhelp($row, "Time Zone Offset", "If you and/or your users are in a different time zone than the server, you can have the default displayed time adjusted by using this option." );
 
$frm->addbreak( "Cookie/Session Settings" );
 
$row=$frm->addrow( "Main Session Timeout (days)", $frm->text_box( "session_timeout", $PHORUM["session_timeout"], 10 ) );
$frm->addhelp($row, "Session Timeout", "When users log in to your Phorum, they are issued a cookie. You can set this timeout to the number of days that you want the cookie to stay on the users computer. If you set it to 0, the cookie will only last as long as the user has the browser open." );
 
$row=$frm->addrow( "Session Path (start with /)", $frm->text_box( "session_path", $PHORUM["session_path"], 30 ) );
$frm->addhelp($row, "Session Path", "When cookies are sent to client's browser, part of the cookie determines the path (url) for which the cookies are valid. For example, if the url is http://example.com/phorum, you could set the path to /phorum. Then, the users browser would only send the cookie information when the user accessed the Phorum. You could also use simply / and the cookie info will be sent for any page on your site. This could be useful if you want to use Phorum's login system for other parts of your site." );
 
$row=$frm->addrow( "Session Domain", $frm->text_box( "session_domain", $PHORUM["session_domain"], 30 ) );
$frm->addhelp($row, "Session Domain", "Most likely, you can leave this blank. If you know you need to use a different domain (like you use forums.example.com, you may want to just use example.com as the domain), you may enter it here." );
 
$row=$frm->addrow( "Track User Usage", $frm->select_tag( "track_user_activity", array( 0=>"Never", 86400=>"Once per day", 3600=>"Once per hour", 600=>"Once per 5 minutes", 1=>"Constantly" ), $PHORUM["track_user_activity"] ) );
$frm->addhelp($row, "Track User Usage", "When set the last time a user accessed the Phorum will be recorded as often as you have decided upon. This will require constant updates to your database. If you have a busy forum on weak equipment, this may be bad thing to set to low." );
 
$frm->addbreak( "Tighter Security" );
 
$row=$frm->addrow( "Enable Tighter Security", $frm->select_tag( "tight_security", array( "No", "Yes" ), $PHORUM["tight_security"] ) );
$frm->addhelp($row, "Enable Tighter Security", "Tight security in Phorum will require that users confirm their login information from time to time before posting messages, accessing private messages or using their Control Center. The length of time is determined by Short Session Timeout." );
 
$row=$frm->addrow( "Short Session Timeout (minutes)", $frm->text_box( "short_session_timeout", $PHORUM["short_session_timeout"], 10 ) );
$frm->addhelp($row, "Short Session Timeout", "When tight security is enabled, the users will be issued a second cookie when the type in their login information. If the user does not use the site for the period of time you set here, they will have to re-enter their login information before posting messages, accessing private messages or using their Control Center. They will still be allowed to read the Phorum as long as their Main Session is still good. The time is minutes. The minimum is 5 minutes. Otherwise, your users will be very angry at you.<br /><br />P.S. 1 day = 1440 minutes" );
 
$frm->addbreak( "User Settings" );
 
$row=$frm->addrow( "Allow Time Zone Selection", $frm->select_tag( "user_time_zone", array( "No", "Yes" ), $PHORUM["user_time_zone"] ) );
 
$row=$frm->addrow( "Allow Template Selection", $frm->select_tag( "user_template", array( "No", "Yes" ), $PHORUM["user_template"] ) );
 
$reg_con_arr = array(
 
PHORUM_REGISTER_INSTANT_ACCESS => "None needed",
 
PHORUM_REGISTER_VERIFY_EMAIL => "Verify via email",
 
PHORUM_REGISTER_VERIFY_MODERATOR => "Verified by a moderator",
 
PHORUM_REGISTER_VERIFY_BOTH => "Verified by a moderator and via email"
 
);
 
$row=$frm->addrow( "Registration Verification", $frm->select_tag( "registration_control", $reg_con_arr, $PHORUM["registration_control"] ) );
 
$upload_arr = array(
 
PHORUM_UPLOADS_SELECT => "Off",
 
PHORUM_UPLOADS_REG => "On",
 
);
 
$row=$frm->addrow( "File Uploads:", $frm->select_tag( "file_uploads", $upload_arr, $PHORUM["file_uploads"] ) );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Types (eg. gif;jpg)", $frm->text_box( "file_types", $PHORUM["file_types"], 30 ) );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max File Size (KB)", $frm->text_box( "max_file_size", $PHORUM["max_file_size"], 30 ) );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Space Quota (KB)", $frm->text_box( "file_space_quota", $PHORUM["file_space_quota"], 30 ) );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Allow Off Site Links", $frm->select_tag( "file_offsite", array( "No", "Yes" ), $PHORUM["file_offsite"] ) );
$frm->addhelp($row, "&nbsp;&nbsp;&nbsp;Allow Off Site Links", "You may not want to allow other web sites to link to files that users upload to your forums. If not, set this to No. If you want to use links on other parts of your web site or only specific web sites, you will need to use your web server's security features to accomplish this. For Apache users, you can reference <i>Prevent \"Image Theft\"</i> at http://httpd.apache.org/docs/env.html#examples." );
 
$row=$frm->addrow( "Private Messaging:", $frm->select_tag( "enable_pm", array( "Off", "On" ), $PHORUM["enable_pm"] ) );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Count New Private Messages", $frm->select_tag( "enable_new_pm_count", array( "No", "Yes" ), $PHORUM["enable_new_pm_count"] ) );
$frm->addhelp($row, "Count New Private Messages", "By setting this to Yes, Phorum will check if a user has new private messages, and display an indicator. On a Phorum with a lot of users and private messages, this may hurt performance. This option has no effect if Private Messaging is disabled." );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Enable Drop-down User List", $frm->select_tag( "enable_dropdown_userlist", array( "No", "Yes" ), $PHORUM["enable_dropdown_userlist"] ) );
$frm->addhelp($row, "Enable Drop-down User List", "By setting this to Yes, Phorum will display a drop-down list of users instead of an empty text box on pages where you can select a user. Two examples of such pages are when sending a private message, and when adding users to a group in the group moderation page. This option should be disabled if you have a large number of users, as a list of thousands of users will slow performance dramatically." );
 
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max number of stored messages", $frm->text_box( "max_pm_messagecount", $PHORUM["max_pm_messagecount"], 30 ) );
$frm->addhelp($row, "Max number of stored messages", "This is the maximum number of private messages that a user may store on the server. The number of private messages is the total of all messages in all PM folders together. Setting this value to zero will allow for unlimited messages.");
 
$frm->addbreak( "General Defaults" );
 
$row=$frm->addrow( "Default Template", $frm->select_tag( "default_template", phorum_get_template_info(), $PHORUM["default_template"] ) );
 
$row=$frm->addrow( "Default Language", $frm->select_tag( "default_language", phorum_get_language_info(), $PHORUM["default_language"] ) );
 
$frm->addbreak( "System Email Settings" );
 
$row=$frm->addrow( "System Emails From Name", $frm->text_box( "system_email_from_name", $PHORUM["system_email_from_name"], 30 ) );
 
$row=$frm->addrow( "System Emails From Address", $frm->text_box( "system_email_from_address", $PHORUM["system_email_from_address"], 30 ) );
 
$row=$frm->addrow( "Use BCC in sending mails:", $frm->select_tag( "use_bcc", array( "No", "Yes" ), $PHORUM["use_bcc"] ) );
 
$row=$frm->addrow( "Ignore Admin for moderator-emails:", $frm->select_tag( "email_ignore_admin", array( "No", "Yes" ), $PHORUM["email_ignore_admin"] ) );
$frm->addhelp($row, "&nbsp;&nbsp;&nbsp;Ignore Admin for moderator-emails", "If you select yes for this option, then the moderator-notifications and report-message emails will not be sent to the admininistrator, only to moderators" );
 
// calling mods
$frm=phorum_hook("admin_general", $frm);
 
$frm->show();
 
?>
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/users.php
New file
0,0 → 1,461
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
include('./include/format_functions.php');
 
 
$error="";
 
if(count($_POST)){
 
 
if( isset($_POST['action']) && $_POST['action'] == "deleteUsers") {
 
$count=count($_POST['deleteIds']);
if($count > 0) {
foreach($_POST['deleteIds'] as $id => $deluid) {
phorum_user_delete($deluid);
}
phorum_admin_okmsg("$count User(s) deleted.");
}
 
} else {
 
$user_data=$_POST;
 
switch( $_POST["section"] ) {
 
 
case "forums":
 
if($_POST["new_forum"]){
if(!is_array($_POST["new_forum_permissions"])){
$permission=0;
} else {
$permission = 0;
foreach($_POST["new_forum_permissions"] as $perm=>$check){
$permission = $permission | $perm;
}
}
 
$user_data["forum_permissions"][$_POST["new_forum"]]=$permission;
}
 
if(isset($_POST["delforum"])){
foreach($_POST["delforum"] as $fid=>$val){
unset($user_data["forum_permissions"][$fid]);
unset($_POST["forums"][$fid]);
}
}
 
if(isset($_POST["forums"])){
foreach($_POST["forums"] as $forum_id){
$permission=0;
 
if(isset($user_data["forum_permissions"][$forum_id])){
foreach($user_data["forum_permissions"][$forum_id] as $perm=>$check){
$permission = $permission | $perm;
}
}
 
$user_data["forum_permissions"][$forum_id]=$permission;
}
}
 
if(empty($user_data["forum_permissions"])) $user_data["forum_permissions"]=array();
 
unset($user_data["delforum"]);
unset($user_data["new_forum"]);
unset($user_data["new_forum_permissions"]);
 
break;
 
case "groups":
$groupdata = array();
 
if($_POST["new_group"]){
// set the new group permission to approved
$groupdata[$_POST["new_group"]] = PHORUM_USER_GROUP_APPROVED;
}
 
if(isset($_POST["group_perm"])){
foreach($_POST["group_perm"] as $group_id=>$perm){
// as long as we aren't removing them from the group, accept other values
if ($perm != PHORUM_USER_GROUP_REMOVE){
$groupdata[$group_id] = $perm;
}
}
}
 
phorum_user_save_groups($_POST["user_id"], $groupdata);
break;
}
 
if(isset($_POST['password1']) && !empty($_POST['password1']) && !empty($_POST['password2']) && $_POST['password1'] != $_POST['password2']) {
$error="Passwords don't match!";
} elseif(!empty($_POST['password1']) && !empty($_POST['password2'])) {
$user_data['password']=$_POST['password1'];
}
 
// clean up
unset($user_data["module"]);
unset($user_data["section"]);
unset($user_data["password1"]);
unset($user_data["password2"]);
 
if(empty($error)){
phorum_user_save($user_data);
phorum_admin_okmsg("User Saved");
}
}
 
}
 
if ($error) {
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
include_once "./include/profile_functions.php";
include_once "./include/users.php";
 
if(!defined("PHORUM_ORIGINAL_USER_CODE") || PHORUM_ORIGINAL_USER_CODE!==true){
echo "Phorum User Admin only works with the Phorum User System.";
return;
}
 
if(!isset($_GET["edit"]) && !isset($_POST['section'])){
 
if(empty($_REQUEST["user_id"])){
 
$frm =& new PhorumInputForm ("", "get", "Search");
 
$frm->addbreak("Phorum User Admin");
 
$frm->hidden("module", "users");
 
$frm->addrow("Search", "Username or email contains: " . $frm->text_box("search", htmlspecialchars($_REQUEST["search"]), 30) . " &bull; <a href=\"{$_SERVER['PHP_SELF']}?module=users&search=\">Find All Users</a>");
 
$frm->addrow("", "Post count " .
$frm->select_tag("posts_op", array("gte" => ">=", "lte" => "<="), $_REQUEST["posts_op"]) .
$frm->text_box("posts", htmlspecialchars($_REQUEST["posts"]), 5) .
" and last active " .
// these are flipped because we're going back in time
$frm->select_tag("lastactive_op", array("gte" => "<=", "lte" => ">="), $_REQUEST["lastactive_op"]) .
$frm->text_box("lastactive", htmlspecialchars($_REQUEST["lastactive"]), 5) . " days ago");
$frm->show();
}
 
?>
<hr class=\"PhorumAdminHR\" />
 
<script type="text/javascript">
<!--
function CheckboxControl(form, onoff) {
for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].type == "checkbox")
form.elements[i].checked = onoff;
}
// -->
</script>
<?php
 
$search=$_REQUEST["search"];
 
$url_safe_search=urlencode($_REQUEST["search"]);
$url_safe_search.="&posts=".urlencode($_REQUEST["posts"]);
$url_safe_search.="&posts_op=".urlencode($_REQUEST["posts_op"]);
$url_safe_search.="&lastactive=".urlencode($_REQUEST["lastactive"]);
$url_safe_search.="&lastactive_op=".urlencode($_REQUEST["lastactive_op"]);
 
$users=phorum_db_search_users($_REQUEST["search"]);
 
if (isset($_REQUEST["posts"]) && $_REQUEST["posts"] != "" && $_REQUEST["posts"] >= 0) {
$cmpfn = phorum_admin_gen_compare($_REQUEST["posts_op"]);
$users = phorum_admin_filter_arr($users, "posts", $_REQUEST["posts"], $cmpfn);
}
 
if(isset($_REQUEST["lastactive"]) && $_REQUEST["lastactive"] != "" && $_REQUEST["lastactive"] >= 0) {
$time = time() - ($_REQUEST["lastactive"] * 86400);
$cmpfn = phorum_admin_gen_compare($_REQUEST["lastactive_op"]);
$users = phorum_admin_filter_arr($users, "date_last_active", $time, $cmpfn);
}
 
$total=count($users);
 
// count active
$total_active=0;
$total_poster=0;
foreach($users as $user){
if ($user['active']==1) {
$total_active++;
if (intval($user['posts'])) $total_poster++;
}
}
 
 
settype($_REQUEST["start"], "integer");
 
$display=30;
 
$users=array_slice($users, $_REQUEST["start"], $display);
 
if(count($users)) {
 
$nav="";
 
if($_REQUEST["start"]>0){
$old_start=$_REQUEST["start"]-$display;
$nav.="<a href=\"$_SERVER[PHP_SELF]?module=users&search=$url_safe_search&start=$old_start\">Previous Page</a>";
}
 
$nav.="&nbsp;&nbsp;";
 
if($_REQUEST["start"]+$display<$total){
$new_start=$_REQUEST["start"]+$display;
$nav.="<a href=\"$_SERVER[PHP_SELF]?module=users&search=$url_safe_search&start=$new_start\">Next Page</a>";
}
 
echo <<<EOT
<form name="UsersForm" action="{$_SERVER['PHP_SELF']}" method="post">
<input type="hidden" name="module" value="users">
<input type="hidden" name="action" value="deleteUsers">
<table border="0" cellspacing="1" cellpadding="0"
class="PhorumAdminTable" width="100%">
<tr>
<td>$total users found ($total_active active, $total_poster posting)</td>
<td colspan="3">Showing $display users at a time
<td colspan="2" align="right">$nav</td>
</tr>
<tr>
<td class="PhorumAdminTableHead">User</td>
<td class="PhorumAdminTableHead">Email</td>
<td class="PhorumAdminTableHead">Status</td>
<td class="PhorumAdminTableHead">Posts</td>
<td class="PhorumAdminTableHead">Last Activity</td>
<td class="PhorumAdminTableHead">Delete</td>
</tr>
EOT;
 
foreach($users as $user){
 
switch($user['active']){
 
case PHORUM_USER_ACTIVE:
$status = "Active";
break;
 
case PHORUM_USER_PENDING_EMAIL:
case PHORUM_USER_PENDING_BOTH:
$status = "Pending Confirmation";
break;
 
case PHORUM_USER_PENDING_MOD:
$status = "Pending Moderator Approval";
 
default:
$status = "Deactivated";
}
 
$posts = intval($user['posts']);
 
$ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
 
echo "<tr>\n";
echo " <td class=\"".$ta_class."\"><a href=\"$_SERVER[PHP_SELF]?module=users&user_id={$user['user_id']}&edit=1\">".htmlspecialchars($user['username'])."</a></td>\n";
echo " <td class=\"".$ta_class."\">".htmlspecialchars($user['email'])."</td>\n";
echo " <td class=\"".$ta_class."\">{$status}</td>\n";
echo " <td class=\"".$ta_class."\" style=\"text-align:right\">{$posts}</td>\n";
echo " <td class=\"".$ta_class."\" align=\"right\">".(intval($user['date_last_active']) ? strftime($PHORUM['short_date'], intval($user['date_last_active'])) : "&nbsp;")."</td>\n";
echo " <td class=\"".$ta_class."\"><input type=\"checkbox\" name=\"deleteIds[]\" value=\"{$user['user_id']}\"></td>\n";
echo "</tr>\n";
}
 
echo <<<EOT
<tr>
<td colspan="6" align="right">
<input type="button" value="Check All"
onClick="CheckboxControl(this.form, true);">
<input type="button" value="Clear All"
onClick="CheckboxControl(this.form, false);">
<input type="submit" name="submit" value="Delete Selected Users"
onClick="return confirm('Really delete the selected user(s)?')">
</td>
</tr>
</table>
</form>
EOT;
 
} else {
 
echo "No Users Found.";
 
}
 
}
 
// display edit form
if(isset($_REQUEST["user_id"])){
 
$user=phorum_user_get($_REQUEST["user_id"]);
 
if(count($user)){
 
$frm =& new PhorumInputForm ("", "post", "Update");
 
$frm->hidden("module", "users");
 
$frm->hidden("section", "main");
 
$frm->hidden("user_id", $_REQUEST["user_id"]);
 
$frm->addbreak("Edit User");
 
$frm->addrow("User Name", htmlspecialchars($user["username"])."&nbsp;&nbsp;<a href=\"#forums\">Edit Forum Permissions</a>&nbsp;&nbsp;<a href=\"#groups\">Edit Groups</a>");
 
$frm->addrow("Email", $frm->text_box("email", $user["email"], 50));
$frm->addrow("Password (Enter to change)", $frm->text_box("password1",""));
$frm->addrow("Password (Confirmation)", $frm->text_box("password2",""));
 
 
$frm->addrow("Signature", $frm->textarea("signature", htmlspecialchars($user["signature"])));
 
$frm->addrow("Active", $frm->select_tag("active", array("No", "Yes"), $user["active"]));
 
$frm->addrow("Administrator", $frm->select_tag("admin", array("No", "Yes"), $user["admin"]));
 
$frm->addrow("Registration Date", phorum_date("%m/%d/%Y %I:%M%p",$user['date_added']));
 
$row=$frm->addrow("Date last active", phorum_date("%m/%d/%Y %I:%M%p",$user['date_last_active']));
 
$frm->addhelp($row, "Date last active", "This shows the date, when the user was last seen in the forum. Check your setting on \"Track user usage\" in the \"General Settings\". As long as this setting is not enabled, the activity will not be tracked.");
 
 
$frm->show();
 
echo "<br /><hr class=\"PhorumAdminHR\" /><br /><a name=\"forums\"></a>";
 
$frm =& new PhorumInputForm ("", "post", "Update");
 
$frm->hidden("user_id", $_REQUEST["user_id"]);
 
$frm->hidden("module", "users");
 
$frm->hidden("section", "forums");
 
$row=$frm->addbreak("Edit Forum Permissions");
 
$frm->addhelp($row, "Forum Permissions", "These are permissions set exclusively for this user. You need to grant all permisssions you want the user to have for a forum here. No permissions from groups or a forum's properties will be used once the user has specific permissions for a forum.");
 
$forums=phorum_db_get_forums();
 
$perm_frm = $frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_READ."]", 1, "Read")."&nbsp;&nbsp;".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply")."&nbsp;&nbsp;".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics")."&nbsp;&nbsp;".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts")."<br />".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files")."<br />".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages")."&nbsp;&nbsp;".
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")."&nbsp;&nbsp;";
 
$arr[]="Add A Forum...";
foreach($forums as $forum_id=>$forum){
if(!isset($user["forum_permissions"][$forum_id]))
$arr[$forum_id]=$forum["name"];
}
 
if(count($arr)>1)
$frm->addrow($frm->select_tag("new_forum", $arr), $perm_frm);
 
 
if(is_array($user["forum_permissions"])){
foreach($user["forum_permissions"] as $forum_id=>$perms){
$perm_frm = $frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_READ."]", 1, "Read", ($perms & PHORUM_USER_ALLOW_READ))."&nbsp;&nbsp;".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", ($perms & PHORUM_USER_ALLOW_REPLY))."&nbsp;&nbsp;".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics", ($perms & PHORUM_USER_ALLOW_NEW_TOPIC))."&nbsp;&nbsp;".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts", ($perms & PHORUM_USER_ALLOW_EDIT))."<br />".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files", ($perms & PHORUM_USER_ALLOW_ATTACH))."<br />".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages", ($perms & PHORUM_USER_ALLOW_MODERATE_MESSAGES))."&nbsp;&nbsp;".
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users", ($perms & PHORUM_USER_ALLOW_MODERATE_USERS))."&nbsp;&nbsp;".
 
$frm->hidden("forums[$forum_id]", $forum_id);
 
$row=$frm->addrow($forums[$forum_id]["name"]."<br />".$frm->checkbox("delforum[$forum_id]", 1, "Delete"), $perm_frm);
 
}
}
 
$frm->show();
 
echo "<br /><hr class=\"PhorumAdminHR\" /><br /><a name=\"groups\"></a>";
 
$frm =& new PhorumInputForm ("", "post", "Update");
 
$frm->hidden("user_id", $_REQUEST["user_id"]);
 
$frm->hidden("module", "users");
 
$frm->hidden("section", "groups");
 
$extra_opts = "";
// if its an admin, let the user know that the admin will be able to act as a moderator no matter what
if ($user["admin"]){
$row=$frm->addbreak("Edit Groups (Admins can act as a moderator of every group, regardless of these values)");
}
else{
$row=$frm->addbreak("Edit Groups");
}
 
$groups= phorum_db_get_groups();
$usergroups = phorum_user_get_groups($_REQUEST["user_id"]);
 
$arr=array("Add A Group...");
foreach($groups as $group_id=>$group){
if(!isset($usergroups[$group_id]))
$arr[$group_id]=$group["name"];
}
 
if(count($arr)>1)
$frm->addrow("Add A Group", $frm->select_tag("new_group", $arr));
 
if(is_array($usergroups)){
$group_options = array(PHORUM_USER_GROUP_REMOVE => "< Remove User From Group >",
PHORUM_USER_GROUP_SUSPENDED => "Suspended",
PHORUM_USER_GROUP_UNAPPROVED => "Unapproved",
PHORUM_USER_GROUP_APPROVED => "Approved",
PHORUM_USER_GROUP_MODERATOR => "Group Moderator");
foreach($usergroups as $group_id => $group_perm){
$group_info = phorum_db_get_groups($group_id);
$frm->hidden("groups[$group_id]", "$group_id");
$frm->addrow($group_info[$group_id]["name"], $frm->select_tag("group_perm[$group_id]", $group_options, $group_perm, $extra_opts));
}
}
 
$frm->show();
 
} else {
 
echo "User Not Found.";
 
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/newforum.php
New file
0,0 → 1,417
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
include_once "./include/users.php";
include_once "./include/format_functions.php";
 
$error="";
 
if(count($_POST)){
 
// set the defaults and check values
 
foreach($_POST as $field=>$value){
 
switch($field){
 
case "name":
if(empty($value) && $_POST["module"]!="forum_defaults"){
$error="Please fill in Title";
}
break;
 
case "list_length_flat":
$_POST[$field]=(int)$value;
if(empty($_POST[$field])){
$_POST[$field]=30;
}
break;
 
case "list_length_threaded":
$_POST[$field]=(int)$value;
if(empty($_POST[$field])){
$_POST[$field]=15;
}
break;
 
case "read_length":
$_POST[$field]=(int)$value;
if(empty($_POST[$field])){
$_POST[$field]=10;
}
break;
 
case "max_attachments":
$_POST[$field]=(int)$value;
if(empty($_POST[$field])){
$_POST["allow_attachment_types"]="";
$_POST["max_attachment_size"]=0;
$_POST["max_totalattachment_size"]=0;
}
break;
 
case "max_attachment_size":
case "max_totalattachment_size":
$_POST[$field]=(int)$value;
break;
 
case "display_fixed":
$_POST[$field]=(int)$value;
break;
 
case "pub_perms":
$permission = 0;
foreach($_POST["pub_perms"] as $perm=>$check){
$permission = $permission | $perm;
}
 
$_POST["pub_perms"]=$permission;
break;
 
case "reg_perms":
$permission = 0;
foreach($_POST["reg_perms"] as $perm=>$check){
$permission = $permission | $perm;
}
 
$_POST["reg_perms"]=$permission;
break;
 
case "inherit_id":
if( $_POST['inherit_id'] !== NULL && $_POST["inherit_id"] != "NULL" && $_POST['inherit_id'] != 0) {
$forum_check_inherit =phorum_db_get_forums(intval($_POST["inherit_id"]));
if( $forum_check_inherit[$_POST["inherit_id"]]["inherit_id"] || ($_POST["inherit_id"]==$_POST["forum_id"]) ) {
$error="Settings can't be inherited by this forum, because this forum already inherits settings from another forum.";
}
if( $forum_check_inherit[$_POST["inherit_id"]]["inherit_id"] === 0) {
$error="Settings can't be inherited by this forum, because this forum already inherits the default settings";
}
}
break;
}
 
if($error) break;
 
 
}
 
if(empty($error)){
unset($_POST["module"]);
 
// handling vroots
if($_POST['parent_id'] > 0) {
$parent_folder=phorum_db_get_forums($_POST['parent_id']);
if($parent_folder[$_POST['parent_id']]['vroot'] > 0) {
$_POST['vroot']=$parent_folder[$_POST['parent_id']]['vroot'];
}
} else {
$_POST['vroot']=0;
}
 
// if we received no perms, set them to 0 so they will get saved correctly.
 
if(!isset($_POST['pub_perms']) || empty($_POST["pub_perms"])) $_POST["pub_perms"]=0;
if(!isset($_POST['reg_perms']) || empty($_POST["reg_perms"])) $_POST["reg_perms"]=0;
 
$old_settings_arr = phorum_db_get_forums($_POST["forum_id"]);
$old_settings = array_shift($old_settings_arr);
 
if($_POST["forum_id"] && $old_settings["inherit_id"]!==NULL && $_POST["inherit_id"]=="NULL"){
$reload = true;
}
 
// inherit settings if we've set this and are not in the default forum options
if( !defined("PHORUM_DEFAULT_OPTIONS") && $_POST["inherit_id"]!="NULL" && $_POST['inherit_id'] !== NULL ) {
 
// Load inherit forum settings
if($_POST["inherit_id"]==0){
$forum_settings_inherit[0]=$PHORUM["default_forum_options"];
} else {
$forum_settings_inherit = phorum_db_get_forums($_POST["inherit_id"]);
}
 
if( isset($forum_settings_inherit[$_POST["inherit_id"]]) ) {
 
// slave settings
$forum_settings_inherit=$forum_settings_inherit[$_POST["inherit_id"]];
$forum_settings_inherit["forum_id"] =$_POST["forum_id"];
$forum_settings_inherit["name"] =$_POST["name"];
$forum_settings_inherit["description"] =$_POST["description"];
$forum_settings_inherit["active"] =$_POST["active"];
$forum_settings_inherit["parent_id"] =$_POST["parent_id"];
$forum_settings_inherit["inherit_id"] =$_POST["inherit_id"];
 
// don't inherit this settings
unset($forum_settings_inherit["message_count"]);
unset($forum_settings_inherit["thread_count"]);
unset($forum_settings_inherit["last_post_time"]);
 
// we don't need to save the master forum
unset($forum_settings_inherit[$inherit_id]);
$_POST =$forum_settings_inherit;
 
} else {
$_POST["inherit_id"]="NULL";
unset($_POST["pub_perms"]);
unset($_POST["reg_perms"]);
}
 
}
 
if(defined("PHORUM_EDIT_FORUM") || defined("PHORUM_DEFAULT_OPTIONS")){
 
$forum_settings=$_POST;
 
if(defined("PHORUM_DEFAULT_OPTIONS")){
// these two will not be set if no options were checked
if(empty($forum_settings["pub_perms"])) $forum_settings["pub_perms"] = 0;
if(empty($forum_settings["reg_perms"])) $forum_settings["reg_perms"] = 0;
$res=phorum_db_update_settings(array("default_forum_options" => $forum_settings));
} else {
$res=phorum_db_update_forum($forum_settings);
}
 
// setting the current settings to all forums/folders inheriting from this forum/default settings
$forum_inherit_settings =phorum_db_get_forums(false,false,false,intval($_POST["forum_id"]));
foreach($forum_inherit_settings as $inherit_setting) {
$forum_settings["forum_id"] =$inherit_setting["forum_id"];
// We don't need to inherit this settings
unset($forum_settings["name"]);
unset($forum_settings["description"]);
unset($forum_settings["active"]);
unset($forum_settings["parent_id"]);
unset($forum_settings["inherit_id"]);
unset($forum_settings["message_count"]);
unset($forum_settings["thread_count"]);
unset($forum_settings["last_post_time"]);
 
$res_inherit =phorum_db_update_forum($forum_settings);
}
 
} else {
 
$res=phorum_db_add_forum($_POST);
}
 
if($res){
if($reload){
$url = $_SERVER['PHP_SELF']."?module=editforum&forum_id=$_POST[forum_id]";
} else {
$url = $_SERVER['PHP_SELF']."?module=default&parent_id=$_POST[parent_id]";
}
 
phorum_redirect_by_url($url);
exit();
} else {
$error="Database error while adding/updating forum.";
}
}
 
foreach($_POST as $key=>$value){
$$key=$value;
}
$pub_perms=0;
if(isset($_POST["pub_perms"])) foreach($_POST["pub_perms"] as $perm=>$check){
$pub_perms = $pub_perms | $perm;
}
$reg_perms=0;
if(isset($_POST["reg_perms"])) foreach($_POST["reg_perms"] as $perm=>$check){
$reg_perms = $reg_perms | $perm;
}
 
 
} elseif(defined("PHORUM_EDIT_FORUM")) {
 
$forum_settings = phorum_db_get_forums($_REQUEST["forum_id"]);
extract($forum_settings[$_REQUEST["forum_id"]]);
 
} else {
 
// this is either a new forum or we are editing the default options
extract($PHORUM["default_forum_options"]);
 
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post");
 
if(defined("PHORUM_DEFAULT_OPTIONS")){
$frm->hidden("module", "forum_defaults");
$frm->hidden("forum_id", 0);
$title="Default Forum Settings";
} elseif(defined("PHORUM_EDIT_FORUM")){
$frm->hidden("module", "editforum");
$frm->hidden("forum_id", $forum_id);
$title="Edit Forum";
} else {
$frm->hidden("module", "newforum");
$title="Add A Forum";
}
 
$frm->addbreak($title);
 
if(!defined("PHORUM_DEFAULT_OPTIONS")){
 
$frm->addrow("Forum Title", $frm->text_box("name", $name, 30));
 
$frm->addrow("Forum Description", $frm->textarea("description", $description, $cols=60, $rows=10, "style=\"width: 100%;\""), "top");
 
$folder_list=phorum_get_folder_info();
$frm->addrow("Folder", $frm->select_tag("parent_id", $folder_list, $parent_id));
if($vroot > 0) {
$frm->addrow("This folder is in the Virtual Root of:",$folder_list[$vroot]);
}
 
 
$frm->addrow("Visible", $frm->select_tag("active", array("No", "Yes"), $active));
 
// Edit + inherit_id exists
if(defined("PHORUM_EDIT_FORUM") && strlen($inherit_id)>0 ) {
 
if($inherit_id!=0){
$forum_settings_inherit = phorum_db_get_forums($inherit_id);
}
// inherit_forum not exists
if( $inherit_id==0 || isset($forum_settings_inherit[$inherit_id]) ) {
$disabled_form_input="disabled=\"disabled\"";
} else {
$inherit_id ="0";
unset($forum_settings_inherit);
}
} else {
unset($disabled_form_input);
}
 
$frm->addbreak("Inherit Forum Settings");
 
$forum_list=phorum_get_forum_info(true);
 
$forum_list["0"] ="Use Default Forum Settings";
$forum_list["NULL"] ="None - I want to customize this forum's settings";
 
// Remove this Forum
if($forum_id>0){
unset($forum_list[$forum_id]);
}
 
// Check for Slaves
if( intval($forum_id) ) {
 
$forum_inherit_settings=phorum_db_get_forums(false,false,false,intval($forum_id));
if( count($forum_inherit_settings)>0 ) {
$disabled_form_input_inherit="disabled=\"disabled\"";
}
}
 
// set to NULL if inherit is disabled
if($inherit_id=="" && $inherit_id!==0) $inherit_id="NULL";
 
$row=$frm->addrow("Inherit Settings from Forum", $frm->select_tag("inherit_id", $forum_list, $inherit_id, $disabled_form_input_inherit));
 
// Set Settings from inherit forum
if( $forum_settings_inherit ) {
$forum_settings =$forum_settings_inherit;
extract($forum_settings[$inherit_id]);
}
}
 
$frm->addbreak("Moderation / Permissions");
 
$row=$frm->addrow("Moderate Messages", $frm->select_tag("moderation", array(PHORUM_MODERATE_OFF=>"Disabled", PHORUM_MODERATE_ON=>"Enabled"), $moderation, $disabled_form_input));
 
$frm->addhelp($row, "Moderate Messages", "This setting determines whether messages are visible to users immediately after they are posted. If enabled, all messages will remain hidden until approved by a moderator.");
 
$frm->addrow("Email Messages To Moderators", $frm->select_tag("email_moderators", array(PHORUM_EMAIL_MODERATOR_OFF=>"Disabled", PHORUM_EMAIL_MODERATOR_ON=>"Enabled"), $email_moderators, $disabled_form_input));
 
$pub_perm_frm = $frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_READ."]", 1, "Read", $pub_perms & PHORUM_USER_ALLOW_READ, $disabled_form_input)."&nbsp;&nbsp;".
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $pub_perms & PHORUM_USER_ALLOW_REPLY, $disabled_form_input)."&nbsp;&nbsp;".
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics", $pub_perms & PHORUM_USER_ALLOW_NEW_TOPIC, $disabled_form_input)."<br />".
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files", $pub_perms & PHORUM_USER_ALLOW_ATTACH, $disabled_form_input);
 
$frm->addrow("Public Users", $pub_perm_frm);
 
$reg_perm_frm = $frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_READ."]", 1, "Read", $reg_perms & PHORUM_USER_ALLOW_READ, $disabled_form_input)."&nbsp;&nbsp;".
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $reg_perms & PHORUM_USER_ALLOW_REPLY, $disabled_form_input)."&nbsp;&nbsp;".
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics", $reg_perms & PHORUM_USER_ALLOW_NEW_TOPIC, $disabled_form_input)."<br />".
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts", $reg_perms & PHORUM_USER_ALLOW_EDIT, $disabled_form_input)."&nbsp;&nbsp;".
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files", $reg_perms & PHORUM_USER_ALLOW_ATTACH, $disabled_form_input);
 
$row=$frm->addrow("Registered Users", $reg_perm_frm);
 
$frm->addhelp($row, "Registered Users", "These settings do not apply to users that are granted permissions directly via the user admin or via a group permissions.");
 
$frm->addbreak("Display Settings");
 
$frm->addrow("Fixed Display-Settings (user can't override them)", $frm->select_tag("display_fixed", array("No", "Yes"), $display_fixed, $disabled_form_input));
 
$frm->addrow("Template", $frm->select_tag("template", phorum_get_template_info(), $template, $disabled_form_input));
 
$frm->addrow("Language", $frm->select_tag("language", phorum_get_language_info(), $language, $disabled_form_input));
 
$frm->addrow("List Threads Expanded", $frm->select_tag("threaded_list", array("No", "Yes"), $threaded_list, $disabled_form_input));
$frm->addrow("Read Threads Expanded", $frm->select_tag("threaded_read", array("No", "Yes"), $threaded_read, $disabled_form_input));
$frm->addrow("Reverse Threading", $frm->select_tag("reverse_threading", array("No", "Yes"), $reverse_threading, $disabled_form_input));
 
$frm->addrow("Move Threads On Reply", $frm->select_tag("float_to_top", array("No", "Yes"), $float_to_top, $disabled_form_input));
 
$frm->addrow("Message List Length (Flat Mode)", $frm->text_box("list_length_flat", $list_length_flat, 10, false, false, $disabled_form_input));
$frm->addrow("Message List Length (Threaded Mode, Nr. of Threads)", $frm->text_box("list_length_threaded", $list_length_threaded, 10, false, false, $disabled_form_input));
 
$frm->addrow("Read Page Length", $frm->text_box("read_length", $read_length, 10, false, false, $disabled_form_input, $disabled_form_input));
 
$frm->addrow("Display IP Addresses <small>(note: admins always see it)</small>", $frm->select_tag("display_ip_address", array("No", "Yes"), $display_ip_address, $disabled_form_input));
 
$frm->addrow("Count views", $frm->select_tag("count_views", array(0 => "No", 1 => "Yes, show views added to subject", 2 => "Yes, show views as extra column"), $count_views, $disabled_form_input));
 
$frm->addbreak("Posting Settings");
 
$frm->addrow("Check for Duplicates", $frm->select_tag("check_duplicate", array("No", "Yes"), $check_duplicate, $disabled_form_input));
 
$frm->addrow("Allow Email Notification", $frm->select_tag("allow_email_notify", array("No", "Yes"), $allow_email_notify, $disabled_form_input));
 
$frm->addbreak("Attachment Settings");
 
$frm->addrow("Number Allowed (0 to disable)", $frm->text_box("max_attachments", $max_attachments, 10, false, false, $disabled_form_input));
 
$frm->addrow("Allowed Files (eg: gif;jpg;png, empty for any)", $frm->text_box("allow_attachment_types", $allow_attachment_types, 10, false, false, $disabled_form_input));
 
$php_limit = ini_get('upload_max_filesize')*1024;
$max_packetsize = phorum_db_maxpacketsize();
if ($max_packetsize == NULL) {
$db_limit = $php_limit;
} else {
$db_limit = $max_packetsize/1024*.6;
}
$max_size = phorum_filesize(min($php_limit, $db_limit)*1024);
 
$row=$frm->addrow("Max File Size In kB ($max_size maximum)", $frm->text_box("max_attachment_size", $max_attachment_size, 10, false, false, $disabled_form_input));
$frm->addhelp($row, "Max File Size", "This is the maximum that one uploaded file can be. If you see a maximum here, that is the maximum imposed by either your PHP installation, database server or both. Leaving this field as 0 will use this maximum.");
 
$frm->addrow("Max cumulative File Size In kB (0 for unlimited)", $frm->text_box("max_totalattachment_size", $max_totalattachment_size, 10, false, false, $disabled_form_input));
 
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/mods.php
New file
0,0 → 1,141
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
 
if(count($_POST)){
 
foreach($_POST as $key=>$value){
$key = base64_decode($key);
if(substr($key, 0, 5)=="mods_") {
 
$mod=substr($key, 5);
$mods[$mod]=$value;
}
}
 
foreach($_POST as $key=>$value){
$key = base64_decode($key);
if(substr($key, 0, 6)=="hooks_"){
$mod=substr($key, 6);
if($mods[$mod]==1){
 
$hook_arr=explode(",", $value);
foreach($hook_arr as $hk){
$parts=explode("|", $hk);
$hooks[$parts[0]]["mods"][]=$mod;
$hooks[$parts[0]]["funcs"][]=$parts[1];
}
}
}
}
 
$data=array("hooks"=>$hooks, "mods"=>$mods);
 
if(phorum_db_update_settings($data)){
echo "Mods Updated<br />";
} else {
$error="Database error while updating settings.";
}
 
}
 
if($error){
phorum_admin_error($error);
}
 
// read plugin info
 
$d = dir("./mods");
while (false !== ($entry = $d->read())) {
$lines = array();
if(file_exists("./mods/$entry/info.txt")){
$lines=file("./mods/$entry/info.txt");
} elseif(is_file("./mods/$entry") && substr($entry, -4)==".php"){
$entry=str_replace(".php", "", $entry);
$data = file_get_contents("./mods/$entry.php");
if($data = stristr($data, "/* phorum module info")){
$data = substr($data, 0, strpos($data, "*/"));
$lines = preg_split('!(\r|\n|\r\n)!', $data);
}
}
if(count($lines)){
$plugins[$entry]=array();
foreach($lines as $line){
if(strstr($line, ":")){
$parts=explode(":", trim($line), 2);
if($parts[0]=="hook"){
$plugins[$entry]["hooks"][]=trim($parts[1]);
} else {
$plugins[$entry][$parts[0]]=trim($parts[1]);
}
}
}
$plugins[$entry]["hooks"]=implode(",", $plugins[$entry]["hooks"]);
 
if(file_exists("./mods/$entry/settings.php")){
$plugins[$entry]["settings"]=true;
} else {
$plugins[$entry]["settings"]=false;
}
}
}
$d->close();
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post");
 
$frm->addbreak("Phorum Module Settings");
 
$frm->hidden("module", "mods");
 
function plugin_sort($a, $b) { return strcmp($a["title"], $b["title"]); }
uasort($plugins, "plugin_sort");
 
foreach($plugins as $name => $plugin){
 
if(isset($mods[$name])){
$thisval=$mods[$name];
} elseif(isset($PHORUM["mods"]["$name"])){
$thisval=$PHORUM["mods"]["$name"];
} else {
$thisval=0;
}
 
if($plugin["settings"]){
if($thisval==0){
$settings_link="<br /><a href=\"javascript:alert('You can not edit settings for a module unless it is turned On.');\">Settings</a>";
} else {
$settings_link="<br /><a href=\"$_SERVER[PHP_SELF]?module=modsettings&mod=$name\">Settings</a>";
}
} else {
$settings_link="";
}
 
$frm->hidden(base64_encode("hooks_$name"), $plugin["hooks"]);
$frm->addrow("$plugin[title]<div class=\"small\">".wordwrap($plugin["desc"], 90, "<br />")."</div>", $frm->select_tag(base64_encode("mods_$name"), array("Off", "On"), $thisval).$settings_link);
 
}
 
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/PhorumAdminMenu.php
New file
0,0 → 1,70
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
class PhorumAdminMenu
{
var $_title;
var $_id;
var $_links;
 
function PhorumAdminMenu ($title="", $id="")
{
$this->reset($title, $id);
}
 
function reset($title="", $id="")
{
$this->_title = $title;
$this->_id = $id;
$this->_links=array();
}
 
function add($title, $module, $description)
{
$this->_links[]=array("title"=>$title, "module"=>$module, "description"=>$description);
}
 
 
function show()
{
if($this->_title){
echo "<div class=\"PhorumAdminMenuTitle\">$this->_title</div>\n";
}
echo "<div class=\"PhorumAdminMenu\"";
if($this->_id) echo " id=\"$this->_id\"";
echo ">";
 
foreach($this->_links as $link){
$desc=$link["description"];
$html ="<a title='$desc' href=\"$_SERVER[PHP_SELF]";
if(!empty($link["module"])) $html.="?module=$link[module]";
$html.="\">$link[title]</a><br />";
echo $html;
}
 
echo "</div>\n";
 
 
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/login.php
New file
0,0 → 1,52
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// don't allow this page to be loaded directly
if(!defined("PHORUM_ADMIN")) exit();
 
if(isset($_POST["username"]) && isset($_POST["password"])){
if(phorum_user_check_login($_POST["username"], $_POST["password"])!=0){
if($PHORUM["user"]["admin"]){
phorum_user_create_session(PHORUM_SESSION_ADMIN);
if(!empty($_POST["target"])){
phorum_redirect_by_url($_POST['target']);
} else {
phorum_redirect_by_url($_SERVER['PHP_SELF']);
}
exit();
}
}
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post");
 
if(count($_REQUEST)){
 
$frm->hidden("target", $_SERVER["REQUEST_URI"]);
}
 
$frm->addrow("Username", $frm->text_box("username", "", 30));
 
$frm->addrow("Password", $frm->text_box("password", "", 30, 0, true));
 
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/logout.php
New file
0,0 → 1,26
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
phorum_user_clear_session("phorum_admin_session");
phorum_redirect_by_url($_SERVER['PHP_SELF']);
exit();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/PhorumInputForm.php
New file
0,0 → 1,326
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM_ADMIN" ) ) return;
 
class PhorumInputForm {
var $_rows;
var $_hiddens;
var $_action;
var $_method;
var $_target;
var $_enctype;
var $_events;
var $_submit;
var $_help;
 
function PhorumInputForm ( $action = "", $method = "get", $submit = "Submit", $target = "", $enctype = "", $events = "" )
{
$this->_action = ( empty( $action ) ) ? $_SERVER["PHP_SELF"] : $action;
$this->_method = $method;
$this->_target = $target;
$this->_enctype = $enctype;
$this->_events = $events;
$this->_submit = $submit;
}
 
function hidden( $name, $value )
{
$this->_hiddens[$name] = $value;
}
 
function addrow( $title, $contents = "", $valign = "middle", $align = "left" )
{
list( $talign, $calign ) = explode( ",", $align );
if ( empty( $calign ) ) $calign = $talign;
 
list( $tvalign, $cvalign ) = explode( ",", $valign );
if ( empty( $cvalign ) ) $cvalign = $tvalign;
 
$this->_rows[] = array( "title" => $title,
"contents" => $contents,
"title_valign" => $tvalign,
"content_valign" => $cvalign,
"title_align" => $talign,
"content_align" => $calign
);
 
end( $this->_rows );
 
return key( $this->_rows );
}
 
function addhelp( $row, $title, $text )
{
// Allow title and text to span multiple lines and
// do escaping for encapsulation within the help
// javascript code.
$title = addslashes(str_replace("\n", " ", $title));
$text = addslashes(str_replace("\n", " ", $text));
$this->_help[$row] = array( $title, $text );
}
 
function addbreak( $break = "&nbsp;" )
{
$this->_rows[] = array( "break" => $break );
end( $this->_rows );
return key( $this->_rows );
}
 
function addmessage( $message )
{
$this->_rows[] = array( "message" => $message );
}
 
function show()
{
if(count($this->_help)){
echo "<script type=\"text/javascript\">\nvar help = Array;\n";
foreach($this->_help as $key=>$data){
$title = str_replace('"', "&quot;", $data[0]);
$text = str_replace('"', '&quot;', $data[1]);
$text = str_replace("\n", "\\n", $text);
echo "help[$key] = [\"$title\", \"$text\"];\n";
}
echo "</script>\n";
}
echo "<form style=\"display: inline;\" action=\"$this->_action\" method=\"$this->_method\"";
if ( !empty( $this->_target ) ) echo " target=\"$this->_target\"";
if ( !empty( $this->_enctype ) ) echo " enctype=\"$this->_enctype\"";
if ( !empty( $this->_events ) ) echo " $this->_events";
echo ">\n";
 
if ( is_array( $this->_hiddens ) ) foreach( $this->_hiddens as $name => $value ) {
echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
}
 
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" class=\"input-form-table\" width=\"100%\">\n";
 
if ( is_array( $this->_rows ) ) foreach( $this->_rows as $key => $row ) {
 
 
if ( $row["break"] ) {
$title = $row["break"];
if ( isset( $this->_help[$key] ) ) {
$title = $title . "<a href=\"javascript:show_help($key);\"><img class=\"question\" alt=\"Help\" title=\"Help\" border=\"0\" src=\"images/qmark.gif\" height=\"16\" width=\"16\" /></a>";
}
echo "<tr class=\"input-form-tr\">\n";
echo " <td colspan=\"2\" class=\"input-form-td-break\">$title</td>\n";
echo "</tr>\n";
} elseif ( $row["message"] ) {
echo "<tr class=\"input-form-tr\">\n";
echo " <td colspan=\"2\" class=\"input-form-td-message\">$row[message]</td>\n";
echo "</tr>\n";
} else {
$colspan = ( $row["contents"] == "" ) ? " colspan=2" : "";
 
$title = $row["title"];
 
if ( isset( $this->_help[$key] ) ) {
$title = $title . "<a href=\"javascript:show_help($key);\"><img class=\"question\" alt=\"Help\" title=\"Help\" border=\"0\" src=\"images/qmark.gif\" height=\"16\" width=\"16\" /></a>";
}
 
echo "<tr class=\"input-form-tr\">\n";
echo " <th valign=\"$row[title_valign]\" align=\"$row[title_align]\" class=\"input-form-th\"$colspan nowrap=\"nowrap\">$title</th>\n";
if ( !$colspan ) {
echo " <td valign=\"$row[content_valign]\" align=\"$row[content_align]\" class=\"input-form-td\">$row[contents]</td>\n";
}
echo "</tr>\n";
}
}
echo "<tr class=\"input-form-tr\">\n";
echo " <td class=\"input-form-td-break\" align=\"center\" colspan=\"2\"><input type=\"submit\" value=\"$this->_submit\" class=\"input-form-submit\"></td>\n";
echo "</tr>\n";
 
echo "</table>\n";
 
echo "\n";
 
echo "</form>\n";
}
 
function time_select( $prefix, $blank_line = true, $time = "" )
{
if ( empty( $time ) ) $time = date( "H:i:s" );
list( $hour, $minute, $second ) = explode( "-", $time );
 
if ( $hour > 12 ) {
$hour -= 12;
$ampm = "PM";
} else {
$ampm = "AM";
}
 
for( $x = 0;$x <= 12;$x++ ) {
if ( $x == 0 && $blank_line ) {
$values[0] = "";
} else {
$key = ( $x < 10 ) ? "0$x" : $x;
$values[$key] = $x;
}
}
$data = $this->select_tag( $prefix . "hour", $values, $hour ) . " : ";
 
array_merge( $values, range( 13, 60 ) );
 
$data .= $this->select_tag( $prefix . "minute", $values, $minute ) . " : ";
$data .= $this->select_tag( $prefix . "second", $values, $second ) . " ";
 
$data .= $this->select_tag( $prefix . "ampm", array( "AM" => "AM", "PM" => "PM" ), $ampm );
}
 
function date_select( $prefix, $blank_line = true, $date = "TODAY", $year_start = "", $year_end = "" )
{
if ( $date == "TODAY" ) $date = date( "Y-m-d" );
list( $year, $month, $day ) = explode( "-", $date );
 
if ( empty( $year_start ) ) $year_start = date( "Y" );
 
if ( empty( $year_end ) ) $year_end = date( "Y" ) + 2;
 
for( $x = 0;$x <= 12;$x++ ) {
if ( $x == 0 && $blank_line ) {
$values[0] = "";
} elseif ( $x > 0 ) {
$key = ( $x < 10 ) ? "0$x" : $x;
$values[$key] = date( "F", mktime( 0, 0, 0, $x ) );
}
}
$data = $this->select_tag( $prefix . "month", $values, $month ) . " ";
 
for( $x = 0;$x <= 31;$x++ ) {
if ( $x == 0 && $blank_line ) {
$values[0] = "";
} elseif ( $x > 0 ) {
$key = ( $x < 10 ) ? "0$x" : $x;
$values[$key] = $x;
}
}
 
$data .= $this->select_tag( $prefix . "day", $values, $day ) . ", ";
 
unset( $values );
if ( $blank_line ) $values = array( "" );
for( $x = $year_start;$x <= $year_end;$x++ ) {
$values[$x] = $x;
}
$data .= $this->select_tag( $prefix . "year", $values, $year );
 
return $data;
}
 
function text_box( $name, $value, $size = 0, $maxlength = 0, $password = false, $extra = "" )
{
$type = ( $password ) ? "password" : "text";
$data = "<input type=\"$type\" name=\"$name\"";
if ( $size > 0 ) $data .= " size=\"$size\"";
if ( $maxlength > 0 ) $data .= " maxlength=\"$maxlength\"";
$value = htmlspecialchars( $value );
$data .= " value=\"$value\" $extra>";
 
return $data;
}
 
function textarea( $name, $value, $cols = 30, $rows = 5, $extra = "" )
{
$value = htmlspecialchars( $value );
$data = "<textarea name=\"$name\" cols=\"$cols\" rows=\"$rows\" $extra>$value</textarea>";
 
return $data;
}
 
function select_tag( $name, $values, $selected = "", $extra = "" )
{
$data = "<select name=\"$name\" $extra>\n";
foreach( $values as $value => $text ) {
$value = htmlspecialchars( $value );
$text = htmlspecialchars( $text );
$data .= "<option value=\"$value\"";
if ( $value == $selected ) $data .= " selected=\"selected\"";
$data .= ">$text</option>\n";
}
$data .= "</select>\n";
return $data;
}
 
function select_tag_valaskey( $name, $values, $selected = "", $extra = "" )
{
$data = "<select name=\"$name\" $extra>\n";
foreach( $values as $value => $text ) {
$data .= "<option value=\"$text\"";
$text = htmlspecialchars( $text );
if ( $text == $selected ) $data .= " selected";
$data .= ">$text</option>\n";
}
$data .= "</select>\n";
return $data;
}
 
function radio_button( $name, $values, $selected = "", $separator = "&nbsp;&nbsp;", $extra = "" )
{
foreach( $values as $value => $text ) {
$value = htmlspecialchars( $value );
$text = htmlspecialchars( $text );
$data .= "<input type=\"radio\" name=\"$name\" value=\"$value\"";
if ( $selected == $value ) $data .= " checked";
$data .= " $extra>&nbsp;$text$separator";
}
return $data;
}
 
function checkbox( $name, $value, $caption, $checked = 0, $extra = "" )
{
$is_checked = ( !empty( $checked ) ) ? "checked" : "" ;
 
$value = htmlspecialchars( $value );
 
$data = "<nobr><input type=\"checkbox\" name=\"$name\" value=\"$value\" $is_checked $extra>&nbsp;$caption</nobr>";
 
return $data;
}
 
// $list and $checklist are both associative and should have the same indicies
function checkbox_list( $prefix, $list, $separator = "&nbsp;&nbsp;", $checklist = 0 )
{
// Get the listing of options to check into a array function library usable format
if ( empty( $checklist ) ) {
$checked_items = array();
} else {
if ( !is_array( $checklist ) ) {
$checked_items = array( $checklist );
} else {
$checked_items = $checklist;
}
}
// Loop through all the array elements and call function to generate the appropriate input tag
foreach( $list as $index => $info ) {
$check_name = $prefix . "[" . $index . "]";
$check_value = $info["value"];
$check_caption = $info["caption"];
$is_checked = ( in_array( $check_value, $checked_items ) ) ? 1 : 0;
 
$data .= $this->checkbox( $check_name, $check_value, $check_caption, $is_checked ) . $separator;
}
 
return $data;
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/manage_languages.php
New file
0,0 → 1,682
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// TODO have a better way to differentiate between Phorum distribution
// TODO and addon files, so we son't index text strings from addon
// TODO files in here.
 
if(!defined("PHORUM_ADMIN")) return;
 
define('TOKEN_DEBUGGER', 0);
 
// Because sometimes the script can take a while, we set the
// PHP time limit to a high value to prevent execution timeouts.
set_time_limit(600);
 
include_once "./include/admin/PhorumInputForm.php";
 
// Get some form variables.
$action = isset($_POST['action']) ? $_POST['action'] : 'start';
$language = isset($_POST['language']) ? $_POST['language'] : $PHORUM["SETTINGS"]["default_language"];
$filename = isset($_POST['filename']) ? trim($_POST['filename']) : '';
$displayname = isset($_POST['displayname']) ? trim($_POST['displayname']) : '';
 
// Handle downloading a new language file.
if ($action == 'download_lang')
{
// Ditch HTML header we have so far (from the admin framework).
ob_end_clean();
 
// Send the new languagefile to the client.
$basename = preg_replace('/-.*$/', '', $filename);
$fullfile = $basename . '-' . PHORUM . '.php';
header ("Content-Type: application/download; filename=$fullfile");
header ("Content-Disposition: attachment; filename=\"$fullfile\"");
$langfile = phorum_cache_get('updated_language', $filename);
print $langfile;
exit();
}
 
// Handle updating a language.
if ($action == 'update_lang') {
$langinfo = phorum_get_language_info();
return phorum_generate_language_file($language, $langinfo[$language], false);
}
 
// Handle generating a new language.
if ($action == 'generate_lang') {
$filename = preg_replace('/\.php$/i', '', basename($filename));
if ($filename == '') {
phorum_admin_error("The basename may not be empty");
} elseif (! preg_match('/^[\w_\.]+$/', $filename)) {
phorum_admin_error(
"The basename contains illegal characters. Please, keep the " .
"filename simple by using only letters, numbers, underscores and " .
"dots. You can't use hyphens, because those are used for " .
"separating the basename from the Phorum version for which the " .
"language file is used."
);
} elseif ($displayname == '') {
phorum_admin_error("The display name for the language may not be empty.");
} else {
$filename .= "-" . PHORUM;
return phorum_generate_language_file($filename, $displayname, true);
}
}
 
 
// Handle start page.
$frm = new PhorumInputForm ("", "post", "Generate updated language file");
 
$frm->addmessage(<<<INTRO
<font color="red">EXPERIMENTAL FEATURE<br/>
Please backup your existing language file if you replace it with
one generated by this maintenance tool. We feel pretty confident
about it, but we wouldn't want you to loose data in case of bugs.</font>
<hr size="0"/>
<h2>Manage language files</h2>
This is a tool which can be used for easy maintenance of
language files for Phorum. It will collect all actual used
language strings from the Phorum software and generate an
updated langage file for your language of choice based on
those strings. In the generated language file, missing and
deprecated strings will be clearly marked, so you can
update the language file to match the running Phorum distribution.
INTRO
);
 
$frm->hidden("module", "manage_languages");
$frm->hidden("action", "update_lang");
$frm->addbreak("Update existing language file");
$frm->addrow("Generate updated version of an existing language file",
$frm->select_tag("language", phorum_get_language_info(), $language, 0));
$frm->show();
 
 
$frm = new PhorumInputForm("", "post", "Generate new language file");
$frm->addmessage(<<<INTRO
In case there is no language file available for your language or
if you want to create a new language file all of your own, you can
generate a new language file using the form below.
INTRO
);
 
$frm->hidden("module", "manage_languages");
$frm->hidden("action", "generate_lang");
$frm->addbreak("Generate a new language file");
$frm->addrow("The basename for the generated file", $frm->text_box('filename', $filename, 20));
$frm->addrow("The display name for the language", $frm->text_box('displayname', $displayname, 20));
$frm->show();
 
exit;
 
 
// ======================================================================
// Generating language files
// ======================================================================
 
function phorum_generate_language_file($lang, $displayname, $generate_new)
{
global $fullfile;
$basename = preg_replace('/-.*$/', '', $lang);
$fullfile = $basename . '-' . PHORUM . '.php';
// Get our default language file.
$DEFAULT = phorum_get_language('english');
 
// Get the languagefile to update, unless generating a new language.
$CURRENT = array();
if (! $generate_new) {
$CURRENT = phorum_get_language($lang);
} else {
$CURRENT['STORE']['language_hide'] = 0;
$CURRENT['STORE']['language'] = urlencode("'" . addslashes($displayname) . "'");
}
// Keep a copy of the languagefile.
$CURRENT_COPY = $CURRENT;
 
// Collect all language strings from the distribution files.
$language_strings = phorum_extract_language_strings();
$frm = new PhorumInputForm ("", "post", "Download new " . htmlspecialchars($fullfile) . " language file");
$frm->hidden("module", "manage_languages");
$frm->hidden("action", "download_lang");
$frm->hidden("filename", $lang);
if (! $generate_new) {
 
$frm->addmessage(
"<h2>Update language: " . htmlspecialchars($displayname) . "</h2>" .
"Below you will see all the things that have been updated " .
"to get to the new version of the language file. At the " .
"bottom of the page you will find a download button to download " .
"the updated language file. This language file has to be placed " .
"in <b>include/lang/" . htmlspecialchars($lang) . ".php</b> to make it " .
"available to Phorum (backup your old file first of course!). " .
"If new language strings have been added, " .
"they will be marked with '***' in the language file, so it's " .
"easy for you to find them."
);
$frm->addbreak("Updates for the new language file");
} else {
$frm->addmessage(
"<h2>Generate new language: " . htmlspecialchars($displayname) . "</h2>" .
"A new language file has been generated. Below you will find " .
"a download button to download the new file. In this file, you " .
"can replace all language strings by strings which apply to " .
"\"" . htmlspecialchars($displayname) . "\". After updating the new " .
"file, you will have to place it in " .
"<b>include/lang/" . htmlspecialchars($fullfile) . ".php</b>, " .
"so Phorum can use it (backup your old file first of course!)."
);
}
$notifies = 0;
 
// Check for language strings that are missing.
$missing = array();
$count_missing = 0;
foreach ($language_strings as $string => $data) {
if ($string == 'TIME') continue; // This one is special.
if (! isset($CURRENT["DATA"]["LANG"][$string])) {
array_push($missing, $string);
$translation = urlencode("'" . addslashes($string) . "'");
if (isset($DEFAULT["DATA"]["LANG"][$string])) {
$translation = $DEFAULT["DATA"]["LANG"][$string];
}
$CURRENT_COPY["DATA"]["LANG"][$string] =
urlencode("'***'. " . urldecode($translation));
$count_missing++;
if (! $generate_new) {
$frm->addrow("MISSING ($count_missing)", $string);
$notifies++;
}
} else {
unset($CURRENT["DATA"]["LANG"][$string]);
}
}
 
// Check for language strings that are deprecated.
$deprecated = array();
$count_deprecated = 0;
if (! $generate_new)
{
foreach ($CURRENT["DATA"]["LANG"] as $string => $translation)
{
if ($string == 'TIME') continue; // This one is special.
$count_deprecated++;
$deprecated[$string] = true;
 
// Only notify the deprecation if not already in deprecated state.
if (! isset($CURRENT['STORE']['DEPRECATED'][$string])) {
$frm->addrow("DEPRECATED ($count_deprecated)", htmlspecialchars($string));
$notifies++;
}
}
}
$CURRENT_COPY['STORE']['DEPRECATED'] = $deprecated;
 
// Restore our full current language data from the copy.
$CURRENT = $CURRENT_COPY;
// Copy values from our default language to the current language.
$copyfields = array('long_date', 'short_date', 'locale');
foreach ($copyfields as $f) {
if (! isset($CURRENT[$f])) {
$CURRENT[$f] = $DEFAULT[$f];
if (! $generate_new) {
$frm->addrow("MISSING VARIABLE", "$f set to default " .
htmlentities(urldecode($DEFAULT[$f])));
$notifies++;
}
}
}
// Copy default values beneath DATA to the current language.
$datafields = array('CHARSET', 'MAILENCODING', 'LANG_META');
foreach ($datafields as $f) {
if (! isset($CURRENT['DATA'][$f]) || $CURRENT['DATA'][$f] == '') {
$CURRENT['DATA'][$f] = $DEFAULT['DATA'][$f];
if (! $generate_new) {
$frm->addrow("MISSING VARIABLE", "DATA->$f set to default " .
htmlentities(urldecode($DEFAULT['DATA'][$f])));
$notifies++;
}
}
}
// Copy default values for timezone information to the current language.
foreach ($DEFAULT['DATA']['LANG']['TIME'] as $key => $val) {
if (! isset($CURRENT['DATA']['LANG']['TIME'][$key])) {
$CURRENT['DATA']['LANG']['TIME'][$key] = $val;
if (! $generate_new) {
$dflt = htmlentities(urldecode($DEFAULT['DATA']['LANG']['TIME'][$key]));
$frm->addrow("MISSING TZINFO", "TZ $key set to default<br/>$dflt");
$notifies++;
}
}
}
if ($generate_new) {
$frm->addrow("COMPLETED", "A new language file has been generated for you");
} elseif (! $notifies) {
$frm->addrow("NONE", "There were no updates for the current \"$lang\" language file");
}
$frm->show();
phorum_write_language_file($lang, $CURRENT);
}
 
function phorum_write_language_file($lang, $CURRENT)
{
// Sort array keys.
ksort($CURRENT['DATA']['LANG']);
ksort($CURRENT['DATA']['STORE']['DEPRECATED']);
$langfile =
"<?php\n" .
"\n" .
$CURRENT['STORE']['keep_comment'] . "\n" .
"\n" .
"// ============================================================\n" .
"// General settings\n" .
"// ============================================================\n" .
"\n" .
"// The language name as it is presented in the interface.\n" .
"\$language = " . urldecode($CURRENT['STORE']['language']) . ";\n" .
"\n" .
"// Uncomment this to hide this language from the user-select-box.\n" .
($CURRENT['STORE']['language_hide'] ? '' : '//') . "\$language_hide = 1;\n" .
"\n" .
"// Date formatting. Check the PHP-docs for the syntax of these\n" .
"// entries (http://www.php.net/strftime). One tip: do not use\n" .
"// %T for showing the time zone, as users can change their time zone.\n" .
"\$PHORUM['long_date'] = " . urldecode($CURRENT['long_date']) . ";\n" .
"\$PHORUM['short_date'] = " . urldecode($CURRENT['short_date']) . ";\n" .
"\n" .
"// The locale setting for enabling localized times/dates. Take a look\n" .
"// at http://www.w3.org/WAI/ER/IG/ert/iso639.htm for the needed string.\n" .
"\$PHORUM['locale'] = " . urldecode($CURRENT['locale']) . ";\n" .
"\n" .
"// The character set to use for converting html into safe valid text.\n" .
"// Also used in the header template for the xml tag. For a list of\n" .
"// supported character sets see: http://www.php.net/htmlentities\n" .
"// You may also need to set a meta-tag with a character set in it.\n" .
"\$PHORUM['DATA']['CHARSET'] = " . urldecode($CURRENT['DATA']['CHARSET']) . ";\n" .
"\n" .
"// The encoding used for outgoing mail messages.\n" .
"\$PHORUM['DATA']['MAILENCODING'] = " . urldecode($CURRENT['DATA']['MAILENCODING']) . ";\n" .
"\n" .
"// Some languages need additional meta tags to set encoding, etc.\n" .
"\$PHORUM['DATA']['LANG_META'] = " . urldecode($CURRENT['DATA']['LANG_META']) . ";\n" .
"\n" .
"// ============================================================\n" .
"// Language translation strings\n" .
"// ============================================================\n" .
"\n" .
"\$PHORUM['DATA']['LANG'] = array(\n";
// Add active language data to the array.
foreach ($CURRENT['DATA']['LANG'] as $key => $val) {
if ($key == 'TIME') continue;
if (isset($CURRENT['STORE']['DEPRECATED'][$key])) continue;
 
$langfile .= " '$key' => " . urldecode($val) . ",\n";
}
// Add deprecated language data to the array.
if (count($CURRENT['STORE']['DEPRECATED']))
{
$langfile .=
"\n" .
" // ============================================================\n" .
" // DEPRECATED:\n" .
" // These are all language strings which are not used anymore.\n" .
" // You might want to keep them to make this language file work\n" .
" // for versions of Phorum prior to version " . PHORUM . "\n" .
" // ============================================================\n" .
"\n";
foreach ($CURRENT['STORE']['DEPRECATED'] as $key => $dummy) {
$langfile .= " '$key' => " . urldecode($CURRENT['DATA']['LANG'][$key]) . ",\n";
}
}
$langfile .=
");\n" .
"\n" .
"// ============================================================\n" .
"// Timezone description strings\n" .
"// ============================================================\n" .
"\n" .
"\$PHORUM['DATA']['LANG']['TIME'] = array(\n";
foreach ($CURRENT['DATA']['LANG']['TIME'] as $key => $val) {
$pre = sprintf(" %6s", "'$key'");
$langfile .= "$pre => " . urldecode($val) . ",\n";
}
$langfile .=
");\n" .
"\n" .
"?>\n";
 
phorum_cache_put('updated_language', $lang, $langfile);
}
 
 
// ======================================================================
// Parsing language files
// ======================================================================
 
// Helper function for phorum_get_language() to be able to do
// some debugging output while getting all PHP tokens.
function token_shift(&$tokens)
{
$token = array_shift($tokens);
if (TOKEN_DEBUGGER > 1) {
print '<div style="color: darkorange">';
if (is_array($token)) {
print "COMPLEX: " . token_name($token[0]) . " [" . htmlspecialchars($token[1]) . "]<br/>";
} else {
print "SIMPLE: [" . htmlspecialchars($token) . "]<br/>";
}
print '</div>';
}
return $token;
}
 
function token_skip_whitespace(&$tokens)
{
while ($tokens[0][0] == T_WHITESPACE) {
array_shift($tokens);
 
}
}
 
function token_get_string(&$tokens, $string = NULL)
{
$levels = 0;
while (count($tokens))
{
$token = token_shift($tokens);
if (is_array($token))
{
switch ($token[0])
{
case T_COMMENT:
if (strstr($token[1], 'DEPRECATED')) {
global $in_deprecated;
$in_deprecated = true;
}
break;
// Tokens which we handle in scalar token code.
case T_DOUBLE_ARROW:
$token = '=>';
break;
case T_CURLY_OPEN:
$token = '{';
break;
case T_WHITESPACE:
case T_ENCAPSED_AND_WHITESPACE:
case T_CONSTANT_ENCAPSED_STRING:
case T_NUM_STRING:
case T_STRING:
case T_ARRAY:
case T_LNUMBER:
case T_VARIABLE:
case T_CHARACTER:
$string .= $token[1];
break;
default:
die ("Unhandled complex " . token_name($token[0]) . " token in token_get_string: " .
htmlspecialchars($token[1]));
break;
}
}
if (is_scalar($token))
{
$oldlevels = $levels;
// Keep track of nested brackets and curlies.
if ($token == '(' || $token == '{' || $token == '[') {
$levels++;
} elseif ($levels && ($token == ')' || $token == '}' || $token == ']')) {
$levels--;
}
if ($levels || $oldlevels) {
$string .= $token;
} else {
// Tokens which end a string.
if ($token == ';' || $token == '=' ||
$token == '=>' || $token == ',' ||
$token == ')') {
$string = trim($string);
return array($string, $token);
} else {
$string .= $token;
}
}
}
}
}
 
// This function retrieves all info from a language file, by directly
// parsing its tokens. We can't simply load the language file, because
// we have to extract any PHP code intact from it. By loading, all
// PHP code would be interpreted.
function phorum_get_language($lang)
{
$path = "./include/lang/$lang.php";
$PHORUM = array();
$DEPRECATED = array();
$keep_comment = '';
if (! file_exists($path)) {
die("Cannot locate language module in $path");
}
// Read the language file. Keep track of comments that
// we want to keep (those starting with '##').
$file = '';
$fp = fopen($path, "r");
if (! $fp) die("Cannot read language file $path");
while (($line = fgets($fp))) {
$file .= $line;
if (substr($line, 0, 2) == '##') {
$keep_comment .= $line;
}
}
fclose($fp);
// Split the contents of the language file into PHP tokens.
$tokens = token_get_all($file);
// Parse the PHP tokens.
while (count($tokens))
{
// Extract all variables. The rest is ignored.
$token = token_shift($tokens);
if (is_array($token))
{
if ($token[0] == T_VARIABLE) {
list($varname,$endedby) = token_get_string($tokens, $token[1]);
if ($endedby != '=') break; // We want only the assignments.
// Peek at the following code, to see what type of variable we're
// handling. Scalar or array.
token_skip_whitespace($tokens);
if ($tokens[0][0] == T_ARRAY)
{
global $in_deprecated;
$in_deprecated = false;
// Handle opening bracket for the array.
token_shift($tokens);
token_skip_whitespace($tokens);
$token = token_shift($tokens);
if ($token != '(') {
die("$path: Expected array opening bracket for array " .
htmlspecialchars($varname));
}
 
while (count($tokens))
{
// Get key
list($key, $endedby) = token_get_string($tokens);
if ($endedby != '=>') {
die("$path: Expected double arrow (=>) for key " .
htmlspecialchars($key) . " in array " .
htmlspecialchars($varname) . ", but got $endedby");
}
 
// Get value
list($val, $endedby) = token_get_string($tokens);
if ($endedby != ',' && $endedby != ')') {
die("$path: Expected ending comma or bracket for key " .
htmlspecialchars($key) . " in array " .
htmlspecialchars($varname) . ", but got $endedby");
}
// Put the data in the environment.
$fullvar = $varname . '[' . $key . ']';
eval("$fullvar = '" . urlencode($val) . "';");
 
// Keep track of data flagged deprecated.
if ($in_deprecated) {
eval("\$DEPRECATED[$key] = true;");
}
// Last key/value pair?
if ($endedby == ')') break;
token_skip_whitespace($tokens);
if ($tokens[0] == ')') {
array_shift($tokens);
break;
}
}
} else {
list($varvalue,$endedby) = token_get_string($tokens);
eval("$varname = '" . urlencode($varvalue) . "';");
}
}
}
}
if ($keep_comment == '') {
$keep_comment = <<<HELP
## For adding information to the start of this language file,
## you can use comments starting with "##". Those comments will
## be kept intact when a new language file is generated by the
## language file maintenance software.
HELP;
}
// These aren't inside $PHORUM, but we put them there so we have
// access to them later on.
$PHORUM['STORE']['language_hide'] = $language_hide;
$PHORUM['STORE']['language'] = $language;
$PHORUM['STORE']['keep_comment'] = $keep_comment;
$PHORUM['STORE']['DEPRECATED'] = $DEPRECATED;
 
if (TOKEN_DEBUGGER){
print_var($PHORUM);
}
return $PHORUM;
}
 
 
// ======================================================================
// Extracting language strings from distribution files
// ======================================================================
 
function phorum_extract_language_strings()
{
global $extract_strings;
$extract_strings = array();
phorum_extract_language_strings_recurse(".");
return $extract_strings;
}
 
// This function processes directories recursively to search
// for language strings.
function phorum_extract_language_strings_recurse($path)
{
global $extract_strings;
 
$dh = opendir($path);
while (($f = readdir($dh)))
{
$file = "$path/$f";
$ext = null;
if (preg_match('/\.(\w+)$/', $f, $m)) $ext = $m[1];
 
// Skip what we do not want to index.
if ($f == "." || $f == "..") continue; // this and parent dir
if ($f == ".svn") continue; // SVN data directories
if ($f == "lang") continue; // language files
if ($f == "mods") continue; // mods
if ($f == "docs") continue; // documentation
if ($f == "cache") continue; // the cache directory
 
if (preg_match('/\.(php|tpl)$/', $file)) {
$fp = fopen($file, "r");
if (! $fp) die("Can't read file '$file'");
while (($line = fgets($fp, 1024))) {
$strings = array();
if (preg_match_all('/LANG->([\w_-]+)/', $line, $m, PREG_SET_ORDER)) {
$strings = array_merge($strings, $m);
}
if (preg_match_all('/\$PHORUM\[["\']DATA["\']\]\[["\']LANG["\']\]\[["\']([^"\']+)["\']\]/', $line, $m, PREG_SET_ORDER)) {
$strings = array_merge($strings, $m);
}
foreach ($strings as $string) {
if (! isset($extract_strings[$string])) {
$extract_strings[$string] = array('files'=>array());
}
$extract_strings[$string[1]]['files'][$file]++;
$extract_strings[$string[1]]['source'][$string[0]]++;
 
}
}
fclose($fp);
}
if (is_dir($file)) {
phorum_extract_language_strings_recurse($file);
}
}
closedir($dh);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/forum_defaults.php
New file
0,0 → 1,26
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
define("PHORUM_DEFAULT_OPTIONS", 1);
 
include "./include/admin/newforum.php";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/groups.php
New file
0,0 → 1,251
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
 
if(count($_POST)){
 
if( isset($_POST['action']) && $_POST['action'] == "deleteGroups") {
$count=0;
foreach($_POST['deleteIds'] as $id => $deluid) {
phorum_db_delete_group($deluid);
$count++;
}
echo "$count Group(s) deleted.<br />";
}
 
switch ($_POST["section"]) {
 
case "add":
$group_id=0;
$_POST["group_name"]=trim($_POST["group_name"]);
if(!empty($_POST["group_name"])){
$group_id=phorum_db_add_group($_POST["group_name"]);
}
if(!$group_id){
echo "Error adding group<br />";
} else {
echo "Group added<br />";
}
break;
 
case "edit":
$group = array("group_id" => $_POST["group_id"], "name" => $_POST["name"], "open" => $_POST["open"]);
 
if(phorum_db_save_group($group)){
echo "Group Saved";
} else {
echo "Error Saving Group Name";
}
break;
case "forums":
$group=$_POST;
if($_POST["new_forum"]){
if(!is_array($_POST["new_permissions"])){
$permission=0;
} else {
$permission = 0;
foreach($_POST["new_permissions"] as $perm=>$check){
$permission = $permission | $perm;
}
}
 
$group["permissions"][$_POST["new_forum"]]=$permission;
}
 
if(isset($_POST["delforum"])){
foreach($_POST["delforum"] as $fid=>$val){
unset($group["permissions"][$fid]);
unset($_POST["forums"][$fid]);
}
}
 
 
if(isset($_POST["forums"])){
foreach($_POST["forums"] as $forum_id){
$permission=0;
if(isset($group["permissions"][$forum_id])){
foreach($group["permissions"][$forum_id] as $perm=>$check){
$permission = $permission | $perm;
}
}
 
$group["permissions"][$forum_id]=$permission;
}
}
 
unset($group["forums"]);
unset($group["delforum"]);
unset($group["new_forum"]);
unset($group["new_permissions"]);
 
if(phorum_db_save_group($group)){
// clearing user-cache if needed
if(isset($PHORUM['cache_users']) && $PHORUM['cache_users']) {
$group_members=phorum_db_get_group_members($_POST["group_id"]);
if(count($group_members)) {
foreach($group_members as $user_id => $user_status) {
phorum_cache_remove('user',$user_id);
}
}
}
echo "Group Forum Permissions Saved";
} else {
echo "Error Saving Group Forum Permissions";
}
 
 
break;
 
}
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
$groups=phorum_db_get_groups();
$forums=phorum_db_get_forums();
 
if(isset($_GET["edit"])){
 
$group=$groups[$_GET["group_id"]];
 
$frm =& new PhorumInputForm ("", "post");
$frm->addbreak("Edit Group");
$frm->hidden("module", "groups");
$frm->hidden("section", "edit");
 
$frm->hidden("group_id", $_GET["group_id"]);
$open_options = array(PHORUM_GROUP_CLOSED => "No",
PHORUM_GROUP_OPEN => "Yes",
PHORUM_GROUP_REQUIRE_APPROVAL => "Yes (require Group Moderator approval)");
$frm->addrow("Name:", $frm->text_box("name", $group["name"], 50));
$frm->addrow("Allow Membership Requests:", $frm->select_tag("open", $open_options, $group["open"], ""));
$frm->show();
 
echo "<br /><hr class=\"PhorumAdminHR\" /><br />";
 
 
$frm =& new PhorumInputForm ("", "post", "Update");
 
$frm->hidden("module", "groups");
$frm->hidden("section", "forums");
 
$frm->hidden("group_id", $_GET["group_id"]);
 
$row=$frm->addbreak("Edit Forum Permissions");
 
$frm->addhelp($row, "Forum Permissions", "Permissions given to groups overwrite any permissions granted by the forum properties. Also, if a user is granted permissions directly to a forum in the user admin, any group permissions he has for that forum will be ignored. If the user is a member of two or more groups that have permissions in the same forum, the permissions will be combined. (eg. If group A allows read and reply and group B allows create and moderate, the user will receive all four permissions.)");
$forums=phorum_db_get_forums();
 
$perm_frm = $frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_READ."]", 1, "Read")."&nbsp;&nbsp;".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply")."&nbsp;&nbsp;".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics")."&nbsp;&nbsp;".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts")."<br />".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files")."<br />".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages")."&nbsp;&nbsp;".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")."&nbsp;&nbsp;";
 
$arr[]="Add A Forum...";
foreach($forums as $forum_id=>$forum){
if(empty($group["permissions"][$forum_id]) && $forum['folder_flag'] == 0)
$arr[$forum_id]=$forum["name"];
}
if(count($arr)>1)
$frm->addrow($frm->select_tag("new_forum", $arr), $perm_frm);
 
 
ksort($group["permissions"]);
if(is_array($group["permissions"])){
foreach($group["permissions"] as $forum_id=>$perms){
$perm_frm = $frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_READ."]", 1, "Read", $perms & PHORUM_USER_ALLOW_READ)."&nbsp;&nbsp;".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $perms & PHORUM_USER_ALLOW_REPLY)."&nbsp;&nbsp;".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create&nbsp;New&nbsp;Topics", $perms & PHORUM_USER_ALLOW_NEW_TOPIC)."&nbsp;&nbsp;".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts", $perms & PHORUM_USER_ALLOW_EDIT)."<br />".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files", $perms & PHORUM_USER_ALLOW_ATTACH)."<br />".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages", $perms & PHORUM_USER_ALLOW_MODERATE_MESSAGES)."&nbsp;&nbsp;".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users", $perms & PHORUM_USER_ALLOW_MODERATE_USERS)."&nbsp;&nbsp;".
 
$frm->hidden("forums[$forum_id]", $forum_id);
 
$row=$frm->addrow($forums[$forum_id]["name"]."<br />".$frm->checkbox("delforum[$forum_id]", 1, "Delete"), $perm_frm);
 
}
}
 
$frm->show();
 
}
 
if(empty($_REQUEST["edit"])){
 
$frm =& new PhorumInputForm ("", "post");
$frm->addbreak("Phorum Group Admin");
$frm->hidden("module", "groups");
$frm->hidden("section", "add");
$frm->addrow("Add A Group:", $frm->text_box("group_name", "", 50));
$frm->show();
 
echo "<hr class=\"PhorumAdminHR\" />";
echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"module\" value=\"groups\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"deleteGroups\">\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableHead\">Group</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Delete</td>\n";
echo "</tr>\n";
foreach($groups as $group){
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableRow\"><a href=\"$_SERVER[PHP_SELF]?module=groups&edit=1&group_id={$group['group_id']}\">".htmlspecialchars($group['name'])."</a></td>\n";
echo " <td class=\"PhorumAdminTableRow\">Delete? <input type=\"checkbox\" name=\"deleteIds[]\" value=\"{$group['group_id']}\"></td>\n";
echo "</tr>\n";
}
echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Delete Selected\"></td></tr>";
echo "</table></form>\n";
}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/default.php
New file
0,0 → 1,115
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$parent_id = (int)(isset($_GET["parent_id"])) ? $_GET["parent_id"] : 0;
$parent_parent_id = (int)(isset($_GET["pparent"])) ? $_GET["pparent"] : 0;
 
$forums=phorum_db_get_forums(0, $parent_id);
 
// change the display-order
if(isset($_GET['display_up']) || isset($_GET['display_down'])) {
 
// load all the forums up for ordering
foreach($forums as $forum_id=>$forum_data){
$forum_order[]=$forum_id;
}
 
// find the one we are moving
$key=array_search(isset($_GET['display_up'])?$_GET['display_up']:$_GET['display_down'], $forum_order);
$newkey=NULL;
// set the new key for it
if($key>0 && isset($_GET['display_up'])){
$newkey=$key-1;
}
if($key<count($forum_order)-1 && isset($_GET['display_down'])){
$newkey=$key+1;
}
 
// if we have a newkey, make the move
if(isset($newkey)){
$tmp=$forum_order[$key];
$forum_order[$key]=$forum_order[$newkey];
$forum_order[$newkey]=$tmp;
 
// loop through all the forums and updated the ones that changed.
// We have to look at them all because the default value for
// display order is 0 for all forums. So, in an unsorted forlder
// all the values are set to 0 until you move one.
foreach($forum_order as $new_display_order=>$forum_id){
if($forums[$forum_id]["display_order"]!=$new_display_order){
$forums[$forum_id]["display_order"]=$new_display_order;
phorum_db_update_forum($forums[$forum_id]);
}
}
 
// get a fresh forum list with updated order.
$forums=phorum_db_get_forums(0, $parent_id);
}
 
}
 
foreach($forums as $forum_id => $forum){
 
 
 
if($forum["folder_flag"]){
$type="Folder";
$actions="<a href=\"$_SERVER[PHP_SELF]?module=default&parent_id=$forum_id&pparent=$parent_id\">Browse</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=editfolder&forum_id=$forum_id\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=deletefolder&forum_id=$forum_id\">Delete</a>";
$editurl="$_SERVER[PHP_SELF]?module=editfolder&forum_id=$forum_id";
} else {
$type="Forum";
$actions="<a href=\"$_SERVER[PHP_SELF]?module=editforum&forum_id=$forum_id\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=deleteforum&forum_id=$forum_id\">Delete</a>";
$editurl="$_SERVER[PHP_SELF]?module=editforum&forum_id=$forum_id";
}
 
$rows.="<tr><td class=\"PhorumAdminTableRow\"><a href=\"$editurl\">$forum[name]</a><br />$forum[description]</td><td class=\"PhorumAdminTableRow\">$type</td><td class=\"PhorumAdminTableRow\"><a href=\"$_SERVER[PHP_SELF]?module=default&display_up=$forum_id&parent_id=$parent_id\">Up</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=default&display_down=$forum_id&parent_id=$parent_id\">Down</a></td><td class=\"PhorumAdminTableRow\">$actions</td></tr>\n";
}
 
if(empty($rows)){
$rows="<tr><td colspan=\"4\" class=\"PhorumAdminTableRow\">There are no forums or folders in this folder.</td></tr>\n";
}
 
if($parent_id>0){
$folder_data=phorum_get_folder_info();
 
$path=$folder_data[$parent_id];
} else {
$path="Choose a forum or folder.";
}
 
 
 
?>
 
<div class="PhorumAdminTitle"><?php echo "$path &nbsp;&nbsp; <a href=\"$_SERVER[PHP_SELF]?module=default&parent_id={$parent_parent_id}\"><span class=\"PhorumAdminTitle\">Go Up</span></a>";?></div>
<table border="0" cellspacing="2" cellpadding="3" width="100%">
<tr>
<td class="PhorumAdminTableHead">Name</td>
<td class="PhorumAdminTableHead">Type</td>
<td class="PhorumAdminTableHead">Move</td>
<td class="PhorumAdminTableHead">Actions</td>
</tr>
<?php echo $rows; ?>
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/version.php
New file
0,0 → 1,108
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check for a new version of the Phorum software. If there's a new version,
// inform the admin about this.
 
if(!defined("PHORUM_ADMIN")) return;
 
require_once("./include/version_functions.php");
 
// Put in a variable, for easy testing of other version numbers.
$phorum_ver = PHORUM;
 
print '<div class="PhorumAdminTitle">Check for new Phorum version</div>';
print '<br/>';
 
// Show the current software version.
list ($running_type, $dummy) = phorum_parse_version($phorum_ver);
print "You are currently running the $running_type version $phorum_ver " .
" of the Phorum software.<br/>";
 
 
// Find all available upgrades. If no releases can be found
// for some reason, we ignore this and simply pretend the installation
// is up-to-date.
$releases = phorum_find_upgrades($phorum_ver);
 
$new_s = isset($releases["stable"]) && $releases["stable"]["upgrade"];
$new_d = isset($releases["development"]) && $releases["development"]["upgrade"];
 
// Notice: when running a snapshot version.
if ($running_type == 'snapshot') {
print "<br/>If this Phorum installation is run on a production server, " .
"the Phorum team recommends upgrading to either a stable " .
"release or the latest development release. Snapshots should " .
"only be used for testing new bleeding edge features.<br/>";
}
 
// Notice: when running a stable release while a new stable is available.
if ($running_type == 'stable' && $new_s) {
print "<br/>A new stable release is available. The Phorum team " .
"recommends upgrading to this release as soon as possible.<br/>";
}
 
// Notice: when running a development release while a new stable
// and development release are available.
if ($running_type == 'development' && $new_s && $new_d) {
print "<br/>There's both a new stable and a new development release " .
"available. If this Phorum installation " .
"is run on a production server, the Phorum team recommends " .
"upgrading to the stable version.<br/>";
}
 
// Notice: when running a development release while a new dev is available.
if ($running_type == 'development' && $new_d && ! $new_s) {
print "<br/>A new development release is available. If this Phorum " .
"installation is run on a production server, the Phorum team " .
"recommends only to upgrade in case new features are needed, " .
"bugs you are suffering from are fixed or security holes have been " .
"closed. Else wait until a stable release is available.<br/>";
}
 
// Display available upgrades.
$found_upgrade = false;
foreach (array("stable","development") as $type) {
if (isset($releases[$type]) && $releases[$type]["upgrade"])
{
$found_upgrade = true;
 
$ver = $releases[$type]["version"];
print "<br/><h3 class=\"input-form-th\">";
if ($running_type == 'snapshot') {
print "The current $type release is version $ver";
} else {
print "A new $type release (version $ver) is available";
}
print "</h3>";
 
print "This release can be downloaded from:<br/><ul>";
foreach ($releases["$type"]["locations"] as $url) {
print "<li><a href=\"". htmlspecialchars($url) . "\">" .
htmlspecialchars($url) . "</a></li>";
}
print "</ul>";
}
}
 
if (! $found_upgrade) {
print "<br/><h3 class=\"input-form-th\">" .
"Your Phorum installation is up to date</h3>";
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/sanity_checks.php
New file
0,0 → 1,116
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
include_once "./include/admin/PhorumInputForm.php";
 
// The place where our sanity checking modules are.
$sanity_checks_dir = "./include/admin/sanity_checks";
 
// ========================================================================
// Load in the available sanity checks.
// ========================================================================
 
$sanity_checks = array();
$dh = opendir ($sanity_checks_dir);
if (! $dh) die("Could not open sanity checks directory");
while ($file = readdir($dh)) {
if (preg_match('/^(.+)\.php$/', $file, $m)) {
unset($phorum_check);
include("$sanity_checks_dir/$file");
$func = "phorum_check_$m[1]";
if (! isset($phorum_check) || ! function_exists($func)) {
die("$sanity_checks_dir/$file is no valid check file! " .
"Either \$phorum_check is not set or the " .
"function " . htmlspecialchars($func) . " does not exist");
continue;
}
 
$sanity_checks[] = array (
'function' => $func,
'description' => $phorum_check,
);
}
}
 
// Give module writers a possiblity to write custom sanity checks.
$sanity_checks = phorum_hook("sanity_checks", $sanity_checks);
 
// ========================================================================
// Build the sanity checking page and run all checks.
// ========================================================================
 
// Mapping of status to display representation.
$status2display = array(
// STATUS BACKGROUND FONT TEXT
PHORUM_SANITY_OK => array('green', 'white', 'ALL IS OK'),
PHORUM_SANITY_WARN => array('darkorange', 'white', 'WARNING'),
PHORUM_SANITY_CRIT => array('red', 'white', 'ERROR'),
);
 
$frm = new PhorumInputForm ("", "post", "Restart sanity checks");
$frm->hidden("module", "sanity_checks");
$frm->addbreak("Phorum System Sanity Checks");
$frm->addmessage(
"Below you will find the results for a number of sanity checks
that have been performed on your system. If you see any
warnings or errors, then read the comments for them and
try to resolve the issues."
);
 
// Make using $php_errormsg possible for the checks.
ini_set('track_errors', 1);
 
// In the case checks take a little while, we want the user
// to have visible feedback.
ob_flush();
// Run the sanity checks.
foreach ($sanity_checks as $check)
{
// Call the sanity check function. This function is expected
// to return an array containing the following elements:
//
// [1] A status, which can be one of
// PHORUM_SANITY_OK No problem found
// PHORUM_SANITY_WARN Problem found, but no fatal one
// PHORUM_SANITY_CRIT Critical problem found
//
// [2] A description of the problem that was found or NULL.
//
// [3] A solution for the problem or NULL.
//
list($status, $error, $solution) = call_user_func($check["function"]);
if (isset($error)) $error = str_replace("\n", " ", $error);
if (isset($solution)) $solution = str_replace("\n", " ", $solution);
$display = $status2display[$status];
$block = "<div style=\"color:{$display[1]};background-color:{$display[0]};text-align:center;border:1px solid black;\">{$display[2]}</div>";
$row = $frm->addrow($check['description'], $block);
if (! empty($error)) {
if (! empty($solution))
$error .= "<br/><br/>" .
"<strong>Possible solution:</strong>" .
"<br/><br/>" .
$solution;
$frm->addhelp($row,"Sanity check failed",$error);
}
}
 
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/upgrade.php
New file
0,0 → 1,85
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
if(!phorum_db_check_connection()){
echo "A database connection could not be established. Please edit include/db/config.php.";
return;
}
 
include_once "./include/admin/PhorumInputForm.php";
 
if(empty($_POST["step"])){
$step = 0;
} else {
$step = $_POST["step"];
}
 
if(isset($PHORUM['internal_version']) && $PHORUM['internal_version'] == PHORUMINTERNAL){
$step = 2;
}
 
switch ($step){
 
case 0:
 
$frm =& new PhorumInputForm ("", "post", "Continue ->");
$frm->addbreak("Phorum Upgrade");
$frm->addmessage("This wizard will upgrade Phorum on your server. Phorum has already confirmed that it can connect to your database. Press continue when you are ready.");
$frm->hidden("module", "upgrade");
$frm->hidden("step", "1");
$frm->show();
 
break;
 
case 1:
if (! ini_get('safe_mode')) {
set_time_limit(0);
ini_set("memory_limit","64M");
}
 
// ok upgrading tables
$message = phorum_upgrade_tables($PHORUM['internal_version'],PHORUMINTERNAL);
 
$frm =& new PhorumInputForm ("", "post", "Continue ->");
 
// done or not done? ;)
$stepsleft = PHORUMINTERNAL - $PHORUM['internal_version'];
$frm->addbreak("Upgrading tables (multiple steps possible) ....");
$frm->addmessage($message);
if($stepsleft > 0) {
$newstep = 1;
} else {
$newstep = 2;
}
$frm->hidden("step", $newstep);
$frm->hidden("module", "upgrade");
$frm->show();
 
break;
 
case 2:
echo "The upgrade is complete. You may want to look through the <a href=\"$_SERVER[PHP_SELF]\">the admin</a> for any new features in this version.";
 
break;
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/header.php
New file
0,0 → 1,395
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
if(empty($PHORUM["http_path"])){
$PHORUM["http_path"]=dirname($_SERVER["PHP_SELF"]);
}
 
 
// load the default Phorum language
if(isset($PHORUM["default_language"])){
include_once( "./include/lang/$PHORUM[default_language].php" );
}
?>
<!-- // // HTTP Content-Type header with the charset from the default language
// if (isset($PHORUM["DATA"]['CHARSET'])) {
// header("Content-Type: text/html; " .
// "charset=".htmlspecialchars($PHORUM["DATA"]['CHARSET']));
// }
//?>
//<html>
//<head>
//<title>Phorum Admin</title>
//<?php
//
//// meta data with the charset from the default language
//if (isset($PHORUM["DATA"]['CHARSET'])) {
// echo "<meta content=\"text/html; charset=".$PHORUM["DATA"]["CHARSET"]."\" http-equiv=\"Content-Type\">\n";
//}
//
//?>
//<style type="text/css">
//
//body
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
//}
//
//input, textarea, select, td
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
// border-color: #EEEEEE;
//}
//
//.input-form-th
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
// padding: 3px;
// background-color: #DDDDEA;
//}
//
//.input-form-td
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
// padding: 3px;
// background-color: #EEEEFA;
//}
//
//.input-form-td-break, .PhorumAdminTitle
//{
// font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif;
// font-size: 16px;
// font-weight: bold;
// padding: 3px;
// background-color: Navy;
// color: White;
//}
//
//.input-form-td-message
//{
// font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif;
// font-size: 13px;
// padding: 10px;
// background-color: White;
// color: Black;
//}
//
//.PhorumAdminMenu
//{
// width: 150px;
// border: 1px solid Navy;
// font-size: 13px;
// margin-bottom: 3px;
// line-height: 18px;
// padding: 3px;
//}
//
//.PhorumAdminMenuTitle
//{
// width: 150px;
// border: 1px solid Navy;
// background-color: Navy;
// color: white;
// font-size: 14px;
// font-weight: bold;
// padding: 3px;
//}
//
//.PhorumAdminTableRow
//{
// background-color: #EEEEFA;
// color: Navy;
// padding: 3px;
// font-size: 13px;
//}
//
//.PhorumAdminTableRowAlt
//{
// background-color: #d6d6e0;
// color: Navy;
// padding: 3px;
// font-size: 13px;
//}
//
//.PhorumAdminTableHead
//{
// background-color: Navy;
// color: White;
// padding: 3px;
// font-weight: bold;
// font-size: 13px;
//}
//
//.PhorumInfoMessage
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
// padding: 3px;
// background-color: #EEEEFA;
// width: 300px;
// align: center;
// text-align: left;
//}
//
//.PhorumAdminError
//{
// background-image: url("./images/alert.gif");
// background-position: 5px 5px;
// background-repeat: no-repeat;
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 15px;
// padding: 12px 12px 12px 50px;
// color: #000000;
// border: 2px solid red;
// margin-bottom: 3px;
//}
//
//.PhorumAdminOkMsg
//{
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 15px;
// padding: 12px;
// color: #000000;
// border: 2px solid darkgreen;
// margin-bottom: 3px;
//}
//
//.small
//{
// font-size: 10px;
//}
//
//.help-td, .help-td a
//{
// color: White;
// padding-bottom: 2px;
// text-decoration: none;
//}
//
//#phorum-status
//{
// vertical-align: middle;
//}
//
//#status-form
//{
// display: inline;
//}
//
//img.question
//{
// padding: 0 5px 1px 5px;
// vertical-align: middle;
//}
//
//#helpdiv
//{
// position: absolute;
// display: none;
// width: 400px;
// border: 2px solid Navy;
//}
//
//#helpdiv-hide
//{
// float: right;
//}
//
//#helpdiv-title
//{
// color: White;
// background-color: Navy;
// padding: 1px 1px 3px 1px;
//}
//
//#helpdiv-content
//{
// background-color: White;
// height: 200px;
// padding: 8px;
// font-family: Lucida Sans Unicode, Lucida Grand, Verdana, Arial, Helvetica;
// font-size: 13px;
// overflow: scroll;
//}
//
//#help-title
//{
// font-weight: bold;
// margin-bottom: 3px;
//}
//
//</style>
//<script>
//
//function show_help(key)
//{
// if (document.all) {
// topoffset=document.body.scrollTop;
// leftoffset=document.body.scrollLeft;
// WIDTH=document.body.clientWidth;
// HEIGHT=document.body.clientHeight;
// } else {
// topoffset=pageYOffset;
// leftoffset=pageXOffset;
// WIDTH=window.innerWidth;
// HEIGHT=window.innerHeight;
// }
//
// if(WIDTH%2!=0) WIDTH--;
// if(HEIGHT%2!=0) HEIGHT--;
//
// newtop=((HEIGHT-200)/2)+topoffset;
//
// // IE still puts selects on top of stuff so it has to be fixed to the left some
// if (document.all) {
// newleft=150;
// } else {
// newleft=((WIDTH-400)/2)+leftoffset;
// }
//
// document.getElementById('helpdiv').style.left=newleft;
// document.getElementById('helpdiv').style.top=newtop;
//
// document.getElementById('help-title').innerHTML = help[key][0];
// document.getElementById('help-text').innerHTML = help[key][1];
//
// document.getElementById('helpdiv').style.display = 'block';
//
//}
//
//function hide_help()
//{
// document.getElementById('helpdiv').style.display = 'none';
// document.getElementById('help-title').innerHTML = "";
// document.getElementById('help-text').innerHTML = "";
//}
//
//</script>
//</head>
//<body>
//<div id="helpdiv">
//<div id="helpdiv-hide"><a href="javascript:hide_help();"><img border="0" src="images/close.gif" height="16" width="16" /></a></div>
//<div id="helpdiv-title">&nbsp;Phorum Admin Help</div>
//<div id="helpdiv-content">
//<div id="help-title"></div>
//<div id="help-text"></div>
//</div>
//</div>
-->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: Navy;">Phorum Admin<small><br />version <?php echo PHORUM; ?></small></td>
<?php if(empty($module)){ // only show the versioncheck if you are on the front page of the admin ?>
<td style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: Navy;" align="center" valign="middle">
<iframe scrolling="no" frameborder="0" align="top" width="400" height="35" src="versioncheck.php"></iframe>
</td>
<?php } else {
// Reset the cookie that is used for the version check.
setcookie("phorum_upgrade_available", '', time()-86400,
$PHORUM["session_path"], $PHORUM["session_domain"]);
} ?>
<td style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: Navy;" align="right">
 
<div id="phorum-status">
<?php if($module!="login" && $module!="install" && $module!="upgrade"){ ?>
<form id="status-form" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="hidden" name="module" value="status" />
Phorum Status:
<select name="status" onChange="this.form.submit();">
<option value="normal" <?php if($PHORUM["status"]=="normal") echo "selected"; ?>>Normal</option>
<option value="read-only"<?php if($PHORUM["status"]=="read-only") echo "selected"; ?>>Read Only</option>
<option value="admin-only"<?php if($PHORUM["status"]=="admin-only") echo "selected"; ?>>Admin Only</option>
<option value="disabled"<?php if($PHORUM["status"]=="disabled" || !phorum_db_check_connection()) echo "selected"; ?>>Disabled</option>
</select>
</form>
<?php } ?>
</div>
<?php if(isset($PHORUM['user'])) { ?>
<small>Logged In As <?php echo $PHORUM["user"]["username"]; ?></small>
<?php } ?>
</td>
</tr>
</table><br />
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<?php
 
if($module!="login" && $module!="install" && $module!="upgrade"){
?>
<tr>
<td valign="top">
<?php
include_once "./include/admin/PhorumAdminMenu.php";
 
$menu = new PhorumAdminMenu("Main Menu");
 
$menu->add("Admin Home", "", "Takes you to the default Admin page.");
$menu->add("Phorum Index", "index", "Takes you to the front page of the Phorum.");
$menu->add("Log Out", "logout", "Logs you out of the admin.");
 
$menu->show();
 
$menu = new PhorumAdminMenu("Global Settings");
 
$menu->add("General Settings", "settings", "Edit the global settings which affect the enter installation.");
$menu->add("Ban Lists", "banlist", "Edits the list of banned names, email addresses and IP addresses.");
$menu->add("Censor List", "badwords", "Edit the list of words that are censored in posts.");
$menu->add("Modules", "mods", "Administer the Phorum Modules that are installed.");
 
$menu->show();
 
$menu = new PhorumAdminMenu("Forums");
 
$menu->add("Manage Forums", "", "Takes you to the default Admin page.");
$menu->add("Default Settings", "forum_defaults", "Allows you to set defaults settings that can be inherited by forums.");
$menu->add("Create Forum", "newforum", "Creates a new area for your users to post messages.");
$menu->add("Create Folder", "newfolder", "Creates a folder which can contain other folders of forums.");
 
$menu->show();
 
$menu = new PhorumAdminMenu("Users/Groups");
 
$menu->add("Edit Users", "users", "Allows administrator to edit users including deactivating them.");
$menu->add("Edit Groups", "groups", "Allows administrator to edit groups and their forum permissions.");
$menu->add("Custom Profiles", "customprofile", "Allows administrator to add fields to Phorum profile.");
 
$menu->show();
$menu = new PhorumAdminMenu("Maintenance");
 
$menu->add("Check For New Version", "version", "Check for new releases.");
$menu->add("Prune Messages", "message_prune", "Pruning old messages.");
$menu->add("Purge Stale Files", "file_purge", "Purging stale files from the database.");
$menu->add("System Sanity Checks", "sanity_checks", "Perform a number of sanity checks on the system to identify possible problems.");
$menu->add("Manage Language Files", "manage_languages", "Allows administrator to create new or updated versions of language files.");
 
$menu->show();
 
?>
<img src="<?php echo "$PHORUM[http_path]/images/trans.gif"; ?>" alt="" border="0" width="150" height="1" />
</td>
<td valign="top"><img src="<?php echo "$PHORUM[http_path]/images/trans.gif"; ?>" alt="" border="0" width="15" height="15" /></td>
<?php
}
?>
<td valign="top" width="100%">
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/banlist.php
New file
0,0 → 1,141
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
$curr="NEW";
 
$ban_types = array(PHORUM_BAD_IPS=>"IP Address/Hostname", PHORUM_BAD_NAMES=>"Name/User Name", PHORUM_BAD_EMAILS=>"Email Address", PHORUM_BAD_USERID=>"User-Id (registered User)", PHORUM_BAD_SPAM_WORDS=>"Illegal Words (SPAM)");
 
$match_types = array("string", "PCRE");
 
$forum_list=phorum_get_forum_info(2);
$forum_list[0]="GLOBAL";
 
if(count($_POST) && $_POST["string"]!=""){
 
if($_POST["curr"]!="NEW"){
$ret=phorum_db_mod_banlists($_POST['type'],$_POST['pcre'],$_POST['string'],$_POST['forumid'],$_POST["curr"]);
} else {
$ret=phorum_db_mod_banlists($_POST['type'],$_POST['pcre'],$_POST['string'],$_POST['forumid'],0);
}
 
if(!$ret){
$error="Database error while updating settings.";
} else {
echo "Ban Item Updated<br />";
}
}
 
if(isset($_GET["curr"])){
if(isset($_GET["delete"])){
phorum_db_del_banitem($_GET['curr']);
echo "Ban Item Deleted<br />";
} else {
$curr = $_GET["curr"];
}
}
 
if($curr!="NEW"){
extract(phorum_db_get_banitem($curr));
$title="Edit Ban Item";
$submit="Update";
} else {
settype($string, "string");
settype($type, "int");
settype($pcre, "int");
settype($forumid,"int");
$title="Add A Ban Item";
$submit="Add";
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
 
 
$frm =& new PhorumInputForm ("", "post", $submit);
 
$frm->hidden("module", "banlist");
 
$frm->hidden("curr", "$curr");
 
$frm->addbreak($title);
 
$frm->addrow("String To Match", $frm->text_box("string", $string, 50));
 
$frm->addrow("Field To Match", $frm->select_tag("type", $ban_types, $type));
 
$frm->addrow("Compare As", $frm->select_tag("pcre", $match_types, $pcre));
 
$frm->addrow("Valid for Forum", $frm->select_tag("forumid", $forum_list, $forumid));
 
$frm->show();
 
echo "If using PCRE for comparison, \"String To Match\" should be a valid PCRE expression. See <a href=\"http://php.net/pcre\" target=\"_blank\">the PHP manual</a> for more information.";
 
if($curr=="NEW"){
 
$PHORUM['banlists']=phorum_db_get_banlists(true);
unset($PHORUM['banlists'][PHORUM_BAD_WORDS]);
 
echo "<hr class=\"PhorumAdminHR\" />";
 
if(count($PHORUM['banlists'])){
 
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableHead\">String</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Field</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Compare Method</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
echo " <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
echo "</tr>\n";
 
 
 
foreach($PHORUM["banlists"] as $type => $content){
$t_last_string = '';
foreach($content as $key => $item){
$ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
echo "<tr>\n";
echo " <td class=\"".$ta_class."\"".($item["string"] == $t_last_string ? " style=\"color:red;\"" : "").">".htmlspecialchars($item['string'])."</td>\n";
echo " <td class=\"".$ta_class."\">".$ban_types[$type]."</td>\n";
echo " <td class=\"".$ta_class."\">".$match_types[$item["pcre"]]."</td>\n";
echo " <td class=\"".$ta_class."\">".$forum_list[$item["forum_id"]]."</td>\n";
echo " <td class=\"".$ta_class."\"><a href=\"$_SERVER[PHP_SELF]?module=banlist&curr=$key&edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=banlist&curr=$key&delete=1\">Delete</a></td>\n";
echo "</tr>\n";
$t_last_string = $item["string"];
}
}
 
echo "</table>\n";
 
} else {
 
echo "No bans in list currently.";
 
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/message_prune.php
New file
0,0 → 1,77
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
 
$forums=phorum_db_get_forums();
$forum_list=array(0=>"All Forums");
 
foreach($forums as $forum_idn=>$forum){
if($forum['folder_flag'] == 0)
$forum_list[$forum_idn]=$forum["name"];
}
if(count($_POST)){
 
if($_POST["days"] > 0){
$ret=phorum_db_prune_oldThreads(time()-(86400*$_POST['days']), intval($_POST['forumid']), $_POST['mode']);
// updating forum-stats
if($_POST['forumid']) {
$PHORUM['forum_id']=$_POST['forumid'];
phorum_db_update_forum_stats(true);
} else {
foreach($forum_list as $fid => $fname) {
$PHORUM['forum_id']=$fid;
phorum_db_update_forum_stats(true);
}
}
// prune messages
}
 
if(!$ret){
$error="No messages deleted.<br />";
} else {
echo "$ret Messages deleted.<br />";
}
}
 
if($error){
phorum_admin_error($error);
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post", "Delete messages");
 
$frm->hidden("module", "message_prune");
 
$frm->addbreak("Pruning old threads ...");
$frm->addmessage("ATTENTION!<br />This script deletes quickly A LOT of messages. Use it on your own risk.<br />There is no further confirmation message after sending this form!");
 
$frm->addrow("older than (days from today)",$frm->text_box("days", "365", 10));
$frm->addrow("in Forum", $frm->select_tag("forumid", $forum_list,0));
$frm->addrow("Check for", $frm->select_tag("mode", array(1=>"When the thread was started",2=>"When the last answer to the thread was posted"),0));
 
$frm->show();
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/admin/modsettings.php
New file
0,0 → 1,35
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM_ADMIN")) return;
 
$mod=$_REQUEST["mod"];
 
if(file_exists("./mods/$mod/settings.php")){
 
include_once("./mods/$mod/settings.php");
 
} else {
 
echo "There are no settings for this module.";
 
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/cache.php
New file
0,0 → 1,176
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
/*
* Simple file-based caching-layer
* Recommended are some more sophisticated solutions, like
* memcached-, mmcache/eaccelerator-layer
*/
if(!defined("PHORUM")) return;
 
/* Only load the caching mechanism if we have a cache directory configured. */
if(!isset($PHORUM["cache"])) return;
/* initializing our real cache-dir */
$PHORUM['real_cache']=$PHORUM['cache']."/".md5(__FILE__);
 
 
 
/*
* This function returns the cached data for the given key
* or NULL if no data is cached for this key
*/
function phorum_cache_get($type,$key) {
$partpath=$GLOBALS['PHORUM']['real_cache']."/".$type;
 
if(is_array($key)) {
$ret=array();
foreach($key as $realkey) {
$path=$partpath."/".wordwrap(md5($realkey), PHORUM_CACHE_SPLIT, "/", true)."/data.php";
if(file_exists($path)){
$retval=unserialize(file_get_contents($path));
// the data is: array($ttl_time,$data)
if($retval[0] < time()) { // timeout
unlink($path);
} else {
$ret[$realkey]=$retval[1];
}
unset($retval);
}
}
} else {
$path=$partpath."/".wordwrap(md5($key), PHORUM_CACHE_SPLIT, "/", true)."/data.php";
if(!file_exists($path)){
$ret=NULL;
} else {
$ret=unserialize(file_get_contents($path));
// the data is: array($ttl_time,$data)
if($ret[0] < time()) { // timeout
$ret=NULL;
unlink($path);
} else {
$ret=$ret[1];
}
}
}
if(is_array($ret) && count($ret) == 0) {
$ret=NULL;
}
return $ret;
}
 
/*
* Puts some data into the cache
* returns number of bytes written (something 'true') or false ...
* depending of the success of the function
*/
function phorum_cache_put($type,$key,$data,$ttl=PHORUM_CACHE_DEFAULT_TTL) {
 
$path=$GLOBALS['PHORUM']['real_cache']."/$type/".wordwrap(md5($key), PHORUM_CACHE_SPLIT, "/", true);
if(!file_exists($path)){
phorum_cache_mkdir($path);
}
$file=$path."/data.php";
$ttl_time=time()+$ttl;
$fp=fopen($file,"w");
$ret=fwrite($fp,serialize(array($ttl_time,$data)));
fclose($fp);
return $ret;
}
 
/*
* Removes a key from the cache
*/
function phorum_cache_remove($type,$key) {
 
$ret =true;
$path=$GLOBALS['PHORUM']['real_cache']."/$type/".wordwrap(md5($key), PHORUM_CACHE_SPLIT, "/", true)."/data.php";
if(file_exists($path)) {
$ret=unlink($path);
}
return $ret;
}
 
/*
* Clears all data from the cache
*/
function phorum_cache_clear() {
$dir = $GLOBALS['PHORUM']['real_cache'];
$ret = false;
if(!empty($dir) && $dir != "/") {
phorum_cache_rmdir($dir);
}
return $ret;
}
 
/*
type can be nearly each value to specify a group of data
used are currently:
'user'
*/
 
// helper functions
 
// recursively deletes all files/dirs in a directory
 
// recursively creates a directory-tree
function phorum_cache_mkdir($path) {
if(empty($path)) return false;
if(is_dir($path)) return true;
if (!phorum_cache_mkdir(dirname($path))) return false;
mkdir($path);
return true;
}
 
// recursively deletes all files/dirs in a directory
function phorum_cache_rmdir( $path ) {
$stack[]=$path;
 
$dirs[]=$path;
 
while(count($stack)){
$path=array_shift($stack);
$dir = opendir( $path ) ;
while ( $entry = readdir( $dir ) ) {
if ( is_file( $path . "/" . $entry ) ) {
unlink($path."/".$entry);
} elseif ( is_dir( $path . "/" . $entry ) && $entry != '.' && $entry != '..' ) {
array_unshift($dirs, $path . "/" . $entry) ;
$stack[]=$path . "/" . $entry ;
}
}
closedir( $dir ) ;
}
foreach($dirs as $dir){
rmdir($dir);
}
return;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/index_classic.php
New file
0,0 → 1,96
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
$forums = phorum_db_get_forums( 0, $parent_id );
 
$PHORUM["DATA"]["FORUMS"] = array();
 
$forums_shown=false;
 
foreach( $forums as $forum ) {
 
if ( $forum["folder_flag"] ) {
 
$forum["url"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );
 
} else {
 
if($PHORUM["hide_forums"] && !phorum_user_access_allowed(PHORUM_USER_ALLOW_READ, $forum["forum_id"])){
continue;
}
 
$forum["url"] = phorum_get_url( PHORUM_LIST_URL, $forum["forum_id"] );
 
// if there is only one forum in Phorum, redirect to it.
if ( $parent_id==0 && count( $forums ) < 2 ) {
phorum_redirect_by_url($forum['url']);
exit();
}
 
if ( $forum["message_count"] > 0 ) {
$forum["last_post"] = phorum_date( $PHORUM["long_date"], $forum["last_post_time"] );
} else {
$forum["last_post"] = "&nbsp;";
}
 
if($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM["show_new_on_index"]){
list($forum["new_messages"], $forum["new_threads"]) = phorum_db_newflag_get_unread_count($forum["forum_id"]);
}
}
 
$forums_shown=true;
 
$PHORUM["DATA"]["FORUMS"][] = $forum;
}
 
if(!$forums_shown){
// we did not show any forums here, show an error-message
// set all our URL's
phorum_build_common_urls();
unset($PHORUM["DATA"]["URL"]["TOP"]);
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoForums"];
include phorum_get_template( "header" );
phorum_hook( "after_header" );
include phorum_get_template( "message" );
phorum_hook( "before_footer" );
include phorum_get_template( "footer" );
} else {
$PHORUM["DATA"]["FORUMS"]=phorum_hook("index", $PHORUM["DATA"]["FORUMS"]);
// set all our URL's
phorum_build_common_urls();
// should we show the top-link?
if($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id']) {
unset($PHORUM["DATA"]["URL"]["INDEX"]);
}
include phorum_get_template( "header" );
phorum_hook("after_header");
include phorum_get_template( "index_classic" );
phorum_hook("before_footer");
include phorum_get_template( "footer" );
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/constants.php
New file
0,0 → 1,222
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
// put constants here that are configurable
// these should be things that will not be changed
// very often. Things that are likely to be changed
// by most admins should go in the admin.
 
define("PHORUM_FILE_EXTENSION", "php");
 
// number of messages remembered as new
define("PHORUM_MAX_NEW_INFO", 1000);
 
// can moderators view email addresses
define("PHORUM_MOD_EMAIL_VIEW", true);
 
// can moderators view user's ip
define("PHORUM_MOD_IP_VIEW", true);
 
// change the author's name on deleting the user
define("PHORUM_DELETE_CHANGE_AUTHOR", true);
 
// enforce the use of only unregistered names for unregistered users
define("PHORUM_ENFORCE_UNREGISTERED_NAMES",true);
 
// maximum time in seconds for having the message editor open
// this is used in determining stale attachment files
define("PHORUM_MAX_EDIT_TIME", 86400);
 
// string used to separate things like items in the title tag.
define("PHORUM_SEPARATOR", " :: ");
 
// default TTL for cache-data if not specified different
define('PHORUM_CACHE_DEFAULT_TTL',3600);
 
// split-variable for file-based cache
define('PHORUM_CACHE_SPLIT',4);
 
// the replace string for masking bad words.
define('PHORUM_BADWORD_REPLACE', '@#$%&');
 
/////////////////////////////////////////
// //
// DO NOT EDIT BELOW THIS AREA //
// //
/////////////////////////////////////////
 
// put constants here that need to stay the same value here.
 
define("PHORUM_UPLOADS_SELECT", 0);
define("PHORUM_UPLOADS_REG", 1);
 
define("PHORUM_MODERATE_OFF", 0);
define("PHORUM_MODERATE_ON", 1);
 
define("PHORUM_EMAIL_MODERATOR_OFF", 0);
define("PHORUM_EMAIL_MODERATOR_ON", 1);
 
define("PHORUM_STATUS_APPROVED", 2);
define("PHORUM_STATUS_HOLD", -1);
define("PHORUM_STATUS_HIDDEN", -2);
 
define("PHORUM_SORT_ANNOUNCEMENT", 0);
define("PHORUM_SORT_STICKY", 1);
define("PHORUM_SORT_DEFAULT", 2);
 
define("PHORUM_THREADED_DEFAULT", 0);
define("PHORUM_THREADED_ON", 1);
define("PHORUM_THREADED_OFF", 2);
 
define("PHORUM_SUBSCRIPTION_MESSAGE", 0);
define("PHORUM_SUBSCRIPTION_DIGEST", 1);
define("PHORUM_SUBSCRIPTION_BOOKMARK", 2);
 
define("PHORUM_REGISTER_INSTANT_ACCESS", 0);
define("PHORUM_REGISTER_VERIFY_EMAIL", 1);
define("PHORUM_REGISTER_VERIFY_MODERATOR", 2);
define("PHORUM_REGISTER_VERIFY_BOTH", 3);
 
define("PHORUM_USER_PENDING_BOTH", -3);
define("PHORUM_USER_PENDING_EMAIL", -2);
define("PHORUM_USER_PENDING_MOD", -1);
define("PHORUM_USER_INACTIVE", 0);
define("PHORUM_USER_ACTIVE", 1);
 
define("PHORUM_USER_ALLOW_READ", 1);
define("PHORUM_USER_ALLOW_REPLY", 2);
define("PHORUM_USER_ALLOW_EDIT", 4);
define("PHORUM_USER_ALLOW_NEW_TOPIC", 8);
define("PHORUM_USER_ALLOW_ATTACH", 32);
define("PHORUM_USER_ALLOW_MODERATE_MESSAGES", 64);
define("PHORUM_USER_ALLOW_MODERATE_USERS", 128);
define("PHORUM_USER_ALLOW_FORUM_PROPERTIES", 256);
 
define("PHORUM_MODERATE_ALLOWED_ANYWHERE", -1);
 
define("PHORUM_USER_GROUP_REMOVE", -128);
define("PHORUM_USER_GROUP_SUSPENDED", -1);
define("PHORUM_USER_GROUP_UNAPPROVED", 0);
define("PHORUM_USER_GROUP_APPROVED", 1);
define("PHORUM_USER_GROUP_MODERATOR", 2);
 
define("PHORUM_GROUP_CLOSED", 0);
define("PHORUM_GROUP_OPEN", 1);
define("PHORUM_GROUP_REQUIRE_APPROVAL", 2);
 
define("PHORUM_NEWFLAG_MSG", 0);
define("PHORUM_NEWFLAG_MIN_ID", 1);
 
define("PHORUM_LINK_USER", "user");
define("PHORUM_LINK_MESSAGE", "message");
define("PHORUM_LINK_EDITOR", "editor");
 
// Definitions for the PM system.
// Special folders
define("PHORUM_PM_INBOX", "inbox");
define("PHORUM_PM_OUTBOX", "outbox");
define("PHORUM_PM_ALLFOLDERS", "allfolder");
// Flag types
define("PHORUM_PM_READ_FLAG", "read_flag");
define("PHORUM_PM_REPLY_FLAG", "reply_flag");
 
// constants below here do not have to have a constant value,
// as long as each is unique. They are used for enumeration.
// Add to them as you wish knowing that.
 
$i=1;
 
define("PHORUM_BAD_IPS", $i++);
define("PHORUM_BAD_NAMES", $i++);
define("PHORUM_BAD_EMAILS", $i++);
define("PHORUM_BAD_WORDS", $i++);
define("PHORUM_BAD_USERID", $i++);
define("PHORUM_BAD_SPAM_WORDS", $i++);
 
define("PHORUM_LIST_URL", $i++);
define("PHORUM_READ_URL", $i++);
define("PHORUM_FOREIGN_READ_URL", $i++);
define("PHORUM_REPLY_URL", $i++);
define("PHORUM_POSTING_URL", $i++);
define("PHORUM_REDIRECT_URL", $i++);
define("PHORUM_SEARCH_URL", $i++);
define("PHORUM_SEARCH_ACTION_URL", $i++);
define("PHORUM_DOWN_URL", $i++);
define("PHORUM_VIOLATION_URL", $i++);
define("PHORUM_USER_URL", $i++);
define("PHORUM_INDEX_URL", $i++);
define("PHORUM_LOGIN_URL", $i++);
define("PHORUM_LOGIN_ACTION_URL", $i++);
define("PHORUM_REGISTER_URL", $i++);
define("PHORUM_REGISTER_ACTION_URL", $i++);
define("PHORUM_PROFILE_URL", $i++);
define("PHORUM_SUBSCRIBE_URL", $i++);
define("PHORUM_MODERATION_URL", $i++);
define("PHORUM_MODERATION_ACTION_URL", $i++);
define("PHORUM_CONTROLCENTER_URL", $i++);
define("PHORUM_CONTROLCENTER_ACTION_URL", $i++);
define("PHORUM_PM_URL", $i++);
define("PHORUM_PM_ACTION_URL", $i++);
define("PHORUM_FILE_URL", $i++);
define("PHORUM_GROUP_MODERATION_URL", $i++);
define("PHORUM_FOLLOW_URL", $i++);
define("PHORUM_FOLLOW_ACTION_URL", $i++);
define("PHORUM_PREPOST_URL", $i++);
define("PHORUM_REPORT_URL", $i++);
define("PHORUM_RSS_URL", $i++);
define("PHORUM_CUSTOM_URL", $i++);
define("PHORUM_BASE_URL", $i++);
 
define("PHORUM_DELETE_MESSAGE", $i++);
define("PHORUM_DELETE_TREE", $i++);
define("PHORUM_MOVE_THREAD", $i++);
define("PHORUM_DO_THREAD_MOVE", $i++);
define("PHORUM_CLOSE_THREAD", $i++);
define("PHORUM_REOPEN_THREAD", $i++);
define("PHORUM_APPROVE_MESSAGE", $i++);
define("PHORUM_HIDE_POST", $i++);
define("PHORUM_APPROVE_MESSAGE_TREE", $i++);
define("PHORUM_MERGE_THREAD", $i++);
define("PHORUM_DO_THREAD_MERGE", $i++);
define("PHORUM_SPLIT_THREAD", $i++);
define("PHORUM_DO_THREAD_SPLIT", $i++);
 
define("PHORUM_SANITY_OK", $i++);
define("PHORUM_SANITY_WARN", $i++);
define("PHORUM_SANITY_CRIT", $i++);
 
define("PHORUM_CC_SUMMARY", "summary");
define("PHORUM_CC_SUBSCRIPTION_THREADS", "subthreads");
define("PHORUM_CC_SUBSCRIPTION_FORUMS", "subforums");
define("PHORUM_CC_USERINFO", "user");
define("PHORUM_CC_SIGNATURE", "sig");
define("PHORUM_CC_MAIL", "email");
define("PHORUM_CC_BOARD", "forum");
define("PHORUM_CC_PASSWORD", "password");
define("PHORUM_CC_UNAPPROVED", "messages");
define("PHORUM_CC_FILES", "files");
define("PHORUM_CC_USERS", "users");
define("PHORUM_CC_PM", "pm");
define("PHORUM_CC_PRIVACY", "privacy");
define("PHORUM_CC_GROUP_MODERATION", "groupmod");
define("PHORUM_CC_GROUP_MEMBERSHIP", "groups");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/version_functions.php
New file
0,0 → 1,175
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
/**
* Parses the Phorum version number.
* @param version - version number to parse
* @return An array containing two elements. The first one holds the release
* type, which can be "unknown" (parse failed), "snapshot", "stable"
* or "development". The version can either be NULL or an array
* containing a splitted up version number (only for "stable"
* and "development").
*/
function phorum_parse_version($version)
{
if (preg_match('/^\w+-(svn|cvs)-\d+$/', $version)) {
$release = 'snapshot';
$parsed_version = array(0,0,0,0);
} elseif (preg_match('/^(\d+)\.(\d+).(\d+)([a-z])?$/', $version, $m)) {
$release = 'stable';
$parsed_version = array_slice($m, 1);
} elseif (preg_match('/^(\d+)\.(\d+).(\d+)(-alpha|-beta|-RC\d+)?$/', $version, $m)) {
$release = 'development';
$parsed_version = array_slice($m, 1);
} else {
$release = 'unknown';
$parsed_version = NULL;
}
 
return array($release, $parsed_version);
}
 
/**
* Compares two version numbers as returned by phorum_parse_version()
* and tells which of those two is larger.
* @param version1 - The first version number
* @param version2 - The second version number
* @return 1 if version1 is higher than version2, 0 if equal, -1 if lower
*/
function phorum_compare_version($version1, $version2)
{
// Compare segment by segment which version is higher.
// Segments 1, 2 and 3 are always numbers. Segment 4 can be
// a post-release version letter (a, b, c, etc.) or a
// development release marker (-alpha and -beta).
for ($s=0; $s<=3; $s++) {
if ($s != 3) {
if ($version1[$s] > $version2[$s]) return 1;
if ($version1[$s] < $version2[$s]) return -1;
} else {
// Build a numerical representation for segment 4.
// * 0 if no segment 4 is set
// * 1 for alpha
// * 2 for beta
// * ord for single char version additions (a = 97)
$v1 = 0; $v2 = 0;
if (isset($version1[$s])) {
if ($version1[$s] == '-alpha') $v1 = 1;
elseif ($version1[$s] == '-beta') $v1 = 2;
elseif (strlen($version1[$s]) == 1) $v1 = ord($version1[$s]);
}
if (isset($version2[$s])) {
if ($version2[$s] == '-alpha') $v2 = 1;
elseif ($version2[$s] == '-beta') $v2 = 2;
elseif (strlen($version2[$s]) == 1) $v2 = ord($version2[$s]);
}
// Same version number with a development suffix is
// considered lower than without any suffix.
if ($v1 == 0 && ($v2 == 1 || $v2 == 2)) return 1;
if (($v1 == 1 || $v1 == 2) && $v2 == 0) return -1;
 
if ($v1 > $v2) return 1;
if ($v1 < $v2) return -1;
}
}
 
// No difference was found.
return 0;
}
 
/**
* Retrieves the available software versions from the Phorum website.
* The format of the data returned from the server is two lines. The first
* line is for the stable version and the second for the development version.
* Each line contains pipe separated values, with the following fields in it:
* <version>|<release date>|<downloadloc 1>|<downloadloc 2>|...|<downloadloc n>
* @return releases - An array of releases for release types "stable" and "development".
*/
function phorum_available_releases()
{
$releases = array();
$fp = @fopen("http://phorum.org/version.php", "r");
if ($fp) {
foreach (array("stable", "development") as $release) {
$line = fgets($fp, 1024);
if (strstr($line, '|')) {
$fields = explode('|', $line);
if (count($fields) >= 3) {
// See if we can parse the version and if the parsed
// release type matches the release type we're expecting.
$parsed_version = phorum_parse_version($fields[0]);
if ($parsed_version[0] == $release) {
$releases[$release] = array(
"version" => array_shift($fields),
"pversion" => $parsed_version[1],
"date" => array_shift($fields),
"locations" => $fields
);
}
}
}
}
fclose($fp);
}
 
return $releases;
}
 
/**
* Finds out if there are any upgrades available for a version of Phorum.
* @param version - the version to check for (default is the running version)
* @return releases - An array of available releases with the
* "upgrade" field set in case the release would be an
* upgrade for the currently running Phorum software.
*/
function phorum_find_upgrades($version = PHORUM)
{
// Parse the running version of phorum.
list ($running_release, $running_version) = phorum_parse_version($version);
 
// Retrieve the available releases.
$releases = phorum_available_releases();
 
// Check if an upgrade is available for the running release.
// If we're running a stable version, we only compare to the current
// stable release. If we're running a development version, we compare both
// stable and development.
if (isset($releases["stable"])) {
$avail_version = $releases["stable"]["pversion"];
if (phorum_compare_version($running_version, $avail_version) == -1) {
$releases["stable"]["upgrade"] = true;
} else {
$releases["stable"]["upgrade"] = false;
}
}
if (($running_release == 'development' || $running_release == 'snapshot') && isset($releases["development"])) {
$avail_version = $releases["development"]["pversion"];
if (phorum_compare_version($running_version, $avail_version) == -1) {
$releases["development"]["upgrade"] = true;
} else {
$releases["development"]["upgrade"] = false;
}
}
 
return $releases;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/thread_sort.php
New file
0,0 → 1,88
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
////////////////////////////////////////////////////////////////////////
//
// This function sorts $rows and fills $threads. It assumes that $rows
// is an array that is sorted by thread, then id. This is critical as
// it ensures that a child is not encountered before a parent.
// It could be made more complicated to implement the tree graphics
// as Phorum 3 did. However, this is much faster and less complicated
// If someone just has to have the tree graphics, it can be done.
//
 
function phorum_sort_threads($rows)
{
foreach($rows as $row){
$rows[$row["parent_id"]]["children"][]=$row["message_id"];
}
// rewriting the define to a var for the new style of indenting
$GLOBALS['PHORUM']['DATA']['marker']=$GLOBALS['PHORUM']['TMP']['marker'];
 
$sorted_rows=array(0=>array());
 
_phorum_recursive_sort($rows, $sorted_rows);
 
unset($sorted_rows[0]);
 
return $sorted_rows;
}
 
 
// not to be called directly. Call phorum_sort_threads
 
function _phorum_recursive_sort($rows, &$threads, $seed=0, $indent=0)
{
global $PHORUM;
 
if($seed>0){
$threads[$rows[$seed]["message_id"]]=$rows[$seed];
// old style of indenting
$threads[$rows[$seed]["message_id"]]["indent"]=str_repeat($PHORUM['TMP']['indentstring'], $indent);
if(!empty($indent)){
$threads[$rows[$seed]["message_id"]]["indent"].=$PHORUM['TMP']['marker'];
}
// new style of indenting by padding-left
$threads[$rows[$seed]["message_id"]]["indent_cnt"]=$indent*$PHORUM['TMP']['indentmultiplier'];
if($indent < 31) {
$wrapnum=80-($indent*2);
} else {
$wrapnum=20;
}
$threads[$rows[$seed]["message_id"]]["subject"]=wordwrap($rows[$seed]['subject'],$wrapnum," ",1);
$indent++;
 
}
if(isset($rows[$seed]["children"])){
foreach($rows[$seed]["children"] as $child){
_phorum_recursive_sort($rows, $threads, $child, $indent);
}
}
}
 
 
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/email_functions.php
New file
0,0 → 1,236
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
function phorum_valid_email($email){
$PHORUM = $GLOBALS["PHORUM"];
 
$ret = false;
 
$email = trim($email);
 
if(preg_match('/^([a-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+(\.[a-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+)*)@(((([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))\.)*((([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))$/i', $email)){
if(!$PHORUM["dns_lookup"]){
// format is valid
// don't look up mail server
$ret = true;
}else{
// get the domain name from the mail address
$fulldomain = substr(strstr($email, "@"), 1).".";
 
// check if a mailserver exists for the domain
if(function_exists('checkdnsrr') && checkdnsrr($fulldomain, "MX")) {
$ret = true;
}
 
// some hosts don't have an MX record, but accept mail themselves
if(!$ret){
// default timeout of 60 seconds makes the user way too long
// in case of problems.
ini_set('default_socket_timeout', 10);
if(@fsockopen($fulldomain, 25)){
$ret = true;
}
}
}
}
 
return $ret;
}
 
/**
* function for sending email to users, gets addresses-array and data-array
*/
function phorum_email_user($addresses, $data)
{
$PHORUM = $GLOBALS['PHORUM'];
 
$mailmessage = $data['mailmessage'];
unset($data['mailmessage']);
$mailsubject = $data['mailsubject'];
unset($data['mailsubject']);
 
if(is_array($data) && count($data)) {
foreach(array_keys($data) as $key){
$mailmessage = str_replace("%$key%", $data[$key], $mailmessage);
$mailsubject = str_replace("%$key%", $data[$key], $mailsubject);
}
}
 
$num_addresses = count($addresses);
$from_address = "\"".$PHORUM['system_email_from_name']."\" <".$PHORUM['system_email_from_address'].">";
 
$hook_data = array(
'addresses' => $addresses,
'from' => $from_address,
'subject' => $mailsubject,
'body' => $mailmessage,
'bcc' => $PHORUM['use_bcc']
);
 
$send_messages = phorum_hook("send_mail", $hook_data);
 
if(isset($data["msgid"])){
$msgid="\nMessage-ID: {$data['msgid']}";
} else {
$msgid="";
}
 
if($send_messages != 0 && $num_addresses > 0){
$phorum_major_version = substr(PHORUM, 0, strpos(PHORUM, '.'));
$mailer = "Phorum" . $phorum_major_version;
$mailheader ="Content-Type: text/plain; charset={$PHORUM["DATA"]["CHARSET"]}\nContent-Transfer-Encoding: {$PHORUM["DATA"]["MAILENCODING"]}\nX-Mailer: $mailer$msgid\n";
 
if(isset($PHORUM['use_bcc']) && $PHORUM['use_bcc'] && $num_addresses > 3){
mail(" ", $mailsubject, $mailmessage, $mailheader."From: $from_address\nBCC: " . implode(",", $addresses));
} else {
foreach($addresses as $address){
mail($address, $mailsubject, $mailmessage, $mailheader."From: $from_address");
}
}
}
 
return $num_addresses;
}
 
function phorum_email_pm_notice($message, $langusers)
{
$mail_data = array(
"pm_message_id" => $message["pm_message_id"],
"author" => $message["from_username"],
"subject" => $message["subject"],
"full_body" => $message["message"],
"plain_body" => wordwrap(phorum_strip_body($message["message"]),72),
"read_url" => phorum_get_url(PHORUM_PM_URL, "page=read", "pm_id=" . $message["pm_message_id"]),
);
 
if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
// strip any auth info from the read url
$mail_data["read_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["read_url"]);
}
 
foreach ($langusers as $language => $users)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( file_exists( "./include/lang/$language.php" ) ) {
include( "./include/lang/$language.php" );
} else {
include("./include/lang/{$PHORUM['language']}.php");
}
 
$mail_data["mailmessage"] = $PHORUM["DATA"]["LANG"]['PMNotifyMessage'];
$mail_data["mailsubject"] = $PHORUM["DATA"]["LANG"]['PMNotifySubject'];
 
$addresses = array();
foreach ($users as $user) {
$addresses[] = $user["email"];
}
 
phorum_email_user($addresses, $mail_data);
}
}
 
function phorum_email_notice($message)
{
$PHORUM=$GLOBALS["PHORUM"];
 
// do we allow email-notification for that forum?
if(!$PHORUM['allow_email_notify']) {
return;
}
 
include_once("./include/format_functions.php");
 
$mail_users_full = phorum_db_get_subscribed_users($PHORUM['forum_id'], $message['thread'], PHORUM_SUBSCRIPTION_MESSAGE);
 
if (count($mail_users_full)) {
$mail_data = array(
"forumname" => strip_tags($PHORUM["DATA"]["NAME"]),
"forum_id" => $PHORUM['forum_id'],
"message_id" => $message['message_id'],
"author" => $message['author'],
"subject" => $message['subject'],
"full_body" => $message['body'],
"plain_body" => phorum_strip_body($message['body']),
"read_url" => phorum_get_url(PHORUM_READ_URL, $message['thread'], $message['message_id']),
"remove_url" => phorum_get_url(PHORUM_FOLLOW_URL, $message['thread'], "remove=1"),
"noemail_url" => phorum_get_url(PHORUM_FOLLOW_URL, $message['thread'], "noemail=1"),
"followed_threads_url" => phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUBSCRIPTION_THREADS),
"msgid" => $message["msgid"]
);
if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
// strip any auth info from the read url
$mail_data["read_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["read_url"]);
$mail_data["remove_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["remove_url"]);
$mail_data["noemail_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["noemail_url"]);
$mail_data["followed_threads_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["followed_threads_url"]);
}
// go through the user-languages and send mail with their set lang
foreach($mail_users_full as $language => $mail_users) {
if ( file_exists( "./include/lang/$language.php" ) ) {
include( "./include/lang/$language.php" );
} else {
include("./include/lang/{$PHORUM['language']}.php");
}
$mail_data["mailmessage"] = $PHORUM["DATA"]["LANG"]['NewReplyMessage'];
$mail_data["mailsubject"] = $PHORUM["DATA"]["LANG"]['NewReplySubject'];
phorum_email_user($mail_users, $mail_data);
 
}
}
}
 
function phorum_email_moderators($message)
{
$PHORUM=$GLOBALS["PHORUM"];
 
$mail_users = phorum_user_get_moderators($PHORUM['forum_id'],false,true);
 
if (count($mail_users)) {
include_once("./include/format_functions.php");
if($message["status"] > 0) { // just notification of a new message
$mailtext = $PHORUM["DATA"]["LANG"]['NewUnModeratedMessage'];
} else { // posts needing approval
$mailtext = $PHORUM["DATA"]["LANG"]['NewModeratedMessage'];
}
$mail_data = array(
"mailmessage" => $mailtext,
"mailsubject" => $PHORUM["DATA"]["LANG"]['NewModeratedSubject'],
"forumname" => strip_tags($PHORUM["DATA"]["NAME"]),
"forum_id" => $PHORUM['forum_id'],
"message_id" => $message['message_id'],
"author" => $message['author'],
"subject" => $message['subject'],
"full_body" => $message['body'],
"plain_body" => phorum_strip_body($message['body']),
"approve_url" => phorum_get_url(PHORUM_PREPOST_URL),
"read_url" => phorum_get_url(PHORUM_READ_URL, $message['thread'], $message['message_id'])
);
if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
// strip any auth info from the read url
$mail_data["read_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["read_url"]);
$mail_data["approve_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["approve_url"]);
}
phorum_email_user($mail_users, $mail_data);
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/format_functions.php
New file
0,0 → 1,195
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if ( !defined( "PHORUM" ) ) return;
 
/**
* Formats forum messages.
*
* @param data - An array containing a messages to be formatted.
* @return data - The formatted messages.
*/
function phorum_format_messages ($data)
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Prepare the bad-words replacement code.
$bad_word_check= false;
$banlists = phorum_db_get_banlists();
if (isset($banlists[PHORUM_BAD_WORDS]) && is_array($banlists[PHORUM_BAD_WORDS])) {
$replace_vals = array();
$replace_words = array();
foreach ($banlists[PHORUM_BAD_WORDS] as $item) {
$replace_words[] = "/\b".preg_quote($item['string'])."(ing|ed|s|er|es)*\b/";
$replace_vals[] = PHORUM_BADWORD_REPLACE;
$bad_word_check = true;
}
}
 
// A special <br> tag to keep track of breaks that are added by phorum.
$phorum_br = '<phorum break>';
 
// Apply Phorum's formatting rules to all messages.
foreach( $data as $key => $message )
{
// Work on the message body ========================
 
if (isset($message["body"]))
{
$body = $message["body"];
 
// Convert legacy <> urls into bare urls.
$body = preg_replace("/<((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%]+?)>/i", "$1", $body);
 
// Escape special HTML characters. The function htmlspecialchars()
// does too much, prior to PHP version 4.0.3.
$body = str_replace(array("&","<",">"), array("&amp;","&lt;","&gt;"), $body);
 
// Replace newlines with $phorum_br temporarily.
// This way the mods know what Phorum did vs the user.
$body = str_replace("\n", "$phorum_br\n", $body);
 
// Run bad word replacement code.
if($bad_word_check) {
$body = preg_replace($replace_words, $replace_vals, $body);
}
 
$data[$key]["body"] = $body;
}
 
// Work on the other fields ========================
 
// Run bad word replacement code on subject and author.
if($bad_word_check) {
if (isset($message["subject"]))
$message["subject"] = preg_replace($replace_words, $replace_vals, $message["subject"]);
if (isset($message["author"]))
$message["author"] = preg_replace($replace_words, $replace_vals, $message["author"]);
}
 
// Escape special HTML characters in fields.
if (isset($message["email"]))
$data[$key]["email"] = str_replace(array("<",">"), array("&lt;","&gt;"), $message["email"]);
if (isset($message["subject"]))
$data[$key]["subject"] = str_replace(array("&","<",">"), array("&amp;","&lt;","&gt;"), $message["subject"]);
 
// Some special things we have to do for the escaped author name.
// We never should have put HTML in the core. Now we have to
// do this hack to get the escaped author name in the linked_author.
if (isset($message["author"])) {
$data[$key]["author"] = str_replace(array("<",">"), array("&lt;","&gt;"), $message["author"]);
$safe_author = str_replace(array("&","<",">"), array("&amp;","&lt;","&gt;"), $message["author"]);
if ($safe_author != $data[$key]["author"] && isset($data[$key]["linked_author"])) {
$data[$key]["linked_author"] = str_replace($data[$key]["author"], $safe_author, $data[$key]["linked_author"]);
$data[$key]["author"] = $safe_author;
}
}
}
 
// A hook for module writers to apply custom message formatting.
$data = phorum_hook("format", $data);
 
// Clean up after the mods are done.
foreach( $data as $key => $message ) {
 
// Clean up line breaks inside pre and xmp tags. These tags
// take care of showing newlines as breaks themselves.
if (isset($message["body"])) {
foreach (array("pre","goep","xmp") as $tagname) {
if (preg_match_all( "/(<$tagname.*?>).+?(<\/$tagname>)/si", $message["body"], $matches)) {
foreach ($matches[0] as $match) {
$stripped = str_replace ($phorum_br, "", $match);
$message["body"] = str_replace ($match, $stripped, $message["body"]);
}
}
}
// Remove line break after quote and code tags. These tags have
// their own line break. Without this, there would be to much
// white lines.
$message["body"] = preg_replace("/\s*(<\/*(xmp|blockquote|pre).*?>)\s*\Q$phorum_br\E/", "$1", $message["body"]);
 
// Normalize the Phorum line breaks that are left.
$data[$key]["body"] = str_replace($phorum_br, "<br />", $message["body"]);
}
}
 
return $data;
}
 
/**
* Formats an epoch timestamp to a date/time for displaying on screen.
*
* @param picture - The time formatting to use, in strftime() format
* @param ts - The epoch timestamp to format
* @return datetime - The formatted date/time string
*/
function phorum_date( $picture, $ts )
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Setting locale.
if (!isset($PHORUM['locale']))
$PHORUM['locale']="EN";
setlocale(LC_TIME, $PHORUM['locale']);
 
// Format the date.
if ($PHORUM["user_time_zone"] && isset($PHORUM["user"]["tz_offset"]) && $PHORUM["user"]["tz_offset"]!=-99) {
$ts += $PHORUM["user"]["tz_offset"] * 3600;
return gmstrftime( $picture, $ts );
} else {
$ts += $PHORUM["tz_offset"] * 3600;
return strftime( $picture, $ts );
}
}
 
/**
* Strips HTML <tags> and BBcode [tags] from the body.
*
* @param body - The block of body text to strip
* @return stripped - The stripped body
*/
function phorum_strip_body( $body )
{
// Strip HTML <tags>
$stripped = preg_replace("|</*[a-z][^>]*>|i", "", $body);
// Strip BB Code [tags]
$stripped = preg_replace("|\[/*[a-z][^\]]*\]|i", "", $stripped);
 
return $stripped;
}
 
/**
* Formats a file size in bytes to a human readable format. Human
* readable formats are MB (MegaByte), kB (KiloByte) and byte.
*
* @param bytes - The number of bytes
* @param formatted - The formatted size
*/
function phorum_filesize( $bytes )
{
if ($bytes >= 1024*1024) {
return round($bytes/1024/1024, 2) . "MB";
} elseif ($bytes >= 1024) {
return round($bytes/1024, 1) . "kB";
} else {
return $bytes . ($bytes == 1 ? " byte" : " bytes");
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/include/index_new.php
New file
0,0 → 1,132
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
if(!defined("PHORUM")) return;
 
if($PHORUM["forum_id"]==0){
 
$forums[0] = array(
"forum_id" => 0,
"folder_flag" => 1,
"vroot" => 0
);
} else {
 
$forums = phorum_db_get_forums( $PHORUM["forum_id"] );
}
 
if($PHORUM["vroot"]==$PHORUM["forum_id"]){
$more_forums = phorum_db_get_forums( 0, $PHORUM["forum_id"] );
foreach($more_forums as $forum_id => $forum){
if(empty($forums[$forum_id])){
$forums[$forum_id]=$forum;
}
}
$folders[$PHORUM["forum_id"]]=$PHORUM["forum_id"];
}
 
$PHORUM["DATA"]["FORUMS"] = array();
 
$forums_shown=false;
 
// create the top level folder
 
foreach( $forums as $key=>$forum ) {
if($forum["folder_flag"] && $forum["vroot"]==$PHORUM["vroot"]){
$folders[$key]=$forum["forum_id"];
$forums[$key]["url"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );
 
$sub_forums = phorum_db_get_forums( 0, $forum["forum_id"] );
foreach($sub_forums as $sub_forum){
if(!$sub_forum["folder_flag"]){
$folder_forums[$sub_forum["parent_id"]][]=$sub_forum;
}
}
}
}
 
 
foreach( $folders as $folder_key=>$folder_id ) {
 
if(!isset($folder_forums[$folder_id])) continue;
 
$shown_sub_forums=array();
 
foreach($folder_forums[$folder_id] as $key=>$forum){
 
if($PHORUM["hide_forums"] && !phorum_user_access_allowed(PHORUM_USER_ALLOW_READ, $forum["forum_id"])){
unset($folder_forums[$folder_id][$key]);
continue;
}
 
$forum["url"] = phorum_get_url( PHORUM_LIST_URL, $forum["forum_id"] );
$forum["url_markread"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"], "markread" );
if(isset($PHORUM['use_rss']) && $PHORUM['use_rss']) {
$forum["url_rss"] = phorum_get_url( PHORUM_RSS_URL, $forum["forum_id"] );
}
 
 
if ( $forum["message_count"] > 0 ) {
$forum["last_post"] = phorum_date( $PHORUM["long_date"], $forum["last_post_time"] );
} else {
$forum["last_post"] = "&nbsp;";
}
 
if($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM["show_new_on_index"]){
list($forum["new_messages"], $forum["new_threads"]) = phorum_db_newflag_get_unread_count($forum["forum_id"]);
}
 
$shown_sub_forums[] = $forum;
 
}
 
if(count($shown_sub_forums)){
$PHORUM["DATA"]["FORUMS"][]=$forums[$folder_key];
$PHORUM["DATA"]["FORUMS"]=array_merge($PHORUM["DATA"]["FORUMS"], $shown_sub_forums);
}
 
}
 
// set all our URL's
phorum_build_common_urls();
 
if(!count($PHORUM["DATA"]["FORUMS"])){
include phorum_get_template( "header" );
phorum_hook("after_header");
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoRead"];
include phorum_get_template( "message" );
phorum_hook("before_footer");
include phorum_get_template( "footer" );
return;
}
 
// should we show the top-link?
if($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id']) {
unset($PHORUM["DATA"]["URL"]["INDEX"]);
}
 
$PHORUM["DATA"]["FORUMS"]=phorum_hook("index", $PHORUM["DATA"]["FORUMS"]);
 
include phorum_get_template( "header" );
phorum_hook("after_header");
include phorum_get_template( "index_new" );
phorum_hook("before_footer");
include phorum_get_template( "footer" );
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/profile.php
New file
0,0 → 1,116
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','profile');
 
include_once("./common.php");
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
 
// set all our URL's
phorum_build_common_urls();
 
$template = "profile";
$error = "";
 
// redirect if no profile id passed
if(!empty($PHORUM["args"][1])){
$profile_id = (int)$PHORUM["args"][1];
}
 
if(empty($PHORUM["args"][1]) || empty($profile_id)){
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
exit();
}
 
include_once("./include/users.php");
 
$user = phorum_user_get($profile_id);
 
if(!is_array($user) || $user["active"]==0) {
$PHORUM["DATA"]["ERROR"]=$PHORUM["DATA"]["LANG"]["UnknownUser"];
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_LIST_URL);
$PHORUM['DATA']["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToList"];
 
// have to include the header here for the Redirect
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
}
 
// security messures
unset($user["password"]);
unset($user["permissions"]);
 
// set any custom profile fields that are not present.
if (!empty($PHORUM["PROFILE_FIELDS"])) {
foreach($PHORUM["PROFILE_FIELDS"] as $field) {
if (!isset($user[$field['name']])) $user[$field['name']] = "";
}
}
 
$PHORUM["DATA"]["PROFILE"] = $user;
$PHORUM["DATA"]["PROFILE"]["forum_id"] = $PHORUM["forum_id"];
 
$PHORUM["DATA"]["PROFILE"]["date_added"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_added"]);
 
if( !empty($PHORUM["user"]["admin"]) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && PHORUM_MOD_EMAIL_VIEW) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS) && PHORUM_MOD_EMAIL_VIEW) ||
!$user["hide_email"]){
 
$PHORUM["DATA"]["PROFILE"]["email"]=phorum_html_encode($user["email"]);
} else {
$PHORUM["DATA"]["PROFILE"]["email"] = $PHORUM["DATA"]["LANG"]["Hidden"];
}
 
if( $PHORUM["track_user_activity"] &&
(!empty($PHORUM["user"]["admin"]) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) ||
(phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS)) ||
!$user["hide_activity"])){
 
$PHORUM["DATA"]["PROFILE"]["date_last_active"]=phorum_date( $PHORUM['short_date'], $PHORUM["DATA"]["PROFILE"]["date_last_active"]);
} else {
unset($PHORUM["DATA"]["PROFILE"]["date_last_active"]);
}
 
$PHORUM["DATA"]["PROFILE"]["posts"]=number_format($PHORUM["DATA"]["PROFILE"]["posts"]);
 
$PHORUM["DATA"]["PROFILE"]["pm_url"] = phorum_get_url(PHORUM_PM_URL, "page=send", "to_id=".urlencode($user["user_id"]));
$PHORUM["DATA"]["PROFILE"]["pm_addbuddy_url"] = phorum_get_url(PHORUM_PM_URL, "page=buddies", "action=addbuddy", "addbuddy_id=".urlencode($user["user_id"]));
$PHORUM["DATA"]["PROFILE"]["is_buddy"] = phorum_db_pm_is_buddy($user["user_id"]);
// unset($PHORUM["DATA"]["PROFILE"]["signature"]);
 
$PHORUM["DATA"]["PROFILE"]["username"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["username"]);
 
$PHORUM["DATA"]["PROFILE"] = phorum_hook("profile", $PHORUM["DATA"]["PROFILE"]);
 
// set all our URL's
phorum_build_common_urls();
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("profile");
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/.htaccess
New file
0,0 → 1,0
Deny from all
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/phorum3to5convert.php
New file
0,0 → 1,253
<?php
 
/*
 
***** IT IS HIGHLY RECCOMENDED THAT YOU RUN THIS SCRIPT ON A CONSOLE
***** PHP VERSION 4.2.0 OR HIGHER IS REQUIRED FOR RUNNING THIS SCRIPT
***** THE SCRIPT IS WRITTEN FOR UPGRADING PHORUM 3.4.x
 
This script will convert the data from a Phorum 3 database to a Phorum 5
database. It does not change any of the old phorum3-tables. The data is
only copied over to the new Phorum 5 tables.
 
Instructions:
 
1. Be sure your Phorum 3 is running a 3.4.x version. If you are running
an older version of Phorum 3, first upgrade to 3.4.x.
 
2. Copy or move this script one directory up, to the main Phorum 5 directory.
 
3. Edit the $CONVERT variables below to match the settings of your
phorum3 installation.
 
4. Install Phorum 5 as usual. For speed and reliability, preferably use the
same database as the database where Phorum 3 lives. Because Phorum 5 uses
a table prefix (typically "phorum_"), the tables for Phorum 3 and Phorum 5
can safely live next to each other in the same database.
 
5. Empty the phorum_messages and phorum_forums tables of the Phorum 5
installation. You can do this either by dropping all forums from the
Phorum 5 admin interface or by issuing the appropriate SQL queries from
the MySQL prompt or from a database tool like "phpmyadmin". The queries
to execute are (replace "phorum" with your own table_prefix if you changed
this during install):
 
DELETE FROM phorum_messages;
DELETE FROM phorum_forums;
 
I could do this from this script as well, but I would find that
a little bit rude ;-))
 
6. Turn off unneeded modules for the conversion. All modules hooking into common.php
or some other general hook will be run while doing the conversion which will lead to
at least a slowdown, unexpected side effects and some strange output.
 
7. If you have shell access to your webserver, run this script using the
shell from the command line. This is the preferred way of running the
upgrade:
 
php phorum3to5convert.php
 
If you do not have shell access, call the upgrade script from your browser:
 
<phorum5-url>/phorum3to5convert.php
 
*** THIS STEP MAY TAKE A WHILE ***
 
8. Take a look at the Phorum 5 forums to see if everything was converted
correctly.
 
9. Delete the upgrade script phorum3to5convert.php.
 
*/
 
ini_set ( "zlib.output_compression", "0");
ini_set ( "output_handler", "");
@ob_end_flush();
 
define("PHORUM5_CONVERSION", 1);
 
/***** CONFIGURATION FOR THE CONVERSION *****/
 
// The data for connecting to the old Phorum 3 database.
$CONVERT['old_dbhost'] = "localhost";
$CONVERT['old_dbuser'] = "phorum5";
$CONVERT['old_dbpass'] = "phorum5";
 
// The name of the old Phorum 3 database.
$CONVERT['olddb'] = "phorum";
 
// The main-table-name for phorum3 (default is "forums")
$CONVERT['forumstable'] = "forums";
 
// Separator character. If you are going to run this script from
// the web, make it "<br>\n". If you are going to run it from the
// shell prompt, make it "\n".
$CONVERT['lbr'] = "<br>\n";
 
// The full path to the directory where the attachments for Phorum 3.4.x
// are stored (like in the old admin).
$CONVERT['attachmentdir'] = "/full/path/to/files";
 
/***** THERE'S NO NEED TO CHANGE ANYTHING BELOW THIS LINE *****/
 
 
// we try to disable the execution timeout
// that command doesn't work in safe_mode :(
set_time_limit(0);
 
require './common.php';
require './include/thread_info.php';
require './scripts/phorum3_in.php';
 
// no need to change anything below this line
// establishing the first link to the old database
$oldlink = mysql_connect($CONVERT['old_dbhost'], $CONVERT['old_dbuser'], $CONVERT['old_dbpass'], true);
mysql_select_db($CONVERT['olddb'], $oldlink);
 
if (!$oldlink) {
print "Couldn't connect to the old database.".$CONVERT['lbr'];
exit();
}
 
// checking attachment-dir
if (!file_exists($CONVERT['attachmentdir']) || empty($CONVERT['attachmentdir'])) {
echo "Directory {$CONVERT['attachmentdir']} doesn't exist. Attachments won't be converted. (doesn't matter if you don't have message-attachments) {$CONVERT['lbr']}";
}
 
$CONVERT['groups']=array();
$CONVERT['do_groups']=false;
 
// checking if the groups-table exists
if(phorum_convert_check_groups($oldlink)) {
// reading groups (should be not too much, therefore we keep the array for later use)
$CONVERT['groups'] = phorum_convert_getGroups($oldlink);
if(count($CONVERT['groups'])) {
echo "Writing groups ... {$CONVERT['lbr']}";
foreach($CONVERT['groups'] as $groupid => $groupdata) {
phorum_db_add_group($groupdata['name'],$groupid);
$CONVERT['groups'][$groupid]['group_id']=$groupid;
}
}
$CONVERT['do_groups']=true;
}
 
$CONVERT['do_users']=false;
// checking if the users-table exists
if(phorum_convert_check_users($oldlink)) {
$CONVERT['do_users']=true;
}
 
// reading the forums
$forums = phorum_convert_getForums($oldlink);
 
// going through all the forums (and folders)
echo "Writing forumdata ... {$CONVERT['lbr']}";
flush();
$offsets=array();
 
foreach($forums as $forumid => $forumdata) {
$newforum = phorum_convert_prepareForum($forumdata);
 
phorum_db_add_forum($newforum);
 
if (!$forumdata['folder']) {
$PHORUM['forum_id'] = $forumid;
$CONVERT['forum_id'] = $forumid;
 
echo "Reading maximum message-id from messages-table... {$CONVERT['lbr']}";
flush();
$CONVERT['max_id'] = phorum_db_get_max_messageid();
$offsets[$forumid]=$CONVERT['max_id'];
 
if ($forumdata['allow_uploads']=='Y' && file_exists($CONVERT['attachmentdir']."/".$forumdata['table_name'])) {
$CONVERT['attachments']=phorum_convert_getAttachments($forumdata['table_name']);
echo "Reading attachments for forum " . $forumdata['name'] . "...{$CONVERT['lbr']}";
flush();
}
 
echo "Writing postings for forum " . $forumdata['name'] . "...{$CONVERT['lbr']}";
flush();
 
$count = 1;
$total = 0;
 
$res = phorum_convert_selectMessages($forumdata, $oldlink);
while ($newmessage = phorum_convert_getNextMessage($res,$forumdata['table_name'])) {
 
if(phorum_db_post_message($newmessage, true)) {
phorum_update_thread_info($newmessage['thread']);
echo "+";
flush();
if ($count == 50) {
$total += $count;
echo " $total from \"{$forumdata['name']}\"";
if($CONVERT['lbr']=="\n"){
// lets just go back on this line if we are on the console
echo "\r";
} else {
echo $CONVERT['lbr'];
}
flush();
$count = 0;
}
$count++;
} else {
print "Error in message: ".$CONVERT['lbr'];
print_var($newmessage);
print $CONVERT['lbr'];
}
}
 
echo "{$CONVERT['lbr']}Updating forum-statistics: {$CONVERT['lbr']}";
flush();
phorum_db_update_forum_stats(true);
echo $CONVERT['lbr'];
flush();
}
}
unset($forums);
 
// storing the offsets of the forums
phorum_db_update_settings(array("conversion_offsets"=>$offsets));
 
if($CONVERT['do_groups'] && count($CONVERT['groups'])) { // here we set the group-permissions
echo "Writing group-permissions ... {$CONVERT['lbr']}";
foreach($CONVERT['groups'] as $groupid => $groupdata) {
phorum_db_save_group($groupdata);
}
}
 
if($CONVERT['do_users']) {
echo "migrating users ...{$CONVERT['lbr']}";
flush();
$group_perms=phorum_convert_getUserGroups($oldlink);
$res = phorum_convert_selectUsers($oldlink);
 
if (!$res) {
echo "No users found, All done now.{$CONVERT['lbr']}";
flush();
exit;
}
 
// there are users...
$count = 0;
$userdata["date_added"] = time();
$cur_time = time();
while ($cur_user = phorum_convert_getNextUser($res)) {
if (isset($cur_user['user_id'])) {
phorum_user_add($cur_user, -1);
$user_groups=$group_perms[$cur_user['user_id']];
if(count($user_groups)) { // setting the user's group-memberships
phorum_db_user_save_groups($cur_user['user_id'],$user_groups);
}
$count++;
}
}
unset($users);
print "$count users converted{$CONVERT['lbr']}";
}
echo "{$CONVERT['lbr']}Done.{$CONVERT['lbr']}";
flush();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/console_upgrade.php
New file
0,0 → 1,127
<?php
 
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
///////////////////////////////////////////////////////////////////////////////
define("phorum_page", "console_upgrade");
 
// I guess the phorum-directory is one level up. if you move the script to
// somewhere else you'll need to change that.
$PHORUM_DIRECTORY="../";
 
// change directory to the main-dir so we can use common.php
if(file_exists($PHORUM_DIRECTORY."/common.php")) {
chdir($PHORUM_DIRECTORY);
} else {
echo "Can't find common.php in the given directory. Please check the \$PHORUM_DIRECTORY -setting in console_upgrade.php\n";
exit();
}
 
// include required files
include_once './common.php';
include_once './include/users.php';
 
// if we are running in the webserver, bail out
if (isset($_SERVER["REMOTE_ADDR"])) {
echo $PHORUM["DATA"]["LANG"]["CannotBeRunFromBrowser"];
return;
}
 
// no database connection?
if(!phorum_db_check_connection()){
echo "A database connection could not be established. Please edit include/db/config.php.\n";
return;
} else {
echo "Database connection confirmed, we will start the upgrade.\n";
flush();
}
 
// no need for upgrade
if(isset($PHORUM['internal_version']) && $PHORUM['internal_version'] == PHORUMINTERNAL){
echo "Your install is already up-to-date. No database-upgrade needed.\n";
return;
}
 
if (! ini_get('safe_mode')) {
echo "Trying to reset the timeout and rise the memory-limit ...\n";
set_time_limit(0);
ini_set("memory_limit","64M");
}
 
$fromversion=$PHORUM['internal_version'];
 
$upgradepath="./include/db/upgrade/{$PHORUM['DBCONFIG']['type']}/";
 
// read in all existing files
$dh=opendir($upgradepath);
$upgradefiles=array();
while ($file = readdir ($dh)) {
if (substr($file,-4,4) == ".php") {
$upgradefiles[]=$file;
}
}
unset($file);
closedir($dh);
 
// sorting by number
sort($upgradefiles,SORT_NUMERIC);
reset($upgradefiles);
 
// advance to current version
while(list($key,$val)=each($upgradefiles)) {
if($val == $fromversion.".php")
break;
}
 
 
while(list($dump,$file) = each($upgradefiles)) {
 
// extract the pure version, needed as internal version
$pure_version = basename($file,".php");
 
if(empty($pure_version)){
die("Something is wrong with the upgrade script. Please contact the Phorum Dev Team. ($fromversion,$pure_version)");
}
 
 
$upgradefile=$upgradepath.$file;
 
if(file_exists($upgradefile)) {
echo "Upgrading from db-version $fromversion to $pure_version ... \n";
flush();
 
if (! is_readable($upgradefile))
die("$upgradefile is not readable. Make sure the file has got the neccessary permissions and try again.");
 
 
$upgrade_queries=array();
include($upgradefile);
$err=phorum_db_run_queries($upgrade_queries);
if($err){
echo "an error occured: $err ... try to continue.\n";
} else {
echo "done.\n";
}
$GLOBALS["PHORUM"]["internal_version"]=$pure_version;
phorum_db_update_settings(array("internal_version"=>$pure_version));
} else {
echo "Ooops, the upgradefile is missing. How could this happen?\n";
}
 
$fromversion=$pure_version;
 
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/generateStaticCSS.php
New file
0,0 → 1,48
<?php
/* generateStaticCSS.php
* this script is meant to be run from the command-line
* it extracts the CSS-data from the templates and will write it to a static file
* keep in mind that you'll have to run it by hand if your color-settings change!!!
*
* for using that script you have either to use the chdir call or put it in the phorum-dir
* keep in mind that others could use this script to overwrite files on your webserver
* therefore there is the first exit(); in there, you have to remove it to use the script too
*
* to have Phorum use the static CSS, you'll have to edit header.tpl, instead the include of the css
* you have to use a link href ...
*/
 
// that's here for security measures, remove it if you want to use the script!!!
exit();
//chdir("../");
include './common.php';
 
if($argc < 2) {
echo "needs 2 parameters, first as forum-id, second as filename (including path) of the css to be generated.\n";
exit();
}
 
// the second arg is the filename
$filepath=$argv[2];
 
if(is_dir($filename)) {
echo "the second argument has to be a filename and no directory!\n";
exit();
}
 
echo "Generating static CSS-file for Forum ".$PHORUM['forum_id']."\n";
 
ob_start();
include phorum_get_template('css');
$css_str=ob_get_contents();
ob_end_clean();
 
echo "writing CSS-file to ".$filepath.".\n";
 
$fp=fopen($filepath,"w");
fputs($fp,$css_str);
fclose($fp);
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/update_postcount.php
New file
0,0 → 1,41
<?php
/*
 
This is just a simple script for updating the post-count of each user, which
is shown in the user's profile. It can be run multiple times, but should at
least be run once after a conversion from Phorum 3 to Phorum 5.
 
How to use?
 
Just copy this script to your main Phorum 5 directory and run it either
from your webbrowser or from the console. It will show only some summary
in the end, nothing more.
 
Depending on the number of messages and users, it may take some time.
 
*/
 
 
// we try to disable the execution timeout
// that command doesn't work in safe_mode :(
set_time_limit(0);
 
require './common.php';
 
// no need to change anything below this line
$sql="select user_id, count(*) as postcnt from ".$PHORUM["message_table"]." group by user_id";
$conn = phorum_db_mysql_connect();
$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
if(mysql_num_rows($res)) {
$usercnt=0;
while($row = mysql_fetch_row($res)) {
$user=array("user_id"=>$row[0],"posts"=>$row[1]);
phorum_user_save_simple($user);
$usercnt++;
}
}
 
print "$usercnt Users updated with their current postcounts. Done!<br>\n";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/rebuild_search_table.php
New file
0,0 → 1,38
<?php
// rebuild search-table
// this script rebuilds the search-table
 
// this needs some time, please make sure that its really needed
// i.e. in case of errors, required updates etc.
 
// it only works with the mysql/mysqli-layer.
 
// YOU NEED TO MOVE THIS SCRIPT TO YOUR PHORUM-DIRECTORY
 
define('phorum_page', 'rebuild_search_table');
 
if(!file_exists('./common.php')) {
echo "You didn't move this script to your phorum-directory!\n";
exit();
}
 
include './common.php';
 
if (! ini_get('safe_mode')) {
set_time_limit(0);
ini_set("memory_limit","64M");
}
 
echo "Rebuilding search-table ...\n";
 
$sql=array();
$sql[]="truncate {$PHORUM['search_table']}";
$sql[]="insert into {$PHORUM['search_table']} (message_id,search_text,forum_id) select message_id, concat(author, ' | ', subject, ' | ', body), forum_id from {$PHORUM['message_table']}";
 
phorum_db_run_queries($sql);
 
flush();
echo "Rebuilding search-table finished successfully if no errors were logged above.\n";
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/phorum3_in.php
New file
0,0 → 1,404
<?php
if(!defined("PHORUM5_CONVERSION")) return;
 
// Phorum3 - to - Phorum5 Conversion Library
 
function phorum_convert_check_groups($link) {
GLOBAL $CONVERT;
 
$sql="show tables LIKE '{$CONVERT['forumstable']}_groups'";
$res=mysql_query($sql,$link);
if(mysql_num_rows($res)>0) {
$ret=true;
} else {
$ret=false;
}
return $ret;
}
 
 
function phorum_convert_check_users($link) {
GLOBAL $CONVERT;
 
$sql="show tables LIKE '{$CONVERT['forumstable']}_auth'";
$res=mysql_query($sql,$link);
if(mysql_num_rows($res)>0) {
$ret=true;
} else {
$ret=false;
}
return $ret;
}
 
function phorum_convert_getForums($link) {
global $CONVERT;
 
$sql="SELECT * FROM {$CONVERT['forumstable']} ORDER BY id ASC";
$res=mysql_unbuffered_query($sql,$link);
$forums=array();
 
if ($err = mysql_error($link)) phorum_db_mysql_error("$err: $sql");
 
 
echo "Reading forums from phorum3-table {$CONVERT['forumstable']} ...{$CONVERT['lbr']}";
while($row=mysql_fetch_array($res)) {
$forums[$row['id']]=$row;
}
 
return $forums;
}
 
 
function phorum_convert_getGroups($link) {
global $CONVERT;
 
$sql="SELECT * FROM {$CONVERT['forumstable']}_groups ORDER BY id ASC";
$res=mysql_unbuffered_query($sql,$link);
$groups=array();
 
if ($err = mysql_error($link)) phorum_db_mysql_error("$err: $sql");
 
while($row=mysql_fetch_array($res)) {
$groups[$row['id']]=$row;
$groups[$row['id']]['open']=PHORUM_GROUP_CLOSED;
 
}
 
return $groups;
}
 
function phorum_convert_getForumGroups($forum_id) {
global $CONVERT;
 
$sql="SELECT * FROM {$CONVERT['forumstable']}_forum2group";
$res=mysql_unbuffered_query($sql,$GLOBALS['oldlink']);
$groups=array();
while($row=mysql_fetch_array($res)) {
$groups[]=$row['group_id'];
}
 
return $groups;
}
 
function phorum_convert_prepareForum($forumdata) {
global $CONVERT;
 
if($forumdata['folder']) { // folders
if(!get_magic_quotes_runtime()){
$forumdata['name'] = $forumdata['name'];
$forumdata['description'] = $forumdata['description'];
}
 
$newforum = array(
'forum_id' => $forumdata['id'],
'name' => $forumdata['name'],
'active' => $forumdata['active'],
'description' => $forumdata['description'],
'template' => 'default',
'folder_flag' => $forumdata['folder'],
'parent_id' => $forumdata['parent'],
'pub_perms' => PHORUM_USER_ALLOW_READ,
'reg_perms' => PHORUM_USER_ALLOW_READ
);
 
 
} else { // forums
echo "Preparing data for forum {$forumdata['name']} ...{$CONVERT['lbr']}";
// rewriting some vars
if($forumdata['moderation'] == "a")
$moderation = PHORUM_MODERATE_ON;
else
$moderation = PHORUM_MODERATE_OFF;
 
if($forumdata['moderation'] == "n")
$email_mod = PHORUM_EMAIL_MODERATOR_OFF;
else
$email_mod = PHORUM_EMAIL_MODERATOR_ON;
 
if($forumdata['collapse'] == 1)
$threaded = 0;
else
$threaded = 1;
 
if($forumdata['multi_level'] == 2)
$float_to_top = 1;
else
$float_to_top = 0;
 
if(!isset($forumdata['allow_edit'])) // hmm could this really happen?
$forumdata['allow_edit'] = 0;
 
 
if(!get_magic_quotes_runtime()){
$forumdata['name'] = $forumdata['name'];
$forumdata['description'] = $forumdata['description'];
}
 
// checking security setting
if($forumdata['security'] > 1) {
if($forumdata['security'] == 2) { // login to post
$pub_perms= 0 | PHORUM_USER_ALLOW_READ;
$reg_perms= 0 | PHORUM_USER_ALLOW_READ | PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY | PHORUM_USER_ALLOW_EDIT;
 
} elseif($forumdata['security'] == 3) { // login to read (so to say, login to everything)
$pub_perms= 0;
$reg_perms= 0 | PHORUM_USER_ALLOW_READ | PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY | PHORUM_USER_ALLOW_EDIT;
}
} else {
$pub_perms = 0 | PHORUM_USER_ALLOW_READ | PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY;
$reg_perms = 0 | PHORUM_USER_ALLOW_READ | PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY | PHORUM_USER_ALLOW_EDIT;
}
 
// checking groups
if($CONVERT['do_groups']) {
$groups=phorum_convert_getForumGroups($forumdata['id']);
if(count($groups) && ($forumdata['permissions'] == 1 || $forumdata['permissions'] > 2) ) {
foreach($groups as $bogus => $group_id) {
$CONVERT['groups'][$group_id]['permissions'][$forumdata['id']]=$reg_perms;
}
$reg_perms=0;
$pub_perms=0;
}
}
 
 
$newforum = array(
'forum_id' => $forumdata['id'],
'name' => $forumdata['name'],
'active' => $forumdata['active'],
'description' => $forumdata['description'],
'template' => 'default',
'folder_flag' => $forumdata['folder'],
'parent_id' => $forumdata['parent'],
'list_length_flat' => $forumdata['display'],
'list_length_threaded' => $forumdata['display'],
'read_length' => 20,
'moderation' => $moderation,
'threaded_list' => $threaded,
'threaded_read' => $threaded,
'float_to_top' => $float_to_top,
'allow_attachment_types' => $forumdata['upload_types'],
'max_attachment_size' => $forumdata['upload_size'],
'max_attachments' => $forumdata['max_uploads'],
'pub_perms' => $pub_perms,
'reg_perms' => $reg_perms,
'display_ip_address' => $forumdata['showip'],
'allow_email_notify' => $forumdata['emailnotification'],
'language' => basename($forumdata['lang'],".php"),
'email_moderators' => $email_mod,
'edit_post' => $forumdata['allow_edit']
);
}
return $newforum;
}
 
function phorum_convert_getAttachments($table_name) {
GLOBAL $CONVERT;
 
$sql="SELECT * FROM ".$table_name."_attachments";
$res=mysql_unbuffered_query($sql,$GLOBALS['oldlink']);
$att=array();
while($row=mysql_fetch_assoc($res)) {
$att[$row['message_id']][]=$row;
}
 
return $att;
}
 
function phorum_convert_selectMessages($forumdata,$link) {
 
$sql="SELECT a.*,b.body,UNIX_TIMESTAMP(a.datestamp) as unixtime FROM ".$forumdata['table_name']." as a, ".$forumdata['table_name']."_bodies as b WHERE b.id = a.id ORDER BY a.id ASC";
$res=mysql_unbuffered_query($sql, $link);
 
if ($err = mysql_error($link)) phorum_db_mysql_error("$err: $sql");
 
return $res;
}
 
function phorum_convert_getNextMessage($res,$table_name) {
global $CONVERT;
 
// fetching the message from the database
$mdata = mysql_fetch_assoc($res);
if(!$mdata) {
return false;
}
$max_id= $CONVERT['max_id'];
 
$id=$mdata['id'];
if($mdata['closed'])
$closed=1;
else
$closed=0;
 
if($mdata['approved'] != "Y")
$post_status=PHORUM_STATUS_HOLD;
else
$post_status=PHORUM_STATUS_APPROVED;
 
$post_sort=PHORUM_SORT_DEFAULT;
 
$parentid=($mdata['parent']>0)?($mdata['parent']+$max_id):0;
 
if(!get_magic_quotes_runtime()){
$mdata['author'] = $mdata['author'];
$mdata['subject'] = $mdata['subject'];
$mdata['body'] = $mdata['body'];
$mdata['email'] = $mdata['email'];
}
 
//find [%sig%] and cut it
if (preg_match ("/\[%sig%\]/", $mdata['body'])) {
$mdata['body'] = preg_replace ( "/\[%sig%\]/", "", $mdata['body']);
$add_signature = true;
} else {
$add_signature = false;
}
 
// bah, there are really people trying to upgrade from 3.2.x ;)
$userid = (isset($mdata['userid']) ? $mdata['userid'] : 0);
 
 
// building the new message
$newmessage = array(
'message_id'=> $mdata['id']+$max_id,
'forum_id' => $CONVERT['forum_id'],
'datestamp' => $mdata['unixtime'],
'thread' => ($mdata['thread']+$max_id),
'parent_id' => $parentid,
'author' => $mdata['author'],
'subject' => $mdata['subject'],
'email' => $mdata['email'],
'ip' => $mdata['host'],
'user_id' => $userid,
'moderator_post' => 0,
'status' => $post_status,
'sort' => $post_sort,
'msgid' => $mdata['msgid'],
'closed' => $closed,
'body' => $mdata['body']
);
 
if($add_signature) {
$newmessage["meta"]["show_signature"]=1;
}
if(isset($mdata['viewcount'])) {
$newmessage['viewcount']=$mdata['viewcount'];
}
$newmessage['viewcount'] = (isset($mdata['viewcount']) ? $mdata['viewcount'] : 0);
// converting attachments if needed
$inserted_files=array();
if (isset($CONVERT['attachments'][$mdata['id']]) && count($CONVERT['attachments'][$mdata['id']])) {
foreach($CONVERT['attachments'][$mdata['id']] as $attachment) {
$filename = $CONVERT['attachmentdir']."/".$table_name."/".$attachment['id'].strtolower(strrchr($attachment['filename'], "."));
if(file_exists($filename) && filesize($filename)>0) {
$fp=fopen($filename, "r");
$buffer=base64_encode(fread($fp, filesize($filename)));
fclose($fp);
$file_id = phorum_db_file_save($userid, $attachment['filename'], filesize($filename), $buffer, $newmessage['message_id']);
unset($buffer); // free that large buffer
$inserted_files[]=array("file_id"=>$file_id, "name"=>$attachment['filename'], "size"=>filesize($filename));
}
}
}
if(count($inserted_files)) {
$newmessage["meta"]["attachments"]=$inserted_files;
}
 
 
return $newmessage;
}
 
function phorum_convert_selectUsers($link) {
global $CONVERT;
 
 
// collecting permissions
$CONVERT['perms'] = phorum_convert_getPermissions($link);
 
// selecting the users
$res=mysql_unbuffered_query("SELECT * FROM ".$CONVERT['forumstable']."_auth ORDER BY id", $link);
 
if(mysql_error($link)) {
return false;
}
 
return $res;
}
 
function phorum_convert_getNextUser($res) {
global $CONVERT;
 
$userdata=array();
$userdata=mysql_fetch_assoc($res);
if(!$userdata) {
return false;
}
 
unset($userdata['lang']);
unset($userdata['password_tmp']);
unset($userdata['combined_token']);
unset($userdata['max_group_permission_level']);
unset($userdata['permission_level']);
 
$userdata['user_id']=$userdata['id'];
unset($userdata['id']);
 
$userdata['real_name']=$userdata['name'];
unset($userdata['name']);
 
$userdata['active']=1;
if(isset($CONVERT['perms'][$userdata['user_id']][0])) {
echo "Setting {$userdata['user_id']} as administrator.{$CONVERT['lbr']}";
$userdata['admin']=1;
unset($CONVERT['perms'][$userdata['user_id']][0]);
}
if(isset($CONVERT['perms'][$userdata['user_id']])) {
foreach($CONVERT['perms'][$userdata['user_id']] as $key => $val) {
echo "Setting {$userdata['user_id']} as moderator for forum $key.{$CONVERT['lbr']}";
$userdata['forum_permissions'][$key] = 0 | PHORUM_USER_ALLOW_READ | PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY | PHORUM_USER_ALLOW_EDIT | PHORUM_USER_ALLOW_MODERATE_MESSAGES;
}
}
// set the date_added and active to current time
$userdata["date_added"]=time();
$userdata["date_last_active"]=time();
 
return $userdata;
 
}
 
function phorum_convert_getUserGroups($link) {
GLOBAL $CONVERT;
 
$res=mysql_unbuffered_query("SELECT * FROM ".$CONVERT['forumstable']."_user2group",$link);
 
if(mysql_error()) {
echo "No user2group-table found? : ".mysql_error().$CONVERT['lbr'];
return false;
}
$groups=array();
 
while($row=mysql_fetch_array($res)) {
$groups[$row['user_id']][$row['group_id']]=PHORUM_USER_GROUP_APPROVED;
}
 
return $groups;
}
 
function phorum_convert_getPermissions($link) {
GLOBAL $CONVERT;
 
$res=mysql_unbuffered_query("SELECT * FROM ".$CONVERT['forumstable']."_moderators",$link);
 
if(mysql_error()) {
echo "No moderators-table found? : ".mysql_error().$CONVERT['lbr'];
return false;
}
 
while($row=mysql_fetch_array($res)) {
$perms[$row['user_id']][$row['forum_id']]=true;
}
return $perms;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/scripts/convertViewCount.php
New file
0,0 → 1,28
<?php
/*
This script converts viewcount data from mod_viewcount to Phorum's internal viewcounter.
To use it, copy the script to your main Phorum directory (eg: /phorum5), and run it from the command line.
"php convertViewCount.php"
It should work from a web browser also, although if output buffering is enabled it may not
output anything until it is completed.
 
If you are enabling Phorum's internal viewcount setting, you should disable mod_viewcount.
*/
include("include/db/config.php");
mysql_connect($PHORUM["DBCONFIG"]["server"],$PHORUM["DBCONFIG"]["user"],$PHORUM["DBCONFIG"]["password"]);
mysql_select_db($PHORUM["DBCONFIG"]["name"]);
$query = "SELECT message_id, meta, viewcount FROM $PHORUM[DBCONFIG][table_prefix]_messages ORDER BY message_id DESC";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
print("Converting message $row[0]\n");
$meta = unserialize($row["meta"]);
if (isset($meta["mod_viewcount"][$row["message_id"]])){
$count = $row["viewcount"] + $meta["mod_viewcount"][$row["message_id"]];
}
else{
$count = 0;
}
$query = "UPDATE $PHORUM[DBCONFIG][table_prefix]_messages SET viewcount = $count WHERE message_id = $row[message_id]";
mysql_query($query);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/redirect.php
New file
0,0 → 1,36
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Redirect to another page. This is used for working around an MSIE bug
// where redirecting to an anchored URL looses the anchor if redirected
// directly from a script that acts on POST input coming from an
// enctype="multipart/mixed" form... *sigh*.
 
define('phorum_page', 'redirect');
 
require_once("./common.php");
 
if (isset($PHORUM["args"]["phorum_redirect_to"])) {
$redir = urldecode($PHORUM["args"]["phorum_redirect_to"]);
phorum_redirect_by_url($redir);
} else {
header("Location: index.php");
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/moderation.php
New file
0,0 → 1,462
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','moderation');
 
include_once("./common.php");
include_once("./include/moderation_functions.php");
include_once("./include/thread_info.php");
include_once("./include/email_functions.php");
 
if(!phorum_check_read_common()) {
return;
}
 
$PHORUM["DATA"]["MODERATOR"] = phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
 
$msgthd_id = (isset($_POST["thread"])) ? (int)$_POST["thread"] : (int)$PHORUM['args'][2];
 
$mod_step = (isset($_POST["mod_step"])) ? (int)$_POST["mod_step"] : (int)$PHORUM['args'][1];
 
if(empty($msgthd_id) || !phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) {
phorum_return_to_list();
}
 
// If the user is not fully logged in, send him to the login page.
// because moderation action can vary so much, the only safe bet is to send them
// to the referrer if they are not fully logged in
if(!$PHORUM["DATA"]["FULLY_LOGGEDIN"]){
phorum_redirect_by_url(phorum_get_url(PHORUM_LOGIN_URL, "redir=".$_SERVER["HTTP_REFERER"]));
exit();
}
 
 
$template="message";
// set all our URL's
phorum_build_common_urls();
 
// make it possible to override this var in a hook
$is_admin_user=$PHORUM["user"]["admin"];
 
// a hook for doing stuff in moderation, i.e. logging moderator-actions
phorum_hook("moderation",$mod_step);
 
 
switch ($mod_step) {
 
case PHORUM_DELETE_MESSAGE: // this is a message delete
 
// check that they're an admin if they want to delete an announcement
$message = phorum_db_get_message($msgthd_id);
if ($message["sort"] == PHORUM_SORT_ANNOUNCEMENT && !$is_admin_user){
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]["LANG"]["DeleteAnnouncementForbidden"];
break;
}
$msg_ids=phorum_db_delete_message($msgthd_id, PHORUM_DELETE_MESSAGE);
foreach($msg_ids as $id){
$files=phorum_db_get_message_file_list($id);
foreach($files as $file_id=>$data){
phorum_db_file_delete($file_id);
}
}
phorum_hook("delete", $msg_ids);
$nummsgs=count($msg_ids);
$PHORUM['DATA']['MESSAGE']=$nummsgs." ".$PHORUM["DATA"]['LANG']['MsgDeletedOk'];
if(isset($PHORUM['args']["prepost"])) {
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
} else {
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
break;
 
case PHORUM_DELETE_TREE: // this is a message delete
// check that they're an admin if they want to delete an announcement
$message = phorum_db_get_message($msgthd_id);
if ($message["sort"] == PHORUM_SORT_ANNOUNCEMENT && !$is_admin_user){
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]["LANG"]["DeleteAnnouncementForbidden"];
break;
}
 
// Delete the message and all its replies.
$msg_ids=phorum_db_delete_message($msgthd_id, PHORUM_DELETE_TREE);
 
// Cleanup the attachments for all deleted messages.
foreach($msg_ids as $id){
$files=phorum_db_get_message_file_list($id);
foreach($files as $file_id=>$data){
phorum_db_file_delete($file_id);
}
}
 
// Check if we have moved threads to delete.
// We unset the forum id, so phorum_db_get_messages()
// will return messages with the same thread id in
// other forums as well (those are the move notifications).
$forum_id = $PHORUM["forum_id"];
$PHORUM["forum_id"] = 0;
$moved = phorum_db_get_messages($msgthd_id);
$PHORUM["forum_id"] = $forum_id;
foreach ($moved as $id => $data) {
if (isset($data["meta"]["moved"])) {
phorum_db_delete_message($id, PHORUM_DELETE_MESSAGE);
}
}
 
// Run a hook for performing custom cleanup actions.
phorum_hook("delete", $msg_ids);
 
$nummsgs=count($msg_ids);
$PHORUM['DATA']['MESSAGE']=$nummsgs." ".$PHORUM["DATA"]["LANG"]['MsgDeletedOk'];
if(isset($PHORUM['args']["prepost"])) {
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
} else {
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
break;
 
case PHORUM_MOVE_THREAD: // this is the first step of a message move
// check if the thread to move is an announcement thread
$message = phorum_db_get_message($msgthd_id);
if ($message["sort"] == PHORUM_SORT_ANNOUNCEMENT) {
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]["LANG"]["MoveAnnouncementForbidden"];
break;
}
$PHORUM['DATA']['URL']["ACTION"]=phorum_get_url(PHORUM_MODERATION_ACTION_URL);
$PHORUM['DATA']["FORM"]["forum_id"]=$PHORUM["forum_id"];
$PHORUM['DATA']["FORM"]["thread_id"]=$msgthd_id;
$PHORUM['DATA']["FORM"]["mod_step"]=PHORUM_DO_THREAD_MOVE;
 
// get all the forums the moderator may move to
$PHORUM['DATA']["MoveForumsOption"]="";
 
 
$forums=phorum_db_get_forums(0,-1,$PHORUM['vroot']);
asort($forums);
 
foreach($forums as $id=>$forum){
if ($id == $PHORUM["forum_id"]) continue;
// add && phorum_user_moderate_allowed($id) if the mod should only be able
// to move to forums he also moderates
if($forum["folder_flag"]==0){
// it makes no sense to move to the forum we are in already
if($forum['forum_id'] != $PHORUM['forum_id']) {
$forum_data[strtolower($forum["name"])]=array("forum_id"=>$id, "name"=>$forum["name"]);
}
}
}
 
$PHORUM['DATA']['FRM']=1;
$PHORUM['DATA']['FORUMS']=$forum_data;
$output=true;
 
$template="move_form";
 
break;
 
case PHORUM_DO_THREAD_MOVE: // this is the last step of a message move
 
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]['LANG']['MsgMoveOk'];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
$message = phorum_db_get_message($msgthd_id);
 
// find out if we have a notification-message already in this
// target-forum for this thread ... it doesn't make sense to keep this
// message any longer as the thread has reappeared on its original location
$temp_forum_id=$PHORUM['forum_id'];
$PHORUM['forum_id']=$_POST['moveto'];
$check_messages=phorum_db_get_messages($msgthd_id);
 
unset($check_messages['users']);
 
// ok, we found exactly one message of this thread in the target forum
if(is_array($check_messages) && count($check_messages) == 1) {
// ... going to delete it
$tmp_message=array_shift($check_messages);
$retval=phorum_db_delete_message($tmp_message['message_id']);
}
 
$PHORUM['forum_id']=$temp_forum_id;
 
// Move the thread to another forum.
phorum_db_move_thread($msgthd_id, $_POST['moveto']);
 
// Create a new message in place of the old one to notify
// visitors that the thread was moved.
if(isset($_POST['create_notification']) && $_POST['create_notification']) {
$newmessage = $message;
$newmessage['body']=" -- moved topic -- ";
$newmessage['meta']=array('moved' => 1);
$newmessage['sort']=PHORUM_SORT_DEFAULT;
unset($newmessage['message_id']);
 
phorum_db_post_message($newmessage);
}
phorum_hook("move_thread", $msgthd_id);
break;
 
case PHORUM_CLOSE_THREAD: // we have to close a thread
 
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]['LANG']['ThreadClosedOk'];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
phorum_db_close_thread($msgthd_id);
phorum_hook("close_thread", $msgthd_id);
break;
 
case PHORUM_REOPEN_THREAD: // we have to reopen a thread
 
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]['LANG']['ThreadReopenedOk'];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
phorum_db_reopen_thread($msgthd_id);
phorum_hook("reopen_thread", $msgthd_id);
break;
 
case PHORUM_APPROVE_MESSAGE: // approving a message
 
$PHORUM['DATA']['MESSAGE']="1 ".$PHORUM["DATA"]['LANG']['MsgApprovedOk'];
 
$old_message = phorum_db_get_message($msgthd_id);
$newpost=array("status"=>PHORUM_STATUS_APPROVED);
 
// setting the new status
phorum_db_update_message($msgthd_id, $newpost);
 
// updating the thread-info
phorum_update_thread_info($old_message['thread']);
 
// updating the forum-stats
phorum_db_update_forum_stats(false, 1, $old_message["datestamp"]);
 
if($old_message['status'] != PHORUM_STATUS_HIDDEN ) {
phorum_email_notice($old_message);
}
 
if(isset($PHORUM['args']['old_forum']) && is_numeric($PHORUM['args']['old_forum']) && $PHORUM['folder_flag'] && $old_message['sort'] == PHORUM_SORT_ANNOUNCEMENT) {
$PHORUM['forum_id']=(int)$PHORUM['args']['old_forum'];
}
 
 
if(isset($PHORUM['args']["prepost"])) {
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
} else {
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
break;
 
case PHORUM_APPROVE_MESSAGE_TREE: // approve a message and all answers to it
 
$old_message = phorum_db_get_message($msgthd_id);
$newpost=array("status"=>PHORUM_STATUS_APPROVED);
 
$mids = phorum_db_get_messagetree($msgthd_id, $old_message["forum_id"]);
// make an array from the string
$mids_arr=explode(",",$mids);
 
// count the entries for later use
$num_approved=count($mids_arr);
foreach($mids_arr as $key => $mid) {
// setting the new status
phorum_db_update_message($mid, $newpost);
 
}
 
// updating the thread-info
phorum_update_thread_info($old_message['thread']);
 
// updating the forum-stats
phorum_db_update_forum_stats(false, "+$num_approved", $old_message["datestamp"]);
 
if(isset($PHORUM['args']['old_forum']) && is_numeric($PHORUM['args']['old_forum']) && $PHORUM['folder_flag'] && $old_message['sort'] == PHORUM_SORT_ANNOUNCEMENT) {
$PHORUM['forum_id']=(int)$PHORUM['args']['old_forum'];
}
 
 
$PHORUM['DATA']['MESSAGE']="$num_approved ".$PHORUM['DATA']['LANG']['MsgApprovedOk'];
if(isset($PHORUM['args']["prepost"])) {
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
} else {
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
break;
 
case PHORUM_HIDE_POST: // hiding a message (and its replies)
 
$old_message = phorum_db_get_message($msgthd_id);
$newpost=array("status"=>PHORUM_STATUS_HIDDEN);
 
$mids = phorum_db_get_messagetree($msgthd_id, $old_message["forum_id"]);
// make an array from the string
$mids_arr=explode(",",$mids);
 
// count the entries for later use
$num_hidden=count($mids_arr);
foreach($mids_arr as $key => $mid) {
// setting the new status
phorum_db_update_message($mid, $newpost);
 
}
 
phorum_hook("hide", $msgthd_id);
 
// updating the thread-info
phorum_update_thread_info($old_message['thread']);
 
// updating the forum-stats
phorum_db_update_forum_stats(false, "-$num_hidden", $old_message["datestamp"]);
 
$PHORUM['DATA']['MESSAGE']="$num_hidden ".$PHORUM['DATA']['LANG']['MsgHiddenOk'];
if(isset($PHORUM['args']["prepost"])) {
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
} else {
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
break;
 
case PHORUM_MERGE_THREAD: // this is the first step of a thread merge
 
$template="merge_form";
$PHORUM['DATA']['URL']["ACTION"] = phorum_get_url(PHORUM_MODERATION_ACTION_URL);
$PHORUM['DATA']["FORM"]["forum_id"] = $PHORUM["forum_id"];
$PHORUM['DATA']["FORM"]["thread_id"] = $msgthd_id;
$PHORUM['DATA']["FORM"]["mod_step"] = PHORUM_DO_THREAD_MERGE;
 
// the moderator selects the target thread to merge to
$merge_t1 = phorum_moderator_data_get('merge_t1');
if( !$merge_t1 || $merge_t1==$msgthd_id ) {
phorum_moderator_data_put('merge_t1', $msgthd_id);
$PHORUM['DATA']["FORM"]["merge_none"] =true;
}
// the moderator selects the source thread to merge from
else {
$PHORUM['DATA']["FORM"]["merge_t1"] =$merge_t1;
$message = phorum_db_get_message($merge_t1, "message_id", true);
$PHORUM['DATA']["FORM"]["merge_subject1"] =htmlentities($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]);
$message = phorum_db_get_message($msgthd_id);
$PHORUM['DATA']["FORM"]["thread_subject"] =htmlentities($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]);
}
break;
 
case PHORUM_DO_THREAD_MERGE: // this is the last step of a thread merge
 
if( isset($_POST['thread1']) && $_POST['thread1']) {
// Commit Thread Merge
settype($_POST['thread1'], "int");
settype($_POST['thread'], "int"); // Thread 2
$PHORUM['DATA']['MESSAGE'] = $PHORUM["DATA"]['LANG']['MsgMergeOk'];
$PHORUM['DATA']["URL"]["REDIRECT"] = $PHORUM["DATA"]["URL"]["TOP"];
$PHORUM["reverse_threading"] = 0;
 
// Get the target thread.
$target =phorum_db_get_message($_POST['thread1'], "message_id", true);
if (!$target) die("Can't retrieve target thread " . $_POST['thread1']);
 
// Get all messages from the thread that we have to merge.
$merge_messages=phorum_db_get_messages($_POST['thread']);
unset($merge_messages['users']);
 
// Create new messages in the target thread for
// all messages that have to be merged.
$msgid_translation=array();
foreach($merge_messages as $msg)
{
$oldid=$msg['message_id'];
 
$msg['thread'] = $target['thread']; // the thread we merge with
$msg['forum_id'] = $target['forum_id']; // the forum_id of the new thread
$msg['sort'] = $target['sort']; // the sort type of the new thread
 
if($msg['message_id'] == $msg['thread']) {
$msg['parent_id']=$target['thread'];
} elseif(isset($msgid_translation[$msg['parent_id']])) {
$msg['parent_id']=$msgid_translation[$msg['parent_id']];
} else {
$msg['parent_id']=$msg['thread'];
}
 
unset($msg['message_id']);
unset($msg['modifystamp']);
 
phorum_db_post_message($msg,true);
 
// save the new message-id for later use
$msgid_translation[$oldid]=$msg['message_id'];
}
 
// deleting messages which are now doubled
phorum_db_delete_message($_POST['thread'], PHORUM_DELETE_TREE);
 
// update message count / stats
phorum_db_update_forum_stats(true);
// change forum_id for the following calls to update the right forum
$PHORUM["forum_id"] =$target['forum_id'];
// update message count / stats
phorum_update_thread_info($target['thread']);
phorum_db_update_forum_stats(true);
} else {
// Cancel Thread Merge
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]['LANG']['MsgMergeCancel'];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
 
// unset temporary moderator_data
phorum_moderator_data_remove('merge_t1');
 
break;
 
case PHORUM_SPLIT_THREAD: // this is the first step of a thread split
 
$PHORUM['DATA']['URL']["ACTION"]=phorum_get_url(PHORUM_MODERATION_ACTION_URL);
$PHORUM['DATA']["FORM"]["forum_id"]=$PHORUM["forum_id"];
$message =phorum_db_get_message($msgthd_id);
$PHORUM['DATA']["FORM"]["thread_id"]=$message["thread"];
$PHORUM['DATA']["FORM"]["message_id"]=$msgthd_id;
$PHORUM['DATA']["FORM"]["message_subject"]=htmlentities($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]);
$PHORUM['DATA']["FORM"]["mod_step"]=PHORUM_DO_THREAD_SPLIT;
$template="split_form";
break;
 
case PHORUM_DO_THREAD_SPLIT: // this is the last step of a thread split
 
$PHORUM['DATA']['MESSAGE']=$PHORUM["DATA"]['LANG']['MsgSplitOk'];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
settype($_POST['forum_id'], "int");
settype($_POST['message'], "int");
settype($_POST['thread'], "int");
phorum_db_split_thread($_POST['message'],$_POST['forum_id']);
// update message count / stats
phorum_update_thread_info($_POST['thread']);
phorum_update_thread_info($_POST['message']);
phorum_db_update_forum_stats(true);
break;
 
default:
 
if(!isset($PHORUM['DATA']['MESSAGE'])) $PHORUM['DATA']['MESSAGE']="";
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
}
 
if(!isset($PHORUM['DATA']['BACKMSG'])) {
$PHORUM['DATA']["BACKMSG"]=$PHORUM['DATA']["LANG"]["BackToList"];
}
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template($template);
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_multiplehooks/info.txt
New file
0,0 → 1,4
title: Multiplehooks example module
desc: This is a module that demonstrates the use of multiple hooks in one module. It will display "Hello" after the header and "World!" before the footer of each page.
hook: after_header|phorum_mod_example_multiplehooks_after_header
hook: before_footer|phorum_mod_example_multiplehooks_before_footer
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_multiplehooks/example_multiplehooks.php
New file
0,0 → 1,15
<?php
 
// This module demonstrates the use of multiple hooks in a single module.
 
if(!defined("PHORUM")) return;
 
function phorum_mod_example_multiplehooks_after_header () {
print "Hello";
}
 
function phorum_mod_example_multiplehooks_before_footer () {
print "World!";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_settings/example_settings.php
New file
0,0 → 1,23
<?php
 
// This module demonstrates the use of settings for a Phorum module.
// This module will display a configurable string for a configurable
// number of times, right after the page header (how useful is that? :-).
 
if(!defined("PHORUM")) return;
 
function phorum_mod_example_settings_after_header () {
$PHORUM = $GLOBALS["PHORUM"];
 
// Apply default values for the settings.
if (empty($PHORUM["mod_example_settings"]["displaytext"]))
$PHORUM["mod_example_settings"]["displaytext"] = "Hello, world!";
if (!isset($PHORUM["mod_example_settings"]["displaycount"]))
$PHORUM["mod_example_settings"]["displaytext"] = 1;
 
for ($i = 0; $i < $PHORUM["mod_example_settings"]["displaycount"]; $i++) {
print $PHORUM["mod_example_settings"]["displaytext"] . " ";
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_settings/settings.php
New file
0,0 → 1,64
<?php
 
// Make sure that this script is loaded from the admin interface.
if(!defined("PHORUM_ADMIN")) return;
 
// Save settings in case this script is run after posting
// the settings form.
if(count($_POST))
{
// Create the settings array for this module.
$PHORUM["mod_example_settings"] = array(
"displaytext" => $_POST["displaytext"],
"displaycount" => $_POST["displaycount"],
);
 
// Force the displaycount to be an integer value.
settype($PHORUM["mod_example_settings"]["displaycount"], "int");
 
if(! phorum_db_update_settings(array("mod_example_settings"=>$PHORUM["mod_example_settings"]))) {
$error="Database error while updating settings.";
} else {
echo "Settings Updated<br />";
}
}
 
// Apply default values for the settings.
if (!isset($PHORUM["mod_example_settings"]["displaytext"]))
$PHORUM["mod_example_settings"]["displaytext"] = "";
if (!isset($PHORUM["mod_example_settings"]["displaycount"]))
$PHORUM["mod_example_settings"]["displaycount"] = 1;
 
// We build the settings form by using the PhorumInputForm object. When
// creating your own settings screen, you'll only have to change the
// "mod" hidden parameter to the name of your own module.
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm ("", "post", "Save");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "example_settings");
 
// Here we display an error in case one was set by saving
// the settings before.
if (!empty($error)) {
echo "$error<br />";
}
 
// This adds a break line to your form, with a description on it.
// You can use this to separate your form into multiple sections.
$frm->addbreak("Edit settings for the example_settings module");
 
// This adds a text message to your form. You can use this to
// explain things to the user.
$frm->addmessage("This is the settings screen for the example_settings module. This module is only written for demonstrating the use of a settings screen for you own modules. The module itself will display a configurable text for a configurable number of times on screen.");
 
// This adds a row with a form field for entering the display text.
$frm->addrow("Text to display (default: Hello, world!)", $frm->text_box('displaytext', $PHORUM["mod_example_settings"]["displaytext"], 50));
 
// This adds another row with a form field for entering the display count.
$frm->addrow("Number of times to display", $frm->text_box('displaycount', $PHORUM["mod_example_settings"]["displaycount"], 5));
 
// We are done building the settings screen.
// By calling show(), the screen will be displayed.
$frm->show();
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_settings/info.txt
New file
0,0 → 1,3
title: Settings example module
desc: This is a module that demonstrates the support module settings in a multiple file module.
hook: after_header|phorum_mod_example_settings_after_header
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_check_post/info.txt
New file
0,0 → 1,3
title: Check_post example module
desc: This is a module that demonstrates how to use the check_post hook. It will disallow the use of the string "bar" in the message body.
hook: check_post|phorum_mod_example_check_post_check_post
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_check_post/example_check_post.php
New file
0,0 → 1,19
<?php
 
// This module demonstrates how a hook function for the check_post
// hook could be written.
 
if(!defined("PHORUM")) return;
 
function phorum_mod_example_check_post_check_post ($args) {
list ($message, $error) = $args;
if (!empty($error)) return $args;
 
if (stristr($message["body"], "bar") !== false) {
return array($message, "The body may not contain 'bar'");
}
return $args;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/example_language.php
New file
0,0 → 1,10
<?php
 
if(!defined("PHORUM")) return;
 
function phorum_mod_example_language_after_header () {
$PHORUM = $GLOBALS["PHORUM"];
print $PHORUM["DATA"]["LANG"]["example_language"]["HelloWorld"];
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/info.txt
New file
0,0 → 1,4
title: Language example module
desc: This is a module that demonstrates the support of multiple languages in a multiple file module.
hook: lang|
hook: after_header|phorum_mod_example_language_after_header
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/lang/french.php
New file
0,0 → 1,3
<?php
$PHORUM["DATA"]["LANG"]["example_language"]["HelloWorld"] = "Salut le Monde!";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/lang/dutch.php
New file
0,0 → 1,3
<?php
$PHORUM["DATA"]["LANG"]["example_language"]["HelloWorld"] = "Hallo, wereld!";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/lang/english.php
New file
0,0 → 1,3
<?php
$PHORUM["DATA"]["LANG"]["example_language"]["HelloWorld"] = "Hello, world!";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/example_language/lang/german.php
New file
0,0 → 1,3
<?php
$PHORUM["DATA"]["LANG"]["example_language"]["HelloWorld"] = "Hallo, Welt!";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/example_mods/helloworld.php
New file
0,0 → 1,19
<?php
 
// This is an example of a single file module for Phorum. Almost all
// programming courses start out with building a program that displays
// "Hello, world!" on screen. The Phorum developers have followed
// the tradition and created "Hello, world!" for the Phorum module
// system.
 
if(!defined("PHORUM")) return;
 
/* phorum module info
title: Single file "Hello, world!" module
desc: This is an example of a single file module. The module will display "Hello, world!" after displaying the page header.
hook: after_header|phorum_mod_helloworld_after_header
*/
 
function phorum_mod_helloworld_after_header () {
print "Hello, world!";
}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/SVN-RULES
New file
0,0 → 1,101
Phorum SVN Rules
================
 
This is the first file you should be reading after you get your SVN account.
We'll assume you're basically familiar with SVN, but feel free to post
your questions in the development forum at phorum.org.
 
For information on Phorum's SVN repository, please visit our website:
http://phorum.org/cgi-bin/trac.cgi/wiki/SVNPage
 
Collaboration is a Good Thing(tm), and SVN lets us do this. Thus, following
some basic rules with regards to SVN usage will:
 
a. Make everybody happier, especially those responsible for maintaining
the SVN itself.
b. Keep the changes consistently well documented and easily trackable.
c. Prevent some of those 'Oops' moments.
d. Increase the general level of good will on planet Earth.
 
 
Having said that, here are the organizational rules:
 
1. Respect other people working on the project.
 
2. Discuss any significant changes on the list or forum before committing.
 
3. If you "strongly disagree" about something another person did, don't
start fighting publicly - take it up in private email.
 
4. If you don't know how to do something, ask first!
 
5. Test your changes before committing them. We mean it. Really.
 
6. Brian and/or Thomas have the final say.
 
The next few rules are more of a technical nature.
 
1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
messages every day. Woe be to those who attempt to mess with it.
 
2. Do not commit multiple file and dump all messages in one commit. If you
modified several unrelated files, commit each group separately and
provide a nice commit message for each one. See example below.
 
3. Do write your commit message in such a way that it makes sense even
without the corresponding diff. One should be able to look at it, and
immediately know what was modified. Definitely include the function name
in the message as shown below.
 
4. In your commit messages, keep each line shorter than 80 characters. And
try to align your lines vertically, if they wrap. It looks bad otherwise.
 
 
The format of the commit messages is pretty simple.
 
If a line begins with #, it is taken to be a comment and will not appear
in the ChangeLog. Everything else goes into the ChangeLog.
 
It is important to note that if your comment logline spans multiple
lines, you have to put # at the beginning of _every_ such line.
 
Another special prefix is MFB. If you are commiting something to a branch
and to trunk, plese put MFB on the front of the trunk commit. This will
keep the log line from showing up twice in the changelog.
 
Example. Say you modified two files, functions.php and mysql.php.
In functions.php you added a new formatting-function and in mysql.php you
fixed a bug in a query. Don't commit both of these at once. Commit them
separately and try to make sure your commit messages look something like
the following.
 
For functions.php:
 
Added new formatting-function that will print everything bold if the user is
not wanted
 
For mysql.php:
Fixed query which messed up the read-page.
# Man, that query was in there since the stone-age!
 
The # lines will be omitted from the ChangeLog.
 
If you fix some bugs, you should note the ticket ID numbers in your
commit message. Ticket ID should be prefixed by "#" for easier access to
tickets when developers are browsing Trac.
 
Example:
 
Fixed attachments-problem when logged in. Ticket #14016
 
To receive daily updates of commits, ask one of the devs to add you to
the list.
 
Happy hacking,
 
The Phorum Dev Team
 
 
* large parts of this file were copied from the PHP Dev Team's
* CVS-RULES file. Thanks guys.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/performance.txt
New file
0,0 → 1,202
Phorum 5 performance notes
==========================
 
Several of Phorum's options have a tradeoff effect: enabling more
features can slow Phorum down. This document describes which options
these are and tries to explain the performance cost of each one.
 
Which options you should turn off to improve performance depends
on the way you use your Phorum installation.
 
Table of contents:
 
1. Global Settings
1.1 DNS Lookups
1.2 Count New Private Messages
1.3 Enable Moderator Notifications
1.4 Track User Usage
2. Forum Settings
2.1 Email Messages to Moderators
2.2 Allow Email Notification
2.3 Count Views
2.4 Show New Count in Forum List
2.5 Ban List
2.6 Censor List
2.7 Move Threads on Reply
2.8 Check for duplicates
 
 
1. Global Settings
-------------------------------------------------------------------------------
 
 
1.1 DNS Lookups
---------------
 
DNS lookups cause Phorum to display DNS entries (hostnames) instead
of IP addresses on posts. It also will enable checking if mail
addresses point to valid domains.
 
On a forum with a lot of posts, enabling this will result in a
significant number of queries to your DNS server. Phorum's performance
will slow down while a query is running, as it will wait for the result
of the query.
 
If your DNS server is slow, this may give the impression to your users
that posting a message is very slow. If that is the case, you should
turn DNS lookups off. If you have access to a fast DNS server or only
have a few regular posters, you should be able to leave it on.
 
 
1.2 Count New Private Messages
------------------------------
 
If enabled, this option will alert users when they have new private
messages. On every page a logged in user visits, Phorum will check
to see if they have new private messages.
 
If you have a large number of active users at one time with a large
number of private messages, this query can start to slow down your
database. Turning it off may help performance, but will also remove
the notification users get when they receive a new private message.
You can also enable userdata caching under "Cache Settings" to
improve performance.
 
 
1.3 Enable Moderator Notifications
----------------------------------
 
Similar to the Count New Private Messages option, this option will
alert users who are also moderators when they have a new item that
requires their attention.
 
The performance hit of this feature is basically nothing for users
without moderator permissions, as Phorum will never perform the checks.
Moderators will suffer a small performance hit, depending on what type
of moderator they are.
 
Administrators will suffer a larger performance hit, as they are
effectively moderators of every type, so all of the checks will be
performed.
 
 
1.4 Track User Usage
--------------------
 
This option controls how often Phorum will record when a user was last
active. Setting this to be more frequent results in more accurate last
activity data, but also causes more database writes.
 
The "Constantly" setting will record the users activity on every page
hit by any logged in user, resulting in a dramatic increase in the number
of database writes. In most databases, a write is much slower then a
read, so this can dramatically reduce performance. This setting is not
recommended, except for installations with very few users, or very
powerful hardware.
 
If you are using a module that actively requires this data (such as the
Online Users module), the setting "Once per 5 minutes" is the best
setting, as the data will be too out of date if you update the data
less frequently.
 
If you are not using such a module, "Once per day" or "Once per hour" are
highly recommended over the other options. "Never" disables this function
entirely, and is recommended if you simply don't care to know if a user
is active or not.
 
Note: the option "Cache User Data" should be disabled if you have this
feature set to "Once per 5 minutes" or "Constantly", as the caching
will not be of much use.
 
 
2. Forum Settings
-------------------------------------------------------------------------------
 
 
2.1 Email Messages to Moderators
--------------------------------
 
If enabled, every post in the forum will be emailed to the forum's
moderators. Administrators are automatically moderators in every forum,
and will also get the emails.
 
This option should not directly affect Phorum's performance, but when
a post is made, it will cause some emails to be created. If you have a
large number of moderators and a lot of posts being made by users, this
can generate a significant amount of email traffic.
 
The traffic should only be a problem on very large forums or if you have
a slow mail server. In other cases, it should not cause significant
performance issues.
 
 
2.2 Allow Email Notification
----------------------------
 
This option has similar issues to the Email Messages to Moderators
setting, except the recipients of the emails are users who have
selected the option to have replies in a followed thread emailed to
them.
 
If a large number of users is using this feature in a busy thread, it
can affect performance. If only few users are using this feature, it
will not cause significant performance issues.
 
 
2.3 Count Views
---------------
If enabled, this feature records the number of views each post gets.
For every post read, the counter will be incremented in the database.
On a busy forum, this will result in a tremendous number of database
writes, dramatically slowing down performance.
 
Enabling this feature is not recommended for high traffic forums,
unless you have very powerful hardware.
 
 
2.4 Show New Count in Forum List
--------------------------------
 
If enabled, the count of new messages for each forum will appear in
index.php. While quite handy, this has to run several queries per
listed forum. If there are many forums on the index.php page, there
could be a significant performance hit.
 
2.5 Ban List
------------
 
The ban list is a list of words that are banned when posting a message.
There is a small performance penalty for searching for the banned words,
but only when posting.
 
 
2.6 Censor List
---------------
 
The censor list is a list of filtered words, that is checked on every
post read. Because it is checked far more often than the ban list, a
large censor list will affect performance much more.
 
 
2.7 Move Threads on Reply
-------------------------
 
"Move Threads on Reply" means that a thread which gets a new reply causes
the topic to be moved to the top of the forum, hence the topics are
sorted by their last reply and not by their first post in the message
list.
 
In Flat-mode there is no performance hit. In Threaded-mode it causes
a large overhead because of the complexity of the sorting and the
counting of posts on a page.
 
 
2.8 Check for duplicates
------------------------
"Check for duplicates" runs one additional query while posting to check
if that post has been made before. That query should be fast and just
a small overhead.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/license.txt
New file
0,0 → 1,66
/* ====================================================================
* The Phorum License 2.0.
*
* Copyright (c) 2001 The Phorum Development Team. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Phorum Development Team (http://phorum.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Phorum" and "Phorum Development Team" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact core@phorum.org.
*
* 5. Products derived from this software may not be called "Phorum",
* nor may "Phorum" appear in their name, without prior written
* permission of the Phorum Development Team.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE PHORUM DEVELOPMENT TEAM OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Phorum Development Team. For more
* information on Phorum , please see
* <http://phorum.org/>.
*
* This license is based on The Apache Software License Version 1.1.
* Only the names, email addresses and urls were changed.
* Permission was granted from The Apache Software Foundation to use
* their license.
*
* The original version of the license is copyright (c) 2000 The Apache
* Software Foundation. All rights reserved.
*
* For more information on the Apache Software Foundation, please
* see <http://www.apache.org/>.
*
*/
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/blog_howto.txt
New file
0,0 → 1,63
Phorum Blog How-To
==================
 
This document describes how to create a forum which can be used as a blog.
 
 
1. Create the Blog Forum
------------------------
 
1. When creating the forum, you should set `Visible` to `No`. This
will keep it out of the normal forum list;
 
2. The template will use the forum's name as the title of the page;
 
3. Set the forum to allow only reading by anyone.
 
 
2. Create a write group
-----------------------
 
1. Go to `Edit Groups`;
 
2. Add a group by creating a new group. e.g. Blog Writers;
 
3. Click on the group name to edit it;
 
4. Add the blog forum to the group and grant `Read`, `Reply`,
`Create New Topics`, `Edit Their Posts`;
 
5. You can create additional groups for moderation of comments, etc.
 
 
3. Make a cool script (optional)
--------------------------------
 
Somehow, you have to point people at the blog. You could make a redirect
using any number of things to redirect your readers to the appropriate URL
(list.php?1, where 1 is the forum id of the blog forum). However, I like
the following method. Let's asume you want the blog to be a page called
blog.php. Then create blog.php like this:
 
<?php
 
chdir("/full/path/to/phorum");
 
// Below, "1" is the forum_id for the blog forum
$PHORUM_CUSTOM_QUERY_STRING="1";
 
include_once "./list.php";
 
?>
 
If you wanted your front page to be the blog, just create index.php and
put this in it.
 
 
TODO
----
 
At the time of writing, there are still several parts of the default
template that are not yet converted to the blog template. Control Center
for example.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/creating_mail_messages.txt
New file
0,0 → 1,99
Customizing your Phorum mail messages
=====================================
 
This document describes the way you can customize the mail messages
that are sent out by Phorum.
 
Table of contents:
 
1. General information
2. User-notifications about new messages in followed threads
3. Moderator-notifications about new messages
4. User-notifications about new private messages
 
 
1. General information
-------------------------------------------------------------------------------
 
All messages and subjects for the mail messages are defined as language
strings in the language-files. So to customize mail messages, you can
change the definition of these strings.
 
For some mail messages, you can use a couple of special tags in the
message and mailsubject, which are automatically replaced by relevant
data.
 
Below you'll find a list of the language strings that you can update for
each type of mail message and the special tags that you can use in them.
 
 
2. User-notifications about new messages in followed threads
-------------------------------------------------------------------------------
 
Related language strings:
 
- NewReplySubject
- NewReplyMessage
 
Replacement tags:
 
- %forumname% The name of the current forum.
- %author% The name of the author of the message.
- %subject% The subject of the message.
- %full_body% The full body of the message including all HTML/BBCode
tags, use with care!
- %plain_body% The body of the message which is stripped from all
HTML/BBCode tags.
- %read_url% The url where this message can be read.
- %remove_url% The url to unsubscribe from the followed thread.
- %noemail_url% The url to set the subscription to "no email", so
the thread is only followed from the user's profile.
- %followed_threads_url% The url to the controlcenter-page where the
user can look at all the followed threads.
 
 
3. Moderator-notifications about new messages
-------------------------------------------------------------------------------
 
Related language strings for messages that need to be moderated:
 
- NewModeratedSubject
- NewModeratedMessage
 
Related language strings for messages that do not need to be moderated:
 
- NewUnModeratedMessage
 
Replacement tags:
 
- %forumname% The name of the current forum.
- %author% The name of the author of the message.
- %subject% The subject of the message.
- %full_body% The full body of the message including all HTML/BBCode
tags, use with care!
- %plain_body% The body of the message which is stripped from all
HTML/BBCode tags.
- %read_url% The url where this message can be read.
- %approve_url% The url where this message can be approve (if it's a
moderated forum and messages need approval)
 
 
4. User-notifications about new private messages
-------------------------------------------------------------------------------
 
Related language strings:
 
- PMNotifySubject
- PMNotifyMessage
 
Replacement tags:
 
- %author% The name of the author of the message.
- %subject% The subject of the message.
- %full_body% The full body of the message including all HTML/BBCode
tags, use with care!
- %plain_body% The body of the message which is stripped from all
HTML/BBCode tags.
- %read_url% The url where this message can be read.
 
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/CODING-STANDARDS
New file
0,0 → 1,31
Phorum 5 Coding Standards
=========================
 
For the most part, Phorum 5 uses the standards set forth in the PEAR Coding
Standards located at http://pear.php.net/manual/en/standards.php. We do
however differ slightly in a few of ways.
 
1. Header Comment - please use the header comment found in the other Phorum
files.
 
2. Function Naming - PEAR uses the "studly caps" naming. We like to name
functions in all lower case with _. So for example: phorum_get_users().
Don't worry about long names. It is better to have a function named
well.
 
3. Variable Names - PEAR really does not address this as the code you are
writing belongs to your package. However, in Phorum, the code you write
belongs to us all. Please make variable names useful and clear. Avoid
single character variables and things like $temp.
 
Now, in looking at the code, you will see that this is not being followed to
the letter. Sometimes, editors don't cooperate and you get tabs, other
times you just forget and don't do it right. Just don't be upset if you see
an SVN commit that just says "formatting" on your code. Some editors have
auto-format features and will be used to clean up formatting.
 
Even if you are not going to write a module, you may want to read the
creating_mods.txt file. It covers some general concepts that exist in
Phorum that may help you understand more of the Phorum code.
 
Additionally, if you will be using SVN please read the SVN-RULES file.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/install.txt
New file
0,0 → 1,298
Phorum 5 Installation instructions
==================================
 
Contents:
 
1. Requirements
2. Quickstart guide
3. Detailed installation instructions
3.1 Download Phorum
3.2 Unpack the downloaded archive
3.3 Place the Phorum files in your website's document root
3.4 Create a database and a database user
3.5 Configure the database access
3.6 Run the web based installer
3.7 Things to do after installing Phorum
4. Additional issues
4.1 Additional issues for UNIX (Linux, BSD, Solaris, etc.)
4.1.2 Cache directory
4.2 Additional issues for Windows
4.2.1 Cache directory
4.2.2 Problems sending mail to end-users
4.2.3 Date formatting
5. Support
 
 
1. Requirements
-------------------------------------------------------------------------------
 
 
Requirements for running Phorum are:
 
* A webserver;
* PHP, version 4 or above;
* A MySQL server, version 4 or above.
 
If you do not run your own website, but have hosted your website with
a hosting provider, then please ask your hosting provider if your
account meets these requirements.
 
 
2. Quickstart guide:
-------------------------------------------------------------------------------
 
 
This is the quickstart guide for installing Phorum, aimed at people that
are used to working with websites, PHP and databases. If you are having
problems following this guide, then please read chapter 3 instead.
 
1. Unpack Phorum into a directory below your website's document root;
2. Create a database and a full-access database user for that database;
3. Edit include/db/config.php.sample, save it as include/db/config.php;
4. Open {phorum url}/admin.php in your web browser and finish the install.
 
 
3. Detailed installation instructions
-------------------------------------------------------------------------------
 
 
3.1 Download Phorum
-------------------
 
If you haven't already done so, download the latest Phorum distribution
from http://phorum.org/downloads.php
 
3.2 Unpack the downloaded archive
---------------------------------
From Windows:
If you have downloaded the .zip file, you can extract the
files from that archive directly using Windows XP's zipfile support.
If you downloaded the .tar.gz file, you will have to download an
appropriate tool for unpacking, e.g. WinZip (http://www.winzip.com/).
From UNIX:
If you have access to a UNIX shell, you can unpack the .tar.gz
archive using the following command:
shell> tar xvzf phorum-x.y.z.tar.gz
Or if the tar program on your system does not support the -z flag:
shell> gunzip phorum-x-y-z.tar.gz
shell> tar xvf phorum-x.y.z.tar
 
 
3.3 Place the Phorum files in your website's document root
----------------------------------------------------------
 
The document root for a website is the directory in which your site's
web pages are stored. If your website's URL is "http://www.example.com"
and you place the Phorum files in a directory called "forum" inside
your document root, your Phorum installation will be available at the
URL "http://www.example.com/forum". From now on, we will name this
URL simply {phorum url}. So if you see {phorum url}/admin.php, using the
example we mean http://www.example.com/forum/admin.php
If the webserver is running on the same system as where you have
unpacked the downloaded archive, you can move the unpacked files
to your website's document root.
If the webserver is running on another system, you will have to upload
the files to your website's document root. In most cases, you will use
FTP for this, but some hosting providers require SCP (secure copy,
which is more secure than FTP). If you do not know how or where to
upload the Phorum files, please contact your hosting provider.
Security note:
(simply ignore this if it does not make sense to you)
There are software packages that require you to make files writable
for the webserver (using the infamous "chmod 777"). DO NOT DO THIS
FOR ANY OF THE PHORUM FILES. The webserver only needs read access on
the disctribution files, because all dynamic data is stored in the
database. If you run into problems running Phorum, it will never be
because you "forgot" to do "chmod 777" on any the Phorum files.
 
 
3.4 Create a database and a database user
-----------------------------------------
 
Phorum stores all its data in a database. So you now need to create
a database. Officially, only the MySQL database server is supported
by Phorum, so we recommend to use MySQL whenever possible.
If you have hosted your site with a hosting provider, then ask
your hosting provider to setup the database and a full access
database user for you.
If you run your own database server, then you will have to create
the database and the user yourself. If you are using a control
panel, like phpmyadmin, then use that control panel to create
them. Else, you can use the mysql prompt to create the database
by issuing commands like:
mysql> CREATE DATABASE phorum;
mysql> GRANT ALL ON phorum.* TO user@localhost IDENTIFIED BY password;
Of course, for security reasons you would use your own user and
password instead.
If you are unsure how to create a database and a database user,
please refer to your system documentation.
 
 
3.5 Configure the database access
---------------------------------
 
After setting up the database, you'll have to tell Phorum how the
database can be accessed. This configuration is put in the file
include/db/config.php inside your Phorum directory. This file is
not in the distribution. Only a differently named sample file is
included.
First, copy or rename the file "include/db/config.php.sample" to
"include/db/config.php". Now edit the config.php file to match the
access settings for the database that was created in step 4.
If you run your website on a remote server, then either edit
the config.php file directly on that server (e.g. through a
UNIX prompt) or upload the file to the correct location after
editing it locally.
 
 
3.6 Run the web based installer
-------------------------------
 
Now all is in place to run Phorum's installer script.
Open {phorum url}/admin.php using your web browser. This is the admin
interface, which will automatically detect that a fresh install has
to be performed.
 
Follow the instructions on screen to finish the Phorum installation.
 
 
3.7 Things to do after installing Phorum
----------------------------------------
 
Now the installation is complete, test if the forum is working
correctly by opening {phorum url} in your web browser. If you run
into problems, please go to {forum url}/admin.php and click on
"System Sanity Checks" in the menu. This page will perform a couple
of system checks to rule out some basic problems. If problems are
found, please follow the instructions from the sanity checks page
to solve them.
Login into the admin interface at {phorum url}/admin.php and check
out what settings can be done to customize Phorum to your likings.
Customize the looks of Phorum to your needs by creating a custom
template. Instructions can be found in docs/creating_templates.txt.
Read the additional issues for your system (below), docs/faq.txt
and any other files in the docs dir that may help you.
 
 
4. Additional issues
-------------------------------------------------------------------------------
 
 
4.1 Additional issues for UNIX (Linux, BSD, Solaris, etc.)
----------------------------------------------------------
 
4.1.2 Cache directory
---------------------
 
In step 5 above (Edit Settings) There is an entry called Cache
Directory. the installer should set that to /tmp if you appear to
be running a *nix system. This will keep compiled PHP versions of
your templates in /tmp. You can change the cache dir if you do not
want to have your files sitting in /tmp on the server or if you see
error messages like:
 
Warning:
fopen(/tmp/tpl-default-header-a72fb9dd20915e5953aa9b07d3eb3871.php):
failed to open stream: Permission denied in
/path/to/phorum/include/templates.php on line 184
 
If you change the the Cache Directory, the best bet is to set it
to ./cache and make that dir (that is already there in the Phorum dir)
writable by the web server. Most likely this means making it world
writeable (chmod 777). If you do not have access to the shell prompt
of the server and are using only FTP to access the server, please see
your FTP clients help on setting the permissions for a directory.
 
 
4.2 Additional issues for Windows
---------------------------------
 
 
4.2.1 Cache directory
---------------------
 
In step 5 above (Edit Settings) There is an entry called Cache
Directory. The installer should set that to C:\Windows\Temp, if it
can detect you are using Windows. This should work for most modern
Windows versions. If it does not, you will see error messages like:
 
Warning:
fopen(c:\windows\temp\tpl-default-header-a72fb9dd209153aa9b07d3eb3871.php):
failed to open stream: Permission denied in
c:\path\to\phorum\include\templates.php on line 184
 
You will need to change the Cache Directory. The Phorum team is not
very familiar with Windows as a web server platform. We can only tell
you that it will need to be something that the web server can write to.
Changing the Cache Directory to ./cache has worked for some.
 
 
4.2.2 Problems sending mail to end-users
----------------------------------------
 
PHP has to be configured correctly on Windows systems to be able to
send out mail. If this is not done, you might get errors and mail
will not arrive. What you need to do is edit the file "php.ini" (this
file holds the configuration for PHP). Find the sections that is called
"[mail function]". In this section, set the parameter "SMTP" to the
hostname or IP-address of the your SMTP server. If you do not know your
SMTP server, please ask your internet access provider. After this,
PHP will know what mailserver to use for sending out mail messages.
 
If you have no access to the php.ini file and the system administrator
is not willing to update it for you, you will have to install the
SMTP module for Phorum. You can download this module from the module page:
http://phorum.org/cgi-bin/trac.cgi/wiki/ListOfModules
In the settings for this module, you can specify the SMTP server to use
for sending mail. When using this module, you will completely bypass PHP's
builtin mail system.
 
 
4.2.3 Date formatting
---------------------
 
Windows does not support the date formatting function strftime() fully.
If your dates are not showing correctly, you have to edit your language
file ({phorum dir}/include/lang/<yourlanguage>.php) and change the
definitions for $PHORUM['long_date'] and $PHORUM['short_date'] in there
to something that will work for your system. We suggest using the
following definitions:
 
$PHORUM['long_date']="%B %d, %Y %I:%M%p";
$PHORUM['short_date']="%m/%d/%Y %I:%M%p";
 
Go to http://www.php.net/strftime for information on all available
formatting options as well as the formats that Windows does not support.
 
 
5. Support
-------------------------------------------------------------------------------
 
If you have questions about installing Phorum, please visit the website
http://phorum.org/ and ask the development team for help in the
Support forum. Also read the file docs/faq.txt for answers to the most
common questions.
 
 
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/faq.txt
New file
0,0 → 1,160
Phorum 5 FAQ
============
 
Table of contents:
 
1. Why did you switch from number of replies to number of posts in the list?
2. Does Phorum have avatars or user rankings like (insert UBB clone)?
3. How do I install a module?
4. Why don't non-registered users have new indicators or any options?
5. Why doesn't the default template use {insert latest greatest W3C concept}?
6. You should do (insert your idea here) in the default template.
7. Can I install Phorum once and deploy it on multiple domains?
8. I need to embed Phorum in my page/application.
9. Why do you not use the 'global' keyword in your functions?
10. What are Sticky and Announcement posts?
 
 
1. Why did you switch from number of replies to number of posts in the list?
-------------------------------------------------------------------------------
In short, the people writing the code liked it better. You can modify
your template by putting this line inside your list.tpl file.
<?php $PHORUM['TMP']['ROWS']['thread_count']--; ?>
Just put that right after the line that says:
{LOOP ROWS}
 
2. Does Phorum have avatars or user rankings like (insert UBB clone)?
-------------------------------------------------------------------------------
 
Not by default. There are modules available to add this functionality.
 
 
3. How do I install a module?
-------------------------------------------------------------------------------
 
That depends on your environment and how the module is packaged.
The basic requirement is that the module be inside a directory
which is inside /mods (in the phorum directory). So you could have
something like /phorum5/mods/mymod
 
Most mods come packaged in some form. For a .tar.gz file, in a Unix
(Linux, etc) environment, you can simply download the file into your
/phorum5/mods directory, and then use this command:
 
tar -zxf downloaded_module.tar.gz
 
In Windows, you can extract them using a program like Winzip. Make
sure that the folders are also extracted (this is an optional feature
in Winzip that should be on).
 
You can also extract the file on your home computer and upoad them to the
server using FTP. In that case you should just upload the entire module
directory into /phorum5/mods
 
 
4. Why don't non-registered users have new indicators or any options?
-------------------------------------------------------------------------------
 
Because of many cookie problems that plagued Phorum 3, we have decided
to store all user settings in the database for Phorum 5. The down side
of this is that users must be registered to use these features. The up
side is that the new indicator really works like it should in Phorum 5.
 
 
5. Why doesn't the default template use {insert latest greatest W3C concept}?
-------------------------------------------------------------------------------
 
While we do try and use standards, things like XHTML and CSS are not
always compatible with old browsers. Phorum strives to work with
browsers that are commonly used. We do not ignore new things. However,
we try and be aware of the affect of things we do on all user's machines.
Phorum will remain usable and decent on as many different platforms and
browsers as we can make it out of the box.
 
You might want to check the other templates available and see if there
is a more futurisitic one there. If not, perhaps you would like to
contribute one for everyone.
 
 
6. You should do (insert your idea here) in the default template.
-------------------------------------------------------------------------------
 
The only answer we will give you on this is that you can make your own
template. We have a reason for everything we do. Does this mean we are
not open to suggestion? No. It means there is a chance your suggestion
has been made already and if we did not do it, there is a good reason.
 
Second, if your idea has anything to do with the size of the HTML or
bandwidth, don't even post unless you are using output compression.
Output compression will decrease your bandwidth by leaps and bounds.
Search the net for mod_gzip or look at the PHP manual for
zlib.output_compression. If you don't have that level of access to your
server, you can use ob_start with obgzhandler to do the job. Look in the
PHP manual for the ob_start docs.
 
Some suggestions we have turned down include:
 
Why don't you have the CSS external - browsers do a bad job of caching
CSS and compression utilities like zlib.output_compression can compress
the CSS if it is in the PHP output itself.
 
Your CSS names are way too long. You could use short abreviations like
PLTR - What the crap does PLTR mean? You will see it in the code and
have no idea what part of the output that is referencing. Yes, we could
put comments in the CSS with a long name, but that would not make the
HTML clear. Also, output compression will remove the multiple instances
of the class name. Perhaps most importantly, by having 'Phorum' in all
our class names, we won't step on another applications classes.
 
 
7. Can I install Phorum once and deploy it on multiple domains?
-------------------------------------------------------------------------------
 
Yes! Once you install the Phorum code somewhere, you can copy the
contents of the portable directory to another location. Edit
phorum_settings.php in the new location and point your browser to that
copy of phorum_admin.php. You will be taken through the install process.
Be sure to choose unique values for table_prefix or choose different
database names for each installation of the portable code. A wrapped
forum is a little slower because of the function overhead.
 
 
8. I need to embed Phorum in my page/application.
-------------------------------------------------------------------------------
 
Well, using the portable code mentioned above, one can safely run Phorum
inside other applications. This is because the portable code runs Phorum
inside a function, protecting the namespace of your variables and
Phorum's variables. Depending on your particular application, you may
need to edit the function phorum_custom_get_url in include/wrapper.php to
have the urls of your site be created by Phorum correctly. Also, you
will need to create a var called $PHORUM_CUSTOM_QUERY_STRING for Phorum
to parse instead of the server's query string. It will need to be
formatted in the same way that the standard phorum_get_url would do it.
 
 
9. Why do you not use the 'global' keyword in your functions?
-------------------------------------------------------------------------------
 
Declaring something as global in PHP is the same as making a reference
to the $GLOBALS array. References are not as fast as making a value copy
according to the PHP developers. It is only used in common.php to create
the global existence of the $PHORUM variable.
 
See: <http://marc.theaimsgroup.com/?l=php-dev&m=100955714924477&w=2>
 
This applys to PHP4 only. We may reconsider once PHP5 is widespread.
 
 
10. What are Sticky and Announcement posts?
-------------------------------------------------------------------------------
 
Sticky posts stay at the top of the forum they are posted in and do not
get bumped down as new topics are posted.
 
Announcement posts appear at the top of all forums in the system.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/upgrade.txt
New file
0,0 → 1,131
Preliminary Upgrade-Instructions
================================
 
This document describes the Phorum upgrading process. Please keep in mind,
that these instructions are neither complete, nor final. If you find
problems in upgrading which are not described here or if you have
useful additions, please let us know.
 
Table of contents:
 
1. Upgrading from a Phorum5 version to another Phorum5 version
1.1 Upgrading the database
1.1.1 Preparations
1.1.2 From a webbrowser
1.1.3 From a system console
1.2 Upgrading templates and hacks
2. Upgrading from Phorum 3.4.x to Phorum5
 
 
1. Upgrading from a Phorum5 version to another Phorum5 version
-------------------------------------------------------------------------------
 
 
1.1 Upgrading the database
--------------------------
 
 
1.1.1 Preparations
-----------------------
 
The upgrading process will preserve all of your active settings and
modules, but will overwrite hacks and any changes made to the default
template (in the directory {phorum dir}/templates/default). Other
templates will be kept intact.
 
Here are the steps for upgrading:
 
- Backup your existing Phorum5 installation.
Before doing an upgrade, it is always wise to make a good backup
of your running system. Make a backup your Phorum install directory
and the database in which your Phorum tables are stored;
 
- Download a newer Phorum5 package;
- Extract the files and put them on top of the current installation;
- Keep the database settings from {phorum dir}/include/db/config.php
the same;
 
Now you can choose whether you want to upgrade from a webbrowser or
from a console.
 
 
1.1.2 From a webbrowser
-----------------------
Open your forum using your webbrowser. In case a database upgrade
is needed, you will be prompted to go to the admin page. In that case
open the {phorum url}/admin.php page, which will guide you through
the upgrade.
 
 
1.1.3 From a system console
---------------------------
 
In the scripts directory of your Phorum installation, you will find
the script "console_upgrade.php". Go to the scripts directory and
execute the script from there. On most systems, you can do this using
the following command:
 
# php console_upgrade.php
 
If you want to run this script from a different locations, then edit
the script and update the $PHORUM_DIRECTORY variable to match the
location of your Phorum installation.
 
 
1.2 Upgrading templates and hacks
---------------------------------
For minor upgrades, the Phorum team has the policy that templates
should not change. For example, if you are upgrading version 5.1.1
to 5.1.2, you can simply keep the old templates.
 
Template functionality might change between major Phorum releases.
For example, templates that were made for Phorum 5.0.x are not
compatible with the templates for Phorum 5.1.x. So to upgrade these,
you'll have to build new templates, based on the new default template
that is included in the distribution. Simply copying the old template
will most probably result in errors and missing functionality.
If you are doing a minor upgrade and you have to preserve changes that
were made to the default template (which is not the recommended way
of customizing Phorum, see creating_templates.txt), you can follow one
of the following options:
- Extract the new Phorum distribution to its own directory and reapply
your changes before putting it over the existing installation;
- Create a backup of your existing installation. Install the new
distribution on top of the old one and reapply the changes to
the new version while it is "live".
 
2. Upgrading from Phorum 3.4.x to Phorum5
-------------------------------------------------------------------------------
 
- Download and unpack the Phorum5 package;
- Follow the installation instructions in docs/install.txt. Install
Phorum5 is a new directory.
- Convert the old forum data:
In the scripts directory of your Phorum5 distribution, you will find
a script named phorum3to5convert.php. Instructions for using this
script can be found at the top of this script itself. The script will
convert your old forum to Phorum5. Everything, but permission levels,
is converted.
- Update the posted message counters for the users:
In the scripts directory, you will also find a script named
"update_postcount.php". This script can be used to update the number
of posts for users to the right value. So if you want correct numbers
to show up in the user profiles, just run this script once AFTER the
conversion has been completed. To run it, you will have to copy it
over to the main Phorum5 directory. After that you can either run
it from the command line or by opening it from your webbrowser. See
also the instructions in the script itself.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/creating_templates.txt
New file
0,0 → 1,58
Creating your own Phorum template
=================================
 
This documents describes how to create your own template for
Phorum. The document is not conclusive, but there should be
enough information in here to get you started.
 
 
Here are the steps that you have to take to create your own template:
 
1) Take the default template directory from {phorum dir}/templates/default
and copy it over to another directory, for example
{phorum dir}/templates/mytemplate.
 
2) Edit {phorum dir}/templates/mytemplate/info.php. In this file you
have to edit at least the $name variable, e.g. to
$name = "My very own template";
 
You can hide the template from the user's template selection box
by setting $template_hide = 1. If you do this, you can only
select this template through the admin interface (this makes
most sense if you set the display-settings to fixed through
the admin interface).
 
3) Open Phorum's admin page {phorum url}/admin.php and go to
"General Settings". There you'll find the option "Default Template".
Set that option to your own template. You can also set a specific
template for each single forum in the forum's settings.
 
 
That's it. You are now using your own template. From here on you can start
tweaking the template files in your {phorum dir}/templates/mytemplate
directory. For most installations, the following template files will be
most interesting:
 
- header.tpl The header which will be added before each page;
- footer.tpl The footer which will be added after each page;
- settings.tpl Here you can change colors and fonts;
- css.tpl This file holds all CSS definitions for Phorum.
 
For more extended information on changing template files, please
visit our Wiki documentation site:
 
http://phorum.org/cgi-bin/trac.cgi/wiki/TemplatesDocs
 
 
 
TODO this should probably go to the wiki, becuase it's quite specific
for a getting started HOWTO...
 
Additional variables in settings.tpl:
{define bodies_in_list 1}
set this to 1 to have the message-bodies loaded in the list if your
template needs them.
 
{define all_bodies_in_threaded_read 0}
set this to 1 to have all the message-bodies also loaded in
threaded-read-view if your template needs them
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/creating_custom_userfields.txt
New file
0,0 → 1,138
Creating custom fields for user profiles
========================================
 
*** THIS DOCUMENT IS UNDER DEVELOPMENT, SO IT'S NOT YET COMPLETE ***
 
This documents describes how you can create your own custom fields
within the profiles of Phorum users.
 
 
Table of contents:
 
1. Introduction
2. Creating the custom field
3. Using the custom field
3.1 From the registration process
3.2 From the user's control center
3.3 From a module
 
 
1. Introduction
-------------------------------------------------------------------------------
 
Phorum users all have their own profile. In this profile, data about
the user is stored. By default, Phorum stores for example the
username, email address and signature in the user profile. Also
user settings like the privacy options are stored in there.
 
You might want to add additional fields to the user profile. Example
applications for this are adding extra information that will be
displayed in user profile screens or storing data and settings for
your mods (see also docs/creating_mods.txt, section 2.5).
 
Phorum has an easy, built-in system to extend the profile fields,
without requiring you to change the structure of the database. So there's
no need to actually add columns to the table in which Phorum users are
stored in the database.
 
This document will explain how to use the custom profile field system.
 
 
2. Creating the custom field
-------------------------------------------------------------------------------
 
 
Go to the admin for your Phorum installation ({phorum url}/admin.php).
There you go to "Custom Profiles" under "Users/Groups". In this screen
you can create, update and delete custom user profile fields.
 
To add a field, you will have to enter the following data:
 
* Field Name
 
This is the name that you are going to use for your custom field.
It is not the display name for your field, but the internal name,
which is used to reference the field from your code and HTML form
elements. You are only allowed to use letters, numbers and
underscores (_) for this. So if you want to store the users's shoe
size, you could for example use the field name "shoe_size".
 
Remark:
If you are creating a field for a mod, we recommend you to prefix
the field name with mod_<module name>, to prevent collisions with
Phorum and other mods. So if you add the shoe_size for a module
named "foo", you would name the field "mod_foo_shoe_size".
(see also creating_mods.txt, section 3.7.4).
 
* Field Length
 
This determines the length of the data that can be stored in the
database for the custom field. Data which is longer than this
value will be automatically truncated to the configured length
before being stored in the database.
 
* Disable HTML
 
If this checkbox is enabled, all characters that have a special
meaning in HTML will be automatically escaped when the field is
retrieved from the database. This checkbox should always be
checked in case you are directly displaying the field data,
without doing any data processing yourself. If you do not follow
this rule, it might result in a XSS security problem (see also
creating_mods.txt, section 3.6).
 
If this checkbox is disabled, you will get the data exactly
as it is stored in the database. If you want to display the
data, you should take care of properly escaping HTML code
yourself.
 
 
3. Using the custom field
-------------------------------------------------------------------------------
 
 
3.1 From the registration process
---------------------------------
 
If you want to let the user fill in the data for your custom
field during registration, you will have to add an input field to
the registration template file, which can be found in
templates/default/register.tpl (or of course in your own template
directory if you are using a custom template).
All you have to do is create a standard HTML input field and give it
the name of your custom field. Phorum will automatically take care
of storing the field's data in the database.
In the template you can make use of {REGISTER->fieldname} to get
the value of the field "fieldname". This can be used to let your
field remember its value during requests.
 
Example:
To add the shoe_size field to the registration page, you could
add the following code to the register.tpl at an appropriate place:
 
<input type="text" name="shoe_size" value="{REGISTER->shoe_size}"/>
 
 
3.2 From the user's control center
----------------------------------
 
If you want to give the user an option to change the value of your
custom field from the control center, you will have to put an input
field to the user settings template file, which can be found in
templates/default/cc_usersettings.tpl.
 
 
3.3 From a module
-----------------
 
 
======================================================================
Bits and pieces:
 
You can use all HTML field types, but we
recommend not to use checkboxes, because you will have to write
special code to handle them. Instead you could use a <select>
list with two options ("on" and "off").
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/permissions.txt
New file
0,0 → 1,91
Permissions in Phorum 5
=======================
 
This document describes the way the permission system of Phorum works.
It is targeted at developers that need inside information on the
API calls that are related to permission handling.
 
Table of contents:
 
1. Checking user permissions
2. Modifying user permissions
3. Some final notes
 
 
1. Checking user permissions
-------------------------------------------------------------------------------
 
First and foremost, your code should use the function called
phorum_user_access_allowed() to check for a given user permission
in the current forum. However, if you find yourself needing to check
the permisssion directly, here is some information.
Permissions are stored using a bitmask. To check for a certain permission,
simply use the bitwise AND (&) operator to match the permission against the
user's permissions.
For example, if we want to check if a user has permission to read
a particular forum, we would use the following if statement:
if($PHORUM["user"]["permissions"] & PHORUM_USER_ALLOW_READ){
// the user can read this forum
} else {
// the user can NOT read this forum
}
 
 
2. Modifying user permissions
-------------------------------------------------------------------------------
 
If you need to modify the permissions, use the bitwise OR (|) to add
a permission or the bitwise XOR (^) to remove a permission. After you
make the change, save the user. Here is some example code:
// add new topic permissions
$PHORUM["user"]["permissions"] =
$PHORUM["user"]["permissions"] | PHORUM_USER_ALLOW_NEW_TOPIC;
phorum_user_save($PHORUM["user"]);
// remove new topic permissions
$PHORUM["user"]["permissions"] =
$PHORUM["user"]["permissions"] ^ PHORUM_USER_ALLOW_NEW_TOPIC;
phorum_user_save($PHORUM["user"]);
 
3. Some final notes
-------------------------------------------------------------------------------
 
That should be all you need to know about the Phorum permission system.
Here is some stuff that helped explain this to the other developers:
> select (256 | 16);
> That OR's the two numbers together.
> you get 272
> then:
> select 16 & 272;
> That returns 16.
> So, in our data, the 272 represents what is in the database.
> The 16 would be one of the permission constancts
> Our constants would look like this:
> define("PHORUM_USER_ALLOW_READ", 1);
> define("PHORUM_USER_ALLOW_REPLY", 2);
> define("PHORUM_USER_ALLOW_EDIT", 4);
> define("PHORUM_USER_ALLOW_NEW_TOPIC", 8);
> define("PHORUM_USER_ALLOW_UPLOAD", 16);
> define("PHORUM_USER_ALLOW_ATTACH", 32);
> define("PHORUM_USER_ALLOW_MODERATE_MESSAGES", 64);
> define("PHORUM_USER_ALLOW_MODERATE_USERS", 128);
> define("PHORUM_USER_ALLOW_FORUM_PROPERTIES", 256);
> To give someone read and reply, we would set their perm to 1 | 2
> Then, to check it, we would $user_perm_value & $perm == $perm
> or in sql
> where permission & $perm = $perm
Another example to show that the = $perm can be left out:
> select 1 | 2
> read, reply
> = 3
> select 3 & 16
> =0
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/NEWS
New file
0,0 → 1,1668
 
Phorum 5 Changelog
--------------------------------------------------------------------------------
2006-03-20 19:23 brian
* releasing Phorum 5.1.0
 
2006-03-10 22:40 brian
* keep version as 5.1-dev and change it in tags
 
2006-03-10 21:41 mmakaay
* Fixed #289: duplicate page header shown on read page with the
forum in r/o mode
 
2006-03-10 12:17 mmakaay
* Fix for #288: editing puts back mail address of registered users
into the post
 
2006-03-07 09:19 ts77
* made two different variables for signature in control panel. one
for formatted one and one for the htmlescaped one. fixing #254
 
2006-03-06 22:51 ts77
* "fixing new pm-flag with user-caching enabled, fixing #281"
 
2006-02-21 12:49 dvl
* Change from INSERT SET to INSERT VALUES
 
2006-02-16 12:34 mmakaay
* Fix for updating posts with single quotes in subj/body (resulted
in SQL error)
 
2006-02-13 20:51 mmakaay
* Fix for #267: sending a PM with a subject only containing spaces
is now rejected
 
2006-02-12 18:19 ts77
* fixed search-escaping and missing search-table inserts (#261)
 
2006-02-12 18:12 ts77
* "fixed author search (#262)"
 
2006-02-08 16:32 mmakaay
* Made the notification message for PM faster, by using
phorum_db_pm_checknew(). Beware that this change inflicts a
template change. Instead of the variable {PRIVATE_MESSAGES->new},
the variable {NEW_PRIVATE_MESSAGES} has to be used. Before,
{PRIVATE_MESSAGES->new} contained the number of new messages,
while now {NEW_PRIVATE_MESSAGES} contains a value that indicated
whether there are new messages or not.
 
2006-02-08 16:29 mmakaay
* Added function phorum_db_pm_checknew for quick checking for new
PMs to db layers
 
2006-02-08 16:05 mmakaay
* Some optimization in the private message formatting code for more
speed.
 
2006-02-08 11:29 mmakaay
* Bugfix: When using reply in read page, moderators could not view
the message
 
2006-02-07 17:07 mmakaay
* Possible fix for templates.php timing out on Windows systems
 
2006-02-05 17:30 ts77
* added script for rebuilding the search-table
 
2006-02-05 16:41 ts77
* fixed double escaped search-data
 
2006-02-04 16:12 mmakaay
* Fix for searching for quoted phrases
 
2006-02-04 15:19 ts77
* removed "stale </a>" from #252
 
2006-02-03 13:48 ts77
* "build the urls in search-page in any case - fix for #251"
 
2006-02-03 13:14 mmakaay
* Fixed bug: admin could not relogin with cookies disabled in
Phorum's settings
 
2006-01-28 22:02 ts77
* "first version of console-upgrade script. not yet tested"
 
2006-01-28 16:37 ts77
* "added missing POST_VARS, fix for #249"
 
2006-01-24 19:54 ts77
* "disabled tight_security by default on new installs"
 
2006-01-24 03:04 brian
* Fix for bug #234. Forum permissions not removed when changing from
default forum options to custom
 
2006-01-22 21:11 mmakaay
* The query for discovering mutual buddies was incorrect (bug #230,
thanks regdos)
 
2006-01-21 18:20 ts77
* fixing default settings overwriting all forums (bug #233)
 
2006-01-21 17:49 ts77
* really showing newflags in both flat and threaded read (fixing
#235)
 
2006-01-20 11:22 mmakaay
* Fix for #231: Undefined constant used (credits to joys)
 
2006-01-20 00:32 mmakaay
* Fix: reply on read page + tighter security gave problems on
session timeout
 
2006-01-18 14:34 mmakaay
* Fixed failing combination of tighter security + URI authentication
(no cookies)
 
2006-01-17 23:01 mmakaay
* Fix for #229: The list of buddies is now sorted by username
(thanks regdos)
 
2006-01-16 23:31 mmakaay
* Bugfix: The administrator could not edit replies to announcements
 
2006-01-16 23:13 ts77
* "fixing index-links + #220"
 
2006-01-16 18:09 brian
* Profiles for users that are deactivated show an error message now.
 
2006-01-16 16:46 mmakaay
* Fix for #219: No charset sent using Content-Type header for admin
interface
 
2006-01-16 15:27 mmakaay
* Final fix for [216] and [217]
 
2006-01-15 18:59 ts77
* fix for not being able to empty the permissions
 
2006-01-15 16:49 ts77
* "focus to search-form only on first entry and no results (#218)"
 
2006-01-15 13:21 ts77
* another fix for reply on separate page, quotes and so on (#216)
 
2006-01-12 23:48 dvl
* Conversion of final MySQL elements. Search now works
 
2006-01-12 22:05 brian
* RSS feeds are now cached for better performance
 
2006-01-11 16:18 brian
* Added post count to user profiles
 
2006-01-10 21:33 ts77
* "fixed a couple of problems with install-settings, now really
fixing #210"
 
2006-01-10 21:18 ts77
* "revert previous change, my bad"
 
2006-01-10 21:08 ts77
* "adding default forum settings on install (fix for #210) "
 
2006-01-06 22:49 dvl
* Because PostgreSQL doesn't have the same limits as MySQL, just
return NULL from phorum_db_maxpacketsize()
 
2006-01-06 22:39 dvl
* Add a work-in-progress for the PostgreSQL port. Search does not
work.
 
2006-01-06 21:42 ts77
* "fixing another item of #203"
 
2006-01-06 10:29 ts77
* "fixed #203"
 
2006-01-04 20:49 mmakaay
* Extended search options for admin user control. Thanks spoier!
 
2005-12-18 20:45 brian
* checked that users are fully logged in if that option is selected
in the admin
 
2005-12-16 23:11 ts77
* added a switch for using RSS and a link to the header for it
 
2005-12-16 21:02 ts77
* streamlined index/messagelist/post-url creation should fix #199
 
2005-12-10 19:36 ts77
* made the target of the sql-error-messages configurable
 
2005-12-10 18:41 ts77
* some better formatting in banlist and badwords, marking duplicate
entries in banlists (patch from golem.de)
 
2005-12-10 18:13 ts77
* remove the unnecessary message-bodies in threaded-read-view for
performance increases in large threads (recommended by golem.de),
added an option to still load them if a template needs this
 
2005-12-10 17:40 brian
* changes to blog template for phorum 5.1
 
2005-12-05 19:40 ts77
* added banlist-checks for spam-words in subject and body (provided
by golem.de)
 
2005-12-04 14:05 ts77
* added options for moderators to avoid getting moderation-emails,
implementing #196
 
2005-12-04 13:14 ts77
* "adding checks for duplicate custom profile-fields and reserved
names, fixing #160 , list of reserved names might need some
extension"
 
2005-11-27 21:48 ts77
* added navigation and more visible message to report-form (fixing
#185)
 
2005-11-23 15:23 brian
* commiting module to allow for attachments to be stored on the
filesystem
 
2005-11-22 23:03 ts77
* setting up more data in list.php if the bodies are retrieved too,
like maurice suggested, fixing #169
 
2005-11-22 22:25 ts77
* moved default settings from dblayer to install-script calling the
db-dependant functions, should fix #172
 
2005-11-22 10:45 ts77
* "fixed #189"
 
2005-11-21 13:12 mmakaay
* Fix for bug #188: new flags not shown for sticky and announce in
threaded list
 
2005-11-20 23:42 ts77
* "added first experimental mysqli-layer"
 
2005-11-08 21:47 ts77
* "fixed removing newlines in table-definitions (kudos to brian)"
 
2005-11-03 20:53 mmakaay
* Added upgrade notification iframe banner to the admin interface
header
 
2005-11-02 21:40 ts77
* fixed bug #175
 
2005-10-29 01:08 mmakaay
* Added 'Check for new version' to the admin interface
 
2005-10-25 13:51 mmakaay
* Lots of improvements for the bundled smiley mod. # * Often the
hard-coded smiley path "./smileys" was used instead # of the
configurable prefix. # * Fixed showing a smiley preview image. # *
Preview image is now also shown directly when starting to edit a
smiley. # * Implemented a separate mods/smileys/defaults.php file,
for easy # default config value maintenance and initial
configuration setup. # * In the $PHORUM["mod_smileys"] array,
smileys are not stored at the same # level as the other settings
anymore. # * The smiley prefix path is better checked for
problems. # * The smiley prefix path is forced to always have an
ending "/" character. # * Only files with a real image extension
are used in the smiley drop down. # * If configured smileys have
an unavailable image, the "Smiley image" # column in the overview
will say "UNAVAILABLE" and a clear warning message # is shown to
the administrator, telling him to fix the problem(s). # * The
smiley body & subject replacement arrays are cached in the
database. # * The message "no smileys configured" was never shown.
# * Inputs for smiley and alt tag are made smaller (50 was too
much IMO). # * Smiley images are put in the CSS class
"phorum-smiley", so users can # style the image if they want to. #
* Installation of a default list of smileys is taken out of #
include/db/mysql.php. This is now fully handled by the module
itself. # * Description for "thumbs up smiley" changed to "the
finger smiley". # * Smileys are now stored inside the module
directory itself. # * The configuration for the old smileys mod is
automatically converted.
 
2005-10-17 16:35 ts77
* fixing #164, removed debug-output and check for forum inheriting
default settings
 
2005-10-17 16:12 ts77
* "fixed [156], table structure needed to be changed"
 
2005-10-15 02:19 mmakaay
* Added phorum_check_bans() for easy checking and fixed
phorum_check_ban_lists().
 
2005-10-11 06:23 mmakaay
* Only show (Buddy) after username in profile in case PM is enabled
 
2005-10-10 13:59 mmakaay
* New template feature: {HOOK hook_name arg1 arg2 .. argn} # Hooks
can now also be called in templates. This is solely for # being
able to let modules writers extend the forms that Phorum uses. #
If one hook argument is used, the hook code will translate to: #
phorum_hook(hook_name, arg1) # If multiple hook arguments are
used, it will translate to: # phorum_hook(hook_name, array(arg1,
arg2, .., argn)) # The hook may also be called without using
arguments.
 
2005-10-08 05:01 brian
* Added new hooks to make alternate attachment storage possible
 
2005-10-06 23:21 mmakaay
* Activated the new editor code in the Phorum core. # This revision
does not contain cleanup of the old code. # That will be done in a
separate revision.
 
2005-10-06 15:52 ts77
* "fixed ticket #138 , typo in database-create-scripts."
 
2005-10-06 14:11 mmakaay
* New feature for the PM interface: multiple recipients in one
message
 
2005-10-06 13:54 mmakaay
* Added feature to header.tpl, which can be used to set the focus to
a page element. The element's id can be specified using
{FOCUS_TO_ID}.
 
2005-10-06 05:00 brian
* simplified the help pop up by ridding us of the iframe and the
extra js code in include.
 
2005-10-05 15:20 brian
* added user's status to the user admin.
 
2005-10-04 06:28 brian
* New security feature! Users must confirm their login before
posting or making changes to their account if they have been away
from the site.
 
2005-10-04 05:02 brian
* Added default forum settings. A forum can now inherit its settings
from another forum, or the defaults.
 
2005-10-04 02:21 brian
* Private Messages are now separate from the Control Center.
 
2005-10-04 01:49 brian
* ASSIGN now supports ints
 
2005-10-03 01:31 mmakaay
* Implemented a buddy system for private messaging.
 
2005-10-01 22:24 mmakaay
* Added a new option "System Sanity Checks" to the admin panel. This
can be used to run a number of checks on the system to see if it
is configured correctly for using Phorum. # Implementation: # #
All checks are stored as single PHP files in the directory #
include/admin/sanity_checks/ # Each file you create there must at
least have the following: # # * A variable $check_description
which is set to the description # string that is showed in the
sanity checks result screen. # * A function named
phorum_check_<file basename> which does the # actual checking.
This function has to return two parameters. # The first one is one
of the constants PHORUM_SANITY_OK, # PHORUM_SANITY_WARN or
PHORUM_SANITY_CRIT. The second one # is a description of a problem
that was found or NULL in # case no problem was found. # # The
sanity checking frontend will then take care of the rest. # #
Already implemented checks are checks for: # - database connection
(Config available and can we connect?) # - cache directory (Can we
find and write there? And does caching work?) # - file uploading
(Checking PHP/MySQL max upload size against settings)
 
2005-09-28 10:51 mmakaay
* Fixed #123: when deleting a thread, also delete move notification
 
2005-09-28 09:32 mmakaay
* Fixed #115
 
2005-09-28 00:40 mmakaay
* Rewrote the module creation documentation and updated the list of
hooks
 
2005-09-24 11:43 mmakaay
* Cleaned up and updated the Phorum5 docs directory.
 
2005-09-22 14:15 mmakaay
* Added e-mail notifications for new private messages. The user can
turn these notification on or off in the control panel (forum
settings). # The users table now has a field "pm_email_notify" to
store the setting in.
 
2005-09-22 00:11 mmakaay
* Implemented folder support for private messaging.
 
2005-09-20 23:30 brian
* Made fonts look better on Linux
 
2005-09-20 23:30 brian
* Changed to use new template abilities
 
2005-09-20 23:29 brian
* Added Mark Read and RSS links to index page.
 
2005-09-20 23:00 brian
* Stickies and announcements not longer mess up threaded view.
 
2005-09-20 22:59 brian
* Stickies and announcements not longer mess up threaded view.
 
2005-09-17 17:26 ts77
* added maurice's new method of including/inlining templates so that
just one large template is processed on output (see #90 for
details)
 
2005-09-16 13:39 mmakaay
* Implemented a whole new backend for the PM system. This backend is
a preparation for a more sophisticated PM system which supports
things like user folders, buddy lists, multiple recipients and a
trash bin. # # Notes: # # Because the way messages are stored has
changed, the old PM calls # from mysql.php have been deprecated.
When calling these functions, # an error message will be shown.
This will only be done in case # non-Phorum scripts call the old
functions. Phorum uses the new API. # # In the database migration
script, dropping the old private messages # table is not yet
included, so in case of problems a rollback is # possible without
loosing the old private messages. This will be # incorporated as
soon as the new code has proven to be stable. # # New database
structure: # # {prefix}_pm_messages: holds the message data for a
PM # {prefix}_pm_folders: holds the custom folders for the users #
{prefix}_pm_xref: links users, messages and folders together # #
The inbox and outbox for the users are built-in special folders, #
so there will not be in {prefix}_pm_folders.
 
2005-09-13 11:15 mmakaay
* Added configuration option for setting max nr. of messages in the
PM storage of a user
 
2005-09-12 23:01 mmakaay
* Fix for #111 Added checks for banned users to PM posting
 
2005-09-12 21:37 mmakaay
* Added an experimental tool for helping language maintainers
 
2005-09-08 14:53 mmakaay
* Fixed "Only variables can be passed by reference" error caused by
PHP 5.0.5 In PHP 5.0.5 constructions like
array_shift(some_function()) are no longer accepted.
 
2005-09-06 19:32 mmakaay
* Use phorum_filesize() for formatting filesizes
 
2005-09-06 18:50 mmakaay
* Subject needed to be formatted before it was displayed.
 
2005-09-06 14:47 mmakaay
* Fixed copyright notice formatting.
 
2005-08-31 21:38 mmakaay
* Database upgrade script for [209]
 
2005-08-31 11:17 mmakaay
* Fixed some more line-ending properties
 
2005-08-29 00:17 mmakaay
* Disabled cumulative attachment size check in case no config value
is set
 
2005-08-28 23:52 mmakaay
* Added max cumulative size to attachment settings and some fixes: *
max cumulative size is used to be able to set a maximum total size
for all attachments together. So now you can allow for example 10
attachments of each 1 Mb max, but limit the total attachment size
to 2 Mb. So the user can upload for example either 10 photo's or 1
MP3 file, but not 10 MP3 files. * uploading one or more
attachments always replaced the complete list of attachments,
instead of adding attachments to it; * Added some more explanation
for the attachment admin parameters, to make clear what an empty
or zero value means to Phorum; * The list of allowed file types is
not shown anymore in the template case no list is set in the admin
interface (so you won't get "You are allowed to attach files of
the following type:" without any options behind it on screen);
 
2005-08-28 18:49 mmakaay
* Updates from #106
 
2005-08-28 14:52 mmakaay
* Implemented formatting of filesizes.
 
2005-08-28 14:45 mmakaay
* Added phorum_filesize() for formatting bytes to better readable
file sizes.
 
2005-08-26 22:19 mmakaay
* Mysql upgrade script for #97
 
2005-08-26 22:00 ts77
* fixes for #97
 
2005-08-26 21:48 mmakaay
* Fixed $thread_is_announcement assignment to make
ThreadAnnouncement work
 
2005-08-26 19:29 ts77
* "fix for bug #103"
 
2005-08-26 19:27 ts77
* "fix for bug #102"
 
2005-08-26 19:24 ts77
* "fix for bug #105"
 
2005-08-26 19:22 ts77
* fixes bug #101
 
2005-08-23 18:21 ts77
* fixing ticket #100, thx to maurice
 
2005-08-22 20:11 ts77
* "fixed problem in newflags with vroots"
 
2005-08-21 18:57 ts77
* included patch for #89
 
2005-08-18 17:23 brian
* Fixed issues with upgrading and made sure no on could run the
install or upgrade on a running Phorum.
 
2005-08-12 21:08 ts77
* "changed merge thread to reinsert messages (#60)"
 
2005-08-11 16:38 ts77
* added option to generate your own custom urls with phorum_get_url
 
2005-08-11 16:10 ts77
* "fixed #86"
 
2005-08-11 16:07 ts77
* "fixed #85"
 
2005-08-11 16:03 ts77
* "fixed #87"
 
2005-08-11 03:04 brian
* Added a new module called markdown that uses the new simple,
single file module method. Markdown is a text decoration syntax
used in several open source blogging applications.
 
2005-08-11 02:59 brian
* Added support for new template options. These include adding NOT
to an if and comparing two template vars with an if. Plus some bug
fixes.
 
2005-08-10 20:53 ts77
* fixed #79
 
2005-08-10 20:34 ts77
* "fixing #72"
 
2005-08-10 20:24 ts77
* "fixing #68 and #80"
 
2005-08-10 10:43 ts77
* "fixed ticket #81 ... thx"
 
2005-08-09 18:28 ts77
* changed post_form-hook to be without arguments
 
2005-08-09 16:02 ts77
* "fixed #76"
 
2005-08-08 18:25 ts77
* made move-thread much more robust, also less permissions needed to
move a thread *to* a forum
 
2005-08-07 15:40 ts77
* "fixed enhancement-request #67"
 
2005-08-07 15:30 ts77
* "fixed bug #64"
 
2005-08-05 18:54 ts77
* "added strike-through to bbcode"
 
2005-08-05 10:50 ts77
* fixed replyable attachments in non-threaded list
 
2005-08-05 01:04 brian
* Adding rss.php to the distro officially
 
2005-08-05 01:02 brian
* Added blog template to distro
 
2005-08-01 19:52 ts77
* formatting the signature on the controlcenter-startpage too
 
2005-07-27 18:36 brian
* we need to htmlspecialchars the body previews.
 
2005-07-26 16:14 ts77
* "changed meta-field in messages-table mediumtext, there were
problems with long threads before"
 
2005-07-24 21:42 ts77
* show index-url only if the forum is not hidden
 
2005-07-24 21:12 ts77
* fixed paging of read-pages for moderators if unapproved posts are
there
 
2005-07-19 17:28 ts77
* setting charset and encoding for outgoing mails (thx to Stephan
Schulz)
 
2005-07-19 17:20 ts77
* fixed tz_offset with default-setting going wrong
 
2005-07-19 10:51 ts77
* made bad-words check work on subject and author too
 
2005-07-18 17:21 ts77
* fixed setting-inheritance
 
2005-07-18 17:19 ts77
* fixed forum-index link in case of new folder view
 
2005-07-16 18:52 ts77
* fixed permissions not being saved in the admin
 
2005-07-12 08:00 ts77
* show "move thread" only if the moderator moderates more than one
forum
 
2005-07-11 21:48 ts77
* option for ignoring administrators in moderator-emails
 
2005-07-06 21:11 ts77
* added banlist by userid and blocked blocked users from editing
their posts
 
2005-07-06 16:27 brian
* Added a note to inform new admins that they will see the IP
address even when hidden from other users.
 
2005-07-05 21:34 ts77
* added merge/split thread feature
 
2005-06-27 17:14 ts77
* added link for going to the first new message in a thread (flat
view only)
 
2005-06-24 16:13 ts77
* added inherited forum-settings (done as paid work by sandersor.de)
 
2005-06-20 19:15 brian
* Rework of attachment workflow. Users can now edit and preview
posts before commiting them to the forum list.
 
2005-06-20 17:48 brian
* The admin now uses the charset from the default language file
 
2005-06-20 17:35 brian
* Reverse threading hack implemented as a feature
 
2005-06-20 17:35 brian
* Reverse threading hack implemented as a feature
 
2005-06-20 17:01 brian
* Using charset in htmlentities now ticket #25
 
2005-06-19 01:02 brian
* You can now choose between the classic forum/folder display and
the new flat forum display
 
2005-06-16 03:55 brian
* Added new ability to toggle the status of the forum. Normal, Read
Only, Admin Only and Disabled. Also, Phorum will display a message
when the database is down and optionally redirect to a URL you set
up in the DB config file.
 
2005-06-16 02:17 brian
* few rewrites for SVN and how the change log works now.
 
2005-06-16 02:09 brian
* doc update for quote hook and some fixes
 
2005-06-16 01:52 brian
* Reply form on a separate page and quote hook are now done.
 
2005-06-15 21:56 brian
* replies by moderators were being marked as closed. also, should
have been checking $parent status and not $parent closed.
 
2005-06-09 08:41 ts77
* sending user-localized mail-notifications (#42)
 
2005-06-08 19:17 ts77
* enhanced announcements with the option to allow replies
 
2005-05-25 21:55 ts77
* added another hook "check_post"
 
2005-05-18 20:48 ts77
* preview for message-edits by users
 
2005-03-28 23:15 ts77
* first implementation of message-caching for read-page
 
2005-03-19 13:53 ts77
* added session-id for uri-authentication to make it a bit safer
(i.e. if such a url is posted somewhere)
 
2005-03-17 23:26 ts77
* don't allow making a message to an announcement if it has replies
 
2005-03-17 22:48 ts77
* make announcements have a better reason that you can not reply to
them (fixes bug #4)
 
2005-03-17 17:41 ts77
* Initial Import of HEAD and 5.0.15
 
 
---------------------------------------------------------------------------------
attached is the previous Changelog up to March, 10th 2005
(before we were running subversion)
---------------------------------------------------------------------------------
Phorum 5 Changelog
---------------------------------------------------------------------------
 
Release: phorum.5.0.15
-----------------------
 
* Better handle invalid input for page value in url. - brian
(03/10/2005)
 
* Better handle invalid input for user_id in url. - brian
(03/10/2005)
 
* Redirect URL needs to encode the url parts - brian (03/10/2005)
 
* make checkdnsrr-calls only if function exists - ts77 (03/09/2005)
 
* fixed bug in email-panel of cc - ts77 (03/09/2005)
 
* added mark-thread-read (patch from Panu, thx!) - ts77 (03/05/2005)
 
* First commit of mysql full text search - brian (03/01/2005)
 
* You can reply via PM - brian (03/01/2005)
 
* Subscriptions now changed when threads are moved. - brian
(02/28/2005)
 
* Fixed a possible XSS issue - brian (02/22/2005)
 
* Forum id carried in group parts of CC now. - brian (02/22/2005)
 
Release: phorum.5.0.14a
------------------------
 
* clearing special-characters from attachment-name (thanks to Jon
Oberheide) - ts77 (02/21/2005)
 
* Removed Upload files permission option. Never used. - brian
(02/21/2005)
 
Release: phorum.5.0.14
-----------------------
 
* fixed wrong fallback to default-template if user-template is set as
empty - ts77 (02/16/2005)
 
* fixed problem if account is denied before the user has verified the
account by mail - ts77 (02/16/2005)
 
* checking new user-email also against existing emails - ts77
(02/16/2005)
 
* Renamed settings variables to comply with Phorum standards - sheik
(02/08/2005)
 
* disallowing time-zone-selection works now too if a user already
selected a timezone. - ts77 (02/05/2005)
 
* implemented user-caching with the new cache-layer - ts77
(02/05/2005)
 
* Removed call to timing functions - sheik (02/05/2005)
 
* Added code for "open links in new window" and "anti-spam tag on
links" - sheik (02/05/2005)
 
* Settings file created to make new "open links in new window" and
"anti-spam tag on links" options optional - sheik (02/05/2005)
 
* added simple file-caching api - ts77 (12/23/2004)
 
* fixed permission-display in admin - ts77 (12/14/2004)
 
* MFH: ip-masking in preview too - ts77 (11/28/2004)
 
* added stripped body and full body to email-variables, documented
email-variables - ts77 (11/28/2004)
 
* added closed-flag to list-page - ts77 (11/28/2004)
 
* moved custom profile-fields into their own table and made options
for limiting them in size and htmlencoding them - ts77 (11/26/2004)
 
* new upgrade-system: only one upgrade-file at a time, new numbering
- ts77 (11/25/2004)
 
* moved format_functions.php out of the condition - ts77
(11/23/2004)
 
* changed threaded-list/-read to use padding for indenting and
wrapping long subjects - ts77 (11/23/2004)
 
* fixed message after editing - ts77 (11/22/2004)
 
* Changed email regex to be more compatible with modern domain names.
- brian (11/22/2004)
 
* new hooks cc_user_save, before_register - changed hook
after_register - ts77 (11/16/2004)
 
* report a post split out from read.php, allows user to explain the
report - tridus (11/16/2004)
 
* added "search"-hook - ts77 (11/16/2004)
 
* fixed saving passwords (disallowed empty ones) - ts77 (11/16/2004)
 
* fixed converting pure email-addresses if no bbcode was found - ts77
(11/16/2004)
 
* showing forum-list-link only if needed - ts77 (11/15/2004)
 
* giving just a message if no forums are visible in a folder - ts77
(11/12/2004)
 
* changed default for new folders to be visible - ts77 (11/12/2004)
 
Release: phorum.5.0.13a
------------------------
 
* reverted more of the entity changes - ts77 (11/11/2004)
 
Release: phorum.5.0.13
-----------------------
 
* Added a lot of code to check for invalid input - brian
(11/10/2004)
 
* Requests for passwords for users that have not verified will not be
sent a new verification email - brian (11/09/2004)
 
* some more precautions for html-entities - ts77 (11/08/2004)
 
* logout works with empty REFERER now too - ts77 (11/08/2004)
 
* fixed wrong message counts in threaded list - ts77 (11/03/2004)
 
* fixed backurl in controlcenter while being in a forum-folder - ts77
(11/02/2004)
 
* removed requirement to specify a description for forum/folder in
the admin - ts77 (11/02/2004)
 
* fixed user_template and user_language to allow the "default"-value
- ts77 (11/01/2004)
 
* fixed bug #531, msgs with attachments didn't get the right status
in moderated forums - ts77 (10/29/2004)
 
* Escape the HTML in name and description when editing - brian
(10/28/2004)
 
Release: phorum.5.0.12
-----------------------
 
* XSS really gone now - ts77 (10/27/2004)
 
* added profile hook to controlcenter-summary too - ts77
(10/27/2004)
 
* better defaults for page if not set - ts77 (10/26/2004)
 
* fixed sql-injection issue - ts77 (10/25/2004)
 
* fixed sql-injection issue - ts77 (10/24/2004)
 
* fixed showing pm-inbox after deleting in the pm-sentbox - ts77
(10/24/2004)
 
* fixed wrong message-index if not logged in - ts77 (10/24/2004)
 
* posts in closed threads can't be edited - tridus (10/22/2004)
 
* Fixed session timeout to allow session cookies by using 0 days -
brian (10/22/2004)
 
* Updated bbcode module to have classes in some of the markup - brian
(10/22/2004)
 
* fixed bug #526/#528 - ts77 (10/21/2004)
 
* fixed move-notification in threaded view - ts77 (10/21/2004)
 
* fixed "message not found" for threaded-read - ts77 (10/21/2004)
 
* added (optional) move-notification - ts77 (10/19/2004)
 
Release: phorum.5.0.11
-----------------------
 
* bug fix release (10/15/2004)
 
* added attachment-conversion (thanks to Clemens Weiss), checking for
existing group and user tables now - ts77 (10/14/2004)
 
* added script for updating the post-counts of users after conversion
- ts77 (10/13/2004)
 
* file update_postcount.php was initially added on branch phorum_5_0.
- ts77 (10/13/2004)
 
* fixed hidden messages showing in threaded-list - ts77 (10/11/2004)
 
* censor-filter now works per-forum too - ts77 (10/09/2004)
 
* file creating_templates.txt was initially added on branch
phorum_5_0. - ts77 (10/09/2004)
 
* bodies only loaded on request now in the message-list - ts77
(10/09/2004)
 
* deleting subscriptions on deleting a message too - ts77
(10/09/2004)
 
* Better detection of js in HTML mod - brian (10/08/2004)
 
* Reworked key for getting post count for better performance - brian
(10/08/2004)
 
* Reworked key for getting post count for better performance - brian
(10/07/2004)
 
* Email validity check now allows for capital letters in the email's
domain - brian (10/04/2004)
 
* Both datestamp and last_post_time are now formatted in threaded and
non-threaded mode. - brian (09/30/2004)
 
* Improved performance of getting unapproved list for moderators -
brian (09/30/2004)
 
* Setting tz to default now works properly - brian (09/29/2004)
 
* Closed posts could be brute force replied to. - brian (09/28/2004)
 
* Fixed warning when adding/editing forums. - brian (09/27/2004)
 
* The HTML_TITLE is not set correctly on pages of a read page. -
brian (09/25/2004)
 
* fixed newflags for moved threads - ts77 (09/22/2004)
 
* fixed ip-display in preview - ts77 (09/20/2004)
 
* Registration emails will now work better for AOL users - brian
(09/15/2004)
 
* Fixed possible XSS issue with the linked author - brian
(09/15/2004)
 
* fixed url in redirect after adding/editing a forum - ts77
(09/14/2004)
 
* Bare urls with capital letters in them were not getting converted
properly. - brian (09/14/2004)
 
* Fixed the email and url tags in BBCode - brian (09/14/2004)
 
Release: phorum.5.0.10
-----------------------
 
* BBCode module only works for properly formatted codes now. Urls are
shortened for better display. - brian (09/13/2004)
 
* Fixed potential XSS in last post author name - brian (09/10/2004)
 
* correctly removing session-info from all notification-urls - ts77
(09/10/2004)
 
* Session timeout can be 0 now. - brian (09/10/2004)
 
* Added module localization support - tridus (09/09/2004)
 
* added forum_last_active column for forum where the user was last
active. - ts77 (09/07/2004)
 
* Email verification is no more inline with RFC 2822 - brian
(09/07/2004)
 
* We now give better messages upon new installations. - brian
(09/06/2004)
 
* new message-notifications for moderators work correctly now - ts77
(09/06/2004)
 
* Fixed bug where sticky posts edited by non-moderators stay sticky -
brian (09/06/2004)
 
* Changes in admin to forums send you back to that forums parent
instead of the top. - brian (09/06/2004)
 
* anchors for read-links now have a msg-<number> name - ts77
(09/05/2004)
 
* fixed that user-timezone set to default is really ignored for
tz-conversion then - ts77 (09/05/2004)
 
* conversion-script now handles permissions and groups /
group-members too - ts77 (09/03/2004)
 
* fixed threaded-view paging. threads could be hidden between page 1
and 2. - ts77 (09/02/2004)
 
Release: phorum.5.0.9
----------------------
 
* bug fix release (09/01/2004)
 
* new hook \"moderation\" i.e. for logging moderator actions - ts77
(08/31/2004)
 
* fixed missing links and vars for mails about attachments - ts77
(08/31/2004)
 
* storing forum-offsets in the settings now on conversion - ts77
(08/31/2004)
 
* installer now checks if cache is writable on a new install - tridus
(08/31/2004)
 
* fixed \"mark all messages read\" in empty forums - ts77
(08/28/2004)
 
Release: phorum.5.0.8.RC
-------------------------
 
* bumped release version - brian (08/20/2004)
 
* newflags are now moved while moving a message - ts77 (08/20/2004)
 
* Added a hook to the index.php page - brian (08/19/2004)
 
* Added new message count to forum index - brian (08/19/2004)
 
* pm-preview now formatted too - ts77 (08/19/2004)
 
* Created a function for module writers that will fetch the last x
messages with several options - brian (08/19/2004)
 
* Attachments can now be deleted by users and moderators - brian
(08/18/2004)
 
* New Smilies - brian (08/17/2004)
 
* added script.php, external and scheduled hooks to run things from
command line - tridus (08/12/2004)
 
* moderator notifications are now different for messages needing
approval and not needing approval - ts77 (08/11/2004)
 
* Moved closed status to its own field for better logic and
performance - brian (08/09/2004)
 
* enhancements for smiley-module (thanks to Cameron Brunner) - ts77
(08/08/2004)
 
* *** empty log message *** - ts77 (08/07/2004)
 
* Improved memory usage of the 3to5 upgrade script. - brian
(08/04/2004)
 
* rewrote newflag/readflag storage to be more flexible - ts77
(08/03/2004)
 
* added email-verification on email-change - ts77 (08/03/2004)
 
* fixed saving permissions, missing break in display_fixed - ts77
(07/29/2004)
 
Release: phorum.5.0.7a.beta
----------------------------
 
* removed debugging output - security issue - ts77 (07/28/2004)
 
* fixed broken p3-to-p5-conv - ts77 (07/28/2004)
 
Release: phorum.5.0.7.beta
---------------------------
 
* bug fix release (07/26/2004)
 
* Improved private messaging. Added formatting, security - brian
(07/23/2004)
 
* fix table name typo - brian (07/23/2004)
 
* Added support to look at banned names and emails to the register
page - brian (07/22/2004)
 
* tweaked new installation settings, added smiley defaults - tridus
(07/22/2004)
 
* changed config.php to config.php.sample - tridus (07/22/2004)
 
* Improved followed (bookmarks/subscriptions) threads - brian
(07/19/2004)
 
* allowed for hidden languages/templates - ts77 (07/19/2004)
 
* added fixed display-settings - ts77 (07/19/2004)
 
* Added hooks to all moderation functions - brian (07/18/2004)
 
* Improved followed (bookmarks/subscriptions) threads - brian
(07/18/2004)
 
* Improved the email sent when a post is reported. - brian
(07/17/2004)
 
* added thread-bookmarking (thanks to Arthur Louie) - ts77
(07/17/2004)
 
* added convertViewCount.php to scripts directory - converts
viewcounts to new format - tridus (07/17/2004)
 
* Improved help text with regards to permissions - brian
(07/17/2004)
 
* Added check of read permissions to attachments. - brian
(07/16/2004)
 
* Added tighter security to seaches - brian (07/16/2004)
 
* added float-to-top for threaded mode AND an additional setting for
number of threads on the list-page on threaded-mode, paged list for
threaded - ts77 (07/15/2004)
 
* added user_list hook - tridus (07/15/2004)
 
* added ability for users to join groups in CC, admin can disallow on
a per-group basis - tridus (07/11/2004)
 
* groupmod improvements - can filter the list of users, group list
shows how many unapproved - tridus (07/11/2004)
 
* added index for unapproved messages-queries - ts77 (07/10/2004)
 
* *** empty log message *** - ts77 (07/10/2004)
 
* added read-url to subscriptions-page - ts77 (07/10/2004)
 
* added option to show smileys in subject too - ts77 (07/10/2004)
 
* added users data as USERINFO to the template-vars - ts77
(07/09/2004)
 
* fixed checking for correct user if reading a PM - ts77
(07/08/2004)
 
* Optimized queries for flat list view. Should help with speed issues
some have seen. - brian (07/07/2004)
 
* added fallback to default-language if nonexistent language selected
- ts77 (07/04/2004)
 
* allowed macro-expansion in mail-subject too - ts77 (07/03/2004)
 
* added SearchTips to the search-page - ts77 (07/03/2004)
 
* added missing signature to post-preview - ts77 (07/01/2004)
 
* added a notification box to alert users of things that need their
attention - tridus (06/21/2004)
 
* initial group moderation interface, can list group members in cc
(assign mods in admin) - tridus (06/19/2004)
 
* group moderation is fully functional - tridus (06/19/2004)
 
* added optional dropdown list of users when sending a new private
message - tridus (06/19/2004)
 
* added error-checking for too large message-bodies - ts77
(06/18/2004)
 
* added DST-setting, started email-change verification (not finished
yet) - ts77 (06/14/2004)
 
* added confirmation before a post is reported - tridus (06/10/2004)
 
* fixed banlist-checking (was wrong order of arguments) - ts77
(06/01/2004)
 
* fixed setting a wrong password in the user-admin if no password is
set. - ts77 (05/30/2004)
 
* merged viewcount-mod into the main-code, allows per-forum setting
now - ts77 (05/29/2004)
 
Release: phorum.5.0.6.beta
---------------------------
 
* File Uploads in CC now global option. Fixes bugs with this system -
brian (05/25/2004)
 
* report a post now works - tridus (05/24/2004)
 
* approving a whole thread is now implemented - ts77 (05/22/2004)
 
* removed page-links from list if the read-view is set to threaded -
ts77 (05/20/2004)
 
* fixed missing sticky/announcement in preview - ts77 (05/20/2004)
 
* tightened checks for valid values in search-links - ts77
(05/20/2004)
 
* fixed missing message-id and -thread in notification messages for
attachments - ts77 (05/20/2004)
 
* really abort an message-edit if an error occured - ts77
(05/20/2004)
 
* *** empty log message *** - ts77 (05/18/2004)
 
* Added an after_register hook - brian (05/15/2004)
 
* User searches in admin now list all users when page first accessed
- brian (05/15/2004)
 
* improved ban-list checking (does user/email check for registered
now too) - ts77 (05/14/2004)
 
* overwriting temporary password too on password-change - ts77
(05/08/2004)
 
* unapproved messages are now marked while reading them - ts77
(05/07/2004)
 
* author-name is changed now on deleting a user (can be disabled with
a constant in include/constants.php) - ts77 (05/07/2004)
 
* hidden/unapproved messages are now ignored in thread-info like
count and new - ts77 (05/07/2004)
 
* Title tag now contains some dyanmic information - brian
(05/02/2004)
 
* Adding a global HTML title and support for additional tags in the
head of the page. - brian (05/02/2004)
 
* Added new constant for string separator for things like the title
tag - brian (05/02/2004)
 
* added user-delete to the admin - ts77 (05/02/2004)
 
* added an admin option for deleting old messages/threads - ts77
(05/01/2004)
 
* Portable code should work now - brian (04/30/2004)
 
* enabled IIS-hack - checking for SERVER_SOFTWARE-string - ts77
(04/30/2004)
 
* many improvements to the templates, better configurability,
alternating colors and stuff - ts77 (04/30/2004)
 
* Added support for meta tags in language files - brian (04/23/2004)
 
* Added a link to phorum.org in the template footer - brian
(04/20/2004)
 
* fixed signature-flag in user-edit of messages - ts77 (04/18/2004)
 
* fixed view of usernames with html-characters, html-encoded now -
ts77 (04/18/2004)
 
* *** empty log message *** - ts77 (04/18/2004)
 
* forum-list link goes now back to the parent-folder, not the
root-folder - ts77 (04/10/2004)
 
* email-addresses of anonymous users are now shown in the list too -
ts77 (04/10/2004)
 
* fixed hide_email not saved - ts77 (04/08/2004)
 
* fixed hidden messages shown in list - ts77 (04/07/2004)
 
* Fixed portable code. - brian (04/02/2004)
 
* You can no longer edit settings for a module that is turned off. -
brian (04/02/2004)
 
* Searches are now url encoded so that url characters do not break
searching. - brian (04/01/2004)
 
* User registering from a forum are now treated properly. - brian
(03/29/2004)
 
Release: phorum.5.0.5.beta
---------------------------
 
* bug fix release (03/23/2004)
 
Release: phorum.5.0.4a.beta
----------------------------
 
* bug fix release (03/22/2004)
 
Release: phorum.5.0.4.beta
---------------------------
 
* implemented dates formatted by locale - ts77 (03/21/2004)
 
* Added the date a user is registered and the ability to track when a
user last used Phorum. - brian (03/17/2004)
 
* Added ability to detect if cookies are off on the browser. - brian
(03/17/2004)
 
* Users can only search forums they are allowed to read now. - brian
(03/17/2004)
 
* added link to private messages to the default template, with number
of new messages - tridus (03/12/2004)
 
* Added user_info hook so module writers could alter user sigs in
read.php - brian (03/05/2004)
 
* fixed bug #489, selecting the max-id from wrong database - ts77
(03/05/2004)
 
* added send_mail-hook for plugging into the sending of messages -
ts77 (03/04/2004)
 
* fixed saving user-data in the cc - ts77 (03/04/2004)
 
Release: phorum.5.0.3.beta
---------------------------
 
* fixed bug #478 - ts77 (03/03/2004)
 
* added an idea, group moderators - ts77 (03/03/2004)
 
* added user-selectable template - ts77 (03/02/2004)
 
* Registration Moderation Added - brian (03/01/2004)
 
* added user-selectable language - ts77 (02/25/2004)
 
* First commit of attachments. - brian (02/13/2004)
 
* added mixed view by checking threaded/non-threaded separately in
list and read - ts77 (01/24/2004)
 
* If there is only one forum, index.php now redirects to it. - brian
(12/09/2003)
 
* honor admin-setting of allowed tz-selection or not - ts77
(12/09/2003)
 
* This is a test of the new cvs update log script. - brian
(11/26/2003)
 
* fixed replies to sticky posts - brian (11/02/2003)
 
Release: phorum.5.0.2.alpha
----------------------------
 
* bug fix release (10/30/2003)
 
* stickies did not show up if there were no other messages. - brian
(10/29/2003)
 
* added user-selectable timezone - ts77 (10/04/2003)
 
* implemented banlists per forum and put banlists in a table - ts77
(09/27/2003)
 
* Moderators can now view all users emails. - brian (09/19/2003)
 
* Added a user file storage area to CC - brian (09/18/2003)
 
* Added a user file storage area to CC - brian (09/17/2003)
 
* Add email confirmation of new registrations. - brian (08/01/2003)
 
* added option to show signature in a post or not added default
settings for email-notify and add-signature to controlcenter ->
boardsettings - ts77 (07/25/2003)
 
* Added bad word filter. - brian (07/24/2003)
 
* added duplicate-post check - ts77 (07/19/2003)
 
* ControlCenter (mostly) finished - ts77 (07/12/2003)
 
* moved prepost-moderation from its own page to the control-center -
ts77 (06/15/2003)
 
* Added list of message-subscriptions to the control-center - ts77
(06/15/2003)
 
* activated display-order in the admin - ts77 (06/15/2003)
 
* added control-center - ts77 (06/10/2003)
 
* Moderator's ips are no longer shown. - brian (06/10/2003)
 
Release: phorum.5.0.1.alpha
----------------------------
 
* bug fix release (06/08/2003)
 
* $PHORUM['DATA']-array and this entry is used as template-name then.
- ts77 (05/31/2003)
 
* Added preview - brian (05/30/2003)
 
* Added "last post" feature in list.php to jump to last post in
thread - brian (05/25/2003)
 
* Fixed lost password so that it now sends a temp password like
Phorum 3 does. - brian (05/25/2003)
 
* Public users can no longer post using registered names. - brian
(05/25/2003)
 
* Added showing of IP to read page. - brian (05/23/2003)
 
* Added quoting on reply. Does not use javascript. - brian
(05/23/2003)
 
Release: phorum.5.0.0.alpha
----------------------------
 
* fixed missing localizations of GoTo - ts77 (04/22/2003)
 
* Changed language file. All keys to array have no spaces now. -
brian (04/09/2003)
 
* Rewrote large portions of the template engine. - brian
(04/09/2003)
 
* added .htaccess-files in important directories to increase security
- ts77 (04/05/2003)
 
* added a first version of a conversion script from phorum3.4 to
phorum5 - ts77 (04/04/2003)
 
* Added HTML module to allow safe HTML in messages. - brian
(04/04/2003)
 
* Added/fixed paging on the list page. - brian (04/03/2003)
 
* fix for update_forum_stats if no posts in forum. - ts77
(03/09/2003)
 
* added display of number of edits and last edit to read-view added
switch for allowing edit of posts to the admin - ts77 (02/24/2003)
 
* added pre-post moderation - ts77 (02/23/2003)
 
* added viewcount-mod, new hook "readthreads" - ts77 (02/21/2003)
 
* Added a post hook. - brian (02/13/2003)
 
* Added a meta field to the message table to store extra info. Useful
for mods to use. - brian (02/13/2003)
 
* fixed new-flags while using paging - ts77 (02/12/2003)
 
* Added paging to the read page including page links on list.php -
brian (02/04/2003)
 
* Fixed more potential cross sight scripting issues with form input.
- brian (01/30/2003)
 
* Fixed a cross sight scripting issue when echoing sql errors. -
brian (01/30/2003)
 
* User/Group permissions fully done. - brian (01/23/2003)
 
* Added Time Zone offset. - brian (01/23/2003)
 
* Added group admin - brian (01/23/2003)
 
* Added sigs to the read page - brian (01/20/2003)
 
* implemented user-edits of posts. - ts77 (01/19/2003)
 
* implemented first try of a new upgrade-system - ts77 (01/18/2003)
 
* added edit-post parts - ts77 (01/18/2003)
 
* Added new item about our CSS/XHTML stance. - brian (01/16/2003)
 
* added option to add moderated forums to a user through the
user-admin. - ts77 (01/13/2003)
 
* threaded or flat is now a user option. - brian (01/12/2003)
 
* added close/reopen thread - ts77 (01/12/2003)
 
* fixed sticky and announcement posting - brian (01/12/2003)
 
* Added announcement support - brian (01/12/2003)
 
* Added color and size tags to bbcode. - brian (01/12/2003)
 
* fixed sticky and announcement posting / added nav to post form -
brian (01/12/2003)
 
* laid groundwork for popup help in admin - brian (01/11/2003)
 
* some more template-code, "if" allows now loopvars and array-vars
too - ts77 (01/11/2003)
 
* added move-thread functionality - ts77 (01/11/2003)
 
* enabled list-moderation - ts77 (01/11/2003)
 
* added code to show menu descriptions in status bar - brian
(01/11/2003)
 
* changed user functions to all be named phorum_user_* - brian
(01/10/2003)
 
* added a wrapper to allow multiple Phorum's from one source base -
brian (01/10/2003)
 
* added first moderation-parts (delete message and delete message
with answers) - ts77 (01/10/2003)
 
* fixed lost password error. - brian (01/10/2003)
 
* improved installer - brian (01/10/2003)
 
* fixed link after register - brian (01/08/2003)
 
* Added user admin module. - brian (01/07/2003)
 
* email banning was not working - brian (01/06/2003)
 
* Modified code to include header and footer templates instead of the
templates having to do it. - brian (12/19/2002)
 
* added mark-all-read-functionality - ts77 (11/23/2002)
 
* Improved error handling of table creation - brian (11/19/2002)
 
* added newflag-support, uses a new table and only works if a user is
logged in - ts77 (11/09/2002)
 
* bbcode handles the url translation of all kinds. - brian
(11/06/2002)
 
* Changed the read hook to run before the body is formatted. mods
must use special methods to insert tags. - brian (10/30/2002)
 
* heh, allow_html was reversed. - brian (10/25/2002)
 
* fixed lack of ] - brian (10/21/2002)
 
* search was skipping the first result. - brian (10/16/2002)
 
* search template - brian (10/16/2002)
 
* fixing modifystamp and thread_count. - brian (10/12/2002)
 
* made index.php get actual data for posts and last post. - brian
(10/11/2002)
 
* removed finish template. - brian (10/07/2002)
 
* $extra not implemented in all places. - brian (10/07/2002)
 
* check for smiley dir before trying to read from it. - brian
(10/07/2002)
 
* adding mod settings admin. - brian (10/06/2002)
 
* some smiley-examples - ts77 (10/06/2002)
 
* updating error codes, got modules working, added bb code mod, added
dns lookup option and email validation. - brian (10/06/2002)
 
* add replace mod and mod creation doc. - brian (10/06/2002)
 
* added function for admin-form, corrected hooks-code, added
smiley-plugin - ts77 (10/06/2002)
 
* adding mod admin code and email validation code. - brian
(10/06/2002)
 
* fixed some install errors. - brian (10/06/2002)
 
* actually adding bbcode module now. - brian (10/06/2002)
 
* fixes for "headers sent" ... just some newlines removed - ts77
(10/06/2002)
 
* more template stuff. more admin stuff. folders working. - brian
(08/29/2002)
 
* updated more of the template. - brian (08/28/2002)
 
* tweaking install process. - brian (08/28/2002)
 
* got search working. - brian (08/27/2002)
 
* added ban list to admin. More work on default template. Started
phorum.php wrapper script. - brian (08/24/2002)
 
* first shot at a template. added some stubs for needed features. -
brian (08/23/2002)
 
* got the install wizard working. started on search - brian
(08/21/2002)
 
* small fix to the caching. - ts77 (08/21/2002)
 
* convert message tables into one table. rename all database
functions to phorum_db_?? - brian (08/18/2002)
 
* admin login was not working. - brian (08/10/2002)
 
* got the admin working, got the index.php working. redesigned the
tables, added and install.txt - brian (08/09/2002)
 
* lots of changes. Remember this is still pre alpha. - brian
(08/08/2002)
 
* fixed read url in flat mode. - brian (07/25/2002)
 
* no longer passing refs from the db functions, just arrays. - brian
(07/12/2002)
 
* lots of fixes. - brian (06/13/2002)
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/docs/creating_mods.txt
New file
0,0 → 1,1869
Creating Modules for Phorum5
============================
 
This document describes the Phorum5 module system. It is targeted at
developers who want to do customization and extend the functionality
of Phorum5. Modules are the preferred way to archieve this in
Phorum5.
 
For much of this document, we will be talking about an example module
"foo". Of course you will not name your module "foo", but something much
more appropriate. If you're not familiar with the terms "foo" and "bar",
you can visit http://en.wikipedia.org/wiki/Metasyntactic_variable
 
Be sure to read at least the **CAUTIONS AND SECURITY ISSUES** section,
before making your own modules.
 
 
Table of contents:
 
1. Introduction
1.1 Modules
1.2 Hacks
1.3 Hooks
2. Creating your own modules
2.1 What modules are built of
2.1.1 Hook functions
2.1.2 Module information
2.1.3 Other "stuff"
2.2 Module structure
2.2.1 Single file modules
2.2.2 Multiple file modules
2.3 Supporting multiple languages
2.4 Storing message data
2.4.1 From hooks that are run before saving a message to the database
2.4.2 From other hooks
2.5 Storing user data
2.6 Creating custom URLs
2.7 Implementing settings for your module
2.8 Changing the template
2.9 Example modules
3. **CAUTIONS AND SECURITY ISSUES**
3.1 Make modules, not hacks
3.2 Reload your module if you change the module information
3.3 How to access the $PHORUM array from your hook functions
3.4 How to access additional files in your multi file module
3.5 Secure your PHP files agains hackers
3.6 Secure your pages from XSS
3.7 Prevent namespace collisions
3.7.1 (Hook) functions
3.7.2 Data stored in $PHORUM
3.7.3 Language strings stored in $PHORUM
3.7.4 Data stored in messages, users and settings
4. Overview of available Phorum hooks
4.1 Code hooks
4.2 Template hooks
5. Support
 
 
1. Introduction
-------------------------------------------------------------------------------
 
 
1.1 Modules
-----------
 
Modules are self contained pieces of software, that can be added to
Phorum to change or extend its functionality. Modules can do this
without having to change anything in the standard Phorum distribution
files or database structure. So installing a module means: drop in
the code, go to the admin "Modules" page, enable the module and it
works.
 
 
1.2 Hacks
---------
 
The moment it is neccessary to make changes to the standard Phorum
distribution files or database structure to implement some kind of
functionality, we're talking about a hack (even if the changes
that have to be made are accompanied by a drop in module).
 
Although there is nothing wrong with writing hacks, the Phorum team
wants to urge you to try if you can write a module before resorting
to a hack. Modules are the preferred way of modifying Phorum
functionality, because that will make both upgrading your distribution
and having your modification adopted by others easier.
 
 
1.3 Hooks
---------
 
Phorum uses hooks to run its modules. Hooks are points in the
application where Phorum stops and runs its data through the modules
that are configured to handle the hook. The modules can act upon and
change this data.
 
The following image visualizes what happens when Phorum reaches
a hook point in the application, for which two modules ("foo" and
"bar") have been configured.
 
 
Phorum
Application
(1) (1) Phorum is running.
| (2) Phorum reaches the
| hook named "some_hook".
v Phorum (3) Phorum sends data to
some_hook >----- data ------+ the module system.
(2) (3) | (4) The module "foo" is run.
v (5) The module "bar" is run.
(4) module "foo" (6) The Phorum data (which
| might be modified by the
v modules) is sent back
(5) module "bar" to Phorum.
| (7) Phorum continues running
Phorum Modified | with the modified data.
Application <---- data ------+
(7) (6)
|
|
v
 
 
2. Creating your own modules
-------------------------------------------------------------------------------
 
 
2.1 What modules are built of
-----------------------------
 
 
2.1.1 Hook functions
--------------------
 
A module contains one or more PHP functions that act as hook
functions. Hook functions will receive some data in a variable
from Phorum and have to return the (possibly modified) data, which
will then go either back to Phorum or to the input of another module
which also handles the same hook (see 1.3). So the most basic (and
useless :-) hook function you could write would look somewhat like this
(see 3.7 for an explanation of the naming of the function):
 
function phorum_mod_foo_some_hook ($data) {
return $data;
}
 
The exact nature of the data that is sent to the hook functions
depends solely on the hook that is run. In chapter 4 of this document
you will find a description of all supported hooks, including a
specification of the type of data that is sent.
 
 
2.1.2 Module information
------------------------
 
For each hook that you want to handle in your module, you will have
to point the module system to the function in your module that will
handle the hook. Together with some other information, used for
describing the module, this is stored in the module information.
The module information acts as the glue between Phorum and your
module.
 
Module information is formatted using lines of plain text. Each line
contains a bit of information about the module. The general format
of the lines in the module information is:
 
<type>: <data>
 
Here is a list of the types that can be used:
 
+--------+-----------------------------------------------------------+
| <type> | <data> |
+--------+-----------------------------------------------------------+
| title | This is the title for the module that is displayed in the |
| | "Modules" page of the admin interface. |
+--------+-----------------------------------------------------------+
| desc | This is the description that is displayed along with the |
| | title in the admin interface, to give a little more |
| | information about the module. Using HTML in the <data> |
| | part is allowed. |
+--------+-----------------------------------------------------------+
| hook | This describes which hook functions are called for which |
| | Phorum hooks. The data consists of two fields, separated |
| | by a pipe "|" symbol. The first field contains the name |
| | of the hook that this module is hooking into. The second |
| | field contains the name of the hook function that will be |
| | called for the hook. |
+--------+-----------------------------------------------------------+
 
It is allowed to use multiple hook lines in your module information,
so your module can hook into multiple hooks. When doing this, it
is also allowed to use the same hook function for handling different
hooks in your module (asuming the hooks are compatible).
 
Here's an example of what the module information for our example
module "foo" might look like:
 
title: Foo example module
desc: This is the Foo module for Phorum. Nothing exciting...
hook: some_hook|phorum_mod_foo_some_hook
hook: some_other_hook|phorum_mod_foo_some_other_hook
hook: yet_another_hook|phorum_mod_foo_some_other_hook
 
So what this module info for example does, is telling Phorum that
when it gets to "some_other_hook", it will have to call the function
phorum_mod_foo_some_other_hook() in your module. It also tells
that for "yet_another_hook" the same function has to be called.
 
 
2.1.3 Other "stuff"
-------------------
 
Hook functions and the module information are all the parts needed
for creating a working module. However, your module might need
extra stuff like template, language and image files. You can
store these files along with your module when using the multiple
file module structure (see 2.2.2 below).
 
If you do not need to store any other stuff with your module, you
can also choose to use the single file (see 2.2.1 below) module
structure.
 
 
2.2 Module structure
--------------------
 
 
2.2.1 Single file modules
-------------------------
 
Single file modules are useful in case case no additional files have
to be distributed with your module. Because the module consist of
only one single file, it is very easy to distribute. Beware that the
moment you want to support for example a settings screen, multiple
languages or custom images, you will have to switch to the multiple
file module structure.
 
Single file modules consist of one single PHP file, which contains
both the module information and the hook functions. For storing the
module informaton, a special PHP comment is used. This comment must
look like the following:
 
/* phorum module info
<module information lines go here>
*/
 
Using the example module info from 2.1.2, the complete single
file module would look like this (see 3.5 why we use the
check on PHORUM at the start of this file):
 
<?php
 
if(!defined("PHORUM")) return;
 
/* phorum module info
title: Foo example module
desc: This is the Foo module for Phorum. Nothing exciting...
hook: some_hook|phorum_mod_foo_some_hook
hook: some_other_hook|phorum_mod_foo_some_other_hook
hook: yet_another_hook|phorum_mod_foo_some_other_hook
*/
 
function phorum_mod_foo_some_hook ($data) {
// Do stuff for "some_hook".
return $data;
}
 
function phorum_mod_foo_some_other_hook ($data) {
// Do stuff for "some_other_hook" and "yet_another_hook".
return $data;
}
 
?>
 
Installation of a single file module is done by putting the PHP
file (e.g. foo.php) directly in the directory {phorum dir}/mods/
and activating the module from the "Modules" screen in your
admin interface.
 
 
2.2.2 Multiple file modules
---------------------------
 
Multiple file modules are useful in case you need additional files
to be stored with your module, for example a settings screen,
language files or custom images.
 
Multiple file modules are stored in their own subdirectory below
the directory {phorum dir}/mods/. So if you have a module named
"foo", you will have to create a directory {phorum dir}/mods/foo/ for
storing all module files.
 
Inside this subdirectory, you will have to create a least two files.
The first is a file called "info.txt". This file contains the
module information for your module (see 2.1.2). The second file
is the PHP file which contains the hook functions for your module.
The basename of this file should be the same as the name of the
module subdirectory. So for our example module "foo", you will have
to create a file named "foo.php".
 
Using the example module info from 2.1.2, the complete multiple
file module would look like this (see 3.5 why we use the
check on PHORUM at the start of the PHP file):
 
info.txt:
 
title: Foo example module
desc: This is the Foo module for Phorum. Nothing exciting...
hook: some_hook|phorum_mod_foo_some_hook
hook: some_other_hook|phorum_mod_foo_some_other_hook
hook: yet_another_hook|phorum_mod_foo_some_other_hook
 
foo.php:
 
<?php
 
if(!defined("PHORUM")) return;
 
function phorum_mod_foo_some_hook ($data) {
// Do stuff for "some_hook".
return $data;
}
 
function phorum_mod_foo_some_other_hook ($data) {
// Do stuff for "some_other_hook" and "yet_another_hook".
return $data;
}
 
?>
 
So far, the module has exactly same functionality as the single
file module from 2.2.1. From here on, the functionality can be
extended. Some of the possibilities are:
 
- Using custom files for your module (images, classes, libs, etc.);
- Letting your module support multiple languages;
- Creating a settings screen for your module;
 
 
2.3 Supporting multiple languages
---------------------------------
 
(this feature is only available for the multiple file module structure)
 
If your module includes text that will be displayed to end users,
you should strongly consider making it support multiple languages.
This will allow Phorum installations using another language to display
output of your module in the same language, instead of the language
you have written the module in.
 
For supporting multiple languages, the first thing to do is add the
following to your module information file (info.txt):
 
hook: lang|
 
There is no hook function configured here, because the "lang" hook
is only used as a marker for Phorum. This only tells Phorum that your
module supports multiple languages.
 
Next, you must provide at least one language file with your module.
Language files are stored in a subdirectory name "lang" inside your
module directory. So in our sample module, the full directory would be
{phorum dir}/foo/lang/. The language files must be named identical
to the main language files that Phorum uses. So, to include both
English and French, your module would have the following file
structure below the Phorum's mods directory:
 
foo/info.txt
foo/foo.php
foo/lang/english.php
foo/lang/french.php
 
The structure of your language files will be almost identical to that
of the main Phorum language files. However, for your own language files
it is advisable to add an extra level in the language variables, to
avoid conflicts with other modules or Phorum itself. Here is an
example of how you would do that:
 
<?php
$PHORUM["DATA"]["LANG"]["mod_foo"]["Hello"] = "Hello!";
?>
 
Here, the extra inserted level is ["mod_foo"]. You can add as many
lines as you need for your module. To access the above language string,
from your module code you would use:
 
$PHORUM["DATA"]["LANG"]["mod_foo"]["Hello"]
 
From a template file, you would use:
 
{LANG->mod_foo->Hello}
 
In case a Phorum installation is using a language that your module
does not support, Phorum will automatically attempt to fallback to
English. So it is highly recommend that you include an english.php
language file in all your modules. If both the current language and
english.php are not found, Phorum will be unable to load a language
for your module and will display empty space instead of language
strings.
 
Try to reuse strings that are already in the main Phorum language
files itself. Only create custom strings when there is no alternative
available. Having more text to translate is more work for everybody,
especially the Phorum translators.
 
 
2.4 Storing message data
------------------------
 
If your module needs to store data along with a Phorum message,
you can make use of the meta information array that is attached
to each message ($message["meta"]). This array is a regular PHP
array, which is stored in the database as serialized data
(see http://www.php.net/serialize). Because Phorum and other modules
make use of this meta data as well, you should not squash it,
neither access the meta data in the database directly. Instead
use the methods described in this section.
 
Remark: because the meta data is stored as serialized data in the
database, it is not possible to include data you store in there
in SQL queries.
 
When storing information in the meta data from a hook function, you
can encounter two different situations, which both need a different
way of handling.
 
 
2.4.1 From hooks that are run before saving a message to the database
---------------------------------------------------------------------
 
There are some hooks that send a full message structure to the
hook functions, so these can change the message data before storing
the message in the database. Examples are the hooks "pre_post"
and "pre_edit". In this case you can simply update the meta
information directly. Here's an example of how this would look
in your hook function:
 
function phorum_mod_foo_pre_post ($message) {
$message["meta"]["mod_foo"]["foodata"] = "Some data";
$message["meta"]["mod_foo"]["bardata"] = "Some more data";
return $message;
}
 
Phorum will take care of storing the updated meta data in the database.
 
 
2.4.2 From other hooks
----------------------
 
For other hooks, the proper way to store information in the meta
data is to retrieve the current meta data using phorum_db_get_message(),
copy the meta data to a new message structure, make changes as needed
and use phorum_db_update_message() to update the message in the
database. Here is an example of how this could look in your hook
function:
 
function phorum_mod_foo_some_hook ($data) {
 
// Somehow you get the id for the message. Here we asume
// that it is stored in the $data parameter.
$message_id = $data["message_id"];
 
// Retrieve the current message data.
$message = phorum_db_get_message ($message_id);
 
// Create updated meta data.
$new_message = array("meta" => $message["meta"]);
$new_message["meta"]["mod_foo"]["foodata"] = "Some data";
$new_message["meta"]["mod_foo"]["bardata"] = "Some more data";
 
// Store the updated data in the database.
phorum_db_update_message($message_id, $new_message);
 
return $data;
}
 
Changing meta data for a message this way will ensure that the
existing meta data is kept intact.
 
 
2.5 Storing user data
---------------------
 
If your module needs to store data along with a Phorum user,
you can make use of custom profile fields. In the admin interface,
under "Custom Profiles", you can add your own profile fields
(see also docs/creating_custom_userfields.txt).
 
The custom profile fields will be accessible from within the user
data. E.g. if you have created a custom profile field named "foobar",
the value of that field will be stored in $user["foobar"].
 
When using a custom profile field for storing module information,
you can use a separate field for each piece of data you want to
store. But instead, you can also create a single field for storing
a complete array of information. Phorum will automatically take care
of storing this information (serialized) in the database. You only
should make sure that the custom profile field is large enough to
store all the data. When your module needs to store multiple fields,
this is the preferred way.
 
For storing data in the custom profile field, you can make use of the
phorum_user_save() function. Below are two pieces of code which show
how our example module might store data for a user (asuming $user_id
is the id of the user that must be changed).
 
When using multiple fields "mod_foo_foodata" and "mod_foo_bardata":
 
$user = phorum_user_get($user_id);
$user["mod_foo_foodata"] = "Some user data";
$user["mod_foo_bardata"] = "Some more user data";
phorum_user_save($user);
 
When using a single custom field "mod_foo" for this module:
 
$user = phorum_user_get($user_id);
$user["mod_foo"] = array (
"foodata" => "Some user data",
"bardata" => "Some more user data"
);
phorum_user_save($user);
 
 
2.6 Creating custom URLs
-------------------------
 
Phorum uses the function phorum_get_url() to consistenly build URLs
that point to parts of Phorum. It is recommended that you use this
function as well when creating links yourself, so special features
and future changes will automatically be incorporated in the links
you use.
 
Here's an example of building an URL, which will open the profile
for the user with user_id = 17:
 
$url = phorum_get_url(PHORUM_PROFILE_URL, 17);
 
The argument list that this function takes, depends on the first
argument which tells Phorum what kind of URL has to be built.
So when building other URLs, other arguments will probably
be used.
 
If you need to build a custom URL to link to your own module, you
can use phorum_get_url() as well. The way to go is simple. You
need to use PHORUM_CUSTOM_URL as the first argument and add all
URL building parameters to it.
 
The first parameter needs to be the filename of the file to link
to, without the (.php) extension. The second parameter needs to
be 0 or 1. If it is 1, the current forum_id is added to the URL.
All other parameters are added comma separated to the URL.
 
Here's an example of building a custom URL which links to the
file "myfile.php". The URL has to have the forum_id in it and
needs to contain the additional parameter "foo=bar":
 
$url = phorum_get_url(PHORUM_CUSTOM_URL, "myfile", 1, "foo=bar");
 
 
2.7 Implementing settings for your module
-----------------------------------------
 
(this feature is only available for the multiple file module structure)
 
Some modules that you write might need to store settings for later
use. For those, you can create a settings page which will be used
from within the admin interface.
 
The settings page must be put in your modules's directory by the
name of "settings.php". So for our example module "foo" the file
would go in {phorum dir}/mods/foo/settings.php. In the admin
interface under the option "Modules", a link to the settings.php
page will automatically be added if the settings.php file is
available for your module.
 
Although you can do anything you want from your settings.php script,
it is recommended that you use the tools that are handed to you
by Phorum for building pages and storing settings.
 
One of those tools is a PHP object "PhorumInputForm" which
can be used to create standard input forms and table displays in
the admin interface. The best example here is to look at one of the
modules that come with Phorum like "bbcode" or "replace".
 
Another tool is the function phorum_db_update_settings() which can
be used for storing settings in the database. To store settings using
this function you do something like the following:
 
$foo_settings["foodata"] = "Some setting data";
$foo_settings["bardata"] = "Some more setting data";
phorum_db_update_settings(array("mod_foo" => $foo_settings));
 
$foo_settings can be anything you like: an array, object, string, etc.
The first request after you have stored your settings, the setting
data for this example will be available in $PHORUM["mod_foo"].
 
To ensure that your settings file is only loaded from the admin
interface, place this line at the top of your settings.php file
(see also 3.5):
 
if(!defined("PHORUM_ADMIN")) return;
 
 
2.8 Changing the templates using template hooks
-----------------------------------------------
 
 
2.8.1 When to use a template hook
---------------------------------
 
Changing the templates should be avoided as much as possible when
writing a module. This will basically turn your mod into a hack,
because files have to be edited for it. Inexperienced users might
find it hard to install your module if they have to modify files
to get it to work.
 
If you cannot avoid changing the template, then consider to use
template hooks for this. You can use these if your template change
involves adding extra code to a template. The advantage is that
there's only little code that has to be added to the templates,
which makes things less confusing to users that want to install the
module.
 
 
2.8.2 How to use a template hook
--------------------------------
 
To create a template hook, you do the following:
 
* Add "{HOOK tpl_some_hook}" to the template at an appropriate spot;
 
* Put "hook: tpl_some_hook|phorum_mod_foo_tpl_some_hook" in your
module info;
 
* Create the hook function phorum_mod_foo_tpl_some_hook() that
prints out the code that has to be placed at the position of
the "{HOOK tpl_some_hook}" code the the template.
 
If you want to pass on the data from template variables to
the hook function, you can simply add the variables to the hook
definition in the template. Example:
 
{HOOK tpl_some_hook DATA1 DATA2}
 
The hook function will get the contents of these variables passed in
a single array. This can for example be useful if your template hook
needs access to loop data. Example:
 
{LOOP MESSAGES}
...
{HOOK tpl_some_hook MESSAGES}
...
{/LOOP MESSAGES}
 
 
2.8.3 Preventing collisions in hook names
-----------------------------------------
 
You can use any name for "tpl_some_hook", but beware that your
name does not collide with an already existing hook name.
 
The easiest way to do this is use the techniques from section 3.7.
As a rule of thumb, you can use the following format:
 
tpl_mod_<modulename>_<identifier>
 
Example: If a buttonbar is added in one of the templates for a module
named "foo", the name for the hook could be "tpl_mod_foo_buttonbar".
 
 
2.9 Example modules
-------------------
 
The best way of learning how to write modules is probably looking
at existing module code. In your Phorum distribution's docs directory,
you will find the directory example_mods. This directory contains a
couple of example modules, demonstrating the features described in this
document. The modules have no real functional purpose, but they might
be easier to read than the real Phorum modules.
 
 
3. **CAUTIONS AND SECURITY ISSUES**
-------------------------------------------------------------------------------
 
 
3.1 Make modules, not hacks
---------------------------
 
Making modules that require database changes are discouraged and may
not be accepted as an approved module. We want modules to be as
transparent as possible for upgrades. Please attempt to store your
data in the proper place. See chapter 2 for more information on that.
 
 
3.2 Reload your module if you change the module information
-----------------------------------------------------------
 
If you are changing the module info for a module that is already
activated in your Phorum installation, you must deactivate and
reactivate it to have Phorum reload the changed information. For
performance reasons the module information is only read when the
module is activated.
 
If you have added a new hook function to your module and it seems
not to be run, it probably is because you did not do this.
 
 
3.3 How to access the $PHORUM array from your hook functions
------------------------------------------------------------
 
The $PHORUM array is in the global scope. From inside a function,
you can not directly access this array. So you will have to import
the $PHORUM array into your function scope. The Phorum team
recommends the following method for doing this (check out the
faq.txt to see why we do not use the "global" keyword):
 
function phorum_mod_foo_some_hook ($data) {
$PHORUM = $GLOBALS["PHORUM"];
 
// Do stuff for "some_hook".
 
return $data;
}
 
 
3.4 How to access additional files in your multi file module
------------------------------------------------------------
 
All standard Phorum pages are run from the Phorum installation
directory. The hook functions that you write also work from
the same directory. So if you want to access files in your module
directory, you will have to specify the relative path to those
files. This path looks like:
 
./mods/<module>/<filename>
 
So let's say that our module "foo" has a subdirectory "images"
which contains "bar.gif", then we could display that image
using the HTML code:
 
<img src="./mods/foo/images/bar.gif" />
 
Another example: let's say that there is a function library
named "my_module_functions.php" in the module, which must be
included from then module code, then this is done using:
 
include("./mods/foo/my_module_functions.php");
 
 
3.5 Secure your PHP files agains hackers
----------------------------------------
 
To prevent hackers from loading your PHP module files directly, you
should add the following to the start of your PHP files:
 
if(!defined("PHORUM")) return;
 
This will make sure that the file will only work when loaded from
the Phorum application. If you are writing pages that are loaded
from the admin interface (like a settings screen for your module),
then use the following line instead:
 
if(!defined("PHORUM_ADMIN")) return;
 
This will make sure that the file will only work when loaded from
the Phorum admin interface.
 
 
3.6 Secure your pages from XSS
------------------------------
 
XSS stands for cross site scripting. This means that hackers
can feed HTML data to your application, which is displayed on
screen without stripping or escaping the HTML data. This way
it can be possible for hackers to feed malicous javascript
code into the browser of users on the forum, causing a security
risk. If you want to learn more about XSS, please visit
http://en.wikipedia.org/wiki/XSS
 
To prevent XSS security holes, you must take care that all
user input is properly sanitized before displaying it on screen.
Sanitizing can be done by either stripping all HTML from
the data (e.g. using http://www.php.net/strip_tags) or by escaping
all html characters (using http://www.php.net/htmlspecialchars).
 
Example:
 
If your module needs to display the username for a user on
screen, it must not simply do:
 
print $user["username"];
 
Instead you must use:
 
print htmlspecialchars($user["username"]);
 
It's not only for security that you have to sanitize data before
displaying it. You must use htmlspecialchars() to prevent some other
possible problems as well. Imagine you have a user with the username
"<b>ob". Without htmlspecialchars() the username would be interpreted
as HTML code, possibly making the full page bold from the username on.
 
 
3.7 Prevent namespace collisions
--------------------------------
 
When creating modules, you must always be aware that you are
working in the same namespace as other modules and Phorum itself.
This means that there is a risk of duplicate use of function
and variable names. By following a couple of simple rules, you
can greatly reduce this risk.
 
 
3.7.1 (Hook) functions
----------------------
 
Always construct names for your module functions like this:
 
phorum_mod_<module name>_<identifier>
 
So if you are writing functions for a module named "foo", all
function names will look like:
 
phorum_mod_foo_<identifier>
 
You can use whatever you like for the <identifier> part. When writing
a hook function, it is recommended to use the name of the hook for
which you are writing the function (this will make clear what the
function does, without having to check the module info). So in case
you are writing a hook function for the hook "some_hook", the full
function name would be:
 
phorum_mod_foo_some_hook
 
If your hook function handles multiple hooks at once, then
simply use one of the hook's names as the <identifier> or make up
something yourself.
 
 
3.7.2 Data stored in $PHORUM
----------------------------
 
When storing data in $PHORUM, always prepend the array key name
with mod_<module name>. If your module is named "foo", do not use:
 
$PHORUM["mydata"]
 
but instead:
 
$PHORUM["mod_foo_mydata"]
 
 
3.7.3 Language strings stored in $PHORUM
----------------------------------------
 
When storing your custom language strings, do not put them directly
in $PHORUM["DATA"]["LANG"] like Phorum does, because that might
result in conflicting language strings. Instead add an extra data level,
which makes sure that your module keeps all language strings to itself.
 
If your module is named "foo", you should store language strings in:
 
$PHORUM["DATA"]["LANG"]["mod_foo"]
 
See also section 2.3.
 
 
3.7.4 Data stored in messages, users and settings
-------------------------------------------------
 
When using the Phorum provided ways of storing data in messages,
users and settings, always prepend the data key with
mod_<module name>. SO if your module is named "foo", do not use
things like:
 
$new_message["meta"]["foodata"] = "Some data";
$user["foodata"] = "Some data";
phorum_db_update_settings(array("settings" => $foo_settings));
 
but instead:
 
$new_message["meta"]["mod_foo_foodata"] = "Some data";
$user["mod_foo_foodata"] = "Some data";
phorum_db_update_settings(array("mod_foo" => $foo_settings));
 
See also sections 2.4 (message data), 2.5 (user data) and 2.7 (settings).
 
 
4. Overview of available Phorum hooks
-------------------------------------------------------------------------------
 
In this chapter you will find an overview of all available Phorum
hooks and a description of what they do.
 
Remarks:
 
* Input is what your module function should expect as parameters.
 
* Return is what your module function should return. Most hooks
expect the same data structure as was sent. For those items,
the Return is listed simply as "Same as Input".
 
* Normally, hook functions are allowed to modify the data that was
sent as input. If this is not allowed, the input data will be
flagged as read-only.
 
* In most cases the hook description will provide only one or more
of the possible uses for the hook. The full leverage of each hook
is only limited by the imagination of the module writer (it's
as much a cliche as it is true).
 
* It may be that you need to hook into a spot where there is
currently no hook available. If that is the case, let the dev
team know by posting a message in the development forum
on phorum.org, explaining where and why you need an extra hook.
Hooks will be added as neccessary, especially while Phorum 5
is young.
 
 
4.1 Code hooks
--------------
 
Code hooks are hooks that are called from within the Phorum core
code. These hooks are typically used for modifying Phorum's internal
datastructures.
 
 
----------------------------------------------------------------------------
admin_general
 
Where : admin interface
When : Right before the PhorumInputForm object is shown.
Input : The PhorumInputForm object.
Return : Same as Input
 
This hook can be used for adding items to the form on the
"General Settings" page of the admin interface.
 
----------------------------------------------------------------------------
admin_file_purge
 
Where : admin interface, option "Purge Stale Files"
When : Right before stale files are deleted from the database.
Input : An array, containing a description of all stale files.
Return : Same as Input
 
The primary use of this hook would be to cleanup stale files, created
by an alternate storage system for attachments (see after_attach and
after_detach as well). The array that is passed on to the hook function
contains arrays, which contain the following fields:
 
file_id : Internal id to reference the file.
filename : Name of the file.
filesize : Filesize in KB.
add_datetime : Epoch timestamp for the time the file was created.
reason : A description why this file is considered to be stale.
 
----------------------------------------------------------------------------
after_attach
 
Where : include/posting/action_attachments.php
When : Just after a file attachment is saved in the database
Input : Two part array where the first element is the message array and
the second element is a file array that contains the name, size,
and file_id of the newly saved file.
Return : Same as Input
 
The primary use of this hook would be for creating an alternate storage
system for attachments. You would need to use the before_attach hook to
remove the file data and in this hook it could be saved properly. You will
need to use the file hook to retreive the file data later.
 
----------------------------------------------------------------------------
after_detach
 
Where : include/posting/action_attachments.php
When : Just after a file attachment is deleted from the database
Input : Two part array where the first element is the message array and
the second element is a file array that contains the name, size,
and file_id of the deleted file.
Return : Same as Input
 
The primary use of this hook would be for creating an alternate storage
system for attachments. Using this hook, you can delete the file from
your alternate storage.
 
----------------------------------------------------------------------------
after_header
 
Where : Every page, except for the admin interface pages
When : Right after the header is displayed.
Input : none
Return : none
 
This hook can be used for creating content at the end of the header,
just before the main content is displayed.
 
----------------------------------------------------------------------------
after_login
 
Where : login.php
When : After a successful login, just before redirecting the
user to a Phorum page.
Input : The redirection URL.
Return : Same as Input
 
This hook can be used for performing tasks after a successful user
login and for changing the page to which the user will be redirected
(by returning a different redirection URL). If you need to access the
user data, then you can do this through the global $PHORUM variable.
The user data will be in $PHORUM["user"].
 
----------------------------------------------------------------------------
after_logout
 
Where : login.php
When : After a logout, just before redirecting the user to
a Phorum page.
Input : The redirection URL.
Return : Same as Input
 
This hook can be used for performing tasks after a successful user
logout and for changing the page to which the user will be redirected
(by returning a different redirection URL). The user data will still
be availbale in $PHORUM["user"] at this point.
 
----------------------------------------------------------------------------
after_register
 
Where : register.php
When : Right after a successful registration of a new user is done
and all confirmation mails are sent.
Input : Array containing the user data of the user (read-only).
Return : Same as Input
 
This hook can be used for performing tasks (like logging and
notification) after a successful user registration.
 
----------------------------------------------------------------------------
before_attach
 
Where : include/posting/action_attachments.php
When : Just before a file attachment is saved in the database
Input : Two part array where the first element is the message array and
the second element is a file array that contains the name, size
and data.
Return : Same as Input
 
The primary use of this hook would be for creating an alternate storage
system for attachments. You would need to use the after_attach hook to
complete the process as you do not yet have the file_id for the file. You
will need to use the file hook to retreive the file data later.
 
----------------------------------------------------------------------------
before_editor
 
Where : posting.php
When : Just before the message editor is displayed.
Input : Array containing data for the message that will be shown
in the editor screen.
Return : Same as Input
 
This hook can be used for changing message data, just before the editor
is displayed. This is done after escaping message data for XSS prevention
is done. So in the hook, the module writer will have to be aware that
data is escaped and that he has to escape data himself if needed.
 
This hook is called every time the editor is displayed. If modifying
the message data does not have to be done on every request (for example
only on the first request when replying to a message), the module will
have to check the state the editor is in. Here's some hints on what
you could do to accomplish this:
 
* Check the editor mode: this can be done by looking at the "mode" field
in the message data. This field can be one of "post", "reply" and "edit".
 
* Check if it's the first request: this can be done by looking at the
$_POST array. If no field "message_id" can be found in there, the
editor is handing the first request.
 
Using this, an example hook function that appends the string "FOO!"
to the subject when replying to a message (how useful ;-) could look
like this:
 
function phorum_mod_foo_before_editor ($data)
{
if ($data["mode"] == "reply" && ! isset($_POST["message_id])) {
$data["reply"] = $data["reply"] . " FOO!";
}
 
return $data;
}
 
Beware: this hook function only changes message data before it is
displayed in the editor. From the editor, the user can still change
the data. Therefore, this hook cannot be used to control the data which
will be stored in the database. If you need that functionality, then
use the hooks pre_edit and/or pre_post instead.
 
----------------------------------------------------------------------------
before_footer
 
Where : Every page, except for the admin interface pages
When : Right before the footer is displayed.
Input : none
Return : none
 
This hook can be used for creating content at the end of the main
content, just before the footer. It can also be used for
performing tasks that have to be executed at the end of each page.
 
----------------------------------------------------------------------------
before_register
 
Where : register.php
When : Right before a new user is stored in the database.
Input : Array containing the user data of the user.
Return : Same as Input
 
This hook can be used for performing tasks before user registration.
This hook is useful if you want to add some data to or change some
data in the user data and to check if the user data is correct.
 
When checking the registration data, the hook can set the "error" field
in the returned user data array. When this field is set after running
the hook, the registration processed will be halted and the error
will be displayed. If you created a custom form field "foo" and you
require that field to be filled in, you could create a hook function
which looks like this:
 
function phorum_mod_foo_before_register ($data)
{
$myfield = trim($data['your_custom_field']);
if (empty($myfield)) {
$data['error'] = 'You need to fill in my custom field';
}
 
return $data;
}
 
----------------------------------------------------------------------------
buddy_add
 
Where : pm.php
When : Right after a buddy has been added successfully.
Input : The user id of the buddy that has been added.
Return : Same as Input
 
This hook can be used for performing actions after a buddy has been
added for a user (e.g. sending the new buddy a PM about this event,
update popularity counters, do logging, synchronizing with other
databases, etc.).
 
----------------------------------------------------------------------------
buddy_delete
 
Where : pm.php
When : Right after a buddy has been deleted successfully.
Input : The user id of the buddy that has been deleted.
Return : Same as Input
 
This hook can be used for performing actions after a buddy has
been deleted for a user.
 
----------------------------------------------------------------------------
cc_save_user
 
Where : control.php
When : Right before data for a user is saved in the control panel.
Input : Array containing the user data to save.
Return : Same as Input
 
This hook works the same way as the before_register hook, so you can
also use it for changing and checking the user data that will be
saved in the database. There's one difference. If you want to
check a custom field, you'll also need to check the panel which
you are on, because this hook is called from multiple panels.
The panel that you are on, will be stored in the 'panel' field
of the user data.
 
If you have added a custom field to the template for the option
"Edit My Profile" in the control panel, your hook function will
look like this:
 
function phorum_mod_foo_cc_save_user ($data)
{
// Only check data for the panel "user".
if ($data['panel'] != "user") return $data;
 
$myfield = trim($data['your_custom_field']);
if (empty($myfield)) {
$data['error'] = 'You need to fill in my custom field';
}
 
return $data;
}
 
----------------------------------------------------------------------------
check_post
 
Where : post.php
When : Right after performing preliminary posting checks, unless
these checks have returned something bad.
Input : Array containing:
0 => the $_POST array with form data
1 => $error, to return errors in
Return : Same as Input
 
This hook can be used for modifying data in the $_POST array and for
running additional checks on the data. If an error is put in $error,
Phorum will stop posting the message and show the error to the user
in the post-form.
 
Beware that $error can already contain an error on input, in case
multiple modules are run for this hook. Therefore you might want to
return immediately in your hook function in case $error is already
set.
 
Below is an example of how a function for this hook could look.
This example will disallow the use of the word "bar" in the
message body.
 
function phorum_mod_foo_check_post ($args) {
list ($message, $error) = $args;
if (!empty($error)) return $args;
 
if (stristr($message["body"], "bar") !== false) {
return array($message, "The body may not contain 'bar'");
}
 
return $args;
}
 
----------------------------------------------------------------------------
close_thread
 
Where : moderation.php
When : Right after a thread has been closed by a moderator.
Input : The id of the thread that has been closed (read-only).
Return : Same as Input
 
This hook can be used for performing actions like sending notifications
or making log entries after closing threads.
 
----------------------------------------------------------------------------
common
 
Where : common.php, so in practice every page
When : Right before the end of the common.php include script.
Input : none
Return : none
 
This hook can be used for applying custom settings or altering
Phorum settings based on external parameters.
 
----------------------------------------------------------------------------
common_no_forum
 
Where : common.php, so in practice every page
When : Right after no forum settings were found, before doing the redirect
Input : none
Return : none
 
This hook can be used for returning some other message (i.e. a 404-page)
to the visitor if the requested forum was not found.
 
----------------------------------------------------------------------------
common_post_user
 
Where : common.php, so in practice every page
When : Right after loading the user from the database, but just
before making descisions on language and template.
Input : none
Return : none
 
This hook can be used for applying custom settings or altering
Phorum settings based on external parameters.
 
----------------------------------------------------------------------------
common_pre
 
Where : common.php, so in practice every page
When : Right after loading the settings from the database, but just
before making descisions on language, template and user.
Input : none
Return : none
 
This hook can be used for applying custom settings or altering
Phorum settings based on external parameters.
 
----------------------------------------------------------------------------
delete
 
Where : moderation.php
When : Right after deleting a message from the database.
Input : Array of ids for messages that have been deleted (read-only).
Return : none
 
This hook can be used for cleaning up anything you may have created
with the post_post hook or any other hook that stored data tied to
messages.
 
----------------------------------------------------------------------------
external
 
The external hook functions are never called from any of the standard
Phorum pages. These functions are called by invoking script.php on the
command line with the --module parameter. This can be used to pipe
output from some arbitrary command to a specific module, which can do
something with that input. If your module does not need any command
line input and is meant to be run on a regular basis, you should
consider using the scheduled hook.
 
Mind that for using an external hook, the module in which it is
handled must be enabled in your admin interface. So if an external
hook is not running, the containing module might be disabled.
 
To run the external hook from the command line, you have to be in
the phorum installation directory. So running the external hook of
a module named "external_foo" would be done like this on a UNIX
system prompt:
 
# cd /your/phorum/dir
# php ./script.php --module=external_foo
 
For easy use, you can of course put these commands in a script file.
 
----------------------------------------------------------------------------
file
 
Where : file.php
When : When attachments are requested.
Input : Two part array where the first element is the mime type already
detected by file.php and the second part is the file array that
contains the filename, file_data, filesize, etc.
Return : Same as Input
 
This hook could be used to count file downloads, or along with after_attach
an alternate file data storage mechanism could be created.
 
----------------------------------------------------------------------------
format
 
Where : phorum_format_messages() in include/format_functions.php
When : Everytime phorum_format_messages() is called for formatting
a message, just before it is sent to the templates.
Input : Array of messages.
Return : Same as Input
 
This hook can be used for applying custom formatting to messages. The
message fields that are most applicable for this are "body" and "author".
When writing a module using this hook, you probably want to format
those fields. In practice you can apply formatting to all the fields
you want.
 
The changes you make to the messages are for displaying purposes
only, so the changes are not stored in the database.
 
----------------------------------------------------------------------------
hide
 
Where : moderation.php
When : Right after a message has been hidden by a moderator.
Input : The id of the message that has been hidden (read-only).
Return : Same as Input
 
This hook can be used for performing actions like sending notifications
or making log entries after hiding a message.
 
----------------------------------------------------------------------------
index
 
Where : include/index_new.php and include/index_classic.php
When : Right before the list of forums is displayed.
Input : Array of forums.
Return : Same as Input
 
This hook can be used for changing or adding data to the forums
in the list.
 
----------------------------------------------------------------------------
lang
 
The lang hook is a only a 'marker'. It flags Phorum that your module
supports multiple languages. It does not take a hook function in
your module information. If you do define a hook function, it will
never be called.
 
Read section 2.3 for information on the use of multiple languages.
 
----------------------------------------------------------------------------
list
 
Where : list.php
When : Right before the messages are formatted and displayed.
Input : Array of threads (or messages in threaded mode).
Return : Same as Input
 
This hook can be used for changing or adding data to the messages
in the list.
 
----------------------------------------------------------------------------
moderation
 
Where : moderation.php
When : At the start of moderation.php
Input : The id of the moderation step which is run (read-only).
Return : none
 
This hook can be used for logging moderator actions. You can
use the $PHORUM-array to retrieve additional info like the
moderating user's id and similar.
 
The moderation step id is the variable $mod_step that is used in
moderation.php. Please read that script to see what moderation
steps are available and for what moderation actions they stand.
 
When checking the moderation step id for a certain step, always use
the contstants that are defined for this in include/constants.php.
The numerical value of this id can change between Phorum releases.
 
----------------------------------------------------------------------------
move_thread
 
Where : moderation.php
When : Right after a thread has been moved by a moderator.
Input : The id of the thread that has been moved (read-only).
Return : none
 
This hook can be used for performing actions like sending notifications
or for making log entries after moving a thread.
 
----------------------------------------------------------------------------
pm_sent
 
Where : include/controlcenter/pm.php
When : Right after a PM and its email notifications have been sent.
Input : Array containing the private message data (read-only).
Return : none
 
This hook can be used for performing actions after sending a PM. Before
PM notification by email was put in the Phorum core, this hook was
used to send those notifications.
 
----------------------------------------------------------------------------
post_edit
 
Where : include/moderation_functions.php
When : Right after storing an edited message in the database.
Input : Array containing message data (read-only).
Return : none
 
This hook can be used for sending notifications or for making log entries
in the database when editing takes place.
 
----------------------------------------------------------------------------
post_post
 
Where : post.php
When : Right after storing a new message in the database and just
before the user is redirected back to the list.
Input : Array containing message data (read-only).
Return : none
 
This hook can be used for performing actions based on what the message
contained.
 
----------------------------------------------------------------------------
posting_permission
 
Where : posting.php
When : Right after Phorum has determined all abilities that apply
to the logged in user.
Input : none
Ouput : none
 
This hook can be used for setting up custom abilities and permissions
for users, by updating the applicable fields in $GLOBALS["PHORUM"]["DATA"]
(e.g. for giving certain users the right to make postings sticky, without
having to make the full moderator for a forum).
 
Read the code in posting.php before this hook is called to find out
what fields can be used.
 
Beware: Only use this hook if you know what you are doing and understand
Phorum's editor permission code. If used wrong, you can open up security
holes in your Phorum installation!
 
----------------------------------------------------------------------------
pre_edit
 
Where : include/moderation_functions.php
When : Right before storing an edited message in the database.
Input : Array containing message data.
Return : Same as Input
 
This hook can be used for changing the message data before storing it
in the database.
 
----------------------------------------------------------------------------
pre_post
 
Where : post.php
When : Right before storing a new message in the database.
Input : Array containing message data.
Return : Same as Input
 
This hook can be used for changing the message data before storing it
in the database.
 
----------------------------------------------------------------------------
profile
 
Where : profile.php and include/controlcenter/summary.php
When : Right before a user profile is displayed.
Input : Array containing user profile data.
Return : Same as Input
 
This hook can be used for making changes to the profile data. This
is for displaying purposes only, so the changes are not stored in the
database.
 
----------------------------------------------------------------------------
quote
 
Where : reply.php, read.php (for inline reply form support)
When : Right after the message to reply to has been loaded.
Input : Array containing:
0 => The message author
1 => The message body
Return : The quoted body to use in the post form.
 
When quoting a message for reply, by default Phorum formats quoted
messages using an old school email style of quoting. By using the quote
hook, you can implement a different quoting mechanism.
 
Your hook function will retrieve an array containing two elements:
the author and the body of the message to be quoted. The return
value for your hook function must be the quoted body that will
be pre-filled into the reply form.
 
The BBCode module that is distributed with Phorum has a quote hook
function. Because it does not make sense to have more than one quote
hook active, the BBCode module has an option to disable its quote hook
function. You need to make sure that its quote hook function is disabled
when using your own quote hook.
 
----------------------------------------------------------------------------
read
 
Where : read.php
When : Right before messages are formatted for displaying.
Input : Array of messages.
Return : Same as Input
 
This hook can be used for making changes to the message data when
reading messages. This is for displaying purposes only, so the
changes are not stored in the database.
 
----------------------------------------------------------------------------
read_user_info
 
Where : read.php post.php include/moderation_functions.php
When : Right after retrieving user data.
Input : Array of users.
Return : Same as Input
 
This hook can be used for changing information for the users before
being displayed. For example: add a border around user signatures.
This is for displaying purposes only, so the changes are not stored
in the database.
 
----------------------------------------------------------------------------
readthreads
 
Where : read.php
When : At the start of the threaded read handling, just before
sorting and displaying the threads.
Input : Array of messages.
Return : Same as Input
 
This hook does exactly the same as the read hook, except that this
one is only applied to messages when viewing the message list in
threaded mode.
 
----------------------------------------------------------------------------
reopen_thread
 
Where : moderation.php
When : Right after a thread has been reopened by a moderator.
Input : The id of the thread that has been reopened (read-only).
Return : Same as Input
 
This hook can be used for performing actions like sending notifications
or making log entries after reopening threads.
 
----------------------------------------------------------------------------
report
 
Where : report.php
When : Just before a reported message is sent to the moderators.
Input : Array with maildata (see report.php for the exact contents).
Return : Same as Input
 
This hook can be used for changing the report data that will be
sent to the moderators or for performing actions like making log
entries.
 
----------------------------------------------------------------------------
sanity_checks
 
Where : include/admin/sanity_checks.php
When : Just before the admin interface's sanity checks are run
Input : Array with sanity checks. Each sanity check is an array with:
function => The function that runs the sanity check
description => A description to show in the admin interface
Return : Same as Input
 
This hook can be used to add custom sanity checks to the admin
interface option "System Sanity Checks".
 
Each checking function is expected to return an array containing
two elements:
 
[0] A status, which can be one of
PHORUM_SANITY_OK No problem found
PHORUM_SANITY_WARN Problem found, but no fatal one
PHORUM_SANITY_CRIT Critical problem found
 
[1] A description of the problem that was found or NULL.
 
A general checking function looks like this:
 
function check_foo() {
$check_ok = ...some check...;
if (!$check_ok) {
return array(PHORUM_SANITY_CRIT, "Foo went wrong because ...");
} else {
return array(PHORUM_SANITY_OK, NULL);
}
}
 
----------------------------------------------------------------------------
scheduled
 
Scheduled hook functions are similar to external ones, except these
functions do not require any input from the command line. The modules
containing a scheduled hook are invoked by running script.php with
the --scheduled argument (no module name is taken; this argument
will run all scheduled hooks for all available modules).
 
Like the name of the hook already suggests, this hook can be used for
creating tasks which have to be executed on a regular basis. To
archieve this, you can let script.php run from a scheduling
service (like a cron job on a UNIX system).
 
In general, scheduled hooks are used for automating tasks you want
to execute without having to perform any manual action. Practical
uses for a scheduled hook could be housekeeping (cleanup of
stale/old data), daily content generation (like sending daily digests
containing all posted messages for that day) or forum statistics
generation.
 
Mind that for using a scheduled hook, the module in which it is
handled must be enabled in your admin interface. So if a scheduled
hook is not running, the containing module might be disabled.
 
To run the scheduled hook from the command line or from a scheduling
service, you have to be in the phorum installation directory. So
running the scheduled hooks for your Phorum installation would
be done like this on a UNIX system prompt:
 
# cd /your/phorum/dir
# php ./script.php --scheduled
 
When creating a scheduling service entry for running this
automatically, then remind to change the directory as well.
You might also have to use the full path to your PHP binary
(/usr/bin/php or whatever it is on your system), because
the scheduling service might not know the path to it. An entry
for the cron system on UNIX could look like this:
 
0 0 * * * cd /your/phorum/dir && /usr/bin/php ./script.php --scheduled
 
Please refer to your system's documentation to see how to
use your system's scheduling service.
 
----------------------------------------------------------------------------
search
 
Where : search.php
When : Right before messages are formatted for displaying.
Input : Array of messages.
Return : Same as Input
 
This hook can be used for making changes to the message data when
searching for messages. This is for displaying purposes only, so the
changes are not stored in the database.
 
----------------------------------------------------------------------------
send_mail
 
Where : include/email_functions.php in the function phorum_email_user()
When : Right before email is sent using PHP's mail() function.
Input : Array with maildata (read-only) containing:
addresses => Array of e-mail addresses,
from => The sender address,
subject => The mail subject,
body => The mail body,
bcc => Whether to use Bcc for mailing multiple recipients
Return : true/false - see description
 
This hook can be used for implementing an alternative mail sending
system (e.g. like the SMTP module does). The hook should return true if
Phorum should still send the mails himself. If you do not want to have
Phorum send the mails also, return false.
 
----------------------------------------------------------------------------
user_list
 
Where : include/users.php include/controlcenter/groupmod.php
When : Whenever phorum_user_get_list() is called.
Input : Array containing:
<user_id> => <data>
Where <data> is an array containing:
username => the username for the user
displayname => the way to display the username
Return : Same as Input
 
This hook can be used for reformatting the list of users in some
way, such as changing the sort order or changing the format of
the displayed names.
 
 
4.2 Template hooks
------------------
 
Template hooks are called from within Phorum's template files.
These hooks can be used to extend the user interface with custom
elements. From a hook function for one of these template hooks, the
module writer can print the HTML code that has to be added to the
interface at the postition of the hook call in the template.
 
 
----------------------------------------------------------------------------
tpl_editor_after_subject
 
Where : posting_messageform.tpl
When : After the Subject: field in the message editor.
Input : none
Return : none
 
This hook can be used to add custom form fields to the message editor.
In the default template, the hook is run from within a two column table.
Column one contains the labels and column two the form fields. So your
hook function for adding a field to the editor could look like this:
 
function phorum_mod_foo_tpl_editor_after_subject()
{
$value = isset($_POST["mod_foo"]) ? $_POST["mod_foo"] : "";
?>
<tr>
<td>
Foo field
</td>
<td>
<input type="text" name="mod_foo"
value="<?php print htmlspecialchars($value) ?>"/>
</td>
</tr>
<?php
}
 
----------------------------------------------------------------------------
tpl_cc_usersettings
 
Where : cc_usersettings.tpl
When : After the built-in usersettings fields.
Input : Array containing the user's current profile.
Return : Same as Input
 
This hook can be used to add extra fields to the settings pages in the
user's control center. Here's an example hook function that will add
an extra field to the "Edit My Profile" page.
 
function phorum_mod_foo_tpl_cc_usersettings($profile)
{
// Check if we're on the userprofile page of cc_usersettings.tpl.
if (! isset($profile["USERPROFILE"]) || ! $profile["USERPROFILE"])
return;
 
$value = isset($profile["shoesize"])
? htmlspecialchars($profile["shoesize"]) : "";
?>
<tr>
<td>Shoe size</td>
<td><input name="shoesize" type="text" value="<?=$value?>"></td>
</tr>
<?php
}
 
----------------------------------------------------------------------------
tpl_editor_attachment_buttons
 
Where : posting_attachments_list.tpl
When : Before the delete button for an attachment.
Input : Array containing attachment information.
Return : Same as Input
 
This hook can be used to add extra buttons to each attachment in the
editor, so you can do custom actions for attachments.
 
To make your buttons look the same as Phorum's buttons, use the
CSS class "PhorumSubmit".
 
Here's an example hook function that will add a button to the attachments,
which will send a javascript alert to the user when clicked.
 
function phorum_mod_foo_tpl_editor_attachment_buttons($data)
{
$id = $data["file_id"];
?>
<input type="submit" class="PhorumSubmit" value="Say it!"
onclick="alert('You clicked attachment id <?php print $id ?>')" />
<?php
}
 
----------------------------------------------------------------------------
tpl_editor_before_textarea
 
Where : posting_messageform.tpl
When : Before the textarea.
Input : none
Return : none
 
This hook can be used to add custom user interface elements before the
textarea in the message editor.
 
----------------------------------------------------------------------------
tpl_editor_buttons
 
Where : posting_buttons.tpl
When : Before the main editor buttons (like Preview, Post and Cancel).
Input : none
Return : none
 
This hook can be used to add extra buttons to the editor buttons.
 
To make your buttons look the same as Phorum's buttons, use the
CSS class "PhorumSubmit".
 
Here's an example hook function that will add a button to the editor,
which will send a javascript alert to the user when clicked.
 
function phorum_mod_foo_tpl_editor_buttons()
{ ?>
<input type="submit" class="PhorumSubmit" value="Say it!"
onclick="alert('Hello, foo!')" />
<?php
}
 
 
6. Support
-------------------------------------------------------------------------------
 
If you have questions about creating modules for Phorum, please visit
the website http://phorum.org/ and ask the development team for help in
the Development forum.
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/follow.php
New file
0,0 → 1,93
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','subscribe');
 
include_once("./common.php");
 
phorum_require_login();
 
// checking read-permissions
if(!phorum_check_read_common()) {
return;
}
 
// somehow we got to a folder
if($PHORUM["folder_flag"] || empty($PHORUM["forum_id"])){
$dest_url = phorum_get_url(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
phorum_redirect_by_url($dest_url);
exit();
}
 
if(isset($PHORUM["args"][1])){
$thread=$PHORUM["args"][1];
} elseif(isset($_POST["thread"])){
$thread=$_POST["thread"];
}
 
if(empty($thread)) {
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}
 
$message=phorum_db_get_message($thread);
 
if(isset($PHORUM["args"]["remove"])){
// we are removing a message from the follow list
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["RemoveFollowed"];
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$template="message";
} elseif(isset($PHORUM["args"]["noemail"])){
// we are stopping emails for this thread
phorum_user_unsubscribe( $PHORUM['user']['user_id'], $thread );
phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, PHORUM_SUBSCRIPTION_BOOKMARK );
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoMoreEmails"];
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$template="message";
} elseif(!empty($_POST)) {
// the user has submitted the form
$type = (isset($_POST["send_email"])) ? PHORUM_SUBSCRIPTION_MESSAGE : PHORUM_SUBSCRIPTION_BOOKMARK;
phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, $type );
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["BookmarkedThread"];
$template="message";
} else {
// we are following a new thread
$PHORUM["DATA"]["URL"]["ACTION"]=phorum_get_url(PHORUM_FOLLOW_ACTION_URL);
$PHORUM["DATA"]["SUBJECT"]=htmlspecialchars($message["subject"]);
$PHORUM["DATA"]["THREAD"]=$thread;
$PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
$template="follow";
}
 
 
// set all our common URL's
phorum_build_common_urls();
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template($template);
phorum_hook("before_footer");
include phorum_get_template("footer");
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/script.php
New file
0,0 → 1,59
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','script');
define('PHORUM_SCRIPT', 1);
 
include_once("./common.php");
 
// if we are running in the webserver, bail out
if (isset($_SERVER["REMOTE_ADDR"])) {
echo $PHORUM["DATA"]["LANG"]["CannotBeRunFromBrowser"];
return;
}
 
if (! isset($_SERVER["argv"][1])) {
phorum_script_usage();
}
 
// figure out what module we are trying to run
if (strpos($_SERVER["argv"][1], "--module=") === 0) {
$module = substr(strstr($_SERVER["argv"][1], "="), 1);
if (strlen($module) > 0) {
$args = $_SERVER["argv"];
unset($args[0]);
$args[1] = $module;
phorum_hook("external", $args);
}
else {
phorum_script_usage();
}
}
elseif ($argv[1] == "--scheduled") {
phorum_hook("scheduled");
}
else {
phorum_script_usage();
}
 
function phorum_script_usage() {
$PHORUM=$GLOBALS["PHORUM"];
echo $PHORUM["DATA"]["LANG"]["ScriptUsage"];
exit(1);
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/search.php
New file
0,0 → 1,224
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','search');
 
include_once("./common.php");
 
if(!phorum_check_read_common()) {
return;
}
 
include_once("./include/format_functions.php");
// set all our URL's
phorum_build_common_urls();
 
$PHORUM["DATA"]["SEARCH"]["noresults"] = false;
$PHORUM["DATA"]["SEARCH"]["showresults"] = false;
$PHORUM["DATA"]["SEARCH"]["safe_search"] = "";
 
function phorum_search_check_valid_vars() {
$PHORUM=$GLOBALS['PHORUM'];
$retval=true;
// these are valid values for some args
$valid_match_types=array("ALL","ANY","PHRASE","AUTHOR");
$valid_match_forum=array("THISONE","ALL");
 
if(!in_array($PHORUM["args"]["match_type"],$valid_match_types)) {
$retval=false;
} elseif(!in_array($PHORUM["args"]["match_forum"],$valid_match_forum)) {
$retval=false;
} elseif(!is_numeric($PHORUM["args"]["match_dates"])) {
$retval=false;
}
 
return $retval;
}
 
 
 
 
if(!empty($_GET["search"]) && !isset($PHORUM["args"]["page"])){
$search_url = @phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($_GET["search"]), "page=1", "match_type=" . urlencode($_GET['match_type']), "match_dates=" . urlencode($_GET['match_dates']), "match_forum=" . urlencode($_GET['match_forum']));
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["SearchRunning"];
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToSearch"];
$PHORUM["DATA"]["URL"]["REDIRECT"]=$search_url;
$PHORUM["DATA"]["REDIRECT_TIME"]=1;
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
}
 
if(isset($PHORUM["args"]["search"])){
$phorum_search = $PHORUM["args"]["search"];
}
 
if(!isset($PHORUM["args"]["match_type"])) $PHORUM["args"]["match_type"]="ALL";
if(!isset($PHORUM["args"]["match_dates"])) $PHORUM["args"]["match_dates"]="30";
if(!isset($PHORUM["args"]["match_forum"])) $PHORUM["args"]["match_forum"]="ALL";
 
if(!phorum_search_check_valid_vars()) {
$redir_url=phorum_get_url(PHORUM_LIST_URL);
phorum_redirect_by_url($redir_url);
}
 
// setup some stuff based on the url passed
if(!empty($phorum_search)){
 
$PHORUM["DATA"]["SEARCH"]["safe_search"] = htmlspecialchars($phorum_search);
 
include_once("./include/format_functions.php");
 
$offset = (empty($PHORUM["args"]["page"])) ? 0 : $PHORUM["args"]["page"]-1;
 
if(empty($PHORUM["list_length"])) $PHORUM["list_length"]=30;
 
$start = ($offset * $PHORUM["list_length"]);
 
settype($PHORUM["args"]["match_dates"], "int");
 
$arr = phorum_db_search($phorum_search, $offset, $PHORUM["list_length"], $PHORUM["args"]["match_type"], $PHORUM["args"]["match_dates"], $PHORUM["args"]["match_forum"]);
 
if(count($arr["rows"])){
 
$match_number = $start + 1;
 
$forums = phorum_db_get_forums();
 
// For announcements, we will put the current forum_id in the record.
// Else the message cannot be read (Phorum will redirect the user
// back to the index page if the forum id is zero). If the user came
// from the index page, no forum id will be set. In that case we
// use the first available forum id.
$announcement_forum_id = 0;
if ($PHORUM["forum_id"]) {
$announcement_forum_id = $PHORUM["forum_id"];
} elseif (count($forums)) {
list ($f_id, $_data) = each($forums);
$announcement_forum_id = $f_id;
}
 
foreach($arr["rows"] as $key => $row){
$arr["rows"][$key]["number"] = $match_number;
 
// Fake a forum_id for folders.
if ($row["forum_id"] == 0) {
$row["forum_id"] = $announcement_forum_id;
}
 
$arr["rows"][$key]["url"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $row["forum_id"], $row["thread"], $row["message_id"]);
 
// strip HTML & BB Code
$body = phorum_strip_body($arr["rows"][$key]["body"]);
$arr["rows"][$key]["short_body"] = substr($body, 0, 200);
$arr["rows"][$key]["datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
$arr["rows"][$key]["author"] = htmlspecialchars($row["author"]);
$arr["rows"][$key]["short_body"] = htmlspecialchars($arr["rows"][$key]["short_body"]);
 
$forum_ids[$row["forum_id"]] = $row["forum_id"];
 
$match_number++;
}
 
foreach($arr["rows"] as $key => $row){
// Skip announcements "forum".
if ($row["forum_id"] == 0) continue;
 
$arr["rows"][$key]["forum_url"] = phorum_get_url(PHORUM_LIST_URL, $row["forum_id"]);
 
$arr["rows"][$key]["forum_name"] = $forums[$row["forum_id"]]["name"];
}
 
$PHORUM["DATA"]["RANGE_START"] = $start + 1;
$PHORUM["DATA"]["RANGE_END"] = $start + count($arr["rows"]);
$PHORUM["DATA"]["TOTAL"] = $arr["count"];
$PHORUM["DATA"]["SEARCH"]["showresults"] = true;
// figure out paging
$pages = ceil($arr["count"] / $PHORUM["list_length"]);
$page = $offset + 1;
 
if ($pages <= 5){
$page_start = 1;
}elseif ($pages - $page < 2){
$page_start = $pages-4;
}elseif ($pages > 5 && $page > 3){
$page_start = $page-2;
}else{
$page_start = 1;
}
 
$pageno = 1;
for($x = 0;$x < 5 && $x < $pages;$x++){
$pageno = $x + $page_start;
$PHORUM["DATA"]["PAGES"][] = array("pageno" => $pageno,
"url" => phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($phorum_search), "page=$pageno", "match_type={$PHORUM['args']['match_type']}", "match_dates={$PHORUM['args']['match_dates']}", "match_forum={$PHORUM['args']['match_forum']}")
);
}
 
$PHORUM["DATA"]["CURRENTPAGE"] = $page;
$PHORUM["DATA"]["TOTALPAGES"] = $pages;
 
if ($page_start > 1){
$PHORUM["DATA"]["URL"]["FIRSTPAGE"] = phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($phorum_search), "page=1", "match_type={$PHORUM['args']['match_type']}", "match_dates={$PHORUM['args']['match_dates']}", "match_forum={$PHORUM['args']['match_forum']}");
}
 
if ($pageno < $pages){
$PHORUM["DATA"]["URL"]["LASTPAGE"] = phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($phorum_search), "page=$pages", "match_type={$PHORUM['args']['match_type']}", "match_dates={$PHORUM['args']['match_dates']}", "match_forum={$PHORUM['args']['match_forum']}");
}
 
if ($pages > $page){
$nextpage = $page + 1;
$PHORUM["DATA"]["URL"]["NEXTPAGE"] = phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($phorum_search), "page=$nextpage", "match_type={$PHORUM['args']['match_type']}", "match_dates={$PHORUM['args']['match_dates']}", "match_forum={$PHORUM['args']['match_forum']}");
}
if ($page > 1){
$prevpage = $page-1;
$PHORUM["DATA"]["URL"]["PREVPAGE"] = phorum_get_url(PHORUM_SEARCH_URL, "search=" . urlencode($phorum_search), "page=$prevpage", "match_type={$PHORUM['args']['match_type']}", "match_dates={$PHORUM['args']['match_dates']}", "match_forum={$PHORUM['args']['match_forum']}");
}
 
 
 
$arr["rows"] = phorum_hook("search", $arr["rows"]);
$arr["rows"] = phorum_format_messages($arr["rows"]);
$PHORUM["DATA"]["MATCHES"] = $arr["rows"];
 
}else{
$PHORUM["DATA"]["SEARCH"]["noresults"] = true;
$PHORUM["DATA"]["FOCUS_TO_ID"] = 'phorum_search_message';
}
} else {
// Set cursor focus to message search entry.
$PHORUM["DATA"]["FOCUS_TO_ID"] = 'phorum_search_message';
}
 
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url(PHORUM_SEARCH_ACTION_URL);
$PHORUM["DATA"]["SEARCH"]["forum_id"] = $PHORUM["forum_id"];
$PHORUM["DATA"]["SEARCH"]["match_type"] = $PHORUM["args"]["match_type"];
$PHORUM["DATA"]["SEARCH"]["match_dates"] = $PHORUM["args"]["match_dates"];
$PHORUM["DATA"]["SEARCH"]["match_forum"] = $PHORUM["args"]["match_forum"];
$PHORUM["DATA"]["SEARCH"]["allow_match_one_forum"] = $PHORUM["forum_id"];
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("search");
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/rss.php
New file
0,0 → 1,176
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
// July 19 Fixed by Dagon, Date format and Location default //
////////////////////////////////////////////////////////////////////////////////
 
define('phorum_page', 'rss');
 
include_once("./common.php");
include_once("./include/format_functions.php");
 
// check this forum allows RSS
if(!$PHORUM['use_rss']){
exit();
}
 
$cache_key = $_SERVER["QUERY_STRING"].",".$PHORUM["user"]["user_id"];
$data = phorum_cache_get("rss", $cache_key);
 
if(empty($data)){
 
if($PHORUM["forum_id"]==$PHORUM["vroot"]){
$forums = phorum_db_get_forums(0, -1, $PHORUM["vroot"]);
$forum_ids = array_keys($forums);
} elseif($PHORUM["folder_flag"] && $PHORUM["vroot"]==0 && $PHORUM["forum_id"]!=0){
// we don't support rss for normal folders
exit();
} else {
$forum_ids = $PHORUM["forum_id"];
$forums = phorum_db_get_forums($PHORUM["forum_id"]);
}
// find default forum for announcements
foreach($forums as $forum_id=>$forum){
if($forum["folder_flag"]){
unset($forums[$forum_id]);
} elseif(empty($default_forum_id)) {
$default_forum_id = $forum_id;
}
}
$PHORUM["threaded_list"]=false;
$PHORUM["float_to_top"]=false;
// get the thread set started
$rows = array();
$thread = (isset($PHORUM["args"][1])) ? (int)$PHORUM["args"][1] : 0;
 
$rows = phorum_db_get_recent_messages(30, $forum_ids, $thread);
unset($rows["users"]);
$items = array();
$pub_date=0;
foreach($rows as $key => $row){
if(!$PHORUM["forum_id"]){
$row["subject"]="[".$forums[$row["forum_id"]]["name"]."] ".$row["subject"];
}
$forum_id = ($row["forum_id"]==0) ? $default_forum_id : $row["forum_id"];
$items[]=array(
"pub_date" => date("r",$row["datestamp"]),
"url" => phorum_get_url(PHORUM_FOREIGN_READ_URL, $forum_id, $row["thread"], $row["message_id"]),
"headline" => $row["subject"],
"description" => strip_tags($row["body"]),
"author" => $row["author"],
"category" => $forums[$row["forum_id"]]["name"]
);
$pub_date = max($row["datestamp"], $pub_date);
}
if (!$PHORUM['locale']) $PHORUM['locale'] ="en"; //if locale not set make it 'en'
if($PHORUM["forum_id"]){
$url = phorum_get_url(PHORUM_LIST_URL);
$name = $PHORUM["name"];
$description = strip_tags($PHORUM["description"]);
} else {
$url = phorum_get_url(PHORUM_INDEX_URL);
$name = $PHORUM["title"];
$description = "";
}
$channel = array(
"name" => $name,
"url" => $url,
"description" => $description,
"pub_date" => date("r",$pub_date),
"language" => $PHORUM['locale']
);
$data = create_rss_feed($channel, $items);
 
}
 
$charset = '';
if (! empty($GLOBALS["PHORUM"]["DATA"]["CHARSET"])) {
$charset = '; charset=' . htmlspecialchars($GLOBALS["PHORUM"]["DATA"]['CHARSET']);
}
header("Content-Type: text/xml$charset");
 
echo $data;
 
phorum_cache_put("rss", $cache_key, $data, 300);
 
/*******************************************************/
 
function create_rss_feed($channel, $items)
{
 
if(empty($items)){
return;
}
 
$encoding = '';
if (! empty($GLOBALS["PHORUM"]["DATA"]["CHARSET"])) {
$encoding = 'encoding="' . htmlspecialchars($GLOBALS["PHORUM"]["DATA"]['CHARSET']) . '"';
}
 
$data ="<?xml version=\"1.0\" $encoding ?>\n";
$data.="<rss version=\"2.0\">\n";
$data.=" <channel>\n";
$data.=" <title>".htmlspecialchars(strip_tags($channel["name"]))."</title>\n";
$data.=" <link>$channel[url]</link>\n";
$data.=" <description><![CDATA[$channel[description]]]></description>\n";
$data.=" <language>$channel[language]</language>\n";
 
$data.=" <pubDate>$channel[pub_date]</pubDate>\n";
$data.=" <lastBuildDate>$channel[pub_date]</lastBuildDate>\n";
$data.=" <category>".htmlspecialchars(strip_tags($channel["name"]))."</category>\n";
$data.=" <generator>Phorum ".PHORUM."</generator>\n";
 
$data.=" <ttl>600</ttl>\n";
 
foreach($items as $item){
$data.=" <item>\n";
$data.=" <title>".htmlspecialchars($item['headline'])."</title>\n";
$data.=" <link>$item[url]</link>\n";
$data.=" <author>".htmlspecialchars($item['author'])."</author>\n";
$data.=" <description><![CDATA[".htmlspecialchars($item['description'])."]]></description>\n";
$data.=" <category>".htmlspecialchars(strip_tags($item['category']))."</category>\n";
$data.=" <guid isPermaLink=\"true\">$item[url]</guid>\n";
$data.=" <pubDate>$item[pub_date]</pubDate>\n";
$data.=" </item>\n";
}
 
$data.=" </channel>\n";
$data.="</rss>\n";
 
return $data;
 
}
 
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/index.php
New file
0,0 → 1,64
<?php
 
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
///////////////////////////////////////////////////////////////////////////////
define('phorum_page','index');
 
include_once( "./common.php" );
 
include_once( "./include/format_functions.php" );
 
if(!phorum_check_read_common()) {
return;
}
 
// check for markread
if (!empty($PHORUM["args"][1]) && $PHORUM["args"][1] == 'markread'){
// setting all posts read
if(isset($PHORUM["forum_id"])){
unset($PHORUM['user']['newinfo']);
phorum_db_newflag_allread($PHORUM["forum_id"]);
}
 
// redirect to a fresh list without markread in url
$dest_url = phorum_get_url(PHORUM_INDEX_URL);
phorum_redirect_by_url($dest_url);
exit();
 
}
 
// somehow we got to a forum in index.php
if(!empty($PHORUM["forum_id"]) && $PHORUM["folder_flag"]==0){
$dest_url = phorum_get_url(PHORUM_LIST_URL);
phorum_redirect_by_url($dest_url);
exit();
}
 
if ( isset( $PHORUM["forum_id"] ) ) {
$parent_id = (int)$PHORUM["forum_id"];
} else {
$parent_id = 0;
}
 
 
if($PHORUM["use_new_folder_style"]){
include_once "./include/index_new.php";
} else {
include_once "./include/index_classic.php";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/footer.tpl
New file
0,0 → 1,3
</div>
</body>
</html>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/settings.tpl
New file
0,0 → 1,84
{! --- defines are used by the engine and vars are used by the template --- }
 
{! --- This is used to indent messages in threaded view --- }
{define indentstring &nbsp;&nbsp;&nbsp;}
 
{! --- This is used to load the message-bodies in the message-list for that template if set to 1 --- }
{define bodies_in_list 1}
 
{! --- This is used to load all the message-bodies in the read-message-view also in threaded-view for that template if set to 1 --- }
{define all_bodies_in_threaded_read 0}
 
{! --- This is the marker for messages in threaded view --- }
{define marker <img src="templates/default/images/carat.gif" border="0" width="8" height="8" alt="" style="vertical-align: middle;" />&nbsp;}
 
{! --- these are the colors used in the style sheet --- }
 
{! --- you can use them or replace them in the style sheet --- }
 
 
 
{! --- common body-colors --- }
{var bodybackground White}
{var defaulttextcolor Black}
{var backcolor White}
{var forumwidth 100%}
{var forumalign center}
{var newflagcolor #CC0000}
{var errorfontcolor Red}
 
 
{! --- for the forum-list ... alternating colors --- }
{var altbackcolor #EEEEEE}
{var altlisttextcolor #000000}
 
{! --- common link-settings --- }
{var linkcolor #000099}
{var activelinkcolor #FF6600}
{var visitedlinkcolor #000099}
{var hoverlinkcolor #FF6600}
 
{! --- for the Navigation --- }
{var navbackcolor #EEEEEE}
{var navtextcolor #000000}
{var navhoverbackcolor #FFFFFF}
{var navhoverlinkcolor #FF6600}
{var navtextweight normal}
{var navfont Lucida Sans Unicode, Lucida Grande, Arial}
{var navfontsize 12px}
 
{! --- for the PhorumHead ... the list-header --- }
{var headerbackcolor #EEEEEE}
{var headertextcolor #000000}
{var headertextweight bold}
{var headerfont Lucida Sans Unicode, Lucida Grande, Arial}
{var headerfontsize 12px}
 
 
 
{var tablebordercolor #808080}
 
{var listlinecolor #F2F2F2}
 
{var listpagelinkcolor #707070}
{var listmodlinkcolor #707070}
 
 
 
 
 
{! --- You can set the table width globaly here ... ONLY tables, no divs are changed--- }
{var tablewidth 100%}
{var narrowtablewidth 600px}
 
 
 
{! --- Some font stuff --- }
{var defaultfont Lucida Sans Unicode, Lucida Grande, Arial}
{var largefont Trebuchet MS,Verdana, Arial, Helvetica, sans-serif}
{var tinyfont Arial, Helvetica, sans-serif}
{var fixedfont Lucida Console, Andale Mono, Courier New, Courier}
{var defaultfontsize 12px}
{var largefontsize 16px}
{var smallfontsize 11px}
{var tinyfontsize 10px}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/profile.tpl
New file
0,0 → 1,19
<h3>{PROFILE->username}</h3>
<table cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->Email}:&nbsp;</td>
<td>{PROFILE->email}</td>
</tr>
{IF PROFILE->real_name}
<tr>
<td nowrap="nowrap">{LANG->RealName}:&nbsp;</td>
<td>{PROFILE->real_name}</td>
</tr>
{/IF}
{IF PROFILE->date_added}
<tr>
<td nowrap="nowrap">{LANG->DateReg}:&nbsp;</td>
<td>{PROFILE->date_added}</td>
</tr>
{/IF}
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting_buttons.tpl
New file
0,0 → 1,12
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: right; border-top: none">
{HOOK tpl_editor_buttons}
 
<input type="submit" name="preview"
class="PhorumSubmit" value=" {LANG->Preview} " />
<input type="submit" name="finish"
class="PhorumSubmit" value=" {POST->submitbutton_text} " />
{IF SHOW_CANCEL_BUTTON}
<input type="submit" name="cancel" onclick="return confirm('{LANG->CancelConfirm}')"
class="PhorumSubmit" value=" {LANG->Cancel} " />
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/search.tpl
New file
0,0 → 1,31
{IF SEARCH->noresults}
<h3>{LANG->NoResults}</h3>
{/IF}
 
{IF SEARCH->showresults}
 
 
<h3>{LANG->Results} {RANGE_START} - {RANGE_END} {LANG->of} {TOTAL}</h3>
<hr />
{LOOP MATCHES}
 
<div class="match">
<h1>{MATCHES->number}.&nbsp;<a href="{MATCHES->url}">{MATCHES->subject}</a></h1>
<p>{MATCHES->short_body}</p>
<small>Post by {MATCHES->author} on {MATCHES->datestamp}&nbsp;&nbsp;|&nbsp;&nbsp;<a href="{MATCHES->url}"><?php echo $PHORUM["TMP"]["MATCHES"]["thread_count"]-1; ?> comment(s)</a></small>
</div>
<hr />
{/LOOP MATCHES}
 
{IF PAGES}
<br /><br /><strong>{LANG->CurrentPage}:</strong>{CURRENTPAGE} {LANG->of} {TOTALPAGES}&nbsp;&nbsp;&nbsp;
<strong>{LANG->Pages}:</strong>&nbsp;
{IF URL->PREVPAGE}<a class="PhorumNavLink" href="{URL->PREVPAGE}">{LANG->PrevPage}</a>{/IF}
{IF URL->FIRSTPAGE}<a class="PhorumNavLink" href="{URL->FIRSTPAGE}">{LANG->FirstPage}...</a>{/IF}
{LOOP PAGES}<a class="PhorumNavLink" href="{PAGES->url}">{PAGES->pageno}</a>{/LOOP PAGES}
{IF URL->LASTPAGE}<a class="PhorumNavLink" href="{URL->LASTPAGE}">...{LANG->LastPage}</a>{/IF}
{IF URL->NEXTPAGE}<a class="PhorumNavLink" href="{URL->NEXTPAGE}">{LANG->NextPage}</a>{/IF}
<br />
{/IF}
 
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/login.tpl
New file
0,0 → 1,33
{IF ERROR}
<h4>{ERROR}</h4>
{/IF}
 
<form id="login-form" action="{URL->ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="forum_id" value="{LOGIN->forum_id}" />
<input type="hidden" name="redir" value="{LOGIN->redir}" />
<table cellspacing="0">
<tr>
<td>{LANG->Username}:&nbsp;</td>
<td><input type="text" name="username" size="30" value="{LOGIN->username}" /></td>
</tr>
<tr>
<td>{LANG->Password}:&nbsp;</td>
<td><input type="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" class="PhorumSubmit" value="{LANG->Submit}" /></td>
</tr>
</table>
<br /><a href="{URL->REGISTER}">{LANG->NotRegistered}</a>
</form>
<br /><br />
<form id="lostpass-form" action="{URL->ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="lostpass" value="1" />
<input type="hidden" name="forum_id" value="{LOGIN->forum_id}" />
<input type="hidden" name="redir" value="{LOGIN->redir}" />
<h2>{LANG->LostPassword}</h2>
{LANG->LostPassInfo}<br />
<input type="text" name="lostpass" size="30" value="" /> <input type="submit" class="PhorumSubmit" value="{LANG->Submit}" />
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting_attachments_list.tpl
New file
0,0 → 1,22
<b>{LANG->Attachments}:</b>
<table id="phorum-attachment-list" class="PhorumFormTable" cellspacing="0" width="100%">
 
<?php $alt = "Alt"; ?>
{ASSIGN LIST POST->attachments}
{LOOP LIST}
<?php $alt = $alt == "" ? "Alt" : "" ;?>
{IF LIST->keep}
<tr>
<td>
{LIST->name} ({LIST->size})
</td>
<td align="right">
{HOOK tpl_editor_attachment_buttons LIST}
<input type="submit" name="detach:{LIST->file_id}"
value="{LANG->Detach}" class="PhorumSubmit" />
</td>
</tr>
{/IF}
{/LOOP LIST}
 
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting_messageform.tpl
New file
0,0 → 1,76
<table id="post" cellspacing="0" border="0">
 
{! A submit button that will be used to catch users pressing enter }
<script type="text/javascript">
document.write('<input type="submit" name="ignore" style="display:none">');
</script>
 
{! Author =================================================================== }
 
<tr>
<td style="white-space: nowrap">{LANG->YourName}:&nbsp;</td>
<td width="100%">
{! Editing a message }
{IF POST->message_id}
{IF POST->user_id}
{POST->author}
{ELSE}
{IF MODERATOR}
<input type="text" name="author" size="30" value="{POST->author}" />
{ELSE}
<?php print $PHORUM["user"]["username"] ?>
{/IF}
{/IF}
{! Writing a new message }
{ELSE}
{IF LOGGEDIN}
<?php print $PHORUM["user"]["username"] ?>
{ELSE}
<input type="text" name="author" size="30" value="{POST->author}" />
{/IF}
{/IF}
</td>
</tr>
 
{! Subject ================================================================== }
 
<tr>
<td style="white-space: nowrap">{LANG->Subject}:&nbsp;</td>
<td>
<input type="text" name="subject" id="phorum_subject" size="50" value="{POST->subject}" />
</td>
</tr>
 
{HOOK tpl_editor_after_subject}
 
{IF POST->user_id}
<tr>
<td></td>
<td>
{IF SHOW_THREADOPTIONS}{IF OPTION_ALLOWED->allow_reply}
<input type="checkbox" name="allow_reply" value="1" {IF POST->allow_reply} checked="checked"{/IF}> {LANG->AllowReplies}<br/>
{/IF}{/IF}
<input type="checkbox" name="email_notify" value="1" {IF POST->email_notify} checked="checked"{/IF} /> {LANG->EmailReplies}<br/>
<input type="checkbox" name="show_signature" value="1" {IF POST->show_signature} checked="checked"{/IF} /> {LANG->AddSig}
</td>
</tr>
{/IF}
 
</table>
 
</div>
 
{! Attachments ============================================================== }
 
{IF ATTACHMENTS}
{include posting_attachments}
{/IF}
 
 
{! Body ===================================================================== }
 
 
{HOOK tpl_editor_before_textarea}
 
<textarea name="body" id="phorum_textarea" rows="15" cols="50">{POST->body}</textarea>
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/list.tpl
New file
0,0 → 1,10
{LOOP ROWS}
{IF NOT ROWS->sort 0} {! Skip announcements }
<div class="entry">
<h1>{ROWS->subject}</h1>
<p>{ROWS->body}</p>
<small>Post by {ROWS->linked_author} on {ROWS->datestamp}</small>
<small>{IF MODERATOR true}<a href="<?php echo phorum_get_url(PHORUM_POSTING_URL, "moderation", $PHORUM["TMP"]["ROWS"]["message_id"]);?>">edit</a>&nbsp;|&nbsp;{/IF}<a href="{ROWS->url}"><?php echo $PHORUM["TMP"]["ROWS"]["thread_count"]-1; ?> comment(s)</a></small>
</div>
{/IF}
{/LOOP ROWS}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/read.tpl
New file
0,0 → 1,30
<?php $count = 0; ?>
{LOOP MESSAGES}
{IF MESSAGES->parent_id 0}
<div class="entry">
<h1>{MESSAGES->subject}</h1>
<p>{MESSAGES->body}</p>
<small>Post by {MESSAGES->linked_author} on {MESSAGES->datestamp}</small>
<small>{IF MODERATOR true}<a href="{MESSAGES->edit_url}">edit</a>&nbsp;|&nbsp;<a href="{MESSAGES->delete_url2}">delete</a>{/IF}</small>
</div>
<div id="comments">
<h2>Comments</h2>
{ELSE}
<a name="msg-{MESSAGES->message_id}"></a>
<?php
$class = ($count%2==0) ? "comment-alt" : "";
$count++;
?>
<div class="comment <?php echo $class;?>">
<h1>{MESSAGES->subject}</h1>
<p>{MESSAGES->body}</p>
<small>Post by {MESSAGES->linked_author} on {MESSAGES->datestamp}</small>
{IF MODERATOR true}<small><a href="{MESSAGES->edit_url}">edit</a>&nbsp;|&nbsp;<a href="{MESSAGES->delete_url1}">delete</a></small>{/IF}
</div>
 
{/IF}
 
{/LOOP MESSAGES}
</div>
 
<h3>Post A Comment</h3>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/cc_index.tpl
New file
0,0 → 1,68
{IF ERROR}
<h4>{ERROR}</h4>
{/IF}
 
<h2>{LANG->PersProfile}</h2>
 
<form id="profile-form" action="{URL->ACTION}" method="POST">
{POST_VARS}
<input type="hidden" name="panel" value="email" />
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<table class="PhorumFormTable" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->RealName}:&nbsp;</td>
<td><input type="text" name="real_name" size="30" value="{PROFILE->real_name}" /></td>
</tr>
<tr>
<td valign="top">{LANG->Email}*:&nbsp;{if PROFILE->EMAIL_CONFIRM}<br />{LANG->EmailConfirmRequired}{/if}</td>
<td><input type="text" name="email" size="30" value="{PROFILE->email}" /></td>
</tr>
{IF PROFILE->email_temp_part}
<tr>
<td valign="top">{LANG->EmailVerify}:&nbsp;</td>
<td>{LANG->EmailVerifyDesc} {PROFILE->email_temp_part}<br>
{LANG->EmailVerifyEnterCode}: <input type="text" name="email_verify_code" value="" />
</td>
</tr>
{/IF}
<tr>
<td colspan="2"><input type="checkbox" name="hide_email" value="1"{IF PROFILE->hide_email 1}{ELSE} checked="checked"{/IF} /> {LANG->AllowSeeEmail}</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap">{LANG->Signature}:&nbsp;</td>
<td width="100%"><textarea name="signature" rows="15" cols="50">{PROFILE->signature}</textarea></td>
</tr>
</table>
<input type="submit" value="{LANG->Submit}" />
</form>
<br />
<br />
<br />
<h2>{LANG->ChangePassword}</h2>
 
<form id="profile-form" action="{URL->ACTION}" method="POST">
{POST_VARS}
<input type="hidden" name="panel" value="password" />
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<table class="PhorumFormTable" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->Password}:&nbsp;</td>
<td><input type="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td nowrap="nowrap">&nbsp;</td>
<td><input type="password" name="password2" size="30" value="" /> ({LANG->again})</td>
</tr>
</table>
*{LANG->Required}<br /><br />
<input type="submit" value="{LANG->Submit}" />
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting_attachments.tpl
New file
0,0 → 1,38
<div class="PhorumStdBlockHeader PhorumNarrowBlock">
 
{IF POST->attachments}
{include posting_attachments_list}
 
{ASSIGN AttachPhrase LANG->AttachAnotherFile}
 
{ELSE}
{ASSIGN AttachPhrase LANG->AttachAFile}
{/IF}
 
{IF ATTACHMENTS_FULL}
<b>{LANG->AttachFull}</b>
{ELSE}
<script type="text/javascript">
function phorumShowAttachForm() {
document.getElementById('phorum-attach-link').style.display='none';
document.getElementById('phorum-attach-form').style.display='block';
}
document.write("<div id=\"phorum-attach-link\" style=\"display: block;\"><a href=\"javascript:phorumShowAttachForm();\"><b>{AttachPhrase} ...</b></a></div>\n");
document.write("<div id=\"phorum-attach-form\" style=\"display: none;\">");
</script>
 
<b>{AttachPhrase}</b>
 
<ul>
{IF EXPLAIN_ATTACH_FILE_TYPES}<li>{EXPLAIN_ATTACH_FILE_TYPES}{/IF}
{IF EXPLAIN_ATTACH_FILE_SIZE}<li>{EXPLAIN_ATTACH_FILE_SIZE}{/IF}
{IF EXPLAIN_ATTACH_TOTALFILE_SIZE}<li>{EXPLAIN_ATTACH_TOTALFILE_SIZE}{/IF}
{IF EXPLAIN_ATTACH_MAX_ATTACHMENTS}<li>{EXPLAIN_ATTACH_MAX_ATTACHMENTS}{/IF}
</ul>
 
<input type="file" size="50" name="attachment" />
<input type="submit" name="attach" value="{LANG->Attach}" />
<script type="text/javascript">document.write('</div>');</script>
{/IF}
 
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/info.php
New file
0,0 → 1,9
<?php
if(!defined("PHORUM")) return;
 
$name="PhorumBlog Template";
$version="0.1";
 
// uncomment this to hide this template from the user-select-box
//$template_hide=1;
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting.tpl
New file
0,0 → 1,20
<div id="phorum-post-form" align="center">
 
{IF ERROR}<div class="PhorumUserError">{ERROR}</div>{/IF}
{IF OKMSG}<div class="PhorumOkMsg">{OKMSG}</div>{/IF}
 
{IF PREVIEW}
{include posting_preview}
{/IF}
 
<form id="post_form" name="post" action="{URL->ACTION}" method="post"
enctype="multipart/form-data">
{POST_VARS}
 
{include posting_messageform}
 
{include posting_buttons}
 
</form>
 
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/register.tpl
New file
0,0 → 1,31
{IF ERROR}
<h4>{ERROR}</h4>
{/IF}
 
<h2>Register</h2>
 
<form id="register-form" action="{URL->ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="forum_id" value="{REGISTER->forum_id}" />
<table cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->Username}*:&nbsp;</td>
<td><input type="text" name="username" size="30" value="{REGISTER->username}" /></td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->Email}*:&nbsp;</td>
<td><input type="text" name="email" size="30" value="{REGISTER->email}" /></td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->Password}*:&nbsp;</td>
<td><input type="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td nowrap="nowrap">&nbsp;</td>
<td><input type="password" name="password2" size="30" value="" /> ({LANG->again})</td>
</tr>
</table>
<br />
*{LANG->Required}<br /><br />
<input type="submit" value="{LANG->Submit}" />
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/message.tpl
New file
0,0 → 1,11
{IF ERROR}
<h4>{ERROR}</h4>
{/IF}
 
{IF MESSAGE}
<p>{MESSAGE}</p>
{/IF}
 
{IF URL->REDIRECT}
<a href="{URL->REDIRECT}">{BACKMSG}</a>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/posting_preview.tpl
New file
0,0 → 1,6
<div class="entry" align="left">
<h1>{PREVIEW->subject}</h1>
<p>{PREVIEW->body}</p>
<small>Post by {PREVIEW->author} on {PREVIEW->datestamp}</small>
</div>
<br />
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/css.tpl
New file
0,0 → 1,147
body {
margin: 10px;
font-family: Trebuchet MS, Arial, Helvetica;
font-size: 13px;
}
 
h4 {
color: red;
}
 
#right-column {
float: right;
width: 200px;
padding: 0 10px 0 10px;
border-left: 1px solid Gray;
}
 
#right-column h1 {
color: Gray;
margin: 0 0 40px 0;
font-size: 18px;
}
 
#right-column ul {
padding: 0;
margin: 0 0 10px 0;
list-style: none;
}
 
#left-column {
margin-right: 220px;
padding-right: 11px;
border-right: 1px solid Gray;
}
 
#title {
margin-bottom: 55px;
}
 
#title a, #title a:visited {
text-decoration: none;
color: black;
}
 
.entry {
margin-bottom: 25px;
border-bottom: 1px solid Gray;
padding-bottom: 25px;
}
 
.entry p {
font-size: 16px;
font-family: Georgia;
line-height: 125%;
margin-left: 5px;
}
 
.entry h1 {
margin: 0 0 5px 0;
font-family: Arial;
font-size: 20px;
}
 
.entry small {
display: block;
font-size: 10px;
font-family: Verdana, Arial, Helvetica;
margin-top: 6px;
}
 
.match p {
font-size: 12px;
font-family: Arial;
margin-left: 5px;
padding: 0;
}
 
.match h1 {
margin: 0;
padding: 0;
font-family: Arial;
font-size: 13px;
font-weight: bold;
}
 
.match h1 a, .match h1 a:visited {
colot: blue;
}
 
.match small {
display: block;
font-size: 10px;
font-family: Verdana, Arial, Helvetica;
}
 
 
#comments {
border-top: 1px solid Gray;
border-bottom: 1px solid Gray;
margin: 25px 0 25px 0;
padding: 0px 0 20px 0;
}
 
.comment {
padding: 8px;
}
 
.comment-alt {
background-color: #F0F0F0;
}
 
.comment p {
font-size: 13px;
font-family: Arial, Helvetica;
line-height: 110%;
margin-left: 5px;
}
 
.comment h1 {
margin: 0 0 5px 0;
font-family: Arial;
font-size: 16px;
}
 
.comment small {
display: block;
font-size: 10px;
font-family: Verdana, Arial, Helvetica;
margin-top: 6px;
}
 
#search-form #search {
width: 120px;
}
 
#post {
margin: 5px 10px 0 10px;
}
 
#post td {
padding: 3px;
}
 
#post-body {
width: 99%;
margin: 0 10px 0 10px;
}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/header.tpl
New file
0,0 → 1,62
<?php echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html lang="<?php echo $PHORUM['locale']; ?>">
<head>
<title>{HTML_TITLE}</title>
<style type="text/css">
{include css}
</style>
{IF URL->RSS}<link rel="alternate" type="application/rss+xml" title="RSS-File" href="{URL->RSS}" />{/IF}
{if URL->REDIRECT}
<meta http-equiv="refresh" content="{IF REDIRECT_TIME}{REDIRECT_TIME}{ELSE}5{/IF}; url={URL->REDIRECT}" />
{/if}
{LANG_META}
{HEAD_TAGS}
</head>
<body>
 
<div id="right-column">
 
<h1>The Phorum Blog Template</h1>
Search:<br />
<form id="search-form" action="<?php echo phorum_get_url(PHORUM_SEARCH_ACTION_URL); ?>" method="get" >
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<input type="hidden" name="match_type" value="ALL" />
<input type="hidden" name="match_dates" value="30" />
<input type="hidden" name="match_forum" value="ALL" />
<input type="hidden" name="body" value="1" />
<input type="hidden" name="author" value="0" />
<input type="hidden" name="subject" value="1" />
<input id="search" name="search" type="text" />&nbsp;<input type="submit" value="{LANG->Search}" />
</form>
 
<ul>
<li><a href="{URL->TOP}">Home</a></li>
</ul>
 
<ul>
{IF LOGGEDIN true}
<?php if (phorum_user_access_allowed(PHORUM_USER_ALLOW_NEW_TOPIC)) { ?>
<li><a href="{URL->POST}">New Post</a></li>
<?php } ?>
<li><a href="{URL->REGISTERPROFILE}">My Profile</a></li>
<li><a href="{URL->LOGINOUT}">Logout</a></li>
{ELSE}
<li><a href="{URL->LOGINOUT}">Login</a></li>
<li><a href="{URL->REGISTER}">Register</a></li>
{/IF}
</ul>
 
<ul>
<li><a href="http://phorum.org/">Phorum Home Page</a></li>
<li><a href="http://phorum.org/phorum5/">Phorum 5 Support</a></li>
<li><a href="http://phorum.org/cgi-bin/trac.cgi/report">Report Bugs</a></li>
</ul>
 
{IF URL->RSS}<a href="{URL->RSS}"><img src="/images/rss20.gif" width="80" height="15" border="0" alt="RSS 2.0" /></a>{/IF}
 
</div>
<div id="left-column">
<h1 id="title"><a href="{URL->TOP}">{NAME}</a></h1>
<p>You should read the docs about setting up the blog template before making it live. Its in the docs dir in the distro called blog_howto.txt. You can remove this comment after that.</p>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/blog/move_form.tpl
New file
0,0 → 1,29
<div align="center">
 
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>{if LOGGEDIN true}&bull;<a class="PhorumNavLink" href="{URL->REGISTERPROFILE}">{LANG->MyProfile}</a>{IF ENABLE_PM}&bull;<a class="PhorumNavLink" href="{URL->PM}">{LANG->PrivateMessages}</a>{/IF}&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{/if}{if LOGGEDIN false}&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/if}</a>
</div>
 
<form method="POST" action="{URL->ACTION}">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORM->forum_id}" />
<input type="hidden" name="thread" value="{FORM->thread_id}" />
<input type="hidden" name="mod_step" value="{FORM->mod_step}" />
 
<div class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><span class="PhorumHeadingLeft">{LANG->MoveThread}</span></div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->MoveThreadTo}:<br />
<select name="moveto">
<option value="0">{LANG->SelectForum}</option>
{LOOP FORUMS}
<option value="{FORUMS->forum_id}">{FORUMS->name}</option>
{/LOOP FORUMS}
</select>
<input type="submit" class="PhorumSubmit" name="move" value="{LANG->MoveThread}" />
</div>
</div>
 
</form>
 
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/delete.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/delete.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/square_bullet.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/square_bullet.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/gauge.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/gauge.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/carat.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/carat.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/logo.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/images/logo.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_menu.tpl
New file
0,0 → 1,3
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_read.tpl
New file
0,0 → 1,41
<form action="{ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="action" value="list" />
<input type="hidden" name="folder_id" value="{FOLDER_ID}" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<input type="hidden" name="pm_id" value="{MESSAGE->pm_message_id}" />
<div class="PhorumStdBlock">
<div class="PhorumReadBodySubject">{MESSAGE->subject}</div>
<div class="PhorumReadBodyHead">{LANG->From}: <strong><a href="{MESSAGE->from_profile_url}">{MESSAGE->from_username}</a></strong></div>
<div class="PhorumReadBodyHead">
{LANG->To}:
{ASSIGN ISFIRST true}
{LOOP MESSAGE->recipients}
<div style="display:inline; white-space: nowrap">
{IF NOT ISFIRST} / {/IF}
<strong><a href="{MESSAGE->recipients->to_profile_url}">{MESSAGE->recipients->username}</a></strong>
{IF USERINFO->user_id MESSAGE->from_user_id}
{IF NOT MESSAGE->recipients->read_flag}({LANG->PMUnread}){/IF}
{/IF}
{ASSIGN ISFIRST false}
</div>
{/LOOP MESSAGE->recipients}
</div>
<div class="PhorumReadBodyHead">{LANG->Date}: {MESSAGE->date}</div><br />
<div class="PhorumReadBodyText">{MESSAGE->message}</div><br />
</div>
<div class="PhorumStdBlock" style="border-top:none">
{IF FOLDER_IS_INCOMING}
{VAR MOVE_SUBMIT_NAME move_message}
{INCLUDE pm_moveselect}
{/IF}
<input type="submit" name="close_message" class="PhorumSubmit" value="{LANG->PMCloseMessage}" />
{IF NOT MESSAGE->from_user_id USERINFO->user_id}
<input type="submit" name="reply" class="PhorumSubmit" value="{LANG->PMReply}" />
{IF NOT MESSAGE->recipient_count 1}
<input type="submit" name="reply_to_all" class="PhorumSubmit" value="{LANG->PMReplyToAll}" />
{/IF}
{/IF}
<input type="submit" name="delete_message" class="PhorumSubmit" value="{LANG->Delete}" onclick="return confirm('<?php echo addslashes($PHORUM['DATA']['LANG']['AreYouSure'])?>')" />
</div>
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/login.tpl
New file
0,0 → 1,54
<div align="center">
{IF ERROR}<div class="PhorumUserError">{ERROR}</div>{/IF}
{IF OKMSG}<div class="PhorumOkMsg">{OKMSG}</div>{/IF}
<div align="center" class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>
</div>
<form action="{URL->ACTION}" method="post" style="display: inline;">
{POST_VARS}
<input type="hidden" name="forum_id" value="{LOGIN->forum_id}" />
<input type="hidden" name="redir" value="{LOGIN->redir}" />
<div class="PhorumStdBlockHeader PhorumNarrowBlock PhorumHeaderText" style="text-align: left;">{LANG->LoginTitle}</div>
<div align="center" class="PhorumStdBlock PhorumNarrowBlock">
{IF LOGGEDIN}
{IF NOT FULLY_LOGGEDIN}
<div class="PhorumFloatingText" style="text-align:left;">{LANG->PeriodicLogin}<br />&nbsp;</div>
{/IF}
{/IF}
<table cellspacing="0" align="center">
<tr>
<td>{LANG->Username}:&nbsp;</td>
<td><input type="text" id="username" name="username" size="30" value="{LOGIN->username}" /></td>
</tr>
<tr>
<td>{LANG->Password}:&nbsp;</td>
<td><input type="password" id="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" class="PhorumSubmit" value="{LANG->Submit}" /></td>
</tr>
</table>
{IF NOT LOGGEDIN}
<div class="PhorumFloatingText"><a href="{URL->REGISTER}">{LANG->NotRegistered}</a></div>
{ELSE}
<br />
{/IF}
</div>
</form>
<div align="center" style="margin-top: 30px;">
<form action="{URL->ACTION}" method="post" style="display: inline;">
{POST_VARS}
<input type="hidden" name="lostpass" value="1" />
<input type="hidden" name="forum_id" value="{LOGIN->forum_id}" />
<input type="hidden" name="redir" value="{LOGIN->redir}" />
<div class="PhorumStdBlockHeader PhorumNarrowBlock PhorumHeaderText" style="text-align: left;">{LANG->LostPassword}</div>
<div class="PhorumStdBlock PhorumNarrowBlock">
<div class="PhorumFloatingText">{LANG->LostPassInfo}</div>
<div class="PhorumFloatingText">
<input type="text" name="lostpass" size="30" value="" />
<input type="submit" class="PhorumSubmit" value="{LANG->Submit}" />
</div>
</div>
</form>
</div>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/index_classic.tpl
New file
0,0 → 1,27
<div class="PhorumNavBlock">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<div class="PhorumStdBlockHeader PhorumHeaderText">
<div class="PhorumColumnFloatLarge">{LANG->LastPost}</div>
<div class="PhorumColumnFloatSmall">{LANG->Posts}</div>
<div class="PhorumColumnFloatSmall">{LANG->Threads}</div>
<div style="margin-right: 425px">{LANG->Forums}</div>
</div>
 
<?php $rclass="Alt"; ?>
<div class="PhorumStdBlock">
{LOOP FORUMS}
<?php if($rclass=="Alt") $rclass=""; else $rclass="Alt"; ?>
<div class="PhorumRowBlock<?php echo $rclass;?>">
{IF FORUMS->folder_flag}
<div class="PhorumColumnFloatXLarge">{LANG->ForumFolder}</div>
{ELSE}
<div class="PhorumColumnFloatLarge">{FORUMS->last_post}&nbsp;</div>
<div class="PhorumColumnFloatSmall">{FORUMS->message_count}{IF FORUMS->new_messages} (<span class="PhorumNewFlag">{FORUMS->new_messages} {LANG->newflag}</span>){/IF}</div>
<div class="PhorumColumnFloatSmall">{FORUMS->thread_count}{IF FORUMS->new_threads} (<span class="PhorumNewFlag">{FORUMS->new_threads} {LANG->newflag}</span>){/IF}</div>
{/IF}
<div style="margin-right: 425px" class="PhorumLargeFont"><a href="{FORUMS->url}">{FORUMS->name}</a></div>
<div style="margin-right: 425px" class="PhorumFloatingText">{FORUMS->description}</div>
</div>
{/LOOP FORUMS}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_attachments_list.tpl
New file
0,0 → 1,15
<b>{LANG->Attachments}:</b>
<table id="phorum-attachment-list" class="PhorumFormTable" cellspacing="0" width="100%">
{ASSIGN LIST POST->attachments}
{LOOP LIST}
{IF LIST->keep}
<tr>
<td>{LIST->name} ({LIST->size})</td>
<td align="right">
{HOOK tpl_editor_attachment_buttons LIST}
<input type="submit" name="detach:{LIST->file_id}" value="{LANG->Detach}" class="PhorumSubmit" />
</td>
</tr>
{/IF}
{/LOOP LIST}
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_menu.tpl
New file
0,0 → 1,40
<div class="phorum-menu" style="text-align: left;">
{LANG->PersProfile}
<ul>
<li><a {IF PROFILE->PANEL "summary"}class="phorum-current-page" {/IF}href="{URL->CC0}">{LANG->ViewProfile}</a></li>
<li><a {IF PROFILE->PANEL "user"}class="phorum-current-page" {/IF}href="{URL->CC3}">{LANG->EditUserinfo}</a></li>
<li><a {IF PROFILE->PANEL "sig"}class="phorum-current-page" {/IF}href="{URL->CC4}">{LANG->EditSignature}</a></li>
<li><a {IF PROFILE->PANEL "email"}class="phorum-current-page" {/IF}href="{URL->CC5}">{LANG->EditMailsettings}</a></li>
<li><a {IF PROFILE->PANEL "privacy"}class="phorum-current-page" {/IF}href="{URL->CC14}">{LANG->EditPrivacy}</a></li>
<li><a {IF PROFILE->PANEL "groups"}class="phorum-current-page" {/IF}href="{URL->CC16}">{LANG->ViewJoinGroups}</a></li>
</ul>
{LANG->Subscriptions}
<ul>
<li><a {IF PROFILE->PANEL "subthreads"}class="phorum-current-page" {/IF}href="{URL->CC1}">{LANG->ListThreads}</a></li>
</ul>
{LANG->Options}
<ul>
<li><a {IF PROFILE->PANEL "forum"}class="phorum-current-page" {/IF}href="{URL->CC6}">{LANG->EditBoardsettings}</a></li>
<li><a {IF PROFILE->PANEL "password"}class="phorum-current-page" {/IF}href="{URL->CC7}">{LANG->ChangePassword}</a></li>
</ul>
{IF MYFILES}
{LANG->Files}
<ul>
<li><a {IF PROFILE->PANEL "files"}class="phorum-current-page" {/IF}href="{URL->CC9}">{LANG->EditMyFiles}</a></li>
</ul>
{/IF}
{IF MODERATOR}
{LANG->Moderate}
<ul>
{IF MESSAGE_MODERATOR}
<li><a {IF PROFILE->PANEL "messages"}class="phorum-current-page" {/IF}href="{URL->CC8}">{LANG->UnapprovedMessages}</a></li>
{/IF}
{IF USER_MODERATOR}
<li><a {IF PROFILE->PANEL "users"}class="phorum-current-page" {/IF}href="{URL->CC10}">{LANG->UnapprovedUsers}</a></li>
{/IF}
{IF GROUP_MODERATOR}
<li><a {IF PROFILE->PANEL "membership"}class="phorum-current-page" {/IF}href="{URL->CC15}">{LANG->GroupMembership}</a></li>
{/IF}
</ul>
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/list.tpl
New file
0,0 → 1,47
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
{INCLUDE paging}
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
{IF VIEWCOUNT_COLUMN}
<th class="PhorumTableHeader" align="center" width="40">{LANG->Views}</th>
{/IF}
<th class="PhorumTableHeader" align="center" nowrap="nowrap" width="80">{LANG->Posts}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->StartedBy}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->LastPost}&nbsp;</th>
</tr>
<?php $rclass="Alt"; ?>
{LOOP ROWS}
<?php if($rclass=="Alt") $rclass=""; else $rclass="Alt"; ?>
<tr>
<td class="PhorumTableRow<?php echo $rclass;?>">
<?php echo $PHORUM['TMP']['marker'] ?>
{IF ROWS->sort PHORUM_SORT_STICKY}<span class="PhorumListSubjPrefix">{LANG->Sticky}: </span>{/IF}
{IF ROWS->sort PHORUM_SORT_ANNOUNCEMENT}<span class="PhorumListSubjPrefix">{LANG->Announcement}: </span>{/IF}
{IF ROWS->moved}<span class="PhorumListSubjPrefix">{LANG->MovedSubject}: </span>{/IF}
<a href="{ROWS->url}">{ROWS->subject}</a>
{IF ROWS->new}&nbsp;<span class="PhorumNewFlag">{ROWS->new}</span>{/IF}
{IF ROWS->pages}<span class="PhorumListPageLink">&nbsp;&nbsp;&nbsp;{LANG->Pages}: {ROWS->pages}</span>{/IF}
{IF MODERATOR true}<br /><span class="PhorumListModLink"><a href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{ROWS->delete_url2}';">{LANG->DeleteThread}</a>{IF ROWS->move_url}&nbsp;&#8226;&nbsp;<a href="{ROWS->move_url}">{LANG->MoveThread}</a>{/IF}&nbsp;&#8226;&nbsp;<a href="{ROWS->merge_url}">{LANG->MergeThread}</a></span>{/IF}
</td>
{IF VIEWCOUNT_COLUMN}
<td class="PhorumTableRow<?php echo $rclass;?>" align="center">{ROWS->viewcount}&nbsp;</td>
{/IF}
<td class="PhorumTableRow<?php echo $rclass;?>" align="center" nowrap="nowrap">{ROWS->thread_count}&nbsp;</td>
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap">{ROWS->linked_author}&nbsp;</td>
<td class="PhorumTableRow<?php echo $rclass;?> PhorumSmallFont" nowrap="nowrap">
{ROWS->lastpost}&nbsp;<br />
<span class="PhorumListSubText">
<a href="{ROWS->last_post_url}">{LANG->LastPostLink}</a> {LANG->by} {ROWS->last_post_by}
</span>
</td>
</tr>
{/LOOP ROWS}
</table>
{INCLUDE paging}
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Options}:</span>
{IF LOGGEDIN true}&nbsp;<a class="PhorumNavLink" href="{URL->MARKREAD}">{LANG->MarkRead}</a>{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/report.tpl
New file
0,0 → 1,19
{IF ReportPostMessage}
<div class="PhorumUserError">{ReportPostMessage}</div>
{/IF}
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{ELSE}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/IF}
</div>
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->Report}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<strong>{LANG->ConfirmReportMessage}</strong><br /><br />
<div class="PhorumReadBodySubject">{PostSubject}</div>
<div class="PhorumReadBodyHead">{LANG->Postedby}: {PostAuthor}</div>
<div class="PhorumReadBodyHead">{LANG->Date}: {PostDate}</div>
<div class="PhorumReadBodyText">{PostBody}</div><br />
{LANG->ReportPostExplanation}<br />
<form method="post" action="{ReportURL}">
<textarea name="explanation" rows="5" cols="60" wrap="virtual">{explanation}</textarea><br />
<input type="submit" name="report" value="{LANG->Report}" />
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_messageform.tpl
New file
0,0 → 1,116
<div class="PhorumStdBlockHeader PhorumNarrowBlock">
<table class="PhorumFormTable" cellspacing="0" border="0">
{! A submit button that will be used to catch users pressing enter }
<script type="text/javascript">
document.write('<input type="submit" name="ignore" style="display:none">');
</script>
{! Author =================================================================== }
<tr>
<td style="white-space: nowrap">{LANG->YourName}:&nbsp;</td>
<td width="100%">
{IF POST->message_id}
{! Editing a message }
{IF POST->user_id}
{POST->author}
{ELSE}
{IF MODERATOR}
<input type="text" name="author" size="30" value="{POST->author}" />
{ELSE}
<?php echo $PHORUM['user']['username'] ?>
{/IF}
{/IF}
{ELSE}
{! Writing a new message }
{IF LOGGEDIN}
<?php echo $PHORUM['user']['username'] ?>
{ELSE}
<input type="text" name="author" size="30" value="{POST->author}" />
{/IF}
{/IF}
</td>
</tr>
{! Email ==================================================================== }
<tr>
<td style="white-space: nowrap">{LANG->YourEmail}:&nbsp;</td>
<td width="100%">
{IF POST->message_id}
{! Editing a message }
{IF POST->user_id}
{POST->email}
{ELSE}
{IF MODERATOR}
<input type="text" name="email" size="30" value="{POST->email}" />
{ELSE}
<?php echo $PHORUM['user']['email'] ?>
{/IF}
{/IF}
{ELSE}
{! Writing a new message }
{IF LOGGEDIN true}
<?php echo $PHORUM['user']['email'] ?>
{ELSE}
<input type="text" name="email" size="30" value="{POST->email}" />
{/IF}
{/IF}
</td>
</tr>
{! Subject ================================================================== }
<tr>
<td style="white-space: nowrap">{LANG->Subject}:&nbsp;</td>
<td><input type="text" name="subject" id="phorum_subject" size="50" value="{POST->subject}" /></td>
</tr>
{HOOK tpl_editor_after_subject}
{! Moderator only fields ==================================================== }
{IF SHOW_THREADOPTIONS}
<tr>
<td>{LANG->Special}:&nbsp;</td>
<td>
{IF SHOW_SPECIALOPTIONS}
<select name="special">
<option value=""></option>
{IF OPTION_ALLOWED->sticky}
<option value="sticky"{IF POST->special "sticky"} selected{/IF}>{LANG->MakeSticky}</option>
{/IF}
{IF OPTION_ALLOWED->announcement}
<option value="announcement" {IF POST->special "announcement"} selected{/IF}>{LANG->MakeAnnouncement}</option>
{/IF}
</select>
{/IF}
{IF OPTION_ALLOWED->allow_reply}
<input type="checkbox" name="allow_reply" value="1" {IF POST->allow_reply} checked="checked"{/IF}> {LANG->AllowReplies}
{/IF}
</td>
</tr>
{/IF}
{! Email notify ============================================================= }
{IF POST->user_id}
{IF EMAILNOTIFY}
<tr>
<td colspan="2">
<input type="checkbox" name="email_notify" value="1" {IF POST->email_notify} checked="checked"{/IF} /> {LANG->EmailReplies}
</td>
</tr>
{/IF}
{/IF}
{! Show signature =========================================================== }
{IF POST->user_id}
<tr>
<td colspan="2">
<input type="checkbox" name="show_signature" value="1" {IF POST->show_signature} checked="checked"{/IF} /> {LANG->AddSig}
</td>
</tr>
{/IF}
</table>
</div>
{! Attachments ============================================================== }
{IF ATTACHMENTS}
{INCLUDE posting_attachments}
{/IF}
{! Body ===================================================================== }
{HOOK tpl_editor_before_textarea}
<div class="PhorumStdBlock PhorumNarrowBlock">
<textarea name="body" id="phorum_textarea" rows="15" cols="50" style="width: 99%">{POST->body}</textarea>
{IF MODERATED}
{LANG->ModeratedForum}<br />
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_subscriptions.tpl
New file
0,0 → 1,65
<form action="{URL->ACTION}" method="POST">
{POST_VARS}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->Subscriptions}</div>
<div class="PhorumStdBlock PhorumFloatingText" style="text-align: left;">
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
{LANG->Activity}:&nbsp;
<select name="subdays">
<option value="1"{IF SELECTED 1} selected{/IF}>1 {LANG->Day}</option>
<option value="2"{IF SELECTED 2} selected{/IF}>2 {LANG->Days}</option>
<option value="7"{IF SELECTED 7} selected{/IF}>7 {LANG->Days}</option>
<option value="30"{IF SELECTED 30} selected{/IF}>1 {LANG->Month}</option>
<option value="180"{IF SELECTED 180} selected{/IF}>6 {LANG->Months}</option>
<option value="365"{IF SELECTED 365} selected{/IF}>1 {LANG->Year}</option>
<option value="0"{IF SELECTED 0} selected{/IF}>{LANG->AllDates}</option>
</select>
<input type="submit" class="PhorumSubmit" value="{LANG->Go}" />
</div>
</form><br />
<form action="{URL->ACTION}" method="POST">
{POST_VARS}
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
<input type="hidden" name="subdays" value="{SELECTED}" />
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th align="left" class="PhorumTableHeader">{LANG->Delete}</th>
<th align="left" class="PhorumTableHeader">{LANG->Subject}</th>
<th align="left" class="PhorumTableHeader">{LANG->Author}</th>
<th align="left" class="PhorumTableHeader">{LANG->LastPost}</th>
<th align="left" class="PhorumTableHeader">{LANG->Email}</th>
</tr>
{LOOP subscriptions}
<tr>
<td class="PhorumTableRow">
<input type="checkbox" name="delthreads[]" value="{subscriptions->thread}" />
</td>
<td class="PhorumTableRow">
<a href="{subscriptions->readurl}">{subscriptions->subject}</a><br />
<span class="PhorumListSubText">{LANG->Forum}: {subscriptions->forum}</span>
</td>
<td class="PhorumTableRow">
{subscriptions->linked_author}
</td>
<td class="PhorumTableRow">
{subscriptions->datestamp}
</td>
<td class="PhorumTableRow">
<input type="hidden" name="thread_forum_id[{subscriptions->thread}]" value="{subscriptions->forum_id}" />
<input type="hidden" name="old_sub_type[{subscriptions->thread}]" value="{subscriptions->sub_type}" />
<select name="sub_type[{subscriptions->thread}]">
<option {if subscriptions->sub_type PHORUM_SUBSCRIPTION_MESSAGE}selected{/IF} value="{PHORUM_SUBSCRIPTION_MESSAGE}">{LANG->Yes}</option>
<option {if subscriptions->sub_type PHORUM_SUBSCRIPTION_BOOKMARK}selected{/IF} value="{PHORUM_SUBSCRIPTION_BOOKMARK}">{LANG->No}</option>
</select>
</td>
</tr>
{/LOOP subscriptions}
<tr>
<th colspan="5" align="right" class="PhorumTableHeader">
<input type="submit" class="PhorumSubmit" name="button_update" value="{LANG->Update}" />
</th>
</tr>
</table>
</form>
<div class="PhorumFloatingText">{LANG->HowToFollowThreads}</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_index.tpl
New file
0,0 → 1,15
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}{IF URL->POST}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{IF LOGGEDIN true}{IF ENABLE_PM}<a class="PhorumNavLink" href="{URL->PM}">{LANG->PrivateMessages}</a>&bull;{/IF}{/IF}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>
</div>
<table id="phorum-menu-table" cellspacing="0" border="0">
<tr>
<td id="phorum-menu" nowrap="nowrap">{INCLUDE cc_menu}</td>
<td id="phorum-content">
{IF content_template}
{INCLUDE_VAR content_template}
{ELSE}
<div class="PhorumFloatingText">{MESSAGE}</div>
{/IF}
</td>
</tr>
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm.tpl
New file
0,0 → 1,22
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}{IF URL->POST}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;<a class="PhorumNavLink" href="{URL->REGISTERPROFILE}">{LANG->MyProfile}</a>&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>
</div>
<table id="phorum-menu-table" cellspacing="0" border="0">
<tr>
<td id="phorum-menu">
{INCLUDE pm_menu}
</td>
<td id="phorum-content">
{IF ERROR}
<div class="PhorumUserError">{ERROR}</div>
{/IF}
{IF OKMSG}
<div class="PhorumOkMsg">{OKMSG}</div>
{/IF}
<?php
// don't touch this line
include phorum_get_template($template);
?>
</td>
</tr>
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/split_form.tpl
New file
0,0 → 1,18
<div align="center">
{INCLUDE posting_menu}
<form method="POST" action="{URL->ACTION}">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORM->forum_id}" />
<input type="hidden" name="thread" value="{FORM->thread_id}" />
<input type="hidden" name="message" value="{FORM->message_id}" />
<input type="hidden" name="mod_step" value="{FORM->mod_step}" />
<div class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><span class="PhorumHeadingLeft">{LANG->SplitThread}</span></div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->SplitThreadInfo}<br /><br />
{LANG->Message}: '{FORM->message_subject}'<br /><br />
<input type="submit" class="PhorumSubmit" name="move" value="{LANG->SplitThread}" />
</div>
</div>
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/index_new.tpl
New file
0,0 → 1,38
<div class="PhorumNavBlock">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<table id="phorum-index" cellspacing="0">
{LOOP FORUMS}
{IF FORUMS->folder_flag}
<tr class="folder">
{IF FORUMS->forum_id FORUMS->vroot}
<th class="forum-name">{LANG->Forums}</th>
{ELSE}
<th class="forum-name"><a href="{FORUMS->url}">{FORUMS->name}</a></th>
{/IF}
<th class="forum-threads">{LANG->Threads}</th>
<th class="forum-posts">{LANG->Posts}</th>
<th class="forum-last-post">{LANG->LastPost}</th>
</tr>
{ELSE}
<tr class="forum">
<td class="forum-name">
<a href="{FORUMS->url}">{FORUMS->name}</a><p>{FORUMS->description}</p><small>{LANG->Options}: {IF LOGGEDIN true}<a href="{FORUMS->url_markread}">{LANG->MarkForumRead}</a>{/IF}{IF FORUMS->url_rss}{IF LOGGEDIN true}&nbsp;&bull;&nbsp;{/IF}<a href="{FORUMS->url_rss}">{LANG->RSS}</a>{/IF}</small>
</td>
<td class="forum-threads" nowrap="nowrap">
{FORUMS->thread_count}
{IF FORUMS->new_threads}
(<span class="PhorumNewFlag">{FORUMS->new_threads} {LANG->newflag}</span>)
{/IF}
</td>
<td class="forum-posts" nowrap="nowrap">
{FORUMS->message_count}
{IF FORUMS->new_messages}
(<span class="PhorumNewFlag">{FORUMS->new_messages} {LANG->newflag}</span>)
{/IF}
</td>
<td class="forum-last-post" nowrap="nowrap">{FORUMS->last_post}</td>
</tr>
{/IF}
{/LOOP FORUMS}
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/merge_form.tpl
New file
0,0 → 1,41
<div align="center">
{INCLUDE posting_menu}
{IF FORM->merge_none}
<div class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><span class="PhorumHeadingLeft">{LANG->MergeThread}</span></div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->MergeThreadWith}:<br /><br />
{LANG->MergeThreadInfo}<br />
</div>
</div>
{/IF}
{IF FORM->merge_t1}
<form method="POST" action="{URL->ACTION}">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORM->forum_id}" />
<input type="hidden" name="thread" value="{FORM->thread_id}" />
<input type="hidden" name="thread1" value="{FORM->merge_t1}" />
<input type="hidden" name="mod_step" value="{FORM->mod_step}" />
<div class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><span class="PhorumHeadingLeft">{LANG->MergeThread}</span></div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->MergeThreadAction}:<br /><br />
{LANG->Thread}: '{FORM->merge_subject1}'<br />
{LANG->Thread}: '{FORM->thread_subject}'<br /><br />
<input type="submit" class="PhorumSubmit" name="move" value="{LANG->MergeThread}" />
</div>
</div>
</form>
{/IF}
{IF FORM->thread_id}
<div class="PhorumFloatingText">
<form method="POST" action="{URL->ACTION}">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORM->forum_id}" />
<input type="hidden" name="thread" value="{FORM->thread_id}" />
<input type="hidden" name="mod_step" value="{FORM->mod_step}" />
<input type="submit" class="PhorumSubmit" name="move" value="{LANG->MergeThreadCancel}" />
</form>
</div>
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting.tpl
New file
0,0 → 1,13
<div id="phorum-post-form" align="center">
{IF ERROR}<div class="PhorumUserError">{ERROR}</div>{/IF}
{IF OKMSG}<div class="PhorumOkMsg">{OKMSG}</div>{/IF}
{IF PREVIEW}
{INCLUDE posting_preview}
{/IF}
<form id="post_form" name="post" action="{URL->ACTION}" method="post" enctype="multipart/form-data">
{POST_VARS}
{INCLUDE posting_menu}
{INCLUDE posting_messageform}
{INCLUDE posting_buttons}
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_groups.tpl
New file
0,0 → 1,32
{IF Message}
<div class="PhorumUserError">{Message}</div>
{/IF}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->JoinAGroup}</div>
<div class="PhorumStdBlock" style="text-align: left;">
{LANG->JoinGroupDescription}
<form method="POST" action="{GROUP->url}">
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<select name="joingroup">
<option value="0">&nbsp;</option>
{LOOP JOINGROUP}
<option value="{JOINGROUP->group_id}">{JOINGROUP->name}</option>
{/LOOP JOINGROUP}
</select>
<input type="submit" value="{LANG->Join}" />
</form>
</div><br />
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->GroupMembership}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
<tr>
<th>{LANG->Group}</th>
<th>{LANG->Permission}</th>
</tr>
{LOOP Groups}
<tr>
<td>{Groups->groupname}&nbsp;&nbsp;</td>
<td>{Groups->perm}</td>
</tr>
{/LOOP Groups}
</table>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/list_threads.tpl
New file
0,0 → 1,84
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
{IF PAGES}
<div class="PhorumNavBlock" style="text-align: left;">
<div style="float: right;">
<span class="PhorumNavHeading">{LANG->Pages}:</span>&nbsp;{IF URL->PREVPAGE}<a class="PhorumNavLink" href="{URL->PREVPAGE}">{LANG->PrevPage}</a>{/IF}{IF URL->FIRSTPAGE}<a class="PhorumNavLink" href="{URL->FIRSTPAGE}">{LANG->FirstPage}...</a>{/IF}{LOOP PAGES}{IF PAGES->pageno CURRENTPAGE}<span class="PhorumNavLink"><strong>{PAGES->pageno}</strong></span>{ELSE}<a class="PhorumNavLink" href="{PAGES->url}">{PAGES->pageno}</a>{/IF}{/LOOP PAGES}{IF URL->LASTPAGE}<a class="PhorumNavLink" href="{URL->LASTPAGE}">...{LANG->LastPage}</a>{/IF}{IF URL->NEXTPAGE}<a class="PhorumNavLink" href="{URL->NEXTPAGE}">{LANG->NextPage}</a>{/IF}
</div>
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->CurrentPage}:</span>{CURRENTPAGE} {LANG->of} {TOTALPAGES}
</div>
{/IF}
<table class="PhorumStdTable" cellspacing="0">
<tr>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
{IF VIEWCOUNT_COLUMN}
<th class="PhorumTableHeader" align="center">{LANG->Views}</th>
{/IF}
<th class="PhorumTableHeader" align="left" nowrap>{LANG->WrittenBy}</th>
<th class="PhorumTableHeader" align="left" nowrap>{LANG->Posted}</th>
</tr>
<?php $oldthread=0; $rclass=""; ?>
{LOOP ROWS}
<?php
if($oldthread != $PHORUM['TMP']['ROWS']['thread']){
if($rclass=="Alt") $rclass=""; else $rclass="Alt";
$oldthread=$PHORUM['TMP']['ROWS']['thread'];
}
?>
<tr>
{IF ROWS->sort PHORUM_SORT_STICKY}
<td class="PhorumTableRow<?php echo $rclass;?>" style="padding-left: {ROWS->indent_cnt}px">
{marker}<span class="PhorumListSubjPrefix">{LANG->Sticky}:&nbsp;</span>
{IF ROWS->moved}<span class="PhorumListSubjPrefix">{LANG->MovedSubject}:&nbsp;</span>{/IF}
<a href="{ROWS->url}">{ROWS->subject}</a>&nbsp;({ROWS->thread_count} {LANG->Posts})&nbsp;<span class="PhorumNewFlag">{ROWS->new}</span>
</td>
{ELSEIF ROWS->sort PHORUM_SORT_ANNOUNCEMENT}
<td class="PhorumTableRow<?php echo $rclass;?>" style="padding-left: {ROWS->indent_cnt}px">
{marker}<span class="PhorumListSubjPrefix">{LANG->Announcement}:&nbsp;</span>
{IF ROWS->moved}<span class="PhorumListSubjPrefix">{LANG->MovedSubject}:&nbsp;</span>{/IF}
<a href="{ROWS->url}">{ROWS->subject}</a>&nbsp;({ROWS->thread_count} {LANG->Posts})&nbsp;<span class="PhorumNewFlag">{ROWS->new}</span>
</td>
{ELSE}
<td class="PhorumTableRow<?php echo $rclass;?>" style="padding-left: {ROWS->indent_cnt}px">
{marker}
{IF ROWS->sort PHORUM_SORT_STICKY}
<span class="PhorumListSubjPrefix">{LANG->Sticky}:&nbsp;</span>
{/IF}
{IF ROWS->sort PHORUM_SORT_ANNOUNCEMENT}
<span class="PhorumListSubjPrefix">{LANG->Announcement}:&nbsp;</span>
{/IF}
{IF ROWS->moved}
<span class="PhorumListSubjPrefix">{LANG->MovedSubject}:&nbsp;</span>
{/IF}
<a href="{ROWS->url}">{ROWS->subject}</a>&nbsp;<span class="PhorumNewFlag">{ROWS->new}</span>
</td>
{/IF}
{IF VIEWCOUNT_COLUMN}
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap" align="center" width="80">
{ROWS->viewcount}
</td>
{/IF}
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap" width="150">
{ROWS->linked_author}
</td>
<td class="PhorumTableRow<?php echo $rclass;?> PhorumSmallFont" nowrap="nowrap" width="150">
{ROWS->datestamp}
{IF MODERATOR true}
<br />
<span class="PhorumListModLink">
{IF ROWS->threadstart false}
<a class="PhorumListModLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteMessage}')) window.location='{ROWS->delete_url1}';">{LANG->DeleteMessage}</a>
{/IF}
{IF ROWS->threadstart true}
<a class="PhorumListModLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{ROWS->delete_url2}';">{LANG->DeleteThread}</a>{IF ROWS->move_url}&nbsp;|&nbsp;<a class="PhorumListModLink" href="{ROWS->move_url}">{LANG->MoveThread}</a>{/IF}&nbsp;|&nbsp;<a class="PhorumListModLink" href="{ROWS->merge_url}">{LANG->MergeThread}</a>{/IF}
</span>
{/IF}
</td>
</tr>
{/LOOP ROWS}
</table>
{INCLUDE paging}
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Options}:</span>&nbsp;{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->MARKREAD}">{LANG->MarkRead}</a>{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/header.tpl
New file
0,0 → 1,39
{IF CHARSET}
<?php
header("Content-Type: text/html; charset=".htmlspecialchars($PHORUM['DATA']['CHARSET']))
?>
{/IF}
<?php echo '<?' ?>xml version="1.0" encoding="{CHARSET}"<?php echo '?>' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html lang="<?php echo $PHORUM['locale']; ?>">
<head>
<style type="text/css">
{INCLUDE css}
</style>
{IF URL->RSS}
<link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="{URL->RSS}" />
{/IF}
{IF URL->REDIRECT}
<meta http-equiv="refresh" content="{IF REDIRECT_TIME}{REDIRECT_TIME}{ELSE}5{/IF}; url={URL->REDIRECT}" />
{/IF}
{LANG_META}
<title>{HTML_TITLE}</title>
{HEAD_TAGS}
</head>
<body onload="{IF FOCUS_TO_ID}var focuselt=document.getElementById('{FOCUS_TO_ID}'); if (focuselt) focuselt.focus();{/IF}">
<div align="{forumalign}">
<div class="PDDiv">
{IF notice_all}
<div class="PhorumNotificationArea PhorumNavBlock">
{IF NEW_PRIVATE_MESSAGES}<a class="PhorumNavLink" href="{URL->PM}">{LANG->NewPrivateMessages}</a><br />{/IF}
{IF notice_messages}<a class="PhorumNavLink" href="{notice_messages_url}">{LANG->UnapprovedMessagesLong}</a><br />{/IF}
{IF notice_users}<a class="PhorumNavLink" href="{notice_users_url}">{LANG->UnapprovedUsersLong}</a><br />{/IF}
{IF notice_groups}<a class="PhorumNavLink" href="{notice_groups_url}">{LANG->UnapprovedGroupMembers}</a><br />{/IF}
</div>
{/IF}
<span class="PhorumTitleText PhorumLargeFont">
{IF NAME}<a href="{URL->TOP}">{NAME}</a>&nbsp;:&nbsp;{/IF}
{TITLE}
</span>
<img src="templates/default/images/logo.png" alt="The fastest message board... ever. " title="The fastest message board... ever. " width="170" height="42" />
<div class="PhorumFloatingText">{DESCRIPTION}&nbsp;</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/css.tpl
New file
0,0 → 1,686
/* Element level classes */
 
body
{
color: {defaulttextcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
background-color: {bodybackground};
margin: 8px;
}
 
td, th
{
color: {defaulttextcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
}
 
img
{
border-width: 0px;
vertical-align: middle;
}
 
a
{
color: {linkcolor};
text-decoration: none;
}
a:active
{
color: {activelinkcolor};
text-decoration: none;
}
a:visited
{
color: {visitedlinkcolor};
text-decoration: none;
}
 
a:hover
{
color: {hoverlinkcolor};
}
 
input[type=text], input[type=password], input[type=file], select
{
background-color: {backcolor};
color: {defaulttextcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
 
vertical-align: middle;
 
}
 
textarea
{
background-color: {backcolor};
color: {defaulttextcolor};
font-size: {defaultfontsize};
font-family: {fixedfont};
}
 
input[type=submit]
{
border: 1px dotted {tablebordercolor};
background-color: {navbackcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
vertical-align: middle;
}
 
input
{
vertical-align: middle;
}
 
 
/* new styles */
 
#phorum-index
{
width: 100%;
border: 1px solid {tablebordercolor};
border-bottom-width: 0px;
text-align: left;
}
 
#phorum-index th
{
border-bottom: 1px solid {tablebordercolor};
background-color: {headerbackcolor};
padding: 3px 0 3px 0;
}
 
#phorum-index td
{
font-family: {largefont};
background-color: {backcolor};
padding: 3px 0 3px 0;
border-bottom: 1px solid {tablebordercolor};
}
 
#phorum-index th.forum-name
{
font-family: {largefont};
font-size: {largefontsize};
padding: 3px 0 3px 3px;
}
 
#phorum-index th.forum-name a
{
color: Black;
}
 
#phorum-index th.forum-threads
{
width: 120px;
text-align: center;
vertical-align: middle;
}
 
#phorum-index th.forum-posts
{
width: 120px;
text-align: center;
vertical-align: middle;
}
 
#phorum-index th.forum-last-post
{
padding: 3px 15px 3px 3px;
vertical-align: middle;
}
 
#phorum-index td.forum-name
{
font-family: {largefont};
font-size: {defaultboldfontsize};
font-weight: bold;
padding: 5px 0 5px 15px;
}
 
#phorum-index td.forum-name p
{
font-size: 13px;
font-weight: normal;
font-family: {defaultfont};
margin: 0 15px 0 0;
}
 
#phorum-index td.forum-name small
{
font-weight: normal;
font-family: {defaultfont};
}
 
#phorum-index td.forum-threads
{
width: 120px;
text-align: center;
}
 
#phorum-index td.forum-posts
{
width: 120px;
text-align: center;
}
 
#phorum-index td.forum-last-post
{
width: 120px;
padding: 0 15px 0 0;
}
 
#phorum-menu-table
{
width: 100%;
border-width: 0px;
}
 
#phorum-menu
{
padding: 5px 3px 0 0;
vertical-align: top;
width: 200px;
}
 
#phorum-content
{
padding: 5px 0 0 2px;
vertical-align: top;
}
 
div.phorum-menu
{
font-size: {defaultfontsize};
font-family: {defaultfont};
background-color: {backcolor};
border: 1px solid {tablebordercolor};
padding: 3px;
}
 
div.phorum-menu ul
{
font-weight: bold;
list-style: none;
padding: 0;
margin: 0 0 10px 0;
}
 
div.phorum-menu li
{
font-weight: bold;
font-family: {navfont};
font-size: {navfontsize};
padding: 0 0 0 15px;
margin-top:3px;
background-image: url('templates/default/images/square_bullet.png');
background-repeat: no-repeat;
background-position: 1px 2px;
}
 
div.phorum-menu a
{
font-weight: normal;
color: {navtextcolor};
}
 
div.phorum-menu a:hover
{
color: {hoverlinkcolor};
}
 
div.phorum-menu a.phorum-current-page
{
font-weight: bold;
}
 
#phorum-post-form ul
{
padding: 0 0 0 20px;
margin: 3px 0px 8px 0px;
font-size: {smallfontsize};
}
 
#phorum-post-form li
{
margin-bottom: 3px;
}
 
#phorum-attachment-list td
{
font-size: {smallfontsize};
}
 
/* Standard classes for use in any page */
/* PhorumDesignDiv - a div for keeping the forum-size size */
.PDDiv
{
width: {forumwidth};
text-align: left;
}
/* new class for layouting the submit-buttons in IE too */
.PhorumSubmit {
border: 1px dotted {tablebordercolor};
color: {defaulttextcolor};
background-color: {navbackcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
vertical-align: middle;
}
 
.PhorumTitleText
{
float: right;
}
 
.PhorumStdBlock
{
font-size: {defaultfontsize};
font-family: {defaultfont};
background-color: {backcolor};
border: 1px solid {tablebordercolor};
/* width: {tablewidth}; */
padding: 3px;
text-align: left;
}
 
.PhorumStdBlockHeader
{
font-size: {defaultfontsize};
font-family: {defaultfont};
background-color: {navbackcolor};
/* width: {tablewidth}; */
border-left: 1px solid {tablebordercolor};
border-right: 1px solid {tablebordercolor};
border-top: 1px solid {tablebordercolor};
padding: 3px;
text-align: left;
}
 
.PhorumHeaderText
{
font-weight: bold;
}
 
.PhorumNavBlock
{
font-size: {navfontsize};
font-family: {navfont};
border: 1px solid {tablebordercolor};
margin-top: 1px;
margin-bottom: 1px;
/* width: {tablewidth}; */
background-color: {navbackcolor};
padding: 2px 3px 2px 3px;
}
 
.PhorumNavHeading
{
font-weight: bold;
}
 
A.PhorumNavLink
{
color: {navtextcolor};
text-decoration: none;
font-weight: {navtextweight};
font-family: {navfont};
font-size: {navfontsize};
border-style: solid;
border-color: {navbackcolor};
border-width: 1px;
padding: 0px 4px 0px 4px;
}
 
.PhorumSelectedFolder
{
color: {navtextcolor};
text-decoration: none;
font-weight: {navtextweight};
font-family: {navfont};
font-size: {navfontsize};
border-style: solid;
border-color: {navbackcolor};
border-width: 1px;
padding: 0px 4px 0px 4px;
}
 
A.PhorumNavLink:hover
{
background-color: {navhoverbackcolor};
font-weight: {navtextweight};
font-family: {navfont};
font-size: {navfontsize};
border-style: solid;
border-color: {tablebordercolor};
border-width: 1px;
color: {navhoverlinkcolor};
}
 
.PhorumFloatingText
{
padding: 10px;
}
 
.PhorumHeadingLeft
{
padding-left: 3px;
font-weight: bold;
}
 
.PhorumUserError
{
padding: 10px;
text-align: center;
color: {errorfontcolor};
font-size: {largefontsize};
font-family: {largefont};
font-weight: bold;
}
 
.PhorumOkMsg
{
padding: 10px;
text-align: center;
color: {okmsgfontcolor};
font-size: {largefontsize};
font-family: {largefont};
font-weight: bold;
}
 
.PhorumNewFlag
{
font-family: {defaultfont};
font-size: {tinyfontsize};
font-weight: bold;
color: {newflagcolor};
}
 
.PhorumNotificationArea
{
float: right;
border-style: dotted;
border-color: {tablebordercolor};
border-width: 1px;
}
 
/* PSUEDO Table classes */
/* In addition to these, each file that uses them will have a */
/* column with a style property to set its right margin */
 
.PhorumColumnFloatXSmall
{
float: right;
width: 75px;
}
 
.PhorumColumnFloatSmall
{
float: right;
width: 100px;
}
 
.PhorumColumnFloatMedium
{
float: right;
width: 150px;
}
 
.PhorumColumnFloatLarge
{
float: right;
width: 200px;
}
 
.PhorumColumnFloatXLarge
{
float: right;
width: 400px;
}
 
.PhorumRowBlock
{
background-color: {backcolor};
border-bottom: 1px solid {listlinecolor};
padding: 5px 0px 0px 0px;
}
 
.PhorumRowBlockAlt
{
background-color: {altbackcolor};
border-bottom: 1px solid {listlinecolor};
padding: 5px 0px 0px 0px;
}
 
/************/
 
 
/* All that is left of the tables */
 
.PhorumStdTable
{
border-style: solid;
border-color: {tablebordercolor};
border-width: 1px;
width: {tablewidth};
}
 
.PhorumTableHeader
{
background-color: {headerbackcolor};
border-bottom-style: solid;
border-bottom-color: {tablebordercolor};
border-bottom-width: 1px;
color: {headertextcolor};
font-size: {headerfontsize};
font-family: {headerfont};
font-weight: {headertextweight};
padding: 3px;
}
 
.PhorumTableRow
{
background-color: {backcolor};
border-bottom-style: solid;
border-bottom-color: {listlinecolor};
border-bottom-width: 1px;
color: {defaulttextcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
height: 35px;
padding: 3px;
}
 
.PhorumTableRowAlt
{
background-color: {altbackcolor};
border-bottom-style: solid;
border-bottom-color: {listlinecolor};
border-bottom-width: 1px;
color: {altlisttextcolor};
font-size: {defaultfontsize};
font-family: {defaultfont};
height: 35px;
padding: 3px;
}
 
table.PhorumFormTable td
{
height: 26px;
}
 
/**********************/
 
 
/* Read Page specifics */
 
.PhorumReadMessageBlock
{
margin-bottom: 5px;
}
 
.PhorumReadBodySubject
{
color: Black;
font-size: {largefontsize};
font-family: {largefont};
font-weight: bold;
padding-left: 3px;
}
 
.PhorumReadBodyHead
{
padding-left: 5px;
}
 
.PhorumReadBodyText
{
font-size: {defaultfontsize};
font-family: {defaultfont};
padding: 5px;
}
 
.PhorumReadNavBlock
{
font-size: {navfontsize};
font-family: {navfont};
border-left: 1px solid {tablebordercolor};
border-right: 1px solid {tablebordercolor};
border-bottom: 1px solid {tablebordercolor};
/* width: {tablewidth}; */
background-color: {navbackcolor};
padding: 2px 3px 2px 3px;
}
 
/********************/
 
/* List page specifics */
 
.PhorumListSubText
{
color: {listpagelinkcolor};
font-size: {tinyfontsize};
font-family: {tinyfont};
}
 
.PhorumListPageLink
{
color: {listpagelinkcolor};
font-size: {tinyfontsize};
font-family: {tinyfont};
}
 
.PhorumListSubjPrefix
{
font-weight: bold;
}
 
/********************/
 
/* Posting editor specifics */
 
.PhorumListModLink, .PhorumListModLink a
{
color: {listmodlinkcolor};
font-size: {tinyfontsize};
font-family: {tinyfont};
}
 
.PhorumAttachmentRow {
border-bottom: 1px solid {altbackcolor};
padding: 3px 0px 3px 0px;
}
 
/********************/
 
/* PM specifics */
 
.phorum-recipientblock
{
border: 1px solid black;
position:relative;
float:left;
padding: 1px 1px 1px 5px;
margin: 0px 5px 5px 0px;
font-size: {smallfontsize};
background-color: {backcolor};
border: 1px solid {tablebordercolor};
white-space: nowrap;
}
 
.phorum-pmuserselection
{
padding-bottom: 5px;
}
 
.phorum-gaugetable {
border-collapse: collapse;
}
 
.phorum-gauge {
border: 1px solid {tablebordercolor};
background-color: {navbackcolor};
}
 
.phorum-gaugeprefix {
border: none;
background-color: white;
padding-right: 10px;
}
 
/********************/
 
/* Override classes - Must stay at the end */
 
.PhorumNarrowBlock
{
width: {narrowtablewidth};
}
 
.PhorumSmallFont
{
font-size: {smallfontsize};
}
 
.PhorumLargeFont
{
color: {defaulttextcolor};
font-size: {largefontsize};
font-family: {largefont};
font-weight: bold;
}
 
 
.PhorumFooterPlug
{
margin-top: 10px;
font-size: {tinyfontsize};
font-family: {tinyfont};
}
 
 
 
/* BBCode styles */
 
blockquote.bbcode
{
font-size: {smallfontsize};
margin: 0 0 0 10px;
}
 
blockquote.bbcode div
{
margin: 0;
padding: 5px;
border: 1px solid {tablebordercolor};
}
 
blockquote.bbcode strong
{
font-style: italic;
margin: 0 0 3px 0;
}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_folders.tpl
New file
0,0 → 1,39
{include pm_folders.formstart}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left">{LANG->PMFolderCreate}</div>
<div class="PhorumStdBlock" style="padding-top: 15px; padding-bottom: 15px">
<input type="text" name="create_folder_name" value="{CREATE_FOLDER_NAME}" size="20" maxlength="20" />
<input type="submit" name="create_folder" value="{LANG->Submit}" class="PhorumSubmit" />
</div>
</form>
{IF PM_USERFOLDERS}
<br />
{include pm_folders.formstart}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left">{LANG->PMFolderRename}</div>
<div class="PhorumStdBlock" style="padding-top: 15px; padding-bottom: 15px">
<select name="rename_folder_from" style="vertical-align: middle">
<option value="">{LANG->PMSelectAFolder}</option>
{LOOP PM_USERFOLDERS}
<option value="{PM_USERFOLDERS->id}">{PM_USERFOLDERS->name}</option>
{/LOOP PM_USERFOLDERS}
</select>
{LANG->PMFolderRenameTo}
<input type="text" name="rename_folder_to" value="{RENAME_FOLDER_NAME}" size="20" maxlength="20" />
<input type="submit" name="rename_folder" value="{LANG->Submit}" class="PhorumSubmit" />
</div>
</form>
<br />
{include pm_folders.formstart}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left">{LANG->PMFolderDelete}</div>
<div class="PhorumStdBlock" style="padding-top: 15px; padding-bottom: 15px">
{LANG->PMFolderDeleteExplain}<br /><br />
{LANG->PMFolderDelete}
<select name="delete_folder_target" style="vertical-align: middle">
<option value="">{LANG->PMSelectAFolder}</option>
{LOOP PM_USERFOLDERS}
<option value="{PM_USERFOLDERS->id}">{PM_USERFOLDERS->name}{IF PM_USERFOLDERS->total} ({PM_USERFOLDERS->total}){/IF}</option>
{/LOOP PM_USERFOLDERS}
</select>
<input type="submit" name="delete_folder" value="{LANG->Submit}" onclick="return confirm('{LANG->PMFolderDeleteConfirm}')" class="PhorumSubmit" />
</div>
</form>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_list_selectall.tpl
New file
0,0 → 1,19
{IF NOT ITEMCOUNT 0}
{IF NOT ITEMCOUNT 1}
{ASSIGN DID_TOGGLEBLOCK 1}
<script type="text/javascript">
document.write
( '<input type="checkbox" name="toggle" onclick="' +
'var lf=document.getElementById(\'phorum_listform\');' +
'for (var i=0;i<lf.elements.length;i++) {' +
'var elt=lf.elements[i];' +
'if (elt.type==\'checkbox\' && elt.name!=\'toggle\') {' +
'elt.checked = this.checked;' +
'}' +
'}' +
'">' );
</script>
<noscript>&nbsp;</noscript>
{/IF}
{/IF}
{IF NOT DID_TOGGLEBLOCK}&nbsp;{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_menu.tpl
New file
0,0 → 1,20
<div class="phorum-menu" style="text-align: left; white-space: nowrap">
{LANG->PrivateMessages}
<ul>
{LOOP PM_FOLDERS}
{! Put a bit of space between incoming and the outgoing folder, in }
{! case the user has own folders. }
{IF PM_USERFOLDERS}{IF PM_FOLDERS->is_outgoing}{VAR SPACER 10px}{/IF}{/IF}
<li {IF SPACER}style="margin-top: {SPACER}"{/IF}>
<a {IF PM_FOLDERS->id FOLDER_ID}class="phorum-current-page" {/IF}href="{PM_FOLDERS->url}">{PM_FOLDERS->name}</a><small>{IF PM_FOLDERS->total}&nbsp;({PM_FOLDERS->total}){/IF}{IF PM_FOLDERS->new}&nbsp;(<span class="PhorumNewFlag">{PM_FOLDERS->new} {LANG->newflag}</span>){/IF}</small>
</li>
{/LOOP PM_FOLDERS}
</ul>
{LANG->Options}
<ul>
<li><a {IF PM_PAGE "folders"}class="phorum-current-page" {/IF}href="{URL->PM_FOLDERS}">{LANG->EditFolders}</a></li>
<li><a {IF PM_PAGE "send"}class="phorum-current-page" {/IF}href="{URL->PM_SEND}">{LANG->SendPM}</a></li>
<li><a {IF PM_PAGE "buddies"}class="phorum-current-page" {/IF} href="{URL->BUDDIES}">{LANG->Buddies}</a></li>
</ul>
</div>
{INCLUDE pm_max_messagecount}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/profile.tpl
New file
0,0 → 1,48
<div align="center">
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<div class="PhorumStdBlockHeader PhorumNarrowBlock PhorumHeaderText" style="text-align: left;">
{LANG->UserProfile}&nbsp;:&nbsp;{PROFILE->username}
{IF ENABLE_PM}
{IF PROFILE->is_buddy} ({LANG->Buddy}){/IF}
{/IF}
</div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<table cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->Email}:&nbsp;</td>
<td>{PROFILE->email}</td>
</tr>
{IF PROFILE->real_name}
<tr>
<td nowrap="nowrap">{LANG->RealName}:&nbsp;</td>
<td>{PROFILE->real_name}</td>
</tr>
{/IF}
{IF PROFILE->posts}
<tr>
<td nowrap="nowrap">{LANG->Posts}:&nbsp;</td>
<td>{PROFILE->posts}</td>
</tr>
{/IF}
{IF PROFILE->date_added}
<tr>
<td nowrap="nowrap">{LANG->DateReg}:&nbsp;</td>
<td>{PROFILE->date_added}</td>
</tr>
{/IF}
{IF PROFILE->date_last_active}
<tr>
<td nowrap="nowrap">{LANG->DateActive}:&nbsp;</td>
<td>{PROFILE->date_last_active}</td>
</tr>
{/IF}
</table>
</div>
{IF ENABLE_PM}
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Options}:</span>&nbsp;<a class="PhorumNavLink" href="{PROFILE->pm_url}">{LANG->SendPM}</a>{IF NOT PROFILE->is_buddy}&bull;<a class="PhorumNavLink" href="{PROFILE->pm_addbuddy_url}">{LANG->BuddyAdd}</a>{/IF}
</div>
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_moveselect.tpl
New file
0,0 → 1,15
{IF PM_USERFOLDERS}
<span style="white-space: nowrap; float:right">
<select name="target_folder" style="vertical-align: middle;">
<option value=""> {LANG->PMSelectAFolder}</option>
{LOOP PM_FOLDERS}
{IF NOT PM_FOLDERS->id FOLDER_ID}
{IF NOT PM_FOLDERS->is_outgoing}
<option value="{PM_FOLDERS->id}"> {PM_FOLDERS->name}</option>
{/IF}
{/IF}
{/LOOP PM_FOLDERS}
</select>
<input type="submit" name="{MOVE_SUBMIT_NAME}" class="PhorumSubmit" value="{LANG->PMMoveToFolder}" />
</span>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/follow.tpl
New file
0,0 → 1,19
<div align="center">
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<form action="{URL->ACTION}" method="post" style="display: inline;">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<input type="hidden" name="thread" value="{THREAD}" />
<div class="PhorumStdBlock PhorumNarrowBlock">
<div class="PhorumFloatingText">
{LANG->YouWantToFollow}
<div class="PhorumLargeFont">{SUBJECT}</div><br />
{LANG->FollowExplanation}<br /><br />
<input type="checkbox" name="send_email" checked="checked" />&nbsp;{LANG->FollowWithEmail}<br /><br />
<input type="submit" value="{LANG->Submit}" />
</div>
</div>
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_users.tpl
New file
0,0 → 1,23
<div class="PhorumLargeFont">{LANG->UnapprovedUsers}</div>
<form action="{ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="panel" value="users" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left">&nbsp;</th>
<th class="PhorumTableHeader" align="left">{LANG->Username}</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->Email}</th>
</tr>
{LOOP USERS}
<tr>
<td class="PhorumTableRow"><input type="checkbox" name="user_ids[]" value="{USERS->user_id}" /></td>
<td class="PhorumTableRow" width="50%">{USERS->username}</td>
<td class="PhorumTableRow" width="50%" nowrap="nowrap" width="150">{USERS->email}</td>
</tr>
{/LOOP USERS}
</table>
<div class="PhorumNavBlock" style="text-align: left;">
<input type="submit" class="PhorumSubmit" name="approve" value="{LANG->ApproveUser}" />&nbsp;<input type="submit" class="PhorumSubmit" name="disapprove" value="{LANG->DenyUser}" />
</div>
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_list.tpl
New file
0,0 → 1,11
<form action="{ACTION}" method="post" id="phorum_listform">
{POST_VARS}
<input type="hidden" name="action" value="list" />
<input type="hidden" name="folder_id" value="{FOLDER_ID}" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
{IF FOLDER_IS_INCOMING}
{INCLUDE pm_list_incoming}
{ELSE}
{INCLUDE pm_list_outgoing}
{/IF}
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_files.tpl
New file
0,0 → 1,43
<form action="{URL->ACTION}" method="POST" enctype="multipart/form-data">
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->UploadFile}</div>
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
{POST_VARS}
<div class="PhorumStdBlock PhorumFloatingText" style="text-align: left;">
{IF FILE_SIZE_LIMIT}{FILE_SIZE_LIMIT}<br />{/IF}
{IF FILE_TYPE_LIMIT}{FILE_TYPE_LIMIT}<br />{/IF}
{IF FILE_QUOTA_LIMIT}{FILE_QUOTA_LIMIT}<br />{/IF}
<br />
<input type="file" name="newfile" size="30" /><br /><br />
<input class="PhorumSubmit" type="submit" value="{LANG->Submit}" />
</div>
</form>
<form action="{URL->ACTION}" method="POST">
{POST_VARS}
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th align="left" class="PhorumTableHeader">{LANG->Filename}</th>
<th align="left" class="PhorumTableHeader">{LANG->Filesize}</th>
<th align="left" class="PhorumTableHeader">{LANG->DateAdded}</th>
<th align="center" class="PhorumTableHeader">{LANG->Delete}</th>
</tr>
{LOOP FILES}
<tr>
<td class="PhorumTableRow"><a href="{FILES->url}">{FILES->filename}</a></td>
<td class="PhorumTableRow">{FILES->filesize}</td>
<td class="PhorumTableRow">{FILES->dateadded}</td>
<td class="PhorumTableRow" align="center"><input type="checkbox" name="delete[]" value="{FILES->file_id}" /></td>
</tr>
{/LOOP FILES}
<tr>
<th align="left" class="PhorumTableHeader">{LANG->TotalFiles}: {TOTAL_FILES}</th>
<th align="left" class="PhorumTableHeader">{LANG->TotalFileSize}: {TOTAL_FILE_SIZE}</th>
<th align="left" class="PhorumTableHeader">&nbsp;</th>
<th align="center" class="PhorumTableHeader">
<input type="submit" class="PhorumSubmit" value="{LANG->Delete}" />
</th>
</tr>
</table>
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_folders.formstart.tpl
New file
0,0 → 1,4
<form action="{ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="action" value="folders" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_buddies.tpl
New file
0,0 → 1,46
<form id="phorum_listform" action="{ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="page" value="buddies" />
<input type="hidden" name="action" value="buddies" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left" width="20">
{ASSIGN ITEMCOUNT BUDDYCOUNT}
{INCLUDE pm_list_selectall}
</th>
<th class="PhorumTableHeader" align="left">{LANG->Buddy}</th>
<th class="PhorumTableHeader" align="left">{LANG->RealName}</th>
<th class="PhorumTableHeader" align="center">{LANG->Mutual}</th>
{IF USERTRACK}
<th class="PhorumTableHeader" align="right">{LANG->DateActive}&nbsp;</th>
{/IF}
</tr>
{IF BUDDYCOUNT}
{LOOP BUDDIES}
<tr>
<td class="PhorumTableRow"><input type="checkbox" name="checked[]" value="{BUDDIES->user_id}"></td>
<td class="PhorumTableRow"><a href="{BUDDIES->profile_url}"><strong>{BUDDIES->username}</strong></a></td>
<td class="PhorumTableRow">{BUDDIES->real_name}</td>
<td class="PhorumTableRow"align="center">{IF BUDDIES->mutual}{LANG->Yes}{ELSE}{LANG->No}{/IF}</td>
{IF USERTRACK}
<td class="PhorumTableRow"align="right">{BUDDIES->date_last_active}&nbsp;</td>
{/IF USERTRACK}
</tr>
{/LOOP BUDDIES}
</table>
<div class="PhorumStdBlock" style="border-top:none">
<input type="submit" name="delete" class="PhorumSubmit" value="{LANG->Delete}" onclick="return confirm('<?php echo addslashes($PHORUM['DATA']['LANG']['AreYouSure'])?>')" />
<input type="submit" name="send_pm" class="PhorumSubmit" value="{LANG->SendPM}" />
</div>
{ELSE}
<tr>
<td colspan="4" style="text-align: center" class="PhorumTableRow">
<br />
<i>{LANG->BuddyListIsEmpty}</i><br />
<br />
</td>
</tr>
</table>
{/IF}
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/read.tpl
New file
0,0 → 1,51
<div class="PhorumNavBlock" style="text-align: left;">
<div style="float: right;">
<span class="PhorumNavHeading">{LANG->GotoThread}:</span>&nbsp;<a class="PhorumNavLink" href="{URL->NEWERTHREAD}">{LANG->PrevPage}</a>&bull;<a class="PhorumNavLink" href="{URL->OLDERTHREAD}">{LANG->NextPage}</a>
</div>
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->MARKTHREADREAD}">{LANG->MarkThreadRead}</a>&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{ELSE}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/IF}
</div>
{IF PAGES}
{INCLUDE paging}
{/IF}
{LOOP MESSAGES}
{IF NOT MESSAGES->parent_id 0}
<a name="msg-{MESSAGES->message_id}"></a>
{/IF}
<div class="PhorumReadMessageBlock">
{IF MESSAGES->is_unapproved}
<div class="PhorumStdBlock">
<div class="PhorumReadBodyHead"><strong>{LANG->UnapprovedMessage}</strong></div>
</div>
{/IF}
<div class="PhorumStdBlock">
{IF MESSAGES->parent_id 0}
<div class="PhorumReadBodySubject">{MESSAGES->subject} <span class="PhorumNewFlag">{MESSAGES->new}</span></div>
{ELSE}
<div class="PhorumReadBodyHead"><strong>{MESSAGES->subject}</strong> <span class="PhorumNewFlag">{MESSAGES->new}</span></div>
{/IF}
<div class="PhorumReadBodyHead">{LANG->Postedby}: <strong>{MESSAGES->linked_author}</strong> ({MESSAGES->ip})</div>
<div class="PhorumReadBodyHead">{LANG->Date}: {MESSAGES->datestamp}</div><br />
<div class="PhorumReadBodyText">{MESSAGES->body}</div><br />
{IF ATTACHMENTS}
{IF MESSAGES->attachments}
{LANG->Attachments}:
{LOOP MESSAGES->attachments}
<a href="{MESSAGES->attachments->url}">{MESSAGES->attachments->name} ({MESSAGES->attachments->size})</a>&nbsp;&nbsp;
{/LOOP MESSAGES->attachments}
{/IF}
{/IF}
</div>
{IF MODERATOR true}
<div class="PhorumReadNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Moderate}:</span>&nbsp;{IF MESSAGES->threadstart true}<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{MESSAGES->delete_url2}';">{LANG->DeleteThread}</a>&bull;{IF MESSAGES->move_url}<a class="PhorumNavLink" href="{MESSAGES->move_url}">{LANG->MoveThread}</a>&bull;{/IF}<a class="PhorumNavLink" href="{MESSAGES->merge_url}">{LANG->MergeThread}</a>&bull;{IF MESSAGES->closed false}<a class="PhorumNavLink" href="{MESSAGES->close_url}">{LANG->CloseThread}</a>{ELSE}<a class="PhorumNavLink" href="{MESSAGES->reopen_url}">{LANG->ReopenThread}</a>{/IF}{ELSE}<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteMessage}')) window.location='{MESSAGES->delete_url1}';">{LANG->DeleteMessage}</a>&bull;<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteMessage}')) window.location='{MESSAGES->delete_url2}';">{LANG->DelMessReplies}</a>&bull;<a class="PhorumNavLink" href="{MESSAGES->split_url}">{LANG->SplitThread}</a>{/IF}{IF MESSAGES->is_unapproved}&bull;<a class="PhorumNavLink" href="{MESSAGES->approve_url}">{LANG->ApproveMessage}</a>{ELSE}&bull;<a class="PhorumNavLink" href="{MESSAGES->hide_url}">{LANG->HideMessage}</a>{/IF}&bull;<a class="PhorumNavLink" href="{MESSAGES->edit_url}">{LANG->EditPost}</a>
</div>
{/IF}
<div class="PhorumReadNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Options}:</span>&nbsp;<a class="PhorumNavLink" href="{MESSAGES->reply_url}">{LANG->Reply}</a>&bull;<a class="PhorumNavLink" href="{MESSAGES->quote_url}">{LANG->QuoteMessage}</a>{IF LOGGEDIN}{IF MESSAGES->private_reply_url}&bull;<a class="PhorumNavLink" href="{MESSAGES->private_reply_url}">{LANG->PrivateReply}</a>{/IF}&bull;<a class="PhorumNavLink" href="{MESSAGES->follow_url}">{LANG->FollowThread}</a>&bull;<a class="PhorumNavLink" href="{MESSAGES->report_url}">{LANG->Report}</a>{/IF}{IF MESSAGES->edit 1}&bull;<a class="PhorumNavLink" href="{MESSAGES->edituser_url}">{LANG->EditPost}</a>{/IF}
</div>
</div>
{/LOOP MESSAGES}
{IF PAGES}
{INCLUDE paging}
{/IF}
<br /><br />
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_attachments.tpl
New file
0,0 → 1,30
<div class="PhorumStdBlockHeader PhorumNarrowBlock">
{IF POST->attachments}
{INCLUDE posting_attachments_list}
{ASSIGN AttachPhrase LANG->AttachAnotherFile}
{ELSE}
{ASSIGN AttachPhrase LANG->AttachAFile}
{/IF}
{IF ATTACHMENTS_FULL}
<b>{LANG->AttachFull}</b>
{ELSE}
<script type="text/javascript">
function phorumShowAttachForm() {
document.getElementById('phorum-attach-link').style.display='none';
document.getElementById('phorum-attach-form').style.display='block';
}
document.write("<div id=\"phorum-attach-link\" style=\"display: block;\"><a href=\"javascript:phorumShowAttachForm();\"><b>{AttachPhrase} ...</b></a></div>\n");
document.write("<div id=\"phorum-attach-form\" style=\"display: none;\">");
</script>
<b>{AttachPhrase}</b>
<ul>
{IF EXPLAIN_ATTACH_FILE_TYPES}<li>{EXPLAIN_ATTACH_FILE_TYPES}</li>{/IF}
{IF EXPLAIN_ATTACH_FILE_SIZE}<li>{EXPLAIN_ATTACH_FILE_SIZE}</li>{/IF}
{IF EXPLAIN_ATTACH_TOTALFILE_SIZE}<li>{EXPLAIN_ATTACH_TOTALFILE_SIZE}</li>{/IF}
{IF EXPLAIN_ATTACH_MAX_ATTACHMENTS}<li>{EXPLAIN_ATTACH_MAX_ATTACHMENTS}</li>{/IF}
</ul>
<input type="file" size="50" name="attachment" />
<input type="submit" name="attach" value="{LANG->Attach}" />
<script type="text/javascript">document.write('</div>');</script>
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_post.tpl
New file
0,0 → 1,78
{IF PREVIEW}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->Preview}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<div class="PhorumReadBodySubject">{PREVIEW->subject}</div>
<div class="PhorumReadBodyHead">{LANG->From}: <strong><a href="#">{PREVIEW->from_username}</a></strong></div>
<div class="PhorumReadBodyHead">
{LANG->To}:
{ASSIGN ISFIRST true}
{LOOP PREVIEW->recipients}
<div style="display:inline; white-space: nowrap">
{IF NOT ISFIRST} / {/IF}
<strong><a href="#">{PREVIEW->recipients->username}</a></strong>
{ASSIGN ISFIRST false}
</div>
{/LOOP PREVIEW->recipients}
</div><br />
<div class="PhorumReadBodyText">{PREVIEW->message}</div><br />
</div><br />
{/IF}
<form action="{ACTION}" method="post">
{POST_VARS}
<input type="hidden" name="action" value="post" />
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<input type="hidden" name="hide_userselect" value="{HIDE_USERSELECT}" />
<div class="PhorumStdBlockHeader" style="text-align: left; width:99%">
<table class="PhorumFormTable" cellspacing="0" border="0" style="width:99%">
<tr>
<td>{LANG->From}:&nbsp;</td>
<td>{MESSAGE->from_username}</td>
</tr>
<tr>
<td valign="top">{LANG->To}:&nbsp;</td>
<td valign="top" width="100%">
{! Show user selection}
{IF SHOW_USERSELECTION}
<div class="phorum-pmuserselection">
{IF USERS}
<select id="userselection" name="to_id" size="1" align="middle">
<option value=""> {LANG->PMSelectARecipient}</option>
{LOOP USERS}
<option value="{USERS->user_id}" <?php if (isset($_POST['to_id']) && $_POST['to_id'] == $PHORUM['TMP']['USERS']['user_id']) echo 'selected="selected"'?>>{USERS->displayname}</option>
{/LOOP USERS}
</select>
{ELSE}
<input type="text" id="userselection" name="to_name" value="<?php if (isset($_POST['to_name'])) echo htmlspecialchars($_POST['to_name'])?>" />
{/IF}
<input type="submit" class="PhorumSubmit" style="font-size: {smallfontsize}" name="rcpt_add" value="{LANG->PMAddRecipient}" />
{! Always show recipient list on a separate line}
{IF RECIPIENT_COUNT}<br style="clear:both" />{/IF}
</div>
{/IF}
{! Display the current list of recipients}
{LOOP MESSAGE->recipients}
<div class="phorum-recipientblock">
{MESSAGE->recipients->username}
<input type="hidden" name="recipients[{MESSAGE->recipients->user_id}]" value="{MESSAGE->recipients->username}" />
<input type="image" src="{delete_image}" name="del_rcpt::{MESSAGE->recipients->user_id}" style="margin-left: 3px;vertical-align:top">
</div>
{/LOOP MESSAGE->recipients}
</td>
</tr>
<tr>
<td>{LANG->Subject}:&nbsp;</td>
<td><input type="text" id="subject" name="subject" size="50" value="{MESSAGE->subject}" /></td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="keep" value="1"{IF MESSAGE->keep} checked="checked" {/IF} /> {LANG->KeepCopy}</td>
</tr>
</table>
</div>
<div class="PhorumStdBlock" style="width:99%; text-align: center">
<textarea id="message" name="message" rows="20" cols="50" style="width: 98%">{MESSAGE->message}</textarea>
<div style="margin-top: 3px; width:99%" align="right">
<input name="preview" type="submit" class="PhorumSubmit" value=" {LANG->Preview} " />
<input type="submit" class="PhorumSubmit" value=" {LANG->Post} " />
</div>
</div>
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_list_outgoing.tpl
New file
0,0 → 1,58
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left" width="20">
{ASSIGN ITEMCOUNT MESSAGECOUNT}
{INCLUDE pm_list_selectall}
</th>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap">{LANG->To}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap">{LANG->PMRead}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap">{LANG->Date}&nbsp;</th>
</tr>
{IF MESSAGECOUNT}
{LOOP MESSAGES}
<tr>
<td class="PhorumTableRow">
<input type="checkbox" name="checked[]" value="{MESSAGES->pm_message_id}" />
</td>
<td class="PhorumTableRow"><a href="{MESSAGES->read_url}">{MESSAGES->subject}</a></td>
<td class="PhorumTableRow" nowrap="nowrap">
{IF MESSAGES->recipient_count 1}
{LOOP MESSAGES->recipients}
<a href="{MESSAGES->recipients->to_profile_url}">{MESSAGES->recipients->username}</a>&nbsp;
{/LOOP MESSAGES->recipients}
{ELSE}
{MESSAGES->recipient_count}&nbsp;{LANG->Recipients}&nbsp;
{/IF}
</td>
<td class="PhorumTableRow" nowrap="nowrap" align="left">
{IF MESSAGES->recipient_count 1}
{LOOP MESSAGES->recipients}
{IF MESSAGES->recipients->read_flag}{LANG->Yes}{ELSE}{LANG->No}{/IF}
{/LOOP MESSAGES->recipients}
{ELSE}
{IF MESSAGES->receive_count MESSAGES->recipient_count}
{LANG->Yes}
{ELSE}
{MESSAGES->receive_count}&nbsp;{LANG->of}&nbsp;{MESSAGES->recipient_count}
{/IF}
{/IF}
</td>
<td class="PhorumTableRow" nowrap="nowrap" style="white-space:nowrap" width="1">
<div style="white-space:nowrap">{MESSAGES->date}&nbsp;</div>
</td>
</tr>
{/LOOP MESSAGES}
{ELSE}
<tr>
<td colspan="5" style="text-align: center" class="PhorumTableRow">
<br />
<i>{LANG->PMFolderIsEmpty}</i><br />
<br />
</td>
</tr>
{/IF}
</table>
<div class="PhorumStdBlock" style="border-top:none">
<input type="submit" name="delete" class="PhorumSubmit" value="{LANG->Delete}" onclick="return confirm('<?php echo addslashes($PHORUM['DATA']['LANG']['AreYouSure'])?>')" />
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/info.php
New file
0,0 → 1,10
<?php
 
if(!defined("PHORUM")) return;
 
$name="Default Phorum Template";
$version="0.4";
// uncomment this to hide this template from the user-select-box
//$template_hide=1;
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_preview.tpl
New file
0,0 → 1,25
<div class="PhorumStdBlockHeader" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Preview}:</span>&nbsp;{LANG->PreviewExplain}
</div>
<div class="PhorumStdBlock" style="text-align: left">
{IF PREVIEW->parent_id 0}
<div class="PhorumReadBodySubject">{PREVIEW->subject}</div>
{ELSE}
<div class="PhorumReadBodyHead"><strong>{PREVIEW->subject}</strong></div>
{/IF}
<div class="PhorumReadBodyHead">{LANG->Postedby}: <strong>{PREVIEW->author}</strong></div>
<div class="PhorumReadBodyHead">{LANG->Date}: {PREVIEW->datestamp}</div><br />
<div class="PhorumReadBodyText">{PREVIEW->body}</div><br />
{IF ATTACHMENTS}
{IF PREVIEW->attachments}
{LANG->Attachments}:
{LOOP PREVIEW->attachments}
{IF PREVIEW->attachments->keep}
<span style="white-space:nowrap">
<a href="{PREVIEW->attachments->url}">{PREVIEW->attachments->name} ({PREVIEW->attachments->size})</a>&nbsp;&nbsp;
</span>
{/IF}
{/LOOP PREVIEW->attachments}
{/IF}
{/IF}
</div><br />
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/loginout_menu.tpl
New file
0,0 → 1,0
{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->REGISTERPROFILE}">{LANG->MyProfile}</a>&bull;{IF ENABLE_PM}<a class="PhorumNavLink" href="{URL->PM}">{LANG->PrivateMessages}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{ELSE}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/message.tpl
New file
0,0 → 1,19
<div align="center">
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>{IF URL->TOP}&bull;<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>{/IF}&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<div class="PhorumStdBlock PhorumNarrowBlock">
{IF ERROR}
<div class="PhorumUserError">{ERROR}</div>
{/IF}
{IF MESSAGE}
<div class="PhorumFloatingText">{MESSAGE}</div>
{/IF}
{IF URL->CLICKHERE}
<div class="PhorumFloatingText"><a href="{URL->CLICKHERE}">{CLICKHEREMSG}</a></div>
{/IF}
{IF URL->REDIRECT}
<div class="PhorumFloatingText"><a href="{URL->REDIRECT}">{BACKMSG}</a></div>
{/IF}
</div>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/register.tpl
New file
0,0 → 1,35
{IF ERROR}
<div class="PhorumUserError">{ERROR}</div>
{/IF}
<div align="center">
<form action="{URL->ACTION}" method="post" style="display: inline;">
{POST_VARS}
<input type="hidden" name="forum_id" value="{REGISTER->forum_id}" />
<div class="PhorumNavBlock PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumNavHeading">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
</div>
<div class="PhorumStdBlockHeader PhorumNarrowBlock PhorumHeaderText" style="text-align: left;">{LANG->Register}</div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
<tr>
<td nowrap="nowrap">{LANG->Username}*:&nbsp;</td>
<td><input type="text" name="username" size="30" value="{REGISTER->username}" /></td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->Email}*:&nbsp;</td>
<td><input type="text" name="email" size="30" value="{REGISTER->email}" /></td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->Password}*:&nbsp;</td>
<td><input type="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td nowrap="nowrap">&nbsp;</td>
<td><input type="password" name="password2" size="30" value="" /> ({LANG->again})</td>
</tr>
</table>
<div style="float: left; margin-top: 5px;">*{LANG->Required}</div>
<div style="margin-top: 3px;" align="right"><input type="submit" class="PhorumSubmit" value=" {LANG->Submit} " /></div>
</div>
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/read_threads.tpl
New file
0,0 → 1,69
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->MARKTHREADREAD}">{LANG->MarkThreadRead}</a>&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{ELSE}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/IF}
</div>
{IF MESSAGE->is_unapproved}
<div class="PhorumStdBlock">
<div class="PhorumReadBodyHead"><strong>{LANG->UnapprovedMessage}</strong></div>
</div>
{/IF}
<div class="PhorumStdBlock">
<div class="PhorumReadBodySubject">{MESSAGE->subject}</div>
<div class="PhorumReadBodyHead">{LANG->Postedby}: <strong>{MESSAGE->linked_author}</strong> ({MESSAGE->ip})</div>
<div class="PhorumReadBodyHead">{LANG->Date}: {MESSAGE->datestamp}</div><br />
<div class="PhorumReadBodyText">{MESSAGE->body}</div><br />
{IF ATTACHMENTS}
{IF MESSAGE->attachments}
{LANG->Attachments}:
{ASSIGN MESSAGE_ATTACHMENTS MESSAGE->attachments}
{LOOP MESSAGE_ATTACHMENTS}
<a href="{MESSAGE_ATTACHMENTS->url}">{MESSAGE_ATTACHMENTS->name} ({MESSAGE_ATTACHMENTS->size})</a>&nbsp;&nbsp;
{/LOOP MESSAGE_ATTACHMENTS}
{/IF}
{/IF}
</div>
{IF MODERATOR true}
<div class="PhorumReadNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Moderate}:</span>&nbsp;{IF MESSAGE->threadstart true}<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{MESSAGE->delete_url2}';">{LANG->DeleteThread}</a>&bull;{IF MESSAGE->move_url}<a class="PhorumNavLink" href="{MESSAGE->move_url}">{LANG->MoveThread}</a>&bull;{/IF}<a class="PhorumNavLink" href="{MESSAGE->merge_url}">{LANG->MergeThread}</a>&bull;{IF MESSAGE->closed false}<a class="PhorumNavLink" href="{MESSAGE->close_url}">{LANG->CloseThread}</a>{ELSE}<a class="PhorumNavLink" href="{MESSAGE->reopen_url}">{LANG->ReopenThread}</a>{/IF}{ELSE}<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteMessage}')) window.location='{MESSAGE->delete_url1}';">{LANG->DeleteMessage}</a>&bull;<a class="PhorumNavLink" href="javascript:if(window.confirm('{LANG->ConfirmDeleteMessage}')) window.location='{MESSAGE->delete_url2}';">{LANG->DelMessReplies}</a>&bull;<a class="PhorumNavLink" href="{MESSAGE->split_url}">{LANG->SplitThread}</a>{/IF}{IF MESSAGE->is_unapproved}&bull;<a class="PhorumNavLink" href="{MESSAGE->approve_url}">{LANG->ApproveMessage}</a>{ELSE}&bull;<a class="PhorumNavLink" href="{MESSAGE->hide_url}">{LANG->HideMessage}</a>{/IF}&bull;<a class="PhorumNavLink" href="{MESSAGE->edit_url}">{LANG->EditPost}</a>
</div>
{/IF}
<div class="PhorumNavBlock">
<div style="float: right;">
<span class="PhorumNavHeading">{LANG->Navigate}:</span>&nbsp;<a class="PhorumNavLink" href="{MESSAGE->prev_url}">{LANG->PreviousMessage}</a>&bull;<a class="PhorumNavLink" href="{MESSAGE->next_url}">{LANG->NextMessage}</a>
</div>
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Options}:</span>&nbsp;<a class="PhorumNavLink" href="{MESSAGE->reply_url}">{LANG->Reply}</a>&bull;<a class="PhorumNavLink" href="{MESSAGE->quote_url}">{LANG->QuoteMessage}</a>{IF LOGGEDIN}{IF MESSAGE->private_reply_url}&bull;<a class="PhorumNavLink" href="{MESSAGE->private_reply_url}">{LANG->PrivateReply}</a>{/IF}&bull;<a class="PhorumNavLink" href="{MESSAGE->follow_url}">{LANG->FollowThread}</a>&bull;<a class="PhorumNavLink" href="{MESSAGE->report_url}">{LANG->Report}</a>{/IF}{IF MESSAGE->edit 1}&bull;<a class="PhorumNavLink" href="{MESSAGE->edituser_url}">{LANG->EditPost}</a>{/IF}
</div><br /><br />
<table class="PhorumStdTable" cellspacing="0">
<tr>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
{IF VIEWCOUNT_COLUMN}
<th class="PhorumTableHeader" align="center">{LANG->Views}</th>
{/IF}
<th class="PhorumTableHeader" align="left" nowrap>{LANG->WrittenBy}</th>
<th class="PhorumTableHeader" align="left" nowrap>{LANG->Posted}</th>
</tr>
<?php $rclass="Alt"; ?>
{LOOP MESSAGES}
<?php if($rclass=="Alt") $rclass=""; else $rclass="Alt"; ?>
<tr>
<td class="PhorumTableRow<?php echo $rclass;?>" style="padding-left: {MESSAGES->indent_cnt}px">
{marker}
<?php
if($PHORUM['TMP']['MESSAGES']['message_id'] == $PHORUM['DATA']['MESSAGE']['message_id']) {
echo '<b>'. $PHORUM['TMP']['MESSAGES']['subject'].'</b>';
} else {
?>
<a href="{MESSAGES->url}">{MESSAGES->subject}</a>
<span class="PhorumNewFlag">{MESSAGES->new}</span>
<?php
}
?>
{IF MESSAGES->is_unapproved} ({LANG->UnapprovedMessage}){/IF}
</td>
{IF VIEWCOUNT_COLUMN}
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap" align="center" width="80">{MESSAGES->viewcount}</td>
{/IF}
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap" width="150">{MESSAGES->linked_author}</td>
<td class="PhorumTableRow<?php echo $rclass;?> PhorumSmallFont" nowrap="nowrap" width="150">{MESSAGES->short_datestamp}</td>
</tr>
{/LOOP MESSAGES}
</table><br /><br />
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/move_form.tpl
New file
0,0 → 1,25
<div align="center">
{INCLUDE posting_menu}
<form method="POST" action="{URL->ACTION}">
{POST_VARS}
<input type="hidden" name="forum_id" value="{FORM->forum_id}" />
<input type="hidden" name="thread" value="{FORM->thread_id}" />
<input type="hidden" name="mod_step" value="{FORM->mod_step}" />
<div class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;">
<span class="PhorumHeadingLeft">{LANG->MoveThread}</span>
</div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->MoveThreadTo}:<br />
<select name="moveto">
<option value="0">{LANG->SelectForum}</option>
{LOOP FORUMS}
<option value="{FORUMS->forum_id}">{FORUMS->name}</option>
{/LOOP FORUMS}
</select><br /><br />
<input type="checkbox" name="create_notification" value="1">{LANG->MoveNotification}<br /><br />
<input type="submit" class="PhorumSubmit" name="move" value="{LANG->MoveThread}" />
</div>
</div>
</form>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_list_incoming.tpl
New file
0,0 → 1,45
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left" width="20">
{ASSIGN ITEMCOUNT MESSAGECOUNT}
{INCLUDE pm_list_selectall}
</th>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap">{LANG->From}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap">{LANG->Date}&nbsp;</th>
</tr>
{IF MESSAGECOUNT}
{LOOP MESSAGES}
<tr>
<td class="PhorumTableRow">
<input type="checkbox" name="checked[]" value="{MESSAGES->pm_message_id}" />
</td>
<td class="PhorumTableRow">
<a href="{MESSAGES->read_url}">{MESSAGES->subject}</a>
{IF NOT MESSAGES->read_flag}
<span class="PhorumNewFlag">&nbsp;{LANG->newflag}</span>
{/IF}
</td>
<td class="PhorumTableRow" nowrap="nowrap">
<a href="{MESSAGES->from_profile_url}">{MESSAGES->from_username}</a>&nbsp;
</td>
<td class="PhorumTableRow" nowrap="nowrap" width="1">
<div style="white-space:nowrap">{MESSAGES->date}&nbsp;</div>
</td>
</tr>
{/LOOP MESSAGES}
{ELSE}
<tr>
<td colspan="4" style="text-align: center" class="PhorumTableRow">
<br />
<i>{LANG->PMFolderIsEmpty}</i><br />
<br />
</td>
</tr>
{/IF}
</table>
<div class="PhorumStdBlock" style="border-top:none">
{VAR MOVE_SUBMIT_NAME move}
{INCLUDE pm_moveselect}
<input type="submit" name="delete" class="PhorumSubmit" value="{LANG->Delete}" onclick="return confirm('<?php echo addslashes($PHORUM['DATA']['LANG']['AreYouSure'])?>')" />
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/pm_max_messagecount.tpl
New file
0,0 → 1,27
{IF MAX_PM_MESSAGECOUNT}
<?php
$avail = $PHORUM['DATA']['PM_SPACE_LEFT'];
$used = $PHORUM['DATA']['PM_MESSAGECOUNT'];
$total = $avail + $used;
$size = 130;
$usedsize = ceil($used/$total * $size);
$usedperc = floor($used/$total * 100 + 0.5);
?>
<div class="phorum-menu" style="margin-top: 6px">
<div style="text-align: center; padding: 10px 0px 10px 0px">
<div style="padding-bottom: 10px">
{IF PM_SPACE_LEFT}
{LANG->PMSpaceLeft}
{ELSE}
{LANG->PMSpaceFull}
{/IF}
</div>
<table class="phorum-gaugetable" align="center">
<tr>
<td class="phorum-gaugeprefix"><?php echo "{$usedperc}%" ?></td>
<td class="phorum-gauge" width="<?php echo $size?>"><img align="left" src="{gauge_image}" width="<?php echo $usedsize?>" height="16px" /></td>
</tr>
</table>
</div>
</div>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/footer.tpl
New file
0,0 → 1,8
<div class="PhorumFooterPlug" align="center">
This <a href="http://www.phorum.org/">forum</a> powered by <a href="http://www.phorum.org/">Phorum</a>.
</div>
{! these are the two div´s from header.tpl }
</div>
</div>
</body>
</html>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/settings.tpl
New file
0,0 → 1,93
{! --- defines are used by the engine and vars are used by the template --- }
 
{! --- This is used to indent messages in threaded view --- }
{define indentstring &nbsp;&nbsp;&nbsp;}
{! --- How many px to indent for each level --- }
{define indentmultiplier 15}
 
{! --- This is used to load the message-bodies in the message-list for that template if set to 1 --- }
{define bodies_in_list 0}
 
{! --- This is the marker for messages in threaded view --- }
 
{define marker <img src="templates/default/images/carat.gif" border="0" width="8" height="8" alt="" style="vertical-align: middle;" />&nbsp;}
 
{! -- This is the image to use as a delete button for recipients in PM --- }
 
{var delete_image templates/default/images/delete.gif}
 
{! -- This is the image for the gauge bar to show how full the PM box is -- }
 
{var gauge_image templates/default/images/gauge.gif}
 
{! --- these are the colors used in the style sheet --- }
 
{! --- you can use them or replace them in the style sheet --- }
 
 
 
{! --- common body-colors --- }
{var bodybackground White}
{var defaulttextcolor Black}
{var backcolor White}
{var forumwidth 100%}
{var forumalign center}
{var newflagcolor #CC0000}
{var errorfontcolor Red}
{var okmsgfontcolor DarkGreen}
 
{! --- for the forum-list ... alternating colors --- }
{var altbackcolor #EEEEEE}
{var altlisttextcolor #000000}
 
{! --- common link-settings --- }
{var linkcolor #000099}
{var activelinkcolor #FF6600}
{var visitedlinkcolor #000099}
{var hoverlinkcolor #FF6600}
 
{! --- for the Navigation --- }
{var navbackcolor #EEEEEE}
{var navtextcolor #000000}
{var navhoverbackcolor #FFFFFF}
{var navhoverlinkcolor #FF6600}
{var navtextweight normal}
{var navfont Lucida Sans Unicode, Lucida Grande, Arial}
{var navfontsize 12px}
 
{! --- for the PhorumHead ... the list-header --- }
{var headerbackcolor #EEEEEE}
{var headertextcolor #000000}
{var headertextweight bold}
{var headerfont Lucida Sans Unicode, Lucida Grande, Arial}
{var headerfontsize 12px}
 
 
 
{var tablebordercolor #808080}
 
{var listlinecolor #F2F2F2}
 
{var listpagelinkcolor #707070}
{var listmodlinkcolor #707070}
 
 
 
 
 
{! --- You can set the table width globaly here ... ONLY tables, no divs are changed--- }
{var tablewidth 100%}
{var narrowtablewidth 600px}
 
 
 
{! --- Some font stuff --- }
{var defaultfont "Bitstream Vera Sans", "Lucida Sans Unicode", "Lucida Grande", Arial}
{var largefont "Bitstream Vera Sans", "Trebuchet MS", Verdana, Arial, sans-serif}
{var tinyfont "Bitstream Vera Sans", Arial, sans-serif}
{var fixedfont Lucida Console, Andale Mono, Courier New, Courier}
{var defaultfontsize 12px}
{var defaultboldfontsize 13px}
{var largefontsize 16px}
{var smallfontsize 11px}
{var tinyfontsize 10px}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/posting_buttons.tpl
New file
0,0 → 1,8
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: right; border-top: none">
{HOOK tpl_editor_buttons}
<input type="submit" name="preview" class="PhorumSubmit" value=" {LANG->Preview} " />
<input type="submit" name="finish" class="PhorumSubmit" value=" {POST->submitbutton_text} " />
{IF SHOW_CANCEL_BUTTON}
<input type="submit" name="cancel" onclick="return confirm('{LANG->CancelConfirm}')" class="PhorumSubmit" value=" {LANG->Cancel} " />
{/IF}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_groupmod.tpl
New file
0,0 → 1,77
{IF Message}
<div class="PhorumUserError">{Message}</div>
{/IF}
{IF GROUP->name}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->AddToGroup} {GROUP->name}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<form method="post" action="{GROUP->url}">
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
{IF NEWMEMBERS}
<select name="adduser">
<option value="0">&nbsp;</option>
{LOOP NEWMEMBERS}
<option value="{NEWMEMBERS->username}">{NEWMEMBERS->displayname}</option>
{/LOOP NEWMEMBERS}
</select>
{ELSE}
<input type="text" name="adduser" />
{/IF}
<input type="submit" value="{LANG->Add}" />
</form>
</div><br />
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->GroupMemberList} {GROUP->name}</div>
<div class="PhorumStdBlock" style="text-align: left;">
{LANG->Filter}:
{LOOP FILTER}
[{IF FILTER->enable}<a href="{FILTER->url}">{/IF}{FILTER->name}{IF FILTER->enable}</a>{/IF}]
{/LOOP FILTER}
<br /><br />
<form method="post" action="{GROUP->url}">
<table class="PhorumFormTable" cellspacing="0" border="0">
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<tr>
<th>{LANG->Username}</th>
<th>{LANG->MembershipType}</th>
</tr>
{LOOP USERS}
<tr>
<td>
{IF USERS->flag}<strong><em>{/IF}<a href="{USERS->profile}">{USERS->displayname}</a>{IF USERS->flag}</em></strong>{/IF}
</td>
<td>
{IF USERS->disabled}
{USERS->statustext}
{ELSE}
<select name="status[{USERS->userid}]">
{LOOP STATUS_OPTIONS}
<?php
// to get around a minor templating problem, we'll figure
// out if we have this line selected here
$PHORUM['TMP']['STATUS_OPTIONS']['selected'] = ($PHORUM['TMP']['STATUS_OPTIONS']['value'] == $PHORUM['TMP']['USERS']['status']);
?>
<option value="{STATUS_OPTIONS->value}"{IF STATUS_OPTIONS->selected} selected="selected"{/IF}>{STATUS_OPTIONS->name}</option>
{/LOOP STATUS_OPTIONS}
</select>
{/IF}
</td>
</tr>
{/LOOP USERS}
<tr>
<td colspan="2"><input type="submit" value="{LANG->SaveChanges}" /></td>
</tr>
</table>
</form>
</div>
{ELSE}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->SelectGroupMod}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
{LOOP GROUPS}
<tr>
<td><a href="{GROUPS->url}">{GROUPS->name}</a></td>
<td><a href="{GROUPS->unapproved_url}">{GROUPS->unapproved} {LANG->Unapproved}</a></td>
</tr>
{/LOOP GROUPS}
</table>
</div>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_prepost.tpl
New file
0,0 → 1,54
<form action="{URL->ACTION}" method="POST">
{POST_VARS}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->UnapprovedMessages}</div>
<div class="PhorumStdBlock PhorumFloatingText" style="text-align: left;">
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
{LANG->ShowOnlyMessages}&nbsp;
<select name="onlyunapproved">
<option value="0"{IF SELECTED_2 0} selected="selected"{/IF}>{LANG->AllNotShown}</option>
<option value="1"{IF SELECTED_2 1} selected="selected"{/IF}>{LANG->OnlyUnapproved}</option>
</select>
{LANG->DatePosted}&nbsp;
<select name="moddays">
<option value="1"{IF SELECTED 1} selected="selected"{/IF}>1 {LANG->Day}</option>
<option value="2"{IF SELECTED 2} selected="selected"{/IF}>2 {LANG->Days}</option>
<option value="7"{IF SELECTED 7} selected="selected"{/IF}>7 {LANG->Days}</option>
<option value="30"{IF SELECTED 30} selected="selected"{/IF}>1 {LANG->Month}</option>
<option value="180"{IF SELECTED 180} selected="selected"{/IF}>6 {LANG->Months}</option>
<option value="365"{IF SELECTED 365} selected="selected"{/IF}>1 {LANG->Year}</option>
<option value="0"{IF SELECTED 0} selected="selected"{/IF}>{LANG->AllDates}</option>
</select>
<input type="submit" class="PhorumSubmit" value="{LANG->Go}" />
</div>
</form><br />
<table border="0" cellspacing="0" class="PhorumStdTable">
{IF UNAPPROVEDMESSAGE}
<tr>
<td class="PhorumTableRow">
{UNAPPROVEDMESSAGE}
</td>
</tr>
{ELSE}
{LOOP PREPOST}
{IF PREPOST->checkvar 1}
<tr>
<th class="PhorumTableHeader" align="left" colspan="3">{PREPOST->forumname}</th>
</tr>
<tr>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->Author}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->Date}&nbsp;</th>
</tr>
{/IF}
<tr>
<td class="PhorumTableRow">
<?php echo $PHORUM['TMP']['marker'] ?><a href="{PREPOST->url}" target="_blank">{PREPOST->subject}</a><br />
<span class="PhorumListModLink">&nbsp;&nbsp;&nbsp;&nbsp;<a class="PhorumListModLink" href="{PREPOST->delete_url}">{LANG->DeleteMessage}</a>&nbsp;&bull;&nbsp;<a class="PhorumListModLink" href="{PREPOST->approve_url}">{LANG->ApproveMessage Short}</a>&nbsp;&bull;&nbsp;<a class="PhorumListModLink" href="{PREPOST->approve_tree_url}">{LANG->ApproveMessageReplies}</a></span>
</td>
<td class="PhorumTableRow" nowrap="nowrap" width="150">{PREPOST->linked_author}&nbsp;</td>
<td class="PhorumTableRow" nowrap="nowrap" width="150">{PREPOST->short_datestamp}&nbsp;</td>
</tr>
{/LOOP PREPOST}
{/IF}
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_start.tpl
New file
0,0 → 1,61
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->PersProfile}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
<tr>
<td>{LANG->Username}:</td>
<td>{PROFILE->username}</td>
</tr>
<tr>
<td>{LANG->RealName}:</td>
<td>{PROFILE->real_name}</td>
</tr>
<tr>
<td>{LANG->Email}:</td>
<td>{PROFILE->email}</td>
</tr>
<tr>
<td>{LANG->DateReg}:</td>
<td>{PROFILE->date_added}</td>
</tr>
{IF PROFILE->date_last_active}
<tr>
<td>{LANG->DateActive}:</td>
<td>{PROFILE->date_last_active}</td>
</tr>
{/IF}
<tr>
<td>{LANG->Posts}:</td>
<td>{PROFILE->posts}</td>
</tr>
<tr>
<td>{LANG->Signature}:</td>
<td>{PROFILE->signature_formatted}</td>
</tr>
</table>
</div>
{IF PROFILE->admin}{ASSIGN SHOWPERMS 1}{/IF}
{IF UserPerms}{ASSIGN SHOWPERMS 1}{/IF}
{IF SHOWPERMS}
<br />
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{LANG->UserPermissions}</div>
<div class="PhorumStdBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
{IF PROFILE->admin}
<tr>
<td>{LANG->PermAdministrator}</td>
</tr>
{ELSEIF UserPerms}
<tr>
<th>{LANG->Forum}</th>
<th>{LANG->Permission}</th>
</tr>
{LOOP UserPerms}
<tr>
<td>{UserPerms->forum}&nbsp;&nbsp;</td>
<td>{UserPerms->perm}</td>
</tr>
{/LOOP UserPerms}
{/IF}
</table>
</div>
{/IF}
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/cc_usersettings.tpl
New file
0,0 → 1,158
{IF ERROR}<div class="PhorumUserError">{ERROR}</div>{/IF}
{IF OKMSG}<div class="PhorumOkMsg">{OKMSG}</div>{/IF}
<form action="{URL->ACTION}" method="POST">
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left;">{PROFILE->block_title}</div>
{POST_VARS}
<input type="hidden" name="panel" value="{PROFILE->PANEL}" />
<input type="hidden" name="forum_id" value="{PROFILE->forum_id}" />
<div class="PhorumStdBlock" style="text-align: left;">
<table class="PhorumFormTable" cellspacing="0" border="0">
{IF PROFILE->USERPROFILE}
<tr>
<td nowrap="nowrap">{LANG->RealName}:&nbsp;</td>
<td><input type="text" name="real_name" size="30" value="{PROFILE->real_name}" /></td>
</tr>
{/IF}
{IF PROFILE->SIGSETTINGS}
<tr>
<td valign="top" nowrap="nowrap">{LANG->Signature}:&nbsp;</td>
<td width="100%"><textarea name="signature" rows="15" cols="50" style="width: 100%">{PROFILE->signature}</textarea></td>
</tr>
{/IF}
{IF PROFILE->MAILSETTINGS}
<tr>
<td valign="top">
{LANG->Email}*:&nbsp;
{IF PROFILE->EMAIL_CONFIRM}<br />{LANG->EmailConfirmRequired}{/IF}
</td>
<td><input type="text" name="email" size="30" value="{PROFILE->email}" /></td>
</tr>
{IF PROFILE->email_temp_part}
<tr>
<td valign="top">{LANG->EmailVerify}:&nbsp;</td>
<td>
{LANG->EmailVerifyDesc} {PROFILE->email_temp_part}<br>
{LANG->EmailVerifyEnterCode}: <input type="text" name="email_verify_code" value="" />
</td>
</tr>
{/IF}
<tr>
<td colspan="2"><input type="checkbox" name="hide_email" value="1"{PROFILE->hide_email_checked} /> {LANG->AllowSeeEmail}</td>
</tr>
{IF PROFILE->show_moderate_options}
<tr>
<td colspan="2"><input type="checkbox" name="moderation_email" value="1"{PROFILE->moderation_email_checked} /> {LANG->ReceiveModerationMails}</td>
</tr>
{/IF}
{/IF}
{IF PROFILE->PRIVACYSETTINGS}
<tr>
<td colspan="2"><input type="checkbox" name="hide_email" value="1"{PROFILE->hide_email_checked} /> {LANG->AllowSeeEmail}</td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="hide_activity" value="1"{PROFILE->hide_activity_checked} /> {LANG->AllowSeeActivity}</td>
</tr>
{/IF}
{IF PROFILE->BOARDSETTINGS}
{IF PROFILE->TZSELECTION}
<tr>
<td nowrap="nowrap">{LANG->Timezone}:&nbsp;</td>
<td>
<select name="tz_offset">
{LOOP TIMEZONE}
<option value="{TIMEZONE->tz}"{TIMEZONE->sel}>{TIMEZONE->str}</option>
{/LOOP TIMEZONE}
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->IsDST}:&nbsp;</td>
<td><input type="checkbox" name="is_dst" value="1"{IF PROFILE->is_dst 1} checked="checked"{/IF}></td>
</tr>
{/IF}
<tr>
<td nowrap="nowrap">{LANG->Language}:&nbsp;</td>
<td>
<select name="user_language">
{LOOP LANGUAGES}
<option value="{LANGUAGES->file}"{LANGUAGES->sel}>{LANGUAGES->name}</option>
{/LOOP LANGUAGES}
</select>
</td>
</tr>
{IF PROFILE->TMPLSELECTION}
<tr>
<td nowrap="nowrap">{LANG->Template}:&nbsp;</td>
<td>
<select name="user_template">
{LOOP TEMPLATES}
<option value="{TEMPLATES->file}"{TEMPLATES->sel}>{TEMPLATES->name}</option>
{/LOOP TEMPLATES}
</select>
</td>
</tr>
{/IF}
<tr>
<td nowrap="nowrap">{LANG->ThreadViewList}:&nbsp;</td>
<td>
<select name="threaded_list">
<option value="0">{LANG->Default}</option>
<option value="1" {IF PROFILE->threaded_list}selected{/IF}>{LANG->ViewThreaded}</option>
<option value="2" {IF PROFILE->threaded_list 2}selected{/IF}>{LANG->ViewFlat}</option>
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->ThreadViewRead}:&nbsp;</td>
<td>
<select name="threaded_read">
<option value="0">{LANG->Default}</option>
<option value="1" {IF PROFILE->threaded_read}selected{/IF}>{LANG->ViewThreaded}</option>
<option value="2" {IF PROFILE->threaded_read 2}selected{/IF}>{LANG->ViewFlat}</option>
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->EnableNotifyDefault}:&nbsp;</td>
<td>
<select name="email_notify">
<option value="0"{IF PROFILE->email_notify 0} selected="selected" {/IF}>{LANG->No}</option>
<option value="1"{IF PROFILE->email_notify 1} selected="selected" {/IF}>{LANG->Yes}</option>
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->AddSigDefault}:&nbsp;</td>
<td>
<select name="show_signature">
<option value="0"{IF PROFILE->show_signature 0} selected="selected" {/IF}>{LANG->No}</option>
<option value="1"{IF PROFILE->show_signature 1} selected="selected" {/IF}>{LANG->Yes}</option>
</select>
</td>
</tr>
<tr>
<td nowrap="nowrap">{LANG->PMNotifyEnableSetting}:&nbsp;</td>
<td>
<select name="pm_email_notify">
<option value="0"{IF PROFILE->pm_email_notify 0} selected="selected" {/IF}>{LANG->No}</option>
<option value="1"{IF PROFILE->pm_email_notify 1} selected="selected" {/IF}>{LANG->Yes}</option>
</select>
</td>
</tr>
{/IF}
{IF PROFILE->CHANGEPASSWORD}
<tr>
<td nowrap="nowrap">{LANG->Password}*:&nbsp;</td>
<td><input type="password" name="password" size="30" value="" /></td>
</tr>
<tr>
<td nowrap="nowrap">&nbsp;</td>
<td><input type="password" name="password2" size="30" value="" /> ({LANG->again})</td>
</tr>
{/IF}
{HOOK tpl_cc_usersettings PROFILE}
</table>
<div style="float: left; margin-top: 5px;">*{LANG->Required}</div>
<div style="margin-top: 3px;" align="center"><input type="submit" class="PhorumSubmit" value=" {LANG->Submit} " /></div>
</div>
</form>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/paging.tpl
New file
0,0 → 1,8
<div class="PhorumNavBlock" style="text-align: left;">
{IF NOT TOTALPAGES 1}
<div style="float: right;">
<span class="PhorumNavHeading">{LANG->Pages}:</span>&nbsp;{IF URL->PREVPAGE}<a class="PhorumNavLink" href="{URL->PREVPAGE}">{LANG->PrevPage}</a>{/IF}{IF URL->FIRSTPAGE}<a class="PhorumNavLink" href="{URL->FIRSTPAGE}">{LANG->FirstPage}...</a>{/IF}{LOOP PAGES}{IF PAGES->pageno CURRENTPAGE}<span class="PhorumNavLink"><strong>{PAGES->pageno}</strong></span>{ELSE}<a class="PhorumNavLink" href="{PAGES->url}">{PAGES->pageno}</a>{/IF}{/LOOP PAGES}{IF URL->LASTPAGE}<a class="PhorumNavLink" href="{URL->LASTPAGE}">...{LANG->LastPage}</a>{/IF}{IF URL->NEXTPAGE}<a class="PhorumNavLink" href="{URL->NEXTPAGE}">{LANG->NextPage}</a>{/IF}
</div>
{/IF}
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->CurrentPage}: </span>{CURRENTPAGE} {LANG->of} {TOTALPAGES}
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/search.tpl
New file
0,0 → 1,103
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}{IF URL->TOP}<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;{/IF}{IF URL->POST}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;{/IF}{INCLUDE loginout_menu}
</div><br />
{IF SEARCH->noresults}
<div align="center">
<div class="PhorumStdBlockHeader PhorumNarrowBlock PhorumHeaderText" style="text-align: left;">
{LANG->NoResults}
</div>
<div class="PhorumStdBlock PhorumNarrowBlock" style="text-align: left;">
<div class="PhorumFloatingText">
{LANG->NoResults Help}
</div>
</div>
</div><br />
{/IF}
{IF SEARCH->showresults}
{INCLUDE paging}
<div class="PhorumStdBlockHeader" style="text-align: left;">
<span class="PhorumHeadingLeft">{LANG->Results} {RANGE_START} - {RANGE_END} {LANG->of} {TOTAL}</span>
</div>
<div class="PhorumStdBlock">
{LOOP MATCHES}
<div class="PhorumRowBlock">
<div class="PhorumColumnFloatLarge">{MATCHES->datestamp}</div>
<div class="PhorumColumnFloatMedium">{MATCHES->author}</div>
<div style="margin-right: 370px" class="PhorumLargeFont">{MATCHES->number}.&nbsp;<a href="{MATCHES->url}">{MATCHES->subject}</a></div>
<div class="PhorumFloatingText">
{MATCHES->short_body}<br />
{IF MATCHES->forum_id}
{LANG->Forum}: <a href="{MATCHES->forum_url}">{MATCHES->forum_name}</a>
{ELSE}
({LANG->Announcement})
{/IF}
</div>
</div>
{/LOOP MATCHES}
</div>
{INCLUDE paging}
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;<a class="PhorumNavLink" href="{URL->TOP}">{LANG->MessageList}</a>&bull;<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;{IF LOGGEDIN true}<a class="PhorumNavLink" href="{URL->REGISTERPROFILE}">{LANG->MyProfile}</a>&bull;<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogOut}</a>{ELSE}<a class="PhorumNavLink" href="{URL->LOGINOUT}">{LANG->LogIn}</a>{/IF}
</div><br />
{/IF}
<table width=100% border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><b>{LANG->SearchMessages}</b></td>
<td style="width: 10px">&nbsp;</td>
<td class="PhorumStdBlockHeader PhorumNarrowBlock" style="text-align: left;"><b>{LANG->SearchAuthors}</b></td>
</tr>
<tr>
<td class="PhorumStdBlock PhorumNarrowBlock" style="padding: 10px;">
<form action="{URL->ACTION}" method="get" style="display: inline;">
<input type="hidden" name="forum_id" value="{SEARCH->forum_id}" />
{POST_VARS}
<input type="text" name="search" id="phorum_search_message" size="30" maxlength="" value="{SEARCH->safe_search}" />&nbsp;<input type="submit" value="{LANG->Search}" /><br />
<div style="margin-top: 3px;">
<select name="match_forum">
<option value="ALL" {IF SEARCH->match_forum ALL}selected{/IF}>{LANG->MatchAllForums}</option>
{IF SEARCH->allow_match_one_forum}
<option value="THISONE" {IF SEARCH->match_forum THISONE}selected{/IF}>{LANG->MatchThisForum}</option>
{/IF}
</select>
</div>
<div style="margin-top: 3px;">
<select name="match_dates">
<option value="30" {IF SEARCH->match_dates 30}selected{/IF}>{LANG->Last30Days}</option>
<option value="90" {IF SEARCH->match_dates 90}selected{/IF}>{LANG->Last90Days}</option>
<option value="365" {IF SEARCH->match_dates 365}selected{/IF}>{LANG->Last365Days}</option>
<option value="0" {IF SEARCH->match_dates 0}selected{/IF}>{LANG->AllDates}</option>
</select>&nbsp;<select name="match_type">
<option value="ALL" {IF SEARCH->match_type ALL}selected{/IF}>{LANG->MatchAll}</option>
<option value="ANY" {IF SEARCH->match_type ANY}selected{/IF}>{LANG->MatchAny}</option>
<option value="PHRASE" {IF SEARCH->match_type PHRASE}selected{/IF}>{LANG->MatchPhrase}</option>
</select>
</div>
</form>
</td>
<td style="width: 10px">&nbsp;</td>
<td class="PhorumStdBlock PhorumNarrowBlock" style="padding: 10px;">
<form action="{URL->ACTION}" method="get" style="display: inline;">
<input type="hidden" name="forum_id" value="{SEARCH->forum_id}" />
<input type="hidden" name="match_type" value="AUTHOR" />
{POST_VARS}
<input type="text" id="phorum_search_author" name="search" size="30" maxlength="" value="{SEARCH->safe_search}" />&nbsp;<input type="submit" value="{LANG->Search}" /><br />
<div style="margin-top: 3px;">
<select name="match_forum">
<option value="ALL" {IF SEARCH->match_forum ALL}selected{/IF}>{LANG->MatchAllForums}</option>
{IF SEARCH->allow_match_one_forum}
<option value="THISONE" {IF SEARCH->match_forum THISONE}selected{/IF}>{LANG->MatchThisForum}</option>
{/IF}
</select>
</div>
<div style="margin-top: 3px;">
<select name="match_dates">
<option value="30" {IF SEARCH->match_dates 30}selected{/IF}>{LANG->Last30Days}</option>
<option value="90" {IF SEARCH->match_dates 90}selected{/IF}>{LANG->Last90Days}</option>
<option value="365" {IF SEARCH->match_dates 365}selected{/IF}>{LANG->Last365Days}</option>
<option value="0" {IF SEARCH->match_dates 0}selected{/IF}>{LANG->AllDates}</option>
</select>
</div>
</form>
</td>
</tr>
</table>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/default/stdblock.tpl
New file
0,0 → 1,6
<div align="center">
{IF BLOCK_TITLE}
<div class="PhorumStdBlockHeader PhorumHeaderText" style="text-align: left; margin-top: 5px;">{BLOCK_TITLE}</div>
{/IF}
<div class="PhorumStdBlock">{BLOCK_CONTENT}</div>
</div>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/templates/.htaccess
New file
0,0 → 1,4
<Files ~ "\.tpl$">
Order allow,deny
Deny from all
</Files>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/login.php
New file
0,0 → 1,274
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','login');
 
include_once( "./common.php" );
include_once( "./include/users.php" );
include_once( "./include/email_functions.php" );
 
// ----------------------------------------------------------------------------
// Handle logout
// ----------------------------------------------------------------------------
 
if ($PHORUM['DATA']['LOGGEDIN'] && !empty($PHORUM["args"]["logout"])) {
 
// killing long-term cookie
phorum_user_clear_session(PHORUM_SESSION_LONG_TERM);
// killing short-term (write) cookie
phorum_user_clear_session(PHORUM_SESSION_SHORT_TERM);
 
// reset the sessid if not using cookies
if(!$PHORUM['use_cookies']) {
 
$new_sessid=md5($_POST['username'].microtime().$_POST['password']);
 
$user=array(
'user_id'=>$PHORUM['user']['user_id'],
'sessid_st'=>$new_sessid
);
phorum_user_save_simple($user);
}
 
 
// Determine the URL to redirect the user to. The hook "after_logout"
// can be used by module writers to set a custom redirect URL.
if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER["HTTP_REFERER"];
} else {
$url = phorum_get_url(PHORUM_LIST_URL);
}
 
// Strip the session id from the URL in case URI auth is in use.
if (stristr($url, PHORUM_SESSION_LONG_TERM)){
$url = str_replace(PHORUM_SESSION_LONG_TERM."=".urlencode($PHORUM["args"][PHORUM_SESSION_LONG_TERM]), "", $url);
}
 
$url = phorum_hook("after_logout", $url);
 
phorum_redirect_by_url($url);
exit();
}
 
// ----------------------------------------------------------------------------
// Handle login and password reminder
// ----------------------------------------------------------------------------
 
// Set all our URLs.
phorum_build_common_urls();
 
$template = "login";
$error = "";
$okmsg = "";
$username = "";
 
// Handle posted form data.
if (count($_POST) > 0) {
 
// The user wants to retrieve a new password.
if (isset($_POST["lostpass"])) {
 
// Trim the email address.
$_POST["lostpass"] = trim($_POST["lostpass"]);
 
// Did the user enter an email address?
if (empty($_POST["lostpass"])) {
$error = $PHORUM["DATA"]["LANG"]["LostPassError"];
}
 
// Is the email address available in the database?
elseif ($uid = phorum_user_check_email($_POST["lostpass"])) {
 
// An existing user id was found for the entered email
// address. Retrieve the user.
$user = phorum_user_get($uid);
 
$tmp_user=array();
 
// User registration not yet approved by a moderator.
if($user["active"] == PHORUM_USER_PENDING_MOD) {
$template = "message";
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyMod"];
// User registration still need email verification.
} elseif ($user["active"] == PHORUM_USER_PENDING_EMAIL ||
$user["active"] == PHORUM_USER_PENDING_BOTH) {
 
// Generate and store a new email confirmation code.
$tmp_user["user_id"] = $uid;
$tmp_user["password_temp"] = substr(md5(microtime()), 0, 8);
phorum_user_save( $tmp_user );
 
// Mail the new confirmation code to the user.
$verify_url = phorum_get_url(PHORUM_REGISTER_URL, "approve=".$tmp_user["password_temp"]."$uid");
$maildata["mailsubject"] = $PHORUM["DATA"]["LANG"]["VerifyRegEmailSubject"];
$maildata["mailmessage"] =
wordwrap($PHORUM["DATA"]["LANG"]["VerifyRegEmailBody1"],72).
"\n\n$verify_url\n\n".
wordwrap($PHORUM["DATA"]["LANG"]["VerifyRegEmailBody2"],72);
phorum_email_user(array($user["email"]), $maildata);
 
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyEmail"];
$template="message";
 
// The user is active.
} else {
 
// Generate and store a new password for the user.
include_once( "./include/profile_functions.php" );
$newpass = phorum_gen_password();
$tmp_user["user_id"] = $uid;
$tmp_user["password_temp"] = $newpass;
phorum_user_save($tmp_user);
 
// Mail the new password.
$user = phorum_user_get( $uid );
$maildata = array();
$maildata['mailmessage'] =
wordwrap($PHORUM["DATA"]["LANG"]["LostPassEmailBody1"],72).
"\n\n".
$PHORUM["DATA"]["LANG"]["Username"] .": $user[username]\n".
$PHORUM["DATA"]["LANG"]["Password"] .": $newpass".
"\n\n".
wordwrap($PHORUM["DATA"]["LANG"]["LostPassEmailBody2"],72);
$maildata['mailsubject'] = $PHORUM["DATA"]["LANG"]["LostPassEmailSubject"];
phorum_email_user(array( 0 => $user['email'] ), $maildata);
 
$okmsg = $PHORUM["DATA"]["LANG"]["LostPassSent"];
 
}
}
 
// The entered email address was not found.
else {
$error = $PHORUM["DATA"]["LANG"]["LostPassError"];
}
}
 
// The user wants to login.
else {
 
// Check if the phorum_tmp_cookie was set. If not, the user's
// browser does not support cookies.
if($PHORUM["use_cookies"] && !isset($_COOKIE["phorum_tmp_cookie"])) {
$PHORUM["use_cookies"] = false;
}
 
$username = trim($_POST["username"]);
$password = trim($_POST["password"]);
 
// Check if the login credentials are right.
if (phorum_user_check_login($username, $password)) {
 
// Destroy the temporary cookie.
if(isset($_COOKIE["phorum_tmp_cookie"])){
setcookie( "phorum_tmp_cookie", "", 0, $PHORUM["session_path"], $PHORUM["session_domain"] );
}
 
// Create an URI session id if cookies are not used..
if(!$PHORUM["use_cookies"]) {
$uri_session_id = md5($_POST['username'].microtime().$_POST['password']);
$user = array(
'user_id' => $PHORUM['user']['user_id'],
'sessid_st'=> $uri_session_id
);
phorum_user_save_simple($user);
phorum_user_create_session(PHORUM_SESSION_LONG_TERM,true,$uri_session_id);
// Create cookie session(s).
} else {
if (!$PHORUM["DATA"]["LOGGEDIN"]) {
phorum_user_create_session(PHORUM_SESSION_LONG_TERM, false);
}
if($PHORUM["tight_security"]){
phorum_user_create_session(PHORUM_SESSION_SHORT_TERM, true);
}
}
 
// Determine the URL to redirect the user to.
// If redir is a number, it is a URL constant.
if(is_numeric($_POST["redir"])){
$redir = phorum_get_url($_POST["redir"]);
}
 
// Redirecting to the registration or login page is a little weird,
// so we just go to the list page if we came from one of those.
elseif (isset($PHORUM['use_cookies']) && $PHORUM["use_cookies"] && !strstr($_POST["redir"], "register." . PHORUM_FILE_EXTENSION) && !strstr($_POST["redir"], "login." . PHORUM_FILE_EXTENSION)) {
$redir = $_POST["redir"];
 
// By default, we redirect to the list page.
} else {
$redir = phorum_get_url( PHORUM_LIST_URL );
}
 
// The hook "after_login" can be used by module writers to
// set a custom redirect URL.
$redir =phorum_hook( "after_login", $redir );
 
phorum_redirect_by_url($redir);
exit();
}
 
// Login failed.
else {
$error = $PHORUM["DATA"]["LANG"]["InvalidLogin"];
}
}
}
 
// No data posted, so this is the first request. Here we set
// a temporary cookie, so we can check if the user's browser
// supports cookies.
elseif($PHORUM["use_cookies"]) {
setcookie( "phorum_tmp_cookie", "this will be destroyed once logged in", 0, $PHORUM["session_path"], $PHORUM["session_domain"] );
}
 
// Determine to what URL the user must be redirected after login.
if (!empty( $PHORUM["args"]["redir"])) {
$redir = htmlspecialchars(urldecode($PHORUM["args"]["redir"]));
} elseif (!empty( $_REQUEST["redir"])) {
$redir = htmlspecialchars($_REQUEST["redir"]);
} elseif (!empty( $_SERVER["HTTP_REFERER"])) {
$base = strtolower(phorum_get_url(PHORUM_BASE_URL));
$len = strlen($base);
if (strtolower(substr($_SERVER["HTTP_REFERER"],0,$len)) == $base) {
$redir = htmlspecialchars($_SERVER["HTTP_REFERER"]);
}
}
if (! isset($redir)) {
$redir = phorum_get_url(PHORUM_LIST_URL);
}
 
// Setup template data.
$PHORUM["DATA"]["LOGIN"]["redir"] = $redir;
$PHORUM["DATA"]["URL"]["REGISTER"] = phorum_get_url( PHORUM_REGISTER_URL );
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url( PHORUM_LOGIN_ACTION_URL );
$PHORUM["DATA"]["LOGIN"]["forum_id"] = ( int )$PHORUM["forum_id"];
$PHORUM["DATA"]["LOGIN"]["username"] = htmlspecialchars( $username );
$PHORUM["DATA"]["ERROR"] = htmlspecialchars( $error );
$PHORUM["DATA"]["OKMSG"] = htmlspecialchars( $okmsg );
 
// Set the field to set the focus to after loading.
$PHORUM["DATA"]["FOCUS_TO_ID"] = empty($username) ? "username" : "password";
 
// Display the page.
include phorum_get_template( "header" );
phorum_hook( "after_header" );
include phorum_get_template( $template );
phorum_hook( "before_footer" );
include phorum_get_template( "footer" );
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/list.php
New file
0,0 → 1,452
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','list');
 
include_once("./common.php");
include_once("./include/format_functions.php");
 
// set all our common URL's
phorum_build_common_urls();
 
if(!phorum_check_read_common()) {
return;
}
 
 
if(empty($PHORUM["forum_id"])){
$dest_url = phorum_get_url(PHORUM_INDEX_URL);
phorum_redirect_by_url($dest_url);
exit();
}
 
// somehow we got to a folder in list.php
if($PHORUM["folder_flag"]){
$dest_url = phorum_get_url(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
phorum_redirect_by_url($dest_url);
exit();
}
 
// check for markread
if (!empty($PHORUM["args"][1]) && $PHORUM["args"][1] == 'markread'){
// setting all posts read
unset($PHORUM['user']['newinfo']);
phorum_db_newflag_allread();
 
// redirect to a fresh list without markread in url
$dest_url = phorum_get_url(PHORUM_LIST_URL);
phorum_redirect_by_url($dest_url);
exit();
 
}
 
if ($PHORUM["DATA"]["LOGGEDIN"]) { // reading newflags in
$PHORUM['user']['newinfo']=phorum_db_newflag_get_flags();
}
 
// figure out what page we are on
if (empty($PHORUM["args"]["page"]) || !is_numeric($PHORUM["args"]["page"]) || $PHORUM["args"]["page"] < 0){
$page=1;
} else {
$page=intval($PHORUM["args"]["page"]);
}
$offset=$page-1;
 
// check the moderation-settings
$PHORUM["DATA"]["MODERATOR"] = phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
 
$build_move_url=false;
if($PHORUM["DATA"]["MODERATOR"]) {
// find out how many forums this user can moderate
$forums=phorum_db_get_forums(0,-1,$PHORUM['vroot']);
 
$modforums=0;
foreach($forums as $id=>$forum){
if($forum["folder_flag"]==0 && phorum_user_moderate_allowed($id)){
$modforums++;
}
if($modforums > 1) {
$build_move_url=true;
break;
}
}
}
// Get the threads
$rows = array();
 
// get the thread set started
$rows = phorum_db_get_thread_list($offset);
 
// redirect if invalid page
if(count($rows) < 1 && $offset > 0){
$dest_url = phorum_get_url(PHORUM_LIST_URL);
phorum_redirect_by_url($dest_url);
exit();
}
 
if($PHORUM['threaded_list']) { // make it simpler :)
$PHORUM["list_length"] = $PHORUM['list_length_threaded'];
} else {
$PHORUM["list_length"] = $PHORUM['list_length_flat'];
}
 
// Figure out paging for threaded and flat mode. Sticky messages
// are in the thread_count, but because these are handled as a separate
// list (together with the announcements), they should not be included
// in the pages computation.
$pages=ceil(($PHORUM["thread_count"] - $PHORUM['sticky_count']) / $PHORUM["list_length"]);
 
// If we only have stickies and/of announcements, the number of pages
// will be zero. In that case, simply use one page.
if ($pages == 0) $pages = 1;
 
if($pages<=11){
$page_start=1;
} elseif($pages-$page<5) {
$page_start=$pages-10;
} elseif($pages>11 && $page>6){
$page_start=$page-5;
} else {
$page_start=1;
}
 
$pageno=1;
for($x=0;$x<11 && $x<$pages;$x++){
$pageno=$x+$page_start;
$PHORUM["DATA"]["PAGES"][] = array(
"pageno"=>$pageno,
"url"=>phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "page=$pageno")
);
}
 
$PHORUM["DATA"]["CURRENTPAGE"]=$page;
$PHORUM["DATA"]["TOTALPAGES"]=$pages;
 
if($page_start>1){
$PHORUM["DATA"]["URL"]["FIRSTPAGE"]=phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "page=1");
}
 
if($pageno<$pages){
$PHORUM["DATA"]["URL"]["LASTPAGE"]=phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "page=$pages");
}
 
if($pages>$page){
$nextpage=$page+1;
$PHORUM["DATA"]["URL"]["NEXTPAGE"]=phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "page=$nextpage");
}
if($page>1){
$prevpage=$page-1;
$PHORUM["DATA"]["URL"]["PREVPAGE"]=phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "page=$prevpage");
}
 
$min_id=0;
if ($PHORUM["threaded_list"]){
 
// loop through and read all the data in.
foreach($rows as $key => $row){
 
if($PHORUM["count_views"]) { // show viewcount if enabled
if($PHORUM["count_views"] == 2) { // viewcount as column
$PHORUM["DATA"]["VIEWCOUNT_COLUMN"]=true;
$rows[$key]["viewcount"]=$row['viewcount'];
} else { // viewcount added to the subject
$rows[$key]["subject"]=$row["subject"]." ({$row['viewcount']} " . strtolower($PHORUM['DATA']['LANG']['Views']) . ")";
}
}
 
$rows[$key]["datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"]);
$rows[$key]["url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"]);
 
if($row["message_id"] == $row["thread"]){
$rows[$key]["threadstart"] = true;
}else{
$rows[$key]["threadstart"] = false;
}
 
$rows[$key]["delete_url1"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $row["message_id"]);
$rows[$key]["delete_url2"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"]);
if($build_move_url) {
$rows[$key]["move_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MOVE_THREAD, $row["message_id"]);
}
$rows[$key]["merge_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MERGE_THREAD, $row["message_id"]);
 
$rows[$key]["new"] = "";
// recognizing moved threads
if(isset($row['meta']['moved']) && $row['meta']['moved'] == 1) {
$rows[$key]['moved']=1;
} elseif ($PHORUM["DATA"]["LOGGEDIN"]){
 
// newflag, if its NOT in newinfo AND newer (min than min_id,
// then its a new message
 
// newflag for collapsed special threads (sticky and announcement)
if (($rows[$key]['sort'] == PHORUM_SORT_STICKY ||
$rows[$key]['sort'] == PHORUM_SORT_ANNOUNCEMENT) &&
isset($row['meta']['message_ids']) &&
is_array($row['meta']['message_ids'])) {
foreach ($row['meta']['message_ids'] as $cur_id) {
if(!isset($PHORUM['user']['newinfo'][$cur_id]) && $cur_id > $PHORUM['user']['newinfo']['min_id'])
$rows[$key]["new"] = $PHORUM["DATA"]["LANG"]["newflag"];
}
}
// newflag for regular messages
else {
if (!isset($PHORUM['user']['newinfo'][$row['message_id']]) && $row['message_id'] > $PHORUM['user']['newinfo']['min_id']) {
$rows[$key]["new"]=$PHORUM["DATA"]["LANG"]["newflag"];
}
}
}
 
if ($row["user_id"]){
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
$rows[$key]["profile_url"] = $url;
$rows[$key]["linked_author"] = "<a href=\"$url\">".htmlspecialchars($row['author'])."</a>";
}else{
$rows[$key]["profile_url"] = "";
if(!empty($row['email'])) {
$email_url = phorum_html_encode("mailto:$row[email]");
// we don't normally put HTML in this code, but this makes it easier on template builders
$rows[$key]["linked_author"] = "<a href=\"".$email_url."\">".htmlspecialchars($row["author"])."</a>";
} else {
$rows[$key]["linked_author"] = htmlspecialchars($row["author"]);
}
}
if($min_id == 0 || $min_id > $row['message_id'])
$min_id = $row['message_id'];
}
// don't move this up. We want it to be conditional.
include_once("./include/thread_sort.php");
 
$rows = phorum_sort_threads($rows);
 
}else{
 
// loop through and read all the data in.
foreach($rows as $key => $row){
 
$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"]);
$rows[$key]["datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
$rows[$key]["url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"]);
$rows[$key]["newpost_url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"],"gotonewpost");
 
$rows[$key]["new"] = "";
 
if($PHORUM["count_views"]) { // show viewcount if enabled
if($PHORUM["count_views"] == 2) { // viewcount as column
$PHORUM["DATA"]["VIEWCOUNT_COLUMN"]=true;
$rows[$key]["viewcount"]=$row['viewcount'];
} else { // viewcount added to the subject
$rows[$key]["subject"]=$row["subject"]." ({$row['viewcount']} " . strtolower($PHORUM['DATA']['LANG']['Views']) . ")";
}
}
 
// recognizing moved threads
if(isset($row['meta']['moved']) && $row['meta']['moved'] == 1) {
$rows[$key]['moved']=1;
} else {
$rows[$key]['moved']=0;
}
 
// default thread-count
$thread_count=$row["thread_count"];
 
if ($PHORUM["DATA"]["LOGGEDIN"]){
 
if($PHORUM["DATA"]["MODERATOR"]){
$rows[$key]["delete_url1"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $row["message_id"]);
$rows[$key]["delete_url2"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"]);
if($build_move_url) {
$rows[$key]["move_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MOVE_THREAD, $row["message_id"]);
}
$rows[$key]["merge_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MERGE_THREAD, $row["message_id"]);
// count could be different with hidden or unapproved posts
if(!$PHORUM["threaded_read"] && isset($row["meta"]["message_ids_moderator"])) {
$thread_count=count($row["meta"]["message_ids_moderator"]);
}
}
 
if(!$rows[$key]['moved'] && isset($row['meta']['message_ids']) && is_array($row['meta']['message_ids'])) {
foreach ($row['meta']['message_ids'] as $cur_id) {
if(!isset($PHORUM['user']['newinfo'][$cur_id]) && $cur_id > $PHORUM['user']['newinfo']['min_id'])
$rows[$key]["new"] = $PHORUM["DATA"]["LANG"]["newflag"];
}
}
}
 
if ($row["user_id"]){
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
$rows[$key]["profile_url"] = $url;
$rows[$key]["linked_author"] = "<a href=\"$url\">$row[author]</a>";
}else{
$rows[$key]["profile_url"] = "";
if(!empty($row['email'])) {
$email_url = phorum_html_encode("mailto:$row[email]");
// we don't normally put HTML in this code, but this makes it easier on template builders
$rows[$key]["linked_author"] = "<a href=\"".$email_url."\">".htmlspecialchars($row["author"])."</a>";
} else {
$rows[$key]["linked_author"] = $row["author"];
}
}
 
$pages=1;
// thread_count computed above in moderators-section
if(!$PHORUM["threaded_read"] && $thread_count>$PHORUM["read_length"]){
 
$pages=ceil($thread_count/$PHORUM["read_length"]);
 
if($pages<=5){
$page_links="";
for($x=1;$x<=$pages;$x++){
$url=phorum_get_url(PHORUM_READ_URL, $row["thread"], "page=$x");
$page_links[]="<a href=\"$url\">$x</a>";
}
$rows[$key]["pages"]=implode(",&nbsp;", $page_links);
} else {
$url=phorum_get_url(PHORUM_READ_URL, $row["thread"], "page=1");
$rows[$key]["pages"]="<a href=\"$url\">1</a>&nbsp;";
$rows[$key]["pages"].="...&nbsp;";
$pageno=$pages-2;
$url=phorum_get_url(PHORUM_READ_URL, $row["thread"], "page=$pageno");
$rows[$key]["pages"].="<a href=\"$url\">$pageno</a>,&nbsp;";
$pageno=$pages-1;
$url=phorum_get_url(PHORUM_READ_URL, $row["thread"], "page=$pageno");
$rows[$key]["pages"].="<a href=\"$url\">$pageno</a>,&nbsp;";
$pageno=$pages;
$url=phorum_get_url(PHORUM_READ_URL, $row["thread"], "page=$pageno");
$rows[$key]["pages"].="<a href=\"$url\">$pageno</a>&nbsp;";
}
}
if(isset($row['meta']['recent_post'])) {
if($pages>1){
$rows[$key]["last_post_url"]=phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["meta"]["recent_post"]["message_id"], "page=$pages");
} else {
$rows[$key]["last_post_url"]=phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["meta"]["recent_post"]["message_id"]);
}
 
$row['meta']['recent_post']['author'] = htmlspecialchars($row['meta']['recent_post']['author']);
if ($row["meta"]["recent_post"]["user_id"]){
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["meta"]["recent_post"]["user_id"]);
$rows[$key]["last_post_profile_url"] = $url;
$rows[$key]["last_post_by"] = "<a href=\"$url\">{$row['meta']['recent_post']['author']}</a>";
}else{
$rows[$key]["profile_url"] = "";
$rows[$key]["last_post_by"] = $row["meta"]["recent_post"]["author"];
}
} else {
$rows[$key]["last_post_by"] = "";
}
 
if($min_id == 0 || $min_id > $row['message_id'])
$min_id = $row['message_id'];
}
}
 
// run list mods
$rows = phorum_hook("list", $rows);
 
// if we retrieve the body too we need to setup some more variables for the messages
// to make it a little more similar to the view in read.php
if(isset($PHORUM['TMP']['bodies_in_list']) && $PHORUM['TMP']['bodies_in_list'] == 1) {
 
foreach ($rows as $id => $row) {
 
// is the message unapproved?
$row["is_unapproved"] = ($row['status'] < 0) ? 1 : 0;
 
// check if its the first message in the thread
if($row["message_id"] == $row["thread"]) {
$row["threadstart"] = true;
} else{
$row["threadstart"] = false;
}
 
// mask host if not a moderator
if(empty($PHORUM["user"]["admin"]) && (empty($PHORUM["DATA"]["MODERATOR"]) || !PHORUM_MOD_IP_VIEW)){
if($PHORUM["display_ip_address"]){
if($row["moderator_post"]){
$row["ip"]=$PHORUM["DATA"]["LANG"]["Moderator"];
} elseif(is_numeric(str_replace(".", "", $row["ip"]))){
$row["ip"]=substr($row["ip"],0,strrpos($row["ip"],'.')).'.---';
} else {
$row["ip"]="---".strstr($row["ip"], ".");
}
 
} else {
$row["ip"]=$PHORUM["DATA"]["LANG"]["IPLogged"];
}
}
 
// add the edited-message to a post if its edited
if(isset($row['meta']['edit_count']) && $row['meta']['edit_count'] > 0) {
$editmessage = str_replace ("%count%", $row['meta']['edit_count'], $PHORUM["DATA"]["LANG"]["EditedMessage"]);
$editmessage = str_replace ("%lastedit%", phorum_date($PHORUM["short_date"],$row['meta']['edit_date']), $editmessage);
$editmessage = str_replace ("%lastuser%", $row['meta']['edit_username'], $editmessage);
$row["body"].="\n\n\n\n$editmessage";
}
 
 
if($PHORUM["max_attachments"]>0 && isset($row["meta"]["attachments"])){
$PHORUM["DATA"]["ATTACHMENTS"]=true;
$row["attachments"]=$row["meta"]["attachments"];
// unset($row["meta"]["attachments"]);
foreach($row["attachments"] as $key=>$file){
$row["attachments"][$key]["size"]=phorum_filesize($file["size"]);
$row["attachments"][$key]["name"]=
htmlentities($file['name'], ENT_COMPAT,
$PHORUM["DATA"]["CHARSET"]);
$row["attachments"][$key]["url"]=
phorum_get_url(PHORUM_FILE_URL, "file={$file['file_id']}");
}
}
$rows[$id] = $row;
}
}
 
// format messages
$rows = phorum_format_messages($rows);
 
 
// set up the data
$PHORUM["DATA"]["ROWS"] = $rows;
 
$PHORUM["DATA"]["URL"]["MARKREAD"] = phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "markread");
if($PHORUM["DATA"]["MODERATOR"]) {
$PHORUM["DATA"]["URL"]["UNAPPROVED"] = phorum_get_url(PHORUM_PREPOST_URL);
}
 
// updating new-info for first visit (last message on first page is first new)
if ($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM['user']['newinfo']['min_id'] == 0 && !isset($PHORUM['user']['newinfo'][$min_id]) && $min_id != 0){
// setting it as min-id
phorum_db_newflag_add_read($min_id);
}
 
include phorum_get_template("header");
phorum_hook("after_header");
 
// include the correct template
if ($PHORUM["threaded_list"]){
include phorum_get_template("list_threads");
}else{
include phorum_get_template("list");
}
 
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/read.php
New file
0,0 → 1,587
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','read');
 
include_once("./common.php");
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
 
 
// set all our URL's ... we need these earlier
phorum_build_common_urls();
 
// checking read-permissions
if(!phorum_check_read_common()) {
return;
}
 
// somehow we got to a folder
if(empty($PHORUM["forum_id"]) || $PHORUM["folder_flag"]){
$dest_url = phorum_get_url(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
phorum_redirect_by_url($dest_url);
exit();
}
 
if ($PHORUM["DATA"]["LOGGEDIN"]) { // reading newflags in
$PHORUM['user']['newinfo']=phorum_db_newflag_get_flags();
}
 
$PHORUM["DATA"]["MODERATOR"] = phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
 
if($PHORUM["DATA"]["MODERATOR"]) {
// find out how many forums this user can moderate
$forums=phorum_db_get_forums(0,-1,$PHORUM['vroot']);
 
$modforums=0;
foreach($forums as $id=>$forum){
if($forum["folder_flag"]==0 && phorum_user_moderate_allowed($id)){
$modforums++;
}
}
if($modforums > 1) {
$build_move_url=true;
} else {
$build_move_url=false;
}
}
 
// setup some stuff based on the url passed
if(empty($PHORUM["args"][1])) {
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
} elseif(empty($PHORUM["args"][2])) {
$thread = (int)$PHORUM["args"][1];
$message_id = (int)$PHORUM["args"][1];
} else{
if(!is_numeric($PHORUM["args"][2])) {
$dest_url="";
$newervar=(int)$PHORUM["args"][1];
 
switch($PHORUM["args"][2]) {
case "newer":
$thread = phorum_db_get_newer_thread($newervar);
break;
case "older":
$thread = phorum_db_get_older_thread($newervar);
break;
case "markthreadread":
// thread needs to be in $thread for the redirection
$thread = (int)$PHORUM["args"][1];
$thread_message=phorum_db_get_message($thread,'message_id');
 
$mids=array();
foreach($thread_message['meta']['message_ids'] as $mid) {
if(!isset($PHORUM['user']['newinfo'][$mid]) && $mid > $PHORUM['user']['newinfo']['min_id']) {
$mids[]=$mid;
}
}
 
$msg_count=count($mids);
 
// any messages left to update newinfo with?
if($msg_count > 0){
phorum_db_newflag_add_read($mids);
unset($mids);
}
break;
case "gotonewpost":
// thread needs to be in $thread for the redirection
$thread = (int)$PHORUM["args"][1];
$thread_message=phorum_db_get_message($thread,'message_id');
$message_ids=$thread_message['meta']['message_ids'];
 
foreach($message_ids as $mkey => $mid) {
// if already read, remove it from message-array
if(isset($PHORUM['user']['newinfo'][$mid]) || $mid <= $PHORUM['user']['newinfo']['min_id']) {
unset($message_ids[$mkey]);
}
 
}
 
// it could happen that they are all read
if(count($message_ids)) {
asort($message_ids,SORT_NUMERIC); // make sure they are sorted
 
 
$new_message=array_shift($message_ids); // get the first element
 
if(!$PHORUM['threaded_read']) { // get new page
$new_page=ceil(phorum_db_get_message_index($thread,$new_message)/$PHORUM['read_length']);
$dest_url=phorum_get_url(PHORUM_READ_URL,$thread,$new_message,"page=$new_page");
} else { // for threaded
$dest_url=phorum_get_url(PHORUM_READ_URL,$thread,$new_message);
}
} else {
// lets go back to the index if they are all read
$dest_url=phorum_get_url(PHORUM_LIST_URL);
}
 
break;
 
 
}
 
if(empty($dest_url)) {
if($thread > 0) {
$dest_url = phorum_get_url(PHORUM_READ_URL, $thread);
} else{
// we are either at the top or the bottom, go back to the list.
$dest_url = phorum_get_url(PHORUM_LIST_URL);
}
}
 
phorum_redirect_by_url($dest_url);
exit();
}
 
$thread = (int)$PHORUM["args"][1];
$message_id = (int)$PHORUM["args"][2];
}
 
// determining the page if page isn't given and message_id != thread
$page=0;
if(!$PHORUM["threaded_read"]) {
if(isset($PHORUM['args']['page']) && is_numeric($PHORUM["args"]["page"]) && $PHORUM["args"]["page"] > 0) {
$page=(int)$PHORUM["args"]["page"];
} elseif($message_id != $thread) {
$page=ceil(phorum_db_get_message_index($thread,$message_id)/$PHORUM['read_length']);
} else {
$page=1;
}
if(empty($page)) {
$page=1;
}
}
 
// Get the thread
$data = phorum_db_get_messages($thread,$page);
 
 
if(!empty($data) && isset($data[$thread]) && isset($data[$message_id])) {
 
$fetch_user_ids = $data['users'];
unset($data['users']);
 
// remove the unneeded message bodies in threaded view
// to avoid unnecessary formatting of bodies
if ($PHORUM["threaded_read"] &&
!(isset($PHORUM['TMP']['all_bodies_in_threaded_read']) &&
!empty($PHORUM['TMP']['all_bodies_in_threaded_read']) ) ) {
 
$remove_threaded_bodies=1;
// the flag is used in the foreach-loop later on
} else {
$remove_threaded_bodies=0;
}
 
// build URL's that apply only here.
if($PHORUM["float_to_top"]) {
$PHORUM["DATA"]["URL"]["OLDERTHREAD"] = phorum_get_url(PHORUM_READ_URL, $data[$thread]["modifystamp"], "older");
$PHORUM["DATA"]["URL"]["NEWERTHREAD"] = phorum_get_url(PHORUM_READ_URL, $data[$thread]["modifystamp"], "newer");
} else{
$PHORUM["DATA"]["URL"]["OLDERTHREAD"] = phorum_get_url(PHORUM_READ_URL, $thread, "older");
$PHORUM["DATA"]["URL"]["NEWERTHREAD"] = phorum_get_url(PHORUM_READ_URL, $thread, "newer");
}
 
$PHORUM["DATA"]["URL"]["MARKTHREADREAD"] = phorum_get_url(PHORUM_READ_URL, $thread, "markthreadread");
$PHORUM["DATA"]["POST"]["thread"] = $thread;
$PHORUM["DATA"]["POST"]["parentid"] = $message_id;
$PHORUM["DATA"]["POST"]["subject"] = $data[$message_id]["subject"];
 
$thread_is_closed = (bool)$data[$thread]["closed"];
$thread_is_announcement = ($data[$thread]["sort"]==PHORUM_SORT_ANNOUNCEMENT)?1:0;
 
// we might have more messages for mods
if($PHORUM["DATA"]["MODERATOR"] && isset($data[$thread]["meta"]["message_ids_moderator"])) {
$threadnum=count($data[$thread]['meta']['message_ids_moderator']);
} else {
$threadnum=$data[$thread]['thread_count'];
}
 
if(!$PHORUM["threaded_read"] && $threadnum > $PHORUM["read_length"]){
$pages=ceil($threadnum/$PHORUM["read_length"]);
 
if($pages<=11){
$page_start=1;
} elseif($pages-$page<5) {
$page_start=$pages-10;
} elseif($pages>11 && $page>6){
$page_start=$page-5;
} else {
$page_start=1;
}
 
for($x=0;$x<11 && $x<$pages;$x++){
$pageno=$x+$page_start;
$PHORUM["DATA"]["PAGES"][] = array(
"pageno"=>$pageno,
"url"=>phorum_get_url(PHORUM_READ_URL, $thread, "page=$pageno")
);
}
 
$PHORUM["DATA"]["CURRENTPAGE"]=$page;
$PHORUM["DATA"]["TOTALPAGES"]=$pages;
 
if($page_start>1){
$PHORUM["DATA"]["URL"]["FIRSTPAGE"]=phorum_get_url(PHORUM_READ_URL, $thread, "page=1");
}
 
if($pageno<$pages){
$PHORUM["DATA"]["URL"]["LASTPAGE"]=phorum_get_url(PHORUM_READ_URL, $thread, "page=$pages");
}
 
if($pages>$page){
$nextpage=$page+1;
$PHORUM["DATA"]["URL"]["NEXTPAGE"]=phorum_get_url(PHORUM_READ_URL, $thread, "page=$nextpage");
}
if($page>1){
$prevpage=$page-1;
$PHORUM["DATA"]["URL"]["PREVPAGE"]=phorum_get_url(PHORUM_READ_URL, $thread, "page=$prevpage");
}
}
 
// fetch_user_ids filled from phorum_db_get_messages
if(isset($fetch_user_ids) && count($fetch_user_ids)){
$user_info=phorum_user_get($fetch_user_ids, false);
// hook to modify user info
$user_info = phorum_hook("read_user_info", $user_info);
}
 
// URLS which are common for the thread
if($PHORUM["DATA"]["MODERATOR"]) {
if($build_move_url) {
$URLS["move_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MOVE_THREAD, $thread);
}
$URLS["merge_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_MERGE_THREAD, $thread);
$URLS["close_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_CLOSE_THREAD, $thread);
$URLS["reopen_url"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_REOPEN_THREAD, $thread);
}
 
 
 
 
// main loop for template setup
$read_messages=array(); // needed for newinfo
foreach($data as $key => $row) {
 
// should we remove the bodies in threaded view
if($remove_threaded_bodies) {
if ($row["message_id"] != $message_id) {
unset($row["body"]); // strip body
}
}
 
// assign user data to the row
if($row["user_id"] && isset($user_info[$row["user_id"]])){
$row["user"]=$user_info[$row["user_id"]];
unset($row["user"]["password"]);
unset($row["user"]["password_tmp"]);
}
if(!$PHORUM["threaded_read"] && $PHORUM["DATA"]["LOGGEDIN"] && $row['message_id'] > $PHORUM['user']['newinfo']['min_id'] && !isset($PHORUM['user']['newinfo'][$row['message_id']])) { // set this message as read
$read_messages[] = array("id"=>$row['message_id'],"forum"=>$row['forum_id']);
}
// is the message unapproved?
$row["is_unapproved"] = ($row['status'] < 0) ? 1 : 0;
 
// all stuff that makes only sense for moderators or admin
if($PHORUM["DATA"]["MODERATOR"]) {
 
$row["delete_url1"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $row["message_id"]);
$row["delete_url2"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"]);
$row["edit_url"]=phorum_get_url(PHORUM_POSTING_URL, "moderation", $row["message_id"]);
$row["split_url"]=phorum_get_url(PHORUM_MODERATION_URL, PHORUM_SPLIT_THREAD, $row["message_id"]);
if($row['is_unapproved']) {
$row["approve_url"]=phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE, $row["message_id"]);
} else {
$row["hide_url"]=phorum_get_url(PHORUM_MODERATION_URL, PHORUM_HIDE_POST, $row["message_id"]);
}
if($build_move_url) {
$row["move_url"] = $URLS["move_url"];
}
$row["merge_url"] = $URLS["merge_url"];
$row["close_url"] = $URLS["close_url"];
$row["reopen_url"] = $URLS["reopen_url"];
}
 
// allow editing only if logged in, allowed for forum, the thread is open,
// its the same user, and its within the time restriction
if($PHORUM["user"]["user_id"]==$row["user_id"] && phorum_user_access_allowed(PHORUM_USER_ALLOW_EDIT) &&
!$thread_is_closed &&($PHORUM["user_edit_timelimit"] == 0 || $row["datestamp"] + ($PHORUM["user_edit_timelimit"] * 60) >= time())) {
$row["edit"]=1;
if($PHORUM["DATA"]["MODERATOR"]) {
$row["edituser_url"]=$row["edit_url"];
} else {
$row["edituser_url"]=phorum_get_url(PHORUM_POSTING_URL, "edit", $row["message_id"]);
}
}
 
// this stuff is used in threaded and non threaded.
$row["short_datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
$row["datestamp"] = phorum_date($PHORUM["long_date"], $row["datestamp"]);
$row["url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"]);
$row["reply_url"] = phorum_get_url(PHORUM_REPLY_URL, $row["thread"], $row["message_id"]);
$row["quote_url"] = phorum_get_url(PHORUM_REPLY_URL, $row["thread"], $row["message_id"], "quote=1");
$row["report_url"] = phorum_get_url(PHORUM_REPORT_URL, $row["message_id"]);
$row["follow_url"] = phorum_get_url(PHORUM_FOLLOW_URL, $row["thread"]);
 
// can only send private replies if the author is a registered user
if ($PHORUM["enable_pm"] && $row["user_id"]) {
$row["private_reply_url"] = phorum_get_url(PHORUM_PM_URL, "page=send", "message_id=".$row["message_id"]);
} else {
$row["private_reply_url"] = false;
}
 
// check if its the first message in the thread
if($row["message_id"] == $row["thread"]) {
$row["threadstart"] = true;
} else{
$row["threadstart"] = false;
}
 
// should we show the signature?
if(isset($row['body'])) {
if(isset($row["user"]["signature"])
&& isset($row['meta']['show_signature']) && $row['meta']['show_signature']==1){
 
$phorum_sig=trim($row["user"]["signature"]);
if(!empty($phorum_sig)){
$row["body"].="\n\n$phorum_sig";
}
}
 
// add the edited-message to a post if its edited
if(isset($row['meta']['edit_count']) && $row['meta']['edit_count'] > 0) {
$editmessage = str_replace ("%count%", $row['meta']['edit_count'], $PHORUM["DATA"]["LANG"]["EditedMessage"]);
$editmessage = str_replace ("%lastedit%", phorum_date($PHORUM["short_date"],$row['meta']['edit_date']), $editmessage);
$editmessage = str_replace ("%lastuser%", $row['meta']['edit_username'], $editmessage);
$row["body"].="\n\n\n\n$editmessage";
}
}
 
 
if(!empty($row["user_id"])) {
$row["profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
// we don't normally put HTML in this code, but this makes it easier on template builders
$row["linked_author"] = "<a href=\"".$row["profile_url"]."\">$row[author]</a>";
} elseif(!empty($row["email"])) {
$row["email_url"] = phorum_html_encode("mailto:$row[email]");
// we don't normally put HTML in this code, but this makes it easier on template builders
$row["linked_author"] = "<a href=\"".$row["email_url"]."\">".htmlspecialchars($row["author"])."</a>";
} else {
$row["linked_author"] = htmlspecialchars($row["author"]);
}
 
// mask host if not a moderator
if(empty($PHORUM["user"]["admin"]) && (empty($PHORUM["DATA"]["MODERATOR"]) || !PHORUM_MOD_IP_VIEW)){
if($PHORUM["display_ip_address"]){
if($row["moderator_post"]){
$row["ip"]=$PHORUM["DATA"]["LANG"]["Moderator"];
} elseif(is_numeric(str_replace(".", "", $row["ip"]))){
$row["ip"]=substr($row["ip"],0,strrpos($row["ip"],'.')).'.---';
} else {
$row["ip"]="---".strstr($row["ip"], ".");
}
 
} else {
$row["ip"]=$PHORUM["DATA"]["LANG"]["IPLogged"];
}
}
 
if($PHORUM["max_attachments"]>0 && isset($row["meta"]["attachments"])){
$PHORUM["DATA"]["ATTACHMENTS"]=true;
$row["attachments"]=$row["meta"]["attachments"];
// unset($row["meta"]["attachments"]);
foreach($row["attachments"] as $key=>$file){
$row["attachments"][$key]["size"]=phorum_filesize($file["size"]);
$row["attachments"][$key]["name"]=htmlentities($file['name'], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]); // clear all special chars from name to avoid XSS
$row["attachments"][$key]["url"]=phorum_get_url(PHORUM_FILE_URL, "file={$file['file_id']}");
}
}
 
// newflag, if its NOT in newinfo AND newer than min_id, then its a new message
$row["new"]="";
if ($PHORUM["DATA"]["LOGGEDIN"]){
if (!isset($PHORUM['user']['newinfo'][$row['message_id']]) && $row['message_id'] > $PHORUM['user']['newinfo']['min_id']) {
$row["new"]= $PHORUM["DATA"]["LANG"]["newflag"];
}
}
 
$messages[$row["message_id"]]=$row;
}
 
if($PHORUM["threaded_read"]) {
// don't move this up. We want it to be conditional.
include_once("./include/thread_sort.php");
 
// run read-threads mods
$messages = phorum_hook("readthreads", $messages);
 
$messages = phorum_sort_threads($messages);
 
if($PHORUM["DATA"]["LOGGEDIN"] && !isset($PHORUM['user']['newinfo'][$message_id]) && $message_id > $PHORUM['user']['newinfo']['min_id']) {
$read_messages[] = array("id"=>$message_id,"forum"=>$messages[$message_id]['forum_id']);
}
 
// we have to loop again and create the urls for the Next and Previous links.
foreach($messages as $key => $row) {
 
if($PHORUM["count_views"]) { // show viewcount if enabled
if($PHORUM["count_views"] == 2) { // viewcount as column
$PHORUM["DATA"]["VIEWCOUNT_COLUMN"]=true;
$messages[$key]["viewcount"]=$row['viewcount'];
} else { // viewcount added to the subject
$messages[$key]["subject"]=$row["subject"]." ({$row['viewcount']} {$PHORUM['DATA']['LANG']['Views']})";
}
}
 
 
$messages[$key]["next_url"] = $PHORUM["DATA"]["URL"]["NEWERTHREAD"];
if(empty($last_key)) {
$messages[$key]["prev_url"] = $PHORUM["DATA"]["URL"]["OLDERTHREAD"];
} else{
$messages[$key]["prev_url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $last_key);
$messages[$last_key]["next_url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"]);
}
 
$last_key = $key;
}
}
 
// run read mods
$messages = phorum_hook("read", $messages);
 
// increment viewcount if enabled
if($PHORUM['count_views']) {
phorum_db_viewcount_inc($message_id);
}
 
// format messages
$messages = phorum_format_messages($messages);
 
// set up the data
$PHORUM["DATA"]["MESSAGE"] = $messages[$message_id];
 
// we need to remove the thread-starter from the data if we are not on the first page
$threadsubject = $messages[$thread]["subject"];
if($page > 1)
unset($messages[$thread]);
 
$PHORUM["DATA"]["MESSAGES"] = $messages;
 
 
// alter the HTML_TITLE
if(!empty($PHORUM["DATA"]["HTML_TITLE"])){
$PHORUM["DATA"]["HTML_TITLE"].=htmlentities(PHORUM_SEPARATOR, ENT_COMPAT, $PHORUM["DATA"]["CHARSET"] );;
}
// No htmlentities() needed. The subject is already escaped.
// Strip HTML tags from the HTML title. There might be HTML in
// here, because of modules adding images and formatting.
$PHORUM["DATA"]["HTML_TITLE"] .= trim(strip_tags($PHORUM["threaded_read"] ? $PHORUM["DATA"]["MESSAGE"]["subject"] : $threadsubject));
 
// include the correct template
 
include phorum_get_template("header");
phorum_hook("after_header");
 
if($PHORUM["threaded_read"]) {
include phorum_get_template("read_threads");
} else{
include phorum_get_template("read");
}
if($PHORUM["DATA"]["LOGGEDIN"]) { // setting read messages really read
phorum_db_newflag_add_read($read_messages);
}
 
// An anchor so clicking on a reply button can let the browser
// jump to the editor or the closed thread message.
if(isset($PHORUM["reply_on_read_page"]) && $PHORUM["reply_on_read_page"]) {
print '<a name="REPLY"></a>';
}
 
// Never show the reply box if the message is closed.
if($thread_is_closed) {
 
// Closed announcements have their own specific message.
$key = $thread_is_announcement ? "ThreadAnnouncement" : "ThreadClosed";
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"][$key];
include phorum_get_template("message");
 
} elseif (isset($PHORUM["reply_on_read_page"]) && $PHORUM["reply_on_read_page"]) {
 
// Prepare the arguments for the posting.php script.
$goto_mode = "reply";
if (isset($PHORUM["args"]["quote"]) && $PHORUM["args"]["quote"]) {
$goto_mode = "quote";
}
 
$PHORUM["postingargs"] = array(
1 => $goto_mode,
2 => $message_id,
"as_include" => true
);
 
include("./posting.php");
}
 
phorum_hook("before_footer");
include phorum_get_template("footer");
 
 
} elseif($toforum=phorum_check_moved_message($thread)) { // is it a moved thread?
 
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["MovedMessage"];
$PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $toforum, $thread);
$PHORUM['DATA']["BACKMSG"]=$PHORUM["DATA"]["LANG"]["MovedMessageTo"];
 
$PHORUM["DATA"]["HTML_TITLE"] = htmlentities( $PHORUM["DATA"]["HTML_TITLE"], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"] );
// have to include the header here for the Redirect
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
 
} else { // message not found
$PHORUM["DATA"]["ERROR"]=$PHORUM["DATA"]["LANG"]["MessageNotFound"];
$PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
$PHORUM['DATA']["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToList"];
 
$PHORUM["DATA"]["HTML_TITLE"] = htmlentities( $PHORUM["DATA"]["HTML_TITLE"], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"] );
// have to include the header here for the Redirect
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
}
 
// find out if the given thread has been moved to another forum
function phorum_check_moved_message($thread) {
$forum_id=$GLOBALS['PHORUM']['forum_id'];
$message=phorum_db_get_message($thread,'message_id',true);
 
if(!empty($message) && $message['forum_id'] != $forum_id) {
$ret=$message['forum_id'];
} else {
$ret=false;
}
return $ret;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/report.php
New file
0,0 → 1,110
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','report');
 
include_once("./common.php");
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
 
 
// set all our URL's ... we need these earlier
phorum_build_common_urls();
 
// checking read-permissions
if(!phorum_check_read_common()) {
return;
}
 
$report = false;
$template = "report";
 
// get the message
if (is_numeric($PHORUM["args"][1])) {
$message_id = $PHORUM["args"][1];
$message = phorum_db_get_message($message_id);
}
 
// check for report requests
if(!empty($_POST["report"])) {
if ($PHORUM["DATA"]["LOGGEDIN"]){
if (empty($_POST["explanation"])){
$_POST["explanation"] = "<" . $PHORUM["DATA"]["LANG"]["None"] . ">";
}
 
$mail_users = phorum_user_get_moderators($PHORUM['forum_id'],false,true);
 
if(count($mail_users)){
$mail_data = array(
"mailmessage" => $PHORUM["DATA"]["LANG"]['ReportPostEmailBody'],
"mailsubject" => $PHORUM["DATA"]["LANG"]['ReportPostEmailSubject'],
"forumname" => $PHORUM["DATA"]["NAME"],
"reportedby" => $PHORUM["user"]["username"],
"author" => $message["author"],
"subject" => $message["subject"],
"body" => wordwrap($message["body"], 72),
"ip" => $message["ip"],
"date" => phorum_date($PHORUM["short_date"], $message["datestamp"]),
"explanation" => wordwrap($_POST["explanation"], 72),
"url" => phorum_get_url(PHORUM_READ_URL, $message["thread"], $message_id),
"delete_url" => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $message_id),
"hide_url" => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_HIDE_POST, $message_id),
"edit_url" => phorum_get_url(PHORUM_POSTING_URL, 'moderation', $message_id),
"reporter_url"=> phorum_get_url(PHORUM_PROFILE_URL, $PHORUM["user"]["user_id"])
);
 
$mail_data = phorum_hook("report", $mail_data);
 
phorum_email_user($mail_users, $mail_data);
 
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"]);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["ReportPostSuccess"];
$template="message";
$report = true;
}
}
else{
$PHORUM["DATA"]["ReportPostMessage"] = $PHORUM["DATA"]["LANG"]['ReportPostNotAllowed'];
}
}
 
// format message
list($message) = phorum_format_messages(array($message));
 
$PHORUM["DATA"]["PostSubject"] = $message["subject"];
$PHORUM["DATA"]["PostAuthor"] = $message["author"];
$PHORUM["DATA"]["PostBody"] = $message["body"];
$PHORUM["DATA"]["PostDate"] = phorum_date($PHORUM["short_date"], $message["datestamp"]);
$PHORUM["DATA"]["ReportURL"] = phorum_get_url(PHORUM_REPORT_URL, $message_id);
 
// if the report was not successfully sent, keep whatever explanation they gave already
if (isset($_POST["explanation"]) && !$report) {
$PHORUM["DATA"]["explanation"] = $_POST["explanation"];
}
else {
$PHORUM["DATA"]["explanation"] = "";
}
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template($template);
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/pm.php
New file
0,0 → 1,966
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// These language strings are set dynamically, so the language
// tool won't recognize them automatically. Therefore they are
// mentioned here.
// $PHORUM["DATA"]["LANG"]["PMFolderCreateSuccess"]
// $PHORUM["DATA"]["LANG"]["PMFolderRenameSuccess"]
// $PHORUM["DATA"]["LANG"]["PMFolderDeleteSuccess"]
// $PHORUM["DATA"]["LANG"]["PMSent"]
 
// PMTODO If reading from a mail notify, lookup the folder_id,
// so the close button will work. Now the folder_id is empty.
// PMTODO implement pm_reply_flag functionality
 
define('phorum_page','pm');
 
include_once("./common.php");
 
phorum_require_login();
 
// set all our common URL's
phorum_build_common_urls();
 
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
 
// a user has to be logged in to use the private messages system
if (!$PHORUM["DATA"]["LOGGEDIN"]) {
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}
 
// if the user is not fully logged in, send him to the login page
if (!$PHORUM["DATA"]["FULLY_LOGGEDIN"]) {
 
// Construct the URL to redirect to after logging in.
$args = array(PHORUM_PM_URL);
foreach ($PHORUM["args"] as $k => $v) {
if (in_array("$k=$v", $PHORUM["DATA"]["GET_VARS"])) continue;
if(is_numeric($k)) $args[] = $v; else $args[] = "$k=$v";
}
$redir = urlencode(call_user_func_array('phorum_get_url', $args));
 
phorum_redirect_by_url(phorum_get_url(PHORUM_LOGIN_URL, "redir=$redir"));
exit();
}
 
// If private messages are disabled, just show a simple error message.
if (! $PHORUM["enable_pm"]) {
$PHORUM["DATA"]["BLOCK_CONTENT"] = $PHORUM["DATA"]["LANG"]["PMDisabled"];
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("stdblock");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
}
 
// ------------------------------------------------------------------------
// Parameter handling
// ------------------------------------------------------------------------
 
// Retrieve a parameter from either the args-list or $_POST.
function phorum_getparam($name)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$ret = NULL;
if (isset($PHORUM["args"][$name])) {
$ret = trim($PHORUM["args"][$name]);
}elseif (isset($_POST[$name])) {
$ret = trim($_POST[$name]);
}
 
return $ret;
}
 
// Get basic parameters.
$action = phorum_getparam('action');
$page = phorum_getparam('page');
$folder_id = phorum_getparam('folder_id');
$pm_id = phorum_getparam('pm_id');
$forum_id = $PHORUM["forum_id"];
$user_id = $PHORUM["user"]["user_id"];
$hide_userselect = phorum_getparam('hide_userselect');
 
// Get recipients from the form and create a valid list of recipients.
$recipients = array();
if (isset($_POST["recipients"]) && is_array($_POST["recipients"])) {
foreach ($_POST["recipients"] as $id => $username) {
$user = phorum_user_get($id, false);
if ($user) {
$recipients[$id] = $user;
}
}
}
 
// init error var
$error_msg = "";
 
// ------------------------------------------------------------------------
// Banlist checking
// ------------------------------------------------------------------------
 
// Start editor Post message Post reply
if ($page == 'send' || $action == 'post' || ($action == 'list' && isset($pm_id)))
{
include_once("./include/profile_functions.php");
$error = phorum_check_bans(array(
array($PHORUM["user"]["username"], PHORUM_BAD_NAMES),
array($PHORUM["user"]["email"], PHORUM_BAD_EMAILS),
array($user_id, PHORUM_BAD_USERID),
array(NULL, PHORUM_BAD_IPS),
));
 
// Show an error in case we encountered a ban.
if (! empty($error)) {
$PHORUM["DATA"]["ERROR"] = $error;
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
}
}
 
// ------------------------------------------------------------------------
// Perform actions
// ------------------------------------------------------------------------
 
// Initialize error and ok message.
$error = '';
$okmsg = '';
 
// init folder list
$pm_folders = phorum_db_pm_getfolders(NULL, true);
 
// Translate button clicks from the read page to appropriate actions.
if (isset($_POST['close_message'])) {
$page = 'list';
} elseif (isset($_POST['delete_message'])) {
$page = 'list';
$_POST['delete'] = 1;
$_POST['checked'] = array($pm_id);
$action = 'list';
} elseif (isset($_POST['move_message'])) {
$page = 'list';
$_POST['move'] = 1;
$_POST['checked'] = array($pm_id);
$action = 'list';
} elseif (isset($_POST['reply']) || isset($_POST['reply_to_all'])) {
$page = 'send';
$action = '';
}
 
if (!empty($action)) {
 
// Utility function to check if a foldername already exists.
// No extreme checking with locking here. Technically
// speaking duplicate foldernames will work. It's just
// confusing for the user.
function phorum_pm_folder_exists($foldername)
{
global $pm_folders;
foreach ($pm_folders as $id => $data) {
if (strcasecmp($foldername, $data["name"]) == 0) {
return true;
}
}
return false;
}
 
// Redirect will be set to a true value if after performing
// the action we want to use a redirect to get to the
// result page. This is done for two reasons:
// 1) Let the result page use refreshed PM data;
// 2) Prevent reloading of the action page (which could for
// example result in duplicate message sending).
// The variable $redirect_message can be set to a language
// key string to have a message displayed after redirection.
$redirect = false;
$redirect_message = '';
 
switch($action) {
 
// Actions which are triggered from the folder management interface.
case "folders":
 
$redirect = false;
$page = "folders";
 
// Create folder.
if (!empty($_POST['create_folder']))
{
$foldername = trim($_POST["create_folder_name"]);
 
if ($foldername != '')
{
if (phorum_pm_folder_exists($foldername)) {
$error = $PHORUM["DATA"]["LANG"]["PMFolderExistsError"];
} else {
phorum_db_pm_create_folder($foldername);
$redirect_message = "PMFolderCreateSuccess";
$redirect = true;
}
 
}
}
 
// Rename a folder.
elseif (!empty($_POST['rename_folder']))
{
$from = $_POST['rename_folder_from'];
$to = trim($_POST['rename_folder_to']);
 
if (!empty($from) && $to != '') {
if (phorum_pm_folder_exists($to)) {
$error = $PHORUM["DATA"]["LANG"]["PMFolderExistsError"];
} else {
phorum_db_pm_rename_folder($from, $to);
$redirect_message = "PMFolderRenameSuccess";
$redirect = true;
}
}
}
 
// Delete a folder.
elseif (!empty($_POST['delete_folder']))
{
$folder_id = $_POST["delete_folder_target"];
if (!empty($folder_id)) {
phorum_db_pm_delete_folder($folder_id);
$redirect_message = "PMFolderDeleteSuccess";
$redirect = true;
 
// Invalidate user cache, to update message counts.
phorum_cache_remove('user',$user_id);
}
}
 
break;
 
 
// Actions which are triggered from the list interface.
case "list":
 
// Delete all checked messages.
if (isset($_POST["delete"]) && isset($_POST["checked"])) {
foreach($_POST["checked"] as $pm_id) {
if (phorum_db_pm_get($pm_id, $folder_id)) {
phorum_db_pm_delete($pm_id, $folder_id);
}
}
 
// Invalidate user cache, to update message counts.
phorum_cache_remove('user',$user_id);
}
 
// Move checked messages to another folder.
elseif (isset($_POST["move"]) && isset($_POST["checked"])) {
$to = $_POST['target_folder'];
if (! empty($to)) {
foreach($_POST["checked"] as $pm_id) {
if (phorum_db_pm_get($pm_id, $folder_id)) {
phorum_db_pm_move($pm_id, $folder_id, $to);
}
}
}
}
 
$page = "list";
$redirect = true;
 
break;
 
 
// Actions which are triggered from the post form.
case "post":
 
// Parse clicks on the image buttons that we use for
// deleting recipients from the list of recipients.
// These are not sent as name=value, but instead
// name_x=xclickoffset and name_y=yclickoffset are sent.
// Also accept normal button clicks with name="del_rcpt::<id>",
// so template builders can use that.
$del_rcpt = NULL;
foreach ($_POST as $key => $val) {
if (preg_match('/^del_rcpt::(\d+)(_x)?$/', $key, $m)) {
$del_rcpt = $m[1];
break;
}
}
 
// Determine what action to perform.
$action = "post";
if (isset($_POST["preview"])) $action = "preview";
if (isset($_POST["rcpt_add"])) $action = "rcpt_add";
if (!is_null($del_rcpt)) $action = "del_rcpt";
 
// Adding a recipient.
if ($action == "rcpt_add" || $action == "preview" || $action == "post") {
 
// Convert adding a recipient by name to adding by user id.
if (isset($_POST["to_name"])) {
$to_name = trim($_POST["to_name"]);
if ($to_name != '') {
$to_user_id = phorum_db_user_check_field('username', $to_name);
if ($to_user_id) {
$_POST["to_id"] = $to_user_id;
unset($_POST["to_name"]);
} else {
$error = $PHORUM["DATA"]["LANG"]["UserNotFound"];
}
}
}
 
// Add a recipient by id.
if (isset($_POST["to_id"]) && is_numeric($_POST["to_id"])) {
$user = phorum_user_get($_POST["to_id"], false);
if ($user) {
$recipients[$user["user_id"]] = $user;
}
}
 
$page = "send";
 
// Deleting a recipient.
} elseif ($action == "del_rcpt") {
 
unset($recipients[$del_rcpt]);
$page = "send";
 
// When deleting a recipient, we always have to
// show the user selection. Put it back in, for
// situations where we had the user selection
// hidden intentionally.
$hide_userselect = 0;
}
 
// For previewing the message, no action has to be taken.
if ($action == "preview") {
$page = "send";
}
 
// Posting the message.
elseif ($action == "post") {
 
// Only send the message if we have at least one recipient.
if (count($recipients)) {
$_POST["subject"] = trim($_POST["subject"]);
$_POST["message"] = trim($_POST["message"]);
 
// Only send the message if all required message data is filled in.
if ($_POST["subject"] == '' || $_POST["message"] == '') {
 
$error = $PHORUM["DATA"]["LANG"]["PMRequiredFields"];
 
// Message data is okay. Post the message.
} else {
 
if (empty($_POST["keep"])) $_POST["keep"] = 0;
 
// Check if sender and recipients have not yet reached the
// maximum number of messages that may be stored on the server.
// Administrators may always send PM.
if (!$PHORUM['user']['admin'] && $PHORUM['max_pm_messagecount'])
{
// Build a list of users to check.
$checkusers = $recipients;
if ($_POST['keep']) $checkusers[] = $PHORUM['user'];
 
// Check all users.
foreach ($checkusers as $user)
{
if ($user['admin']) continue; // No limits for admins
$current_count = phorum_db_pm_messagecount(PHORUM_PM_ALLFOLDERS, $user["user_id"]);
if ($current_count['total'] >= $PHORUM['max_pm_messagecount']) {
if ($user['user_id'] == $PHORUM["user"]["user_id"]) {
$error = $PHORUM["DATA"]["LANG"]["PMFromMailboxFull"];
} else {
$error = $PHORUM["DATA"]["LANG"]["PMToMailboxFull"];
$error = str_replace('%recipient%', htmlspecialchars($user["username"]), $error);
}
}
}
}
 
// Send the private message if no errors occurred.
if (empty($error)) {
 
$pm_message_id = phorum_db_pm_send($_POST["subject"], $_POST["message"], array_keys($recipients), NULL, $_POST["keep"]);
 
// Show an error in case of problems.
if (! $pm_message_id) {
 
$error = $PHORUM["DATA"]["LANG"]["PMNotSent"];
 
// Do e-mail notifications on successful sending.
} else {
 
include_once("./include/email_functions.php");
 
$pm_message = array(
'pm_message_id' => $pm_message_id,
'subject' => $_POST['subject'],
'message' => $_POST['message'],
'from_username' => $PHORUM['user']['username'],
'from_user_id' => $user_id,
);
 
// Sort all recipients that want a notify by language.
$langrcpts = array();
foreach ($recipients as $rcpt_id => $rcpt) {
 
if ($rcpt["pm_email_notify"]) {
if (!isset($langrcpts[$rcpt["user_language"]])) {
$langrcpts[$rcpt["user_language"]] = array($rcpt);
} else {
$langrcpts[$rcpt["user_language"]][] = $rcpt;
}
}
}
 
phorum_email_pm_notice($pm_message, $langrcpts);
 
phorum_hook("pm_sent", $pm_message);
}
}
 
// Invalidate user cache, to update message counts.
phorum_cache_remove('user', $user_id);
foreach ($recipients as $rcpt) {
phorum_cache_remove('user', $rcpt["user_id"]);
}
 
$redirect_message = "PMSent";
}
 
} else {
$error = $PHORUM["DATA"]["LANG"]["PMNoRecipients"];
}
 
// Stay on the post page in case of errors. Redirect on success.
if ($error) {
$page = "send";
} else {
$redirect = true;
}
 
}
 
break;
 
 
// Actions that are triggered from the buddy list.
case "buddies":
 
// Delete all checked buddies.
if (isset($_POST["delete"]) && isset($_POST["checked"])) {
foreach($_POST["checked"] as $buddy_user_id) {
phorum_db_pm_buddy_delete($buddy_user_id);
phorum_hook("buddy_delete", $buddy_user_id);
}
}
 
// Send a PM to the checked buddies.
if (isset($_POST["send_pm"]) && isset($_POST["checked"])) {
$pm_rcpts = $_POST["checked"];
if (count($pm_rcpts)) {
$redirect = true;
$page = "send";
} else {
unset($pm_rcpts);
}
}
 
break;
 
 
// Add a user to this user's buddy list.
case "addbuddy":
 
$buddy_user_id = $PHORUM["args"]["addbuddy_id"];
if (!empty($buddy_user_id)) {
if (phorum_db_pm_buddy_add($buddy_user_id)) {
$okmsg = $PHORUM["DATA"]["LANG"]["BuddyAddSuccess"];
phorum_hook("buddy_add", $buddy_user_id);
} else {
$error = $PHORUM["DATA"]["LANG"]["BuddyAddFail"];
}
}
break;
 
 
default:
die("Unhandled action for pm.php: " . htmlspecialchars($action));
 
}
 
// The action has been completed successfully.
// Redirect the user to the result page.
if ($redirect)
{
$args = array(
PHORUM_PM_URL,
"page=" . $page,
"folder_id=" . $folder_id,
);
if (isset($pm_rcpts)) $args[] = "to_id=" . implode(':', $pm_rcpts);
if (!empty($pm_id)) $args[] = "pm_id=" . $pm_id;
if (!empty($redirect_message)) $args[] = "okmsg=" . $redirect_message;
 
$redir_url = call_user_func_array('phorum_get_url', $args);
 
phorum_redirect_by_url($redir_url);
exit();
}
 
}
 
// ------------------------------------------------------------------------
// Display a PM page
// ------------------------------------------------------------------------
 
// Use the message list as the default page.
if (!$page){
$page = "list";
$folder_id = PHORUM_PM_INBOX;
}
 
// Show an OK message for a redirected page?
$okmsg_id = phorum_getparam('okmsg');
if ($okmsg_id && isset($PHORUM["DATA"]["LANG"][$okmsg_id])) {
$okmsg = $PHORUM["DATA"]["LANG"][$okmsg_id];
}
 
// Make error and OK messages available in the template.
$PHORUM["DATA"]["ERROR"] = (empty($error)) ? "" : $error;
$PHORUM["DATA"]["OKMSG"] = (empty($okmsg)) ? "" : $okmsg;
 
switch ($page) {
 
// Manage the PM folders.
case "folders":
 
$PHORUM["DATA"]["CREATE_FOLDER_NAME"] = isset($_POST["create_folder_name"]) ? htmlspecialchars($_POST["create_folder_name"]) : '';
$PHORUM["DATA"]["RENAME_FOLDER_NAME"] = isset($_POST["rename_folder_name"]) ? htmlspecialchars($_POST["rename_folder_name"]) : '';
$template = "pm_folders";
break;
 
 
// Manage the buddies.
case "buddies":
 
// Retrieve a list of users that are buddies for the current user.
$buddy_list = phorum_db_pm_buddy_list(NULL, true);
if (count($buddy_list)) {
$buddy_users = phorum_user_get(array_keys($buddy_list), false);
$buddy_users = phorum_hook("read_user_info", $buddy_users);
} else {
$buddy_users = array();
}
 
// Sort the buddies by username.
function phorum_sort_buddy_list($a,$b) {
return strcasecmp($a["username"], $b["username"]);
}
uasort($buddy_users, 'phorum_sort_buddy_list');
 
$buddies = array();
foreach ($buddy_users as $id => $buddy_user) {
$buddy = array(
'user_id' => $id,
'profile_url' => phorum_get_url(PHORUM_PROFILE_URL, $buddy_user["user_id"]),
'username' => htmlspecialchars($buddy_user["username"]),
'real_name' => isset($buddy_user["real_name"]) ? htmlspecialchars($buddy_user["real_name"]) : '',
'mutual' => $buddy_list[$id]["mutual"],
);
 
if (!$buddy_user['hide_activity']) {
$buddy["date_last_active"] = phorum_date($PHORUM["short_date"], $buddy_user["date_last_active"]);
} else {
$buddy["date_last_active"] = "-";
}
$buddies[$id] = $buddy;
}
 
$PHORUM["DATA"]["USERTRACK"] = $PHORUM["track_user_activity"];
$PHORUM["DATA"]["BUDDIES"] = $buddies;
$PHORUM["DATA"]["BUDDYCOUNT"] = count($buddies);
 
$PHORUM["DATA"]["PMLOCATION"] = $PHORUM["DATA"]["LANG"]["Buddies"];
 
$template = "pm_buddies";
break;
 
 
// Show a listing of messages in a folder.
case "list":
 
// Check if the folder exists for the user.
if (! isset($pm_folders[$folder_id])) {
$PHORUM["DATA"]["BLOCK_CONTENT"] = $PHORUM["DATA"]["LANG"]["PMFolderNotAvailable"];
$template = "stdblock";
} else {
 
$list = phorum_db_pm_list($folder_id);
 
// Prepare data for the templates (formatting and XSS prevention).
$list = phorum_pm_format($list);
foreach ($list as $message_id => $message)
{
$list[$message_id]["from_profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $message["from_user_id"]);
$list[$message_id]["read_url"]=phorum_get_url(PHORUM_PM_URL, "page=read", "folder_id=$folder_id", "pm_id=$message_id");
$list[$message_id]["date"] = phorum_date($PHORUM["short_date"], $message["datestamp"]);
$list[$message_id]["recipient_count"] = count($message["recipients"]);
$receive_count = 0;
foreach ($message["recipients"] as $rcpt_id => $rcpt) {
if ($rcpt["read_flag"]) $receive_count++;
$list[$message_id]["recipients"][$rcpt_id]["username"] = htmlspecialchars($rcpt["username"]);
$list[$message_id]["recipients"][$rcpt_id]["to_profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $rcpt_id);
}
$list[$message_id]["receive_count"] = $receive_count;
}
 
// Setup template variables.
$PHORUM["DATA"]["MESSAGECOUNT"] = count($list);
$PHORUM["DATA"]["MESSAGES"] = $list;
$PHORUM["DATA"]["PMLOCATION"] = $pm_folders[$folder_id]["name"];
 
$template = "pm_list";
}
 
break;
 
 
// Read a single private message.
case "read":
 
if (($message=phorum_db_pm_get($pm_id, $folder_id))) {
 
// Mark the message read.
if (! $message['read_flag']) {
phorum_db_pm_setflag($message["pm_message_id"], PHORUM_PM_READ_FLAG, true);
 
// Invalidate user cache, to update message counts.
phorum_cache_remove('user',$user_id);
}
 
// Run the message through the default message formatting.
list($message) = phorum_pm_format(array($message));
 
// Setup data for recipients.
foreach ($message["recipients"] as $rcpt_id => $rcpt) {
$message["recipients"][$rcpt_id]["username"] = htmlspecialchars($rcpt["username"]);
$message["recipients"][$rcpt_id]["to_profile_url"] = phorum_get_url(PHORUM_PROFILE_URL, $rcpt_id);
}
$message["recipient_count"] = count($message["recipients"]);
 
// Setup URL's and format date.
$message["from_profile_url"]=phorum_get_url(PHORUM_PROFILE_URL, $message["from_user_id"]);
$message["date"]=phorum_date($PHORUM["short_date"], $message["datestamp"]);
 
$PHORUM["DATA"]["MESSAGE"] = $message;
$PHORUM["DATA"]["PMLOCATION"] = $PHORUM["DATA"]["LANG"]["PMRead"];
 
// re-init folder list to account for change in read flags
$pm_folders = phorum_db_pm_getfolders(NULL, true);
 
// Set folder id to the right folder for this message.
$folder_id = $message["pm_folder_id"];
if ($folder_id == 0) {
$folder_id = $message["special_folder"];
}
 
$template = "pm_read";
 
} else {
 
// The message was not found. Show an error.
$PHORUM["DATA"]["BLOCK_CONTENT"] = $PHORUM["DATA"]["LANG"]["PMNotAvailable"];
$template = "stdblock";
}
 
break;
 
 
// Post a new private message.
case "send":
 
// Setup the default array with the message data.
$msg = array(
"from_username" => $PHORUM["user"]["username"],
"keep" => isset($_POST["keep"]) && $_POST["keep"] ? 1 : 0,
"subject" => isset($_POST["subject"]) ? $_POST["subject"] : '',
"message" => isset($_POST["message"]) ? $_POST["message"] : '',
"preview" => isset($_POST["preview"]) ? 1 : 0,
"recipients" => $recipients,
);
 
// Data initialization for posting messages on first request.
if ($action == NULL || $action != 'post')
{
// Setup data for sending a private message to specified recipients.
// Recipients are passed on as a standard phorum argument "to_id"
// containing a colon separated list of users.
if (isset($PHORUM["args"]["to_id"])) {
foreach (explode(":", $PHORUM["args"]["to_id"]) as $rcpt_id) {
settype($rcpt_id, "int");
$user = phorum_user_get($rcpt_id, false);
if ($user) {
$msg["recipients"][$rcpt_id] = array(
"username" => $user["username"],
"user_id" => $user["user_id"]
);
}
}
 
$hide_userselect = 1;
 
// Setup data for replying to a private message.
} elseif (isset($pm_id)) {
 
$message = phorum_db_pm_get($pm_id);
$msg["subject"] = $message["subject"];
$msg["message"] = $message["message"];
$msg["recipients"][$message["from_user_id"]] = array(
"username" => $message["from_username"],
"user_id" => $message["from_user_id"]
);
$msg = phorum_pm_quoteformat($message["from_username"], $msg);
 
// Include the other recipient, excecpt the active
// user himself, when replying to all.
if (isset($_POST["reply_to_all"])) {
foreach($message["recipients"] as $rcpt) {
if ($user_id == $rcpt["user_id"]) continue;
$msg["recipients"][$rcpt["user_id"]] = array(
"username" => $rcpt["username"],
"user_id" => $rcpt["user_id"],
);
}
}
 
$hide_userselect = 1;
 
// Setup data for replying privately to a forum post.
} elseif (isset($PHORUM["args"]["message_id"])) {
 
$message = phorum_db_get_message($PHORUM["args"]["message_id"], "message_id", true);
 
if (phorum_user_access_allowed(PHORUM_USER_ALLOW_READ) && ($PHORUM["forum_id"]==$message["forum_id"] || $message["forum_id"] == 0)) {
 
// get url to the message board thread
$origurl = phorum_get_url(PHORUM_READ_URL, $message["thread"], $message["message_id"]);
 
// Find the real username, because some mods rewrite the
// username in the message table. There will be a better solution
// for selecting recipients, but for now this will fix some
// of the problems.
$user = phorum_user_get($message["user_id"], false);
 
$msg["subject"] = $message["subject"];
$msg["message"] = $message["body"];
$msg["recipients"][$message["user_id"]] = array(
'username' => $user["username"],
'user_id' => $user["user_id"]
);
$msg = phorum_pm_quoteformat($user["username"], $msg, $origurl);
}
 
$hide_userselect = 1;
}
}
 
// Setup data for previewing a message.
if ($msg["preview"]) {
list($preview) = phorum_pm_format(array($msg));
$PHORUM["DATA"]["PREVIEW"] = $preview;
}
 
// XSS prevention.
foreach ($msg as $key => $val) {
switch ($key) {
case "recipients": {
foreach ($val as $id => $data) {
$msg[$key][$id]["username"] = htmlspecialchars($data["username"]);
}
break;
}
default: {
$msg[$key] = htmlspecialchars($val);
break;
}
}
}
 
 
$PHORUM["DATA"]["MESSAGE"] = $msg;
$PHORUM["DATA"]["RECIPIENT_COUNT"] = count($msg["recipients"]);
$PHORUM["DATA"]["SHOW_USERSELECTION"] = true;
 
// Determine what input element gets the focus.
$focus_id = 'userselection';
if ($PHORUM["DATA"]["RECIPIENT_COUNT"]) $focus_id = 'subject';
if (!empty($msg["subject"])) $focus_id = 'message';
$PHORUM["DATA"]["FOCUS_TO_ID"] = $focus_id;
 
// Create data for a user dropdown list, if configured.
if ($PHORUM["DATA"]["SHOW_USERSELECTION"] && $PHORUM["enable_dropdown_userlist"])
{
$allusers = array();
$userlist = phorum_user_get_list();
foreach ($userlist as $user_id => $userinfo){
if (isset($msg["recipients"][$user_id])) continue;
$userinfo["displayname"] = htmlspecialchars($userinfo["displayname"]);
$userinfo["username"] = htmlspecialchars($userinfo["username"]);
$userinfo["user_id"] = $user_id;
$allusers[] = $userinfo;
}
$PHORUM["DATA"]["USERS"] = $allusers;
if (count($allusers) == 0) $PHORUM["DATA"]["SHOW_USERSELECTION"] = false;
}
 
$PHORUM["DATA"]["PMLOCATION"] = $PHORUM["DATA"]["LANG"]["SendPM"];
$template = "pm_post";
break;
}
 
if ($hide_userselect) {
$PHORUM["DATA"]["SHOW_USERSELECTION"] = 0;
}
 
// Make message count and quota information available in the templates.
$PHORUM['DATA']['MAX_PM_MESSAGECOUNT'] = 0;
if (! $PHORUM['user']['admin']) {
$PHORUM['DATA']['MAX_PM_MESSAGECOUNT'] = $PHORUM['SETTINGS']['max_pm_messagecount'];
if ($PHORUM['SETTINGS']['max_pm_messagecount'])
{
$current_count = phorum_db_pm_messagecount(PHORUM_PM_ALLFOLDERS);
$PHORUM['DATA']['PM_MESSAGECOUNT'] = $current_count['total'];
$space_left = $PHORUM['SETTINGS']['max_pm_messagecount'] - $current_count['total'];
if ($space_left < 0) $space_left = 0;
$PHORUM['DATA']['PM_SPACE_LEFT'] = $space_left;
$PHORUM['DATA']['LANG']['PMSpaceLeft'] = str_replace('%pm_space_left%', $space_left, $PHORUM['DATA']['LANG']['PMSpaceLeft']);
}
}
 
// Make a list of folders for use in the menu and a list of folders that
// the user created. The latter will be set to zero if no user folders
// are available.
 
$pm_userfolders = array();
foreach($pm_folders as $id => $data)
{
$pm_folders[$id]["is_special"] = is_numeric($id) ? 0 : 1;
$pm_folders[$id]["is_outgoing"] = $id == PHORUM_PM_OUTBOX;
$pm_folders[$id]["id"] = $id;
$pm_folders[$id]["name"] = htmlspecialchars($data["name"]);
$pm_folders[$id]["url"] = phorum_get_url(PHORUM_PM_URL, "page=list", "folder_id=$id");
 
if (!$pm_folders[$id]["is_special"]) {
$pm_userfolders[$id] = $pm_folders[$id];
}
}
 
$PHORUM["DATA"]["URL"]["PM_FOLDERS"] = phorum_get_url(PHORUM_PM_URL, "page=folders");
$PHORUM["DATA"]["URL"]["PM_SEND"] = phorum_get_url(PHORUM_PM_URL, "page=send");
$PHORUM["DATA"]["URL"]["BUDDIES"] = phorum_get_url(PHORUM_PM_URL, "page=buddies");
 
$PHORUM["DATA"]["PM_FOLDERS"] = $pm_folders;
$PHORUM["DATA"]["PM_USERFOLDERS"] = count($pm_userfolders) ? $pm_userfolders : 0;
 
 
// Set some default template data.
$PHORUM["DATA"]["ACTION"]=phorum_get_url( PHORUM_PM_ACTION_URL );
$PHORUM["DATA"]["FOLDER_ID"] = $folder_id;
$PHORUM["DATA"]["FOLDER_IS_INCOMING"] = $folder_id == PHORUM_PM_OUTBOX ? 0 : 1;
$PHORUM["DATA"]["PM_PAGE"] = $page;
$PHORUM["DATA"]["HIDE_USERSELECT"] = $hide_userselect;
 
include phorum_get_template("header");
phorum_hook("after_header");
if ($error_msg) {
$PHORUM["DATA"]["ERROR"] = $error_msg;
unset($PHORUM["DATA"]["MESSAGE"]);
include phorum_get_template("message");
} else {
include phorum_get_template("pm");
}
phorum_hook("before_footer");
include phorum_get_template("footer");
 
// ------------------------------------------------------------------------
// Utility functions
// ------------------------------------------------------------------------
 
// Apply the default forum message formatting to a private message.
function phorum_pm_format($messages)
{
include_once("./include/format_functions.php");
 
// Reformat message so it looks like a forum message.
foreach ($messages as $id => $message)
{
$messages[$id]["author"] = $message["from_username"];
$messages[$id]["body"] = isset($message["message"]) ? $message["message"] : "";
$messages[$id]["email"] = "";
}
 
// Run the messages through the formatting code.
$messages = phorum_format_messages($messages);
 
// Reformat message back to a private message.
foreach ($messages as $id => $message)
{
$messages[$id]["message"] = $message["body"];
$messages[$id]["from_username"] = $message["author"];
unset($messages[$id]["body"]);
unset($messages[$id]["author"]);
}
 
return $messages;
}
 
// Apply message reply quoting to a private message.
function phorum_pm_quoteformat($orig_author, $message, $inreplyto = NULL)
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Build the reply subject.
if (substr($message["subject"], 0, 3) != "Re:") {
$message["subject"] = "Re: ".$message["subject"];
}
 
// Build a quoted version of the message body.
$quote = phorum_strip_body($message["message"]);
$quote = str_replace("\n", "\n> ", $quote);
$quote = wordwrap(trim($quote), 50, "\n> ", true);
$quote = ($inreplyto != NULL ? "{$PHORUM['DATA']['LANG']['InReplyTo']} {$inreplyto}\n" : '') .
"$orig_author {$PHORUM['DATA']['LANG']['Wrote']}:\n" .
str_repeat("-", 55)."\n> {$quote}\n\n\n";
$message["message"] = $quote;
 
return $message;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/.htaccess
New file
0,0 → 1,11
# By default, no module files may be accessed
# directly from a webbrowser.
Order deny,allow
Deny from all
 
# File types for which we make an exception.
<Files ~ "\.(gif|jpg|jpeg|png)$">
Order allow,deny
Allow from all
</Files>
 
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/replace/replace.php
New file
0,0 → 1,39
<?php
 
if(!defined("PHORUM")) return;
 
function phorum_mod_replace ($data)
{
$PHORUM=$GLOBALS["PHORUM"];
 
if(isset($PHORUM["mod_replace"])){
 
foreach($data as $key => $message){
 
if(isset($message["body"])){
 
$body=$message["body"];
foreach($PHORUM["mod_replace"] as $entry){
$entry["replace"]=str_replace(array("<", ">"), array("<", ">"), $entry["replace"]);
if($entry["pcre"]){
$body=preg_replace("/$entry[search]/is", $entry["replace"], $body);
} else {
$body=str_replace($entry["search"], "$entry[replace]", $body);
}
}
$data[$key]["body"]=$body;
}
}
 
}
 
return $data;
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/replace/settings.php
New file
0,0 → 1,107
<?php
 
if(!defined("PHORUM_ADMIN")) return;
 
$error="";
$curr="NEW";
 
$match_types = array("string", "PCRE");
 
if(count($_POST) && $_POST["search"]!="" && $_POST["replace"]!=""){
 
$item = array("search"=>$_POST["search"], "replace"=>$_POST["replace"], "pcre"=>$_POST["pcre"]);
 
if($_POST["curr"]!="NEW"){
$PHORUM["mod_replace"][$_POST["curr"]]=$item;
} else {
$PHORUM["mod_replace"][]=$item;
}
 
if(empty($error)){
if(!phorum_db_update_settings(array("mod_replace"=>$PHORUM["mod_replace"]))){
$error="Database error while updating settings.";
} else {
echo "Replacement Updated<br />";
}
}
}
 
if(isset($_GET["curr"])){
if(isset($_GET["delete"])){
unset($PHORUM["mod_replace"][$_GET["curr"]]);
phorum_db_update_settings(array("mod_replace"=>$PHORUM["mod_replace"]));
echo "Replacement Deleted<br />";
} else {
$curr = $_GET["curr"];
}
}
 
 
if($curr!="NEW"){
extract($PHORUM["mod_replace"][$curr]);
$title="Edit Replacement";
$submit="Update";
} else {
settype($string, "string");
settype($type, "int");
settype($pcre, "int");
$title="Add A Replacement";
$submit="Add";
}
 
include_once "./include/admin/PhorumInputForm.php";
 
$frm =& new PhorumInputForm ("", "post", $submit);
 
$frm->hidden("module", "modsettings");
 
$frm->hidden("mod", "replace");
 
$frm->hidden("curr", "$curr");
 
$frm->addbreak($title);
 
$frm->addrow("String To Match", $frm->text_box("search", $search, 50));
 
$frm->addrow("Replacement", $frm->text_box("replace", $replace, 50));
 
$frm->addrow("Compare As", $frm->select_tag("pcre", $match_types, $pcre));
 
$frm->show();
 
echo "If using PCRE for comparison, \"Sting To Match\" should be a valid PCRE expression. See <a href=\"http://php.net/pcre\">the PHP manual</a> for more information.";
 
if($curr=="NEW"){
 
echo "<hr class=\"PhorumAdminHR\" />";
 
if(count($PHORUM["mod_replace"])){
 
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableHead\">Search</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Replace</td>\n";
echo " <td class=\"PhorumAdminTableHead\">Compare Method</td>\n";
echo " <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
echo "</tr>\n";
 
foreach($PHORUM["mod_replace"] as $key => $item){
echo "<tr>\n";
echo " <td class=\"PhorumAdminTableRow\">".htmlspecialchars($item["search"])."</td>\n";
echo " <td class=\"PhorumAdminTableRow\">".htmlspecialchars($item["replace"])."</td>\n";
echo " <td class=\"PhorumAdminTableRow\">".$match_types[$item["pcre"]]."</td>\n";
echo " <td class=\"PhorumAdminTableRow\"><a href=\"$_SERVER[PHP_SELF]?module=modsettings&mod=replace&curr=$key&?edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=modsettings&mod=replace&curr=$key&delete=1\">Delete</a></td>\n";
echo "</tr>\n";
}
 
echo "</table>\n";
 
} else {
 
echo "No replacements in list currently.";
 
}
 
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/replace/info.txt
New file
0,0 → 1,3
hook: format|phorum_mod_replace
title: Simple Text Replacement Mod
desc: This module allows admins to define text replacement in messages.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/bbcode/info.txt
New file
0,0 → 1,4
hook: format|phorum_bb_code
hook: quote|phorum_bb_code_quote
title: BB Code Phorum Mod
desc: This module converts BB Code into HTML.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/bbcode/bbcode.php
New file
0,0 → 1,150
<?php
 
if(!defined("PHORUM")) return;
 
// BB Code Phorum Mod
function phorum_bb_code($data)
{
$PHORUM = $GLOBALS["PHORUM"];
 
$search = array(
"/\[img\]((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%# ]+?)\[\/img\]/is",
"/\[url\]((http|https|ftp|mailto):\/\/([a-z0-9\.\-@:]+)[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),\#%~ ]*?)\[\/url\]/is",
"/\[url=((http|https|ftp|mailto):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%# ]+?)\](.+?)\[\/url\]/is",
"/\[email\]([a-z0-9\-_\.\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+?)\[\/email\]/ies",
"/\[color=([\#a-z0-9]+?)\](.+?)\[\/color\]/is",
"/\[size=([+\-\da-z]+?)\](.+?)\[\/size\]/is",
"/\[b\](.+?)\[\/b\]/is",
"/\[u\](.+?)\[\/u\]/is",
"/\[i\](.+?)\[\/i\]/is",
"/\[s\](.+?)\[\/s\]/is",
"/\[center\](.+?)\[\/center\]/is",
"/\[hr\]/i",
"/\[code\](.+?)\[\/code\]/is",
"/\[sub\](.+?)\[\/sub\]/is",
"/\[sup\](.+?)\[\/sup\]/is",
);
 
// add extra tags to links, if enabled in the admin settings page
 
$extra_link_tags = "";
 
if(isset($PHORUM["mod_bb_code"])){ // check for settings file before using settings-dependent variables
if ($PHORUM["mod_bb_code"]["links_in_new_window"]){
$extra_link_tags .= "target=\"_blank\" ";
}
if ($PHORUM["mod_bb_code"]["rel_no_follow"]){
$extra_link_tags .= "rel=\"nofollow\" ";
}
}
 
$replace = array(
"<img src=\"$1\" />",
"[<a $extra_link_tags href=\"$1\">$3</a>]",
"<a $extra_link_tags href=\"$1\">$3</a>",
"'<a $extra_link_tags href=\"'.phorum_html_encode('mailto:$1').'\">'.phorum_html_encode('$1').'</a>'",
"<span style=\"color: $1\">$2</span>",
"<span style=\"font-size: $1\">$2</span>",
"<strong>$1</strong>",
"<u>$1</u>",
"<i>$1</i>",
"<s>$1</s>",
"<center class=\"bbcode\">$1</center>",
"<hr class=\"bbcode\" />",
"<pre class=\"bbcode\">$1</pre>",
"<sub class=\"bbcode\">$1</sub>",
"<sup class=\"bbcode\">$1</sup>",
);
 
$quote_search = array(
"/\[quote\]/is",
"/\[quote ([^\]]+?)\]/is",
"/\[quote=([^\]]+?)\]/is",
"/\[\/quote\]/is"
);
 
$quote_replace = array(
"<blockquote class=\"bbcode\">".$PHORUM["DATA"]["LANG"]["Quote"] . ":<div>",
"<blockquote class=\"bbcode\">".$PHORUM["DATA"]["LANG"]["Quote"] . ":<div><strong>$1</strong><br />",
"<blockquote class=\"bbcode\">".$PHORUM["DATA"]["LANG"]["Quote"] . ":<div><strong>$1</strong><br />",
"</div></blockquote>"
);
 
foreach($data as $message_id => $message){
 
if(isset($message["body"])){
 
// do BB Code here
$body = $message["body"];
 
$rnd=substr(md5($body.time()), 0, 4);
 
// convert bare urls into bbcode tags as best we can
// the haystack has to have a space in front of it for the preg to work.
$body = preg_replace("/([^='\"(\[url\]|\[img\])])((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%#]+)/i", "$1:$rnd:$2:/$rnd:", " $body");
 
// stip puncuation from urls
if(preg_match_all("!:$rnd:(.+?):/$rnd:!i", $body, $match)){
 
$urls = array_unique($match[1]);
 
foreach($urls as $key => $url){
// stip puncuation from urls
if(preg_match("|[^a-z0-9=&/\+_]+$|i", $url, $match)){
 
$extra = $match[0];
$true_url = substr($url, 0, -1 * (strlen($match[0])));
 
$body = str_replace("$url:/$rnd:", "$true_url:/$rnd:$extra", $body);
 
$url = $true_url;
}
 
$body = str_replace(":$rnd:$url:/$rnd:", "[url]{$url}[/url]", $body);
}
 
}
 
// no sense doing any of this if there is no [ in the body
if(strstr($body, "[")){
 
// convert bare email addresses into bbcode tags as best we can.
$body = preg_replace("/([a-z0-9][a-z0-9\-_\.\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+[a-z0-9])/i", "[email]$1[/email]", $body);
 
// clean up any BB code we stepped on.
$body = str_replace("[email][email]", "[email]", $body);
$body = str_replace("[/email][/email]", "[/email]", $body);
 
// fiddle with white space around quote and code tags.
$body=preg_replace("/\s*(\[\/*(code|quote)\])\s*/", "$1", $body);
 
// run the pregs defined above
$body = preg_replace($search, $replace, $body);
 
// quote has to be handled differently because they can be embedded.
// we only do quote replacement if we have matching start and end tags
if(strstr($body, "[quote") && substr_count($body, "[quote")==substr_count($body, "[/quote]")){
$body = preg_replace($quote_search, $quote_replace, $body);
}
 
 
}
 
 
$data[$message_id]["body"] = $body;
}
}
 
return $data;
}
 
 
function phorum_bb_code_quote ($array)
{
$PHORUM = $GLOBALS["PHORUM"];
 
if(isset($PHORUM["mod_bb_code"]) && $PHORUM["mod_bb_code"]["quote_hook"]){
return "[quote $array[0]]$array[1][/quote]";
}
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/bbcode/settings.php
New file
0,0 → 1,44
<?php
// this Settings file was hacked together from the example module
// kindly created by Chris Eaton (tridus@hiredgoons.ca)
// Update history:
// Checkboxes added for "links in window" and "anti-spam tags" by Adam Sheik (www.cantonese.sheik.co.uk)
 
if(!defined("PHORUM_ADMIN")) return;
 
// save settings
if(count($_POST)){
$PHORUM["mod_bb_code"]["links_in_new_window"]=$_POST["links_in_new_window"] ? 1 : 0;
$PHORUM["mod_bb_code"]["rel_no_follow"]=$_POST["rel_no_follow"] ? 1 : 0;
$PHORUM["mod_bb_code"]["quote_hook"]=$_POST["quote_hook"] ? 1 : 0;
 
if(!phorum_db_update_settings(array("mod_bb_code"=>$PHORUM["mod_bb_code"]))){
$error="Database error while updating settings.";
}
else {
echo "Settings Updated<br />";
}
}
 
include_once "./include/admin/PhorumInputForm.php";
$frm =& new PhorumInputForm ("", "post", "Save");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "bbcode"); // this is the directory name that the Settings file lives in
 
if (!empty($error)){
echo "$error<br />";
}
$frm->addbreak("Edit settings for the BBCode module");
$frm->addmessage("When users post links on your forum, you can choose whether they open in a new window.");
$frm->addrow("Open links in new window: ", $frm->checkbox("links_in_new_window", "1", "", $PHORUM["mod_bb_code"]["links_in_new_window"]));
$frm->addmessage("Enable <a href=\"http://en.wikipedia.org/wiki/Blog_spam\" target=\"_blank\">
Google's new anti-spam protocol</a> for links posted on your forums.
<br/>
Note, this doesn't stop spam links being posted, but it does mean that
spammers don't get credit from Google from that link.");
$frm->addrow("Use 'rel=nofollow' anti-spam tag: ", $frm->checkbox("rel_no_follow", "1", "", $PHORUM["mod_bb_code"]["rel_no_follow"]));
$frm->addmessage("As of Phorum 5.1, there is the option to have quoted text altered by modules. Since it only makes sense to have one module modifying the quoted text, you can disable this one part of this module.");
 
$frm->addrow("Enable quote hook", $frm->checkbox("quote_hook", "1", "", $PHORUM["mod_bb_code"]["quote_hook"]));
$frm->show();
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/html/html.php
New file
0,0 → 1,51
<?php
 
if(!defined("PHORUM")) return;
 
// HTML Phorum Mod
function phorum_html($data)
{
$PHORUM = $GLOBALS["PHORUM"];
 
foreach($data as $message_id => $message){
 
if(isset($message["body"])){
 
$body = $message["body"];
 
// restore tags where Phorum has killed them
$body = preg_replace("!&lt;(\/*[a-z].*?)&gt;!i", "<$1>", $body);
 
// restore escaped &
$body = str_replace("&amp;", "&", $body);
 
// strip out javascript events
if(preg_match_all("/<[a-z][^>]+>/i", $body, $matches)){
$tags=array_unique($matches[0]);
foreach($tags as $tag){
$newtag=preg_replace("/\son.+?=[^>]+/i", "$1", $tag);
$body=str_replace($tag, $newtag, $body);
}
}
 
// turn script and meta tags into comments
$body=preg_replace("/<(\/*(script|meta).*?)>/i", "<!--$1-->", $body);
 
// strip any <br phorum=\"true\" /> that got inside certain blocks like tables and pre.
$block_tags="table|pre|xmp";
 
preg_match_all("!(<($block_tags).*?>).+?(</($block_tags).*?>)!ms", $body, $matches);
 
foreach($matches[0] as $block){
$newblock=str_replace("<br phorum=\"true\" />", "", $block);
$body=str_replace($block, $newblock, $body);
}
 
$data[$message_id]["body"] = $body;
}
}
 
return $data;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/html/info.txt
New file
0,0 → 1,3
hook: format|phorum_html
title: HTML Phorum Mod
desc: This module allow HTML to be used in posts. This includes allowing special characters (eg. UTF-8) that are HTML encoded. NOTE: Bad HTML input by users could mess up your page layout.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/smileyslib.php
New file
0,0 → 1,244
<?php
 
// A library of common functions and definitions for
// the smileys mod. This library is only loaded when
// initializing or saving module settings.
 
if(!defined("PHORUM") && !defined("PHORUM_ADMIN")) return;
 
// A match for filtering files that are accepted as smiley images.
define('MOD_SMILEYS_IMAGE_MATCH', '/^.+\.(gif|png|jpg|jpeg)$/i');
 
// A match for matching absolute file paths. Paths that I could think of:
// UNIX path /...
// URL proto://...
// Windows path X:\... or X:/...
// Windows net path \\...
define('MOD_SMILEYS_ABSPATH_MATCH', '!^/|^\w+://|^\w:[/\\\\]|^\\\\\\\\!i');
 
// The default smiley prefix path.
global $MOD_SMILEY_DEFAULT_PREFIX;
$MOD_SMILEY_DEFAULT_PREFIX = './mods/smileys/images/';
 
// The default list of smileys to install upon initial setup.
global $MOD_SMILEY_DEFAULT_SMILEYS;
$MOD_SMILEY_DEFAULT_SMILEYS = array(
"(:P)" => "smiley25.gif spinning smiley sticking its tongue out",
"(td)" => "smiley23.gif thumbs up",
"(tu)" => "smiley24.gif thumbs down",
":)-D" => "smiley15.gif smileys with beer",
">:D<" => "smiley14.gif the finger smiley",
"(:D" => "smiley12.gif smiling bouncing smiley",
"8-)" => "smilie8.gif eye rolling smiley",
":)o" => "smiley16.gif drinking smiley",
"::o" => "smilie10.gif eye popping smiley",
"B)-" => "smilie7.gif smoking smiley",
":(" => "smilie2.gif sad smiley",
":)" => "smilie1.gif smiling smiley",
":?" => "smiley17.gif moody smiley",
":D" => "smilie5.gif grinning smiley",
":P" => "smilie6.gif tongue sticking out smiley",
":S" => "smilie11.gif confused smiley",
":X" => "smilie9.gif angry smiley",
":o" => "smilie4.gif yawning smiley",
";)" => "smilie3.gif winking smiley",
"B)" => "cool.gif cool smiley",
"X(" => "hot.gif hot smiley",
);
 
/**
* Sets up initial settings for the smileys mod or upgrades
* the settings from old versions.
* @return modinfo - Updated module information.
*/
function phorum_mod_smileys_initsettings()
{
$PHORUM = $GLOBALS["PHORUM"];
global $MOD_SMILEY_DEFAULT_PREFIX;
global $MOD_SMILEY_DEFAULT_SMILEYS;
$modinfo = isset($PHORUM["mod_smileys"]) ? $PHORUM["mod_smileys"] : array();
 
// Keep track if we need to store settings in the database.
$do_db_update = false;
 
// Set default for the image prefix path.
if(! isset($modinfo['prefix'])) {
$modinfo['prefix'] = $MOD_SMILEY_DEFAULT_PREFIX;
// So phorum_mod_smileys_available() sees it right away.
$GLOBALS["PHORUM"]["mod_smileys"]["prefix"] = $MOD_SMILEY_DEFAULT_PREFIX;
$do_db_update = true;
}
 
// Set a default list of smileys or upgrade from existing smiley mod.
if (! isset($modinfo['smileys']))
{
$modinfo['smileys'] = array();
 
// Check if we have smileys from the previous version of the
// smiley mod. These were stored at the same level as the
// settings.
$upgrade_list = array();
if (isset($PHORUM["mod_smileys"])) {
foreach ($PHORUM["mod_smileys"] as $id => $smiley) {
if (is_numeric($id)) {
$upgrade_list[$id] = $smiley;
}
}
}
 
// We have an existing list of smileys to upgrade. Move the
// smileys to their new location.
if (count($upgrade_list)) {
foreach ($upgrade_list as $id => $smiley) {
unset($modinfo[$id]);
$modinfo["smileys"][$id] = $smiley;
}
$do_db_update = true;
}
// Set an initial list of smileys.
else {
foreach ($MOD_SMILEY_DEFAULT_SMILEYS as $search => $data) {
list($smiley, $alt) = preg_split('/\s+/', $data, 2);
$modinfo["smileys"][] = array(
"search" => $search,
"alt" => $alt,
"smiley" => $smiley,
"uses" => 2,
);
}
$do_db_update = true;
}
}
 
// Store the changed settings in the database. Errors are
// silently ignored here, to keep them away from end-users.
if ($do_db_update) {
list($modinfo, $message) = phorum_mod_smileys_store($modinfo);
$GLOBALS["PHORUM"]["mod_smileys"] = $modinfo;
return $modinfo;
}
}
 
/**
* Reads in the list of available smiley images.
* @return smileys - An array of smiley image filenames.
*/
function phorum_mod_smileys_available()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$available_smileys = array();
if(file_exists($PHORUM['mod_smileys']['prefix'])){
$d = dir($PHORUM['mod_smileys']['prefix']);
while($entry=$d->read()) {
if(preg_match(MOD_SMILEYS_IMAGE_MATCH, $entry)) {
$available_smileys[$entry]=$entry;
}
}
}
asort($available_smileys);
return $available_smileys;
}
 
/**
* Compiles replacement arrays for the smileys mod and stores the
* data for the module in the database.
* @param modinfo - The configuration array for mod_smileys.
* @return result - An array containing two elements:
* updated module info or NULL on failure and
* a message that can be displayed to the user.
*/
function phorum_mod_smileys_store($modinfo)
{
// Get the current list of available smiley images.
$available_smileys = phorum_mod_smileys_available();
 
// Sort the smileys by length. We need to do this to replace the
// longest smileys matching strings first. Else for example the
// smiley ":)-D" could end up as (smileyimage)-D, because ":)"
// was replaced first.
uasort($modinfo["smileys"],'phorum_mod_smileys_sortbylength');
 
// Create and fill replacement arrays for subject and body.
$smiley_subject_key = array();
$smiley_subject_val = array();
$smiley_body_key = array();
$smiley_body_val = array();
$seen_images = array();
foreach ($modinfo["smileys"] as $id => $smiley)
{
// Check if the smiley image is available. Skip and keep track
// of missing smiley images.
$active = isset($available_smileys[$smiley["smiley"]]) ? true : false;
$modinfo["smileys"][$id]['active'] = $active;
if (! $active) continue;
 
// Check if the smiley image has been seen before. If is has, mark
// the current smiley as being an alias. This is used in the editor
// smiley help, to show only one version of a smiley image.
$is_alias = isset($seen_images[$smiley["smiley"]]) ? true : false;
$seen_images[$smiley["smiley"]] = 1;
$modinfo["smileys"][$id]["is_alias"] = $is_alias;
 
// Create HTML image code for the smiley.
$prefix = $modinfo["prefix"];
$src = htmlspecialchars("$prefix{$smiley['smiley']}");
$alttxt = empty($smiley['alt']) ? $smiley["search"] : $smiley["alt"];
$alt = htmlspecialchars($alttxt);
$img = "<img class=\"mod_smileys_img\" src=\"$src\" alt=\"$alt\" title=\"$alt\"/>";
 
// Below we use htmlspecialchars() on the search string.
// This is done, because the smiley mod is run after formatting
// by Phorum, so characters like < and > are HTML escaped.
 
// Body only replace (0) or subject and body replace (2).
if ($smiley['uses'] == 0 || $smiley['uses'] == 2) {
$smiley_body_key[] = htmlspecialchars($smiley['search']);
$smiley_body_val[] = $img;
}
 
// Subject only replace (1) or subject and body replace (2).
if ($smiley['uses'] == 1 || $smiley['uses'] == 2) {
$smiley_subject_key[] = htmlspecialchars($smiley['search']);
$smiley_subject_val[] = $img;
}
}
 
// Store replacement arrays in the module settings.
$modinfo["replacements"] = array(
"subject" => count($smiley_subject_key)
? array($smiley_subject_key, $smiley_subject_val)
: NULL,
"body" => count($smiley_body_key)
? array($smiley_body_key, $smiley_body_val)
: NULL
);
 
// For quickly determining if the smiley replacements must be run.
$modinfo["do_smileys"] = $modinfo["replacements"]["subject"] != NULL ||
$modinfo["replacements"]["body"] != NULL;
 
// Store the module settings in the database.
if (! phorum_db_update_settings(array("mod_smileys" => $modinfo))) {
return array(NULL, "Saving the smiley settings to the database failed.");
} else {
return array($modinfo, "The smiley settings were successfully saved.");
}
}
 
/**
* A callback function for sorting smileys by their search string length.
* usage: uasort($array_of_smileys, 'phorum_mod_smileys_sortbylength');
*/
function phorum_mod_smileys_sortbylength($a, $b) {
if (isset($a["search"]) && isset($b["search"])) {
if (strlen($a["search"]) == strlen($b["search"])) {
return strcmp($a["search"], $b["search"]);
} else {
return strlen($a["search"]) < strlen($b["search"]);
}
} else {
return 0;
}
}
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/undecided.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/undecided.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/embarrassed.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/embarrassed.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/frowning.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/frowning.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/crying.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/crying.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/baringteeth.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/baringteeth.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/suprised.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/suprised.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/tounge.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/tounge.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/sleepy.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/sleepy.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley23.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley23.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/wink.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/wink.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley24.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley24.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley25.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley25.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/thinking.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/thinking.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/innocent.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/innocent.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/angry.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/angry.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie10.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie10.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/disappointed.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/disappointed.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie11.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie11.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/nerd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/nerd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/sick.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/sick.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/hot.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/hot.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/cool.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/cool.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/laughing.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/laughing.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/rolleyes.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/rolleyes.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie1.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie1.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie3.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie3.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley12.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley12.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/confused.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/confused.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie4.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie4.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley14.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley14.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/kissing.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/kissing.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie5.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie5.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley15.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley15.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie6.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie6.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley16.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley16.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smile.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smile.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie7.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie7.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley17.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smiley17.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie8.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie8.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie9.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/smilie9.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/footinmouth.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/footinmouth.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/lipsaresealed.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/images/lipsaresealed.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/settings.php
New file
0,0 → 1,349
<?php
 
if(!defined("PHORUM_ADMIN")) return;
 
require_once("./include/admin/PhorumInputForm.php");
require_once("./mods/smileys/smileyslib.php");
require_once("./mods/smileys/defaults.php");
 
// The definition of the possible uses for a smiley.
$PHORUM_MOD_SMILEY_USES = array(
0 => "Body",
1 => "Subject",
2 => "Body + Subject",
);
 
// ---------------------------------------------------------------------------
// Handle actions for sent form data.
// ---------------------------------------------------------------------------
 
// The action to perform.
$action = isset($_POST["action"]) ? $_POST["action"] : "";
 
// Keep track if the settings must be saved in the database.
$do_db_update = false;
 
// Keep track of error and success messages.
$error="";
$okmsg = "";
 
// Initialize smiley_id parameter.
$smiley_id = isset($_POST["smiley_id"]) ? $_POST["smiley_id"] : "NEW";
 
// ACTION: Changing the mod_smileys settings.
if (empty($error) && $action == "edit_settings") {
$_POST["prefix"] = trim($_POST["prefix"]);
// Is the field filled in?
if (empty($_POST["prefix"])) {
$error = "Please, fill in the smiley prefix path";
// Deny absolute paths.
} elseif (preg_match(MOD_SMILEYS_ABSPATH_MATCH, $_POST["prefix"])) {
$error = "The smiley path must be a path, relative to Phorum's " .
"installation directory";
// Is the specified prefix a directory?
} elseif (!is_dir($_POST["prefix"])) {
$error = "The smiley prefix path " .
'"' . htmlspecialchars($_POST["prefix"]) . '" ' .
" does not exist";
}
 
// All is okay. Set the prefix path in the config.
if (empty($error))
{
// Make sure the prefix path ends with a "/".
if (substr($_POST["prefix"], -1, 1) != '/') {
$_POST["prefix"] .= "/";
}
 
$PHORUM["mod_smileys"]["prefix"] = $_POST["prefix"];
 
$okmsg = "The smiley settings have been saved successfully";
$do_db_update = true;
}
}
 
// ACTION: Adding or updating smileys.
if (empty($error) && $action == "edit_smiley")
{
// Trim whitespace from form input fields.
foreach (array("search","smiley","alt") as $field) {
if (isset($_POST[$field])) $_POST[$field] = trim($_POST[$field]);
}
 
// Check if the search string is entered.
if (empty($_POST["search"]))
$error = "Please enter the string to match";
// Check if a replace smiley is selected.
elseif (empty($_POST["smiley"]))
$error = "Please, select a smiley to replace the string " .
htmlspecialchars($_POST["search"]) . " with";
// Check if the smiley doesn't already exist.
if (empty($error)) {
foreach ($PHORUM["mod_smileys"]["smileys"] as $id => $smiley) {
if ($smiley["search"] == $_POST["search"] &&
$_POST["smiley_id"] != $id) {
$error = "The smiley " .
'"' . htmlspecialchars($_POST["search"]) . '" ' .
"already exists";
break;
}
}
}
 
// All fields are okay. Update the smiley list.
if (empty($error))
{
$item = array(
"search" => $_POST["search"],
"smiley" => $_POST["smiley"],
"alt" => $_POST["alt"],
"uses" => $_POST['uses']
);
 
if ($smiley_id == "NEW") {
$PHORUM["mod_smileys"]["smileys"][]=$item;
$okmsg = "The smiley has been added successfully";
} else {
$PHORUM["mod_smileys"]["smileys"][$smiley_id]=$item;
$okmsg = "The smiley has been updated successfully";
}
 
$do_db_update = true;
}
}
 
// GET based actions.
if (empty($error) && isset($_GET["smiley_id"]))
{
// ACTION: Deleting a smiley from the list.
if (isset($_GET["delete"])) {
unset($PHORUM["mod_smileys"]["smileys"][$_GET["smiley_id"]]);
$do_db_update = true;
$okmsg = "The smiley has been deleted successfully";
}
 
// ACTION: Startup editing a smiley from the list.
if (isset($_GET["edit"])) {
$smiley_id = $_GET["smiley_id"];
}
}
 
 
// ---------------------------------------------------------------------------
// Do database updates.
// ---------------------------------------------------------------------------
 
// Changes have been made to the smileys configuration.
// Store these changes in the database.
if (empty($error) && $do_db_update)
{
list($modinfo, $message) = phorum_mod_smileys_store($PHORUM["mod_smileys"]);
if ($modinfo == NULL) {
$error = $message;
} else {
if (empty($okmsg)) $okmsg = $message;
$PHORUM["mod_smileys"] = $modinfo;
 
// Back to the startscreen
unset($_POST);
$smiley_id = 'NEW';
}
}
 
 
// ---------------------------------------------------------------------------
// Display the settings page
// ---------------------------------------------------------------------------
 
// Get the current list of available smiley images.
$available_smileys = phorum_mod_smileys_available();
 
// Javascript for displaying a smiley preview when a smiley image
// is selected from the drop down box.
?>
<script type="text/javascript">
function change_image(new_image) {
var div = document.getElementById("preview_div");
var img = document.getElementById("preview_image");
if (new_image.length == 0) {
new_image = "./images/trans.gif";
div.style.display = 'none';
} else {
new_image = "<?php print $PHORUM["mod_smileys"]["prefix"]?>" + new_image;
div.style.display = 'block';
}
img.src =new_image;
}
</script>
<?php
 
// Display the result message.
if (! empty($error)) {
phorum_admin_error($error);
} elseif (! empty($okmsg)) {
phorum_admin_okmsg($okmsg);
}
 
// Count things.
$total_smileys = 0;
$inactive_smileys = 0;
foreach ($PHORUM["mod_smileys"]["smileys"] as $id => $smiley) {
$total_smileys ++;
if (! $smiley["active"]) $inactive_smileys ++;
}
 
// Display a warning in case there are no smiley images available.
if (! count($available_smileys)) {
phorum_admin_error(
"<strong>Warning:</strong><br/>" .
"No smiley images were found in your current smiley prefix " .
"path. Please place some smileys in the directory " .
htmlspecialchars($PHORUM["mod_smileys"]["prefix"]) .
" or change your prefix path to point to a directory " .
"containing smiley images.");
} elseif ($inactive_smileys) {
phorum_admin_error(
"<strong>Warning:</strong><br/>" .
"You have $inactive_smileys smiley(s) configured for which the " .
"image file was not found (marked as \"UNAVAILBLE\" in the list " .
"below). Delete the smiley(s) from the list or place the missing " .
"images in the directory \"" .
htmlspecialchars($PHORUM["mod_smileys"]["prefix"]) . "\". After " .
"placing new smiley images, click \"Save settings\" to update " .
"the smiley settings.");
}
 
// Create the smiley settings form.
if ($smiley_id == "NEW")
{
$frm = new PhorumInputForm ("", "post", 'Save settings');
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "smileys");
$frm->hidden("action", "edit_settings");
$frm->addbreak("Smiley Settings");
$row = $frm->addrow("Smiley Prefix Path", $frm->text_box("prefix", $PHORUM["mod_smileys"]["prefix"], 50));
$frm->addhelp($row,
"Set the smiley image prefix path",
"This option can be used to set the path to the directory where
you have stored your smileys. This path must be relative to the
directory in which you installed the Phorum software. Absolute
paths cannot be used here.");
$frm->show();
}
 
// No smiley images in the current prefix path? Then do not show the
// rest of the forms. Let the admin fix this issue first.
if (!count($available_smileys)) return;
 
// Create the smiley adding and editing form.
if (isset($_POST["smiley_id"])) {
$search = $_POST["search"];
$smiley = $_POST["smiley"];
$alt = $_POST["alt"];
$uses = $_POST["uses"];
}
if ($smiley_id == "NEW") {
$title = "Add a new smiley";
$submit = "Add smiley";
 
// Fill initial form data for creating smileys.
if (! isset($_POST["smiley_id"])) {
$search = "";
$smiley = "";
$alt = "";
$uses = 2;
}
} else {
$title = "Update a smiley";
$submit = "Update smiley";
 
// Fill initial form data for editing smileys.
if (! isset($_POST["smiley_id"])) {
$smileydata = $PHORUM["mod_smileys"]["smileys"][$smiley_id];
$search = $smileydata["search"];
$smiley = $smileydata["smiley"];
$alt = $smileydata["alt"];
$uses = $smileydata["uses"];
}
}
$frm = new PhorumInputForm ("", "post", $submit);
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "smileys");
$frm->hidden("smiley_id", $smiley_id);
$frm->hidden("action", "edit_smiley");
$frm->addbreak($title);
$frm->addrow("Smiley string to match", $frm->text_box("search", $search, 20));
$row = $frm->addrow("Image to replace the string with", $frm->select_tag("smiley", array_merge(array(''=>'Select smiley ...'),$available_smileys), $smiley, "onChange=\"change_image(this.options[this.selectedIndex].value);\"") . "&nbsp;&nbsp;<div style=\"display:none;margin-top:5px\" id=\"preview_div\"><strong>Preview: </strong><img src=\"images/trans.gif\" id=\"preview_image\" /></div>");
$frm->addhelp($row,
"Smiley replacement image",
"The drop down list shows all images that were found in your
smiley prefix path. If you want to add your own smileys, simply place
them in \"" . htmlspecialchars($PHORUM["mod_smileys"]["prefix"]) . "\"
and reload this page.");
$frm->addrow("ALT tag for the image", $frm->text_box("alt", $alt, 40));
$frm->addrow("Used for", $frm->select_tag("uses", $PHORUM_MOD_SMILEY_USES, $uses));
$frm->show();
 
// Make the preview image visible in case a $smiley is set.
if (!empty($smiley)) {?>
<script type="text/javascript">
change_image('<?php print addslashes($smiley) ?>');
</script><?php
}
 
// Show the configured list of smileys.
if ($smiley_id == "NEW")
{
print "<hr class=\"PhorumAdminHR\" />";
 
if (count($PHORUM["mod_smileys"]["smileys"]))
{ ?>
<table cellspacing="1" class="PhorumAdminTable" width="100%">
<tr>
<td class="PhorumAdminTableHead">String</td>
<td class="PhorumAdminTableHead">Image file</td>
<td class="PhorumAdminTableHead">Image</td>
<td class="PhorumAdminTableHead">ALT tag</td>
<td class="PhorumAdminTableHead">Used for</td>
<td class="PhorumAdminTableHead">&nbsp;</td>
</tr>
<?php
 
foreach ($PHORUM["mod_smileys"]["smileys"] as $id => $item)
{
$used_for_txt = $PHORUM_MOD_SMILEY_USES[$item['uses']];
foreach ($item as $key => $val) {
$item[$key] = htmlspecialchars($val);
}
$action_url = "$_SERVER[PHP_SELF]?module=modsettings&mod=smileys&smiley_id=$id";
 
print "<tr>\n";
print " <td class=\"PhorumAdminTableRow\">{$item["search"]}</td>\n";
print " <td class=\"PhorumAdminTableRow\">{$item["smiley"]}</td>\n";
print " <td class=\"PhorumAdminTableRow\" align=\"center\">";
if ($item["active"]) {
print "<img src=\"{$PHORUM["mod_smileys"]["prefix"]}{$item["smiley"]}\"/></td>\n";
} else {
print "<div style=\"color:red\">UNAVAILBLE</div>";
}
print " <td class=\"PhorumAdminTableRow\">{$item["alt"]}</td>\n";
print " <td class=\"PhorumAdminTableRow\" style=\"white-space:nowrap\">$used_for_txt</td>\n";
print " <td class=\"PhorumAdminTableRow\">" .
"<a href=\"$action_url&edit=1\">Edit</a>&nbsp;&#149;&nbsp;" .
"<a href=\"$action_url&delete=1\">Delete</a></td>\n";
print "</tr>\n";
}
 
print "</table>\n";
 
} else {
 
print "Currently, you have no smiley replacements configured.";
 
}
 
// For a more clear end of page.
print "<br/><br/><br/>";
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/info.txt
New file
0,0 → 1,4
hook: after_header|phorum_mod_smileys_after_header
hook: format|phorum_mod_smileys_format
title: Smiley Replacement Mod
desc: This module allows admins to define smiley replacements in messages.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/smileys.php
New file
0,0 → 1,50
<?php
 
if(!defined("PHORUM")) return;
 
require_once("./mods/smileys/defaults.php");
 
function phorum_mod_smileys_after_header()
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Return immediately if we have no active smiley replacements.
if (!isset($PHORUM["mod_smileys"])||!$PHORUM["mod_smileys"]["do_smileys"]){
return $data;
} ?>
 
<style type="text/css">
.mod_smileys_img {
vertical-align: bottom;
margin: 0px 3px 0px 3px;
}
</style> <?php
}
 
function phorum_mod_smileys_format($data)
{
$PHORUM = $GLOBALS["PHORUM"];
 
// Return immediately if we have no active smiley replacements.
if (!isset($PHORUM["mod_smileys"])||!$PHORUM["mod_smileys"]["do_smileys"]){
return $data;
}
 
// Run smiley replacements.
$replace = $PHORUM["mod_smileys"]["replacements"];
foreach ($data as $key => $message)
{
// Do subject replacements.
if (isset($replace["subject"]) && isset($message["subject"])) {
$data[$key]['subject'] = str_replace ($replace["subject"][0] , $replace["subject"][1], $message['subject'] );
}
// Do body replacements.
if (isset($replace["body"]) && isset($message["body"])) {
$data[$key]['body'] = str_replace ($replace["body"][0] , $replace["body"][1], $message['body'] );
}
}
 
return $data;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/smileys/defaults.php
New file
0,0 → 1,14
<?php
// A simple helper script that will setup initial module
// settings in case one of these settings is missing.
 
if(!defined("PHORUM") && !defined("PHORUM_ADMIN")) return;
 
if (! isset($PHORUM['mod_smileys']) ||
! isset($PHORUM['mod_smileys']['prefix']) ||
! isset($PHORUM['mod_smileys']['smileys'])) {
require_once("./mods/smileys/smileyslib.php");
$PHORUM['mod_smileys'] = phorum_mod_smileys_initsettings();
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/smileys_js.php
New file
0,0 → 1,115
<?php if(!defined("PHORUM")) return; ?>
 
<script type="text/javascript">
 
/* ------------------------------------------------------------------------
* Javascript functions for Smiley tools.
* ------------------------------------------------------------------------
*/
 
var smileys_state = -1;
var smileys_count = 0;
var loaded_count = 0;
var loadingobj;
 
function toggle_smileys()
{
// On the first request to open the smiley help, load all smiley images.
if (smileys_state == -1)
{
// Load smiley images.
<?php
$smileys_count = 0;
$c = '';
foreach ($PHORUM["mod_smileys"]["smileys"] as $id => $smiley) {
if (! $smiley["active"] || $smiley["is_alias"] || $smiley["uses"] == 1) continue;
$smileys_count ++;
$src = htmlspecialchars($prefix . $smiley['smiley']);
$c.="document.getElementById('smiley-button-{$id}').src='$src';\n";
}
print "smileys_count = $smileys_count;\n$c\n";
?>
 
smileys_state = 0;
}
 
// Toggle smiley panel.
smileys_state = ! smileys_state;
if (smileys_state) show_smileys(); else hide_smileys();
}
 
function show_smileys()
{
// We wait with displaying the smiley help until all smileys are loaded.
if (loaded_count < smileys_count) return false;
 
document.getElementById('phorum_mod_editor_tools_smileys').style.display = 'block';
document.getElementById('phorum_mod_editor_tools_smileys_dots').style.display = 'none';
return false;
}
 
function hide_smileys()
{
document.getElementById('phorum_mod_editor_tools_smileys').style.display = 'none';
document.getElementById('phorum_mod_editor_tools_smileys_dots').style.display = 'inline';
return false;
}
 
function phorum_mod_smileys_insert_smiley(string)
{
var area = document.getElementById("phorum_textarea");
string = unescape(string);
if (area)
{
if (area.createTextRange) /* MSIE */
{
area.focus(area.caretPos);
area.caretPos = document.selection.createRange().duplicate();
curtxt = area.caretPos.text;
area.caretPos.text = string + curtxt;
}
else /* Other browsers */
{
var pos = area.selectionStart;
area.value =
area.value.substring(0,pos) +
string +
area.value.substring(pos);
area.focus();
area.selectionStart = pos + string.length;
area.selectionEnd = area.selectionStart;
}
} else {
alert('There seems to be a technical problem. The textarea ' +
'cannot be found in the page. ' +
'The textarea should have id="phorum_textarea" in the ' +
'definition for this feature to be able to find it. ' +
'If you are not the owner of this forum, then please ' +
'alert the forum owner about this.');
}
}
 
function phorum_mod_smileys_load_smiley (imgobj)
{
loadingobj = document.getElementById('phorum_mod_editor_tools_smileys_loading');
 
// Another smiley image was loaded. If we have loaded all
// smiley images, then show the smileys panel.
if (imgobj.src != '') {
loaded_count ++;
imgobj.onload = '';
if (loaded_count == smileys_count) {
loadingobj.style.display = 'none';
show_smileys();
} else {
// Visual feedback for the user while loading the images.
loadingobj.style.display = 'inline';
loadingobj.innerHTML = "("
+ "<?php print $PHORUM["DATA"]["LANG"]["LoadingSmileys"]; ?> "
+ Math.floor(loaded_count/smileys_count*100) + "%)";
}
}
}
 
</script>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/info.txt
New file
0,0 → 1,4
hook: lang|
hook: tpl_editor_before_textarea|phorum_mod_smileys_editor_tools
title: Editor tools
desc: This module implements editor tools to help users with writing their messages. For now, the module has implemented an easy way to add smileys to messages (the smileys mod has to be enabled for this to work). The next thing that will be implemented is a tool for BBcode.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/smileys_panel.php
New file
0,0 → 1,51
<?php
if(!defined("PHORUM")) return;
$PHORUM = $GLOBALS["PHORUM"];
$prefix = $PHORUM["mod_smileys"]["prefix"];
 
include("./mods/editor_tools/smileys_js.php");
 
?>
 
<style type="text/css">
#phorum_mod_editor_tools_panel { display: none; }
#phorum_mod_editor_tools_smileys_dots { display: inline; }
#phorum_mod_editor_tools_smileys_loading { display: none; }
#phorum_mod_editor_tools_smileys { display: none; padding: 0px 5px 5px 5px; }
#phorum_mod_editor_tools_smileys img {
margin: 0px 7px 0px 0px;
vertical-align: bottom;
cursor: pointer;
cursor: hand;
}
</style>
 
<div id="phorum_mod_editor_tools_panel"
class="PhorumStdBlockHeader PhorumNarrowBlock">
 
<a href="javascript:toggle_smileys()">
<b><?php print $PHORUM["DATA"]["LANG"]["AddSmiley"]?></b>
</a>
<div id="phorum_mod_editor_tools_smileys_dots"><b>...</b></div>
<div id="phorum_mod_editor_tools_smileys_loading">
(<?php print $PHORUM["DATA"]["LANG"]["LoadingSmileys"]; ?>)
</div>
 
<div id="phorum_mod_editor_tools_smileys"> <?php
// Create a list of stub smiley images. The real images are only
// loaded when the user opens the smiley panel.
foreach($PHORUM["mod_smileys"]["smileys"] as $id => $smiley) {
if (! $smiley["active"] || $smiley["is_alias"] || $smiley["uses"] == 1) continue;
print "<img id=\"smiley-button-$id\" onclick=\"phorum_mod_smileys_insert_smiley('" . urlencode($smiley["search"]) . "')\" onload=\"phorum_mod_smileys_load_smiley(this)\" src=\"\"/>";
} ?>
</div>
 
</div>
 
<script type="text/javascript">
// Display the smileys panel. This way browsers that do not
// support javascript (but which do support CSS) will not
// show the smileys panel (since the default display style for the
// smileys panel is 'none').
document.getElementById("phorum_mod_editor_tools_panel").style.display = 'block';
</script>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/editor_tools.php
New file
0,0 → 1,16
<?php
 
if(!defined("PHORUM")) return;
 
require_once("./mods/smileys/defaults.php");
 
function phorum_mod_smileys_editor_tools()
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ($PHORUM["mods"]["smileys"]) {
include("./mods/editor_tools/smileys_panel.php");
}
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/lang/dutch_informal.php
New file
0,0 → 1,4
<?php
$PHORUM["DATA"]["LANG"]["AddSmiley"] = "Smiley invoegen";
$PHORUM["DATA"]["LANG"]["LoadingSmileys"] = "smileys inlezen";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/lang/dutch.php
New file
0,0 → 1,4
<?php
$PHORUM["DATA"]["LANG"]["AddSmiley"] = "Smiley invoegen";
$PHORUM["DATA"]["LANG"]["LoadingSmileys"] = "smileys inlezen";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/lang/english.php
New file
0,0 → 1,4
<?php
$PHORUM["DATA"]["LANG"]["AddSmiley"] = "Smileys";
$PHORUM["DATA"]["LANG"]["LoadingSmileys"] = "loading smileys";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/editor_tools/lang/german.php
New file
0,0 → 1,4
<?php
$PHORUM["DATA"]["LANG"]["AddSmiley"] = "Smiley einfügen";
$PHORUM["DATA"]["LANG"]["LoadingSmileys"] = "Smileys einlesen";
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/mods/markdown.php
New file
0,0 → 1,1408
<?php
 
#
# Markdown - A text-to-HTML conversion tool for web writers
#
# Copyright (c) 2004-2005 John Gruber
# <http://daringfireball.net/projects/markdown/>
#
# Copyright (c) 2004-2005 Michel Fortin - PHP Port
# <http://www.michelf.com/projects/php-markdown/>
#
 
 
global $MarkdownPHPVersion, $MarkdownSyntaxVersion,
$md_empty_element_suffix, $md_tab_width,
$md_nested_brackets_depth, $md_nested_brackets,
$md_escape_table, $md_backslash_escape_table,
$md_list_level;
 
$MarkdownPHPVersion = '1.0.1c'; # Fri 9 Dec 2005
$MarkdownSyntaxVersion = '1.0.1'; # Sun 12 Dec 2004
 
 
#
# Global default settings:
#
$md_empty_element_suffix = " />"; # Change to ">" for HTML output
$md_tab_width = 4;
 
#
# WordPress settings:
#
$md_wp_posts = true; # Set to false to remove Markdown from posts.
$md_wp_comments = true; # Set to false to remove Markdown from comments.
 
 
# -- WordPress Plugin Interface -----------------------------------------------
/*
Plugin Name: Markdown
Plugin URI: http://www.michelf.com/projects/php-markdown/
Description: <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://www.michelf.com/projects/php-markdown/">More...</a>
Version: 1.0.1c
Author: Michel Fortin
Author URI: http://www.michelf.com/
*/
if (isset($wp_version)) {
# More details about how it works here:
# <http://www.michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
# Post content and excerpts
if ($md_wp_posts) {
remove_filter('the_content', 'wpautop');
remove_filter('the_excerpt', 'wpautop');
add_filter('the_content', 'Markdown', 6);
add_filter('get_the_excerpt', 'Markdown', 6);
add_filter('get_the_excerpt', 'trim', 7);
add_filter('the_excerpt', 'md_add_p');
add_filter('the_excerpt_rss', 'md_strip_p');
remove_filter('content_save_pre', 'balanceTags', 50);
remove_filter('excerpt_save_pre', 'balanceTags', 50);
add_filter('the_content', 'balanceTags', 50);
add_filter('get_the_excerpt', 'balanceTags', 9);
function md_add_p($text) {
if (strlen($text) == 0) return;
if (strcasecmp(substr($text, -3), '<p>') == 0) return $text;
return '<p>'.$text.'</p>';
}
function md_strip_p($t) { return preg_replace('{</?[pP]>}', '', $t); }
}
# Comments
if ($md_wp_comments) {
remove_filter('comment_text', 'wpautop');
remove_filter('comment_text', 'make_clickable');
add_filter('pre_comment_content', 'Markdown', 6);
add_filter('pre_comment_content', 'md_hide_tags', 8);
add_filter('pre_comment_content', 'md_show_tags', 12);
add_filter('get_comment_text', 'Markdown', 6);
add_filter('get_comment_excerpt', 'Markdown', 6);
add_filter('get_comment_excerpt', 'md_strip_p', 7);
global $md_hidden_tags;
$md_hidden_tags = array(
'<p>' => md5('<p>'), '</p>' => md5('</p>'),
'<pre>' => md5('<pre>'), '</pre>'=> md5('</pre>'),
'<ol>' => md5('<ol>'), '</ol>' => md5('</ol>'),
'<ul>' => md5('<ul>'), '</ul>' => md5('</ul>'),
'<li>' => md5('<li>'), '</li>' => md5('</li>'),
);
function md_hide_tags($text) {
global $md_hidden_tags;
return str_replace(array_keys($md_hidden_tags),
array_values($md_hidden_tags), $text);
}
function md_show_tags($text) {
global $md_hidden_tags;
return str_replace(array_values($md_hidden_tags),
array_keys($md_hidden_tags), $text);
}
}
}
 
 
# -- bBlog Plugin Info --------------------------------------------------------
function identify_modifier_markdown() {
global $MarkdownPHPVersion;
return array(
'name' => 'markdown',
'type' => 'modifier',
'nicename' => 'Markdown',
'description' => 'A text-to-HTML conversion tool for web writers',
'authors' => 'Michel Fortin and John Gruber',
'licence' => 'GPL',
'version' => $MarkdownPHPVersion,
'help' => '<a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://www.michelf.com/projects/php-markdown/">More...</a>'
);
}
 
# -- Smarty Modifier Interface ------------------------------------------------
function smarty_modifier_markdown($text) {
return Markdown($text);
}
 
# -- Textile Compatibility Mode -----------------------------------------------
# Rename this file to "classTextile.php" and it can replace Textile anywhere.
if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
# Try to include PHP SmartyPants. Should be in the same directory.
@include_once 'smartypants.php';
# Fake Textile class. It calls Markdown instead.
class Textile {
function TextileThis($text, $lite='', $encode='', $noimage='', $strict='') {
if ($lite == '' && $encode == '') $text = Markdown($text);
if (function_exists('SmartyPants')) $text = SmartyPants($text);
return $text;
}
}
}
 
 
# -- Phorum Module Info --------------------------------------------------------
/* phorum module info
hook: format|phorum_Markdown
title: Markdown
desc: Markdown syntax allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by John Gruber.<br />http://daringfireball.net/projects/markdown/syntax<br />http://www.michelf.com/projects/php-markdown/
*/
function phorum_Markdown ($data)
{
foreach($data as $key=>$message){
if(!empty($message["body"])){
$message["body"] = str_replace('<br phorum="true" />', '', $message["body"]);
$data[$key]["body"] = Markdown($message["body"]);
}
}
return ($data);
}
 
 
#
# Globals:
#
 
# Regex to match balanced [brackets].
# Needed to insert a maximum bracked depth while converting to PHP.
$md_nested_brackets_depth = 6;
$md_nested_brackets =
str_repeat('(?>[^\[\]]+|\[', $md_nested_brackets_depth).
str_repeat('\])*', $md_nested_brackets_depth);
 
# Table of hash values for escaped characters:
$md_escape_table = array(
"\\" => md5("\\"),
"`" => md5("`"),
"*" => md5("*"),
"_" => md5("_"),
"{" => md5("{"),
"}" => md5("}"),
"[" => md5("["),
"]" => md5("]"),
"(" => md5("("),
")" => md5(")"),
">" => md5(">"),
"#" => md5("#"),
"+" => md5("+"),
"-" => md5("-"),
"." => md5("."),
"!" => md5("!")
);
# Create an identical table but for escaped characters.
$md_backslash_escape_table;
foreach ($md_escape_table as $key => $char)
$md_backslash_escape_table["\\$key"] = $char;
 
 
function Markdown($text) {
#
# Main function. The order in which other subs are called here is
# essential. Link and image substitutions need to happen before
# _EscapeSpecialCharsWithinTagAttributes(), so that any *'s or _'s in the <a>
# and <img> tags get encoded.
#
# Clear the global hashes. If we don't clear these, you get conflicts
# from other articles when generating a page which contains more than
# one article (e.g. an index page that shows the N most recent
# articles):
global $md_urls, $md_titles, $md_html_blocks;
$md_urls = array();
$md_titles = array();
$md_html_blocks = array();
 
# Standardize line endings:
# DOS to Unix and Mac to Unix
$text = str_replace(array("\r\n", "\r"), "\n", $text);
 
# Make sure $text ends with a couple of newlines:
$text .= "\n\n";
 
# Convert all tabs to spaces.
$text = _Detab($text);
 
# Strip any lines consisting only of spaces and tabs.
# This makes subsequent regexen easier to write, because we can
# match consecutive blank lines with /\n+/ instead of something
# contorted like /[ \t]*\n+/ .
$text = preg_replace('/^[ \t]+$/m', '', $text);
 
# Turn block-level HTML blocks into hash entries
$text = _HashHTMLBlocks($text);
 
# Strip link definitions, store in hashes.
$text = _StripLinkDefinitions($text);
 
$text = _RunBlockGamut($text);
 
$text = _UnescapeSpecialChars($text);
 
return $text . "\n";
}
 
 
function _StripLinkDefinitions($text) {
#
# Strips link definitions from text, stores the URLs and titles in
# hash references.
#
global $md_tab_width;
$less_than_tab = $md_tab_width - 1;
 
# Link defs are in the form: ^[id]: url "optional title"
$text = preg_replace_callback('{
^[ ]{0,'.$less_than_tab.'}\[(.+)\]: # id = $1
[ \t]*
\n? # maybe *one* newline
[ \t]*
<?(\S+?)>? # url = $2
[ \t]*
\n? # maybe one newline
[ \t]*
(?:
(?<=\s) # lookbehind for whitespace
["(]
(.+?) # title = $3
[")]
[ \t]*
)? # title is optional
(?:\n+|\Z)
}xm',
'_StripLinkDefinitions_callback',
$text);
return $text;
}
function _StripLinkDefinitions_callback($matches) {
global $md_urls, $md_titles;
$link_id = strtolower($matches[1]);
$md_urls[$link_id] = _EncodeAmpsAndAngles($matches[2]);
if (isset($matches[3]))
$md_titles[$link_id] = str_replace('"', '&quot;', $matches[3]);
return ''; # String that will replace the block
}
 
 
function _HashHTMLBlocks($text) {
global $md_tab_width;
$less_than_tab = $md_tab_width - 1;
 
# Hashify HTML blocks:
# We only want to do this for block-level HTML tags, such as headers,
# lists, and tables. That's because we still want to wrap <p>s around
# "paragraphs" that are wrapped in non-block-level tags, such as anchors,
# phrase emphasis, and spans. The list of tags we're looking for is
# hard-coded:
$block_tags_a = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|'.
'script|noscript|form|fieldset|iframe|math|ins|del';
$block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|'.
'script|noscript|form|fieldset|iframe|math';
 
# First, look for nested blocks, e.g.:
# <div>
# <div>
# tags for inner block must be indented.
# </div>
# </div>
#
# The outermost tags must start at the left margin for this to match, and
# the inner nested divs must be indented.
# We need to do this before the next, more liberal match, because the next
# match will start at the first `<div>` and stop at the first `</div>`.
$text = preg_replace_callback("{
( # save in $1
^ # start of line (with /m)
<($block_tags_a) # start tag = $2
\\b # word break
(.*\\n)*? # any number of lines, minimally matching
</\\2> # the matching end tag
[ \\t]* # trailing spaces/tabs
(?=\\n+|\\Z) # followed by a newline or end of document
)
}xm",
'_HashHTMLBlocks_callback',
$text);
 
#
# Now match more liberally, simply from `\n<tag>` to `</tag>\n`
#
$text = preg_replace_callback("{
( # save in $1
^ # start of line (with /m)
<($block_tags_b) # start tag = $2
\\b # word break
(.*\\n)*? # any number of lines, minimally matching
.*</\\2> # the matching end tag
[ \\t]* # trailing spaces/tabs
(?=\\n+|\\Z) # followed by a newline or end of document
)
}xm",
'_HashHTMLBlocks_callback',
$text);
 
# Special case just for <hr />. It was easier to make a special case than
# to make the other regex more complicated.
$text = preg_replace_callback('{
(?:
(?<=\n\n) # Starting after a blank line
| # or
\A\n? # the beginning of the doc
)
( # save in $1
[ ]{0,'.$less_than_tab.'}
<(hr) # start tag = $2
\b # word break
([^<>])*? #
/?> # the matching end tag
[ \t]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
)
}x',
'_HashHTMLBlocks_callback',
$text);
 
# Special case for standalone HTML comments:
$text = preg_replace_callback('{
(?:
(?<=\n\n) # Starting after a blank line
| # or
\A\n? # the beginning of the doc
)
( # save in $1
[ ]{0,'.$less_than_tab.'}
(?s:
<!
(--.*?--\s*)+
>
)
[ \t]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
)
}x',
'_HashHTMLBlocks_callback',
$text);
 
return $text;
}
function _HashHTMLBlocks_callback($matches) {
global $md_html_blocks;
$text = $matches[1];
$key = md5($text);
$md_html_blocks[$key] = $text;
return "\n\n$key\n\n"; # String that will replace the block
}
 
 
function _RunBlockGamut($text) {
#
# These are all the transformations that form block-level
# tags like paragraphs, headers, and list items.
#
global $md_empty_element_suffix;
 
$text = _DoHeaders($text);
 
# Do Horizontal Rules:
$text = preg_replace(
array('{^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$}mx',
'{^[ ]{0,2}([ ]? -[ ]?){3,}[ \t]*$}mx',
'{^[ ]{0,2}([ ]? _[ ]?){3,}[ \t]*$}mx'),
"\n<hr$md_empty_element_suffix\n",
$text);
 
$text = _DoLists($text);
$text = _DoCodeBlocks($text);
$text = _DoBlockQuotes($text);
 
# We already ran _HashHTMLBlocks() before, in Markdown(), but that
# was to escape raw HTML in the original Markdown source. This time,
# we're escaping the markup we've just created, so that we don't wrap
# <p> tags around block-level tags.
$text = _HashHTMLBlocks($text);
$text = _FormParagraphs($text);
 
return $text;
}
 
 
function _RunSpanGamut($text) {
#
# These are all the transformations that occur *within* block-level
# tags like paragraphs, headers, and list items.
#
global $md_empty_element_suffix;
 
$text = _DoCodeSpans($text);
 
$text = _EscapeSpecialChars($text);
 
# Process anchor and image tags. Images must come first,
# because ![foo][f] looks like an anchor.
$text = _DoImages($text);
$text = _DoAnchors($text);
 
# Make links out of things like `<http://example.com/>`
# Must come after _DoAnchors(), because you can use < and >
# delimiters in inline links like [this](<url>).
$text = _DoAutoLinks($text);
$text = _EncodeAmpsAndAngles($text);
$text = _DoItalicsAndBold($text);
 
# Do hard breaks:
$text = preg_replace('/ {2,}\n/', "<br$md_empty_element_suffix\n", $text);
 
return $text;
}
 
 
function _EscapeSpecialChars($text) {
global $md_escape_table;
$tokens = _TokenizeHTML($text);
 
$text = ''; # rebuild $text from the tokens
# $in_pre = 0; # Keep track of when we're inside <pre> or <code> tags.
# $tags_to_skip = "!<(/?)(?:pre|code|kbd|script|math)[\s>]!";
 
foreach ($tokens as $cur_token) {
if ($cur_token[0] == 'tag') {
# Within tags, encode * and _ so they don't conflict
# with their use in Markdown for italics and strong.
# We're replacing each such character with its
# corresponding MD5 checksum value; this is likely
# overkill, but it should prevent us from colliding
# with the escape values by accident.
$cur_token[1] = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$cur_token[1]);
$text .= $cur_token[1];
} else {
$t = $cur_token[1];
$t = _EncodeBackslashEscapes($t);
$text .= $t;
}
}
return $text;
}
 
 
function _DoAnchors($text) {
#
# Turn Markdown link shortcuts into XHTML <a> tags.
#
global $md_nested_brackets;
#
# First, handle reference-style links: [link text] [id]
#
$text = preg_replace_callback("{
( # wrap whole match in $1
\\[
($md_nested_brackets) # link text = $2
\\]
 
[ ]? # one optional space
(?:\\n[ ]*)? # one optional newline followed by spaces
 
\\[
(.*?) # id = $3
\\]
)
}xs",
'_DoAnchors_reference_callback', $text);
 
#
# Next, inline-style links: [link text](url "optional title")
#
$text = preg_replace_callback("{
( # wrap whole match in $1
\\[
($md_nested_brackets) # link text = $2
\\]
\\( # literal paren
[ \\t]*
<?(.*?)>? # href = $3
[ \\t]*
( # $4
(['\"]) # quote char = $5
(.*?) # Title = $6
\\5 # matching quote
)? # title is optional
\\)
)
}xs",
'_DoAnchors_inline_callback', $text);
 
return $text;
}
function _DoAnchors_reference_callback($matches) {
global $md_urls, $md_titles, $md_escape_table;
$whole_match = $matches[1];
$link_text = $matches[2];
$link_id = strtolower($matches[3]);
 
if ($link_id == "") {
$link_id = strtolower($link_text); # for shortcut links like [this][].
}
 
if (isset($md_urls[$link_id])) {
$url = $md_urls[$link_id];
# We've got to encode these to avoid conflicting with italics/bold.
$url = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$url);
$result = "<a href=\"$url\"";
if ( isset( $md_titles[$link_id] ) ) {
$title = $md_titles[$link_id];
$title = str_replace(array('*', '_'),
array($md_escape_table['*'],
$md_escape_table['_']), $title);
$result .= " title=\"$title\"";
}
$result .= ">$link_text</a>";
}
else {
$result = $whole_match;
}
return $result;
}
function _DoAnchors_inline_callback($matches) {
global $md_escape_table;
$whole_match = $matches[1];
$link_text = $matches[2];
$url = $matches[3];
$title =& $matches[6];
 
# We've got to encode these to avoid conflicting with italics/bold.
$url = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$url);
$result = "<a href=\"$url\"";
if (isset($title)) {
$title = str_replace('"', '&quot;', $title);
$title = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$title);
$result .= " title=\"$title\"";
}
$result .= ">$link_text</a>";
 
return $result;
}
 
 
function _DoImages($text) {
#
# Turn Markdown image shortcuts into <img> tags.
#
global $md_nested_brackets;
 
#
# First, handle reference-style labeled images: ![alt text][id]
#
$text = preg_replace_callback('{
( # wrap whole match in $1
!\[
('.$md_nested_brackets.') # alt text = $2
\]
 
[ ]? # one optional space
(?:\n[ ]*)? # one optional newline followed by spaces
 
\[
(.*?) # id = $3
\]
 
)
}xs',
'_DoImages_reference_callback', $text);
 
#
# Next, handle inline images: ![alt text](url "optional title")
# Don't forget: encode * and _
 
$text = preg_replace_callback('{
( # wrap whole match in $1
!\[
('.$md_nested_brackets.') # alt text = $2
\]
\( # literal paren
[ \t]*
<?(\S+?)>? # src url = $3
[ \t]*
( # $4
([\'"]) # quote char = $5
(.*?) # title = $6
\5 # matching quote
[ \t]*
)? # title is optional
\)
)
}xs',
'_DoImages_inline_callback', $text);
 
return $text;
}
function _DoImages_reference_callback($matches) {
global $md_urls, $md_titles, $md_empty_element_suffix, $md_escape_table;
$whole_match = $matches[1];
$alt_text = $matches[2];
$link_id = strtolower($matches[3]);
 
if ($link_id == "") {
$link_id = strtolower($alt_text); # for shortcut links like ![this][].
}
 
$alt_text = str_replace('"', '&quot;', $alt_text);
if (isset($md_urls[$link_id])) {
$url = $md_urls[$link_id];
# We've got to encode these to avoid conflicting with italics/bold.
$url = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$url);
$result = "<img src=\"$url\" alt=\"$alt_text\"";
if (isset($md_titles[$link_id])) {
$title = $md_titles[$link_id];
$title = str_replace(array('*', '_'),
array($md_escape_table['*'],
$md_escape_table['_']), $title);
$result .= " title=\"$title\"";
}
$result .= $md_empty_element_suffix;
}
else {
# If there's no such link ID, leave intact:
$result = $whole_match;
}
 
return $result;
}
function _DoImages_inline_callback($matches) {
global $md_empty_element_suffix, $md_escape_table;
$whole_match = $matches[1];
$alt_text = $matches[2];
$url = $matches[3];
$title = '';
if (isset($matches[6])) {
$title = $matches[6];
}
 
$alt_text = str_replace('"', '&quot;', $alt_text);
$title = str_replace('"', '&quot;', $title);
# We've got to encode these to avoid conflicting with italics/bold.
$url = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$url);
$result = "<img src=\"$url\" alt=\"$alt_text\"";
if (isset($title)) {
$title = str_replace(array('*', '_'),
array($md_escape_table['*'], $md_escape_table['_']),
$title);
$result .= " title=\"$title\""; # $title already quoted
}
$result .= $md_empty_element_suffix;
 
return $result;
}
 
 
function _DoHeaders($text) {
# Setext-style headers:
# Header 1
# ========
#
# Header 2
# --------
#
$text = preg_replace(
array('{ ^(.+)[ \t]*\n=+[ \t]*\n+ }emx',
'{ ^(.+)[ \t]*\n-+[ \t]*\n+ }emx'),
array("'<h1>'._RunSpanGamut(_UnslashQuotes('\\1')).'</h1>\n\n'",
"'<h2>'._RunSpanGamut(_UnslashQuotes('\\1')).'</h2>\n\n'"),
$text);
 
# atx-style headers:
# # Header 1
# ## Header 2
# ## Header 2 with closing hashes ##
# ...
# ###### Header 6
#
$text = preg_replace("{
^(\\#{1,6}) # $1 = string of #'s
[ \\t]*
(.+?) # $2 = Header text
[ \\t]*
\\#* # optional closing #'s (not counted)
\\n+
}xme",
"'<h'.strlen('\\1').'>'._RunSpanGamut(_UnslashQuotes('\\2')).'</h'.strlen('\\1').'>\n\n'",
$text);
 
return $text;
}
 
 
function _DoLists($text) {
#
# Form HTML ordered (numbered) and unordered (bulleted) lists.
#
global $md_tab_width, $md_list_level;
$less_than_tab = $md_tab_width - 1;
 
# Re-usable patterns to match list item bullets and number markers:
$marker_ul = '[*+-]';
$marker_ol = '\d+[.]';
$marker_any = "(?:$marker_ul|$marker_ol)";
 
$markers = array($marker_ul, $marker_ol);
 
foreach ($markers as $marker) {
# Re-usable pattern to match any entirel ul or ol list:
$whole_list = '
( # $1 = whole list
( # $2
[ ]{0,'.$less_than_tab.'}
('.$marker.') # $3 = first list item marker
[ \t]+
)
(?s:.+?)
( # $4
\z
|
\n{2,}
(?=\S)
(?! # Negative lookahead for another list item marker
[ \t]*
'.$marker.'[ \t]+
)
)
)
'; // mx
# We use a different prefix before nested lists than top-level lists.
# See extended comment in _ProcessListItems().
if ($md_list_level) {
$text = preg_replace_callback('{
^
'.$whole_list.'
}mx',
'_DoLists_callback_top', $text);
}
else {
$text = preg_replace_callback('{
(?:(?<=\n\n)|\A\n?)
'.$whole_list.'
}mx',
'_DoLists_callback_nested', $text);
}
}
 
return $text;
}
function _DoLists_callback_top($matches) {
# Re-usable patterns to match list item bullets and number markers:
$marker_ul = '[*+-]';
$marker_ol = '\d+[.]';
$marker_any = "(?:$marker_ul|$marker_ol)";
$list = $matches[1];
$list_type = preg_match("/$marker_ul/", $matches[3]) ? "ul" : "ol";
$marker_any = ( $list_type == "ul" ? $marker_ul : $marker_ol );
# Turn double returns into triple returns, so that we can make a
# paragraph for the last item in a list, if necessary:
$list = preg_replace("/\n{2,}/", "\n\n\n", $list);
$result = _ProcessListItems($list, $marker_any);
# Trim any trailing whitespace, to put the closing `</$list_type>`
# up on the preceding line, to get it past the current stupid
# HTML block parser. This is a hack to work around the terrible
# hack that is the HTML block parser.
$result = rtrim($result);
$result = "<$list_type>" . $result . "</$list_type>\n";
return $result;
}
function _DoLists_callback_nested($matches) {
# Re-usable patterns to match list item bullets and number markers:
$marker_ul = '[*+-]';
$marker_ol = '\d+[.]';
$marker_any = "(?:$marker_ul|$marker_ol)";
$list = $matches[1];
$list_type = preg_match("/$marker_ul/", $matches[3]) ? "ul" : "ol";
$marker_any = ( $list_type == "ul" ? $marker_ul : $marker_ol );
# Turn double returns into triple returns, so that we can make a
# paragraph for the last item in a list, if necessary:
$list = preg_replace("/\n{2,}/", "\n\n\n", $list);
$result = _ProcessListItems($list, $marker_any);
$result = "<$list_type>\n" . $result . "</$list_type>\n";
return $result;
}
 
 
function _ProcessListItems($list_str, $marker_any) {
#
# Process the contents of a single ordered or unordered list, splitting it
# into individual list items.
#
global $md_list_level;
# The $md_list_level global keeps track of when we're inside a list.
# Each time we enter a list, we increment it; when we leave a list,
# we decrement. If it's zero, we're not in a list anymore.
#
# We do this because when we're not inside a list, we want to treat
# something like this:
#
# I recommend upgrading to version
# 8. Oops, now this line is treated
# as a sub-list.
#
# As a single paragraph, despite the fact that the second line starts
# with a digit-period-space sequence.
#
# Whereas when we're inside a list (or sub-list), that line will be
# treated as the start of a sub-list. What a kludge, huh? This is
# an aspect of Markdown's syntax that's hard to parse perfectly
# without resorting to mind-reading. Perhaps the solution is to
# change the syntax rules such that sub-lists must start with a
# starting cardinal number; e.g. "1." or "a.".
$md_list_level++;
 
# trim trailing blank lines:
$list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
 
$list_str = preg_replace_callback('{
(\n)? # leading line = $1
(^[ \t]*) # leading whitespace = $2
('.$marker_any.') [ \t]+ # list marker = $3
((?s:.+?) # list item text = $4
(\n{1,2}))
(?= \n* (\z | \2 ('.$marker_any.') [ \t]+))
}xm',
'_ProcessListItems_callback', $list_str);
 
$md_list_level--;
return $list_str;
}
function _ProcessListItems_callback($matches) {
$item = $matches[4];
$leading_line =& $matches[1];
$leading_space =& $matches[2];
 
if ($leading_line || preg_match('/\n{2,}/', $item)) {
$item = _RunBlockGamut(_Outdent($item));
}
else {
# Recursion for sub-lists:
$item = _DoLists(_Outdent($item));
$item = preg_replace('/\n+$/', '', $item);
$item = _RunSpanGamut($item);
}
 
return "<li>" . $item . "</li>\n";
}
 
 
function _DoCodeBlocks($text) {
#
# Process Markdown `<pre><code>` blocks.
#
global $md_tab_width;
$text = preg_replace_callback('{
(?:\n\n|\A)
( # $1 = the code block -- one or more lines, starting with a space/tab
(?:
(?:[ ]{'.$md_tab_width.'} | \t) # Lines must start with a tab or a tab-width of spaces
.*\n+
)+
)
((?=^[ ]{0,'.$md_tab_width.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
}xm',
'_DoCodeBlocks_callback', $text);
 
return $text;
}
function _DoCodeBlocks_callback($matches) {
$codeblock = $matches[1];
 
$codeblock = _EncodeCode(_Outdent($codeblock));
// $codeblock = _Detab($codeblock);
# trim leading newlines and trailing whitespace
$codeblock = preg_replace(array('/\A\n+/', '/\s+\z/'), '', $codeblock);
 
$result = "\n\n<pre><code>" . $codeblock . "\n</code></pre>\n\n";
 
return $result;
}
 
 
function _DoCodeSpans($text) {
#
# * Backtick quotes are used for <code></code> spans.
#
# * You can use multiple backticks as the delimiters if you want to
# include literal backticks in the code span. So, this input:
#
# Just type ``foo `bar` baz`` at the prompt.
#
# Will translate to:
#
# <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
#
# There's no arbitrary limit to the number of backticks you
# can use as delimters. If you need three consecutive backticks
# in your code, use four for delimiters, etc.
#
# * You can use spaces to get literal backticks at the edges:
#
# ... type `` `bar` `` ...
#
# Turns to:
#
# ... type <code>`bar`</code> ...
#
$text = preg_replace_callback('@
(?<!\\\) # Character before opening ` can\'t be a backslash
(`+) # $1 = Opening run of `
(.+?) # $2 = The code block
(?<!`)
\1 # Matching closer
(?!`)
@xs',
'_DoCodeSpans_callback', $text);
 
return $text;
}
function _DoCodeSpans_callback($matches) {
$c = $matches[2];
$c = preg_replace('/^[ \t]*/', '', $c); # leading whitespace
$c = preg_replace('/[ \t]*$/', '', $c); # trailing whitespace
$c = _EncodeCode($c);
return "<code>$c</code>";
}
 
 
function _EncodeCode($_) {
#
# Encode/escape certain characters inside Markdown code runs.
# The point is that in code, these characters are literals,
# and lose their special Markdown meanings.
#
global $md_escape_table;
 
# Encode all ampersands; HTML entities are not
# entities within a Markdown code span.
$_ = str_replace('&', '&amp;', $_);
 
# Do the angle bracket song and dance:
$_ = str_replace(array('<', '>'),
array('&lt;', '&gt;'), $_);
 
# Now, escape characters that are magic in Markdown:
$_ = str_replace(array_keys($md_escape_table),
array_values($md_escape_table), $_);
 
return $_;
}
 
 
function _DoItalicsAndBold($text) {
# <strong> must go first:
$text = preg_replace('{
( # $1: Marker
(?<!\*\*) \*\* | # (not preceded by two chars of
(?<!__) __ # the same marker)
)
(?=\S) # Not followed by whitespace
(?!\1) # or two others marker chars.
( # $2: Content
(?:
[^*_]+? # Anthing not em markers.
|
# Balence any regular emphasis inside.
([*_]) (?=\S) .+? (?<=\S) \3 # $3: em char (* or _)
|
(?! \1 ) . # Allow unbalenced * and _.
)+?
)
(?<=\S) \1 # End mark not preceded by whitespace.
}sx',
'<strong>\2</strong>', $text);
# Then <em>:
$text = preg_replace(
'{ ( (?<!\*)\* | (?<!_)_ ) (?=\S) (?! \1) (.+?) (?<=\S) \1 }sx',
'<em>\2</em>', $text);
 
return $text;
}
 
 
function _DoBlockQuotes($text) {
$text = preg_replace_callback('/
( # Wrap whole match in $1
(
^[ \t]*>[ \t]? # ">" at the start of a line
.+\n # rest of the first line
(.+\n)* # subsequent consecutive lines
\n* # blanks
)+
)
/xm',
'_DoBlockQuotes_callback', $text);
 
return $text;
}
function _DoBlockQuotes_callback($matches) {
$bq = $matches[1];
# trim one level of quoting - trim whitespace-only lines
$bq = preg_replace(array('/^[ \t]*>[ \t]?/m', '/^[ \t]+$/m'), '', $bq);
$bq = _RunBlockGamut($bq); # recurse
 
$bq = preg_replace('/^/m', " ", $bq);
# These leading spaces screw with <pre> content, so we need to fix that:
$bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
'_DoBlockQuotes_callback2', $bq);
 
return "<blockquote>\n$bq\n</blockquote>\n\n";
}
function _DoBlockQuotes_callback2($matches) {
$pre = $matches[1];
$pre = preg_replace('/^ /m', '', $pre);
return $pre;
}
 
 
function _FormParagraphs($text) {
#
# Params:
# $text - string to process with html <p> tags
#
global $md_html_blocks;
 
# Strip leading and trailing lines:
$text = preg_replace(array('/\A\n+/', '/\n+\z/'), '', $text);
 
$grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
 
#
# Wrap <p> tags.
#
foreach ($grafs as $key => $value) {
if (!isset( $md_html_blocks[$value] )) {
$value = _RunSpanGamut($value);
$value = preg_replace('/^([ \t]*)/', '<p>', $value);
$value .= "</p>";
$grafs[$key] = $value;
}
}
 
#
# Unhashify HTML blocks
#
foreach ($grafs as $key => $value) {
if (isset( $md_html_blocks[$value] )) {
$grafs[$key] = $md_html_blocks[$value];
}
}
 
return implode("\n\n", $grafs);
}
 
 
function _EncodeAmpsAndAngles($text) {
# Smart processing for ampersands and angle brackets that need to be encoded.
 
# Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
# http://bumppo.net/projects/amputator/
$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
'&amp;', $text);;
 
# Encode naked <'s
$text = preg_replace('{<(?![a-z/?\$!])}i', '&lt;', $text);
 
return $text;
}
 
 
function _EncodeBackslashEscapes($text) {
#
# Parameter: String.
# Returns: The string, with after processing the following backslash
# escape sequences.
#
global $md_escape_table, $md_backslash_escape_table;
# Must process escaped backslashes first.
return str_replace(array_keys($md_backslash_escape_table),
array_values($md_backslash_escape_table), $text);
}
 
 
function _DoAutoLinks($text) {
$text = preg_replace("!<((https?|ftp):[^'\">\\s]+)>!",
'<a href="\1">\1</a>', $text);
 
# Email addresses: <address@domain.foo>
$text = preg_replace('{
<
(?:mailto:)?
(
[-.\w]+
\@
[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+
)
>
}exi',
"_EncodeEmailAddress(_UnescapeSpecialChars(_UnslashQuotes('\\1')))",
$text);
 
return $text;
}
 
 
function _EncodeEmailAddress($addr) {
#
# Input: an email address, e.g. "foo@example.com"
#
# Output: the email address as a mailto link, with each character
# of the address encoded as either a decimal or hex entity, in
# the hopes of foiling most address harvesting spam bots. E.g.:
#
# <a href="&#x6D;&#97;&#105;&#108;&#x74;&#111;:&#102;&#111;&#111;&#64;&#101;
# x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;">&#102;&#111;&#111;
# &#64;&#101;x&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;&#111;&#109;</a>
#
# Based by a filter by Matthew Wickline, posted to the BBEdit-Talk
# mailing list: <http://tinyurl.com/yu7ue>
#
$addr = "mailto:" . $addr;
$length = strlen($addr);
 
# leave ':' alone (to spot mailto: later)
$addr = preg_replace_callback('/([^\:])/',
'_EncodeEmailAddress_callback', $addr);
 
$addr = "<a href=\"$addr\">$addr</a>";
# strip the mailto: from the visible part
$addr = preg_replace('/">.+?:/', '">', $addr);
 
return $addr;
}
function _EncodeEmailAddress_callback($matches) {
$char = $matches[1];
$r = rand(0, 100);
# roughly 10% raw, 45% hex, 45% dec
# '@' *must* be encoded. I insist.
if ($r > 90 && $char != '@') return $char;
if ($r < 45) return '&#x'.dechex(ord($char)).';';
return '&#'.ord($char).';';
}
 
 
function _UnescapeSpecialChars($text) {
#
# Swap back in all the special characters we've hidden.
#
global $md_escape_table;
return str_replace(array_values($md_escape_table),
array_keys($md_escape_table), $text);
}
 
 
# _TokenizeHTML is shared between PHP Markdown and PHP SmartyPants.
# We only define it if it is not already defined.
if (!function_exists('_TokenizeHTML')) :
function _TokenizeHTML($str) {
#
# Parameter: String containing HTML markup.
# Returns: An array of the tokens comprising the input
# string. Each token is either a tag (possibly with nested,
# tags contained therein, such as <a href="<MTFoo>">, or a
# run of text between tags. Each element of the array is a
# two-element array; the first is either 'tag' or 'text';
# the second is the actual value.
#
#
# Regular expression derived from the _tokenize() subroutine in
# Brad Choate's MTRegex plugin.
# <http://www.bradchoate.com/past/mtregex.php>
#
$index = 0;
$tokens = array();
 
$match = '(?s:<!(?:--.*?--\s*)+>)|'. # comment
'(?s:<\?.*?\?>)|'. # processing instruction
# regular tags
'(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)';
 
$parts = preg_split("{($match)}", $str, -1, PREG_SPLIT_DELIM_CAPTURE);
 
foreach ($parts as $part) {
if (++$index % 2 && $part != '')
$tokens[] = array('text', $part);
else
$tokens[] = array('tag', $part);
}
 
return $tokens;
}
endif;
 
 
function _Outdent($text) {
#
# Remove one level of line-leading tabs or spaces
#
global $md_tab_width;
return preg_replace("/^(\\t|[ ]{1,$md_tab_width})/m", "", $text);
}
 
 
function _Detab($text) {
#
# Replace tabs with the appropriate amount of space.
#
global $md_tab_width;
 
# For each line we separate the line in blocks delemited by
# tab characters. Then we reconstruct every line by adding the
# appropriate number of space between each blocks.
$lines = explode("\n", $text);
$text = "";
foreach ($lines as $line) {
# Split in blocks.
$blocks = explode("\t", $line);
# Add each blocks to the line.
$line = $blocks[0];
unset($blocks[0]); # Do not add first block twice.
foreach ($blocks as $block) {
# Calculate amount of space, insert spaces, insert block.
$amount = $md_tab_width - strlen($line) % $md_tab_width;
$line .= str_repeat(" ", $amount) . $block;
}
$text .= "$line\n";
}
return $text;
}
 
 
function _UnslashQuotes($text) {
#
# This function is useful to remove automaticaly slashed double quotes
# when using preg_replace and evaluating an expression.
# Parameter: String.
# Returns: The string with any slash-double-quote (\") sequence replaced
# by a single double quote.
#
return str_replace('\"', '"', $text);
}
 
 
/*
 
PHP Markdown
============
 
Description
-----------
 
This is a PHP translation of the original Markdown formatter written in
Perl by John Gruber.
 
Markdown is a text-to-HTML filter; it translates an easy-to-read /
easy-to-write structured text format into HTML. Markdown's text format
is most similar to that of plain text email, and supports features such
as headers, *emphasis*, code blocks, blockquotes, and links.
 
Markdown's syntax is designed not as a generic markup language, but
specifically to serve as a front-end to (X)HTML. You can use span-level
HTML tags anywhere in a Markdown document, and you can use block level
HTML tags (like <div> and <table> as well).
 
For more information about Markdown's syntax, see:
 
<http://daringfireball.net/projects/markdown/>
 
 
Bugs
----
 
To file bug reports please send email to:
 
<michel.fortin@michelf.com>
 
Please include with your report: (1) the example input; (2) the output you
expected; (3) the output Markdown actually produced.
 
 
Version History
---------------
 
See the readme file for detailed release notes for this version.
 
1.0.1c - 9 Dec 2005
 
1.0.1b - 6 Jun 2005
 
1.0.1a - 15 Apr 2005
 
1.0.1 - 16 Dec 2004
 
1.0 - 21 Aug 2004
 
 
Author & Contributors
---------------------
 
Original Perl version by John Gruber
<http://daringfireball.net/>
 
PHP port and other contributions by Michel Fortin
<http://www.michelf.com/>
 
 
Copyright and License
---------------------
 
Copyright (c) 2004-2005 Michel Fortin
<http://www.michelf.com/>
All rights reserved.
 
Copyright (c) 2003-2004 John Gruber
<http://daringfireball.net/>
All rights reserved.
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
 
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
 
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
 
* Neither the name "Markdown" nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
 
This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the copyright owner
or contributors be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
 
*/
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/cache/.htaccess
New file
0,0 → 1,0
Deny from all
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/close.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/close.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/alert.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/alert.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/trans.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/trans.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/button.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/button.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/qmark.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/images/qmark.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/file.php
New file
0,0 → 1,122
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','file');
 
ob_start();
 
ini_set ( "zlib.output_compression", "0");
ini_set ( "output_handler", "");
 
include_once("./common.php");
 
// set all our URL's
phorum_build_common_urls();
 
// checking read-permissions
if(!phorum_check_read_common()) {
return;
}
 
if(empty($PHORUM["args"]["file"])){
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}
 
$filearg=(int)$PHORUM["args"]["file"];
$file=phorum_db_file_get($filearg);
 
 
if(empty($file)){
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}
 
$send_file=true;
 
// check if this phorum allows off site links and if not, check the referrer
if(isset($_SERVER["HTTP_REFERER"]) && !$PHORUM["file_offsite"] && preg_match('!^https?://!', $_SERVER["HTTP_REFERER"])){
 
$base = strtolower(phorum_get_url(PHORUM_BASE_URL));
$len = strlen($base);
if (strtolower(substr($_SERVER["HTTP_REFERER"], 0, $len)) != $base) {
 
ob_end_flush();
 
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["FileForbidden"];
include phorum_get_template("header");
include phorum_get_template("message");
include phorum_get_template("footer");
 
$send_file=false;
}
}
 
if($send_file){
 
// Mime Types for Attachments
$mime_types["default"]="text/plain";
$mime_types["pdf"]="application/pdf";
$mime_types["doc"]="application/msword";
$mime_types["xls"]="application/vnd.ms-excel";
$mime_types["gif"]="image/gif";
$mime_types["png"]="image/png";
$mime_types["jpg"]="image/jpeg";
$mime_types["jpeg"]="image/jpeg";
$mime_types["jpe"]="image/jpeg";
$mime_types["tiff"]="image/tiff";
$mime_types["tif"]="image/tiff";
$mime_types["xml"]="text/xml";
$mime_types["mpeg"]="video/mpeg";
$mime_types["mpg"]="video/mpeg";
$mime_types["mpe"]="video/mpeg";
$mime_types["qt"]="video/quicktime";
$mime_types["mov"]="video/quicktime";
$mime_types["avi"]="video/x-msvideo";
$mime_types["gz"]="application/x-gzip";
$mime_types["tgz"]="application/x-gzip";
$mime_types["zip"]="application/zip";
$mime_types["tar"]="application/x-tar";
$mime_types["exe"]="application/octet-stream";
$mime_types["rar"]="application/octet-stream";
$mime_types["wma"]="application/octet-stream";
$mime_types["wmv"]="application/octet-stream";
$mime_types["mp3"]="audio/mpeg";
 
$type=strtolower(substr($file["filename"], strrpos($file["filename"], ".")+1));
 
if(isset($mime_types[$type])){
$mime=$mime_types[$type];
}
else{
$mime=$mime_types["default"];
}
 
list($mime, $file) = phorum_hook("file", array($mime, $file));
 
ob_end_clean();
 
header("Content-Type: $mime");
header("Content-Disposition: filename=\"{$file['filename']}\"");
 
echo base64_decode($file["file_data"]);
 
exit();
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/control.php
New file
0,0 → 1,248
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','control');
 
include_once("./common.php");
 
phorum_require_login();
 
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
 
define("PHORUM_CONTROL_CENTER", 1);
 
// A user has to be logged in to use his control-center.
if (!$PHORUM["DATA"]["LOGGEDIN"]) {
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
exit();
}
 
// If the user is not fully logged in, send him to the login page.
if(!$PHORUM["DATA"]["FULLY_LOGGEDIN"]){
phorum_redirect_by_url(phorum_get_url(PHORUM_LOGIN_URL, "redir=".PHORUM_CONTROLCENTER_URL));
exit();
}
 
$error_msg = false;
 
// Generating the panel id of the page to use.
$panel = (!isset($PHORUM['args']['panel']) || empty($PHORUM["args"]['panel']))
? PHORUM_CC_SUMMARY : $PHORUM["args"]['panel'];
 
// Sometimes we set the panel id from a post-form.
if (isset($_POST['panel'])) {
$panel = $_POST['panel'];
}
 
// Set all our URLs.
phorum_build_common_urls();
 
// Generate the control panel URLs.
$PHORUM['DATA']['URL']['CC0'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUMMARY);
$PHORUM['DATA']['URL']['CC1'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUBSCRIPTION_THREADS);
$PHORUM['DATA']['URL']['CC2'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUBSCRIPTION_FORUMS);
$PHORUM['DATA']['URL']['CC3'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_USERINFO);
$PHORUM['DATA']['URL']['CC4'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SIGNATURE);
$PHORUM['DATA']['URL']['CC5'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_MAIL);
$PHORUM['DATA']['URL']['CC6'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_BOARD);
$PHORUM['DATA']['URL']['CC7'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_PASSWORD);
$PHORUM['DATA']['URL']['CC8'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_UNAPPROVED);
$PHORUM['DATA']['URL']['CC9'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_FILES);
$PHORUM['DATA']['URL']['CC10'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_USERS);
$PHORUM['DATA']['URL']['CC14'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_PRIVACY);
$PHORUM['DATA']['URL']['CC15'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION);
$PHORUM['DATA']['URL']['CC16'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MEMBERSHIP);
 
// Determine if the user files functionality is available.
$PHORUM["DATA"]["MYFILES"] = ($PHORUM["file_uploads"] || $PHORUM["user"]["admin"]);
 
// Determine if the user is a moderator.
$PHORUM["DATA"]["MESSAGE_MODERATOR"] = (count(phorum_user_access_list(PHORUM_USER_ALLOW_MODERATE_MESSAGES)) > 0);
$PHORUM["DATA"]["USER_MODERATOR"] = phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_USERS);
$PHORUM["DATA"]["GROUP_MODERATOR"] = phorum_user_allow_moderate_group();
$PHORUM["DATA"]["MODERATOR"] = ($PHORUM["DATA"]["USER_MODERATOR"] + $PHORUM["DATA"]["MESSAGE_MODERATOR"] + $PHORUM["DATA"]["GROUP_MODERATOR"]) > 0;
 
// The form action for the common form.
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL);
 
$user = $PHORUM['user'];
 
// Security messures.
unset($user["password"]);
unset($user["password_temp"]);
unset($user["permissions"]);
 
// Format the user signature using standard message body formatting
// or HTML escape it
$user["signature"] = htmlspecialchars($user["signature"]);
 
// Fake a message here so we can run the sig through format_message.
$fake_messages = array(array("author"=>"", "email"=>"", "subject"=>"", "body"=>$user["signature"]));
$fake_messages = phorum_format_messages( $fake_messages );
$user["signature_formatted"] = $fake_messages[0]["body"];
 
// Initialize any custom profile fields that are not present.
if (!empty($PHORUM["PROFILE_FIELDS"])) {
foreach($PHORUM["PROFILE_FIELDS"] as $field) {
if (!isset($user[$field['name']])) $user[$field['name']] = "";
}
}
 
// Setup template data.
$PHORUM["DATA"]["PROFILE"] = $user;
$PHORUM["DATA"]["PROFILE"]["forum_id"] = isset($PHORUM["forum_id"]) ? $PHORUM['forum_id'] : 0;
$PHORUM["DATA"]["PROFILE"]["PANEL"] = $panel;
 
// Set the back-URL and -message.
if ($PHORUM['forum_id'] > 0 && $PHORUM['folder_flag'] == 0) {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_LIST_URL);
$PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BacktoForum'];
} else {
if(isset($PHORUM['forum_id'])) {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL,$PHORUM['forum_id']);
} else {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL);
}
$PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BackToForumList'];
}
 
// Load the include file for the current panel.
$panel = basename($panel);
if (file_exists("./include/controlcenter/$panel.php")) {
include "./include/controlcenter/$panel.php";
} else {
include "./include/controlcenter/summary.php";
}
 
// The include file can set the template we have to use for
// displaying the main part of the control panel screen
// in the $template variable.
if (isset($template)) {
$PHORUM['DATA']['content_template'] = $template;
}
 
// The include file can also set an error message to show
// in the $error variable and a success message in $okmsg.
if (isset($error) && !empty($error)) $PHORUM['DATA']['ERROR'] = $error;
if (isset($okmsg) && !empty($okmsg)) $PHORUM['DATA']['OKMSG'] = $okmsg;
 
// Display the control panel page.
include phorum_get_template("header");
phorum_hook("after_header");
if ($error_msg) { // Possibly set from the panel include file.
include phorum_get_template("message");
} else {
include phorum_get_template("cc_index");
}
phorum_hook("before_footer");
include phorum_get_template("footer");
 
// ============================================================================
 
/**
* A common function which is used to save the userdata from the post-data.
* @param panel - The panel for which to save data.
* @return array - An array containing $error and $okmsg.
*/
function phorum_controlcenter_user_save($panel)
{
$PHORUM = $GLOBALS['PHORUM'];
$error = "";
$okmsg = "";
 
// Setup the default userdata fields that may be changed
// from the control panel interface.
$userdata = array(
'signature' => NULL,
'hide_email' => NULL,
'hide_activity' => NULL,
'password' => NULL,
'tz_offset' => NULL,
'is_dst' => NULL,
'user_language' => NULL,
'threaded_list' => NULL,
'threaded_read' => NULL,
'email_notify' => NULL,
'show_signature' => NULL,
'pm_email_notify' => NULL,
'email' => NULL,
'email_temp' => NULL,
'user_template' => NULL,
'moderation_email'=> NULL,
);
// Add custom profile fields as acceptable fields.
foreach ($PHORUM["PROFILE_FIELDS"] as $field) {
$userdata[$field["name"]] = NULL;
}
// Update userdata with $_POST information.
foreach ($_POST as $key => $val) {
if (array_key_exists($key, $userdata)) {
$userdata[$key] = $val;
}
}
// Remove unused profile fields.
foreach ($userdata as $key => $val) {
if (is_null($val)) {
unset($userdata[$key]);
}
}
 
// Set static userdata.
$userdata["user_id"] = $PHORUM["user"]["user_id"];
 
// Run a hook, so module writers can update and check the userdata.
$userdata = phorum_hook("cc_save_user", $userdata);
 
// Set $error, in case the before_register hook did set an error.
if (isset($userdata['error'])) {
$error=$userdata['error'];
unset($userdata['error']);
// Try to update the userdata in the database.
} elseif (!phorum_user_save($userdata)) {
// Updating the user failed.
$error = $PHORUM["DATA"]["LANG"]["ErrUserAddUpdate"];
} else {
// Updating the user was successful.
$okmsg = $PHORUM["DATA"]["LANG"]["ProfileUpdatedOk"];
 
// Let the userdata be reloaded.
phorum_user_set_current_user($userdata["user_id"]);
 
// If a new password was set, let's create a new session.
if (isset($userdata["password"]) && !empty($userdata["password"])) {
phorum_user_create_session();
}
 
// Copy data from the updated user back into the template data.
// Leave PANEL and forum_id alone (these are injected into the
// userdata in the template from this script).
foreach ($GLOBALS["PHORUM"]["DATA"]["PROFILE"] as $key => $val) {
if ($key == "PANEL" || $key == "forum_id") continue;
if (isset($GLOBALS["PHORUM"]["user"][$key])) {
$GLOBALS["PHORUM"]["DATA"]["PROFILE"][$key] = $GLOBALS["PHORUM"]["user"][$key];
} else {
$GLOBALS["PHORUM"]["DATA"]["PROFILE"][$key] = "";
}
}
}
 
return array($error, $okmsg);
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/INSTALL
New file
0,0 → 1,2
See docs/install.txt for installation instructions.
See docs/upgrade.txt for upgrading instructions.
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/portable/phorum.php
New file
0,0 → 1,46
<?php
 
// THIS IS AN EXAMPLE OF HOW YOU WOULD WRAP PHORUM
// IT IS NOT A DROP IN SOLUTION.
 
// Phorum wrapper to create a portable, dynamic Phorum with a single code base
// and to safely wrap Phorum to protect it from other applications.
 
include_once "./phorum_settings.php";
 
chdir($PHORUM_DIR);
 
// set a default page
 
// we set $PHORUM["CUSTOM_QUERY_STRING"] so Phorum will parse it instead of
// the servers QUERY_STRING.
if(preg_match("/^([a-z]+)(,|$)/", $_SERVER["QUERY_STRING"], $match)){
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = str_replace($match[0], "", $_SERVER["QUERY_STRING"]);
$page = basename($match[1]);
} elseif(isset($_REQUEST["page"])){
$page = basename($_REQUEST["page"]);
$getparts = array();
foreach (explode("&", $_SERVER["QUERY_STRING"]) as $q) {
if (substr($q, 0, 5) != "page=") {
$getparts[] = $q;
}
}
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = implode(",", $getparts);
} else {
$page="index";
}
 
 
 
if(file_exists("./$page.php")){
phorum_namespace($page);
}
 
// create a namespace for Phorum
function phorum_namespace($page)
{
global $PHORUM; // globalize the $PHORUM array
include_once("./$page.php");
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/portable/phorum_settings.php
New file
0,0 → 1,34
<?php
// needed to really load the alternate db-config in common.php
define("PHORUM_WRAPPER",1);
 
// set the Phorum install dir
$PHORUM_DIR="/home/florian/Applications/lampp/htdocs/papyrus/client/phorum";
 
// set the databse settings for this Phorum Install
$PHORUM_ALT_DBCONFIG=array(
 
"type" => "mysql",
"name" => "papyrus",
"server" => "localhost",
"user" => "root",
"password" => "fs1980",
"table_prefix" => "phorum"
 
);
 
// We have to alter the urls a little
function phorum_custom_get_url ($page, $query_items, $suffix)
{
$PHORUM=$GLOBALS["PHORUM"];
 
$url = "$PHORUM[http_path]/phorum.php?$page";
 
if(count($query_items)) $url.=",".implode(",", $query_items);
 
if(!empty($suffix)) $url.=$suffix;
 
return $url;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/portable/phorum_admin.php
New file
0,0 → 1,9
<?php
 
include_once "./phorum_settings.php";
 
chdir($PHORUM_DIR);
 
include_once "./admin.php";
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/posting.php
New file
0,0 → 1,640
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// This script can initially be called in multiple ways to indicate what
// type of posting mode will be used. The parameters are:
//
// 1) The forum id.
//
// 2) The mode to use. Possibilities are:
//
// - post Post a new message (default if no mode is issued)
// - edit User edit of an already posted message
// - moderation Moderator edit of an already posted message
// - reply Reply to a message
// - quote Reply to a message, with quoting of the original message
//
// 3) If edit, moderation or reply is used: the message id.
//
// Examples:
// http://yoursite/phorum/posting.php?10,quote,15
// http://yoursite/phorum/posting.php?10,edit,20
// http://yoursite/phorum/posting.php?10,post
//
// This script can also be included in another page (for putting the editor
// screen inline in a page), by setting up the $PHORUM["postingargs"] before
// including:
//
// $PHORUM["postingargs"]["as_include"] any true value, to flag included state
// $PHORUM["postingargs"][0] the forum id
// $PHORUM["postingargs"][1] the mode to use (post,reply,quote,edit,moderation)
// $PHORUM["postingargs"][2] the message id to work with (omit for "post")
//
 
// ----------------------------------------------------------------------
// Basic setup and checks
// ----------------------------------------------------------------------
 
if (! defined('phorum_page')) {
define('phorum_page', 'post');
}
 
include_once("./common.php");
include_once("include/format_functions.php");
 
// Check if the Phorum is in read-only mode.
if(isset($PHORUM["status"]) && $PHORUM["status"]=="read-only"){
phorum_build_common_urls();
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["ReadOnlyMessage"];
// Only show header and footer when not included in another page.
if (phorum_page == "post") {
include phorum_get_template("header");
phorum_hook("after_header");
}
include phorum_get_template("message");
if (phorum_page == "post") {
phorum_hook("before_footer");
include phorum_get_template("footer");
}
return;
}
 
// No forum id was set. Take the user back to the index.
if(empty($PHORUM["forum_id"])){
$dest_url = phorum_get_url(PHORUM_INDEX_URL);
phorum_redirect_by_url($dest_url);
exit();
}
 
// Somehow we got to a folder in posting.php. Take the
// user back to the folder.
if($PHORUM["folder_flag"]){
$dest_url = phorum_get_url(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
phorum_redirect_by_url($dest_url);
exit();
}
 
// ----------------------------------------------------------------------
// Definitions
// ----------------------------------------------------------------------
 
// A list of valid posting modes.
$valid_modes = array(
"post", // Post a new message
"reply", // Post a reply to a message
"quote", // Post a reply with quoting of the message replied to
"edit", // Edit a message
"moderation", // Edit a message in moderator modus
);
 
// Configuration that we use for fields that we use in the editor form.
// Format for the array elements:
// [0] The type of field (string, integer, boolean, array).
// [1] Whether the value must be included as a hidden form field
// if the field is read-write flagged. So this is used for
// identifying values which are always implemented as a
// hidden form fields.
// [2] Whether the field is read-only or not. Within the editing process,
// this parameter can be changed to make the field writable.
// (for example if a moderator is editing a message).
// [3] A default value to initialize the form field with.
//
$PHORUM["post_fields"] = array(
"message_id" => array("integer", true, true, 0),
"user_id" => array("integer", true, true, 0),
"datestamp" => array("string", true, true, ''),
"status" => array("integer", false, true, 0),
"author" => array("string", false, true, ''),
"email" => array("string", false, true, ''),
"subject" => array("string", false, false, ''),
"body" => array("string", false, false, ''),
"forum_id" => array("integer", true, true, $PHORUM["forum_id"]),
"thread" => array("integer", true, true, 0),
"parent_id" => array("integer", true, true, 0),
"allow_reply" => array("boolean", false, true, 1),
"special" => array("string", false, true, ''),
"email_notify" => array("boolean", false, false, 0),
"show_signature" => array("boolean", false, false, 0),
"attachments" => array("array", true, true, array()),
"meta" => array("array", true, true, array()),
"thread_count" => array("integer", true, true, 0),
"mode" => array("string", true, true, ''),
);
 
// Indices for referencing the fields in $post_fields.
define("pf_TYPE", 0);
define("pf_HIDDEN", 1);
define("pf_READONLY", 2);
define("pf_INIT", 3);
 
// Definitions for a clear $apply_readonly parameter in
// the function phorum_posting_merge_db2form().
define("ALLFIELDS", false);
define("READONLYFIELDS", true);
 
// ----------------------------------------------------------------------
// Gather information about the editor state and start processing
// ----------------------------------------------------------------------
 
// Is this an initial request?
$initial = ! isset($_POST["message_id"]);
 
// Is finish, cancel of preview clicked?
$finish = (! $initial && isset($_POST["finish"]));
$cancel = (! $initial && isset($_POST["cancel"]));
$preview = (! $initial && isset($_POST["preview"]));
 
// Do we already have postingargs or do we use the global args?
if (! isset($PHORUM["postingargs"])) {
$PHORUM["postingargs"] = $PHORUM["args"];
}
 
// Find out what editing mode we're running in.
if ($initial) {
$mode = isset($PHORUM["postingargs"][1]) ? $PHORUM["postingargs"][1] : "post";
 
// Quote may also be passed as a phorum parameter (quote=1).
if ($mode == "reply" && isset($PHORUM["postingargs"]["quote"]) && $PHORUM["postingargs"]["quote"]) {
$mode = "quote";
}
 
} else {
if (! isset($_POST["mode"])) {
die("Missing parameter \"mode\" in request");
}
$mode = $_POST["mode"];
}
if (! in_array($mode, $valid_modes)) {
die("Illegal mode issued: $mode");
}
 
// Find out if we are attaching or detaching something.
// For detaching $do_detach will be set to the attachment's file_id.
$do_detach = false;
$do_attach = false;
foreach ($_POST as $var => $val) {
if (substr($var, 0, 7) == "detach:") {
$do_detach = substr($var, 7);
} elseif ($var == "attach") {
$do_attach = true;
}
}
 
// In case users click on post or preview, without uploading
// their attachment first, we fake an upload action.
if (count($_FILES)) {
list($name, $data) = each($_FILES);
if ($data["size"]) $do_attach = true;
reset($_FILES);
}
 
// Set all our URL's
phorum_build_common_urls();
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url(PHORUM_POSTING_URL);
 
// Keep track of errors.
$error_flag = false;
$PHORUM["DATA"]["MESSAGE"] = null;
$PHORUM["DATA"]["ERROR"] = null;
 
// Do things that are specific for first time or followup requests.
if ($initial) {
include("./include/posting/request_first.php");
} else {
include("./include/posting/request_followup.php");
}
 
// Store the posting mode in the form parameters, so we can remember
// the mode throughout the editing cycle (for example to be able to
// create page titles which match the editing mode).
$PHORUM["DATA"]["MODE"] = $mode;
 
// ----------------------------------------------------------------------
// Permission and ability handling
// ----------------------------------------------------------------------
 
// Make a descision on what posting mode we're really handling, based on
// the data that we have. The posting modes "reply" and "quote" will
// both be called "reply" from here. Modes "edit" and "moderation" will
// be called "edit" from here. The exact editor behaviour for editing is
// based on the user's permissions, not on posting mode.
$mode = "post";
if ($message["message_id"]) {
$mode = "edit";
} elseif ($message["parent_id"]) {
$mode = "reply";
}
 
// Do ban list checks. Only check the bans on entering and
// on finishing up. No checking is needed on intermediate requests.
if (! $error_flag && ($initial || $finish || $preview)) {
include("./include/posting/check_banlist.php");
}
 
// Determine the abilities that the current user has.
if (! $error_flag)
{
// Is the forum running in a moderated state?
$PHORUM["DATA"]["MODERATED"] =
$PHORUM["moderation"] == PHORUM_MODERATE_ON &&
!phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
 
// Does the user have administrator permissions?
$PHORUM["DATA"]["ADMINISTRATOR"] = $PHORUM["user"]["admin"];
 
// Does the user have moderator permissions?
$PHORUM["DATA"]["MODERATOR"] =
phorum_user_access_allowed(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
 
// Ability: Do we allow attachments?
$PHORUM["DATA"]["ATTACHMENTS"] = $PHORUM["max_attachments"] > 0 && phorum_user_access_allowed(PHORUM_USER_ALLOW_ATTACH);
 
$PHORUM["DATA"]["EMAILNOTIFY"] =
(isset($PHORUM['allow_email_notify']) && !empty($PHORUM['allow_email_notify']))? 1 : 0;
 
// What special options can this user set for a message?
$PHORUM["DATA"]["OPTION_ALLOWED"] = array(
"sticky" => false, // Sticky flag for message sorting
"announcement" => false, // Announcement flag for message sorting
"allow_reply" => false, // Wheter replies are allowed in the thread
);
// For moderators and administrators.
if (($PHORUM["DATA"]["MODERATOR"] || $PHORUM["DATA"]["ADMINISTRATOR"]) && $message["parent_id"] == 0) {
$PHORUM["DATA"]["OPTION_ALLOWED"]["sticky"] = true;
$PHORUM["DATA"]["OPTION_ALLOWED"]["allow_reply"] = true;
}
// For administrators only.
if ($PHORUM["DATA"]["ADMINISTRATOR"]) {
$PHORUM["DATA"]["OPTION_ALLOWED"]["announcement"] = true;
}
}
 
if (! $error_flag)
{
// A hook to allow modules to change the abilities from above.
phorum_hook("posting_permission");
 
// Show special sort options in the editor? These only are
// honoured for the thread starter messages, so we check the
// parent_id for that.
$PHORUM["DATA"]["SHOW_SPECIALOPTIONS"] =
$message["parent_id"] == 0 &&
($PHORUM["DATA"]["OPTION_ALLOWED"]["announcement"] ||
$PHORUM["DATA"]["OPTION_ALLOWED"]["sticky"]);
 
// Show special sort options or allow_reply in the editor?
$PHORUM["DATA"]["SHOW_THREADOPTIONS"] =
$PHORUM["DATA"]["SHOW_SPECIALOPTIONS"] ||
$PHORUM["DATA"]["OPTION_ALLOWED"]["allow_reply"];
}
 
// Set extra writeable fields, based on the user's abilities.
if (isset($PHORUM["DATA"]["ATTACHMENTS"]) && $PHORUM["DATA"]["ATTACHMENTS"]) {
// Keep it as a hidden field.
$PHORUM["post_fields"]["attachments"][pf_READONLY] = false;
}
if (isset($PHORUM["DATA"]["MODERATOR"]) && $PHORUM["DATA"]["MODERATOR"]) {
if (! $message["user_id"]) {
$PHORUM["post_fields"]["author"][pf_READONLY] = false;
$PHORUM["post_fields"]["email"][pf_READONLY] = false;
}
}
if (isset($PHORUM["DATA"]["SHOW_SPECIALOPTIONS"]) && $PHORUM["DATA"]["SHOW_SPECIALOPTIONS"]) {
$PHORUM["post_fields"]["special"][pf_READONLY] = false;
}
if (isset($PHORUM["DATA"]["OPTION_ALLOWED"]["allow_reply"]) && $PHORUM["DATA"]["OPTION_ALLOWED"]["allow_reply"]) {
$PHORUM["post_fields"]["allow_reply"][pf_READONLY] = false;
}
 
// Check permissions and apply read-only data.
// Only do this on entering and on finishing up.
// No checking is needed on intermediate requests.
if (! $error_flag && ($initial || $finish)) {
include("./include/posting/check_permissions.php");
}
 
// Do permission checks for attachment management.
if (! $error_flag && ($do_attach || $do_detach)) {
if (! $PHORUM["DATA"]["ATTACHMENTS"]) {
$PHORUM["DATA"]["MESSAGE"] =
$PHORUM["DATA"]["LANG"]["AttachNotAllowed"];
$error_flag = true;
}
}
 
// ----------------------------------------------------------------------
// Perform actions
// ----------------------------------------------------------------------
 
// Only check the integrity of the data on finishing up. During the
// editing process, the user may produce garbage as much as he likes.
if (! $error_flag && $finish) {
include("./include/posting/check_integrity.php");
}
 
// Handle cancel request.
if (! $error_flag && $cancel) {
include("./include/posting/action_cancel.php");
}
 
// Count the number and total size of active attachments
// that we currently have.
$attach_count = 0;
$attach_totalsize = 0;
foreach ($message["attachments"] as $attachment) {
if ($attachment["keep"]) {
$attach_count ++;
$attach_totalsize += $attachment["size"];
}
}
 
// Attachment management. This will update the
// $attach_count and $attach_totalsize variables.
if (! $error_flag && ($do_attach || $do_detach)) {
include("./include/posting/action_attachments.php");
}
 
// Handle finishing actions.
if (! $error_flag && $finish)
{
// Posting mode
if ($mode == "post" || $mode == "reply") {
include("./include/posting/action_post.php");
}
// Editing mode.
elseif ($mode == "edit") {
include("./include/posting/action_edit.php");
}
// A little safety net.
else {
die("Internal error: finish action for \"$mode\" not available");
}
}
 
// ----------------------------------------------------------------------
// Display the page
// ----------------------------------------------------------------------
 
// Make up the text which must be used on the posting form's submit button.
$button_txtid = $mode == "edit" ? "SaveChanges" : "Post";
$message["submitbutton_text"] = $PHORUM["DATA"]["LANG"][$button_txtid];
 
// Attachment config
if($PHORUM["max_attachments"]){
 
$php_limit = ini_get('upload_max_filesize')*1024;
$max_packetsize = phorum_db_maxpacketsize();
if ($max_packetsize == NULL) {
$db_limit = $php_limit;
} else {
$db_limit = $max_packetsize/1024*.6;
}
if($PHORUM["max_attachment_size"]==0) $PHORUM["max_attachment_size"]=$php_limit;
$PHORUM["max_attachment_size"] = min($PHORUM["max_attachment_size"], $php_limit, $db_limit);
if ($PHORUM["max_totalattachment_size"]) {
if ($PHORUM["max_totalattachment_size"] < $PHORUM["max_attachment_size"]) {
$PHORUM["max_attachment_size"] = $PHORUM["max_totalattachment_size"];
}
}
 
// Data for attachment explanation.
if ($PHORUM["allow_attachment_types"]) {
$PHORUM["DATA"]["ATTACH_FILE_TYPES"] = str_replace(";", ", ", $PHORUM["allow_attachment_types"]);
$PHORUM["DATA"]["EXPLAIN_ATTACH_FILE_TYPES"] = str_replace("%types%", $PHORUM["DATA"]["ATTACH_FILE_TYPES"], $PHORUM["DATA"]["LANG"]["AttachFileTypes"]);
}
if ($PHORUM["max_attachment_size"]) {
$PHORUM["DATA"]["ATTACH_FILE_SIZE"] = $PHORUM["max_attachment_size"];
$PHORUM["DATA"]["ATTACH_FORMATTED_FILE_SIZE"] = phorum_filesize($PHORUM["max_attachment_size"] * 1024);
$PHORUM["DATA"]["EXPLAIN_ATTACH_FILE_SIZE"] = str_replace("%size%", $PHORUM["DATA"]["ATTACH_FORMATTED_FILE_SIZE"], $PHORUM["DATA"]["LANG"]["AttachFileSize"]);
}
if ($PHORUM["max_totalattachment_size"] && $PHORUM["max_attachments"]>1) {
$PHORUM["DATA"]["ATTACH_TOTALFILE_SIZE"] = $PHORUM["max_totalattachment_size"];
$PHORUM["DATA"]["ATTACH_FORMATTED_TOTALFILE_SIZE"] = phorum_filesize($PHORUM["max_totalattachment_size"] * 1024);
$PHORUM["DATA"]["EXPLAIN_ATTACH_TOTALFILE_SIZE"] = str_replace("%size%", $PHORUM["DATA"]["ATTACH_FORMATTED_TOTALFILE_SIZE"], $PHORUM["DATA"]["LANG"]["AttachTotalFileSize"]);
}
if ($PHORUM["max_attachments"] && $PHORUM["max_attachments"]>1) {
$PHORUM["DATA"]["ATTACH_MAX_ATTACHMENTS"] = $PHORUM["max_attachments"];
$PHORUM["DATA"]["ATTACH_REMAINING_ATTACHMENTS"] = $PHORUM["max_attachments"] - $attach_count;
$PHORUM["DATA"]["EXPLAIN_ATTACH_MAX_ATTACHMENTS"] = str_replace("%count%", $PHORUM["DATA"]["ATTACH_REMAINING_ATTACHMENTS"], $PHORUM["DATA"]["LANG"]["AttachMaxAttachments"]);
}
 
// A flag for the template building to be able to see if the
// attachment storage space is full.
$PHORUM["DATA"]["ATTACHMENTS_FULL"] =
$attach_count >= $PHORUM["max_attachments"] ||
($PHORUM["max_totalattachment_size"] &&
$attach_totalsize >= $PHORUM["max_totalattachment_size"]*1024);
}
 
// Let the templates know if we're running as an include.
$PHORUM["DATA"]["EDITOR_AS_INCLUDE"] =
isset($PHORUM["postingargs"]["as_include"]) && $PHORUM["postingargs"]["as_include"];
 
// Process data for previewing.
if ($preview) {
include("./include/posting/action_preview.php");
}
 
// Always put the current mode in the message, so hook
// writers can use this for identifying what we're doing.
$message["mode"] = $mode;
 
// Create hidden form field code. Fields which are read-only are
// all added as a hidden form fields in the form. Also the fields
// for which the pf_HIDDEN flag is set will be added to the
// hidden fields.
$hidden = "";
foreach ($PHORUM["post_fields"] as $var => $spec)
{
if ($var == "mode") {
$val = $mode;
} elseif ($spec[pf_TYPE] == "array") {
$val = htmlspecialchars(serialize($message[$var]));
} else {
$val = htmlentities($message[$var], ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]);
}
if ($spec[pf_READONLY] || $spec[pf_HIDDEN]) {
$hidden .= '<input type="hidden" name="' . $var . '" ' .
'value="' . $val . "\" />\n";
}
}
$PHORUM["DATA"]["POST_VARS"] .= $hidden;
 
// Process data for XSS prevention.
foreach ($message as $var => $val)
{
// The meta information should not be used in templates, because
// nothing is escaped here. But we might want to use the data in
// mods which are run after this code. We continue here, so the
// data won't be stripped from the message data later on.
if ($var == "meta") continue;
 
if ($var == "attachments") {
if (is_array($val)) {
foreach ($val as $nr => $data)
{
// Do not show attachments which are not kept.
if (! $data["keep"]) {
unset($message["attachments"][$nr]);
continue;
}
 
$message[$var][$nr]["name"] = htmlspecialchars($data["name"]);
$message[$var][$nr]["size"] = phorum_filesize(round($data["size"]));
}
}
} else {
if (is_scalar($val)) {
$message[$var] = htmlspecialchars($val);
} else {
// Not used in the template, unless proven otherwise.
$message[$var] = '[removed from template data]';
}
}
}
 
// A cancel button is not needed if the editor is included in a page.
// This can also be used by the before_editor hook to disable the
// cancel button in all pages.
$PHORUM["DATA"]["SHOW_CANCEL_BUTTON"] = (isset($PHORUM["postingargs"]["as_include"]) ? false : true);
 
// A hook to give modules a last chance to update the message data.
$message = phorum_hook("before_editor", $message);
 
// Make the message data available to the template engine.
$PHORUM["DATA"]["POST"] = $message;
 
// Set the field to focus.
$focus = "phorum_subject";
if (!empty($message["subject"])) $focus = "phorum_textarea";
$PHORUM["DATA"]["FOCUS_TO_ID"] = $focus;
 
// Load page header.
if (! isset($PHORUM["postingargs"]["as_include"])) {
include phorum_get_template("header");
phorum_hook("after_header");
}
 
// Load page content.
if (isset($PHORUM["DATA"]["MESSAGE"])) {
include phorum_get_template("message");
} else {
include phorum_get_template("posting");
}
 
// Load page footer.
if (! isset($PHORUM["postingargs"]["as_include"])) {
phorum_hook("before_footer");
include phorum_get_template("footer");
}
 
// ----------------------------------------------------------------------
// Functions
// ----------------------------------------------------------------------
 
// Merge data from a database message record into the form fields
// that we use. If $apply_readonly is set to a true value, then
// only the fields which are flagged as read-only will be copied.
function phorum_posting_merge_db2form($form, $db, $apply_readonly = false)
{
$PHORUM = $GLOBALS['PHORUM'];
 
// If we have a user linked to the current message, then get the
// user data from the database, if it has to be applied as
// read-only data.
if ($PHORUM["post_fields"]["email"][pf_READONLY] || $PHORUM["post_fields"]["author"][pf_READONLY]) {
if ($db["user_id"]) {
$user_info = phorum_user_get($db["user_id"], false);
$user_info["author"] = $user_info["username"];
}
}
 
foreach ($PHORUM["post_fields"] as $key => $info)
{
// Skip writeable fields if we only have to apply read-only ones.
if ($apply_readonly && ! $info[pf_READONLY]) continue;
 
switch ($key) {
case "show_signature": {
$form[$key] = !empty($db["meta"]["show_signature"]);
break;
}
 
case "allow_reply": {
$form[$key] = ! $db["closed"];
break;
}
 
case "email_notify": {
$form[$key] = phorum_db_get_if_subscribed(
$db["forum_id"], $db["thread"], $db["user_id"]);
break;
}
 
case "forum_id": {
$form["forum_id"] = $db["forum_id"] ? $db["forum_id"] : $PHORUM["forum_id"];
break;
}
 
case "attachments": {
$form[$key] = array();
if (isset($db["meta"]["attachments"])) {
foreach ($db["meta"]["attachments"] as $data) {
$data["keep"] = true;
$data["linked"] = true;
$form["attachments"][] = $data;
}
}
break;
}
 
case "author":
case "email": {
if ($db["user_id"]) {
$form[$key] = $user_info[$key];
} else {
$form[$key] = $db[$key];
}
break;
}
 
case "special": {
if ($db["sort"] == PHORUM_SORT_ANNOUNCEMENT) {
$form["special"] = "announcement";
} elseif ($db["sort"] == PHORUM_SORT_STICKY) {
$form["special"] = "sticky";
} else {
$form["special"] = "";
}
break;
}
 
case "mode": {
// NOOP
break;
}
 
default:
$form[$key] = $db[$key];
}
}
return $form;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/versioncheck.php
New file
0,0 → 1,89
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','version_iframe');
 
// Check for new versions of the Phorum software. Only do this once by
// issuing a cookie which remembers whether we need to upgrade or not.
// This file is included within an <iframe> in the admin interface header,
// so downtime of the phorum.org website won't affect the performance of
// the admin interface for Phorum users.
 
require_once('./common.php');
 
if (isset($_COOKIE["phorum_upgrade_available"])) {
$upgrade_available = $_COOKIE["phorum_upgrade_available"];
} else {
require_once('./include/version_functions.php');
$releases = phorum_find_upgrades();
if (isset($releases["stable"]) && $releases["stable"]["upgrade"]) {
$upgrade_available = $releases["stable"]["version"];
} elseif (isset($releases["development"]) && $releases["development"]["upgrade"]) {
$upgrade_available = $releases["development"]["version"];
} else {
$upgrade_available = 0;
}
}
setcookie("phorum_upgrade_available", $upgrade_available, 0,
$PHORUM["session_path"], $PHORUM["session_domain"]);
 
?>
<html>
<head>
<title>Phorum upgrade notification</title>
<style type="text/css">
body {
background-color: white;
margin: 0px;
padding: 0px;
}
.notify_upgrade {
text-align: center;
border: 2px solid black;
background-color: #e00000;
padding: 3px;
margin: 0px;
}
.notify_upgrade a {
font-family: Lucida Sans Unicode,Lucida Grand,Verdana,Arial,Helvetica;
color: white;
font-weight: bold;
font-size: 13px;
}
.notify_noupgrade {
text-align: center;
border: 1px solid black;
padding: 3px;
margin: 0px;
font-family: Lucida Sans Unicode,Lucida Grand,Verdana,Arial,Helvetica;
font-size: 13px;
}
</style>
</head>
<body>
<?php if ($upgrade_available) { ?>
<div class="notify_upgrade">
<a target="_top" href="admin.php?module=version">New Phorum version <?php print $upgrade_available ?> available!</a>
</div>
<?php } else { ?>
<div class="notify_noupgrade">
Your Phorum installation is up to date
</div>
<?php } ?>
</body>
</html>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/register.php
New file
0,0 → 1,255
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','register');
 
include_once("./common.php");
include_once("./include/users.php");
include_once("./include/profile_functions.php");
include_once("./include/email_functions.php");
 
// set all our URL's
phorum_build_common_urls();
 
// The URL contains an approve argument, which means that a new user
// is confirming a new user account.
if (isset($PHORUM["args"]["approve"])) {
 
// Extract registration validation code and user_id.
$tmp_pass=substr($PHORUM["args"]["approve"], 0, 8);
$user_id = (int)substr($PHORUM["args"]["approve"], 8);
$user_id = phorum_user_verify($user_id, $tmp_pass);
 
// Validation code correct.
if ($user_id) {
 
$user = phorum_user_get($user_id);
 
$moduser=array();
 
// The user has been denied by a moderator.
if ($user["active"] == PHORUM_USER_INACTIVE) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyFailed"];
// The user should still be approved by a moderator.
} elseif ($user["active"] == PHORUM_USER_PENDING_MOD) {
// TODO: this message should be changed in 5.1 to have a unique message!!!
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyMod"];
// The user is waiting for email and/or email+moderator confirmation.
} else {
// Waiting for both? Then switch to wait for moderator.
if ($user["active"] == PHORUM_USER_PENDING_BOTH) {
$moduser["active"] = PHORUM_USER_PENDING_MOD;
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyMod"];
// Only email confirmation was required. Active the user.
} else {
$moduser["active"] = PHORUM_USER_ACTIVE;
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegAcctActive"];
}
 
// Save the new user active status.
$moduser["user_id"] = $user_id;
phorum_user_save($moduser);
}
 
// Validation code incorrect.
} else {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyFailed"];
}
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
 
}
 
$error = ''; // Init error as empty.
 
// Process posted form data.
if (count($_POST)) {
 
// Sanitize input data.
foreach ($_POST as $key => $val) {
if ($key == 'username') {
// Trim and space-collapse usernames, so people can't
// impersonate as other users using the same username,
// but with extra spaces in it.
$_POST[$key] = preg_replace('/\s+/', ' ', trim($val));
} else {
$_POST[$key] = trim($val);
}
}
 
// Check if all required fields are filled and valid.
if (!isset($_POST["username"]) || empty($_POST['username'])) {
$error = $PHORUM["DATA"]["LANG"]["ErrUsername"];
} elseif (!isset($_POST["email"]) || !phorum_valid_email($_POST["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
} elseif (empty($_POST["password"]) || $_POST["password"] != $_POST["password2"]) {
$error = $PHORUM["DATA"]["LANG"]["ErrPassword"];
}
// Check if the username and email address don't already exist.
elseif(phorum_user_check_username($_POST["username"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"];
} elseif (phorum_user_check_email($_POST["email"])){
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"];
}
 
// Check banlists.
if (empty($error)) {
$error = phorum_check_bans(array(
array($_POST["username"], PHORUM_BAD_NAMES),
array($_POST["email"], PHORUM_BAD_EMAILS),
array(NULL, PHORUM_BAD_IPS),
));
}
 
// Create user if no errors have been encountered.
if (empty($error)) {
 
// Setup the default userdata to store.
$userdata = array(
'username' => NULL,
'password' => NULL,
'email' => NULL,
);
// Add custom profile fields as acceptable fields.
foreach ($PHORUM["PROFILE_FIELDS"] as $data) {
$userdata[$data["name"]] = NULL;
}
// Update userdata with $_POST information.
foreach ($_POST as $key => $val) {
if (array_key_exists($key, $userdata)) {
$userdata[$key] = $val;
}
}
// Remove unused custom profile fields.
foreach ($PHORUM["PROFILE_FIELDS"] as $field) {
if (is_null($userdata[$field["name"]])) {
unset($userdata[$field["name"]]);
}
}
// Add static info.
$userdata["date_added"]=time();
$userdata["date_last_active"]=time();
$userdata["hide_email"]=true;
 
// Set user active status depending on the registration verification
// setting. Generate a confirmation code for email verification.
if ($PHORUM["registration_control"] == PHORUM_REGISTER_INSTANT_ACCESS) {
$userdata["active"] = PHORUM_USER_ACTIVE;
} elseif ($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_EMAIL) {
$userdata["active"] = PHORUM_USER_PENDING_EMAIL;
$userdata["password_temp"]=substr(md5(microtime()), 0, 8);
} elseif ($PHORUM["registration_control"]==PHORUM_REGISTER_VERIFY_MODERATOR) {
$userdata["active"] = PHORUM_USER_PENDING_MOD;
} elseif ($PHORUM["registration_control"]==PHORUM_REGISTER_VERIFY_BOTH) {
$userdata["password_temp"]=substr(md5(microtime()), 0, 8);
$userdata["active"] = PHORUM_USER_PENDING_BOTH;
}
 
// Run a hook, so module writers can update and check the userdata.
$userdata = phorum_hook("before_register", $userdata);
 
// Set $error, in case the before_register hook did set an error.
if (isset($userdata['error'])) {
$error = $userdata['error'];
unset($userdata['error']);
}
// Try to add the user to the database.
elseif ($user_id = phorum_user_add($userdata)) {
 
// The user was added. Determine what message to show.
if ($PHORUM["registration_control"] == PHORUM_REGISTER_INSTANT_ACCESS) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegThanks"];
} elseif($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_EMAIL ||
$PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_BOTH) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyEmail"];
} elseif($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_MODERATOR) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyMod"];
}
 
// Send a message to the new user in case email verification is required.
if ($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_BOTH ||
$PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_EMAIL) {
$verify_url = phorum_get_url(PHORUM_REGISTER_URL, "approve=".$userdata["password_temp"]."$user_id");
// make the link an anchor tag for AOL users
if (preg_match("!aol\.com$!i", $userdata["email"])) {
$verify_url = "<a href=\"$verify_url\">$verify_url</a>";
}
$maildata["mailsubject"] = $PHORUM["DATA"]["LANG"]["VerifyRegEmailSubject"];
$maildata["mailmessage"] = wordwrap($PHORUM["DATA"]["LANG"]["VerifyRegEmailBody1"], 72)."\n\n$verify_url\n\n".wordwrap($PHORUM["DATA"]["LANG"]["VerifyRegEmailBody2"], 72);
phorum_email_user(array($userdata["email"]), $maildata);
}
 
$PHORUM["DATA"]["BACKMSG"] = $PHORUM["DATA"]["LANG"]["RegBack"];
$PHORUM["DATA"]["URL"]["REDIRECT"] = phorum_get_url(PHORUM_LOGIN_URL);
 
// Run a hook, so module writers can run tasks after registering.
phorum_hook("after_register",$userdata);
 
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
return;
 
// Adding the user to the database failed.
} else {
$error = $PHORUM["DATA"]["LANG"]["ErrUserAddUpdate"];
}
}
 
// Some error encountered during processing? Then setup the
// data to redisplay the registration form, including an error.
if (!empty($error)) {
foreach($_POST as $key => $val){
$PHORUM["DATA"]["REGISTER"][$key] = htmlspecialchars($val);
}
$PHORUM["DATA"]["ERROR"] = htmlspecialchars($error);
}
 
// No data posted, so this is the first request. Initialize form data.
} else {
// Initialize fixed fields.
$PHORUM["DATA"]["REGISTER"]["username"] = "";
$PHORUM["DATA"]["REGISTER"]["email"] = "";
$PHORUM["DATA"]["ERROR"] = "";
 
// Initialize custom profile fields.
foreach($PHORUM["PROFILE_FIELDS"] as $field) {
$PHORUM["DATA"]["REGISTER"][$field["name"]] = "";
}
}
 
# Setup static template data.
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url( PHORUM_REGISTER_ACTION_URL );
$PHORUM["DATA"]["REGISTER"]["forum_id"] = $PHORUM["forum_id"];
$PHORUM["DATA"]["REGISTER"]["block_title"] = $PHORUM["DATA"]["LANG"]["Register"];
 
// Display the registration page.
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("register");
phorum_hook("before_footer");
include phorum_get_template("footer");
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/admin.php
New file
0,0 → 1,305
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Phorum 5 Admin
 
define("PHORUM_ADMIN", 1);
 
// set a sane error level for our admin.
// this will make the coding time faster and
// the code run faster.
error_reporting (E_ERROR | E_WARNING | E_PARSE);
 
include_once "./common.php";
include_once "./include/users.php";
 
 
// if we are installing or upgrading, we don't need to check for a session
// 2005081000 was the internal version that introduced the installed flag
if(!isset($PHORUM['internal_version']) || (!isset($PHORUM['installed']) && $PHORUM['internal_version']>='2005081000')) {
 
// this is an install
$module="install";
 
} elseif (isset($PHORUM['internal_version']) && $PHORUM['internal_version'] < PHORUMINTERNAL) {
 
// this is an upgrade
$module="upgrade";
 
} else {
 
// check for a session
phorum_user_check_session("phorum_admin_session");
 
if(!isset($GLOBALS["PHORUM"]["user"]) || !$GLOBALS["PHORUM"]["user"]["admin"]){
// if not an admin
unset($GLOBALS["PHORUM"]["user"]);
$module="login";
} else {
// load the default module if none is specified
if(!empty($_REQUEST["module"])){
$module = basename($_REQUEST["module"]);
} else {
$module = "default";
}
 
}
 
}
 
ob_start();
if($module!="help") include_once "./include/admin/header.php";
@include_once "./include/admin/$module.php";
if($module!="help") include_once "./include/admin/footer.php";
ob_end_flush();
 
 
/////////////////////////////////////////////////
 
function phorum_admin_error($error)
{
echo "<div class=\"PhorumAdminError\">$error</div>\n";
}
 
function phorum_admin_okmsg($error)
{
echo "<div class=\"PhorumAdminOkMsg\">$error</div>\n";
}
// phorum_get_language_info and phorum_get_template_info moved to common.php (used in the cc too)
 
function phorum_get_folder_info()
{
$folders=array();
$folder_data=array();
 
$forums = phorum_db_get_forums();
 
foreach($forums as $forum){
if($forum["folder_flag"]){
$path = $forum["name"];
$parent_id=$forum["parent_id"];
while($parent_id!=0 && $parent_id!=$forum["forum_id"]){
$path=$forums[$parent_id]["name"]."::$path";
$parent_id=$forums[$parent_id]["parent_id"];
}
$folders[$forum["forum_id"]]=$path;
}
}
 
asort($folders);
 
$tmp=array("--None--");
 
foreach($folders as $id => $folder){
$tmp[$id]=$folder;
}
 
$folders=$tmp;
 
return $folders;
 
}
 
function phorum_get_forum_info($forums_only=0)
{
$folders=array();
$folder_data=array();
 
$forums = phorum_db_get_forums();
 
foreach($forums as $forum){
if($forums_only == 0 || $forum['folder_flag']==0 || ($forums_only=2 && $forum['vroot'] && $forum['vroot'] == $forum['forum_id'])) {
$path = $forum["name"];
$parent_id=$forum["parent_id"];
while($parent_id!=0){
$path=$forums[$forum["parent_id"]]["name"]."::$path";
 
$parent_id=$forums[$parent_id]["parent_id"];
}
if($forum['vroot'] && $forum['vroot']==$forum['forum_id']) {
$path.=" (Virtual Root)";
}
$folders[$forum["forum_id"]]=$path;
}
}
 
asort($folders);
 
return $folders;
 
}
 
/*
* Sets the given vroot for the descending forums / folders
* which are not yet in another descending vroot
*
* $folder = folder from which we should go down
* $vroot = virtual root we set the folders/forums to
* $old_vroot = virtual root which should be overrideen with the new value
*
*/
function phorum_admin_set_vroot($folder,$vroot=-1,$old_vroot=0) {
// which vroot
if($vroot == -1) {
$vroot=$folder;
}
 
// get the desc forums/folders
$descending=phorum_admin_get_descending($folder);
$valid=array();
 
// collecting vroots
$vroots=array();
foreach($descending as $id => $data) {
if($data['folder_flag'] == 1 && $data['vroot'] != 0 && $data['forum_id'] == $data['vroot']) {
$vroots[$data['vroot']]=true;
}
}
 
// getting forums which are not in a vroot or not in *this* vroot
foreach($descending as $id => $data) {
if($data['vroot'] == $old_vroot || !isset($vroots[$data['vroot']])) {
$valid[$id]=$data;
}
}
 
// $valid = forums/folders which are not in another vroot
$set_ids=array_keys($valid);
$set_ids[]=$folder;
 
$new_forum_data=array('forum_id'=>$set_ids,'vroot'=>$vroot);
$returnval=phorum_db_update_forum($new_forum_data);
 
return $returnval;
}
 
function phorum_admin_get_descending($parent) {
 
$ret_data=array();
$arr_data=phorum_db_get_forums(0,$parent);
foreach($arr_data as $key => $val) {
$ret_data[$key]=$val;
if($val['folder_flag'] == 1) {
$more_data=phorum_db_get_forums(0,$val['forum_id']);
$ret_data=$ret_data + $more_data; // array_merge reindexes the array
}
}
return $ret_data;
}
 
function phorum_upgrade_tables($fromversion,$toversion) {
 
$PHORUM=$GLOBALS['PHORUM'];
 
if(empty($fromversion) || empty($toversion)){
die("Something is wrong with the upgrade script. Please contact the Phorum Dev Team. ($fromversion,$toversion)");
}
 
$msg="";
$upgradepath="./include/db/upgrade/{$PHORUM['DBCONFIG']['type']}/";
 
// read in all existing files
$dh=opendir($upgradepath);
$upgradefiles=array();
while ($file = readdir ($dh)) {
if (substr($file,-4,4) == ".php") {
$upgradefiles[]=$file;
}
}
unset($file);
closedir($dh);
 
// sorting by number
sort($upgradefiles,SORT_NUMERIC);
reset($upgradefiles);
 
// advance to current version
while(list($key,$val)=each($upgradefiles)) {
if($val == $fromversion.".php")
break;
}
 
 
 
// get the file for the next version (which we will upgrade to)
list($dump,$file) = each($upgradefiles);
 
// extract the pure version, needed as internal version
$pure_version = basename($file,".php");
 
if(empty($pure_version)){
die("Something is wrong with the upgrade script. Please contact the Phorum Dev Team. ($fromversion,$toversion)");
}
 
 
$upgradefile=$upgradepath.$file;
 
if(file_exists($upgradefile)) {
if (! is_readable($upgradefile))
die("$upgradefile is not readable. Make sure the file has got the neccessary permissions and try again.");
 
$msg.="Upgrading from db-version $fromversion to $pure_version ... ";
$upgrade_queries=array();
include($upgradefile);
$err=phorum_db_run_queries($upgrade_queries);
if($err){
$msg.= "an error occured: $err ... try to continue.<br />\n";
} else {
$msg.= "done.<br />\n";
}
$GLOBALS["PHORUM"]["internal_version"]=$pure_version;
phorum_db_update_settings(array("internal_version"=>$pure_version));
} else {
$msg="Ooops, the upgradefile is missing. How could this happen?";
}
 
return $msg;
}
 
function phorum_admin_gen_compare($txt) {
$func = 0;
if($txt == "gt") {
$func = create_function('$a, $b', 'return $a > $b;');
} elseif($txt == "gte") {
$func = create_function('$a, $b', 'return $a >= $b;');
} elseif($txt == "lt") {
$func = create_function('$a, $b', 'return $a < $b;');
} elseif($txt == "lte") {
$func = create_function('$a, $b', 'return $a <= $b;');
} elseif($txt == "eq") {
$func = create_function('$a, $b', 'return $a == $b;');
}
if(!$func) {
phorum_admin_error("Invalid posts comparison operator.");
return NULL;
}
return $func;
}
 
function phorum_admin_filter_arr($arr,$field,$value,$cmpfn) {
$new = array();
foreach($arr as $item){
if(isset($item[$field]) && $cmpfn($item[$field],$value)) {
array_push($new,$item);
}
}
return $new;
}
 
?>
/branches/v2.0-narmer/client/phorum/bibliotheque/phorum/common.php
New file
0,0 → 1,835
<?php
 
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2006 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
 
// Check that this file is not loaded directly.
if ( basename( __FILE__ ) == basename( $_SERVER["PHP_SELF"] ) ) exit();
 
// all other constants in ./include/constants.php
define( "PHORUM", "5.1.10" );
 
// our internal version in format of year-month-day-serial
define( "PHORUMINTERNAL", "2005120400" );
 
define( "DEBUG", 0 );
 
include_once( "./include/constants.php" );
 
// setup the PHORUM var
$PHORUM = array();
 
// temp member to hold arrays and such in templates
$PHORUM["TMP"] = array();
 
// The data member is the data the templates can access
$PHORUM["DATA"] = array();
$PHORUM["DATA"]["GET_VARS"] = array();
$PHORUM["DATA"]["POST_VARS"] = "";
 
// get the forum id if set with a post
if ( isset( $_REQUEST["forum_id"] ) && is_numeric( $_REQUEST["forum_id"] ) ) {
$PHORUM["forum_id"] = $_REQUEST["forum_id"];
}
 
// strip the slashes off of POST data if magic_quotes is on
if ( get_magic_quotes_gpc() && count( $_REQUEST ) ) {
foreach( $_POST as $key => $value ) {
if ( !is_array( $value ) )
$_POST[$key] = stripslashes( $value );
else
$_POST[$key] = phorum_recursive_stripslashes( $value );
}
foreach( $_GET as $key => $value ) {
if ( !is_array( $value ) )
$_GET[$key] = stripslashes( $value );
else
$_GET[$key] = phorum_recursive_stripslashes( $value );
}
}
 
// look for and parse the QUERY_STRING
// this only applies to urls that we create.
// scrips using urls from forms (search) should use $_GET or $_POST
if ( !defined( "PHORUM_ADMIN" ) ) {
if ( isset( $_SERVER["QUERY_STRING"] ) || isset( $PHORUM["CUSTOM_QUERY_STRING"] ) ) {
$Q_STR = empty( $GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] ) ? $_SERVER["QUERY_STRING"]: $GLOBALS["PHORUM_CUSTOM_QUERY_STRING"];
 
// ignore stuff past a #
if ( strstr( $Q_STR, "#" ) ) list( $Q_STR, $other ) = explode( "#", $Q_STR );
 
// explode it on comma
$PHORUM["args"] = explode( ",", $Q_STR );
 
// check for any assigned values
if ( strstr( $Q_STR, "=" ) ) {
foreach( $PHORUM["args"] as $key => $arg ) {
 
// if an arg has an = create an element in args
// with left part as key and right part as value
if ( strstr( $arg, "=" ) ) {
list( $var, $value ) = explode( "=", $arg );
$PHORUM["args"][$var] = urldecode( $value );
// get rid of the numbered arg, it is useless.
unset( $PHORUM["args"][$key] );
}
}
}
 
// set forum_id if not set already by
if ( empty( $PHORUM["forum_id"] ) && isset( $PHORUM["args"][0] ) ) {
$PHORUM["forum_id"] = ( int )$PHORUM["args"][0];
}
}
}
 
// set the forum_id to 0 if not set by now.
if ( empty( $PHORUM["forum_id"] ) ) $PHORUM["forum_id"] = 0;
 
// Get the database settings.
if ( empty( $GLOBALS["PHORUM_ALT_DBCONFIG"] ) || $GLOBALS["PHORUM_ALT_DBCONFIG"]==$_REQUEST["PHORUM_ALT_DBCONFIG"] || !defined("PHORUM_WRAPPER") ) {
// Backup display_errors setting.
$orig = ini_get("display_errors");
ini_set("display_errors", 0);
 
// Load configuration.
if (! include_once( "./include/db/config.php" )) {
print '<html><head><title>Phorum error</title></head><body>';
print '<h2>Phorum database configuration error</h2>';
 
// No database configuration found.
if (!file_exists("./include/db/config.php")) { ?>
Phorum has been installed on this server, but the configuration<br/>
for the database connection has not yet been made. Please read<br/>
<a href="docs/install.txt">docs/install.txt</a> for installation instructions. <?php
} else {
$fp = fopen("./include/db/config.php", "r");
// Unable to read the configuration file.
if (!$fp) { ?>
A database configuration file was found in ./include/db/config.php,<br/>
but Phorum was unable to read it. Please check the file permissions<br/>
for this file. <?php
// Unknown error.
} else {
fclose($fp); ?>
A database configuration file was found in ./include/dbconfig.php,<br/>
but it could not be loaded. It possibly contains one or more errors.<br/>
Please check your configuration file. <?php
}
}
 
print '</body></html>';
exit(1);
}
 
// Restore original display_errors setting.
ini_set("display_errors", $orig);
} else {
$PHORUM["DBCONFIG"] = $GLOBALS["PHORUM_ALT_DBCONFIG"];
}
 
// Load the database layer.
include_once( "./include/db/{$PHORUM['DBCONFIG']['type']}.php" );
 
if(!phorum_db_check_connection()){
if(isset($PHORUM["DBCONFIG"]["down_page"])){
header("Location: ".$PHORUM["DBCONFIG"]["down_page"]);
exit();
} else {
echo "The database connection failed. Please check your database configuration in include/db/config.php. If the configuration is okay, check if the database server is running.";
exit();
}
}
 
// get the Phorum settings
phorum_db_load_settings();
 
// a hook for rewriting vars at the beginning of common.php,
//right after loading the settings from the database
phorum_hook( "common_pre", "" );
 
include_once( "./include/cache.php" );
 
// stick some stuff from the settings into the DATA member
$PHORUM["DATA"]["TITLE"] = ( isset( $PHORUM["title"] ) ) ? $PHORUM["title"] : "";
$PHORUM["DATA"]["HTML_TITLE"] = ( !empty( $PHORUM["html_title"] ) ) ? $PHORUM["html_title"] : $PHORUM["DATA"]["TITLE"];
$PHORUM["DATA"]["HEAD_TAGS"] = ( isset( $PHORUM["head_tags"] ) ) ? $PHORUM["head_tags"] : "";
$PHORUM["DATA"]["FORUM_ID"] = $PHORUM["forum_id"];
 
////////////////////////////////////////////////////////////
// only do this stuff if we are not in the admin
 
if ( !defined( "PHORUM_ADMIN" ) ) {
 
// if the Phorum is disabled, display a message.
if(isset($PHORUM["status"]) && $PHORUM["status"]=="disabled"){
if(!empty($PHORUM["disabled_url"])){
header("Location: ".$PHORUM["disabled_url"]);
exit();
} else {
echo "This Phorum is currently disabled. Please contact the web site owner at ".$PHORUM['system_email_from_address']." for more information.\n";
exit();
}
}
 
// checking for upgrade or new install
if ( !isset( $PHORUM['internal_version'] ) ) {
echo "<html><head><title>Phorum error</title></head><body>No Phorum settings were found. Either this is a brand new installation of Phorum or there is an error with your database server. If this is a new install, please <a href=\"admin.php\">go to the admin page</a> to complete the installation. If not, check your database server.</body></html>";
exit();
} elseif ( $PHORUM['internal_version'] < PHORUMINTERNAL ) {
echo "<html><head><title>Error</title></head><body>Looks like you have installed a new version. Go to the admin to complete the upgrade!</body></html>";
exit();
}
 
// load the forum's settings
if ( !empty( $PHORUM["forum_id"] ) ) {
$forum_settings = phorum_db_get_forums( $PHORUM["forum_id"] );
if ( empty( $forum_settings[$PHORUM["forum_id"]] ) ) {
phorum_hook( "common_no_forum", "" );
phorum_redirect_by_url( phorum_get_url( PHORUM_INDEX_URL ) );
exit();
}
$PHORUM = array_merge( $PHORUM, $forum_settings[$PHORUM["forum_id"]] );
} else {
// some defaults we might need if no forum is set (i.e. on the index-page)
$PHORUM['vroot']=0;
$PHORUM['parent_id']=0;
$PHORUM['active']=1;
$PHORUM['folder_flag']=1;
}
 
// stick some stuff from the settings into the DATA member
$PHORUM["DATA"]["NAME"] = ( isset( $PHORUM["name"] ) ) ? $PHORUM["name"] : "";
$PHORUM["DATA"]["DESCRIPTION"] = ( isset( $PHORUM["description"] ) ) ? $PHORUM["description"] : "";
$PHORUM["DATA"]["ENABLE_PM"] = ( isset( $PHORUM["enable_pm"] ) ) ? $PHORUM["enable_pm"] : "";
if ( !empty( $PHORUM["DATA"]["HTML_TITLE"] ) && !empty( $PHORUM["DATA"]["NAME"] ) ) {
$PHORUM["DATA"]["HTML_TITLE"] .= PHORUM_SEPARATOR;
}
$PHORUM["DATA"]["HTML_TITLE"] .= $PHORUM["DATA"]["NAME"];
 
// check the user session
include_once( "./include/users.php" );
if ( phorum_user_check_session() ) {
$PHORUM["DATA"]["LOGGEDIN"] = true;
 
if(!$PHORUM["tight_security"] || phorum_user_check_session( PHORUM_SESSION_SHORT_TERM )){
$PHORUM["DATA"]["FULLY_LOGGEDIN"] = true;
} else {
$PHORUM["DATA"]["FULLY_LOGGEDIN"] = false;
}
 
// Let the templates know whether we have new private messages.
$PHORUM["DATA"]["NEW_PRIVATE_MESSAGES"] = 0;
if ( $PHORUM["enable_pm"] && isset($PHORUM["user"]["new_private_messages"]) ) {
$PHORUM["DATA"]["NEW_PRIVATE_MESSAGES"] = $PHORUM["user"]["new_private_messages"];
}
 
$PHORUM["DATA"]["notice_messages"] = false;
$PHORUM["DATA"]["notice_users"] = false;
$PHORUM["DATA"]["notice_groups"] = false;
 
// if moderator notifications are on and the person is a mod, lets find out if anything is new
if ( $PHORUM["enable_moderator_notifications"] ) {
$forummodlist = phorum_user_access_list( PHORUM_USER_ALLOW_MODERATE_MESSAGES );
if ( count( $forummodlist ) > 0 ) {
$PHORUM["DATA"]["notice_messages"] = ( count( phorum_db_get_unapproved_list( $forummodlist, true ) ) > 0 );
$PHORUM["DATA"]["notice_messages_url"] = phorum_get_url( PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_UNAPPROVED );
}
if ( phorum_user_access_allowed( PHORUM_USER_ALLOW_MODERATE_USERS ) ) {
$PHORUM["DATA"]["notice_users"] = ( count( phorum_db_user_get_unapproved() ) > 0 );
$PHORUM["DATA"]["notice_users_url"] = phorum_get_url( PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_USERS );
}
if ( phorum_user_allow_moderate_group() ) {
$groups = phorum_user_get_moderator_groups();
if ( count( $groups ) > 0 ) {
$PHORUM["DATA"]["notice_groups"] = count( phorum_db_get_group_members( array_keys( $groups ), PHORUM_USER_GROUP_UNAPPROVED ) );
$PHORUM["DATA"]["notice_groups_url"] = phorum_get_url( PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION );
}
}
}
 
$PHORUM["DATA"]["notice_all"] = ( $PHORUM["enable_pm"] && phorum_page!="pm" && $PHORUM["DATA"]["NEW_PRIVATE_MESSAGES"] ) || $PHORUM["DATA"]["notice_messages"] || $PHORUM["DATA"]["notice_users"] || $PHORUM["DATA"]["notice_groups"];
 
// if the user has overridden thread settings, change it here.
if ( !isset( $PHORUM['display_fixed'] ) || !$PHORUM['display_fixed'] ) {
if ( $PHORUM["user"]["threaded_list"] == PHORUM_THREADED_ON ) {
$PHORUM["threaded_list"] = true;
} elseif ( $PHORUM["user"]["threaded_list"] == PHORUM_THREADED_OFF ) {
$PHORUM["threaded_list"] = false;
}
if ( $PHORUM["user"]["threaded_read"] == PHORUM_THREADED_ON ) {
$PHORUM["threaded_read"] = true;
} elseif ( $PHORUM["user"]["threaded_read"] == PHORUM_THREADED_OFF ) {
$PHORUM["threaded_read"] = false;
}
}
}
 
// set up the blank user if not logged in
if ( empty( $PHORUM["user"] ) ) {
$PHORUM["user"] = array( "user_id" => 0, "username" => "", "admin" => false, "newinfo" => array() );
$PHORUM["DATA"]["LOGGEDIN"] = false;
}
 
 
// a hook for rewriting vars in common.php after loading the user
phorum_hook( "common_post_user", "" );
 
 
// set up the template
 
// check for a template being passed on the url
// only use valid template names
if ( !empty( $PHORUM["args"]["template"] ) ) {
$template = basename( $PHORUM["args"]["template"] );
if ($template != '..') {
$PHORUM["template"] = $template;
}
}
 
// user output buffering so we don't get header errors
// not loaded if we are running an external or scheduled script
if (! defined('PHORUM_SCRIPT')) {
ob_start();
include_once( phorum_get_template( "settings" ) );
ob_end_clean();
}
 
// get the language file
if ( ( !isset( $PHORUM['display_fixed'] ) || !$PHORUM['display_fixed'] ) && isset( $PHORUM['user']['user_language'] ) && !empty($PHORUM['user']['user_language']) )
$PHORUM['language'] = $PHORUM['user']['user_language'];
 
if ( !isset( $PHORUM["language"] ) || empty( $PHORUM["language"] ) || !file_exists( "./include/lang/$PHORUM[language].php" ) )
$PHORUM["language"] = $PHORUM["default_language"];
 
if ( file_exists( "./include/lang/$PHORUM[language].php" ) ) {
include_once( "./include/lang/$PHORUM[language].php" );
}
// load languages for localized modules
if ( isset( $PHORUM["hooks"]["lang"] ) && is_array($PHORUM["hooks"]["lang"]) ) {
foreach( $PHORUM["hooks"]["lang"]["mods"] as $mod ) {
// load mods for this hook
if ( file_exists( "./mods/$mod/lang/$PHORUM[language].php" ) ) {
include_once "./mods/$mod/lang/$PHORUM[language].php";
}
elseif ( file_exists( "./mods/$mod/lang/english.php" ) ) {
include_once "./mods/$mod/lang/english.php";
}
}
}
 
// HTML titles can't contain HTML code, so we strip HTML tags
// and HTML escape the title.
$PHORUM["DATA"]["HTML_TITLE"] = htmlentities(strip_tags($PHORUM["DATA"]["HTML_TITLE"]), ENT_COMPAT, $PHORUM["DATA"]["CHARSET"]);
 
// if the Phorum is disabled, display a message.
if(isset($PHORUM["status"]) && $PHORUM["status"]=="admin-only" && !$PHORUM["user"]["admin"]){
// set all our URL's
phorum_build_common_urls();
 
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["AdminOnlyMessage"];
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template("message");
phorum_hook("before_footer");
include phorum_get_template("footer");
exit();
 
}
 
 
// a hook for rewriting vars at the end of common.php
phorum_hook( "common", "" );
 
$PHORUM['DATA']['USERINFO'] = $PHORUM['user'];
$PHORUM['DATA']['PHORUM_PAGE'] = phorum_page;
$PHORUM['DATA']['USERTRACK'] = $PHORUM['track_user_activity'];
}
 
 
//////////////////////////////////////////////////////////
// functions
 
/**
* A common function to check that a user is logged in
*/
function phorum_require_login()
{
$PHORUM = $GLOBALS['PHORUM'];
if ( !$PHORUM["user"]["user_id"] ) {
$url = phorum_get_url( PHORUM_LOGIN_URL, "redir=" . urlencode( $PHORUM["http_path"] . "/" . basename( $_SERVER["PHP_SELF"] ) . "?" . $_SERVER["QUERY_STRING"] ) );
phorum_redirect_by_url( $url );
exit();
}
}
 
/**
* A common function for checking the read-permissions for a forum-page
* returns false if access is not allowed and an error page-was output
*/
function phorum_check_read_common()
{
$PHORUM = $GLOBALS['PHORUM'];
 
$retval = true;
 
if ( $PHORUM["forum_id"] > 0 && !$PHORUM["folder_flag"] && !phorum_user_access_allowed( PHORUM_USER_ALLOW_READ ) ) {
if ( $PHORUM["DATA"]["LOGGEDIN"] ) {
// if they are logged in and not allowed, they don't have rights
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoRead"];
} else {
// check if they could read if logged in.
// if so, let them know to log in.
if ( ( empty( $PHORUM["DATA"]["POST"]["parentid"] ) && $PHORUM["reg_perms"] &PHORUM_USER_ALLOW_READ ) ) {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["PleaseLoginRead"];
} else {
$PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["NoRead"];
}
}
 
phorum_build_common_urls();
 
include phorum_get_template( "header" );
phorum_hook( "after_header" );
include phorum_get_template( "message" );
phorum_hook( "before_footer" );
include phorum_get_template( "footer" );
 
$retval = false;
}
 
return $retval;
}
 
// used for all url creation.
function phorum_get_url()
{
$PHORUM = $GLOBALS["PHORUM"];
 
$args = "";
$url = "";
$suffix = "";
$add_forum_id = false;
$add_get_vars = true;
 
$argv = func_get_args();
$type = array_shift( $argv );
 
switch ( $type ) {
case PHORUM_LIST_URL:
$page = "list";
if ( empty( $argv ) ) $add_forum_id = true;
break;
case PHORUM_READ_URL:
$page = "read";
$add_forum_id = true;
if ( !empty( $argv[1] ) && is_numeric( $argv[1] ) ) $suffix = "#msg-$argv[1]";
break;
case PHORUM_FOREIGN_READ_URL:
$page = "read";
if ( !empty( $argv[2] ) && is_numeric( $argv[2] ) ) $suffix = "#msg-$argv[2]";
break;
case PHORUM_REPLY_URL:
if(isset($PHORUM["reply_on_read_page"]) && $PHORUM["reply_on_read_page"]){
$page = "read";
$suffix = "#REPLY";
} else {
$page = "posting";
// For reply on a separate page, we call posting.php on its own.
// In that case argv[0] is the editor mode we want to use
// (reply in this case). Currently, the thread id is in argv[0],
// but we don't need that one for posting.php. So we simply
// replace argv[0] with the correct argument.
$argv[0] = "reply";
}
$add_forum_id = true;
break;
case PHORUM_POSTING_URL:
$page = "posting";
$add_forum_id = true;
break;
case PHORUM_REDIRECT_URL:
$page = "redirect";
$add_forum_id = false;
break;
case PHORUM_SEARCH_URL:
$page = "search";
$add_forum_id = true;
break;
case PHORUM_SEARCH_ACTION_URL:
$page = "search";
$add_get_vars = true;
break;
case PHORUM_DOWN_URL:
$page = "down";
$add_forum_id = true;
break;
case PHORUM_VIOLATION_URL:
$page = "violation";
$add_forum_id = true;
break;
case PHORUM_INDEX_URL:
$page = "index";
break;
case PHORUM_LOGIN_URL:
$page = "login";
$add_forum_id = true;
break;
case PHORUM_LOGIN_ACTION_URL:
$page = "login";
break;
case PHORUM_REGISTER_URL:
$page = "register";
$add_forum_id = true;
break;
case PHORUM_REGISTER_ACTION_URL:
$page = "register";
break;
case PHORUM_PROFILE_URL:
$page = "profile";
$add_forum_id = true;
break;
case PHORUM_SUBSCRIBE_URL:
$page = "subscribe";
$add_forum_id = true;
break;
case PHORUM_MODERATION_URL:
$page = "moderation";
$add_forum_id = true;
break;
case PHORUM_MODERATION_ACTION_URL:
$page = "moderation";
$add_get_vars = false;
break;
case PHORUM_PREPOST_URL:
$page = "control";
$argv[] = "panel=messages";
$add_forum_id = true;
break;
case PHORUM_CONTROLCENTER_URL:
$page = "control";
$add_forum_id = true;
break;
case PHORUM_CONTROLCENTER_ACTION_URL:
$page = "control";
break;
case PHORUM_PM_URL:
$page = "pm";
$add_forum_id = true;
break;
case PHORUM_PM_ACTION_URL:
$page = "pm";
break;
case PHORUM_FILE_URL:
$page = "file";
$add_forum_id = true;
break;
case PHORUM_FOLLOW_URL:
$page = "follow";
$add_forum_id = true;
break;
case PHORUM_FOLLOW_ACTION_URL:
$page = "follow";
$add_forum_id = false;
break;
case PHORUM_REPORT_URL:
$page = "report";
$add_forum_id = true;
break;
case PHORUM_RSS_URL:
switch(phorum_page){
case "list":
$add_forum_id = true;
break;
case "read":
$add_forum_id = true;
array_push($argv, $PHORUM["args"]["1"]);
break;
}
$page = "rss";
break;
// this is for adding own generic urls
case PHORUM_CUSTOM_URL:
$page = array_shift($argv); // first arg is our page
$add_forum_id_tmp=array_shift($argv); // second determining if we should add the forum_id
$add_forum_id = $add_forum_id_tmp?true:false;
break;
 
case PHORUM_BASE_URL:
// only to flag phorum_custom_get_url() that base url is requested
$page = '';
break;
 
default:
trigger_error( "Unhandled page type.", E_USER_WARNING );
break;
}
 
// build the query string
$query_items = array();
 
if ( $add_forum_id ) {
$query_items[] = ( int )$PHORUM["forum_id"];
}
 
if ( count( $argv ) > 0 ) {
$query_items = array_merge( $query_items, $argv );
}
 
if ( !empty( $PHORUM["DATA"]["GET_VARS"] ) && $add_get_vars ) {
$query_items = array_merge( $query_items, $PHORUM["DATA"]["GET_VARS"] );
}
// build the url
if ( !function_exists( "phorum_custom_get_url" ) ) {
if ($type == PHORUM_BASE_URL) return $PHORUM["http_path"] . '/';
 
$url = "$PHORUM[http_path]/$page." . PHORUM_FILE_EXTENSION;
 
if ( count( $query_items ) ) $url .= "?" . implode( ",", $query_items );
 
if ( !empty( $suffix ) ) $url .= $suffix;
} else {
$url = phorum_custom_get_url( $page, $query_items, $suffix );
}
 
return $url;
}
 
// retrieve the appropriate template file name
function phorum_get_template( $page, $is_include = false )
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( ( !isset( $PHORUM['display_fixed'] ) || !$PHORUM['display_fixed'] ) && isset( $PHORUM['user']['user_template'] ) && !empty($PHORUM['user']['user_template'])) {
$PHORUM['template'] = $PHORUM['user']['user_template'];
}
 
// If no user template is set or if the template folder cannot be found,
// fallback to the default template.
if (empty($PHORUM["template"]) || !file_exists("./templates/{$PHORUM['template']}")) {
$PHORUM["template"] = $PHORUM["default_template"];
}
 
$tpl = "./templates/$PHORUM[template]/$page";
// check for straight PHP file
if ( file_exists( "$tpl.php" ) ) {
$phpfile = "$tpl.php";
} else {
// not there, look for a template
$tplfile = "$tpl.tpl";
$safetemplate = str_replace("-", "_", $PHORUM["template"]);
$safepage = str_replace("-", "_", $page);
$phpfile = "$PHORUM[cache]/tpl-$safetemplate-$safepage-" .
($is_include ? "include" : "toplevel") . "-" .
md5( dirname( __FILE__ ) ) . ".php";
 
if ( $is_include || !file_exists( $phpfile ) ) {
include_once "./include/templates.php";
phorum_import_template( $tplfile, $phpfile );
}
}
 
return $phpfile;
}
 
// creates URLs used on most pages
function phorum_build_common_urls()
{
$PHORUM=$GLOBALS['PHORUM'];
 
// those links are only needed in forums, not in folders
if(isset($PHORUM['folder_flag']) && !$PHORUM['folder_flag']) {
$GLOBALS["PHORUM"]["DATA"]["URL"]["TOP"] = phorum_get_url( PHORUM_LIST_URL );
$GLOBALS["PHORUM"]["DATA"]["URL"]["MARKREAD"] = phorum_get_url( PHORUM_LIST_URL, "markread=1" );
$GLOBALS["PHORUM"]["DATA"]["URL"]["POST"] = phorum_get_url( PHORUM_POSTING_URL );
$GLOBALS["PHORUM"]["DATA"]["URL"]["SUBSCRIBE"] = phorum_get_url( PHORUM_SUBSCRIBE_URL );
}
 
// those are general urls, needed nearly everywhere
$GLOBALS["PHORUM"]["DATA"]["URL"]["SEARCH"] = phorum_get_url( PHORUM_SEARCH_URL );
 
// RSS-Url only makes sense on a couple of pages
if(isset($PHORUM['use_rss']) && $PHORUM['use_rss']
&& (phorum_page=="index" || phorum_page=="list" || phorum_page=="read")){
$GLOBALS["PHORUM"]["DATA"]["URL"]["RSS"] = phorum_get_url( PHORUM_RSS_URL );
}
 
$index_id=-1;
// in a folder
 
if( $PHORUM['folder_flag'] && phorum_page != 'index'
&& ($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id'])) {
// folder where we usually don't show the index-link but on
// additional pages like search and login its shown
$index_id=$PHORUM['forum_id'];
 
} elseif( ( $PHORUM['folder_flag'] &&
($PHORUM['forum_id'] != 0 && $PHORUM['vroot'] != $PHORUM['forum_id'])) ||
(!$PHORUM['folder_flag'] && $PHORUM['active'])) {
// either a folder where the link should be shown (not vroot or root)
// or an active forum where the link should be shown
 
if(isset($PHORUM["use_new_folder_style"]) && $PHORUM["use_new_folder_style"] ) {
// go to root or vroot
$index_id=$PHORUM["vroot"]; // vroot is either 0 (root) or another id
 
} else {
// go to parent
$index_id=$PHORUM["parent_id"]; // parent_id is always set now
 
}
 
}
if($index_id > -1) {
// check if its the full root, avoid adding an id in this case (SE-optimized ;))
if (!empty($index_id))
$GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"] = phorum_get_url( PHORUM_INDEX_URL, $index_id );
else
$GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"] = phorum_get_url( PHORUM_INDEX_URL );
}
 
// these urls depend on the login-status of a user
if ( $GLOBALS["PHORUM"]["DATA"]["LOGGEDIN"] ) {
$GLOBALS["PHORUM"]["DATA"]["URL"]["LOGINOUT"] = phorum_get_url( PHORUM_LOGIN_URL, "logout=1" );
$GLOBALS["PHORUM"]["DATA"]["URL"]["REGISTERPROFILE"] = phorum_get_url( PHORUM_CONTROLCENTER_URL );
$GLOBALS["PHORUM"]["DATA"]["URL"]["PM"] = phorum_get_url( PHORUM_PM_URL );
} else {
$GLOBALS["PHORUM"]["DATA"]["URL"]["LOGINOUT"] = phorum_get_url( PHORUM_LOGIN_URL );
$GLOBALS["PHORUM"]["DATA"]["URL"]["REGISTERPROFILE"] = phorum_get_url( PHORUM_REGISTER_URL );
}
}
 
// calls phorum mod functions
function phorum_hook( $hook, $arg = "" )
{
$PHORUM = $GLOBALS["PHORUM"];
 
if ( isset( $PHORUM["hooks"][$hook] ) && is_array($PHORUM["hooks"][$hook])) {
 
foreach( $PHORUM["hooks"][$hook]["mods"] as $mod ) {
// load mods for this hook
if ( file_exists( "./mods/$mod/$mod.php" ) ) {
include_once "./mods/$mod/$mod.php";
} elseif ( file_exists( "./mods/$mod.php" ) ) {
include_once "./mods/$mod.php";
}
}
 
foreach( $PHORUM["hooks"][$hook]["funcs"] as $func ) {
// call functions for this hook
if ( function_exists( $func ) ) {
$arg = call_user_func( $func, $arg );
}
}
}
 
return $arg;
}
 
// HTML encodes a string
function phorum_html_encode( $string )
{
$ret_string = "";
$len = strlen( $string );
for( $x = 0;$x < $len;$x++ ) {
$ord = ord( $string[$x] );
$ret_string .= "&#$ord;";
}
return $ret_string;
}
 
// removes slashes from all array-entries
function phorum_recursive_stripslashes( $array )
{
if ( !is_array( $array ) ) {
return $array;
} else {
foreach( $array as $key => $value ) {
if ( !is_array( $value ) )
$array[$key] = stripslashes( $value );
else
$array[$key] = phorum_recursive_stripslashes( $value );
}
}
return $array;
}
 
// returns the available templates as an array
function phorum_get_template_info()
{
$tpls = array();
 
$d = dir( "./templates" );
while ( false !== ( $entry = $d->read() ) ) {
if ( $entry != "." && $entry != ".." && file_exists( "./templates/$entry/info.php" ) ) {
include "./templates/$entry/info.php";
if ( !isset( $template_hide ) || empty( $template_hide ) || defined( "PHORUM_ADMIN" ) ) {
$tpls[$entry] = "$name $version";
} else {
unset( $template_hide );
}
}
}
 
return $tpls;
}
 
// returns the available languages as an array
function phorum_get_language_info()
{
$langs = array();
 
$d = dir( "./include/lang" );
while ( false !== ( $entry = $d->read() ) ) {
if ( substr( $entry, -4 ) == ".php" && is_file( "./include/lang/$entry" ) ) {
@include "./include/lang/$entry";
if ( !isset( $language_hide ) || empty( $language_hide ) || defined( "PHORUM_ADMIN" ) ) {
$langs[str_replace( ".php", "", $entry )] = $language;
} else {
unset( $language_hide );
}
}
}
 
return $langs;
}
 
function phorum_redirect_by_url( $redir_url )
{
if ( stristr( $_SERVER['SERVER_SOFTWARE'], "Microsoft-IIS" ) ) {
// the ugly IIS-hack to avoid crashing IIS
print "<html><head>\n<title>Redirecting ...</title>\n";
print "<meta http-equiv=\"refresh\" content=\"0; URL=$redir_url\">";
print "</head>\n";
print "<body><a href=\"$redir_url\">Redirecting ...</a></body>\n";
print "</html>";
} else {
// our standard-way
header( "Location: $redir_url" );
}
exit(0);
}
 
// might remove these, might not. Need it for debugging.
function print_var( $var )
{
echo "<xmp>";
print_r( $var );
echo "</xmp>";
}
 
?>
/branches/v2.0-narmer/client/phorum/langues/phorum.langue.fr.inc.php
New file
0,0 → 1,64
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Fichier de traduction en français de l'application contact
*
*@package contact
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Ecole et Nature 2005
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
define ('CON_CONTACTEZ_NOUS', 'Contactez-nous');
define ('CON_VOTRE_MESSAGE', 'Votre message');
define ('CON_A_ETE_ENVOYE', 'a bien été envoyé.');
define ('CON_EXPEDITEUR', 'Expéditeur (entrez ici votre adresse mail): ') ;
define ('CON_EMAIL_REQUIS','veuillez saisir votre adresse mail pour que l\'on puisse vous répondre');
define ('CON_EMAIL_INCORRECT','adresse mail incorrecte (elle doit etre de la forme nom@domaine.ext)');
define ('CON_DESTINATAIRE', 'Destinataire : ') ;
define ('CON_SUJET', 'Sujet : ') ;
define ('CON_SUJET_REQUIS', 'veuillez saisir un sujet pour le message');
define ('CON_MESSAGE', 'Message : ') ;
define ('CON_MESSAGE_REQUIS', 'veuillez saisir le message');
define ('CON_ENVOYER', 'Envoyer le message') ;
define ('CON_ENVOYER_NOUS_MAIL', 'Envoyez-nous un message électronique (courriel):');
define ('CON_CHAMPS_REQUIS','champs obligatoires');
define ('CON_ERREUR_SAISIE','Erreur de saisie des champs:');
define ('CON_VEUILLEZ_CORRIGER','Veuillez corriger, SVP.');
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
* Revision 1.2 2006/01/19 10:24:37 florian
* champs obligatoires pour le formulaire de saisie
*
* Revision 1.1 2005/09/22 13:28:50 florian
* Application de contact, pour envoyer des mails. Reste a faire: configuration pour choisir les destinataires dans l'annuaire.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/phorum/phorum.php
New file
0,0 → 1,107
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Phorum
*
* Application de forums
*
*@package inscription
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*
*@copyright Outils-Reseaux 2006-2010
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/phorum.config.inc.php';
chdir($PHORUM_DIR);
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
// create a namespace for Phorum
function phorum_namespace($page)
{
global $PHORUM; // globalize the $PHORUM array
include_once("./$page.php");
}
 
function phorum_custom_get_url ($page, $query_items, $suffix)
{
// on défini l'URL de tous les liens (qui conservent les GET) et rajoute les pages
$url_reecrite = $_SERVER['REQUEST_URI'];
$decoupe=explode("&param=",$url_reecrite);
$url_reecrite = $decoupe[0];
$url = "$url_reecrite&param=$page";
 
if(count($query_items)) $url.=",".implode(",", $query_items);
 
if(!empty($suffix)) $url.=$suffix;
 
return $url;
}
 
 
function afficherContenuCorps() {
$res = '' ;
ob_start();
$decoupe=explode("&param=",$_SERVER["QUERY_STRING"]);
if (isset($decoupe[1])) $url_reecrite = $decoupe[1]; else $url_reecrite = '';
$match = '' ;
if(preg_match("/^([a-z]+),?/", $url_reecrite, $match)){
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = str_replace($match[0], "", $url_reecrite);
$page = basename($match[1]);
} elseif(isset($_REQUEST["page"])){
$page = basename($_REQUEST["page"]);
$getparts = array();
foreach (explode("&", $_SERVER["QUERY_STRING"]) as $q) {
if (substr($q, 0, 5) != "page=") {
$getparts[] = $q;
}
}
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = implode(",", $getparts);
} else {
$page="index";
}
if(file_exists("./$page.php")){
phorum_namespace($page);
}
$res .= ob_get_clean();
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/contact/langues/contact.langue.fr.inc.php
New file
0,0 → 1,61
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: contact.langue.fr.inc.php,v 1.2 2006-01-19 10:24:37 florian Exp $
/**
* Fichier de traduction en français de l'application contact
*
*@package contact
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Ecole et Nature 2005
*@version $Revision: 1.2 $ $Date: 2006-01-19 10:24:37 $
// +------------------------------------------------------------------------------------------------------+
*/
define ('CON_CONTACTEZ_NOUS', 'Contactez-nous');
define ('CON_VOTRE_MESSAGE', 'Votre message');
define ('CON_A_ETE_ENVOYE', 'a bien été envoyé.');
define ('CON_EXPEDITEUR', 'Expéditeur (entrez ici votre adresse mail): ') ;
define ('CON_EMAIL_REQUIS','veuillez saisir votre adresse mail pour que l\'on puisse vous répondre');
define ('CON_EMAIL_INCORRECT','adresse mail incorrecte (elle doit etre de la forme nom@domaine.ext)');
define ('CON_DESTINATAIRE', 'Destinataire : ') ;
define ('CON_SUJET', 'Sujet : ') ;
define ('CON_SUJET_REQUIS', 'veuillez saisir un sujet pour le message');
define ('CON_MESSAGE', 'Message : ') ;
define ('CON_MESSAGE_REQUIS', 'veuillez saisir le message');
define ('CON_ENVOYER', 'Envoyer le message') ;
define ('CON_ENVOYER_NOUS_MAIL', 'Envoyez-nous un message électronique (courriel):');
define ('CON_CHAMPS_REQUIS','champs obligatoires');
define ('CON_ERREUR_SAISIE','Erreur de saisie des champs:');
define ('CON_VEUILLEZ_CORRIGER','Veuillez corriger, SVP.');
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/09/22 13:28:50 florian
* Application de contact, pour envoyer des mails. Reste a faire: configuration pour choisir les destinataires dans l'annuaire.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/contact/contact.php
New file
0,0 → 1,127
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: contact.php,v 1.3 2006-04-28 11:35:37 florian Exp $
/**
* Contact
*
* Un module d'envoi de mails a une personne de l'annuaire, choisie par une liste déroulante
*
*@package inscription
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*
*@copyright Réseau Ecole et Nature 2005
*@version $Revision: 1.3 $ $Date: 2006-04-28 11:35:37 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
 
function afficherContenuCorps() {
include_once 'client/contact/langues/contact.langue.'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php'; //appel du fichier de constantes des langues
$url = preg_replace ('/&amp;/', '&', $GLOBALS['_GEN_commun']['url']->getURL()) ;
if (isset($_POST['Destinataire'])) {
$headers = 'From: '.$_POST['Expediteur'].' <'.$_POST['Expediteur'].'>'."\n";
$headers .= "X-Mailler: Florian\n";
if ($_POST['Destinataire']==1) $destinataire='isabelle.lepeule@ecole-et-nature.org';
elseif ($_POST['Destinataire']==2) $destinataire='roland.gerard@ecole-et-nature.org';
elseif ($_POST['Destinataire']==3) $destinataire='fabienne.chadenier@ecole-et-nature.org';
elseif ($_POST['Destinataire']==4) $destinataire='gaelle.haussaire@ecole-et-nature.org';
elseif ($_POST['Destinataire']==5) $destinataire='gregoire.delforge@ecole-et-nature.org';
elseif ($_POST['Destinataire']==6) $destinataire='delphine.vinck@ecole-et-nature.org';
elseif ($_POST['Destinataire']==7) $destinataire='catherine.stoven@ecole-et-nature.org';
elseif ($_POST['Destinataire']==8) $destinataire='florian@ecole-et-nature.org';
elseif ($_POST['Destinataire']==0) $destinataire='info@ecole-et-nature.org';
mail($destinataire, $_POST['Subject'], $_POST['Text'], $headers); // Envoi du mail
$message='<p style="clear:both;border: 2px solid #F00;padding:5px;color:#F00;background:#FFF;text-decoration: blink;">'.CON_VOTRE_MESSAGE.' <em style="font-style: italic;color:#F00;background:#FFF;"> '.$_POST['Subject'].' </em> '.CON_A_ETE_ENVOYE.'</p>';
}
$res='';
if (isset($message)) {$res .= $message;}
$res .= '<h1>'.CON_CONTACTEZ_NOUS.'</h1>'."\n";
$res .= '<br />'."\n";
$res .= '<h3>Adresse postale:</h3>'."\n";
$res .= '<strong>Réseau Ecole et Nature</strong><br />'."\n";
$res .= 'Espace République<br />'."\n";
$res .= '20 rue de la République<br />'."\n";
$res .= '34 000 Montpellier'."\n";
$res .= '<br /><br />'."\n";
$res .= '<h3>Coordonnées téléphoniques:</h3>Tél : 04 67 06 18 70<br />'."\n";
$res .= 'Fax : 04 67 92 02 58'."\n";
$res .= '<br /><br />'."\n";
$res .= '<h3>'.CON_ENVOYER_NOUS_MAIL.'</h3>'."\n";
$form_contact = new HTML_QuickForm('inscription', 'post', $url);
$squelette =& $form_contact->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<label>{label}&nbsp;</label><br />'."\n".'{element}'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".'<br />'."\n");
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire">* {requiredNote}</span>'."\n");
$option=array('style'=>'width:500px;', 'maxlength'=>100);
$form_contact->setRequiredNote(CON_CHAMPS_REQUIS) ;
$form_contact->setJsWarnings(CON_ERREUR_SAISIE,CON_VEUILLEZ_CORRIGER);
$form_contact->addElement('text', 'Expediteur', CON_EXPEDITEUR, $option);
$form_contact->addRule('Expediteur', CON_EMAIL_REQUIS, 'required','', 'client') ;
$form_contact->addRule('Expediteur', CON_EMAIL_INCORRECT, 'email', '', 'client') ;
$liste_destinataires[0]='service d\'information générale';
$liste_destinataires[1]='relations nationales';
$liste_destinataires[2]='relations internationales';
$liste_destinataires[3]='formations et professionnalisation';
$liste_destinataires[4]='dispositifs pédagogiques';
$liste_destinataires[5]='soutien à l\'organisation des acteurs';
$liste_destinataires[6]='communication / édition';
$liste_destinataires[7]='service de comptabilité';
$liste_destinataires[8]='service informatique / hébergement Internet';
$option=array('style'=>'width:500px;');
$form_contact->addElement('select', 'Destinataire', CON_DESTINATAIRE, $liste_destinataires, $option);
$option=array('style'=>'width:500px;','maxlength'=>100);
$form_contact->addElement('text', 'Subject', CON_SUJET, $option);
$form_contact->addRule('Subject', CON_SUJET_REQUIS, 'required','', 'client') ;
$option=array('style'=>'width:500px;height:200px;white-space: pre;padding:3px;');
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
$formtexte= new HTML_QuickForm_textarea('Text', CON_MESSAGE, $option);
$form_contact->addElement($formtexte) ;
$form_contact->addRule('Text', CON_MESSAGE_REQUIS, 'required','', 'client') ;
$form_contact->addElement('submit', 'Envoyer', CON_ENVOYER);
$res .= $form_contact->toHTML();
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/01/19 10:24:37 florian
* champs obligatoires pour le formulaire de saisie
*
* Revision 1.1 2005/09/22 13:28:50 florian
* Application de contact, pour envoyer des mails. Reste a faire: configuration pour choisir les destinataires dans l'annuaire.
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/upload/vide.txt
--- bazar/bazar.head.php (revision 0)
+++ bazar/bazar.head.php (revision 1976)
@@ -0,0 +1,14 @@
+<?php
+include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
+
+$requete = 'SELECT bn_id_nature, bn_label_nature FROM bazar_nature' ;
+$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
+if (DB::isError($resultat)) {
+ die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
+}
+echo '<link rel="alternate" type="application/rss+xml" title="'.BAZ_TOUTES_LES_ANNONCES.'" href="http://'.$_SERVER['HTTP_HOST'].'/bazar/bazarRSS.php" />'."\n";
+while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
+ echo '<link rel="alternate" type="application/rss+xml" title="'.$ligne['bn_label_nature'].'" href="http://'.$_SERVER['HTTP_HOST'].'/bazar/bazarRSS.php?annonce='.$ligne['bn_label_nature'].'" />'."\n";
+}
+
+?>
/branches/v2.0-narmer/client/bazar/bazar.php
New file
0,0 → 1,356
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.php,v 1.40 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.40 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
error_reporting(E_ALL);
require_once PAP_CHEMIN_API_PEAR.'DB.php' ;
require_once PAP_CHEMIN_API_PEAR.'Auth.php' ;
require_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
require_once 'bibliotheque/bazar.class.php';
require_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazar
 
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
}
 
//**********************************************************************************************************
//initialisation des paramêtres papyrus
//**********************************************************************************************************
//si un parametre est précisé dans le gestionnaire de menus papyrus, on le prends en compte
 
//parametre action pour lancer directement l'action indiquée
if (!isset($_GET['action'])and(isset($GLOBALS['_GEN_commun']['info_application']->action))) {
$_GET['action']=$GLOBALS['_GEN_commun']['info_application']->action;
}
 
//parametre voir_menu pour afficher le menu ou pas (par défaut, il l'affiche)
if ((isset($GLOBALS['_GEN_commun']['info_application']->voir_menu))and($GLOBALS['_GEN_commun']['info_application']->voir_menu==0)) {
$GLOBALS['_BAZAR_']['affiche_menu']=0;
}
else $GLOBALS['_BAZAR_']['affiche_menu']=1;
 
//parametre categorie_nature pour préciser quels types de fiches sont montrees (par défaut, il affiche les id_menu=0)
if (isset($GLOBALS['_GEN_commun']['info_application']->categorie_nature)) {
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature;
}
elseif (isset($_REQUEST['categorie_nature'])) {
$GLOBALS['_BAZAR_']['categorie_nature']=$_REQUEST['categorie_nature'];
}
else $GLOBALS['_BAZAR_']['categorie_nature']=0;
 
//parametre id_nature pour afficher un certain type de fiche (par défaut, tous les types de fiches)
if (isset($GLOBALS['_GEN_commun']['info_application']->id_nature)) {
$GLOBALS['_BAZAR_']['id_typeannonce']=$GLOBALS['_GEN_commun']['info_application']->id_nature;
}
elseif (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce']='toutes';
 
//**********************************************************************************************************
//initialisation de la variable globale de bazar
//**********************************************************************************************************
$GLOBALS['id_user']=$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
 
//Recuperer les eventuelles variables passees en GET ou en POST
if (isset($_REQUEST['id_fiche'])) {
$GLOBALS['_BAZAR_']['id_fiche']=$_REQUEST['id_fiche'];
// récupération du type d'annonce à partir de la fiche
$requete = 'select bf_ce_nature from bazar_fiche where bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'] ;
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage().'<br />'.$resultat->getInfoDebug();
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$GLOBALS['_BAZAR_']['id_typeannonce'] = $ligne->bf_ce_nature ;
$resultat->free();
}
if (isset($_REQUEST['typeannonce'])) {
$GLOBALS['_BAZAR_']['id_typeannonce']=$_REQUEST['typeannonce'];
}
 
if ((isset($GLOBALS['_BAZAR_']['id_typeannonce']))and($GLOBALS['_BAZAR_']['id_typeannonce']!='toutes')) {
$requete = 'SELECT bn_label_nature, bn_condition, bn_template, bn_commentaire, bn_appropriation, bn_image_titre, bn_image_logo FROM bazar_nature WHERE bn_id_nature = '.$GLOBALS['_BAZAR_']['id_typeannonce'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
$GLOBALS['_BAZAR_']['template']=$ligne['bn_template'];
$GLOBALS['_BAZAR_']['commentaire']=$ligne['bn_commentaire'];
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation'];
$GLOBALS['_BAZAR_']['image_titre']=$ligne['bn_image_titre'];
$GLOBALS['_BAZAR_']['image_logo']=$ligne['bn_image_logo'];
}
if (!isset($GLOBALS['_BAZAR_']['id_typeannonce'])) $GLOBALS['_BAZAR_']['id_typeannonce'] = 'toutes' ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
if ($GLOBALS['_BAZAR_']['affiche_menu']) {
//---------------le menu de l'appli-----------
function afficherContenuNavigation () {
$res ='<ul id="BAZ_menu">'."\n";
//partie consultation d'annonces
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
$res .= '<li id="consulter"';
if (!isset($_GET['action']) || (isset($_GET['action']) && ($_GET['action']==BAZ_VOIR_TOUTES_ANNONCES || $_GET['action']==BAZ_VOIR_FICHE))) $res .=' class="onglet_actif" ';
$res .='><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_CONSULTER.'</a>'."\n".'</li>'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
// Mes fiches
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
$res .= '<li id="consulter"';
if (isset($_GET['action']) && $_GET['action']==BAZ_ACTION_VOIR_VOS_ANNONCES) $res .=' class="onglet_actif" ';
$res .= '><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_VOIR_VOS_ANNONCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
//partie abonnement aux annonces
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);
$res .= '<li id="inscrire"';
if (isset($_GET['action']) && $_GET['action']==BAZ_S_INSCRIRE) $res .=' class="onglet_actif" ';
$res .= '><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_ABONNER.'</a></li>'."\n" ;
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
//partie saisie d'annonces
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
$res .= '<li id="deposer"';
if (isset($_GET['action']) && ($_GET['action']==BAZ_DEPOSER_ANNONCE || $_GET['action']==BAZ_ACTION_NOUVEAU_V || $_GET['action']==BAZ_ACTION_MODIFIER)) $res .=' class="onglet_actif" ';
$res .='><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_SAISIR.'</a>'."\n".'</li>'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
//choix des administrateurs
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
$est_admin=0;
if ($GLOBALS['AUTH']->getAuth()) {
$requete='SELECT bn_id_nature FROM bazar_nature';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
if ($utilisateur->isAdmin ($ligne['bn_id_nature'])) {
$est_admin=1;
}
}
if ($est_admin || $utilisateur->isSuperAdmin()) {
//partie administrer
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ANNONCES_A_VALIDER);
$res .= '<li id="administrer"';
if (isset($_GET['action']) && $_GET['action']==BAZ_ANNONCES_A_VALIDER) $res .=' class="onglet_actif" ';
$res .='><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMINISTRER.'</a></li>'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
if ($utilisateur->isSuperAdmin()) {
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_GERER_DROITS);
$res .= '<li id="gerer"';
if (isset($_GET['action']) && $_GET['action']==BAZ_GERER_DROITS) $res .=' class="onglet_actif" ';
$res .='><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_GESTION_DES_DROITS.'</a></li>'."\n" ;
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
}
}
$res.= '</ul>'."\n";
return $res ;
}
}
function afficherContenuCorps() {
$res = '';
$res.='<h1 id="titre_bazar">'.$GLOBALS['_GEN_commun']['info_menu']->gm_titre.'</h1>'."\n";
 
if (isset($_GET['action'])) {
if (($_GET['action']!=BAZ_ACTION_NOUVEAU_V)and($_GET['action']!=BAZ_ACTION_MODIFIER_V)) unset($_SESSION['formulaire_annonce_valide']);
switch ($_GET['action']) {
case BAZ_ACTION_VOIR_VOS_ANNONCES : $res .= mes_fiches(); break;
case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($GLOBALS['_BAZAR_']['id_typeannonce']); break;
case BAZ_DEPOSER_ANNONCE : $res .= baz_formulaire(BAZ_DEPOSER_ANNONCE); break;
case BAZ_ANNONCES_A_VALIDER : $res .= fiches_a_valider(); break;
case BAZ_ADMINISTRER_ANNONCES : $res .= baz_administrer_annonces(); break;
case BAZ_MODIFIER_FICHE : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
case BAZ_SUPPRIMER_FICHE : $res .= baz_suppression().baz_liste('',$GLOBALS['id_user'],''); break;
case BAZ_VOIR_FICHE : $res .= baz_voir_fiche(1); break;
case BAZ_ACTION_NOUVEAU : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU); break;
case BAZ_ACTION_NOUVEAU_V : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU_V).mes_fiches(); break;
case BAZ_ACTION_MODIFIER : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
case BAZ_ACTION_MODIFIER_V : $res .= baz_formulaire(BAZ_ACTION_MODIFIER_V).mes_fiches(); break;
case BAZ_ACTION_SUPPRESSION : $res .= baz_suppression().mes_fiches(); break;
case BAZ_ACTION_PUBLIER : publier_fiche(1) ;$res .= fiches_a_valider(); break;
case BAZ_ACTION_PAS_PUBLIER : publier_fiche(0) ;$res .= fiches_a_valider(); break;
case BAZ_GERER_DROITS : $res .= baz_gestion_droits(); break;
case BAZ_S_INSCRIRE : $res .= baz_s_inscrire(); break;
case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=ISO-8859-1');include("bazarRSS.php");exit(0);break;
default : $res .= baz_liste($GLOBALS['_BAZAR_']['id_typeannonce']) ;
}
}
else {
$res .= baz_liste($GLOBALS['_BAZAR_']['id_typeannonce']);
}
return $res ;
}
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.35.2.2 2007/03/07 16:53:17 jp_milcent
* Suppression du query string "action" et non pas "nature"
*
* Revision 1.35.2.1 2007/02/15 13:42:16 jp_milcent
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
*
* Revision 1.35 2006/10/05 08:53:50 florian
* amelioration moteur de recherche, correction de bugs
*
* Revision 1.34 2006/09/04 15:25:12 alexandre_tb
* ajout d'un id dans la balise HTML du titre
*
* Revision 1.33 2006/06/21 15:41:42 alexandre_tb
* rétablissement du menu mes fiches
*
* Revision 1.32 2006/06/21 15:40:15 alexandre_tb
* rétablissement du menu mes fiches
*
* Revision 1.31 2006/05/19 13:54:32 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.30 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
* Revision 1.29 2006/04/24 10:16:22 alexandre_tb
* ajout de la globale filtre.
* elle remplace (à terme) catégorie nature
*
* Revision 1.28 2006/03/29 13:05:41 alexandre_tb
* utilisation de la classe Administrateur_bazar
*
* Revision 1.27 2006/02/07 11:08:36 alexandre_tb
* utilisation de la classe Utilisateur_bazar pour la vérification des droits
*
* Revision 1.26 2006/02/06 09:33:53 alexandre_tb
* modification de l'affichage lors de la saisie de fiche
*
* Revision 1.25 2006/01/30 17:25:38 alexandre_tb
* correction de bugs
*
* Revision 1.24 2006/01/26 11:06:43 alexandre_tb
* ajout d'une requete pour recupere l'id_nature si un id_fiche est passé dans l'url
*
* Revision 1.23 2006/01/17 10:07:36 alexandre_tb
* en cours
*
* Revision 1.22 2006/01/16 15:11:28 alexandre_tb
* simplification code
*
* Revision 1.21 2006/01/13 14:12:52 florian
* utilisation des temlates dans la table bazar_nature
*
* Revision 1.20 2006/01/05 16:28:25 alexandre_tb
* prise en chage des checkbox, reste la mise à jour à gérer
*
* Revision 1.19 2006/01/03 10:19:31 florian
* Mise à jour pour accepter des parametres dans papyrus: faire apparaitre ou non le menu, afficher qu'un type de fiches, définir l'action par défaut...
*
* Revision 1.18 2005/12/02 10:57:03 florian
* MAJ pour paramétrage dans gestion de menus papyrus
*
* Revision 1.17 2005/12/01 16:05:41 florian
* changement des chemins pour appli Pear
*
* Revision 1.16 2005/12/01 15:31:30 florian
* correction bug modifs et saisies
*
* Revision 1.15 2005/11/30 13:58:45 florian
* ajouts graphisme (logos, boutons), changement structure SQL bazar_fiche
*
* Revision 1.14 2005/11/24 16:17:13 florian
* corrections bugs, ajout des cases à cocher
*
* Revision 1.13 2005/11/14 16:04:54 florian
* maj bug affichage flux
*
* Revision 1.12 2005/11/07 17:05:46 florian
* amélioration validation conditions de saisie, ajout des règles spécifiques de saisie des formulaires
*
* Revision 1.11 2005/10/21 16:15:04 florian
* mise a jour appropriation
*
* Revision 1.10 2005/10/12 17:20:33 ddelon
* Reorganisation calendrier + applette
*
* Revision 1.9 2005/10/12 13:35:07 florian
* amélioration de l'interface de bazar, de manière a simplifier les consultations, et à harmoniser par rapport aux Ressources
*
* Revision 1.8 2005/09/30 13:00:05 ddelon
* Fiche bazar generique
*
* Revision 1.7 2005/09/30 12:34:44 ddelon
* petite modification pour integration bazar dans papyrus
*
* Revision 1.6 2005/09/30 12:22:54 florian
* Ajouts commentaires pour fiche, modifications graphiques, maj SQL
*
* Revision 1.4 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.2 2005/02/22 15:33:32 florian
* integration dans Papyrus
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.3 2004/07/05 15:10:14 florian
* changement interface de saisie
*
* Revision 1.2 2004/07/01 10:13:41 florian
* modif Florian
*
* Revision 1.1 2004/06/23 09:58:32 alex
* version initiale
*
* Revision 1.1 2004/06/18 09:00:07 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bazar.desinscription.inc.php
New file
0,0 → 1,68
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.desinscription.inc.php,v 1.3 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
/* Ce programme est appelé depuis inscription.php et
* se situe dans la fonction afficherContenuCorps()
*/
// +------------------------------------------------------------------------------------------------------+
// | LES CONSTANTES DES ACTIONS DE BAZAR |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// Suppression des entrée dans bazar_droits
$requete = 'DELETE FROM bazar_droits WHERE bd_id_utilisateur='.$id_utilisateur ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
 
if (DB::isError($resultat)) {
echo 'Erreur dans la requete sur bazar_droits<br />'.$requete.'<br />'.$resultat->getMessage() ;
}
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1.4.1 2007/03/07 16:53:45 jp_milcent
* Mise en majuscule des mots réservés par SQL
*
* Revision 1.1 2005/09/29 16:14:17 alexandre_tb
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bazar.interne.css
New file
0,0 → 1,39
/*
+----------------------------------------------------------------------------+
| bazar.css |
+----------------------------------------------------------------------------+
| Copyright (c) 2005 Ecole et Nature |
+----------------------------------------------------------------------------+
| Feuille de style interne spécifique a l'application Bazar |
+----------------------------------------------------------------------------+
| Auteur : Florian SCHMITT <florian@ecole-et-nature.org> |
+----------------------------------------------------------------------------+
*/
#BAZ_corps {width:100%;}
#formulaire input, #formulaire textarea, #formulaire select {border:1px solid #000;}
.enligne {padding:0;margin:0;display:inline;list-style: none;list-style-type:none;background:#FFF;}
/*-------------Les fiches Bazar-------------------------------------------------*/
.BAZ_cadre_fiche {margin:0 auto;width:100%;padding:10px;
border: 1px solid #3082AA;-moz-border-radius:10px;
text-indent:0; font: 13px arial, sans-serif; color:#000; text-align:justify; line-height:17px;}
.BAZ_cadre_fiche a {font: 14px arial, sans-serif;color:#3082AA;text-decoration:underline;}
.BAZ_cadre_fiche a:hover {color:#515966;text-decoration:underline;}
#fiche_image {float:left;height:150px; width:150px;}
#fiche_titre {text-align:left;width:100%;padding-left:10px; background:transparent; border:0; color:#B1BB7E; font: 19px arial, sans-serif;}
#BAZ_description {min-height:120px;font: 15px arial, sans-serif;text-align:justify;}
#BAZ_bas_page {margin: 0;padding:0;}
.bulle_haut {margin: 0;padding:0;}
.bulle_corps {margin: 0;padding:10px 5px;border: 1px solid #3082AA;-moz-border-radius:10px;background:#DBE8C8;}
.bulle_bas {margin: 0;padding:0;}
#formation_qualifiante {float:right;margin:0 -15px 0 5px;height:190px;width:30px;background:url(images/BAZ_formation_qualifiante.gif) bottom right no-repeat;}
#formation_diplomante {float:right;margin:0 -15px 0 5px;height:190px;width:30px;background:url(images/BAZ_formation_diplomante.gif) bottom right no-repeat;}
#formation_continue {float:right;margin:0 -15px 0 5px;height:190px;width:30px;background:url(images/BAZ_formation_continue.gif) bottom right no-repeat;}
.centrer {clear:both;margin:0 auto;}
.rubrique {width:150px; text-align:left;font: bold 15px arial, sans-serif; color: #515966;}
.rubrique_bulle {width:90px;text-align:left;font: bold 15px arial, sans-serif; color: #000;}
.infos {width:70%;float:left;min-height:120px;font: bold 15px arial, sans-serif; color: #B1BB7E;line-height: 25px;}
.bazar_checkbox {float:left;width:170px;font:10px arial, sans-serif;border:0;}
.lien_wikini {margin: 0;padding:10px 5px;border: 2px solid #DBE8C8;-moz-border-radius:10px;background:#3082AA;}
div.lien_wikini a {padding-left:100px;color:#FFFFFF;}
.table_bazar th{font-weight:bold;}
.table_bazar #col1,.table_bazar #col2,.table_bazar #col3,.table_bazar #col4{text-align:center;}
/branches/v2.0-narmer/client/bazar/bazar.calendrier.php
New file
0,0 → 1,62
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: bazar.calendrier.php,v 1.10 2007-04-11 08:30:12 neiluj Exp $
/**
* bazar_calendrier : programme affichant les evenements du bazar sous forme de Calendrier
*
*
*@package Bazar
//Auteur original :
*@author David DELON <david.delon@clapas.net>
*@version $Revision: 1.10 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
if (!defined('BAZ_VOIR_FICHE')) {
define ('BAZ_VOIR_FICHE', 8);
}
include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
include_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazar
 
 
include_once 'bibliotheque/bazar.fonct.cal.php'; //fichier des fonctions de Bazar
 
 
function afficherContenuCorps() {
return GestionAffichageCalendrier('calendrier');
}
?>
/branches/v2.0-narmer/client/bazar/bazar.inscription.inc.php
New file
0,0 → 1,76
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.inscription.inc.php,v 1.6 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// RAPPEL : On se situe dans la fonction afficherContenuCorps() de inscription.php
 
// requete pour récupérer l'ensemble des type d'annonces
$requete = 'SELECT bn_id_nature FROM bazar_nature WHERE 1' ;
$resultat = $GLOBALS['ins_db']->query ($requete);
$SQL = '' ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$SQL .= '('.$id_utilisateur.', '.$ligne->bn_id_nature.', 1),' ;
}
 
$SQL = substr ($SQL, 0, strlen ($SQL) - 1) ;
 
$requete = 'INSERT INTO bazar_droits VALUES '.$SQL;
 
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
echo ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
unset($resultat) ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4.2.1 2007/03/07 16:50:42 jp_milcent
* Mise en majuscule des mots réservés par SQL
*
* Revision 1.4 2006/12/01 13:23:17 florian
* integration annuaire backoffice
*
* Revision 1.3 2006/04/28 16:10:17 florian
* inscrit d'office tous les utilisateurs en rédacteur de fiches
*
* Revision 1.2 2006/03/29 13:06:07 alexandre_tb
* Code initial
*
* Revision 1.1 2005/09/29 16:14:17 alexandre_tb
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/index.php
New file
0,0 → 1,66
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: index.php,v 1.5 2005-11-30 13:58:45 florian Exp $
/**
* Index
*
* Première page chargée du répertoire de l'appli bazar. Sert à tester l'appli
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2005-11-30 13:58:45 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include "bazar.php";
echo afficherContenuCorps();
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.2 2005/02/22 15:34:04 florian
* integration dans Papyrus
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/langues/baz_langue_fr.inc.php
New file
0,0 → 1,610
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: baz_langue_fr.inc.php,v 1.52.2.1 2007-05-23 10:22:28 jp_milcent Exp $
/**
* Fichier de traduction en français de l'application Bazar
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.52.2.1 $ $Date: 2007-05-23 10:22:28 $
// +------------------------------------------------------------------------------------------------------+
*/
 
if (file_exists(BAZ_CHEMIN_APPLI.'langues/baz_langue_fr.local.php')) {
include_once BAZ_CHEMIN_APPLI.'langues/baz_langue_fr.local.php' ;
}
 
define ('BAZ_TITREAPPLI','Gestionnaire de fiches (Bazar) ');
define ('BAZ_DESCRIPTIONAPPLI','D&eacute;couvrez Bazar, une application de gestion de fiches class&eacute;es, consultables en ligne ou par flux RSS, grandement personnalisable.');
define ('BAZ_MOTS_CLES','Bazar, fiches, flux, rss, nouveaut&eacute;, information, gestionnaire, xml, syndication, info, application, php, dynamique, mise, aacute; , jour ');
define ('BAZ_TOUTES_LES_ANNONCES', 'Consulter les fiches');
define ('BAZ_CONSULTER_FICHES_VALIDEES', 'Consulter les fiches valid&eacute;es');
define ('BAZ_TOUTES_LES_ANNONCES_DE_TYPE', 'Consulter toutes les fiches de type:');
define ('BAZ_TOUS_TYPES_FICHES', 'Tous types de fiches');
define ('BAZ_TOUS_LES_EMETTEURS', 'Tous les emetteurs');
define ('BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE','Pr&eacute;cisez vos critères de recherche et appuyez sur le bouton "Rechercher" pour consulter les fiches.');
define ('BAZ_MODIFIE_RSS','Modifi&eacute;: ' );
define ('BAZ_NOM', 'Nom') ;
define ('BAZ_PRENOM', 'Pr&eacute;nom') ;
define ('BAZ_TOUS', 'Tous');
define ('BAZ_TOUTES', 'Toutes');
define ('BAZ_MOT_CLE', 'Mots clés (facultatif)');
define ('BAZ_EMETTEUR', 'Émetteur');
define ('BAZ_NATURE', 'Nature de la fiche' );
define ('BAZ_STATUT', 'Statut' );
define ('BAZ_DATE_CREATION', 'Date de cr&eacute;ation' );
define ('BAZ_DATE_MAJ', 'Date de mise &agrave; jour' );
define ('BAZ_URL_IMAGE', 'Image' );
define ('BAZ_LANGUES_PARLES', 'Langues parl&eacute;s :') ;
define ('BAZ_EMAIL', 'E-mail :') ;
define ('BAZ_MOT_DE_PASSE', 'Mot de passe') ;
define ('BAZ_TITREANNONCE', 'Titre de la fiche') ;
define ('BAZ_TYPEANNONCE', 'Type de fiche') ;
define ('BAZ_ANNONCEUR', 'Annonceur') ;
define ('BAZ_REPETE_MOT_DE_PASSE', 'R&eacute;p&eacute;ter le mot de passe :') ;
define ('BAZ_OUI', 'Oui') ;
define ('BAZ_NON', 'Non') ;
define ('BAZ_ANNULER', 'Annuler') ;
define ('BAZ_RETOUR', 'Retour') ;
define ('BAZ_RETABLIR', 'R&eacute;tablir') ;
define ('BAZ_VALIDER', 'Valider') ;
define ('BAZ_PUBLIER', 'Valider la publication') ;
define ('BAZ_ETATPUBLICATION', 'Etat de publication') ;
define ('BAZ_ENCOURSDEVALIDATION', 'En attente de validation');
define ('BAZ_REJETEE', 'Rejet&eacute;e');
define ('BAZ_PUBLIEE', 'Publi&eacute;e') ;
define ('BAZ_PAS_DE_FICHE', '<br />Vous n\'avez pas encore d&eacute;pos&eacute; de fiches.') ;
define ('BAZ_PAS_DE_FICHE_A_VALIDER', 'Pas de fiches &agrave; valider pour l\'instant.');
define ('BAZ_VOS_ANNONCES', 'Vos fiches d&eacute;pos&eacute;es') ;
define ('BAZ_ANNONCES_A_ADMINISTRER', 'Les fiches &agrave; valider') ;
define ('BAZ_MOTS_DE_PASSE_DIFFERENTS', 'Les mots de passe sont diff&eacute;rents !') ;
define ('BAZ_EMAIL_REQUIS', 'Vous devez saisir un email.') ;
define ('BAZ_MOT_DE_PASSE_REQUIS', 'Vous devez saisir un mot de passe.') ;
define ('BAZ_MAIL_INCORRECT', 'L\'email doit avoir une forme correcte, utilisateur@domaine.ext') ;
define ('BAZ_MAIL_DOUBLE', 'Cet email est d&eacute;j&agrave utilis&eacute; par quelqu\'un d\'autre') ;
define ('BAZ_NOTE_REQUIS', 'Indique les champs requis') ;
define ('BAZ_ERREUR_SAISIE', 'Erreur de saisie ') ;
define ('BAZ_VEUILLEZ_CORRIGER', 'Veuillez corriger') ;
define ('BAZ_MODIFIER', 'Modifier') ;
define ('BAZ_MODIFIER_LA_FICHE', 'Modifier la fiche') ;
define ('BAZ_SUPPRIMER', 'Supprimer') ;
define ('BAZ_SELECTION', '--S&eacute;lectionnez ici--');
define ('BAZ_DROITS_PAR_TYPE', 'Droits par type de fiches:');
define ('BAZ_TITRE_SAISIE_ANNONCE', 'Entrer une fiche de type: ');
define ('BAZ_ACCUEIL','Accueil');
define ('BAZ_SORTIRDELAPPLI','Quittez l\'application Bazar');
define ('BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE', 'Saisir une fiche') ;
define ('BAZ_CHOIX_TYPEANNONCE', 'Choisissez le type de fiche que vous souhaitez d&eacute;poser:') ;
define ('BAZ_GESTION_DES_DROITS', 'Gestion des droits');
define ('BAZ_DESCRIPTION_GESTION_DES_DROITS', 'Veuillez choisir un utilisateur dans la liste d&eacute;roulante ci-dessous pour administrer ses droits.');
define ('BAZ_LABEL_CHOIX_PERSONNE', 'Choix de la personne dans l\'annuaire: ');
define ('BAZ_CONFIRMATION_SUPPRESSION', 'Etes-vous s&ucirc;r de vouloir supprimer cette fiche ?') ;
define ('BAZ_NON_VALIDE', 'Non valide') ;
define ('BAZ_VALIDE', 'Valide') ;
define ('BAZ_PRECEDENT', 'Pr&eacute;c&eacute;dent') ;
define ('BAZ_SUIVANT', 'Suivant') ;
define ('BAZ_PAS_DE_FICHE_CRIT', 'Pas de fiche correspondant &agrave; vos crit&egrave;res.') ;
define ('BAZ_TEXTE_IMG_ALTERNATIF', 'Image de la fiche');
define ('BAZ_NUM_FICHE', 'Num&eacute;ro de fiche');
define ('BAZ_ADMIN_ANNONCES', 'Modifier les types de fiches');
define ('BAZ_RECHERCHER_DES_ANNONCES', 'Rechercher des fiches');
define ('BAZ_RECHERCHE_AVANCEE', 'Recherche avanc&eacute;e >>');
define ('BAZ_RECHERCHE_DE_BASE','<< Recherche simple');
define ('BAZ_DESCRIPTION_RECHERCHE', 'En pr&eacute;cisant, ci dessus, le type de fiche cherch&eacute;, vous pourrez obtenir des fonctions de recherche avanc&eacute;.');
define ('BAZ_PAS_D_ANNONCES', 'Pas de fiches trouv&eacute;es.');
define ('BAZ_S_INSCRIRE_AUX_ANNONCES', 'S\'abonner &agrave; un type de fiche');
define ('BAZ_ABONNE', 'Abonn&eacute;');
define ('BAZ_PAS_ABONNE', 'Pas abonn&eacute;');
define ('BAZ_S_ABONNER', 'S\'abonner');
define ('BAZ_LAIUS_S_ABONNER', 'Il y a deux mani&egrave;res de s\'abonner:<br />- soit en s\'abonnant pour recevoir les fiches par mails<br />- soit par flux RSS');
define ('BAZ_SE_DESABONNER', 'Se d&eacute;sabonner');
define ('BAZ_RSS', 'Flux RSS');
define ('BAZ_DERNIERE_ACTU', 'Derni&egrave;res actualit&eacute;s');
if (!defined ('BAZ_DERNIERES_FICHES')) define ('BAZ_DERNIERES_FICHES', 'Les derni&egrave;res fiches enregistr&eacute;es');
define ('BAZ_A_MODERER',' &agrave; mod&eacute;rer');
define ('BAZ_CONSULTER','Consulter');
define ('BAZ_SAISIR','Saisir');
define ('BAZ_ADMINISTRER','Administrer');
define ('BAZ_FICHE_ECRITE','Fiche &eacute;crite par : ');
define ('BAZ_NB_VUS','Cette fiche a &eacute;t&eacute; consult&eacute;e ');
define ('BAZ_FOIS', ' fois depuis sa cr&eacute;ation.');
define ('BAZ_LES_COMMENTAIRES', 'Les commentaires sur cette fiche');
define ('BAZ_PAS_DE_COMMENTAIRES', 'Pas de commentaires post&eacute;s pour l\'instant, vous &ecirc;tes le (la) premier (premi&egrave;re) !!');
define ('BAZ_IL_Y_A', 'Il y a ');
define ('BAZ_COMMENTAIRE', 'commentaire : ');
define ('BAZ_COMMENTAIRES', 'commentaires : ');
define ('BAZ_ENTREZ_VOTRE_NOM', 'Entrez votre nom : ');
define ('BAZ_ENTREZ_VOTRE_COMMENTAIRE', 'Entrez votre commentaire : ');
define ('BAZ_ENVOYER','Envoyer');
define ('BAZ_NOM_REQUIS', 'Le champs nom ne doit pas rester vide');
define ('BAZ_COMMENTAIRE_REQUIS', 'Le champs commentaire ne doit pas rester vide');
define ('BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE', 'Les structures possédant cette ressource');
define ('BAZ_FICHES_PAS_VALIDEES','Seulement les fiches pas valid&eacute;es');
define ('BAZ_FICHES_VALIDEES','Seulement les fiches valid&eacute;es');
define ('BAZ_LES_DEUX','Fiches valid&eacute;es et non valid&eacute;es');
define ('BAZ_VOIR_VOS_ANNONCES', 'Vos fiches');
define ('BAZ_RECHERCHER','Rechercher');
define ('BAZ_SAISIR_UNE_NOUVELLE_FICHE','Saisir une nouvelle fiche');
define ('BAZ_POUR_CHANGER_IMAGE','Pour changer d\'image, il suffit d\'en saisir une autre ci dessous.');
define ('BAZ_CONFIRMATION_SUPPRESSION_LIEN', 'Etes-vous s&ucirc;r de vouloir supprimer ce lien ?') ;
define ('BAZ_CONFIRMATION_SUPPRESSION_FICHIER', 'Etes-vous s&ucirc;r de vouloir supprimer ce fichier ?') ;
define ('BAZ_CONFIRMATION_SUPPRESSION_IMAGE', 'Etes-vous s&ucirc;r de vouloir supprimer cette image ?') ;
define ('BAZ_VALIDER_PUBLICATION', 'Valider la publication');
define ('BAZ_ENTRER_PROJET', 'ENTRER SUR L\'ESPACE DU PROJET');
//================Textes pour les libellés======================================
define ('BAZ_ANNONCES','annonces');
define ('BAZ_PUBLICATIONS','publications');
define ('BAZ_EVENEMENTS','&eacute;v&egrave;nements');
define ('BAZ_FORMATIONS','formations');
define ('BAZ_SEJOURS','s&eacute;jours');
define ('BAZ_EMPLOIS','emplois');
define ('BAZ_RESS_HUMAINES','Ressources humaines');
define ('BAZ_RESS_DOCS','Ressources documentaires');
define ('BAZ_RESS_PHYSIQUES','Ressources physiques');
define ('BAZ_RESS_FINANCIERES','Ressources financi&egrave;res');
define ('BAZ_JEUX','jeux');
define ('BAZ_PETITES_ANNONCES','petites annonces');
define ('BAZ_BREVES','br&egrave;ves');
define('BAZ_COMPTES_RENDUS','comptes rendus');
define ('BAZ_REALISATION','r&eacute;alisation');
define ('BAZ_PERSONNES_EXPERTES','personnes expertes');
define ('BAZ_THEMATIQUE','th&eacute;matique');
define ('BAZ_THEMATIQUE_REQUIS','la thematique est requise');
define ('BAZ_SITE_INTERNET','site internet');
define ('BAZ_ADRESSE_CONTACT','Adresse du contact');
define ('BAZ_MAIL_CONTACT','Mail du contact');
define ('BAZ_MAIL_CONTACT_REQUIS','Le mail du contact est requis');
 
//================Textes pour les formations====================================
define ('BAZ_TITRE_FORMATION','Intitul&eacute; de la formation');
define ('BAZ_TITRE_FORMATION_REQUIS','L\'intitul&eacute; de la formation est obligatoire, veuillez le saisir');
define ('BAZ_SI_MODULE','Si plusieurs modules de formation');
define ('BAZ_NUMERO_MODULE','Num&eacute;ro de module');
define ('BAZ_NB_TOTAL_MODULE','Nombre total de modules');
define ('BAZ_TYPE_FORMATION','Type de la formation');
define ('BAZ_TYPE_FORMATION_REQUIS','Le type de la formation est obligatoire, veuillez le saisir');
define ('BAZ_SI_DIPLOMANTE','Si la formation est diplomante');
define ('BAZ_DIPLOME_PREPARE', 'Dipl&ograve;me pr&eacute;par&eacute;');
define ('BAZ_NIVEAU', 'Niveau');
define ('BAZ_SI_QUALIFIANTE', 'Si la formation est qualifiante');
define ('BAZ_QUALIF_PREPAREE', 'Qualification pr&eacute;par&eacute;e');
define ('BAZ_OBJECTIFS', 'Objectifs');
define ('BAZ_OBJECTIFS_REQUIS', 'Entrer les objectifs est obligatoire, veuillez les saisir');
define ('BAZ_CONTENU', 'Contenu');
define ('BAZ_PUBLIC', 'Publics');
define ('BAZ_PUBLIC_REQUIS', 'Publics');
define ('BAZ_CONDITIONS_ACCES', 'Conditions d\'acc&egrave;s');
define ('BAZ_DATE_DEBUT_FORMATION', 'Date de d&eacute;but de la formation');
define ('BAZ_DATE_FIN_FORMATION', 'Date de fin de la formation');
define ('BAZ_DATE_FIN_INSCRIPTION', 'Date limite d\'inscription');
define ('BAZ_CP_LIEU_EVENEMENT', 'Code postal du lieu de l\'&eacute;v&eacute;nement');
define ('BAZ_TARIF_INDIVIDUEL', 'Tarif individuel (en euros)');
define ('BAZ_TARIF_ENTREPRISE', 'Tarif entreprise (en euros)');
define ('BAZ_TARIF_OPCA', 'Tarif OPCA (en euros)');
define ('BAZ_NUM_AGREMENT', 'Num&eacute;ro d\'agr&eacute;ement de la structure');
define ('BAZ_NUM_AGREMENT_REQUIS', 'Le numéro d\'agr&eacute;ement de la structure est obligatoire, veuillez le saisir');
define ('BAZ_ANNONCE_REQUIS','Le corps de l\'annonce est requis');
define ('BAZ_PRENOM_CONTACT', 'Pr&eacute;nom');
define ('BAZ_PRENOM_CONTACT_REQUIS', 'Le pr&eacute;nom de la personne contact est obligatoire, veuillez le saisir');
define ('BAZ_NOM_CONTACT', 'Nom');
define ('BAZ_NOM_CONTACT_REQUIS', 'Le nom de la personne contact est obligatoire, veuillez le saisir');
define ('BAZ_MAIL', 'Adresse &eacute;lectronique');
define ('BAZ_TELEPHONE', 'T&eacute;l&eacute;phone');
define ('BAZ_TELEPHONE_REQUIS', 'Le t&eacute;l&eacute;phone du contact est obligatoire, veuillez le saisir');
define ('BAZ_INTERVENANTS', 'Les intervenants');
define ('BAZ_INFOS_COMPLEMENTAIRE', 'Informations compl&eacute;mentaires');
define ('BAZ_COORDONNEES_CONTACT', 'Coordonn&eacute;es de la personne contact<br />');
define ('BAZ_DUREE_DE_PARUTION', '<strong>Dur&eacute;e de parution:</strong> la date de d&eacute;but de parution indique le moment ou la fiche devient visible sur le site, et la date de fin de parution, le moment o&ugrave; elle disparait.<br />');
define ('BAZ_LIGNE_HORIZONTALE', '<hr />');
define ('BAZ_CHAMPS_REQUIS', ': champs requis');
define ('BAZ_PAR', 'par');
define ('BAZ_CHAMPS_INDISPENSABLES_CLASSES', 'Champs indispensables pour les classes<br />');
define ('BAZ_ECRIT_LE',', &eacute;crit le ');
define ('BAZ_FICHES_CORRESPONDANTES', 'fiches correspondantes à votre recherche') ;
define ('BAZ_FICHE_CORRESPONDANTE', 'fiche correspondante à votre recherche') ;
 
//================Le formulaire ================================================
define ('BAZ_AJOUTER_CHAMPS_DE_BASE', 'Ajouter les informations de base pour la fiche');
define ('BAZ_PAYS', 'Pays');
define ('BAZ_PAYS_REQUIS', 'Le champs pays est requis!');
define ('BAZ_ORGANISME', 'Organisme');
define ('BAZ_CONTACT', 'Contact');
define ('BAZ_REGION', 'R&eacute;gion');
define ('BAZ_REGION_REQUIS', 'Le champs r&eacute;gion est requis!');
define ('BAZ_DEPARTEMENT', 'D&eacute;partement') ;
define ('BAZ_DEPARTEMENT_REQUIS', 'Le champs d&eacute;partement est requis!');
define ('BAZ_LICENCE', 'Type de licence') ;
define ('BAZ_LICENCE_REQUIS', 'Le type de licence est requis!') ;
define ('BAZ_TITRE', 'Titre') ;
define ('BAZ_TITRE_REQUIS', 'Un titre de fiche est requis!') ;
define ('BAZ_DESCRIPTION', 'Description') ;
define ('BAZ_DESCRIPTION_REQUIS', 'Une description de la fiche est requise!!') ;
define ('BAZ_DATEDEBVALID', 'D&eacute;but de parution' );
define ('BAZ_DATEDEBVALID_REQUIS', 'La date de d&eacute;but de parution est requise!!') ;
define ('BAZ_DATEFINVALID', 'Fin de parution' );
define ('BAZ_DATEFINVALID_REQUIS', 'La date de fin de parution est requise!!') ;
define ('BAZ_DU', 'du') ;
define ('BAZ_AU', 'au') ;
define ('BAZ_DATE_DEBUT_EVENEMENT', 'D&eacute;but de l\'&eacute;venement' );
define ('BAZ_DATE_DEBUT_EVENEMENT_REQUIS', 'La date de d&eacute;but de l\'&eacute;venement est requise!!') ;
define ('BAZ_DATE_FIN_EVENEMENT', 'Fin de l\'&eacute;venement' );
define ('BAZ_DATE_FIN_EVENEMENT_REQUIS', 'La date de fin de l\'&eacute;venement est requise!!') ;
define ('BAZ_LIEU_EVENEMENT', 'Lieu de l\'&eacute;venement' );
define ('BAZ_LIEU_EVENEMENT_REQUIS', 'Le lieu de l\'&eacute;venement est requis!!') ;
define ('BAZ_PAS_UNE_IMAGE', 'Ce fichier n\'est pas une image.' );
define ('BAZ_AJOUTER_IMAGE', 'Pour l\'instant, pas d\'image associ&eacute;e &agrave; la fiche, vous pouvez en ajouter une ci-dessous.' );
define ('BAZ_IMAGE', 'Image pour la fiche (facultatif)' );
define ('BAZ_IMAGE_VALIDE_REQUIS', 'Le fichier image n\'est pas valide.') ;
 
//================Textes pour les parutions=====================================
define ('BAZ_CODE', 'Code ISBN ou ISSN (s\'il existe)' );
define ('BAZ_NOM_AUTEUR', 'Auteur' );
define ('BAZ_NOM_AUTEUR_REQUIS', 'L\'auteur est requis');
define ('BAZ_EDITEUR', 'Editeur');
define ('BAZ_TYPE_PARUTION', 'Type de parution');
define ('BAZ_ANNONCE','Annonce');
define ('BAZ_CAPACITE_ACCUEIL', 'Capacit&eacute; d\'accueil' );
define ('BAZ_CAPACITE_ACCUEIL_REQUIS', 'La capacit&eacute; d\'accueil est requise!!') ;
define ('BAZ_NB_ANIMATEURS', 'Nombre d\'animateurs' );
define ('BAZ_NB_ANIMATEURS_REQUIS', 'Le nombre d\'animateurs est requis!!') ;
define ('BAZ_TARIF', 'Tarif (en euros)' );
define ('BAZ_TARIF_REQUIS', 'Le tarif est requis!!') ;
define ('BAZ_LISTE_TRANCHES_AGES', 'Tranches d\'&agrave;ges' );
define ('BAZ_LISTE_TRANCHES_AGES_REQUIS', 'Les tranches d\'&agrave;ges sont requises!!') ;
define ('BAZ_LISTE_URL', 'Liens associ&eacute;s &agrave; l\'annonce: ');
define ('BAZ_PAS_URL', 'Pour l\'instant, pas de lien associ&eacute; &agrave; la fiche, vous pouvez en ajouter ci-dessous.');
define ('BAZ_AJOUTER_URL', 'Ajouter un lien (URL) &agrave la fiche');
define ('BAZ_LIEN', 'Lien' );
define ('BAZ_LIEN_INTERNET', 'Liens Internet' );
define ('BAZ_URL_LIEN', 'Adresse du lien (URL)' );
define ('BAZ_URL_LIEN_REQUIS', 'L\'adresse du lien (URL) est requise!!') ;
define ('BAZ_URL_TEXTE', 'Texte du lien' );
define ('BAZ_URL_TEXTE_REQUIS', 'Le texte du lien est requis!!') ;
define ('BAZ_AJOUTER_FICHIER_JOINT','Ajouter un fichier joint &agrave la fiche');
define ('BAZ_FICHIER_JOINT', 'Fichier joint' );
define ('BAZ_LISTE_FICHIERS_JOINTS', 'Fichiers associ&eacute;s &agrave; la fiche ');
define ('BAZ_PAS_DE_FICHIERS_JOINTS', 'Pour l\'instant, pas de fichier associ&eacute; &agrave; la fiche, vous pouvez en ajouter ci-dessous.');
define ('BAZ_FICHIER','Fichier');
define ('BAZ_FICHIER_JOINT_REQUIS', 'Le fichier joint est requis!!') ;
define ('BAZ_FICHIER_DESCRIPTION', 'Description du fichier' );
define ('BAZ_FICHIER_TEXTE_REQUIS', 'Le texte du fichier est requis!!') ;
define ('BAZ_FICHIER_LABEL', 'Label du fichier') ;
define ('BAZ_FICHIER_LABEL_REQUIS', 'Le label du fichier est requis!!') ;
define ('BAZ_FICHIER_EXISTANT', 'Il existe d&eacute;j&agrave; un fichier du même nom sur le site.<br />Votre fiche a &eacute;t&eacute; associ&eacute;e avec le fichier existant d&eacute;j&agrave;.');
define ('BAZ_ACCEPTE_CONDITIONS', 'J\'accepte les conditions de saisie de la fiche');
define ('BAZ_ACCEPTE_CONDITIONS_REQUIS', 'Vous devez accepter les conditions de saisie de la fiche');
 
//================Textes pour les emplois=======================================
define ('BAZ_INTITULE_POSTE', 'Intitul&eacute; du poste');
define ('BAZ_INTITULE_POSTE_REQUIS', 'L\'intitul&eacute; du poste est requis');
define ('BAZ_DESCRIPTION_STRUCTURE', 'Description de la structure qui embauche');
define ('BAZ_DESCRIPTION_STRUCTURE_REQUIS', 'La description de la structure qui embauche est requise');
define ('BAZ_CP_LIEU_TRAVAIL', 'Code postal du lieu de travail');
define ('BAZ_LIEU_TRAVAIL', 'Lieu de travail');
define ('BAZ_MISSIONS', 'Missions du poste');
define ('BAZ_PROFIL', 'Profil du poste');
define ('BAZ_PROFIL_REQUIS', 'Le profil du poste est requis');
define ('BAZ_NIVEAU_DIPLOME_DEMANDE', 'Niveau de diplome demand&eacute;');
define ('BAZ_ELEGIBILITE', 'Elegibilit&eacute; (CES, Emploi jeune,...)');
define ('BAZ_TYPE_CONTRAT', 'Type de contrat');
define ('BAZ_TYPE_CONTRAT_REQUIS', 'Type de contrat requis');
define ('BAZ_FORME_CANDIDATURE', 'Moyen de candidature (envois de CV par mail, lettre manucrite,...)');
define ('BAZ_INDICE_SALAIRE', 'Indice salaire');
define ('BAZ_SALAIRE_BRUT_MENSUEL', 'Salaire brut mensuel');
define ('BAZ_SALAIRE_BRUT_MENSUEL_REQUIS', 'Le salaire brut mensuel est requis');
define ('BAZ_ECHEANCE_CANDIDATURE', 'Date d\'&eacute;ch&eacute;ance de candidature');
define ('BAZ_DATE_DEBUT_EMBAUCHE', 'Date de d&eacute;but d\'embauche');
 
//================Textes pour les ressources=======================================
define ('BAZ_THEME','Th&egrave;me');
define ('BAZ_THEME_REQUIS','Le th&egrave;me est requis');
define ('BAZ_TRANCHES_AGES','Tranches d\'&acirc;ge');
define ('BAZ_TRANCHES_AGES_REQUIS','les tranches d\'&acirc; soTRUCTUREnt requises');
define ('BAZ_PERIODE', 'P&eacute;riode');
define ('BAZ_PERIODE_REQUIS', 'P&eacute;riode requise');
define ('BAZ_NIVEAU_SCOLAIRE', 'Niveau scolaire');
define ('BAZ_DATE_DEBUT_SEJOUR', 'Date de d&eacute;but du s&eacute;jour');
define ('BAZ_DATE_DEBUT_SEJOUR_REQUIS', 'Date de d&eacute;but du s&eacute;jour requise');
define ('BAZ_DATE_FIN_SEJOUR', 'Date de fin du s&eacute;jour');
define ('BAZ_DATE_FIN_SEJOUR_REQUIS', 'Date de fin du s&eacute;jour requise');
define ('BAZ_LIEU', 'Lieu');
define ('BAZ_LIEU_REQUIS', 'Lieu requis');
define ('BAZ_MILIEU_DOMINANT', 'Milieu dominant');
define ('BAZ_HEBERGEMENT', 'H&eacute;bergement');
define ('BAZ_HEBERGEMENT_REQUIS', 'H&eacute;bergement requis');
define ('BAZ_NOMBRE_PLACES', 'Nombre de places');
define ('BAZ_NOMBRE_PLACES_REQUIS', 'Nombre de places requis');
define ('BAZ_NOMBRE_ANIMS', 'Nombre d\'animateurs');
define ('BAZ_NOMBRE_ANIMS_REQUIS', 'Nombre d\'animateurs requis');
define ('BAZ_QUALIF_ANIMS', 'Qualification des animateurs');
define ('BAZ_QUALIF_ANIMS_REQUIS', 'Qualification des animateurs requise');
define ('BAZ_AGREMENTS', 'Agr&eacute;ments');
define ('BAZ_ACTIVITES_DOMINANTES', 'Activit&eacute;s dominantes (en 3 mots cl&eacute;s)');
define ('BAZ_ACTIVITES_DOMINANTES_REQUIS', 'Activit&eacute;s dominantes requises');
define ('BAZ_PRECISION_PRIX', 'Pr&eacute;cision sur le prix');
define ('BAZ_PRECISION_PRIX_REQUIS', 'Pr&eacute;cision sur le prix requise');
define ('BAZ_VOYAGE_COMPRIS', 'Voyage compris');
define ('BAZ_VOYAGE_COMPRIS_REQUIS', 'Voyage compris requis');
define ('BAZ_AIDES_POSSIBLES', 'Aides possibles');
define ('BAZ_CHOISIR', 'Choisir...');
define ('BAZ_CHOISIR_OBLIGATOIRE', 'Il faut choisir une option dans la liste ');
define ('BAZ_INDIFFERENT','Indiff&eacute;rent');
 
define ('BAZ_COORDONNEES','Coordonn&eacute;es');
define ('BAZ_ANNEE_PARUTION','Ann&eacute;e de parution');
define ('BAZ_LANGUE','Langue');
define ('BAZ_THEMES','Thèmes');
define ('BAZ_PAS_D_APPROPRIATION','Aucune structure ne s\'est appropri&eacute; cette ressource pour l\'instant.');
define ('BAZ_STRUCTURE_POSSEDANT', 'structure poss&eacute;dant cette ressource.');
define ('BAZ_STRUCTURES_POSSEDANT', 'structures poss&eacute;dant cette ressource.');
define ('BAZ_SI_POSSEDE_RESSOURCE', 'Si vous poss&egrave;dez cette ressource dans votre structure:');
define ('BAZ_POSSEDE_DEJA_RESSOURCE', 'Vous poss&egrave;dez cette ressource.');
define ('BAZ_CLIQUER_POUR_VOUS_ENLEVER', 'cliquez ici pour vous enlever de la liste.');
define ('BAZ_IL_FAUT_ETRE_STRUCTURE', 'Seules les structures identifi&eacute;es peuvent s\'approprier cette ressource.');
define ('BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE', 'En vous identifiant ou ou vous inscrivant en tant que structure, vous pouvez vous associer cette ressource.');
define ('BAZ_CLIQUER_POUR_APPARAITRE', 'cliquez ici pour appaitre dans la liste.');
define ('BAZ_NON_PRECISE','Non pr&eacute;cis&eacute;');
 
 
define ('BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR', 'Pour saisir des fiches, voir vos fiches ou s\'abonner:<br /> veuillez vous identifier ou vous inscrire.');
define ('BAZ_EST_SUPERADMINISTRATEUR', 'Cette personne est un super-administrateur.<br />Il peut modifier le droits des utilisateurs et administrer toutes les rubriques de fiches.');
define ('BAZ_CHANGER_SUPERADMINISTRATEUR', 'Changer ses droits de super-administrateur pour en faire un utilisateur sans pouvoir');
define ('BAZ_AUCUN_DROIT', 'utilisateur sans pouvoir');
define ('BAZ_DROIT_REDACTEUR', 'r&eacute;dacteur');
define ('BAZ_DROIT_ADMIN', 'administrateur');
define ('BAZ_PASSER_SUPERADMINISTRATEUR', 'Passer la personne en super administrateur');
define ('BAZ_ENLEVER_DROIT', 'Passer en utilisateur sans pouvoir');
define ('BAZ_TYPE_ANNONCES', 'Types de fiche');
define ('BAZ_DROITS_ACTUELS', 'Droits actuels');
define ('BAZ_PASSER_EN', 'Passer en');
define ('BAZ_OU_PASSER_EN', 'ou passer en');
 
 
define ('BAZ_CHECKBOX_SUPERADMIN', 'Super administrateur : ');
define ('BAZ_RADIO_AUCUN', 'aucun &nbsp;');
define ('BAZ_RADIO_REDACTEUR', 'r&eacute;dacteur &nbsp;');
define ('BAZ_RADIO_ADMINISTRATEUR', 'administrateur &nbsp;');
 
//================Textes pour les sejours==================================
define ('BAZ_TITRE_SEJOUR','Titre du s&eacute;jour');
define ('BAZ_TITRE_SEJOUR_REQUIS','Le titre du s&eacute;jour est obligatoire, veuillez le saisir');
define ('BAZ_MAX_60_CAR', '(maximum 60 caractères)');
 
// ================ Texte pour les structures =============================
define ('BAZ_FICHE_STRUCTURE', 'Fiche structure') ;
define ('BAZ_NOM_STRUCTURE', 'Nom de la structure');
define ('BAZ_NOM_STRUCTURE_REQUIS', 'Le nom de la structure est requis');
define ('BAZ_RAISON_SOCIALE', 'Raison sociale');
define ('BAZ_RAISON_SOCIALE_REQUIS', 'Raison sociale requise');
define ('BAZ_OBJET', 'Objet');
define ('BAZ_OBJET_REQUIS', 'Objet requis');
define ('BAZ_ACTIONS', 'Actions');
define ('BAZ_PRODUCTIONS', 'Productions');
define ('BAZ_RESEAUX', 'Réseaux');
define ('BAZ_ADRESSE', 'Adresse');
define ('BAZ_ADRESSE_REQUIS', 'Adresse requise');
define ('BAZ_FAX', 'Fax');
//define ('BAZ_DERNIERES_FICHES', 'Derni&egrave;res fiches enregistr&eacute;es');
define ('BAZ_FICHE_NUMERO', 'Fiches n');
define ('BAZ_ECRITE', '&nbsp;&eacute;crite par&nbsp;');
 
//================ Administration de Bazar ================================
define ('BAZ_CONFIG', 'Configuration du bazar');
define ('BAZ_ENREGISTRER_ET_QUITTER', 'Enregistrer et quitter');
 
//================ Calendrier Bazar =======================================
 
define ('BAZ_LUNDI','Lundi');
define ('BAZ_MARDI','Mardi');
define ('BAZ_MERCREDI','Mercredi');
define ('BAZ_JEUDI','Jeudi');
define ('BAZ_VENDREDI','Vendredi');
define ('BAZ_SAMEDI','Samedi');
define ('BAZ_DIMANCHE','Dimanche');
 
define ('BAZ_LUNDI_COURT','Lun');
define ('BAZ_MARDI_COURT','Mar');
define ('BAZ_MERCREDI_COURT','Mer');
define ('BAZ_JEUDI_COURT','Jeu');
define ('BAZ_VENDREDI_COURT','Ven');
define ('BAZ_SAMEDI_COURT','Sam');
define ('BAZ_DIMANCHE_COURT','Dim');
 
define ('BAZ_JANVIER','Janvier');
define ('BAZ_FEVRIER','F&eacute;vrier');
define ('BAZ_MARS','Mars');
define ('BAZ_AVRIL','Avril');
define ('BAZ_MAI','Mai');
define ('BAZ_JUIN','Juin');
define ('BAZ_JUILLET','Juillet');
define ('BAZ_AOUT','Ao&uacute;t');
define ('BAZ_SEPTEMBRE','Septembre');
define ('BAZ_OCTOBRE','Octobre');
define ('BAZ_NOVEMBRE','Novembre');
define ('BAZ_DECEMBRE','D&eacute;cembre');
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.52 2007-04-20 12:47:42 florian
* correction bugs suite au merge
*
* Revision 1.51 2007/04/20 09:57:21 florian
* correction bugs suite au merge
*
* Revision 1.50 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.42.2.2 2007/03/07 17:20:47 jp_milcent
* Ajout d'une majuscule accentuée.
*
* Revision 1.42.2.1 2007/01/29 10:54:25 alexandre_tb
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
*
* Revision 1.42 2006/10/05 08:53:50 florian
* amelioration moteur de recherche, correction de bugs
*
* Revision 1.41 2006/09/21 14:19:39 florian
* amélioration des fonctions liés au wikini
*
* Revision 1.40 2006/07/19 12:50:00 alexandre_tb
* Un accent
*
* Revision 1.39 2006/06/29 10:30:26 florian
* correction de BAZ_MOT_CLE
*
* Revision 1.38 2006/05/19 13:53:45 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.37 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
* Revision 1.36 2006/03/14 17:10:21 florian
* ajout des fonctions de syndication, changement du moteur de recherche
*
* Revision 1.35 2006/03/02 20:36:52 florian
* les entrees du formulaire de saisir ne sont plus dans les constantes mias dans des tables qui gerent le multilinguisme.
*
* Revision 1.34 2006/03/01 16:23:22 florian
* modifs textes fr et correction bug "undefined index"
*
* Revision 1.33 2006/03/01 16:00:17 florian
* ajout de certains mots par rapport aux formulaires de saisie de ressources
*
* Revision 1.32 2006/02/09 18:00:17 florian
* ajout des trois mots, je sais c'est peu de choses!!
*
* Revision 1.31 2006/01/18 10:53:28 florian
* corrections bugs affichage fiche
*
* Revision 1.30 2006/01/05 16:28:25 alexandre_tb
* prise en chage des checkbox, reste la mise à jour à gérer
*
* Revision 1.29 2006/01/04 15:31:46 alexandre_tb
* ajout de label
*
* Revision 1.28 2006/01/03 10:19:31 florian
* Mise à jour pour accepter des parametres dans papyrus: faire apparaitre ou non le menu, afficher qu'un type de fiches, définir l'action par défaut...
*
* Revision 1.27 2006/01/02 13:24:23 alexandre_tb
* ajout de label
*
* Revision 1.26 2005/11/30 13:58:45 florian
* ajouts graphisme (logos, boutons), changement structure SQL bazar_fiche
*
* Revision 1.25 2005/11/24 16:17:13 florian
* corrections bugs, ajout des cases à cocher
*
* Revision 1.24 2005/11/08 16:09:26 florian
* modifs séjours
*
* Revision 1.23 2005/11/08 16:06:41 florian
* modifs séjours
*
* Revision 1.22 2005/11/07 17:30:36 florian
* ajout controle sur les listes pour la saisie
*
* Revision 1.21 2005/11/07 17:05:46 florian
* amélioration validation conditions de saisie, ajout des règles spécifiques de saisie des formulaires
*
* Revision 1.20 2005/11/04 17:13:49 florian
* ajout des textes et du formulaire pour les annonces
*
* Revision 1.19 2005/10/31 17:10:56 ddelon
* Reintegration des commits mysterieusement disparus
*
* Revision 1.18 2005/10/24 09:42:21 florian
* mise a jour appropriation
*
* Revision 1.17 2005/10/21 16:15:04 florian
* mise a jour appropriation
*
* Revision 1.13 2005/10/13 14:43:42 florian
* corrections pb accents
*
* Revision 1.12 2005/10/12 16:28:37 florian
* corrections fautes orthographes
*
* Revision 1.11 2005/10/12 16:27:22 florian
* ajout textes des Ressources
*
* Revision 1.10 2005/10/12 16:17:37 florian
* corrections pb accents
*
* Revision 1.9 2005/10/12 16:12:34 florian
* corrections pb accents
*
* Revision 1.8 2005/10/12 15:31:43 florian
* corrections pb accents
*
* Revision 1.7 2005/10/10 16:22:06 alexandre_tb
* Modification de label pour les rendre plus générique
*
* Revision 1.6 2005/09/30 23:04:31 ddelon
* calendrier bazar
*
* Revision 1.5 2005/09/30 12:22:54 florian
* Ajouts commentaires pour fiche, modifications graphiques, maj SQL
*
* Revision 1.3 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.6 2004/07/06 16:21:50 florian
* d&eacute;buggage modification + MAJ flux RSS
*
* Revision 1.5 2004/07/05 15:13:53 florian
* changement interface de saisie
*
* Revision 1.4 2004/07/02 14:51:41 florian
* ajouts de labels divers
*
* Revision 1.3 2004/07/01 16:37:14 florian
* ajout de labels
*
* Revision 1.2 2004/07/01 13:00:24 florian
* modif Florian
*
* Revision 1.1 2004/06/23 09:58:32 alex
* version initiale
*
* Revision 1.1 2004/06/18 09:00:46 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/langues/baz_langue_fr.admin.inc.php
New file
0,0 → 1,55
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: baz_langue_fr.admin.inc.php,v 1.1 2007-02-02 14:01:53 alexandre_tb Exp $
 
/**
* Papyrus : Programme d'administration du bazar
*
* Fichier de de langue
*@package Bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_bas.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_bas.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_continue.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_continue.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_cadre_bas.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_cadre_bas.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Ekotheque.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Ekotheque.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Emplois.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Emplois.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Evenements.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Evenements.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-etoile-contact.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-etoile-contact.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-personnes.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-personnes.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-outils-2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-outils-2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-outils.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-outils.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Projets-actif.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Projets-actif.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_pastille.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_pastille.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-etoile-jaune.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-etoile-jaune.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Annonces.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Annonces.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_qualifiante.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_qualifiante.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Formations.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Formations.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Parutions.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Parutions.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_telephone.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_telephone.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Emplois.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Emplois.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_barre.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_barre.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_px_infobulle.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_px_infobulle.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Sejours.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Sejours.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_titre.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_titre.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_haut.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_encadre_haut.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Parutions.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Parutions.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-site.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-site.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Logo_Annonces.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Logo_Annonces.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Projets.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Projets.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Sejours.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Sejours.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_diplomante.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_formation_diplomante.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Actualites.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Bandeau-fiche-Actualites.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_precedent.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_precedent.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_mail.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_mail.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Evenements.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Evenements.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_rss.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_rss.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_suivant.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_suivant.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Titre_Formations.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Titre_Formations.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_Enfants.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_Enfants.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-groupe-travail.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-groupe-travail.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Puce-documents.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Puce-documents.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/BAZ_cadre_haut.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/BAZ_cadre_haut.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/Zone-image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/Zone-image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/images/cal_titre_fond.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/images/cal_titre_fond.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/configuration/baz_config.inc.php
New file
0,0 → 1,247
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: baz_config.inc.php,v 1.28.2.1 2007-05-24 14:46:12 neiluj Exp $
/**
* Fichier de configuration du bazar
*
* A éditer de façon spécifique à chaque déploiement
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.28.2.1 $ $Date: 2007-05-24 14:46:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LES CONSTANTES DES ACTIONS DE BAZAR |
// +------------------------------------------------------------------------------------------------------+
 
define ('BAZ_VOIR_TOUTES_ANNONCES', 1) ;
define ('BAZ_ACTION_VOIR_VOS_ANNONCES', 2);
define ('BAZ_DEPOSER_ANNONCE', 3) ;
define ('BAZ_ANNONCES_A_VALIDER', 4) ;
define ('BAZ_GERER_DROITS', 5) ;
define ('BAZ_ADMINISTRER_ANNONCES', 6) ;
define ('BAZ_MODIFIER_FICHE', 7) ;
if (!defined('BAZ_VOIR_FICHE')) define ('BAZ_VOIR_FICHE', 8) ;
define ('BAZ_SUPPRIMER_FICHE', 9) ;
define ('BAZ_ACTION_NOUVEAU', 10) ;
define ('BAZ_ACTION_NOUVEAU_V', 11) ;
define ('BAZ_ACTION_MODIFIER', 12) ;
define ('BAZ_ACTION_MODIFIER_V', 13) ;
define ('BAZ_ACTION_SUPPRESSION', 14) ;
define ('BAZ_ACTION_PUBLIER', 15) ;
define ('BAZ_ACTION_PAS_PUBLIER', 16) ;
define ('BAZ_S_INSCRIRE', 17);
define ('BAZ_VOIR_FLUX_RSS', 18);
 
//==================================== LES FLUX RSS==================================
// Constantes liées aux flux RSS
//==================================================================================
 
define('BAZ_CREER_FICHIERS_XML',0); //0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/
define('BAZ_RSS_NOMSITE','Educ-Envir.org'); //Nom du site indiqué dans les flux rss
define('BAZ_RSS_ADRESSESITE','http://educ-envir.org'); //Adresse Internet du site indiqué dans les flux rss
define('BAZ_RSS_DESCRIPTIONSITE','Educ-Envir.org, pour mutualiser l\'information en éducation à l\'environnement.'); //Description du site indiquée dans les flux rss
define('BAZ_RSS_LOGOSITE','http://ecole-et-nature.org/images/Logo_REN-Site.png'); //Logo du site indiqué dans les flux rss
define('BAZ_RSS_MANAGINGEDITOR', 'nom@domaine.tld') ; //Managing editor du site
define('BAZ_RSS_WEBMASTER', 'nom@domaine.tld') ; //Mail Webmaster du site
define('BAZ_RSS_CATEGORIE', 'Education a l\'environnement'); //catégorie du flux RSS
 
 
//==================================== PARAMETRAGE =================================
// Pour régler certaines fonctionnalité de l'application
//==================================================================================
 
define ('BAZ_ETAT_VALIDATION',0);
//Valeur par défaut d'état de la fiche annonce après saisie
//Mettre 0 pour 'en attente de validation d'un administrateur'
//Mettre 1 pour 'directement validée en ligne'
 
define ('BAZ_TAILLE_MAX_FICHIER',2000*1024);
//Valeur maximale en octets pour la taille d'un fichier joint à tàlàcharger
 
define ('BAZ_TYPE_AFFICHAGE_LISTE', 'jma');
$GLOBALS['_BAZAR_']['db'] = & $GLOBALS['_GEN_commun']['pear_db'];
$GLOBALS['AUTH'] =& $GLOBALS['_GEN_commun']['pear_auth'];
define ('BAZ_ANNUAIRE','annuaire'); //Table annuaire
define ('BAZ_CHAMPS_ID','a_id'); //Champs index sur la table annuaire
define ('BAZ_CHAMPS_NOM','a_nom'); //Champs nom sur la table annuaire
define ('BAZ_CHAMPS_PRENOM','a_prenom'); //Champs prenom sur la table annuaire
define ('BAZ_CHAMPS_EST_STRUCTURE','a_est_structure'); //Champs indiquant si c'est une structure qui est identifiée
define ('BAZ_CHAMPS_EMAIL','a_mail'); //Champs prenom sur la table annuaire
define ('BAZ_CHAMPS_NOM_WIKI','a_nom_wikini'); //Champs nom wikini sur la table annuaire
 
/** Réglage des droits pour déposer des annonces */
// Mettre à true pour limiter le dépôt aux rédacteurs
define ('BAZ_RESTREINDRE_DEPOT', 0) ;
 
/** Réglage de l'affichage de la liste deroulante pour la saisie des dates */
// Mettre à true pour afficher une liste deroulante vide pour la saisie des dates
define ('BAZ_DATE_VIDE', 0);
 
/** Réglage de l'URL de l'annuaire */
// Mettre l'URL correspondant à l'annuaire
define ('BAZ_URL_ANNUAIRE', 'http://localhost/papyrus/papyrus.php?site=1&menu=13');
 
// Mettre à true pour faire apparaitre un champs texte déroulant dans le formulaire
// de recherche des fiches, pour choisir les émetteurs
define ('BAZ_RECHERCHE_PAR_EMETTEUR', 1) ;
 
$GLOBALS['_BAZAR_']['url'] = $GLOBALS['_GEN_commun']['url'];
 
//BAZ_CHEMIN_APPLI : chemin vers l'application bazar METTRE UN SLASH (/) A LA FIN!!!!
define('BAZ_CHEMIN_APPLI', PAP_CHEMIN_RACINE.'client/bazar/');
 
//==================================== LES LANGUES ==================================
// Constantes liées à l'utilisation des langues
//==================================================================================
$GLOBALS['_BAZAR_']['langue']='fr-FR';
define ('BAZ_LANGUE_PAR_DEFAUT', 'fr') ; //Indique un code langue par défaut
define ('BAZ_VAR_URL_LANGUE', 'lang') ; //Nom de la variable GET qui sera passée dans l'URL (Laisser vide pour les sites monolingues)
//code pour l'inclusion des langues NE PAS MODIFIER
if (BAZ_VAR_URL_LANGUE != '' && isset (${BAZ_VAR_URL_LANGUE})) {
include_once BAZ_CHEMIN_APPLI.'langues/baz_langue_'.${BAZ_VAR_URL_LANGUE}.'.inc.php';
} else {
include_once BAZ_CHEMIN_APPLI.'langues/baz_langue_'.BAZ_LANGUE_PAR_DEFAUT.'.inc.php';
}
 
// Option concernant la division des resultats en pages
define ('BAZ_NOMBRE_RES_PAR_PAGE', 30);
define ('BAZ_MODE_DIVISION', 'Jumping'); // 'Jumping' ou 'Sliding' voir http://pear.php.net/manual/fr/package.html.pager.compare.php
define ('BAZ_DELTA', 12); // Le nombre de page à afficher avant le 'next';
 
/** Réglage de l'affichage du formulaire de recherche avancee */
// Mettre à true pour afficher automatiquement le formulaire de recherche avancee, à false pour avoir un lien afficher la recherche avancee
define ('BAZ_MOTEUR_RECHERCHE_AVANCEE', 1);
 
/** Réglage de l'utilisation ou non des templates */
// Mettre à true pour afficher les pages incluses dans la base bazar_template, à false sinon
define ('BAZ_UTILISE_TEMPLATE',1);
 
// Mettre ici le type d'annonce qui va s'afficher dans les calendriers.
// Il est possible d'indiquer plusieurs identifiant de nature de fiche (bn_id_nature) en séparant les nombre par des
// virgules : '1,2,3'
define ('BAZ_NUM_ANNONCE_CALENDRIER', 3);
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.28 2007/04/20 09:57:21 florian
* correction bugs suite au merge
*
* Revision 1.27 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.21.2.1 2007/02/15 13:43:54 jp_milcent
* Ajout de commentaire pour la constante utilisée par le Calendrier.
*
* Revision 1.21 2006/10/05 08:53:50 florian
* amelioration moteur de recherche, correction de bugs
*
* Revision 1.20 2006/07/04 13:59:01 alexandre_tb
* Ajout de la constante BAZ_NUM_ANNONCE_CALENDRIER dans le fichier de conf. Elle indique le type d'annonce que le calendrier doit afficher
*
* Revision 1.19 2006/06/21 15:40:15 alexandre_tb
* rétablissement du menu mes fiches
*
* Revision 1.18 2006/06/02 09:29:30 florian
* ajout constante nom wikini
*
* Revision 1.17 2006/05/19 13:53:57 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.16 2006/05/17 09:48:48 alexandre_tb
* Ajout des constantes pour le découpage en page
*
* Revision 1.15 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
* Revision 1.14 2006/03/24 09:23:30 alexandre_tb
* ajout de la variable globale $GLOBALS['_BAZAR_']['filtre']
*
* Revision 1.13 2006/03/14 17:10:21 florian
* ajout des fonctions de syndication, changement du moteur de recherche
*
* Revision 1.12 2006/02/07 13:57:41 alexandre_tb
* ajout de la constante pour masquer la liste des émetteurs
*
* Revision 1.11 2006/01/18 10:03:36 florian
* recodage de l'insertion et de la maj des données relatives aux listes et checkbox dans des formulaires
*
* Revision 1.10 2006/01/03 10:19:31 florian
* Mise à jour pour accepter des parametres dans papyrus: faire apparaitre ou non le menu, afficher qu'un type de fiches, définir l'action par défaut...
*
* Revision 1.9 2005/12/16 15:47:54 alexandre_tb
* ajout de l'option restreindre dépôt
*
* Revision 1.8 2005/10/24 09:42:21 florian
* mise a jour appropriation
*
* Revision 1.7 2005/10/21 16:15:04 florian
* mise a jour appropriation
*
* Revision 1.6 2005/09/30 12:22:54 florian
* Ajouts commentaires pour fiche, modifications graphiques, maj SQL
*
* Revision 1.4 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.2 2005/02/22 15:34:17 florian
* integration dans Papyrus
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.5 2004/07/08 12:15:32 florian
* ajout constantes pour flux RSS
*
* Revision 1.4 2004/07/06 16:21:54 florian
* débogage modification + MAJ flux RSS
*
* Revision 1.3 2004/07/02 14:50:47 florian
* ajout configuration de l'etat de l'annonce (visible,masquée,...)
*
* Revision 1.2 2004/07/01 10:13:30 florian
* modif Florian
*
* Revision 1.1 2004/06/23 09:58:32 alex
* version initiale
*
* Revision 1.1 2004/06/18 09:00:41 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/configuration/bazar.admin.config.php
New file
0,0 → 1,71
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: bazar.admin.config.php,v 1.1 2007-02-02 14:01:20 alexandre_tb Exp $
 
/**
* Papyrus : Programme d'administration du bazar
*
* Fichier de configuration
*@package Bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// BAZ_CHEMIN_APPLI : chemin vers l'application bazar METTRE UN SLASH (/) A LA FIN!!!!
define('BAZ_CHEMIN_APPLI', PAP_CHEMIN_RACINE.'client/bazar/');
 
 
// Variable action
define ('BAZ_VARIABLE_ACTION', 'action');
 
// +------------------------------------------------------------------------------------------------------+
// | CONSTANTES D ACTION |
// +------------------------------------------------------------------------------------------------------+
 
define ('BAZ_ACTION_VOIR_TEMPLATE', 1);
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bazar.calendrier.applette.php
New file
0,0 → 1,70
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: bazar.calendrier.applette.php,v 1.8 2007-04-11 08:30:12 neiluj Exp $
/**
* bazar_calendrier : programme affichant les evenements du bazar sous forme de Calendrier
*
*
*@package Bazar
//Auteur original :
*@author David DELON <david.delon@clapas.net>
*@version $Revision: 1.8 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
if (!defined('BAZ_VOIR_FICHE')) {
define ('BAZ_VOIR_FICHE', 8);
}
 
include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
include_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazar
 
include_once 'bibliotheque/bazar.fonct.cal.php'; //fichier des fonctions de Bazar
 
 
 
$GLOBALS['_CAL_']['nom_fonction'] = 'afficherCalendrier';
$_GEN_commun['info_applette_nom_fonction'] = $GLOBALS['_CAL_']['nom_fonction'];
// Balise : CLIENT_BAZAR_CALENDRIER
$_GEN_commun['info_applette_balise'] = 'BAZAR_CALENDRIER';
 
 
function afficherCalendrier() {
 
return GestionAffichageCalendrier('calendrier_applette');
}
?>
/branches/v2.0-narmer/client/bazar/documentation/balises.txt
New file
0,0 → 1,2
Affichage calendrier :
CLIENT_BAZAR_CALENDRIER
/branches/v2.0-narmer/client/bazar/documentation/bazar_v0.24.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bazar/documentation/bazar_v0.24.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bazar/bazar.admin.php
New file
0,0 → 1,169
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2004 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: bazar.admin.php,v 1.2 2007-04-20 09:57:21 florian Exp $
 
/**
* Papyrus : Programme d'administration du bazar
*
* La page contient l'appel aux fonctions de l'application de vérification de l'installation puis
* l'appel du fichier réalisant l'initialisation. Enfin, l'appel du fichier réalisant le rendu et
* retournant la page au navigateur client.
*
*@package Bazar
//Auteur original :
*@author Florian SCHMITT <florian.schmitt@laposte.net>
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
//appel du fichier de constantes des langues
include_once 'langues/baz_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
 
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
 
class Bazar_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction redigerContenu() - Affiche le formulaire de r?action
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
//-------------------------------------------------------------------------------------------------------------------
// Initialisation des attributs
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
$this->objet_pear_db = $GLOBALS['_GEN_commun']['pear_db'];
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
$this->sortie_xhtml = '<h1>'.BAZ_CONFIG.'</h1>'."\n";
//-------------------------------------------------------------------------------------------------------------------
// Gestion des boutons de l'interface
if (isset($_POST['afficheur_annuler'])) {
return false;
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
$requete = 'UPDATE gen_menu SET gm_application_arguments="num_questionnaire='.$_POST['num_questionnaire'].
'||mail_questionnaire='.$_POST['mail_questionnaire'].'||texte_questionnaire_envoye='.$_POST['texte_questionnaire_envoye'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans le menu
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
//echo $requete;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$valeurs_par_defaut = array();
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$arguments = explode('||', $ligne->gm_application_arguments);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i], 2);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
//valeurs par defaut enregistrees dans la table
if (isset($info_application)) {
$valeurs_par_defaut['num_questionnaire']=$info_application->num_questionnaire;
$valeurs_par_defaut['mail_questionnaire']=$info_application->mail_questionnaire;
$valeurs_par_defaut['texte_questionnaire_envoye']=$info_application->texte_questionnaire_envoye;
}
} else {
//valeurs par defaut pour afficher une carto des structures
$valeurs_par_defaut['num_questionnaire']='';
$valeurs_par_defaut['mail_questionnaire']='';
$valeurs_par_defaut['texte_questionnaire_envoye']='';
}
//--------------------------------------------------------------------------------------------------------------
// Gestion du questionnaire
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
$form =& new HTML_QuickForm('form_param_bazar', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<p>'."\n".
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </label>'."\n".'{element}'."\n".
'</p>'."\n" );
$form->addElement('text', 'mail_questionnaire', QUESTIONNAIRE_MAIL);
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
$form->addElement('html', $liste_bouton_debut);
$form->addElement('submit', 'afficheur_enregistrer_quitter', BAZ_ENREGISTRER_ET_QUITTER);
$form->addElement('submit', 'afficheur_annuler', BAZ_ANNULER);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$form->setDefaults($valeurs_par_defaut);
$this->sortie_xhtml .= $form->toHTML()."\n";
return $this->sortie_xhtml;
}
 
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.1 2007/02/02 14:02:08 alexandre_tb
* version initiale vide pour le moment
*
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazarTemplate.class.php
New file
0,0 → 1,70
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: bazarTemplate.class.php,v 1.2.2.1 2007-05-24 15:09:46 neiluj Exp $
 
/**
* Application projet
*
* La classe d acces aux templates du bazar
*
*@package bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PAP_CHEMIN_API_PEAR.'PEAR.php' ;
 
class bazarTemplate extends PEAR {
 
 
var $_db ;
function bazarTemplate(&$objetDB) {
$this->_db = $objetDB ;
}
function getTemplate ($id_template, $lang='fr-FR', $categorie_nature = 0) {
$requete = 'select bt_template from bazar_template where bt_id_template='.$id_template.
' and bt_id_i18n like "'.$lang.'%"' ;
if($categorie_nature != 0)
$requete .= ' and bt_categorie_nature='.$categorie_nature ;
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) return $this->raiseError ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
if ($resultat->numRows() == 0) return $this->raiseError ('Aucun template avec l\'identifiant: '.$id_template.
' et la langue: '.$lang.'<br />'.$$requete) ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->bt_template ;
}
}
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.fonct.formulaire.controles.php
New file
0,0 → 1,51
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.formulaire.controles.php,v 1.1 2005-11-07 17:05:45 florian Exp $
/**
* Formulaire controles
*
* Les fonctions de controles de saisie des formulaires
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2005-11-07 17:05:45 $
// +------------------------------------------------------------------------------------------------------+
*/
 
//-------------------FONCTIONS DE MISE EN PAGE DES FORMULAIRES
 
/** liste_choisir() - Teste si une valeur à été choisie pour une liste
*
*
*/
function liste_choisir($element_name,$element_value) {
if ($element_value == 0) {
return false;
}
else {
return true;
}
}
 
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.class.php
New file
0,0 → 1,209
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.class.php,v 1.6 2007-04-20 09:58:06 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LES CONSTANTES DES NIVEAUX DE DROIT |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
class Administrateur_bazar {
 
var $_auth ;
/**
* Identifiant de l'utilisateur
*/
var $_id_utilisateur ;
 
/**
* Vaut true si l'utilisateur est un administrateur
*/
var $_isSuperAdmin ;
/** Constructeur
*
* @param object Un objet authentification
* @return void
*
*/
function Administrateur_bazar (&$AUTH) {
$this->_auth = $AUTH ;
if ($AUTH->getAuth())$this->_id_utilisateur = $this->_auth->getAuthData(BAZ_CHAMPS_ID) ;
}
/** isSuperAdmin () - Renvoie true si l'utilisateur est un super administrateur
*
*/
function isSuperAdmin() {
if(empty($this->_id_utilisateur))
return FALSE;
// On court-circuite si la question a déjà été posé pour ne pas refaire la requete
if (isset ($this->_isSuperAdmin)) return $this->_isSuperAdmin ;
// On court-circuite si l'utilisateur n'est pas logué
if (!$this->_auth->getAuth()) return false ;
// Sinon on interroge la base
$requete = 'SELECT bd_niveau_droit FROM bazar_droits WHERE bd_id_utilisateur='.
$this->_id_utilisateur.
' AND bd_niveau_droit=0';
 
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$this->_isSuperAdmin = true ;
} else {
$this->_isSuperAdmin = false ;
}
return $this->_isSuperAdmin;
}
/** isAdmin () - Renvoie true si l'utilisateur est administrateur du type de fiche spécifié
*
* @param interger type_annonce Le type de l'annonce
*
*/
function isAdmin($id_nature) {
// on court-circuite si l'utilisateur n'est pas logué
if (!$this->_auth->getAuth()) return false ;
return $this->_requeteDroit ($id_nature, 2) ;
}
/** isRedacteur() - Renvoie true si l'utilisateur est rédacteur du type de fiche spécifié
*
*/
function isRedacteur($id_nature) {
return $this->_requeteDroit ($id_nature, 1) ;
}
/** _requeteDroit() - fait une requete sur la table bazar_droit
*
*/
function _requeteDroit ($id_nature, $niveau) {
if(empty($this->_id_utilisateur))
return false;
$requete = 'SELECT bd_niveau_droit FROM bazar_droits WHERE bd_id_utilisateur='
.$this->_id_utilisateur.
' AND bd_id_nature_offre="'.$id_nature.'" and bd_niveau_droit='.$niveau;
 
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
return true ;
}
return false ;
}
}
 
class Utilisateur_bazar extends Administrateur_bazar {
function Utilisateur_bazar($id_utilisateur) {
$this->_id_utilisateur = $id_utilisateur ;
}
function isAdmin($id_nature) {
return $this->_requeteDroit ($id_nature, 2) ;
}
/** isSuperAdmin () - Renvoie true si l'utilisateur est un super administrateur
*
*/
function isSuperAdmin() {
if(empty($this->_id_utilisateur))
return false;
// On court-circuite si la question a déjà été posé pour ne pas refaire la requete
if (isset ($this->_isSuperAdmin)) return $this->_isSuperAdmin ;
// Sinon on interroge la base
$requete = 'SELECT bd_niveau_droit FROM bazar_droits WHERE bd_id_utilisateur='.
$this->_id_utilisateur.
' AND bd_niveau_droit=0';
 
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$this->_isSuperAdmin = true ;
} else {
$this->_isSuperAdmin = false ;
}
return $this->_isSuperAdmin;
}
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.3.2.1 2007/03/07 16:49:21 jp_milcent
* Mise en majuscule de select
*
* Revision 1.3 2006/03/29 13:05:12 alexandre_tb
* ajout de la classe Administrateur_bazar
*
* Revision 1.2 2006/02/09 11:06:12 alexandre_tb
* changement dans les id des droit
* 0 => super administrateur
* 1 => redacteur
* 2 => administrateur
*
* Revision 1.1 2006/02/07 11:08:06 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.fonct.cal.php
New file
0,0 → 1,317
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.cal.php,v 1.17.2.1 2007-05-09 13:56:49 alexandre_tb Exp $
/**
*
* Fonctions calendrier du module bazar
*
*@package bazar
//Auteur original :
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.17.2.1 $ $Date: 2007-05-09 13:56:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
// Classe Utilitaire pour Calendrier
class DiaryEvent extends Calendar_Decorator {
var $entry = array();
function DiaryEvent($calendar)
{
Calendar_Decorator::Calendar_Decorator($calendar);
}
function setEntry($entry)
{
$this->entry[] = $entry;
}
function getEntry()
{
return $this->entry;
}
}
 
 
// $type : calendrier
// $type : calendrier_appplette
function GestionAffichageCalendrier($type = 'calendrier') {
$retour = '';
 
$url = $GLOBALS['_GEN_commun']['url'] ;
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
if (!isset($_GET['y'])) {
$_GET['y'] = date('Y');
}
if (!isset($_GET['m'])) {
$_GET['m'] = date('m');
}
// Construction Mois en Cours
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
 
$curStamp = $month->getTimeStamp();
$url->addQueryString('y', date('Y',$curStamp));
$url->addQueryString('m', date('n',$curStamp));
$url->addQueryString('d', date('j',$curStamp));
$cur = $url->getUrl();
// Navigation
$prevStamp = $month->prevMonth(true);
$url->addQueryString('y', date('Y',$prevStamp));
$url->addQueryString('m', date('n',$prevStamp));
$url->addQueryString('d', date('j',$prevStamp));
$prev = $url->getUrl();
$nextStamp = $month->nextMonth(true);
$url->addQueryString('y', date('Y',$nextStamp));
$url->addQueryString('m', date('n',$nextStamp));
$url->addQueryString('d', date('j',$nextStamp));
$next = $url->getUrl();
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
 
$retour.= "<div class=\"navi\">";
$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>";
 
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$cur;
$retour.= "\"> ";
$retour.= $fr_month[(date('n',$curStamp))];
$retour.= "&nbsp;";
$retour.= (date('Y',$curStamp));
$retour.= "</a>";
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
 
$retour.= "</div>";
 
$retour.="<br></br>";
 
// Vue Mois calendrier ou vue applette
if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
// Recherche evenement de la periode selectionnée
// TODO : Selectionner element du mois en cours
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement , bf_date_fin_evenement, bf_description ".
"FROM bazar_fiche, bazar_nature ".
"WHERE YEAR(bf_date_debut_evenement) = ".date('Y',$curStamp)." ".
"AND month(bf_date_debut_evenement) = ".date('m',$curStamp)." ".
"AND bf_ce_nature = bn_id_nature ".
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.") ".
"AND bf_statut_fiche = 1 ".
"ORDER BY bf_jour_debut_evenement";
$resultat_evenement = $db->query($requete_evenements);
(DB::isError($resultat_evenement))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
: '';
$calcom="";
$selection=array();
$evenements=array();
$prev_curday_ymd=0;
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
$curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
if ($curday_ymd!=$prev_curday_ymd) {
$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
$DiaryEvent = new DiaryEvent($Day);
$prev_curday_ymd=$curday_ymd;
}
$DiaryEvent->setEntry($ligne_evenements);
// Add the decorator to the selection
$selection[] = $DiaryEvent;
}
// Affichage Calendrier
$month->build($selection);
if ($type=='calendrier') {
$retour.= "<table class=\"calendar\">
<tr>
<th> ". BAZ_LUNDI ."</th>
<th> ". BAZ_MARDI ."</th>
<th> ". BAZ_MERCREDI ."</th>
<th> ". BAZ_JEUDI ."</th>
<th> ". BAZ_VENDREDI ."</th>
<th> ". BAZ_SAMEDI ."</th>
<th> ". BAZ_DIMANCHE ."</th>
</tr>
";
}
else {
$retour.= "<table class=\"calendar\">
<tr>
<th> ". BAZ_LUNDI_COURT ."</th>
<th> ". BAZ_MARDI_COURT ."</th>
<th> ". BAZ_MERCREDI_COURT ."</th>
<th> ". BAZ_JEUDI_COURT ."</th>
<th> ". BAZ_VENDREDI_COURT ."</th>
<th> ". BAZ_SAMEDI_COURT ."</th>
<th> ". BAZ_DIMANCHE_COURT ."</th>
</tr>
";
}
$todayStamp=time();
$today_ymd=date('Ymd',$todayStamp);
// Other month : mois
//
while ($day = $month->fetch() ) {
$dayStamp = $day->thisDay(true);
$day_ymd=date('Ymd',$dayStamp);
if ( $day->isEmpty() ) {
$class = "other_month";
}
else {
if (($day_ymd < $today_ymd)) {
$class= "previous_month";
}
else {
if ($day_ymd == $today_ymd) {
$class= "current_day";
}
else {
$class="current_month";
}
}
}
$url->addQueryString ('y', date('Y',$dayStamp));
$url->addQueryString ('m', date('n',$dayStamp));
$url->addQueryString ('d', date('j',$dayStamp));
$link = $url->getUrl();
// isFirst() to find start of week
if ($day->isFirst())
$retour.= ( "<tr>\n" );
//$retour.= ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" );
if ($type=='calendrier') {
$retour.= "<td class=\"".$class."\">".$day->thisDay()."\n";
if ($day->isSelected() ) {
$evenements=$day->getEntry();
while ($ligne_evenement=array_pop($evenements)) {
$id_fiches=array();
$id_fiches[]=$ligne_evenement->bf_id_fiche;
$url->addQueryString ('id_fiches',$id_fiches);
$link = $url->getUrl();
$retour.= "<a href=\"".$link."\">".$ligne_evenement->bf_titre."</a>\n";
$url->removeQueryString ('id_fiches');
}
}
}
else {
$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
if ($day->isSelected() ) {
$evenements=$day->getEntry();
$id_fiches=array();
while ($ligne_evenement=array_pop($evenements)) {
$id_fiches[]=$ligne_evenement->bf_id_fiche;
}
$url->addQueryString ('id_fiches',$id_fiches);
$link = $url->getUrl();
$lien_date= "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n";
$url->removeQueryString ('id_fiches');
}
$retour.=$lien_date;
}
$retour.= ( "</td>\n" );
// isLast() to find end of week
if ( $day->isLast() )
$retour.= ( "</tr>\n" );
}
$retour.= "</table>";
}
// Vue detail
if ((isset($_GET['id_fiches']))) {
// Ajout des styles du bazar
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne2', 'client/bazar/bazar.interne.css');
}
// Ajout d'un titre pour la page avec la date
$jours = array ( 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi') ;
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
'octobre', 'novembre', 'décembre') ;
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
}
 
// Nettoyage de l'url
$url->removeQueryString('id_fiches');
$url->removeQueryString('y');
$url->removeQueryString('m');
$url->removeQueryString('d');
return $retour;
}
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.fonct.php
New file
0,0 → 1,1554
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.php,v 1.63.2.1 2007-05-23 10:22:57 jp_milcent Exp $
/**
*
* Fonctions du module bazar
*
*
*@package bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.63.2.1 $ $Date: 2007-05-23 10:22:57 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/Table.php' ;
require_once 'bazar.fonct.formulaire.php';
require_once 'bazar.fonct.rss.php';
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/** niveau_droit() - Retourne le niveau de droit de l'utilisateur
*
* @param integer Id de la nature d'offre pour connaitre les droits sur une rubrique
* @param integer Id de la personne (par défaut la personne loguée)
*
* @return string Retourne 'redacteur', 'administrateur', 'superadministrateur', ou 'aucun'
*/
function niveau_droit($id_nature_offre='0', $personne) {
$requete = 'SELECT bd_niveau_droit FROM bazar_droits WHERE bd_id_utilisateur='.$personne.
' AND (bd_id_nature_offre="'.$id_nature_offre.'" OR bd_id_nature_offre=0)';
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
if ($ligne['bd_niveau_droit']==0) return 'superadministrateur';
if ($ligne['bd_niveau_droit']==1) return 'redacteur';
if ($ligne['bd_niveau_droit']==2) return 'administrateur';
}
}
else return 'aucun';
}
 
 
/** fiches_a_valider () - Renvoie les annonces restant à valider par un administrateur
*
* @return string HTML
*/
function fiches_a_valider() {
// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
// On effectue une requete sur le bazar pour voir les fiches a administrer
$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2><br />'."\n";
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bf_date_maj_fiche DESC' ;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$tableAttr = array('id' => 'table_bazar') ;
$table = new HTML_Table($tableAttr) ;
$entete = array (BAZ_TITREANNONCE ,BAZ_ANNONCEUR, BAZ_TYPEANNONCE, BAZ_PUBLIER, BAZ_SUPPRIMER) ;
$table->addRow($entete) ;
$table->setRowType (0, 'th') ;
// On affiche une ligne par proposition
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
//Requete pour trouver le nom et prénom de l'annonceur
$requetenomprenom = 'SELECT '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_NOM.' FROM '.BAZ_ANNUAIRE.
' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'] ;
$resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query ($requetenomprenom) ;
if (DB::isError($resultatnomprenom)) {
echo ("Echec de la requete<br />".$resultatnomprenom->getMessage()."<br />".$resultatnomprenom->getDebugInfo()) ;
}
while ($lignenomprenom = $resultatnomprenom->fetchRow (DB_FETCHMODE_ASSOC)) {
$annonceur=$lignenomprenom[BAZ_CHAMPS_PRENOM]." ".$lignenomprenom[BAZ_CHAMPS_NOM];
}
// Nettoyage de l'url
// NOTE (jpm - 23 mai 2007): pour être compatible avec PHP5 il faut utiliser tjrs $GLOBALS['_BAZAR_']['url'] car en php4 on
// copie bien une variable mais pas en php5, cela reste une référence...
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $ligne['bn_id_nature']);
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
$lien_voir = $GLOBALS['_BAZAR_']['url']->getURL();
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
 
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_PUBLIER);
$lien_publie_oui = $GLOBALS['_BAZAR_']['url']->getURL();
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_PAS_PUBLIER);
$lien_publie_non = $GLOBALS['_BAZAR_']['url']->getURL();
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$lien_supprimer = $GLOBALS['_BAZAR_']['url']->getURL();
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
$table->addRow (array(
'<a href="'.$lien_voir.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom
$annonceur."\n", // col 2 : annonceur
$ligne['bn_label_nature']."\n", // col 3 : type annonce
"<a href=\"".$lien_publie_oui."\">".BAZ_OUI."</a> / \n".
"<a href=\"".$lien_publie_non."\">".BAZ_NON."</a>", // col 4 : publier ou pas
"<a href=\"".$lien_supprimer."\"".
" onclick=\"javascript:return confirm('".BAZ_CONFIRMATION_SUPPRESSION."');\">".BAZ_SUPPRIMER."</a>\n")) ; // col 5 : supprimer
}
$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
$table->updateColAttributes(1, array("align" => "center"));
$table->updateColAttributes(2, array("align" => "center"));
$table->updateColAttributes(3, array("align" => "center"));
$table->updateColAttributes(4, array("align" => "center"));
$res .= $table->toHTML() ;
}
else {
$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE_A_VALIDER.'</p>'."\n" ;
}
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
$res .= '<br /><ul style="clear:both;"><li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_CONSULTER_FICHES_VALIDEES.'">'.BAZ_CONSULTER_FICHES_VALIDEES.'</a></li></ul>';
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
 
return $res;
}
 
 
/** mes_fiches () - Renvoie les fiches bazar d'un utilisateur
*
* @return string HTML
*/
function mes_fiches() {
$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
if ($GLOBALS['AUTH']->getAuth()) {
// requete pour voir si l'utilisateur a des fiches a son nom, classees par date de MAJ et nature d'annonce
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$tableAttr = array('id' => 'table_bazar') ;
$table = new HTML_Table($tableAttr) ;
$entete = array (BAZ_TITREANNONCE , BAZ_TYPEANNONCE, BAZ_ETATPUBLICATION, BAZ_MODIFIER, BAZ_SUPPRIMER) ;
$table->addRow($entete) ;
$table->setRowType (0, "th") ;
// On affiche une ligne par proposition
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
if ($ligne['bf_statut_fiche']==1) $publiee=BAZ_PUBLIEE;
elseif ($ligne['bf_statut_fiche']==0) $publiee=BAZ_ENCOURSDEVALIDATION;
else $publiee=BAZ_REJETEE;
$lien_voir = $GLOBALS['_BAZAR_']['url'];
$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']);
$lien_voir_url=$lien_voir->getURL();
$lien_modifier = $GLOBALS['_BAZAR_']['url'];
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
$lien_modifier->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$lien_modifier->addQueryString('typeannonce', $ligne['bn_id_nature']);
$lien_modifier_url=$lien_modifier->getURL();
$lien_supprimer = $GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$lien_supprimer->addQueryString('typeannonce', $ligne['bn_id_nature']);
$lien_supprimer_url=$lien_supprimer->getURL();
$table->addRow (array(
'<a href="'.$lien_voir_url.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom
$ligne['bn_label_nature']."\n", // col 2: type annonce
$publiee."\n", // col 3 : publiee ou non
'<a href="'.$lien_modifier_url.'">'.BAZ_MODIFIER.'</a>'."\n", // col 4 : modifier
'<a href="'.$lien_supprimer_url.'" onclick="javascript:return '.
'confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 5 : supprimer
}
$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
$table->updateColAttributes(1, array("align" => "left"));
$table->updateColAttributes(2, array("align" => "center"));
$table->updateColAttributes(3, array("align" => "center"));
$table->updateColAttributes(4, array("align" => "center"));
$res .= $table->toHTML() ;
}
else {
$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE.'</p>'."\n" ;
}
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
$res .= '<br /><ul id="liste_liens"><li id="lien_saisir"><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'">'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'</a></li></ul>';
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
else {
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
$res .= '<form id="form_connexion" class="form_identification" action="' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
$res .= '" method="post">
<fieldset>
<legend>Identifiez vous</legend>
<label for="username">Courriel : </label>
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
<label for="password">Mot de passe : </label>
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
</fieldset>
</form>';
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
return $res;
}
 
/** baz_gestion_droits() interface de gestion des droits
*
* return string le code HTML
*/
function baz_gestion_droits() {
$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
$lien_formulaire->addQueryString('action', BAZ_GERER_DROITS);
 
//contruction du squelette du formulaire
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) );
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:150px;text-align:right;">'."\n".'{label} :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".'</tr>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
//Initialisation de la variable personne
if ( isset($_POST['personnes']) ) {
$personne=$_POST['personnes'];
}
else $personne=0;
//Cas ou les droits ont etes changes
if (isset($_GET['pers'])) {
$personne=$_GET['pers'];
//CAS DES DROITS POUR UN TYPE D'ANNONCE: On efface tous les droits de la personne pour ce type d'annonce
if (isset($_GET['idtypeannonce'])) {
$requete = 'DELETE FROM bazar_droits WHERE bd_id_utilisateur='.$_GET['pers'].
' AND bd_id_nature_offre='.$_GET['idtypeannonce'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
//CAS DU SUPER ADMIN: On efface tous les droits de la personne en general
else {
$requete = 'DELETE FROM bazar_droits WHERE bd_id_utilisateur='.$_GET['pers'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
if ($_GET['droits']=='superadmin') {
$requete = 'INSERT INTO bazar_droits VALUES ('.$_GET['pers'].',0,0)';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
elseif ($_GET['droits']=='redacteur') {
$requete = 'INSERT INTO bazar_droits VALUES ('.$_GET['pers'].','.$_GET['idtypeannonce'].',1)';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
elseif ($_GET['droits']=='admin') {
$requete = 'INSERT INTO bazar_droits VALUES ('.$_GET['pers'].','.$_GET['idtypeannonce'].',2)';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
}
//requete pour obtenir l'id, le nom et prenom des personnes inscrites a l'annuaire sauf soi meme
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.BAZ_ANNUAIRE.
' WHERE '.BAZ_CHAMPS_ID." != ".$GLOBALS['id_user'].' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
echo ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$res='<h2>'.BAZ_GESTION_DES_DROITS.'</h2><br />'."\n";
$res.=BAZ_DESCRIPTION_GESTION_DES_DROITS.'<br /><br />'."\n";
$personnes_select[0]=BAZ_SELECTION;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
}
$java=array ('style'=>'width:250px;','onchange'=>'this.form.submit();');
$formtemplate->addElement ('select', 'personnes', BAZ_LABEL_CHOIX_PERSONNE, $personnes_select, $java) ;
$defauts=array ('personnes'=>$personne);
$formtemplate->setDefaults($defauts);
$res.= $formtemplate->toHTML().'<br />'."\n" ;
if ($personne!=0) {
//cas du super utilisateur
$utilisateur = new Utilisateur_bazar($personne) ;
if ($utilisateur->isSuperAdmin()) {
$res.= '<br />'.BAZ_EST_SUPERADMINISTRATEUR.'<br /><br />'."\n";
$lien_enlever_superadmin=$GLOBALS['_BAZAR_']['url'];
$lien_enlever_superadmin->addQueryString('action', BAZ_GERER_DROITS);
$lien_enlever_superadmin->addQueryString('pers', $personne);
$lien_enlever_superadmin->addQueryString('droits', 'aucun');
$res.= '<a href='.$lien_enlever_superadmin->getURL().'>'.BAZ_CHANGER_SUPERADMINISTRATEUR.'</a><br />'."\n";
}
else {
$lien_passer_superadmin=$GLOBALS['_BAZAR_']['url'];
$lien_passer_superadmin->addQueryString('action', BAZ_GERER_DROITS);
$lien_passer_superadmin->addQueryString('pers', $personne);
$lien_passer_superadmin->addQueryString('droits', 'superadmin');
$res.= '<a href='.$lien_passer_superadmin->getURL().'>'.BAZ_PASSER_SUPERADMINISTRATEUR.'</a><br />'."\n";
//on cherche les differentes rubriques d'annonces
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre FROM bazar_nature';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$res.='<br /><b>'.BAZ_DROITS_PAR_TYPE.'</b><br /><br />';
$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')) ;
$table->addRow(array ('<strong>'.BAZ_TYPE_ANNONCES.'</strong>',
'<strong>'.BAZ_DROITS_ACTUELS.'</strong>',
'<strong>'.BAZ_PASSER_EN.'</strong>',
'<strong>'.BAZ_OU_PASSER_EN.'</strong>')) ;
$table->setRowType (0, 'th') ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$droits = niveau_droit($ligne['bn_id_nature'],$personne);
 
$lien_aucun_droit=$GLOBALS['_BAZAR_']['url'];
$lien_aucun_droit->addQueryString('action', BAZ_GERER_DROITS);
$lien_aucun_droit->addQueryString('pers', $personne);
$lien_aucun_droit->addQueryString('droits', 'aucun');
$lien_aucun_droit->addQueryString('idtypeannonce', $ligne["bn_id_nature"]);
$lien_passer_redacteur=$GLOBALS['_BAZAR_']['url'];
$lien_passer_redacteur->addQueryString('action', BAZ_GERER_DROITS);
$lien_passer_redacteur->addQueryString('pers', $personne);
$lien_passer_redacteur->addQueryString('droits', 'redacteur');
$lien_passer_redacteur->addQueryString('idtypeannonce', $ligne["bn_id_nature"]);
$lien_passer_admin=$GLOBALS['_BAZAR_']['url'];
$lien_passer_admin->addQueryString('action', BAZ_GERER_DROITS);
$lien_passer_admin->addQueryString('pers', $personne);
$lien_passer_admin->addQueryString('droits', 'admin');
$lien_passer_admin->addQueryString('idtypeannonce', $ligne["bn_id_nature"]);
if (isset($ligne['bn_image_titre'])) {
$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";
} else {
$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";
}
if ($utilisateur->isAdmin($ligne['bn_id_nature'])) {
$table->addRow(array($titre,
BAZ_DROIT_ADMIN,
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>'));
}
elseif ($utilisateur->isRedacteur($ligne['bn_id_nature'])) {
$table->addRow(array($titre,
BAZ_DROIT_REDACTEUR,
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
}
else {
$table->addRow(array($titre,
BAZ_AUCUN_DROIT,
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>',
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
}
}
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
$table->updateColAttributes(0, array('align' => 'left'));
$table->updateColAttributes(1, array('align' => 'left'));
$table->updateColAttributes(2, array('align' => 'left'));
$table->updateColAttributes(3, array('align' => 'left'));
$res.=$table->toHTML() ;
}
}
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('pers');
$GLOBALS['_BAZAR_']['url']->removeQueryString('droits');
$GLOBALS['_BAZAR_']['url']->removeQueryString('idtypeannonce');
 
return $res;
}
 
/** baz_formulaire() - Renvoie le menu pour les saisies et modification des annonces
*
* @param string choix du formulaire a afficher (soit formulaire personnalise de
* l'annonce, soit choix du type d'annonce)
*
* @return string HTML
*/
function baz_formulaire($mode) {
$res = '';
if ($GLOBALS['AUTH']->getAuth()) {
$lien_formulaire=$GLOBALS['_BAZAR_']['url'];
//Definir le lien du formulaire en fonction du mode de formulaire choisi
if ($mode == BAZ_DEPOSER_ANNONCE) {
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU);
if (isset($GLOBALS['_BAZAR_']['id_typeannonce']) && $GLOBALS['_BAZAR_']['id_typeannonce'] != 'toutes') {
$mode = BAZ_ACTION_NOUVEAU ;
}
}
if ($mode == BAZ_ACTION_NOUVEAU) {
if ((!isset($_POST['accept_condition']))and($GLOBALS['_BAZAR_']['condition']!=NULL)) {
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU);
} else {
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
}
}
if ($mode == BAZ_ACTION_MODIFIER) {
if (!isset($_POST['accept_condition'])and($GLOBALS['_BAZAR_']['condition']!=NULL)) {
$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER);
} else {
$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER_V);
}
$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
}
if ($mode == BAZ_ACTION_MODIFIER_V) {
$lien_formulaire->addQueryString('action', BAZ_ACTION_MODIFIER_V);
$lien_formulaire->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
}
//contruction du squelette du formulaire
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace ('/&amp;/', '&', $lien_formulaire->getURL()) );
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".'</tr>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
//------------------------------------------------------------------------------------------------
//AFFICHAGE DU FORMULAIRE GENERAL DE CHOIX DU TYPE D'ANNONCE
//------------------------------------------------------------------------------------------------
if ($mode == BAZ_DEPOSER_ANNONCE) {
$res = '';
//requete pour obtenir le nom et la description des types d'annonce
$requete = 'SELECT * FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') ORDER BY bn_label_nature ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
if ($resultat->numRows()==1) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
$GLOBALS['_BAZAR_']['template']=$ligne['bn_template'];
$GLOBALS['_BAZAR_']['commentaire']=$ligne['bn_commentaire'];
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation'];
$GLOBALS['_BAZAR_']['image_titre']=$ligne['bn_image_titre'];
$GLOBALS['_BAZAR_']['image_logo']=$ligne['bn_image_logo'];
$mode = BAZ_ACTION_NOUVEAU;
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
} else {
$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
if (($droitspers=='redacteur') or ($droitspers=='administrateur')
or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
if ($ligne['bn_image_titre']!='') {
$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.
$ligne['bn_label_nature'].'" />'.'<br />'."\n";
} else {
$titre='<h3>'.$ligne['bn_label_nature'].' : </h3>'."\n";
}
$formtemplate->addElement('radio', 'typeannonce', '',
$titre.$ligne['bn_description'].'<br /><br />'."\n",
$ligne['bn_id_nature'], array("id" => 'select'.$ligne['bn_id_nature'],
"style" => 'float:left;'));
}
}
$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
//Mettre les annonces en choix par defaut
$formtemplate->setdefaults(array('typeannonce'=>'1'));
//Bouton de validation du formulaire
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
//Affichage a l'ecran
$res.= $formtemplate->toHTML()."\n";
}
}
//------------------------------------------------------------------------------------------------
//AFFICHAGE DU FORMULAIRE CORRESPONDANT AU TYPE DE L'ANNONCE CHOISI PAR L'UTILISATEUR
//------------------------------------------------------------------------------------------------
if ($mode == BAZ_ACTION_NOUVEAU) {
unset ($_SESSION['formulaire_annonce_valide']) ;
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
$formtemplate->updateAttributes(array('action' => str_replace('&amp;', '&', $lien_formulaire->getURL())));
 
$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);
}
//------------------------------------------------------------------------------------------------
//CAS DE LA MODIFICATION D'UNE ANNONCE (FORMULAIRE DE MODIFICATION)
//------------------------------------------------------------------------------------------------
if ($mode == BAZ_ACTION_MODIFIER) {
$res=baz_afficher_formulaire_annonce('modification',$formtemplate);
}
// Nettoyage de l'url avant les return
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
//------------------------------------------------------------------------------------------------
//CAS DE L'INSCRIPTION D'UNE ANNONCE
//------------------------------------------------------------------------------------------------
if ($mode == BAZ_ACTION_NOUVEAU_V) {
if ($formtemplate->validate() && !isset($_SESSION['formulaire_annonce_valide'])) {
$formtemplate->process('baz_insertion', false) ;
$_SESSION['formulaire_annonce_valide'] = 1;
return;
}
}
//------------------------------------------------------------------------------------------------
//CAS DE LA MODIFICATION D'UNE ANNONCE (VALIDATION ET MAJ)
//------------------------------------------------------------------------------------------------
if ($mode == BAZ_ACTION_MODIFIER_V) {
if ($formtemplate->validate()) {
$formtemplate->process('baz_mise_a_jour', false) ;
return ;
}
}
}
else {
$res .= '<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2><br />'."\n";
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
$res .= '<form id="form_connexion" class="form_identification" action="' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
$res .= '" method="post">
<fieldset>
<legend>Identifiez vous</legend>
<label for="username">Courriel : </label>
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
<label for="password">Mot de passe : </label>
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
</fieldset>
</form>';
}
 
return $res;
}
 
/** baz_afficher_formulaire_annonce() - Genere le formulaire de saisie d'une annonce
*
* @param string type de formulaire: insertion ou modification
* @param mixed objet quickform du formulaire
*
* @return string code HTML avec formulaire
*/
function baz_afficher_formulaire_annonce($mode='insertion',$formtemplate) {
if ($mode=='modification') {
//initialisation de la variable globale id_fiche
$GLOBALS['_BAZAR_']['id_fiche'] = $_REQUEST['id_fiche'];
//suppression eventuelle d'une url, d'un fichier ou d'une image
if (isset($_GET['id_url'])) {
baz_suppression_url($_GET['id_url']);
}
if (isset($_GET['id_fichier'])) {
baz_suppression_fichier($_GET['id_fichier']);
}
if (isset($_GET['image'])) {
baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
}
}
//titre de la rubrique
$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.'&nbsp;'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
if (($GLOBALS['_BAZAR_']['condition']!='')AND(!isset($_POST['accept_condition']))AND(!isset($_GET['url'])OR(!isset($_GET['fichier']))OR(!isset($_GET['image'])))) {
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
$conditions= new HTML_QuickForm_html('<tr><td colspan="2" style="padding:5px; margin:5px; width: 90%; background: #C1CBA7;">'.$GLOBALS['_BAZAR_']['condition'].'</td>'."\n".'</tr>'."\n");
$formtemplate->addElement($conditions);
$formtemplate->addElement('checkbox', 'accept_condition',BAZ_ACCEPTE_CONDITIONS) ;
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
$formtemplate->addRule('accept_condition', BAZ_ACCEPTE_CONDITIONS_REQUIS, 'required', '', 'client') ;
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
}
//affichage du formulaire si conditions acceptees
else {
//Parcours du fichier de templates, pour mettre les valeurs des champs
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
if ($mode=='modification') {
//Ajout des valeurs par defaut
$valeurs_par_defaut = baz_valeurs_fiche($GLOBALS['_BAZAR_']['id_fiche']) ;
for ($i=0; $i<count($tableau); $i++) {
if ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
$def=$tableau[$i]['type'].$tableau[$i]['nom_bdd'];
}
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
$def=$tableau[$i]['nom_bdd'];
}
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
$tableau[$i]['limite2'], $valeurs_par_defaut[$def], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
}
}
else {
for ($i=0; $i<count($tableau); $i++) {
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
}
}
$formtemplate->addElement('hidden', 'typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
}
 
//Affichage a l'ecran
$res .= $formtemplate->toHTML()."\n";
return $res;
}
 
 
/** requete_bazar_fiche() - preparer la requete d'insertion ou de MAJ de la table bazar_fiche a partir du template
*
* @global mixed L'objet contenant les valeurs issues de la saisie du formulaire
* @return void
*/
function requete_bazar_fiche($valeur) {
$requete=NULL;
//l'annonce est directement publiée pour les admins
if ((niveau_droit($GLOBALS['_BAZAR_']['id_typeannonce'],$GLOBALS['id_user'])=='administrateur') or
(niveau_droit($GLOBALS['_BAZAR_']['id_typeannonce'],$GLOBALS['id_user'])=='superadministrateur')) {
$requete.='bf_statut_fiche=1, ';
}
else {
$requete.='bf_statut_fiche="'.BAZ_ETAT_VALIDATION.'", ';
}
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
for ($i=0; $i<count($tableau); $i++) {
//cas des checkbox et des listes
if ($tableau[$i]['type']=='checkbox' || $tableau[$i]['type']=='liste') {
//on supprime les anciennes valeurs de la table bazar_fiche_valeur_liste
$requetesuppression='DELETE FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetesuppression) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if (isset($valeur[$tableau[$i]['type'].$tableau[$i]['nom_bdd']]) && ($valeur[$tableau[$i]['type'].$tableau[$i]['nom_bdd']]!=0)) {
//on insere les nouvelles valeurs
$requeteinsertion='INSERT INTO bazar_fiche_valeur_liste (bfvl_ce_fiche, bfvl_ce_liste, bfvl_valeur) VALUES ';
//pour les checkbox, les différentes valeurs sont dans un tableau
if (is_array($valeur[$tableau[$i]['type'].$tableau[$i]['nom_bdd']])) {
$nb=0;
while (list($cle, $val) = each($valeur[$tableau[$i]['type'].$tableau[$i]['nom_bdd']])) {
if ($nb>0) $requeteinsertion .= ', ';
$requeteinsertion .= '('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$tableau[$i]['nom_bdd'].', '.$cle.') ';
$nb++;
}
}
//pour les listes, une insertion de la valeur suffit
else {
$requeteinsertion .= '('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$tableau[$i]['nom_bdd'].', '.$valeur[$tableau[$i]['type'].$tableau[$i]['nom_bdd']].')';
}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requeteinsertion) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
}
//cas des fichiers
elseif ($tableau[$i]['type']=='fichier') {
if (isset($valeur['texte_fichier'.$tableau[$i]['nom_bdd']]) && $valeur['texte_fichier'.$tableau[$i]['nom_bdd']]!='') {
baz_insertion_fichier($valeur['texte_fichier'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche'], 'fichier'.$tableau[$i]['nom_bdd']);
}
}
//cas des urls
elseif ($tableau[$i]['type']=='url') {
if (isset($valeur['url_lien'.$tableau[$i]['nom_bdd']]) && $valeur['url_lien'.$tableau[$i]['nom_bdd']]!='' ) {
baz_insertion_url($valeur['url_lien'.$tableau[$i]['nom_bdd']], $valeur['url_texte'.$tableau[$i]['nom_bdd']], $GLOBALS['_BAZAR_']['id_fiche']);
}
}
//cas des images
elseif ($tableau[$i]['type']=='image') {
if (isset($_FILES['image']['name']) && $_FILES['image']['name']!='') {
$requete .= baz_insertion_image($GLOBALS['_BAZAR_']['id_fiche']);
}
}
//cas des dates
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
// On construit la date selon le format YYYY-mm-dd
$date = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
// si la date de fin evenement est anterieure a la date de debut, on met la date de debut
// pour eviter les incoherence
if ($tableau[$i]['nom_bdd'] == 'bf_date_fin_evenement' &&
mktime(0,0,0, $valeur['bf_date_debut_evenement']['m'], $valeur['bf_date_debut_evenement']['d'], $valeur['bf_date_debut_evenement']['Y']) >
mktime(0,0,0, $valeur['bf_date_fin_evenement']['m'], $valeur['bf_date_fin_evenement']['d'], $valeur['bf_date_fin_evenement']['Y'])) {
$val = $valeur['bf_date_debut_evenement']['Y'].'-'.$valeur['bf_date_debut_evenement']['m'].'-'.$valeur['bf_date_debut_evenement']['d'] ;
} else {
$val = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
}
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
}
//cas des champs texte
elseif ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) {
//on mets les slashes pour les saisies dans les champs texte et textearea
$val=addslashes($valeur[$tableau[$i]['nom_bdd']]) ;
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
}
//cas des wikinis
elseif ( $tableau[$i]['type']=='wikini' && $_REQUEST['action']==BAZ_ACTION_NOUVEAU_V ) {
//on appelle les pages des apis et de l'integrateur wikini
include_once PAP_CHEMIN_RACINE.'api/sql/SQL_manipulation.fonct.php';
include_once PAP_CHEMIN_RACINE.'client/integrateur_wikini/configuration/adwi_configuration.inc.php' ;
include_once PAP_CHEMIN_RACINE.'client/integrateur_wikini/bibliotheque/adwi_wikini.fonct.php' ;
//génération du titre du wiki, sous la forme id-titre du projet
$titre=baz_titre_wiki($valeur["bf_titre"]);
//création du wiki
$valeur=array ("action"=> "nouveau_v", "code_alpha_wikini"=>$titre, "page"=>"AccueiL", "bdd_hote"=> "",
"bdd_nom"=> "", "bdd_utilisateur"=> "", "bdd_mdp" => "", "table_prefix"=> "", "chemin" => "wikini/".$titre, "valider"=> "Valider");
$val = insertion($valeur, $GLOBALS['_BAZAR_']['db']);
}
}
$requete.=' bf_date_maj_fiche=NOW()';
return $requete;
}
 
/** baz_insertion() - inserer une nouvelle fiche
*
* @array Le tableau des valeurs a inserer
* @integer Valeur de l'identifiant de la fiche
* @return void
*/
function baz_insertion($valeur) {
// =========== Insertion d'une nouvelle fiche ===================
//requete d'insertion dans bazar_fiche
$GLOBALS['_BAZAR_']['id_fiche'] = baz_nextid('bazar_fiche', 'bf_id_fiche', $GLOBALS['_BAZAR_']['db']) ;
$requete = 'INSERT INTO bazar_fiche SET bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].','.
'bf_ce_utilisateur='.$GLOBALS['id_user'].', bf_ce_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'].','.
'bf_date_creation_fiche=NOW(),';
if (!isset($_REQUEST['bf_date_debut_validite_fiche'])) {
$requete .= 'bf_date_debut_validite_fiche=now(), bf_date_fin_validite_fiche="0000-00-00", ' ;
}
$requete .=requete_bazar_fiche(&$valeur) ;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_insertion_url() - inserer un lien URL a une fiche
*
* @global string L'url du lien
* @global string Le texte du lien
* @global integer L'identifiant de la fiche
* @return void
*/
function baz_insertion_url($url_lien, $url_texte, $idfiche) {
//requete d'insertion dans bazar_url
$id_url = baz_nextId('bazar_url', 'bu_id_url', $GLOBALS['_BAZAR_']['db']) ;
$requete = 'INSERT INTO bazar_url SET bu_id_url='.$id_url.', bu_ce_fiche='.$idfiche.', '.
'bu_url="'.$url_lien.'", bu_descriptif_url="'.addslashes($url_texte).'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_insertion_fichier() - inserer un fichier a une fiche
*
* @global string Le label du fichier
* @global string La description du fichier
* @global integer L'identifiant de la fiche
* @return void
*/
function baz_insertion_fichier($fichier_description, $idfiche, $nom_fichier='fichier_joint') {
//verification de la presence de ce fichier
$requete = 'SELECT bfj_id_fichier FROM bazar_fichier_joint WHERE bfj_fichier="'.$_FILES[$nom_fichier]['name'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()==0) {
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES[$nom_fichier]['name'];
move_uploaded_file($_FILES[$nom_fichier]['tmp_name'], $chemin_destination);
}
$id_fichier_joint = baz_nextId('bazar_fichier_joint', 'bfj_id_fichier', $GLOBALS['_BAZAR_']['db']) ;
$requete = 'INSERT INTO bazar_fichier_joint SET bfj_id_fichier='.$id_fichier_joint.', bfj_ce_fiche='.$idfiche.
', bfj_description="'.addslashes($fichier_description).'", bfj_fichier="'.$_FILES[$nom_fichier]['name'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_insertion_image() - inserer une image a une fiche
*
* @global integer L'identifiant de la fiche
* @return string requete SQL
*/
function baz_insertion_image($idfiche) {
//verification de la presence de ce fichier
$requete = 'SELECT bf_id_fiche FROM bazar_fiche WHERE bf_url_image="'.$_FILES['image']['name'].'" AND bf_id_fiche!='.$idfiche;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()==0) {
$chemin_destination=BAZ_CHEMIN_APPLI.'upload/'.$_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination);
}
return 'bf_url_image="'.$_FILES['image']['name'].'", ' ;
}
 
 
/** baz_mise_a_jour() - Mettre a jour une fiche
*
* @global Le contenu du formulaire de saisie de l'annonce
* @return void
*/
function baz_mise_a_jour($valeur) {
//MAJ de bazar_fiche
$requete = 'UPDATE bazar_fiche SET '.requete_bazar_fiche(&$valeur,$GLOBALS['_BAZAR_']['id_typeannonce']);
$requete.= ' WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_suppression() - Supprime une fiche
*
* @global L'identifiant de la fiche a supprimer
* @return void
*/
function baz_suppression() {
$valeurs=baz_valeurs_fiche($_GET['id_fiche']);
//suppression des wikinis associes
//génération du titre du wiki, sous la forme id-titre du projet
$titre=baz_titre_wiki($valeurs["bf_titre"]);
$requete = 'SELECT gewi_id_wikini FROM gen_wikini WHERE gewi_code_alpha_wikini = "'.$titre.'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$id_wikini=$ligne['gewi_id_wikini'];
}
include_once PAP_CHEMIN_RACINE.'api/sql/SQL_manipulation.fonct.php';
include_once PAP_CHEMIN_RACINE.'client/integrateur_wikini/configuration/adwi_configuration.inc.php' ;
include_once PAP_CHEMIN_RACINE.'client/integrateur_wikini/bibliotheque/adwi_wikini.fonct.php' ;
adwi_supprimer_wikini($id_wikini, $GLOBALS['_BAZAR_']['db']);
}
// suppression des valeurs des listes et des cases à cocher
$requete = 'DELETE FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$_GET['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
//suppression des urls associes
$requete = 'SELECT bu_id_url FROM bazar_url WHERE bu_ce_fiche = '.$_GET['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'."\n") ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
baz_suppression_url($ligne['bu_id_url']);
}
//suppression des fichiers associes
$requete = 'SELECT bfj_id_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche = '.$_GET['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'."\n") ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
baz_suppression_fichier($ligne['bfj_id_fichier']);
}
//suppression dans bazar_fiche
$requete = 'DELETE FROM bazar_fiche WHERE bf_id_fiche = '.$_GET['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo().'<br />'."\n") ;
}
return ;
}
 
 
/** baz_suppression_url() - Supprimer un lien d'une fiche
*
* @global integer L'identifiant du lien
* @return void
*/
function baz_suppression_url($id_url) {
//suppression dans bazar_url
$requete = 'DELETE FROM bazar_url WHERE bu_id_url = '.$id_url;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_suppression_fichier() - Supprimer un fichier d'une fiche
*
* @global integer L'identifiant du fichier
* @return void
*/
function baz_suppression_fichier($id_fichier) {
//verification de l'utilisation du fichier joint pour une autre annonce
$requete = 'SELECT bfj_fichier FROM bazar_fichier_joint WHERE bfj_id_fichier='.$id_fichier;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$requete = 'SELECT bfj_fichier FROM bazar_fichier_joint WHERE bfj_fichier="'.$ligne['bfj_fichier'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
//si le fichier n'est que utilise dans cette fiche, on le supprime, on le laisse sinon
if ($resultat->numRows()==1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
unlink(BAZ_CHEMIN_APPLI.'upload/'.$ligne['bfj_fichier']);
}
//suppression dans la table bazar_fichier
$requete = 'DELETE FROM bazar_fichier_joint WHERE bfj_id_fichier = '.$id_fichier;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** baz_suppression_image() - Supprimer une image d'une fiche
*
* @global integer L'identifiant de la fiche
* @return void
*/
function baz_suppression_image($id_fiche) {
//verification de l'utilisation de l'image pour une autre annonce
$requete = 'SELECT bf_url_image FROM bazar_fiche WHERE bf_id_fiche='.$id_fiche;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$requete = 'SELECT bf_url_image FROM bazar_fiche WHERE bf_url_image="'.$ligne['bf_url_image'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
//si le fichier n'est que utilise dans cette fiche, on le supprime, on le laisse sinon
if ($resultat->numRows()==1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
unlink(BAZ_CHEMIN_APPLI.'upload/'.$ligne['bf_url_image']);
}
//suppression dans la table bazar_fiche
$requete = 'UPDATE bazar_fiche SET bf_url_image=NULL WHERE bf_id_fiche = '.$id_fiche;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
return;
}
 
 
/** publier_fiche () - Publie ou non dans les fichiers XML la fiche bazar d'un utilisateur
*
* @global boolean Valide: oui ou non
* @return void
*/
function publier_fiche($valid) {
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
if (isset($_GET['typeannonce'])) $typeannonce=$_GET['typeannonce'];
if ($valid==0) {
$requete = 'UPDATE bazar_fiche SET bf_statut_fiche=2 WHERE bf_id_fiche="'.$GLOBALS['_BAZAR_']['id_fiche'].'"' ;
}
else {
$requete = 'UPDATE bazar_fiche SET bf_statut_fiche=1 WHERE bf_id_fiche="'.$GLOBALS['_BAZAR_']['id_fiche'].'"' ;
}
// ====================Mise a jour de la table bazar_fiche====================
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
unset ($resultat) ;
//TODO envoie mail annonceur
return;
}
 
 
/** baz_s_inscrire() affiche le formulaire qui permet de s'inscrire pour recevoir des annonces d'un type
*
* @return string le code HTML
*/
function baz_s_inscrire() {
$res= '<h2>'.BAZ_S_INSCRIRE_AUX_ANNONCES.'</h2>'."\n";
if (isset($_GET['inscrip'])) {
//cas d'une desinscription
if ($_GET['inscrip']==0) {
$requete='DELETE FROM bazar_abonnement WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$_GET['idtypeannonce'];
}
//cas d'une inscription
else {
$requete='INSERT INTO bazar_abonnement VALUES ('.$GLOBALS['id_user'].', '.$_GET['idtypeannonce'].')';
}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
}
if ($GLOBALS['AUTH']->getAuth()) {
$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n";
//requete pour obtenir l'id et le label des types d'annonces
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar'));
$table->addRow(array(BAZ_TYPE_ANNONCES, BAZ_STATUT, BAZ_PASSER_EN, BAZ_RSS));
$table->setRowType(0, 'th');
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ;
foreach ($tab_parametres_GET as $cle_param => $valeur_param) {
$tab_valeur = explode ('=', $valeur_param) ;
$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]);
}
$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
$lien_s_abonner->addQueryString('action', BAZ_S_INSCRIRE);
$lien_s_abonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
$lien_s_abonner->addQueryString('inscrip', 1);
$lien_se_desabonner=$GLOBALS['_BAZAR_']['url'];
$lien_se_desabonner->addQueryString('action', BAZ_S_INSCRIRE);
$lien_se_desabonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
$lien_se_desabonner->addQueryString('inscrip', 0);
$lien_RSS=$GLOBALS['_BAZAR_']['url'];
$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);
//requete pour savoir si la personne est inscrite a ce type d'annonce
$requete = 'SELECT ba_id_utilisateur '.
'FROM bazar_abonnement '.
'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
$resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat2)) {
die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
}
if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";}
else {$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";}
if ($resultat2->numRows()>0) {
$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
$table->addRow(array($titre,
BAZ_ABONNE,
'<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>',
'<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
$lien_RSS->removeQueryString('annonce');
}
else {
$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
$table->addRow(array($titre,
BAZ_PAS_ABONNE,
'<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>',
'<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
$lien_RSS->removeQueryString('annonce');
}
}
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
$table->updateColAttributes(0, array('id' => 'col1'));
$table->updateColAttributes(1, array('id' => 'col2'));
$table->updateColAttributes(2, array('id' => 'col3'));
$table->updateColAttributes(3, array('id' => 'col4'));
$res.=$table->toHTML() ;
}
else {
$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);
$res .= $GLOBALS['_BAZAR_']['url']->getURL();
$res .= '" method="post">
<fieldset>
<legend>Identifiez vous</legend>
<label for="username">Courriel : </label>
<input type="text" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
<label for="password">Mot de passe : </label>
<input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
</fieldset>
</form>';
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('idtypeannonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('inscrip');
return $res;
}
 
 
/** baz_valeurs_fiche() - Renvoie un tableau avec les valeurs par defaut du formulaire d'inscription
*
* @param integer Identifiant de la fiche
*
* @return array Valeurs enregistrees pour cette fiche
*/
function baz_valeurs_fiche($idfiche) {
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$idfiche;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$valeurs_fiche = array() ;
$tableau = baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
for ($i=0; $i<count($tableau); $i++) {
if ($tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox') {
$requete = 'SELECT bfvl_valeur FROM bazar_fiche_valeur_liste WHERE bfvl_ce_fiche='.$idfiche.
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$nb=0;$val='';
while ($result = $resultat->fetchRow()) {
if ($nb>0) $val .= ', ';
$val .= $result[0];
$nb++;
}
$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val;
}
elseif ($tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin') {
$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]);
}
}
return $valeurs_fiche;
}
 
 
function baz_envoie_mail() {
$headers['From'] = $_SERVER['SERVER_ADMIN'] ;
$headers['To'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers['Subject'] = INS_MAIL_ADMIN_APRES_INSCRIPTION_SUJET;
$q = "select * from ".INS_ANNUAIRE." where ".INS_CHAMPS_MAIL."=\"".$_POST['mail']."\"" ;
$r = $GLOBALS['_BAZAR_']['db']->query($q) ;
if (DB::isError ($r)) {
die ("echec de la requete") ;
}
$row = $r->fetchRow(DB_FETCHMODE_ASSOC) ;
$body_entete = "Un nouvel inscrit à tela : \n" ;
$body = "mail : ".$row[INS_CHAMPS_MAIL]."\n" ;
$body .= "------------------------------------------\n";
$body .= "nom: ".unhtmlentities($row[INS_CHAMPS_NOM])." \n" ;
$body .= "prénom : ".unhtmlentities($row[INS_CHAMPS_PRENOM])." \n" ;
$body .= "-------------------------------------------\n" ;
// création du mail
$mail_object =& Mail::factory('mail');
if (!mail ($headers['To'], $headers['Subject'], $body)) {
return "Une erreur s'est produite:<br />\n" ;
}
$body .= INS_MAIL_INSCRIPTION_2;
$headers['To'] = $_POST['mail'] ;
// création du mail
if (mail($headers['To'], $headers['Subject'], INS_MAIL_INSCRIPTION_1.$body)) {
return "Une erreur s'est produite<br />\n" ;
}
return;
}
 
 
/** function baz_nextId () Renvoie le prochain identifiant numerique libre d'une table
*
* @param string Nom de la table
* @param string Nom du champs identifiant
* @param mixed Objet DB de PEAR pour la connexion a la base de donnees
*
* return integer Le prochain numero d'identifiant disponible
*/
function baz_nextId($table, $colonne_identifiant, $bdd) {
$requete = 'SELECT MAX('.$colonne_identifiant.') AS maxi FROM '.$table;
$resultat = $bdd->query($requete) ;
if (DB::isError($resultat)) {
die (__FILE__ . __LINE__ . $resultat->getMessage() . $requete);
return $bdd->raiseError($resultat) ;
}
if ($resultat->numRows() > 1) {
return $bdd->raiseError('<br />La table '.$table.' a un identifiant non unique<br />') ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->maxi + 1 ;
}
 
/** function baz_titre_wiki () Renvoie la chaine de caractere sous une forme compatible avec wikini
*
* @param string mot à transformer (enlever accents, espaces)
*
* return string mot transformé
*/
function baz_titre_wiki($nom) {
$titre=trim($nom);
for ($j = 0; $j < strlen ($titre); $j++) {
if (!preg_match ('/[a-zA-Z0-9]/', $titre[$j])) {
$titre[$j] = '_' ;
}
}
return $titre;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.63 2007-04-11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.57.2.12 2007/03/16 14:49:24 alexandre_tb
* si la date de debut d evenement est superieure a la date de fin alors on met
* la meme date dans les deux champs (coherence)
*
* Revision 1.57.2.11 2007/03/07 17:40:57 jp_milcent
* Ajout d'id sur les colonnes et gestion par les CSS des styles du tableau des abonnements.
*
* Revision 1.57.2.10 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
* Revision 1.57.2.9 2007/03/06 16:23:24 jp_milcent
* Nettoyage de l'url pour la gestion des droits.
*
* Revision 1.57.2.8 2007/03/05 14:33:44 jp_milcent
* Suppression de l'appel à Mes_Fiches dans la fonction baz_formulaire
*
* Revision 1.57.2.7 2007/03/05 10:28:03 alexandre_tb
* correction d un commentaire
*
* Revision 1.57.2.6 2007/02/15 13:42:16 jp_milcent
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
*
* Revision 1.57.2.5 2007/02/12 16:16:31 alexandre_tb
* suppression du style clear:both dans les attribut du formulaire d identification
*
* Revision 1.57.2.4 2007/02/01 16:19:30 alexandre_tb
* correction erreur de requete sur insertion bazar_fiche
*
* Revision 1.57.2.3 2007/02/01 16:11:05 alexandre_tb
* correction erreur de requete sur insertion bazar_fiche
*
* Revision 1.57.2.2 2007/01/22 16:05:39 alexandre_tb
* insertion de la date du jour dans bf_date_debut_validite_fiche quand il n'y a pas ce champs dans le formulaire (évite le 0000-00-00)
*
* Revision 1.57.2.1 2006/12/13 13:23:03 alexandre_tb
* Remplacement de l appel d une constante par un appel direct. -> warning
*
* Revision 1.58 2006/12/13 13:20:16 alexandre_tb
* Remplacement de l appel d une constante par un appel direct. -> warning
*
* Revision 1.57 2006/10/05 08:53:50 florian
* amelioration moteur de recherche, correction de bugs
*
* Revision 1.56 2006/09/28 15:41:36 alexandre_tb
* Le formulaire pour se logguer dans l'action saisir reste sur l'action saisir après
*
* Revision 1.55 2006/09/21 14:19:39 florian
* amélioration des fonctions liés au wikini
*
* Revision 1.54 2006/09/14 15:11:23 alexandre_tb
* suppression temporaire de la gestion des wikinis
*
* Revision 1.53 2006/07/25 13:24:44 florian
* correction bug image
*
* Revision 1.52 2006/07/25 13:05:00 alexandre_tb
* Remplacement d un die par un echo
*
* Revision 1.51 2006/07/18 14:17:32 alexandre_tb
* Ajout d'un formulaire d identification
*
* Revision 1.50 2006/06/21 08:37:59 alexandre_tb
* Correction de bug, d'un appel constant (....) qui ne fonctionnais plus.
*
* Revision 1.49 2006/06/02 09:29:07 florian
* debut d'integration de wikini
*
* Revision 1.48 2006/05/19 13:54:11 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.47 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
* Revision 1.46 2006/03/29 13:04:35 alexandre_tb
* utilisation de la classe Administrateur_bazar
*
* Revision 1.45 2006/03/24 09:28:02 alexandre_tb
* utilisation de la variable globale $GLOBALS['_BAZAR_']['categorie_nature']
*
* Revision 1.44 2006/03/14 17:10:21 florian
* ajout des fonctions de syndication, changement du moteur de recherche
*
* Revision 1.43 2006/03/02 20:36:52 florian
* les entrees du formulaire de saisir ne sont plus dans les constantes mias dans des tables qui gerent le multilinguisme.
*
* Revision 1.42 2006/03/01 16:23:22 florian
* modifs textes fr et correction bug "undefined index"
*
* Revision 1.41 2006/03/01 16:05:51 florian
* ajout des fichiers joints
*
* Revision 1.40 2006/02/06 09:33:00 alexandre_tb
* correction de bug
*
* Revision 1.39 2006/01/30 17:25:38 alexandre_tb
* correction de bugs
*
* Revision 1.38 2006/01/30 10:27:04 florian
* - ajout des entrées de formulaire fichier, url, et image
* - correction bug d'affichage du mode de saisie
*
* Revision 1.37 2006/01/24 14:11:11 alexandre_tb
* correction de bug sur l'ajout d'une image et d'un fichier
*
* Revision 1.36 2006/01/19 17:42:11 florian
* ajout des cases à cocher pré-cochées pour les maj
*
* Revision 1.35 2006/01/18 11:06:51 florian
* correction erreur saisie date
*
* Revision 1.34 2006/01/18 10:53:28 florian
* corrections bugs affichage fiche
*
* Revision 1.33 2006/01/18 10:07:34 florian
* recodage de l'insertion et de la maj des données relatives aux listes et checkbox dans des formulaires
*
* Revision 1.32 2006/01/18 10:03:36 florian
* recodage de l'insertion et de la maj des données relatives aux listes et checkbox dans des formulaires
*
* Revision 1.31 2006/01/17 10:07:08 alexandre_tb
* en cours
*
* Revision 1.30 2006/01/16 09:42:57 alexandre_tb
* en cours
*
* Revision 1.29 2006/01/13 14:12:51 florian
* utilisation des temlates dans la table bazar_nature
*
* Revision 1.28 2006/01/05 16:28:24 alexandre_tb
* prise en chage des checkbox, reste la mise à jour à gérer
*
* Revision 1.27 2006/01/04 15:30:56 alexandre_tb
* mise en forme du code
*
* Revision 1.26 2006/01/03 10:19:31 florian
* Mise à jour pour accepter des parametres dans papyrus: faire apparaitre ou non le menu, afficher qu'un type de fiches, définir l'action par défaut...
*
* Revision 1.25 2005/12/20 14:49:35 ddelon
* Fusion Head vers Livraison
*
* Revision 1.24 2005/12/16 15:44:40 alexandre_tb
* ajout de l'option restreindre dépôt
*
* Revision 1.23 2005/12/01 17:03:34 florian
* changement des chemins pour appli Pear
*
* Revision 1.22 2005/12/01 16:05:41 florian
* changement des chemins pour appli Pear
*
* Revision 1.21 2005/12/01 15:31:30 florian
* correction bug modifs et saisies
*
* Revision 1.20 2005/11/30 13:58:45 florian
* ajouts graphisme (logos, boutons), changement structure SQL bazar_fiche
*
* Revision 1.19 2005/11/24 16:17:13 florian
* corrections bugs, ajout des cases à cocher
*
* Revision 1.18 2005/11/18 16:03:23 florian
* correction bug html entites
*
* Revision 1.17 2005/11/17 18:48:02 florian
* corrections bugs + amélioration de l'application d'inscription
*
* Revision 1.16 2005/11/07 17:30:36 florian
* ajout controle sur les listes pour la saisie
*
* Revision 1.15 2005/11/07 17:05:45 florian
* amélioration validation conditions de saisie, ajout des règles spécifiques de saisie des formulaires
*
* Revision 1.14 2005/11/07 08:48:02 florian
* correction pb guillemets pour saisie et modif de fiche
*
* Revision 1.13 2005/10/21 16:15:04 florian
* mise a jour appropriation
*
* Revision 1.11 2005/10/12 17:20:33 ddelon
* Reorganisation calendrier + applette
*
* Revision 1.10 2005/10/12 15:14:06 florian
* amélioration de l'interface de bazar, de manière a simplifier les consultations, et à harmoniser par rapport aux Ressources
*
* Revision 1.9 2005/10/10 16:22:52 alexandre_tb
* Correction de bug. Lorsqu'on revient en arrière après avoir validé un formulaire.
*
* Revision 1.8 2005/09/30 13:50:07 alexandre_tb
* correction bug date parution ressource
*
* Revision 1.7 2005/09/30 13:15:58 ddelon
* compatibilité php5
*
* Revision 1.6 2005/09/30 13:00:05 ddelon
* Fiche bazar generique
*
* Revision 1.5 2005/09/30 12:22:54 florian
* Ajouts commentaires pour fiche, modifications graphiques, maj SQL
*
* Revision 1.3 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.10 2004/07/08 17:25:25 florian
* ajout commentaires + petits debuggages
*
* Revision 1.8 2004/07/07 14:30:19 florian
* débogage RSS
*
* Revision 1.7 2004/07/06 16:22:01 florian
* débogage modification + MAJ flux RSS
*
* Revision 1.6 2004/07/06 09:28:26 florian
* changement interface de modification
*
* Revision 1.5 2004/07/05 15:10:23 florian
* changement interface de saisie
*
* Revision 1.4 2004/07/02 14:51:14 florian
* ajouts divers pour faire fonctionner l'insertion de fiches
*
* Revision 1.3 2004/07/01 16:37:42 florian
* ajout de fonctions pour les templates
*
* Revision 1.2 2004/07/01 13:00:13 florian
* modif Florian
*
* Revision 1.1 2004/06/23 09:58:32 alex
* version initiale
*
* Revision 1.1 2004/06/18 09:00:37 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.fonct.formulaire.php
New file
0,0 → 1,530
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.formulaire.php,v 1.25 2007-04-11 08:30:12 neiluj Exp $
/**
* Formulaire
*
* Les fonctions de mise en page des formulaire
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aleandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.25 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
require_once 'bazar.fonct.formulaire.controles.php';
 
//-------------------FONCTIONS DE MISE EN PAGE DES FORMULAIRES
 
/** liste() - Ajoute un élément de type liste au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param int identifiant de la liste sur bazar_liste
* @param string label à afficher dans le formulaire
* @param string première restriction de la taille des champs du formulaire
* @param string deuxième restriction de la taille des champs du formulaire
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs de la liste
* @param string ce champs est il obligatoire? (required)
* @param boolean sommes nous dans le moteur de recherche?
* @return void
*/
function liste(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($dans_moteur_de_recherche==0) {
$select[0]=BAZ_CHOISIR;
}
else {
$select[0]=BAZ_INDIFFERENT;
}
while ($ligne = $resultat->fetchRow()) {
$select[$ligne[1]] = $ligne[2] ;
}
$option=array('style'=>'width: '.$limite1.'px;');
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php';
$select= new HTML_QuickForm_select('liste'.$id_liste, $label, $select, $option);
$select->setSize($limite2);
$select->setMultiple(0);
$select->setSelected($defaut);
$formtemplate->addElement($select) ;
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.$label , 'nonzero', '', 'client') ;
$formtemplate->addRule('liste'.$id_liste, $label.' obligatoire', 'required', '', 'client') ;}
}
 
 
/** checkbox() - Ajoute un élément de type checkbox au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param int identifiant de la liste sur bazar_liste
* @param string label à afficher dans le formulaire
* @param string première restriction de la taille des champs du formulaire
* @param string deuxième restriction de la taille des champs du formulaire
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs de la liste
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function checkbox(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'" ORDER BY blv_label';
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
$i=0;
if (isset($defaut)) $tab=split(', ', $defaut);
while ($ligne = $resultat->fetchRow()) {
if ($i==0) $labelchkbox=$label ; else $labelchkbox='&nbsp;';
$checkbox[$i]= & HTML_Quickform::createElement('checkbox', $ligne[1], $labelchkbox, $ligne[2],
array ('style'=>'display:inline;margin:2px;')) ;
foreach ($tab as $val) {
if ($ligne[1]==$val) $checkbox[$i]->setChecked(1);
}
$i++;
}
$squelette_checkbox =& $formtemplate->defaultRenderer();
$squelette_checkbox->setElementTemplate( '<tr><td colspan="2" style="text-align:left;">'."\n".'<fieldset class="bazar_fieldset">'."\n".'<legend>{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
'</legend>'."\n".'{element}'."\n".'</fieldset> '."\n".'</td></tr>'."\n", 'checkbox'.$id_liste);
$squelette_checkbox->setGroupElementTemplate( "\n".'<div class="bazar_checkbox">'."\n".'{element}'."\n".'</div>'."\n", 'checkbox'.$id_liste);
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, $label, "\n");
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addGroupRule('checkbox'.$id_liste, $label.' obligatoire', 'required', null, 1, 'client');
}
}
 
 
/** listedatedeb() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de début
*
* @param mixed L'objet QuickForm du formulaire
* @param string nom de la table dans la base de donnée
* @param string label à afficher dans le formulaire
* @param string première restriction de la taille des champs du formulaire
* @param string deuxième restriction de la taille des champs du formulaire
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs de la date
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function listedatedeb(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
$optiondate = array('language' => BAZ_LANGUE_PAR_DEFAUT,
'minYear' => date('Y')-4,
'maxYear'=> (date('Y')+10),
'format' => 'd m Y',
'addEmptyOption' => BAZ_DATE_VIDE,
);
$formtemplate->addElement('date', $nom_bdd, $label, $optiondate) ;
//gestion des valeurs par défaut (date du jour)
if (isset($defaut) && $defaut!='') {
$tableau_date = explode ('-', $defaut);
$formtemplate->setDefaults(array($nom_bdd => array ('d'=> $tableau_date[2], 'm'=> $tableau_date[1], 'Y'=> $tableau_date[0])));
}
else {
$defauts=array($nom_bdd => array ('d'=>date('d'), 'm'=>date('m'), 'Y'=>date('Y')));
$formtemplate->setDefaults($defauts);
}
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;
}
}
 
/** listedatefin() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de fin
*
* @param mixed L'objet QuickForm du formulaire
* @param string nom de la table dans la base de donnée
* @param string label à afficher dans le formulaire
* @param string première restriction de la taille des champs du formulaire
* @param string deuxième restriction de la taille des champs du formulaire
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs de la date
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function listedatefin(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
listedatedeb($formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche);
}
 
 
/** texte() - Ajoute un élément de type texte au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string nom de la table dans la base de donnée
* @param string label à afficher dans le formulaire
* @param string première restriction de la taille des champs du formulaire
* @param string deuxième restriction de la taille des champs du formulaire
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function texte(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
$option=array('size'=>$limite1,'maxlength'=>$limite2);
$formtemplate->addElement('text', $nom_bdd, $label, $option) ;
//gestion des valeurs par défaut
$defauts=array($nom_bdd=>$defaut);
$formtemplate->setDefaults($defauts);
$formtemplate->applyFilter($nom_bdd, 'addslashes') ;
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;
}
}
 
 
/** textelong() - Ajoute un élément de type textearea au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string nom de la table dans la base de donnée
* @param string label à afficher dans le formulaire
* @param string taille des colonnes de l'élément
* @param string taille des lignes de l'élément
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
$formtexte= new HTML_QuickForm_textarea($nom_bdd, $label, array('style'=>'white-space: normal;'));
$formtexte->setCols($limite1);
$formtexte->setRows($limite2);
$formtemplate->addElement($formtexte) ;
//gestion des valeurs par défaut
$defauts=array($nom_bdd=>$defaut);
$formtemplate->setDefaults($defauts);
$formtemplate->applyFilter($nom_bdd, 'addslashes') ;
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;
}
}
 
/** url() - Ajoute un élément de type url internet au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string numero du champs input du formulaire (pour le différencier d'autres champs du meme type dans ce formulaire)
* @param string label à afficher dans le formulaire
* @param string taille des colonnes de l'élément
* @param string taille des lignes de l'élément
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function url(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
//recherche des URLs deja entrees dans la base
$html_url= '';
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) {
$requete = 'SELECT bu_id_url, bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']["id_fiche"];
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
if (DB::isError ($resultat)) {
die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$html_url= '<tr>'."\n".'<td colspan="2">'."\n".'<strong>'.BAZ_LISTE_URL.'</strong>'."\n";
$tableAttr = array("class" => "bazar_table") ;
$table = new HTML_Table($tableAttr) ;
$entete = array (BAZ_LIEN , BAZ_SUPPRIMER) ;
$table->addRow($entete) ;
$table->setRowType(0, "th") ;
$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', $_GET['action']);
$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
$lien_supprimer->addQueryString('typeannonce', $_REQUEST['typeannonce']);
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$lien_supprimer->addQueryString('id_url', $ligne->bu_id_url);
$table->addRow (array(
'<a href="'.$ligne->bu_url.'" target="_blank"> '.$ligne->bu_descriptif_url.'</a>', // col 1 : le lien
'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION_LIEN.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
$lien_supprimer->removeQueryString('id_url');
}
 
// Nettoyage de l'url
$lien_supprimer->removeQueryString('action');
$lien_supprimer->removeQueryString('id_fiche');
$lien_supprimer->removeQueryString('typeannonce');
$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
$table->updateColAttributes(1, array("align" => "center"));
$html_url.= $table->toHTML()."\n".'</td>'."\n".'</tr>'."\n" ;
}
}
$html ='<tr>'."\n".'<td colspan="2">'."\n".'<h4>'.$label.'</h4>'."\n".'</td>'."\n".'</tr>'."\n";
$formtemplate->addElement('html', $html) ;
if ($html_url!='') $formtemplate->addElement('html', $html_url) ;
$formtemplate->addElement('text', 'url_lien'.$nom_bdd, BAZ_URL_LIEN) ;
$formtemplate->addElement('text', 'url_texte'.$nom_bdd, BAZ_URL_TEXTE) ;
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule('url_lien'.$nom_bdd, BAZ_URL_LIEN_REQUIS, 'required', '', 'client') ;
$formtemplate->addRule('url_texte'.$nom_bdd, BAZ_URL_TEXTE_REQUIS, 'required', '', 'client') ;
}
}
 
/** fichier() - Ajoute un élément de type fichier au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string numero du champs input du formulaire (pour le différencier d'autres champs du meme type dans ce formulaire)
* @param string label à afficher dans le formulaire
* @param string taille des colonnes de l'élément
* @param string taille des lignes de l'élément
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function fichier(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
//AJOUTER DES FICHIERS JOINTS
$html_fichier= '';
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) {
$requete = 'SELECT * FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']["id_fiche"];
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
if (DB::isError ($resultat)) {
die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$html_fichier = '<tr>'."\n".'<td colspan="2">'."\n".'<strong>'.BAZ_LISTE_FICHIERS_JOINTS.'</strong>'."\n";
$tableAttr = array("class" => "bazar_table") ;
$table = new HTML_Table($tableAttr) ;
$entete = array (BAZ_FICHIER , BAZ_SUPPRIMER) ;
$table->addRow($entete) ;
$table->setRowType(0, "th") ;
$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', $_GET['action']);
$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
$lien_supprimer->addQueryString('typeannonce', $_REQUEST['typeannonce']);
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$lien_supprimer->addQueryString('id_fichier', $ligne->bfj_id_fichier);
$table->addRow(array('<a href="client/bazar/upload/'.$ligne->bfj_fichier.'"> '.$ligne->bfj_description.'</a>', // col 1 : le fichier et sa description
'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION_FICHIER.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 2 : supprimer
$lien_supprimer->removeQueryString('id_fichier');
}
$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
$table->updateColAttributes(1, array("align" => "center"));
$html_fichier .= $table->toHTML()."\n".'</td>'."\n".'</tr>'."\n" ;
}
}
$html ='<tr>'."\n".'<td colspan="2">'."\n".'<h4>'.$label.'</h4>'."\n".'</td>'."\n".'</tr>'."\n";
$formtemplate->addElement('html', $html) ;
if ($html_fichier!='') $formtemplate->addElement('html', $html_fichier) ;
$formtemplate->addElement('text', 'texte_fichier'.$nom_bdd, BAZ_FICHIER_DESCRIPTION) ;
$formtemplate->addElement('file', 'fichier'.$nom_bdd, BAZ_FICHIER_JOINT) ;
$formtemplate->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, '', '', 'client') ; //a completer pour checker l'image
$formtemplate->setMaxFileSize($limite1);
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule('texte_fichier'.$nom_bdd, BAZ_FICHIER_LABEL_REQUIS, 'required', '', 'client') ;
$formtemplate->addRule('fichier'.$nom_bdd, BAZ_FICHIER_JOINT_REQUIS, 'required', '', 'client') ;
}
}
 
/** image() - Ajoute un élément de type image au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string numero du champs input du formulaire (pour le différencier d'autres champs du meme type dans ce formulaire)
* @param string label à afficher dans le formulaire
* @param string taille maximum du fichier colonnes de l'élément
* @param string taille des lignes de l'élément
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function image(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
//AJOUTER UNE IMAGE
$html_image= '';
if (isset($GLOBALS['_BAZAR_']["id_fiche"])) {
$requete = 'SELECT bf_url_image FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
if (DB::isError ($resultat)) {
die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$image=$ligne->bf_url_image;
}
if ($image!=NULL) {
$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', $_GET['action']);
$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']["id_fiche"]);
$lien_supprimer->addQueryString('typeannonce', $_REQUEST['typeannonce']);
$lien_supprimer->addQueryString('image', 1);
$html_image = '<tr>'."\n".
'<td>'."\n".'<img src="client/bazar/upload/'.$image.'" alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n".'</td>'."\n".
'<td>'."\n".'<a href="'.$lien_supprimer->getURL().'" onclick="javascript:return confirm(\''.BAZ_CONFIRMATION_SUPPRESSION_IMAGE.'\');" >'.BAZ_SUPPRIMER.'</a><br /><br />'."\n".
'<strong>'.BAZ_POUR_CHANGER_IMAGE.'</strong><br />'."\n".'</td>'."\n".'</tr>'."\n";
}
}
}
$html ='<tr>'."\n".'<td colspan="2">'."\n".'<h4>'.$label.'</h4>'."\n".'</td>'."\n".'</tr>'."\n";
$formtemplate->addElement('html', $html) ;
if ($html_image!='') $formtemplate->addElement('html', $html_image) ;
$formtemplate->addElement('file', 'image', BAZ_IMAGE) ;
//TODO: controler si c'est une image
$formtemplate->setMaxFileSize($limite1);
//gestion du champs obligatoire
if (($dans_moteur_de_recherche==0) && isset($obligatoire) && ($obligatoire==1)) {
$formtemplate->addRule('image', BAZ_IMAGE_VALIDE_REQUIS, 'required', '', 'client') ;
}
}
 
/** wikini() - Ajoute un wikini au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string numero du champs input du formulaire (pour le différencier d'autres champs du meme type dans ce formulaire)
* @param string label à afficher dans le formulaire
* @param string taille maximum du fichier colonnes de l'élément
* @param string taille des lignes de l'élément
* @param string valeur par défaut du formulaire
* @param string table source pour les valeurs du texte (inutile)
* @param string ce champs est il obligatoire? (required)
* @return void
*/
function wikini(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
return;
}
 
/** labelhtml() - Ajoute un élément de type textearea au formulaire
*
* @param mixed L'objet QuickForm du formulaire
* @param string nom de la table dans la base de donnée (pas utilisé)
* @param string label à afficher dans le formulaire
* @param string taille des colonnes de l'élément (pas utilisé)
* @param string taille des lignes de l'élément (pas utilisé)
* @param string valeur par défaut du formulaire (pas utilisé)
* @param string table source pour les valeurs du texte (pas utilisé)
* @param string ce champs est il obligatoire? (required) (pas utilisé)
* @return void
*/
function labelhtml(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire, $dans_moteur_de_recherche=0) {
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/html.php';
$formhtml= new HTML_QuickForm_html('<tr>'."\n".'<td colspan="2" style="text-align:left;">'."\n".$label."\n".'</td>'."\n".'</tr>'."\n");
$formtemplate->addElement($formhtml) ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.22.2.3 2007/03/16 14:48:32 alexandre_tb
* on peut maintenant saisir une date par défaut
* et 0000-00-00 pour des champs vide
*
* Revision 1.22.2.2 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
* Revision 1.22.2.1 2007/01/17 16:01:37 alexandre_tb
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.22 2006/06/02 09:29:07 florian
* debut d'integration de wikini
*
* Revision 1.21 2006/05/19 13:54:11 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.20 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
* Revision 1.19 2006/03/02 20:36:52 florian
* les entrees du formulaire de saisir ne sont plus dans les constantes mias dans des tables qui gerent le multilinguisme.
*
* Revision 1.18 2006/03/01 16:01:46 florian
* correction bug déclaration variable $html
*
* Revision 1.17 2006/01/30 10:27:03 florian
* - ajout des entrées de formulaire fichier, url, et image
* - correction bug d'affichage du mode de saisie
*
* Revision 1.16 2006/01/24 14:11:44 alexandre_tb
* ajout du paramètre emptyOptionValue dans les champs de date
*
* Revision 1.15 2006/01/23 16:57:03 alexandre_tb
* correction d'un notice
*
* Revision 1.14 2006/01/19 17:42:11 florian
* ajout des cases à cocher pré-cochées pour les maj
*
* Revision 1.13 2006/01/13 14:12:51 florian
* utilisation des temlates dans la table bazar_nature
*
* Revision 1.12 2006/01/05 16:28:24 alexandre_tb
* prise en chage des checkbox, reste la mise à jour à gérer
*
* Revision 1.11 2006/01/02 13:24:07 alexandre_tb
* correction de bug d'un mauvais retour en erreur
*
* Revision 1.10 2005/12/01 16:05:41 florian
* changement des chemins pour appli Pear
*
* Revision 1.9 2005/11/24 16:17:13 florian
* corrections bugs, ajout des cases à cocher
*
* Revision 1.8 2005/11/18 16:03:23 florian
* correction bug html entites
*
* Revision 1.7 2005/11/07 17:51:06 florian
* correction bug liste
*
* Revision 1.6 2005/11/07 17:30:36 florian
* ajout controle sur les listes pour la saisie
*
* Revision 1.5 2005/11/07 17:05:45 florian
* amélioration validation conditions de saisie, ajout des règles spécifiques de saisie des formulaires
*
* Revision 1.4 2005/10/25 13:53:02 alexandre_tb
* ajout d'un filtre dans les formulaire texte et textelong
*
* Revision 1.3 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.4 2004/07/08 11:17:59 alex
* ajout de commentaires et d'entete
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.abonnement.inc.php
New file
0,0 → 1,65
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Fonctions d'abonnement a afficher dans la fiche du bottin
*
*
*@package inscription
//Auteur original :
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*
*@copyright Outils-Reseaux 2006-2010
*@version $Revision$ $Date$
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PAP_CHEMIN_RACINE.'client/bazar/configuration/baz_config.inc.php' ;
include_once PAP_CHEMIN_RACINE.'client/bazar/bibliotheque/bazar.fonct.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
$GLOBALS['id_user']=$id;
if (isset($_GET['action']) && $_GET['action']==BAZ_VOIR_FLUX_RSS) {
header('Content-type: text/xml; charset=ISO-8859-1');
include(PAP_CHEMIN_RACINE.'client/bazar/bazarRSS.php');exit(0);break;
} else {
$abonnement = baz_s_inscrire();
}
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log$
* Revision 1.1 2006/04/28 12:46:14 florian
* integration des liens vers annuaire
*
*
*/
?>
/branches/v2.0-narmer/client/bazar/bibliotheque/bazar.fonct.rss.php
New file
0,0 → 1,1337
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.rss.php,v 1.82.2.4 2007-08-24 13:06:05 jp_milcent Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.82.2.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
 
 
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
*
* @param string valeur du template de bazar_nature
*
* @return mixed tableau contenant les champs du fichier template
*/
function baz_valeurs_template($valeur_template) {
//Parcours du fichier de templates, pour mettre les champs specifiques
$tableau= array();
$nblignes=0;
$chaine = explode ("\n", $valeur_template);
array_pop($chaine);
foreach ($chaine as $ligne) {
$souschaine = explode ("***", $ligne) ;
$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
else {$tableau[$nblignes]['nom_bdd'] ='';}
if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
else {$tableau[$nblignes]['label'] ='';}
if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
else {$tableau[$nblignes]['limite1'] ='';}
if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
else {$tableau[$nblignes]['limite2'] ='';}
if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
else {$tableau[$nblignes]['defaut'] ='';}
if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
else {$tableau[$nblignes]['table_source'] ='';}
if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
else {$tableau[$nblignes]['id_source'] ='';}
if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
else {$tableau[$nblignes]['obligatoire'] ='';}
if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
else {$tableau[$nblignes]['recherche'] ='';}
// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;
}
$nblignes++;
}
return $tableau;
}
 
/** baz_voir_fiches() - Permet de visualiser en detail une liste de fiche au format XHTML
*
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
* @global integer Tableau d(Identifiant des fiches à afficher
*
* @return string HTML
*/
function baz_voir_fiches($danslappli, $idfiches=array()) {
$res='';
foreach($idfiches as $idfiche) {
$res.=baz_voir_fiche($danslappli, $idfiche);
}
return $res;
}
 
 
/** baz_voir_fiche() - Permet de visualiser en detail une fiche au format XHTML
*
* @global boolean Rajoute des informations internes a l'application (date de modification, lien vers la page de départ de l'appli) si a 1
* @global integer Identifiant de la fiche a afficher
*
* @return string HTML
*/
function baz_voir_fiche($danslappli, $idfiche='') {
$res='';
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
$url= $GLOBALS['_BAZAR_']['url'];
$url->addQueryString('action', BAZ_VOIR_FICHE);
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url = preg_replace ('/&amp;/', '&', $url->getURL()) ;
//cas ou la fiche a ete validee
if (isset($_GET['publiee'])) {
publier_fiche($_GET['publiee']);
}
//cas on une structure s'approprie une ressource
if (isset($_GET['appropriation'])) {
if ($_GET['appropriation']==1) {
$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
elseif ($_GET['appropriation']==0) {
$requete = 'DELETE FROM bazar_appropriation WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
//cas ou un commentaire a ete entre
if (isset($_POST['Nom'])) {
$requete = 'INSERT INTO bazar_commentaires VALUES ('.
baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
'", NOW() )';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
//cas ou un commentaire va etre supprime
elseif (isset($_GET['id_commentaire'])) {
$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
else {
if (isset($_GET['action'])) {
if ($_GET['action']==BAZ_VOIR_FICHE) {
//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
}
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
: '';
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
if (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce'] = $ligne['bf_ce_nature'];
if (!isset($GLOBALS['_BAZAR_']['fiche_valide'])) $GLOBALS['_BAZAR_']['fiche_valide'] = $ligne['bf_statut_fiche'];
//on verifie si l'utilisateur est administrateur
$est_admin=0;
$requete='SELECT bn_id_nature, bn_template, bn_commentaire, bn_label_class FROM bazar_nature WHERE bn_id_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$id_nature = $result['bn_id_nature'];
if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
if (!isset($GLOBALS['_BAZAR_']['class'])) $GLOBALS['_BAZAR_']['class'] = $result['bn_label_class'];
if ($GLOBALS['AUTH']->getAuth()) {
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
{
$est_admin=1;
}
}
//debut de la fiche
$res .= '<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
//affiche le titre sous forme d'image
if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
$res .= '<img class="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
}
//affiche le texte sinon
else {
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
//si le template existe, on genere le template
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
$res .=genere_fiche($ligne);
}
//on affiche ligne par ligne sinon
else {
//cas d'une image personalisee
if (isset($ligne['bf_url_image'])) {
$res .= '<div class="BAZ_fiche_image BAZ_fiche_image_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<img class="BAZ_image" src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
$res .= '</div>'."\n";
}
//cas d'une image par defaut
elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
$res .= '<div class="BAZ_fiche_image BAZ_fiche_image_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<img class="BAZ_image" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
$res .= '</div>'."\n";
}
$res .= '<h1 class="BAZ_fiche_titre BAZ_fiche_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$ligne['bf_titre'].'</h1>'."\n";
$res .= '<div class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'.nl2br($ligne['bf_description']).'</div>'."\n";
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
for ($i=0; $i<count($tableau); $i++) {
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="'.$tableau[$i]['nom_bdd'].'_description"> '.nl2br($ligne[$val]).'</span>'."\n".'</div>'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$tableau[$i]['nom_bdd'].' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$val='';$nb=0;
while ($tab = $resultat->fetchRow()) {
if ($nb>0) $val .= ', ';
$val .= $tab[0];
$nb++;
}
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="rubrique_'.$tableau[$i]['nom_bdd'].'">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="description_'.$tableau[$i]['nom_bdd'].'"> '.$val.'</span>'."\n".'</div>'."\n";
}
}
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="'.$tableau[$i]['nom_bdd'].'_description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'</div>'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='wikini' ) {
$res .= '<div class="BAZ_lien_wikini BAZ_lien_wikini_'.$GLOBALS['_BAZAR_']['class'].'"><a href="wikini/'.genere_nom_wiki2($ligne["bf_titre"], TRUE).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
}
}
//afficher les liens pour l'annonce
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="BAZ_label BAZ_label_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LIEN_INTERNET.':</span>'."\n";
$res .= '<span class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<ul class="BAZ_liste BAZ_liste_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li class="BAZ_liste_lien BAZ_liste_lien_'.$GLOBALS['_BAZAR_']['class'].'"><a href="'.$ligne1['bu_url'].'" class="BAZ_lien" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
//afficher les fichiers pour l'annonce
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="BAZ_label BAZ_label_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
$res .= '<span class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<ul class="BAZ_liste BAZ_liste_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li class="BAZ_liste_fichier BAZ_liste_fichier_'.$GLOBALS['_BAZAR_']['class'].'"><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<div class="BAZ_infos_fiche BAZ_infos_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<span class="BAZ_nb_vues BAZ_nb_vues_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_NB_VUS.$ligne['bf_nb_consultations'].BAZ_FOIS.'</span><br />'."\n";
//affichage du redacteur de la fiche
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= BAZ_FICHE_NUMERO.$GLOBALS['_BAZAR_']['id_fiche'].BAZ_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
}
//informations complementaires (id fiche, etat publication,... )
if ($danslappli==1) {
if ($GLOBALS['_BAZAR_']['fiche_valide']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1) {
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' && $ligne['bf_date_fin_validite_fiche'] != '0000-00-00') {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.
' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.
BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
}
}
elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $GLOBALS['_BAZAR_']['fiche_valide']!=1) {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
}
//affichage des infos et du lien pour la mise a jour de la fiche
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'" id="date_creation">'.BAZ_DATE_CREATION.'</span> '.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bf_date_creation_fiche']))."\n";
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'" id="date_mise_a_jour">'.BAZ_DATE_MAJ.'</span> '.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
}
$res .= '</div>'."\n";
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
$res .='<div class="BAZ_actions_fiche BAZ_actions_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
if ( $est_admin ) {
$res .= '<ul>'."\n";
$lien_publie = &$GLOBALS['_BAZAR_']['url'];
$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
if ($GLOBALS['_BAZAR_']['fiche_valide']==0||$GLOBALS['_BAZAR_']['fiche_valide']==2) {
$lien_publie->addQueryString('publiee', 1);
$label_publie=BAZ_VALIDER_LA_FICHE;
$class_publie='_valider';
} elseif ($GLOBALS['_BAZAR_']['fiche_valide']==1) {
$lien_publie->addQueryString('publiee', 0);
$label_publie=BAZ_INVALIDER_LA_FICHE;
$class_publie='_invalider';
}
$res .= '<li class="BAZ_liste'.$class_publie.'"><a href="'.$lien_publie->getURL().'">'.$label_publie.'</a></li>'."\n";
$lien_publie->removeQueryString('publiee');
}
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$res .= '<li class="BAZ_liste_modifier"><a href="'.$lien_modifier->getURL().'" id="modifier_fiche">'.BAZ_MODIFIER_LA_FICHE.'</a></li>'."\n";
$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_supprimer->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$res .= '<li class="BAZ_liste_supprimer"><a href="'.$lien_supprimer->getURL().'" id="supprimer_fiche">'.BAZ_SUPPRIMER_LA_FICHE.'</a></li>'."\n";
$res .= '</ul>'."\n";
$res .= '</div>'."\n";
}
}
$res .= '</div>'."\n";
}
$res .= '</div>'."\n";
//on ajoute les appropriations, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$possede_ressource=0;
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
}
$res .= '</ul><br />'."\n";
}
else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
$res .='<p class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
if ($possede_ressource) {
$lien_appropriation->addQueryString('appropriation', 0);
$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$lien_appropriation->addQueryString('appropriation', 1);
$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
}
elseif (!$GLOBALS['AUTH']->getAuth()) {
$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
}
$res .='</p>'."\n";
$res .= '</div>'."\n";
}
//on ajoute les commentaires, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
//affichage du commentaire
$res .= $ligne['bc_commentaire'].'<br />'."\n";
$res .= '<div class="BAZ_commentaire_admin">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bc_date']));
//pour les identifies seulement, administrateurs de la rubrique ou superadmins
if ($est_admin==1) {
$url_comment= $GLOBALS['_BAZAR_']['url'];
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
$res .= '&nbsp;&nbsp;<a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a>'."\n";
}
$res .= '</div>'."\n";
$res .= '</div>'."\n";
}
}
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
//formulaire des commentaires
$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
$squelette =& $form_commentaire->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
'</label><br />'."\n".'{element}<br />'."\n");
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
$form_commentaire->addElement($formtexte) ;
$option=array('style'=>'border:1px solid #000;');
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$res .= $form_commentaire->toHTML();
$res .= '</div>'."\n";
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_commentaire');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
return $res ;
}
 
// merci PHP 5 ...
function mb_str_split2($str, $length = 1) {
if ($length < 1) return FALSE;
 
$result = array();
 
for ($i = 0; $i < strlen($str); $i += $length) {
$result[] = substr($str, $i, $length);
}
return $result;
}
 
function remove_accents2( $string )
{
$string = htmlentities($string);
return preg_replace("/&([a-z])[a-z]+;/i","$1",$string);
}
 
function genere_nom_wiki2($nom, $spaces = FALSE)
{
// traitement des accents
$nom = remove_accents2($nom);
$temp = mb_str_split2($nom);
 
$count = 0;
$final = NULL;
foreach($temp as $letter)
{
if(preg_match('/([[:space:]]|[[:punct:]])/', $letter))
{
$final .= ($spaces ? '_' : '');
} elseif(preg_match ('/[a-zA-Z0-9]/', $letter)) {
$final .= (($count == 0 || $count == (strlen($nom) - 1)) ? strtoupper($letter) : strtolower($letter));
}
$count++;
}
// vérifions que le retour n'est pas uniquement un underscore
if(preg_match('/^[[:punct:]]+$/', $final)) return FALSE;
 
// sinon retour du nom formaté
return($final);
}
 
 
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
*
* On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
* et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher
*
* @param string le contenu du flux RSS
* @param boolean afficher ou non la description
* @param string choisir le format de date: jmah (12/02/2004 12h34) jmh (12/02 12h34) jma (12/02/2004) jm (12/02) ou rien
*
* @return string le code HTML
*/
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
if ($rss!='') {
$rawitems='';$title='';$url='';$cat='';$date='';
$res='';
if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
$items = explode('<item>', $rawitems[0]);
$res.='<ul id="BAZ_liste_fiche">'."\n";
for( $i = 0; $i < count($items)-1; $i++ ) {
eregi('<title>(.*)</title>',$items[$i+1], $title );
eregi('<link>(.*)</link>',$items[$i+1], $url );
eregi('<description>(.*)</description>',$items[$i+1], $cat);
eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
$res.='<li>';
if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
if ($voirdesc) {$res.=$cat[1];}
// Ajout du bouton supprimer pour les superadministrateur
if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ;
$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
$res .= ' ( <a href="'.$url_suppr->getURL().
'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
BAZ_SUPPRIMER.'</a> )'."\n" ;
}
$res.='</li>'."\n";
}
$res.='</ul>'."\n";
if ($affichenb==1) {
//une annonce trouvee, on accorde au singulier
if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
}
//plusieures annonces trouvees, on accorde au pluriel
else {
$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
}
}
//cas des fiches pas trouvées
if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
}
}
}
else $res = BAZ_PAS_D_ANNONCES;
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
return $res;
}
 
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
*
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
* @param string La requete SQL personnalisee
* @param integer La categorie des fiches bazar
*
* @return string Le code du flux RSS
*/
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description, bn_label_nature, bf_date_creation_fiche '.
'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
if ($valide!=2) {
$requete .= 'bf_statut_fiche='.$valide;
$req_where=1;
}
$nomflux=html_entity_decode(BAZ_DERNIERE_ACTU);
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
$req_where=1;
//le nom du flux devient le type d'annonce
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
}
// Cas ou il y plusieurs type d annonce demande
if (is_array ($typeannonce)) {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature IN (' ;
$chaine = '';
foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
$requete .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requete .= ') and bf_ce_nature=bn_id_nature ';
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {
$requete .= ' AND ';
}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
}
}
else $nomflux .= BAZ_A_MODERER;
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
//requete pour afficher le nom de la structure
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
if ($categorie_nature!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') and bf_ce_nature=bn_id_nature ';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ;
// passage en utf-8 --julien
// --
// setlocale() pour avoir les formats de date valides (w3c) --julien
setlocale(LC_TIME, "C");
$xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes') ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode($nomflux)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode(BAZ_RSS_ADRESSESITE)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, utf8_encode(html_entity_decode(BAZ_RSS_DESCRIPTIONSITE)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('copyright', null, 'Copyright (c) '. date('Y') .' '. BAZ_RSS_NOMSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT'));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('ttl', null, '60');
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('image');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('image');
if ($resultat->numRows() > 0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(($ligne['bf_titre']))));
$xml .= "\r\n ";
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('description');
$xml .= "\r\n ";
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection ( utf8_encode(html_entity_decode(($ligne['bf_description']))));
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('description');
$xml .= "\r\n ";
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' &&
$ligne['bf_date_debut_validite_fiche']>$ligne['bf_date_creation_fiche']) {
$date_pub = $ligne['bf_date_debut_validite_fiche'];
} else $date_pub = $ligne['bf_date_creation_fiche'] ;
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
}
}
else {//pas d'annonces
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime("01/01/%Y")));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement('rss') ;
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
return $xml;
}
 
 
/** baz_liste() Formate la liste de toutes les annonces actuelles
*
* @return string le code HTML a afficher
*/
function baz_liste($typeannonce='toutes') {
//creation du lien pour le formulaire de recherche
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".'</tr>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces
//requete pour obtenir l'id et le label des types d'annonces
$requete = 'SELECT bn_id_nature, bn_label_nature '.
'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
'ORDER BY bn_label_nature ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
//on recupere le nb de types de fiches, pour plus tard
$nb_type_de_fiches=$resultat->numRows();
$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
}
if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
'onchange' => 'javascript:this.form.submit();');
$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
if (isset($_REQUEST['nature'])) {
$defauts=array('nature'=>$_REQUEST['nature']);
$formtemplate->setDefaults($defauts);
}
}
//cas du type d'annonces predefini
else {
if ($nb_type_de_fiches==1) {
$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
}
$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
 
//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
// dans le but de construire l'element de formulaire select avec les noms des emetteurs de fiche
if (BAZ_RECHERCHE_PAR_EMETTEUR) {
$requete = 'SELECT DISTINCT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';
$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
if (!isset($_REQUEST['nature'])) {
if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
}
}
else {
if ($_REQUEST['nature']!='toutes') {
$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
}
}
$requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
}
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
} else {
$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
}
//pour les super-administrateurs, on peut voir les annonces non validees
//on verifie si l'utilisateur est administrateur
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
 
if ($utilisateur->isSuperAdmin()) {
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
$valide_select[1] = BAZ_FICHES_VALIDEES;
$valide_select[2] = BAZ_LES_DEUX;
$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ;
$defauts=array('valides'=>1);
$formtemplate->setDefaults($defauts);
}
//champs texte pour entrer les mots cles
$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
//option cachee pour savoir si le formulaire a ete appele deja
$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
// Ajout des options si un type de fiche a ete choisie
if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) {
if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
$champs_requete = '' ;
if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
$_REQUEST['nature'] = $tableau_typeannonces[0];
}
}
// Recuperation du template
$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
//lien recherche de base
labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');
}
$tableau = baz_valeurs_template($resultat) ;
for ($i=0; $i<count($tableau); $i++) {
if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
}
}
}
else {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->removeQueryString($cle);
}
}
//lien recherche avancee
if (isset($lien_recherche_avancee)) {
labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
}
//Bouton de validation du formulaire
$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
//affichage du formulaire
//$res.=$formtemplate->toHTML()."\n";
 
// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
$case_coche = false ;
$nb_jointures=0;
$requeteFrom = '' ;
$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '. ($GLOBALS['_BAZAR_']['id_typeannonce'] == 'toutes' ? '' : 'AND bn_id_nature=\''.$GLOBALS['_BAZAR_']['id_typeannonce'].'\'') .' AND bn_id_nature=bf_ce_nature AND ' ;
$requeteWhereListe = '' ;
if ( isset($tableau) ) {
for ($i = 0; $i < count ($tableau); $i++) {
if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
$nb_jointures++;
$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
$case_coche = true;
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($nb_jointures) ;
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhere .= ' bfvl'.($nb_jointures).'.bfvl_ce_fiche=bf_id_fiche AND ';
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
$chaine = '';
//var_dump($_REQUEST[$nom_liste]);
foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
if ($valeur == 1) {
$chaine .= '"'.$cle.'",' ;
}
}
$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requeteWhereListe .= ') AND ';
} else {
if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($nb_jointures) ;
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
$requeteWhere .= ' bfvl'.($nb_jointures).'.bfvl_ce_fiche=bf_id_fiche AND ';
$case_coche = true;
}
}
}
}
}
if ($case_coche) {
$requeteWhere .= $requeteWhereListe;
}
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
}
if (BAZ_UTILISE_TEMPLATE) {
// Appel du template n 1
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
ob_start();
eval ($chaine) ;
$res .= ob_get_contents();
ob_end_clean() ;
} else {
$res .= $formtemplate->toHTML();
if (!isset($_REQUEST['recherche_effectuee'])) {
$res .= '<p class="zone_info">'.BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
$GLOBALS['_BAZAR_']['url']->addQueryString('action',BAZ_VOIR_FLUX_RSS);
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce',$GLOBALS['_BAZAR_']['id_typeannonce']);
if ($GLOBALS['_BAZAR_']['categorie_nature']!=0) $GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature',$GLOBALS['_BAZAR_']['categorie_nature']);
// $res .= '{{Syndication titre="'.BAZ_DERNIERES_FICHES.'" url="'.$GLOBALS['_BAZAR_']['url']->getURL().'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description, bn_label_nature, bf_date_creation_fiche FROM bazar_fiche, bazar_nature WHERE bn_id_nature=bf_ce_nature AND bn_ce_id_menu="'.$GLOBALS['_BAZAR_']['categorie_nature'].'" AND (bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00") AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00")
ORDER BY bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete);
if (DB::isError($resultat)) {
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if($resultat->numRows() != 0) {
$res .= '<h2>'.BAZ_DERNIERES_FICHES.'</h2>';
$res .= '<ul class="liste_rss">';
while($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC))
{
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$res .= '<li class="titre_rss"><a class="lien_rss" href="'. $GLOBALS['_BAZAR_']['url']->getURL() .'" alt="lire la fiche">'. $ligne['bf_titre'].'</a></li>';
}
$res .= '</ul>';
}
}
}
 
//affichage des resultats de la recherche si le formulaire a ete envoye
$requeteSQL='';
if (isset($_REQUEST['recherche_effectuee'])) {
//preparation de la requete pour trouver les mots cles
if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
//decoupage des mots cles
$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
$nbmots=count($recherche);
$requeteSQL='';
for ($i=0; $i<$nbmots; $i++) {
if ($i>0) $requeteSQL.=' OR ';
$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
}
}
if (!isset($_REQUEST['nature'])) {
if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ;
} else {
$typedefiches = $_REQUEST['nature'] ;
if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
}
if ($typeannonce!='toutes') $typedefiches=$typeannonce;
if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
else {$valides=1;}
//generation de la liste de flux a afficher
if (!isset($_REQUEST['personnes'])) $_REQUEST['personnes']='tous';
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personnes'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('annonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('categorie_nature');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
return $res;
}
 
/**
* Cette fonction renvoie du HTML
*/
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT * '.
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
if ($valide!=2) {
if ($req_where==1) {$requete .= ' AND ';}
$req_where=1;
$requete .= 'bf_statut_fiche='.$valide;
} else {
$requete .= '1 ' ;
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
$req_where=1;
}
}
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
return $resultat->getMessage().'<br /><br />'.$resultat->getDebugInfo() ;
}
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
// $res .= 'requete: '. $requete. '<br />';
$res .= '<ul>' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
$donnees = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']) ;
array_push ($donnees, $ligne);
}
// Mise en place du Pager
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
$params = array(
'mode' => BAZ_MODE_DIVISION,
'perPage' => BAZ_NOMBRE_RES_PAR_PAGE,
'delta' => BAZ_DELTA,
'httpMethod' => 'GET',
'extraVars' => array_merge($_POST, $_GET),
'altNext' => BAZ_SUIVANT,
'altPrev' => BAZ_PRECEDENT,
'nextImg' => BAZ_SUIVANT,
'prevImg' => BAZ_PRECEDENT,
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$data = $pager->getPageData();
$links = $pager->getLinks();
if (BAZ_UTILISE_TEMPLATE) {
//Appel du template n 2
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
$chaine = $template->getTemplate(2, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
ob_start();
eval ($chaine) ;
$res .= ob_get_contents();
ob_end_clean() ;
} else {
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
foreach ($data as $valeur) {
$res .='<li class="BAZ_'.$valeur['bn_label_class'].'">'."\n";
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur['bf_id_fiche']) ;
if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur['bf_ce_utilisateur']) {
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a>&nbsp;'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$res .='<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>&nbsp;'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur['bf_titre'].'</a>'."\n";
$res .='</li>'."\n";
}
$res .= '</ul>'."\n".'<div class="bazar_numero">'.$pager->links.'</div>'."\n";
}
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
 
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.82.2.3 2007-05-24 15:33:57 neiluj
* correction bug de recherche avec nature='toutes' ne retournant aucun resultat
*
* Revision 1.82 2007/04/20 12:47:42 florian
* correction bugs suite au merge
*
* Revision 1.81 2007/04/20 09:59:41 florian
* et un echo en moins!
*
* Revision 1.80 2007/04/20 09:57:21 florian
* correction bugs suite au merge
*
* Revision 1.79 2007/04/19 14:57:41 alexandre_tb
* merge
*
* Revision 1.77 2007/04/04 15:15:22 neiluj
* débug pour nom wiki
*
* Revision 1.76 2007/04/04 15:09:59 florian
* modif class fichiers
*
* Revision 1.75 2007/04/04 08:51:01 florian
* gestion des classes spécifiques pour habiller par CSS les fiches bazar
*
* Revision 1.74 2007/03/28 15:54:32 florian
* correction de bugs
*
* Revision 1.73 2007/03/28 10:01:47 florian
* ajout de la constante BAZ_UTILISE_TEMPLATE, pour utiliser ou non les templates pour l'affichage du moteur de recherche
*
* Revision 1.72 2007/03/28 08:51:22 neiluj
* passage des flux RSS en UTF-8
* ajout de l'indentation du code
* Vérification validation w3c = OK
*
* Revision 1.71 2007/03/19 15:17:37 alexandre_tb
* correction de la requete de recherche
*
* Revision 1.70 2007/03/08 15:12:13 jp_milcent
* Fusion avec la livraison Menes : 08 mars 2007
*
* Revision 1.60.2.11 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
* Revision 1.60.2.10 2007/03/06 09:41:15 alexandre_tb
* backport de corrections de bugs de la branche principale
*
* Revision 1.69 2007/03/06 09:39:00 alexandre_tb
* correction de bug sur les jointures et sur les flux rss
*
* Revision 1.68 2007/03/05 10:27:06 alexandre_tb
* ajout d identifiant dans les span qui affiche le detail d une fiche.
* ajout d un modele pour les fiches -> du code a ete deplace dans
* bazar_template
*
* Revision 1.67 2007/02/28 10:18:56 alexandre_tb
* backport de bug depuis la 1.60 de menes
*
* Revision 1.60.2.9 2007/02/27 15:32:40 alexandre_tb
* utilisation de la fonction xmlEntities pour transformer les &amp; en &#...;
* fixe les plantages des flux rss lorsque des guillemets ou des esperluettes étaient présents
*
* Revision 1.60.2.8 2007/02/27 15:11:00 alexandre_tb
* correction d une jointure dans la requete pour les flux rss
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
*
* Revision 1.60.2.7 2007/02/15 17:39:00 jp_milcent
* Remise dans le code d'un bogue...
* A corriger!
*
* Revision 1.60.2.6 2007/02/15 13:42:16 jp_milcent
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
*
* Revision 1.64 2007/02/02 14:00:41 alexandre_tb
* mise en place d'un template pour l'affichage du moteur de recherche
*
* Revision 1.60.2.5 2007/02/02 13:46:54 alexandre_tb
* correction bug sur une date
*
* Revision 1.60.2.4 2007/01/30 15:45:01 alexandre_tb
* affichage de la date de création e la fiche lorsque la date de début de validité n'est plus bonne
*
* Revision 1.60.2.3 2007/01/29 10:53:46 alexandre_tb
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
*
* Revision 1.63 2007/01/18 14:37:34 alexandre_tb
* backport
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.60.2.2 2007/01/17 16:01:27 alexandre_tb
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.60.2.1 2007/01/05 14:41:49 alexandre_tb
* backport ordre d affichage des dernieres news et suppression de la taille des images uploadees
*
* Revision 1.60 2006/10/05 08:53:50 florian
* amelioration moteur de recherche, correction de bugs
*
* Revision 1.59 2006/09/21 14:19:39 florian
* amélioration des fonctions liés au wikini
*
* Revision 1.58 2006/09/15 12:31:40 alexandre_tb
* correction du nom du flux RSS.
*
* Revision 1.57 2006/07/25 13:22:27 alexandre_tb
* réorganisation du code, sans grand changement
*
* Revision 1.56 2006/07/18 14:13:35 alexandre_tb
* Ajout d identifiant HTML
*
* Revision 1.55 2006/07/04 14:29:18 alexandre_tb
* Ajout du bouton supprimer pour les administrateurs
*
* Revision 1.54 2006/07/03 09:51:21 alexandre_tb
* correction du bug recherche sur fiches validés et invalidés.
*
* Revision 1.53 2006/06/29 10:29:51 florian
* correction bug moteur de recherche
*
* Revision 1.52 2006/06/02 09:29:07 florian
* debut d'integration de wikini
*
* Revision 1.51 2006/05/23 15:41:27 alexandre_tb
* ajout de la numérotation des pages en haut et en bas ds résultats et ajout d'une div class=bazar_numero pour les entourer
*
* Revision 1.50 2006/05/22 09:55:12 alexandre_tb
* ajout de la variable recherche_avancee dans l'action du formulaire
*
* Revision 1.49 2006/05/19 13:54:11 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.48 2006/05/17 09:50:13 alexandre_tb
* Ajout du moteur de recherche évolué et du découpage par page
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bazar/bazarRSS.php
New file
0,0 → 1,117
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazarRSS.php,v 1.7 2007-04-11 08:30:12 neiluj Exp $
/**
* Générateur de flux RSS à partir du bazar
*
*@package bazar
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
include_once 'bibliotheque/bazar.fonct.rss.php'; //fichier des fonctions RSS de Bazar
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS DU PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_GET['annonce'])) {
$annonce=$_GET['annonce'];
}
else {
$annonce='';
}
 
if (isset($_GET['categorie_nature'])) {
$categorie_nature=$_GET['categorie_nature'];
}
else {
$categorie_nature='';
}
 
if (isset($_GET['nbitem'])) {
$nbitem=$_GET['nbitem'];
}
else {
$nbitem='';
}
 
if (isset($_GET['emetteur'])) {
$emetteur=$_GET['emetteur'];
}
else {
$emetteur='';
}
 
if (isset($_GET['valide'])) {
$valide=$_GET['valide'];
}
else {
$valide=1;
}
 
if (isset($_GET['sql'])) {
$requeteSQL=$_GET['sql'];
}
else {
$requeteSQL='';
}
 
echo html_entity_decode(gen_RSS($annonce, $nbitem, $emetteur, $valide, $requeteSQL, '', '', $categorie_nature));
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2006/05/19 13:54:32 florian
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
*
* Revision 1.3 2005/07/21 19:03:12 florian
* nouveautés bazar: templates fiches, correction de bugs, ...
*
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
* Import initial de Bazar
*
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
* Import initial
*
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
* import de la nouvelle version
*
* Revision 1.3 2004/07/08 15:06:48 alex
* modification de la date
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/branches/v2.0-narmer/client/bottin/annuaire_backoffice.php
New file
0,0 → 1,98
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire_backoffice.php,v 1.6 2007-04-11 08:30:12 neiluj Exp $
/**
* programme principal du module annuaire_moteur
*
* programme principal du module annuaire_moteur
*
*@package annuaire
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
include_once 'configuration/bottin.config.inc.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/annuaire.fonct.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/annuaire_backoffice.fonct.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.fonct.php';
$lang=INS_LANGUE_DEFAUT;
define ("ANN_MAIL_TOUS", 1) ;
define ("ANN_MAIL_TOUS_ENVOIE", 2) ;
 
// Recherche parametres menu actif : ils ne sont pas present dans le contexte, quel dommage !
$requete_menu = 'SELECT gm_application_arguments '.
'FROM gen_menu '.
'WHERE gm_id_menu = '.$_GET['menu'];
$resultat_menu = $GLOBALS['_GEN_commun']['pear_db']->query($requete_menu);
$info_menu = $resultat_menu->fetchRow(DB_FETCHMODE_OBJECT);
$resultat_menu->free();
if (isset($info_menu->gm_application_arguments)) {
$arguments = explode(' ', $info_menu->gm_application_arguments);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
//cas de l'annuaire admin papyrus, on modifie certaines constantes
if ($info_application->type_annuaire==1) {
include_once INS_CHEMIN_APPLI.'configuration/annuaire_backoffice.config.inc.php';
}
 
function afficherContenuCorps () {
global $statut ;
 
if (!$GLOBALS['AUTH']->getAuth()) {
$res = AUTH_formulaire_login() ;
} else {
if (isset($_REQUEST[INS_CHAMPS_ID])) {
include_once (INS_CHEMIN_APPLI.'bibliotheque/edition_fiche.php');
$GLOBALS['ins_url']->addQueryString (INS_CHAMPS_ID, $_REQUEST[INS_CHAMPS_ID]) ;
return putFrame() ;
}
if (isset ($_GET['action'])) {
include_once (INS_CHEMIN_APPLI.'bibliotheque/mail_tous.php') ;
return putFrame() ;
}
if (isset($_REQUEST['ajouter'])) {
return ajouterInscrit() ;
}
$res = "<div>".mkengine()."</div>\n" ;
}
return $res ;
}
 
?>
/branches/v2.0-narmer/client/bottin/cartographie.admin.php
New file
0,0 → 1,185
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: cartographie.admin.php,v 1.6 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENT?E du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
class Cartographie_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction redigerContenu() - Affiche le formulaire de r?action
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
/** Inclusion du fichier de configuration de cette application.*/
require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
//-------------------------------------------------------------------------------------------------------------------
// Initialisation des attributs
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
$this->objet_pear_db = $GLOBALS['ins_db'];
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
$this->sortie_xhtml = '<h1>'.INS_CONFIG_MENU.' '.$_GET['adme_menu_id'].'</h1><br />'."\n";
//-------------------------------------------------------------------------------------------------------------------
// Gestion des boutons de l'interface
if (isset($_POST['afficheur_annuler'])) {
return false;
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
// Sauvegarde paramêtres carto
//on vérifie l'existence de la configuration, pour savoir si l'on fait un INSERT ou un UPDATE
$requete = 'SELECT cc_menu_id FROM carto_config WHERE cc_menu_id='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$requete = 'UPDATE carto_config SET cc_titre_carto="'.$_POST['titre_carto'].'", cc_table1="'.$_POST['nom_table1'].'", cc_table2="'.$_POST['nom_table2'].
'", cc_pays="'.$_POST['nom_champs_pays'].'", cc_cp="'.$_POST['nom_champs_cp'].
'", cc_sql="'.$_POST['requete_sql'].'" WHERE cc_menu_id='.$_GET['adme_menu_id'];
} else {
$requete = 'INSERT INTO carto_config (cc_titre_carto, cc_menu_id, cc_table1, cc_table2, cc_pays, cc_cp, cc_sql)'.
' VALUES ( "'.$_POST['titre_carto'].'", '.$_GET['adme_menu_id'].', "'.$_POST['nom_table1'].'", "'.$_POST['nom_table2'].
'", "'.$_POST['nom_champs_pays'].'", "'.$_POST['nom_champs_cp'].'", "'.$_POST['requete_sql'].'")';
}
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans carto_config
$requete = 'SELECT * FROM carto_config WHERE cc_menu_id='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$valeurs_par_defaut = array();
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
//valeurs par defaut enregistrees dans la table
$valeurs_par_defaut['titre_carto']=$ligne['cc_titre_carto'];
$valeurs_par_defaut['nom_table1']=$ligne['cc_table1'];
$valeurs_par_defaut['nom_table2']=$ligne['cc_table2'];
$valeurs_par_defaut['nom_champs_pays']=$ligne['cc_pays'];
$valeurs_par_defaut['nom_champs_cp']=$ligne['cc_cp'];
$valeurs_par_defaut['requete_sql']=$ligne['cc_sql'];
}
} else {
//valeurs par defaut pour afficher une carto des structures
$valeurs_par_defaut['titre_carto']='';
$valeurs_par_defaut['nom_table1']=INS_ANNUAIRE;
$valeurs_par_defaut['nom_table2']=0;
$valeurs_par_defaut['nom_champs_pays']=INS_CHAMPS_PAYS;
$valeurs_par_defaut['nom_champs_cp']=INS_CHAMPS_CODE_POSTAL;
$valeurs_par_defaut['requete_sql']='a_structure=1';
}
//--------------------------------------------------------------------------------------------------------------
// Gestion du formulaire
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
$form =& new HTML_QuickForm('form_param_carto', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".
'<td style="padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </td>'."\n".
'<td style="padding:5px;text-align:left;">{element}</td>'."\n".
'</tr>'."\n" );
$form->addElement('text', 'titre_carto', INS_TITRE_CARTO);
$requete = 'SHOW TABLES FROM '.$this->objet_pear_db->dsn['database'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$option_tables = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_tables[$ligne['Tables_in_'.$this->objet_pear_db->dsn['database']]] = $ligne['Tables_in_'.$this->objet_pear_db->dsn['database']];
}
$javascript= array('onchange' => 'javascript:this.form.submit();');
$form->addElement('select', 'nom_table1', INS_TABLE, $option_tables, $javascript);
if (isset($_POST['nom_table1'])) {
$table=$_POST['nom_table1'];
} else {
$table=$valeurs_par_defaut['nom_table1'];
}
$requete = 'SHOW COLUMNS FROM '.$table;
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$option_champs = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_champs[$ligne['Field']] = $ligne['Field'];
}
$form->addElement('select', 'nom_champs_pays', INS_NOM_CHAMPS_PAYS, $option_champs);
$form->addElement('select', 'nom_champs_cp', INS_NOM_CHAMPS_CP, $option_champs);
$option_tables[0] = INS_PAS_NECESSAIRE;
$form->addElement('select', 'nom_table2', INS_TABLE_SUPPLEMENTAIRE, $option_tables);
$form->addElement('text', 'requete_sql', INS_REQUETE_SQL_SUPPLEMENTAIRE);
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
$form->addElement('html', $liste_bouton_debut);
$form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
$form->addElement('submit', 'afficheur_annuler', INS_ANNULER);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$form->setDefaults($valeurs_par_defaut);
$this->sortie_xhtml .= $form->toHTML()."\n";
return $this->sortie_xhtml;
}
 
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
?>
/branches/v2.0-narmer/client/bottin/configuration/cartographie.config.inc.php
New file
0,0 → 1,23
<?php
 
// +----------------------------------------------------------------------------+
// |car_config.inc.php |
// +----------------------------------------------------------------------------+
// | Copyright (c) 2004 Tela Botanica |
// +----------------------------------------------------------------------------+
// | Le module d'inscription amélioré, configuration |
// +----------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +----------------------------------------------------------------------------+
//
// $Id: cartographie.config.inc.php,v 1.2 2006-04-04 12:23:05 florian Exp $
 
//==================================== CONSTANTES ==================================
// Constantes
//==================================================================================
define ('INS_MAIL_ADMIN', 'florian@ecole-et-nature.org') ; // L'email de l'administrateur de la carto pour envoyer un message en double
define ('INS_NECESSITE_LOGIN', 0) ; // Precise si les infos sont visibles pour tous (mettre 0) ou pour les identifies seulement (mettre 1)
define ('INS_ECHELLE_DEPART', 'europe') ; // Affiche l'échelle de départ à afficher pour la carto
define ('INS_AFFICHE_ECHELLE', 1) ; // Affiche l'échelle de la carto (mettre 1) ou non (mettre 0)
define ('INS_AFFICHE_ZONE_ROUGE', 1) ; // Affiche la liste déroulante permettant de mettre une zone au choix en rouge pour la reconnaitre (mettre 1) ou non (mettre 0)
?>
/branches/v2.0-narmer/client/bottin/configuration/annuaire_backoffice_bottin.config.inc.php
New file
0,0 → 1,103
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Fichier de configuration de l'application d'inscription/annuaire
*
* A éditer de façon spécifique à chaque déploiement
*
*@package ins_annuaire
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
//================================= CONSTANTES DB ==================================
/** Nom de la table Annuaire */
define ('INS_ANNUAIRE', 'annuaire');
/** Nom de la table des départements */
define ('INS_TABLE_DPT', 'gen_departement');
/** Nom de la table des pays */
define ('INS_TABLE_PAYS', 'gen_i18n_pays');
/** Champs identifiant */
define ('INS_CHAMPS_ID', 'a_id');
/** Champs adresse mail */
define ('INS_CHAMPS_MAIL', 'a_mail');
/** Champs nom */
define ('INS_CHAMPS_NOM', 'a_nom');
/** Champs prénom */
define ('INS_CHAMPS_PRENOM', 'a_prenom');
/** Champs description */
define ('INS_CHAMPS_DESCRIPTION','a_description');
/** Champs mot de passe */
define ('INS_CHAMPS_PASSE', 'a_mot_de_passe');
/** Champs identifiant pays */
define ('INS_CHAMPS_PAYS', 'a_ce_pays');
/** Champs code postal */
define ('INS_CHAMPS_CODE_POSTAL', 'a_code_postal');
/** Champs département */
define ('INS_CHAMPS_DEPARTEMENT', 'a_numero_dpt');
/** Champs adresse 1 */
define ('INS_CHAMPS_ADRESSE_1', 'a_adresse1');
/** Champs adresse 2 */
define ('INS_CHAMPS_ADRESSE_2', 'a_adresse2');
/** Champs ville */
define ('INS_CHAMPS_VILLE', 'a_ville');
/** Champs date de l'inscription */
define ('INS_CHAMPS_DATE_INSCRIPTION', 'a_date_inscription');
/** Champs pour désigner si c'est l'inscription d'une structure */
define ('INS_CHAMPS_EST_STRUCTURE', 'a_est_structure');
/** Champs sigle de la structure */
define ('INS_CHAMPS_SIGLE_STRUCTURE', 'a_sigle_structure');
/** Champs numéro de téléphone */
define ('INS_CHAMPS_TELEPHONE', 'a_telephone');
/** Champs numéro de fax */
define ('INS_CHAMPS_FAX', 'a_fax');
/** Champs d'appartenance à une structure */
define ('INS_CHAMPS_STRUCTURE', 'a_ce_structure');
/** Champs identifiant du pays de la table des pays*/
define ('INS_CHAMPS_ID_PAYS', 'gip_id_pays');
/** Champs nom du pays de la table des pays*/
define ('INS_CHAMPS_LABEL_PAYS', 'gip_nom_pays_traduit');
/** Champs qui contient la localisation */
define ('INS_CHAMPS_I18N_PAYS', ' gip_id_i18n') ;
/** Champs identifiant du département de la table des departement*/
define ('INS_CHAMPS_ID_DEPARTEMENT','gd_id_departement');
/** Champs nom du département de la table des departement*/
define ('INS_CHAMPS_NOM_DEPARTEMENT','gd_nom');
/** Champs pour l'abonnement à une liste, laisser vide si vous ne souhaitez pas d'inscription' */
define ('INS_CHAMPS_LETTRE', 'a_lettre');
/** Champs de la date d'inscription */
define ('INS_CHAMPS_DATE', 'a_date_inscription');
/** Champs du site Internet*/
define ('INS_CHAMPS_SITE_INTERNET', 'a_site_internet');
/** Champs pour la vue sur carto*/
define ('INS_CHAMPS_VISIBLE', 'a_voir_sur_carto');
/** Champs pour la vue sur carto*/
define ('INS_CHAMPS_NUM_AGREMENT', 'a_num_agrement_fpc');
/** Champs pour le logo*/
define ('INS_CHAMPS_LOGO', 'a_logo');
?>
/branches/v2.0-narmer/client/bottin/configuration/annuaire_backoffice.config.inc.php
New file
0,0 → 1,33
<?php
 
// +--------------------------------------------------------------------------------+
// | annuaire_moteur_config.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2000 - 2003 Tela Botanica |
// +--------------------------------------------------------------------------------+
// | Fichier de configuration de annuaire_moteur.php |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: annuaire_backoffice.config.inc.php,v 1.4 2007-04-11 08:30:12 neiluj Exp $
 
/**
//==================================== CONSTANTES ==================================
* Constantes des noms de tables et de champs dans l'annuaire admin papyrus
//==================================================================================
*/
 
/** Nom de la table Annuaire */
define ('INS_ANNUAIRE', 'gen_annuaire');
/** Champs identifiant */
define ('INS_CHAMPS_ID', 'ga_id_administrateur');
/** Champs adresse mail */
define ('INS_CHAMPS_MAIL', 'ga_mail');
/** Champs nom */
define ('INS_CHAMPS_NOM', 'ga_nom');
/** Champs prénom */
define ('INS_CHAMPS_PRENOM', 'ga_prenom');
/** Champs mot de passe */
define ('INS_CHAMPS_PASSE', 'ga_mot_de_passe');
?>
/branches/v2.0-narmer/client/bottin/configuration/bottin.config.inc.php
New file
0,0 → 1,291
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bottin.config.inc.php,v 1.16 2007-04-11 08:30:12 neiluj Exp $
/**
* Fichier de configuration de l'application d'inscription/annuaire
*
* A éditer de façon spécifique à chaque déploiement
*
*@package ins_annuaire
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.16 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
//================================= CONSTANTES DB ==================================
/** Nom de la table Annuaire */
define ('INS_ANNUAIRE', 'annuaire');
/** Nom de la table des départements */
define ('INS_TABLE_DPT', 'gen_departement');
/** Nom de la table des pays */
define ('INS_TABLE_PAYS', 'gen_i18n_pays');
/** Champs identifiant */
define ('INS_CHAMPS_ID', 'a_id');
/** Champs adresse mail */
define ('INS_CHAMPS_MAIL', 'a_mail');
/** Champs nom */
define ('INS_CHAMPS_NOM', 'a_nom');
/** Champs prénom */
define ('INS_CHAMPS_PRENOM', 'a_prenom');
/** Champs description */
define ('INS_CHAMPS_DESCRIPTION','a_description');
/** Champs mot de passe */
define ('INS_CHAMPS_PASSE', 'a_mot_de_passe');
/** Champs identifiant pays */
define ('INS_CHAMPS_PAYS', 'a_ce_pays');
/** Champs code postal */
define ('INS_CHAMPS_CODE_POSTAL', 'a_code_postal');
/** Champs département */
define ('INS_CHAMPS_DEPARTEMENT', 'a_numero_dpt');
/** Champs adresse 1 */
define ('INS_CHAMPS_ADRESSE_1', 'a_adresse1');
/** Champs adresse 2 */
define ('INS_CHAMPS_ADRESSE_2', 'a_adresse2');
/** Champs ville */
define ('INS_CHAMPS_VILLE', 'a_ville');
/** Champs date de l'inscription */
define ('INS_CHAMPS_DATE_INSCRIPTION', 'a_date_inscription');
/** Champs pour désigner si c'est l'inscription d'une structure */
define ('INS_CHAMPS_EST_STRUCTURE', 'a_est_structure');
/** Champs sigle de la structure */
define ('INS_CHAMPS_SIGLE_STRUCTURE', 'a_sigle_structure');
/** Champs numéro de téléphone */
define ('INS_CHAMPS_TELEPHONE', 'a_telephone');
/** Champs numéro de fax */
define ('INS_CHAMPS_FAX', 'a_fax');
/** Champs d'appartenance à une structure */
define ('INS_CHAMPS_STRUCTURE', 'a_ce_structure');
/** Champs identifiant du pays de la table des pays*/
define ('INS_CHAMPS_ID_PAYS', 'gip_id_pays');
/** Champs nom du pays de la table des pays*/
define ('INS_CHAMPS_LABEL_PAYS', 'gip_nom_pays_traduit');
/** Champs qui contient la localisation */
define ('INS_CHAMPS_I18N_PAYS', ' gip_id_i18n') ;
/** Champs identifiant du département de la table des departement*/
define ('INS_CHAMPS_ID_DEPARTEMENT','gd_id_departement');
/** Champs nom du département de la table des departement*/
define ('INS_CHAMPS_NOM_DEPARTEMENT','gd_nom');
/** Champs pour l'abonnement à une liste, laisser vide si vous ne souhaitez pas d'inscription' */
define ('INS_CHAMPS_LETTRE', 'a_lettre');
/** Champs de la date d'inscription */
define ('INS_CHAMPS_DATE', 'a_date_inscription');
/** Champs du site Internet*/
define ('INS_CHAMPS_SITE_INTERNET', 'a_site_internet');
/** Champs pour la vue sur carto*/
define ('INS_CHAMPS_VISIBLE', 'a_voir_sur_carto');
/** Champs pour la vue sur carto*/
define ('INS_CHAMPS_NUM_AGREMENT', 'a_num_agrement_fpc');
/** Champs pour le logo*/
define ('INS_CHAMPS_LOGO', 'a_logo');
 
 
if (INS_CHAMPS_LETTRE != '') {
/** adresse d'inscription à la newsletter */
define ('INS_MAIL_INSCRIPTION_LISTE', 'newsletter-subscribe@domaine.org');
/** adresse de désinscription à la newsletter */
define ('INS_MAIL_DESINSCRIPTION_LISTE', 'newsletter-unsubscribe@domaine.org');
}
 
//teste si l'on est dans l'application Papyrus
if (!defined('PAP_VERSION')) { //pas dans Papyrus
//================================ BASE DE DONNEES =================================
define ('INS_PROTOCOLE', 'mysql') ;
define ('INS_UTILISATEUR', '') ;
define ('INS_MOT_DE_PASSE_DB', '') ;
define ('INS_HOTE', 'localhost') ;
define ('INS_BASE', '') ;
define ('INS_TYPE_ENCODAGE','MD5');
// Formation du dsn
$dsn = INS_PROTOCOLE.'://'.INS_UTILISATEUR.':'.INS_MOT_DE_PASSE_DB.'@'.INS_HOTE.'/'.INS_BASE;
 
include_once PAP_CHEMIN_RACINE.'api/pear/DB.php'; //appel de la librairie DB de PEAR
/** Variable globale contenant l'objet d'accès à la base de donnée */
$GLOBALS['ins_db'] =& DB::connect($dsn);
//=============================== AUTHENTIFICATION =================================
include_once PAP_CHEMIN_RACINE.'api/pear/Auth.php'; //appel de la librairie Auth de PEAR
/** Nom de la session PHP */
define ('INS_NOM_SESSION','Educ-Envir.org');
/** Durée de la session PHP */
define ('INS_DUREE_SESSION',3600*12);
/** Tableau des parametres de l'authentification */
$params = array(
'dsn' => $dsn,
'table' => INS_ANNUAIRE,
'usernamecol' => INS_CHAMPS_MAIL,
'passwordcol' => INS_CHAMPS_MOT_DE_PASSE
);
/** Variable globale contenant l'objet d'authentification de l'application, un objet AUTH*/
$GLOBALS['AUTH']= &new Auth($GLOBALS['ins_db'], $params );
$GLOBALS['AUTH']->setSessionname(INS_NOM_SESSION);
$GLOBALS['AUTH']->setExpire(INS_DUREE_SESSION);
$GLOBALS['AUTH']->setShowLogin(false);
//==================================== LES URLS ====================================
include_once PAP_CHEMIN_RACINE.'api/pear/Net_URL.php'; //appel de la librairie Net_URL de PEAR
/** Variable globale contenant l'objet d'accès à l'URL de base de l'application, un objet Net_URL*/
$GLOBALS['ins_url'] = new Net_URL('http://localhost/');
 
//===================================== CHEMINS ====================================
/** Chemin de l'application (mettre un / à la fin) */
define ('INS_CHEMIN_APPLI', '/');
 
//===================================== LANGUES ====================================
/** Choix de la langue par défaut de l'application */
define ('INS_LANGUE_DEFAUT', 'fr');
include_once INS_CHEMIN_APPLI.'langues/ins_annuaire.langue.'.INS_LANGUE_DEFAUT.'.inc.php'; //appel du fichier de constantes des langues
} else { //dans Papyrus
//================================ BASE DE DONNEES =================================
/** Variable globale contenant l'objet d'accès à la base de données de l'application, un objet DB*/
$GLOBALS['ins_db'] =& $GLOBALS['_GEN_commun']['pear_db'];
 
//=========================AUTHENTIFICATION=================================
/** Variable globale contenant l'objet d'authentification de l'application, un objet AUTH*/
$GLOBALS['AUTH'] =& $GLOBALS['_GEN_commun']['pear_auth'];
//==================================== LES URLS ====================================
/** Variable globale contenant l'objet d'accès à l'URL de base de l'application, un objet Net_URL*/
$GLOBALS['ins_url'] =& $GLOBALS['_GEN_commun']['url'];
 
//===================================== CHEMINS ====================================
/** Chemin de l'application (mettre un / à la fin) */
define ('INS_CHEMIN_APPLI', 'client/bottin/');
 
//===================================== LANGUES ====================================
/** Choix de la langue par défaut de l'application */
define ('INS_LANGUE_DEFAUT', $GLOBALS['_GEN_commun']['i18n']) ;
include_once INS_CHEMIN_APPLI.'langues/bottin.langue_'.INS_LANGUE_DEFAUT.'.inc.php'; //appel du fichier de constantes des langues
}
 
 
/** Définir la présence d'un formulaire d'inscription de structure (mettre à 1 pour oui, 0 pour non */
define ('INS_FORMULAIRE_STRUCTURE', 1);
 
/** Définir la présence d'un formulaire d'inscription de structure (mettre à 1 pour oui, 0 pour non */
define ('INS_URL_BAZAR', 'http://localhost/papyrus/papyrus.php?menu=16');
 
 
/** Définir la nécessité d'envoyer un message de confirmation d'inscription (mettre à 1 pour oui, 0 pour non */
define ('INS_MAIL_VALIDATION_INSCRIPTION', 0);
 
/** Adresse de messagerie de l'administrateur, pour suivre les inscriptions */
define ('INS_MAIL_ADMIN_APRES_INSCRIPTION', 'nom@domaine.ext');
 
$GLOBALS['mail_admin'] = array ('nom@domaine.ext') ; // Liste des personne recevant le mail
/** Sujet du message envoyé pour l'inscription */
define ('INS_MAIL_ADMIN_APRES_INSCRIPTION_SUJET', '[nom] Inscription');
 
/** L'inscription génère t'elle l'inscription à un Spip? Mettre à 1 pour oui , et 0 pour non */
define ('INS_UTILISE_SPIP', 0);
if (INS_UTILISE_SPIP) {
/** Chemin d'accès au Spip */
define ('INS_CHEMIN_SPIP', '');
}
 
/** L'inscription génère t'elle l'inscription à un Wikini? Mettre à 1 pour oui , et 0 pour non */
define ('INS_UTILISE_WIKINI', 1);
if (INS_UTILISE_WIKINI) {
/** Le nom du champs contenant le nom wikini dans l'annuaire */
define ('INS_CHAMPS_NOM_WIKINI', 'a_nom_wikini');
/** Le nom Wiki est il genere automatiquement */
define ('INS_NOM_WIKINI_GENERE', 1) ;
}
 
/** L'inscription utilise t'elle le module projet? Mettre à 1 pour oui , et 0 pour non */
define ('INS_UTILISE_MODULE_PROJET', 1) ;
if (INS_UTILISE_MODULE_PROJET) {
define ('INS_CHEMIN_PROJET', 'client/projet/') ;
}
 
/**
//==================================== PARAMETRAGE =================================
* Pour gérer la réécriture d'url de l'inscription
* Cela nécessite une ligne dans le fichier .htaccess, par exemple
* RewriteRule ^ins([0-9a-z]*)$ papyrus.php?menu=22&id=$1 [L]
* Cela sert à racourcir l'URL de confirmation d'inscription
//==================================================================================
*/
 
define ('INS_UTILISE_REECRITURE_URL', 1) ; // mettre à 1 si on souhaite utiliser la réécriture
 
if (INS_UTILISE_REECRITURE_URL) {
define ('INS_URL_PREFIXE', 'ins_') ; // Indique le préfixe de l'url http://www.mondomaine.org/prefix____
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.14 2006/12/01 13:23:17 florian
* integration annuaire backoffice
*
* Revision 1.13 2006/09/20 14:56:41 alexandre_tb
* correction de la valeur par défaut INS_CHAMPS_I18N_PAYS
*
* Revision 1.12 2006/09/12 15:44:18 alexandre_tb
* suppression du $GLOBALS['mail_admin'] en double
*
* Revision 1.11 2006/09/12 15:40:33 alexandre_tb
* modification des valeurs par défaut
* utilisation de gen_i18n_pays pour la table des pays
*
* Revision 1.10 2006/06/29 07:47:22 alexandre_tb
* ajout du tableau mail_admin
*
* Revision 1.9 2006/04/28 12:44:05 florian
* integration bazar
*
* Revision 1.8 2006/04/10 09:51:28 alexandre_tb
* ajout de la constante INS_NOM_WIKINI_GENERE.
*
* Revision 1.7 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.6 2006/03/15 11:04:27 alexandre_tb
* ajout du tableau mail_admin qui contient la liste des administrateurs qui recevront un double du mail d'inscription
*
* Revision 1.5 2005/12/19 13:16:38 alexandre_tb
* généricité du fichier de config
*
* Revision 1.4 2005/12/19 11:06:01 alexandre_tb
* modification dans la table annuaire
*
* Revision 1.3 2005/11/17 18:48:02 florian
* corrections bugs + amélioration de l'application d'inscription
*
* Revision 1.2 2005/09/29 13:56:48 alexandre_tb
* En cours de production. Reste à gérer les news letters et d'autres choses.
*
* Revision 1.1 2005/09/27 13:56:18 alexandre_tb
* version initiale, les autres fichiers de configurations devraient progressivement disparaitre.
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/configuration/annuaire.config.inc.php
New file
0,0 → 1,65
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.config.inc.php,v 1.2 2006-04-04 12:23:05 florian Exp $
/**
* Fichier de configuration de l'annuaire
*
* A éditer de façon spécifique à chaque déploiement
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
//include_once INS_CHEMIN_APPLI.'langues/annuaire.langue.'.INS_LANGUE_DEFAUT.'.inc.php'; //appel du fichier de constantes des langues
define ('INS_NECESSITE_LOGIN', 0) ; // Precise si les infos sont visibles pour tous (mettre 0) ou pour les identifies seulement (mettre 1)
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.3 2005/03/24 08:46:29 alex
* version initiale
*
* Revision 1.2 2005/03/08 09:43:34 alex
* --
*
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
* Import initial
*
* Revision 1.1 2005/01/03 17:19:20 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/inscription.php
New file
0,0 → 1,341
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.php,v 1.23 2007-04-11 08:30:12 neiluj Exp $
/**
* Inscription
*
* Un module d'inscription, en général ce code est spécifique à
* un site web
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.23 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
include_once 'configuration/bottin.config.inc.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
 
// Inclusion d'une classe personnalisé si elle existe
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;
} else {
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
}
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
if (!isset($_REQUEST['action'])) {
$_REQUEST['action']='';
}
 
 
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences'])
or (isset($_REQUEST['action'])&&($_REQUEST['action']=='modifier_v'||$_REQUEST['action']=='modifier_v'))
or ($GLOBALS['AUTH']->getAuth() && ($_REQUEST['action']!='modifier')) ) {
//---------------le menu de l'appli-----------
function afficherContenuNavigation () {
$res =inscription_onglets();
return $res ;
}
}
 
function afficherContenuCorps() {
$res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
 
//cas de la déconnexion----------------------------------------------------------------------------------
if ($_REQUEST['action'] == 'deconnexion') {
$GLOBALS['AUTH']->logout() ;
$_POST['username'] = '' ;
$_POST['password'] = '' ;
return $res.inscription_AUTH_formulaire_login() ;
}
//cas de la désinscription-------------------------------------------------------------------------------
if ($_REQUEST['action'] == 'supprimer') {
$id_utilisateur = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
// Suppression dans SPIP
if (INS_UTILISE_SPIP) {
desinscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) ;
}
// Suppression dans Wikini
if (INS_UTILISE_WIKINI) {
$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_NOM_WIKINI) ;
desinscription_interwikini_users($nom_wiki) ;
}
// Appel des actions desinscriptions des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;
}
$d->close();
$resultat = $GLOBALS['AUTH']->removeUser($GLOBALS['AUTH']->getUsername()) ;
if (PEAR::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
// Deconnection
$GLOBALS['AUTH']->logout() ;
return $res.inscription_AUTH_formulaire_login() ;
}
//cas de l'envoi de mot de passe par mail----------------------------------------------------------------
if ($_REQUEST['action'] == 'sendpasswd') {
return inscription_envoie_passe()."\n".inscription_formulaire_envoi_passe() ;
}
 
//cas de la saisie ou la modification de l'inscription individuelle ou structure
if (($_REQUEST['action'] == 'modifier')or($_REQUEST['action'] == 'modifier_v')or($_REQUEST['action'] == 'inscription')or($_REQUEST['action'] == 'inscription_v')) {
$formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()), '_self', '', 0) ;
$formulaire->construitFormulaire(preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()));
if (isset($_REQUEST['form_structure'])) {
if ($_REQUEST['form_structure']==1) {
$formulaire->formulaireStructure() ;
}
}
// On ajoute la règle de vérification mail uniquement lors de l inscription
if ($_REQUEST['action'] == 'inscription') {
$formulaire->registerRule('doublonmail', 'callback', 'verif_doublonMail');
$formulaire->addRule('email', INS_MAIL_DOUBLE, 'doublonmail', true);
}
//pour la modification d'une inscription, on charge les valeurs par défauts
if ($_REQUEST['action'] == 'modifier') {
$formulaire->addElement('hidden', 'action', 'modifier_v') ;
$formulaire->setDefaults(inscription_formulaire_defaults()) ;
}
if ($_REQUEST['action'] == 'inscription') {
if ($GLOBALS['AUTH']->getAuth()) {
} else {
$formulaire->addElement('hidden', 'action', 'inscription_v') ;
$formulaire->setDefaults(array('pays' => 'fr', 'visible' => 1,'lettre'=>1));
}
}
if ($_REQUEST['action'] == 'inscription_v') {
if ($formulaire->validate()) {
if (INS_MAIL_VALIDATION_INSCRIPTION) {
$formulaire->process('inscription_demande', false) ;
return $res.INS_MESSAGE_INSCRIPTION;
} else {
$formulaire->process('inscription_validee', false) ;
$id_utilisateur = $GLOBALS['ins_db']->getOne('SELECT MAX('.INS_CHAMPS_ID.') FROM '.INS_ANNUAIRE) ;
// Appel des actions des inscriptions des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
}
$d->close();
return $res.info();
}
} else {
// Si le formulaire n'est pas bon on remet l'action à inscription_v
$formulaire->addElement('hidden', 'action', 'inscription_v') ;
}
}
if ($_REQUEST['action'] == 'modifier_v') {
if ($formulaire->validate()) {
$formulaire->process('inscription_mise_a_jour', false) ;
} else {
return $formulaire->toHTML();
}
return $res.info();
}
return $res.$formulaire->toHTML() ;
}
//cas de la validation par mail d'une inscription--------------------------------------------------------
if ((INS_MAIL_VALIDATION_INSCRIPTION)and(isset($_GET['id']))) {
$requete = 'SELECT id_donnees FROM inscription_demande WHERE id_identifiant_session="'.$_GET['id'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() == 0) {
return $res.INS_MESSAGE_EXPIRATION;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$donnees = unserialize (stripslashes($ligne->id_donnees)) ;
$id_utilisateur = inscription_insertion($donnees) ;
$GLOBALS['AUTH']->username = $donnees['email'] ;
$GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
// On loggue l'utilisateur
$GLOBALS['AUTH']->login() ;
// inscription à la lettre d'information
if (isset ($donnees['lettre'])) {
inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
}
// On supprime la demande d'inscription
$requete = 'delete from inscription_demande where id_identifiant_session="'.$_GET['id'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
// Appel des actions desinscriptions des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
}
$d->close();
envoie_mail() ;
}
if ((!$GLOBALS['AUTH']->getAuth())&&($_REQUEST['action']!='inscription')&&($_REQUEST['action']!='inscription_v')) {
if (isset($_POST['username']) && $_POST['username'] != '') {
$res .= '<p class="erreur">'.INS_ERREUR_LOGIN.'</p><br />'."\n".inscription_formulaire_envoi_passe();
} else {
$res .= inscription_AUTH_formulaire_login() ;
}
}
//cas d'une authentification réussie---------------------------------------------------------------------
if ($GLOBALS['AUTH']->getAuth() && ($_REQUEST['action']!='modifier')) {
return info() ;
}
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.20.2.1 2007/01/26 10:32:59 alexandre_tb
* suppression d un notice
*
* Revision 1.20 2006/12/01 13:23:17 florian
* integration annuaire backoffice
*
* Revision 1.19 2006/10/05 13:53:54 florian
* amélioration des fichiers sql
*
* Revision 1.18 2006/07/20 09:48:07 alexandre_tb
* réglages
*
* Revision 1.17 2006/07/06 10:33:30 alexandre_tb
* correction bug du à dernière mise à jour
*
* Revision 1.16 2006/07/04 09:38:31 alexandre_tb
* Ajout de la règle doublon email uniquement lors de création d'une entrée
*
* Revision 1.15 2006/06/01 10:00:35 alexandre_tb
* correction bug désinscription des appli cliente
*
* Revision 1.14 2006/04/10 09:48:16 alexandre_tb
* Correction de bug pour les inscriptions aux autres applications
*
* Revision 1.13 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.12 2006/03/15 11:05:45 alexandre_tb
* ajout de l'action caché inscription_v lors du réaffichage du formulaire après erreur de saisie.
*
* Revision 1.11 2006/03/02 14:10:35 alexandre_tb
* correction du bug desinscription wikini
*
* Revision 1.10 2006/03/02 13:03:45 alexandre_tb
* bug de désinscription interwikini_users
*
* Revision 1.9 2006/02/28 14:08:27 alexandre_tb
* appel des inscriptions des autres appli, sous le format:
* client/appli/appli.inscription.php
*
* Revision 1.8 2006/02/14 10:21:08 alexandre_tb
* ajout d'un appel à un fichier de classe personnalisé
*
* Revision 1.7 2005/12/19 13:16:14 alexandre_tb
* correction d'un bug
*
* Revision 1.6 2005/11/18 16:04:15 florian
* corrections de bugs, optimisations, tests pour rendre inscription stable.
*
* Revision 1.5 2005/11/17 18:48:02 florian
* corrections bugs + amélioration de l'application d'inscription
*
* Revision 1.4 2005/10/25 14:02:21 alexandre_tb
* le formulaire affiche la france par défaut
*
* Revision 1.3 2005/09/29 16:07:51 alexandre_tb
* En cours de production.
*
* Revision 1.2 2005/09/27 13:59:24 alexandre_tb
* correction de bogue, généralisation du code etc.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.4 2005/03/21 16:57:30 florian
* correction de bug, mise à jour interface
*
* Revision 1.3 2005/03/08 17:44:02 alex
* suppression en utilisant removeUser de Auth plutôt qu'en requete directe
*
* Revision 1.2 2005/03/02 12:44:41 alex
* Correction du bug message d'erreur alors qu'on tente de s'inscrire simplement
*
* Revision 1.1 2004/12/15 13:32:15 alex
* version initiale
*
* Revision 1.2 2004/09/01 16:36:37 alex
* changement du chemin pour les include
*
* Revision 1.1 2004/07/06 15:42:28 alex
* en cours
*
* Revision 1.5 2004/07/06 15:28:56 alex
* en cours
*
* Revision 1.4 2004/06/25 14:26:03 alex
* modification de la suppression
*
* Revision 1.3 2004/06/23 12:41:44 alex
* amélioration de la gestion de la perte de mot de passe
*
* Revision 1.2 2004/06/18 09:18:23 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/annuaire.php
New file
0,0 → 1,104
<?
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.php,v 1.7 2007-04-11 08:30:12 neiluj Exp $
/**
* programme principal du module annuaire
*
* programme principal du module annuaire
*
*@package annuaire
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
include_once 'configuration/bottin.config.inc.php';
include_once 'configuration/annuaire.config.inc.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
 
if (!isset($GLOBALS['lang'])) {
$GLOBALS['lang'] = INS_LANGUE_DEFAUT ;
}
include_once INS_CHEMIN_APPLI."langues/annuaire.langue.".$GLOBALS['lang'].".inc.php" ;
 
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
//---------------le menu de l'appli-----------
function afficherContenuNavigation () {
$res =inscription_onglets();
return $res ;
}
}
 
/**
* Renvoie le code HTML de l'application
*
* @return string HTML
*/
function afficherContenuCorps () {
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
$res = affiche_onglet_info();
} else {
$res = '<h1 class="annuaire_titre1">'.INS_ANNUAIRE_MEMBRES.'</h1>'."\n" ;
if (!$GLOBALS['AUTH']->getAuth()&&INS_NECESSITE_LOGIN) {
$res .= '<p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
} else {
// S'il y a un mail a envoyé, on l'envoie
if (isset($_POST['select']) && is_array ($_POST['select'])) $res .= envoie_mail_depuis_annuaire() ;
//affichage du formulaire de recherche
$res .= Annuaire_recherche() ;
}
}
return $res;
}
 
/**------------------------------------------------------------------------------
* $Log: not supported by cvs2svn $
* Revision 1.5 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
* Revision 1.4 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.3 2005/10/03 09:38:42 alexandre_tb
* Lorsque non loggué, on renvoie un message et non un formulaire
*
* Revision 1.2 2005/09/29 16:07:51 alexandre_tb
* En cours de production.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
*
*-- End of source ------------------------------------------------------------*/
?>
/branches/v2.0-narmer/client/bottin/documentation/ins_annuaire.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/documentation/ins_annuaire.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/documentation/bottin_v0.24.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/documentation/bottin_v0.24.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/documentation/cartographie.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/documentation/cartographie.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/annuaire_backoffice.admin.php
New file
0,0 → 1,138
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
*
*@package bottin
//Auteur original :
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
class Annuaire_Backoffice_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction redigerContenu() - Affiche le formulaire de r?action
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
/** Inclusion du fichier de configuration de cette application.*/
require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
//-------------------------------------------------------------------------------------------------------------------
// Initialisation des attributs
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
$this->objet_pear_db = $GLOBALS['ins_db'];
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
$this->sortie_xhtml = '<h1>'.INS_CONFIG_ANNUAIRE_BACKOFFICE.'</h1><br />'."\n";
//-------------------------------------------------------------------------------------------------------------------
// Gestion des boutons de l'interface
if (isset($_POST['afficheur_annuler'])) {
return false;
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
$requete = 'UPDATE gen_menu SET gm_application_arguments="type_annuaire='.$_POST['type_annuaire'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans carto_config
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$valeurs_par_defaut = array();
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$arguments = explode(' ', $ligne->gm_application_arguments);
var_dump($arguments);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
//valeurs par defaut enregistrees dans la table
$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
} else {
//valeurs par defaut pour afficher une carto des structures
$valeurs_par_defaut['type_annuaire']=0;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion du formulaire
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
$form =& new HTML_QuickForm('form_param_annuaire_backoffice', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<p>'."\n".
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </label>'."\n".'{element}'."\n".
'</p>'."\n" );
$option_tables[0] = INS_ANNUAIRE_BOTTIN;
$option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
$form->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
$form->addElement('html', $liste_bouton_debut);
$form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
$form->addElement('submit', 'afficheur_annuler', INS_ANNULER);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$form->setDefaults($valeurs_par_defaut);
$this->sortie_xhtml .= $form->toHTML()."\n";
return $this->sortie_xhtml;
}
 
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/voir_recu_pdf.php
New file
0,0 → 1,39
<?php
// +----------------------------------------------------------------------------+
// |recu_pdf.php |
// +----------------------------------------------------------------------------+
// | Copyright (c) 2003 Tela Botanica |
// +----------------------------------------------------------------------------+
// | Ce fichier génère un fichier PDF |
// | contenant le recu pour une cotisation à Tela Botanica |
// | Il utilise la librairie FPDF |
// | http://www.fpdf.org/ |
// | |
// | Recoie $cotisation_id en parametre |
// +----------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +----------------------------------------------------------------------------+
//
// $Id: voir_recu_pdf.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
 
 
// Inclusion des fichiers nécessaire à une connection
include_once ("../../papyrus/configuration/pap_config.inc.php") ;
include_once 'DB.php' ;
 
$db = DB::connect (PAP_DSN) ;
 
include_once "../../api/fpdf/fpdf.php";
 
$envoie = 1 ;
 
include_once "recu_pdf_corps.php" ;
 
 
// buffer est une propriété de la classe FPDF qui contient les données au format PDF.
// habituellement on ne l'utilise pas, on appelle $pdf->Output() qui envoie les
// entete HTTP du document généré
 
$pdf->Output() ;
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/edition_fiche.php
New file
0,0 → 1,214
<?php
 
// +--------------------------------------------------------------------------------+
// | admin_annu.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2002 |
// +--------------------------------------------------------------------------------+
// | Administration des inscrits à un annuaire de type annuaire_tela |
// | de Gsite, |
// | Sont également mises en jeux les tables gen_COUNTRY, gen_FRENCH_DPT, |
// | LABELS |
// | Plus spécifique la fonction cotisation($id) en bas permet de |
// | gérer les cotisations versées par les inscrits, avec la table |
// | annuaire_COTISATION |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: edition_fiche.php,v 1.5 2007-04-11 08:30:12 neiluj Exp $
 
 
define ("URL_RECU", $GLOBALS['ins_url']->protocol. '://'.$GLOBALS['ins_url']->host."/client/annuaire/voir_recu_pdf.php") ;
 
include_once ("HTML/Table.php") ;
 
// admin_annu est une application cliente de gsite elle commence donc
// dans une fonction putFrame()
 
 
function putFrame()
{
 
$url = $GLOBALS['ins_url']->getURL() ;
 
// mise à jour si il y lieu
 
if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'up') {
upSQL() ;
}
 
// Requete de pour récupérer toutes les infos d'un usager
 
$query = 'select '.INS_ANNUAIRE.'.* ,'.INS_TABLE_PAYS.'.'.INS_CHAMPS_LABEL_PAYS ;
$query .= ' from '.INS_ANNUAIRE.','.INS_TABLE_PAYS.','.INS_TABLE_DPT ;
$query .= ' where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID] ;
$query .= ' and '.INS_ANNUAIRE.'.'.INS_CHAMPS_PAYS.'='.INS_TABLE_PAYS.'.'.INS_CHAMPS_ID_PAYS ;
 
$result = $GLOBALS['ins_db']->query($query) ;
if (DB::isError($result)) {
echo $result->getMessage().'<br />'.$query ;
}
 
$row = $result->fetchRow(DB_FETCHMODE_ASSOC) ;
 
$res = '<h1>Edition d\'un adh&eacute;rent : '.$row[INS_CHAMPS_NOM].' '.$row[INS_CHAMPS_PRENOM].'</h1>'."\n" ;
$res .= "<div>".form("Nom : ", INS_CHAMPS_NOM, $row[INS_CHAMPS_NOM])."</div>\n" ;
$res .= "<div>".form("Pr&eacute;nom : ", INS_CHAMPS_PRENOM, $row[INS_CHAMPS_PRENOM])."</div>\n" ;
$res .= "<div>".form("Adresse mail : ", INS_CHAMPS_MAIL, $row[INS_CHAMPS_MAIL])."</div>\n" ;
$res .= "<div>".form("Date d'inscription : ", INS_CHAMPS_DATE, $row[INS_CHAMPS_DATE])."</div>\n" ;
$res .= "<div>".form("Adresse 1 : ", INS_CHAMPS_ADRESSE_1, $row[INS_CHAMPS_ADRESSE_1])."</div>\n" ;
$res .= "<div>".form("Adresse 2 : ", INS_CHAMPS_ADRESSE_2, $row[INS_CHAMPS_ADRESSE_2])."</div>\n" ;
$res .= "<div>".form("Région : ", "a_region", $row['a_region'])."</div>\n" ;
$res .= "<div>".form("Code postal : ", INS_CHAMPS_CODE_POSTAL, $row[INS_CHAMPS_CODE_POSTAL])."</div>\n" ;
$res .= "<div>".form("Ville : ", INS_CHAMPS_VILLE, $row[INS_CHAMPS_VILLE])."</div>\n" ;
$res .= "<div>".form("Pays : ", INS_CHAMPS_PAYS, $row[INS_CHAMPS_PAYS])."</div>\n" ;
$res .= "<div>".form("Site web personnel : ", INS_CHAMPS_SITE_INTERNET, $row[INS_CHAMPS_SITE_INTERNET])."</div>\n" ;
$res .= suppression($row[INS_CHAMPS_ID]) ;
$formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post',
preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()), '_self', '', 0) ;
$formulaire->construitFormulaire(preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()));
if (isset($_REQUEST['form_structure'])) {
if ($_REQUEST['form_structure']==1) {
$formulaire->formulaireStructure() ;
}
}
//pour la modification d'une inscription, on charge les valeurs par défauts
if (isset ($_REQUEST[INS_CHAMPS_ID]) == 'modifier') {
$formulaire->addElement('hidden', 'modifier_v', '1') ;
$formulaire->setDefaults(formulaire_defaults($_REQUEST[INS_CHAMPS_ID])) ;
}
if (isset ($_REQUEST['modifier_v'])) {
if ($formulaire->validate()) {
mise_a_jour($formulaire->getSubmitValues(), $_REQUEST[INS_CHAMPS_ID]);
} else {
return $res.$formulaire->toHTML();
}
return $res;
}
$res .= $formulaire->toHTML();
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'suppr_adh') {
$res .= suppression($_REQUEST[INS_CHAMPS_ID]) ;
return ;
}
return $res ;
}
 
 
// form construit soit un formulaire de type <input type="text" ...> et
// de nom $field_ et place un $label devant
// soit construit un lien vers un formulaire à partir du champs $field_
 
 
function form($label, $field_, $value)
{
global $u_id, $GS_GLOBAL, $field ;
 
$url = $GLOBALS['ins_url']->getURL() ;
 
if ($field != $field_) {
$res = "<b>$label</b>" ;
$res .= "<a href=\"$url&amp;field=$field_\">" ;
$res .= $value ? $value : "(vide)";
$res .= "</a>\n" ;
}
if ($field == $field_) {
$res = '<form action="'.$url.'&amp;'.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID].'&amp;action=up&amp;field_='.$field_.'" method="post">' ;
$res .= "<b>$label</b>\n" ;
switch ($field_) {
case INS_CHAMPS_PAYS :
$res .= select (INS_TABLE_PAYS, INS_CHAMPS_ID_PAYS, INS_CHAMPS_LABEL_PAYS, $value);
break ;
default :
$res .= '<input type="text" size="40" name="'.$field_.'" value="'.$value.'">'."\n" ;
}
$res .= '<input type="submit" value="valider">'."\n" ;
$res .= "</form>" ;
}
return $res ;
}
 
 
// upSQL met à jour la table annuaire_tela
 
function upSQL()
{
global $field_ ;
 
// Recherche de l'ancien mail
$req_am = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID] ;
$res_am = $GLOBALS['ins_db']->query ($req_am) ;
$ligne_am = $res_am->fetchRow(DB_FETCHMODE_ASSOC) ;
$ancien_mail = $ligne_am[INS_CHAMPS_MAIL] ;
if ($field_ == INS_CHAMPS_PAYS) {
$field_ = INS_CHAMPS_PAYS ;
$_REQUEST[$field_] = $_REQUEST[INS_TABLE_PAYS] ;
}
$query = 'update '.INS_ANNUAIRE.' set '.$field_.'="'.$_REQUEST[$field_].'" where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID] ;
$GLOBALS['ins_db']->query($query) ;
// Traitement du département
if ($field_ == INS_CHAMPS_CODE_POSTAL) {
if (preg_match("/^97|98[0-9]*/", $HTTP_POST_VARS[INS_CHAMPS_CODE_POSTAL])) {
$n_dpt = substr($HTTP_POST_VARS[INS_CHAMPS_CODE_POSTAL], 0, 3) ;
} else {
$n_dpt = substr($HTTP_POST_VARS[INS_CHAMPS_CODE_POSTAL], 0, 2) ;
}
$GLOBALS['ins_db']->query ('update '.INS_ANNUAIRE.' set '.INS_CHAMPS_DEPARTEMENT.'='.$n_dpt.' where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID]) ;
}
}
 
function suppression($u_id) {
 
$url = $GLOBALS['ins_url']->getURL() ;
 
$res = "<div>Supprimer l'inscription</div>\n" ;
$res .="<div><form action=\"$url&action=suppr_adh\" method=\"post\">\n" ;
$res .= "<input type=\"submit\" value=\"Supprimer\" " ;
$res .= "onclick=\"javascript:return confirm('&ecirc;tes-vous s&ucirc;r de vouloir supprimer cet adh&eacute;rent');\">\n" ;
$res .= "</form></div>\n" ;
 
if (isset ($_REQUEST['action']) && $_REQUEST['action'] =="suppr_adh") {
$queryLogin = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID] ;
$resultLogin = $GLOBALS['ins_db']->query($queryLogin) ;
$rowLogin = $resultLogin->fetchRow(DB_FETCHMODE_ASSOC) ;
$mail = $rowLogin[INS_CHAMPS_MAIL];
 
// suppression
$query = 'delete from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.'='.$_REQUEST[INS_CHAMPS_ID] ;
$GLOBALS['ins_db']->query($query);
// Appel des actions desinscriptions des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
$id_utilisateur = $_REQUEST[INS_CHAMPS_ID];
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;
}
$d->close();
}
return $res ;
}
 
function select ($table, $champs_id, $champs_label, $defaut = '') {
$requete = 'select * from '.$table.' where gip_id_i18n like "'.$GLOBALS['lang'].'%"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage().'<br />'.$requete ;
}
$res = '<select name="'.$table.'">' ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<option value="'.$ligne[$champs_id].'"' ;
if ($defaut != '' && $defaut == $ligne[$champs_id]) $res .= ' selected' ;
$res .= '>'.$ligne[$champs_label].'</option>' ;
}
$res .= '</select>' ;
return $res ;
}
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/cartographie.fonct.liste_inscrit.php
New file
0,0 → 1,210
<?
// +--------------------------------------------------------------------------------+
// | liste_inscrit.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2002 |
// +--------------------------------------------------------------------------------+
// | |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: cartographie.fonct.liste_inscrit.php,v 1.5 2007-04-11 08:30:12 neiluj Exp $
 
global $HTTP_USER_AGENT;
 
$classe_titre = 'titlePage' ;
 
$javascript = 'function confirmer ()
{
if (window.confirm (\'Cliquez sur OK pour confirmer.\')) {
window.formmail.submit();
}
}
function setCheckboxes(the_form)
{
var do_check=document.forms[the_form].elements[\'selecttotal\'].checked;
var elts = document.forms[the_form].elements[\'select[]\'];
var elts_cnt = (typeof(elts.length) != \'undefined\')
? elts.length
: 0;
if (elts_cnt) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = do_check;
} // Fin for
}
else {
elts.checked = do_check;
} // Fin if... else
return true;
}
 
';
 
GEN_stockerCodeScript($javascript);
$res = "";
$tabmonde = explode ('*',$monde->historique);
// Premier cas, on vient de cliquer sur un pays qui n'est pas
// la France, on affiche les adhérents de ce pays
if (count($tabmonde) == 3) {
$argument = $tabmonde[2];
$query = 'SELECT * FROM carto_PAYS WHERE CP_ID_pays="'.$argument.'"';
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage().'<br />'.$result->getDebugInfo()) ;
}
$row = $result->fetchRow(DB_FETCHMODE_OBJECT) ;
$pays = $row->CP_Intitule_pays;
$monde->nom = $monde->nom.'*'.$pays;
$tabonglet = explode ('*', $monde->historique);
$tabnom = explode ('*', $monde->nom);
$res .= "<b>\n";
foreach ($tabonglet as $key => $value) {
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
else if ($key == (count($tabonglet)-1)) {
$res .= "<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$pays</a>";
}
else {
$chemin .= '*'.$value;
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= "</b>\n";
$capitale = $row->CP_Intitule_capitale;
$query2 = " SELECT count(".INS_CHAMPS_ID.") as nbr".
" from ".INS_ANNUAIRE.
" where ".INS_CHAMPS_PAYS."='$argument'";
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT) ;
$res .= "<br /><br /><div class=\"$classe_titre\">$pays (capitale: $capitale) : " ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT.' '.INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr.' '.INS_INSCRIT.INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr.' '.INS_INSCRIT.'s '.INS_LABEL_PROJET ;
}
$res .= "</div>\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
}
else {
$requete = 'SELECT * FROM '.INS_ANNUAIRE.
' WHERE '.INS_CHAMPS_PAYS.'="'.$argument.'"'.
' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
if ($row2->nbr > 1) {
$res .= listes_inscrit($requete, $select, $url) ;
if ($mailer==1) {
if (!is_array($select)) {
$res .= "<div>".INS_NO_DESTINATAIRE."</div>";
}
else {
$res .= "<div class=\"$classe_titre\">".INS_MESSAGE_ENVOYE."</div>\n" ;
carto_envoie_mail() ;
}
}
else {
$res .= carto_texte_cocher() ;
}
$res .= carto_formulaire($titre_mail, $corps) ;
}
}
}
}
 
// 2 ème cas, on vient de cliquer sur un département français
 
else if (count($tabmonde) == 4) {
$numero_departement = $tabmonde[3];
$query = 'SELECT * FROM '.INS_TABLE_DPT.' WHERE '.INS_CHAMPS_ID_DEPARTEMENT.'='.$numero_departement;
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage() .'<br />'.$result->getDebugInfo());
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$nom = $row[INS_CHAMPS_NOM_DEPARTEMENT];
$tabonglet=explode ('*', $monde->historique);
$tabnom=explode ('*', $monde->nom);
$res.="<div><b>\n";
foreach ($tabonglet as $key=>$value) {
if ($key==0) {
$chemin=$value;
$value='monde';
$res.= "<a class=\"chemin_carto\" href=\"".
$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
else if ($key==(count($tabonglet)-1)) {
$res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
}
else {
$chemin.='*'.$value;
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= "</b></div>\n";
$query2 = ' SELECT count('.INS_CHAMPS_ID.') as nbr'.
' FROM '.INS_ANNUAIRE.
' WHERE '.INS_CHAMPS_CODE_POSTAL.' LIKE "'.$numero_departement.'%"'.
' AND '.INS_CHAMPS_PAYS.'="FR"';
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT);
$res .= "<br /><br /><div class=\"$classe_titre\">" ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT." ".INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr." ".INS_INSCRIT." ".INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr." ".INS_INSCRIT."s ".INS_LABEL_PROJET ;
}
$res .= "</div><br />\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
} else {
$requete = 'SELECT * FROM '.INS_ANNUAIRE.
' WHERE '.INS_CHAMPS_CODE_POSTAL.' LIKE "'.$argument.'%"'.
' AND '.INS_CHAMPS_PAYS.'="FR"';
' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
$res .= listes_inscrit($requete, $select, $_SERVER['REQUEST_URI']) ;
if ($mailer==1) {
if (!is_array($select)) {
$res.= INS_NO_DESTINATAIRE;
} else {
$res .= "<div class=\"$classe_titre\">".INS_MESSAGE_ENVOYE."</div>\n" ;
carto_envoie_mail() ;
}
} else {
$res .=carto_texte_cocher() ;
}
$res .= carto_formulaire() ;
}
}
}
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/mail_tous.php
New file
0,0 → 1,105
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: mail_tous.php,v 1.2 2006-01-02 09:51:03 alexandre_tb Exp $
/**
* Permet d'envoie un mail à une sélection dans l'annuaire
*
*
*@package annuaire
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
function putFrame() {
// configuration
global $objet, $corps, $annuaire_LABEL_STATUT, $SERVER_ADMIN ;
global $action ;
$url = $GLOBALS['ins_url']->getURL() ;
 
// Entete
$corps_debut = "RESEAU TELA BOTANICA - Le ".date("j/m/Y").
"\n\nBonjour,\n"."\n\nCordialement,\n-------------------\n".
"Tela Botanica le réseau des botanistes francophones\n".
"accueil@tela-botanica.org\nhttp://www.tela-botanica.org\n";
 
$res = "<h1>Envoi d'un mail &agrave; tous les membres</h1>\n" ;
 
if ($_GET['action'] == ANN_MAIL_TOUS_ENVOIE) $res .= envoie_mail_selection() ;
 
// formulaire
$res .= "<div><form action=\"$url&action=".ANN_MAIL_TOUS_ENVOIE."\" method=\"post\"><table>\n" ;
$res .= "<tr><td>" ;
$res .= "Objet&nbsp;:&nbsp;</td><td><input size=\"91\" name=\"objet\" type=\"text\"></td></tr>\n" ;
$res .= '<tr><td>Corps&nbsp;:&nbsp;</td><td><textarea name="corps" cols="90" rows="30">'.
$corps_debut.'</textarea></td></tr>'."\n" ;
$res .= "<tr><td></td><td><input type=\"submit\" value=\"envoyer\"" ;
$res .= " onclick=\"javascript:return confirm('Etes-vous sur de vouloir envoyer ce message !!');\"" ;
$res .= "></td></tr>\n" ;
$res .= "</table></form></div>\n" ;
 
return $res ;
}
 
include_once ("Mail.php");
 
// envoie le mail à tous
 
 
function envoie_mail_selection()
{
 
$headers['From'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
$headers['Subject'] = stripslashes($_REQUEST['objet']) ;
 
$corps = stripslashes($_REQUEST['corps']) ;
$requete = $_SESSION['requete_mail_tous'] ;
unset ($_SESSION['requete_mail_tous']) ;
 
$resultat = $GLOBALS['ins_db']->query($requete) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
if (!mail($ligne[INS_CHAMPS_MAIL], $headers['Subject'], $corps, "From: ".$headers['From'])) {
return "<div>Une erreur s'est produite:<br>".$mail_object->getMessage()."</div>\n" ;
}
}
return "<div>Le mail est parti !</div>\n";
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/recu_pdf_corps.php
New file
0,0 → 1,166
<?php
// +----------------------------------------------------------------------------+
// |pdf_recu_et_mail.php |
// +----------------------------------------------------------------------------+
// | Copyright (c) 2003 Tela Botanica |
// +----------------------------------------------------------------------------+
// | Ce fichier génère un fichier PDF |
// | contenant le recu pour une cotisation à Tela Botanica |
// | Il utilise la librairie FPDF |
// | http://www.fpdf.org/ |
// | Il envoie également un email à l'adhérent concerné |
// +----------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +----------------------------------------------------------------------------+
//
// $Id: recu_pdf_corps.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
 
 
// Recherche des informations sur un utilisateur
 
$requete = "select * from annuaire_COTISATION, annuaire_tela, MODE_COTISATION
where IC_ID=$cotisation_id
and IC_ANNU_ID=U_ID
and IC_MC_ID=MC_ID" ;
$resultat = $db->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$resultat->free() ;
 
/*
// On regarde si le reçu a déjà été envoyé
$requete = "select IC_RECU from annuaire_COTISATION where IC_ID=$cotisation_id" ;
$resultat = mysql_query ($requete) or die ($requete."<br>".mysql_error()) ;
$ligne = mysql_fetch_object($resultat) ;
mysql_free_result($resultat) ;
*/
 
if ($ligne->IC_RECU != 0) {
$num_recu = $ligne->IC_RECU ;
// $deja_envoye permettra au programme admin_annu.php de ne pas incrementé
// le compteur de recu
$deja_envoye = true ;
} else {
$res_compteur = $db->query("select COMPTEUR from COMPTEUR_COTISATION") ;
$ligne_compteur = $res_compteur->fetchRow(DB_FETCHMODE_OBJECT) ;
$num_recu = $ligne_compteur->COMPTEUR ;
$deja_envoye = false ;
}
 
@include_once "api/fpdf/fpdf.php";
 
if (!isset($envoie)) $chemin = "client/annuaire/" ;
 
// Constante nécessaire à fpdf.php
define('FPDF_FONTPATH','font/');
 
// Création de l'objet pdf
 
$pdf = new FPDF();
 
$pdf->Open();
$pdf->AddPage("P");
// La ligne du haut
 
$pdf->Line(10, 10, 200, 10) ;
 
// Contenu du document
 
$pdf->SetFont('Arial', '', 8) ;
 
$pdf->Cell(150, 10, "", 0, 0) ;
 
$pdf->MultiCell(40, 10, "Numéro d'ordre : $num_recu", 1,1, "C") ;
 
$pdf->SetY($pdf->GetY() - 10) ;
 
$pdf->SetFont('Arial','B',14);
$pdf->Cell(0,10,'Reçu dons aux œuvres', 0, 1, "C");
$pdf->SetFont('Arial', '', 10) ;
$pdf->Cell(0, 0, '(Article 200-5 et 238 bis du Code Général des impôts)', 0, 1, "C") ;
 
$pdf->Cell(0, 10, 'REÇU A CONSERVER ET A JOINDRE A VOTRE DECLARATION DE REVENUS 2004', 0, 1, "L") ;
 
// On met le logo de Tela
$pdf->Image($chemin."logotb.png", 12, 35, "29", "", "PNG", "http://www.tela-botanica.org/") ;
 
 
 
// On écrie Les titres du cadre
 
$pdf->SetFontSize(12) ;
$pdf->Cell(100, 10, 'Bénéficiaire du don', 0, 0, "C") ;
$pdf->Cell(100, 10, 'Donateur', 0, 1, "C") ;
 
$pdf->SetFont('Arial', 'B', 10) ;
 
$pdf->Cell(38, 5, '', 0, 0) ;
$pdf->Cell(62, 5, 'Association Tela Botanica', 0, 0, "L") ;
 
$pdf->SetFont('Arial', 'B', 10) ;
 
$pdf->Cell(100, 5, "$ligne->U_NAME $ligne->U_SURNAME", 0, 1, "L") ;
 
$pdf->SetFont('Arial', '', 10) ;
 
$pdf->Cell(38, 5, '', 0, 0) ;
$pdf->Cell(62, 5, 'Institut de Botanique', 0, 1, "L") ;
$pdf->Cell(38, 5, '', 0, 0) ;
$pdf->Cell(62, 5, '163, rue A. Broussonnet', 0, 0, "L") ;
$pdf->Cell(100, 5, "$ligne->U_ADDR1", 0, 1, "L") ;
 
$pdf->Cell(38, 5, '', 0, 0) ;
$pdf->Cell(62, 5, '34090 Montpellier', 0, 0, "L") ;
$pdf->Cell(100, 8, "$ligne->U_ADDR2", 0, 1, "L") ;
 
 
$pdf->Cell(100, 5, 'Objet :', 0,1, "L") ;
$pdf->SetFontSize(8) ;
$pdf->MultiCell(100, 4, 'Contribuer au rapprochement de tous les botanistes de langue française. Favoriser l\'échange d\'information'.
' et animer des projets botaniques grâce aux nouvelles technologies de la communication.', 0, 1, "") ;
 
$pdf->SetFontSize(10) ;
 
$pdf->Text(111, 58 + 8, "$ligne->U_ZIP_CODE $ligne->U_CITY") ;
$pdf->SetFontSize(8) ;
$pdf->MultiCell(100,4, 'Organisme d\'intérêt général à caractère scientifique concourant à la diffusion de la langue et des connaissances scientifiques françaises.', 0,1, "R") ;
 
 
 
// On remonte le curseur de 52
$pdf->SetY($pdf->GetY() - 58) ;
 
// Le cadre central
$pdf->Cell(100, 60, '', 1) ;
$pdf->Cell(90, 60, '', 1) ;
$pdf->Ln() ;
 
$pdf->SetFontSize(10) ;
$pdf->Cell(0,10, 'L\'Association reconnaît avoir reçu, à titre de don, la somme de :', 0, 1, "L") ;
 
$pdf->SetFont('Arial', 'B', 11) ;
$pdf->Cell(0,10, "*** $ligne->IC_MONTANT euros ***", 0, 1, "C") ;
 
$pdf->SetFont('Arial', '', 10) ;
 
$pdf->Ln() ;
$pdf->Cell(100,10, "Date du paiement : ".date ("d/m/Y", $ligne->IC_DATE), 0, 0, "L") ;
$pdf->Cell(100, 10, 'Montpellier, le '.date("d/m/Y"), 0, 1, "L") ;
 
// La signature de Daniel
$pdf->Image($chemin."signature_Daniel.png", 110, $pdf->GetY(),28.22, "") ;
 
$pdf->Ln() ;
$pdf->Cell(0, 10, "Mode de versement : $ligne->MC_LABEL", 0, 1, "L") ;
 
$pdf->Cell(100, 10, '', 0, 0) ;
$pdf->Cell (100, 10, 'Daniel MATHIEU, Président', 0, 1, "L") ;
$pdf->Ln(5) ;
 
$pdf->SetFontSize(10) ;
$pdf->Cell(0, 7, '60 % de votre don à Tela Botanica est déductible de vos impôts dans la limite de 20 % de votre revenu imposable.', 1, 1, "C") ;
 
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/fonctions.php
New file
0,0 → 1,267
<?php
// +--------------------------------------------------------------------------------+
// | fonctions.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2002 Tela Botanica |
// +--------------------------------------------------------------------------------+
// | Fonctions diverses |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: fonctions.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
 
// effectue une requete sur un colonne unique et renvoie le resultat sous la forme
// d'un tableau
 
function get($query) {
$tableau = array() ;
$query = "SELECT " . $query;
$result = mysql_query($query) or die ("Echec de la requ&ecirc;te sur AGORA");
while ($row = mysql_fetch_row($result)) {
array_push ($tableau,$row[0]);
}
 
return $tableau ;
}
 
function textecourt($texte, $taille) {
if (strlen($texte) > $taille) return substr($texte, 0, $taille-3)."...";
return $texte;
}
 
// formulaire, prend en parametre les valeurs par defaut
function formulaire($titre="",$description="", $abreviation="", $internet="", $selectedForums="", $selectedProjet="",$origine="NOUVEAU") {
global $baseURL, $forums, $projets, $projetAb ;
$forums = get("AGO_A_ALIAS FROM agora") ;
$IDforums = get ("AGO_A_ID FROM agora");
$projets = get("TITRE FROM PROJET_PROJET ORDER BY ABREVIATION");
$projetAb = get("ABREVIATION FROM PROJET_PROJET ORDER BY ABREVIATION") ;
if ($selectedForums == "") $selectedForums = array() ;
if ($selectedProjet == "") $selectedProjet = array() ;
$res ="<table>\n";
if ($origine == "NOUVEAU") {
$res .="<form action=\"$baseURL&menuProjet=projetadm&action=2\" method=\"post\">\n";
} else {
$res .="<form action=\"$baseURL&menuProjet=projetgest&projet=$abreviation&action=2\" method=\"post\">\n";
}
$res .="<tr class=\"text\"><td style=\"text-align:right;font-weight:bold;\">Titre :</td><td><input type=\"text\"
class=\"insInputForm\" name=\"titre\" size=\"60\" value=\"$titre\"></td></tr>\n";
$res .="<tr class=\"text\"><td valign=\"top\" style=\"text-align:right;font-weight:bold;\">Description :</td><td><textarea name=\"description\"
class=\"insInputForm\" cols=\"60\" rows=\"20\">$description</textarea></td></tr>\n";
if ($origine == "NOUVEAU") {
$res .="<tr class=\"text\"><td style=\"text-align:right;font-weight:bold;\">Abr&eacute;viation :</td>\n";
$res .="<td><input class=\"insInputForm\" type=\"text\" name=\"abreviation\" size=\"5\" value=\"$abreviation\">&nbsp;&nbsp;";
$res .="&nbsp;&nbsp;Au maximum 5 caract&egrave;res, de pr&eacute;f&eacute;rence en majuscule.</td></tr>\n";
}
$res .="<tr class=\"text\"><td style=\"text-align:right;font-weight:bold;\">Espace Internet :</td>\n";
$res .="<td><input class=\"insInputForm\" type=\"text\" name=\"internet\" size=\"60\" value=\"$internet\"></td></tr>\n";
$res .="<tr class=\"text\"><td valign=\"top\" style=\"text-align:right;font-weight:bold;\">Forums associ&eacute;s :</td><td><select class=\"insInputForm\" name=forumsS[] size=\"";
$res .=count($forums);
$res .="\" multiple>\n";
for ($i = 0 ; $i < count($forums) ; $i++) {
$res .="<option value=\"$IDforums[$i]\"";
if (in_array($forums[$i],$selectedForums)) $res .=" selected";
$res .=">";
$res .=$forums[$i];
$res .="</option>\n";
}
$res .="</select>\n";
$res .="<tr class=\"text\"><td valign=\"top\" style=\"text-align:right;font-weight:bold;\">Projets associ&eacute;s :</td>\n<td><select class=\"insInputForm\" name=projetsS[] size=\"";
$res .=count($projets);
$res .="\" multiple>\n";
for ($i = 0 ; $i < count($projets) ; $i++) {
$res .="<option value=\"";
$res .=$projetAb[$i];
$res .="\"";
if (in_array($projetAb[$i],$selectedProjet)) $res .=" selected";
$res .=">";
$res .=$projets[$i];
$res .="</option>\n";
}
$res .="</select></td></tr>\n";
$res .="<tr><td colspan=\"2\" align=\"center\">\n";
if ($origine != "NOUVEAU") $res .="<input style=\"background-color:#FFFFFF\" type=\"button\" onclick=\"Javascript:history.go(-1);\" value=\"Annuler\">\n" ;
$res .="<input style=\"background-color:#FFFFFF\" type=\"submit\"";
if ($origine == "NOUVEAU") {
$res .=" value=\"Cr&eacute;er\">";
} else { $res .=" value=\"Valider\">";
}
$res .="</td></tr>\n";
$res .="</form>\n";
$res .="</table>\n";
return $res ;
}
 
function getExtension($filename) {
$extension = explode (".",$filename) ;
return $extension[1] ;
}
 
#--------------------------------------------------------------
# Insere $num espace insecable
#--------------------------------------------------------------
 
function insert_spaces($num) {
$res = "" ;
for ($i = 0; $i < $num; $i++) $res .= "&nbsp;";
return $res ;
}
 
function getEnumSet($text) {
$resultat = explode("'", $text) ;
$retour = array() ; $j = 0 ;
for ($i = 1 ; $i < count ($resultat)-1 ; $i = $i + 2) {
$retour[$j] = $resultat[$i] ;
$j++ ;
}
return $retour ;
}
 
$jour = array("lundi","mardi", "mercredi", "jeudi", "vendredi", "samedi","dimanche");
$moi = array("janvier","f&eacute;vrier","mars","avril","mai","juin","juillet","septembre","octobre","novembre","d&eacute;cembre") ;
 
function parcourrirAnnu($event) {
global $baseURL, $lettre, $menuProjet ;
$outputText = "" ;
$outputText .= "<tr><td>&nbsp;</td></tr>\n";
$outputText .= "<tr><td><table align=\"center\">";
$outputText .= "<tr class=\"texte_tb\">";
// ecrire toutes les lettres avec un lien
for ($i = 65 ; $i <91 ; $i++) {
$outputText .= "\t<td><a style=\"font-size:15px;\" href=\"$baseURL&amp;menuProjet=$menuProjet&amp;action=$event&amp;lettre=";
$outputText .= chr($i) ;
$outputText .= "\">";
$outputText .= chr($i) ;
$outputText .= "</a></td>\n";
}
$outputText .= "<td>&nbsp;&nbsp;<a href=\"$baseURL&amp;menuProjet=$menuProjet&amp;action=$event&amp;lettre=tous\">Tous</a></td>\n" ;
$outputText .= "</tr></table></td></tr>\n";
// si une lettre est selectionne
if (!empty($lettre)) {
$query = "SELECT annuaire_tela.U_NAME,annuaire_tela.U_SURNAME,annuaire_tela.U_MAIL,annuaire_tela.U_CITY,
annuaire_tela.U_ZIP_CODE,gen_COUNTRY.GC_NAME FROM annuaire_tela,gen_COUNTRY WHERE";
if ($lettre != "tous") $query .= " U_NAME LIKE \"$lettre%\" AND" ;
$query .= " annuaire_tela.U_COUNTRY=gen_COUNTRY.GC_ID AND gen_COUNTRY.GC_LOCALE=\"fr\"
AND U_NAME<>\"\" and U_SHOW=3 ORDER BY U_NAME" ;
$result = mysql_query($query) or die ("Echec de la requ&ecirc;te sur annuaire_tela...");
if (mysql_num_rows($result) != 0) {
// pour chaque nom, on inscrit les infos
$outputText .= "<tr><td>&nbsp;</td></tr>\n";
$outputText .= "<tr class=\"insTitle1\"><td>Liste des inscrits &agrave; la lettre : $lettre</td></tr>\n";
$outputText .= "<tr><td><table width=\"100%\">";
$outputText .= "<tr class=\"insTitle1\"><td>Nom</td>";
$outputText .= "<td>Pr&eacute;nom</td><td align=\"center\">E-mail</td>\n";
$outputText .= "<td align=\"center\">Code postal</td><td>Pays</td></tr>\n";
$pair = true ;
while ($row = mysql_fetch_object($result)) {
$outputText .= "<tr class=\"texte_tb2\"";
if ($pair) {
$outputText .= " bgcolor=\"#E8FFE5\"";
$pair = false ;
} else {
$pair = true ;
}
$outputText .= "><td>$row->U_NAME</td><td>$row->U_SURNAME</td>\n";
$outputText .= "<td align=\"left\"><a href=\"mailto:$row->U_MAIL\">$row->U_MAIL</a></td>\n";
$outputText .= "<td align=\"center\">$row->U_ZIP_CODE</td>\n";
$outputText .= "<td>$row->GC_NAME</td>\n" ;
$outputText .= "</tr>\n";
}
$outputText .= "</table></td></tr>\n";
} else {
$outputText .= "<tr><td>&nbsp;</td></tr>\n";
$outputText .= "<tr class=\"texte_tb\"><td>Pas d'inscrit</td></tr>\n";
}
}
return $outputText ;
}
function formRep($nom="", $description="", $origine="NOUVEAU", $visibilite="") {
global $baseURL, $projet, $repcourant, $id ;
if ($origine == "NOUVEAU") {
$res = "<form action=$baseURL&action=20\" method=\"post\">\n" ;
} else {
$res = "<form action=$baseURL&action=19\" method=\"post\"\n>" ;
}
$res .= "\t<table align=\"center\">\n\t" ;
$res .= "<tr class=\"texte_tb\"><td colspan=\"2\">N'utilisez pas d'accents, ni d'espace pour le nom du r&eacute;pertoire.</td></tr>\n";
$res .= "<tr class=\"text\"><td style=\"font-weight:bold;text-align:right\">" ;
$res .= "Nom : </td><td><input class=\"insInputForm\" type=\"text\" name=\"nom\" size=\"80\" value=\"$nom\"></td></tr>\n" ;
$res .= "<tr class=\"text\"><td style=\"font-weight:bold;text-align:right;vertical-align:top\">Description : </td>\n" ;
$res .= "<td><textarea class=\"insInputForm\" name=\"description\" cols=\"81\">$description</textarea></td></tr>\n" ;
$res .= "<tr class=\"text\"><td align=\"right\"><b>Visibilit&eacute; :</b></td>\n";
$res .= "<td align=\"left\">\n";
$res .= "<input style=\"background-color:#FFFFFF;\" type=\"radio\" name=\"visible\" value=\"public\"" ;
if ($visibilite == "public" or $visibilite == "") $res .= " checked" ;
$res .= ">Tout public&nbsp;&nbsp;&nbsp;&nbsp;";
$res .= "<input style=\"background-color:#FFFFFF;\" type=\"radio\" name=\"visible\" value=\"prive\"" ;
if ($visibilite == "prive") $res.= " checked" ;
$res .= ">Projet seulement</td></tr>\n";
$res .= "<tr class=\"text\"><td><input type=\"hidden\" name=\"repcourant\" value=\"$repcourant\"</td><td>\n" ;
$res .= "<input type=\"hidden\" name=\"id\" value=\"$id\">" ;
$res .= "<input type=\"submit\" style=\"background-color:#FFFFFF;\"" ;
if ($origine == "NOUVEAU") { $res.= "value=\"Valider\"" ; } else { $res .= "value=\"Modifier\"" ; }
$res .= "></td></tr></table></form>\n" ;
return $res ;
}
 
// renvoie le chemin complet depuis la racine de l'application
// on indique en argument l'identifiant du repertoire en cour
// la fonction remonte d'etage en etage jusqu'a ce que gen_voiraussi.PERE soit NULL
function getPath($ID_rep) {
$path = "" ;
$query = "SELECT PERE,NOM FROM gen_repertoire WHERE ID='$ID_rep'" ;
$result = mysql_query($query) or die ("Echec de la requ&ecirc;te dans gen_voiraussi, au cours de la recherche
du chemin des repertoire") ;
$row = mysql_fetch_object($result) ;
if ($row->PERE != NULL) {
$path .= getPath($row->PERE)."/".$row->NOM ;
}
return $path ;
}
 
 
// renvoie le chemin avec les tag <a href
 
function getHTMLPath($ID_rep) {
global $baseURL ;
$query = "SELECT PERE,NOM FROM gen_repertoire WHERE ID='$ID_rep'" ;
$result = mysql_query($query) or die ("Echec de la requ&ecirc;te dans gen_voiraussi, au cours de la recherche
du chemin des repertoire") ;
$row = mysql_fetch_object($result) ;
if ($row->PERE != NULL) {
$path .= " <b>&gt;</b><a href=\"$baseURL&amp;repcourant=$ID_rep\">" ;
$path .= $row->NOM ;
$path .= "</a>\n" ;
$path = getHTMLPath($row->PERE).$path ;
}
return $path ;
}
 
function nettoieAccent(&$texte) {
 
// un peu barbare
$texte = ereg_replace("é","e",$texte) ;
$texte = ereg_replace("è","e",$texte) ;
$texte = ereg_replace("ê","e",$texte) ;
$texte = ereg_replace("à","a",$texte) ;
$texte = ereg_replace("ù","u",$texte) ;
$texte = ereg_replace("â","a",$texte) ;
$texte = ereg_replace("ä","a",$texte) ;
$texte = ereg_replace("ë","e",$texte) ;
$texte = ereg_replace("î","i",$texte) ;
$texte = ereg_replace("ô","o",$texte) ;
$texte = ereg_replace("û","u",$texte) ;
$texte = ereg_replace("ö","o",$texte) ;
$texte = ereg_replace("ü","u",$texte) ;
 
return $texte ;
}
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/bottin.class.php
New file
0,0 → 1,89
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Fichier des fonctions du bottin
*
*@package bottin
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org.org>
//Autres auteurs :
*@copyright Outils-reseaux 2006-2040
*@version 05 avril 2006
// +-----------------------------------------------------------------------------------------------+
//
// $Id: bottin.class.php,v 1.1 2006-12-13 13:26:52 alexandre_tb Exp $
// FICHIER : $RCSfile: bottin.class.php,v $
// AUTEUR : $Author: alexandre_tb $
// VERSION : $Revision: 1.1 $
// DATE : $Date: 2006-12-13 13:26:52 $
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'PEAR.php';
 
 
class lettresAlphabet extends PEAR {
var $url;
var $variable_lettre ;
/**
* Constructeur
*
* @param Net_URL un objet Net_URL
* @param string $variable_lettre le nom de la variable $_GET qui sera place dans l URL
* @return void
* @access public
*/
function lettresAlphabet($url, $variable_lettre = 'lettre') {
$this->url = $url ;
$this->variable_lettre = $variable_lettre ;
}
/**
* Renvoie le code HTML d une liste avec les lettres
*
* @return string HTML
* @access public
*/
function toHMTL() {
$res = '<ul class="liste_lettre">'."\n" ;
for ($i = 65 ; $i <91 ; $i++) {
$this->url->addQueryString($this->variable_lettre, chr($i)) ;
$res .= "\t".'<li class="liste_lettre"><a class="lien_alphabet" '.
'href="'.
$this->url->getURL().'">';
$res .= chr($i) ;
$res .= '</a></li>'."\n";
}
$res .= '</ul>';
return $res ;
}
}
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/inscription.class.php
New file
0,0 → 1,247
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.class.php,v 1.19 2007-04-20 08:40:22 alexandre_tb Exp $
/**
* Inscription
*
* Un module d'inscription, en général ce code est spécifique à
* un site web
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.19 $ $Date: 2007-04-20 08:40:22 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
 
class ListeDePays extends PEAR{
 
var $_db ;
/** Constructeur
* Vérifie l'existance de la table gen_pays_traduction
*
* @param DB Un objet PEAR::DB
* @return
*/
function ListeDePays(&$objetDB) {
$this->_db = $objetDB ;
$requete = 'SHOW TABLES';
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
while ($ligne = $resultat->fetchRow()) {
if ($ligne[0] == INS_TABLE_PAYS) {
return ;
}
}
return $this->raiseError('La table gen_i18n_pays n\'est pas présente dans la base de donnée !') ;
}
/** Renvoie la liste des pays traduite
*
* @param string une chaine de type i18n ou une chaine code iso langue (fr_FR ou fr ou FR)
* @return un tableau contenant en clé, le code iso du pays, en majuscule et en valeur le nom du pays traduit
*/
function getListePays($i18n) {
if (strlen($i18n) == 2) {
$i18n = strtolower($i18n)."-".strtoupper($i18n) ;
}
$requete = 'select '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' from '.INS_TABLE_PAYS
.' where '.INS_CHAMPS_I18N_PAYS.'="'.$i18n.'"';
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() == 0) {
return $this->raiseError('Le code fourni ne correspond à aucun pays ou n\'est pas dans la table!') ;
}
$retour = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$retour[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
}
return $retour ;
}
/** Renvoie le nom d'un pays traduit dans la langue passé en paramètre
*
* @param string une chaine de type i18n ou une chaine code iso langue (fr_FR ou fr ou FR)
* @return un tableau contenant en clé, le code iso du pays, en majuscule et en valeur le nom du pays traduit
*/
function getNomPays($codeIso, $i18n = INS_LANGUE_DEFAUT) {
if (strlen($i18n) == 2) {
$i18n = strtolower($i18n)."-".strtoupper($i18n) ;
}
$requete = 'select '.INS_CHAMPS_LABEL_PAYS.' from '.INS_TABLE_PAYS.
' where '.INS_CHAMPS_I18N_PAYS.'="'.$i18n.'" and '.
INS_CHAMPS_ID_PAYS.'="'.$codeIso.'"';
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() == 0) {
return $this->raiseError('Le code fourni ne correspond à aucun pays ou n\'est pas dans la table!') ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
return $ligne[INS_CHAMPS_LABEL_PAYS] ;
}
}
 
class HTML_formulaireInscription extends HTML_Quickform {
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire
* @param string method Méthode post ou get
* @param string action L'action du formulaire.
* @param int target La cible.
* @param Array attributes Les attributs HTML en plus.
* @param bool trackSubmit ??
* @return void
* @access public
*/
function HTML_formulaireInscription( $formName, $method = "post", $action, $target = "_self", $attributes, $trackSubmit = false ) {
HTML_Quickform::HTML_Quickform($formName, $method, $action, $target, $attributes, $trackSubmit) ;
}
/**
*
*
* @return void
* @access public
*/
function construitFormulaire($url)
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".
'<td style="font-size:12px;width:140px;text-align:right;">'."\n".'{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
' :</td>'."\n".
'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".
'</tr>'."\n");
$squelette->setElementTemplate( '<tr><td colspan="2" style="font-size:12px;text-align:left;">{label}{element}</td></tr>'."\n", 'lettre');
$squelette->setElementTemplate( '<tr><td colspan="2" style="font-size:12px;text-align:left;">{label}{element}</td></tr>'."\n", 'visible');
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton" id="bouton_annuler">{label}{element}</td></tr>'."\n", 'groupe_bouton');
$squelette->setGroupTemplate('<tr><td colspan="2">{content}</td></tr>'."\n", 'groupe_bouton');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$this->setRequiredNote(INS_CHAMPS_REQUIS) ;
$this->setJsWarnings(INS_ERREUR_SAISIE,INS_VEUILLEZ_CORRIGER);
$debut = '<h2>'.INS_AJOUT_MEMBRE.'</h2>'."\n";
$this->addElement('html', $debut);
$this->addElement('text', 'email', INS_EMAIL) ;
$this->addRule('email', INS_EMAIL_REQUIS, 'required','', 'client') ;
$this->addRule('email', INS_MAIL_INCORRECT, 'email', '', 'client') ;
$this->addElement('password', 'mot_de_passe', INS_MOT_DE_PASSE, array('size' => '10')) ;
$this->addElement('password', 'mot_de_passe_repete', INS_REPETE_MOT_DE_PASSE, array('size' => '10')) ;
$this->addRule('mot_de_passe', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ;
$this->addRule('mot_de_passe_repete', INS_MOT_DE_PASSE_REQUIS, 'required', '', 'client') ;
$this->addRule(array ('mot_de_passe', 'mot_de_passe_repete'), INS_MOTS_DE_PASSE_DIFFERENTS, 'compare', '', 'client') ;
$this->addElement('text', 'nom', INS_NOM) ;
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ;
$this->addElement('text', 'prenom', INS_PRENOM) ;
$this->addRule('prenom', INS_PRENOM_REQUIS, 'required', '', 'client') ;
$this->addElement('text', 'adresse_1', INS_ADRESSE_1) ;
$this->addElement('text', 'adresse_2', INS_ADRESSE_2) ;
$this->addElement('text', 'cp', INS_CODE_POSTAL) ;
$this->addRule('cp', INS_CODE_POSTAL_REQUIS, 'required', '', 'client') ;
$this->addElement('text', 'ville', INS_VILLE) ;
// L'élément pays est construit à partir du tableau liste_pays
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
$this->addElement('select', 'pays', INS_PAYS, $liste_pays->getListePays(INS_LANGUE_DEFAUT)) ;
$this->addElement('text', 'telephone', INS_TELEPHONE, array('size' => '12')) ;
$this->addElement('text', 'fax', INS_FAX, array('size' => '12')) ;
$this->addElement('text', 'site', INS_SITE_INTERNET) ;
$this->addElement('file', 'image', INS_LOGO_OU_IMAGE) ;
$this->setMaxFileSize(150000); //logo de 15ko maximum
if (INS_CHAMPS_LETTRE != '') $this->addElement('checkbox', 'lettre',INS_LETTRE, '<br />') ;
$this->addElement('checkbox', 'visible',INS_VISIBLE, '<br />') ;
$this->addElement('hidden', 'est_structure', 0) ;
$defauts=array ('lettre'=>1,'pays'=>'FR');
$this->setDefaults($defauts);
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$boutons[] = &HTML_QuickForm::createElement('button', 'annuler', INS_ANNULER, array ("onclick" => "javascript:document.location.href='".$url."'",
'id' => 'annuler', 'class' => 'bouton'));
$boutons[] = &HTML_QuickForm::createElement('submit', 'valider', INS_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
$this->addGroup($boutons, 'groupe_bouton', '', "\n");
} // end of member function construitFormulaire
/** Modifie le formulaire pour l'adapter au cas des structures
*
*
* @return void
* @access public
*/
function formulaireStructure()
{
$this->removeElement('nom', false) ;
$this->removeElement('prenom') ;
$this->removeElement('email', false) ;
$mail = & HTML_QuickForm::createElement('text', 'email', INS_MAIL_STRUCTURE) ;
$this->insertElementBefore($mail, 'mot_de_passe') ;
$nom_structure = & HTML_QuickForm::createElement('text', 'nom', INS_NOM_STRUCTURE) ;
$this->insertElementBefore($nom_structure, 'email') ;
$this->addRule('nom', INS_NOM_REQUIS, 'required', '', 'client') ;
$sigle_structure = & HTML_QuickForm::createElement('text', 'sigle_structure', INS_SIGLE_DE_LA_STRUCTURE) ;
$this->insertElementBefore($sigle_structure, 'email') ;
$this->addRule('sigle_structure', INS_SIGLE_REQUIS, 'required', '', 'client') ;
$num_agrement = & HTML_QuickForm::createElement('text', 'num_agrement', INS_NUM_AGREMENT) ;
$this->insertElementBefore($num_agrement, 'email') ;
$this->removeElement('site', false) ;
$site_structure = & HTML_QuickForm::createElement('text', 'site', INS_SITE_STRUCTURE) ;
$this->insertElementBefore($site_structure, 'lettre') ;
$this->removeElement('est_structure', false) ;
$this->addElement('hidden', 'est_structure', 1) ;
$this->addElement('hidden', 'form_structure', 1) ;
}
/**
*
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
}
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/annuaire_backoffice.fonct.php
New file
0,0 → 1,374
<?php
 
// +--------------------------------------------------------------------------------+
// | annuaire_moteur_fonction.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2000 - 2003 Tela Botanica |
// +--------------------------------------------------------------------------------+
// | Les fonctions de annuaire_moteur.php |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: annuaire_backoffice.fonct.php,v 1.10 2007-04-11 08:30:12 neiluj Exp $
 
 
/** function mkengine ()
*
*
*
* @return
*/
 
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php' ;
include_once PAP_CHEMIN_API_PEAR.'HTML/Table.php';
 
function mkengine()
{
global $nbr_total;
global $bouton, $HTTP_POST_VARS ;
$requete = mkquery() ;
$ret = '<div>'. $requete .'</div>';
// Deux requetes, une avec tous les resultats, l'autre avec les résultats affichés
 
$result_final = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($result_final)) {
echo $result_final->getMessage().'<br />'.$requete ;
}
$nbr_final = $result_final->numRows() ;
$_SESSION['requete_mail_tous'] = $requete ;
$donnees = array();
while ($ligne = $result_final->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees[] = $ligne ;
}
if (!isset($_REQUEST['setPerPage'])) $_REQUEST['setPerPage'] = 50 ;
$param_pager = array (
'mode' => 'Jumping',
'delta' => 5,
'itemData' => $donnees
) ;
$pager = & Pager::factory($param_pager);
$mes_vars = array ("recherche", "nom", "ville", "mail" ,"dept", "prenom", "cotisant", "pays", "sort", "T_REPONSE", "lettre","statut") ;
// Deux cas , soit on a cliqué sur rechercher, soit on a cliqué sur un lien
foreach ($mes_vars as $key=>$value) {
if (!$bouton) { // on a cliqué sur un lien
if (empty($HTTP_POST_VARS[$value])) {
}
} else {
// Si on clique sur le bouton rechercher
if (empty ($HTTP_POST_VARS[$value])) {
$$value = "" ;
} else {
$$value = $HTTP_POST_VARS[$value] ;
}
}
}
// Comptage du nombre total de données dans la table (hors CACHER = 1)
$requete_nbre_inscrit = "select count(*) as CPT from ".INS_ANNUAIRE;
$resultat_nbre_inscrit = $GLOBALS['ins_db']->query($requete_nbre_inscrit) ;
 
if ($resultat_nbre_inscrit->numRows() == 1) {
$tmp_nb = $resultat_nbre_inscrit->fetchRow(DB_FETCHMODE_OBJECT);
$nbr_total = $tmp_nb->CPT;
$chaine = "parmi $nbr_total données";
if ($nbr_total <= 0) $ret .= "<B>Erreur</B> lors du comptage des structures ($nbr_total trouvées) : $requete_nbre_inscrit";
}
else $ret .= "<B>Erreur</B> lors du comptage des structures : $requete_nbre_inscrit";
 
 
// fin comptage
 
$ret = '';
$ret .= '<h1>'.AM_L_TITRE.' '.$chaine.'</h1>'."\n" ;
// construction du moteur de str
$ret .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post">'."\n";
$ret .= '<table summary="recherche">'."\n";
// ligne de recherche
$ret .= "<tr>\n";
$ret .= "<td>".AM_L_RECHERCHER." :\n</td>\n<td>";
$ret .= form_mk_chaineI(isset ($_REQUEST['recherche']) ? stripslashes($_REQUEST['recherche']) : '', "recherche")."&nbsp;";
$ret .= '</td><td colspan="4">'.AM_L_PAYS." : \n" ;
// formulaire contenant les pays, avec par défaut soit le pays en cours
// soit "tous les pays"
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
$tableau_pays = $liste_pays->getListePays(INS_LANGUE_DEFAUT) ;
$ret .= "<select name=\"pays\">\n" ;
$ret .= "<option value=\"tous\">Tous les pays</option>\n" ;
foreach ($tableau_pays as $codeIso => $labelPays) {
$ret .= '<option value="'.$codeIso.'"' ;
if (!empty($pays)) {
if ($pays == $codeIso) $ret .= " selected" ;
}
$ret .= '>'.$labelPays.'</option>'."\n" ;
}
$ret .= "</select>\n" ;
$ret .= "</td></tr>\n" ;
$ret .= "<tr>\n";
$ret .= "<td>".AM_L_NOM." :\n</td><td>";
$ret .= form_mk_chaineI(isset ($_REQUEST['nom']) ? stripslashes($_REQUEST['nom']) : '', "nom")."&nbsp;</td>\n<td>" ;
$ret .= AM_L_PRENOM."&nbsp;:</td>\n<td>".form_mk_chaineI(isset ($_REQUEST['prenom']) ? stripslashes($_REQUEST['prenom']) : '', "prenom")."&nbsp;</td>\n<td class=\"insLabel\">" ;
$ret .= AM_L_VILLE."&nbsp;:</td>\n<td>".form_mk_chaineI(isset ($_REQUEST['ville']) ? stripslashes($_REQUEST['ville']) : '', "ville")."&nbsp;</td>" ;
$ret .= "</tr><tr>\n" ;
$ret .= "<td>".AM_L_DEPARTEMENT."&nbsp;: </td>\n<td>" ;
// Construction du <select> des départements
$requete_dpt = 'select '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' from '.INS_TABLE_DPT ;
$resultat_dpt = $GLOBALS['ins_db']->query($requete_dpt) ;
if (DB::isError($resultat_dpt)) {
echo 'Echec de la requete<br />'.$requete_dpt.'<br />'.$resultat_dpt->getMessage();
}
$ret .= "<select name=\"dept\">\n" ;
$ret .= "<option value=\"tous\">tous</option>\n" ;
while ($ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC)) {
$ret .= '<option value="'.$ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT].'"' ;
if (isset ($_REQUEST['dept']) && $_REQUEST['dept'] == $ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT]) $ret .= " selected" ;
$ret .= '>'.$ligne_dpt[INS_CHAMPS_ID_DEPARTEMENT].' - '.$ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT].'</option>'."\n" ;
}
$ret .= "</select></td>\n" ;
$ret .= '<td>'.AM_L_MAIL.'&nbsp;: </td><td colspan="3">'.form_mk_chaineI(isset ($_REQUEST['mail']) ? stripslashes($_REQUEST['mail']) : '', "mail")."</td>\n" ;
$ret .= "</tr>" ;
// Les statuts des inscrits
 
$ret .= "<tr>\n";
$ret .= "<td>\n";
$ret .= AM_L_GRP_RES." : </td>" ;
$ret .= '<td>'.$pager->getperpageselectbox (50 , 200, 50 , false ,'%d').'</td>'."\n" ;
$ret .= '<td colspan="4">'."\n";
$ret .= "<input type=\"submit\" value=\"".AM_L_RECHERCHER."\" name =\"bouton\">\n";
$ret .= "</td></tr></table></form>\n";
$ret .= "\n<div>" ;
// La liste des lettres de l'alphabet
for ($i = 65 ; $i <91 ; $i++) {
$GLOBALS['ins_url']->addQueryString('lettre', chr($i)) ;
$ret .= "\t<a href=\"".$GLOBALS['ins_url']->getURL();
$ret .= '">';
$ret .= chr($i) ;
$ret .= "</a> \n";
}
$GLOBALS['ins_url']->addQueryString ('lettre', 'tous') ;
$ret .= " <a href=\"".$GLOBALS['ins_url']->getURL().'">'.AM_L_TOUS."</a>\n" ;
$ret .= "</div>\n" ;
$ret .= '<div>'.$nbr_final.' résultat(s)</div>' ;
$GLOBALS['ins_url']->removeQueryString('lettre') ;
// Menu Ajouter un inscrit
$GLOBALS['ins_url']->addQueryString('ajouter', '1') ;
$ret .= '<div><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_AJOUT_MEMBRE.'</a></div>'."\n";
$data = $pager->getPageData();
$table = new HTML_Table(array ('class' => 'table_bazar')) ;
$table->addRow(array(
'<a href="'.$GLOBALS['ins_url']->getURL().'&amp;sort='.INS_CHAMPS_NOM.'">Identit&eacute;</a>',
'<a href="'.$GLOBALS['ins_url']->getURL().'&amp;sort='.INS_CHAMPS_MAIL.'">Adresse mail</a>',
'<a href="'.$GLOBALS['ins_url']->getURL().'&amp;sort='.INS_CHAMPS_VILLE.'">'.AM_L_VILLE.'</a>',
'Pays ou Dpt (fr)'
), '', 'TH') ;
$debut = isset($_REQUEST['pageID']) ? $_REQUEST['pageID'] : 1 ;
for ($i = ($debut - 1) * $_REQUEST['setPerPage'];
$i < $_REQUEST['setPerPage'] * $debut;
$i++) {
// On teste s'il y une valeur, si oui on ajoute la ligne
if (isset ($data[$i])) {
$urlPop = $GLOBALS['ins_url']->getURL().'&amp;'.INS_CHAMPS_ID.'='.$data[$i][INS_CHAMPS_ID];
$ligne_inscrit = array ("<a href=\"$urlPop\">".$data[$i][INS_CHAMPS_NOM].' '.$data[$i][INS_CHAMPS_PRENOM].
'</a>', $data[$i][INS_CHAMPS_MAIL], $data[$i][INS_CHAMPS_VILLE]) ;
// Pour la france on met le département, sinon on laisse le nom du pays
if ($data[$i][INS_CHAMPS_PAYS] != 'fr') {
array_push ($ligne_inscrit, $data[$i][INS_CHAMPS_LABEL_PAYS]);
} else {
$req_dpt = 'select '.INS_CHAMPS_NOM_DEPARTEMENT.' from '.INS_TABLE_DPT.",".INS_ANNUAIRE.
" where ".INS_ANNUAIRE.'.'.INS_CHAMPS_ID.'='.$data[$i][INS_CHAMPS_ID] ;
$req_dpt .= " and ".INS_ANNUAIRE.'.'.INS_CHAMPS_DEPARTEMENT.'='.INS_TABLE_DPT.'.'
.INS_CHAMPS_ID_DEPARTEMENT ;
$resultat_dpt = $GLOBALS['ins_db']->query($req_dpt) ;
if (DB::isError($resultat_dpt)) {
echo $resultat_dpt->getMessage().$resultat_dpt->getDebugInfo();
}
$ligne_dpt = $resultat_dpt->fetchRow(DB_FETCHMODE_ASSOC) ;
array_push ($ligne_inscrit, $ligne_dpt[INS_CHAMPS_NOM_DEPARTEMENT]) ;
}
$table->addRow($ligne_inscrit) ;
}
}
$ret .= $table->toHTML();
$links = $pager->getLinks();
$ret .= $links['all'] ;
 
$ret .= '<div><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action='.ANN_MAIL_TOUS
.'">'.AM_L_MAIL_SELECTION."</a></div>\n" ;
return $ret;
}
 
/** function form_mk_chaineI () Renvoie une balise de type <input>
*
* @param string l'attribut value de la balise
* @param string l'attibut name de la balise
* @param string la classe CSS
* @return string HTML
*/
function form_mk_chaineI($value="", $name, $class="insInputForm")
{
return "<input type=\"text\" size=\"15\" value=\"$value\" name=\"$name\" class=\"$class\">";
}
 
function form_mk_select($value="", $name="", $class="insInputForm") {
$res = "<select name=\"$name\" class=\"$class\">\n" ;
$res .= "<option value=\"1\"" ;
if ($value == 1) $res .= " selected" ;
$res .= ">Cotisants</option>\n" ;
$res .= "<option value=\"2\"" ;
if ($value == 2) $res .= " selected" ;
$res .= ">Non cotisants</option>\n" ;
$res .= "<option value=\"3\"" ;
if ($value == 3 || $value == "") $res .= " selected" ;
$res .= ">Tous</option>\n" ;
$res .= "</select>\n" ;
return $res ;
}
 
function mkquery()
{
// Requete sur l'annuaire pour extraire le nom, prénom, ville, nom du département (jointure),
// l'état de la cotisation (jointure)
// le tableau suivant contient tous les champs de la table annuaire_tela sur lesquels on peut effectuer une recherche
$fields_annu = array("nom" => INS_CHAMPS_NOM, "prenom" => INS_CHAMPS_PRENOM , "mail" => INS_CHAMPS_MAIL , "ville" => INS_CHAMPS_VILLE,
"dept" => INS_CHAMPS_DEPARTEMENT, "pays" => INS_CHAMPS_PAYS ) ;
 
$mes_vars = array ("recherche", "nom", "ville", "mail" ,"dept", "prenom", "cotisant", "pays", "sort", "T_REPONSE", "lettre","statut") ;
 
$queries = "select ".INS_ANNUAIRE.".*" ;
$queries .= ", ".INS_TABLE_PAYS.'.'.INS_CHAMPS_LABEL_PAYS ;
$queries .= " from ".INS_ANNUAIRE ;
$queries .= ",".INS_TABLE_PAYS ;
// Construction en fonction des champs saisies
// juste le champs "rechercher", on regarde partout
$where = ' where ' ;
if (isset ($_REQUEST['recherche']) && $_REQUEST['recherche'] != "") {
$where .= '('.INS_CHAMPS_NOM.' like "%'.$_REQUEST['recherche'].'%"' ; // le premier
foreach($fields_annu as $key=>$value) {
if ($key == "nom" || $key == 'dept') continue ;
$where .= ($key == "pays" ?
$_REQUEST['pays'] == "tous" ? ")" :
") and $value = '".$_REQUEST['pays']."'" : ' or '.$value.' like "%'.$_REQUEST['recherche'].'%"') ; // les autres
}
if (isset ($_REQUEST['dept']) && $_REQUEST['dept'] != 'tous') {
$where .= 'and '.INS_CHAMPS_DEPARTEMENT.'="'.$_REQUEST['dept'].'"' ;
}
} else {
 
// si un ou plusieurs autres champs ont été indiqué, on les rajoute ici
 
$or_flag = false ;
foreach($fields_annu as $key=>$valeur) {
if ($key != "") {
if ($key == "pays") {
if (!isset($_REQUEST[$key]) || $_REQUEST[$key] == "tous") {
$where .= " and ".INS_CHAMPS_PAYS." like '%'";
} else {
$where .= " and $valeur like \"%".$_REQUEST[$key]."%\"" ;
}
} else {
if ($key == "dept") {
if (isset($_REQUEST[$key]) && $_REQUEST[$key] != "tous") {
$where .= " and ".INS_CHAMPS_DEPARTEMENT."=".$_REQUEST[$key] ;
if ($fields_annu["pays"] != "fr") $where .= " and ".INS_CHAMPS_PAYS."=\"fr\"" ;
}
} else {
if (isset ($_REQUEST[$key]) && $or_flag) {
$where .= "$valeur like \"%".$_REQUEST[$key]."%\"" ;
} else {
$where .= "$valeur like \"%%\"" ;
}
if ($key != "ville") $where .= " and " ;
}
}
$or_flag = true ;
}
}
// ici le cas ou rien n'a été saisie du tout, on affiche tout
if (!$or_flag) {
$where .= INS_CHAMPS_NOM." like '%')" ;
}
}
 
if (isset($_REQUEST['lettre'])) {
if ($_REQUEST['lettre'] == 'tous') $_REQUEST['lettre'] = '';
$where = ' where '.INS_CHAMPS_NOM.' like "'.$_REQUEST['lettre'].'%"' ;
}
$where .= " and ".INS_ANNUAIRE.".".INS_CHAMPS_PAYS."=".INS_TABLE_PAYS.".".INS_CHAMPS_ID_PAYS."" ;
 
if (isset($nom) && $nom != "") $where .= " and ".INS_CHAMPS_NOM." like \"%$nom%\"" ;
if (isset($_REQUEST['prenom']) && $_REQUEST['prenom'] != "")
$where .= " and ".INS_CHAMPS_PRENOM.' like "%'.$_REQUEST['prenom'].'%"' ;
if (isset($ville) && $ville != "") $where .= " and ".INS_CHAMPS_VILLE." like \"%$ville%\"" ;
if (isset($mail) && $mail != "") $where .= " and ".INS_CHAMPS_MAIL." like \"%$mail%\"" ;
$where .= ' and gip_id_i18n like "%'.$GLOBALS['lang'].'%"' ;
 
if (isset ($_REQUEST['lettre']) && $_REQUEST['lettre'] == "tous") $_REQUEST['lettre'] = "" ;
if (!isset ($_REQUEST['lettre'])) $_REQUEST['lettre'] = '' ;
 
$queries .= $where ;
if (isset($_REQUEST['sort']) && $_REQUEST['sort'] != "") $queries .= ' order by '.$_REQUEST['sort'] ;
return $queries;
}
 
function ajouterInscrit() {
$res = '';
$GLOBALS['ins_url']->addQueryString ('ajouter', '1');
$GLOBALS['ins_url']->addQueryString ('ajouter_v', '1');
$formulaire = new HTML_formulaireInscription('inscription', '',
str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()), '', '') ;
$formulaire->construitFormulaire(str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL())) ;
if (isset($_REQUEST['ajouter_v'])) {
if ($formulaire->validate()) {
$id_utilisateur = insertion($formulaire->getSubmitValues()) ;
// Appel des actions desinscriptions des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
}
$d->close();
if (INS_CHAMPS_LETTRE != '' && isset ($valeurs['lettre'])) {
inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
}
return mkengine();
}
}
return $formulaire->toHTML();
}
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/bottin.fonct.php
New file
0,0 → 1,1322
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Fichier des fonctions du bottin
*
*@package bottin
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Outils-reseaux 2006-2040
*@version 05 avril 2006
// +-----------------------------------------------------------------------------------------------+
//
// $Id$
// FICHIER : $RCSfile$
// AUTEUR : $Author$
// VERSION : $Revision$
// DATE : $Date$
*/
 
 
include_once 'inscription.fonct.wiki.php' ;
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
include_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';
 
/** function inscription_onglets() Affiche les onglets de présentation de la structure
*
*
*
* @return string HTML
*/
function inscription_onglets() {
//on trouve l'id de la fiche en fonction de l'onglet choisi auparavant
if (isset($_GET['voir_fiche'])) {
$id_fiche=$_GET['voir_fiche'];
} elseif (isset($_GET['voir_abonnement'])) {
$id_fiche=$_GET['voir_abonnement'];
} elseif (isset($_GET['voir_actus'])) {
$id_fiche=$_GET['voir_actus'];
} elseif (isset($_GET['voir_ressources'])) {
$id_fiche=$_GET['voir_ressources'];
} elseif (isset($_GET['voir_competences'])) {
$id_fiche=$_GET['voir_competences'];
} else {
$id_fiche = '';
}
//preparation de l'affichage des onglets
$res='<ul id="onglets_inscription">'."\n";
//partie présentation
$GLOBALS['ins_url']->addQueryString('voir_fiche', $id_fiche);
$res .= '<li id="fiche"';
if (isset($_GET['voir_fiche'])) $res .= ' class="onglet_actif" ';
$res .= '><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_PRESENTATION.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_fiche');
if ($id_fiche==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
//partie abonnement
$GLOBALS['ins_url']->addQueryString('voir_abonnement', $id_fiche);
$res .= '<li id="abonnements"';
if (isset($_GET['voir_abonnement'])) $res .= ' class="onglet_actif" ';
$res .= '><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ABONNEMENTS.'</a></li>'."\n" ;
$GLOBALS['ins_url']->removeQueryString('voir_abonnement');
}
//partie actualites
$GLOBALS['ins_url']->addQueryString('voir_actus', $id_fiche);
$res .= '<li id="actus"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ACTUALITES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_actus');
//partie ressources
$GLOBALS['ins_url']->addQueryString('voir_ressources', $id_fiche);
$res .= '<li id="ressources"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_RESSOURCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_ressources');
//partie competences
//$GLOBALS['ins_url']->addQueryString('voir_competences', $id_fiche);
//$res .= '<li id="competences"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_COMPETENCES.'</a>'."\n".'</li>'."\n";
//$GLOBALS['ins_url']->removeQueryString('voir_competences');
$res.= '</ul>'."\n";
return $res;
}
 
/** function affiche_onglet_info() sélectionne le type d'information à montrer pour une fiche
*
*
*
* @return string HTML
*/
function affiche_onglet_info() {
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.fonct.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
if ( isset($_GET['voir_fiche']) ) {
$res=info($_GET['voir_fiche'], 'fiche');
} elseif (isset($_GET['voir_abonnement'])) {
$res=info($_GET['voir_abonnement'], 'abonnement');
} elseif (isset($_GET['voir_actus'])) {
$res=info($_GET['voir_actus'], 'actus');
} elseif (isset($_GET['voir_ressources'])) {
$res=info($_GET['voir_ressources'], 'ressources');
} elseif (isset($_GET['voir_competences'])) {
$res=info($_GET['voir_competences'], 'competences');
}
return $res;
}
 
/** function Annuaire_recherche () Moteur de recherche dans l'annuaire des inscrits
*
*
*
* @return string HTML
*/
function Annuaire_recherche() {
$res ='<h2>'.INS_RECHERCHE_ANNUAIRE_DES_INSCRITS.'</h2>'."\n";
$form =& new HTML_QuickForm('form_recherche_annuaire', 'post', str_replace('&amp;', '&', $GLOBALS['ins_url']->getURL()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".
'<td style="padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </td>'."\n".
'<td style="padding:5px;text-align:left;">{element}</td>'."\n".
'</tr>'."\n" );
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan=2 style="padding:5px;">{label}{element}</td>'."\n".'</tr>'."\n", 'bouton_rechercher');
$option_type=array ('0' => INS_PERSONNES_OU_STRUCTURES,
'1' => INS_PERSONNES,
'2' => INS_STRUCTURES);
$form->addElement('select', 'nom_type', INS_JE_RECHERCHE, $option_type);
//requete pour recuperer la liste des pays
$requete = 'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' FROM '.INS_TABLE_PAYS.' WHERE '.INS_CHAMPS_I18N_PAYS.'="fr-FR"';
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_pays = array('zz' => INS_TOUS_PAYS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_pays[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
}
$form->addElement('select', 'nom_pays', INS_PAYS, $option_pays);
//requete pour recuperer la liste des départements
$requete = 'SELECT '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' FROM '.INS_TABLE_DPT;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_departements = array('0' => INS_TOUS_DEPARTEMENTS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_departements[$ligne[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne[INS_CHAMPS_NOM_DEPARTEMENT] ;
}
$form->addElement('select', 'nom_departement', INS_DEPARTEMENT_POUR_LA_FRANCE, $option_departements);
$form->addElement('text', 'nom_annuaire', INS_NOM_ANNUAIRE);
$form->addElement('submit', 'bouton_rechercher', INS_RECHERCHER);
//valeurs par defaut
$defauts=array('nom_pays'=>'fr','nom_departement'=>'0');
$form->setDefaults($defauts);
//affichage du formulaire
$res .=$form->toHtml();
//on teste si l'on affiche le resultat de la recherche ou
if (isset($_POST['nom_type'])) {
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
$req_where=0;
if ($_POST['nom_type']==1) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=0 ';
$req_where=1;
} elseif ($_POST['nom_type']==2) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=1 ';
$req_where=1;
}
if ($_POST['nom_pays']!='0'and$_POST['nom_pays']!='zz') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_PAYS.'="'.$_POST['nom_pays'].'" ';
}
if ($_POST['nom_departement']!='0') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_DEPARTEMENT.'="'.$_POST['nom_departement'].'" ';
}
if ($_POST['nom_annuaire']!='') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= '('.INS_CHAMPS_NOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_PRENOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_SIGLE_STRUCTURE.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_DESCRIPTION.' LIKE "%'.$_POST['nom_annuaire'].'%") ';
}
if (!$req_where) $requete .= '1';
$requete .=' ORDER BY '.INS_CHAMPS_NOM;
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.' ('.$resultat->numRows().' '.INS_ENTREES.')</h2>'."\n";
$res .='<p class="zone_info">'.INS_CLIQUER_ELEMENT_LISTE.'</p>'."\n";
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres);
}
else {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.'</h2>'."\n";
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
} else {
$res .='<h2>'.INS_DIX_DERNIERES_INSCRIPTIONS.'</h2>'."\n";
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' ORDER BY '.INS_CHAMPS_DATE.' DESC LIMIT 0 , 10';
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, 0);
}
else {
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
}
return $res ;
}
 
/**
* Renvoie le code HTML de la liste des inscrits
* en fonction de la requete passé en parametre
*
* @return Renvoie le code HTML de la liste des inscrits
*/
 
function listes_inscrit(& $donnees_membres, $affiche_form_mail=1) {
$res = '';
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";}
$res .= '<ul style="clear:both;">'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";
}
$res .= '<ul>'."\n";
for ($i=0;$i<count($donnees_membres);$i++) {
$id = array_shift($donnees_membres[$i]);
$GLOBALS['ins_url']->addQueryString('voir_fiche', $id);
$res .= '<li>'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res.='<input type="checkbox" name="select[]" value="'.$id.'" />'."\n";
}
$res .= '<a href="'.$GLOBALS['ins_url']->getURL().'">'."\n";
$res .= '<strong>'.$donnees_membres[$i][INS_CHAMPS_NOM].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_PRENOM].'</strong>'."\n".
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_CODE_POSTAL].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_VILLE];
$res .= '</a>'."\n".'</li>'."\n";
}
$res .= '</ul>'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res .= INS_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"><br />';
$res .= '<h3>'.INS_ENVOYER_MAIL.'</h3>'."\n";
$res .= '<p style="text-align:right;">'.INS_SUJET.'&nbsp;:&nbsp;<input style="border:1px solid #000;width:450px;" type="text" name="titre_mail"><br />'."\n".
INS_MESSAGE.'&nbsp;:&nbsp;<textarea style="border:1px solid #000;width:450px;" name="corps" rows="5" cols="60"></textarea></p>'."\n".
'<p style="width:100px;margin:4px auto;text-align:center;"><input name="bouton_envoi_mail" type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
'<p style="width:100px;margin:4px auto;text-align:center;"><input type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
'<input type="hidden" name="fin" value="true" /><input type="hidden" name="mailer" value="1" />'.
'</form>'."\n";
} else {
if ($affiche_form_mail) $res .='<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
}
return $res ;
}
 
 
 
/** envoie_mail_depuis_annuaire()
*
*
* @return envoie l'email
*/
 
function envoie_mail_depuis_annuaire() {
$requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE.
" where ".INS_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)."'";
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
$_POST['corps'] .= INS_PIED_MESSAGE;
$_POST['corps'] = stripslashes($_POST['corps']) ;
$liste = "" ;
$liste_numero = implode (',', $_POST['select']) ;
$requete_liste_mail = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.
' in ('.$liste_numero.')' ;
$resultat_liste_mail = $GLOBALS['ins_db']->query($requete_liste_mail);
while ($ligne_liste_mail = $resultat_liste_mail->fetchRow(DB_FETCHMODE_ASSOC)) {
mail ($ligne_liste_mail[INS_CHAMPS_MAIL], stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
$liste .= $ligne_liste_mail[INS_CHAMPS_MAIL]."\n" ;
}
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
$_POST['corps'] .= "\n".INS_MESSAGE_ENVOYE_A." :\n $liste" ;
mail (INS_MAIL_ADMIN_APRES_INSCRIPTION, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
$_POST['corps'] = '';
$_POST['titre_mail'] = '';
return '<div>'.INS_MAIL_ENVOYE.'</div>' ;
}
 
/** function carto_liste_fiches()
*
*
* @return string HTML
*/
function carto_liste_fiches(&$monde, $nom_table1, $nom_table2, $nom_champs_pays, $nom_champs_cp, $requete_sql) {
 
global $mailer;
global $select;//utilisé dans liste_inscrit.php
$javascript = "
function confirmer () {
if (window.confirm ('Cliquez sur OK pour confirmer.')) {
window.formmail.submit();
}
}
 
function setCheckboxes(the_form)
{
var do_check=document.forms[the_form].elements['selecttotal'].checked;
var elts = document.forms[the_form].elements['select[]'];
var elts_cnt = (typeof(elts.length) != 'undefined')
? elts.length
: 0;
if (elts_cnt) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = do_check;
} // Fin for
}
else {
elts.checked = do_check;
} // Fin if... else
return true;
} // Fin de la fonction 'setCheckboxes()'
 
";
GEN_stockerCodeScript($javascript);
 
$res = '';
$tabmonde = explode ('*',$monde->historique);
// Premier cas, on vient de cliquer sur un pays qui n'est pas
// la France, on affiche les adhérents de ce pays
if (count($tabmonde) == 3) {
$argument = $tabmonde[2];
$query = 'SELECT * FROM carto_PAYS WHERE CP_ID_pays="'.$argument.'"';
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage().'<br />'.$result->getDebugInfo()) ;
}
$row = $result->fetchRow(DB_FETCHMODE_OBJECT) ;
$pays = $row->CP_Intitule_pays;
$monde->nom = $monde->nom.'*'.$pays;
$tabonglet = explode ('*', $monde->historique);
$tabnom = explode ('*', $monde->nom);
$res .='<br /><strong>'.INS_RETOUR_A_LA_CARTE."\n";
foreach ($tabonglet as $key => $value) {
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
} else if ($key == (count($tabonglet)-1)) {
$res .= "<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$pays</a>";
} else {
$chemin .= '*'.$value;
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= '</strong>'."\n";
$capitale = $row->CP_Intitule_capitale;
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
' FROM '.$nom_table1;
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
$query2 .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT) ;
$res .= '<br /><br /><div class="info_pays">'.$pays.' (capitale: '.$capitale.') : ' ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT.' '.INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr.' '.INS_INSCRIT.' '.INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr.' '.INS_INSCRIT.'s '.INS_LABEL_PROJET ;
}
$res .= "</div>\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
}
else {
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL.' FROM '.$nom_table1;
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
$requete .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
$requete .= ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
$resultat = $GLOBALS['ins_db']->query($requete);
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, 1);
if ($mailer==1) {
if (!is_array($select)) {
$res .= "<div>".INS_NO_DESTINATAIRE."</div>";
}
else {
$res .= '<div class="zone_info">'.INS_MESSAGE_ENVOYE.'</div>'."\n" ;
carto_envoie_mail() ;
}
}
else {
$res .= carto_texte_cocher() ;
}
$res .= carto_formulaire() ;
}
}
// 2 ème cas, on vient de cliquer sur un département français
} else if (count($tabmonde) == 4) {
$argument = $tabmonde[3];
$query = 'SELECT * FROM '.INS_TABLE_DPT.' WHERE '.INS_CHAMPS_ID_DEPARTEMENT.'='.$argument;
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage() .'<br />'.$result->getDebugInfo());
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$nom = $row[INS_CHAMPS_NOM_DEPARTEMENT];
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
' FROM '.$nom_table1;
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
$query2 .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
' AND '.$nom_champs_pays.'="FR"';
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT);
$res .= '<br /><p class="zone_info">'."\n" ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT." ".INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr." ".INS_INSCRIT." ".INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr." ".INS_INSCRIT."s ".INS_LABEL_PROJET ;
}
$res .= '</p>'."\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
} else {
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL.' FROM '.$nom_table1;
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
if (strlen($argument)==1) {
$argument='0'.$argument;
}
$requete .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
' AND '.$nom_champs_pays.'="FR"';
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
$requete .= ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
$resultat = $GLOBALS['ins_db']->query($requete);
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, 1);
if ($mailer==1) {
if (!is_array($select)) {
$res.= INS_NO_DESTINATAIRE;
} else {
$res .= '<p class="zone_info">'.INS_MESSAGE_ENVOYE."</p>\n" ;
carto_envoie_mail() ;
}
}
}
}
}
return $res;
}
 
 
/** function carto_texte_cocher ()
*
*
* @return string HTML
*/
function carto_texte_cocher() {
$res = '<br />'.INS_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'."\n";
return $res ;
}
 
 
/** function carto_formulaire ()
*
*
*
* @return string HTML
*/
function carto_formulaire($titre_mail="", $corps="") {
$res = '<br /><h2>'.INS_ENVOYER_MAIL.'</h2><br />'."\n".
INS_SUJET.' :<br /><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /><br /><br />'."\n".
INS_MESSAGE.' :<br /><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea><br /><br />'."\n".
'<input class="bouton" type="submit" onclick="javascript:confirmer();" value="'.INS_ENVOYER.'" />'."\n".
'</form>'."\n";
return $res ;
}
 
/** envoie_mail()
*
*
* @return envoie l'email
*/
function carto_envoie_mail() {
$requete = 'SELECT '.INS_CHAMPS_MAIL.' FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_ID.'='.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
 
include_once PAP_CHEMIN_API_PEAR.'Mail.php' ;
$entetes['From'] = $ligne[INS_CHAMPS_MAIL];
 
$objet_mail =& Mail::factory('smtp');
$entetes['Subject'] = $GLOBALS['titre_mail'];
$entetes['Date'] = date("m-d-Y H:i") ;
$GLOBALS['corps'] .= INS_TEXTE_FIN_MAIL;
$liste = "" ;
$destinataire = array() ;
foreach ($GLOBALS['select'] as $key => $value) {
$requete = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.'="'.$value.'"';
$mail = $GLOBALS['ins_db']->getOne($requete) ;
array_push ($destinataire, $mail) ;
$liste .= $mail."\n" ;
}
$objet_mail->send($destinataire, $entetes, $GLOBALS['corps']);
$GLOBALS['corps'] .= "
----------------------------------------------------------------------------".INS_MESSAGE_ENVOYE_A."
$liste" ;
mail(INS_MAIL_ADMIN, stripslashes(INS_SURVEILLANCE_ENVOI_MAIL.$GLOBALS['titre_mail']), $GLOBALS['corps'], $entetes);
$GLOBALS['corps'] = '';
$GLOBALS['titre_mail'] = '';
}
 
//-----Fonctions de l'inscription-----------------------------------------------------+
 
 
/**
*
* @param array les valeurs renvoyés par le formulaire
* @return
*/
function inscription_demande($valeurs) {
// On stocke les informations dans un variable de session
// On coupe l'identifiant de session pour ne prendre que les 8 premiers caractères
// afin d'éviter d'obtenir une url trop longue
$chaine = substr (session_id(), 0, 8) ;
$requete_verif = 'select * from inscription_demande where id_identifiant_session="'.$chaine.'"' ;
$resultat_verif = $GLOBALS['ins_db']->query ($requete_verif) ;
if ($resultat_verif->numRows() != 0) {
$requete_suppression = 'delete from inscription_demande where id_identifiant_session="'.$chaine.'"' ;
$GLOBALS['ins_db']->query ($requete_suppression) ;
}
$requete = 'insert into inscription_demande set id_identifiant_session="'.$chaine.'", id_donnees="'.
addslashes(serialize($valeurs)).'", id_date=NOW()' ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError ($resultat)) {
echo ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
// On envoie un email de confirmation pour l'utilisateur
$GLOBALS['ins_url']->addQueryString ('id', $chaine) ;
if (INS_UTILISE_REECRITURE_URL) {
$url = 'http://'.$GLOBALS['ins_url']->host.'/'.INS_URL_PREFIXE.$chaine ;
} else {
$url = str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()) ;
}
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le gabarit du mail est dans un template
// template 2
$requete = 'select it_template from inscription_template where it_id_template=2'.
' and it_i18n like "%'.INS_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($GLOBALS['ins_db']->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('URL_INSCRIPTION', $url) ;
 
mail ($GLOBALS['email'], 'Inscription', $tpl->get(), 'From: '.INS_MAIL_ADMIN_APRES_INSCRIPTION) ;
}
 
/**
*
* @param array les valeurs renvoyés par le formulaire
* @return
*/
 
function inscription_validee($valeurs) {
inscription_insertion($valeurs) ;
$GLOBALS['AUTH']->username = $valeurs['email'] ;
$GLOBALS['AUTH']->password = $valeurs['mot_de_passe'] ;
// On loggue l'utilisateur
$GLOBALS['AUTH']->login() ;
// inscription à la lettre d'information
if (INS_CHAMPS_LETTRE != '' && isset ($valeurs['lettre'])) {
inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
}
}
 
/**
* Renvoie l'accueil de l'inscription
*
* @return string HTML
*/
function inscription_AUTH_formulaire_login() {
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le formulaire pour se logguer est dans un template
// template 1
$requete = 'SELECT it_template FROM inscription_template WHERE it_id_template=1'.
' AND it_i18n LIKE "%'.INS_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($GLOBALS['ins_db']->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('URL_INSCRIPTION', $GLOBALS['ins_url']->getURL());
return $tpl->get() ;
}
 
 
/** formulaire_envoi_passe() - Renvoie le code HTML d'un formulaire d'envoi de mot de passe par mail
*
* @return string HTML
*/
function inscription_formulaire_envoi_passe() {
$res = '<h2>'.INS_SI_PASSE_PERDU.'</h2>'."\n" ;
$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'&amp;action=sendpasswd" method="post">'."\n" ;
$res .= '<p class="label100">'.INS_EMAIL.' : </p>'."\n" ;
$res .= '<input type="text" value="';
if (isset($_POST['username'])) $res .= $_POST['username'];
$res .= '" name="mail" size="32" />'."\n" ;
$res .= '<input type="submit" value="'.INS_ENVOIE_PASSE.'" />' ;
$res .= '</form><br />'."\n" ;
$res .= inscription_AUTH_formulaire_login() ;
return $res;
}
 
 
function inscription_insertion($valeur) {
// =========== Insertion dans l'annuaire ===================
// Génération du nom wikini à partir du nom et du prénom
if (INS_UTILISE_WIKINI && INS_NOM_WIKINI_GENERE) {
$valeur['nom_wiki'] = inscription_genere_nom_wiki ($valeur['nom'], isset ($valeur['prenom']) ? $valeur['prenom'] : '') ;
} else {
if (!INS_NOM_WIKINI_GENERE) {
$valeur['nom_wiki'] = $valeur['nomwiki'];
}
}
$id_utilisateur = inscription_nextId(INS_ANNUAIRE, INS_CHAMPS_ID, $GLOBALS['ins_db']) ;
$requete = 'INSERT INTO '.INS_ANNUAIRE.' SET '.
INS_CHAMPS_ID.'="'.$id_utilisateur.'",'.
inscription_requete_annuaire($valeur) ;
 
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
 
// ================ Insertion dans SPIP =========================================
if (INS_UTILISE_SPIP) {
inscription_spip($id_utilisateur, $valeur) ;
}
if (INS_UTILISE_WIKINI) inscription_interwikini_users('', $valeur) ;
return $id_utilisateur ;
}
 
 
/**
* Réalise une mise à jour dans la base de donnée
*
* @param array un tableau de valeur avec en clé les noms des champs du formulaire
* @return void
*/
function inscription_mise_a_jour($valeur, $id = '') {
// ====================Mise à jour dans l'annuaire gen_annuaire ====================
if ($id == '') {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
}
$requete = 'update '.INS_ANNUAIRE.' set '.
inscription_requete_annuaire ($valeur).
'where '.INS_CHAMPS_ID.'="'.$id.'"';
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
unset ($resultat) ;
 
// ========================= Mise à jour dans SPIP ================================
if (INS_UTILISE_SPIP) {
mod_inscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID), $valeur) ;
}
}
 
/** requete_annuaire () - Renvoie une chaine contenant les champs de l'annuaire avec leur valeur suite à le fonction process de QuickForm
*
* @return string une requete du type champs="valeur",...
*/
 
function inscription_requete_annuaire($valeur) {
$req = INS_CHAMPS_NOM.'="'.addslashes($valeur['nom']).'", ';
if (isset($valeur['est_structure']) && $valeur['est_structure'] == 0)
$req .= INS_CHAMPS_PRENOM.'="'.addslashes($valeur['prenom']).'", ';
// Initialisation de variable pour éviter des notices
foreach (array ('adresse_1', 'adresse_2', 'ville', 'telephone', 'fax', 'site') as $val) {
if (!isset ($valeur[$val])) $valeur[$val] = '' ;
}
 
$req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
$req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
INS_CHAMPS_ADRESSE_2.'="'.addslashes($valeur['adresse_2']).'", '.
INS_CHAMPS_DATE_INSCRIPTION.'=NOW(), '.
INS_CHAMPS_CODE_POSTAL.'="'.addslashes($valeur['cp']).'", '.
INS_CHAMPS_VILLE.'="'.addslashes($valeur['ville']).'", '.
INS_CHAMPS_EST_STRUCTURE.'="'.addslashes($valeur['est_structure']).'", '.
INS_CHAMPS_TELEPHONE.'="'.addslashes($valeur['telephone']).'", '.
INS_CHAMPS_FAX.'="'.addslashes($valeur['fax']).'", '.
INS_CHAMPS_SITE_INTERNET.'="'.addslashes($valeur['site']).'" ';
if (isset($valeur['visible'])) $req .= ', '.INS_CHAMPS_VISIBLE.'="'.$valeur['visible'].'"';
else $req .= ', '.INS_CHAMPS_VISIBLE.'=0';
if (INS_CHAMPS_LETTRE != '') {
if (isset($valeur['lettre'])) {
$req .= ', '.INS_CHAMPS_LETTRE.'="'.$valeur['lettre'].'" ';
inscription_lettre('inscrire');
}
else {
$req .= ', '.INS_CHAMPS_LETTRE.'=0 ';
inscription_lettre('desinscrire');
}
}
if (isset($_FILES['image']['name']) && $_FILES['image']['name']!='') {
$chemin_destination=INS_CHEMIN_APPLI.'presentations/logos/'.$_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination);
$req .= ', '.INS_CHAMPS_LOGO.'="'.$_FILES['image']['name'].'"' ;
}
if (isset($valeur['sigle_structure'])) {
$req .= ', '.INS_CHAMPS_SIGLE_STRUCTURE.'="'.addslashes($valeur['sigle_structure']).'"' ;
}
if (isset($valeur['num_agrement'])) {
$req .= ', '.INS_CHAMPS_NUM_AGREMENT.'="'.addslashes($valeur['num_agrement']).'"' ;
}
// traitement du numéro de département pour la france
if ($valeur['pays'] == 'FR') {
if (preg_match("/^97|98[0-9]*/", $valeur['cp'])) {
$n_dpt = substr($valeur['cp'], 0, 3) ;
} else {
$n_dpt = substr($valeur['cp'], 0, 2) ;
}
$req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
}
if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
return $req ;
}
 
 
 
/** formulaire_defaults() - Renvoie un tableau avec les valeurs par défaut du formulaire d'inscription
*
* @return array Valeurs par défaut du formulaire d'inscription
*/
function inscription_formulaire_defaults($id = '') {
if ($id == '') {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
}
$requete = 'select '.INS_ANNUAIRE.'.* '.
'from '.INS_ANNUAIRE.' '.
'where '.INS_ANNUAIRE.'.'.INS_CHAMPS_ID.'= "'.$id.'"' ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$valeurs_par_defaut = array() ;
$valeurs_par_defaut['email'] = $ligne[INS_CHAMPS_MAIL];
$valeurs_par_defaut['nom'] = $ligne[INS_CHAMPS_NOM];
$valeurs_par_defaut['prenom'] = $ligne[INS_CHAMPS_PRENOM] ;
$valeurs_par_defaut['pays'] = $ligne[INS_CHAMPS_PAYS] ;
if (INS_UTILISE_WIKINI) {$valeurs_par_defaut['nomwiki'] = $ligne[INS_CHAMPS_NOM_WIKINI] ;}
$valeurs_par_defaut['cp'] = $ligne[INS_CHAMPS_CODE_POSTAL] ;
$valeurs_par_defaut['ville'] = $ligne[INS_CHAMPS_VILLE] ;
$valeurs_par_defaut['adresse_1'] = $ligne[INS_CHAMPS_ADRESSE_1] ;
$valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
$valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
$valeurs_par_defaut['fax'] = $ligne[INS_CHAMPS_FAX] ;
if (INS_CHAMPS_STRUCTURE != '' && isset($ligne[INS_CHAMPS_STRUCTURE])) {
$valeurs_par_defaut['structure'] = $ligne[INS_CHAMPS_STRUCTURE] ;
//$valeurs_par_defaut['type_structure'] = $ligne['a_type_structure'];
}
$valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
$valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
$valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
$valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
if (INS_CHAMPS_NUM_AGREMENT != '') $valeurs_par_defaut['num_agrement'] = $ligne[INS_CHAMPS_NUM_AGREMENT] ;
return $valeurs_par_defaut ;
}
 
 
/** info() - Renvoie une fiche d'information sur la personne ou la structure
*
* @param integer identifiant de la fiche a afficher, mettre -1 pour voir sa propre fiche
* @param text nom de l'onglet de la fiche
*
* @return text Code HTML de la fiche
*/
function info($id=-1, $type_info='fiche') {
if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
$requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
.INS_CHAMPS_ID.'="'.$id.'"' ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
 
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
//voir la présentation de la fiche
if ($type_info=='fiche') {
$res = '';
if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
$res .= '<h2>'.INS_FICHE_STRUCTURE.'</h2>'."\n" ;
} else {
$res .= '<h2>'.INS_FICHE_PERSONNELLE.'</h2>'."\n" ;
}
$res .= '<div class="fiche">'."\n" ;
if ($ligne[INS_CHAMPS_LOGO] != NULL) {
$res .= '<img style="float:right;width:120px;height:120px;margin:0 0 10px 10px;" src="'.INS_CHEMIN_APPLI.'presentations/logos/'.$ligne[INS_CHAMPS_LOGO].'" alt="logo" />'."\n";
}
if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
$res .= '<h3>'.$ligne[INS_CHAMPS_NOM].'</h3>'."\n";
$res .= inscription_ligne(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
if (INS_CHAMPS_NUM_AGREMENT != '') $res .= inscription_ligne(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
} else {
$res .= '<h3>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h3>'."\n";
}
$res .= inscription_ligne(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
$res .= inscription_ligne(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
$res .= inscription_ligne(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
$res .= inscription_ligne(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
$pays = new ListeDePays($GLOBALS['ins_db']) ;
$res .= inscription_ligne(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
$res .= inscription_ligne(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
$res .= inscription_ligne(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
$res .= inscription_ligne(INS_SITE_INTERNET, '<a href="'.$ligne[INS_CHAMPS_SITE_INTERNET].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[INS_CHAMPS_SITE_INTERNET].'</a>');
}
if ($GLOBALS['AUTH']->getAuth()) $res .= inscription_ligne(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
if (INS_UTILISE_WIKINI) {
$res .= inscription_ligne (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI])."\n" ;
}
$res .= '</ul>'."\n";
if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
$res .= '<ul style="margin-top:10px; clear:both;">'."\n";
if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
if (INS_CHAMPS_LETTRE != '') {
if ($ligne[INS_CHAMPS_LETTRE] == 1) {
$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
}
$res .= '</ul>'."\n";
$res .= '<ul style="margin:15px;">'."\n";;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=modifier&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'">'.INS_MODIFIER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=supprimer&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'" onclick="javascript:return confirm(\''.INS_SUPPRIMER_INSCRIPTION.'?\');">'.INS_SUPPRIMER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
$res .= '</ul>'."\n";
$res .= '</div>'."\n"; //div fiche
}
//voir les abonnements presents dans les applis clientes
} elseif ($type_info=='abonnement') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_GESTION_DES_ABONNEMENTS.'</h2>'."\n" ;
// Appel des actions d'abonnement des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
$abonnement='';
$abonnements='';
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php')) {
require_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php' ;
$abonnements .= $abonnement;
}
}
$d->close();
$res .= $abonnements;
//voir les actus
} elseif ($type_info=='actus') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_ACTUALITES_DEPOSEES.'</h2>'."\n" ;
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'configuration'.GEN_SEP.'baz_config.inc.php';
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'bibliotheque'.GEN_SEP.'bazar.fonct.rss.php';
$_GET['action']=1;
$res .= RSSversHTML(gen_RSS('', '', $id, 1, ''), 0, 'jma', 0);
//voir les ressources
} elseif ($type_info=='ressources') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_RESSOURCES_ASSOCIEES.'</h2>'."\n" ;
$requete = 'SELECT bf_id_fiche, bf_titre FROM bazar_fiche, bazar_appropriation WHERE ba_ce_id_fiche=bf_id_fiche AND ba_ce_id_structure='.$id ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.INS_URL_BAZAR.'&amp;action=8&amp;id_fiche='.$ligne['bf_id_fiche'].'" onclick="window.open(this.href,\'_blank\');return false;">'.$ligne['bf_titre'].'</a></li>'."\n";
}
$res .= '</ul><br />'."\n";
//voir les competences
} elseif ($type_info=='competences') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_COMPETENCES_ASSOCIEES.'</h2>'."\n" ;
}
return $res ;
}
 
 
/** inscription_ligne() - Renvoie une ligne avec label et valeur
*
* @param string label Le label
* @param string valeur
* @return string HTML
*/
function inscription_ligne($label, $valeur) {
if ($valeur == '') {
return;
}
if (($label == '')or($label == '&nbsp;')) {
return '<div class="inscription_infos">'.$valeur.'</div>'."\n";
} else {
return '<div class="inscription_infos"><strong class="inscription_label">'."\n".$label.' : </strong>'.$valeur.'</div>'."\n";
}
}
 
 
/** Renvoie vrai si l'email passé en paramètre n'est pas déjà dans l'annuaire
* ou si, en cas de modification d'inscription, l'inscrit ne modifie pas son email
*
* @return boolean
*/
function inscription_verif_doublonMail($mail, $id = '') {
if ($id == '') {
if (isset ($GLOBALS['AUTH'])) {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
}
}
if (isset ($id) && $id != '') {
$requete_mail = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE." where ".
INS_CHAMPS_ID."=".$id ;
$resultat_mail = $GLOBALS['ins_db']->query ($requete_mail) ;
if (DB::isError ($resultat_mail)) {
die ("Echec de la requete : $requete_mail<br />".$resultat_mail->getMessage()) ;
}
$ligne_mail = $resultat_mail->fetchRow(DB_FETCHMODE_ASSOC) ;
if ($mail == $ligne_mail[INS_CHAMPS_MAIL]) {
return true ;
}
}
$requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE." where ".INS_CHAMPS_MAIL."= \"$mail\"" ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 0) return true ;
return false ;
}
 
 
function inscription_envoie_passe() {
$res='';
$requete = 'SELECT '.INS_CHAMPS_MAIL.' FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_MAIL.'="'.$_POST['mail'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 0) {
$res .= '<p class="erreur">'.INS_MAIL_INCONNU_DANS_ANNUAIRE.'</p>'."\n" ;
} else {
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$mail = & Mail::factory('smtp') ;
$headers ['Return-Path'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['From'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['Subject'] = INS_MOT_DE_PASSE_CHANGE ;
$headers ['Reply-To'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['To'] = "<".$_POST['mail'].">" ;
$nouveau_passe = create_new_random(6) ;
// modification du mot de passe dans la base
$requete = 'UPDATE '.INS_ANNUAIRE.' SET '.INS_CHAMPS_PASSE.'=MD5("'.$nouveau_passe.'") WHERE '.INS_CHAMPS_MAIL.'="'.$_POST['mail'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$body = INS_NOUVEAU_MOT_DE_PASSE_2.$nouveau_passe ;
$body .= INS_NOUVEAU_MOT_DE_PASSE_LAIUS ;
$mail->send($_POST['mail'], $headers, $body) ;
if (PEAR::isError($mail)) {
$res .= '<p class="erreur">'.INS_PROBLEME_ENVOI_MAIL.'</p>'."\n" ;
return $res ;
}
$res .= '<p class="info">'.INS_NOUVEAU_MOT_DE_PASSE_ENVOYE.'</p>'."\n" ;
}
return $res ;
}
 
/**
* Inscrit un adhérent à la lettre d'actualité par l'envoie d'un email subscribe / unsubscribe
* à la liste
*
* @global AUTH Un objet PEAR::Auth
* @return boolean true en cas de succès
*/
 
function inscription_lettre($action) {
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$mail = & Mail::factory ('smtp') ;
$email = $GLOBALS['AUTH']->getUsername() ;
$headers ['Return-Path'] = $email ;
$headers ['From'] = "<".$email.">" ;
$headers ['Subject'] = $action ;
$headers ['Reply-To'] = $email ;
$mail -> send ($action, $headers, "") ;
if (PEAR::isError ($mail)) {
echo '<p class="erreur">Le mail n\'est pas parti...</p>' ;
return false ;
}
return true ;
}
 
/**
*
* @global ins_db Un pointeur vers un objet PEAR::DB connecté
* @return
*/
 
function inscription_envoie_mail() //A COMPLETER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
include_once PAP_CHEMIN_RACINE.'api/pear/Mail/mime.php' ;
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$crlf="\n";
$headers ['From'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
$headers ['Subject'] = INS_MAIL_COORD_SUJET ;
$headers ['Reply-To'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
$mime = new Mail_mime($crlf);
$requete = "select *, ".INS_CHAMPS_LABEL_PAYS." from ".INS_ANNUAIRE.",".INS_TABLE_PAYS.
" where ".INS_CHAMPS_MAIL."=\"".$GLOBALS['AUTH']->getUsername()."\"".
" and ".INS_CHAMPS_ID_PAYS."=".INS_CHAMPS_PAYS;
 
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$body_entete = INS_MAIL_COORD_CORPS."\n" ;
$body = "mail : ".$ligne[INS_CHAMPS_MAIL]."\n" ;
$body .= "------------------------------------------\n";
$body .= INS_NOM.": ".unhtmlentities($ligne[INS_CHAMPS_NOM])." \n" ;
$body .= INS_PRENOM.' : '.unhtmlentities($ligne[INS_CHAMPS_PRENOM])." \n" ;
$body .= INS_PAYS." : ".unhtmlentities($ligne[INS_CHAMPS_LABEL_PAYS])." \n" ;
$body .= "-------------------------------------------\n" ;
$mime->setTXTBody($body);
$mime->setHTMLBody(info()) ;
$body = $mime->get();
$headers = $mime->headers($headers);
$mail = & Mail::factory('mail') ;
$mail -> send ($ligne[INS_CHAMPS_MAIL], $headers, $body) ;
// Envoi du mail aux administrateur du site
foreach ($GLOBALS['mail_admin'] as $administrateur) {
$mail -> send ($administrateur, $headers, $body) ;
}
if (PEAR::isError($mail)) {
echo 'erreur d\'envoi' ;
return false ;
}
return true ;
}
 
 
/**
* Génère un nom wiki valide à partir des données saisies par l'utilisateur
* fait une requete dans la base
*
* @return string un nom wiki valide
*/
 
function inscription_genere_nom_wiki($prenom, $nom) {
// 1. suppression des espaces
$nom = trim ($nom) ;
$prenom = trim ($prenom) ;
// 2. suppression des caractères non ascii et ajout de la première lettre en majuscule
$nom = inscription_trim_non_ascii ($nom) ;
$prenom = inscription_trim_non_ascii ($prenom) ;
// Vérification
$nom_wiki = $prenom.$nom ;
if (!preg_match('/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/', $nom_wiki)) {
$nom_wiki = chr(rand(65, 90)).$nom_wiki.chr(rand(65, 90)) ;
}
return $nom_wiki ;
}
 
/**
* Cette fonction supprime les caractères autres que asccii et les chiffres
*
* @return string la chaine épurée
*/
 
function inscription_trim_non_ascii ($nom) {
$premiere_lettre = true ;
for ($i = 0; $i < strlen ($nom); $i++) {
if (!preg_match ('/[a-zA-Z0-9]/', $nom[$i])) {
$nom[$i] = '_' ;
}
// remplacement de la première lettre en majuscule
if (preg_match ('/[a-zA-Z]/', $nom[$i]) && $premiere_lettre) {
$nom[$i] = strtoupper ($nom[$i]) ;
$premiere_lettre = false ;
} else {
if (preg_match ('/[a-zA-Z]/', $nom[$i])) {
$nom[$i] = strtolower ($nom[$i]) ;
}
}
}
$nom = preg_replace ('/_/', '', $nom) ;
return $nom ;
}
 
// For users prior to PHP 4.3.0 you may do this:
//function unhtmlentities($string)
//{
// $trans_tbl = array_flip ($trans_tbl);
// return strtr ($string, $trans_tbl);
//}
 
//==============================================================================
/** function create_new_random($n,$type) permet de générer un nombre de caractères aléatoires.
*
*
*
* ENTREE :
* - $n : créer un 'mot' de $n caractères
* - $type : permet de définir la liste des caractères disponibles
*
* SORTIE : chaine de $n caractères pris dans une liste $type
*/
function create_new_random($n,$type="")
{
$str = "";
 
switch ($type){
default:{
$chaine = "abcdefghkmnpqrstuvwxyzABCDEFGHKLMNPQRSTUVWXYZ23456789";
}
break;
}
srand((double)microtime()*1000000);
for($i = 0; $i < $n; $i++){
$str .= $chaine[rand()%strlen($chaine)];
}
return "$str";
}
 
//==============================================================================
/** function nextId () Renvoie le prochain identifiant numérique libre d'une table
*
* On passe en paramètre le nom de la table et l'identifiant de la base selon PEAR DB
*
* @param mixed handler de connexion
* @param string Nom de la table
* return interger l'identifiant
*/
function inscription_nextId($table, $colonne_identifiant)
{
$requete = 'select MAX('.$colonne_identifiant.') as maxi from '.$table ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die (__FILE__ . __LINE__ . $resultat->getMessage() . $requete);
return $GLOBALS['ins_db']->raiseError($resultat) ;
}
if ($resultat->numRows() > 1) {
return $GLOBALS['ins_db']->raiseError("<br />La table $table a un identifiant non unique<br/>") ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->maxi + 1 ;
}
 
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log$
* Revision 1.12 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.8.2.1 2007/01/26 10:28:43 alexandre_tb
* correction d un notice
*
* Revision 1.8 2006/12/01 13:23:15 florian
* integration annuaire backoffice
*
* Revision 1.7 2006/10/05 13:53:54 florian
* amélioration des fichiers sql
*
* Revision 1.6 2006/09/13 12:31:18 florian
* ménage: fichier de config Papyrus, fichiers temporaires
*
* Revision 1.5 2006/04/28 12:44:05 florian
* integration bazar
*
* Revision 1.4 2006/04/11 08:39:52 alexandre_tb
* correction de l'envoie de mail par la carto
*
* Revision 1.3 2006/04/10 14:21:51 florian
* correction bug affichage formulaire de mail en double
*
* Revision 1.2 2006/04/10 14:15:10 florian
* les cases à cocher apparaissent à nouveau
*
* Revision 1.1 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
*
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/inscription.fonct.php
New file
0,0 → 1,813
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.fonct.php,v 1.28 2007-04-20 08:39:37 alexandre_tb Exp $
/**
* Fonctions du module inscription
*
* Fonctions du module inscription
*
*@package inscription
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Florian Schmitt <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.28 $ $Date: 2007-04-20 08:39:37 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'inscription.fonct.wiki.php' ;
include_once 'inscription.class.php' ;
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
*
* @param array les valeurs renvoyés par le formulaire
* @return
*/
 
function demande_inscription($valeurs) {
// On stocke les informations dans un variable de session
// On coupe l'identifiant de session pour ne prendre que les 8 premiers caractères
// afin d'éviter d'obtenir une url trop longue
$chaine = substr (session_id(), 0, 8) ;
$requete_verif = 'select * from inscription_demande where id_identifiant_session="'.$chaine.'"' ;
$resultat_verif = $GLOBALS['ins_db']->query ($requete_verif) ;
if ($resultat_verif->numRows() != 0) {
$requete_suppression = 'delete from inscription_demande where id_identifiant_session="'.$chaine.'"' ;
$GLOBALS['ins_db']->query ($requete_suppression) ;
}
$requete = 'insert into inscription_demande set id_identifiant_session="'.$chaine.'", id_donnees="'.
addslashes(serialize($valeurs)).'", id_date=NOW()' ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError ($resultat)) {
echo ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
// On envoie un email de confirmation pour l'utilisateur
$GLOBALS['ins_url']->addQueryString ('id', $chaine) ;
if (INS_UTILISE_REECRITURE_URL) {
$url = 'http://'.$GLOBALS['ins_url']->host.'/'.INS_URL_PREFIXE.$chaine ;
} else {
$url = str_replace ('&amp;', '&', $GLOBALS['ins_url']->getURL()) ;
}
require_once PAP_CHEMIN_API_PEAR.'HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le gabarit du mail est dans un template
// template 2
$requete = 'select it_template from inscription_template where it_id_template=2'.
' and it_i18n like "%'.INS_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($GLOBALS['ins_db']->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('URL_INSCRIPTION', $url) ;
 
mail ($GLOBALS['email'], 'Inscription', $tpl->get(), 'From: '.INS_MAIL_ADMIN_APRES_INSCRIPTION) ;
}
 
/**
*
* @param array les valeurs renvoyés par le formulaire
* @return
*/
 
function inscription_validee($valeurs) {
insertion($valeurs) ;
$GLOBALS['AUTH']->username = $valeurs['email'] ;
$GLOBALS['AUTH']->password = $valeurs['mot_de_passe'] ;
// On loggue l'utilisateur
$GLOBALS['AUTH']->login() ;
// inscription à la lettre d'information
if (INS_CHAMPS_LETTRE != '' && isset ($valeurs['lettre'])) {
inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
}
}
 
/**
* Renvoie l'accueil de l'inscription
*
* @return string HTML
*/
function AUTH_formulaire_login() {
require_once PAP_CHEMIN_API_PEAR.'api/pear/HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le formulaire pour se logguer est dans un template
// template 1
$requete = 'SELECT it_template FROM inscription_template WHERE it_id_template=1'.
' AND it_i18n LIKE "%'.INS_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($GLOBALS['ins_db']->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('URL_INSCRIPTION', $GLOBALS['ins_url']->getURL());
return $tpl->get() ;
}
 
 
/** formulaire_envoi_passe() - Renvoie le code HTML d'un formulaire d'envoi de mot de passe par mail
*
* @return string HTML
*/
function formulaire_envoi_passe() {
$res = '<h2>'.INS_SI_PASSE_PERDU.'</h2>'."\n" ;
$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'&amp;action=sendpasswd" method="post">'."\n" ;
$res .= '<p class="label100">'.INS_EMAIL.' : </p>'."\n" ;
$res .= '<input type="text" value="';
if (isset($_POST['username'])) $res .= $_POST['username'];
$res .= '" name="mail" size="32" />'."\n" ;
$res .= '<input type="submit" value="'.INS_ENVOIE_PASSE.'" />' ;
$res .= '</form><br />'."\n" ;
$res .= AUTH_formulaire_login() ;
return $res;
}
 
 
function insertion($valeur) {
// =========== Insertion dans l'annuaire ===================
// Génération du nom wikini à partir du nom et du prénom
if (INS_UTILISE_WIKINI && INS_NOM_WIKINI_GENERE) {
$valeur['nom_wiki'] = genere_nom_wiki ($valeur['nom'], isset ($valeur['prenom']) ? $valeur['prenom'] : '') ;
} else {
if (!INS_NOM_WIKINI_GENERE) {
$valeur['nom_wiki'] = $valeur['nomwiki'];
}
}
$id_utilisateur = nextId(INS_ANNUAIRE, INS_CHAMPS_ID, $GLOBALS['ins_db']) ;
$requete = 'INSERT INTO '.INS_ANNUAIRE.' SET '.
INS_CHAMPS_ID.'="'.$id_utilisateur.'",'.
requete_annuaire($valeur) ;
 
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
 
// ================ Insertion dans SPIP =========================================
if (INS_UTILISE_SPIP) {
inscription_spip($id_utilisateur, $valeur) ;
}
if (INS_UTILISE_WIKINI) inscription_interwikini_users('', $valeur) ;
return $id_utilisateur ;
}
 
 
/**
* Réalise une mise à jour dans la base de donnée
*
* @param array un tableau de valeur avec en clé les noms des champs du formulaire
* @return void
*/
function mise_a_jour($valeur, $id = '') {
// ====================Mise à jour dans l'annuaire gen_annuaire ====================
if ($id == '') {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
}
$requete = 'update '.INS_ANNUAIRE.' set '.
requete_annuaire ($valeur).
'where '.INS_CHAMPS_ID.'="'.$id.'"';
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
unset ($resultat) ;
 
// ========================= Mise à jour dans SPIP ================================
if (INS_UTILISE_SPIP) {
mod_inscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID), $valeur) ;
}
}
 
/** requete_annuaire () - Renvoie une chaine contenant les champs de l'annuaire avec leur valeur suite à le fonction process de QuickForm
*
* @return string une requete du type champs="valeur",...
*/
 
function requete_annuaire($valeur) {
$req = INS_CHAMPS_NOM.'="'.addslashes($valeur['nom']).'", ';
if (isset($valeur['est_structure']) && $valeur['est_structure'] == 0)
$req .= INS_CHAMPS_PRENOM.'="'.addslashes($valeur['prenom']).'", ';
// Initialisation de variable pour éviter des notices
foreach (array ('adresse_1', 'adresse_2', 'ville', 'telephone', 'fax', 'site') as $val) {
if (!isset ($valeur[$val])) $valeur[$val] = '' ;
}
 
$req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
$req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
INS_CHAMPS_ADRESSE_2.'="'.addslashes($valeur['adresse_2']).'", '.
INS_CHAMPS_DATE_INSCRIPTION.'=NOW(), '.
INS_CHAMPS_CODE_POSTAL.'="'.addslashes($valeur['cp']).'", '.
INS_CHAMPS_VILLE.'="'.addslashes($valeur['ville']).'", '.
INS_CHAMPS_EST_STRUCTURE.'="'.addslashes($valeur['est_structure']).'", '.
INS_CHAMPS_TELEPHONE.'="'.addslashes($valeur['telephone']).'", '.
INS_CHAMPS_FAX.'="'.addslashes($valeur['fax']).'", '.
INS_CHAMPS_SITE_INTERNET.'="'.addslashes($valeur['site']).'" ';
if (isset($valeur['visible'])) $req .= ', '.INS_CHAMPS_VISIBLE.'="'.$valeur['visible'].'"';
else $req .= ', '.INS_CHAMPS_VISIBLE.'=0';
if (INS_CHAMPS_LETTRE != '') {
if (isset($valeur['lettre'])) {
$req .= ', '.INS_CHAMPS_LETTRE.'="'.$valeur['lettre'].'" ';
inscription_lettre('inscrire');
}
else {
$req .= ', '.INS_CHAMPS_LETTRE.'=0 ';
inscription_lettre('desinscrire');
}
}
if (isset($valeur['sigle_structure'])) {
$req .= ', '.INS_CHAMPS_SIGLE_STRUCTURE.'="'.addslashes($valeur['sigle_structure']).'"' ;
}
if (isset($valeur['num_agrement'])) {
$req .= ', '.INS_CHAMPS_NUM_AGREMENT.'="'.addslashes($valeur['num_agrement']).'"' ;
}
// traitement du numéro de département pour la france
if ($valeur['pays'] == 'FR') {
if (preg_match("/^97|98[0-9]*/", $valeur['cp'])) {
$n_dpt = substr($valeur['cp'], 0, 3) ;
} else {
$n_dpt = substr($valeur['cp'], 0, 2) ;
}
$req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
}
if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
return $req ;
}
 
 
 
/** formulaire_defaults() - Renvoie un tableau avec les valeurs par défaut du formulaire d'inscription
*
* @return array Valeurs par défaut du formulaire d'inscription
*/
function formulaire_defaults($id = '') {
if ($id == '') {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
}
$requete = 'select '.INS_ANNUAIRE.'.* '.
'from '.INS_ANNUAIRE.' '.
'where '.INS_ANNUAIRE.'.'.INS_CHAMPS_ID.'= "'.$id.'"' ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$valeurs_par_defaut = array() ;
$valeurs_par_defaut['email'] = $ligne[INS_CHAMPS_MAIL];
$valeurs_par_defaut['nom'] = $ligne[INS_CHAMPS_NOM];
$valeurs_par_defaut['prenom'] = $ligne[INS_CHAMPS_PRENOM] ;
$valeurs_par_defaut['pays'] = $ligne[INS_CHAMPS_PAYS] ;
if (INS_UTILISE_WIKINI) {$valeurs_par_defaut['nomwiki'] = $ligne[INS_CHAMPS_NOM_WIKINI] ;}
$valeurs_par_defaut['cp'] = $ligne[INS_CHAMPS_CODE_POSTAL] ;
$valeurs_par_defaut['ville'] = $ligne[INS_CHAMPS_VILLE] ;
$valeurs_par_defaut['adresse_1'] = $ligne[INS_CHAMPS_ADRESSE_1] ;
$valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
$valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
$valeurs_par_defaut['fax'] = $ligne[INS_CHAMPS_FAX] ;
if (INS_CHAMPS_STRUCTURE != '' && isset($ligne[INS_CHAMPS_STRUCTURE])) {
$valeurs_par_defaut['structure'] = $ligne[INS_CHAMPS_STRUCTURE] ;
//$valeurs_par_defaut['type_structure'] = $ligne['a_type_structure'];
}
$valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
$valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
$valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
$valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
if (INS_CHAMPS_NUM_AGREMENT != '') $valeurs_par_defaut['num_agrement'] = $ligne[INS_CHAMPS_NUM_AGREMENT] ;
return $valeurs_par_defaut ;
}
 
 
/** info() - Renvoie une fiche d'information sur la personne ou la structure
*
* @param integer identifiant de la fiche a afficher, mettre -1 pour voir sa propre fiche
* @param text nom de l'onglet de la fiche
*
* @return text Code HTML de la fiche
*/
function info($id=-1, $type_info='fiche') {
if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
$requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
.INS_CHAMPS_ID.'="'.$id.'"' ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
 
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
//voir la présentation de la fiche
if ($type_info=='fiche') {
if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
$res = '<h1>'.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_FICHE_STRUCTURE.'</h2>'."\n" ;
$res .= '<ul class="affiche_infos">'."\n";
$res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
} else {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_FICHE_PERSONNELLE.'</h2>'."\n" ;
$res .= '<ul class="affiche_infos">'."\n";
}
$res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
$res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
$res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
$res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
$pays = new ListeDePays($GLOBALS['ins_db']) ;
$res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
$res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
$res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
if (INS_UTILISE_WIKINI) {
$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
}
if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
$res .= ligne_inscription(INS_SITE_INTERNET, '<a href="'.$ligne[INS_CHAMPS_SITE_INTERNET].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[INS_CHAMPS_SITE_INTERNET].'</a>');
}
if ($GLOBALS['AUTH']->getAuth()) $res .= ligne_inscription(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
$res .= '</ul>'."\n";
if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
$res .= '<br />'."\n";
$res .= '<ul>'."\n";
if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
if (INS_CHAMPS_LETTRE != '') {
if ($ligne[INS_CHAMPS_LETTRE] == 1) {
$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
} else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
}
$res .= '</ul>'."\n";
$res .= '<br />'."\n";
$res .= '<ul>'."\n";;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=modifier&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'">'.INS_MODIFIER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=supprimer&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'" onclick="javascript:return confirm(\''.INS_SUPPRIMER_INSCRIPTION.'?\');">'.INS_SUPPRIMER_INSCRIPTION.'</a></li>'."\n" ;
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
$res .= '</ul>'."\n";
}
//voir les abonnements presents dans les applis clientes
} elseif ($type_info=='abonnement') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_GESTION_DES_ABONNEMENTS.'</h2>'."\n" ;
// Appel des actions d'abonnement des applications clientes
$d = dir(GEN_CHEMIN_CLIENT);
$abonnement='';
$abonnements='';
while (false !== ($repertoire = $d->read())) {
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php')) {
require_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php' ;
$abonnements .= $abonnement;
}
}
$d->close();
$res .= $abonnements;
//voir les actus
} elseif ($type_info=='actus') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_ACTUALITES_DEPOSEES.'</h2>'."\n" ;
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'configuration'.GEN_SEP.'baz_config.inc.php';
require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'bibliotheque'.GEN_SEP.'bazar.fonct.rss.php';
$_GET['action']=1;
$res .= RSSversHTML(gen_RSS('', '', $id, 1, ''), 0, 'jma', 0);
//voir les ressources
} elseif ($type_info=='ressources') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_RESSOURCES_ASSOCIEES.'</h2>'."\n" ;
$requete = 'SELECT bf_id_fiche, bf_titre FROM bazar_fiche, bazar_appropriation WHERE ba_ce_id_fiche=bf_id_fiche AND ba_ce_id_structure='.$id ;
$resultat = $GLOBALS['ins_db'] -> query($requete) ;
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.INS_URL_BAZAR.'&amp;action=8&amp;id_fiche='.$ligne['bf_id_fiche'].'" onclick="window.open(this.href,\'_blank\');return false;">'.$ligne['bf_titre'].'</a></li>'."\n";
}
$res .= '</ul><br />'."\n";
//voir les competences
} elseif ($type_info=='competences') {
$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
$res .= '<h2>'.INS_COMPETENCES_ASSOCIEES.'</h2>'."\n" ;
}
return $res ;
}
 
 
/** ligne_inscription() - Renvoie une ligne avec label et valeur
*
* @param string label Le label
* @param string valeur
* @return string HTML
*/
function ligne_inscription($label, $valeur) {
if ($valeur == '') {
return;
}
if (($label == '')or($label == '&nbsp;')) {
return '<li>'."\n".$valeur."\n".'</li>'."\n" ;
} else {
return '<li>'."\n".'<strong>'.$label.' : </strong>'."\n".$valeur."\n".'</li>'."\n" ;
}
}
 
 
/** Renvoie vrai si l'email passé en paramètre n'est pas déjà dans l'annuaire
* ou si, en cas de modification d'inscription, l'inscrit ne modifie pas son email
*
* @return boolean
*/
function verif_doublonMail($mail, $id = '') {
if ($id == '') {
if (isset ($GLOBALS['AUTH'])) {
$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
}
}
if (isset ($id) && $id != '') {
$requete_mail = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE." where ".
INS_CHAMPS_ID."=".$id ;
$resultat_mail = $GLOBALS['ins_db']->query ($requete_mail) ;
if (DB::isError ($resultat_mail)) {
die ("Echec de la requete : $requete_mail<br />".$resultat_mail->getMessage()) ;
}
$ligne_mail = $resultat_mail->fetchRow(DB_FETCHMODE_ASSOC) ;
if ($mail == $ligne_mail[INS_CHAMPS_MAIL]) {
return true ;
}
}
$requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE." where ".INS_CHAMPS_MAIL."= \"$mail\"" ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 0) return true ;
return false ;
}
 
 
function envoie_passe() {
$res='';
$requete = 'SELECT '.INS_CHAMPS_MAIL.' FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_MAIL.'="'.$_POST['mail'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 0) {
$res .= '<p class="erreur">'.INS_MAIL_INCONNU_DANS_ANNUAIRE.'</p>'."\n" ;
} else {
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$mail = & Mail::factory('smtp') ;
$headers ['Return-Path'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['From'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['Subject'] = INS_MOT_DE_PASSE_CHANGE ;
$headers ['Reply-To'] = "<".INS_MAIL_ADMIN_APRES_INSCRIPTION.">" ;
$headers ['To'] = "<".$_POST['mail'].">" ;
$nouveau_passe = create_new_random(6) ;
// modification du mot de passe dans la base
$requete = 'UPDATE '.INS_ANNUAIRE.' SET '.INS_CHAMPS_PASSE.'=MD5("'.$nouveau_passe.'") WHERE '.INS_CHAMPS_MAIL.'="'.$_POST['mail'].'"' ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$body = INS_NOUVEAU_MOT_DE_PASSE_2.$nouveau_passe ;
$body .= INS_NOUVEAU_MOT_DE_PASSE_LAIUS ;
$mail->send($_POST['mail'], $headers, $body) ;
if (PEAR::isError($mail)) {
$res .= '<p class="erreur">'.INS_PROBLEME_ENVOI_MAIL.'</p>'."\n" ;
return $res ;
}
$res .= '<p class="info">'.INS_NOUVEAU_MOT_DE_PASSE_ENVOYE.'</p>'."\n" ;
}
return $res ;
}
 
/**
* Inscrit un adhérent à la lettre d'actualité par l'envoie d'un email subscribe / unsubscribe
* à la liste
*
* @global AUTH Un objet PEAR::Auth
* @return boolean true en cas de succès
*/
 
function inscription_lettre($action) {
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$mail = & Mail::factory ('smtp') ;
$email = $GLOBALS['AUTH']->getUsername() ;
$headers ['Return-Path'] = $email ;
$headers ['From'] = "<".$email.">" ;
$headers ['Subject'] = $action ;
$headers ['Reply-To'] = $email ;
$mail -> send ($action, $headers, "") ;
if (PEAR::isError ($mail)) {
echo '<p class="erreur">Le mail n\'est pas parti...</p>' ;
return false ;
}
return true ;
}
 
/**
*
* @global ins_db Un pointeur vers un objet PEAR::DB connecté
* @return
*/
 
function envoie_mail() //A COMPLETER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
include_once PAP_CHEMIN_RACINE.'api/pear/Mail/mime.php' ;
include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
$crlf="\n";
$headers ['From'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
$headers ['Subject'] = INS_MAIL_COORD_SUJET ;
$headers ['Reply-To'] = INS_MAIL_ADMIN_APRES_INSCRIPTION ;
$mime = new Mail_mime($crlf);
$requete = "select *, ".INS_CHAMPS_LABEL_PAYS." from ".INS_ANNUAIRE.",".INS_TABLE_PAYS.
" where ".INS_CHAMPS_MAIL."=\"".$GLOBALS['AUTH']->getUsername()."\"".
" and ".INS_CHAMPS_ID_PAYS."=".INS_CHAMPS_PAYS;
 
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$body_entete = INS_MAIL_COORD_CORPS."\n" ;
$body = "mail : ".$ligne[INS_CHAMPS_MAIL]."\n" ;
$body .= "------------------------------------------\n";
$body .= INS_NOM.": ".unhtmlentities($ligne[INS_CHAMPS_NOM])." \n" ;
$body .= INS_PRENOM.' : '.unhtmlentities($ligne[INS_CHAMPS_PRENOM])." \n" ;
$body .= INS_PAYS." : ".unhtmlentities($ligne[INS_CHAMPS_LABEL_PAYS])." \n" ;
$body .= "-------------------------------------------\n" ;
$mime->setTXTBody($body);
$mime->setHTMLBody(info()) ;
$body = $mime->get();
$headers = $mime->headers($headers);
$mail = & Mail::factory('mail') ;
$mail -> send ($ligne[INS_CHAMPS_MAIL], $headers, $body) ;
// Envoi du mail aux administrateur du site
foreach ($GLOBALS['mail_admin'] as $administrateur) {
$mail -> send ($administrateur, $headers, $body) ;
}
if (PEAR::isError($mail)) {
echo 'erreur d\'envoi' ;
return false ;
}
return true ;
}
 
 
/**
* Génère un nom wiki valide à partir des données saisies par l'utilisateur
* fait une requete dans la base
*
* @return string un nom wiki valide
*/
 
function genere_nom_wiki($prenom, $nom) {
// 1. suppression des espaces
$nom = trim ($nom) ;
$prenom = trim ($prenom) ;
// 2. suppression des caractères non ascii et ajout de la première lettre en majuscule
$nom = trim_non_ascii ($nom) ;
$prenom = trim_non_ascii ($prenom) ;
// Vérification
$nom_wiki = $prenom.$nom ;
if (!preg_match('/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/', $nom_wiki)) {
$nom_wiki = chr(rand(65, 90)).$nom_wiki.chr(rand(65, 90)) ;
}
return $nom_wiki ;
}
 
/**
* Cette fonction supprime les caractères autres que asccii et les chiffres
*
* @return string la chaine épurée
*/
 
function trim_non_ascii ($nom) {
$premiere_lettre = true ;
for ($i = 0; $i < strlen ($nom); $i++) {
if (!preg_match ('/[a-zA-Z0-9]/', $nom[$i])) {
$nom[$i] = '_' ;
}
// remplacement de la première lettre en majuscule
if (preg_match ('/[a-zA-Z]/', $nom[$i]) && $premiere_lettre) {
$nom[$i] = strtoupper ($nom[$i]) ;
$premiere_lettre = false ;
} else {
if (preg_match ('/[a-zA-Z]/', $nom[$i])) {
$nom[$i] = strtolower ($nom[$i]) ;
}
}
}
$nom = preg_replace ('/_/', '', $nom) ;
return $nom ;
}
 
// For users prior to PHP 4.3.0 you may do this:
function unhtmlentities($string)
{
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
return strtr ($string, $trans_tbl);
}
 
//==============================================================================
/** function create_new_random($n,$type) permet de générer un nombre de caractères aléatoires.
*
*
*
* ENTREE :
* - $n : créer un 'mot' de $n caractères
* - $type : permet de définir la liste des caractères disponibles
*
* SORTIE : chaine de $n caractères pris dans une liste $type
*/
function create_new_random($n,$type="")
{
$str = "";
 
switch ($type){
default:{
$chaine = "abcdefghkmnpqrstuvwxyzABCDEFGHKLMNPQRSTUVWXYZ23456789";
}
break;
}
srand((double)microtime()*1000000);
for($i = 0; $i < $n; $i++){
$str .= $chaine[rand()%strlen($chaine)];
}
return "$str";
}
 
//==============================================================================
/** function nextId () Renvoie le prochain identifiant numérique libre d'une table
*
* On passe en paramètre le nom de la table et l'identifiant de la base selon PEAR DB
*
* @param mixed handler de connexion
* @param string Nom de la table
* return interger l'identifiant
*/
 
function nextId($table, $colonne_identifiant)
{
$requete = 'select MAX('.$colonne_identifiant.') as maxi from '.$table ;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die (__FILE__ . __LINE__ . $resultat->getMessage() . $requete);
return $GLOBALS['ins_db']->raiseError($resultat) ;
}
if ($resultat->numRows() > 1) {
return $GLOBALS['ins_db']->raiseError("<br />La table $table a un identifiant non unique<br/>") ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->maxi + 1 ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.27 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.23 2006/12/01 13:23:15 florian
* integration annuaire backoffice
*
* Revision 1.22 2006/10/05 13:53:53 florian
* amélioration des fichiers sql
*
* Revision 1.21 2006/09/20 13:10:01 alexandre_tb
* Ajout d'un test sur la lettre d'actualité
*
* Revision 1.20 2006/07/06 10:33:58 alexandre_tb
* Suppression d'un warning
*
* Revision 1.19 2006/07/04 09:39:27 alexandre_tb
* correction d'un bug mineur
*
* Revision 1.18 2006/06/01 14:42:20 alexandre_tb
* suppression d'un commentaire inutile
*
* Revision 1.17 2006/04/28 12:44:05 florian
* integration bazar
*
* Revision 1.16 2006/04/11 08:41:41 alexandre_tb
* Ajout du champs nom wiki dans le formulaire si la constante INS_GENERE_NOM_WIKI n'est pas activé
*
* Revision 1.15 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
* Revision 1.14 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.13 2006/03/21 10:25:33 alexandre_tb
* ajout d'un template pour le mail de confirmation
*
* Revision 1.12 2006/03/15 11:02:35 alexandre_tb
* ajout de l'insertion du prénom qui avait disparu
*
* Revision 1.11 2006/03/02 16:57:31 alexandre_tb
* correction appel au générateur de nom wiki
*
* Revision 1.10 2006/02/28 14:02:20 alexandre_tb
* suppression des insertion dans les tables du bazar
*
* Revision 1.9 2006/02/14 10:19:10 alexandre_tb
* Mise en place des templates
* CREATE TABLE `inscription_template` (
* `it_id_template` smallint(5) unsigned NOT NULL default '0',
* `it_i18n` varchar(5) NOT NULL default '',
* `it_template` text NOT NULL,
* PRIMARY KEY (`it_id_template`)
* ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
*
* Revision 1.8 2006/01/02 09:51:38 alexandre_tb
* généralisation du code et intégration au bottin
*
* Revision 1.7 2005/12/19 13:19:07 alexandre_tb
* Correction de l'affichage des pays
*
* Revision 1.6 2005/11/24 16:17:52 florian
* changement template inscription + modifs carto
*
* Revision 1.5 2005/11/18 16:04:15 florian
* corrections de bugs, optimisations, tests pour rendre inscription stable.
*
* Revision 1.4 2005/11/17 18:48:02 florian
* corrections bugs + amélioration de l'application d'inscription
*
* Revision 1.3 2005/10/03 09:45:21 alexandre_tb
* suppression d'un echo
*
* Revision 1.2 2005/09/29 13:56:48 alexandre_tb
* En cours de production. Reste à gérer les news letters et d'autres choses.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.3 2005/03/21 16:57:30 florian
* correction de bug, mise à jour interface
*
* Revision 1.2 2004/12/17 17:41:51 alex
* ajout du numéro de tel, du fax et de la structure
*
* Revision 1.1 2004/12/15 13:32:25 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent4e02f3d287ff451b28c7acd51fee072e.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent4e02f3d287ff451b28c7acd51fee072e.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/vide.txt
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continenta729e2de4cac4495743c2af70cfd6cb5.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continentecf6c7b537d24ab0698ff6154584c915.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continentecf6c7b537d24ab0698ff6154584c915.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent0bfaa9187a3b23e6cd9ee3e3cc3210a9.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent0bfaa9187a3b23e6cd9ee3e3cc3210a9.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent9c3720856d2c6a319cc4649a19c79557.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent9c3720856d2c6a319cc4649a19c79557.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent771ce0ad55596625a6242d5101ba3de6.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent771ce0ad55596625a6242d5101ba3de6.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent87413cb2f49ab95a7332a98e39361db5.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent87413cb2f49ab95a7332a98e39361db5.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continentc1f9f0d0e489b7ae8617a5304d91583d.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continentc1f9f0d0e489b7ae8617a5304d91583d.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent0da6482d48a9e57af6b9c4fe6c56f30b.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continent0da6482d48a9e57af6b9c4fe6c56f30b.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continente7951401ce28bb8a3c3a83a2d2cc2260.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/bibliotheque/tmp/carto/continente7951401ce28bb8a3c3a83a2d2cc2260.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/bibliotheque/annuaire.fonct.php
New file
0,0 → 1,327
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.fonct.php,v 1.7 2007-04-11 08:30:12 neiluj Exp $
/**
* Fonctions du module annuaire
*
* Fonctions du module annuaire
*
*@package annuaire
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
//include_once "HTML/QuickForm.php" ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/** function inscription_onglets() Affiche les onglets de présentation de la structure
*
*
*
* @return string HTML
*/
function inscription_onglets() {
$res='<ul id="onglets_inscription">'."\n";
//partie présentation
$GLOBALS['ins_url']->addQueryString('voir_fiche', $_GET['voir_fiche']);
$res .= '<li id="fiche"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_PRESENTATION.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_fiche');
//partie abonnement
$GLOBALS['ins_url']->addQueryString('voir_abonnement', $_GET['voir_fiche']);
$res .= '<li id="abonnements"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ABONNEMENTS.'</a></li>'."\n" ;
$GLOBALS['ins_url']->removeQueryString('voir_abonnement');
//partie actualites
$GLOBALS['ins_url']->addQueryString('voir_actus', $_GET['voir_fiche']);
$res .= '<li id="actus"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ACTUALITES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_actus');
//partie ressources
$GLOBALS['ins_url']->addQueryString('voir_ressources', $_GET['voir_fiche']);
$res .= '<li id="ressources"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_RESSOURCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_ressources');
//partie competences
$GLOBALS['ins_url']->addQueryString('voir_competences', $_GET['voir_fiche']);
$res .= '<li id="competences"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_COMPETENCES.'</a>'."\n".'</li>'."\n";
$GLOBALS['ins_url']->removeQueryString('voir_competences');
$res.= '</ul>'."\n";
return $res;
}
 
/** function Annuaire_recherche () Moteur de recherche dans l'annuaire des inscrits
*
*
*
* @return string HTML
*/
function Annuaire_recherche() {
$res ='<h2>'.INS_RECHERCHE_ANNUAIRE_DES_INSCRITS.'</h2>'."\n";
$form =& new HTML_QuickForm('form_recherche_annuaire', 'post', str_replace('&amp;', '&', $GLOBALS['ins_url']->getURL()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".
'<td style="padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </td>'."\n".
'<td style="padding:5px;text-align:left;">{element}</td>'."\n".
'</tr>'."\n" );
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan=2 style="padding:5px;">{label}{element}</td>'."\n".'</tr>'."\n", 'bouton_rechercher');
$option_type=array ('0' => INS_PERSONNES_OU_STRUCTURES,
'1' => INS_PERSONNES,
'2' => INS_STRUCTURES);
$form->addElement('select', 'nom_type', INS_JE_RECHERCHE, $option_type);
//requete pour recuperer la liste des pays
$requete = 'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' FROM '.INS_TABLE_PAYS.' WHERE '.INS_CHAMPS_I18N_PAYS.'="fr-FR"';
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_pays = array('zz' => INS_TOUS_PAYS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_pays[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
}
$form->addElement('select', 'nom_pays', INS_PAYS, $option_pays);
//requete pour recuperer la liste des départements
$requete = 'SELECT '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' FROM '.INS_TABLE_DPT;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$option_departements = array('0' => INS_TOUS_DEPARTEMENTS) ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$option_departements[$ligne[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne[INS_CHAMPS_NOM_DEPARTEMENT] ;
}
$form->addElement('select', 'nom_departement', INS_DEPARTEMENT_POUR_LA_FRANCE, $option_departements);
$form->addElement('text', 'nom_annuaire', INS_NOM_ANNUAIRE);
$form->addElement('submit', 'bouton_rechercher', INS_RECHERCHER);
//valeurs par defaut
$defauts=array('nom_pays'=>'fr','nom_departement'=>'0');
$form->setDefaults($defauts);
//affichage du formulaire
$res .=$form->toHtml();
//on teste si l'on affiche le resultat de la recherche ou
if (isset($_POST['nom_type'])) {
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
$req_where=0;
if ($_POST['nom_type']==1) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=0 ';
$req_where=1;
} elseif ($_POST['nom_type']==2) {
$requete .= INS_CHAMPS_EST_STRUCTURE.'=1 ';
$req_where=1;
}
if ($_POST['nom_pays']!='0'and$_POST['nom_pays']!='zz') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_PAYS.'="'.$_POST['nom_pays'].'" ';
}
if ($_POST['nom_departement']!='0') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= INS_CHAMPS_DEPARTEMENT.'="'.$_POST['nom_departement'].'" ';
}
if ($_POST['nom_annuaire']!='') {
if ($req_where) {
$requete .= 'AND ';
} else {
$req_where=1;
}
$requete .= '('.INS_CHAMPS_NOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_PRENOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_SIGLE_STRUCTURE.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
' OR '.INS_CHAMPS_DESCRIPTION.' LIKE "%'.$_POST['nom_annuaire'].'%") ';
}
if (!$req_where) $requete .= '1';
$requete .=' ORDER BY '.INS_CHAMPS_NOM;
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.' ('.$resultat->numRows().' '.INS_ENTREES.')</h2>'."\n";
$res .='<p class="zone_info">'.INS_CLIQUER_ELEMENT_LISTE.'</p>'."\n";
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres);
}
else {
$res .='<h2>'.INS_RESULTATS_RECHERCHE.'</h2>'."\n";
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
} else {
$res .='<h2>'.INS_DIX_DERNIERES_INSCRIPTIONS.'</h2>'."\n";
$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
$requete .= ' FROM '.INS_ANNUAIRE.' ORDER BY '.INS_CHAMPS_DATE.' DESC LIMIT 0 , 10';
$resultat = $GLOBALS['ins_db']->query($requete);
if ($resultat->numRows()>0) {
$i=0;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$donnees_membres[$i++]=$ligne;
}
$res .= listes_inscrit($donnees_membres, 0);
}
else {
$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
}
}
return $res ;
}
 
/**
* Renvoie le code HTML de la liste des inscrits
* en fonction de la requete passé en parametre
*
* @return Renvoie le code HTML de la liste des inscrits
*/
 
function listes_inscrit(& $donnees_membres, $affiche_form_mail=1) {
$res = '';
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";}
$res .= '<ul>'."\n";
for ($i=0;$i<count($donnees_membres);$i++) {
$id = array_shift($donnees_membres[$i]);
$GLOBALS['ins_url']->addQueryString('voir_fiche', $id);
$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'">'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res.='<input type="checkbox" name="select[]" value="'.$id.'">'."\n";
}
$res .= '<strong>'.$donnees_membres[$i][INS_CHAMPS_NOM].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_PRENOM].'</strong>'."\n".
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_CODE_POSTAL].
'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_VILLE];
$res .= '</a></li>'."\n";
}
$res .= '</ul>'."\n";
if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
$res .= INS_CHECK_UNCHECK ;
$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"><br />';
$res .= '<h3>'.INS_ENVOYER_MAIL.'</h3>'."\n";
$res .= '<p style="text-align:right;">'.INS_SUJET.'&nbsp;:&nbsp;<input style="border:1px solid #000;width:450px;" type="text" name="titre_mail"><br />'."\n".
INS_MESSAGE.'&nbsp;:&nbsp;<textarea style="border:1px solid #000;width:450px;" name="corps" rows="5" cols="60"></textarea></p>'."\n".
'<p style="width:100px;margin:4px auto;text-align:center;"><input type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
'</form>'."\n";
} else {
if ($affiche_form_mail) $res .='<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
}
return $res ;
}
 
 
 
/** envoie_mail_depuis_annuaire()
*
*
* @return envoie l'email
*/
 
function envoie_mail_depuis_annuaire() {
$requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE.
" where ".INS_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)."'";
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
$_POST['corps'] .= ANN_PIED_MESSAGE;
$_POST['corps'] = stripslashes($_POST['corps']) ;
$liste = "" ;
$liste_numero = implode (',', $_POST['select']) ;
$requete_liste_mail = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.
' in ('.$liste_numero.')' ;
$resultat_liste_mail = $GLOBALS['ins_db']->query($requete_liste_mail);
while ($ligne_liste_mail = $resultat_liste_mail->fetchRow(DB_FETCHMODE_ASSOC)) {
mail ($ligne_liste_mail[INS_CHAMPS_MAIL], stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
$liste .= $ligne_liste_mail[INS_CHAMPS_MAIL]."\n" ;
}
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
$_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
mail (INS_MAIL_ADMIN_APRES_INSCRIPTION, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
$_POST['corps'] = '';
$_POST['titre_mail'] = '';
return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
* Revision 1.3 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.2 2005/09/29 16:13:54 alexandre_tb
* En cours de production.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.3 2005/03/24 08:24:29 alex
* --
*
* Revision 1.2 2005/01/06 15:18:31 alex
* modification de la fonction de formulaire d'authentification
*
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
* Import initial
*
* Revision 1.1 2005/01/03 17:18:49 alex
* retour vers la liste des participants après un ajout.
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/inscription.fonct.wiki.php
New file
0,0 → 1,153
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.fonct.wiki.php,v 1.6 2007-04-11 08:30:12 neiluj Exp $
/**
* Fonctions wikini
*
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
*
*@package inscription
*@subpackage fonctions_wikini
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function inscription_interwikini_users($id, $valeur) {
// On vérifie l'existance du nom wiki dans interwikini_users
$requete_verif = 'select name from interwikini_users where name="'.$valeur['nom_wiki'].'"';
$resultat_verif = $GLOBALS['ins_db']->query ($requete_verif) ;
if (DB::isError($resultat_verif)) {
echo ("Echec de la requete dans interwikini_users<br />".$resultat_verif->getMessage()) ;
}
if ($resultat_verif->numRows() != 0) {
return ;
}
$requete = "insert into interwikini_users set name=\"".$valeur['nom_wiki'].
"\", password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"".
', signuptime=now()' ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
}
}
 
function mod_inscription_interwikini_users($nomwiki, $valeur) {
$requete = "update interwikini_users set password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"".
" where name=\"$nomwiki\"" ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
}
}
 
function desinscription_interwikini_users($nomwiki) {
$requete = "delete from interwikini_users where name=\"$nomwiki\"" ;
$resultat = $GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
}
}
 
function verif_doublonNomWiki($nom_wiki) {
global $db ;
$requete = "select name from interwikini_users where name = \"$nom_wiki\"" ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 0) return true ;
return false ;
}
 
function wiki_cookie() {
if ($userid != "") {
// 1. name
// On recherche le nom
$nomwikini = $AUTH->getAuthData('ga_login') ;
setcookie ("name", $nomwikini, time () + 3600 * 24 * 30, "/" ) ; // 1 mois
//2. password
// on recherche le mot de passe crypté
$requete = "select ga_mot_de_passe from gen_annuaire where ga_id_administrateur=$userid" ;
$resultat = $db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Erreur") ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$mot_de_passe = $ligne->ga_mot_de_passe ;
setcookie ("password", $mot_de_passe, time () + 3600 * 24 * 30, "/") ;
// 3. remember
setcookie ("remember", 1, time () + 3600 * 24 * 30, "/") ;
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2006/07/04 09:39:03 alexandre_tb
* correction d'un bug mineur
*
* Revision 1.3 2006/04/11 08:42:07 alexandre_tb
* Vérification de l'existance d'un nom wiki avant son insertion
*
* Revision 1.2 2005/09/29 13:56:48 alexandre_tb
* En cours de production. Reste à gérer les news letters et d'autres choses.
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.2 2005/03/21 16:57:30 florian
* correction de bug, mise à jour interface
*
* Revision 1.1 2004/12/15 13:32:25 alex
* version initiale
*
* Revision 1.1 2004/07/06 15:42:17 alex
* en cours
*
* Revision 1.1 2004/06/18 09:20:48 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
 
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/lib.carto.php
New file
0,0 → 1,1261
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
* Fichier regroupant toutes les classes de la carto
*
*Toutes les classe de la carto sont disponibles dans ce fichier.
*
*@package carto
//Auteur original :
*@author Nicolas MATHIEU
//Autres auteurs :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2003
*@version 01 juillet 2002
// +-----------------------------------------------------------------------------------------------+
//
// $Id: lib.carto.php,v 1.9 2007-04-20 14:16:45 alexandre_tb Exp $
// FICHIER : $RCSfile: lib.carto.php,v $
// AUTEUR : $Author: alexandre_tb $
// VERSION : $Revision: 1.9 $
// DATE : $Date: 2007-04-20 14:16:45 $
//
// +-----------------------------------------------------------------------------------------------+
// A FAIRE :
// 1.-Rendre cette classe indépendante de l'arborescence du site.
// On trouve encore des urls ou des chemins d'accé au fichier codé en dur dans l'appli
// Il faudrait pouvoir les paramétrés dans la classe.
// 2.- Supprimer l'attribut $this->historiques qui doit être devenu complétement obscoléte et le
// remplacer par $this->historique_cartes
// 3.- Renomer $this->liste_zone_carte en quelque chose de plus parlant...
*/
//Inclusion d'un autre fichier de librairie
include_once 'lib.couleur.php';
 
//Sert seulement en interne pour le débogage des requetes SQL
$NOM_FICHIER = 'lib.carto.php';
 
//==================================================================================================
// La classe Carto_HistoriqueCarte sert à pouvoir afficher les liens avec les carte précédentes
// On accède à cette fonctionnalité grâce à la méthode afficherHistoriqueCarte()
// L'objet Carto_HistoriqueCarte recoit en parametres :
// -la généalogie du niveau ou on en est (du type monde*europe*france )
// -l'url du document
// -en option : *le caractere de separation (par defaut c'est >)
// *la classe css des liens
//===================================================================================================
 
class Carto_HistoriqueCarte
{
var $historique;
var $url;
var $caractere_separation;
var $class_css;
var $nom;
 
function Carto_HistoriqueCarte ($objet_carte, $caractere = '&gt;', $class = '')
{
global $GS_GLOBAL;
 
$this->historique = $objet_carte->historique;
$this->url = $objet_carte->url;
$this->nom = $objet_carte->nom;
unset ($objet_carte);
$this->caractere_separation = $caractere;
$this->class_css = $class;
}//Fin du constructeur Carto_HistoriqueCarte().
function afficherHistoriqueCarte ()
{
$res='<div style="float:left;">'.INS_ECHELLE;
$tabonglet = explode ('*', $this->historique);
$tabnom = explode ('*', $this->nom);
foreach ($tabonglet as $key=>$value) {
if ($key == 0) {
$chemin = $value;
}
else {
$chemin .= '*'.$value;
}
$res.= '<a ';
if (!empty($this->class_css)) {
$res.='class="'.$this->class_css.'" ';
}
$res.='href="'.$this->url.'&amp;historique_cartes='.$chemin.'">&nbsp;'.$this->caractere_separation.'&nbsp;'.$tabnom[$key].'</a>';
}
$res.= '</div>'."\n";
return $res;
}//Fin de la méthode afficherHistoriqueCarte().
 
}//Fin de la classe Carto_HistoriqueCarte.
 
//================================================================================================
//La classe Action sert a definir les paramètres nécessaires pour recueillir l'action a réaliser en
// fonction des coordonnées du point, du masque et du niveau.
//Elle remplace la fonction get_cartoAction() que l'on peut trouver dans le fichier carto_commun.php
//des différentes application utilisant la carto.
// Les champs a renseigner sont les suivants :
// -le nom de la table ($nom_table_carto_action) où sont stokée les actions à réalisées
// en fonction des couleurs
// -les 5 champs principaux de la table :
// -l'identifiant de la zone géographique (un nom, un numéro ou une abréviation) -> $nom_champ_cle
// -les couleurs -> $nom_champ_rouge, $nom_champ_vert, $nom_champ_bleu
// -l'action -> $nom_champ_action
// Elle possède une seule méthode : get_cartoAction().
//================================================================================================
 
class Carto_Action
{
var $_table_zone_geo;
var $_id_zone_geo_zone;
var $_rouge;
var $_vert;
var $_bleu;
var $_table_action;
var $_id_carte_action;
var $_id_zone_geo_action;
var $_type_zone_geo_action;
var $_action;
var $_id_carte_destination;
function Carto_Action ($table_zone_geo, $zone_chp_id_zone, $chp_rouge,
$chp_vert, $chp_bleu, $table_carto_action, $action_chp_id_carte, $action_chp_id_zone,
$action_chp_type_zone, $chp_action, $chp_destination)
{
$this->_table_zone_geo = $table_zone_geo;
$this->_id_zone_geo_zone = $zone_chp_id_zone;
$this->_rouge = $chp_rouge;
$this->_vert = $chp_vert;
$this->_bleu = $chp_bleu;
$this->_table_action = $table_carto_action;
$this->_id_carte_action = $action_chp_id_carte;
$this->_id_zone_geo_action = $action_chp_id_zone;
$this->_type_zone_geo_action = $action_chp_type_zone;
$this->_action = $chp_action;
$this->_id_carte_destination = $chp_destination;
}
//**********************************************************************************************************
// Méthode get_cartoAction($imageX, $imageY, $masque, $id_carte)
// Elle renvoit l'action a réaliser.
// Nous passons les paramètres suivant :
// -les coordonnees du point ($imageX et $imageY)
// -le masque pour recuperer la couleur ($masque)
// -l'identifiant de la carte où nous nous trouvons ($id_carte)
//**********************************************************************************************************
function _consulterActionImage($imageX, $imageY, $masque, $id_carte)
{
// Nous récuperons les valeurs RVB de la couleur sur laquelle l'utilisateur a cliqué.
// Les valeurs RVB sont stockées dans le tableau associatif $valeurs_RVB.
$masque_courant = imagecreatefrompng($masque);
$index_couleur = imagecolorat($masque_courant,$imageX,$imageY);
$valeurs_RVB = imagecolorsforindex($masque_courant, $index_couleur);
// Nous effectuons une requete dans la table carto_ACTION pour récupérer la valeur
// du champ "action", afin de savoir quoi faire.
$requete =
'SELECT '.$this->_action.', '.$this->_id_carte_destination.', '.$this->_id_zone_geo_action.
' FROM '.$this->_table_action.', '.$this->_table_zone_geo.
' WHERE '.$this->_table_zone_geo.'.'.$this->_rouge.' = '.$valeurs_RVB['red'].
' AND '.$this->_table_zone_geo.'.'.$this->_vert.' = '.$valeurs_RVB['green'].
' AND '.$this->_table_zone_geo.'.'.$this->_bleu.' = '.$valeurs_RVB['blue'].
' AND '.$this->_table_action.'.'.$this->_id_zone_geo_action.' = '.$this->_table_zone_geo.'.'.$this->_id_zone_geo_zone.
' AND '.$this->_table_action.'.'.$this->_id_carte_action.' = "'.$id_carte.'"';
$resultat=mysql_query($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
if (mysql_num_rows ($resultat) != 0) {
$chp_id_zone_geo = $this->_id_zone_geo_action;
$chp_action = $this->_action;
$chp_id_carte_destination = $this->_id_carte_destination;
$action['id_zone_geo'] = $ligne->$chp_id_zone_geo;
$action['type_action'] = $ligne->$chp_action;
$action['id_carte_destination'] = $ligne->$chp_id_carte_destination;
return $action;
}
}//Fin de la méthode _consulterActionImage().
//**********************************************************************************************************
// Méthode _consulterActionListe($id_zone_carte, $id_carte)
// Elle renvoit l'action a réaliser.
// Nous passons les paramètres suivant :
// -l'identifiant de la zone que l'on veut afficher
// -l'identifiant de la carte où nous nous trouvons ($id_carte)
//**********************************************************************************************************
function _consulterActionListe($id_zone_carte, $id_carte)
{
// Nous effectuons une requete dans la table carto_ACTION pour récupérer la valeur
// du champ "action", afin de savoir quoi faire.
$requete =
'SELECT '.$this->_action.', '.$this->_id_carte_destination.', '.$this->_id_zone_geo_action.
' FROM '.$this->_table_action.', '.$this->_table_zone_geo.
' WHERE '.$this->_table_action.'.'.$this->_id_zone_geo_action.' = '.$this->_table_zone_geo.'.'.$this->_id_zone_geo_zone.
' AND '.$this->_table_zone_geo.'.'.$this->_id_zone_geo_zone.' = "'.$id_zone_carte.'"'.
' AND '.$this->_table_action.'.'.$this->_id_carte_action.' = "'.$id_carte.'"';
$resultat=mysql_query($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
if (mysql_num_rows ($resultat) != 0) {
$chp_id_zone_geo = $this->_id_zone_geo_action;
$chp_action = $this->_action;
$chp_id_carte_destination = $this->_id_carte_destination;
$action['id_zone_geo'] = $ligne->$chp_id_zone_geo;
$action['type_action'] = $ligne->$chp_action;
$action['id_carte_destination'] = $ligne->$chp_id_carte_destination;
return $action;
}
}//Fin de la méthode get_cartoAction().
}//Fin de la classe Carto_Action.
 
//================================================================================================
// L'objet carte est l'objet principal de la carto. C'est lui possede qui possède les methodes
//pour colorier les cartes.
// Il faut lui donner les parametres suivants :
// -le nom de la premier carte ($id).
// -le nom du masque ($masque).
// -le nom du fond de carte a colorier ($fond).
// -le tableau $info_table_couleur : il contient les renseignements concernant la table des couleurs ainsi
// qu'un autre tableau dans lequel figure le nombre d'elements par zone.
// L'objet comporte deux methodes principales :
// -'ajouterFils()' qui permet d'ajouter les cartes de niveau inferieur.
// -'donnerFormulaireImage()' qui lance l'action a faire en fonction de l'action de l'utilisateur.
// Il faut aussi penser a donner directement le champs url.
//================================================================================================
 
class Carto_Carte
{
/*|=============================================================================================|*/
/*| LES ATTRIBUTS DE LA CLASSE |*/
/*|---------------------------------------------------------------------------------------------|*/
var $id;
var $_id_zone_geo_carte;
var $nom;
var $masque;
var $fond;
var $chemin;
var $image;
var $fils;
var $url;
var $_info_table_zg;
var $filiation;
var $image_x;
var $image_y;
var $historique_cartes;
var $liste_zone_carte;
var $historique;
// La couleur dominante ( $maxiRVB ), la couleur la plus claire ($miniRVB) et la couleur
// intermédiaire précédant le maximum ( $mediumRVB ) au cas ou il y aurait un trop grand
//ecart entre les deux plus grandes valeurs.
var $_zeroR;
var $_zeroV;
var $_zeroB;
var $_miniR;
var $_miniV;
var $_miniB;
var $_mediumR;
var $_mediumV;
var $_mediumB;
var $_maxiR;
var $_maxiV;
var $_maxiB;
//Le type de formule mathématique permettant de colorier la carte
var $_formule_coloriage;
//L'action à réaliser
var $_action;
 
/*|=============================================================================================|*/
/*| LE CONSTRUCTEUR DE LA CLASSE |*/
/*|---------------------------------------------------------------------------------------------|*/
function Carto_Carte ($id, $id_zone_geo_carte, $nom, $masque, $fond, $chemin, $info_table)
{
$this->id = $id;
$this->_id_zone_geo_carte = $id_zone_geo_carte;
$this->nom = $nom;
$this->masque = $chemin.$masque;
$this->fond = $chemin.$fond;
$this->chemin = $chemin;
$this->_info_table_zg = $info_table;
$this->_action = new Carto_Action($info_table['nom_table_zone'],$info_table['nom_chp_id_zone'], $info_table['nom_chp_rouge'], $info_table['nom_chp_vert'], $info_table['nom_chp_bleu'],
'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone', 'CA_Action', 'CA_ID_Carte_destination');
$this->fils = array();
$this->filiation = $id;
$this->historique_cartes = '';
$this->liste_zone_carte = '';
$this->definirCouleurs();
$this->definirFormuleColoriage();
}
/*|=============================================================================================|*/
/*| LES METHODES PUBLIQUES |*/
/*|---------------------------------------------------------------------------------------------|*/
function definirCouleurs (
$couleur_zero_R = '255', $couleur_zero_V = '255', $couleur_zero_B = '255',
$couleur_mini_R = '210', $couleur_mini_V = '230', $couleur_mini_B = '210',
$couleur_medium_R = '92', $couleur_medium_V = '181', $couleur_medium_B = '92',
$couleur_maxi_R = '0', $couleur_maxi_V = '127', $couleur_maxi_B = '0')
{
$this->_zeroR = $couleur_zero_R;
$this->_zeroV = $couleur_zero_V;
$this->_zeroB = $couleur_zero_B;
$this->_miniR = $couleur_mini_R;
$this->_miniV = $couleur_mini_V;
$this->_miniB = $couleur_mini_B;
$this->_mediumR = $couleur_medium_R;
$this->_mediumV = $couleur_medium_V;
$this->_mediumB = $couleur_medium_B;
$this->_maxiR = $couleur_maxi_R;
$this->_maxiV = $couleur_maxi_V;
$this->_maxiB = $couleur_maxi_B;
}
function definirFormuleColoriage ($nomFormuleColoriage = 'defaut')
{
$this->_formule_coloriage = $nomFormuleColoriage;
}
//********************************************************************************************************
// La méthode donnerImageSimple ($objet) permet de récupérer une image non cliquable.
//*********************************************************************************************************
function donnerImageSimple ($objet)
{
$nom_fichier_image = $this->_donnerIdUnique();
$objet->_lancerColoriage('', $nom_fichier_image);
$res = '<img src="'.INS_CHEMIN_APPLI.'/bibliotheque/lib.carto.extractimg.php?fichier='.$nom_fichier_image.'" alt="image.png">';
return $res;
}
//********************************************************************************************************
// La methode ajouterFils() est essentielle. Elle permet d'ajouter toutes les sous cartes voulues.
// Il faut lui indiquer, comme a la carte du niveau du dessus, son nom, le masque, le fond et info_table_couleur.
// On a ainsi une inclusion d'objets les uns dans les autres.
//*********************************************************************************************************
function ajouterFils ($id, $id_zone_geo_carte, $nom, $masque, $fond, $info_table)
{
$this->fils[$id] = new Carto_Carte ($id, $id_zone_geo_carte, $nom, $masque, $fond, $this->chemin, $info_table);
//Si on ajoute à la carte du monde comme fils celle de l'europe, alors
//on aura comme valeur pour $this->filiation de la carte d'europe : monde*europe
$this->fils[$id]->filiation = $this->filiation.'*'.$id;
$this->fils[$id]->url = $this->url;
//Si on ajoute à la carte du monde dont le nom est 'Monde' comme fils celle de l'europe,
//dont le nom est 'Europe', alors on aura comme valeur pour $this->nom de la carte d'europe : Monde*Europe
$this->fils[$id]->nom = $this->nom.'*'.$nom;
$this->fils[$id]->historique_cartes = $this->historique_cartes;
}
//*********************************************************************************************************
// La methode donnerFormulaireImage() est la methode principale de la carto. C'est elle qui gere ce qu'il y a faire en
// fonction de l'action de l'utilisateur.
// Trois cas se distinguent :
// -soit l'utilisateur a clique sur un point de la carte.
// -soit il a clique sur un des liens que l'on a afficher avec la méthode afficherHistoriqueCarte de l'objet Carto_HistoriqueCarte.
// -soit il a sélectionné une zone géographique dans la liste déroulante.
// Elle renvoit a la fin:
// -soit une nouvelle carte coloriée
// -soit false.
//**********************************************************************************************************
function donnerFormulaireImage ()
{
global $GS_GLOBAL;
$res = '';
// Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
// si les attributs $this->image_x et $this->image_y de la classe Carte existe ou ne sont pas null.
// La carte est une image appelée par une balise <input type="image"> et non par une balise classique <img>.
// Ansi, lorsqu'on clique sur la carte le formulaire appelle (via l'url du formulaire) l'application
// utilisant la classe carte et lui renvoit deux variables contenant les coordonnées x et y du clic.
// L'application instancie à nouveau les objets cartes mais cette fois ci la carte affichée dépendra des
// informations founit par une table de la base de données.
// La classe carto_action instanciée dans l'application utilisant la classe carte fournit les noms
// des champs et celui de la table contenant les valeur RVB de chaque zone des cartes, l'identifiant
// de la zone et l'action à entreprendre pour la zone conssidérée.
// La méthode imgform() utilise la méthode get_cartoAction() de l'objet Carto_Action pour connaître
// en fonction des coordonnées du clic l'action à entreprendre.
if (isset ($this->image_x) && ($this->image_x != '') && isset ($this->image_y) && ($this->image_y != '')) {
// on regarde ici si l'on a pas un objet de plus bas niveau présent dans la variable de session carte
//a charger a la place de l'objet de plus haut niveau
$var_session_retour = $_SESSION['carte'] ;
if ($var_session_retour) {
$image_x = $this->image_x;
$image_y = $this->image_y;
$liste_zone_carte = $this->liste_zone_carte;
// Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
 
$historique_cartes = explode('*',$this->historique_cartes);
foreach ($historique_cartes as $key => $value) {
if ($key != 0) {
foreach (get_object_vars($this->fils[$value]) as $key => $value)
$this->$key = $value;
}
}
 
$this->image_x = $image_x;
$this->image_y = $image_y;
$this->liste_zone_carte = $liste_zone_carte;
unset ($_SESSION['carte']) ;
}
// on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
$action = $this->_action->_consulterActionImage($this->image_x, $this->image_y, $this->masque, $this->id);
// Nous distinguons 2 cas :
//le cas ou il faut afficher une nouvelle carte ... :
if ($action['type_action'] == 'Aller_a') {
$id_carte_destination = $action['id_carte_destination'] ;
$this->fils[$id_carte_destination]->liste_zone_carte = $this->liste_zone_carte;
if (INS_AFFICHE_ZONE_ROUGE) {
$res .= ''.$this->fils[$id_carte_destination]->_donnerListeZoneCarte()."<br />\n";
}
$res .= '<input type="image" src="';
$id_image = $this->_donnerIdUnique();
$this->fils[$id_carte_destination]->_lancerColoriage($id_image);
$obj = serialize($this->fils[$id_carte_destination]);
$_SESSION['carte'] = $obj ;
$this->historique = $this->fils[$id_carte_destination]->filiation;
$this->id = $this->fils[$id_carte_destination]->id;
$this->nom = $this->fils[$id_carte_destination]->nom;
}
//Dans le cas où l'on veut rappeler une nouvelle carte, il se peut que la nouvelle carte à rappeler
//soit la même que précédement.
//Cette possibilité peut se présenter quand on clique sur un zone blanche d'une carte (càd dans la mer)
//Là, on recharge la carte précédente :
elseif ($action['type_action'] == 'Recharger') {
if (INS_AFFICHE_ZONE_ROUGE) {
$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
}
$res .= '<input type="image" src="';
$id_image = $this->_donnerIdUnique();
$this->_lancerColoriage($id_image);
$obj = serialize($this);
$_SESSION['carte'] = $obj ;
$this->historique = $this->filiation;
}
// ... et le cas ou il faut lancer le dernier niveau
else if ($action['type_action'] == 'Stop') {
unset ($_SESSION['carte']) ;
$this->historique = $this->filiation.'*'.$action['id_zone_geo'];
$obj = serialize($this);
$_SESSION['carte'] = $obj ;
return false;
}
}
elseif ($this->liste_zone_carte != '') {
$liste_zone_carte = $this->liste_zone_carte;
$historique_cartes = explode('*',$this->historique_cartes);
foreach ($historique_cartes as $key => $value) {
if ($key != 0) {
foreach (get_object_vars($this->fils[$value]) as $key => $value)
$this->$key = $value;
}
}
$this->liste_zone_carte = $liste_zone_carte;
if (INS_AFFICHE_ZONE_ROUGE) {
$res .= ''.$this->_donnerListeZoneCarte($this->liste_zone_carte)."<br />\n";
}
$res .= '<input type="image" src="';
$id_image = $this->_donnerIdUnique();
$this->_lancerColoriage($id_image, '', $this->liste_zone_carte);
$this->historique = $this->historique_cartes;
$obj = serialize($this);
$_SESSION['carte'] = $obj ;
}
// On teste maintenant si l'on vient d'un lien. Si c'est le cas on a recu un argument
// qui nous donne la "genealogie" de la carte que l'on doit afficher
else if ($this->historique_cartes) {
// Nous chargons alors l'ojet approprié en descendant grâce a la généalogie
$historique_cartes = explode('*',$this->historique_cartes);
foreach ($historique_cartes as $key => $value) {
if ($key != 0) {
foreach (get_object_vars($this->fils[$value]) as $key => $value)
$this->$key = $value;
}
}
// une foit que l'on a charge le bon objet nous le colorions
if (INS_AFFICHE_ZONE_ROUGE) {
$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
}
$res .= '<input type="image" src="';
$id_image = $this->_donnerIdUnique();
$this->_lancerColoriage($id_image);
$this->historique = $this->historique_cartes;
$obj = serialize($this);
$_SESSION['carte'] = $obj ;
}
// Enfin si on ne vient pas d'une carte ou d'un lien c'est que l'on vient de l'onglet carto du menu
// et on affiche alors la premiere carte
else {
unset ($_SESSION['carte']) ;
if (INS_AFFICHE_ZONE_ROUGE) {
$res .= ''.$this->_donnerListeZoneCarte()."<br />\n";
}
$res .= '<input type="image" src="';
$id_image = $this->_donnerIdUnique();
$this->_lancerColoriage($id_image);
$this->historique = $this->id;
$obj = serialize($this);
$_SESSION['carte'] = $obj ;
}
$res .= INS_CHEMIN_APPLI.'/bibliotheque/lib.carto.extractimg.php?fichier='.$this->id.$id_image.'"';
$res .= ' name="image" onmouseover="javascript:show(\'d\');" onmouseout="javascript:show(\'d\');" />'."\n";
$res .= '<input type="hidden" name="historique_cartes" value="'.$this->historique.'" />'."\n";
return $res;
}
/*|=============================================================================================|*/
/*| LES METHODES PRIVEES |*/
/*|---------------------------------------------------------------------------------------------|*/
function _donnerListeZoneCarte($zone_par_defaut = '')
{
$retour = '';
$requete =
'SELECT '.$this->_info_table_zg['nom_chp_id_zone'].', '.$this->_info_table_zg['nom_chp_nom_zone'].
' FROM '.$this->_info_table_zg['nom_table_zone'];
if ($this->_info_table_zg['nom_chp_zone_sup'] != ''){
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
$requete .=
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = "'.$this->_id_zone_geo_carte.'"';
}
else{
$requete .=
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
}
}
$requete .=
' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
$resultat = mysql_query ($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__,
'', $requete));
$i=0;
$retour = '<select name="liste_zone_carte" style="float:right;" onchange="javascript:this.form.submit();">'."\n";
$retour .= '<option value="">'.INS_VISUALISER_ZONE.'</option>'."\n";
$nom_chp_nom_zone = $this->_info_table_zg['nom_chp_nom_zone'];
$nom_chp_id_zone = $this->_info_table_zg['nom_chp_id_zone'];
while ($ligne = mysql_fetch_object ($resultat)) {
if ($zone_par_defaut == $ligne->$nom_chp_id_zone){
$retour .= '<option value="'.$ligne->$nom_chp_id_zone.'" selected="selected">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
}
else {
$retour .= '<option value="'.$ligne->$nom_chp_id_zone.'">'.$ligne->$nom_chp_nom_zone.'</option>'."\n";
}
$i++;
}
$retour .= '</select>'."\n";
return $retour;
}
//==============================================================================
// METHODE _lancerColoriage()
//
// Elle lance le coloriage de l'image.
// Elle est lancée toute seule par la méthode donnerFormulaireImage().
// Les informations qui lui sont necessaires sont déjà données à l'objet carte (fond, info_table_couleur).
//==============================================================================
function _lancerColoriage ($id_image = '_00', $nom_fichier = '', $id_zone_a_reperer = '')
{
$this->image = imagecreatefrompng($this->fond);
$this->_colorierImage ($this->image, $this->_info_table_zg['nom_table_zone'], $this->_info_table_zg['nom_chp_id_zone'], $this->_info_table_zg['nom_chp_rouge'],
$this->_info_table_zg['nom_chp_vert'], $this->_info_table_zg['nom_chp_bleu'], $this->_info_table_zg['nom_chp_zone_sup'],
$this->_info_table_zg['tableau_valeurs_zone'], $id_zone_a_reperer) ;
if ($nom_fichier != '') {
imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$nom_fichier.'.png');
//$this->image = imagepng(&$this->image);
}
else {
imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$this->id.$id_image.'.png');
//imagepng(&$this->image);
}
}
//==============================================================================
// METHODE _colorierImage()
//
// Elle réalise le coloriage de l'image.
//==============================================================================
function _colorierImage (&$image_fond, $table_zone_geo, $chp_id_zone_couleur, $chp_rouge, $chp_vert, $chp_bleu, $chp_zone_sup, $tableau_valeurs_zone, $id_zone_a_reperer)
{
//----------------------------------------------------------------------------
// Cherche les valeurs RVB de la couleur de chaque zone géographique et les rentre dans
//un tableau d'objets Carto_InformationCouleur (voir la description de la classe ci-dessus.
$requete_01 =
'SELECT *'.
' FROM '.$table_zone_geo;
if ($chp_zone_sup != ''){
if(ereg("[a-z]+",$this->_id_zone_geo_carte)){
$requete_01 .=
' WHERE '.$chp_zone_sup.' = "'.$this->_id_zone_geo_carte.'"';
}
else{
$requete_01 .=
' WHERE '.$chp_zone_sup.' = '.$this->_id_zone_geo_carte;
}
}
$resultat_01 = mysql_query ($requete_01) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Requete : </b>'.$requete_01.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$i=0;
$attachments = array();
while ($ligne_01 = mysql_fetch_object ($resultat_01)) {
$attachments[$i] = new Carto_InformationCouleur ($ligne_01->$chp_id_zone_couleur, $ligne_01->$chp_rouge, $ligne_01->$chp_vert, $ligne_01->$chp_bleu);
$i++;
}
//Nous libérons toute la mémoire associée à l'identifiant de résultat.
mysql_free_result ($resultat_01);
//----------------------------------------------------------------------------
// On realide l'association entre l'index des couleurs et la zone de meme couleur
$attachments = $this->_construireAssociationIndexZone ($image_fond, $attachments);
//----------------------------------------------------------------------------
//Dans l'application qui utilise la classe carte, nous avons instancié un tableau
//associatif qui contient en clé l'identifiant d'une zone géographique et en valeur
//un nombre (qui peut-être un nombre d'inscrit, d'institutions, de taxons...).
// Nous récupérons ci-dessous la valeur minimum autre que 0 présente dans ce tableau
//puis une valeur conscidérée comme maximum
if (!is_array($tableau_valeurs_zone)) {
$mini = 0;
$medium = 0;
$maxi = 0;
$nbre_valeurs = 0;
}
else {
if (count($tableau_valeurs_zone) == 0) {
$mini=0;
$medium = 0;
$maxi=0;
}
else {
$i=0;
foreach ($tableau_valeurs_zone as $cle => $valeur) {
//Nous recherchons le minimum, le maximum et le la valeur médium juste au dessous du maximum.
if ($valeur != 0) {
$tablo_valeurs[$i] = $valeur;
$i++;
}
}
//Nombre d'entrées dans le tableau de valeurs non nulles :
$nbre_valeurs = count($tablo_valeurs);
$somme_valeurs = array_sum($tablo_valeurs);
$tablo_frequences = array_count_values($tablo_valeurs);
$nbre_frequences = count($tablo_frequences);
if ($nbre_valeurs > 0){
//Nous trions le tableau dans l'ordre croissant :
sort($tablo_valeurs);
//Nous récupérons la valeur la plus petite :
$mini = $tablo_valeurs[0];
$maxi = $tablo_valeurs[$nbre_valeurs-1];
isset($tablo_valeurs[$nbre_valeurs-2]) ? $medium = $tablo_valeurs[$nbre_valeurs-2] : $medium = 0;
$moyenne = $somme_valeurs/$nbre_valeurs;
$ecart_au_carre_moyen = 0;
for ($i = 0; $i < $nbre_valeurs; $i++) {
$ecart_au_carre_moyen += pow(($tablo_valeurs[$i] - $moyenne), 2);
}
$variance = $ecart_au_carre_moyen/$nbre_valeurs;
$ecart_type = sqrt($variance);
$moyenne = round($moyenne, 0);
$variance = round($variance, 0);
$ecart_type = round($ecart_type, 0);
/*echo 'Nombre de valeurs : '.$nbre_valeurs.'<br>';
echo 'Nombre de frequences : '.$nbre_frequences.'<br>';
echo 'Moyenne : '.$moyenne.'<br>';
echo 'Variance : '.$variance.'<br>';
echo 'Ecart-type : '.$ecart_type.'<br>';
echo 'Formule de coloriage : '.$this->_formule_coloriage.'<br>';
echo "mini : $mini medium : $medium maxi : $maxi<br/>";
*/
}
}
}
 
//----------------------------------------------------------------------------
// Nous réalisons le coloriage de toutes les zones :
$requete_03 =
"SELECT $chp_id_zone_couleur ".
"FROM $table_zone_geo";
$resultat_03 = mysql_query ($requete_03) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Requete : </b>'.$requete_03.
'<br/><br/><b>Erreur : </b>'.mysql_error());
while ($ligne_03 = mysql_fetch_object ($resultat_03)) {
$id_zone_geo = $ligne_03->$chp_id_zone_couleur;
if (!isset ($tableau_valeurs_zone[$id_zone_geo])) {
$tableau_valeurs_zone[$id_zone_geo] = 0;
}
//Nous cherchons la couleur a afficher pour chaque zone.
if ($tableau_valeurs_zone[$id_zone_geo] != 0) {
//echo 'ZONE:'.$id_zone_geo."<br/>";
//echo $tableau_valeurs_zone[$id_zone_geo]."<br/>";
$theColor = $this->_donnerCouleur(
$this->_miniR, $this->_miniV, $this->_miniB,
$this->_mediumR , $this->_mediumV , $this->_mediumB ,
$this->_maxiR , $this->_maxiV , $this->_maxiB ,
$mini, $medium, $maxi, $nbre_valeurs, $ecart_type, $moyenne, $tablo_valeurs,
$tablo_frequences, $nbre_frequences,
$tableau_valeurs_zone[$id_zone_geo],
$this->_formule_coloriage);
//echo $theColor['R'].'<br>';
//echo $theColor['V'].'<br>';
//echo $theColor['B'].'<br>';
}
else {
$theColor['R'] = $this->_zeroR;
$theColor['V'] = $this->_zeroV;
$theColor['B'] = $this->_zeroB;
}
//Nous réalisons le coloriage de toutes les zones de l'image avec la couleur obtenue.
$this->_remplacerCouleur($image_fond, $attachments, $id_zone_geo, $theColor['R'], $theColor['V'], $theColor['B'], $id_zone_a_reperer);
}
//Nous libérons toute la mémoire associée à l'identifiant de résultat de la requête.
mysql_free_result ($resultat_03);
}
//==============================================================================
// METHODE _construireAssociationIndexZone ($image, &$att)
//
// Le tableau $att est passé par référence. La méthode modifie donc directement
// le tableau et ne renvoit donc rien.
// Attache dans un tableau $att, contenant sous forme d'objet (Carto_ColorInfo)
// les valeurs RVB des zones d'une image, la valeur de l'index correspondant
// à la couleur de la zone.
// Note : les images en question sont constituées de zones distincte possédant
// chacune une couleur unique et unie.
//==============================================================================
function _construireAssociationIndexZone(&$image_fond, &$att)
{
// Nous récupérons le nombre de couleur différentes contenues dans l'image.
//echo $this->fond.'<BR>';
$image_fond = imagecreatefrompng($this->fond);
$taille_palette = imagecolorstotal ($image_fond);
if (!$image_fond) echo 'erreur fond : '.$this->fond;
// Pour chaque couleur contenue dans l'image, nous cherchons l'objet correspondant
// dans le tableau $att, qui contient des informations sur chaque zone de l'image,
// et nous attribuons à l'objet la valeur de l'index de sa couleur dans l'image.
for ($i = 0; $i < $taille_palette; $i++) {
$valeurs_RVB = array();
$valeurs_RVB = imagecolorsforindex ($image_fond, $i);
for ($j = 0; $j < count ($att); $j++) {
if (($att[$j]->rouge == $valeurs_RVB['red']) && ($att[$j]->vert == $valeurs_RVB['green']) && ($att[$j]->bleu == $valeurs_RVB['blue'])) {
$att[$j]->index = $i;
//echo 'ICI'.$att[$j]->id_zone.$att[$j]->index.'<br>';
break;
}
}
}
return $att;
}//Fin méthode _construireAssociationIndexZone()
 
//==============================================================================
// METHODE _donnerCouleur()
//------------------------------------------------------------------------------
// Renvoie pour une valeur donnee la couleur a mettre
//------------------------------------------------------------------------------
// ENTREE
// $miniR : valeur rouge du minimum
// $miniV : valeur vert du minimum
// $miniB : valeur blue du minimum
// $maxiR : valeur rouge du maximum
// $maxiV : valeur vert du maximum
// $maxiB : valeur bleu du maximum
// $mediumR : valeur rouge du deuxieme maximum
// $mediumV : valeur vert du deuxieme maximum
// $mediumB : valeur bleu du deuxieme maximum
// $mini : valeur mini sur l'echelle
// $medium : valeur juste au dessous du maximum sur l'echelle
// $maxi : valeur maxi sur l'echelle
// $val : valeur dont on cherche la couleur
//------------------------------------------------------------------------------
// SORTIE
// $couleur array donne la couleur pour la valeur demande ($val)
//------------------------------------------------------------------------------
function _donnerCouleur($miniR, $miniV, $miniB, $mediumR, $mediumV, $mediumB, $maxiR,
$maxiV, $maxiB, $mini, $medium, $maxi, $nbre_valeurs, $ecart_type, $moyenne, $tablo_valeurs, $tablo_frequences, $nbre_frequences, $val, $formuleColoriage)
{
if ($formuleColoriage == 'defaut'){
if ($val == $maxi) {
$couleur['R'] = $maxiR;
$couleur['V'] = $maxiV;
$couleur['B'] = $maxiB;
}
if ($val == $mini && $val != $maxi) {
$couleur['R'] = $miniR;
$couleur['V'] = $miniV;
$couleur['B'] = $miniB;
}
if ($maxi/10 > $medium && $maxi/40 < $medium) {
$diff = $medium - $mini;
if ($diff > 0 && $val != $medium && $val != $maxi) {
$diffR = $mediumR - $miniR;
$diffV = $mediumV - $miniV;
$diffB = $mediumB - $miniB;
$variationR = round ( ($diffR/$diff ), 0 );
$variationV = round ( ($diffV/$diff ), 0 );
$variationB = round ( ($diffB/$diff ), 0 );
$couleur['R'] = couleur_bornerNbre(($miniR + ($val * $variationR)), 0, 255);
$couleur['V'] = couleur_bornerNbre(($miniV + ($val * $variationV)), 0, 255);
$couleur['B'] = couleur_bornerNbre(($miniB + ($val * $variationB)), 0, 255);
}
else if ($val == $medium) {
$couleur['R'] = $mediumR;
$couleur['V'] = $mediumV;
$couleur['B'] = $mediumB;
}
}
else {
$diff = $maxi - $mini;
if ($diff > 0 && $val != $maxi && $val != $mini) {
$diffR = $maxiR - $miniR;
$diffV = $maxiV - $miniV;
$diffB = $maxiB - $miniB;
$variationR = round ( ($diffR/$diff ), 0 );
$variationV = round ( ($diffV/$diff ), 0 );
$variationB = round ( ($diffB/$diff ), 0 );
$couleur['R'] = couleur_bornerNbre(($miniR + ($val * $variationR)), 0, 255);
$couleur['V'] = couleur_bornerNbre(($miniV + ($val * $variationV)), 0, 255);
$couleur['B'] = couleur_bornerNbre(($miniB + ($val * $variationB)), 0, 255);
}
else if ($diff == 0){
$couleur['R'] = $mediumR;
$couleur['V'] = $mediumV;
$couleur['B'] = $mediumB;
}
}
}
elseif ($formuleColoriage == 'ecart_type') {
if ($ecart_type == 0) {
$couleur['R'] = $maxiR;
$couleur['V'] = $maxiV;
$couleur['B'] = $maxiB;
}
elseif ($ecart_type >= 1 && $ecart_type <= 15) {
if ($val == $mini) {
$couleur['R'] = $miniR;
$couleur['V'] = $miniV;
$couleur['B'] = $miniB;
}
elseif ($val == $medium) {
$couleur['R'] = $mediumR;
$couleur['V'] = $mediumV;
$couleur['B'] = $mediumB;
}
elseif ($val == $maxi) {
$couleur['R'] = $maxiR;
$couleur['V'] = $maxiV;
$couleur['B'] = $maxiB;
}
else {
$dif_valeur_maxi_mini = $maxi - $mini;
$diffR = $maxiR - $miniR;
$diffV = $maxiV - $miniV;
$diffB = $maxiB - $miniB;
$variationR = round ( ($diffR/$dif_valeur_maxi_mini ), 0 );
$variationV = round ( ($diffV/$dif_valeur_maxi_mini ), 0 );
$variationB = round ( ($diffB/$dif_valeur_maxi_mini ), 0 );
$couleur['R']=$miniR + ($val * $variationR);
$couleur['V']=$miniV + ($val * $variationV);
$couleur['B']=$miniB + ($val * $variationB);
}
}
elseif ($ecart_type > 15) {
//Le tableau est trié de la plus petite à la plus grande clé.
ksort($tablo_frequences);
$i = 0;
foreach ($tablo_frequences as $cle => $valeur){
//Nous cherchons la correspondance entre la valeur et la clé.
if ($cle == $val) {
//Pour faire le Rouge, Vert, Bleu
$couleur['R'] = $miniR + ($i/$nbre_frequences) * ($maxiR - $miniR);
$couleur['V'] = $miniV + ($i/$nbre_frequences) * ($maxiV - $miniV);
$couleur['B'] = $miniB + ($i/$nbre_frequences) * ($maxiB - $miniB);
}
$i++;
}
}
}
return $couleur;
}//Fin méthode _donnerCouleur()
 
//==============================================================================
// METHODE _remplacerCouleur ($img, $att, $id_zone_geo, $r, $g, $b)
//
// $img is the image, $att an array of carto_colorinfo objects, $id_zone_geo the name
// of an object of $att, ($r, $g, $b) the new color.
//
// In the palette of $img, the color matching with $id_zone_geo is modified.
//==============================================================================
function _remplacerCouleur(&$image, &$atta, $id_zone_geo, $rouge, $vert, $bleu, $id_zone_a_reperer)
{
// Nous recherchons la valeur de l'index.
$index = -1;
for ($i = 0; $i < count ($atta); $i++) {
if ($atta[$i]->id_zone == $id_zone_geo) {
$index = $atta[$i]->index;
//Dans le cas où nous voulons repérer une zone sur la carte :
if($id_zone_geo == $id_zone_a_reperer) {
$rouge = 255;
$vert = 0;
$bleu = 0;
}
break;
}
}
// Nous mettons à jour l'image de la carte avec la valeur de l'index.
if ($index >= 0) {
imagecolorset (&$image, $index, $rouge, $vert, $bleu);
}
}//Fin de la méthode _remplacerCouleur
//==============================================================================
// METHODE _donnerIdUnique ()
//
// Cette méthode privée retourne un identifiant de 32 caractères unique.
//
//==============================================================================
function _donnerIdUnique()
{
$id = '';
$id = md5 (uniqid (rand()));
return $id;
}//Fin de la méthode _donnerIdUnique()
 
 
}//Fin de la classe Carto_Carte()
 
//==============================================================================
// La classe Carto_InformationCouleur n'est utilisée que par la classe carte.
// C'est une classe privée.
// Elle sert à stocker les informations (RVB et index) sur la couleur d'une
// zone d'une image.
//==============================================================================
 
class Carto_InformationCouleur
{
/*|=============================================================================================|*/
/*| LES ATTRIBUTS DE LA CLASSE |*/
/*|---------------------------------------------------------------------------------------------|*/
var $id_zone;
var $rouge;
var $vert;
var $bleu;
var $index;
/*|=============================================================================================|*/
/*| LE CONSTRUCTEUR DE LA CLASSE |*/
/*|---------------------------------------------------------------------------------------------|*/
function Carto_InformationCouleur($id_zone, $rouge, $vert, $bleu)
{
$this->id_zone = $id_zone;
$this->rouge = $rouge;
$this->vert = $vert;
$this->bleu = $bleu;
$this->index = -1;
}
}//Fin de la classe Carto_InformationCouleur
 
 
//==============================================================================
// FUNCTION carto_errorMsg ()
//
// Return an error message about carto management.
//==============================================================================
 
function carto_errorMsg()
{
global $PRIVATE_CARTO_ERROR;
 
return $PRIVATE_CARTO_ERROR;
}
 
//==============================================================================
// FUNCTION carto_putErrorImage ()
//
// Dump a default error image.
//==============================================================================
 
function carto_putErrorImage()
{
$img = '47494638396120002000800100ff000000006621f90401000001002c000000002000'.
'200040026d848fa99be11f009c53524373b41ae2da65dcf345e1693aa536aae77ab1'.
'e1d7a2a22ad5f60deb6fe54bc958418f0b05bb9190bee2f1327276a2c91db16a855a'.
'a4489c31bb24d5b8614fb32b2a9ea7d228738785dab673e7f81554b395682008dc52'.
'4236b4210416c390a8a85000003b';
header ('Content-Type: image/gif');
echo gs_hex2bin($img);
}
 
//==============================================================================
//==============================================================================
// Les fonctions qui suivent permettent de recuperer des infos (nom de l'image,
// du masque, du niveau ou du titre) d'une carte.
//==============================================================================
//==============================================================================
 
function carto_consulterTitreCarte($id_carte)
{
global $NOM_FICHIER;
$requete =
'SELECT * '.
' FROM carto_DESCRIPTION_CARTE'.
' WHERE CDC_ID_Carte = "'.$id_carte.'"';
$resultat = mysql_query ($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_consulterTitreCarte<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
$titre_carte = $ligne->CDC_Titre_carte;
return $titre_carte;
}
 
function carto_consulterFichierFond($id_carte)
{
global $NOM_FICHIER;
$requete =
'SELECT * '.
' FROM carto_DESCRIPTION_CARTE'.
' WHERE CDC_ID_Carte = "'.$id_carte.'"';
$resultat = mysql_query ($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_consulterFichierFond<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
$nom_fichier_carte_fond = $ligne->CDC_Carte_fond;
return $nom_fichier_carte_fond;
}
 
function carto_consulterFichierMasque($id_carte)
{
global $NOM_FICHIER;
$requete =
'SELECT * '.
' FROM carto_DESCRIPTION_CARTE'.
' WHERE CDC_ID_Carte = "'.$id_carte.'"';
$resultat = mysql_query ($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_consulterFichierMasque<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
$nom_fichier_carte_masque = $ligne->CDC_Carte_masque;
return $nom_fichier_carte_masque;
}
 
function carto_consulterTypeZoneCarte($id_carte)
{
global $NOM_FICHIER;
$requete =
'SELECT * '.
' FROM carto_DESCRIPTION_CARTE'.
' WHERE CDC_ID_Carte = "'.$id_carte.'"';
$resultat = mysql_query($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_consulterTypeZoneCarte<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object($resultat);
$type_zone_carte = $ligne->CDC_Type_zone_carte;
return $type_zone_carte;
}
 
function carto_consulterIdZoneGeoCarte($id_carte)
{
global $NOM_FICHIER;
$requete =
'SELECT * '.
' FROM carto_DESCRIPTION_CARTE'.
' WHERE CDC_ID_Carte = "'.$id_carte.'"';
$resultat = mysql_query($requete) or die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
'<b>Nom fonction : </b> carto_consulterIdZoneGeoCarte<br/>'.
'<b>Requete : </b>'.$requete.
'<br/><br/><b>Erreur : </b>'.mysql_error());
$ligne = mysql_fetch_object ($resultat);
$id_zone_carte = $ligne->CDC_ID_Zone_geo_carte;
return $id_zone_carte;
}
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
* Revision 1.8 2007/04/11 08:30:12 neiluj
* remise en état du CVS...
*
* Revision 1.5 2006/12/01 13:23:16 florian
* integration annuaire backoffice
*
* Revision 1.4 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.3 2005/12/07 14:59:14 alexandre_tb
* suppression d'un echo
*
* Revision 1.2 2005/11/24 16:17:52 florian
* changement template inscription + modifs carto
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.2 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.1 2004/12/15 13:30:20 alex
* version initiale
*
* Revision 1.17 2003/05/16 13:17:40 jpm
* Correction d'une erreur (des guillemets en trop).
*
* Revision 1.16 2003/03/14 14:12:14 jpm
* Correction bug : le nom de la zone ne restait pas dans la liste déroulante.
*
* Revision 1.15 2003/03/11 14:49:47 jpm
* Simplification de l'interface.
*
* Revision 1.14 2003/03/07 15:10:24 jpm
* Ajout de commentaires : "à faire"
*
* Revision 1.13 2003/03/04 16:14:06 alex
* Utilisation de la fonction cxt_clearVariable à la place de cxt_clear
*
* Revision 1.12 2003/03/04 08:09:39 jpm
* Ajout suppression des fichiers carto du dossier carto temporaire.
*
* Revision 1.11 2003/02/26 12:12:38 jpm
* Ajout de la gestion des listes déroulantes représentant la zone géographique
* à éditer.
*
* Revision 1.10 2003/02/21 13:50:57 jpm
* Mise à jour nouvel objet Carto_Carte.
*
* Revision 1.8 2003/02/14 08:01:14 jpm
* Changement des noms de méthode selon les recommandations de PEAR.
* Ajout d'attributs à la classe.
* Ajout de la possibilité de redéfinir les couleurs de coloriage d'une carte.
* Ajout de la possibilité de désigner une formule mathématique de coloriage.
*
* Revision 1.7 2003/02/12 18:15:56 jpm
* Meilleure gestion de l'obtentions des valeurs minimum, medium et maximum
* pour l'ensemble des zones géographiques d'une carte.
* Ajout de commentaires.
* Meilleure gestion des erreurs de requêtes.
*
*
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/cartographie.fonct.php
New file
0,0 → 1,343
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Page permettant l'affichage des informations de cartographie des inscrits
*
*@package cartographie
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version 03 mai 2004
// +-----------------------------------------------------------------------------------------------+
//
// $Id: cartographie.fonct.php,v 1.4 2007-04-11 08:30:12 neiluj Exp $
// FICHIER : $RCSfile: cartographie.fonct.php,v $
// AUTEUR : $Author: neiluj $
// VERSION : $Revision: 1.4 $
// DATE : $Date: 2007-04-11 08:30:12 $
*/
 
/** function carto_liste_fiches()
*
*
* @return string HTML
*/
function carto_liste_fiches(&$monde, $nom_table1, $nom_table2, $nom_champs_pays, $nom_champs_cp, $requete_sql) {
 
global $mailer;
global $select;//utilisé dans liste_inscrit.php
$javascript = "
function confirmer () {
if (window.confirm ('Cliquez sur OK pour confirmer.')) {
window.formmail.submit();
}
}
 
function setCheckboxes(the_form)
{
var do_check=document.forms[the_form].elements['selecttotal'].checked;
var elts = document.forms[the_form].elements['select[]'];
var elts_cnt = (typeof(elts.length) != 'undefined')
? elts.length
: 0;
if (elts_cnt) {
for (var i = 0; i < elts_cnt; i++) {
elts[i].checked = do_check;
} // Fin for
}
else {
elts.checked = do_check;
} // Fin if... else
return true;
} // Fin de la fonction 'setCheckboxes()'
 
";
GEN_stockerCodeScript($javascript);
 
$res = '';
$tabmonde = explode ('*',$monde->historique);
// Premier cas, on vient de cliquer sur un pays qui n'est pas
// la France, on affiche les adhérents de ce pays
if (count($tabmonde) == 3) {
$argument = $tabmonde[2];
$query = 'SELECT * FROM carto_PAYS WHERE CP_ID_pays="'.$argument.'"';
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage().'<br />'.$result->getDebugInfo()) ;
}
$row = $result->fetchRow(DB_FETCHMODE_OBJECT) ;
$pays = $row->CP_Intitule_pays;
$monde->nom = $monde->nom.'*'.$pays;
$tabonglet = explode ('*', $monde->historique);
$tabnom = explode ('*', $monde->nom);
$res .= "<b>\n";
foreach ($tabonglet as $key => $value) {
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
} else if ($key == (count($tabonglet)-1)) {
$res .= "<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$pays</a>";
} else {
$chemin .= '*'.$value;
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= "</b>\n";
$capitale = $row->CP_Intitule_capitale;
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
' FROM '.$nom_table1;
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
$query2 .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT) ;
$res .= '<br /><br /><div class="info_pays">'.$pays.' (capitale: '.$capitale.') : ' ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT.' '.INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr.' '.INS_INSCRIT.' '.INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr.' '.INS_INSCRIT.'s '.INS_LABEL_PROJET ;
}
$res .= "</div>\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
}
else {
$requete = 'SELECT * FROM '.$nom_table1;
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
$requete .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
//todo: gerer l'ordre ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
if ($row2->nbr >= 1) {
$res .= listes_inscrit($requete, $select, $_SERVER['REQUEST_URI']) ;
if ($mailer==1) {
if (!is_array($select)) {
$res .= "<div>".INS_NO_DESTINATAIRE."</div>";
}
else {
$res .= '<div class="zone_info">'.INS_MESSAGE_ENVOYE.'</div>'."\n" ;
carto_envoie_mail() ;
}
}
else {
$res .= carto_texte_cocher() ;
}
$res .= carto_formulaire() ;
}
}
}
// 2 ème cas, on vient de cliquer sur un département français
} else if (count($tabmonde) == 4) {
$argument = $tabmonde[3];
$query = 'SELECT * FROM '.INS_TABLE_DPT.' WHERE '.INS_CHAMPS_ID_DEPARTEMENT.'='.$argument;
$result = $GLOBALS['ins_db']->query($query);
if (DB::isError($result)) {
die ($result->getMessage() .'<br />'.$result->getDebugInfo());
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$nom = $row[INS_CHAMPS_NOM_DEPARTEMENT];
$tabonglet=explode ('*', $monde->historique);
$tabnom=explode ('*', $monde->nom);
$res.="<div><b>\n";
foreach ($tabonglet as $key=>$value) {
if ($key==0) {
$chemin=$value;
$value='monde';
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
else if ($key==(count($tabonglet)-1)) {
$res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
}
else {
$chemin.='*'.$value;
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
}
}
$res .= "</b></div>\n";
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
' FROM '.$nom_table1;
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
$query2 .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
' AND '.$nom_champs_pays.'="FR"';
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
$result2 = $GLOBALS['ins_db']->query($query2);
if (DB::isError($result2)) {
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
}
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT);
$res .= '<br /><br /><div class="nb_inscrits">' ;
if ($row2->nbr == 0) {
$res .= INS_AUCUN_INSCRIT." ".INS_LABEL_PROJET ;
}
else if ($row2->nbr == 1) {
$res .= $row2->nbr." ".INS_INSCRIT." ".INS_LABEL_PROJET ;
}
else {
$res .= $row2->nbr." ".INS_INSCRIT."s ".INS_LABEL_PROJET ;
}
$res .= "</div><br />\n";
if ($row2->nbr>0) {
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
} else {
$requete = 'SELECT * FROM '.$nom_table1;
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
if (strlen($argument)==1) {
$argument='0'.$argument;
}
$requete .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
' AND '.$nom_champs_pays.'="FR"';
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
//todo: ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
$res .= listes_inscrit($requete, $select, $_SERVER['REQUEST_URI']) ;
if ($mailer==1) {
if (!is_array($select)) {
$res.= INS_NO_DESTINATAIRE;
} else {
$res .= '<p class="zone_info">'.INS_MESSAGE_ENVOYE."</p>\n" ;
carto_envoie_mail() ;
}
} else {
$res .=carto_texte_cocher() ;
}
$res .= carto_formulaire() ;
}
}
}
return $res;
}
 
 
/** function carto_texte_cocher ()
*
*
* @return string HTML
*/
function carto_texte_cocher() {
$res = "<div class=\"texte\">".INS_CHECK_UNCHECK ;
$res .= "&nbsp;<input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\" /></div>";
return $res ;
}
 
 
/** function carto_formulaire ()
*
*
*
* @return string HTML
*/
function carto_formulaire($titre_mail="", $corps="") {
$res = "<br /><h2>".INS_ENVOYER_MAIL."</h2><br />\n";
$res .= INS_SUJET.' :<br /><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /><br /><br />'."\n"
.INS_MESSAGE.' :<br /><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea><br />'."\n";
$res.='<br /><input class="bouton" type="submit" onclick="javascript:confirmer();" value="'.INS_ENVOYER.'" /></form>'."\n";
return $res ;
}
 
/**
* Renvoie le code HTML de la liste des inscrits
* en fonction de la requete passé en parametre
*
* @return Renvoie le code HTML de la liste des inscrits
*/
 
function listes_inscrit($requete, $select, $url) {
$res='';
$resultat= $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res.='<input type="checkbox" name="select[]" value="'.$ligne[INS_CHAMPS_MAIL].'" />'."\n".
$ligne[INS_CHAMPS_NOM].'&nbsp;'.$ligne[INS_CHAMPS_PRENOM].'&nbsp;'.
$ligne[INS_CHAMPS_CODE_POSTAL].'&nbsp;'.$ligne[INS_CHAMPS_VILLE].'&nbsp;'.
date("d.m.Y", strtotime($ligne[INS_CHAMPS_DATE_INSCRIPTION])).'<br /><br />'."\n";
}
$res .= '<input type="hidden" name="mailer" value="1" />'."\n";
$res .= '<input type="hidden" name="select" value="'.$select.'" /><br />'."\n";
return $res ;
}
 
/** envoie_mail()
*
*
* @return envoie l'email
*/
function carto_envoie_mail() {
$requete = 'SELECT '.INS_CHAMPS_MAIL.' FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_ID.'='.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
$resultat = $GLOBALS['ins_db']->query($requete);
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
$GLOBALS['corps'] .= INS_TEXTE_FIN_MAIL;
$GLOBALS['corps'] = stripslashes($GLOBALS['corps']) ;
$liste = "" ;
foreach ($GLOBALS['select'] as $key => $value) {
mail ($value, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'] , $entete) ;
$liste .= $value."\n" ;
}
$GLOBALS['corps'] .= "\n----------------------------------------------------------------------------";
$GLOBALS['corps'] .= "\n".INS_MESSAGE_ENVOYE_A." :\n $liste" ;
mail(INS_MAIL_ADMIN, stripslashes(INS_SURVEILLANCE_ENVOI_MAIL.$GLOBALS['titre_mail']), $GLOBALS['corps'], $entete);
$GLOBALS['corps'] = '';
$GLOBALS['titre_mail'] = '';
}
//-- Fin du code source ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.2 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.1 2004/12/15 13:30:20 alex
* version initiale
*
*
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/lib.couleur.php
New file
0,0 → 1,136
<?php
 
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
* Fichier regroupant toutes les fonctions manipulant les couleurs
*
*Toutes les fonctions sur les couleurs sont disponibles dans ce fichier.
*
*@package couleur
//Auteur original :
*@author iubito <sylvain_machefert@yahoo.fr>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2003
*@version 25 fevrier 2003
// +-----------------------------------------------------------------------------------------------+
//
// $Id: lib.couleur.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
// FICHIER : $RCSfile: lib.couleur.php,v $
// AUTEUR : $Author: ddelon $
// VERSION : $Revision: 1.1 $
// DATE : $Date: 2005-09-22 14:02:49 $
//
// +-----------------------------------------------------------------------------------------------+
// A FAIRE :
*/
 
/**
//==================================== FONCTION ==================================
* La fonction array couleur_hexadecimalAuRgb(string color) renvoie des valeurs de couleur en RGB.
*
*Cette fonction prend une valeur de couleur codée en hexadécimal et retourne
*les valeurs RGB correspondantes sous forme de tableau.
*Exemple d'utilisation:
*$rgb = couleur_hexadecimalAuRgb("fffc49");
*echo "<br>couleur_hexadecimalAuRgb de 'fffc49' : ".$rgb['R']." ".$rgb['V']." ".$rgb['B'];
*
*@author iubito <sylvain_machefert@yahoo.fr>
*@copyright iubito - http://iubito.free.fr/ - 2003
*
*@param string $couleur représente une couleur codée en héxadécimal.
*
*@return array tableau associatif contenant les 3 valeurs RGB, avec clé du rouge 'R',
* du vert 'V' et enfin du bleu 'B'.
//==============================================================================
*/
function couleur_hexadecimalAuRgb($couleur_html)
{
//gestion du #...
if (substr($couleur_html, 0, 1) == "#") {
$couleur_html = substr($couleur_html, 1, 6);
}
$tablo_rgb['R'] = hexdec(substr($couleur_html, 0, 2));
$tablo_rgb['V'] = hexdec(substr($couleur_html, 2, 2));
$tablo_rgb['B'] = hexdec(substr($couleur_html, 4, 2));
return $tablo_rgb;
}
 
 
/**
//==================================== FONCTION ==================================
* La fonction string couleur_rgbAuHexadecimal(array tablo) renvoie la valeur d'une
*couleur en héxadécimal.
*
*Cette fonction prend un tableau de valeurs d'une couleur codées en RGB et retourne
*la valeur hexadécimal correspondante sous forme de chaîne.
*C'est la réciproque exacte de la fonction couleur_hexadecimalAuRgb.
*
*@author iubito <sylvain_machefert@yahoo.fr>
*@copyright iubito - http://iubito.free.fr/ - 2003
*
*@param array $tablo_RGB représente un tableau associatif avec les valeurs RGB
*d'une couleur.Les trois clés du tableau sont : R pour rouge, V pour vert et B pour bleu.
*
*@return string chaîne contenant la valeur de la couleur sous forme héxadécimale.
//==============================================================================
*/
function couleur_rgbAuHexadecimal($tablo_rgb)
{
//Vérification des bornes...
foreach($tablo_rgb as $cle => $valeur) {
$tablo_rgb[$cle] = bornes($tablo_rgb[$cle],0,255);
}
//Le str_pad permet de remplir avec des 0
//parce que sinon couleur_rgbAuHexadecimal(array(0,255,255)) retournerai #0ffff<=manque un 0 !
return "#".str_pad(dechex(($tablo_rgb['R']<<16)|($tablo_rgb['V']<<8)|$tablo_rgb['B']),6,"0",STR_PAD_LEFT);
}
 
/**
//==================================== FONCTION ==================================
* La fonction int couleur_bornerNbre(int nb, int min, int max) borne des nombres.
*
*Cette fonction permet de borner la valeur d'un nombre entre un minimum $mini et
*un maximum $maxi.
*
*@author iubito <sylvain_machefert@yahoo.fr>
*@copyright iubito - http://iubito.free.fr/ - 2003
*
*@param integer $nbre le nombre à borner.
*@param integer $mini la borne minimum.
*@param integer $maxi la borne maximum.
*
*@return integer le nombre limité aux bornes si nécessaire.
//==============================================================================
*/
function couleur_bornerNbre($nbre, $mini, $maxi)
{
if ($nbre < $mini) {
$nbre = $mini;
}
if ($nbre > $maxi) {
$nbre = $maxi;
}
return $nbre;
}
 
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/lib.carto.extractimg.php
New file
0,0 → 1,86
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
* Fichier permettant de générer l'entête HTTP des images de la carto.
*
*Ce fichier permet de construire l'image de la carto et de la faire passer dans les entête HTTP.
*
*@package lib.carto
//Auteur original :
*@author Luc LAMBERT
//Autres auteurs :
*@author Nicolas MATHIEU
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2003
*@version 01 juillet 2002
// +-----------------------------------------------------------------------------------------------+
//
// $Id: lib.carto.extractimg.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
// FICHIER : $RCSfile: lib.carto.extractimg.php,v $
// AUTEUR : $Author: ddelon $
// VERSION : $Revision: 1.1 $
// DATE : $Date: 2005-09-22 14:02:49 $
//
// +-----------------------------------------------------------------------------------------------+
// A FAIRE :
//
*/
 
$image = imagecreatefrompng('tmp/carto/'.$fichier.'.png');
chmod ('tmp/carto/'.$fichier.'.png', 755) ;
 
header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
header('Cache-Control: no-cache, must-revalidate');// HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
header ('content-type:image/png');
imagepng($image);
unlink('tmp/carto/'.$fichier.'.png');
//Nous nettoyons le dossier tmp des fichiers qu'il contient:
$poignet_de_dossier = opendir('tmp/carto/');
while ($fichier_dechet = readdir($poignet_de_dossier)) {
if ($fichier_dechet != '.' && $fichier_dechet != '..') {
unlink(CAR_CHEMIN_TMP.$fichier_dechet);
}
}
closedir($poignet_de_dossier);
exit();
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.1 2004/12/15 13:30:20 alex
* version initiale
*
* Revision 1.7 2003/03/04 08:09:39 jpm
* Ajout suppression des fichiers carto du dossier carto temporaire.
*
* Revision 1.6 2003/02/21 13:50:57 jpm
* Mise à jour nouvel objet Carto_Carte.
*
* Revision 1.5 2003/02/14 07:56:45 jpm
* Ajout d'un entête.
* Ajout de requêtes HTTP pour éviter le cache.
*
*
*
*/
?>
/branches/v2.0-narmer/client/bottin/bibliotheque/inscription.fonct.spip.php
New file
0,0 → 1,140
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.fonct.spip.php,v 1.4 2007-04-11 08:30:12 neiluj Exp $
/**
* Fonctions wikini
*
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
*
*@package inscription
*@subpackage fonctions_wikini
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function inscription_spip($id, &$valeur)
{
 
// Requete pour inscrire dans SPIP
if (isset ($valeur['nomwiki'])) {
$login = $valeur['nomwiki'] ;
} else {
$login = $valeur['email'] ;
}
$requete = "insert into spip_auteurs set id_auteur=$id, nom=\"".$valeur['prenom']." ".$valeur['nom'].
"\",email=\"".$valeur['email']."\",login=\"".$login.
"\", pass=\"".md5($valeur['mot_de_passe'])."\", statut=\"nouveau\", lang=\"".
strtolower($valeur['pays'])."\"" ;
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
}
 
function mod_inscription_spip($id, &$valeur)
{
if (isset ($valeur['nomwiki'])) {
$login = $valeur['nomwiki'] ;
} else {
$login = $valeur['email'] ;
}
//BIEN METTRE alea_actuel, htpass ET alea_futur À ""
$requete = "update spip_auteurs set nom=\"".$valeur['prenom']." ".$valeur['nom'].
"\",email=\"".$valeur['email']."\",login=\"".$login.
"\", pass=\"".md5($valeur['mot_de_passe'])."\", htpass=\"\", alea_actuel=\"\", alea_futur=\"\", lang=\"fr\" where id_auteur=$id" ;
//echo $requete;
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
}
function desinscription_spip($id_utilisateur)
{
$requete = 'delete from spip_auteurs where id_auteur='.$id_utilisateur ;
@mysql_query($requete) or die ("$requete<br>Echec de la requête de mise à la poubelle de l'utilisateur dans spip <br>".mysql_error()) ;
}
 
function spip_cookie() {
if ($userid != 0) {
setcookie("spip_admin", "@$login", time()+3600*24*30, INS_CHEMIN_SPIP) ;
include ("ecrire/inc_version.php3");
include_ecrire ("inc_meta.php3");
include_ecrire ("inc_session.php3");
$query = "SELECT * FROM spip_auteurs WHERE id_auteur=$userid";
$result = mysql_query($query);
$GLOBALS['auteur_session'] = mysql_fetch_array($result) ;
$GLOBALS['auteur_session']['statut'] = "1comite" ;
$GLOBALS['auteur_session']['lang'] = "en" ;
if (!$HTTP_COOKIE_VARS["spip_session"]) {
$id_session = $userid."_".(md5 (uniqid (rand ())));
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
} else {
$id_session = preg_replace("/[0-9]+_/", $userid."_", $HTTP_COOKIE_VARS["spip_session"]) ;
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
}
ajouter_session($GLOBALS['auteur_session'], $id_session) ;
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/03/15 11:03:34 alexandre_tb
* généralisation du code
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.2 2005/03/21 16:57:30 florian
* correction de bug, mise à jour interface
*
* Revision 1.1 2004/12/15 13:32:25 alex
* version initiale
*
* Revision 1.1 2004/07/06 15:42:17 alex
* en cours
*
* Revision 1.2 2004/06/25 14:25:27 alex
* modification de la requete de suppresssion
*
* Revision 1.1 2004/06/18 09:20:48 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
 
 
?>
/branches/v2.0-narmer/client/bottin/index.php
New file
0,0 → 1,3
<?php
header('Location:inscription.php');
?>
/branches/v2.0-narmer/client/bottin/cartographie.php
New file
0,0 → 1,334
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Page permettant l'affichage des informations de cartographie des inscrits
*
*@package cartographie
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version 03 mai 2004
// +-----------------------------------------------------------------------------------------------+
//
// $Id: cartographie.php,v 1.9 2007-04-11 08:30:12 neiluj Exp $
// FICHIER : $RCSfile: cartographie.php,v $
// AUTEUR : $Author: neiluj $
// VERSION : $Revision: 1.9 $
// DATE : $Date: 2007-04-11 08:30:12 $
*/
include_once PAP_CHEMIN_RACINE.'/client/bottin/configuration/bottin.config.inc.php';
include_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
include_once INS_CHEMIN_APPLI.'bibliotheque/lib.carto.php';
 
//================================================================================================
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
//---------------le menu de l'appli-----------
function afficherContenuNavigation () {
$res =inscription_onglets();
return $res ;
}
}
 
//================================================================================================
function construit_hierarchie(&$info_zone, &$carto_config, $info_zone_hierarchie, &$monde) {
static $i=0;
$i++;
//on ajoute la carto en cours en tant que fils
$monde->ajouterFils($info_zone_hierarchie->czh_code_alpha, $info_zone_hierarchie->czh_identifiant_table_info_couleur,
$info_zone_hierarchie->czh_nom, $info_zone_hierarchie->czh_fichier_masque,
$info_zone_hierarchie->czh_fichier_image, '');
$monde->fils[$info_zone_hierarchie->czh_code_alpha]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
//requete pour trouver les fils de la carte de depart voulue
$requete_zone_fils = 'SELECT * FROM carto_zone_hierarchie '.
'WHERE czh_id_zone_pere='.$info_zone_hierarchie->czh_id_zone;/*echo $requete_zone_fils;*/
$resultat_zone_fils = $GLOBALS['ins_db']->query($requete_zone_fils) ;
if (DB::isError($resultat_zone_fils )) {
echo ($resultat_zone_fils->getMessage().'<br />'.$resultat_zone_fils->getDebugInfo()).'<br />'.$requete_zone_fils ;
}
if ($resultat_zone_fils->numRows()!=0) {
while ($ligne_zone_fils = $resultat_zone_fils ->fetchRow(DB_FETCHMODE_OBJECT)) {
//requete pour obtenir toutes les infos (repartition par zones, nom des tables et champs pour les couleurs,.. ) pour la carte à afficher
$requete_01 = 'SELECT '.$ligne_zone_fils->czh_nom_champs_id_pere.',count('.$ligne_zone_fils->czh_nom_champs_id_pere.') AS nbr'.
' FROM '.$carto_config['cc_table1'].', '.$ligne_zone_fils->czh_nom_table_info_couleur;
if ($carto_config['cc_table2']!=0) $requete_01 .= ', '.$carto_config['cc_table2'];
$requete_01 .= ' WHERE '.$ligne_zone_fils->czh_champs_jointure_annuaire.' = '.$ligne_zone_fils->czh_nom_champs_id;
if ($carto_config['cc_sql']!='') $requete_01 .= ' AND ('.$carto_config['cc_sql'].')';
$requete_01 .= ' GROUP BY '.$ligne_zone_fils->czh_nom_champs_id_pere;
$resultat_01 = $GLOBALS['ins_db']->query($requete_01) ;
if (DB::isError($resultat_01)) {
echo ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()).'<br />'.$requete_01 ;
}
$tableau_repartition=array();
while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
$id=$ligne_zone_fils->czh_nom_champs_id_pere;
$tableau_repartition[$ligne_01->$id] = $ligne_01->nbr;
}
$info_zone[$i]['nom_table_zone'] =$info_zone_hierarchie->czh_nom_table_info_couleur;
$info_zone[$i]['nom_chp_id_zone'] =$info_zone_hierarchie->czh_nom_champs_id;
$info_zone[$i]['nom_chp_nom_zone'] =$info_zone_hierarchie->czh_nom_champs_intitule;
$info_zone[$i]['nom_chp_rouge'] =$info_zone_hierarchie->czh_nom_champs_couleur_R;
$info_zone[$i]['nom_chp_vert'] =$info_zone_hierarchie->czh_nom_champs_couleur_V;
$info_zone[$i]['nom_chp_bleu'] =$info_zone_hierarchie->czh_nom_champs_couleur_B;
$info_zone[$i]['nom_chp_zone_sup'] =$info_zone_hierarchie->czh_nom_champs_id_pere;
$info_zone[$i]['tableau_valeurs_zone'] = $tableau_repartition;
if ($i == 1) {
$monde->_info_table_zg = $info_zone[1];
$monde->definirCouleurs('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
construit_hierarchie($info_zone, $carto_config, $ligne_zone_fils, $monde);
} else {
$monde->_info_table_zg = $info_zone[$i];
construit_hierarchie($info_zone, $carto_config, $ligne_zone_fils, $monde->fils[$info_zone_hierarchie->czh_code_alpha]);
}
}
}
}
 
function afficherContenuCorps() {
global $image_x;
global $image_y;
global $historique_cartes;
global $mailer;
global $fin;
global $sendpwd;//utilisé dans liste_inscrit.php
global $select;//utilisé dans liste_inscrit.php
global $liste_zone_carte;
//=================================================================================================
//Gestion de la configuration
$requete = 'SELECT * FROM carto_config WHERE cc_menu_id='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu;
$resultat = $GLOBALS['ins_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$carto_config = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
//on affiche les infos lorsqu'on regarde une fiche
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
$res = affiche_onglet_info();
} else {
//requete pour afficher la carte de depart voulue dans la conf.
$requete_zone_hierarchie = 'SELECT * FROM carto_zone_hierarchie WHERE czh_id_zone='.$carto_config['cc_ce_premiere_carte'];
$resultat_zone_hierarchie = $GLOBALS['ins_db']->query($requete_zone_hierarchie) ;
if (DB::isError($resultat_zone_hierarchie )) {
echo ($resultat_zone_hierarchie->getMessage().'<br />'.$resultat_zone_hierarchie->getDebugInfo()) ;
}
$ligne_zone_hierarchie = $resultat_zone_hierarchie ->fetchRow(DB_FETCHMODE_OBJECT);
//initialisation de la variable 2 dimensions, contenant les infos specifiques a chaque echelle de territoire
$info_zone= array();
$monde = new Carto_Carte($ligne_zone_hierarchie->czh_code_alpha, '', $ligne_zone_hierarchie->czh_nom,
$ligne_zone_hierarchie->czh_fichier_masque, $ligne_zone_hierarchie->czh_fichier_image,
INS_CHEMIN_APPLI.'presentations/fonds/', '');
construit_hierarchie($info_zone, $carto_config, $ligne_zone_hierarchie, $monde);
echo '<pre>'.var_dump($monde).'</pre>';
//requete
// $requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
//
// $resultat_02 = $GLOBALS['ins_db']->query($requete_02) ;
// if (DB::isError($resultat_02)) {
// die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
// }
//
// while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
// $requete_03 = 'SELECT CP_ID_Pays, count(cp_id_pays) as nbr '.
// ' FROM '.$nom_table1.', carto_PAYS';
// if ($nom_table2!=0) $requete_03 .= ', '.$nom_table2;
// $requete_03 .= ' WHERE '.$nom_champs_pays.'= cp_id_pays';
// if ($requete_sql!='') $requete_03 .= ' AND ('.$requete_sql.')';
// $requete_03 .= ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
// ' GROUP BY cp_id_pays';
// $resultat_03 = $GLOBALS['ins_db']->query($requete_03) ;
// if (DB::isError($resultat_03)) {
// die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
// }
//
// $tableau_ad_pays = array();
// while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
// $tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
// }
//
// $info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
// $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
// $info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
}
// //============================================================================================================
// //if (!isset($_POST['historique_cartes']) && INS_ECHELLE_DEPART!='france') {
// $requete_04 = 'SELECT CD_ID_Departement, count(cd_id_departement) as nbr'.
// ' FROM '.$nom_table1.', carto_DEPARTEMENT'.
// ' WHERE '.$nom_champs_pays.' = "fr"'.
// ' AND SUBSTRING('.$nom_champs_cp.' FROM 1 FOR 2) = cd_id_Departement'.
// ' GROUP BY cd_id_Departement';
// $resultat_04 = $GLOBALS['ins_db']->query ($requete_04) ;
// $tableau_ad_dpt_france = array();
// while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
// $tableau_ad_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr;
// }
// $info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
// $info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
// $info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
// $info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
// $info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
// $info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
// $info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
// $info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
// //}
//
//============================================================================================================
//============================================================================================================
// On cree tout d'abord l'arborescence
/*
$monde = new Carto_Carte('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png',
INS_CHEMIN_APPLI.'presentations/fonds/', $info_zone[1]);
$monde->definirCouleurs('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;*/
if (isset($_POST['historique_cartes'])) {
$monde->historique_cartes = $_POST['historique_cartes'];
} else {
$monde->historique_cartes = INS_ECHELLE_DEPART;
}
$monde->image_x = $image_x;
$monde->image_y = $image_y;
$monde->liste_zone_carte = $liste_zone_carte;
$monde->url = $GLOBALS['ins_url']->getURL();
/*
foreach ($info_zone[2] as $cle => $valeur) {
$requete_05 =
"SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte".
" FROM carto_DESCRIPTION_CARTE, carto_ACTION ".
" WHERE CA_ID_Zone_geo = '$cle'".
" AND CA_Type_zone = 1".
" AND CA_ID_Carte_destination = CDC_ID_Carte";
$resultat_05 = $GLOBALS['ins_db']->query ($requete_05) ;
if (DB::isError($resultat_05)) {
die ($resultat_05->getMessage().'<br />'.$resultat_05->getDebugInfo()) ;
}
$ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
$monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
$ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
$monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
}
*/
//$monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france.png', $info_zone[3]);
//$monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
// Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
// (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
// le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
$img = false;
if ($mailer == 1 || $fin == true) {
$objet_carte = $_SESSION['carte'] ;
$monde = unserialize($objet_carte);}
else {
$img = $monde->donnerFormulaireImage();
}
// Quoi qu'il arrive, on ouvre la balise formulaire
if ($carto_config['cc_titre_carto']!='') $res = '<h1>'.$carto_config['cc_titre_carto'].'</h1>'."\n";
else $res = '<h1>'.INS_CARTOGRAPHIE.'</h1>'."\n";
$res .= '<form name="formmail" action="'.$monde->url.'" method="post">'."\n";
if ((INS_AFFICHE_ECHELLE)and($img)) {
$historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
$res .= $historique_carte->afficherHistoriqueCarte()."\n" ;
}
if (!$img ) {
//include 'bibliotheque/cartographie.fonct.liste_inscrit.php';
$res .= carto_liste_fiches($monde, $carto_config['cc_table1'], $carto_config['cc_table2'], $carto_config['cc_pays'],$carto_config['cc_cp'], $carto_config['cc_sql']);
return $res;
} else {
$res .= $img;
$res .= '<p class="zone_info">'."\n";
$res .= '<strong>'.INS_CLIQUER_ACCEDER.'</strong><br />'."\n";
$res .= INS_COULEUR."\n".'</p>'."\n";
}
$res .= '</form>'."\n";
return $res;
//----------------------------------------------------------------------------------------------------------------------
// Cas ou la carto n'a pas encore ete configuree
} else {
return '<p class="zone_alert">'.INS_FAUT_CONFIGURER_CARTO.'</p>'."\n";
}
}
 
 
//-- Fin du code source ------------------------------------------------------------
/*
* $Log: not supported by cvs2svn $
* Revision 1.6 2006/12/01 13:23:17 florian
* integration annuaire backoffice
*
* Revision 1.5 2006/04/19 13:49:04 alexandre_tb
* correction de bug sur l'utilisation de l'id_menu de papyrus
*
* Revision 1.4 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
* Revision 1.3 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.2 2005/11/24 16:17:52 florian
* changement template inscription + modifs carto
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.2 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.1 2004/12/15 13:33:03 alex
* version initiale
*
* Revision 1.2 2004/06/18 08:48:03 alex
* améliorations diverses
*
* Revision 1.1 2004/06/09 13:56:47 alex
* corrections diverses
*
* Revision 1.9 2003/05/06 12:49:27 alex
* remplacement include par include_once
*
* Revision 1.8 2003/03/07 15:20:32 jpm
* Correction d'une erreur de texte.
*
* Revision 1.7 2003/02/28 08:43:33 jpm
* Gestion des nouvelles tables MySql carto.
*
* Revision 1.6 2003/02/21 13:50:19 jpm
* Mise à jour nouvel objet Carto_Carte.
*
* Revision 1.5 2003/02/17 14:33:52 jpm
* Modification pour être compatible avec la nouvelle classe carte.
*
*
*/
?>
/branches/v2.0-narmer/client/bottin/inscription.admin.php
New file
0,0 → 1,137
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
*
*@package bottin
//Auteur original :
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
class Inscription_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction redigerContenu() - Affiche le formulaire de r?action
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
/** Inclusion du fichier de configuration de cette application.*/
require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
//require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
//-------------------------------------------------------------------------------------------------------------------
// Initialisation des attributs
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
$this->objet_pear_db = $GLOBALS['ins_db'];
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
$this->sortie_xhtml = '<h1>'.INS_CONFIG_INSCRIPTION.'</h1><br />'."\n";
//-------------------------------------------------------------------------------------------------------------------
// Gestion des boutons de l'interface
if (isset($_POST['afficheur_annuler'])) {
return false;
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
$requete = 'UPDATE gen_menu SET gm_application_arguments="type_annuaire='.$_POST['type_annuaire'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans carto_config
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$valeurs_par_defaut = array();
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$arguments = explode(' ', $ligne->gm_application_arguments);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
//valeurs par defaut enregistrees dans la table
$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
} else {
//valeurs par defaut pour afficher une carto des structures
$valeurs_par_defaut['type_annuaire']=0;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion du formulaire
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
$form =& new HTML_QuickForm('form_param_inscription', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<p>'."\n".
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </label>'."\n".'{element}'."\n".
'</p>'."\n" );
$option_tables[0] = INS_ANNUAIRE_BOTTIN;
$option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
$form->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
$form->addElement('html', $liste_bouton_debut);
$form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
$form->addElement('submit', 'afficheur_annuler', INS_ANNULER);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$form->setDefaults($valeurs_par_defaut);
$this->sortie_xhtml .= $form->toHTML()."\n";
return $this->sortie_xhtml;
}
 
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
?>
/branches/v2.0-narmer/client/bottin/langues/cartographie.langue.fr.inc.php
New file
0,0 → 1,55
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: cartographie.langue.fr.inc.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
/**
* Fichier de traduction en français de l'application inscription
*
* Fichier de traduction en français de l'application inscription
*
*@package vecam
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2005-09-22 14:02:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.1 2004/12/15 13:31:21 alex
* version initiale
*
* Revision 1.1 2004/06/18 08:49:57 alex
* version initiale, pour vecam
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/langues/ins_annuaire.langue.fr.inc.php
New file
0,0 → 1,212
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ins_annuaire.langue.fr.inc.php,v 1.3 2007-04-06 08:35:46 neiluj Exp $
/**
* Fichier de traduction en français de l'application ins_annuaire
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $ $Date: 2007-04-06 08:35:46 $
// +------------------------------------------------------------------------------------------------------+
*/
define ('INS_TITRE_INSCRIPTION', 'Inscription au réseau');
define ('INS_INSCRIPTION_PERSONNE','S\'inscrire en tant que personne');
define ('INS_INSCRIPTION_STRUCTURE', 'S\'inscrire en tant que structure');
define ("INS_AJOUT_MEMBRE", "Ajout d'un nouveau membre") ;
define ("INS_NOM", "Nom") ;
define ("INS_NOM_REQUIS", "Veuillez indiquer votre nom.") ;
define ("INS_PRENOM", "Pr&eacute;nom") ;
define ("INS_PRENOM_REQUIS", "Veuillez indiquer votre prénom.") ;
define ("INS_PAYS", "Pays") ;
define ("INS_LANGUES_PARLES", "Langues parl&eacute;s") ;
define ("INS_EMAIL", "Adresse mail") ;
define ("INS_MOT_DE_PASSE", "Mot de passe") ;
define ("INS_REPETE_MOT_DE_PASSE", "R&eacute;p&eacute;ter le mot de passe") ;
define ("INS_ADRESSE_1", "Adresse") ;
define ("INS_ADRESSE_2", "Adresse (suite)") ;
define ("INS_REGION", "R&eacute;gion / province") ;
define ("INS_CODE_POSTAL", "Code postal") ;
define ("INS_CODE_POSTAL_REQUIS", "Veuillez indiquer votre code postal.") ;
define ("INS_VILLE", "Ville") ;
define ("INS_VILLE_REQUIS", "Veuillez indiquer votre ville.") ;
define ("INS_SITE_INTERNET", "Site web personnel") ;
define ("INS_LETTRE", "Je souhaite recevoir la lettre<br /> d'actualité sur l'éducation en<br /> l'environnement") ;
define ("INS_ADHERENT", "Vous &ecirc;tes adh&eacute;rents de personnes morales (associations, institutions, entreprise... )") ;
define ("INS_ORGANISME", "Organisme") ;
define ("INS_FONCTION", "Fonction") ;
define ('INS_TELEPHONE', 'Téléphone');
define ('INS_FAX','Fax');
define ("INS_ANNULER", "Annuler") ;
define ("INS_RETABLIR", "Rétablir") ;
define ("INS_VALIDER", "Valider") ;
define ("INS_MOTS_DE_PASSE_DIFFERENTS", "Les mots de passe sont diff&eacute;rents !") ;
define ("INS_EMAIL_REQUIS", "Vous devez saisir une adresse électronique.") ;
define ("INS_MOT_DE_PASSE_REQUIS", "Vous devez saisir un mot de passe.") ;
define ("INS_MAIL_INCORRECT", "L'email doit avoir une forme correcte, utilisateur@domaine.ext") ;
define ("INS_MAIL_DOUBLE", "Cet email est d&eacute;j&agrave utilis&eacute; par quelqu'un d'autre") ;
define ("INS_NOTE_REQUIS", "Indique les champs requis") ;
define ("INS_ACCUEIL_INSCRIPTION", "Inscription au réseau") ;
define ("INS_MODIFIER_INSCRIPTION", "Modifier votre inscription") ;
define ("INS_SUPPRIMER_INSCRIPTION", "Supprimer votre inscription") ;
define ("INS_MESSAGE_BIENVENU", "Vous &ecirc;tes inscrit aux sites Educ-Envir.org et Ecole-et-Nature.org") ;
define ("INS_FICHE_PERSONNELLE", "Fiche personnelle") ;
define ("INS_DECONNEXION", 'D&eacute;connexion') ;
define ("INS_INSCRIPTION", 'Inscription') ;
define ("INS_TEXTE_PERDU", "Mot de passe perdu? Indiquez seulement votre adresse email et cliquez sur \"Valider\"") ;
define ('INS_SIGLE_STRUCTURE', 'Sigle de la structure <br />(s\'il n\'existe pas, mettre <br />le nom de la structure)');
define ('INS_VISIBLE', 'Je souhaite apparaitre sur la <br/>cartographie et sur l\'annuaire <br />du site');
define ('INS_SIGLE_REQUIS', 'Sigle de la structure requis!');
define ('INS_NOM_STRUCTURE', 'Nom de la structure');
define ('INS_MAIL_STRUCTURE', 'Adresse électronique');
define ('INS_SITE_STRUCTURE', 'Site Internet de la structure');
define ('INS_NUM_AGREMENT', 'Numéro d\'agrément FPC');
define ("INS_NOM_WIKI", "Nom wiki") ;
define ("INS_MAUVAIS_NOM_WIKI", "Le nom wiki n'est pas valide (ex : NomPrenom)") ;
define ("INS_DEJA_INSCRIT", "D&eacute;j&agrave;  inscrit, identifiez-vous pour acc&eacute;der &agrave;  votre fiche personnelle :") ;
define ('INS_PAS_INSCRIT', 'Pas encore inscrit, enregistrez-vous!');
define ("INS_ERREUR_LOGIN", "Utilisateur inconnu ou mot de passe erronn&eacute;") ;
define ("INS_SI_PASSE_PERDU", "Si vous avez perdu votre mot de passe, indiquez votre adresse email dans le champs ci-dessus.<br>\n".
"Un nouveau mot de passe vous sera envoyé.") ; ;
define ("INS_ENVOIE_PASSE", "Envoi du mot de passe par mail") ;
define ("INS_LAIUS_INSCRIPTION", "L'inscription au r&eacute;seau Ecole et Nature est libre et gratuite !") ;
define ("INS_LAIUS_INSCRIPTION_2", "<h3>L'inscription est libre et gratuite, elle vous permet de :</h3><ul>
<li> consulter l'annuaire des personnes inscrites au R&eacute;seau et pouvoir ainsi &eacute;changer des informations</li>
<li> acc&eacute;der &agrave;  certaines informations diffus&eacute;es sur le site</li>
<li> vous inscrire &agrave;  des projets d'éducation à l'environnement</li>
<li> rédiger des annonces d'actualité, d'évenements, de séjours et rencontres, de covoiturage ou de parutions</li>
<li> recevoir un bulletin &eacute;lectronique d'informations.</li></ul>") ;
 
//============= L'envoie du mot de passe perdu par mail =============================
define ("INS_NOUVEAU_MOT_DE_PASSE", "Votre nouveau mot de passe sur Educ-Envir.org et Ecole-et-Nature.org") ;
define ("INS_NOUVEAU_MOT_DE_PASSE_2", "Votre nouveau mot de passe : ") ;
define ("INS_NOUVEAU_MOT_DE_PASSE_LAIUS", "\n\nCe mot de passe vous permet de modifier les informations\n".
"vous concernant dans les sites du réseau Ecole et Nature: Educ-Envir.org et Ecole-et-Nature.org.\n".
"http://www.educ-envir.org/\n\n".
"http://www.ecole-et-nature.org/\n\n") ;
define ("INS_MOT_DE_PASSE_ENVOYE_1", "Votre nouveau mot de passe a &eacute;t&eacute; ".
"envoy&eacute; &agrave; l'adresse") ;
define ("INS_MOT_DE_PASSE_ENVOYE_2", "Relevez votre messagerie, notez votre nouveau mot de passe et identifiez vous à ".
"nouveau en allant à l'inscription. N'h&eacute;sitez pas à changer ce mot de passe ".
"pour en mettre un plus simple, plus facile &agrave; retenir." );
//============= L'envoie d'un mail de confirmation ===================================
// Ne pas utiliser d'entités HTML
define ('INS_ENTETE_INSCRIPTION','Inscription sur les sites Educ-Envir.org et Ecole-et-Nature.org');
define ("INS_MAIL_INSCRIPTION_1", "Votre inscription a bien été prise en compte.\n".
"Voici les informations que nous avons enregistré :\n") ;
define ("INS_MAIL_INSCRIPTION_2", "\nVous pouvez modifier votre inscription sur \nhttp://www.ecole-et-nature.org ou \nhttp://www.educ-envir.org\n".
"rubrique S'inscrire (le signe + sur le bandeau du haut).\n\n".
"L'équipe du réseau Ecole et Nature.") ;
define ('INS_MESSAGE_EXPIRATION','Désolé, le temps imparti à votre inscription c\'est écoulé...<br />'.
'Merci de bien vouloir vous réinscrire, en répondant rapidement au mail de confirmation.<br /><br />'.
'En vous remerciant de votre compréhension, a tout de suite!');
define ('INS_MESSAGE_VALIDER_INSCRIPTION','Validation de votre inscription sur le réseau Ecole et Nature:'."\n".
'Merci de vous être inscrit(e), soyez bienvenu(e)!'."\n".
'Veuillez cliquer sur le lien ci-dessous pour finaliser votre inscription:'."\n");
 
// Envoir d'un mail à la coordination
define ("INS_MAIL_COORD_SUJET", "Un nouvel inscrit au réseau ") ;
define ("INS_MAIL_COORD_CORPS", "Une nouvelle inscription a été effectuée sur le site.") ;
define ("INS_CHAMPS_REQUIS", "Champs requis") ;
 
define ("INS_MESSAGE_INSCRIPTION", "Votre inscription a été prise en compte, relevez votre messagerie et cliquer sur le lien proposé pour terminer votre inscription.") ;
 
// CARTO
define ("INS_DATE_INS", "Date d'inscription") ;
define ("INS_CHECK_UNCHECK", "Cocher les cases pour s&eacute;lectionner votre destinataire ou cocher / d&eacute;cocher tout") ;
define ("INS_ENVOYER_MAIL", "Envoyer un email") ;
define ("INS_SUJET", "Sujet") ;
define ("INS_MESSAGE", "Message") ;
define ("INS_ENVOYER", "Envoyer") ;
define ("INS_LABEL_PROJET", "en tant que membre du réseau Ecole et Nature");
define ("INS_COULEUR", "La couleur est proportionnelle au nombre d'inscrits.") ;
define ("INS_AVERTISSEMENT_TITRE", "Avertissement et d&eacute;ni de responsabilit&eacute;") ;
define ("INS_AVERTISSEMENT", "La représentation et l'utilisation des fronti&egrave;res, des noms g&eacute;ographiques et autres ".
" donn&eacute;es employ&eacute;s sur les cartes et utilis&eacute;s dans les listes,".
" les tableaux, les documents et les bases de donn&eacute;es de ce site ne sont pas garanties sans ".
"erreurs, de m&ecirc;me qu'elles n'engagent pas la responsabilit&eacute; des auteurs de ce site ni ".
"n'impliquent de reconnaissance officielle de leur part.") ;
define ("INS_MONDE", "Monde") ;
define ("INS_CLIQUER_ACCEDER", "Cliquer sur la carte pour zoomer ou acc&eacute;der aux informations&nbsp;&nbsp;") ;
define ('INS_VISUALISER_ZONE', 'Mettre en rouge la zone...');
define ("INS_MESSAGE_ENVOYE", "<br /><br />Votre message a &eacute;t&eacute; envoy&eacute;") ;
define ("INS_MESSAGE_ENVOYE_A", "Ce message a été envoyé à") ; // pas d'entités HTML, c'est pour un mail
define ("INS_AUCUN_INSCRIT", "aucun inscrit") ;
define ("INS_INSCRIT", "inscrit") ;
define ('INS_TEXTE_FIN_MAIL', "\n".'---------------------------------------------------------------------------'."\n".
'Ce message vous est envoyé par l\'intermédiaire des sites Internet'."\n".
'du réseau Ecole et Nature: Educ-Envir.org et Ecole-et-nature.org'."\n".
'auquel vous êtes inscrit. D\'autres inscrits peuvent avoir reçu ce message.'."\n".
'Ne répondez que si vous êtes concerné, ou si vous avez des informations'."\n".
'utiles à transmettre au demandeur.'."\n".
"----------------------------------------------------------------------------") ;
define ('INS_NO_DESTINATAIRE', '<br /><br />Veuillez cocher au moins un destinataire pour votre mail<br />');
define ('INS_VOUS_DEVEZ_ETRE_INSCRIT', 'Vous devez être inscrit pour pouvoir envoyer des messages électronique aux personnes ou structure de l\'annuaire.<br />Identifiez-vous ou inscrivez-vous sur la page <a href="http://test.educ-envir.org/papyrus.php?site=1&menu=29">Inscription</a> du site.');
define ('INS_SURVEILLANCE_ENVOI_MAIL', 'Surveillance envois de mails: ');
define ('INS_ENREGISTRER_ET_QUITTER', 'Enregistrer et quitter');
define ('INS_TABLE', 'Nom de la table dans la base SQL contenant des informations à cartographier');
define ('INS_TABLE_SUPPLEMENTAIRE', 'Nom de la table additionnelle contenant des informations à cartographier');
define ('INS_NOM_CHAMPS_PAYS', 'Nom du champs représentant le pays');
define ('INS_NOM_CHAMPS_CP', 'Nom du champs représentant le code postal');
define ('INS_REQUETE_SQL_SUPPLEMENTAIRE', 'Complément de requète SQL (conditions supplémentaires pour le WHERE)');
define ('INS_PAS_NECESSAIRE', 'Pas nécéssaire');
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.2 2005/03/10 09:40:39 tam
* modifs labels
*
* Revision 1.1 2005/03/04 10:39:54 tam
* installation
*
* Revision 1.1 2004/07/06 15:42:17 alex
* en cours
*
* Revision 1.4 2004/07/06 15:31:43 alex
* en cours
*
* Revision 1.3 2004/06/25 14:25:40 alex
* ajout de labels
*
* Revision 1.2 2004/06/24 07:43:55 alex
* traduction
*
* Revision 1.1 2004/06/18 09:21:15 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/langues/annuaire_backoffice.langue.fr.inc.php
New file
0,0 → 1,27
<?php
 
// +--------------------------------------------------------------------------------+
// | annuaire_moteur_lang_fr.php |
// +--------------------------------------------------------------------------------+
// | Copyright (c) 2000 - 2003 Tela Botanica |
// +--------------------------------------------------------------------------------+
// | Contient le texte de l'appli en français |
// +--------------------------------------------------------------------------------+
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
// +--------------------------------------------------------------------------------+
//
// $Id: annuaire_backoffice.langue.fr.inc.php,v 1.3 2007-04-06 08:35:46 neiluj Exp $
 
define ("AM_L_TITRE", "Chercher un adhérent") ;
define ("AM_L_RECHERCHER", "Rechercher") ;
define ("AM_L_PAYS", "Pays") ;
define ("AM_L_NOM", "Nom") ;
define ("AM_L_PRENOM", "Prénom") ;
define ("AM_L_VILLE", "Ville") ;
define ("AM_L_DEPARTEMENT", "Département") ;
define ("AM_L_MAIL", "Mail") ;
define ("AM_L_COTISANTS", "Cotisants") ;
define ("AM_L_GRP_RES", "Grouper les résultats") ;
define ("AM_L_TOUS", "Tous") ;
define ("AM_L_MAIL_SELECTION", "Envoyer un mail à la sélection") ;
?>
/branches/v2.0-narmer/client/bottin/langues/bottin.langue_fr.inc.php
New file
0,0 → 1,333
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bottin.langue_fr.inc.php,v 1.19 2007-04-11 08:30:12 neiluj Exp $
/**
* Fichier de traduction en français de l'application ins_annuaire
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.19 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
if (file_exists (INS_CHEMIN_APPLI.'langues/bottin_langue_'.INS_LANGUE_DEFAUT.'.local.php')) {
include_once INS_CHEMIN_APPLI.'langues/bottin_langue_'.INS_LANGUE_DEFAUT.'.local.php' ;
}
define ('INS_TITRE_INSCRIPTION', 'Inscription au r&eacute;seau');
define ('INS_INSCRIPTION_PERSONNE','S\'inscrire en tant que personne');
define ('INS_INSCRIPTION_STRUCTURE', 'S\'inscrire en tant que structure');
define ('INS_AJOUT_MEMBRE', 'Ajout d\'un nouveau membre') ;
define ('INS_NOM', 'Nom') ;
define ('INS_NOM_REQUIS', 'Veuillez indiquer votre nom.') ;
define ('INS_PRENOM', 'Prénom') ; // Pas d'entite, car sert dans le corps d un mail
define ('INS_PRENOM_REQUIS', 'Veuillez indiquer votre prénom.') ;
define ('INS_PAYS', 'Pays') ;
define ('INS_LANGUES_PARLES', 'Langues parl&eacute;s') ;
define ('INS_EMAIL', 'Adresse mail') ;
define ('INS_MOT_DE_PASSE', 'Mot de passe') ;
define ('INS_REPETE_MOT_DE_PASSE', 'R&eacute;p&eacute;ter le mot de passe') ;
define ('INS_ADRESSE_1', 'Adresse') ;
define ('INS_ADRESSE_2', 'Adresse (suite)') ;
define ('INS_REGION', 'R&eacute;gion / province') ;
define ('INS_CODE_POSTAL', 'Code postal') ;
define ('INS_CODE_POSTAL_REQUIS', 'Veuillez indiquer votre code postal.') ;
define ('INS_VILLE', 'Ville') ;
define ('INS_VILLE_REQUIS', 'Veuillez indiquer votre ville.') ;
define ('INS_SITE_INTERNET', 'Site internet') ;
define ('INS_LETTRE', 'Je souhaite recevoir la lettre d\'actualité') ;
define ('INS_MOT_DE_PASSE_CHANGE', 'Changement de mot de passe') ;
define ('INS_NOUVEAU_MOT_DE_PASSE_ENVOYE', 'Votre mot de passe a &eacute;t&eacute; chang&eacute;, consultez votre messagerie.') ;
define ('INS_MAIL_INCONNU_DANS_ANNUAIRE', 'L\'adresse mail saisie n\'est pas pr&eacute;sente dans notre annuaire, v&eacute;rifiez la saisie de cette adresse') ;
define ('INS_VOUS_RECEVEZ_LETTRE','Vous &ecirc;tes abonn&eacute;(e) &agrave; la cyberlettre');
define ('INS_VOUS_RECEVEZ_PAS_LETTRE','Vous n\'&ecirc;tes pas abonn&eacute;(e) &agrave; la cyberlettre');
define ('INS_VOUS_APPARAISSEZ','Vous apparaissez sur la cartographie et dans l\'annuaire du site');
define ('INS_VOUS_APPARAISSEZ_PAS','Vous n\'apparaissez par sur la cartographie, ni dans l\'annuaire du site');
define ('INS_ADHERENT', 'Vous &ecirc;tes adh&eacute;rents de personnes morales (associations, institutions, entreprise... )') ;
define ('INS_ORGANISME', 'Organisme') ;
define ('INS_FONCTION', 'Fonction') ;
define ('INS_TELEPHONE', 'Téléphone');
define ('INS_FAX','Fax');
define ('INS_LOGO_OU_IMAGE', 'Ins&eacute;rer une image ou un logo (.jpg, .png ou .gif, 150Ko max.)');
define ('INS_ANNULER', 'Annuler') ;
define ('INS_RETABLIR', 'Rétablir') ;
define ('INS_VALIDER', 'Valider') ;
define ('INS_MOTS_DE_PASSE_DIFFERENTS', 'Les mots de passe sont diff&eacute;rents !') ;
define ('INS_EMAIL_REQUIS', 'Vous devez saisir une adresse électronique.') ;
define ('INS_MOT_DE_PASSE_REQUIS', 'Vous devez saisir un mot de passe.') ;
define ('INS_MAIL_INCORRECT', 'L\'email doit avoir une forme correcte, utilisateur@domaine.ext') ;
define ('INS_MAIL_DOUBLE', 'Cet email est d&eacute;j&agrave utilis&eacute; par quelqu\'un d\'autre') ;
define ('INS_NOTE_REQUIS', 'Indique les champs requis') ;
define ('INS_ACCUEIL_INSCRIPTION', 'Inscription au réseau') ;
define ('INS_MODIFIER_INSCRIPTION', 'Modifier votre inscription') ;
define ('INS_SUPPRIMER_INSCRIPTION', 'Supprimer votre inscription') ;
define ('INS_MESSAGE_BIENVENU', 'Vous &ecirc;tes inscrit') ;
define ('INS_FICHE_PERSONNELLE', 'Fiche personnelle') ;
define ('INS_FICHE_STRUCTURE','Fiche de la structure');
define ('INS_DECONNEXION', 'D&eacute;connexion') ;
define ('INS_INSCRIPTION', 'Inscription') ;
define ('INS_TEXTE_PERDU', 'Mot de passe perdu? Indiquez seulement votre adresse email et cliquez sur \'Valider\'') ;
define ('INS_SIGLE_DE_LA_STRUCTURE', 'Sigle de la structure');
define ('INS_SIGLE_STRUCTURE', 'Sigle de la structure <br />(s\'il n\'existe pas, mettre <br />le nom de la structure)');
define ('INS_VISIBLE', 'Je souhaite apparaitre sur la cartographie et sur l\'annuaire du site');
define ('INS_SIGLE_REQUIS', 'Sigle de la structure requis!');
define ('INS_NOM_STRUCTURE', 'Nom de la structure');
define ('INS_MAIL_STRUCTURE', 'Adresse électronique');
define ('INS_SITE_STRUCTURE', 'Site Internet de la structure');
define ('INS_NUM_AGREMENT', 'Numéro d\'agrément FPC');
define ('INS_NOM_WIKI', 'Nom wiki') ;
define ('INS_NOM_WIKI_REQUIS', 'Nom wiki requis') ;
define ('INS_DEJA_INSCRIT', 'D&eacute;j&agrave;  inscrit, identifiez-vous pour acc&eacute;der &agrave;  votre fiche personnelle :') ;
define ('INS_PAS_INSCRIT', 'Pas encore inscrit, enregistrez-vous!');
define ('INS_ERREUR_LOGIN', 'Utilisateur inconnu ou mot de passe erronn&eacute;') ;
define ('INS_SI_PASSE_PERDU', 'Recevez un nouveau mot de passe par courriel') ; ;
define ('INS_ENVOIE_PASSE', 'Envoi du mot de passe par courriel') ;
define ('INS_LAIUS_INSCRIPTION', 'Pas encore inscrit, inscrivez-vous !') ;
define ('INS_LAIUS_INSCRIPTION_2', '<strong>L\'inscription est libre et gratuite</strong>, elle vous permet de :<br /><ul>
<li> consulter l\'annuaire des personnes inscrites au R&eacute;seau et pouvoir ainsi &eacute;changer des informations</li>
<li> acc&eacute;der &agrave;  certaines informations diffus&eacute;es sur le site</li>
<li> vous inscrire &agrave;  des projets</li>
<li> r&eacute;diger des annonces d\'actualit&eacute;, d\'&eacute;v&eacute;nements, de s&eacute;jours et rencontres</li>
<li> r&eacute;diger des fiches ressources</li>
<li> recevoir un bulletin &eacute;lectronique d\'informations.</li></ul>') ;
define ('INS_ERREUR_SAISIE', 'Erreur de saisie') ;
define ('INS_VEUILLEZ_CORRIGER', 'Veuillez corriger.') ;
define ('INS_CARTOGRAPHIE','Cartographie');
define ('INS_CONFIG_MENU','Configuration de la cartographie du menu');
define ('INS_TITRE_CARTO','Titre &agrave; afficher dans le site pour cette cartographie');
define ('INS_FAUT_CONFIGURER_CARTO','Vous ne pouvez pas acc&eacute;der &agrave; cette cartographie car elle n\'a pas encore &eacute;t&eacute; configur&eacute;e.');
 
//============= L'envoie du mot de passe perdu par mail =============================
define ('INS_NOUVEAU_MOT_DE_PASSE', 'Votre nouveau mot de passe sur Educ-Envir.org et Ecole-et-Nature.org') ;
define ('INS_NOUVEAU_MOT_DE_PASSE_2', 'Votre nouveau mot de passe : ') ;
define ('INS_NOUVEAU_MOT_DE_PASSE_LAIUS', "\n\n".'Ce mot de passe vous permet de modifier les informations '.
'vous concernant dans les sites du réseau Ecole et Nature:'."\n".
'http://www.educ-envir.org/'."\n".'http://www.ecole-et-nature.org/'."\n\n".
'Identifiez-vous sur l\'un de ces sites, puis vous pourrez changer votre mot de passe en cliquant sur "Modifier votre inscription".') ;
define ('INS_MOT_DE_PASSE_ENVOYE_1', 'Votre nouveau mot de passe a &eacute;t&eacute; '.
'envoy&eacute; &agrave; l\'adresse') ;
define ('INS_MOT_DE_PASSE_ENVOYE_2', 'Relevez votre messagerie, notez votre nouveau mot de passe et identifiez vous à '.
'nouveau en allant à l\'inscription. N\'h&eacute;sitez pas à changer ce mot de passe '.
'pour en mettre un plus simple, plus facile &agrave; retenir.' );
//============= L'envoie d'un mail de confirmation ===================================
// Ne pas utiliser d'entités HTML
define ('INS_ENTETE_INSCRIPTION','Inscription sur le site');
define ('INS_MAIL_INSCRIPTION_1', 'Votre inscription a bien été prise en compte.\n'.
'Voici les informations que nous avons enregistré :\n') ;
define ('INS_MAIL_INSCRIPTION_2', '\nVous pouvez modifier votre inscription sur \nhttp://www.ecole-et-nature.org ou \nhttp://www.educ-envir.org\n'.
'rubrique S\'inscrire (le signe + sur le bandeau du haut).\n\n'.
'L\'équipe du réseau Ecole et Nature.') ;
define ('INS_MESSAGE_EXPIRATION','Le temps imparti à votre inscription s\'est écoulé...<br />'.
'Merci de bien vouloir vous réinscrire, en répondant rapidement au mail de confirmation.<br /><br />'.
'En vous remerciant de votre compréhension, à tout de suite!');
define ('INS_MESSAGE_VALIDER_INSCRIPTION','Validation de votre inscription sur le réseau :'.'\n'.
'Merci de vous être inscrit(e), soyez bienvenu(e)!'.'\n'.
'Veuillez cliquer sur le lien ci-dessous pour finaliser votre inscription:'.'\n');
define ('INS_MESSAGE_DEBUT_MAIL_INSCRIPTION', 'Bonjour,'."\n\n".
'Nous avons reçu une demande d\'inscription pour cette adresse mail.'."\n".
'Pour confirmer, cliquer sur le lien ci-dessous.'."\n\n" ) ;
define ('INS_MESSAGE_FIN_MAIL_INSCRIPTION', "\n\n".'L\'équipe de Vivreurope ') ;
// Envoir d'un mail à la coordination
define ('INS_MAIL_COORD_SUJET', 'Un nouvel inscrit au réseau ') ;
define ('INS_MAIL_COORD_CORPS', 'Une nouvelle inscription a été effectuée sur le site.') ;
define ('INS_CHAMPS_REQUIS', 'Champs requis') ;
 
define ('INS_MESSAGE_INSCRIPTION', 'Votre inscription a été prise en compte, relevez votre messagerie et cliquer sur le lien proposé pour terminer votre inscription.') ;
 
// CARTO
define ('INS_DATE_INS', 'Date d\'inscription') ;
define ('INS_CHECK_UNCHECK', 'Cocher les cases pour s&eacute;lectionner votre destinataire ou cocher / d&eacute;cocher tout') ;
define ('INS_ENVOYER_MAIL', 'Envoyer un email') ;
define ('INS_SUJET', 'Sujet') ;
define ('INS_MESSAGE', 'Message') ;
define ('INS_ENVOYER', 'Envoyer') ;
define ('INS_LABEL_PROJET', 'en tant que membre du réseau');
define ('INS_COULEUR', 'La couleur est proportionnelle au nombre de fiches.') ;
define ('INS_MONDE', 'Monde') ;
define ('INS_ECHELLE', 'Echelle : ') ;
define ('INS_CLIQUER_ACCEDER', 'Cliquer sur la carte pour zoomer ou acc&eacute;der aux informations&nbsp;&nbsp;') ;
define ('INS_VISUALISER_ZONE', 'Mettre en rouge la zone...');
define ('INS_MESSAGE_ENVOYE', '<br /><br />Votre message a &eacute;t&eacute; envoy&eacute;') ;
define ('INS_MESSAGE_ENVOYE_A', 'Ce message a été envoyé à') ; // pas d'entités HTML, c'est pour un mail
define ('INS_PIED_MESSAGE', '') ;
define ('INS_MAIL_ENVOYE', 'Le mail a &eacute;t&eacute; envoy&eacute; avec succ&egrave;s');
define ('INS_AUCUN_INSCRIT', 'aucun inscrit') ;
define ('INS_INSCRIT', 'inscrit') ;
define ('INS_TEXTE_FIN_MAIL', "\n".'---------------------------------------------------------------------------'."\n".
'Ce message vous est envoyé par l\'intermédiaire des sites Internet'."\n".
'du réseau '."\n".
'auquel vous êtes inscrit. D\'autres inscrits peuvent avoir reçu ce message.'."\n".
'Ne répondez que si vous êtes concerné, ou si vous avez des informations'."\n".
'utiles à transmettre au demandeur.'."\n".
'----------------------------------------------------------------------------') ;
define ('INS_NO_DESTINATAIRE', '<br /><br />Veuillez cocher au moins un destinataire pour votre mail<br />');
define ('INS_VOUS_DEVEZ_ETRE_INSCRIT', 'Vous devez être inscrit pour pouvoir accèder aux informations.<br />Identifiez-vous ou inscrivez-vous sur la page <a href="/Inscription">inscription</a> du site.');
define ('INS_SURVEILLANCE_ENVOI_MAIL', 'Surveillance envois de mails: ');
define ('INS_ENREGISTRER_ET_QUITTER', 'Enregistrer et quitter');
define ('INS_TABLE', 'Nom de la table dans la base SQL contenant des informations à cartographier');
define ('INS_TABLE_SUPPLEMENTAIRE', 'Nom de la table additionnelle contenant des informations à cartographier');
define ('INS_NOM_CHAMPS_PAYS', 'Nom du champs représentant le pays');
define ('INS_NOM_CHAMPS_CP', 'Nom du champs représentant le code postal');
define ('INS_REQUETE_SQL_SUPPLEMENTAIRE', 'Complément de requète SQL (conditions supplémentaires pour le WHERE)');
define ('INS_PAS_NECESSAIRE', 'Pas nécéssaire');
define ('INS_ANNUAIRE_MEMBRES','Annuaire des inscrits au site');
define ('INS_RECHERCHE_ANNUAIRE_DES_INSCRITS','Rechercher dans l\'annuaire des inscrits');
define ('INS_DIX_DERNIERES_INSCRIPTIONS','Les dix dernières inscriptions');
define ('INS_RECHERCHER','Rechercher');
define ('INS_PERSONNES_OU_STRUCTURES','des personnes ou des structures');
define ('INS_PERSONNES','uniquement des personnes');
define ('INS_STRUCTURES','uniquement des structures');
define ('INS_JE_RECHERCHE','Je recherche');
define ('INS_DEPARTEMENT_POUR_LA_FRANCE','D&eacute;partements pour le pays France');
define ('INS_TOUS_DEPARTEMENTS','tous les d&eacute;partements');
define ('INS_TOUS_PAYS','tous les pays');
define ('INS_NOM_ANNUAIRE','Nom (voire pr&eacute;nom) de la personne ou de la structure recherch&eacute;e');
define ('INS_ENTREES','entr&eacute;es trouv&eacute;es');
define ('INS_RESULTATS_RECHERCHE','Les r&eacute;sultats de la recherche');
define ('INS_PAS_DE_RESULTATS','Pas de r&eacute;sultats pour cette recherche, veuillez &eacute;largir vos crit&egrave;res de recherche.');
define ('INS_PAS_IDENTIFIE','Vous pouvez consulter la liste des inscrits, mais pas leur envoyer de message mail. Pour pouvoir les contacter par mail, il faudrait <a href="/Inscription">vous identifier ou vous inscrire au site</a>.');
define ('INS_CLIQUER_ELEMENT_LISTE','Cliquer sur un des &eacute;l&eacute;ments de la liste pour avoir ses informations d&eacute;taill&eacute;es.');
define ('INS_PRESENTATION', 'Pr&eacute;sentation');
define ('INS_ABONNEMENTS', 'Mes abonnements');
define ('INS_GESTION_DES_ABONNEMENTS', 'Gestion de mes abonnements');
define ('INS_ACTUALITES', 'Actualit&eacute;s');
define ('INS_ACTUALITES_DEPOSEES', 'Actualit&eacute;s d&eacute;pos&eacute;es');
define ('INS_RESSOURCES', 'Ressources');
define ('INS_RESSOURCES_ASSOCIEES','Ressources associ&eacute;es');
define ('INS_COMPETENCES', 'Comp&eacute;tences');
define ('INS_COMPETENCES_ASSOCIEES','Comp&eacute;tences associ&eacute;es');
define ('INS_RETOUR_A_LA_CARTE','Retour &agrave; la carte : ');
 
//annuaire backoffice
define ('INS_CONFIG_ANNUAIRE_BACKOFFICE','Configuration de la gestion de l\'annuaire');
define ('INS_TYPE_ANNUAIRE','Type d\'annuaire &agrave; configurer');
define ('INS_ANNUAIRE_BOTTIN','Annuaire du bottin');
define ('INS_ANNUAIRE_ADMIN_PAPYRUS','Annuaire des administrateurs Papyrus');
define ("AM_L_TITRE", "Chercher un adhérent") ;
define ("AM_L_RECHERCHER", "Rechercher") ;
define ("AM_L_PAYS", "Pays") ;
define ("AM_L_NOM", "Nom") ;
define ("AM_L_PRENOM", "Prénom") ;
define ("AM_L_VILLE", "Ville") ;
define ("AM_L_DEPARTEMENT", "Département") ;
define ("AM_L_MAIL", "Mail") ;
define ("AM_L_COTISANTS", "Cotisants") ;
define ("AM_L_GRP_RES", "Grouper les résultats") ;
define ("AM_L_TOUS", "Tous") ;
define ("AM_L_MAIL_SELECTION", "Envoyer un mail à la sélection") ;
 
//define ('ANN_PAS_D_INSCRITS', 'Pas d\'inscrits commençant par cette lettre dans l\'annuaire.');
//define ("ANN_LANGUES_PARLES", "Langues parl&eacute;s :") ;
//define ("ANN_EMAIL", "Courriel :") ;
//define ("ANN_MOT_DE_PASSE", "Mot de passe :") ;
//define ("ANN_REPETE_MOT_DE_PASSE", "R&eacute;p&eacute;ter le mot de passe :") ;
//define ("ANN_RETABLIR", "Rétablir") ;
//define ("ANN_VALIDER", "Valider") ;
//define ("ANN_MESSAGE_BIENVENU", "Vous &ecirc;tes inscrit au Réseau") ;
//define ("ANN_CLIQUEZ_LETTRE", 'Cliquez sur une lettre pour voir les membres du réseau.') ;
//define ("ANN_LISTE_INSCRIT_LETTRE", "Liste des inscrits &agrave; la lettre") ;
//define ("ANN_TITRE", 'Annuaire du réseau') ;
//define ("ANN_CHECK_UNCHECK", "Cocher les cases pour s&eacute;lectionner votre destinataire ou cocher / d&eacute;cocher tout") ;
//define ("ANN_ENVOYER_MAIL", "Envoyer un message aux personnes cochées") ;
//define ("ANN_SUJET", "Sujet") ;
//define ("ANN_MESSAGE", "Message") ;
//define ("ANN_ENVOYER", "Envoyer") ;
//define ("ANN_CLIC_CONFIRMATION", "Cliquez sur OK pour confirmer") ;
//define ("ANN_PAS_D_INSCRIT", "Pas d'inscrit") ;
//define ('ANN_DATE','Date d\'inscription');
//// ========================= Labels pour les mails ============================
//
//define ("ANN_VERIF_MAIL_COCHE", "Veuillez cocher au moins un destinataire pour votre mail" );
//define ("ANN_VERIF_TITRE", "Votre message doit comporter un titre <i>et</i> un corps") ;
//define ("ANN_PIED_MESSAGE", "\n---------------------------------------------------------------------------".
// "\nCe message vous est envoyé par l'intermédiaire du site Internet".
// "\n(http://www.domaine.org) du réseau , ".
// "\nauquel vous êtes inscrit. ".
// "\nNe répondez pas à ce message." ) ;
//
//define ('ANN_LOGUEZ_VOUS', 'Vous devez être inscrit au réseau pour accéder à l\'annuaire');
//
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.15 2006/12/01 13:23:16 florian
* integration annuaire backoffice
*
* Revision 1.14 2006/10/05 13:53:54 florian
* amélioration des fichiers sql
*
* Revision 1.13 2006/09/13 12:31:18 florian
* ménage: fichier de config Papyrus, fichiers temporaires
*
* Revision 1.12 2006/07/17 10:01:08 alexandre_tb
* correction du chemin vers le fichier de traduction local
*
* Revision 1.11 2006/07/04 09:36:16 alexandre_tb
* modification d'un label
*
* Revision 1.10 2006/04/11 08:39:19 alexandre_tb
* modification d'un label
*
* Revision 1.9 2006/04/10 14:01:36 florian
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
*
* Revision 1.8 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.7 2006/02/28 16:26:40 alexandre_tb
* changement d'une entité
*
* Revision 1.6 2006/02/28 14:07:23 alexandre_tb
* changement de la constante de langue
*
* Revision 1.5 2005/12/19 11:13:29 alexandre_tb
* Ajout de l'appel vers bottin_langue_fr.local.php
*
* Revision 1.4 2005/12/02 13:50:52 florian
* ajout gestion erreur javascript
*
* Revision 1.3 2005/11/24 16:17:52 florian
* changement template inscription + modifs carto
*
* Revision 1.2 2005/11/18 16:04:15 florian
* corrections de bugs, optimisations, tests pour rendre inscription stable.
*
* Revision 1.1 2005/11/17 18:48:02 florian
* corrections bugs + amélioration de l'application d'inscription
*
* Revision 1.3 2005/10/14 12:02:50 alexandre_tb
* Modification des labels pour les rendre plus générique
*
* Revision 1.2 2005/09/29 13:56:48 alexandre_tb
* En cours de production. Reste à gérer les news letters et d'autres choses.
*
* Revision 1.1 2005/09/28 13:19:08 alexandre_tb
* version initiale
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/langues/annuaire.langue.fr.inc.php
New file
0,0 → 1,67
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.langue.fr.inc.php,v 1.5 2007-04-11 08:30:12 neiluj Exp $
/**
* Fichier de traduction en français de l'application inscription
*
* Fichier de traduction en français de l'application inscription
*
*@package vecam
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2006/04/04 12:23:05 florian
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
*
* Revision 1.2 2005/10/03 09:37:56 alexandre_tb
* ajout d'un label
*
* Revision 1.1 2005/09/22 14:02:49 ddelon
* nettoyage annuaire et php5
*
* Revision 1.4 2005/09/22 13:30:49 florian
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
*
* Revision 1.2 2005/03/08 09:43:55 alex
* changement de label
*
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
* Import initial
*
* Revision 1.1 2005/01/03 17:19:32 alex
* version initiale
*
* Revision 1.1 2004/06/18 08:54:55 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/bottin/presentations/logos/vide.txt
--- bottin/presentations/inscription.css (revision 0)
+++ bottin/presentations/inscription.css (revision 1976)
@@ -0,0 +1,148 @@
+/*
+
+ +----------------------------------------------------------------------------+
+ | inscription.css |
+ +----------------------------------------------------------------------------+
+ | Copyright (c) 2004 Tela Botanica |
+ +----------------------------------------------------------------------------+
+ | Feuille de style specifique a l'application inscription de Tela Botanica |
+ +----------------------------------------------------------------------------+
+ | Auteur : Tamara LE BOURG <tamara@tela-botanica.org> |
+ +----------------------------------------------------------------------------+
+
+*/
+
+.symbole_obligatoire {color:red;}
+
+#table_inscription {
+ border: 1px solid #E8AE3B;
+ border-collapse: collapse;
+ width:100%;
+}
+/*FORMULAIRE INSCRIPTION*/
+
+#formulaire_inscription fieldset {
+ border: 0px;
+ margin: 0px;
+ padding: 0px;}
+
+#formulaire_inscription ul {
+ padding:0px;
+}
+
+.liste_inscription {
+ background: transparent;
+ padding:3px 0px;
+}
+.liste_inscription > input, select {
+ position:absolute;
+ left:200px;
+}
+
+.liste_inscription > input+input {
+ position:absolute;
+ left:350px;
+}
+.groupe_formulaire_1 input {
+ position:absolute;
+ left:200px;
+}
+.groupe_formulaire_2 label {
+ position:absolute;
+ left:400px;
+}
+.groupe_formulaire_2 input {
+ position:absolute;
+ left:450px;
+}
+
+/*
+#contenu form fieldset ul li {
+ text-align: left;
+ padding-left: 0px;
+ margin-left: 0px;
+}
+
+/*
+#contenu form label {
+ float: left;
+ width: 20%;
+ text-align: left;
+}
+*/
+
+th {
+ border: 1px 0px 1px 0px solid #E8AE3B;
+ background-color: #FFCD9B;
+ color: #775522;
+ padding: 2px;
+}
+
+ul.liste_inscription {
+ margin: 0px;
+}
+
+li.liste_inscription {
+ list-style-type: none;
+ margin: 4px;
+}
+
+.groupe_formulaire {
+ width:50%;
+}
+
+.ligne_impaire {
+ background-color: #FFFFFF;
+ font-size: 85%;
+ border: none;
+ padding: 2px;
+
+}
+
+.ligne2_impaire {
+ background-color: #FFFFFF;
+ font-size: 85%;
+ border: none;
+ padding: 2px;
+}
+
+.ligne_paire {
+ background-color: #FFEBD7;
+ font-size: 85%;
+ border: none;
+ padding: 2px;
+
+}
+
+.ligne2_paire {
+ background-color: #FFEBD7;
+ font-size: 85%;
+ border: none;
+ padding: 2px;
+}
+
+.titre1_inscription {
+ font-family: Arial, Verdana, Helvetica, sans-serif;
+ margin: 3px 0;
+ font-size: 130%;
+ margin-top: 1em;
+}
+
+.titre2_inscription {
+ font-family: Arial, Verdana, Helvetica, sans-serif;
+ margin: 3px 0;
+ font-size: 110%;
+ margin-top: 1em;
+}
+
+.inscription_erreur {
+ width:60%;
+ padding:0.2em;
+ margin:0.2em;
+ color: #FF0000;
+ font-size: 110%;
+ text-align: center;
+ font-weight: bold;
+ text-decoration: blink;
+ border: 0.2em solid #FF0000;
+}
\ No newline at end of file
/branches/v2.0-narmer/client/bottin/presentations/fonds/monde_masque5c.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/monde_masque5c.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/samerique_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/samerique_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/afrique_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/afrique_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/moyenorient.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/moyenorient.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/france_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/france_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/europe_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/europe_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/oceanie_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/oceanie_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/asie.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/asie.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/moyenorient_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/moyenorient_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/namerique.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/namerique.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/monde5c.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/monde5c.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/samerique.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/samerique.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/afrique.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/afrique.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/asie_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/asie_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/france.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/france.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/europe.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/europe.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/namerique_masque.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/namerique_masque.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/fonds/oceanie.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/fonds/oceanie.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/signature_numerique.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/bottin/presentations/signature_numerique.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/bottin/presentations/cartographie.css
New file
0,0 → 1,101
/*
 
+----------------------------------------------------------------------------+
| cartographie.css |
+----------------------------------------------------------------------------+
| Copyright (c) 2004 Tela Botanica |
+----------------------------------------------------------------------------+
| Feuille de style specifique a l'application cartographie de Tela Botanica |
+----------------------------------------------------------------------------+
| Auteur : Tamara LE BOURG <tamara@tela-botanica.org> |
+----------------------------------------------------------------------------+
 
*/
 
#carto {
text-align:left;
}
 
#table_carto {
border: 1px solid #E8AE3B;
border-collapse: collapse;
width:100%;
}
 
.avertissement_carto {
font-size:10px;
font-family:Verdana, Sans-serif;
margin: 10px 77px 0 0;
text-align:justify;
}
 
a.chemin_carto {
text-decoration:none;
font-weight:bold;
}
 
th {
border: 1px 0px 1px 0px solid #E8AE3B;
background-color: #FFCD9B;
color: #775522;
padding: 2px;
}
 
ul.liste_carto {
margin: 0px;
}
 
li.liste_carto {
list-style-type: none;
margin: 0px;
}
 
.ligne_impaire {
background-color: #FFFFFF;
font-size: 85%;
border: none;
padding: 2px;
 
}
 
.ligne2_impaire {
background-color: #FFFFFF;
font-size: 85%;
border: none;
padding: 2px;
}
 
.ligne_paire {
background-color: #FFEBD7;
font-size: 85%;
border: none;
padding: 2px;
 
}
 
.ligne2_paire {
background-color: #FFEBD7;
font-size: 85%;
border: none;
padding: 2px;
}
 
.titre1_carto {
font-family: Arial, Verdana, Helvetica, sans-serif;
margin: 3px 0;
font-size: 130%;
margin-top: 1em;
}
 
.titre2_carto {
font-family: Arial, Verdana, Helvetica, sans-serif;
margin: 3px 0;
font-size: 110%;
margin-top: 1em;
}
 
.carto_erreur {
color: #CC6633;
font-weight: bold;
text-decoration: blink;
}
/branches/v2.0-narmer/client/integrateur_wikini/langues/iw_langue_fr.inc.php
New file
0,0 → 1,63
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Integrateur Wikini. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_langue_fr.inc.php,v 1.1 2005-08-18 10:20:01 ddelon Exp $
/**
* Traduction de l'intégrateur de page Wikini : fr
*
* Fichier de traduction en français de l'intégrateur de page Wikini.
*
*@package IntegrateurWikini
*@subpackage Traduction
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:01 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/langues/adwi_langue_fr.inc.php
New file
0,0 → 1,104
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Papyrus. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adwi_langue_fr.inc.php,v 1.6 2006-06-19 10:06:29 alexandre_tb Exp $
/**
* Gestion des langues de l'application ADWI : administration des Wikini
*
* Contient les constantes pour la langue française de l'application ADWI
*
*@package Admin_Wikini
*@subpackage Langues
//Auteur original :
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des CONSTANTES |
// +------------------------------------------------------------------------------------------------------+
define ("ADWI_NOM_WIKINI", "Nom Wikini") ;
define ("ADWI_BDD_HOTE", "Serveur base de donnee") ;
define ("ADWI_BDD_NOM", "Base de donnée") ;
define ("ADWI_BDD_UTILISATEUR", "Utilisateur") ;
define ("ADWI_BDD_MDP", "Mot de Passe") ;
define ("ADWI_TABLE_PREFIX", "Préfixe des tables") ;
define ("ADWI_PAGE", "Page de démarrage") ;
define ("ADWI_CHEMIN", "Chemin d'accès") ;
 
define ("ADWI_MODIFIER", "Modifier") ;
define ("ADWI_SUPPRIMER", "Supprimer") ;
define ("ADWI_SELECTIONNER", "Selection") ;
define ("ADWI_CHOISIR", "Choisir") ;
define ("ADWI_AJOUTER", "Ajouter un Wikini") ;
define ("ADWI_VISITER", "Voir Contenu ") ;
 
 
define("ADWI_TITRE_SELECTION","Sélection Wikini pour le menu");
 
define("ADWI_LISTE_WIKINI","Liste des Wikini enregistrés");
 
define("ADWI_PAGE_DEMARRAGE","Page de démarrage");
 
define ("ADWI_NOM_WIKINI_ALERTE", "Vous devez spécifier un nom") ;
define ("ADWI_NOM_WIKINI_NON_VALIDE", "Le nom wiki n'est pas valide, il ne doit contenir que des lettres sans accents.") ;
 
define ("ADWI_CHAMPS_REQUIS", "Indique les champs requis") ;
 
define ("ADWI_ANNULER", "Annuler") ;
define ("ADWI_VALIDER", "Valider") ;
define ("ADWI_RETOUR", "Retour") ;
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/09/06 08:35:36 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.3 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/08/31 17:34:52 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/03/09 10:40:37 alex
* version initiale
*
* Revision 1.1 2004/12/13 18:07:38 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/presentations/styles/wikini.css
New file
0,0 → 1,9
.edit {margin:5px 0;border: 1px solid #3082AA;width:520px;}
.buttons {padding:1px; background: #7FB1CA;margin: 1; float:left; }
.raise{ background: #7FB1CA;margin:1; float:left; }
.press {background: #7FB1CA; margin:1; float:left; }
/* ci dessous les petits champs */
.ACsearchbox {padding: 0; margin: 0; font-size: 10px; }
.texteChampsImage {font-size: 10px; }
#toolbar { float:left;margin: 0; width:520px; padding: 2px; height:20px; background: #7FB1CA; text-align:left; }
.boutons_wiki {margin-left:200px;}
/branches/v2.0-narmer/client/integrateur_wikini/integrateur_wikini.admin.php
New file
0,0 → 1,297
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: integrateur_wikini.admin.php,v 1.7 2007-04-06 08:40:13 neiluj Exp $
/**
* Gestion des Wikini associé à un menu pour papyrus : lit et stocke les informations dans la
* champs gm_application_arguments de la table gen_menu
*
* Principe :
* Lecture arguments, decodage et affichage : Nom Wiki et Page Demarrage
* Affichage de l'ensemble des Wiki Disponible (avec leur page par Defaut)
* Choix d'un wiki
* Mise à jour
*
* TODO : gerer le defaut sur demmarage
*
* ------------ --------------
* Wiki : | | Page Principale : | |
* ------------ --------------
*
* Fragmenteur choix (selection uniquement)
*
* --------------------------------------
* | Nom Wiki | Page Demmarage |
* --------------------------------------
* | Wikini_01 | |
* ---------------------------------------
* | Wikini_02 | ChatMot |
* ---------------------------------------
*
* Valider - Annuler
*
*
*@package IntegrateurWikini
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $ $Date: 2007-04-06 08:40:13 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// TODO GEN_GER_STYLE !!!
//GEN_stockerStyleExterne('afficheur', AFFI_CHEMIN_STYLE.'afficheur.css');
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclusion du fichier de configuration de cette application.*/
require_once 'configuration/adwi_configuration.inc.php';
 
 
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
 
// Inclusion des fichiers de traduction de l'appli ADWI dePapyrus
if (file_exists(ADWI_CHEMIN_LANGUE.'adwi_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
require_once ADWI_CHEMIN_LANGUE.'adwi_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
} else {
/** Inclusion du fichier de traduction par défaut.*/
require_once ADWI_CHEMIN_LANGUE.'adwi_langue_'.ADWI_I18N_DEFAUT.'.inc.php';
}
 
 
class Integrateur_Wikini_Admin {
/** Fonction redigerContenu() - Affiche le formulaire de rédaction
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
 
 
$res='';
 
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$url = $GLOBALS['_GEN_commun']['url'] ;
$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
$url_origine=$url;
$url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$url->addQueryString('adme_action', $_GET['adme_action']);
// Recherche parametres menu actif : ils ne sont pas present dans le contexte, quel dommage !
$requete_menu = 'SELECT gen_menu.* '.
'FROM gen_menu '.
'WHERE gm_id_menu = '.$_GET['adme_menu_id'];
$resultat_menu = $db->query($requete_menu);
(DB::isError($resultat_menu))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete_menu))
: '';
$info_menu = $resultat_menu->fetchRow(DB_FETCHMODE_OBJECT);
$resultat_menu->free();
if (isset($info_menu->gm_application_arguments)) {
$arguments = explode(' ', $info_menu->gm_application_arguments);
 
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i]);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
isset ($GLOBALS['action']) ? '' : $GLOBALS['action'] = '' ; // On déclare action si elle n'existe pas
if (!$auth->getAuth()) {
return 'Identifiez-vous' ;
}
 
 
// Mise à jour ?
if (isset ($GLOBALS['action'])) {
$arguments_menu="";
if ((isset($_POST['code_alpha_wikini'])) && (!empty($_POST['code_alpha_wikini']))) {
$arguments_menu.="wikini=".($_POST['code_alpha_wikini'])." ";
}
if ((isset($_POST['page'])) && (!empty($_POST['page']))) {
$arguments_menu.="page=".($_POST['page'])." ";
}
$requete = "update gen_menu set gm_application_arguments = '".$arguments_menu .
"' where gm_id_menu =".$_GET['adme_menu_id'];
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
 
}
}
// Affichage par defaut
// Formulaire Selection Wiki
$formulaire =& new HTML_QuickForm('form_selection_wiki', 'post', str_replace('&amp;', '&', $url->getUrl()));
 
$res .= "<h2>". ADWI_TITRE_SELECTION." ".$info_menu->gm_nom."</h2";
$squelette =& $formulaire->defaultRenderer();
$squelette->setGroupTemplate('<table>{content}</table>', 'id');
$squelette->setGroupElementTemplate('<tr><td>{element}<!-- BEGIN required --><!-- END required-->{label}</td></tr>', 'id');
$formulaire->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array ('size' => 20));
$formulaire->addElement ('text', 'page', ADWI_PAGE_DEMARRAGE , array ('size' => 20));
 
 
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('button', 'retour', ADWI_RETOUR, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_origine->getURL())."'"));
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', ADWI_VALIDER);
$formulaire->addGroup($buttons, null, null, '&nbsp;');
 
// Initialisation
if ((isset($_GET['id_wikini'])) && (!empty($_GET['id_wikini']))) {
$requete = "select * from gen_wikini where gewi_id_wikini=".$_GET['id_wikini'] ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(), E_USER_WARNING) ;
return ;
}
$info_wikini = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$formulaire->setDefaults(array('code_alpha_wikini'=>$info_wikini->gewi_code_alpha_wikini)) ;
$formulaire->setDefaults(array('page'=>$info_wikini->gewi_page)) ;
$resultat->free();
}
else {
if ((isset($info_application->wikini)) && (!empty($info_application->wikini))) {
$formulaire->setDefaults(array('code_alpha_wikini'=>$info_application->wikini)) ;
}
if ((isset($info_application->page)) && (!empty($info_application->page))) {
$formulaire->setDefaults(array('page'=>$info_application->page)) ;
}
}
$res .= $formulaire->toHTML() ;
 
$res .='<br/>';
 
$res .= "<h2>". ADWI_LISTE_WIKINI.": </h2";
// Comportement par défaut
// requete sur la table gen_wikini pour affichage de la liste des Wikini
$requete = "select gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
$liste = new HTML_TableFragmenteur () ;
$liste->construireEntete(array (ADWI_NOM_WIKINI,ADWI_PAGE, ADWI_SELECTIONNER)) ;
$tableau_wikini = array() ;
while ($ligne = $resultat->fetchRow()) {
$url->addQueryString ('id_wikini', $ligne[0]) ;
array_push ($tableau_wikini, array ($ligne[1]."\n", // Première colonne, le nom de l'application
$ligne[2]."\n", // Deuxieme colonne, la page par defaut
'<a href="'.$url->getURL()."&amp;action=validation".'">'.ADWI_CHOISIR.'</a>'."\n",
));
}
$liste->construireListe($tableau_wikini) ;
$res .= $liste->toHTML();
return $res ;
}
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2006/04/28 12:41:26 florian
* corrections erreurs chemin
*
* Revision 1.4 2005/09/30 07:48:35 ddelon
* Projet Wikini
*
* Revision 1.3 2005/09/14 09:12:15 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/09/06 08:35:36 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/configuration/iw_config.inc.php
New file
0,0 → 1,197
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Integrateur Wikini. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_config.inc.php,v 1.10 2007-04-11 08:30:12 neiluj Exp $
/**
* Configuration de l'intégrateur de page Wikini
*
* Fichier de configuration de l'intégrateur de page Wikini
*
*@package IntegrateurWikini
*@subpackage Configuration
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.10 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// Définition de la langue
/** Constante stockant la valeur i18n fournie par Papyrus et pouvant être passée dans l'url.*/
define('IW_I18N', $GLOBALS['_GEN_commun']['i18n']);
 
// +------------------------------------------------------------------------------------------------------+
// Définition des chemins de fichiers.
/** Constante stockant le chemin du dossier racine.*/
define('IW_CHEMIN_RACINE', GEN_CHEMIN_CLIENT.'integrateur_wikini'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant les traductions.*/
define('IW_CHEMIN_LANGUES', IW_CHEMIN_RACINE.'langues'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant la bibliothèque de code.*/
define('IW_CHEMIN_BIBLIO', IW_CHEMIN_RACINE.'bibliotheque'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant la bibliothèque Wikini.*/
define('IW_CHEMIN_BIBLIO_WIKINI', IW_CHEMIN_BIBLIO.'wikini'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant la bibliothèque Wikini.*/
define('IW_CHEMIN_BIBLIO_ACEDITOR', IW_CHEMIN_BIBLIO.'ACeditor'.GEN_SEP);
/** Constante stockant le chemin du dossier contenant les sites Wikini.*/
define('IW_CHEMIN_WIKINI', GEN_CHEMIN_WIKINI);
/** Chemin vers la bibliothèque API.*/
define('IW_CHEMIN_BIBLIOTHEQUE_API', GEN_CHEMIN_API);
/** Chemin vers la bibliothèque API : fckeditor.*/
 
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
if (!isset($GLOBALS['_GEN_commun']['info_application']->wikini)) {
$GLOBALS['_GEN_commun']['info_application']->wikini = 'defaut';
}
 
$config_wikini = adwi_valeurs_par_code_alpha($GLOBALS['_GEN_commun']['info_application']->wikini,&$GLOBALS['_GEN_commun']['pear_db'] );
 
// Parametres de base de donnée de Papyrus par défaut
 
 
if ((!isset($config_wikini['bdd_hote'])) || (empty($config_wikini['bdd_hote']))) {
$config_wikini['bdd_hote'] = PAP_BDD_SERVEUR;
}
 
if ((!isset($config_wikini['bdd_nom'])) || (empty($config_wikini['bdd_nom']))) {
$config_wikini['bdd_nom'] = PAP_BDD_NOM;
}
 
if ((!isset($config_wikini['bdd_utilisateur'])) || (empty($config_wikini['bdd_utilisateur']))) {
$config_wikini['bdd_utilisateur'] = PAP_BDD_UTILISATEUR;
}
 
if ((!isset($config_wikini['bdd_mdp'])) || (empty($config_wikini['bdd_mdp']))) {
$config_wikini['bdd_mdp'] = PAP_BDD_MOT_DE_PASSE;
}
 
if ((!isset($config_wikini['table_prefix'])) || (empty($config_wikini['table_prefix']))) {
$config_wikini['table_prefix'] = $GLOBALS['_GEN_commun']['info_application']->wikini.'_';
}
 
// Ordre de selection de la page de demarrage :
// Page Specifiee dans le menu
// Page par defaut du Wiki enregistré
// PagePrincipale
 
if ((!isset($GLOBALS['_GEN_commun']['info_application']->page)) || (empty($GLOBALS['_GEN_commun']['info_application']->page))) {
if ((!isset($config_wikini['page'])) || (empty($config_wikini['page']))) {
$config_wikini['page'] = 'PagePrincipale';
}
}
else {
$config_wikini['page'] = $GLOBALS['_GEN_commun']['info_application']->page;
}
 
if ((!isset($config_wikini['code_alpha_wikini'])) || (empty($config_wikini['code_alpha_wikini']))) {
$config_wikini['code_alpha_wikini'] = $GLOBALS['_GEN_commun']['info_application']->wikini;
}
 
/** Constante stockant le chemin du dossier contenant le site Wikini en cours */
 
/** Utilité ? **/
if ((!isset($config_wikini['chemin'])) || (empty($config_wikini['chemin']))) {
define('IW_CHEMIN_WIKINI_COURANT', GEN_CHEMIN_WIKINI.$config_wikini['code_alpha_wikini'].GEN_SEP);
}
else {
define('IW_CHEMIN_WIKINI_COURANT',$config_wikini['chemin'].GEN_SEP);
}
 
/** Constante stockant le chemin du dossier contenant le site Wikini en cours */
define('IW_CHEMIN_WIKINI_COURANT_FORMATTER', IW_CHEMIN_WIKINI_COURANT.'formatters'.GEN_SEP);
global $wikini_config_defaut;
// Ajout dans l'URL générale du Query String wiki spécifique à l'intégrateur
$GLOBALS['_GEN_commun']['url']->addQueryString('wiki', '');
$wikini_config_defaut = array(
"wakka_version" => "0.1.1",
"wikini_version" => "0.4.3",
'mysql_host' => $config_wikini['bdd_hote'],
'mysql_database' => $config_wikini['bdd_nom'],
'mysql_user' => $config_wikini['bdd_utilisateur'],
'mysql_password' => $config_wikini['bdd_mdp'],
'table_prefix' => $config_wikini['table_prefix'],
'root_page' => $config_wikini['page'],
'wakka_name' => $config_wikini['code_alpha_wikini'],
'base_url' => str_replace('&amp;', '&', $GLOBALS['_GEN_commun']['url']->getUrl()),
'rewrite_mode' => '0',
'meta_keywords' => '',
'meta_description' => '',
'action_path' => IW_CHEMIN_WIKINI_COURANT.'actions',
'handler_path' => IW_CHEMIN_WIKINI_COURANT.'handlers',
'header_action' => 'header',
'footer_action' => 'footer',
'navigation_links' => 'DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur',
'referrers_purge_time' => 24,
'pages_purge_time' => 90,
'default_write_acl' => '*',
'default_read_acl' => '*',
'default_comment_acl' => '*',
'preview_before_save' => '0');
// Suppression de l'URL générale du Query String wiki spécifique à l'intégrateur
$GLOBALS['_GEN_commun']['url']->removeQueryString('wiki', '');
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2006/11/09 17:50:41 jp_milcent
* Compatibilité avec les nouveaux permaliens de Papyrus.
*
* Revision 1.7 2005/09/14 09:12:15 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.6 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.5 2005/09/06 08:35:36 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.3 2005/08/31 17:34:52 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/03/02 17:47:05 jpm
* Ajout des fichiers necessaires à l'intégrateur de wikini.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/configuration/adwi_configuration.inc.php
New file
0,0 → 1,87
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adwi_configuration.inc.php,v 1.2 2005-09-09 09:37:17 ddelon Exp $
/**
* Fichier de configuration général de l'application Administration des wikini
*
* Permet de définir certains paramètres valables pour toutes l'application
* Administrateur des Wikni
*
*@package Admin_Wikini
*@subpackage Configuration
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Constante stockant la valeur de la langue par défaut pour l'appli ADAP.*/
define('ADWI_I18N_DEFAUT', GEN_I18N_ID_DEFAUT);
 
// Chemin des fichiers à inclure.
/** Chemin vers la bibliothèque PEAR.*/
define('ADWI_CHEMIN_BIBLIOTHEQUE_PEAR', '');
/** Chemin vers la bibliothèque API.*/
define('ADWI_CHEMIN_BIBLIOTHEQUE_API', GEN_CHEMIN_API);
/** Chemin vers la bibliothèque de Papyrus.*/
define('ADWI_CHEMIN_BIBLIOTHEQUE_GEN', GEN_CHEMIN_BIBLIO);
 
 
 
// Chemin vers les dossiers de l'application
/** Chemin vers l'application Admin Auth de Papyrus.*/
define('ADWI_CHEMIN_APPLICATION', GEN_CHEMIN_CLIENT.'integrateur_wikini/');
/** Chemin vers la bibliothèque de l'application gestion des Wikini de Papyrus.*/
define('ADWI_CHEMIN_BIBLIOTHEQUE', ADWI_CHEMIN_APPLICATION.'bibliotheque/');
/** Chemin vers la reference Wikini de l'application gestion des Wikini de Papyrus.*/
define('ADWI_CHEMIN_BIBLIOTHEQUE_WIKINI', ADWI_CHEMIN_BIBLIOTHEQUE.'wikini/');
/** Chemin vers les fichiers de traduction de l'application Admin Auth de Papyrus.*/
define('ADWI_CHEMIN_LANGUE', ADWI_CHEMIN_APPLICATION.'langues/');
/** Constante stockant le chemin du dossier contenant les sites Wikini.*/
define('ADWI_CHEMIN_WIKINI', GEN_CHEMIN_WIKINI);
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2004/12/13 18:07:33 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/admin_wikini.php
New file
0,0 → 1,100
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: admin_wikini.php,v 1.9 2006-04-28 12:41:26 florian Exp $
/**
* Application gérant les Wikini associe à Papyrus
*
*@package Admin_Wikini
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclusion des fonctions de cette application.*/
require_once 'bibliotheque/iw_admin_wikini.fonct.php';
 
 
function afficherContenuCorpsHTML() {
return admin_afficherContenuCorpsHTML();
}
 
function afficherContenuCorps()
{
 
return admin_afficherContenuCorps();
}
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.7 2005/10/21 20:55:06 ddelon
* todo wikini
*
* Revision 1.6 2005/09/30 07:48:35 ddelon
* Projet Wikini
*
* Revision 1.5 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/09/06 08:35:36 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.3 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/08/31 17:34:52 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/03/09 10:46:17 jpm
* Changement d'un nom de fichier.
*
* Revision 1.3 2005/03/09 10:40:26 alex
* version initiale
*
* Revision 1.2 2005/02/28 10:32:59 jpm
* Changement de nom de dossier.
*
* Revision 1.1 2004/12/13 18:07:19 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/documentation/gen_application.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/documentation/gen_application.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/documentation/integrateur_wikini_v0.24.sql
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/documentation/integrateur_wikini_v0.24.sql
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/integrateur_wikini.php
New file
0,0 → 1,85
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Integrateur Wikini. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: integrateur_wikini.php,v 1.13 2006-04-28 12:41:26 florian Exp $
/**
* Integrateur de page Wikini
*
* Application permettant d'intégrer des pages wikini dans Papyrus.
*
*@package IntegrateurWikini
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.13 $ $Date: 2006-04-28 12:41:26 $
*
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/**
* Renvoie le menu général de l'integrateur Wikini : derniers changement etc.
*
* @return string
* @access public
*/
require_once 'bibliotheque/iw_integrateur.fonct.php';
 
 
function afficherContenuMenu()
{
return afficherPageMenuWikini();
}
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
*
* Elle retourne le contenu de l'application.
*
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
*/
function afficherContenuCorps()
{
return afficherPageWikini();
}
// TODO : qu'affiche-t-on en pied ?
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
*
* Elle retourne le pied de l'application.
*
* @return string du code XHTML correspondant au pied renvoyé par l'application.
*/
function afficherContenuPied()
{
return '';
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/adwi_HTML_formulaireWikini.class.php
New file
0,0 → 1,124
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adwi_HTML_formulaireWikini.class.php,v 1.12 2007-04-20 13:14:05 neiluj Exp $
/**
*
* Admin Wikini
*
* Classe affichage gestion des Wikini de Papyrus
*
*@package projet
//Auteur original :
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireProjet
* Cette classe représente un formulaire pour saisir un wikini ou le modifier
*/
class HTML_formulaireWikini extends HTML_QuickForm
{
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireWikini( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire($url_retour)
{
 
$this->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array ('size' => 60)) ;
$this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_ALERTE, 'required', '', 'client') ;
$this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'lettersonly', '', 'client');
// Défault : PagePrincipale
$this->addElement ('text', 'page', ADWI_PAGE, array ('size' => 60)) ;
 
$this->addElement ('static', '', 'Configuration avancée : ') ;
 
$this->addElement ('text', 'bdd_hote', ADWI_BDD_HOTE, array ('size' => 60)) ;
$this->addElement ('text', 'bdd_nom', ADWI_BDD_NOM, array ('size' => 60)) ;
$this->addElement ('text', 'bdd_utilisateur', ADWI_BDD_UTILISATEUR, array ('size' => 60)) ;
$this->addElement ('password', 'bdd_mdp', ADWI_BDD_MDP, array ('size' => 60)) ;
$this->addElement ('text', 'table_prefix', ADWI_TABLE_PREFIX, array ('size' => 60)) ;
$this->addElement ('text', 'chemin', ADWI_CHEMIN, array ('size' => 60)) ;
 
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.ADWI_CHAMPS_REQUIS) ;
 
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('button', 'annuler', ADWI_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_retour->getURL())."'",
'id' => 'annuler', 'class' => 'bouton'));
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', ADWI_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
$this->addGroup($buttons, null, null, '&nbsp;');
 
} // end of member function _construitFormulaire
} // end of HTML_formulaireProjet
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/iw_encodage.fonct.php
New file
0,0 → 1,81
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.3 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of eFlore-Chorologie. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_encodage.fonct.php,v 1.1 2005-08-18 10:20:09 ddelon Exp $
/**
* Fonctions manipulant les encodages
*
* Fichiers contenant des fonctions manipulant l'encodage.
*
*@package IntegrateurWikini
*@subpackage Fonctions
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:09 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE DES FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/**
* La fonction remplacerEntiteHTLM() remplace des caractères par les entités html.
*
* Cette fonction retourne un texte dans lequel touts les caractères correspondant
* à des entités html sont remplacés par la valeur de l'entité, à l'exception
* des caractères <, >, & et ".
* Cela permet de remplacer toutes les entités dans une chaine contenant du html.
*
*@param string la chaîne html à parsser.
*@return string contient la chaîne html avec les entités intégrées.
*/
 
function remplacerEntiteHTLM($texte)
{
$texte_retour = '';
$tab_entites = get_html_translation_table(HTML_ENTITIES);
unset($tab_entites['"']);
unset($tab_entites['<']);
unset($tab_entites['>']);
unset($tab_entites['&']);
$tab_entites[' & '] = ' &amp; ';
return strtr($texte, $tab_entites);
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/05/19 15:11:49 jpm
* Ajout du remplacement des & par des &amp;
*
* Revision 1.1 2005/03/02 17:47:05 jpm
* Ajout des fichiers necessaires à l'intégrateur de wikini.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/iw_affichage_xhtml.fonct.php
New file
0,0 → 1,84
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.3 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Integrateur Wikini. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_affichage_xhtml.fonct.php,v 1.2 2005-08-25 08:59:12 ddelon Exp $
/**
* Fichier permettant d'inclure les données dans du XHTML.
*
* Fichier contenant des fonctions retournant du XHTML une fois les données passées en paramêtre incluse à l 'intérieur.
*
*@package IntegrateurWikini
*@subpackage Fonctions
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.2 $ $Date: 2005-08-25 08:59:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/**
* Fonction inclusion_html() - Gestion des inclusions XHTML dans le code PHP.
*
* Cette fonction retourne du XHTML à insérer dans le code PHP.
*
* @param string le type d'inclusion de XHTML à retourner.
* @param array le tableau des paramêtre à inclure dans le XHTML à retourner.
* @return string contient du XHTML à insérer dans le code PHP.
*/
function inclusion_html($type_inclusion, $variable = array()){
$html_renvoyer = '';
switch ($type_inclusion){
// +------------------------------------------------------------------------------------------------------+
// LES TITRES
// +------------------------------------------------------------------------------------------------------+
// LES TEXTES
// +------------------------------------------------------------------------------------------------------+
// LES PIEDS DE PAGES
case "pied_page" :
break;
}//fin du switch
return remplacerEntiteHTLM($html_renvoyer);
}//fin fonction inclusion_html
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/08/18 10:20:08 ddelon
* Integrateur Wikini et Acces PEAR
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php
New file
0,0 → 1,486
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Integrateur Wikini. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_integrateur.fonct.php,v 1.19 2006-08-29 20:22:41 ddelon Exp $
/**
* Fonctions de l'integrateur de page Wikini
*
* Application permettant d'intégrer des pages wikini dans Papyrus.
*
*@package IntegrateurWikini
//Auteur original :
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.19 $ $Date: 2006-08-29 20:22:41 $
*
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
 
/** Inclusion de la classe PEAR de gestion des URL. */
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
 
require_once PAP_CHEMIN_API_PEAR.'Net/URL.php';
 
// TODO : un seul fichier de configuration ?
/** Inclusion du fichier de configuration de cette application.*/
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
 
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
 
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
 
global $wikini_config_defaut;
global $wiki;
global $wiki_p;
 
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
 
if ( ! isset( $_REQUEST['wiki'] ) ) {
$_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
}
 
$server=$_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF']="wakka.php";
 
// Utilise le wakkaconfig de la racine ...
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
// TODO : verifier bon dimensionnement des champs et clef de la table papyrus_wiki
// TODO : creation des tables par defaut à l'installation d'un wikini
// TODO : Fusion des fichiers de configuration ?
 
//echo IW_CHEMIN_WIKINI_COURANT.'wakka.php';
if (!file_exists(IW_CHEMIN_WIKINI_COURANT.'wakka.php')) {
if (GEN_DEBOGAGE) {
$GLOBALS['_GEN_commun']['debogage_info'] .=
'ERREUR Papyrus : le fichier '.IW_CHEMIN_WIKINI_COURANT.'wakka.php n\'existe pas.<br />'.
'Identifiant : '. $id_fichier .'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier : '. __FILE__;
}
return ;
}
ob_start();
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
include_once(IW_CHEMIN_WIKINI_COURANT."/formatters/tableaux.php");
include_once(IW_CHEMIN_WIKINI_COURANT."/actions/attach.class.php");
 
ob_end_clean();
$_SERVER['PHP_SELF']=$server;
 
 
// On surcharge la classe Wiki pour en faire ce qu'on en veut
Class Wiki_Papyrus extends Wiki {
 
 
function Header() {
 
return;
}
 
function Footer() {
echo "<div class=\"footer\">";
echo $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour modifier cette page.\">Modifier cette page</a> ::\n" : "";
echo $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les derni&egrave;res modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : "";
// if this page exists
if ($this->page)
{
// if owner is current user
if ($this->UserIsOwner())
{
echo
"Propri&eacute;taire&nbsp;: vous :: \n",
"<a href=\"",$this->href("acls")."\" title=\"Cliquez pour modifer les permissions de cette page.\">&Eacute;diter permissions</a> :: \n",
"<a href=\"",$this->href("deletepage")."\">Supprimer</a> :: \n";
}
else
{
if ($owner = $this->GetPageOwner())
{
echo "Propri&eacute;taire : ",$this->Format($owner);
}
else
{
echo "Pas de propri&eacute;taire ";
echo ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : "");
}
echo " :: \n";
}
}
echo "Vous &ecirc;tes ";
echo $this->Format($this->GetUserName());
echo "</div>";
 
}
 
function FormOpen($method = "", $tag = "", $formMethod = "post") {
 
// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post.
 
if (($method=="diff") && $formMethod=="get") {
$formMethod="post";
}
 
if ($method=="edit") {
$result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
return $result;
}
 
return parent::FormOpen($method,$tag, $formMethod);
 
}
// Detournement des handlers : comme ca on peut faire ce que l'on veut ....
function Method($method) {
 
if ($method=="xml") {
header("Content-type: text/xml");
if ($pages = $this->LoadRecentlyChanged(50)) {
$link=ereg_replace('&','&amp;',$this->Href());
$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
$output .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
$output .= "<channel>\n";
$output .= "<title> Derniers changements sur ". $this->config["wakka_name"] . "</title>\n";
$output .= "<link>" . $link . "</link>\n";
$output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n";
$output .= "<language>fr</language>\n";
$output .= '<generator>WikiNi ' . WIKINI_VERSION . "</generator>\n";
foreach ($pages as $i => $page)
{
$output .= "<item>\n";
$output .= "<title>" . $page["tag"] . "</title>\n";
$output .= '<dc:creator>' . $page["user"] . "</dc:creator>\n";
$output .= '<pubDate>' . date("r", strtotime($page['time'])) . "</pubDate>\n";
$output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] /* . " le " . $day ." - ". $hh .":". $mm */ . "</description>\n";
$link=ereg_replace('&','&amp;',$this->Href("",$page["tag"]));
$output .= "<link>" . $link . "&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
$output .= "</item>\n";
}
$output .= "</channel>\n";
$output .= "</rss>\n";
echo $output ;
 
}
exit;
return;
}
 
if ($method=="edit") {
if ($this->HasAccess("write") && $this->HasAccess("read")) {
$result='';
if ($_POST) {
if ($_POST["submit"] == "Sauver") {
// check for overwriting
if ($this->page) {
if ($this->page["id"] != $_POST["previous"]) {
$error = "ALERTE : ".
"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
}
}
// store
if (!$error) {
$body = str_replace("\r", "", $_POST["body"]);
// test si la nouvelle page est differente de la précédente
if(rtrim($body)==rtrim($this->page["body"])) {
$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
$this->Redirect($this->href());
}
// add page (revisions)
$this->SavePage($this->tag, $body);
// now we render it internally so we can write the updated link table.
$this->ClearLinkTable();
$this->StartLinkTracking();
$dummy = $this->Header();
$dummy .= $this->Format($body);
$dummy .= $this->Footer();
$this->StopLinkTracking();
$this->WriteLinkTable();
$this->ClearLinkTable();
// forward
$this->Redirect($this->href());
}
}
}
// fetch fields
if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
if (!$body = $_POST["body"]) $body = $this->page["body"];
// preview?
if ($_POST["submit"] == "Aperçu")
{
$result .=
"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
$this->Format($body)."\n\n".
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
"<br />\n".
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose()."\n";
return $result;
}
else
{
$ACbuttonsBar='';
require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
$result .=
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
htmlspecialchars($body).
"\n</textarea><br />\n".'<div class="boutons_wiki">'.
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" /></div>\n".
$this->FormClose();
return $result;
}
}
else {
echo "<i>Vous n'avez pas acc&egrave;s en &eacute;criture &agrave; cette page !</i>\n";
}
}
else {
return parent::Method($method);
}
}
 
 
// Surcharge Format a cause probleme de chemin.
 
function Format($text, $formatter = "wakka") {
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
}
 
 
// Identification
 
function SetUser($user, $remember) {
// Appel à partir de Papyrus
if ($user=='initwiki') {
$remember=1;
$wiki_prenom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom));
$wiki_nom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom));
$_SESSION["user"]=array("name"=>$wiki_prenom.$wiki_nom,"password"=>"wikini","changescount"=> 100);
$this->SetPersistentCookie("name", $user["name"], $remember);
$this->SetPersistentCookie("password", $user["password"], $remember);
$this->SetPersistentCookie("remember", $remember, $remember);
}
else {
parent::Setuser($user,$remember);
}
 
}
 
function LoadUser($name, $password = 0) {
return true;
}
 
function LogoutUser() {
$_SESSION["user"]="";
$this->DeleteCookie("remember");
parent::LogoutUser();
}
 
function versChatMot($entree) {
$sortie = strtolower(trim(strtr($entree, "àâéêèëîïôöùûüç-", "aaeeeeiioouuuc ")));
$sortie = ucwords($sortie);
$sortie = str_replace(" ", "",$sortie);
return $sortie;
}
 
}
 
 
 
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
/** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
} else {
/** Inclusion du fichier de traduction fr par défaut. */
include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
}
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
/**
*
* Fonction afficherPageMenuWikini()
*
* Renvoie le contenu de la page Menu de Wikini
*
* @return string
* @access public
*/
 
function afficherPageMenuWikini()
{
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
 
global $wiki;
global $wikini_config_defaut;
$sortie='';
$wakkaConfig = $GLOBALS['wikini_config_defaut'];
if (!class_exists('Wiki_Papyrus')) return ;
$wiki = new Wiki_Papyrus($wakkaConfig);
 
// Suppression des slash.
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
 
// split into page/method
$matches='';
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page, $method) = $matches;
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page) = $matches;
}
 
$server=$_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF']="wakka.php";
 
$contenu=$wiki->LoadPage("PageMenu");
 
$sortie.="<div id=\"menu_wikini\">";
$sortie.=$wiki->Format($contenu['body']);
$sortie.="</div>";
 
$_SERVER['PHP_SELF']=$server;
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
 
return $sortie;
 
}
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Fonction afficherPageWikini() - Fonction appelé par le gestionnaire Papyrus.
*
* Elle retourne le contenu de l'application.
*
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
*/
function afficherPageWikini()
{
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
 
// Ajout d'une feuille de style externe
GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
 
global $wiki;
global $wikini_config_defaut;
$sortie='';
$wakkaConfig = $GLOBALS['wikini_config_defaut'];
if (!class_exists ('Wiki_Papyrus')) return ;
$wiki = new Wiki_Papyrus($wakkaConfig);
 
if ($GLOBALS['_GEN_commun']['pear_auth']->checkAuth()) {
// if (!isset($_SESSION["user"]) || ($_SESSION["user"]=="")) {
$wiki->SetUser('initwiki');
// }
}
else {
$wiki->LogoutUser();
}
 
// Gestion de la variable de session "linktracking"
if ( ! isset( $_SESSION['linktracking'] ) ) {
$_SESSION['linktracking'] = 1;
}
 
// Suppression des slash.
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
 
// split into page/method
$matches='';
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page, $method) = $matches;
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page) = $matches;
}
 
// Vérification de la méthode d'affichage employée!
if ( ! isset( $method ) ) {
$method = '';
}
 
//Récupération du contenu de la page Wikini
 
ob_start();
 
$server=$_SERVER['PHP_SELF'];
$_SERVER['PHP_SELF']="wakka.php";
 
$wiki->Run($page, $method);
 
$_SERVER['PHP_SELF']=$server;
 
$sortie.= ob_get_contents();
ob_end_clean();
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
 
if ($method!="edit") {
return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
}
else {
return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\">"."\n".$sortie.'</div>'."\n");
}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/italic.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/italic.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/hr.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/hr.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/code.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/code.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/link.old.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/link.old.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/bold.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/bold.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t1.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t1.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/underline.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/underline.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t3.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t3.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/crlf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/crlf.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listealpha.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listealpha.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t4.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t4.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/php.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t5.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t5.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/link.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/link.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listepuce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listepuce.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/separator.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/separator.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listenum.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listenum.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/strike.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/strike.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACeditor.buttonsBar.php
New file
0,0 → 1,44
<?php
 
$ACbuttonsBar = "
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'**','**');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/bold.gif\" title=\"Passe le texte sélectionné en gras ( Ctrl-Maj-b )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'//','//');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/italic.gif\" title=\"Passe le texte sélectionné en italique ( Ctrl-Maj-t )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'__','__');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/underline.gif\" title=\"Souligne le texte sélectionné ( Ctrl-Maj-u )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'@@','@@');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/strike.gif\" title=\"Barre le texte sélectionné\">
<img class=\"buttons\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'======','======\\n');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t1.gif\" title=\" En-tête énorme\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'=====','=====\\n');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t2.gif\" title=\" En-tête très gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'====','====\\n');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t3.gif\" title=\" En-tête gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'===','===\\n');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t4.gif\" title=\" En-tête normal\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'==','==');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/t5.gif\" title=\" Petit en-tête\">
<img class=\"buttons\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithLink(thisForm.body);\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/link.gif\" title=\"Ajoute un lien au texte sélectionné\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t-&nbsp;','');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listepuce.gif\" title=\"Liste\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t1)&nbsp;','');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listenum.gif\" title=\"Liste numérique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\ta)&nbsp;','');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/listealpha.gif\" title=\"Liste alphabéthique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n---','');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/crlf.gif\" title=\"Insère un retour chariot\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n------','');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/hr.gif\" title=\"Insère une ligne horizontale\">
 
 
<img class=\"buttons\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%','%%');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/code.gif\" title=\"Code\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%(php)','%%');\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/php.gif\" title=\"Code PHP\">
</div>
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithImage(thisForm.body);\" src=\"client/integrateur_wikini/bibliotheque/ACeditor/ACEdImages/image.gif\" title=\"insère un tag image \">
 
<span class=\"texteChampsImage\">
&nbsp;&nbsp;Fichier&nbsp;<input type=\"text\" name=\"filename\" class=\"ACsearchbox\" size=\"10\">&nbsp;&nbsp;Description&nbsp;<input type=\"text\" name=\"description\" class=\"ACsearchbox\" size=\"10\">
&nbsp;&nbsp;Alignement&nbsp;<select id=\"alignment\" class=\"ACsearchbox\">
<option value=\"left\">Gauche</option>
<option value=\"center\">Centré</option>
<option value=\"right\">Droite</option>
</select>
</span>
</div>";
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/ACeditor/ACeditor.js
New file
0,0 → 1,152
/*
written by chris wetherell
http://www.massless.org
chris [THE AT SIGN] massless.org
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
if there are any problems, let chris know.
*/
var ACEditor; /* make sure to change the onload handler of the
<body> tag to the form you're using!... */
addEvent(window, 'load', startAce);
 
function startAce() {
 
thisForm=document.ACEditor;
}
 
 
function addEvent(obj, evType, fn) {
if (obj.addEventListener) {
obj.addEventListener(evType, fn, true);
return true;
}
else if (obj.attachEvent) {
var r = obj.attachEvent('on'+evType, fn);
return r;
}
else {
return false;
}
}
function mozWrap(txtarea, lft, rgt) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd==1 || selEnd==2) selEnd=selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + lft + s2 + rgt + s3;
}
function IEWrap(lft, rgt) {
strSelection = document.selection.createRange().text;
if (strSelection!="") {
document.selection.createRange().text = lft + strSelection + rgt;
}
}
// Cette fonction permet de faire fonctionner l'insertion de tag image dans un textarea de IE sans sélection initiale,
// à la position du curseur
 
function IEWrap2(txtarea,lft, rgt) {
txtarea.focus();
if (document.selection) {
txtarea.focus();
sel = document.selection.createRange();
sel.text = lft+rgt;
}
}
function wrapSelection(txtarea, lft, rgt) {
if (document.all) {IEWrap(lft, rgt);}
else if (document.getElementById) {mozWrap(txtarea, lft, rgt);}
}
function wrapSelectionBis(txtarea, lft, rgt) {
// pareil que la wrapSelection, avec une différence dans IE
// qui permet à wrapSelectionBis de pouvoir insérer à l'endroit du curseur même sans avoir sélectionné des caractères !!!
// Pour mozilla, c'est bien la fonction Wrap standard qui est appelée, aucun changement
if (document.all) { // document.all est une infamie de IE, on détecte cette horreur !
IEWrap2(txtarea,lft, rgt); // Attention, un parametre de plus que IEWrap
} else if (document.getElementById) {
mozWrap(txtarea, lft, rgt); // là on est chez les gentils
}
}
function wrapSelectionWithLink(txtarea) {
var my_link = prompt("Entrez l'URL: ","http://");
if (my_link != null) {
lft="[[" + my_link + " ";
rgt="]]";
wrapSelection(txtarea, lft, rgt);
}
return;
}
/* Aaaxl modif for ACeditor */
function wrapSelectionWithImage(txtarea) {
nom = document.ACEditor.filename.value;
descript = document.ACEditor.description.value;
align = document.ACEditor.alignment.value;
 
lft= " {{attach file=\"" + nom + "\" desc=\"" + descript + "\" class=\"" + align + "\" }} ";
rgt = "";
wrapSelectionBis(txtarea, lft, rgt);
return;
}
document.onkeypress = function (e) {
if (document.all) {
key=event.keyCode; txtarea=thisForm.body;
if (key == 1) wrapSelectionWithLink(txtarea);
if (key == 2) wrapSelection(txtarea,'**','**');
if (key == 20) wrapSelection(txtarea,'//','//');
}
else if (document.getElementById) {
ctrl=e.ctrlKey; shft=e.shiftKey; chr=e.charCode;
if (ctrl) if (shft) if (chr==65) wrapSelectionWithLink(thisForm.body);
if (ctrl) if (shft) if (chr==66) wrapSelection(thisForm.body,'**','**');
if (ctrl) if (shft) if (chr==84) wrapSelection(thisForm.body,'//','//');
//if (ctrl) if (shft) if (chr==85) wrapSelection(thisForm.body,'__','__');
}
return true;
}
/* end chris w. script */
 
/*
written by meg hourihan
http://www.megnut.com
meg@megnut.com
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
but leave this text in place.
any problems, let meg know.
*/
function mouseover(el) {
el.className = "raise";
}
function mouseout(el) {
el.className = "buttons";
}
function mousedown(el) {
el.className = "press";
}
function mouseup(el) {
el.className = "raise";
}
/* end meg script */
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACeditor.buttonsBar.php
New file
0,0 → 1,43
<?php
$ACbuttonsBar = "
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'**','**');\" src=\"ACEdImages/bold.gif\" title=\"Passe le texte sélectionné en gras ( Ctrl-Maj-b )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'//','//');\" src=\"ACEdImages/italic.gif\" title=\"Passe le texte sélectionné en italique ( Ctrl-Maj-t )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'__','__');\" src=\"ACEdImages/underline.gif\" title=\"Souligne le texte sélectionné ( Ctrl-Maj-u )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'@@','@@');\" src=\"ACEdImages/strike.gif\" title=\"Barre le texte sélectionné\">
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'======','======\\n');\" src=\"ACEdImages/t1.gif\" title=\" En-tête énorme\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'=====','=====\\n');\" src=\"ACEdImages/t2.gif\" title=\" En-tête très gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'====','====\\n');\" src=\"ACEdImages/t3.gif\" title=\" En-tête gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'===','===\\n');\" src=\"ACEdImages/t4.gif\" title=\" En-tête normal\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'==','==');\" src=\"ACEdImages/t5.gif\" title=\" Petit en-tête\">
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithLink(thisForm.body);\" src=\"ACEdImages/link.gif\" title=\"Ajoute un lien au texte sélectionné\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t-&nbsp;','');\" src=\"ACEdImages/listepuce.gif\" title=\"Liste\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t1)&nbsp;','');\" src=\"ACEdImages/listenum.gif\" title=\"Liste numérique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\ta)&nbsp;','');\" src=\"ACEdImages/listealpha.gif\" title=\"Liste alphabéthique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n---','');\" src=\"ACEdImages/crlf.gif\" title=\"Insère un retour chariot\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n------','');\" src=\"ACEdImages/hr.gif\" title=\"Insère une ligne horizontale\">
 
 
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%','%%');\" src=\"ACEdImages/code.gif\" title=\"Code\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%(php)','%%');\" src=\"ACEdImages/php.gif\" title=\"Code PHP\">
</div>
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithImage(thisForm.body);\" src=\"ACEdImages/image.gif\" title=\"insère un tag image \">
 
<span class=\"texteChampsImage\">
&nbsp;&nbsp;Fichier&nbsp;<input type=\"text\" name=\"filename\" class=\"ACsearchbox\" size=\"10\">&nbsp;&nbsp;Description&nbsp;<input type=\"text\" name=\"description\" class=\"ACsearchbox\" size=\"10\">
&nbsp;&nbsp;Alignement&nbsp;<select id=\"alignment\" class=\"ACsearchbox\">
<option value=\"left\">Gauche</option>
<option value=\"center\">Centré</option>
<option value=\"right\">Droite</option>
</select>
</span>
</div>";
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/files/vide.txt
New file
0,0 → 1,0
peut etre supprime.
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/images/Bandeau-wiki.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/images/Bandeau-wiki.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/images/Logo-wiki.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/images/Logo-wiki.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACeditor.js
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACeditor.js
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/INSTALL
New file
0,0 → 1,25
Wakka / Wikini Installation
 
 
Not much to it (as long as it works, ahem). Unpack/upload the distribution files
into a directory that can be accessed via the web. Then go to the corresponding URL.
A web-based installer will walk you through the rest.
 
Example:
 
If your website, say, http://www.mysite.com, is mapped to the directory /home/jdoe/www/,
and you place the Wakka distribution files into /home/jdoe/www/wakka/, you should go to
http://www.mysite.com/wakka/.
 
Note that Wakka distributions normally unpack into directories that include the version
in their name; you'll probably want to rename those to just "wakka" -- or, if you're
on a unixoid system, set up a symbolic link.
 
IMPORTANT: for installing or upgrading Wakka, do NOT access any of the files contained
in the setup/ subdirectory. They're used by the web-based installer/updater, but you
should really just access the Wakka directory itself, and it will (or at least should)
work perfectly.
 
Detailed instructions are available at <http://www.wakkawiki.com/WakkaInstallation>.
 
- Hendrik Mans <hendrik@mans.de>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/COPYING
New file
0,0 → 1,340
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
 
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
 
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
 
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
 
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
 
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
 
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
 
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
 
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
 
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
 
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
 
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
 
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
 
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
 
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
 
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
 
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
 
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
 
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
 
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
 
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
 
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
 
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
 
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
 
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
 
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
 
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
 
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
 
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
 
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
 
NO WARRANTY
 
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
 
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
 
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
 
 
Also add information on how to contact you by electronic and paper mail.
 
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
 
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
 
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
 
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
 
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/italic.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/italic.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/hr.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/hr.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/code.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/code.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/link.old.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/link.old.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/bold.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/bold.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t1.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t1.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/underline.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/underline.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t3.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t3.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/crlf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/crlf.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listealpha.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listealpha.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t4.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t4.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/php.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t5.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/t5.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listepuce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listepuce.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/link.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/link.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/separator.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/separator.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listenum.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/listenum.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/strike.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/ACEdImages/strike.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/LICENSE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/LICENSE
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/wakka.php
New file
0,0 → 1,832
<?php
/* encoding: iso-8859-1
wakka.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 Carlo Zottmann
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NÉPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Éric DELORD
Copyright 2003 Éric FELDSTEIN
Copyright 2004 Jean-Christophe ANDRÉ
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/*
Yes, most of the formatting used in this file is HORRIBLY BAD STYLE. However,
most of the action happens outside of this file, and I really wanted the code
to look as small as what it does. Basically. Oh, I just suck. :)
*/
 
 
 
// do not change this line, you fool. In fact, don't change anything! Ever!
define("WAKKA_VERSION", "0.1.1");
define("WIKINI_VERSION", "0.4.3");
// start the compute time
list($g_usec, $g_sec) = explode(" ",microtime());
define ("t_start", (float)$g_usec + (float)$g_sec);
$t_SQL=0;
 
 
 
class Wiki
{
var $dblink;
var $page;
var $tag;
var $parameter = array();
var $queryLog = array();
var $interWiki = array();
var $VERSION;
var $CookiePath = '/';
 
 
// constructor
function Wiki($config)
{
$this->config = $config;
// some host do not allow mysql_pconnect
$this->dblink = @mysql_connect (
$this->config["mysql_host"],
$this->config["mysql_user"],
$this->config["mysql_password"]);
if ($this->dblink)
{
if (!@mysql_select_db($this->config["mysql_database"], $this->dblink))
{
@mysql_close($this->dblink);
$this->dblink = false;
}
}
$this->VERSION = WAKKA_VERSION;
 
//determine le chemin pour le cookie
$a = parse_url($this->GetConfigValue('base_url'));
$this->CookiePath = dirname($a['path']);
if ($this->CookiePath != '/') $this->CookiePath .= '/';
}
 
 
 
// DATABASE
function Query($query)
{
if($this->GetConfigValue("debug")) $start = $this->GetMicroTime();
if (!$result = mysql_query($query, $this->dblink))
{
ob_end_clean();
die("Query failed: ".$query." (".mysql_error().")");
}
if($this->GetConfigValue("debug"))
{
$time = $this->GetMicroTime() - $start;
$this->queryLog[] = array(
"query" => $query,
"time" => $time);
}
return $result;
}
function LoadSingle($query) { if ($data = $this->LoadAll($query)) return $data[0]; }
function LoadAll($query)
{
$data=array();
if ($r = $this->Query($query))
{
while ($row = mysql_fetch_assoc($r)) $data[] = $row;
mysql_free_result($r);
}
return $data;
}
 
 
 
// MISC
function GetMicroTime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); }
function IncludeBuffered($filename, $notfoundText = "", $vars = "", $path = "")
{
if ($path) $dirs = explode(":", $path);
else $dirs = array("");
 
foreach($dirs as $dir)
{
if ($dir) $dir .= "/";
$fullfilename = $dir.$filename;
if (file_exists($fullfilename))
{
if (is_array($vars)) extract($vars);
 
ob_start();
include($fullfilename);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}
if ($notfoundText) return $notfoundText;
else return false;
}
 
 
 
// VARIABLES
function GetPageTag() { return $this->tag; }
function GetPageTime() { return $this->page["time"]; }
function GetMethod() { return $this->method; }
function GetConfigValue($name) { return $this->config[$name]; }
function GetWakkaName() { return $this->GetConfigValue("wakka_name"); }
function GetWakkaVersion() { return $this->VERSION; }
function GetWikiNiVersion() { return WIKINI_VERSION; }
 
 
 
// PAGES
function LoadPage($tag, $time = "", $cache = 1) {
// retrieve from cache
if (!$time && $cache && ($cachedPage = $this->GetCachedPage($tag))) { $page = $cachedPage;}
// load page
if (!isset($page)) $page = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($tag)."' ".($time ? "and time = '".mysql_escape_string($time)."'" : "and latest = 'Y'")." limit 1");
// cache result
if (!$time) $this->CachePage($page);
return $page;
}
function GetCachedPage($tag) {return (isset($this->pageCache[$tag]) ? $this->pageCache[$tag] : ''); }
function CachePage($page) { $this->pageCache[$page["tag"]] = $page; }
function SetPage($page) { $this->page = $page; if ($this->page["tag"]) $this->tag = $this->page["tag"]; }
function LoadPageById($id) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".mysql_escape_string($id)."' limit 1"); }
function LoadRevisions($page) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page)."' order by time desc"); }
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_escape_string($tag)."' order by tag"); }
function LoadRecentlyChanged($limit=50) {
$limit= (int) $limit;
if ($pages = $this->LoadAll("select tag, time, user, owner from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by time desc limit $limit"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
function LoadAllPages() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' order by tag"); }
function FullTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(tag, body) against('".mysql_escape_string($phrase)."')"); }
function LoadWantedPages() { return $this->LoadAll("select distinct ".$this->config["table_prefix"]."links.to_tag as tag,count(".$this->config["table_prefix"]."links.from_tag) as count from ".$this->config["table_prefix"]."links left join ".$this->config["table_prefix"]."pages on ".$this->config["table_prefix"]."links.to_tag = ".$this->config["table_prefix"]."pages.tag where ".$this->config["table_prefix"]."pages.tag is NULL group by tag order by count desc"); }
function LoadOrphanedPages() { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on = '' order by tag"); }
function IsOrphanedPage($tag) { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on ='' and tag='".mysql_escape_string($tag)."'"); }
function DeleteOrphanedPage($tag) {
$this->Query("delete from ".$this->config["table_prefix"]."pages where tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."acls where page_tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."referrers where page_tag='".mysql_escape_string($tag)."' ");
}
function SavePage($tag, $body, $comment_on = "") {
// get current user
$user = $this->GetUserName();
 
//die($tag);
 
// TODO: check write privilege
if ($this->HasAccess("write", $tag))
{
// is page new?
if (!$oldPage = $this->LoadPage($tag))
{
// create default write acl. store empty write ACL for comments.
$this->SaveAcl($tag, "write", ($comment_on ? "" : $this->GetConfigValue("default_write_acl")));
 
// create default read acl
$this->SaveAcl($tag, "read", $this->GetConfigValue("default_read_acl"));
 
// create default comment acl.
$this->SaveAcl($tag, "comment", $this->GetConfigValue("default_comment_acl"));
 
// current user is owner; if user is logged in! otherwise, no owner.
if ($this->GetUser()) $owner = $user;
}
else
{
// aha! page isn't new. keep owner!
$owner = $oldPage["owner"];
}
 
 
// set all other revisions to old
$this->Query("update ".$this->config["table_prefix"]."pages set latest = 'N' where tag = '".mysql_Escape_string($tag)."'");
 
// add new revision
$this->Query("insert into ".$this->config["table_prefix"]."pages set ".
"tag = '".mysql_escape_string($tag)."', ".
($comment_on ? "comment_on = '".mysql_escape_string($comment_on)."', " : "").
"time = now(), ".
"owner = '".mysql_escape_string($owner)."', ".
"user = '".mysql_escape_string($user)."', ".
"latest = 'Y', ".
"body = '".mysql_escape_string(chop($body))."'");
}
}
function PurgePages() {
if ($days = $this->GetConfigValue("pages_purge_time")) {
// Selection of pages which can be deleted
$pages = $this->LoadAll("select distinct tag, time from ".$this->config["table_prefix"]."pages where time < date_sub(now(), interval '".mysql_escape_string($days)."' day) and latest = 'N' order by time asc");
foreach ($pages as $page) {
// Deletion if there are more than 2 versions avalaible (TODO : parameter ?)
$tags=$this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page[tag])."' group by tag having count(*) > 2 order by tag");
foreach ($tags as $tag) {
$this->Query("delete from ".$this->config["table_prefix"]."pages where time = '".mysql_escape_string($page[time])."' and tag = '".mysql_escape_string($tag[tag])."'");
}
}
}
}
 
 
 
// COOKIES
function SetSessionCookie($name, $value) { SetCookie($name, $value, 0, $this->CookiePath); $_COOKIE[$name] = $value; }
function SetPersistentCookie($name, $value, $remember = 0) { SetCookie($name, $value, time() + ($remember ? 90*24*60*60 : 60 * 60), $this->CookiePath); $_COOKIE[$name] = $value; }
function DeleteCookie($name) { SetCookie($name, "", 1, $this->CookiePath); $_COOKIE[$name] = ""; }
function GetCookie($name) { return $_COOKIE[$name]; }
 
 
 
// HTTP/REQUEST/LINK RELATED
function SetMessage($message) { $_SESSION["message"] = $message; }
function GetMessage()
{
if (isset($_SESSION["message"])) $message = $_SESSION["message"];
else $message = "";
$_SESSION["message"] = "";
return $message;
}
function Redirect($url)
{
header("Location: $url");
exit;
}
// returns just PageName[/method].
function MiniHref($method = "", $tag = "")
{
if (!$tag = trim($tag)) $tag = $this->tag;
return $tag.($method ? "/".$method : "");
}
// returns the full url to a page/method.
function Href($method = "", $tag = "", $params = "")
{
$href = $this->config["base_url"].$this->MiniHref($method, $tag);
if ($params)
{
$href .= ($this->config["rewrite_mode"] ? "?" : "&amp;").$params;
}
return $href;
}
function Link($tag, $method = "", $text = "", $track = 1) {
$tag=htmlspecialchars($tag); //avoid xss
$text=htmlspecialchars($text); //paranoiac again
if (!$text) $text = $tag;
 
// is this an interwiki link?
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $tag, $matches))
{
$tag = $this->GetInterWikiUrl($matches[1], $matches[2]);
return "<a href=\"$tag\">$text (interwiki)</a>";
}
// is this a full link? ie, does it contain non alpha-numeric characters?
// Note : [:alnum:] is equivalent [0-9A-Za-z]
// [^[:alnum:]] means : some caracters other than [0-9A-Za-z]
// For example : "www.adress.com", "mailto:adress@domain.com", "http://www.adress.com"
else if (preg_match("/[^[:alnum:]]/", $tag))
{
// check for email addresses
if (preg_match("/^.+\@.+$/", $tag))
{
$tag = "mailto:".$tag;
}
// check for protocol-less URLs
else if (!preg_match("/:\/\//", $tag))
{
$tag = "http://".$tag; //Very important for xss (avoid javascript:() hacking)
}
// is this an inline image (text!=tag and url ends png,gif,jpeg)
if ($text!=$tag and preg_match("/.(gif|jpeg|png|jpg)$/i",$tag))
{
return "<img src=\"$tag\" alt=\"$text\" />";
}
else
{
return "<a href=\"$tag\">$text</a>";
}
}
else
{
// it's a Wiki link!
if (isset($_SESSION["linktracking"]) && $track) $this->TrackLinkTo($tag);
return ($this->LoadPage($tag) ? "<a href=\"".$this->href($method, $tag)."\">".$text."</a>" : "<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>");
}
}
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1) {
if (!$text) $text = $tag;
$text = htmlentities($text);
if (isset($_SESSION["linktracking"]) && $track)
$this->TrackLinkTo($tag);
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
}
// function PregPageLink($matches) { return $this->Link($matches[1]); }
function IsWikiName($text) { return preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/", $text); }
function TrackLinkTo($tag) { $_SESSION["linktable"][] = $tag; }
function GetLinkTable() { return $_SESSION["linktable"]; }
function ClearLinkTable() { $_SESSION["linktable"] = array(); }
function StartLinkTracking() { $_SESSION["linktracking"] = 1; }
function StopLinkTracking() { $_SESSION["linktracking"] = 0; }
function WriteLinkTable() {
// delete old link table
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag = '".mysql_escape_string($this->GetPageTag())."'");
if ($linktable = $this->GetLinkTable())
{
$from_tag = mysql_escape_string($this->GetPageTag());
foreach ($linktable as $to_tag)
{
$lower_to_tag = strtolower($to_tag);
if (!$written[$lower_to_tag])
{
$this->Query("insert into ".$this->config["table_prefix"]."links set from_tag = '".$from_tag."', to_tag = '".mysql_escape_string($to_tag)."'");
$written[$lower_to_tag] = 1;
}
}
}
}
function Header() { return $this->Action($this->GetConfigValue("header_action"), 1); }
function Footer() { return $this->Action($this->GetConfigValue("footer_action"), 1); }
 
 
 
// FORMS
function FormOpen($method = "", $tag = "", $formMethod = "post") {
$result = "<form action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
if (!$this->config["rewrite_mode"]) $result .= "<input type=\"hidden\" name=\"wiki\" value=\"".$this->MiniHref($method, $tag)."\" />\n";
return $result;
}
function FormClose() {
return "</form>\n";
}
 
 
 
// INTERWIKI STUFF
function ReadInterWikiConfig() {
if ($lines = file("interwiki.conf"))
{
foreach ($lines as $line)
{
if ($line = trim($line))
{
list($wikiName, $wikiUrl) = explode(" ", trim($line));
$this->AddInterWiki($wikiName, $wikiUrl);
}
}
}
}
function AddInterWiki($name, $url) {
$this->interWiki[$name] = $url;
}
function GetInterWikiUrl($name, $tag) {
if (isset($this->interWiki[$name]))
{
return $this->interWiki[$name].$tag;
} else {
return 'http://'.$tag; //avoid xss by putting http:// in front of JavaScript:()
}
}
 
 
 
// REFERRERS
function LogReferrer($tag = "", $referrer = "") {
// fill values
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
if (!$referrer = trim($referrer) AND isset($_SERVER["HTTP_REFERER"])) $referrer = $_SERVER["HTTP_REFERER"];
// check if it's coming from another site
if ($referrer && !preg_match("/^".preg_quote($this->GetConfigValue("base_url"), "/")."/", $referrer))
{
$this->Query("insert into ".$this->config["table_prefix"]."referrers set ".
"page_tag = '".mysql_escape_string($tag)."', ".
"referrer = '".mysql_escape_string($referrer)."', ".
"time = now()");
}
}
function LoadReferrers($tag = "") {
return $this->LoadAll("select referrer, count(referrer) as num from ".$this->config["table_prefix"]."referrers ".($tag = trim($tag) ? "where page_tag = '".mysql_escape_string($tag)."'" : "")." group by referrer order by num desc");
}
function PurgeReferrers() {
if ($days = $this->GetConfigValue("referrers_purge_time")) {
$this->Query("delete from ".$this->config["table_prefix"]."referrers where time < date_sub(now(), interval '".mysql_escape_string($days)."' day)");
}
}
 
 
 
// PLUGINS
function Action($action, $forceLinkTracking = 0)
{
$action = trim($action); $vars=array();
// stupid attributes check
if ((stristr($action, "=\"")) || (stristr($action, "/")))
{
// extract $action and $vars_temp ("raw" attributes)
preg_match("/^([A-Za-z0-9]*)\/?(.*)$/", $action, $matches);
list(, $action, $vars_temp) = $matches;
// match all attributes (key and value)
$this->parameter[$vars_temp]=$vars_temp;
preg_match_all("/([A-Za-z0-9]*)=\"(.*)\"/U", $vars_temp, $matches);
 
// prepare an array for extract() to work with (in $this->IncludeBuffered())
if (is_array($matches))
{
for ($a = 0; $a < count($matches[1]); $a++)
{
$vars[$matches[1][$a]] = $matches[2][$a];
$this->parameter[$matches[1][$a]]=$matches[2][$a];
}
}
}
if (!$forceLinkTracking) $this->StopLinkTracking();
$result = $this->IncludeBuffered(strtolower($action).".php", "<i>Action inconnue \"$action\"</i>", $vars, $this->config["action_path"]);
$this->StartLinkTracking();
if (isset($parameter)) unset($this->parameter[$parameter]);
unset($this->parameter);
return $result;
}
function Method($method) {
if (!$handler = $this->page["handler"]) $handler = "page";
$methodLocation = $handler."/".$method.".php";
return $this->IncludeBuffered($methodLocation, "<i>M&eacute;thode inconnue \"$methodLocation\"</i>", "", $this->config["handler_path"]);
}
function Format($text, $formatter = "wakka") {
return $this->IncludeBuffered("formatters/".$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
}
 
 
 
// USERS
function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1"); }
function LoadUsers() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."users order by name"); }
function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }
function UserName() { /* deprecated! */ return $this->GetUserName(); }
function GetUser() { return (isset($_SESSION["user"]) ? $_SESSION["user"] : '');}
function SetUser($user, $remember=0) { $_SESSION["user"] = $user; $this->SetPersistentCookie("name", $user["name"], $remember); $this->SetPersistentCookie("password", $user["password"], $remember); $this->SetPersistentCookie("remember", $remember, $remember); }
function LogoutUser() { $_SESSION["user"] = ""; $this->DeleteCookie("name"); $this->DeleteCookie("password"); }
function UserWantsComments() { if (!$user = $this->GetUser()) return false; return ($user["show_comments"] == "Y"); }
function GetParameter($parameter, $default = '') { return (isset($this->parameter[$parameter]) ? $this->parameter[$parameter] : $default); }
 
 
// COMMENTS
function LoadComments($tag) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on = '".mysql_escape_string($tag)."' and latest = 'Y' order by time"); }
function LoadRecentComments() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on != '' and latest = 'Y' order by time desc"); }
function LoadRecentlyCommented($limit = 50) {
// NOTE: this is really stupid. Maybe my SQL-Fu is too weak, but apparently there is no easier way to simply select
// all comment pages sorted by their first revision's (!) time. ugh!
// load ids of the first revisions of latest comments. err, huh?
$pages=array();
$comments=array();
if ($ids = $this->LoadAll("select min(id) as id from ".$this->config["table_prefix"]."pages where comment_on != '' group by tag order by id desc"))
{
// load complete comments
$num=0;
foreach ($ids as $id)
{
$comment = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".$id["id"]."' limit 1");
if (!isset($comments[$comment["comment_on"]]) && $num < $limit)
{
$comments[$comment["comment_on"]] = $comment;
$num++;
}
}
// now load pages
if ($comments)
{
// now using these ids, load the actual pages
foreach ($comments as $comment)
{
$page = $this->LoadPage($comment["comment_on"]);
$page["comment_user"] = $comment["user"];
$page["comment_time"] = $comment["time"];
$page["comment_tag"] = $comment["tag"];
$pages[] = $page;
}
}
}
// load tags of pages
//return $this->LoadAll("select comment_on as tag, max(time) as time, tag as comment_tag, user from ".$this->config["table_prefix"]."pages where comment_on != '' group by comment_on order by time desc");
return $pages;
}
 
 
 
// ACCESS CONTROL
// returns true if logged in user is owner of current page, or page specified in $tag
function UserIsOwner($tag = "") {
// check if user is logged in
if (!$this->GetUser()) return false;
 
// set default tag
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
// check if user is owner
if ($this->GetPageOwner($tag) == $this->GetUserName()) return true;
}
function GetPageOwner($tag = "", $time = "") { if (!$tag = trim($tag)) $tag = $this->GetPageTag(); if ($page = $this->LoadPage($tag, $time)) return $page["owner"]; }
function SetPageOwner($tag, $user) {
// check if user exists
if (!$this->LoadUser($user)) return;
// updated latest revision with new owner
$this->Query("update ".$this->config["table_prefix"]."pages set owner = '".mysql_escape_string($user)."' where tag = '".mysql_escape_string($tag)."' and latest = 'Y' limit 1");
}
function LoadAcl($tag, $privilege, $useDefaults = 1) {
if ((!$acl = $this->LoadSingle("select * from ".$this->config["table_prefix"]."acls where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1")) && $useDefaults)
{
$acl = array("page_tag" => $tag, "privilege" => $privilege, "list" => $this->GetConfigValue("default_".$privilege."_acl"));
}
return $acl;
}
function SaveAcl($tag, $privilege, $list) {
if ($this->LoadAcl($tag, $privilege, 0)) $this->Query("update ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."' where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1");
else $this->Query("insert into ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."', page_tag = '".mysql_escape_string($tag)."', privilege = '".mysql_escape_string($privilege)."'");
}
// returns true if $user (defaults to current user) has access to $privilege on $page_tag (defaults to current page)
function HasAccess($privilege, $tag = "", $user = "") {
// set defaults
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
if (!$user = $this->GetUserName());
// load acl
$acl = $this->LoadAcl($tag, $privilege);
// if current user is owner, return true. owner can do anything!
if ($this->UserIsOwner($tag)) return true;
// fine fine... now go through acl
foreach (explode("\n", $acl["list"]) as $line)
{
$line = trim($line);
 
// check for inversion character "!"
if (preg_match("/^[!](.*)$/", $line, $matches))
{
$negate = 1;
$line = $matches[1];
}
else
{
$negate = 0;
}
 
// if there's still anything left... lines with just a "!" don't count!
if ($line)
{
switch ($line[0])
{
// comments
case "#":
break;
// everyone
case "*":
return !$negate;
// aha! a user entry.
case "+":
if (!$this->LoadUser($user))
{
return $negate;
}
else
{
return !$negate;
}
default:
if ($line == $user)
{
return !$negate;
}
}
}
}
// tough luck.
return false;
}
 
 
 
// MAINTENANCE
function Maintenance() {
// purge referrers
$this->PurgeReferrers();
// purge old page revisions
$this->PurgePages();
}
 
 
 
// THE BIG EVIL NASTY ONE!
function Run($tag, $method = "") {
if(!($this->GetMicroTime()%3)) $this->Maintenance();
 
$this->ReadInterWikiConfig();
 
// do our stuff!
if (!$this->method = trim($method)) $this->method = "show";
if (!$this->tag = trim($tag)) $this->Redirect($this->href("", $this->config["root_page"]));
if ((!$this->GetUser() && isset($_COOKIE["name"])) && ($user = $this->LoadUser($_COOKIE["name"], $_COOKIE["password"]))) $this->SetUser($user, $_COOKIE["remember"]);
$this->SetPage($this->LoadPage($tag, (isset($_REQUEST["time"]) ? $_REQUEST["time"] :'')));
$this->LogReferrer();
 
//correction pour un support plus facile de nouveaux handlers
print($this->Method($this->method));
}
}
 
 
 
// stupid version check
if (!isset($_REQUEST)) die('$_REQUEST[] not found. Wakka requires PHP 4.1.0 or higher!');
 
// workaround for the amazingly annoying magic quotes.
function magicQuotesSuck(&$a)
{
if (is_array($a))
{
foreach ($a as $k => $v)
{
if (is_array($v))
magicQuotesSuck($a[$k]);
else
$a[$k] = stripslashes($v);
}
}
}
set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc())
{
magicQuotesSuck($_POST);
magicQuotesSuck($_GET);
magicQuotesSuck($_COOKIE);
}
 
 
// default configuration values
$wakkaConfig= array();
$wakkaDefaultConfig = array(
'wakka_version' => '',
'wikini_version' => '',
'debug' => 'no',
"mysql_host" => "localhost",
"mysql_database" => "wikini",
"mysql_user" => "wikini",
"mysql_password" => '',
"table_prefix" => "wikini_",
"root_page" => "PagePrincipale",
"wakka_name" => "MonSiteWikiNi",
"base_url" => "http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").$_SERVER["REQUEST_URI"].(preg_match("/".preg_quote("wakka.php")."$/", $_SERVER["REQUEST_URI"]) ? "?wiki=" : ""),
"rewrite_mode" => (preg_match("/".preg_quote("wakka.php")."$/", $_SERVER["REQUEST_URI"]) ? "0" : "1"),
'meta_keywords' => '',
'meta_description' => '',
"action_path" => "actions",
"handler_path" => "handlers",
"header_action" => "header",
"footer_action" => "footer",
"navigation_links" => "DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur",
"referrers_purge_time" => 24,
"pages_purge_time" => 90,
"default_write_acl" => "*",
"default_read_acl" => "*",
"default_comment_acl" => "*",
"preview_before_save" => "0");
 
// load config
if (!$configfile = GetEnv("WAKKA_CONFIG")) $configfile = "wakka.config.php";
if (file_exists($configfile)) include($configfile);
$wakkaConfigLocation = $configfile;
$wakkaConfig = array_merge($wakkaDefaultConfig, $wakkaConfig);
 
// check for locking
if (file_exists("locked")) {
// read password from lockfile
$lines = file("locked");
$lockpw = trim($lines[0]);
// is authentification given?
if (isset($_SERVER["PHP_AUTH_USER"])) {
if (!(($_SERVER["PHP_AUTH_USER"] == "admin") && ($_SERVER["PHP_AUTH_PW"] == $lockpw))) {
$ask = 1;
}
} else {
$ask = 1;
}
if ($ask) {
header("WWW-Authenticate: Basic realm=\"".$wakkaConfig["wakka_name"]." Install/Upgrade Interface\"");
header("HTTP/1.0 401 Unauthorized");
echo "Ce site est en cours de mise &agrave; jour. Veuillez essayer plus tard." ;
exit;
}
}
 
 
// compare versions, start installer if necessary
if ($wakkaConfig["wakka_version"] && (!$wakkaConfig["wikini_version"])) { $wakkaConfig["wikini_version"]=$wakkaConfig["wakka_version"]; }
if (($wakkaConfig["wakka_version"] != WAKKA_VERSION) || ($wakkaConfig["wikini_version"] != WIKINI_VERSION)) {
// start installer
if (!isset($_REQUEST["installAction"]) OR !$installAction = trim($_REQUEST["installAction"])) $installAction = "default";
include("setup/header.php");
if (file_exists("setup/".$installAction.".php")) include("setup/".$installAction.".php"); else echo "<i>Invalid action</i>" ;
include("setup/footer.php");
exit;
}
 
 
// configuration du cookie de session
//determine le chemin pour le cookie
$a = parse_url($wakkaConfig['base_url']);
$CookiePath = dirname($a['path']);
if ($CookiePath != '/') $CookiePath .= '/';
$a = session_get_cookie_params();
session_set_cookie_params($a['lifetime'],$CookiePath);
unset($a);
unset($CookiePath);
 
// start session
session_start();
 
// fetch wakka location
if (!isset($_REQUEST["wiki"])) $_REQUEST["wiki"] = '';
$wiki = $_REQUEST["wiki"];
 
// remove leading slash
$wiki = preg_replace("/^\//", "", $wiki);
 
// split into page/method
if (preg_match("#^(.+?)/([A-Za-z0-9_]*)$#", $wiki, $matches)) list(, $page, $method) = $matches;
else if (preg_match("#^(.*)$#", $wiki, $matches)) list(, $page) = $matches;
 
// create wiki object
$wiki = new Wiki($wakkaConfig);
// check for database access
if (!$wiki->dblink)
{
echo "<p>Pour des raisons ind&eacute;pendantes de notre volont&eacute;, le contenu de ce Wiki est temporairement inaccessible. Veuillez r&eacute;essayer ult&eacute;rieurement, merci de votre compr&eacute;hension.</p>";
exit;
}
 
function compress_output($output)
{
return gzencode($output);
}
 
// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
{
// Start output buffering, and register compress_output() (see
// below)
ob_start ("compress_output");
 
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
}
 
 
// go!
if (!isset($method)) $method='';
 
// Security (quick hack) : Check method syntax
if (!(preg_match('#^[A-Za-z0-9_]*$#',$method))) {
$method='';
}
 
include('tools/prepend.php');
$wiki->Run($page, $method);
 
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/wakka.css
New file
0,0 → 1,79
* {margin: 0; padding: 0; }
body {text-align:center; background:#FFF;font: 12px Arial, sans-serif; color: #000;text-align: justify;line-height: 17px;}
img {border:0;}
#container {margin: 3px auto;width: 800px;text-align: left;}
#page_table {border-spacing: 0;border-collapse: separate; margin: 0; padding: 0 ; border: 0; border-width:0; }
#bandeau_haut {vertical-align: top;border-spacing: 0;margin: 0; padding: 0; border: 0; background: url(images/Bandeau-wiki.png) no-repeat top left; width:631px; height:165px;}
#logo_ekotribu, #logo_ekotribu img {vertical-align: top; border-spacing: 0; margin: 0; padding: 0; border: 0;}
.menu_column {vertical-align: top; border: 0; background: #F2B814; width: 159px; border: 0;padding:10px 5px 5px 5px;}
.menu_column h1,h2,h3,h4,h5 {text-align: center; font: 12px Arial,sans-serif; color: #4F3493;border-bottom:1px solid #FFF;}
.menu_column h1 {font-size:20px;}
.menu_column h2 {font-size:18px;}
.menu_column h3 {font-size:16px;}
.menu_column h4 {font-size:14px;}
.menu_column h5 {font-size:12px;}
.menu_column h5 {font-size:10px;}
.menu_column a:link, a:visited { font-weight: normal; text-decoration: underline; color: #FFF;}
.menu_column a:hover, a:active { text-decoration:none ; color: #4F3493;}
.menu_column li {display : list-item; list-style-type: disc; padding:0;color: #FFF;}
.menu_column li:hover {color: #4F3493;}
div.centrage {text-align: center;}
.body_column {vertical-align: top; border: 0; padding:5px;}
.page_name {display:none; }
.wiki_name {padding-top:5px;text-align:center;color: #4F3493; font-size:22px;}
.header {display:none;}
.page { background-color: #FFF; padding: 5px; border: 0; }
.page h1 {padding:2px; text-align: center; font-size: 22px; color: #4F3493;}
.page h2 {padding:2px; text-align: left; font-size: 18px; color: #05AEF8; background: #FFFFFF;}
.page h3 {padding:2px; font-weight: bold; font-size:17px; color: #4F3493;}
.page h4 {padding:2px; text-align: center; font-weight: bold; font-size: 14px; color: #05AEF8;}
.page h5 {padding:2px; text-align: center; font-weight: bold; font-size: 12px; color: #4F3493;}
.page a:link { font-weight: normal; text-decoration: underline; color: #FB9B02;}
.page a:visited { font-weight: normal; text-decoration: underline; color: #FB9B02;}
.page a:hover, a:active { text-decoration:none ; color: #05AEF8;}
ul { margin: 0; padding: 0 0 0 15px;}
li { display : list-item; list-style-type: circle; padding:0;}
ol { margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; }
form { margin: 0px; padding: 0px; }
tt { color: Navy; }
hr {border: 0px; color: #F2B814; /* Internet Explorer */ background-color: #F2B814; height: 2px; }
 
.error { color: #CC3333; font-weight: bold; }
.indent { margin-left: 40px; }
.additions { color: #008800; }
.deletions { color: #880000; }
.add { font-weight: bold; color: #c00; text-decoration: underline; }
.del { font-style: italic; color: #c00; text-decoration: line-through; }
 
.prev_alert { background-color: red; color: white; font-size: 1.7em; font-weight: bold; margin-bottom: 5px; }
.edit { width: 100%; height: 400px; }
.footer { font-size:12px; padding: 5px; border: 2px solid #F2B814; }
.footer a {color: #4F3493;text-decoration:underline; }
.footer a:hover {color: #F2B814;text-decoration:none; }
.code { background: #FFFFFF; border: solid #888888 2px; font-family: 'Courier New', Courier; color: black; font-size: 10pt; width: 100%; height: 400px; overflow: scroll; padding: 3px; }
.revisioninfo { color: #AAAAAA; padding-bottom: 20px; }
 
.commentsheader {display:none;}
.comment { background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #EEEEEE; }
.commentinfo { color: #AAAAAA; }
.commentform { background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC }
 
.copyright { font-size: 11px; color: #000; text-align: right; }
.copyright a { color: #000; }
.searchbox { background: #FFF; border: 1px solid #000; width:100px; }
.debug { font-size: 11px; color: #888888; }
 
.hr_clear { clear: both; visibility: hidden; }
.include_right { float: right; width: 17%; } /* bloc flotant à droite */
.include_left { float: left; width: 17%; } /* bloc flotant à gauche */
.include_solid_border { border: solid; padding: 2px; } /* encadré noir */
.include_gray_background { background-color: #DDDDDD; } /* fond gris */
.include_small_fonts { font-size: 0.8em; } /* petites polices */
.include_big_fonts { font-size: 1.2em; } /* grandes polces */
.include_height10em { height: 10em; overflow: scroll; } /* boite de 10em de hauteur, avec ascenseur */
.include_height15em { height: 15em; overflow: scroll; }
.include_height30em { height: 30em; overflow: scroll; }
.include_height60em { height: 60em; overflow: scroll; }
 
.trail_table { line-height: 30px;}
.trail_button { color: #993333; }
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools.php
New file
0,0 → 1,167
<?php
// Get configuration
 
 
require_once ('tools/libs/class.plugins.php');
require_once ('tools/libs/lib.compat.php');
require_once ('tools/libs/lib.form.php');
require_once ('tools/libs/lib.files.php');
require_once ('tools/libs/lib.buffer.php');
require_once ('tools/libs/class.wiki.php');
 
function __($str) {
return $str;
}
 
if (!defined('DC_ECRIRE')) {
define('DC_ECRIRE','');
}
 
if (!defined('TOOLS_MANAGER')) {
define('TOOLS_MANAGER','TOOLS_MANAGER');
}
 
require_once ('tools/libs/Auth.php');
require_once ('tools/libs/Container.php');
 
class CustomAuthContainer extends Auth_Container
{
var $mysql_user;
var $mysql_password;
function CustomAuthContainer($mysql_user, $mysql_password )
{
$this->mysql_user=$mysql_user;
$this->mysql_password=$mysql_password;
}
 
function fetchData($username, $password)
{
if (($username == $this->mysql_user ) && ( $password == $this->mysql_password)) {
return true;
}
return false;
}
}
 
 
$auth_container = new CustomAuthContainer($wakkaConfig['mysql_user'],$wakkaConfig['mysql_password']);
 
$params = array(
"advancedsecurity" => "true"
);
 
 
$a = new Auth($auth_container,$params);
 
$a->start();
 
if ($_GET['tools_action'] == "logout" && $a->checkAuth()) {
$a->logout();
$a->start();
exit;
}
 
 
if($a->checkAuth()) {
}
else {
exit;
}
 
$plugins_root = 'tools/';
 
$plugins = new plugins($plugins_root);
$plugins->getPlugins(true);
$plugins_list = $plugins->getPluginsList();
 
$PLUGIN_HEAD = '';
$PLUGIN_BODY = '';
 
if ((!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']])
&& $plugins_list[$_REQUEST['p']]['active']))
{
$p = $_REQUEST['p'];
buffer::init();
include $plugins_root.$p.'/index.php';
$PLUGIN_BODY = buffer::getContent();
buffer::clean();
}
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<title>Configuration extension(s) de WikiNi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
</head>
 
<body>
 
 
<?php
 
$tools_url= "http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").dirname($_SERVER["REQUEST_URI"]).'/tools.php';
 
echo '<a href="'.$tool_url.'?tools_action=logout">Déconnexion</a>';
 
 
if ($PLUGIN_HEAD != '')
{
echo '<h1>';
echo $PLUGIN_HEAD;
echo '</h1>';
}
 
if ($PLUGIN_BODY != '')
{
echo '<h1>';
echo '<a href="'.$tools_url.'">Retour à la liste des extensions actives</a>';
echo '</h1>';
echo $PLUGIN_BODY;
}
else
{
if (count($plugins_list) == 0)
{
echo '<p>Aucun outil n\'est disponible ou actif</p>';
}
else
{
# Tri des plugins par leur nom
uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);'));
# Liste des plugins
echo '<h1>';
echo '<a href="'.$tools_url.'">Liste des extensions actives</a>';
echo '</h1>';
echo '<dl class="plugin-list">';
foreach ($plugins_list as $k => $v)
{
$plink = '<a href="tools.php?p='.$k.'">%s</a>';
$plabel = (!empty($v['label'])) ? $v['label'] : $v['name'];
echo '<dt>';
if (file_exists($plugins_root.$k.'/icon.png')) {
printf($plink,'<img alt="" src="tools/'.$k.'/icon.png" />');
echo ' ';
}
printf($plink,$plabel);
echo '</dt>';
echo '<dd>'.$v['desc'].'</dd>';
}
echo '</dl>';
}
}
?>
</body>
</html>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/raw.php
New file
0,0 → 1,31
<?php
/*
raw.php
 
Copyright 2002, 2003 David DELON
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
if ($test=$_REQUEST["text"]) {
echo "";
}
else if ($lines = file($text)) {
foreach ($lines as $line) {
// To avoid loop:ignore inclusion of other raw link
if (!(preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $line, $matches)))
echo $line;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/code.php
New file
0,0 → 1,33
 
<pre>
<?php
/*
code.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
echo htmlentities($text)."\n";
?>
</pre>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/action.php
New file
0,0 → 1,64
<?php
/*
action.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
 
if (!function_exists("wakka2callback"))
{
function wakka2callback($things)
{
$thing = $things[1];
 
global $wiki;
// events
if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
{
if ($matches[1])
return $wiki->Action($matches[1]);
else
return "{{}}";
}
else if (preg_match("/^.*$/s", $thing, $matches))
{
return "";
}
 
// if we reach this point, it must have been an accident.
return $thing;
}
}
 
 
$text = str_replace("\r", "", $text);
$text = trim($text)."\n";
$text = preg_replace_callback(
"/(\{\{.*?\}\}|.*)/msU", "wakka2callback", $text);
 
echo $text ;
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/coloration_delphi.php
New file
0,0 → 1,77
<?php
/*
* $Id: coloration_delphi.php,v 1.3 2006-09-21 14:18:06 florian Exp $
*
* Souligneur syntaxique Delphi
*
* copyrigth Eric Feldstein 2003 2004 mailto:garfield_fr@tiscali.fr
*
* Licence : la meme que wikini (voir le fichier LICENCE).
* Vous êtes libre d'utiliser et de modifier ce code à condition de laisser le copyright
* d'origine. Vous pouvez bien sur vous ajouter à la liste des auteurs.
*
* Installation : copier le fichier dans le repertoire "formatters" de WikiNi
*/
include_once('formatters/hightlighter.class.inc');
 
$DH = new Hightlighter();
$DH->isCaseSensitiv = false;
 
//************* commentaires *************
$DH->comment = array('({[^$][^}]*})', //commentaires: { ... }
'(\(\*[^$](.*)\*\))' //commentaires: (* ... *)
);
$DH->commentLine = array('(//.*\n)'); //commentaire //
$DH->commentStyle = "color: red; font-style: italic"; //style CSS pour balise SPAN
 
//************* directives de compilation *************
$DH->directive = array('({\\$[^{}]*})', //directive {$....}
'(\(\*\\$(.*)\*\))' //directive (*$....*)
);
$DH->directiveStyle = "color: green"; //style CSS pour balise SPAN
 
//************* chaines de caracteres *************
$DH->string = array("('[^']*')",'(#\d+)'); //chaine = 'xxxxxxxx' ou #23
$DH->stringStyle = "background: yellow";
 
//************* nombres *************
$DH->number[] = '(\b\d+(\.\d*)?([eE][+-]?\d+)?)'; //123 ou 123. ou 123.456 ou 123.E-34 ou 123.e-34 123.45E+34 ou 4e54
$DH->number[] = '(\$[0-9A-Fa-f]+\b)'; //ajout des nombres hexadecimaux : $AF
$DH->numberStyle = 'color: blue';
 
//************* mots clé *************
$DH->keywords['MotCle']['words'] = array('absolute','abstract','and','array','as','asm',
'begin',
'case','class','const','constructor',
'default','destructor','dispinterface','div','do','downto',
'else','end','except','exports','external',
'file','finalization','finally','for','function',
'goto',
'if','implementation','inherited','initialization','inline','interface','is',
'label','library','loop','message',
'mod',
'nil','not',
'object','of','or','out','overload','override',
'packed','private','procedure','program','property','protected','public','published',
'raise','read','record','repeat','resourcestring',
'set','shl','shr','stdcall','string',
'then','threadvar','to','try','type','unit','until',
'use','uses',
'var','virtual','while',
'with','write',
'xor'
);
$DH->keywords['MotCle']['style'] = 'font-weight: bold'; //style CSS pour balise SPAN
 
//************* liste des symboles *************
$DH->symboles = array('#','$','&','(','(.',')','*','+',',','-','.','.)','..',
'/',':',':=',';','<','<=','<>','=','>','>=','@','[',']','^');
$DH->symbolesStyle = '';
 
//************* identifiants *************
$DH->identifier = array('[_A-Za-z]?[_A-Za-z0-9]+');
$DH->identStyle = '';
 
echo "<pre>".$DH->Analyse($text)."</pre>";
unset($DH);
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/wakka.php
New file
0,0 → 1,333
<?php
/*
wakka.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric DELORD
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
 
if (!function_exists("wakka2callback"))
{
function wakka2callback($things)
{
$thing = $things[1];
$result='';
 
static $oldIndentLevel = 0;
static $oldIndentLength= 0;
static $indentClosers = array();
static $newIndentSpace= array();
static $br = 1;
 
$brf=0;
global $wiki;
// convert HTML thingies
if ($thing == "<")
return "&lt;";
else if ($thing == ">")
return "&gt;";
// bold
else if ($thing == "**")
{
static $bold = 0;
return (++$bold % 2 ? "<b>" : "</b>");
}
// italic
else if ($thing == "//")
{
static $italic = 0;
return (++$italic % 2 ? "<i>" : "</i>");
}
// underlinue
else if ($thing == "__")
{
static $underline = 0;
return (++$underline % 2 ? "<u>" : "</u>");
}
// monospace
else if ($thing == "##")
{
static $monospace = 0;
return (++$monospace % 2 ? "<tt>" : "</tt>");
}
// Deleted
else if ($thing == "@@")
{
static $deleted = 0;
return (++$deleted % 2 ? "<span class=\"del\">" : "</span>");
}
// Inserted
else if ($thing == "££")
{
static $inserted = 0;
return (++$inserted % 2 ? "<span class=\"add\">" : "</span>");
}
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
if (!isset($matches[2])) $matches[2] = '';
return "<a href=\"$url\">$url</a>".$matches[2];
}
// header level 5
else if ($thing == "==")
{
static $l5 = 0;
$br = 0;
return (++$l5 % 2 ? "<h5>" : "</h5>");
}
// header level 4
else if ($thing == "===")
{
static $l4 = 0;
$br = 0;
return (++$l4 % 2 ? "<h4>" : "</h4>");
}
// header level 3
else if ($thing == "====")
{
static $l3 = 0;
$br = 0;
return (++$l3 % 2 ? "<h3>" : "</h3>");
}
// header level 2
else if ($thing == "=====")
{
static $l2 = 0;
$br = 0;
return (++$l2 % 2 ? "<h2>" : "</h2>");
}
// header level 1
else if ($thing == "======")
{
static $l1 = 0;
$br = 0;
return (++$l1 % 2 ? "<h1>" : "</h1>");
}
// forced line breaks
else if ($thing == "---")
{
return "<br />";
}
// escaped text
else if (preg_match("/^\"\"(.*)\"\"$/s", $thing, $matches))
{
return $matches[1];
}
// code text
else if (preg_match("/^\%\%(.*)\%\%$/s", $thing, $matches))
{
// check if a language has been specified
$code = $matches[1];
$language='';
if (preg_match("/^\((.+?)\)(.*)$/s", $code, $matches))
{
list(, $language, $code) = $matches;
}
//Select formatter for syntaxe hightlighting
if (file_exists("formatters/coloration_".$language.".php")){
$formatter = "coloration_".$language;
}else{
$formatter = "code";
}
 
$output = "<div class=\"code\">";
$output .= $wiki->Format(trim($code), $formatter);
$output .= "</div>";
 
return $output;
}
// raw inclusion from another wiki
// (regexp documentation : see "forced link" below)
else if (preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $thing, $matches))
{
list (,$url,,$text) = $matches;
if (!$text) $text = "404";
if ($url)
{
$url.="/wakka.php?wiki=".$text."/raw";
return $wiki->Format($wiki->Format($url, "raw"),"wakka");
}
else
{
return "";
}
}
// forced links
// \S : any character that is not a whitespace character
// \s : any whitespace character
else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/", $thing, $matches))
{
list (, $url, $text) = $matches;
if ($url)
{
if ($url!=($url=(preg_replace("/@@|££|\[\[/","",$url))))$result="</span>";
if (!$text) $text = $url;
$text=preg_replace("/@@|££|\[\[/","",$text);
return $result.$wiki->Link($url, "", $text);
}
else
{
return "";
}
}
// indented text
else if ((preg_match("/\n(\t+|([ ]{1})+)(-|([0-9,a-z,A-Z]+)\))?/s", $thing, $matches))
|| (preg_match("/^(\t+|([ ]{1})+)(-|([0-9,a-z,A-Z]+)\))?/s", $thing, $matches) && $brf=1))
{
// new line
if ($brf) $br=0;
$result .= ($br ? "<br />\n" : "");
 
// we definitely want no line break in this one.
$br = 0;
 
// find out which indent type we want
if (!isset($matches[3])) $matches[3] = '';
$newIndentType = $matches[3];
if (!$newIndentType) { $opener = "<div class=\"indent\">"; $closer = "</div>"; $br = 1; }
else if ($newIndentType == "-") { $opener = "<ul>\n"; $closer = "</li>\n</ul>"; $li = 1; }
else { $opener = "<ol type=\"".$matches[4]."\">\n"; $closer = "</li>\n</ol>"; $li = 1; }
 
// get new indent level
if (strpos($matches[1],"\t")) $newIndentLevel = strlen($matches[1]);
else
{
$newIndentLevel=$oldIndentLevel;
$newIndentLength = strlen($matches[1]);
if ($newIndentLength>$oldIndentLength)
{
$newIndentLevel++;
$newIndentSpace[$newIndentLength]=$newIndentLevel;
}
else if ($newIndentLength<$oldIndentLength)
$newIndentLevel=$newIndentSpace[$newIndentLength];
}
$op=0;
if ($newIndentLevel > $oldIndentLevel)
{
for ($i = 0; $i < $newIndentLevel - $oldIndentLevel; $i++)
{
$result .= $opener;
$op=1;
array_push($indentClosers, $closer);
}
}
else if ($newIndentLevel < $oldIndentLevel)
{
for ($i = 0; $i < $oldIndentLevel - $newIndentLevel; $i++)
{
$op=1;
$result .= array_pop($indentClosers);
if ($oldIndentLevel && $li) $result .= "</li>";
}
}
 
if (isset($li) && $op) $result .= "<li>";
else if (isset($li))
$result .= "</li>\n<li>";
 
$oldIndentLevel = $newIndentLevel;
$oldIndentLength= $newIndentLength;
 
return $result;
}
// new lines
else if ($thing == "\n")
{
// if we got here, there was no tab in the next line; this means that we can close all open indents.
$c = count($indentClosers);
for ($i = 0; $i < $c; $i++)
{
$result .= array_pop($indentClosers);
$br = 0;
}
$oldIndentLevel = 0;
$oldIndentLength= 0;
$newIndentSpace=array();
 
$result .= ($br ? "<br />\n" : "\n");
$br = 1;
return $result;
}
// events
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
{
if ($matches[1])
return $wiki->Action($matches[1]);
else
return "{{}}";
}
// interwiki links!
else if (preg_match("/^[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)$/s", $thing))
 
{
return $wiki->Link($thing);
}
// wiki links!
else if (preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/s", $thing))
{
return $wiki->Link($thing);
}
// separators
else if (preg_match("/-{4,}/", $thing, $matches))
{
// TODO: This could probably be improved for situations where someone puts text on the same line as a separator.
// Which is a stupid thing to do anyway! HAW HAW! Ahem.
$br = 0;
return "<hr />";
}
// if we reach this point, it must have been an accident.
return $thing;
}
}
 
 
$text = str_replace("\r", "", $text);
$text = chop($text)."\n";
$text = preg_replace_callback(
"/(\%\%.*?\%\%|".
"\"\".*?\"\"|".
"\[\[.*?\]\]|".
"\b[a-z]+:\/\/\S+|".
"\*\*|\#\#|@@|££|__|<|>|\/\/|".
"======|=====|====|===|==|".
"-{4,}|---|".
"\n(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"^(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"\{\{.*?\}\}|".
"\b[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)\b|".
"\b([A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*)\b|".
"\n)/ms", "wakka2callback", $text);
 
// we're cutting the last <br />
$text = preg_replace("/<br \/>$/","", trim($text));
echo $text ;
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/coloration_php.php
New file
0,0 → 1,30
<?php
/*
coloration_php.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
highlight_string($text)
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/tableaux.php
New file
0,0 → 1,87
<?php
function parsetable($thing)
{
$tableattr = 'border="1"';
// echo "parsetable debut : \$thing = $thing<br>";
// recuperation des attributs
preg_match("/^\[\|(.*)$/m",$thing,$match);
// echo "parsetable : \$match = ";var_dump($match);echo "<br>";
if ($match[1]){
$tableattr = $match[1];
}
$table = "<table $tableattr >\n";
//suppression de [|xxxx et de |]
$thing = preg_replace("/^\[\|(.*)$/m","",$thing);
$thing = trim(preg_replace("/\|\]/m","",$thing));
// echo "parsetable suppression [| |]: \$thing = $thing<br>";
//recuperation de chaque ligne
$rows = preg_split("/$/m",$thing,-1,PREG_SPLIT_NO_EMPTY);
// echo "parsetable preg_split:";var_dump($rows);echo "<br>";
//analyse de chaque ligne
foreach ($rows as $row){
$table .= parsetablerow($row);
}
$table.= "</table>";
return $table;
}
//parse la definition d'une ligne
function parsetablerow($row)
{
$rowattr = "";
$row = trim($row);
// echo "parsetablerow debut : \$row = $row<br>";
//detection des attributs de ligne => si la ligne ne commence pas par | alors attribut
if (!preg_match("/^\|/",$row,$match)){
preg_match("/^!([^\|]*)!\|/",$row,$match);
$rowattr = $match[1];
// echo "\$rowattr = $rowattr<br>";
$row = trim(preg_replace("/^!([^\|]*)!/","",$row));
}
$result .= " <tr $rowattr>\n";
$row = trim(preg_replace("/^\|/","",trim($row)));
$row = trim(preg_replace("/\|$/","",trim($row)));
// echo "parsetablerow sans attribut : \$row = $row<br>";
//recuperation de chaque cellule
$cells = explode("|",$row); //nb : seule les indices impaire sont significatif
// echo "parsetablerow preg_split \$cells:";var_dump($cells);echo "<br>";
$i=0;
foreach ($cells as $cell){
// if ($i % 2){
// echo "\$cell = $cell<br>";
$result .= parsetablecell($cell);
// }
$i++;
}
$result .= " </tr>\n";
return $result;
}
//parse la definition d'une cellule
function parsetablecell($cell)
{
global $wiki;
$cellattr = "";
if (preg_match("/^!(.*)!/",$cell,$match)){
$cellattr = $match[1];
}
$cell = preg_replace("/^!(.*)!/","",$cell);
//si espace au debut => align=right
//si espace a la fin => align=left
//si espace debut et fin => align=center
if (preg_match("/^\s(.*)/",$cell)){
$align="right";
}
if (preg_match("/^(.*)\s$/",$cell)){
$align="left";
}
if (preg_match("/^\s(.*)\s$/",$cell)){
$align="center";
}
if ($align) $cellattr .= " align=\"$align\"";
// echo "\$this->classname = ".get_class($wiki)."<br>";
return " <td $cellattr>".$wiki->Format($cell)."</td>\n";
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/formatters/hightlighter.class.inc
New file
0,0 → 1,250
<?php
/*
* $Id: hightlighter.class.inc,v 1.3 2006-09-21 14:18:06 florian Exp $
*
* Souligneur générique pour colorier la syntaxe de langage de programmation
*
* copyrigth Eric Feldstein 2004 mailto:garfield_fr@tiscali.fr
*
* Licence : la meme que wikini(voir le fichier LICENCE).
* Vous êtes libre d'utiliser et de modifier ce code à condition de laisser le copyright
* d'origine. Vous pouvez bien sur vous ajouter à la liste des auteurs.
*
* INSTALLATION : copier le fichier dans le repertoire "formatters" de WikiNi
* UTILISATION : importer la classe dans le script de coloration
* ATTRIBUTS DE LA CLASSE :
* - isCaseSensitiv : booleen - indique si la syntaxe est sensible a la casse
* - comment : array - tableau d'expressions regulieres definissant les commentaires multiligne
* ex : array('({[^$][^}]*})', //commentaires: { ... }
* '(\(\*[^$](.*)\*\))' //commentaires: (* ... *)
* );
* - commentLine : array tableau d'expressions regulieres definissant les commentaires monoligne
* ex : array('(//.*\n)'); //commentaire //
* - commentStyle : string - style CSS inline a utiliser pour la coloration(utilisé dans une
* balise <SPAN style="..."></SPAN>)
* - directive : array - tableau d'expression reguliere pour definir les directive de
* compilation
* - directiveStyle : string - style CSS inline a utiliser pour la coloration
* - string : array - tableau d'expression reguliere pour definir les chaine de caracteres
* - stringStyle : string - style CSS inline a utiliser pour la coloration
* - number : array - tableau d'expression reguliere pour definir les nombres
* - numberStyle : string - style CSS inline a utiliser pour la coloration
* - keywords : array - tableau asociatif contenant des tableaux de liste de mots avec leur style. Ex :
* $oHightlighter->keywords['Liste1']['words'] = array('liste1mot1','liste1mot2','liste1mot3');
* $oHightlighter->keywords['Liste1']['style'] = 'color: red';
* $oHightlighter->keywords['Liste2']['words'] = array('liste2mot1','liste2mot2');
* $oHightlighter->keywords['Liste2']['style'] = 'color: yellow';
* chaque tableau keywords['...'] DOIT posseder les 2 clé 'words' et 'style'.
* - symboles : array - tableau conteant la liste des symboles
* - symbolesStyle : string - style CSS inline a utiliser pour la coloration
* - identifier : array - tableau d'expression reguliere pour definir les identifiants
* - identStyle : string - style CSS inline a utiliser pour la coloration
* METHODE PUBLIQUE DE LA CLASSE :
* - Analyse($text) : $text string Chaine a analyser
* renvoie le texte colorié.
*
* NOTES IMPORTANTES
* - Les expressions reguliere doivent être entre parenthèse capturante pour etre utilisé
* dans une fonction de remplacement. Voir le fichier coloration_delphi.php pour un exemple
* - Lorsque un style est defini à vide, l'expression reguliere n'est pas prise en compte dans
* l'analyse.
* - L'option de recherche est msU : multiligne, le . peut être un \n et la recherche
* est 'not greedy' qui inverse la tendance à la gourmandise des expressions régulières.
*/
 
class Hightlighter{
//sensibilite majuscule/minuscule
var $isCaseSensitiv = false;
//commentaires
var $comment = array(); //commentaire multiligne
var $commentLine = array(); //commentaire monoligne
var $commentStyle = '';//'color: red';
//directives de compilation
var $directive = array();
var $directiveStyle = '';//'color: green';
//chaine de caracteres
var $string = array();
var $stringStyle = '';
//nombre
var $number = array();
var $numberStyle = '';
//mots clé
var $keywords = array();
//séparateurs
var $symboles = array();
var $symbolesStyle = '';
//identifiant
var $identifier = array();
var $identStyle = '';
//*******************************************************
// Variable privées
//*******************************************************
var $_patOpt = 'msU'; //option de recherche
var $_pattern = ''; //modele complet
var $_commentPattern = ''; //modele des commentaires
var $_directivePattern = '';//modele des directives
var $_numberPattern = ''; //modele des nombres
var $_stringPattern = ''; //modele des chaine de caracteres
var $_keywordPattern = ''; //modele pour le mots cle
var $_symbolesPattern = ''; //modele pour les symbole
var $_separatorPattern = '';//modele pour les sparateurs
var $_identPattern = ''; //modele pour les identifiants
/********************************************************
Methodes de la classe
*********************************************************/
/**
* Renvoie le pattern pour les commentaires
*/
function _getCommentPattern(){
$a = array_merge($this->commentLine,$this->comment);
return implode('|',$a);
}
/**
* Renvoie le pattern pour les directives de compilation
*/
function _getDirectivePattern(){
return implode('|',$this->directive);
}
/**
* Renvoie le pattern pour les chaine de caracteres
*/
function _getStringPattern(){
return implode('|',$this->string);
}
/**
* Renvoie le pattern pour les nombre
*/
function _getNumberPattern(){
return implode('|',$this->number);
}
/**
* Renvoie le pattern pour les mots clé
*/
function _getKeywordPattern(){
$aResult = array();
foreach($this->keywords as $key=>$keyword){
$aResult = array_merge($aResult, $keyword['words']);
$this->keywords[$key]['pattern'] = '\b'.implode('\b|\b',$keyword['words']).'\b';
}
return '\b'.implode('\b|\b',$aResult).'\b';
}
/**
* Renvoie le pattern pour les symboles
*/
function _getSymbolesPattern(){
$a = array();
foreach($this->symboles as $s){
$a[] = preg_quote($s,'`');
}
return implode('|',$a);
}
/**
* Renvoie le pattern pour les identifiants
*/
function _getIdentifierPattern(){
return implode('|',$this->identifier);
}
/**
* Liste des separateur d'apres la liste des symboles
*/
function _getSeparatorPattern(){
$a = array_unique(preg_split('//', implode('',$this->symboles), -1, PREG_SPLIT_NO_EMPTY));
$pattern = '['.preg_quote(implode('',$a),'`').'\s]+';
return $pattern;
}
/**
* Renvoie le modele a utiliser dans l'expression regulière
*
* @return string Modele de l'expression régulière
*/
function _getPattern(){
$this->_separatorPattern = $this->_getSeparatorPattern();
$this->_symbolesPattern = $this->_getSymbolesPattern();
$this->_commentPattern = $this->_getCommentPattern();
$this->_directivePattern = $this->_getDirectivePattern();
$this->_stringPattern = $this->_getStringPattern();
$this->_numberPattern = $this->_getNumberPattern();
$this->_keywordPattern = $this->_getKeywordPattern();
$this->_identPattern = $this->_getIdentifierPattern();
//construction du modele globale en fonction de l'existance d'un style(optimisation)
if($this->commentStyle){ $a[] = $this->_commentPattern; }
if($this->directiveStyle){ $a[] = $this->_directivePattern; }
if($this->stringStyle){ $a[] = $this->_stringPattern; }
if($this->numberStyle){ $a[] = $this->_numberPattern; }
if(count($this->keywords)>0){ $a[] = $this->_keywordPattern; }
if($this->symbolesStyle){ $a[] = $this->_symbolesPattern; }
if($this->identStyle){ $a[] = $this->_identPattern; }
$this->_pattern = implode('|',$a);
return $this->_pattern;
}
/**
* Fonction de remplacement de chaque élement avec leur style.
*/
function replacecallback($match){
$text = $match[0];
$pcreOpt = $this->_patOpt;
$pcreOpt .= ($this->isCaseSensitiv)?'':'i';
//commentaires
if($this->commentStyle){
if (preg_match('`'.$this->_commentPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->commentStyle\">".$match[0].'</span>';
}
}
//directive de compilation
if ($this->directiveStyle){
if (preg_match('`'.$this->_directivePattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->directiveStyle\">".$match[0].'</span>';
}
}
//chaine de caracteres
if ($this->stringStyle){
if (preg_match('`'.$this->_stringPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->stringStyle\">".$match[0].'</span>';
}
}
//nombres
if ($this->numberStyle){
if (preg_match('`'.$this->_numberPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->numberStyle\">".$match[0].'</span>';
}
}
//mot clé
if (count($this->keywords)>0){
foreach($this->keywords as $key=>$keywords){
if ($keywords['style']){
if(preg_match('`'.$keywords['pattern']."`$pcreOpt",$text,$m)){
return "<span style=\"".$keywords['style']."\">".$match[0].'</span>';
}
}
}
}
//symboles
if ($this->symbolesStyle){
if (preg_match('`'.$this->_symbolesPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->symbolesStyle\">".$match[0].'</span>';
}
}
//identifiants
if ($this->identStyle){
if (preg_match('`'.$this->_identPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->identStyle\">".$match[0].'</span>';
}
}
return $match[0];
}
/**
* renvois le code colorié
*
* @param $text string Texte a analyser
* @return string texte colorié
*/
function Analyse($text){
$pattern = '`'.$this->_getPattern()."`$this->_patOpt";
if (!$this->isCaseSensitiv){
$pattern .= 'i';
}
$text = preg_replace_callback($pattern,array($this,'replacecallback'),$text);
return $text;
}
} //class Hightlighter
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/interwiki.conf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/interwiki.conf
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/README
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/README
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/index.php
New file
0,0 → 1,30
<?php
/*
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
 
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
header("Location: wakka.php");
exit;
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/usersettings.php
New file
0,0 → 1,256
<?php
/*
usersettings.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (!isset($_REQUEST["action"])) $_REQUEST["action"] = '';
if ($_REQUEST["action"] == "logout")
{
$this->LogoutUser();
$this->SetMessage("Vous &ecirc;tes maintenant d&eacute;connect&eacute; !");
$this->Redirect($this->href());
}
else if ($user = $this->GetUser())
{
// is user trying to update?
if ($_REQUEST["action"] == "update")
{
$this->Query("update ".$this->config["table_prefix"]."users set ".
"email = '".mysql_escape_string($_POST["email"])."', ".
"doubleclickedit = '".mysql_escape_string($_POST["doubleclickedit"])."', ".
"show_comments = '".mysql_escape_string($_POST["show_comments"])."', ".
"revisioncount = '".mysql_escape_string($_POST["revisioncount"])."', ".
"changescount = '".mysql_escape_string($_POST["changescount"])."', ".
"motto = '".mysql_escape_string($_POST["motto"])."' ".
"where name = '".$user["name"]."' limit 1");
$this->SetUser($this->LoadUser($user["name"]));
// forward
$this->SetMessage("Param&egrave;tres sauvegard&eacute;s !");
$this->Redirect($this->href());
}
if ($_REQUEST["action"] == "changepass")
{
// check password
$password = $_POST["password"];
if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans les mots de passe.";
else if (strlen($password) < 5) $error = "Mot de passe trop court.";
else if ($user["password"] != md5($_POST["oldpass"])) $error = "Mauvais mot de passe.";
else
{
$this->Query("update ".$this->config["table_prefix"]."users set "."password = md5('".mysql_escape_string($password)."') "."where name = '".$user["name"]."'");
$this->SetMessage("Mot de passe chang&eacute; !");
$user["password"]=md5($password);
$this->SetUser($user);
$this->Redirect($this->href());
}
}
// user is logged in; display config form
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="update" />
<table>
<tr>
<td align="right"></td>
<td>Bonjour, <?php echo $this->Link($user["name"]) ?>&nbsp;!</td>
</tr>
<tr>
<td align="right">Votre adresse de messagerie &eacute;lectronique&nbsp;:</td>
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">&Eacute;dition en double-cliquant&nbsp;:</td>
<td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $user["doubleclickedit"] == "Y" ? "checked=\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Par d&eacute;faut, montrer les commentaires&nbsp;:</td>
<td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $user["show_comments"] == "Y" ? "checked\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Nombre maximum de derniers commentaires&nbsp;:</td>
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Nombre maximum de versions&nbsp;:</td>
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Votre devise&nbsp;:</td>
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Mise &agrave; jour" /> <input type="button" value="D&eacute;connexion" onclick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td>
</tr>
 
<?php
echo $this->FormClose();
 
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="changepass" />
 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("Changement de mot de passe"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre ancien mot de passe&nbsp;:</td>
<td><input type="password" name="oldpass" size="40" /></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe&nbsp;:</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Changer" size="40" /></td>
</tr>
</table>
<?php
echo $this->FormClose();
 
}
else
{
// user is not logged in
// is user trying to log in or register?
if ($_REQUEST["action"] == "login")
{
// if user name already exists, check password
if ($existingUser = $this->LoadUser($_POST["name"]))
{
// check password
if ($existingUser["password"] == md5($_POST["password"]))
{
$this->SetUser($existingUser, $_POST["remember"]);
$this->Redirect($this->href());
}
else
{
$error = "Mauvais mot de passe&nbsp;!";
}
}
// otherwise, create new account
else
{
$name = trim($_POST["name"]);
$email = trim($_POST["email"]);
$password = $_POST["password"];
$confpassword = $_POST["confpassword"];
 
// check if name is WikkiName style
if (!$this->IsWikiName($name)) $error = "Votre nom d'utilisateur doit &ecirc;tre format&eacute; en NomWiki.";
else if (!$email) $error = "Vous devez sp&eacute;cifier une adresse de messagerie &eacute;lectronique.";
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas &agrave; une adresse de messagerie &eacute;lectronique.";
else if ($confpassword != $password) $error = "Les mots de passe n'&eacute;taient pas identiques";
else if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans un mot de passe.";
else if (strlen($password) < 5) $error = "Mot de passe trop court. Un mot de passe doit contenir au minimum 5 caract&egrave;res alphanum&eacute;riques.";
else
{
$this->Query("insert into ".$this->config["table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_escape_string($name)."', ".
"email = '".mysql_escape_string($email)."', ".
"password = md5('".mysql_escape_string($_POST["password"])."')");
 
// log in
$this->SetUser($this->LoadUser($name));
 
// forward
$this->Redirect($this->href());
}
}
}
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="login" />
<table>
<tr>
<td></td>
<td><?php echo $this->Format("Si vous &ecirc;tes d&eacute;j&agrave; enregistr&eacute;, identifiez-vous ici"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre NomWiki&nbsp;:</td>
<td><input name="name" size="40" value="<?php if (isset($name)) echo $name ?>" /></td>
</tr>
<tr>
<td align="right">Mot de passe (5 caract&egrave;res minimum)&nbsp;:</td>
<td>
<input type="password" name="password" size="40" />
<input type="hidden" name="remember" value="0" />
<input type="checkbox" name="remember" value="1" />&nbsp;Se souvenir de moi.
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Identification" size="40" /></td>
</tr>
<tr>
<td></td>
<td width="500"><?php echo $this->Format("Les champs suivants sont &agrave; remplir si vous vous identifiez pour la premi&egrave;re fois (vous cr&eacute;erez ainsi un compte)"); ?></td>
</tr>
<tr>
<td align="right">Confirmation du mot de passe&nbsp;:</td>
<td><input type="password" name="confpassword" size="40" /></td>
</tr>
<tr>
<td align="right">Adresse de messagerie &eacute;lectronique.&nbsp;:</td>
<td><input name="email" size="40" value="<?php if (isset($email)) echo $email ?>" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Nouveau compte" size="40" /></td>
</tr>
</table>
<?php
echo $this->FormClose();
}
?>
 
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/redirect.php
New file
0,0 → 1,48
<?php
/*
redirect.php : Permet de faire une redirection vers une autre pages Wiki du site
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 David DELON
Copyright 2004 Jean Christophe ANDRE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/*
Parametres : page : nom wiki de la page vers laquelle ont doit rediriger (obligatoire)
exemple : {{redirect page="BacASable"}}
*/
 
//recuperation du parametres
$redirPageName = $this->GetParameter("page");
 
if (empty($redirPageName)){
echo $this->Format("//Le param&ecirc;tre \"page\" est manquant.//");
}else{
if (eregi("^".$redirPageName."$",$this->GetPageTag())){
echo $this->Format("//Impossible &agrave; une page de se rediriger vers elle m&ecirc;me.//");
}else{
$fromPages = array();
$fromPages = explode(":",$_COOKIE['redirectfrom']);
if (in_array($this->GetPageTag(),$fromPages)){
echo $this->Format("//Redirection circulaire.//");
}else{
$fromPages[] = $this->GetPageTag();
SetCookie('redirectfrom', implode(":",$fromPages), time() + 30, $this->CookiePath);
$this->Redirect($this->Href('', $redirPageName));
}
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/recentchangesrss.php
New file
0,0 → 1,60
<?php
/*
recentchangesrss.php
 
Copyright 2003 David DELON
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
if ($user = $this->GetUser())
{
$max = $user["changescount"];
}
else
{
$max = 50;
}
 
if ($pages = $this->LoadRecentlyChanged($max))
{
if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"];
$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
$output .= "<!-- RSS v0.91 generated by Wikini -->\n";
$output .= "<rdf:RDF\n";
$output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
$output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
$output .= "<channel>\n";
$output .= "<title> Derniers changements sur ". $this->config["wakka_name"] . "</title>\n";
$output .= "<link>" . $this->config["base_url"] . $link . "</link>\n";
$output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n";
$output .= "<language>fr</language>\n";
$output .= "</channel>\n";
 
foreach ($pages as $i => $page)
{
list($day, $time) = explode(" ", $page["time"]);
$day= preg_replace("/-/", " ", $day);
list($hh,$mm,$ss) = explode(":", $time);
$output .= "<item>\n";
$output .= "<title>" . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n";
$output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n";
$output .= "<link>" . $this->config["base_url"] . $page["tag"] . "&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
$output .= "</item>\n";
}
$output .= "</rdf:RDF>\n";
echo $output ;
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/backlinks.php
New file
0,0 → 1,62
<?php
 
/*
backlinks.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if ($this->GetParameter("page"))
{
$page = $this->GetParameter("page");
$title = "Pages ayant un lien vers ".$this->ComposeLinkToPage($page)."&nbsp;: <br />\n";
}
else
{
$page = $this->getPageTag();
$title = "Pages ayant un lien vers la page courante&nbsp;: <br />\n";
}
 
$pages = $this->LoadPagesLinkingTo($page);
 
if ($pages)
{
echo $title;
if (!$exclude = $this->GetParameter("exclude"))
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
else
{
foreach ($pages as $page)
{
// Show link if it isn't an excluded link
if (!preg_match("/".$page["tag"]."(;|$)/", $exclude)) echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
}
else
{
echo "<i>Aucune page n'a de lien vers ", $this->ComposeLinkToPage($page), ".</i>";
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/interwikilist.php
New file
0,0 → 1,30
<?php
/*interwikilist.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$file = implode("", file("interwiki.conf", 1));
echo $this->Format("%%".$file."%%") ;
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/wantedpages.php
New file
0,0 → 1,43
<?php
/*
wantedpages.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($pages = $this->LoadWantedPages())
{
foreach ($pages as $page)
{
echo $this->Link($page["tag"])," (<a
ref=\"",$this->href(),"&amp;linking_to=",$page["tag"],"\">",$page["count"],"</a>)<br />\n";
}
}
else
{
echo "<i>Aucune page &agrave; cr&eacute;er.</i>";
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/attach.php
New file
0,0 → 1,121
<?php
/*
attach.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
* DOCUMENTATION
*******************************************************************************
RESUME
L'action {{attach}} permet de lier un fichier à une page, d'uploader ce fichier
et de downloader ce fichier. Si le fichier est une image, elle est affichée
dans la page. Lorsque le fichier est sur le serveur, il est possible de faire
une mise à jour de celui-ci.
 
PARAMETRES DE L'ACTION
L'action {{attach}} prend les paramètres suivants :
- file ou attachfile: nom du fichier tel qu'il sera sur le serveur. Les
espaces sont remplacé par des "_". (OBLIGATOIRE)
- desc ou attachdesc: description du fichier. C'est le texte qui sera affiché
comme lien vers le fichier ou dans l'attribut alt de la balise <img>. Ce
paramètre est obligatoire pour les images pour être conforme au XHTML.
- delete ou attachdelete: Si ce paramètre est non vide alors le fichier sera
effacé sur le serveur.
- link ou attachlink: URL de lien pour une image sensible. le lien peut être
un nom de page WikiNi, un lien interwiki ou une adresse http
- class: indique le nom de la ou les classes de style à utiliser pour afficher
l'image. les noms des classes sont séparés par un espace.
 
EXEMPLES
- Attacher un fichier archive:
{{attach file="archive.zip"}}
- Attacher un fichier archive avec une description
{{attach file="archive.zip" desc="Code source de l'application"}}
- Supprimer un fichier:
{{attach file="archive.zip" delete="y"}}
- Afficher une image:
{{attach file="image.png" desc="voici une image"}}
- Afficher une image sensible:
{{attach file="image.png" desc="voici une image" link="PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="WikiNi:PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="http://www.wikini.net"}}
- Afficher une image collé sur le bord droit et sans contour:
{{attach file="image.png" desc="voici une image" class="right noborder"}}
 
INSTALLATION
1) Copiez le fichier attach.php dans le répertoire des actions (/actions)
2) Copiez le fichier attach.class.php dans le répertoire des actions (/actions)
3) Copiez le fichier attachfm.php dans le repertoire des actions (/actions)
4) Copiez le fichier filamanager.php dans le répertoire des handlers (/handlers/page)
5) Copiez le fichier upload.php dans le répertoire des handlers (/handlers/page)
6) Copiez le fichier download.php dans le répertoire des handlers (/handlers/page)
7) Créez le répertoire racine des uploads sur le site du wiki. Si le SAFE_MODE
de PHP est activé, vous devez créer vous même ce répertoire et autoriser
l'écriture dans ce répertoire pour l'utilisateur et le groupe.
8) Ouvrez le fichier wakka.config.php et ajoutez la configuration de l'action.
Tous les paramètres de configuration ont une valeur par défaut.
Le configuration par défaut est:
 
$wakkaConfig["attach_config"] = array(
"upload_path" => 'files', //repertoire racine des uploads
"ext_images" => 'gif|jpeg|png|jpg', //extension des fichiers images
"ext_script" => 'php|php3|asp|asx|vb|vbs|js', //extension des script(non utilisé)
"update_symbole" => '*', //symbole pour faire un update du fichier
"max_file_size" => 1024*100, //taille maximum du fichier en octer (100Ko par défaut)
"fmDelete_symbole" => 'Supr', //symbole a afficher pour le lien "supprimer" dans le gestionnaire de fichier
"fmRestore_symbole" => 'Rest', //symbole a afficher pour le lien "restaurer" dans le gestionnaire de fichier
"fmTrash_symbole" => 'Poubelle') //symbole a afficher pour le lien "Poubelle" dans le gestionnaire de fichier
 
9) Ajoutez les classes de style au fichier wakka.css. Exemple de style :
.attach_margin05em { margin: 0.5em;}
.attach_margin1em { margin: 1em;}
.attach_left {float: left;}
.attach_right {float: right;}
.attach_noborder {border-width: 0px;}
.attach_vmiddle {vertical-align: text-bottom;}
 
10)Pour configurer l'aspect du gestionnnaire de fichier utiliser les classes de style .tableFM
tableFMCol1 et tableFMCol2
Exemple :
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
*******************************************************************************/
 
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doAttach();
unset($att);
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/pageindex.php
New file
0,0 → 1,54
<?php
/*
pageindex.php
Copyright (c) 2003, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($pages = $this->LoadAllPages())
{
foreach ($pages as $page)
{
if (!preg_match("/^Comment/", $page["tag"])) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
 
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
 
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
}
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/resetpassword.php
New file
0,0 → 1,80
<?php
/*
resetpassword.php
 
Copyright 2003 Patrick PAUL
Copyright 2003 David DELON
Copyright 2004 David VANTYGHEM
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if (($user = $this->GetUser()) && ($user["name"]==$this->GetConfigValue("admin")) && $this->GetConfigValue("admin"))
{
 
if (($_REQUEST["action"] == "resetpass"))
{
$this->Query("update ".$this->config["table_prefix"]."users set ".
"password = md5('".mysql_escape_string($_POST["password"])."') ".
"where name = '".mysql_escape_string($_POST["name"])."' limit 1");
$this->SetMessage("Mot de passe r&eacute;initialis&eacute; !");
$this->Redirect($this->href());
}
else
{
$error="";
//$error = "Il est interdit de r&eacute;initialiser le mot de passe de cet utilisateur ! Non mais !";
}
echo $this->FormOpen() ;
$name=$_GET["name"];
?>
<input type="hidden" name="action" value="resetpass">
<table>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("R&eacute;initialisation du mot de passe"); ?></td>
</tr>
<?php
if ($error)
{
echo "<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n" ;
}
?>
<tr>
<td align="right">Login:</td>
<td><input name="name" size="40" value="<?php echo $name ?>"></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe:</td>
<td><input type="password" name="password" size="40"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Reset password" size="40"></td>
</tr>
</table>
<?php
echo $this->FormClose() ;
}
else
{
echo "<i>Vous n'avez pas les permissions n&eacute;cessaires pour ex&eacute;cuter cette action.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/mypages.php
New file
0,0 → 1,78
<?php
 
// actions/mypages.php
// written by Carlo Zottmann
// http://wakkawikki.com/CarloZottmann
/*
mypages.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Jean Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($user = $this->GetUser())
{
echo "<b>Liste des pages dont vous &ecirc;tes le propri&eacute;taire.</b><br /><br />\n" ;
 
$my_pages_count = 0;
 
if ($pages = $this->LoadAllPages())
{
foreach ($pages as $page)
{
if ($this->UserName() == $page["owner"] && !preg_match("/^Comment/", $page["tag"])) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
$my_pages_count++;
}
}
if ($my_pages_count == 0)
{
echo "<i>Vous n'&ecirc;tes le propri&eacute;taire d'aucune page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/changestyle.php
New file
0,0 → 1,67
<?php
 
// Action changesstyle.php version 0.2 du 16/03/2004
// pour WikiNi 0.4.1rc (=> à la version du 200403xx) et supérieurs
// Par Charles Népote (c) 2004
// Licence GPL
 
 
// Fonctionnement
//
// Cette action regroupe la fonction de changement de style ainsi que l'interface
// de modification du style.
// Une fois le style sélectionné via l'interface, la requête est envoyée sous la forme :
// http://example.org/PageTest&set="NomDeFeuilleDeStyle"
// . si ce nom n'est pas constitué uniquement de caractères alphanumériques,
// une erreur est retournée
// . si ce nom est valide et que la feuille de style existe :
// . on change le cookie utilisateur
// . on redirrige l'utilisateur vers http://example.org/PageTest où
// l'utilisateur peut alors constater le changement de style
 
 
// Usage :
//
// -- {{changestyle link="xxx.css"}}
// donne le lien suivant :
// Feuille de style xxx.css
//
// -- {{changestyle link="xxx.css" title="Ouragan"}}
// donne le lien suivant :
// Ouragan
 
 
// A compléter (peut-être un jour) :
//
// -- {{changestyle}}
// donne un formulaire :
// Entrer l'adresse de la feuille de style désirée : [ ]
//
// -- {{changestyle choice="zzz.css;ttt.css"}}
// [] Feuille de style zzz
// [] Feuille de style ttt
 
 
$set = $_GET["set"];
 
 
if ($this->GetParameter(link))
{
echo "<a href=\"".$this->href()."&set=".$this->GetParameter(link)."\">";
echo (!$this->GetParameter(title))?"Feuille de style ".$this->GetParameter(link):$this->GetParameter(title);
echo "</a>";
}
 
 
// Do it.
if (preg_match("/^[A-Za-z0-9][A-Za-z0-9]+$/", $set))
{
$this->SetPersistentCookie('sitestyle',$set,1);
header("Location: ".$this->href());
}
else if ($set)
{
$this->SetMessage("La feuille de style ".$set." est non valide !");
header("Location: ".$this->href());
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/attach.class.php
New file
0,0 → 1,625
<?php
/*
attach.class.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Classe de gestion de l'action {{attach}}
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
class attach {
var $wiki = ''; //objet wiki courant
var $attachConfig = array(); //configuration de l'action
var $file = ''; //nom du fichier
var $desc = ''; //description du fichier
var $link = ''; //url de lien (image sensible)
var $isPicture = 0; //indique si c'est une image
var $classes = ''; //classe pour afficher une image
var $attachErr = ''; //message d'erreur
var $pageId = 0; //identifiant de la page
var $isSafeMode = false; //indicateur du safe mode de PHP
/**
* Constructeur. Met les valeurs par defaut aux paramètres de configuration
*/
function attach(&$wiki){
$this->wiki = $wiki;
$this->attachConfig = $this->wiki->GetConfigValue("attach_config");
if (empty($this->attachConfig["ext_images"])) $this->attachConfig["ext_images"] = "gif|jpeg|png|jpg";
if (empty($this->attachConfig["ext_script"])) $this->attachConfig["ext_script"] = "php|php3|asp|asx|vb|vbs|js";
if (empty($this->attachConfig['upload_path'])) $this->attachConfig['upload_path'] = 'files';
if (empty($this->attachConfig['update_symbole'])) $this->attachConfig['update_symbole'] = '*';
if (empty($this->attachConfig['max_file_size'])) $this->attachConfig['max_file_size'] = 1024*100; //100ko max
if (empty($this->attachConfig['fmDelete_symbole'])) $this->attachConfig['fmDelete_symbole'] = 'Supr';
if (empty($this->attachConfig['fmRestore_symbole'])) $this->attachConfig['fmRestore_symbole'] = 'Rest';
if (empty($this->attachConfig['fmTrash_symbole'])) $this->attachConfig['fmTrash_symbole'] = 'Poubelle';
$this->isSafeMode = ini_get("safe_mode");
}
/******************************************************************************
* FONCTIONS UTILES
*******************************************************************************/
/**
* Création d'une suite de répertoires récursivement
*/
function mkdir_recursif ($dir) {
if (strlen($dir) == 0) return 0;
if (is_dir($dir)) return 1;
elseif (dirname($dir) == $dir) return 1;
return ($this->mkdir_recursif(dirname($dir)) and mkdir($dir,0755));
}
/**
* Renvois le chemin du script
*/
function GetScriptPath () {
if (preg_match("/.(php)$/i",$_SERVER["PHP_SELF"])){
$a = explode('/',$_SERVER["PHP_SELF"]);
$a[count($a)-1] = '';
$path = implode('/',$a);
}else{
$path = $_SERVER["PHP_SELF"];
}
return !empty($_SERVER["HTTP_HOST"])? 'http://'.$_SERVER["HTTP_HOST"].$path : 'http://'.$_SERVER["SERVER_NAME"].$path ;
}
/**
* Calcul le repertoire d'upload en fonction du safe_mode
*/
function GetUploadPath(){
if ($this->isSafeMode) {
$path = $this->attachConfig['upload_path'];
}else{
$path = $this->attachConfig['upload_path'].'/'.$this->wiki->GetPageTag();
if (! is_dir($path)) $this->mkdir_recursif($path);
}
return $path;
}
/**
* Calcule le nom complet du fichier attaché en fonction du safe_mode, du nom et de la date de
* revision la page courante.
* Le nom du fichier "mon fichier.ext" attache à la page "LaPageWiki"sera :
* mon_fichier_datepage_update.ext
* update : date de derniere mise a jour du fichier
* datepage : date de revision de la page à laquelle le fichier a ete lié/mis a jour
* Si le fichier n'est pas une image un '_' est ajoute : mon_fichier_datepage_update.ext_
* Selon la valeur de safe_mode :
* safe_mode = on : LaPageWiki_mon_fichier_datepage_update.ext_
* safe_mode = off: LaPageWiki/mon_fichier_datepage_update.ext_ avec "LaPageWiki" un sous-repertoire du répertoire upload
*/
function GetFullFilename($newName = false){
$pagedate = $this->convertDate($this->wiki->page['time']);
//decompose le nom du fichier en nom+extension
if (preg_match('`^(.*)\.(.*)$`', str_replace(' ','_',$this->file), $match)){
list(,$file['name'],$file['ext'])=$match;
if(!$this->isPicture()) $file['ext'] .= '_';
}else{
return false;
}
//recuperation du chemin d'upload
$path = $this->GetUploadPath($this->isSafeMode);
//generation du nom ou recherche de fichier ?
if ($newName){
$full_file_name = $file['name'].'_'.$pagedate.'_'.$this->getDate().'.'.$file['ext'];
if($this->isSafeMode){
$full_file_name = $path.'/'.$this->wiki->GetPageTag().'_'.$full_file_name;
}else{
$full_file_name = $path.'/'.$full_file_name;
}
}else{
//recherche du fichier
if($this->isSafeMode){
//TODO Recherche dans le cas ou safe_mode=on
$searchPattern = '`^'.$this->wiki->GetPageTag().'_'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}else{
$searchPattern = '`^'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}
$files = $this->searchFiles($searchPattern,$path);
 
$unedate = 0;
foreach ($files as $file){
//recherche du fichier qui une datepage <= a la date de la page
if($file['datepage']<=$pagedate){
//puis qui a une dateupload la plus grande
if ($file['dateupload']>$unedate){
$theFile = $file;
$unedate = $file['dateupload'];
}
}
}
if (is_array($theFile)){
$full_file_name = $path.'/'.$theFile['realname'];
}
}
return $full_file_name;
}
/**
* Test si le fichier est une image
*/
function isPicture(){
return preg_match("/.(".$this->attachConfig["ext_images"].")$/i",$this->file)==1;
}
/**
* Renvoie la date courante au format utilise par les fichiers
*/
function getDate(){
return date('YmdHis');
}
/**
* convertie une date yyyy-mm-dd hh:mm:ss au format yyyymmddhhmmss
*/
function convertDate($date){
$date = str_replace(' ','', $date);
$date = str_replace(':','', $date);
return str_replace('-','', $date);
}
/**
* Parse une date au format yyyymmddhhmmss et renvoie un tableau assiatif
*/
function parseDate($sDate){
$pattern = '`^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$`';
$res = '';
if (preg_match($pattern, $sDate, $m)){
//list(,$res['year'],$res['month'],$res['day'],$res['hour'],$res['min'],$res['sec'])=$m;
$res = $m[1].'-'.$m[2].'-'.$m[3].' '.$m[4].':'.$m[5].':'.$m[6];
}
return ($res?$res:false);
}
/**
* Decode un nom long de fichier
*/
function decodeLongFilename($filename){
$afile = array();
$afile['realname'] = basename($filename);
$afile['size'] = filesize($filename);
$afile['path'] = dirname($filename);
if(preg_match('`^(.*)_(\d{14})_(\d{14})\.(.*)(trash\d{14})?$`', $afile['realname'], $m)){
$afile['name'] = $m[1];
//suppression du nom de la page si safe_mode=on
if ($this->isSafeMode){
$afile['name'] = preg_replace('`^('.$this->wiki->tag.')_(.*)$`i', '$2', $afile['name']);
}
$afile['datepage'] = $m[2];
$afile['dateupload'] = $m[3];
$afile['trashdate'] = preg_replace('`(.*)trash(\d{14})`', '$2', $m[4]);
//suppression de trashxxxxxxxxxxxxxx eventuel
$afile['ext'] = preg_replace('`^(.*)(trash\d{14})$`', '$1', $m[4]);
$afile['ext'] = rtrim($afile['ext'],'_');
//$afile['ext'] = rtrim($m[4],'_');
}
return $afile;
}
/**
* Renvois un tableau des fichiers correspondant au pattern. Chaque element du tableau est un
* tableau associatif contenant les informations sur le fichier
*/
function searchFiles($filepattern,$start_dir){
$files_matched = array();
$start_dir = rtrim($start_dir,'\/');
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '.')==0 || strcmp($file, '..')==0 || is_dir($file)) continue;
if (preg_match($filepattern, $file)){
$files_matched[] = $this->decodeLongFilename($start_dir.'/'.$file);
}
}
return $files_matched;
}
/******************************************************************************
* FONCTIONS D'ATTACHEMENTS
*******************************************************************************/
/**
* Test les paramètres passé à l'action
*/
function CheckParams(){
//recuperation des parametres necessaire
$this->file = $this->wiki->GetParameter("attachfile");
if (empty($this->file)) $this->file = $this->wiki->GetParameter("file");
$this->desc = $this->wiki->GetParameter("attachdesc");
if (empty($this->desc)) $this->desc = $this->wiki->GetParameter("desc");
$this->link = $this->wiki->GetParameter("attachlink");//url de lien - uniquement si c'est une image
if (empty($this->link)) $this->link = $this->wiki->GetParameter("link");
//test de validité des parametres
if (empty($this->file)){
$this->attachErr = $this->wiki->Format("//action attach : paramètre **file** manquant//---");
}
if ($this->isPicture() && empty($this->desc)){
$this->attachErr .= $this->wiki->Format("//action attach : paramètre **desc** obligatoire pour une image//---");
}
if ($this->wiki->GetParameter("class")) {
$array_classes = explode(" ", $this->wiki->GetParameter("class"));
foreach ($array_classes as $c) { $this->classes = $this->classes . "attach_" . $c . " "; }
$this->classes = trim($this->classes);
}
}
/**
* Affiche le fichier lié comme une image
*/
function showAsImage($fullFilename){
//c'est une image : balise <IMG..../>
$img = "<img src=\"".$this->GetScriptPath().$fullFilename."\" ".
"alt=\"".$this->desc.($this->link?"\nLien vers: $this->link":"")."\" />";
//test si c'est une image sensible
if(!empty($this->link)){
//c'est une image sensible
//test si le lien est un lien interwiki
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $this->link, $matches))
{ //modifie $link pour être un lien vers un autre wiki
$this->link = $this->wiki->GetInterWikiUrl($matches[1], $matches[2]);
}
//calcule du lien
$output = $this->wiki->Format('[['.$this->link." $this->file]]");
$output = eregi_replace(">$this->file<",">$img<",$output);//insertion du tag <img...> dans le lien
}else{
//ce n'est pas une image sensible
$output = $img;
}
$output = ($this->classes?"<span class=\"$this->classes\">$output</span>":$output);
echo $output;
$this->showUpdateLink();
}
/**
* Affiche le fichier lié comme un lien
*/
function showAsLink($fullFilename){
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=$this->file");
echo '<a href="'.$url.'">'.($this->desc?$this->desc:$this->file)."</a>";
$this->showUpdateLink();
}
/**
* Affiche le lien de mise à jour
*/
function showUpdateLink(){
echo " <a href=\"".
$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file").
"\" title='Mise à jour'>".$this->attachConfig['update_symbole']."</a>";
}
/**
* Affiche un liens comme un fichier inexistant
*/
function showFileNotExits(){
echo $this->file."<a href=\"".$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file")."\">?</a>";
}
/**
* Affiche l'attachement
*/
function doAttach(){
$this->CheckParams();
if ($this->attachErr) {
echo $this->attachErr;
return;
}
$fullFilename = $this->GetFullFilename();
//test d'existance du fichier
if((!file_exists($fullFilename))||($fullFilename=='')){
$this->showFileNotExits();
return;
}
//le fichier existe : affichage en fonction du type
if($this->isPicture()){
$this->showAsImage($fullFilename);
}else{
$this->showAsLink($fullFilename);
}
}
/******************************************************************************
* FONTIONS D'UPLOAD DE FICHIERS
*******************************************************************************/
/**
* Traitement des uploads
*/
function doUpload(){
$HasAccessWrite=$this->wiki->HasAccess("write");
if ($HasAccessWrite){
switch ($_SERVER["REQUEST_METHOD"]) {
case 'GET' : $this->showUploadForm(); break;
case 'POST': $this->performUpload(); break;
default : echo $this->wiki->Format("//Methode de requete invalide//---");
}
}else{
echo $this->wiki->Format("//Vous n'avez pas l'accès en écriture à cette page//---");
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
}
/**
* Formulaire d'upload
*/
function showUploadForm(){
echo $this->wiki->Format("====Formulaire d'envois de fichier====\n---");
$this->file = $_GET['file'];
echo $this->wiki->Format("**Envois du fichier $this->file :**\n")
."<form enctype=\"multipart/form-data\" name=\"frmUpload\" method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">\n"
." <input type=\"hidden\" name=\"wiki\" value=\"".$this->wiki->GetPageTag()."/upload\" />\n"
." <input TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$this->attachConfig['max_file_size']."\" />\n"
." <input type=\"hidden\" name=\"file\" value=\"$this->file\" />\n"
." <input type=\"file\" name=\"upFile\" size=\"50\" /><br />\n"
." <input type=\"submit\" value=\"Envoyer\" />\n"
."</form>\n";
}
/**
* Execute l'upload
*/
function performUpload(){
$this->file = $_POST['file'];
 
$destFile = $this->GetFullFilename(true); //nom du fichier destination
//test de la taille du fichier recu
if($_FILES['upFile']['error']==0){
$size = filesize($_FILES['upFile']['tmp_name']);
if ($size > $this->attachConfig['max_file_size']){
$_FILES['upFile']['error']=2;
}
}
switch ($_FILES['upFile']['error']){
case 0:
$srcFile = $_FILES['upFile']['tmp_name'];
if (move_uploaded_file($srcFile,$destFile)){
chmod($destFile,0644);
header("Location: ".$this->wiki->href("",$this->wiki->GetPageTag(),""));
}else{
echo $this->wiki->Format("//Erreur lors du déplacement du fichier temporaire//---");
}
break;
case 1:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de upload_max_filesize, configuré dans le php.ini.//---");
break;
case 2:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de MAX_FILE_SIZE, qui a été spécifiée dans le formulaire HTML.//---");
break;
case 3:
echo $this->wiki->Format("//Le fichier n'a été que partiellement téléchargé.//---");
break;
case 4:
echo $this->wiki->Format("//Aucun fichier n'a été téléchargé.//---");
break;
}
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
/******************************************************************************
* FUNCTIONS DE DOWNLOAD DE FICHIERS
*******************************************************************************/
function doDownload(){
$this->file = $_GET['file'];
$fullFilename = $this->GetUploadPath().'/'.$this->file;
if(!file_exists($fullFilename)){
$fullFilename = $this->GetFullFilename();
$dlFilename = $this->file;
$size = filesize($fullFilename);
}else{
$file = $this->decodeLongFilename($fullFilename);
$size = $file['size'];
$dlFilename =$file['name'].'.'.$file['ext'];
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/force-download");
header('Pragma: public');
header("Pragma: no-cache");// HTTP/1.0
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octet-stream; name="' . $dlFilename . '"'); //This should work for the rest
header('Content-Type: application/octetstream; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Type: application/download; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Disposition: attachment; filename="'.$dlFilename.'"');
header("Content-Description: File Transfer");
header("Content-length: $size".'bytes');
readfile($fullFilename);
}
/******************************************************************************
* FONTIONS DU FILEMANAGER
*******************************************************************************/
function doFileManager(){
$do = $_GET['do']?$_GET['do']:'';
switch ($do){
case 'restore' :
$this->fmRestore();
$this->fmShow(true);
break;
case 'erase' :
$this->fmErase();
$this->fmShow(true);
break;
case 'del' :
$this->fmDelete();
$this->fmShow();
break;
case 'trash' :
$this->fmShow(true); break;
case 'emptytrash' :
$this->fmEmptyTrash(); //pas de break car apres un emptytrash => retour au gestionnaire
default :
$this->fmShow();
}
}
/**
* Affiche la liste des fichiers
*/
function fmShow($trash=false){
$fmTitlePage = $this->wiki->Format("====Gestion des fichiers attachés à la page ".$this->wiki->tag."====\n---");
if($trash){
//Avertissement
$fmTitlePage .= '<div class="prev_alert">Les fichiers effacés sur cette page le sont définitivement</div>';
//Pied du tableau
$url = $this->wiki->Link($this->wiki->tag,'filemanager','Gestion des fichiers');
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n";
$url = $this->wiki->Link($this->wiki->tag,'filemanager&do=emptytrash','Vider la poubelle');
$fmFootTable.= ' <td>'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}else{
//pied du tableau
$url = '<a href="'.$this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=trash').'" title="Poubelle">'.$this->attachConfig['fmTrash_symbole']."</a>";
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}
//entete du tableau
$fmHeadTable = ' <thead>'."\n".
' <tr>'."\n".
' <td>&nbsp;</td>'."\n".
' <td>Nom du fichier</td>'."\n".
' <td>Nom réel du fichier</td>'."\n".
' <td>Taille</td>'."\n".
' <td>Révision de la page</td>'."\n".
' <td>Révison du fichier</td>'."\n";
if($trash){
$fmHeadTable.= ' <td>Suppression</td>'."\n";
}
$fmHeadTable.= ' </tr>'."\n".
' </thead>'."\n";
//corps du tableau
$files = $this->fmGetFiles($trash);
$files = $this->sortByNameRevFile($files);
 
$fmBodyTable = ' <tbody>'."\n";
$i = 0;
foreach ($files as $file){
$i++;
$color= ($i%2?"tableFMCol1":"tableFMCol2");
//lien de suppression
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=erase&file='.$file['realname']);
}else{
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=del&file='.$file['realname']);
}
$dellink = '<a href="'.$url.'" title="Supprimer">'.$this->attachConfig['fmDelete_symbole']."</a>";
//lien de restauration
$restlink = '';
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=restore&file='.$file['realname']);
$restlink = '<a href="'.$url.'" title="Restaurer">'.$this->attachConfig['fmRestore_symbole']."</a>";
}
 
//lien pour downloader le fichier
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=".$file['realname']);
$dlLink = '<a href="'.$url.'">'.$file['name'].'.'.$file['ext']."</a>";
$fmBodyTable .= ' <tr class="'.$color.'">'."\n".
' <td>'.$dellink.' '.$restlink.'</td>'."\n".
' <td>'.$dlLink.'</td>'."\n".
' <td>'.$file['realname'].'</td>'."\n".
' <td>'.$file['size'].'</td>'."\n".
' <td>'.$this->parseDate($file['datepage']).'</td>'."\n".
' <td>'.$this->parseDate($file['dateupload']).'</td>'."\n";
if($trash){
$fmBodyTable.= ' <td>'.$this->parseDate($file['trashdate']).'</td>'."\n";
}
$fmBodyTable .= ' </tr>'."\n";
}
$fmBodyTable .= ' </tbody>'."\n";
//pied de la page
$fmFooterPage = "---\n-----\n[[".$this->wiki->tag." Retour à la page ".$this->wiki->tag."]]\n";
//affichage
echo $fmTitlePage."\n";
echo '<table class="tableFM" border="0" cellspacing="0">'."\n".$fmHeadTable.$fmFootTable.$fmBodyTable.'</table>'."\n";
echo $this->wiki->Format($fmFooterPage);
}
/**
* Renvoie la liste des fichiers
*/
function fmGetFiles($trash=false){
$path = $this->GetUploadPath();
if($this->isSafeMode){
$filePattern = '^'.$this->wiki->GetPageTag().'_.*_\d{14}_\d{14}\..*';
}else{
$filePattern = '^.*_\d{14}_\d{14}\..*';
}
if($trash){
$filePattern .= 'trash\d{14}';
}else{
$filePattern .= '[^(trash\d{14})]';
}
return $this->searchFiles('`'.$filePattern.'$`', $path);
}
/**
* Vide la poubelle
*/
function fmEmptyTrash(){
$files = $this->fmGetFiles(true);
foreach ($files as $file){
$filename = $file['path'].'/'.$file['realname'];
if(file_exists($filename)){
unlink($filename);
}
}
}
/**
* Effacement d'un fichier dans la poubelle
*/
function fmErase(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
unlink($filename);
}
}
/**
* Met le fichier a la poubelle
*/
function fmDelete(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$trash = $filename.'trash'.$this->getDate();
rename($filename, $trash);
}
}
/**
* Restauration d'un fichier mis a la poubelle
*/
function fmRestore(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$restFile = preg_replace('`^(.*\..*)trash\d{14}$`', '$1', $filename);
rename($filename, $restFile);
}
}
/**
* Tri tu tableau liste des fichiers par nom puis par date de revision(upload) du fichier, ordre croissant
*/
function sortByNameRevFile($files){
if (!function_exists('ByNameByRevFile')){
function ByNameByRevFile($f1,$f2){
$f1Name = $f1['name'].'.'.$f1['ext'];
$f2Name = $f2['name'].'.'.$f2['ext'];
$res = strcasecmp($f1Name, $f2Name);
if($res==0){
//si meme nom => compare la revision du fichier
$res = strcasecmp($f1['dateupload'], $f2['dateupload']);
}
return $res;
}
}
usort($files,'ByNameByRevFile');
return $files;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/recentchanges.php
New file
0,0 → 1,76
<?php
 
/*
recentchanges.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Which is the max number of pages to be shown ?
if ($max = $this->GetParameter("max"))
{
if ($max=="last") $max=50; else $last = (int) $max;
}
elseif ($user = $this->GetUser())
{
$max = $user["changescount"];
}
else
{
$max = 50;
}
 
// Show recently changed pages
if ($pages = $this->LoadRecentlyChanged($max))
{
if ($this->GetParameter("max"))
{
foreach ($pages as $i => $page)
{
// echo entry
echo "(",$page["time"],") (",$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($page["user"]),"<br />\n" ;
}
}
else
{
$curday='';
foreach ($pages as $i => $page)
{
// day header
list($day, $time) = explode(" ", $page["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$time,") (",$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($page["user"]),"<br />\n" ;
}
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/textsearch.php
New file
0,0 → 1,106
<?php
/*
textsearch.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
Copyright 2004 Jean Christophe ANDRÉ
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// label à afficher devant la zone de saisie
$label = $this->GetParameter('label', 'Ce que vous souhaitez chercher&nbsp;: ');
// largeur de la zone de saisie
$size = $this->GetParameter('size', '40');
// texte du bouton
$button = $this->GetParameter('button', 'Chercher');
// texte à chercher
$phrase = $this->GetParameter('phrase', false);
// séparateur entre les éléments trouvés
$separator = $this->GetParameter('separator', false);
 
// se souvenir si c'était un paramètre de l'action ou du CGI
$paramPhrase = $phrase;
// récupérer le paramètre du CGI le cas échéant
if (!isset($_REQUEST['phrase'])) $_REQUEST['phrase'] = '';
if (!$phrase) $phrase = $_REQUEST['phrase'];
 
// s'il y a un paramètre d'action "phrase", on affiche uniquement le résultat
// dans le cas contraire, présenter une zone de saisie
if (!$paramPhrase)
{
echo $this->FormOpen('', '', 'get');
if ($label)
{
echo $this->Format($label), ' ';
}
echo '<input name="phrase" size="', htmlspecialchars($size), '" value="', htmlentities($phrase), '" />';
if ($button)
{
echo '&nbsp;<input type="submit" value="', htmlspecialchars($button), '" />';
}
echo "\n", $this->FormClose();
}
 
if ($phrase)
{
if ($results = $this->FullTextSearch($phrase))
{
if ($separator)
{
$separator = htmlspecialchars($separator);
if (!$paramPhrase)
{
echo '<p>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;: ';
}
foreach ($results as $i => $page)
{
if ($i > 0) echo $separator;
echo $this->ComposeLinkToPage($page['tag']);
}
if (!$paramPhrase)
{
echo '</p>', "\n";
}
}
else
{
echo '<p><strong>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;:</strong></p>', "\n",
'<ol>', "\n";
foreach ($results as $i => $page)
{
echo "<li>", $this->ComposeLinkToPage($page["tag"]), "</li>\n";
}
echo "</ol>\n";
}
}
else
{
if (!$paramPhrase)
{
echo "<p>Aucun r&eacute;sultat pour \"", htmlspecialchars($phrase), "\". :-(</p>";
}
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/trail.php
New file
0,0 → 1,102
<?php
 
/*
trail.php : Permet d'afficher des liens "Page Suivante" "Sommaire" "Page Precedente" dans une page
 
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/*
* Cette action permet de lier des pages entre elle via une page contenant la liste
* ordonnées de ces pages. L'action affiche des liens de navigation permettant de
* passer à la page suivante ou précédente ou de revenir au sommaire.
*
* @param toc string nom de la page contenant la liste ordonnée des pages à liées entre elles
*/
 
/* La page sommaire doit contenir une liste de pages. Le premier mot de chaque élément
de la liste doit être le nom d'une page du wiki, donc un mot wiki ou un lien force
exemple de page sommaire:
 
===Sommaire===
 
IntroductionAuProjet : présentation du projet.
[[AnalyseProjet Analyse]] : analyse des besoins
-BesoinDesUtilisateurs
-ContraintesTechniques
OutilsEtNormes
 
Texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte texte
 
*/
 
//echo $this->Format("===Action Trail===");
$sommaire = $this->GetParameter("toc");
if (!$sommaire) {
echo $this->Format("//Indiquez le nom de la page sommaire, paramètre 'toc'//.");
}else{
//chargement de la page sommaire
$tocPage = $this->LoadPage($sommaire);
//analyse de la page sommaire pour récupérer la liste des pages
//recuperation de la liste
if (preg_match_all("/\n[\t ]+(.*)/",$tocPage["body"],$tocListe)){
//analyse de chaque ligne de la liste pour recupérer la page cible
$currentPageIndex = NULL;
foreach ($tocListe[1] as $line){
//suppression d'un signe de liste eventuel
$line = trim(preg_replace("/^([A-Za-z0-9]+\)|-)/","",$line));
//recuperation du 1er mot
$line = preg_replace("/^(\[\[.*\]\]|[A-Za-z0-9]+)\s*(.*)$/","$1",$line);
//ajout a la liste des pages si le 1er mot est un lien force ou un mot wiki
if (preg_match("/\[\[.*\]\]/",$line,$match)|$this->IsWikiName($line)){
$pages[] = $line;
//regarde si la page ajoute a la liste est la page courante
if (strcasecmp($this->GetPageTag(),$line)==0){
$currentPageIndex = count($pages)-1;
}else { //traite le cas des lien force
if (preg_match("/\[\[(.*:)?".$this->GetPageTag()."(\s.*)?\]\]$/",$line)) {
$currentPageIndex = count($pages)-1;
}
}
 
}
}//foreach
}
//ecriture des liens Page Précedente/sommaire/page suivante
if ($currentPageIndex>0) {
$PrevPage = $pages[$currentPageIndex-1];
$btnPrev = "<span class=\"trail_button\">".$this->Format("&lt;&lt; $PrevPage")."</span>";
}else{
$btnPrev = "&nbsp;";
}
$btnTOC = "<span class=\"trail_button\">".$this->Format($sommaire)."</span>";
if ($currentPageIndex < (count($pages)-1)){
$NextPage = $pages[$currentPageIndex+1];
$btnNext = "<span class=\"trail_button\">".$this->Format("$NextPage &gt;&gt;")."</span>";
}else{
$btnNext = "&nbsp;";
}
echo "<table class=\"trail_table\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35%\">$btnPrev</td>\n";
echo " <td align=\"center\">$btnTOC</td>\n";
echo " <td align=\"right\" width=\"35%\">$btnNext</td>\n";
echo " </tr>\n";
echo "</table>\n";
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/mychanges.php
New file
0,0 → 1,118
<?php
/*
mychanges.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($user = $this->GetUser())
{
$my_edits_count = 0;
 
if (($bydate = $this->GetParameter("bydate")))
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par date de modification.</b><br /><br />\n";
 
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY time ASC, tag ASC"))
{
foreach ($pages as $page)
{
$edited_pages[$page["tag"]] = $page["time"];
}
 
arsort($edited_pages);
 
foreach ($edited_pages as $page["tag"] => $page["time"])
{
// day header
list($day, $time) = explode(" ", $page["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n";
echo "<b>$day:</b><br />\n";
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;($time) (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
 
$my_edits_count++;
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
else
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par ordre alphab&eacute;tique.</b><br /><br />\n";
 
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY tag ASC, time DESC"))
{
foreach ($pages as $page)
{
if ($last_tag != $page["tag"]) {
$last_tag = $page["tag"];
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n";
echo "<b>$firstChar</b><br />\n";
$curChar = $firstChar;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$page["time"],") (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
$my_edits_count++;
}
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>";
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/orphanedpages.php
New file
0,0 → 1,35
<?php
/*
orphanedpages.php
 
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
if ($pages = $this->LoadOrphanedPages())
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n" ;
}
}
else
{
echo "<i>Pas de pages orphelines</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/recentlycommented.php
New file
0,0 → 1,76
<?php
/*
recentlycommented.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Which is the max number of pages to be shown ?
if ($max = $this->GetParameter("max"))
{
if ($max=="last") $max=50; else $last = (int) $max;
}
else
{
$max = 50;
}
 
// Show recently commented pages
if ($pages = $this->LoadRecentlyCommented($max))
{
if ($this->GetParameter("max"))
{
foreach ($pages as $page)
{
// echo entry
echo "(",$page["comment_time"],") <a href=\"",$this->href("", $page["tag"], "show_comments=1"),"#",$page["comment_tag"],"\">",$page["tag"],"</a> . . . . dernier commentaire par ",$this->Format($page["comment_user"]),"<br />\n" ;
}
}
else
{
$curday='';
foreach ($pages as $page)
{
// day header
list($day, $time) = explode(" ", $page["comment_time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$time,") <a href=\"",$this->href("", $page["tag"], "show_comments=1"),"#",$page["comment_tag"],"\">",$page["tag"],"</a> . . . . dernier commentaire par ",$this->Format($page["comment_user"]),"<br />\n" ;
}
}
}
else
{
echo "<i>Aucune page n'a &eacute;t&eacute; comment&eacute;e r&eacute;cemment.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/include.php
New file
0,0 → 1,55
<?php
/*
include.php : Permet d'inclure une page Wiki dans un autre page
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Charles NEPOTE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/* Paramètres :
-- page : nom wiki de la page a inclure (obligatoire)
-- class : nom de la classe de style à inclure (facultatif)
*/
 
 
// récuperation du parametres
$incPageName = $this->GetParameter("page");
// TODO : améliorer le traitement des classes
if ($this->GetParameter("class")) {
$classes='';
$array_classes = explode(" ", $this->GetParameter("class"));
foreach ($array_classes as $c) { $classes = $classes . "include_" . $c . " "; }
}
 
// Affichage de la page ou d'un message d'erreur
if (empty($incPageName)) {
echo $this->Format("//Le paramètre \"page\" est manquant.//");
} else {
if (eregi("^".$incPageName."$",$this->GetPageTag())) {
echo $this->Format("//Impossible à une page de s'inclure dans elle même.//");
} else {
if (!$this->HasAccess("read",$incPageName)){
echo $this->Format("//Lecture de la page inclue $page non autorisée.//");
} else {
$incPage = $this->LoadPage($incPageName);
$output = $this->Format($incPage["body"]);
if ($classes) echo "<div class=\"", $classes,"\">\n", $output, "</div>\n";
else echo $output;
}
}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/recentcomments.php
New file
0,0 → 1,54
<?php
/*
recentcomments.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($comments = $this->LoadRecentComments())
{
foreach ($comments as $comment)
{
// day header
list($day, $time) = explode(" ", $comment["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$comment["time"],") <a href=\"",$this->href("", $comment["comment_on"], "show_comments=1"),"#",$comment["tag"],"\">",$comment["comment_on"],"</a> . . . . ",$this->Format($comment["user"]),"<br />\n" ;
}
}
else
{
echo "<i>Pas de commentaires r&eacute;cents.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/attachfm.php
New file
0,0 → 1,38
<?php
/*
attachfm.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
 
*/
$url = $this->href('filemanager',$this->GetPageTag());
echo '<a href="'.$url.'"><span class="attachfm"><span>Gestion des fichiers attachés</span></span></a>';
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/header.php
New file
0,0 → 1,78
<?php
/* header.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$message = $this->GetMessage();
$user = $this->GetUser();
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 
 
<head>
<title><?php echo $this->GetWakkaName().":".$this->GetPageTag(); ?></title>
<?php if ($this->GetMethod() != 'show')
echo "<meta name=\"robots\" content=\"noindex, nofollow\"/>\n";?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="keywords" content="<?php echo $this->GetConfigValue("meta_keywords") ?>" />
<meta name="description" content="<?php echo $this->GetConfigValue("meta_description") ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo (!isset($_COOKIE["sitestyle"]))?'wakka':$_COOKIE["sitestyle"] ?>.css" />
<script type="text/javascript">
function fKeyDown() {
if (event.keyCode == 9) {
event.returnValue= false;
document.selection.createRange().text = String.fromCharCode(9) } }
</script>
</head>
 
 
<body <?php echo (!$user || ($user["doubleclickedit"] == 'Y')) && ($this->GetMethod() == "show") ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "" ?>
<?php echo $message ? "onLoad=\"alert('".$message."');\" " : "" ?> >
 
 
<div style="display: none;"><a href="<?php echo $this->href() ?>/resetstyle" accesskey="7"></a></div>
 
<div id="container">
<table id="page_table" border="0" cellspacing="0" cellpadding="0">
<tr><td id="logo_ekotribu"><a id="lien_logo_ekotribu" href="http://ekotribu.org" title="Retour a la page d'accueil Ekotribu"><img alt="logo" src="images/Logo-wiki.png" /></a></td>
<td id="bandeau_haut">
<h1 class="wiki_name"><?php echo $this->config["wakka_name"] ?></h1>
<h1 class="page_name">
<a href="<?php echo $this->config["base_url"] ?>RechercheTexte&amp;phrase=<?php echo htmlentities($this->GetPageTag()); ?>">
<?php echo htmlentities($this->GetPageTag()); ?>
</a>
</h1>
<div class="header">
<?php echo $this->ComposeLinkToPage($this->config["root_page"]); ?> ::
<?php echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "" ?>
Vous &ecirc;tes <?php echo $this->Format($this->GetUserName()); if ($user = $this->GetUser()) echo " (<a href=\"".$this->config["base_url"] ."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n"; ?>
</div>
</td>
</tr>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/listpages.php
New file
0,0 → 1,85
<?php
/*
listpages.php
 
Copyright 2002 David DELON
Copyright 2003 Patrick PAUL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
if (!function_exists("TreeView"))
{
function TreeView($node,$level,$indent=0)
{
global $wiki;
if ($level>0) {
$head=split(" :: ",$wiki->GetConfigValue("navigation_links"));
// we don't want page from the header
if (!in_array($node, $head, TRUE))
{
if (($indent>0) && (!($wiki->GetConfigValue("root_page")==$node)) || ($indent==0) )
{
// Ignore users too ...
if (!$wiki->LoadUser($node))
{
if ($indent)
echo (str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$indent)),$wiki->Link($node),"<br/>\n";
$pages = $wiki->LoadAll("select to_tag from ".$wiki->config["table_prefix"]."links where from_tag='".mysql_escape_string($node)."' order by to_tag asc");
 
if (is_array($pages)) {
foreach ($pages as $page)
{
$wiki->CachePage($page);
TreeView($page["to_tag"],$level-1,$indent+1);
}
}
}
}
}
}
}
}
 
if($sortkey = $this->GetParameter("sort")) {
if (($sortkey != "tag") && ($sortkey != "time") && ($sortkey != "owner") && ($sortkey != "user")) $sortkey = "tag";
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by $sortkey asc");
foreach ($pages as $page) {
$this->CachePage($page);
$owner=$page["owner"]?$page["owner"]:"Inconnu";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),". . . . derni&egrave;re modification par " , $this->Format($page["user"]) , "<br/>\n" ;
}
}
// Tree display
else if ($sortkey = $this->GetParameter("tree"))
{
// No rootpage specified, assume root_page
if ($sortkey=="tree") $sortkey=$this->GetConfigValue("root_page");
echo $this->ComposeLinkToPage($sortkey),"<br /><br/>\n" ;
 
// 3 levels displayed, It should be parameter ...
TreeView($sortkey,3);
 
}
// Default Action : sort by tag
else
{
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by tag asc");
foreach ($pages as $page) {
$this->CachePage($page);
$owner=$page["owner"]?$page["owner"]:"Inconnu";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),"<br/>\n" ;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/listusers.php
New file
0,0 → 1,45
<?php
/*
listusers.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if ($last = $this->GetParameter("last"))
{
if ($last=="last") $last=150; else $last= (int) $last;
if ($last)
{
$last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by signuptime desc limit $last");
foreach($last_users as $user) { echo $this->Format($user["name"])," . . . ",$user["signuptime"],"<br />\n" ; }
}
}
 
else
{
if ($last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by name asc")
)
{
foreach($last_users as $user)
{
echo $this->Format($user["name"])," . . . ",$user["signuptime"],"<br />\n" ;
}
}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/actions/footer.php
New file
0,0 → 1,101
 
 
<div class="footer">
<?php
/* footer.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003, 2004 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
echo $this->FormOpen("", "RechercheTexte", "get");
echo $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a> ::\n" : "";
echo $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les derni&egrave;res modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : "";
// if this page exists
if ($this->page)
{
// if owner is current user
if ($this->UserIsOwner())
{
echo
"Propri&eacute;taire&nbsp;: vous :: \n",
"<a href=\"",$this->href("acls")."\" title=\"Cliquez pour &eacute;diter les permissions de cette page.\">&Eacute;diter permissions</a> :: \n",
"<a href=\"",$this->href("deletepage")."\">Supprimer</a> :: \n";
}
else
{
if ($owner = $this->GetPageOwner())
{
echo "Propri&eacute;taire : ",$this->Format($owner);
}
else
{
echo "Pas de propri&eacute;taire ";
echo ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : "");
}
echo " :: \n";
}
}
?>
<a href="<?php echo $this->href("referrers") ?>" title="Cliquez pour voir les URLs faisant r&eacute;f&eacute;rence &agrave; cette page.">
R&eacute;f&eacute;rences</a> ::
Recherche : <input name="phrase" size="15" class="searchbox" />
<?php echo $this->FormClose(); ?>
</div>
 
 
<div class="copyright">
<a href="http://validator.w3.org/check/referer">XHTML 1.0 valide ?</a> ::
<a href="http://jigsaw.w3.org/css-validator/check/referer">CSS valide ?</a> ::
-- Fonctionne avec <?php echo $this->Link("WikiNi:PagePrincipale", "", "WikiNi ".$this->GetWikiNiVersion()) . "\n"; ?>
</div>
 
 
<?php
if ($this->GetConfigValue("debug")=="yes")
{
echo "<span class=\"debug\"><b>Query log :</b><br />\n";
$t_SQL=0;
foreach ($this->queryLog as $query)
{
echo $query["query"]." (".round($query["time"],4).")<br />\n";
$t_SQL = $t_SQL + $query["time"];
}
echo "</span>\n";
 
echo "<span class=\"debug\">".round($t_SQL, 4)." s (total SQL time)</span><br />\n";
list($g2_usec, $g2_sec) = explode(" ",microtime());
define ("t_end", (float)$g2_usec + (float)$g2_sec);
echo "<span class=\"debug\"><b>".round(t_end-t_start, 4)." s (total time)</b></span><br />\n";
 
echo "<span class=\"debug\">SQL time represent : ".round((($t_SQL/(t_end-t_start))*100),2)."% of total time</span>\n";
}
?>
 
 
</body>
</html>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/deletepage.php
New file
0,0 → 1,53
<?php
/*
deletepage.php
 
Copyright 2002 David DELON
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->UserIsOwner())
{
if ($pages = $this->IsOrphanedPage($this->GetPageTag()))
{
foreach ($pages as $page)
{
$this->DeleteOrphanedPage($this->GetPageTag());
}
}
else
{
echo"<i>Cette page n'est pas orpheline.</i>";
}
 
}
else
{
echo"<i>Vous n'&ecirc;tes pas le propri&eacute;taire de cette page.</i>";
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/referrers.php
New file
0,0 → 1,86
<?php
/*
referrers.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($global = $_REQUEST["global"])
{
$title = "Sites faisant r&eacute;f&eacute;rence &agrave; ce wiki (<a href=\"".$this->href("referrers_sites", "", "global=1")."\">voir la liste des domaines</a>)&nbsp;:";
$referrers = $this->LoadReferrers();
}
else
{
$title = "Pages externes faisant r&eacute;f&eacute;rence &agrave; ".$this->ComposeLinkToPage($this->GetPageTag()).
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers_sites")."\">voir la liste des domaines</a>)&nbsp;:";
$referrers = $this->LoadReferrers($this->GetPageTag());
}
 
echo "<b>$title</b><br /><br />\n" ;
if ($referrers)
{
{
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" ;
foreach ($referrers as $referrer)
{
echo "<tr>" ;
echo "<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">",$referrer["num"],"</td>" ;
echo "<td valign=\"top\"><a href=\"",$referrer["referrer"],"\">",$referrer["referrer"],"</a></td>" ;
echo "</tr>\n" ;
}
echo "</table>\n" ;
}
}
else
{
echo "<i>Aucune <acronym tilte=\"Uniform Resource Locator (adresse web)\">URL</acronym> ne fait r&eacute;f&eacute;rence &agrave; cette page.</i><br />\n" ;
}
 
if ($global)
{
echo "<br />[<a href=\"",$this->href("referrers_sites"),"\">Voir les domaines faisant r&eacute;f&eacute;rence &agrave; ",$this->GetPageTag()," seulement</a> | <a href=\"",$this->href("referrers"),"\">Voir les r&eacute;f&eacute;rences &agrave; ",$this->GetPageTag()," seulement</a>]" ;
}
else
{
 
echo "<br />[<a href=\"",$this->href("referrers_sites", "", "global=1"),"\">Voir tous les domaines faisant r&eacute;f&eacute;rence </a> | <a href=\"",$this->href("referrers", "", "global=1"),"\">Voir toutes les r&eacute;f&eacute;rences </a>]" ;
}
 
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/xml.php
New file
0,0 → 1,39
<?php
/*
xml.php
 
Copyright 2003 David DELON
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
 
header("Content-type: text/xml");
 
if ($HasAccessRead=$this->HasAccess("read"))
{
// TODO : Return an empty xml ?
// TODO : Return an error read (noaccess) xml ?
if ($this->page)
{
// display page
echo $this->Format($this->page["body"], "action") ;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/slide_show.php
New file
0,0 → 1,233
<?php
/*
Handler "slide_show" pour WikiNi version WikiNi 0.4.1rc et supérieurs.
Développé par Charles Népote.
Version 0.08 du 26/04/2004.
Licence GPL.
 
Par défaut il utilise les classes de style suivantes :
.slide { font-size: 160%; margin: 5%; background-color: #FFFFFF; padding: 30px; border: 1px inset; line-height: 1.5; }
.slide UL, LI { font-size: 100%; }
.slide LI LI { font-size: 90% }
.sl_nav p { text-decoration: none; text-align: right; font-size: 80%; line-height: 0.4; }
.sl_nav A { text-decoration: none; }
.sl_nav a:hover { color: #CF8888 }
.sum { font-size: 8px; }
 
Pour modifier ces styles il faut créer un fichier "slideshow.css" contenant les styles modifiés.
Le fichier "slideshow.css" sera reconnu automatiquement.
 
*/
 
// On teste si le script n'est pas appelé en direct
if (!eregi("wakka.php", $_SERVER['PHP_SELF']))
{
die ("acc&egrave;s direct interdit");
}
 
// On teste si l'utilisateur peut lire la page
if (!$this->HasAccess("read"))
{
return;
}
else
{
// On teste si la page existe
if (!$this->page)
{
return;
}
else
{
/*
Exemple de page :
(1) Présentation xxxxxxxxxxxxxx
===== (2) Titre =====
Diapo 2.
===== (3) Titre =====
Diapo 3.
===== (4) Titre =====
Diapo 4.
===== (5) Titre =====
Diapo 5.
===== (6) Titre =====
Diapo 6.
===== (7) Titre =====
Diapo 7.
Autre exemple :
===== (1) Titre =====
Diapo 1.
===== (2) Titre =====
Diapo 2.
===== (3) Titre =====
Diapo 3.
===== (4) Titre =====
Diapo 4.
===== (5) Titre =====
Diapo 5.
===== (6) Titre =====
Diapo 6.
===== (7) Titre =====
Diapo 7.
*/
 
//
// découpe la page
$body_f = $this->format($this->page["body"]);
$body = preg_split('/(.*<h2>.*<\/h2>)/',$body_f,-1,PREG_SPLIT_DELIM_CAPTURE);
if ($_REQUEST["debug"] == "1") print_r("<div style=\"display: none\">".$body."</div>");
 
// Si la première diapositive commence par un titre de niveau 1
if (preg_match('/^<h2>.*<\/h2>/', $body_f)) $major = "0";
else $major = "1";
$user = $this->GetUser(); // echo $this->GetUser();
 
// On teste toutes les paramètres du handler "slide_show" ; s'il n'y en a pas, c'est le paramètre "slide=1" qui est invoqué par défaut
 
/*
switch ($_REQUEST["method"])
{
case "export":
export();
break;
case "show":
showSlide();
break;
default:
showSlide();
break;
}
*/
 
//if ($_REQUEST["export"]) { return; }
 
if (!$body)
{
return;
}
else
{
// Si on ne précise pas de paramètre, on affiche par défaut la première diapo
if (!$_REQUEST["slide"] or $_REQUEST["slide"] == "1") $slide = "1";
else $slide = $_REQUEST["slide"];
 
// Affiche l'en-tête
echo
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo
"<html>\n\n\n",
"<head>\n",
"<title>", $this->GetWakkaName(), ":", $this->GetPageTag(), "</title>\n",
"<meta name=\"robots\" content=\"noindex, nofollow\" />\n",
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
echo
"<style type=\"text/css\" media=\"all\"> @import \"wakka.css\";</style>\n";
// Teste s'il existe une feuille de style externe, sinon utilise des styles par défaut
if (!file_exists("slideshow.css"))
{
echo "<style type=\"text/css\">\n",
".slide { font-size: 160%; margin: 5%; background-color: #FFFFFF; padding: 30px; border: 1px inset; line-height: 1.5; }\n",
".slide UL, LI { font-size: 100%; }\n",
".slide LI LI { font-size: 90% }\n",
".sl_nav p { text-decoration: none; text-align: right; font-size: 80%; line-height: 0.4; }\n",
".sl_nav A { text-decoration: none; }\n",
".sl_nav a:hover { color: #CF8888 }\n",
".sum { font-size: 8px; }\n",
"</style>\n";
}
else
{
echo "<style type=\"text/css\" media=\"all\"> @import \"slideshow.css\";</style>\n";
}
 
echo
"</head>\n\n\n";
// Affiche le corps de la page
echo
"<body ";
echo (!$user || ($user["doubleclickedit"] == 'Y')) ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "", ">\n";
 
// Affichage du sommaire [à compléter]
/*
if ($_REQUEST["sum"] == "on")
{
echo "<ul class=\"sum\">\n";
if ($major = "1") echo "<li>", $this->format($body[0]), "</li>\n";
foreach ($body as $title_sum)
{
$i = $i + 1;
$type = gettype($i/2);
// Ne retourne que les 50 premiers caractères du titre
$title_sum = substr($title_sum, 0, 50);
if ($type == "integer")
{
echo "<li>",$this->format($title_sum),"</li>\n";
}
}
echo "</ul>\n\n";
}
*/
 
// Affichage du menu de navigation
echo
"<div class=\"sl_nav\">\n",
"<p>";
if ($slide !== "1")
echo
"<a href=\"",$this->href(),"/slide_show&slide=",$_REQUEST['slide']-1,"\"><< précédent</a>",
" :: <a href=\"",$this->href(),"/slide_show&slide=1\">[début]</a>\n";
echo " :: ";
if ($body[($slide)*2-($nb*2)+2] or $slide == "1")
echo "<a href=\"",$this->href(),"/slide_show&slide=",$slide+1,"\">suivant >></a>\n";
echo
"</p>\n";
echo "<p><a href=\"",$this->href(),"/edit\">Éditer </a> :: <a href=\"",$this->href(),"\">[]-></a></p>\n";
echo
"</div>\n\n";
 
echo
"<div class=\"slide\">\n";
// Si c'est la première diapositive
if ($slide == "1" and $major == "1")
{
echo $body[0], "<br /><br />";
}
 
// A partir de la deuxième diapositive
else
{
echo
$body[($slide*2)-($major*2)-1].$body[($slide*2)-($major*2)],"\n";
echo "\n";
}
echo
"</div>\n\n";
 
echo
"</body>\n",
"</html>";
}
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/resetstyle.php
New file
0,0 → 1,27
<?php
 
// Handler resetstyle.php version 0.2 du 16/03/2004
// pour WikiNi 0.4.1rc (=> à la version du 200403xx) et supérieurs
// Par Charles Népote (c) 2004
// Licence GPL
 
 
// Fonctionnement
//
// Cet handler permet à l'utilisateur de revenir à la feuille de style par défaut du site.
// Techniquement :
 
 
// Usage :
// http://example.org/PageTest/resetstyle
 
 
// A compléter (peut-être un jour) :
//
// -- détecter le fichier par défaut via une variable de configuration
//
 
$this->SetPersistentCookie('sitestyle','wakka',1);
header("Location: ".$this->href());
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/referrers_sites.php
New file
0,0 → 1,98
<?php
/*
wakka.php
Copyright (c) 2003, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($global = $_REQUEST["global"])
{
$title = "Domaines faisant r&eacute;f&eacute;rence &agrave; ce wiki (<a href=\"".$this->href("referrers", "", "global=1")."\">voir la liste des pages externes</a>):";
$referrers = $this->LoadReferrers();
}
else
{
$title = "Domaines faisant r&eacute;f&eacute;rence &agrave; ".$this->Link($this->GetPageTag()).
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers")."\">voir la liste des pages externes</a>):";
$referrers = $this->LoadReferrers($this->GetPageTag());
}
 
echo "<b>$title</b><br /><br />\n" ;
if ($referrers)
{
for ($a = 0; $a < count($referrers); $a++)
{
$temp_parse_url = parse_url($referrers[$a]["referrer"]);
$temp_parse_url = ($temp_parse_url["host"] != "") ? strtolower(preg_replace("/^www\./Ui", "", $temp_parse_url["host"])) : "inconnu";
 
if (isset($referrer_sites["$temp_parse_url"]))
{
$referrer_sites["$temp_parse_url"] += $referrers[$a]["num"];
}
else
{
$referrer_sites["$temp_parse_url"] = $referrers[$a]["num"];
}
}
 
array_multisort($referrer_sites, SORT_DESC, SORT_NUMERIC);
reset($referrer_sites);
 
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" ;
foreach ($referrer_sites as $site => $site_count)
{
echo "<tr>" ;
echo "<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">" , $site_count, "</td>" ;
echo "<td valign=\"top\">" , (($site != "unknown") ? "<a href=\"http://$site\">$site</a>" : $site) , "</td>" ;
echo "</tr>\n" ;
}
echo "</table>\n" ;
}
else
{
echo "<i>None</i><br />\n" ;
}
 
if ($global)
{
echo "<br />[<a href=\"",$this->href("referrers_sites"),"\">Voir les domaines faisant r&eacute;f&eacute;rence &agrave; ",$this->GetPageTag()," seulement</a> | <a href=\"",$this->href("referrers"),"\">Voir les r&eacute;f&eacute;rences ",$this->GetPageTag()," seulement</a>]";
}
else
{
echo "<br />[<a href=\"",$this->href("referrers_sites", "", "global=1"),"\">Voir tous les domaines faisant r&eacute;f&eacute;rence </a> | <a href=\"",$this->href("referrers", "", "global=1"),"\">Voir toutes les r&eacute;f&eacute;rences </a>]" ;
}
 
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/download.php
New file
0,0 → 1,48
<?php
/*
download.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le download des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doDownload();
unset($att);
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/diff.php
New file
0,0 → 1,1003
<?php
/*
diff.php
 
Copyright (C) 1992 Free Software Foundation, Inc. Francois Pinard <pinard@iro.umontreal.ca>.
Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org>
Copyright 2002,2003,2004 David DELON
Copyright 2002 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
 
original diff.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->HasAccess("read"))
{
 
// If asked, call original diff
 
if ($_REQUEST["fastdiff"]) {
/* NOTE: This is a really cheap way to do it. I think it may be more intelligent to write the two pages to temporary files and run /usr/bin/diff over them. Then again, maybe not. */
// load pages
$pageA = $this->LoadPageById($_REQUEST["a"]);
$pageB = $this->LoadPageById($_REQUEST["b"]);
// prepare bodies
$bodyA = explode("\n", $pageA["body"]);
$bodyB = explode("\n", $pageB["body"]);
$added = array_diff($bodyA, $bodyB);
$deleted = array_diff($bodyB, $bodyA);
$output .= "<b>Comparaison de <a href=\"".$this->href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> &agrave; <a href=\"".$this->href("", "", "time=".urlencode($pageB["time"]))."\">".$pageB["time"]."</a></b><br />\n";
if ($added)
{
// remove blank lines
$output .= "<br />\n<b>Ajouts:</b><br />\n";
$output .= "<div class=\"additions\">".$this->Format(implode("\n", $added))."</div>";
}
if ($deleted)
{
$output .= "<br />\n<b>Suppressions:</b><br />\n";
$output .= "<div class=\"deletions\">".$this->Format(implode("\n", $deleted))."</div>";
}
if (!$added && !$deleted)
{
$output .= "<br />\nPas de diff&eacute;rences.";
}
echo $output;
}
else {
// load pages
$pageA = $this->LoadPageById($_REQUEST["b"]);
$pageB = $this->LoadPageById($_REQUEST["a"]);
// extract text from bodies
$textA = $pageA["body"];
$textB = $pageB["body"];
$sideA = new Side($textA);
$sideB = new Side($textB);
$bodyA='';
$sideA->split_file_into_words($bodyA);
$bodyB='';
$sideB->split_file_into_words($bodyB);
// diff on these two file
$diff = new Diff(split("\n",$bodyA),split("\n",$bodyB));
// format output
$fmt = new DiffFormatter();
$sideO = new Side($fmt->format($diff));
$resync_left=0;
$resync_right=0;
$count_total_right=$sideB->getposition() ;
$sideA->init();
$sideB->init();
$output='';
while (1) {
$sideO->skip_line();
if ($sideO->isend()) {
break;
}
if ($sideO->decode_directive_line()) {
$argument=$sideO->getargument();
$letter=$sideO->getdirective();
switch ($letter) {
case 'a':
$resync_left = $argument[0];
$resync_right = $argument[2] - 1;
break;
case 'd':
$resync_left = $argument[0] - 1;
$resync_right = $argument[2];
break;
case 'c':
$resync_left = $argument[0] - 1;
$resync_right = $argument[2] - 1;
break;
}
$sideA->skip_until_ordinal($resync_left);
$sideB->copy_until_ordinal($resync_right,$output);
// deleted word
if (($letter=='d') || ($letter=='c')) {
$sideA->copy_whitespace($output);
$output .="@@";
$sideA->copy_word($output);
$sideA->copy_until_ordinal($argument[1],$output);
$output .="@@";
}
// inserted word
if ($letter == 'a' || $letter == 'c') {
$sideB->copy_whitespace($output);
$output .="££";
$sideB->copy_word($output);
$sideB->copy_until_ordinal($argument[3],$output);
$output .="££";
}
}
}
$sideB->copy_until_ordinal($count_total_right,$output);
$sideB->copy_whitespace($output);
$out=$this->Format($output);
echo $out;
}
 
}
else{
echo "<i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page.</i>" ;
}
// Side : a string for wdiff
class Side {
var $position;
var $cursor;
var $content;
var $character;
var $directive;
var $argument;
var $length;
 
function Side($content) {
$this->content=$content;
$this->position=0;
$this->cursor=0;
$this->directive='';
$this->argument=array();
$this->length=strlen($this->content);
$this->character=substr($this->content,0,1);
}
 
function getposition() {
return $this->position;
}
 
function getcharacter() {
return $this->character;
}
 
function getdirective() {
return $this->directive;
}
 
function getargument() {
return $this->argument;
}
 
function nextchar() {
$this->cursor++;
$this->character=substr($this->content,$this->cursor,1);
}
 
function copy_until_ordinal($ordinal,&$out) {
while ($this->position < $ordinal) {
$this->copy_whitespace($out);
$this->copy_word($out);
}
}
 
function skip_until_ordinal($ordinal) {
while ($this->position < $ordinal) {
$this->skip_whitespace();
$this->skip_word();
}
}
 
function split_file_into_words (&$out) {
while (!$this->isend()) {
$this->skip_whitespace();
if ($this->isend()) {
break;
}
$this->copy_word($out);
$out .="\n";
}
}
function init() {
$this->position=0;
$this->cursor=0;
$this->directive='';
$this->argument=array();
$this->character=substr($this->content,0,1);
}
 
function isspace($char) {
if (ereg('[[:space:]]',$char)) {
return true;
}
else {
return false;
}
}
 
function isdigit($char) {
if (ereg('[[:digit:]]',$char)) {
return true;
}
else {
return false;
}
}
 
function isend() {
if (($this->cursor)>=($this->length)) {
return true;
}
else {
return false;
}
}
 
 
 
function copy_whitespace(&$out) {
while (!$this->isend() && $this->isspace($this->character)) {
$out .=$this->character;
$this->nextchar();
}
}
 
function skip_whitespace() {
while (!$this->isend() && $this->isspace($this->character)) {
$this->nextchar();
}
}
 
function skip_line() {
while (!$this->isend() && !$this->isdigit($this->character)) {
while (!$this->isend() && $this->character!="\n")
$this->nextchar();
if($this->character=="\n")
$this->nextchar();
}
}
 
 
 
function copy_word(&$out) {
while (!$this->isend() && !($this->isspace($this->character))) {
$out.=$this->character;
$this->nextchar();
}
$this->position++;
}
 
function skip_word() {
 
while (!$this->isend() && !($this->isspace($this->character))) {
$this->nextchar();
}
$this->position++;
}
 
 
function decode_directive_line() {
 
$value=0;
$state=0;
$error=0;
 
while (!$error && $state < 4) {
if ($this->isdigit($this->character)) {
$value = 0;
while($this->isdigit($this->character)) {
$value = 10 * $value + $this->character - '0';
$this->nextchar();
}
}
else if ($state != 1 && $state != 3)
$error = 1;
 
/* Assign the proper value. */
 
$this->argument[$state] = $value;
 
/* Skip the following character. */
 
switch ($state) {
case 0:
case 2:
if ($this->character == ',')
$this->nextchar();
break;
 
case 1:
if ($this->character == 'a' || $this->character == 'd' || $this->character == 'c') {
$this->directive = $this->character;
$this->nextchar();
}
else
$error = 1;
break;
 
case 3:
if ($this->character != "\n")
$error = 1;
break;
}
$state++;
}
 
/* Complete reading of the line and return success value. */
 
while ((!$this->isend()) && ($this->character != "\n")) {
$this->nextchar();
}
if ($this->character == "\n")
$this->nextchar();
 
return !$error;
}
 
 
 
}
 
// difflib
//
// A PHP diff engine for phpwiki.
//
// Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org>
// You may copy this code freely under the conditions of the GPL.
//
 
 
// PHP3 does not have assert()
define('USE_ASSERTS', function_exists('assert'));
 
class _DiffOp {
var $type;
var $orig;
var $final;
 
function norig() {
return $this->orig ? sizeof($this->orig) : 0;
}
 
function nfinal() {
return $this->final ? sizeof($this->final) : 0;
}
}
 
class _DiffOp_Copy extends _DiffOp {
var $type = 'copy';
function _DiffOp_Copy ($orig, $final = false) {
if (!is_array($final))
$final = $orig;
$this->orig = $orig;
$this->final = $final;
}
 
}
 
class _DiffOp_Delete extends _DiffOp {
var $type = 'delete';
function _DiffOp_Delete ($lines) {
$this->orig = $lines;
$this->final = false;
}
 
}
 
class _DiffOp_Add extends _DiffOp {
var $type = 'add';
function _DiffOp_Add ($lines) {
$this->final = $lines;
$this->orig = false;
}
 
}
 
class _DiffOp_Change extends _DiffOp {
var $type = 'change';
function _DiffOp_Change ($orig, $final) {
$this->orig = $orig;
$this->final = $final;
}
 
}
/**
* Class used internally by Diff to actually compute the diffs.
*
* The algorithm used here is mostly lifted from the perl module
* Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
* http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
*
* More ideas are taken from:
* http://www.ics.uci.edu/~eppstein/161/960229.html
*
* Some ideas are (and a bit of code) are from from analyze.c, from GNU
* diffutils-2.7, which can be found at:
* ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
*
* Finally, some ideas (subdivision by NCHUNKS > 2, and some optimizations)
* are my own.
*
* @author Geoffrey T. Dairiki
* @access private
*/
class _DiffEngine
{
function diff ($from_lines, $to_lines) {
$n_from = sizeof($from_lines);
$n_to = sizeof($to_lines);
 
$this->xchanged = $this->ychanged = array();
$this->xv = $this->yv = array();
$this->xind = $this->yind = array();
unset($this->seq);
unset($this->in_seq);
unset($this->lcs);
// Skip leading common lines.
for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) {
if ($from_lines[$skip] != $to_lines[$skip])
break;
$this->xchanged[$skip] = $this->ychanged[$skip] = false;
}
// Skip trailing common lines.
$xi = $n_from; $yi = $n_to;
for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {
if ($from_lines[$xi] != $to_lines[$yi])
break;
$this->xchanged[$xi] = $this->ychanged[$yi] = false;
}
// Ignore lines which do not exist in both files.
for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
$xhash[$from_lines[$xi]] = 1;
for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
$line = $to_lines[$yi];
if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
continue;
$yhash[$line] = 1;
$this->yv[] = $line;
$this->yind[] = $yi;
}
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
$line = $from_lines[$xi];
if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
continue;
$this->xv[] = $line;
$this->xind[] = $xi;
}
 
// Find the LCS.
$this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
 
// Merge edits when possible
$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
 
// Compute the edit operations.
$edits = array();
$xi = $yi = 0;
while ($xi < $n_from || $yi < $n_to) {
USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
 
// Skip matching "snake".
$copy = array();
while ( $xi < $n_from && $yi < $n_to
&& !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
$copy[] = $from_lines[$xi++];
++$yi;
}
if ($copy)
$edits[] = new _DiffOp_Copy($copy);
 
// Find deletes & adds.
$delete = array();
while ($xi < $n_from && $this->xchanged[$xi])
$delete[] = $from_lines[$xi++];
 
$add = array();
while ($yi < $n_to && $this->ychanged[$yi])
$add[] = $to_lines[$yi++];
if ($delete && $add)
$edits[] = new _DiffOp_Change($delete, $add);
elseif ($delete)
$edits[] = new _DiffOp_Delete($delete);
elseif ($add)
$edits[] = new _DiffOp_Add($add);
}
return $edits;
}
 
/* Divide the Largest Common Subsequence (LCS) of the sequences
* [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
* sized segments.
*
* Returns (LCS, PTS). LCS is the length of the LCS. PTS is an
* array of NCHUNKS+1 (X, Y) indexes giving the diving points between
* sub sequences. The first sub-sequence is contained in [X0, X1),
* [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note
* that (X0, Y0) == (XOFF, YOFF) and
* (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
*
* This function assumes that the first lines of the specified portions
* of the two files do not match, and likewise that the last lines do not
* match. The caller must trim matching lines from the beginning and end
* of the portions it is going to specify.
*/
function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
$flip = false;
if ($xlim - $xoff > $ylim - $yoff) {
// Things seems faster (I'm not sure I understand why)
// when the shortest sequence in X.
$flip = true;
list ($xoff, $xlim, $yoff, $ylim)
= array( $yoff, $ylim, $xoff, $xlim);
}
 
if ($flip)
for ($i = $ylim - 1; $i >= $yoff; $i--)
$ymatches[$this->xv[$i]][] = $i;
else
for ($i = $ylim - 1; $i >= $yoff; $i--)
$ymatches[$this->yv[$i]][] = $i;
 
$this->lcs = 0;
$this->seq[0]= $yoff - 1;
$this->in_seq = array();
$ymids[0] = array();
$numer = $xlim - $xoff + $nchunks - 1;
$x = $xoff;
for ($chunk = 0; $chunk < $nchunks; $chunk++) {
if ($chunk > 0)
for ($i = 0; $i <= $this->lcs; $i++)
$ymids[$i][$chunk-1] = $this->seq[$i];
 
$x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line]))
continue;
$matches = $ymatches[$line];
reset($matches);
while (list ($junk, $y) = each($matches))
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
break;
}
while (list ($junk, $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
$this->in_seq[$this->seq[$k]] = false;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
}
else if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
}
}
}
}
 
$seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
$ymid = $ymids[$this->lcs];
for ($n = 0; $n < $nchunks - 1; $n++) {
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
$y1 = $ymid[$n] + 1;
$seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
}
$seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
 
return array($this->lcs, $seps);
}
 
function _lcs_pos ($ypos) {
$end = $this->lcs;
if ($end == 0 || $ypos > $this->seq[$end]) {
$this->seq[++$this->lcs] = $ypos;
$this->in_seq[$ypos] = 1;
return $this->lcs;
}
 
$beg = 1;
while ($beg < $end) {
$mid = (int)(($beg + $end) / 2);
if ( $ypos > $this->seq[$mid] )
$beg = $mid + 1;
else
$end = $mid;
}
 
USE_ASSERTS && assert($ypos != $this->seq[$end]);
 
$this->in_seq[$this->seq[$end]] = false;
$this->seq[$end] = $ypos;
$this->in_seq[$ypos] = 1;
return $end;
}
 
/* Find LCS of two sequences.
*
* The results are recorded in the vectors $this->{x,y}changed[], by
* storing a 1 in the element for each line that is an insertion
* or deletion (ie. is not in the LCS).
*
* The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
*
* Note that XLIM, YLIM are exclusive bounds.
* All line numbers are origin-0 and discarded lines are not counted.
*/
function _compareseq ($xoff, $xlim, $yoff, $ylim) {
// Slide down the bottom initial diagonal.
while ($xoff < $xlim && $yoff < $ylim
&& $this->xv[$xoff] == $this->yv[$yoff]) {
++$xoff;
++$yoff;
}
 
// Slide up the top initial diagonal.
while ($xlim > $xoff && $ylim > $yoff
&& $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
--$xlim;
--$ylim;
}
 
if ($xoff == $xlim || $yoff == $ylim)
$lcs = 0;
else {
// This is ad hoc but seems to work well.
//$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
//$nchunks = max(2,min(8,(int)$nchunks));
$nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
list ($lcs, $seps)
= $this->_diag($xoff,$xlim,$yoff, $ylim,$nchunks);
}
 
if ($lcs == 0) {
// X and Y sequences have no common subsequence:
// mark all changed.
while ($yoff < $ylim)
$this->ychanged[$this->yind[$yoff++]] = 1;
while ($xoff < $xlim)
$this->xchanged[$this->xind[$xoff++]] = 1;
}
else {
// Use the partitions to split this problem into subproblems.
reset($seps);
$pt1 = $seps[0];
while ($pt2 = next($seps)) {
$this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
$pt1 = $pt2;
}
}
}
 
/* Adjust inserts/deletes of identical lines to join changes
* as much as possible.
*
* We do something when a run of changed lines include a
* line at one end and has an excluded, identical line at the other.
* We are free to choose which identical line is included.
* `compareseq' usually chooses the one at the beginning,
* but usually it is cleaner to consider the following identical line
* to be the "change".
*
* This is extracted verbatim from analyze.c (GNU diffutils-2.7).
*/
function _shift_boundaries ($lines, &$changed, $other_changed) {
$i = 0;
$j = 0;
 
USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
$len = sizeof($lines);
$other_len = sizeof($other_changed);
 
while (1) {
/*
* Scan forwards to find beginning of another run of changes.
* Also keep track of the corresponding point in the other file.
*
* Throughout this code, $i and $j are adjusted together so that
* the first $i elements of $changed and the first $j elements
* of $other_changed both contain the same number of zeros
* (unchanged lines).
* Furthermore, $j is always kept so that $j == $other_len or
* $other_changed[$j] == false.
*/
while ($j < $other_len && $other_changed[$j])
$j++;
while ($i < $len && ! $changed[$i]) {
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$i++; $j++;
while ($j < $other_len && $other_changed[$j])
$j++;
}
if ($i == $len)
break;
 
$start = $i;
 
// Find the end of this run of changes.
while (++$i < $len && $changed[$i])
continue;
 
do {
/*
* Record the length of this run of changes, so that
* we can later determine whether the run has grown.
*/
$runlength = $i - $start;
 
/*
* Move the changed region back, so long as the
* previous unchanged line matches the last changed one.
* This merges with previous changed regions.
*/
while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {
$changed[--$start] = 1;
$changed[--$i] = false;
while ($start > 0 && $changed[$start - 1])
$start--;
USE_ASSERTS && assert('$j > 0');
while ($other_changed[--$j])
continue;
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
}
 
/*
* Set CORRESPONDING to the end of the changed run, at the last
* point where it corresponds to a changed run in the other file.
* CORRESPONDING == LEN means no such point has been found.
*/
$corresponding = $j < $other_len ? $i : $len;
 
/*
* Move the changed region forward, so long as the
* first changed line matches the following unchanged one.
* This merges with following changed regions.
* Do this second, so that if there are no merges,
* the changed region is moved forward as far as possible.
*/
while ($i < $len && $lines[$start] == $lines[$i]) {
$changed[$start++] = false;
$changed[$i++] = 1;
while ($i < $len && $changed[$i])
$i++;
 
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$j++;
if ($j < $other_len && $other_changed[$j]) {
$corresponding = $i;
while ($j < $other_len && $other_changed[$j])
$j++;
}
}
} while ($runlength != $i - $start);
 
/*
* If possible, move the fully-merged run of changes
* back to a corresponding run in the other file.
*/
while ($corresponding < $i) {
$changed[--$start] = 1;
$changed[--$i] = 0;
USE_ASSERTS && assert('$j > 0');
while ($other_changed[--$j])
continue;
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
}
}
}
}
 
/**
* Class representing a 'diff' between two sequences of strings.
*/
class Diff
{
var $edits;
 
/**
* Constructor.
* Computes diff between sequences of strings.
*
* @param $from_lines array An array of strings.
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
*/
function Diff($from_lines, $to_lines) {
$eng = new _DiffEngine;
$this->edits = $eng->diff($from_lines, $to_lines);
}
 
}
 
 
/**
* A class to format Diffs
*
* This class formats the diff in classic diff format.
* It is intended that this class be customized via inheritance,
* to obtain fancier outputs.
*/
class DiffFormatter
{
 
/**
* Format a diff.
*
* @param $diff object A Diff object.
* @return string The formatted output.
*/
function format($diff) {
 
$xi = $yi = 1;
$block = false;
$context = array();
 
$this->_start_diff();
 
foreach ($diff->edits as $edit) {
if ($edit->type == 'copy') {
if (is_array($block)) {
if (sizeof($edit->orig) <= 0) {
$block[] = $edit;
}
else{
$this->_block($x0, + $xi - $x0,
$y0, + $yi - $y0,
$block);
$block = false;
}
}
}
else {
if (! is_array($block)) {
$x0 = $xi;
$y0 = $yi;
$block = array();
}
$block[] = $edit;
}
 
if ($edit->orig)
$xi += sizeof($edit->orig);
if ($edit->final)
$yi += sizeof($edit->final);
}
 
if (is_array($block))
$this->_block($x0, $xi - $x0,
$y0, $yi - $y0,
$block);
 
return $this->_end_diff();
}
 
function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
$this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
}
 
function _start_diff() {
ob_start();
}
 
function _end_diff() {
$val = ob_get_contents();
ob_end_clean();
return $val;
}
 
function _block_header($xbeg, $xlen, $ybeg, $ylen) {
if ($xlen > 1)
$xbeg .= "," . ($xbeg + $xlen - 1);
if ($ylen > 1)
$ybeg .= "," . ($ybeg + $ylen - 1);
 
return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
}
function _start_block($header) {
echo $header."\n";
}
 
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/filemanager.php
New file
0,0 → 1,58
<?php
/*
filemanager.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le gestion des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if($this->UserIsOwner()){
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doFilemanager();
unset($att);
}else{
echo $this->Format("//Seul le propriétaire de cette page peut accéder au gestionnaire des fichiers attaché//");
}
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/addcomment.php
New file
0,0 → 1,71
<?php
/*
addcomment.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
 
if ($this->HasAccess("comment"))
{
// find number
if ($latestComment = $this->LoadSingle("select tag, id from ".$this->config["table_prefix"]."pages where comment_on != '' order by id desc limit 1"))
{
preg_match("/^Comment([0-9]+)$/", $latestComment["tag"], $matches);
$num = $matches[1] + 1;
}
else
{
$num = "1";
}
 
$body = trim($_POST["body"]);
if (!$body)
{
$this->SetMessage("Commentaire vide -- pas de sauvegarde !");
}
else
{
// store new comment
$this->SavePage("Comment".$num, $body, $this->tag);
}
 
// redirect to page
$this->redirect($this->href());
}
else
{
echo"<div class=\"page\"><i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; commenter cette page.</i></div>\n";
}
echo $this->Footer();
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/show.php
New file
0,0 → 1,170
<?php
/*
show.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric DELORD
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($HasAccessRead=$this->HasAccess("read"))
{
if (!$this->page)
{
echo "Cette page n'existe pas encore, voulez vous la <a href=\"".$this->href("edit")."\">cr&eacute;er</a> ?" ;
}
else
{
// comment header?
if ($this->page["comment_on"])
{
echo "<div class=\"commentinfo\">Ceci est un commentaire sur ",$this->ComposeLinkToPage($this->page["comment_on"], "", "", 0),", post&eacute; par ",$this->Format($this->page["user"])," &agrave; ",$this->page["time"],"</div>";
}
 
if ($this->page["latest"] == "N")
{
echo "<div class=\"revisioninfo\">Ceci est une version archiv&eacute;e de <a href=\"",$this->href(),"\">",$this->GetPageTag(),"</a> &agrave; ",$this->page["time"],".</div>";
}
 
 
// display page
echo $this->Format($this->page["body"], "wakka");
 
// if this is an old revision, display some buttons
if (($this->page["latest"] == "N") && $this->HasAccess("write"))
{
$latest = $this->LoadPage($this->tag);
?>
<br />
<?php echo $this->FormOpen("edit") ?>
<input type="hidden" name="previous" value="<?php echo $latest["id"] ?>">
<input type="hidden" name="body" value="<?php echo htmlentities($this->page["body"]) ?>">
<input type="submit" value="R&eacute;&eacute;diter cette version archiv&eacute;e">
<?php echo $this->FormClose(); ?>
<?php
}
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page</i>" ;
}
?>
<hr class="hr_clear" />
</div>
 
 
<?php
if ($HasAccessRead)
{
// load comments for this page
$comments = $this->LoadComments($this->tag);
// store comments display in session
$tag = $this->GetPageTag();
if (!isset($_SESSION["show_comments"][$tag]))
$_SESSION["show_comments"][$tag] = ($this->UserWantsComments() ? "1" : "0");
if (isset($_REQUEST["show_comments"])){
switch($_REQUEST["show_comments"])
{
case "0":
$_SESSION["show_comments"][$tag] = 0;
break;
case "1":
$_SESSION["show_comments"][$tag] = 1;
break;
}
}
// display comments!
if ($this->page && $_SESSION["show_comments"][$tag])
{
// display comments header
?>
<div class="commentsheader">
Commentaires [<a href="<?php echo $this->href("", "", "show_comments=0") ?>">Cacher commentaires/formulaire</a>]
</div>
<?php
// display comments themselves
if ($comments)
{
foreach ($comments as $comment)
{
echo "<a name=\"",$comment["tag"],"\"></a>\n" ;
echo "<div class=\"comment\">\n" ;
echo $this->Format($comment["body"]),"\n" ;
echo "<div class=\"commentinfo\">\n-- ",$this->Format($comment["user"])," (".$comment["time"],")\n</div>\n" ;
echo "</div>\n" ;
}
}
// display comment form
echo "<div class=\"commentform\">\n" ;
if ($this->HasAccess("comment"))
{
?>
Ajouter un commentaire &agrave; cette page:<br />
<?php echo $this->FormOpen("addcomment"); ?>
<textarea name="body" rows="6" style="width: 100%"></textarea><br />
<input type="submit" value="Ajouter Commentaire" accesskey="s">
<?php echo $this->FormClose(); ?>
<?php
}
echo "</div>\n" ;
}
else
{
?>
<div class="commentsheader">
<?php
switch (count($comments))
{
case 0:
echo "Il n'y a pas de commentaire sur cette page." ;
break;
case 1:
echo "Il y a un commentaire sur cette page." ;
break;
default:
echo "Il y a ",count($comments)," commentaires sur cette page." ;
}
?>
[<a href="<?php echo $this->href("", "", "show_comments=1") ?>">Afficher commentaires/formulaire</a>]
 
</div>
<?php
}
}
echo $this->Footer();
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/revisions.php
New file
0,0 → 1,86
<?php
/*
revisions.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
// load revisions for this pageif
if ($this->HasAccess("read")) {
 
$output='';
if ($pages = $this->LoadRevisions($this->tag))
{
$output .= $this->FormOpen("diff", "", "get");
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
$output .= "<tr>\n";
$output .= "<td><input type=\"submit\" value=\"Voir Diff&eacute;rences\" /></td>";
$output .= "<td><input type=\"checkbox\" name=\"fastdiff\"/>\n".$this->Format("Affichage simplifi&eacute;")."</td>";
$output .= "</tr>\n";
$output .= "</table>\n";
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
if ($user = $this->GetUser())
{
$max = $user["revisioncount"];
}
else
{
$max = 20;
}
$c = 0;
foreach ($pages as $page)
{
$c++;
if (($c <= $max) || !$max)
{
$output .= "<tr>";
$output .= "<td><input type=\"radio\" name=\"a\" value=\"".$page["id"]."\" ".($c == 1 ? "checked=\"checked\"" : "")." /></td>";
$output .= "<td><input type=\"radio\" name=\"b\" value=\"".$page["id"]."\" ".($c == 2 ? "checked=\"checked\"" : "")." /></td>";
$output .= "<td>&nbsp;<a href=\"".$this->href("show")."&amp;time=".urlencode($page["time"])."\">".$page["time"]."</a></td>";
$output .= "<td>&nbsp;by ".$this->Format($page["user"])."</td>";
$output .= "</tr>\n";
}
}
$output .= "</table>\n".$this->FormClose()."\n";
}
echo $output ;
}
else
{
echo "<i>Vous n'avez pas acc&egrave;s &agrave; cette page.</i>" ;
}
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/acls.php
New file
0,0 → 1,128
<?php
/*
acls.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->UserIsOwner())
{
if ($_POST)
{
// store lists
$this->SaveAcl($this->GetPageTag(), "read", $_POST["read_acl"]);
$this->SaveAcl($this->GetPageTag(), "write", $_POST["write_acl"]);
$this->SaveAcl($this->GetPageTag(), "comment", $_POST["comment_acl"]);
$message = "Droits d\'acc&egrave;s mis &agrave; jour ";//$message = "Access control lists updated";
// change owner?
if ($newowner = $_POST["newowner"])
{
$this->SetPageOwner($this->GetPageTag(), $newowner);
$message .= " et changement du propri&eacute;taire. Nouveau propri&eacute;taire : ".$newowner;//$message .= " and gave ownership to ".$newowner;
}
 
// redirect back to page
$this->SetMessage($message."!");
$this->Redirect($this->Href());
}
else
{
// load acls
$readACL = $this->LoadAcl($this->GetPageTag(), "read");
$writeACL = $this->LoadAcl($this->GetPageTag(), "write");
$commentACL = $this->LoadAcl($this->GetPageTag(), "comment");
 
// show form
?>
<h3>Liste des droits d'acc&egrave;s de la page <?php echo $this->ComposeLinkToPage($this->GetPageTag()) ?></h3><!-- Access Control Lists for-->
<br />
<?php echo $this->FormOpen("acls") ?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="padding-right: 20px">
<b>Droits de lecture :</b><br /><!-- Read ACL:-->
<textarea name="read_acl" rows="4" cols="20"><?php echo $readACL["list"] ?></textarea>
</td>
<td valign="top" style="padding-right: 20px">
<b>Droits d'&eacute;criture :</b><br /><!-- Write ACL:-->
<textarea name="write_acl" rows="4" cols="20"><?php echo $writeACL["list"] ?></textarea>
</td>
<td valign="top" style="padding-right: 20px">
<b>Droits des commentaires :</b><br /><!-- Comments ACL:-->
<textarea name="comment_acl" rows="4" cols="20"><?php echo $commentACL["list"] ?></textarea>
</td>
</tr>
<tr>
<td colspan="3">
<b>Changer le propri&eacute;taire :</b><br /><!-- Set Owner:-->
<select name="newowner">
<option value="">Ne rien modifier</option><!-- Don't change-->
<option value=""></option>
<?php
if ($users = $this->LoadUsers())
{
foreach($users as $user)
{
echo "<option value=\"",htmlentities($user["name"]),"\">",$user["name"],"</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="3">
<br />
<input type="submit" value="Enregistrer" style="width: 120px" accesskey="s" /><!-- Store ACLs-->
<input type="button" value="Annuler" onclick="history.back();" style="width: 120px" /><!-- Cancel -->
</td>
</tr>
</table>
<?php
echo$this->FormClose();
}
}
else
{
echo"<i>Vous n'&ecirc;tes pas le propri&eacute;taire de cette page.</i>";
//echo"<i>You're not the owner of this page.</i>";
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/upload.php
New file
0,0 → 1,55
<?php
/*
upload.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute l'upload des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doUpload();
unset($att);
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/claim.php
New file
0,0 → 1,46
<?php
/*
claim.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
 
// only claim ownership if this page has no owner, and if user is logged in.
if ($this->page && !$this->GetPageOwner() && $this->GetUser())
{
$this->SetPageOwner($this->GetPageTag(), $this->GetUserName());
$this->SetMessage("Vous &ecirc;tes maintenant le propri&eacute;taire de cette page");
}
 
$this->Redirect($this->href());
 
echo $this->Footer();
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/edit.php
New file
0,0 → 1,150
<?php
/*
edit.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($this->HasAccess("write") && $this->HasAccess("read"))
{
$output='';
if ($_POST)
{
// only if saving:
if ($_POST["submit"] == "Sauver")
{
// check for overwriting
if ($this->page)
{
if ($this->page["id"] != $_POST["previous"])
{
$error = "ALERTE : ".
"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
}
}
 
 
// store
if (!$error)
{
$body = str_replace("\r", "", $_POST["body"]);
// test si la nouvelle page est differente de la précédente
if(rtrim($body)==rtrim($this->page["body"])) {
$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
$this->Redirect($this->href());
}
 
// add page (revisions)
$this->SavePage($this->tag, $body);
 
// now we render it internally so we can write the updated link table.
$this->ClearLinkTable();
$this->StartLinkTracking();
$dummy = $this->Header();
$dummy .= $this->Format($body);
$dummy .= $this->Footer();
$this->StopLinkTracking();
$this->WriteLinkTable();
$this->ClearLinkTable();
 
// forward
$this->Redirect($this->href());
}
}
}
 
// fetch fields
if (!isset($_POST["previous"])) $previous = $this->page["id"];
else $previous = $_POST["previous"];
if (!isset($_POST["body"])) $body = $this->page["body"];
else $body = $_POST["body"];
 
 
// preview?
if (!isset($_POST["submit"])) $_POST["submit"] = "";
if ($_POST["submit"] == "Aperçu")
{
$output .=
"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
$this->Format($body)."\n\n".
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
"<br />\n".
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose()."\n";
}
else
{
// display form
if (isset($error))
{
if (!isset($output)) $output = '';
$output .= "<div class=\"error\">$error</div>\n";
}
 
// append a comment?
if (isset($_REQUEST["appendcomment"]))
{
$body = trim($body)."\n\n----\n\n--".$this->UserName()." (".strftime("%c").")";
}
 
if (!isset($output)) $output = '';
$output .=
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
htmlspecialchars($body).
"\n</textarea><br />\n".
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
}
 
echo $output;
}
else
{
echo "<i>Vous n'avez pas acc&egrave;s en &eacute;criture &agrave; cette page !</i>\n";
}
?>
<hr class="hr_clear" />
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/handlers/page/raw.php
New file
0,0 → 1,45
<?php
/*
raw.php
 
Copyright 2002 David DELON
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Charles NEPOTE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
 
if ($this->HasAccess("read"))
{
if (!$this->page)
{
return;
}
else
{
header("Content-type: text/plain");
// display raw page
echo $this->page["body"];
}
}
else
{
return;
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/default.php
New file
0,0 → 1,90
<form action="<?php echo myLocation() ?>?installAction=install" method="POST">
<table>
 
<tr><td></td><td><b>Installation de WikiNi</b></td></tr>
 
<?php
/*
default.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (($wakkaConfig["wakka_version"]) || ($wakkaConfig["wikini_version"]))
{
if ($wakkaConfig["wikini_version"]) {
$config=$wakkaConfig["wikini_version"];
}
else {
$config=$wakkaConfig["wakka_version"];
}
echo "<tr><td></td><td>Votre syst&egrave;me WikiNi existant a &eacute;t&eacute; reconnu comme &eacute;tant la version ",$config,". Vous &ecirc;tes sur le point de <b>mettre &agrave; jour</b> WikiNi pour la version ",WIKINI_VERSION,". Veuillez revoir vos informations de configuration ci-dessous.</td></tr>\n";
}
else
{
echo "<tr><td></td><td>Vous &ecirc;tes sur le point d'installer WikiNi ",WIKINI_VERSION,". Veuillez configurer votre WikiNi en utilisant le formulaire suivant.</td></tr>\n";
}
?>
 
<tr><td></td><td><br>NOTE: Ce programme d'installation va essayer de modifier les options de configurations dans le fichier <tt>wakka.config.php</tt>, situ&eacute; dans votre r&eacute;pertoire WikiNi. Pour que cela fonctionne, veuillez vous assurez que votre serveur a les droits d'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas faire &ccedil;a vous devrez modifier ce fichier manuellement (ce programme d'installation vous dira comment).</td></tr>
 
<tr><td></td><td><br><b>Configuration de la base de donn&eacute;es</b></td></tr>
<tr><td></td><td>La machine sur laquelle se trouve votre serveur MySQL. En g&eacute;n&eacute;ral c'est "localhost" (ie, la m&ecirc;me machine que celle o&ugrave; se trouve les pages de WikiNi.).</td></tr>
<tr><td align="right" nowrap>Machine MySQL :</td><td><input type="text" size="50" name="config[mysql_host]" value="<?php echo $wakkaConfig["mysql_host"] ?>"></td></tr>
<tr><td></td><td>La base de donn&eacute;es MySQL &agrave; utiliser pour WikiNi. Cette base de donn&eacute;es doit d&eacute;j&agrave; exister avant de pouvoir continuer.</td></tr>
<tr><td align="right" nowrap>Base de donn&eacute;es MySQL :</td><td><input type="text" size="50" name="config[mysql_database]" value="<?php echo $wakkaConfig["mysql_database"] ?>"></td></tr>
<tr><td></td><td>Nom et mot de passe de l'utilisateur MySQL qui sera utilis&eacute; pour se connecter &agrave; votre base de donn&eacute;es.</td></tr>
<tr><td align="right" nowrap>Non de l'utilisateur MySQL :</td><td><input type="text" size="50" name="config[mysql_user]" value="<?php echo $wakkaConfig["mysql_user"] ?>"></td></tr>
<tr><td align="right" nowrap>Mot de passe MySQL :</td><td><input type="password" size="50" name="config[mysql_password]" value=""></td></tr>
<tr><td></td><td>Pr&eacute;fixe &agrave; utiliser pour toutes les tables utilis&eacute;es par WikiNi. Ceci vous permet d'utiliser plusieurs WikiNi sur une m&ecirc;me base de donnn&eacute;es en donnant diff&eacute;rents pr&eacute;fixes aux tables.</td></tr>
<tr><td align="right" nowrap>Prefixe des tables :</td><td><input type="text" size="50" name="config[table_prefix]" value="<?php echo $wakkaConfig["table_prefix"] ?>"></td></tr>
 
<tr><td></td><td><br><b>Configuration de votre site WikiNi</b></td></tr>
 
<tr><td></td><td>Le nom de votre site WikiNi. Ceci est g&eacute;n&eacute;ralement un NomWiki et EstSousCetteForme.</td></tr>
<tr><td align="right" nowrap>Le nom de votre WikiNi :</td><td><input type="text" size="50" name="config[wakka_name]" value="<?php echo $wakkaConfig["wakka_name"] ?>"></td></tr>
 
<tr><td></td><td>La page d'accueil de votre WikiNi. Ceci doit &ecirc;tre un NomWiki.</td></tr>
<tr><td align="right" nowrap>Home page:</td><td><input type="text" size="50" name="config[root_page]" value="<?php echo $wakkaConfig["root_page"] ?>"></td></tr>
 
<tr><td></td><td>META Mots clefs/Description qui seront ins&eacute;r&eacute;s dans les codes HTML.</td></tr>
<tr><td align="right" nowrap>Mots clefs :</td><td><input type="text" size="50" name="config[meta_keywords]" value="<?php echo $wakkaConfig["meta_keywords"] ?>"></td></tr>
<tr><td align="right" nowrap>Description :</td><td><input type="text" size="50" name="config[meta_description]" value="<?php echo $wakkaConfig["meta_description"] ?>"></td></tr>
 
<tr><td></td><td><br><b>Configuration de l'URL de votre WikiNi</b><?php echo $wakkaConfig["wikini_version"] ? "" : "<br>Ceci est une nouvelle installation. Le programme d'installation va essayer de trouver les valeurs appropri&eacute;es. Changez-les uniquement si vous savez ce que vous faites." ?></td></tr>
 
<tr><td></td><td>L'URL de base de votre site WikiNi. Les noms des pages seront directement rajout&eacute;s &agrave; cet URL. Supprimez la partie "?wiki=" uniquement si vous utilisez la redirection (voir ci apr&egrave;s).</td></tr>
<tr><td align="right" nowrap>URL de base :</td><td><input type="text" size="50" name="config[base_url]" value="<?php echo $wakkaConfig["base_url"] ?>"></td></tr>
 
<tr><td></td><td>Le mode "redirection automatique" doit &ecirc;tre s&eacute;lectionn&eacute; uniquement si vous utilisez WikiNi avec la redirection d'URL (si vous ne savez pas ce qu'est la redirection d'URL n'activez pas cette option).</td></tr>
<tr><td align="right" nowrap>Mode "redirection" :</td><td><input type="hidden" name="config[rewrite_mode]" value="0"><input type="checkbox" name="config[rewrite_mode]" value="1" <?php echo $wakkaConfig["rewrite_mode"] ? "checked" : "" ?>> Activation</td></tr>
 
<tr><td></td><td><br><b>Options suppl&eacute;mentaires</b></td></tr>
 
<tr><td></td><td><input type="hidden" name="config[preview_before_save]" value="0"><input type="checkbox" name="config[preview_before_save]" value="1" <?php echo $wakkaConfig["preview_before_save"] ? "checked" : "" ?>> Imposer de faire un aper&ccedil;u avant de pouvoir sauver une page.</td></tr>
<tr><td></td><td><input type="submit" value="Continuer"></td></tr>
</table>
</form>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/install.php
New file
0,0 → 1,175
<?php
/*
install.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// fetch configuration
$config = $_POST["config"];
 
// test configuration
echo "<b>Test de la configuration</b><br>\n";
test("Test connexion MySQL ...", $dblink = @mysql_connect($config["mysql_host"], $config["mysql_user"], $config["mysql_password"]));
test("Recherche base de donn&eacute;es ...", @mysql_select_db($config["mysql_database"], $dblink), "La base de donn&eacute;es que vous avez choisie n'existe pas, vous devez la cr&eacute;er avant d'installer WikiNi !");
echo "<br>\n" ;
 
// do installation stuff
if (!$version = trim($wakkaConfig["wikini_version"])) $version = "0";
switch ($version)
{
// new installation
case "0":
echo "<b>Installation</b><br>\n";
test("Creation table page...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."pages (".
"id int(10) unsigned NOT NULL auto_increment,".
"tag varchar(50) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"body text NOT NULL,".
"body_r text NOT NULL,".
"owner varchar(50) NOT NULL default '',".
"user varchar(50) NOT NULL default '',".
"latest enum('Y','N') NOT NULL default 'N',".
"handler varchar(30) NOT NULL default 'page',".
"comment_on varchar(50) NOT NULL default '',".
"PRIMARY KEY (id),".
"FULLTEXT KEY tag (tag,body),".
"KEY idx_tag (tag),".
"KEY idx_time (time),".
"KEY idx_latest (latest),".
"KEY idx_comment_on (comment_on)".
") TYPE=MyISAM;", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table ACL ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."acls (".
"page_tag varchar(50) NOT NULL default '',".
"privilege varchar(20) NOT NULL default '',".
"list text NOT NULL,".
"PRIMARY KEY (page_tag,privilege)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table link ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."links (".
"from_tag char(50) NOT NULL default '',".
"to_tag char(50) NOT NULL default '',".
"UNIQUE KEY from_tag (from_tag,to_tag),".
"KEY idx_from (from_tag),".
"KEY idx_to (to_tag)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table referrer ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."referrers (".
"page_tag char(50) NOT NULL default '',".
"referrer char(150) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"KEY idx_page_tag (page_tag),".
"KEY idx_time (time)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table user ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."users (".
"name varchar(80) NOT NULL default '',".
"password varchar(32) NOT NULL default '',".
"email varchar(50) NOT NULL default '',".
"motto text NOT NULL,".
"revisioncount int(10) unsigned NOT NULL default '20',".
"changescount int(10) unsigned NOT NULL default '50',".
"doubleclickedit enum('Y','N') NOT NULL default 'Y',".
"signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
"show_comments enum('Y','N') NOT NULL default 'N',".
"PRIMARY KEY (name),".
"KEY idx_name (name),".
"KEY idx_signuptime (signuptime)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
//insertion des pages de documentation et des pages standards
$d = dir("setup/doc/");
while ($doc = $d->read()){
if ($doc != "." && $doc != ".." && !is_dir($doc)){
$pagecontent = implode ('', file("setup/doc/$doc"));
if ($doc=='_root_page.txt'){
$pagename = $config["root_page"];
}else{
$pagename = substr($doc,0,strpos($doc,'.txt'));
}
 
$sql = "Select tag from ".$config["table_prefix"]."pages where tag='$pagename'";
// Insert documentation page if not present (a previous failed installation ?)
if (($r=@mysql_query($sql, $dblink)) && (mysql_num_rows($r)==0)) {
$sql = "Insert into ".$config["table_prefix"]."pages ".
"set tag = '$pagename', ".
"body = '".mysql_escape_string($pagecontent)."', ".
"user = 'WikiNiInstaller', ".
"time = now(), ".
"latest = 'Y'";
 
test("Insertion de la page $pagename ...", @mysql_query($sql, $dblink),"?",0);
 
// update table_links
$wiki = new Wiki($config);
$wiki->SetPage($wiki->LoadPage($pagename,"",0));
$wiki->ClearLinkTable();
$wiki->StartLinkTracking();
$wiki->TrackLinkTo($pagename);
$dummy = $wiki->Header();
$dummy .= $wiki->Format($pagecontent);
$dummy .= $wiki->Footer();
$wiki->StopLinkTracking();
$wiki->WriteLinkTable();
$wiki->ClearLinkTable();
}
else
{
test("Insertion de la page $pagename ...", 0 ,"Existe d&eacute;j&agrave;.",0);
}
 
}
}
break;
// The funny upgrading stuff. Make sure these are in order! //
case "0.1":
echo "<b>En cours de mise &agrave; jour de WikiNi 0.1</b><br>\n";
test("Just very slightly altering the pages table...",
@mysql_query("alter table ".$config["table_prefix"]."pages add body_r text not null default '' after body", $dblink), "Already done? Hmm!", 0);
test("Claiming all your base...", 1);
}
 
?>
 
<p>
A l'&eacute;tape suivante, le programme d'installation va essayer
d'&eacute;crire le fichier de configuration <tt><?php echo $wakkaConfigLocation ?></tt>.
Assurez vous que le serveur web a bien le droit d'&eacute;crire dans ce fichier, sinon vous devrez le modifier manuellement. </p>
 
<form action="<?php echo myLocation(); ?>?installAction=writeconfig" method="POST">
<input type="hidden" name="config" value="<?php echo htmlentities(serialize($config)) ?>">
<input type="submit" value="Continuer">
</form>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/header.php
New file
0,0 → 1,65
<?php
/*
header.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// stuff
function test($text, $condition, $errorText = "", $stopOnError = 1) {
echo "$text " ;
if ($condition)
{
echo "<span class=\"ok\">OK</span><br>\n" ;
}
else
{
echo "<span class=\"failed\">ECHEC</span>" ;
if ($errorText) echo ": ",$errorText ;
echo "<br>\n" ;
if ($stopOnError) exit;
}
}
 
function myLocation()
{
list($url, ) = explode("?", $_SERVER["REQUEST_URI"]);
return $url;
}
 
?>
<html>
<head>
<title>Installation de WikiNi</title>
<style>
P, BODY, TD, LI, INPUT, SELECT, TEXTAREA { font-family: Verdana; font-size: 13px; }
INPUT { color: #880000; }
.ok { color: #008800; font-weight: bold; }
.failed { color: #880000; font-weight: bold; }
A { color: #0000FF; }
</style>
</head>
 
<body>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/footer.php
New file
0,0 → 1,2
</body>
</html>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionPageIndex.txt
New file
0,0 → 1,7
L'action ""{{PageIndex}}"" liste toutes les pages classées par ordre alphabétique et regroupées par lettre. On peut la voir en action sur l'IndexDesPagesBis.
Pour obtenir la liste des pages du site on pourra voir également l'action [[ActionListPages ListPages]].
 
Cette action ne prend aucun paramètre.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/RechercheTexte.txt
New file
0,0 → 1,0
{{TextSearch}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/TableauDeBordDeCeWiki.txt
New file
0,0 → 1,14
Ce tableau de bord regroupe toutes les pages utiles à l'analyse et à l'animation de ce site.
- DerniersChangements et DerniersCommentaires
- PlanDuSite à partir de la racine
- IndexDesPages, IndexDesPagesBis
- PagesOrphelines
- PagesACreer
 
----
==== 8 derniers comptes utilisateurs ====
{{Listusers last="8"}}
==== 8 dernières pages modifiées ====
{{recentchanges max="8"}}
==== 5 dernières pages commentées ====
{{RecentlyCommented max="5"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionRecentChanges.txt
New file
0,0 → 1,10
L'action ""{{RecentChanges}}"" affiche la liste des pages récement modifiées. Elle est illustrée dans la page DerniersChangements.
 
==== Paramètres ====
Cette action prend en compte le paramètre "max", permettant à un utilisateur de spécifier le nombre de pages affichées.
Par exemple ""{{recentchanges max="3"}}"" donne :
 
{{recentchanges max="3"}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/PlanDuSite.txt
New file
0,0 → 1,0
{{listpages/tree}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ListeDesActionsWikini.txt
New file
0,0 → 1,22
Wikini propose par défaut les "actions" suivantes.
 
- ActionBacklinks
- ActionFindpage
- ActionInclude : inclusion d'une page au sein d'une autre
- ActionListPages
- ActionListUsers
- ActionMyChanges
- ActionMyPages
- ActionOrphanedPages : recherche les pages qui n'ont pas de liens vers elle (par orpheline )
- ActionPageIndex
- ActionRecentChanges
- ActionRecentChangesRSS
- ActionRecentComments
- ActionRecentlyCommented
- ActionRedirect : redirection d'une page vers une autre
- ActionTextSearch : recherche d'une chaine de caractères dans l'ensemble des page de [[http://www.wikini.net WikiNi]]
- ActionTrail : permet de lier des pages entres elles et de passer de l'une à l'autre avec un petit navigateur style "précédente/suivante"
- ActionUserSettings
- ActionWantedPages : liste les pages devant être écrites.
 
 
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionTextSearch.txt
New file
0,0 → 1,12
L'action ##""{{TextSearch}}""## permet de lister les pages contenant un ou plusieurs mots entré(s) par l'utilisateur.
On peut la voir en action sur la page RechercheTexte.
 
Cette action utilise la fonction d'indexation en texte intégral de ""MySQL"" et hérite de ses qualités et défauts :
- la recherche est quasi instantanée
- la recherche est limitée à des mots de 4 lettres au minimim
- la recherche n'accepte pas de caractères génériques (ou caractères joker : ".*?", etc.)
- la recherche n'est pas lématisée : la recherche de "protocole" ne trouvera pas "protocoles" ; la recherche de "lascif" ne trouvera pas "lascive"
- la recherche n'est pas effectuée sur une partie de MotWiki : la recherche de "text" ne donnera pas ActionTextSearch pour résultat
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionTrail.txt
New file
0,0 → 1,38
L'action ##""{{trail toc="NomDePage"}}""## permet de lier des pages entres elles grace à une page de sommaire. Cette action affiche un navigateur du type "précedente/suivante" en indiquant le nom des pages précende et suivante.
 
====Paramètre====
Le paramètre ##toc## permet d'indiquer le nom de la page contenant le liste des pages liées.
 
====Configuration====
L'aspet des liens du navigateur est définis par deux classe CSS présente dans wakka.css :
##
.trail_table { line-height: 30px;}
.trail_button { color: #993333; }
##
 
====Ecriture d'une page "toc"====
Cette page peut contenir n'importe quel texte. Les règles qui permettent de définir la liste des pages liées sont :
- Le nom de la page appartient à une liste (numéroté, à bulle ou sans signe)
- Le nom de la page est le **1er** mot de chaque élément de la liste
- Les liens ##""[[NomPageWikiNi Nom d'une page WikiNi]]""## sont acceptés et doivent être le **1er mot** de chaque éléments de la liste.
 
Un exemple de page sommaire :
-----
 
====Sommaire====
 
Texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte.
 
- Page1 : texte texte texte texte texte texte texte texte texte texte texte
- Page2 : texte texte texte texte texte texte texte texte texte texte texte texte texte
- [[Page3 Vers la page 3]] : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
- Page31 : texte texte texte texte texte texte texte texte texte texte texte
- Page32 : texte texte texte texte texte texte texte texte texte texte texte
- Page4 : texte texte texte texte texte texte texte texte texte texte texte
 
texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte.
- Page5 : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
- Page6 : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
-----
{{trail toc="ListeDesActionsWikiNi"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/NomWiki.txt
New file
0,0 → 1,3
Un NomWiki est un nom qui est écrit ""CommeCela"".
 
Un NomWiki est transformé automatiquement en lien. Si la page correspondante n'existe pas, un '?' est affiché à côté du mot.
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/AideWikiNi.txt
New file
0,0 → 1,5
=====Les pages d'aide sur [[http://www.wikini.net WikiNi]]=====
 
- ReglesDeFormatage : résumé des syntaxes ""WikNi"" permettant la mise en forme du texte.
- ListeDesActionsWikini : liste des actions disponible dans [[http://www.wikini.net WikiNi]].
- ControlerLAccesAuxPages : explique comment gérer les droits d'accès aux page de [[http://www.wikini.net WikiNi]].
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/_root_page.txt
New file
0,0 → 1,3
Bienvenue ! Cliquez sur le lien "Editer cette page" au bas de la page pour démarrer.
 
Pages utiles: PagesOrphelines, PagesACreer, RechercheTexte, ReglesDeFormatage, AideWikiNi, TableauDeBordDeCeWiki.
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionOrphanedPages.txt
New file
0,0 → 1,11
L'action ""{{OrphanedPages}}"" liste toutes les pages orphelines, c'est-à-dire toutes les pages n'étant reliées à aucune autre page.
Cette action est utilisée ici dans la page : PagesOrphelines.
 
Elle peut servir :
- à localiser les pages qui ont besoin d'être reliées à d'autres pages
- à localiser les pages rendues inutiles et que l'on peut alors effacer
 
Cette page ne comporte aucun paramètre.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionRecentlyCommented.txt
New file
0,0 → 1,10
L'action ""{{RecentlyCommented}}"" permet d'afficher la liste des pages ayant été récement commentées. Cette action est visible sur la page DerniersCommentaires.
 
==== Paramètres ====
Cette action accepte un seul paramètre, le paramètre "max" permettant de spécifier le nombre maximum de pages récemment commentées à afficher.
Par exemple ""{{RecentlyCommented max="3"}}"" va donner le résultat suivant :
 
{{RecentlyCommented max="3"}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ReglesDeFormatage.txt
New file
0,0 → 1,61
==== Guide des règles de formatage ====
 
Les règles de formatage avec Wakka diffèrent légèrement des autres Wikis. (Voir par exemple [[http://c2.com/cgi/wiki?TextFormattingRules les règles de formatage de WikiWikiWeb]], le premier Wiki connu.)
Tout texte placé entre deux guillemets doubles - " - est présenté tel que.
 
Vous pouvez effectuer vos propres test dans le BacASable : c'est un endroit fait pour ça.
 
Règles de base :
""**Texte en gras !** ---""> **Texte en gras !**
""//Texte en italique.// ---""> //Texte en italique.//
""Texte __souligné__ ! ---""> Texte __souligné__ !
""Texte @@barré@@ ! ---""> Texte @@barré@@ !
""##texte à espacement fixe## ---""> ##texte à espacement fixe##
""%%code%%""
""%%(php) PHP code%%""
""%%(delphi) code delphi/pascal%%""
 
Empêcher le formatage du texte :
Pour empêcher que Wikini n'interprète les balises de formatage de texte qu'il reconnait, encadrer le texte par une paire de guillemets doubles. ""Par __exemple__, ce **texte** @@contient@@ des %%balises%% reconnue par Wikini qui ne sont //pas// interprétée car il est encadré par une paire de **guillemets double** comme __vous__ pouvez vous en apercevoir :)""
Deux autres utilisations :
- écrire directement du HTML dans le wikini - par exemple pour les tableaux... ;-) - vu que ce qui est renvoyé est tout de même interprété par le moteur de rendu de Mozilla
- afficher des logs / des scripts shell en ajoutant les tag <pre> et </pre> qui seront interprétés pour afficher le texte tel quel par le navigateur (sous réserve qu'il n'y ait pas de double guillemet dedans). Cela permet d'avoir le contenu in extenso plutôt que dans une boîte de code qui est de taille fixe (contrairement à la fonctionnalité de phpBB2 avec les tags [code] et [/code])
 
Liens forcés :
""[[http://www.mon-site.org]]""
""[[http://www.mon-site.org Mon-site]]""
""[[P2P]]""
""[[P2P Page sur le P2P]]""
 
En-têtes :
""====== En-tête énorme ======"" ====== En-tête énorme ======
""===== En-tête très gros ====="" ===== En-tête très gros =====
""==== En-tête gros ===="" ==== En-tête gros ====
""=== En-tête normal ==="" === En-tête normal ===
""== Petit en-tête =="" == Petit en-tête ==
 
Séparateur horizontal : il suffit de taper au moins 4 "-", au dela de 4 tirets c'est le meme effet
Exemple : ""----""
-------
 
 
Retour de ligne forcé :
""---""
 
L'indentation de textes se fait avec la touche "TAB". Vous pouvez aussi créer des listes à puces ou numérotées :
""- liste à puce""
""1) liste numérotée (chiffres arabes)""
""A) liste numérotée (capitales alphabétiques)""
""a) liste numérotée (minuscules alphabétiques)""
""i) liste numérotée (chiffres romains)""
 
Vous pouvez également indenter du texte en utilisant des caractères espace au lieu de la touche "TAB", les exemples ci dessus restent valables mais attention à ne pas mélanger des "TAB" et des espaces dans la même énumération.
 
""- liste à puce""
""1) liste numérotée (chiffres arabes)""
""A) liste numérotée (capitales alphabétiques)""
""a) liste numérotée (minuscules alphabétiques)""
""i) liste numérotée (chiffres romains)""
 
Note : à cause d'un [[http://bugzilla.mozilla.org/show_bug.cgi?id=10547 bogue dans son moteur de rendu]], les listes, utilisant la touche TAB, ne fonctionnent pas (encore) sous Mozilla.
 
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ControlerLAccesAuxPages.txt
New file
0,0 → 1,29
Chaque page possède trois niveaux de contrôle d'accès :
- lecture de la page
- écriture/modification de la page
- commentaire de la page
 
Les contrôles d'accès ne peuvent être modifiés que par le propriétaire de la page -- l'administrateur technique peut aussi manuellement modifier ces contrôles en travaillant directement sur la base de données.
Le propriétaire d'une page voit apparaître, dans la page dont il est propriétaire, l'option "Éditer permissions" : cette option lui permet de modifier les contrôles d'accès.
Ces contrôles sont matérialisés par des colonnes où le propriétaire va ajouter ou supprimer des informations.
Le propriétaire peut compléter ces colonnes par les informations suivantes, séparées par des espaces :
- le nom d'un ou plusieurs utilisateurs : par exemple ""CharlesNepote"" ou ""DavidDelon""
- le caractère ***** désignant tous les utilisateurs
- le caractère **+** désignant les utilisateurs enregistrés
- le caractère **!** signifiant la négation : par exemple !""CharlesNepote"" signifie que ""CharlesNepote"" **ne doit pas** avoir accès à cette page
 
===== Droits d'accès par défaut =====
Pour toute nouvelle page créée, [[http://www.wikini.net WikiNi]] applique des droits d'accès par défaut. Ces droits d'accès sont configurables via le fichier /wakka.config.php.
Il faut renseigner les trois variables de configuration suivantes :
##
"default_write_acl" => "*",
"default_read_acl" => "*",
"default_comment_acl" => "*",
##
 
Par exemple, vous pouvez souhaiter que, par défaut, seuls les utilisateurs enregistrés puisse modifier des pages. Vous utiliserez alors :
##
"default_write_acl" => "+",
"default_read_acl" => "*",
"default_comment_acl" => "*",
##
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/PagesACreer.txt
New file
0,0 → 1,0
{{WantedPages}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/IndexDesPagesBis.txt
New file
0,0 → 1,0
{{pageindex}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionInclude.txt
New file
0,0 → 1,40
L'action ##""{{include page="PagePrincipale"}}""## ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet d'inclure dans une page une autre page du wiki (ici la page PagePrincipale). Cette action possède plusieurs applications :
- elle permet de regrouper plusieurs pages en une seule et donc, par exemple, créer un document à partir de différentes "sections" disséminées dans plusieurs pages
- elle permet de commenter/critiquer une page en lecture seule en l'incluant dans le corps d'une autre page
- elle peut permettre, par exemple, de constituer des blocs d'informations redondantes qui seront répétés (inclus) dans plusieurs autres pages (il peut s'agir d'un menu, d'une signature, d'une mention légale, ou autre)
- encore plus fort ! il semble possible configurer ainsi le menu de navigation de [[http://www.wikini.net WikiNi]] de cette manière ! dans le fichier wakka.config.php, il suffit d'indiquer :
##"navigation_links" => """{{include page=\"MenuDuHaut\"}}""",##
et de créer dans la page ""MenuDuHaut"" ce que l'on souhaite voir apparaître. Cette page peut être protégée en lecture seule pour tout le monde et en écriture pour les administrateurs fonctionnels.
- elle permet une sorte de syndication en incluant des pages d'un autre __""WikiNi""__.
 
==== Paramètres ====
Cette action accepte deux paramètres :
- page : paramètre obligatoire pour désigner la page à inclure (sans lequel l'action ne fonctionne pas). Ce paramètre peut être une page local au [[http://www.wikini.net WikiNi]] ou une page d'un autre [[http://www.wikini.net WikiNi]].
- class : désignant une ou plusieurs classes de style, séparées par des espaces, agissant sur la mise en forme de l'inclusion ; ce paramètre est optionnel.
 
Actuellement, [[http://www.wikini.net WikiNi]] intègre plusieurs classes prédéfinies pour gérer la mise en forme de l'inclusion :
%%
.include_right { float: right; width: 17%; } /* bloc flotant à droite */
.include_left { float: left; width: 17%; } /* bloc flotant à gauche */
.include_solid_border { border: solid; padding: 2px; } /* encadré noir */
.include_gray_background { background-color: #DDDDDD; } /* fond gris */
.include_small_fonts { font-size: 0.8em; } /* petites polices */
.include_big_fonts { font-size: 1.2em; } /* grandes polces */
.include_height10em { height: 10em; overflow: scroll; } /* boite de 10em de hauteur, avec ascenseur */
.include_height15em { height: 15em; overflow: scroll; }
.include_height30em { height: 30em; overflow: scroll; }
.include_height60em { height: 60em; overflow: scroll; }
%%
 
{{include page="ListeDesActionsWikini" class="right height15em small_fonts solid_border gray_background"}}
Ces classes de style peuvent être employées cumulativement. Ainsi, si l'on souhaite obtenir, par exemple, une boite grise avec une bordure et de petits caractères, on employera :
##""{{include page="ListeDesActionsWikini" class="gray_background solid_border small_fonts"}}""##
L'inclusion par défaut, pour le moment, produit une présentation non différenciée par rapport au reste de la page ; il faut **spécifier** un style (comme en HTML classique), pour le voir appliqué. L'utilisation des classes de style doit faire l'objet d'une attention particulière, certains navigateurs ne supportant que peu ou pas les styles CSS.
La boite ci à droite correspond à l'inclusion suivante : ##""{{include page="ListeDesActionsWikini" class="right height15em small_fonts solid_border gray_background"}}""##
 
Une page ne peut-être inclue dans elle-même : cela provoquerait une boucle récursive infinie : un page affichant une page, affichant une page, affichant une page, etc.
De même, les boucles d'inclusion portant sur plus d'une page, sont impossibles. Prenons par exemple : un page ""Page1"" inclus une page ""Page2"" qui inclus une page ""Page3"" qui inclus la page ""Page1"". Lorsque ont demande à afficher la page ""Page1"", on voit le contenu des pages ""Page1"", ""Page2"" et ""Page3"" et le message d'erreur indiquant qu'il est impossible d'inclure une page dans elle même. En effet, la page "active" est ""Page1"" et le test dans l'action ##""{{include}}""## regarde si le nom de la page inclus est le même que celui de la page active ce qui provoque une erreur car l'inclusion d'autres pages ne change pas la page active.
On verra cet exemple concrètement développé dans WikiNi:ActionIncludeExempleDeBouclePage1 et suivantes.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/DerniersCommentaires.txt
New file
0,0 → 1,0
{{RecentlyCommented}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/IndexDesPages.txt
New file
0,0 → 1,0
{{listpages}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/MotWiki.txt
New file
0,0 → 1,0
{{redirect page="NomWiki"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/DerniersChangements.txt
New file
0,0 → 1,0
{{RecentChanges}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/PagesOrphelines.txt
New file
0,0 → 1,0
{{OrphanedPages}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionListPages.txt
New file
0,0 → 1,16
L'action ""{{ListPages}}"" liste la totalité des pages du site.
Pour obtenir la liste des pages du site on pourra voir également l'action [[ActionPageIndex PageIndex]].
 
L'action ""ListPages"" s'utilise avec différents paramètres :
 
- ""{{ListPages}}"" : établi un IndexDesPages, liste de toutes les pages du site dans l'ordre alphabétique de leur nom, avec leur propriétaire (identique à ""{{ListPages/sort}}"" et ""{{ListPages/sort="tag"}}"")
- ""{{ListPages/tree}}"" : établi un PlanDuSite, c'est-à-dire une liste hiérarchique des pages sur trois niveaux à partir de la page d'accueil (cette action ne liste donc pas toutes les pages du site)
- ""{{ListPages/tree="MotWiki"}}"" : établi une liste hiérarchique des pages sur trois niveaux à partir de la page passée en paramètre, ici ""MotWiki"".
- ""{{ListPages/sort}}"" : liste de toutes les pages du site classées par ordre alphabétique (identique à ""{{ListPages}}"" et ""{{ListPages/sort="tag"}}"")
- ""{{ListPages/sort="time"}}"" : liste toutes les pages du site classées par ordre de dernière date de modification
- ""{{ListPages/sort="owner"}}"" : liste de toute les pages du site classées par ordre du nom du propriétaire de la page
- ""{{ListPages/sort="user"}}"" : liste de toutes les pages du site classées par ordre du nom du dernier utilisateur à l'avoir modifiée
- ""{{ListPages/sort="tag"}}"" : liste de toutes les pages du site classées par ordre alphabétique (identique à ""{{ListPages}}"" et ""{{ListPages/sort}}"")
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionListUsers.txt
New file
0,0 → 1,20
==== Liste des comptes utilisateurs ====
 
Cette fonction permet de lister les comptes utilisateurs créés.
La fonction est loin d'être indispensable, mais elle permet, par exemple, de connaître les nouveaux utilisateurs qui se sont inscrits pour des raisons pratiques (paramétrage) mais qui n'ont pas encore renseigné leur page personnelle. Autre exemple, on peut observer le nombre de nouveaux inscrits suite à une promotion du site, etc.
Par défaut, cette fonction donne la liste des comptes par ordre alphabétique. Cette fonction accepte en outre le paramètre "last" permettant le tri des comptes par odre inverse de date de création. Ce dernier paramètre accepte lui-même, de surcroit, un chiffre en paramètre permettant de réduire le nombre comptes affichés. La syntaxe d'utilisation de cette "action" est donnée ci-dessous.
 
""{{Listusers/last}}"" : donne la liste des derniers comptes utilisateurs
{{listusers/last}}
 
""{{Listusers/last="3"}}""
{{listusers/last="3"}}
 
""{{Listusers/last="50"}}""
{{listusers/last="50"}}
 
""{{Listusers}}"" : donne la liste des comptes utilisateurs par ordre alphabétique
{{listusers}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/BacASable.txt
New file
0,0 → 1,0
Faites vos test sur [[http://www.wikini.net WikiNi]] sur cette page
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionUserSettings.txt
New file
0,0 → 1,10
L'action ""{{UserSettings}}"" permet aux utilisateurs d'effectuer les actions suivantes :
- création d'un nouveau compte
- authentification
- réglage des paramètres utilisateur
- changement de mot-de-passe
 
On peut la voir en action dans les ParametresUtilisateur.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ParametresUtilisateur.txt
New file
0,0 → 1,0
{{UserSettings}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionRedirect.txt
New file
0,0 → 1,23
L'action ##""{{redirect page="PagePrincipale"}}""## permet d'être redirigé vers une autre page lorsqu'une page est demandée (ici vers la PagePrincipale). Cela permet de faire des "alias" de page, plusieurs noms différents pour une même page.
 
**Synthèse des cas** où cette action peut être utile :
- dans le cas où certains termes sont d'orthographe variable, comme par exemple Persistance of Vision - qui devient ""PoV"", ""POV"", ""PovRay"", ""POV-Ray""... et certains Wiki voient donc deux pages apparaitre pour la même chose, avec du contenu trop élaboré pour être facilement reconciliable en une seule page.
- en cas de renommage d'une page (en fait le déplacement d'une page vers une autre page), l'ancien nom peut rediriger vers le nouveau nom ; ceci peut être particulièrement utile dans le cas où de très nombreuses pages pointe sur la page originelle, évitant ainsi de changer les liens dans chaque page
- redirection d'une page au nom wiki disgracieux vers une page au nom wiki plus lisible ; exemples : ""SpIp"" => Spip, ""DelPhine"" => Delphine, etc.
 
Une différence notable entre une inclusion et une redirection : lors d'une inclusion, le contenu de la page incluant une autre page peut être modifé, donc utiliser l'inclusion pour faire des alias de page ne me parait pas très sûr car il risque d'apparaitre des divergences de contenu si c'est la page incluant une autre page qui est modifée. Par contre, une redirection __impose__ qu'une seule page est éditable et la cohérence de contenu est donc correcte.
 
===== Paramètres =====
 
Cette action accepte un seul paramètre :
- page : paramètre obligatoire pour désigner la page vers laquelle la page est redirigée.
 
===== Modification d'une page contenant l'action ##redirect## =====
Il faut entrer manuellement dans la barre d'adresse du navigateur l'adresse de la page + le "handler" désiré ; par exemple :
Pour la modifier :
- http://domaine/wakka.php?wiki=NomDeLaPage/edit
Pour la supprimer :
- http://domaine/wakka.php?wiki=NomDeLaPage/deletepage
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionBacklinks.txt
New file
0,0 → 1,24
Action permettant d'insérer la liste de toutes les pages faisant référence à la page courante. Dans cette présente page, ""{{backlinks}}"" donne ceci :
 
{{BackLinks}}
 
Sur la page personnelle d'un utilisateur, cette action affichera aussi les pages dont il est le propriétaire ou le dernier modificateur.
 
===== Paramètres =====
 
==== Paramètre "page" ====
Le paramètre "page" ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet de spécifier une page différente de la page courante.
Par exemple ##""{{backlinks page="PagePrincipale"}}""##
Ce paramètre peut être utile, par exemple :
- pour améliorer le TableauDeBordDeCeWiki : il suffit d'ajouter la liste des pages liées à la page ""AFaire"" pour connaître les pages qui doivent faire l'objet d'un travail
- pour consolider des données sur une seule page : par exemple la liste des pages liées aux pages ""EstUnHomme"" et ""EstUneFemme""
- autres ?
 
==== Paramètre "exclude" ====
Le paramètre "exclude" ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet de spécifier des pages à exclure de la liste des pages qui ont pourtant un lien vers la page de référence.
Il est en effet parfois génant d'afficher la totalité des pages faisant référence à une page. Par exemple, la page ""AFaire"" liste la page ""CharlesNepoteVeilleSurInternet"" alors que, non seulement cette information n'a pas d'intérêt mais elle pollue en outre la lecture de cette page. Autre exemple, une page ""MamiFeres"" a intérêt par exemple à lister ""CheVal"" et ""ElePhant"" mais pas nécessairement ""AniMaux"" qui est une catégorie supérieure. Je suggère donc la création d'un paramètre exclude destiné à exclure certaines pages : par exemple :
##""{{backlinks exclude="AniMaux"}}""##
Le paramètre "exclude" peut contenir plusieurs noms de page séparés par des ";", par exemple : ##""{{backlinks exclude="AniMaux; PagePrincipale"}}""##
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/doc/ActionWantedPages.txt
New file
0,0 → 1,5
L'action ""{{WantedPages}}"" liste tous les MotWiki du site qui n'ont pas vu la création d'une page.
Cette page est visible en action sur les PagesACreer.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/setup/writeconfig.php
New file
0,0 → 1,77
<?php
/*
writeconfig.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// fetch config
$config = $config2 = unserialize($_POST["config"]);
 
// merge existing configuration with new one
$config = array_merge($wakkaConfig, $config);
 
// set version to current version, yay!
$config["wikini_version"] = WIKINI_VERSION;
$config["wakka_version"] = WAKKA_VERSION;
 
// convert config array into PHP code
$configCode = "<?php\n// wakka.config.php cr&eacute;&eacute;e ".strftime("%c")."\n// ne changez pas la wikini_version manuellement!\n\n\$wakkaConfig = array(\n";
foreach ($config as $k => $v)
{
$entries[] = "\t\"".$k."\" => \"".$v."\"";
}
$configCode .= implode(",\n", $entries).");\n?>";
 
// try to write configuration file
echo "<b>Cr&eacute;ation du fichier de configuration en cours...</b><br>\n";
test("&Eacute;criture du fichier de configuration <tt>".$wakkaConfigLocation."</tt>...", $fp = @fopen($wakkaConfigLocation, "w"), "", 0);
 
if ($fp)
{
fwrite($fp, $configCode);
// write
fclose($fp);
echo "<p>Voila c'est termin&eacute; ! Vous pouvez <a href=\"",$config["base_url"],"\">retourner sur votre site WikiNi</a>. Il est conseill&eacute; de retirer l'acc&egrave;s en &eacute;criture au fichier <tt>wakka.config.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>";
}
else
{
// complain
echo"<p><span class=\"failed\">AVERTISSEMENT:</span> Le
fichier de configuration <tt>",$wakkaConfigLocation,"</tt> n'a pu &ecirc;tre
cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits d'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer au moyen d'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier <tt>wakka.config.php</tt> directement dans le r&eacute;pertoire de WikiNi. Une fois que vous aurez fait cela, votre site WikiNi devrait fonctionner correctement.</p>\n";
?>
<form action="<?php echo myLocation() ?>?installAction=writeconfig" method="POST">
<input type="hidden" name="config" value="<?php echo htmlentities(serialize($config2)) ?>">
<input type="submit" value="Essayer &agrave; nouveau">
</form>
<?php
echo"<div style=\"background-color: #EEEEEE; padding: 10px 10px;\">\n<xmp>",$configCode,"</xmp>\n</div>\n";
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/toolsmng/desc.xml
New file
0,0 → 1,7
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="Plugins Manager" version="0.1" active="1">
<author>David Delon (auteur original : Olivier Meunier)</author>
<label>Gestionnaire d'extension</label>
<desc>Gestionnaire d'extensions pour Wikini.</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/toolsmng/index.php
New file
0,0 → 1,144
<?php
 
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
 
$err = '';
$tool_url = '';
 
# Liste des thèmes
$plugins_root = dirname(__FILE__).'/../';
$plugins = new plugins($plugins_root);
$plugins->getPlugins(false);
$plugins_list = $plugins->getPluginsList();
 
$is_writable = is_writable($plugins_root);
 
# Installation d'un thème
if ($is_writable && !empty($_GET['tool_url']))
{
$tool_url = $_GET['tool_url'];
$parsed_url = parse_url($tool_url);
if (empty($parsed_url['scheme']) || !preg_match('/^http|ftp$/',$parsed_url['scheme'])
|| empty($parsed_url['host']) || empty($parsed_url['path']))
{
$err = __('URL is not valid.');
}
else
{
if (($err = $plugins->install($tool_url)) === true)
{
header('Location: tools.php?p=toolsmng');
exit;
}
}
}
 
# Changement de status d'un plugin
$switch = (!empty($_GET['switch'])) ? $_GET['switch'] : '';
 
if ($is_writable && $switch != '' && in_array($switch,array_keys($plugins_list)) && $switch != 'toolsmng')
{
$plugins->switchStatus($switch);
header('Location: tools.php?p=toolsmng');
exit;
}
 
# Suppression d'un thème
$delete = (!empty($_GET['delete'])) ? $_GET['delete'] : '';
 
if ($is_writable && $delete != '' && in_array($delete,array_keys($plugins_list)) && $delete != 'toolsmng')
{
files::deltree($plugins_root.'/'.$delete);
header('Location: tools.php?p=toolsmng');
exit;
}
 
if($err != '')
{
buffer::str(
'<div class="erreur"><p><strong>'.__('Error(s)').' :</strong></p>'.$err.'</div>'
);
}
 
buffer::str(
'<h2>'.__('Plugins manager').'</h2>'.
'<h3>'.__('Install a plugin').'</h3>'
);
 
if (!$is_writable)
{
buffer::str(
'<p>'.sprintf(__('The folder %s is not writable, please check its permissions.'),
DC_ECRIRE.'/tools/').'</p>'
);
}
else
{
buffer::str(
'<form action="tools.php" method="get">'.
'<p><label for="tool_url">'.__('Please give the URL (http or ftp) of the plugin\'s file').' :</label>'.
form::field('tool_url',50,'',$tool_url).'</p>'.
'<p><input type="submit" class="submit" value="'.__('install').'" />'.
'<input type="hidden" name="p" value="toolsmng" /></p>'.
'</form>'
);
}
 
buffer::str(
'<p><a href="http://www.wikini.net">'.__('Install new plugins').'</a></p>'
);
 
# Traduction des plugins
foreach ($plugins_list as $k => $v)
{
$plugins->loadl10n($k);
$plugins_list[$k]['label'] = __($v['label']);
$plugins_list[$k]['desc'] = __($v['desc']);
}
 
# Tri des plugins par leur nom
uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);'));
 
buffer::str(
'<h3>'.__('List of installed plugins').'</h3>'.
'<dl>'
);
 
foreach ($plugins_list as $k => $v)
{
buffer::str(
'<dt>'.__($v['label']).' - '.$k.'</dt>'.
'<dd>'.__($v['desc']).' <br />'.
'par '.$v['author'].' - '.__('version').' '.$v['version'].' <br />'
);
if ($k != 'toolsmng')
{
if (is_writable($plugins_root.$k.'/desc.xml')) {
$action = $v['active'] ? 'disable' : 'enable';
buffer::str('<a href="tools.php?p=toolsmng&switch='.$k.'">'.__($action).'</a>');
} else {
buffer::str('<em>'.sprintf(__('cannot enable/disable'),'desc.xml').'</em>');
}
if ($is_writable)
{
buffer::str(
' - <a href="tools.php?p=toolsmng&amp;delete='.$k.'" '.
'onclick="return window.confirm(\''.__('Are you sure you want to delete this plugin ?').'\')">'.
__('delete').'</a>'
);
}
}
buffer::str('</dd>');
}
buffer::str('</dl>');
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/toolsmng/icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/toolsmng/icon.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/wiki.php
New file
0,0 → 1,20
<?php
// Partie publique
 
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
// Surcharge methode GetUserName de la class Wiki
 
$wikiClasses [] = 'Hello';
$wikiClassesContent [] = '
 
function GetUserName() {
if ($user = $this->GetUser()) $name = $user["name"];
else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"];
return "Bonjour ".$name;
}
 
';
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/desc.xml
New file
0,0 → 1,6
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="wkhello" version="0.1" active="0">
<author>David Delon</author>
<label>Hello</label>
<desc>Extension exemple pour Wikini</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/index.php
New file
0,0 → 1,34
<?php
// index.php
// Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes
// opérations réservées à l'administrateur technique de Wikini.
 
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
// Affichage au moyen de la méthode statique buffer::str :
 
buffer::str(
'Parametrage de l\'extension Hello ...'.'<br />'
);
 
// Utilisation d'un objet Wiki pour acces à la base de donnée
 
$wiki=new Wiki($wakkaConfig);
 
buffer::str(
'Utilisateurs enregistrés : '.'<br />'
);
 
$last_users = $wiki->LoadAll("select name, signuptime from ".$wiki->config["table_prefix"]."users order by signuptime desc limit 10");
foreach($last_users as $user) {
buffer::str(
$user["name"]." . . . ".$user["signuptime"]."<br />\n"
);
}
 
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/actions/__hello.php
New file
0,0 → 1,17
<?php
/*
__hello.php
Appellé AVANT l'execution de l'action hello
*/
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
 
 
echo $this->Format("Je vais dire bonjour !");
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/actions/hello__.php
New file
0,0 → 1,17
<?php
/*
hello__.php
Appellé APRES l'execution de l'action hello
*/
 
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
 
echo $this->Format("J'ai dit bonjour !");
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/actions/hello.php
New file
0,0 → 1,17
<?php
/*
hello.php
Nouvelle action 'hello' ou remplace l'action hello si déjà présente
*/
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
 
 
echo $this->Format("Bonjour !");
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/handlers/page/hello.php
New file
0,0 → 1,30
<?php
/*
hello.php
Nouvel handler 'hello' ou remplace le handler hello si déjà présent
*/
 
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
 
echo $this->Format("===== Bonjour !=====");
 
if ($this->HasAccess("read"))
{
if (!$this->page)
{
return;
}
else
{
echo $this->Format($this->page["body"]);
}
}
 
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/handlers/page/__hello.php
New file
0,0 → 1,19
<?php
/*
__hello.php
Appelle AVANT le handler 'hello'
*/
 
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
echo $this->Header();
echo $this->Format("===== Je vais dire Bonjour !=====");
 
 
?>
<div class="page">
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/hello/handlers/page/hello__.php
New file
0,0 → 1,21
</div>
<?php
/*
hello__.php
Appelle APRES le handler 'hello'
*/
 
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
echo $this->Format("===== J'ai dit Bonjour !=====");
 
 
echo $this->Footer();
 
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/prepend.php
New file
0,0 → 1,130
<?php
 
// Vérification de sécurité
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
 
// Meme nom : remplace
// _Meme nom : avant
// Meme nom : _apres
 
 
require_once('libs/class.plugins.php');
 
 
Class WikiTools extends Wiki {
function Format($text, $formatter = "wakka") {
return $this->IncludeBuffered($formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"),$this->config['formatter_path']);
}
function IncludeBuffered($filename, $notfoundText = "", $vars = "", $path = "") {
if ($path) $dirs = explode(":", $path);
else $dirs = array("");
$included['before']=array();
$included['new']=array();
$included['after']=array();
foreach($dirs as $dir) {
if ($dir) $dir .= "/";
$fullfilename = $dir.$filename;
if (strstr($filename,'page/')) {
list($file,$extension) = explode("page/", $filename);
$beforefullfilename = $dir.$file.'page/__'.$extension;
}
else {
$beforefullfilename = $dir.'__'.$filename;
}
list($file,$extension) = explode(".", $filename);
$afterfullfilename = $dir.$file.'__.'.$extension;
if (file_exists($beforefullfilename)) {
$included['before'][]=$beforefullfilename;
}
if (file_exists($fullfilename)) {
$included['new'][]=$fullfilename;
}
if (file_exists($afterfullfilename)) {
$included['after'][]=$afterfullfilename;
}
}
 
$plugin_output_before='';
$plugin_output_new='';
$plugin_output_after='';
$found=0;
if (is_array($vars)) extract($vars);
foreach ($included['before'] as $before) {
$found=1;
ob_start();
include($before);
$plugin_output_before.= ob_get_contents();
ob_end_clean();
}
foreach ($included['new'] as $new) {
$found=1;
ob_start();
require($new);
$plugin_output_new = ob_get_contents();
ob_end_clean();
break;
}
foreach ($included['after'] as $after) {
$found=1;
ob_start();
include($after);
$plugin_output_after.= ob_get_contents();
ob_end_clean();
}
if ($found) return $plugin_output_before.$plugin_output_new.$plugin_output_after;
if ($notfoundText) return $notfoundText;
else return false;
}
}
 
$plugins_root = 'tools/';
 
$objPlugins = new plugins($plugins_root);
$objPlugins->getPlugins(true);
$plugins_list = $objPlugins->getPluginsList();
 
$wakkaConfig['formatter_path']='formatters';
$wikiClasses [] = 'WikiTools';
$wikiClassesContent [] = '';
 
foreach ($plugins_list as $k => $v) {
if (file_exists($plugins_root.$k.'/wiki.php')) {
include($plugins_root.$k.'/wiki.php');
}
if (file_exists($plugins_root.$k.'/actions')) {
$wakkaConfig['action_path']=$plugins_root.$k.'/actions/'.':'.$wakkaConfig['action_path'];
}
if (file_exists($plugins_root.$k.'/handlers')) {
$wakkaConfig['handler_path']=$plugins_root.$k.'/handlers/'.':'.$wakkaConfig['handler_path'];
}
if (file_exists($plugins_root.$k.'/formatters')) {
$wakkaConfig['formatter_path']=$plugins_root.$k.'/formatters/'.':'.$wakkaConfig['formatter_path'];
}
}
 
for ($iw=0;$iw<count($wikiClasses);$iw++) {
if ($wikiClasses[$iw]!='WikiTools') {
eval('Class '. $wikiClasses[$iw] .' extends '. $wikiClasses[$iw-1] . ' { '.$wikiClassesContent[$iw].' }; ');
}
}
 
//$wiki = new WikiTools($wakkaConfig);
eval ('$wiki = new '.$wikiClasses[count($wikiClasses)-1]. '($wakkaConfig);');
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/desc.xml
New file
0,0 → 1,6
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="wkattach" version="0.1" active="1">
<author>GarfieldFr</author>
<label>Attach</label>
<desc>Action permettant de joindre un fichier a Wikini</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/index.php
New file
0,0 → 1,12
<?php
// index.php
// Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes
// opérations réservées à l'administrateur technique de Wikini.
 
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/actions/attach.php
New file
0,0 → 1,121
<?php
/*
attach.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
* DOCUMENTATION
*******************************************************************************
RESUME
L'action {{attach}} permet de lier un fichier à une page, d'uploader ce fichier
et de downloader ce fichier. Si le fichier est une image, elle est affichée
dans la page. Lorsque le fichier est sur le serveur, il est possible de faire
une mise à jour de celui-ci.
 
PARAMETRES DE L'ACTION
L'action {{attach}} prend les paramètres suivants :
- file ou attachfile: nom du fichier tel qu'il sera sur le serveur. Les
espaces sont remplacé par des "_". (OBLIGATOIRE)
- desc ou attachdesc: description du fichier. C'est le texte qui sera affiché
comme lien vers le fichier ou dans l'attribut alt de la balise <img>. Ce
paramètre est obligatoire pour les images pour être conforme au XHTML.
- delete ou attachdelete: Si ce paramètre est non vide alors le fichier sera
effacé sur le serveur.
- link ou attachlink: URL de lien pour une image sensible. le lien peut être
un nom de page WikiNi, un lien interwiki ou une adresse http
- class: indique le nom de la ou les classes de style à utiliser pour afficher
l'image. les noms des classes sont séparés par un espace.
 
EXEMPLES
- Attacher un fichier archive:
{{attach file="archive.zip"}}
- Attacher un fichier archive avec une description
{{attach file="archive.zip" desc="Code source de l'application"}}
- Supprimer un fichier:
{{attach file="archive.zip" delete="y"}}
- Afficher une image:
{{attach file="image.png" desc="voici une image"}}
- Afficher une image sensible:
{{attach file="image.png" desc="voici une image" link="PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="WikiNi:PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="http://www.wikini.net"}}
- Afficher une image collé sur le bord droit et sans contour:
{{attach file="image.png" desc="voici une image" class="right noborder"}}
 
INSTALLATION
1) Copiez le fichier attach.php dans le répertoire des actions (/actions)
2) Copiez le fichier attach.class.php dans le répertoire des actions (/actions)
3) Copiez le fichier attachfm.php dans le repertoire des actions (/actions)
4) Copiez le fichier filamanager.php dans le répertoire des handlers (/handlers/page)
5) Copiez le fichier upload.php dans le répertoire des handlers (/handlers/page)
6) Copiez le fichier download.php dans le répertoire des handlers (/handlers/page)
7) Créez le répertoire racine des uploads sur le site du wiki. Si le SAFE_MODE
de PHP est activé, vous devez créer vous même ce répertoire et autoriser
l'écriture dans ce répertoire pour l'utilisateur et le groupe.
8) Ouvrez le fichier wakka.config.php et ajoutez la configuration de l'action.
Tous les paramètres de configuration ont une valeur par défaut.
Le configuration par défaut est:
 
$wakkaConfig["attach_config"] = array(
"upload_path" => 'files', //repertoire racine des uploads
"ext_images" => 'gif|jpeg|png|jpg', //extension des fichiers images
"ext_script" => 'php|php3|asp|asx|vb|vbs|js', //extension des script(non utilisé)
"update_symbole" => '*', //symbole pour faire un update du fichier
"max_file_size" => 1024*2000, //taille maximum du fichier en octer (2M par défaut)
"fmDelete_symbole" => 'Supr', //symbole a afficher pour le lien "supprimer" dans le gestionnaire de fichier
"fmRestore_symbole" => 'Rest', //symbole a afficher pour le lien "restaurer" dans le gestionnaire de fichier
"fmTrash_symbole" => 'Poubelle') //symbole a afficher pour le lien "Poubelle" dans le gestionnaire de fichier
 
9) Ajoutez les classes de style au fichier wakka.css. Exemple de style :
.attach_margin05em { margin: 0.5em;}
.attach_margin1em { margin: 1em;}
.attach_left {float: left;}
.attach_right {float: right;}
.attach_noborder {border-width: 0px;}
.attach_vmiddle {vertical-align: text-bottom;}
 
10)Pour configurer l'aspect du gestionnnaire de fichier utiliser les classes de style .tableFM
tableFMCol1 et tableFMCol2
Exemple :
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
*******************************************************************************/
 
if (!class_exists('attach')){
include('tools/attach/actions/attach.class.php');
}
$att = new attach($this);
$att->doAttach();
unset($att);
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/actions/attachfm.php
New file
0,0 → 1,38
<?php
/*
attachfm.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
 
*/
$url = $this->href('filemanager',$this->GetPageTag());
echo '<a href="'.$url.'"><span class="attachfm"><span>Gestion des fichiers attachés</span></span></a>';
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/actions/attach.class.php
New file
0,0 → 1,649
<?php
/*
attach.class.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Classe de gestion de l'action {{attach}}
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
class attach {
var $wiki = ''; //objet wiki courant
var $attachConfig = array(); //configuration de l'action
var $file = ''; //nom du fichier
var $desc = ''; //description du fichier
var $link = ''; //url de lien (image sensible)
var $isPicture = 0; //indique si c'est une image
var $isAudio = 0; //indique si c'est un fichier audio
var $classes = ''; //classe pour afficher une image
var $attachErr = ''; //message d'erreur
var $pageId = 0; //identifiant de la page
var $isSafeMode = false; //indicateur du safe mode de PHP
/**
* Constructeur. Met les valeurs par defaut aux paramètres de configuration
*/
function attach(&$wiki){
$this->wiki = $wiki;
$this->attachConfig = $this->wiki->GetConfigValue("attach_config");
if (empty($this->attachConfig["ext_images"])) $this->attachConfig["ext_images"] = "gif|jpeg|png|jpg";
if (empty($this->attachConfig["ext_audio"])) $this->attachConfig["ext_audio"] = "mp3";
if (empty($this->attachConfig["ext_script"])) $this->attachConfig["ext_script"] = "php|php3|asp|asx|vb|vbs|js";
if (empty($this->attachConfig['upload_path'])) $this->attachConfig['upload_path'] = 'files';
if (empty($this->attachConfig['update_symbole'])) $this->attachConfig['update_symbole'] = '*';
if (empty($this->attachConfig['max_file_size'])) $this->attachConfig['max_file_size'] = 1024*10000; //10000ko max
if (empty($this->attachConfig['fmDelete_symbole'])) $this->attachConfig['fmDelete_symbole'] = 'Supr';
if (empty($this->attachConfig['fmRestore_symbole'])) $this->attachConfig['fmRestore_symbole'] = 'Rest';
if (empty($this->attachConfig['fmTrash_symbole'])) $this->attachConfig['fmTrash_symbole'] = 'Poubelle';
$this->isSafeMode = ini_get("safe_mode");
}
/******************************************************************************
* FONCTIONS UTILES
*******************************************************************************/
/**
* Création d'une suite de répertoires récursivement
*/
function mkdir_recursif ($dir) {
if (strlen($dir) == 0) return 0;
if (is_dir($dir)) return 1;
elseif (dirname($dir) == $dir) return 1;
return ($this->mkdir_recursif(dirname($dir)) and mkdir($dir,0755));
}
/**
* Renvois le chemin du script
*/
function GetScriptPath () {
if (preg_match("/.(php)$/i",$_SERVER["PHP_SELF"])){
$a = explode('/',$_SERVER["PHP_SELF"]);
$a[count($a)-1] = '';
$path = implode('/',$a);
}else{
$path = $_SERVER["PHP_SELF"];
}
return !empty($_SERVER["HTTP_HOST"])? 'http://'.$_SERVER["HTTP_HOST"].$path : 'http://'.$_SERVER["SERVER_NAME"].$path ;
}
/**
* Calcul le repertoire d'upload en fonction du safe_mode
*/
function GetUploadPath(){
if ($this->isSafeMode) {
$path = $this->attachConfig['upload_path'];
}else{
$path = $this->attachConfig['upload_path'].'/'.$this->wiki->GetPageTag();
if (! is_dir($path)) $this->mkdir_recursif($path);
}
return $path;
}
/**
* Calcule le nom complet du fichier attaché en fonction du safe_mode, du nom et de la date de
* revision la page courante.
* Le nom du fichier "mon fichier.ext" attache à la page "LaPageWiki"sera :
* mon_fichier_datepage_update.ext
* update : date de derniere mise a jour du fichier
* datepage : date de revision de la page à laquelle le fichier a ete lié/mis a jour
* Si le fichier n'est pas une image un '_' est ajoute : mon_fichier_datepage_update.ext_
* Selon la valeur de safe_mode :
* safe_mode = on : LaPageWiki_mon_fichier_datepage_update.ext_
* safe_mode = off: LaPageWiki/mon_fichier_datepage_update.ext_ avec "LaPageWiki" un sous-repertoire du répertoire upload
*/
function GetFullFilename($newName = false){
$pagedate = $this->convertDate($this->wiki->page['time']);
//decompose le nom du fichier en nom+extension
if (preg_match('`^(.*)\.(.*)$`', str_replace(' ','_',$this->file), $match)){
list(,$file['name'],$file['ext'])=$match;
if(!$this->isPicture() && !$this->isAudio()) $file['ext'] .= '_';
}else{
return false;
}
//recuperation du chemin d'upload
$path = $this->GetUploadPath($this->isSafeMode);
//generation du nom ou recherche de fichier ?
if ($newName){
$full_file_name = $file['name'].'_'.$pagedate.'_'.$this->getDate().'.'.$file['ext'];
if($this->isSafeMode){
$full_file_name = $path.'/'.$this->wiki->GetPageTag().'_'.$full_file_name;
}else{
$full_file_name = $path.'/'.$full_file_name;
}
}else{
//recherche du fichier
if($this->isSafeMode){
//TODO Recherche dans le cas ou safe_mode=on
$searchPattern = '`^'.$this->wiki->GetPageTag().'_'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}else{
$searchPattern = '`^'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}
$files = $this->searchFiles($searchPattern,$path);
 
$unedate = 0;
foreach ($files as $file){
//recherche du fichier qui une datepage <= a la date de la page
if($file['datepage']<=$pagedate){
//puis qui a une dateupload la plus grande
if ($file['dateupload']>$unedate){
$theFile = $file;
$unedate = $file['dateupload'];
}
}
}
if (is_array($theFile)){
$full_file_name = $path.'/'.$theFile['realname'];
}
}
return $full_file_name;
}
/**
* Test si le fichier est une image
*/
function isPicture(){
return preg_match("/.(".$this->attachConfig["ext_images"].")$/i",$this->file)==1;
}
/**
* Test si le fichier est un fichier audio
*/
function isAudio(){
return preg_match("/.(".$this->attachConfig["ext_audio"].")$/i",$this->file)==1;
}
/**
* Renvoie la date courante au format utilise par les fichiers
*/
function getDate(){
return date('YmdHis');
}
/**
* convertie une date yyyy-mm-dd hh:mm:ss au format yyyymmddhhmmss
*/
function convertDate($date){
$date = str_replace(' ','', $date);
$date = str_replace(':','', $date);
return str_replace('-','', $date);
}
/**
* Parse une date au format yyyymmddhhmmss et renvoie un tableau assiatif
*/
function parseDate($sDate){
$pattern = '`^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$`';
$res = '';
if (preg_match($pattern, $sDate, $m)){
//list(,$res['year'],$res['month'],$res['day'],$res['hour'],$res['min'],$res['sec'])=$m;
$res = $m[1].'-'.$m[2].'-'.$m[3].' '.$m[4].':'.$m[5].':'.$m[6];
}
return ($res?$res:false);
}
/**
* Decode un nom long de fichier
*/
function decodeLongFilename($filename){
$afile = array();
$afile['realname'] = basename($filename);
$afile['size'] = filesize($filename);
$afile['path'] = dirname($filename);
if(preg_match('`^(.*)_(\d{14})_(\d{14})\.(.*)(trash\d{14})?$`', $afile['realname'], $m)){
$afile['name'] = $m[1];
//suppression du nom de la page si safe_mode=on
if ($this->isSafeMode){
$afile['name'] = preg_replace('`^('.$this->wiki->tag.')_(.*)$`i', '$2', $afile['name']);
}
$afile['datepage'] = $m[2];
$afile['dateupload'] = $m[3];
$afile['trashdate'] = preg_replace('`(.*)trash(\d{14})`', '$2', $m[4]);
//suppression de trashxxxxxxxxxxxxxx eventuel
$afile['ext'] = preg_replace('`^(.*)(trash\d{14})$`', '$1', $m[4]);
$afile['ext'] = rtrim($afile['ext'],'_');
//$afile['ext'] = rtrim($m[4],'_');
}
return $afile;
}
/**
* Renvois un tableau des fichiers correspondant au pattern. Chaque element du tableau est un
* tableau associatif contenant les informations sur le fichier
*/
function searchFiles($filepattern,$start_dir){
$files_matched = array();
$start_dir = rtrim($start_dir,'\/');
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '.')==0 || strcmp($file, '..')==0 || is_dir($file)) continue;
if (preg_match($filepattern, $file)){
$files_matched[] = $this->decodeLongFilename($start_dir.'/'.$file);
}
}
return $files_matched;
}
/******************************************************************************
* FONCTIONS D'ATTACHEMENTS
*******************************************************************************/
/**
* Test les paramètres passé à l'action
*/
function CheckParams(){
//recuperation des parametres necessaire
$this->file = $this->wiki->GetParameter("attachfile");
if (empty($this->file)) $this->file = $this->wiki->GetParameter("file");
$this->desc = $this->wiki->GetParameter("attachdesc");
if (empty($this->desc)) $this->desc = $this->wiki->GetParameter("desc");
$this->link = $this->wiki->GetParameter("attachlink");//url de lien - uniquement si c'est une image
if (empty($this->link)) $this->link = $this->wiki->GetParameter("link");
//test de validité des parametres
if (empty($this->file)){
$this->attachErr = $this->wiki->Format("//action attach : paramètre **file** manquant//---");
}
if ($this->isPicture() && empty($this->desc)){
$this->attachErr .= $this->wiki->Format("//action attach : paramètre **desc** obligatoire pour une image//---");
}
if ($this->wiki->GetParameter("class")) {
$array_classes = explode(" ", $this->wiki->GetParameter("class"));
foreach ($array_classes as $c) { $this->classes = $this->classes . "attach_" . $c . " "; }
$this->classes = trim($this->classes);
}
}
/**
* Affiche le fichier lié comme une image
*/
function showAsImage($fullFilename){
//c'est une image : balise <IMG..../>
$img = "<img src=\"".$this->GetScriptPath().$fullFilename."\" ".
"alt=\"".$this->desc.($this->link?"\nLien vers: $this->link":"")."\" />";
//test si c'est une image sensible
if(!empty($this->link)){
//c'est une image sensible
//test si le lien est un lien interwiki
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $this->link, $matches))
{ //modifie $link pour être un lien vers un autre wiki
$this->link = $this->wiki->GetInterWikiUrl($matches[1], $matches[2]);
}
//calcule du lien
$output = $this->wiki->Format('[['.$this->link." $this->file]]");
$output = eregi_replace(">$this->file<",">$img<",$output);//insertion du tag <img...> dans le lien
}else{
//ce n'est pas une image sensible
$output = $img;
}
$output = ($this->classes?"<span class=\"$this->classes\">$output</span>":$output);
echo $output;
$this->showUpdateLink();
}
/**
* Affiche le fichier lié comme un lien
*/
function showAsLink($fullFilename){
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=$this->file");
echo '<a href="'.$url.'">'.($this->desc?$this->desc:$this->file)."</a>";
$this->showUpdateLink();
}
// Affiche le fichier liee comme un fichier audio
function showAsAudio($fullFilename){
$output = "<object type=\"application/x-shockwave-flash\" data=\"tools/player/dewplayer.swf?son=$fullFilename&amp;bgcolor=FFFFFF\" width=\"200\"
height=\"20\"><param name=\"movie\" value=\"tools/player/dewplayer.swf?son=$fullFilename&amp;bgcolor=FFFFFF\"/></object>";
$output .= "<br></br>";
$output .="[<a href=\"$fullFilename\">mp3</a>]";
echo $output;
$this->showUpdateLink();
}
/**
* Affiche le lien de mise à jour
*/
function showUpdateLink(){
echo " <a href=\"".
$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file").
"\" title='Mise à jour'>".$this->attachConfig['update_symbole']."</a>";
}
/**
* Affiche un liens comme un fichier inexistant
*/
function showFileNotExits(){
echo $this->file."<a href=\"".$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file")."\">?</a>";
}
/**
* Affiche l'attachement
*/
function doAttach(){
$this->CheckParams();
if ($this->attachErr) {
echo $this->attachErr;
return;
}
$fullFilename = $this->GetFullFilename();
//test d'existance du fichier
if((!file_exists($fullFilename))||($fullFilename=='')){
$this->showFileNotExits();
return;
}
//le fichier existe : affichage en fonction du type
if($this->isPicture()){
$this->showAsImage($fullFilename);
}else{
if($this->isAudio()){
$this->showAsAudio($fullFilename);
}
else {
$this->showAsLink($fullFilename);
}
}
}
/******************************************************************************
* FONTIONS D'UPLOAD DE FICHIERS
*******************************************************************************/
/**
* Traitement des uploads
*/
function doUpload(){
$HasAccessWrite=$this->wiki->HasAccess("write");
if ($HasAccessWrite){
switch ($_SERVER["REQUEST_METHOD"]) {
case 'GET' : $this->showUploadForm(); break;
case 'POST': $this->performUpload(); break;
default : echo $this->wiki->Format("//Methode de requete invalide//---");
}
}else{
echo $this->wiki->Format("//Vous n'avez pas l'accès en écriture à cette page//---");
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
}
/**
* Formulaire d'upload
*/
function showUploadForm(){
echo $this->wiki->Format("====Formulaire d'envois de fichier====\n---");
$this->file = $_GET['file'];
echo $this->wiki->Format("**Envois du fichier $this->file :**\n")
."<form enctype=\"multipart/form-data\" name=\"frmUpload\" method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">\n"
." <input type=\"hidden\" name=\"wiki\" value=\"".$this->wiki->GetPageTag()."/upload\" />\n"
." <input TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$this->attachConfig['max_file_size']."\" />\n"
." <input type=\"hidden\" name=\"file\" value=\"$this->file\" />\n"
." <input type=\"file\" name=\"upFile\" size=\"50\" /><br />\n"
." <input type=\"submit\" value=\"Envoyer\" />\n"
."</form>\n";
}
/**
* Execute l'upload
*/
function performUpload(){
$this->file = $_POST['file'];
 
$destFile = $this->GetFullFilename(true); //nom du fichier destination
//test de la taille du fichier recu
if($_FILES['upFile']['error']==0){
$size = filesize($_FILES['upFile']['tmp_name']);
if ($size > $this->attachConfig['max_file_size']){
$_FILES['upFile']['error']=2;
}
}
switch ($_FILES['upFile']['error']){
case 0:
$srcFile = $_FILES['upFile']['tmp_name'];
if (move_uploaded_file($srcFile,$destFile)){
chmod($destFile,0644);
header("Location: ".$this->wiki->href("",$this->wiki->GetPageTag(),""));
}else{
echo $this->wiki->Format("//Erreur lors du déplacement du fichier temporaire//---");
}
break;
case 1:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de upload_max_filesize, configuré dans le php.ini.//---");
break;
case 2:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de MAX_FILE_SIZE, qui a été spécifiée dans le formulaire HTML.//---");
break;
case 3:
echo $this->wiki->Format("//Le fichier n'a été que partiellement téléchargé.//---");
break;
case 4:
echo $this->wiki->Format("//Aucun fichier n'a été téléchargé.//---");
break;
}
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
/******************************************************************************
* FUNCTIONS DE DOWNLOAD DE FICHIERS
*******************************************************************************/
function doDownload(){
$this->file = $_GET['file'];
$fullFilename = $this->GetUploadPath().'/'.$this->file;
if(!file_exists($fullFilename)){
$fullFilename = $this->GetFullFilename();
$dlFilename = $this->file;
$size = filesize($fullFilename);
}else{
$file = $this->decodeLongFilename($fullFilename);
$size = $file['size'];
$dlFilename =$file['name'].'.'.$file['ext'];
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/force-download");
header('Pragma: public');
header("Pragma: no-cache");// HTTP/1.0
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octet-stream; name="' . $dlFilename . '"'); //This should work for the rest
header('Content-Type: application/octetstream; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Type: application/download; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Disposition: attachment; filename="'.$dlFilename.'"');
header("Content-Description: File Transfer");
header("Content-length: $size".'bytes');
readfile($fullFilename);
}
/******************************************************************************
* FONTIONS DU FILEMANAGER
*******************************************************************************/
function doFileManager(){
$do = $_GET['do']?$_GET['do']:'';
switch ($do){
case 'restore' :
$this->fmRestore();
$this->fmShow(true);
break;
case 'erase' :
$this->fmErase();
$this->fmShow(true);
break;
case 'del' :
$this->fmDelete();
$this->fmShow();
break;
case 'trash' :
$this->fmShow(true); break;
case 'emptytrash' :
$this->fmEmptyTrash(); //pas de break car apres un emptytrash => retour au gestionnaire
default :
$this->fmShow();
}
}
/**
* Affiche la liste des fichiers
*/
function fmShow($trash=false){
$fmTitlePage = $this->wiki->Format("====Gestion des fichiers attachés à la page ".$this->wiki->tag."====\n---");
if($trash){
//Avertissement
$fmTitlePage .= '<div class="prev_alert">Les fichiers effacés sur cette page le sont définitivement</div>';
//Pied du tableau
$url = $this->wiki->Link($this->wiki->tag,'filemanager','Gestion des fichiers');
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n";
$url = $this->wiki->Link($this->wiki->tag,'filemanager&do=emptytrash','Vider la poubelle');
$fmFootTable.= ' <td>'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}else{
//pied du tableau
$url = '<a href="'.$this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=trash').'" title="Poubelle">'.$this->attachConfig['fmTrash_symbole']."</a>";
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}
//entete du tableau
$fmHeadTable = ' <thead>'."\n".
' <tr>'."\n".
' <td>&nbsp;</td>'."\n".
' <td>Nom du fichier</td>'."\n".
' <td>Nom réel du fichier</td>'."\n".
' <td>Taille</td>'."\n".
' <td>Révision de la page</td>'."\n".
' <td>Révison du fichier</td>'."\n";
if($trash){
$fmHeadTable.= ' <td>Suppression</td>'."\n";
}
$fmHeadTable.= ' </tr>'."\n".
' </thead>'."\n";
//corps du tableau
$files = $this->fmGetFiles($trash);
$files = $this->sortByNameRevFile($files);
 
$fmBodyTable = ' <tbody>'."\n";
$i = 0;
foreach ($files as $file){
$i++;
$color= ($i%2?"tableFMCol1":"tableFMCol2");
//lien de suppression
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=erase&file='.$file['realname']);
}else{
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=del&file='.$file['realname']);
}
$dellink = '<a href="'.$url.'" title="Supprimer">'.$this->attachConfig['fmDelete_symbole']."</a>";
//lien de restauration
$restlink = '';
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=restore&file='.$file['realname']);
$restlink = '<a href="'.$url.'" title="Restaurer">'.$this->attachConfig['fmRestore_symbole']."</a>";
}
 
//lien pour downloader le fichier
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=".$file['realname']);
$dlLink = '<a href="'.$url.'">'.$file['name'].'.'.$file['ext']."</a>";
$fmBodyTable .= ' <tr class="'.$color.'">'."\n".
' <td>'.$dellink.' '.$restlink.'</td>'."\n".
' <td>'.$dlLink.'</td>'."\n".
' <td>'.$file['realname'].'</td>'."\n".
' <td>'.$file['size'].'</td>'."\n".
' <td>'.$this->parseDate($file['datepage']).'</td>'."\n".
' <td>'.$this->parseDate($file['dateupload']).'</td>'."\n";
if($trash){
$fmBodyTable.= ' <td>'.$this->parseDate($file['trashdate']).'</td>'."\n";
}
$fmBodyTable .= ' </tr>'."\n";
}
$fmBodyTable .= ' </tbody>'."\n";
//pied de la page
$fmFooterPage = "---\n-----\n[[".$this->wiki->tag." Retour à la page ".$this->wiki->tag."]]\n";
//affichage
echo $fmTitlePage."\n";
echo '<table class="tableFM" border="0" cellspacing="0">'."\n".$fmHeadTable.$fmFootTable.$fmBodyTable.'</table>'."\n";
echo $this->wiki->Format($fmFooterPage);
}
/**
* Renvoie la liste des fichiers
*/
function fmGetFiles($trash=false){
$path = $this->GetUploadPath();
if($this->isSafeMode){
$filePattern = '^'.$this->wiki->GetPageTag().'_.*_\d{14}_\d{14}\..*';
}else{
$filePattern = '^.*_\d{14}_\d{14}\..*';
}
if($trash){
$filePattern .= 'trash\d{14}';
}else{
$filePattern .= '[^(trash\d{14})]';
}
return $this->searchFiles('`'.$filePattern.'$`', $path);
}
/**
* Vide la poubelle
*/
function fmEmptyTrash(){
$files = $this->fmGetFiles(true);
foreach ($files as $file){
$filename = $file['path'].'/'.$file['realname'];
if(file_exists($filename)){
unlink($filename);
}
}
}
/**
* Effacement d'un fichier dans la poubelle
*/
function fmErase(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
unlink($filename);
}
}
/**
* Met le fichier a la poubelle
*/
function fmDelete(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$trash = $filename.'trash'.$this->getDate();
rename($filename, $trash);
}
}
/**
* Restauration d'un fichier mis a la poubelle
*/
function fmRestore(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$restFile = preg_replace('`^(.*\..*)trash\d{14}$`', '$1', $filename);
rename($filename, $restFile);
}
}
/**
* Tri tu tableau liste des fichiers par nom puis par date de revision(upload) du fichier, ordre croissant
*/
function sortByNameRevFile($files){
if (!function_exists('ByNameByRevFile')){
function ByNameByRevFile($f1,$f2){
$f1Name = $f1['name'].'.'.$f1['ext'];
$f2Name = $f2['name'].'.'.$f2['ext'];
$res = strcasecmp($f1Name, $f2Name);
if($res==0){
//si meme nom => compare la revision du fichier
$res = strcasecmp($f1['dateupload'], $f2['dateupload']);
}
return $res;
}
}
usort($files,'ByNameByRevFile');
return $files;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/handlers/page/filemanager.php
New file
0,0 → 1,58
<?php
/*
filemanager.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le gestion des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if($this->UserIsOwner()){
if (!class_exists('attach')){
include('tools/attach/actions/attach.class.php');
}
$att = new attach($this);
$att->doFilemanager();
unset($att);
}else{
echo $this->Format("//Seul le propriétaire de cette page peut accéder au gestionnaire des fichiers attaché//");
}
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/handlers/page/upload.php
New file
0,0 → 1,55
<?php
/*
upload.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute l'upload des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if (!class_exists('attach')){
include('tools/attach/actions/attach.class.php');
}
$att = new attach($this);
$att->doUpload();
unset($att);
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/attach/handlers/page/download.php
New file
0,0 → 1,48
<?php
/*
download.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le download des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
if (!class_exists('attach')){
include('tools/attach/actions/attach.class.php');
}
$att = new attach($this);
$att->doDownload();
unset($att);
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/Auth/Frontend/Html.php
New file
0,0 → 1,142
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
 
/**
* Standard Html Login form
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id$
* @link http://pear.php.net/package/Auth
* @since File available since Release 1.3.0
*/
 
/**
* Standard Html Login form
*
* @category Authentication
* @package Auth
* @author Yavor Shahpasov <yavo@netsmart.com.cy>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version Release: @package_version@ File: $Revision$
* @link http://pear.php.net/package/Auth
* @since Class available since Release 1.3.0
*/
class Auth_Frontend_Html {
// {{{ render()
 
/**
* Displays the login form
*
* @param object The calling auth instance
* @param string The previously used username
* @return void
*/
function render(&$caller, $username = '') {
$loginOnClick = 'return true;';
// Try To Use Challene response
// TODO javascript might need some improvement for work on other browsers
if($caller->advancedsecurity && $caller->storage->supportsChallengeResponse() ) {
 
// Init the secret cookie
$caller->session['loginchallenege'] = md5(microtime());
 
print "\n";
print '<script language="JavaScript">'."\n";
 
include 'Auth/Frontend/md5.js';
 
print "\n";
print ' function securePassword() { '."\n";
print ' var pass = document.getElementById(\''.$caller->getPostPasswordField().'\');'."\n";
print ' var secret = document.getElementById(\'authsecret\')'."\n";
//print ' alert(pass);alert(secret); '."\n";
 
// If using md5 for password storage md5 the password before
// we hash it with the secret
// print ' alert(pass.value);';
if ($caller->storage->getCryptType() == 'md5' ) {
print ' pass.value = hex_md5(pass.value); '."\n";
#print ' alert(pass.value);';
}
 
print ' pass.value = hex_md5(pass.value+\''.$caller->session['loginchallenege'].'\'); '."\n";
// print ' alert(pass.value);';
print ' secret.value = 1;'."\n";
print ' var doLogin = document.getElementById(\'doLogin\')'."\n";
print ' doLogin.disabled = true;'."\n";
print ' return true;';
print ' } '."\n";
print '</script>'."\n";;
print "\n";
 
$loginOnClick = ' return securePassword(); ';
}
 
print '<center>'."\n";
 
$status = '';
if (!empty($caller->status) && $caller->status == AUTH_EXPIRED) {
$status = '<i>Your session has expired. Please login again!</i>'."\n";
} else if (!empty($caller->status) && $caller->status == AUTH_IDLED) {
$status = '<i>You have been idle for too long. Please login again!</i>'."\n";
} else if (!empty ($caller->status) && $caller->status == AUTH_WRONG_LOGIN) {
$status = '<i>Wrong login data!</i>'."\n";
} else if (!empty ($caller->status) && $caller->status == AUTH_SECURITY_BREACH) {
$status = '<i>Security problem detected. </i>'."\n";
}
print '<form method="post" action="'.$caller->server['PHP_SELF'].'" '
.'onSubmit="'.$loginOnClick.'">'."\n";
print '<table border="0" cellpadding="2" cellspacing="0" '
.'summary="login form" align="center" >'."\n";
print '<tr>'."\n";
print ' <td colspan="2" bgcolor="#eeeeee"><strong>Login </strong>'
.$status.'</td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
print ' <td>Username:</td>'."\n";
print ' <td><input type="text" id="'.$caller->getPostUsernameField()
.'" name="'.$caller->getPostUsernameField().'" value="' . $username
.'" /></td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
print ' <td>Password:</td>'."\n";
print ' <td><input type="password" id="'.$caller->getPostPasswordField()
.'" name="'.$caller->getPostPasswordField().'" /></td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
//onClick=" '.$loginOnClick.' "
print ' <td colspan="2" bgcolor="#eeeeee"><input value="Login" '
.'id="doLogin" name="doLogin" type="submit" /></td>'."\n";
print '</tr>'."\n";
print '</table>'."\n";
 
// Might be a good idea to make the variable name variable
print '<input type="hidden" id="authsecret" name="authsecret" value="" />';
print '</form>'."\n";
print '</center>'."\n";
}
 
// }}}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/lib.buffer.php
New file
0,0 → 1,46
<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2004 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DotClear 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 DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ***** END LICENSE BLOCK *****
 
class buffer
{
function init()
{
$GLOBALS['__dc_buffer'] = NULL;
}
function clean()
{
$GLOBALS['__dc_buffer'] = NULL;
}
function getContent()
{
return $GLOBALS['__dc_buffer'];
}
function str($str)
{
$GLOBALS['__dc_buffer'] .= $str;
}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/Auth.php
New file
0,0 → 1,1093
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
 
/**
* The main include file for Auth package
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id$
* @link http://pear.php.net/package/Auth
*/
 
/**
* Returned if session exceeds idle time
*/
define('AUTH_IDLED', -1);
/**
* Returned if session has expired
*/
define('AUTH_EXPIRED', -2);
/**
* Returned if container is unable to authenticate user/password pair
*/
define('AUTH_WRONG_LOGIN', -3);
/**
* Returned if a container method is not supported.
*/
define('AUTH_METHOD_NOT_SUPPORTED', -4);
/**
* Returned if new Advanced security system detects a breach
*/
define('AUTH_SECURITY_BREACH', -5);
 
/**
* PEAR::Auth
*
* The PEAR::Auth class provides methods for creating an
* authentication system using PHP.
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version Release: @package_version@ File: $Revision$
* @link http://pear.php.net/package/Auth
*/
class Auth {
 
// {{{ properties
 
/**
* Auth lifetime in seconds
*
* If this variable is set to 0, auth never expires
*
* @var integer
* @see setExpire(), checkAuth()
*/
var $expire = 0;
 
/**
* Has the auth session expired?
*
* @var bool
* @see checkAuth()
*/
var $expired = false;
 
/**
* Maximum idletime in seconds
*
* The difference to $expire is, that the idletime gets
* refreshed each time checkAuth() is called. If this
* variable is set to 0, idletime is never checked.
*
* @var integer
* @see setIdle(), checkAuth()
*/
var $idle = 0;
 
/**
* Is the maximum idletime over?
*
* @var boolean
* @see checkAuth()
*/
var $idled = false;
 
/**
* Storage object
*
* @var object
* @see Auth(), validateLogin()
*/
var $storage = '';
 
/**
* User-defined function that creates the login screen
*
* @var string
*/
var $loginFunction = '';
 
/**
* Should the login form be displayed
*
* @var bool
* @see setShowlogin()
*/
var $showLogin = true;
/**
* Is Login Allowed from this page
*
* @var bool
* @see setAllowLogin
*/
var $allowLogin = true;
 
/**
* Current authentication status
*
* @var string
*/
var $status = '';
 
/**
* Username
*
* @var string
*/
var $username = '';
 
/**
* Password
*
* @var string
*/
var $password = '';
 
/**
* Login callback function name
*
* @var string
* @see setLoginCallback()
*/
var $loginCallback = '';
 
/**
* Failed Login callback function name
*
* @var string
* @see setFailedLoginCallback()
*/
var $loginFailedCallback = '';
 
/**
* Logout callback function name
*
* @var string
* @see setLogoutCallback()
*/
var $logoutCallback = '';
 
/**
* Auth session-array name
*
* @var string
*/
var $_sessionName = '_authsession';
 
/**
* Package Version
*
* @var string
*/
var $version = "@version@";
 
/**
* Flag to use advanced security
* When set extra checks will be made to see if the
* user's IP or useragent have changed across requests.
* Turned off by default to preserve BC.
*
* @var boolean
*/
var $advancedsecurity = false;
 
/**
* Username key in POST array
*
* @var string
*/
var $_postUsername = 'username';
 
/**
* Password key in POST array
*
* @var string
*/
var $_postPassword = 'password';
 
/**
* Holds a reference to the session auth variable
* @var array
*/
var $session;
 
/**
* Holds a reference to the global server variable
* @var array
*/
var $server;
 
/**
* Holds a reference to the global post variable
* @var array
*/
var $post;
 
/**
* Holds a reference to the global cookie variable
* @var array
*/
var $cookie;
 
/**
* A hash to hold various superglobals as reference
* @var array
*/
var $authdata;
/**
* How many times has checkAuth been called
* var int
*/
var $authChecks = 0;
 
// }}}
// {{{ Auth() [constructor]
 
/**
* Constructor
*
* Set up the storage driver.
*
* @param string Type of the storage driver
* @param mixed Additional options for the storage driver
* (example: if you are using DB as the storage
* driver, you have to pass the dsn string here)
*
* @param string Name of the function that creates the login form
* @param boolean Should the login form be displayed if neccessary?
* @return void
*/
function Auth($storageDriver, $options = '', $loginFunction = '', $showLogin = true)
{
$this->applyAuthOptions($options);
 
// Start the session suppress error if already started
if(!session_id()){
@session_start();
if(!session_id()) {
// Throw error
include_once 'PEAR.php';
PEAR::throwError('Session could not be started by Auth, '
.'possibly headers are already sent, try putting '
.'ob_start in the beginning of your script');
}
}
 
// Make Sure Auth session variable is there
if( !isset($_SESSION[$this->_sessionName])
&& !isset($GLOBALS['HTTP_SESSION_VARS'][$this->_sessionName])) {
isset($_SESSION)
? $_SESSION[$this->_sessionName] = array()
: $GLOBALS['HTTP_SESSION_VARS'][$this->_sessionName] = array();
}
 
// Assign Some globals to internal references, this will replace _importGlobalVariable
isset($_SESSION)
? $this->session =& $_SESSION[$this->_sessionName]
: $this->session =& $GLOBALS['HTTP_SESSION_VARS'][$this->_sessionName] ;
isset($_SERVER)
? $this->server =& $_SERVER
: $this->server =& $GLOBALS['HTTP_SERVER_VARS'];
isset($_POST)
? $this->post =& $_POST
: $this->post =& $GLOBALS['HTTP_POST_VARS'];
isset($_COOKIE)
? $this->cookie =& $_COOKIE
: $this->cookie =& $GLOBALS['HTTP_COOKIE_VARS'];
//isset($_GET) ? $var = &$_GET : $var = &$GLOBALS['HTTP_GET_VARS'];
 
if ($loginFunction != '' && is_callable($loginFunction)) {
$this->loginFunction = $loginFunction;
}
 
if (is_bool($showLogin)) {
$this->showLogin = $showLogin;
}
 
if (is_object($storageDriver)) {
$this->storage =& $storageDriver;
// Pass a reference to auth to the container, ugly but works
// this is used by the DB container to use method setAuthData not staticaly.
$this->storage->_auth_obj =& $this;
} else {
// $this->storage = $this->_factory($storageDriver, $options);
//
$this->storage_driver = $storageDriver;
$this->storage_options =& $options;
}
}
 
// }}}
// {{{ applyAuthOptions()
 
/**
* Set the Auth options
*
* Some options which are Auth specific will be applied
* the rest will be left for usage by the container
*
* @param array An array of Auth options
* @return array The options which were not applied
* @access private
*/
function &applyAuthOptions(&$options)
{
if(is_array($options)){
if (!empty($options['sessionName'])) {
$this->_sessionName = $options['sessionName'];
unset($options['sessionName']);
}
if (isset($options['allowLogin'])) {
$this->allowLogin = $options['allowLogin'];
unset($options['allowLogin']);
}
if (!empty($options['postUsername'])) {
$this->_postUsername = $options['postUsername'];
unset($options['postUsername']);
}
if (!empty($options['postPassword'])) {
$this->_postPassword = $options['postPassword'];
unset($options['postPassword']);
}
if (isset($options['advancedsecurity'])) {
$this->advancedsecurity = $options['advancedsecurity'];
unset($options['advancedsecurity']);
}
}
return($options);
}
 
// }}}
// {{{ _loadStorage()
/**
* Load Storage Driver if not already loaded
*
* Suspend storage instantiation to make Auth lighter to use
* for calls which do not require login
*
* @return bool True if the conainer is loaded, false if the container
* is already loaded
* @access private
*/
function _loadStorage()
{
if(!is_object($this->storage)) {
$this->storage =& $this->_factory($this->storage_driver,
$this->storage_options);
$this->storage->_auth_obj =& $this;
return(true);
}
return(false);
}
 
// }}}
// {{{ _factory()
 
/**
* Return a storage driver based on $driver and $options
*
* @static
* @param string $driver Type of storage class to return
* @param string $options Optional parameters for the storage class
* @return object Object Storage object
* @access private
*/
function &_factory($driver, $options = '')
{
$storage_class = 'Auth_Container_' . $driver;
include_once $driver . '.php';
$obj =& new $storage_class($options);
return $obj;
}
 
// }}}
// {{{ assignData()
 
/**
* Assign data from login form to internal values
*
* This function takes the values for username and password
* from $HTTP_POST_VARS/$_POST and assigns them to internal variables.
* If you wish to use another source apart from $HTTP_POST_VARS/$_POST,
* you have to derive this function.
*
* @global $HTTP_POST_VARS, $_POST
* @see Auth
* @return void
* @access private
*/
function assignData()
{
if ( isset($this->post[$this->_postUsername])
&& $this->post[$this->_postUsername] != '') {
$this->username = (get_magic_quotes_gpc() == 1
? stripslashes($this->post[$this->_postUsername])
: $this->post[$this->_postUsername]);
}
if ( isset($this->post[$this->_postPassword])
&& $this->post[$this->_postPassword] != '') {
$this->password = (get_magic_quotes_gpc() == 1
? stripslashes($this->post[$this->_postPassword])
: $this->post[$this->_postPassword] );
}
}
 
// }}}
// {{{ start()
 
/**
* Start new auth session
*
* @return void
* @access public
*/
function start()
{
$this->assignData();
if (!$this->checkAuth() && $this->allowLogin) {
$this->login();
}
}
 
// }}}
// {{{ login()
 
/**
* Login function
*
* @return void
* @access private
*/
function login()
{
$login_ok = false;
$this->_loadStorage();
// Check if using challenge response
(isset($this->post['authsecret']) && $this->post['authsecret'] == 1)
? $usingChap = true
: $usingChap = false;
 
// When the user has already entered a username, we have to validate it.
if (!empty($this->username)) {
if (true === $this->storage->fetchData($this->username, $this->password, $usingChap)) {
$this->session['challengekey'] = md5($this->username.$this->password);
$login_ok = true;
}
}
 
if (!empty($this->username) && $login_ok) {
$this->setAuth($this->username);
if (is_callable($this->loginCallback)) {
call_user_func_array($this->loginCallback, array($this->username, $this));
}
}
 
// If the login failed or the user entered no username,
// output the login screen again.
if (!empty($this->username) && !$login_ok) {
$this->status = AUTH_WRONG_LOGIN;
if (is_callable($this->loginFailedCallback)) {
call_user_func_array($this->loginFailedCallback, array($this->username, $this));
}
}
 
if ((empty($this->username) || !$login_ok) && $this->showLogin) {
if (is_callable($this->loginFunction)) {
call_user_func_array($this->loginFunction, array($this->username, $this->status, $this));
} else {
// BC fix Auth used to use drawLogin for this
// call is sub classes implement this
if (is_callable(array($this, 'drawLogin'))) {
return $this->drawLogin($this->username, $this);
}
 
// New Login form
include_once 'Html.php';
return Auth_Frontend_Html::render($this, $this->username);
}
} else {
return;
}
}
 
// }}}
// {{{ setExpire()
 
/**
* Set the maximum expire time
*
* @param integer time in seconds
* @param bool add time to current expire time or not
* @return void
* @access public
*/
function setExpire($time, $add = false)
{
$add ? $this->expire += $time : $this->expire = $time;
}
 
// }}}
// {{{ setIdle()
 
/**
* Set the maximum idle time
*
* @param integer time in seconds
* @param bool add time to current maximum idle time or not
* @return void
* @access public
*/
function setIdle($time, $add = false)
{
$add ? $this->idle += $time : $this->idle = $time;
}
 
// }}}
// {{{ setSessionName()
 
/**
* Set name of the session to a customized value.
*
* If you are using multiple instances of PEAR::Auth
* on the same domain, you can change the name of
* session per application via this function.
* This will chnage the name of the session variable
* auth uses to store it's data in the session
*
* @param string New name for the session
* @return void
* @access public
*/
function setSessionName($name = 'session')
{
$this->_sessionName = '_auth_'.$name;
isset($_SESSION)
? $this->session =& $_SESSION[$this->_sessionName]
: $this->session =& $GLOBALS['HTTP_SESSION_VARS'][$this->_sessionName] ;
}
 
// }}}
// {{{ setShowLogin()
 
/**
* Should the login form be displayed if neccessary?
*
* @param bool show login form or not
* @return void
* @access public
*/
function setShowLogin($showLogin = true)
{
$this->showLogin = $showLogin;
}
 
// }}}
// {{{ setAllowLogin()
 
/**
* Should the login form be displayed if neccessary?
*
* @param bool show login form or not
* @return void
* @access public
*/
function setAllowLogin($allowLogin = true)
{
$this->allowLogin = $allowLogin;
}
 
// }}}
// {{{ setLoginCallback()
/**
* Register a callback function to be called on user login.
* The function will receive two parameters, the username and a reference to the auth object.
*
* @param string callback function name
* @return void
* @see setLogoutCallback()
* @access public
*/
function setLoginCallback($loginCallback)
{
$this->loginCallback = $loginCallback;
}
 
// }}}
// {{{ setFailedLoginCallback()
 
/**
* Register a callback function to be called on failed user login.
* The function will receive a single parameter, the username and a reference to the auth object.
*
* @param string callback function name
* @return void
* @access public
*/
function setFailedLoginCallback($loginFailedCallback)
{
$this->loginFailedCallback = $loginFailedCallback;
}
 
// }}}
// {{{ setLogoutCallback()
 
/**
* Register a callback function to be called on user logout.
* The function will receive three parameters, the username and a reference to the auth object.
*
* @param string callback function name
* @return void
* @see setLoginCallback()
* @access public
*/
function setLogoutCallback($logoutCallback)
{
$this->logoutCallback = $logoutCallback;
}
 
// }}}
// {{{ setAuthData()
 
/**
* Register additional information that is to be stored
* in the session.
*
* @param string Name of the data field
* @param mixed Value of the data field
* @param boolean Should existing data be overwritten? (default
* is true)
* @return void
* @access public
*/
function setAuthData($name, $value, $overwrite = true)
{
if (!empty($this->session['data'][$name]) && $overwrite == false) {
return;
}
$this->session['data'][$name] = $value;
}
 
// }}}
// {{{ getAuthData()
 
/**
* Get additional information that is stored in the session.
*
* If no value for the first parameter is passed, the method will
* return all data that is currently stored.
*
* @param string Name of the data field
* @return mixed Value of the data field.
* @access public
*/
function getAuthData($name = null)
{
if (!isset($this->session['data'])) {
return null;
}
if(!isset($name)) {
return $this->session['data'];
}
if (isset($name) && isset($this->session['data'][$name])) {
return $this->session['data'][$name];
}
return null;
}
 
// }}}
// {{{ setAuth()
 
/**
* Register variable in a session telling that the user
* has logged in successfully
*
* @param string Username
* @return void
* @access public
*/
function setAuth($username)
{
// #2021 - Change the session id to avoid session fixation attacks php 4.3.3 >
// session_regenerate_id(true);
 
if (!isset($this->session) || !is_array($this->session)) {
$this->session = array();
}
 
if (!isset($this->session['data'])) {
$this->session['data'] = array();
}
 
$this->session['sessionip'] = isset($this->server['REMOTE_ADDR'])
? $this->server['REMOTE_ADDR']
: '';
$this->session['sessionuseragent'] = isset($this->server['HTTP_USER_AGENT'])
? $this->server['HTTP_USER_AGENT']
: '';
 
// This should be set by the container to something more safe
// Like md5(passwd.microtime)
if(empty($this->session['challengekey'])) {
$this->session['challengekey'] = md5($username.microtime());
}
 
$this->session['challengecookie'] = md5($this->session['challengekey'].microtime());
setcookie('authchallenge', $this->session['challengecookie']);
 
$this->session['registered'] = true;
$this->session['username'] = $username;
$this->session['timestamp'] = time();
$this->session['idle'] = time();
}
 
// }}}
// {{{ setAdvancedSecurity()
/**
* Enables advanced security checks
*
* Currently only ip change and useragent change
* are detected
* @todo Add challenge cookies - Create a cookie which changes every time
* and contains some challenge key which the server can verify with
* a session var cookie might need to be crypted (user pass)
* @param bool Enable or disable
* @return void
* @access public
*/
function setAdvancedSecurity($flag=true)
{
$this->advancedsecurity = $flag;
}
 
// }}}
// {{{ checkAuth()
 
/**
* Checks if there is a session with valid auth information.
*
* @access public
* @return boolean Whether or not the user is authenticated.
*/
function checkAuth()
{
$this->authChecks++;
if (isset($this->session)) {
// Check if authentication session is expired
if ( $this->expire > 0
&& isset($this->session['timestamp'])
&& ($this->session['timestamp'] + $this->expire) < time()) {
$this->expired = true;
$this->status = AUTH_EXPIRED;
$this->logout();
return false;
}
 
// Check if maximum idle time is reached
if ( $this->idle > 0
&& isset($this->session['idle'])
&& ($this->session['idle'] + $this->idle) < time()) {
$this->idled = true;
$this->status = AUTH_IDLED;
$this->logout();
return false;
}
 
if ( isset($this->session['registered'])
&& isset($this->session['username'])
&& $this->session['registered'] == true
&& $this->session['username'] != '') {
Auth::updateIdle();
 
if ($this->advancedsecurity) {
// Only Generate the challenge once
if($this->authChecks == 1) {
$this->session['challengecookieold'] = $this->session['challengecookie'];
$this->session['challengecookie'] = md5($this->session['challengekey'].microtime());
setcookie('authchallenge', $this->session['challengecookie']);
}
// Check for ip change
if ( isset($this->server['REMOTE_ADDR'])
&& $this->session['sessionip'] != $this->server['REMOTE_ADDR']) {
// Check if the IP of the user has changed, if so we
// assume a man in the middle attack and log him out
$this->expired = true;
$this->status = AUTH_SECURITY_BREACH;
$this->logout();
return false;
}
// Check for useragent change
if ( isset($this->server['HTTP_USER_AGENT'])
&& $this->session['sessionuseragent'] != $this->server['HTTP_USER_AGENT']) {
// Check if the User-Agent of the user has changed, if
// so we assume a man in the middle attack and log him out
$this->expired = true;
$this->status = AUTH_SECURITY_BREACH;
$this->logout();
return false;
}
// Check challenge cookie here, if challengecookieold is not set
// this is the first time and check is skipped
// TODO when user open two pages similtaneuly (open in new window,open
// in tab) auth breach is caused find out a way around that if possible
if ( isset($this->session['challengecookieold'])
&& $this->session['challengecookieold'] != $this->cookie['authchallenge']) {
$this->expired = true;
$this->status = AUTH_SECURITY_BREACH;
$this->logout();
$this->login();
return false;
}
}
 
return true;
}
}
return false;
}
 
// }}}
// {{{ staticCheckAuth() [static]
 
/**
* Statically checks if there is a session with valid auth information.
*
* @access public
* @see checkAuth
* @return boolean Whether or not the user is authenticated.
* @static
*/
function staticCheckAuth($options = null)
{
static $staticAuth;
if(!isset($staticAuth)) {
$staticAuth = new Auth('null', $options);
}
return $staticAuth->checkAuth();
}
 
// }}}
// {{{ getAuth()
 
/**
* Has the user been authenticated?
*
* @access public
* @return bool True if the user is logged in, otherwise false.
*/
function getAuth()
{
return $this->checkAuth();
}
 
// }}}
// {{{ logout()
 
/**
* Logout function
*
* This function clears any auth tokens in the currently
* active session and executes the logout callback function,
* if any
*
* @access public
* @return void
*/
function logout()
{
if (is_callable($this->logoutCallback)) {
call_user_func_array($this->logoutCallback, array($this->session['username'], $this));
}
 
$this->username = '';
$this->password = '';
$this->session = null;
}
 
// }}}
// {{{ updateIdle()
 
/**
* Update the idletime
*
* @access private
* @return void
*/
function updateIdle()
{
$this->session['idle'] = time();
}
 
// }}}
// {{{ getUsername()
 
/**
* Get the username
*
* @return string
* @access public
*/
function getUsername()
{
if (isset($this->session['username'])) {
return($this->session['username']);
}
return('');
}
 
// }}}
// {{{ getStatus()
 
/**
* Get the current status
*
* @return string
* @access public
*/
function getStatus()
{
return $this->status;
}
 
// }}}
// {{{ getPostUsernameField()
/**
* Gets the post varible used for the username
*
* @return string
* @access public
*/
function getPostUsernameField()
{
return($this->_postUsername);
}
 
// }}}
// {{{ getPostPasswordField()
 
/**
* Gets the post varible used for the username
*
* @return string
* @access public
*/
function getPostPasswordField()
{
return($this->_postPassword);
}
 
// }}}
// {{{ sessionValidThru()
 
/**
* Returns the time up to the session is valid
*
* @access public
* @return integer
*/
function sessionValidThru()
{
if (!isset($this->session['idle'])) {
return 0;
}
if ($this->idle == 0) {
return 0;
}
return ($this->session['idle'] + $this->idle);
}
 
// }}}
// {{{ listUsers()
 
/**
* List all users that are currently available in the storage
* container
*
* @access public
* @return array
*/
function listUsers()
{
$this->_loadStorage();
return $this->storage->listUsers();
}
 
// }}}
// {{{ addUser()
 
/**
* Add user to the storage container
*
* @access public
* @param string Username
* @param string Password
* @param mixed Additional parameters
* @return mixed True on success, PEAR error object on error
* and AUTH_METHOD_NOT_SUPPORTED otherwise.
*/
function addUser($username, $password, $additional = '')
{
$this->_loadStorage();
return $this->storage->addUser($username, $password, $additional);
}
 
// }}}
// {{{ removeUser()
 
/**
* Remove user from the storage container
*
* @access public
* @param string Username
* @return mixed True on success, PEAR error object on error
* and AUTH_METHOD_NOT_SUPPORTED otherwise.
*/
function removeUser($username)
{
$this->_loadStorage();
return $this->storage->removeUser($username);
}
 
// }}}
// {{{ changePassword()
 
/**
* Change password for user in the storage container
*
* @access public
* @param string Username
* @param string The new password
* @return mixed True on success, PEAR error object on error
* and AUTH_METHOD_NOT_SUPPORTED otherwise.
*/
function changePassword($username, $password)
{
$this->_loadStorage();
return $this->storage->changePassword($username, $password);
}
 
// }}}
 
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/Container.php
New file
0,0 → 1,224
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
 
/**
* Auth_Container Base Class
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id$
* @link http://pear.php.net/package/Auth
*/
 
/**
* Storage class for fetching login data
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version Release: @package_version@ File: $Revision$
* @link http://pear.php.net/package/Auth
*/
class Auth_Container
{
 
// {{{ properties
 
/**
* User that is currently selected from the storage container.
*
* @access public
*/
var $activeUser = "";
 
// }}}
// {{{ Auth_Container() [constructor]
 
/**
* Constructor
*
* Has to be overwritten by each storage class
*
* @access public
*/
function Auth_Container()
{
}
 
// }}}
// {{{ fetchData()
 
/**
* Fetch data from storage container
*
* Has to be overwritten by each storage class
*
* @access public
*/
function fetchData($username, $password, $isChallengeResponse=false)
{
}
 
// }}}
// {{{ verifyPassword()
 
/**
* Crypt and verfiy the entered password
*
* @param string Entered password
* @param string Password from the data container (usually this password
* is already encrypted.
* @param string Type of algorithm with which the password from
* the container has been crypted. (md5, crypt etc.)
* Defaults to "md5".
* @return bool True, if the passwords match
*/
function verifyPassword($password1, $password2, $cryptType = "md5")
{
switch ($cryptType) {
case "crypt" :
return ( crypt($password1, $password2) == $password2 );
break;
case "none" :
case "" :
return ($password1 == $password2);
break;
case "md5" :
return (md5($password1) == $password2);
break;
default :
if (function_exists($cryptType)) {
return ($cryptType($password1) == $password2);
} elseif (method_exists($this,$cryptType)) {
return ($this->$cryptType($password1) == $password2);
} else {
return false;
}
break;
}
}
 
// }}}
// {{{ supportsChallengeResponse()
/**
* Returns true if the container supports Challenge Response
* password authentication
*/
function supportsChallengeResponse()
{
return(false);
}
 
// }}}
// {{{ getCryptType()
/**
* Returns the crypt current crypt type of the container
*
* @return string
*/
function getCryptType()
{
return('');
}
 
// }}}
// {{{ listUsers()
 
/**
* List all users that are available from the storage container
*/
function listUsers()
{
return AUTH_METHOD_NOT_SUPPORTED;
}
 
// }}}
// {{{ getUser()
 
/**
* Returns a user assoc array
*
* Containers which want should overide this
*
* @param string The username
*/
function getUser($username)
{
$users = $this->listUsers();
if ($users === AUTH_METHOD_NOT_SUPPORTED) {
return AUTH_METHOD_NOT_SUPPORTED;
}
for ($i=0; $c = count($users), $i<$c; $i++) {
if ($users[$i]['username'] == $username) {
return $users[$i];
}
}
return false;
}
 
// }}}
// {{{ addUser()
 
/**
* Add a new user to the storage container
*
* @param string Username
* @param string Password
* @param array Additional information
*
* @return boolean
*/
function addUser($username, $password, $additional=null)
{
return AUTH_METHOD_NOT_SUPPORTED;
}
 
// }}}
// {{{ removeUser()
 
/**
* Remove user from the storage container
*
* @param string Username
*/
function removeUser($username)
{
return AUTH_METHOD_NOT_SUPPORTED;
}
 
// }}}
// {{{ changePassword()
 
/**
* Change password for user in the storage container
*
* @param string Username
* @param string The new password
*/
function changePassword($username, $password)
{
return AUTH_METHOD_NOT_SUPPORTED;
}
 
// }}}
 
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/Html.php
New file
0,0 → 1,141
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
 
/**
* Standard Html Login form
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Authentication
* @package Auth
* @author Martin Jansen <mj@php.net>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id$
* @link http://pear.php.net/package/Auth
* @since File available since Release 1.3.0
*/
 
/**
* Standard Html Login form
*
* @category Authentication
* @package Auth
* @author Yavor Shahpasov <yavo@netsmart.com.cy>
* @author Adam Ashley <aashley@php.net>
* @copyright 2001-2006 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version Release: @package_version@ File: $Revision$
* @link http://pear.php.net/package/Auth
* @since Class available since Release 1.3.0
*/
class Auth_Frontend_Html {
// {{{ render()
 
/**
* Displays the login form
*
* @param object The calling auth instance
* @param string The previously used username
* @return void
*/
function render(&$caller, $username = '') {
$loginOnClick = 'return true;';
// Try To Use Challene response
// TODO javascript might need some improvement for work on other browsers
if($caller->advancedsecurity && $caller->storage->supportsChallengeResponse() ) {
 
// Init the secret cookie
$caller->session['loginchallenege'] = md5(microtime());
 
print "\n";
print '<script language="JavaScript">'."\n";
 
 
print "\n";
print ' function securePassword() { '."\n";
print ' var pass = document.getElementById(\''.$caller->getPostPasswordField().'\');'."\n";
print ' var secret = document.getElementById(\'authsecret\')'."\n";
//print ' alert(pass);alert(secret); '."\n";
 
// If using md5 for password storage md5 the password before
// we hash it with the secret
// print ' alert(pass.value);';
if ($caller->storage->getCryptType() == 'md5' ) {
print ' pass.value = hex_md5(pass.value); '."\n";
#print ' alert(pass.value);';
}
 
print ' pass.value = hex_md5(pass.value+\''.$caller->session['loginchallenege'].'\'); '."\n";
// print ' alert(pass.value);';
print ' secret.value = 1;'."\n";
print ' var doLogin = document.getElementById(\'doLogin\')'."\n";
print ' doLogin.disabled = true;'."\n";
print ' return true;';
print ' } '."\n";
print '</script>'."\n";;
print "\n";
 
$loginOnClick = ' return securePassword(); ';
}
 
print '<center>'."\n";
 
$status = '';
if (!empty($caller->status) && $caller->status == AUTH_EXPIRED) {
$status = '<i>Your session has expired. Please login again!</i>'."\n";
} else if (!empty($caller->status) && $caller->status == AUTH_IDLED) {
$status = '<i>You have been idle for too long. Please login again!</i>'."\n";
} else if (!empty ($caller->status) && $caller->status == AUTH_WRONG_LOGIN) {
$status = '<i>Wrong login data!</i>'."\n";
} else if (!empty ($caller->status) && $caller->status == AUTH_SECURITY_BREACH) {
$status = '<i>Security problem detected. </i>'."\n";
}
print '<form method="post" action="'.$caller->server['PHP_SELF'].'" '
.'onSubmit="'.$loginOnClick.'">'."\n";
print '<table border="0" cellpadding="2" cellspacing="0" '
.'summary="login form" align="center" >'."\n";
print '<tr>'."\n";
print ' <td colspan="2" bgcolor="#eeeeee"><strong>Login </strong>'
.$status.'</td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
print ' <td>Username:</td>'."\n";
print ' <td><input type="text" id="'.$caller->getPostUsernameField()
.'" name="'.$caller->getPostUsernameField().'" value="' . $username
.'" /></td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
print ' <td>Password:</td>'."\n";
print ' <td><input type="password" id="'.$caller->getPostPasswordField()
.'" name="'.$caller->getPostPasswordField().'" /></td>'."\n";
print '</tr>'."\n";
print '<tr>'."\n";
//onClick=" '.$loginOnClick.' "
print ' <td colspan="2" bgcolor="#eeeeee"><input value="Login" '
.'id="doLogin" name="doLogin" type="submit" /></td>'."\n";
print '</tr>'."\n";
print '</table>'."\n";
 
// Might be a good idea to make the variable name variable
print '<input type="hidden" id="authsecret" name="authsecret" value="" />';
print '</form>'."\n";
print '</center>'."\n";
}
 
// }}}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/class.plugins.php
New file
0,0 → 1,280
<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2004 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DotClear 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 DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ***** END LICENSE BLOCK *****
 
/*
Classe de gestion des plugins et des thèmes
*/
 
class plugins
{
var $location;
var $type;
var $_xml;
var $p_list = array();
function plugins($location,$type='plugin')
{
if (is_dir($location)) {
$this->location = $location.'/';
} else {
$this->location = NULL;
}
$this->type = $type;
}
function getPlugins($active_only=true)
{
if (($list_files = $this->_readDir()) !== false)
{
$this->p_list = array();
foreach ($list_files as $entry => $pfile)
{
if (($info = $this->_getPluginInfo($pfile)) !== false) {
if (($active_only && $info['active']) || !$active_only) {
$this->p_list[$entry] = $info;
}
}
}
ksort($this->p_list);
return true;
}
else
{
return false;
}
}
function getPluginsList()
{
return $this->p_list;
}
function getFunctions($f='functions.php')
{
$res = array();
if (($list_files = $this->_readDir()) !== false)
{
foreach ($list_files as $entry => $pfile)
{
if (file_exists(dirname($pfile).'/'.$f)) {
$res[] = dirname($pfile).'/'.$f;
}
}
}
return $res;
}
function loadCallbacks()
{
$res['onPost'] = array();
$ires = array_keys($res);
foreach ($this->p_list as $k => $v)
{
# Chargement des fichiers events.php
if (file_exists($this->location.$k.'/events.php'))
{
require_once $this->location.$k.'/events.php';
foreach ($v['callbacks'] as $f)
{
if (in_array($f[0],$ires))
{
$pf = explode('::',$f[1]);
if (count($pf) == 2 && is_callable($pf)) {
$res[$f[0]][] = $pf;
}
}
}
}
}
return $res;
}
function loadl10n($p)
{
if (defined('DC_LANG')) {
if (dc_encoding == 'UTF-8') {
l10n::set($this->location.$p.'/l10n/'.DC_LANG.'-utf8/main');
} else {
l10n::set($this->location.$p.'/l10n/'.DC_LANG.'/main');
}
}
}
function switchStatus($p)
{
$xml_path = $this->location.$p.'/desc.xml';
$p_info = $this->_getPluginInfo($xml_path);
$xml = implode('',file($xml_path));
$active = (integer) !$p_info['active'];
$xml = preg_replace('|(<'.$this->type.'[^>]*?active=)"([^"]+)([^>]*>)|ms',
'$1"'.$active.'$3',$xml);
if (!files::putContent($xml_path,$xml)) {
return false;
}
return true;
}
/* Installation d'un plugin */
function install($url)
{
$dest = $this->location.'/'.basename($url);
if (($err = files::copyRemote($url,$dest)) !== true)
{
return $err;
}
else
{
if (($content = @implode('',@gzfile($dest))) === false) {
return __('Cannot open file');
} else {
if (($list = unserialize($content)) === false)
{
return __('Plugin not valid');
}
else
{
if (is_dir($this->location.'/'.$list['name']))
{
/*if (files::deltree($this->location.'/'.$list['name']) === false)
{
return 'Impossible de supprimer le plugin existant';
}*/
unlink($dest);
return __('This plugin still exists. Delete it before.');
}
foreach ($list['dirs'] as $d)
{
mkdir ($this->location.'/'.$d,fileperms($this->location));
chmod($this->location.'/'.$d,fileperms($this->location));
}
foreach ($list['files'] as $f => $v)
{
$v = base64_decode($v);
$fp = fopen($this->location.'/'.$f,'w');
fwrite($fp,$v,strlen($v));
fclose($fp);
chmod($this->location.'/'.$f,fileperms($this->location) & ~0111);
}
unlink($dest);
}
}
}
return true;
}
/* Lecture d'un répertoire à la recherche des desc.xml */
function _readDir()
{
if ($this->location === NULL) {
return false;
}
$res = array();
$d = dir($this->location);
# Liste du répertoire des plugins
while (($entry = $d->read()) !== false)
{
if ($entry != '.' && $entry != '..' &&
is_dir($this->location.$entry) && file_exists($this->location.$entry.'/desc.xml'))
{
$res[$entry] = $this->location.$entry.'/desc.xml';
}
}
return $res;
}
function _getPluginInfo($p)
{
if (file_exists($p))
{
$this->_current_tag_cdata = '';
$this->_p_info = array('name'=>NULL,'version'=>NULL,
'active'=>NULL,'author'=>NULL,'label'=>NULL,
'desc'=>NULL,'callbacks'=>array());
$this->_xml = xml_parser_create('ISO-8859-1');
xml_parser_set_option($this->_xml, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->_xml, $this);
xml_set_element_handler($this->_xml,'_openTag','_closeTag');
xml_set_character_data_handler($this->_xml, '_cdata');
xml_parse($this->_xml,implode('',file($p)));
xml_parser_free($this->_xml);
if (!empty($this->_p_info['name'])) {
return $this->_p_info;
} else {
return false;
}
}
}
function _openTag($p,$tag,$attr)
{
if ($tag == $this->type && !empty($attr['name']))
{
$this->_p_info['name'] = $attr['name'];
$this->_p_info['version'] = (!empty($attr['version'])) ? $attr['version'] : NULL;
$this->_p_info['active'] = (!empty($attr['active'])) ? (boolean) $attr['active'] : false;
}
if ($tag == 'callback') {
$this->_p_info['callbacks'][] = array($attr['event'],$attr['function']);
}
}
function _closeTag($p,$tag)
{
switch ($tag)
{
case 'author':
case 'label':
case 'desc':
$this->_p_info[$tag] = $this->_current_tag_cdata;
break;
}
}
function _cdata($p,$cdata)
{
$this->_current_tag_cdata = $cdata;
}
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/class.wiki.php
New file
0,0 → 1,56
<?php
require_once('wakka.config.php');
 
// Une classe minimal wiki pour l'acces à la base de donnée
 
class Wiki
{
var $dblink;
var $VERSION;
 
// constructor
function Wiki($config)
{
$this->config = $config;
// some host do not allow mysql_pconnect
$this->dblink = @mysql_connect (
$this->config["mysql_host"],
$this->config["mysql_user"],
$this->config["mysql_password"]);
if ($this->dblink)
{
if (!@mysql_select_db($this->config["mysql_database"], $this->dblink))
{
@mysql_close($this->dblink);
$this->dblink = false;
}
}
$this->VERSION = WAKKA_VERSION;
 
}
 
 
// DATABASE
function Query($query)
{
if (!$result = mysql_query($query, $this->dblink))
{
ob_end_clean();
die("Query failed: ".$query." (".mysql_error().")");
}
return $result;
}
function LoadSingle($query) { if ($data = $this->LoadAll($query)) return $data[0]; }
function LoadAll($query)
{
$data=array();
if ($r = $this->Query($query))
{
while ($row = mysql_fetch_assoc($r)) $data[] = $row;
mysql_free_result($r);
}
return $data;
}
 
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/lib.files.php
New file
0,0 → 1,328
<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2004 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DotClear 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 DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ***** END LICENSE BLOCK *****
 
class files
{
function scandir($d,$order=0)
{
$res = array();
if (($dh = @opendir($d)) !== false)
{
while (($f = readdir($dh)) !== false) {
$res[] = $f;
}
closedir($dh);
sort($res);
if ($order == 1) {
rsort($res);
}
return $res;
}
else
{
return false;
}
}
function isDeletable($f)
{
if (is_file($f)) {
return is_writable(dirname($f));
} elseif (is_dir($f)) {
return (is_writable(dirname($f)) && count(files::scandir($f)) <= 2);
}
}
# Suppression récursive d'un répertoire (rm -rf)
function deltree($dir)
{
$current_dir = opendir($dir);
while($entryname = readdir($current_dir))
{
if (is_dir($dir.'/'.$entryname) and ($entryname != '.' and $entryname!='..'))
{
if (!files::deltree($dir.'/'.$entryname)) {
return false;
}
}
elseif ($entryname != '.' and $entryname!='..')
{
if (!@unlink($dir.'/'.$entryname)) {
return false;
}
}
}
closedir($current_dir);
return @rmdir($dir);
}
function touch($f)
{
if (is_writable($f)) {
$c = implode('',file($f));
if ($fp = @fopen($f,'w')) {
fwrite($fp,$c,strlen($c));
fclose($fp);
}
}
}
function secureFile($f)
{
if (is_file($f))
{
@chmod($f,0600);
if (is_readable($f)) {
return true;
} else {
@chmod($f,0660);
if (is_readable($f)) {
return true;
} else {
@chmod($f,0666);
}
}
}
}
function makeDir($f)
{
if (@mkdir($f,fileperms(dirname($f))) === false) {
return false;
}
@chmod($f,fileperms(dirname($f)));
}
function putContent($f, $f_content)
{
if (is_writable($f))
{
if ($fp = @fopen($f, 'w'))
{
fwrite($fp,$f_content,strlen($f_content));
fclose($fp);
return true;
}
}
return false;
}
function size($size)
{
$kb = 1024;
$mb = 1024 * $kb;
$gb = 1024 * $mb;
$tb = 1024 * $gb;
if($size < $kb) {
return $size." B";
}
else if($size < $mb) {
return round($size/$kb,2)." KB";
}
else if($size < $gb) {
return round($size/$mb,2)." MB";
}
else if($size < $tb) {
return round($size/$gb,2)." GB";
}
else {
return round($size/$tb,2)." TB";
}
}
# Copier d'un fichier binaire distant
function copyRemote($src,$dest)
{
if (($fp1 = @fopen($src,'r')) === false)
{
return __('An error occured while downloading the file.');
}
else
{
if (($fp2 = @fopen($dest,'w')) === false)
{
fclose($fp1);
return __('An error occured while writing the file.');
}
else
{
while (($buffer = fgetc($fp1)) !== false) {
fwrite($fp2,$buffer);
}
fclose($fp1);
fclose($fp2);
return true;
}
}
}
# Fonctions de création de packages
#
function getDirList($dirName)
{
static $filelist = array();
static $dirlist = array();
$exclude_list=array('.','..','.svn');
if (empty($res)) {
$res = array();
}
$dirName = preg_replace('|/$|','',$dirName);
if (!is_dir($dirName)) {
return false;
}
$dirlist[] = $dirName;
$d = dir($dirName);
while($entry = $d->read())
{
if (!in_array($entry,$exclude_list))
{
if (is_dir($dirName.'/'.$entry))
{
if ($entry != 'CVS')
{
files::getDirList($dirName.'/'.$entry);
}
}
else
{
$filelist[] = $dirName.'/'.$entry;
}
}
}
$d->close();
return array('dirs'=>$dirlist, 'files'=>$filelist);
}
function makePackage($name,$dir,$remove_path='',$gzip=true)
{
if ($gzip && !function_exists('gzcompress')) {
return false;
}
if (($filelist = files::getDirList($dir)) === false) {
return false;
}
$res = array ('name' => $name, 'dirs' => array(), 'files' => array());
foreach ($filelist['dirs'] as $v) {
$res['dirs'][] = preg_replace('/^'.preg_quote($remove_path,'/').'/','',$v);
}
foreach ($filelist['files'] as $v) {
$f_content = base64_encode(file_get_contents($v));
$v = preg_replace('/^'.preg_quote($remove_path,'/').'/','',$v);
$res['files'][$v] = $f_content;
}
$res = serialize($res);
if ($gzip) {
$res = gzencode($res);
}
return $res;
}
}
 
 
class path
{
function real($p,$strict=true)
{
$os = (DIRECTORY_SEPARATOR == '\\') ? 'win' : 'nix';
# Chemin absolu ou non ?
if ($os == 'win') {
$_abs = preg_match('/^\w+:/',$p);
} else {
$_abs = substr($p,0,1) == '/';
}
# Transformation du chemin, forme std
if ($os == 'win') {
$p = str_replace('\\','/',$p);
}
# Ajout de la racine du fichier appelant si
if (!$_abs) {
$p = dirname($_SERVER['SCRIPT_FILENAME']).'/'.$p;
}
# Nettoyage
$p = preg_replace('|/+|','/',$p);
if (strlen($p) > 1) {
$p = preg_replace('|/$|','',$p);
}
$_start = '';
if ($os == 'win') {
list($_start,$p) = explode(':',$p);
$_start .= ':/';
} else {
$_start = '/';
}
$p = substr($p,1);
# Parcours
$P = explode('/',$p);
$res = array();
for ($i=0;$i<count($P);$i++)
{
if ($P[$i] == '.') {
continue;
}
if ($P[$i] == '..') {
if (count($res) > 0) {
array_pop($res);
}
} else {
array_push($res,$P[$i]);
}
}
$p = $_start.implode('/',$res);
if ($strict && !@file_exists($p)) {
return false;
}
return $p;
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/lib.compat.php
New file
0,0 → 1,64
<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2004 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DotClear 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 DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ***** END LICENSE BLOCK *****
 
/* Missing functions
source : http://pear.php.net/package/PHP_Compat
*/
 
/* files_get_contents */
if (!function_exists('file_get_contents'))
{
function file_get_contents($filename, $incpath = false, $resource_context = null)
{
if (false === $fh = fopen($filename, 'rb', $incpath))
{
trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = filesize($filename))
{
$data = fread($fh, $fsize);
}
else
{
while (!feof($fh)) {
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
}
 
if (!function_exists('is_a'))
{
function is_a($obj, $classname)
{
if (strtolower(get_class($obj)) == strtolower($classname)) {
return true;
} else {
return(is_subclass_of($obj, $classname));
}
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/libs/lib.form.php
New file
0,0 → 1,137
<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2004 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DotClear 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 DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ***** END LICENSE BLOCK *****
 
class form
{
function combo($name,$arryData,$default='',$class='',$id='',$tabindex='')
{
$res = '<select name="'.$name.'" ';
if($class != '')
$res .= 'class="'.$class.'" ';
if($tabindex != '')
$res .= 'tabindex="'.$tabindex.'" ';
if($id != '')
$res .= 'id="'.$id.'" ';
else
$res .= 'id="'.$name.'" ';
$res .= '>'."\n";
foreach($arryData as $k => $v)
{
$res .= '<option value="'.$v.'"';
if($v == $default)
$res .= ' selected="selected"';
$res .= '>'.$k.'</option>'."\n";
}
$res .= '</select>'."\n";
return $res;
}
function radio($name, $value, $checked='', $class='', $id='')
{
$res = '<input type="radio" name="'.$name.'" value="'.$value.'" ';
if($class != '') {
$res .= 'class="'.$class.'" ';
}
if($id != '') {
$res .= 'id="'.$id.'" ';
}
if (($checked === 0) or $checked >= 1) {
$res .= 'checked="checked" ';
}
$res .= '/>'."\n";
return $res;
}
 
function checkbox($name, $value, $checked='', $class='', $id='')
{
$res = '<input type="checkbox" name="'.$name.'" value="'.$value.'"';
if($class != '')
$res .= 'class="'.$class.'" ';
if($id != '') {
$res .= 'id="'.$id.'" ';
}
 
if($checked != '') {
$res.='checked="checked"';
}
$res .= ' />'."\n";
 
return $res;
}
 
function field($id,$size,$max,$default='',$tabindex='',$html='')
{
if (is_array($id)) {
$name = $id[0];
$id = isset($id[1]) ? $id[1] : '';
} else {
$name = $id;
}
$res = '<input type="text" size="'.$size.'" name="'.$name.'" ';
$res .= ($id != '') ? 'id="'.$id.'" ' : '';
$res .= ($max != '') ? 'maxlength="'.$max.'" ' : '';
$res .= ($tabindex != '') ? 'tabindex="'.$tabindex.'" ' : '';
$res .= ($default != '') ? 'value="'.$default.'" ' : '';
$res .= $html;
$res .= ' />';
return $res;
}
function textArea($id,$cols,$rows,$default='',$tabindex='',$html='')
{
$res = '<textarea cols="'.$cols.'" rows="'.$rows.'" ';
$res .= 'name="'.$id.'" id="'.$id.'" ';
$res .= ($tabindex != '') ? 'tabindex="'.$tabindex.'" ' : '';
$res .= $html.'>';
$res .= $default;
$res .= '</textarea>';
return $res;
}
function hidden($id,$value)
{
return '<input type="hidden" name="'.$id.'" value="'.$value.'" />';
}
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/desc.xml
New file
0,0 → 1,6
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="wkaceditor" version="0.1" active="1">
<author>Alexandre Vicq et Philippe Drouot</author>
<label>Barre d'outil</label>
<desc>Aide à la saisie des règles de formatage wikini, en particulier pour l'insertion d'images et de documents à partir de la contribution ActionAttach</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/index.php
New file
0,0 → 1,12
<?php
// index.php
// Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes
// opérations réservées à l'administrateur technique de Wikini.
 
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/actions/header__.php
New file
0,0 → 1,24
<?php
if ($this->GetMethod() == "edit") {
$plugin_output_new=preg_replace ('/<\/head>/',
'
<style type="text/css">
.buttons { background: #ccc; border: 1px solid #ccc; margin: 1; float:left; }
.raise{ border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; background: #ccc; margin:1; float:left; }
.press { border-top: 1px solid buttonshadow; border-left: 1px solid buttonshadow; border-bottom: 1px solid buttonhighlight; border-right: 1px solid buttonhighlight; background: #ccc; margin:1; float:left; }
/* ci dessous les petits champs */
.ACsearchbox { background: #FFFFF8; border: 0px; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px; font-size: 10px; }
.texteChampsImage {font-size: 10px; }
#toolbar { margin: 0; width: 450px; padding: 0; height:20px; background: #ccc; border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; text-align:left; }
#toolbar_suite { margin: 0; width: 450px; padding: 0; height:20px; background: #ccc; border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; text-align:left; }
</style>
<script type="text/javascript" src="tools/aceditor/ACeditor.js"></script>
</head>
',
$plugin_output_new);
$plugin_output_new=preg_replace ('/<body /',
"<body onload=\"thisForm=document.ACEditor;\""
,
$plugin_output_new);
}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/handlers/page/edit__.php
New file
0,0 → 1,57
<?php
if ($this->HasAccess("write") && $this->HasAccess("read"))
{
// preview?
if ($_POST["submit"] == "Aperçu")
{
// Rien
}
else
{
$ACbuttonsBar = "
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'**','**');\" src=\"tools/aceditor/ACEdImages/bold.gif\" title=\"Passe le texte sélectionné en gras ( Ctrl-Maj-b )\" alt=\"Gras\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'//','//');\" src=\"tools/aceditor/ACEdImages/italic.gif\" title=\"Passe le texte sélectionné en italique ( Ctrl-Maj-t )\" alt=\"Italique\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'__','__');\" src=\"tools/aceditor/ACEdImages/underline.gif\" title=\"Souligne le texte sélectionné ( Ctrl-Maj-u )\" alt=\"Souligné\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'@@','@@');\" src=\"tools/aceditor/ACEdImages/strike.gif\" title=\"Barre le texte sélectionné\" alt=\"Barre\"></img>
<img class=\"buttons\" src=\"tools/aceditor/ACEdImages/separator.gif\" alt=\"\" ></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'======','======\\n');\" src=\"tools/aceditor/ACEdImages/t1.gif\" title=\" En-tête énorme\" alt=\"\"> </img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'=====','=====\\n');\" src=\"tools/aceditor/ACEdImages/t2.gif\" title=\" En-tête très gros\" alt=\"\"> </img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'====','====\\n');\" src=\"tools/aceditor/ACEdImages/t3.gif\" title=\" En-tête gros\" alt=\"\"> </img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'===','===\\n');\" src=\"tools/aceditor/ACEdImages/t4.gif\" title=\" En-tête normal\" alt=\"\"> </img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'==','==');\" src=\"tools/aceditor/ACEdImages/t5.gif\" title=\" Petit en-tête\" alt=\"\"> </img>
<img class=\"buttons\" src=\"tools/aceditor/ACEdImages/separator.gif\" alt=\"\" ></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithLink(thisForm.body);\" src=\"tools/aceditor/ACEdImages/link.gif\" title=\"Ajoute un lien au texte sélectionné\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t-&nbsp;','');\" src=\"tools/aceditor/ACEdImages/listepuce.gif\" title=\"Liste\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t1)&nbsp;','');\" src=\"tools/aceditor/ACEdImages/listenum.gif\" title=\"Liste numérique\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\ta)&nbsp;','');\" src=\"tools/aceditor/ACEdImages/listealpha.gif\" title=\"Liste alphabéthique\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n---','');\" src=\"tools/aceditor/ACEdImages/crlf.gif\" title=\"Insère un retour chariot\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n------','');\" src=\"tools/aceditor/ACEdImages/hr.gif\" title=\"Insère une ligne horizontale\" alt=\"\"> </img>
<img class=\"buttons\" src=\"tools/aceditor/ACEdImages/separator.gif\" alt=\"\" ></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%','%%');\" src=\"tools/aceditor/ACEdImages/code.gif\" title=\"Code\" alt=\"\"></img>
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%(php)','%%');\" src=\"tools/aceditor/ACEdImages/php.gif\" title=\"Code PHP\" alt=\"\"></img>
</div>
<div id=\"toolbar_suite\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithImage(thisForm.body);\" src=\"tools/aceditor/ACEdImages/image.gif\" title=\"insère un tag image \" alt=\"\"> </img>
<span class=\"texteChampsImage\">
&nbsp;&nbsp;Fichier&nbsp;<input type=\"text\" name=\"filename\" class=\"ACsearchbox\" size=\"10\"/>&nbsp;&nbsp;Description&nbsp;<input type=\"text\" name=\"description\" class=\"ACsearchbox\" size=\"10\"/>
&nbsp;&nbsp;Alignement&nbsp;<select id=\"alignment\" class=\"ACsearchbox\">
<option value=\"left\">Gauche</option>
<option value=\"center\">Centré</option>
<option value=\"right\">Droite</option>
</select>
</span>
</div>";
$plugin_output_new=preg_replace ('/\<textarea onkeydown/',
$ACbuttonsBar.
'<textarea onkeydown',
$plugin_output_new);
}
}
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/bold.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/bold.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t1.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t1.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/underline.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/underline.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t3.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t3.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/crlf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/crlf.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listealpha.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listealpha.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t4.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t4.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/php.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t5.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/t5.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/link.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/link.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listepuce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listepuce.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/separator.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/separator.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listenum.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/listenum.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/strike.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/strike.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/italic.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/italic.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/hr.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/hr.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/code.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/code.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/link.old.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACEdImages/link.old.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACeditor.js
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/ACeditor.js
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/aceditor/wiki.php
New file
0,0 → 1,23
<?php
// Partie publique
 
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
 
$wikiClasses [] = 'Aceditor';
$wikiClassesContent [] = '
 
function FormOpen($method = "", $tag = "", $formMethod = "post") {
 
if (ereg("edit$", $this->href($method, $tag))) {
$result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
} else {
$result = "<form action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
}
 
if (!$this->config["rewrite_mode"]) $result .= "<input type=\"hidden\" name=\"wiki\" value=\"".$this->MiniHref($method, $tag)."\" />\n";
return $result;
}
';
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/tableau/desc.xml
New file
0,0 → 1,6
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="wkattach" version="0.1" active="1">
<author>GardFieldFr</author>
<label>Tableau</label>
<desc>Permet de créer des tableaux dans Wikini</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/tableau/index.php
New file
0,0 → 1,8
<?php
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/tableau/formatters/wakka__.php
New file
0,0 → 1,108
<?php
if (!function_exists("wakka2callbacktableaux"))
{
function parsetable($thing)
{
$tableattr = 'border="1"';
// echo "parsetable debut : \$thing = $thing<br>";
// recuperation des attributs
preg_match("/^\[\|(.*)$/m",$thing,$match);
// echo "parsetable : \$match = ";var_dump($match);echo "<br>";
if ($match[1]){
$tableattr = $match[1];
}
$table = "<table $tableattr >\n";
//suppression de [|xxxx et de |]
$thing = preg_replace("/^\[\|(.*)$/m","",$thing);
$thing = trim(preg_replace("/\|\]/m","",$thing));
// echo "parsetable suppression [| |]: \$thing = $thing<br>";
//recuperation de chaque ligne
$rows = preg_split("/$/m",$thing,-1,PREG_SPLIT_NO_EMPTY);
// echo "parsetable preg_split:";var_dump($rows);echo "<br>";
//analyse de chaque ligne
foreach ($rows as $row){
$table .= parsetablerow($row);
}
$table.= "</table>";
return $table;
}
//parse la definition d'une ligne
function parsetablerow($row)
{
$rowattr = "";
$row = trim($row);
// echo "parsetablerow debut : \$row = $row<br>";
//detection des attributs de ligne => si la ligne ne commence pas par | alors attribut
if (!preg_match("/^\|/",$row,$match)){
preg_match("/^!([^\|]*)!\|/",$row,$match);
$rowattr = $match[1];
// echo "\$rowattr = $rowattr<br>";
$row = trim(preg_replace("/^!([^\|]*)!/","",$row));
}
$result .= " <tr $rowattr>\n";
$row = trim(preg_replace("/^\|/","",trim($row)));
$row = trim(preg_replace("/\|$/","",trim($row)));
// echo "parsetablerow sans attribut : \$row = $row<br>";
//recuperation de chaque cellule
$cells = explode("|",$row); //nb : seule les indices impaire sont significatif
// echo "parsetablerow preg_split \$cells:";var_dump($cells);echo "<br>";
$i=0;
foreach ($cells as $cell){
// if ($i % 2){
// echo "\$cell = $cell<br>";
$result .= parsetablecell($cell);
// }
$i++;
}
$result .= " </tr>\n";
return $result;
}
//parse la definition d'une cellule
function parsetablecell($cell)
{
global $wiki;
$cellattr = "";
if (preg_match("/^!(.*)!/",$cell,$match)){
$cellattr = $match[1];
}
$cell = preg_replace("/^!(.*)!/","",$cell);
//si espace au debut => align=right
//si espace a la fin => align=left
//si espace debut et fin => align=center
if (preg_match("/^\s(.*)/",$cell)){
$align="right";
}
if (preg_match("/^(.*)\s$/",$cell)){
$align="left";
}
if (preg_match("/^\s(.*)\s$/",$cell)){
$align="center";
}
if ($align) $cellattr .= " align=\"$align\"";
// echo "\$this->classname = ".get_class($wiki)."<br>";
return " <td $cellattr>".$wiki->Format($cell)."</td>\n";
}
 
 
 
function wakka2callbacktableaux($things)
{
$thing = $things[1];
 
global $wiki;
if (preg_match("/^\[\|(.*)\|\]/s", $thing)) {
$thing=preg_replace("/<br \/>/","", $thing);
return parsetable($thing);
}
// if we reach this point, it must have been an accident.
return $thing;
}
}
 
$plugin_output_new = preg_replace_callback("/(^\[\|.*?\|\])/ms", "wakka2callbacktableaux", $plugin_output_new);
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/navigation/desc.xml
New file
0,0 → 1,6
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugin name="wknavigation" version="0.1" active="1">
<author>Philippe Drouot</author>
<label>Navigation</label>
<desc>Menu de navigation pour Wikini</desc>
</plugin>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/navigation/index.php
New file
0,0 → 1,30
<?php
// Administration
 
 
// Vérification de sécurité
if (!defined("TOOLS_MANAGER"))
{
die ("acc&egrave;s direct interdit");
}
 
 
buffer::str(
'
Ajouter les lignes suivantes dans le fichier wakka.css pour personnaliser
votre menu de navigation :
<br>
<code>
.page_table {margin: 0px; padding: 0px ; border: none; height: 100%;width: 100%;}
<br>
.menu_column {background-color: #FFFFCC; vertical-align: top; width: 150px; border: 1px solid #000000;padding:5px;}
<br>
.body_column {vertical-align: top; border: none;padding:5px;}
<br>
</code>
'
 
 
);
 
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/navigation/actions/footer__.php
New file
0,0 → 1,6
<?
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!="")) {
$plugin_output_new=preg_replace ('/<\/body>/','</td></tr></table></div></body>', $plugin_output_new);
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/navigation/actions/header__.php
New file
0,0 → 1,14
<?php
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!=""))
{
// Ajout Menu de Navigation
echo '<tr><td class="menu_column">';
$wikiMenu = $this;
$wikiMenu->tag=$menu_page;
$wikiMenu->SetPage($wikiMenu->LoadPage($wikiMenu->tag));
echo $wikiMenu->Format($wikiMenu->page["body"], "wakka");
echo '</td>';
echo '<td class="body_column">';
}
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/wikini/tools/navigation/wiki.php
New file
0,0 → 1,10
<?php
 
// Partie publique
 
if (!defined("WIKINI_VERSION"))
{
die ("acc&egrave;s direct interdit");
}
$wakkaConfig['menu_page'] = 'PageMenu';
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/adwi_wikini.fonct.php
New file
0,0 → 1,463
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Papyrus. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adwi_wikini.fonct.php,v 1.14 2007-04-20 13:14:05 neiluj Exp $
/**
* Contient les fonctions de l'application gestion des Wikini
*
*
*
*
*@package Admin_Wikini
*@subpackage Fonctions
//Auteur original :
*@author David Delon <david.delon@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.14 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
/* CRUD */
 
/**
*
* D du CRUD
* @return
*/
 
function adwi_supprimer_wikini($id_wikini, &$db) {
// Suppression enregistrement
 
$valeur = adwi_valeurs_par_defaut($id_wikini,$db );
$requete = "delete from gen_wikini where gewi_id_wikini =$id_wikini" ;
$resultat = $db->query ($requete) ;
// Suppression tables Wikini ...
include_once ADWI_CHEMIN_BIBLIOTHEQUE.'gestion_wikini.class.php' ;
$g_wikini = new gestion_wikini($db);
if ((!isset($valeur['table_prefix'])) || (empty($config_wikini['$valeur']))) {
$valeur['table_prefix'] = $valeur['code_alpha_wikini'];
}
$g_wikini->suppression_tables ($valeur['table_prefix']);
if (GEN_FTP_UTILISE) {
/** Inclusion bibliothèque de PEAR gérant le FTP.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'Net/FTP.php';
// création de l'objet pear ftp
$objet_pear_ftp = new Net_FTP(PAP_FTP_SERVEUR, PAP_FTP_PORT);
// création de la connexion
$ftp_conn = $objet_pear_ftp->connect(PAP_FTP_SERVEUR, PAP_FTP_PORT);
// identification
$ftp_login_result = $objet_pear_ftp->login(PAP_FTP_UTILISATEUR, PAP_FTP_MOT_DE_PASSE);
// Gestion des erreurs ftp
if ((PEAR::isError($ftp_conn) || PEAR::isError($ftp_login_result))) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de se connecter par ftp.<br />'.
'Serveur : '. PAP_FTP_SERVEUR .'<br />'.
'Utilisateur : '. PAP_FTP_UTILISATEUR .'<br />'.
'Erreur connexion : '.$ftp_conn->getMessage().'<br />'.
'Erreur login : '.$ftp_login_result->getMessage().'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier n° : '. __FILE__ .'<br /><p>';
print $message;
}
$chemin_wikini = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP;
if ($valeur['code_alpha_wikini']!='') {
$resultat = $objet_pear_ftp->rm($chemin_wikini, true);
if (PEAR::isError($resultat)) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
'Wikini : '. $chemin_wikini .'<br />'.
'Erreur origine : '. $resultat->getMessage() .'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier n° : '. __FILE__ .'<br /></p>';
print $message;
}
}
}
 
// else {
 
// Gestion sans FTP à faire
 
//}
 
}
 
/**
*
*
* @return
*/
 
function adwi_valeurs_par_code_alpha($code_alpha_wikini, &$db) {
$requete = "select * from gen_wikini where gewi_code_alpha_wikini='". $code_alpha_wikini."'" ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
 
 
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$resultat->free();
unset ($requete, $resultat);
return adwi_valeurs_par_defaut($ligne->gewi_id_wikini,$db);
}
function adwi_valeurs_par_defaut($id_wikini, &$db) {
 
// requete sur gen_wikin
$requete = "select * from gen_wikini where gewi_id_wikini=$id_wikini" ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(), E_USER_WARNING) ;
return ;
}
$tableau_retour = array () ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$tableau_retour['code_alpha_wikini'] = $ligne->gewi_code_alpha_wikini;
$tableau_retour['bdd_hote'] = $ligne->gewi_bdd_hote ;
$tableau_retour['bdd_nom'] = $ligne->gewi_bdd_nom;
$tableau_retour['bdd_utilisateur'] = $ligne->gewi_bdd_utilisateur;
$tableau_retour['bdd_mdp'] = $ligne->gewi_bdd_mdp;
$tableau_retour['table_prefix'] = $ligne->gewi_table_prefix ;
$tableau_retour['page'] = $ligne->gewi_page;
$tableau_retour['chemin'] = $ligne->gewi_chemin ;
unset ($requete, $resultat);
return $tableau_retour ;
}
 
/**
*
* C du CRUD
* @return int id_wikini_bdd
*/
 
 
function insertion ($valeur, &$db) {
// Calcul dernier identifiant
$id_wikini_bdd = SQL_obtenirNouveauId ($db, 'gen_wikini', 'gewi_id_wikini') ;
$requete = "insert into gen_wikini set gewi_id_wikini ="
.$id_wikini_bdd.","
.requete_wikini($valeur) ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
}
 
if (GEN_FTP_UTILISE) {
/** Inclusion bibliothèque de PEAR gérant le FTP.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'Net/FTP.php';
 
// création de l'objet pear ftp
$objet_pear_ftp = new Net_FTP(PAP_FTP_SERVEUR, PAP_FTP_PORT);
// création de la connexion
$ftp_conn = $objet_pear_ftp->connect(PAP_FTP_SERVEUR, PAP_FTP_PORT);
// identification
$ftp_login_result = $objet_pear_ftp->login(PAP_FTP_UTILISATEUR, PAP_FTP_MOT_DE_PASSE);
// Gestion des erreurs ftp
if ((PEAR::isError($ftp_conn) || PEAR::isError($ftp_login_result))) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de se connecter par ftp.<br />'.
'Serveur : '. PAP_FTP_SERVEUR .'<br />'.
'Utilisateur : '. PAP_FTP_UTILISATEUR .'<br />'.
'Erreur connexion : '.$ftp_conn->getMessage().'<br />'.
'Erreur login : '.$ftp_login_result->getMessage().'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier n° : '. __FILE__ .'<br /><p>';
print $message;
}
$objet_pear_ftp->mkdir(PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini']) ;
$chemin_wikini_bibliotheque = ADWI_CHEMIN_BIBLIOTHEQUE_WIKINI;
$chemin_wikini = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP;
// Overwrite = fale (3eme parametre)
$resultat = $objet_pear_ftp->putRecursive($chemin_wikini_bibliotheque, $chemin_wikini, false, FTP_BINARY);
if (PEAR::isError($resultat)) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
'Fichier origine : '. $chemin_wikini_bibliotheque .'<br />'.
'Fichier copié : '. $chemin_wikini .'<br />'.
'Erreur origine : '. $resultat->getMessage() .'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier n° : '. __FILE__ .'<br /></p>';
print $message;
}
}
// else {
// Gestion sans FTP à faire
//}
// Creation tables wikini
include_once ADWI_CHEMIN_BIBLIOTHEQUE.'gestion_wikini.class.php' ;
$g_wikini = new gestion_wikini($db);
if ((!isset($valeur['table_prefix'])) || (empty($config_wikini['$valeur']))) {
$valeur['table_prefix'] = $valeur['code_alpha_wikini'];
}
$g_wikini->creation_tables($valeur['table_prefix']);
// Creation Wakka.config.php
$config_wikini = adwi_config_wikini($valeur['code_alpha_wikini'] ,$db );
$base_url=parse_url(PAP_URL);
$dirname_base_url=dirname($base_url['path']);
$config_base_url=$dirname_base_url.GEN_SEP.ADWI_CHEMIN_WIKINI.GEN_SEP.$config_wikini['code_alpha_wikini'].GEN_SEP."wakka.php?wiki=";
$config_base_url = str_replace("//", "/", $config_base_url);
 
$config = array(
"wakka_version" => "0.1.1",
"wikini_version" => "0.4.3",
'mysql_host' => $config_wikini['bdd_hote'],
'mysql_database' => $config_wikini['bdd_nom'],
'mysql_user' => $config_wikini['bdd_utilisateur'],
'mysql_password' => $config_wikini['bdd_mdp'],
'table_prefix' => $config_wikini['table_prefix'],
'root_page' => $config_wikini['page'],
'wakka_name' => $config_wikini['code_alpha_wikini'],
'base_url' => $config_base_url,
'rewrite_mode' => '0',
'meta_keywords' => '',
'meta_description' => '',
'action_path' => 'actions',
'handler_path' => 'handlers',
'header_action' => 'header',
'footer_action' => 'footer',
'navigation_links' => 'DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur',
'referrers_purge_time' => 24,
'pages_purge_time' => 90,
'default_write_acl' => '*',
'default_read_acl' => '*',
'default_comment_acl' => '*',
'preview_before_save' => '0');
 
// convert config array into PHP code
$configCode = "<?php\n// wakka.config.php cr&eacute;&eacute;e ".strftime("%c")."\n// ne changez pas la wikini_version manuellement!\n\n\$wakkaConfig = array(\n";
foreach ($config as $k => $v)
{
$entries[] = "\t\"".$k."\" => \"".$v."\"";
}
$configCode .= implode(",\n", $entries).");\n?>";
 
 
$tempfn = tempnam("","");
$temp = fopen($tempfn, "w");
fwrite($temp, $configCode);
fclose($temp);
 
 
$fichier_config_source = $tempfn;
$fichier_config_cible = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP."wakka.config.php";
$resultat = $objet_pear_ftp->put($fichier_config_source, $fichier_config_cible, false, FTP_BINARY);
if (PEAR::isError($resultat)) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
'Fichier origine : '. $chemin_wikini_bibliotheque .'<br />'.
'Fichier copié : '. $chemin_wikini .'<br />'.
'Erreur origine : '. $resultat->getMessage() .'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier n° : '. __FILE__ .'<br /></p>';
print $message;
}
$objet_pear_ftp->disconnect();
unlink($tempfn);
}
 
/**
*
* U du CRUD
* @return
*/
 
 
function mise_a_jour ($valeur, &$db) {
$requete = "update gen_wikini set ".requete_wikini($valeur)
.' where gewi_id_wikini ='.$GLOBALS['id_wikini'] ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
}
}
 
/**
*
* Formate code sql pour insertion à partir des valeurs entrees dans le formulaire
*
* @return string un morceau de code SQL
*/
 
function requete_wikini (&$valeur) {
return 'gewi_code_alpha_wikini ="'.$valeur['code_alpha_wikini'].'", '
.'gewi_bdd_hote ="'.$valeur['bdd_hote'].'", '
.'gewi_bdd_nom="'.$valeur['bdd_nom'].'", '
.'gewi_bdd_utilisateur ="'.$valeur['bdd_utilisateur'].'", '
.'gewi_bdd_mdp="'.$valeur['bdd_mdp'].'", '
.'gewi_table_prefix="'.$valeur['table_prefix'].'", '
.'gewi_chemin="'.$valeur['chemin'].'", '
.'gewi_page="'.$valeur['page'].'"';
}
 
 
function adwi_config_wikini($code_alpha_wikini,&$db) {
$config_wikini = adwi_valeurs_par_code_alpha($code_alpha_wikini,$db );
 
// Parametres de base de donnée de Papyrus par défaut
if ((!isset($config_wikini['bdd_hote'])) || (empty($config_wikini['bdd_hote']))) {
$config_wikini['bdd_hote'] = PAP_BDD_SERVEUR;
}
if ((!isset($config_wikini['bdd_nom'])) || (empty($config_wikini['bdd_nom']))) {
$config_wikini['bdd_nom'] = PAP_BDD_NOM;
}
if ((!isset($config_wikini['bdd_utilisateur'])) || (empty($config_wikini['bdd_utilisateur']))) {
$config_wikini['bdd_utilisateur'] = PAP_BDD_UTILISATEUR;
}
if ((!isset($config_wikini['bdd_mdp'])) || (empty($config_wikini['bdd_mdp']))) {
$config_wikini['bdd_mdp'] = PAP_BDD_MOT_DE_PASSE;
}
if ((!isset($config_wikini['table_prefix'])) || (empty($config_wikini['table_prefix']))) {
$config_wikini['table_prefix'] = $code_alpha_wikini.'_';
}
// Ordre de selection de la page de demarrage :
// Page par defaut du Wiki enregistré
// PagePrincipale
if ((!isset($config_wikini['page'])) || (empty($config_wikini['page']))) {
$config_wikini['page'] = 'PagePrincipale';
}
/** Constante stockant le chemin du dossier contenant le site Wikini en cours */
if ((!isset($config_wikini['chemin'])) || (empty($config_wikini['chemin']))) {
$config_wikini['chemin'] = GEN_CHEMIN_WIKINI.$config_wikini['code_alpha_wikini'].GEN_SEP;
}
return $config_wikini;
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.10 2006/10/05 08:56:12 florian
* maj table sql
*
* Revision 1.9 2006/09/21 14:18:06 florian
* changement du wiki de base (ajout du gestionnaire d'extension), amélioration de l'intégrateur wiki
*
* Revision 1.8 2006/07/19 13:55:01 ddelon
* Bug suppression de Wiki
*
* Revision 1.7 2006/06/02 09:12:16 florian
* ajout constante chemin
*
* Revision 1.6 2006/04/28 12:41:26 florian
* corrections erreurs chemin
*
* Revision 1.5 2005/09/28 16:29:39 ddelon
* Merge modification projet
*
* Revision 1.4 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.3 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/08/31 17:34:52 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/03/09 10:44:04 jpm
* Mise au norme du nom du fichier.
*
* Revision 1.2 2005/03/09 10:40:33 alex
* version initiale
*
* Revision 1.1 2004/12/13 18:07:28 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/gestion_wikini.class.php
New file
0,0 → 1,192
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: gestion_wikini.class.php,v 1.9 2007-04-11 08:48:15 neiluj Exp $
/**
* Application projet
*
* La classe gestion_wikini
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class gestion_wikini
*
*/
class gestion_wikini
{
 
/*** Attributes: ***/
 
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur
*
* @param DB objetDB Une référence vers un objet PEAR:DB
* @return void
* @access public
*/
function gestion_wikini( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function gestion_wikini
 
/**
*
*
* @param string prefixe Le préfixe des tables.
* @return void
* @access public
*/
function creation_tables( $prefixe, $root_page = 'PagePrincipale' )
{
// Connection à la base de donné de wikini
$prefixe .= '_' ;
$this->_db->query(
"CREATE TABLE `".$prefixe."pages` (".
"id int(10) unsigned NOT NULL auto_increment,".
"tag varchar(50) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"body text NOT NULL,".
"body_r text NOT NULL,".
"owner varchar(50) NOT NULL default '',".
"user varchar(50) NOT NULL default '',".
"latest enum('Y','N') NOT NULL default 'N',".
"handler varchar(30) NOT NULL default 'page',".
"comment_on varchar(50) NOT NULL default '',".
"PRIMARY KEY (id),".
"FULLTEXT KEY tag (tag,body),".
"KEY idx_tag (tag),".
"KEY idx_time (time),".
"KEY idx_latest (latest),".
"KEY idx_comment_on (comment_on)".
") TYPE=MyISAM;");
$this->_db->query(
"CREATE TABLE `".$prefixe."acls` (".
"page_tag varchar(50) NOT NULL default '',".
"privilege varchar(20) NOT NULL default '',".
"list text NOT NULL,".
"PRIMARY KEY (page_tag,privilege)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE `".$prefixe."links` (".
"from_tag char(50) NOT NULL default '',".
"to_tag char(50) NOT NULL default '',".
"UNIQUE KEY from_tag (from_tag,to_tag),".
"KEY idx_from (from_tag),".
"KEY idx_to (to_tag)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE `".$prefixe."referrers` (".
"page_tag char(50) NOT NULL default '',".
"referrer char(150) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"KEY idx_page_tag (page_tag),".
"KEY idx_time (time)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE `".$prefixe."users` (".
"name varchar(80) NOT NULL default '',".
"password varchar(32) NOT NULL default '',".
"email varchar(50) NOT NULL default '',".
"motto text NOT NULL,".
"revisioncount int(10) unsigned NOT NULL default '20',".
"changescount int(10) unsigned NOT NULL default '50',".
"doubleclickedit enum('Y','N') NOT NULL default 'Y',".
"signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
"show_comments enum('Y','N') NOT NULL default 'N',".
"PRIMARY KEY (name),".
"KEY idx_name (name),".
"KEY idx_signuptime (signuptime)".
") TYPE=MyISAM");
$this->_db->query("INSERT INTO `".$prefixe."pages` (`id`, `tag`, `time`, `body`, `body_r`, `owner`, `user`, `latest`, `handler`, `comment_on`) VALUES (56, 'PageMemo', '2006-09-21 10:38:12', '[[AideWikiNi Retour]]\n\n======Màmo d''utilisation du site Internet Wikini======\n\n=====Prçambule, en règle général :=====\n\n - N''oubliez pas de vous **identifier** pour avoir accès à toutes les pages qui vous concernent.\n\n - Veillez à ne pas effacer le contenu d''une page mis en ligne précédemment. \nEn mode \" édition \" une page n''est pas forcément très lisible, **prenez le temps de vous habituer à la syntaxe, à trouver où vous voulez écrire.**\n\n=====Ecrire sur une page, enregistrer ses modifications ou faire un aperçu de la page :=====\n\n - Pour écrire sur une page, il vous suffit de **double cliquer sur la zone d''écriture** ou de cliquer en bas de la page sur le lien : **\" Editer cette page \"**\nAttention, lorsque vous avez terminé décrire, n''oubliez pas de **sauvegarder vos modifications** en bas de la page en cliquant sur le bouton **Aperçu** puis sur **Sauver**\n\n=====Pour Mettre en page :=====\n\n - Pour mettre en page vos textes vous pouvez **utiliser la barre d''outil** située en haut de la page quand vous êtes en mode édition.\n\n - Sinon, vous pouvez utiliser des codes prié configuràs à partir de **symboles de syntaxe.**\nDans tous les cas il faudra utiliser deux symboles juste avant la première lettre à mettre en page et deux autres juste après la dernière lettre à mettre en page.\nPar exemple, si vous tapez : \"\"**Le COCM est une association régie sous la loi 1901**\"\"\nA l''écran le texte apparaîtra ainsi : **Le COCM est une **association** régie sous la loi 1901**\n\n - **Guide des règles de formatage**\n__Règles de base :__\n\n- \"\"##texte à espacement fixe## --->\"\" ##texte à espacement fixe##\n\n- Mettre en gras : \"\"**Texte en gras !** --->\"\" Texte en gras !\n\n- Souligner : \"\"Texte __souligné__ ! --->\"\" __Texte souligné !__ (2 fois le symbole du tiret bas, touche 8 du clavier)\n\n- Barrer un texte : \"\"@@Texte barré@@ ! --->\"\" @@Texte barré !@@ (deux arobaz)\n\n- Mettre en Italique : \"\"//Texte en italique.// --->\"\" //Texte en italique.// (deux slash)\n\n- \"\"======Grand titre (T1):======(6 signes \" égal \") -->\"\" ======Grand titre (T1):======\n\n- \"\"=====Grand titre (T2) :===== -->\"\" =====Grand titre (T2) :===== (5 signes \" égal \")\n\n- \"\"====Grand titre (T3) :==== -->\"\" ====Grand titre (T3) :==== (4 signes \" égal \")\n\n- Séparateur horizontal : il suffit de taper au moins 4 \"-\", au dela de 4 tirets c''est le meme effet : \"\"----\"\" (4 tiret, touche 6 du clavier)\nExemple : ----\n\nRetour de ligne forcé : \"\" ---\"\" \nExemple : \"\"le--- wikini --->\"\"le --- wikini\n\n=====Faire un lien vers un autre site ou une autre page du site :=====\n\n - **Pour faire un lien vers un autre site**, il suffit d''**écrire l''adresse du site entière** sur la page, le wikini reconnaît automatique que c''est un lien. Rappel, une adresse complète commence par [[http://]]\n\n - **Si vous souhaitez q''un autre texte apparaisse**, vous devrez écrire l''adresse du lien entre des crochets avec le texte que vous voulez. \nPar exemple : \"\"[[http://cocmathlétisme.org Visitez le site du club de Mauguio !]]\"\" le texte que le public verra sera : [[http://cocmathlétisme.org Visitez le site du club de Mauguio !]]\n\n - **Pour faire un lien d''une page du site vers une autre page du même site**, pas besoin de mettre toute l''adresse, il vous suffit d''indiquer le dernier mot du chemin (celui avec les deux majuscules) Par exemple pour faire un lien vers cette page, on utilisera seulement le mot écrit en bleu : http://www.cocmathletisme.org/wikini/wakka.php?wiki=AdministraTeurs\nVous pourrez également utiliser un autre texte grâce aux crochets comme expliqué plus haut. (rappel : \"\"[[ParametresUtilisateur Identification ]]\"\" donnera aux visiteurs : [[ParametresUtilisateur Identification ]]\n\n=====Créer une nouvelle page :=====\n\n - **Une nouvelle page se crée** en écrivant un mot qui contient 2 majuscules **CommeCeci**.\nLorsque vous sauvez vos modifications, le mot apparaît à l''écran avec une majuscule en bout de mot : **CommeCeci?** En cliquant sur le point d''interrogation, une nouvelle page blanche apparaît, en y insérant du texte et en sauvant, cette page devient active.\n\n - **Conseil** : Lorsque vous créer la page, il est préférable d''**en informer l''administrateur principal** afin qu''il puisse gérer les droits d''écriture et de lecture de la page (notamment si cette page est créée dans la rubrique des administrateurs)\n\n=====Mettre une image dans le corps d''une page :=====\n\n1) **dimensionner votre photo** de manière à ce qu''elle ne soit pas trop grande (rester sur un format 10X15 cm maxi), vérifier que votre photo ne soit pas trop lourde sinon, elle n''apparaîtra pas. Configurer par exemple **la résolution** qui, pour être sur le Web, doit être de 72 dpi.\n\n2) Quant vous êtes en train de modifier la page, il faut utiliser la barre d''outil en haut de la page, sur la 2ème ligne de la barre, il y a un icône image, avant de cliquez dessus, vous allez informer les cases suivantes : **fichier, description et alignement**\n\n3) **Fichier** : indiquer un nom de fichier et surtout son **extension** (.doc,.jpg,.img ,.gif....) par exemple pour le logo de cocm vous pourrez indiquer **logo.jpg**\n\n4) **Description** : ici vous décrivez la photo par exemple : Le logo du cocm\n\n5) **Alignement** : indiquer si vous souhaitez que l''image soit centrée, à gauche ou à droite de l''écran.\n\n6) **Cliquez enfin sur le bouton image** de la barre d''outil puis **sauver vos modifications**, vous verrez apparaître à côté de la description de votre ficher un point d''interrogation : le logo du cocm?\n\n7/ Cliquez sur le point d''interrogation, le site vous propose de **transférer votre image** via le formulaire d''envois de fichier cliquez sur \" parcourir \". **Pointez l''image** et cliquez sur **envoyer**.\n\n=====Mettre un fichier en téléchargement sur le site :=====\n\n - **Idem que pour mettre une image**, suivez les instructions du point 2/ à 7/\nRappel : ne vous trompez pas sur l''extension de votre fichier :\nQuelques extensions possibles : \nFichier Word : .doc\nPower point : .pps ou . ppt\nExcel : .xls\n\n**Attention, lorsque un fichier est trop lourd, le serveur vous envoie un message d''erreur. Veillez à ne pas trop surcharger le site, en effet, l''espace d''un site n''est pas extensible.**', '', '', 'ekotribu', 'Y', 'page', ''),
(2, 'DerniersChangements', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentChanges}}', '', '', 'ekotribu', 'Y', 'page', ''),
(3, 'DerniersCommentaires', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentlyCommented}}', '', '', 'ekotribu', 'Y', 'page', ''),
(5, 'PagesACreer', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages à créer : ===\n\n{{WantedPages}}', '', '', 'ekotribu', 'Y', 'page', ''),
(6, 'PagesOrphelines', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages orphelines ===\n\n{{OrphanedPages}}', '', '', 'ekotribu', 'Y', 'page', ''),
(7, 'RechercheTexte', '2006-09-20 12:18:59', '** Retour : ** [[PagePrincipale Page principale]] > [[TableauDeBord Tableau de bord]]\n----\n{{TextSearch}}', '', '', 'ekotribu', 'Y', 'page', ''),
(9, 'ListeUtilisateurs', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du premier au dernier.\n\n{{Listusers}}', '', '', 'ekotribu', 'Y', 'page', ''),
(10, 'ListeUtilisateursInverse', '2006-09-20 12:18:59', '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du dernier au premier.\n\n{{Listusers/last}}', '', '', 'ekotribu', 'Y', 'page', ''),
(11, 'PlanDuSite', '2006-09-20 12:18:59', '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Plan du site : ===\n\n{{ListPages/tree}}', '', '', 'ekotribu', 'Y', 'page', ''),
(12, 'IndexDesPages', '2006-09-20 12:18:59', '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages : ===\n\n{{ListPages}}', '', '', 'ekotribu', 'Y', 'page', ''),
(13, 'IndexAlphabetiqueDesPages', '2006-09-20 12:18:59', '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages par ordre alphabétique : ===\n\n{{pageindex}}', '', '', 'ekotribu', 'Y', 'page', ''),
(14, 'DerniersChangementsRSS', '2006-09-20 12:18:59', '**Retour : ** [[TableauDeBord tableau de bord]]\n----\nCette page renvoie au fils RSS des derniers changement. Pour savoir comment l''utiliser voir la page \"\"<a href=\"http://www.wikini.net/wakka.php?wiki=WikiniEtLesFluxRSS\" target=\"_blank\" title=\"Wikini et les flux RSS\">Wikini et les flux RSS</a>\"\".\n\n\"\"<!--\n\n{{recentchangesrss/link=\"DerniersChangements\"}}\n\n-->\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(15, 'BacASable', '2006-09-20 12:18:59', '** Retour : ** [[PagePrincipale Page pincipale]]\n----\nUtilisez cette page pour faire vos tests !', '', '', 'ekotribu', 'Y', 'page', ''),
(16, 'TableauDeBord', '2006-09-20 12:18:59', '** Retour : ** [[PagePrincipale Page Principale]]\n----\n===== Tableau de bord =====\n\n - Listes des utilisateurs : [[ListeUtilisateurs par ordre de création ]] ou [[ListeUtilisateursInverse par ordre inverse de création ]].\n\n - [[DerniersChangements Dernières modifications sur les pages]]\n - [[DerniersCommentaires Dernières modifications sur les commentaires]]\n\n\n - [[PagesOrphelines Pages orphelines]]\n - [[PagesACreer Pages à créer]]\n\n - [[RechercheTexte Recherche texte]]\n\n - [[PlanDuSite Plan du site]]\n - [[IndexDesPages Index des pages avec noms des propriétaires]]\n - [[IndexAlphabetiqueDesPages Index des pages par classement alphabétique]]\n\n - [[DerniersChangementsRSS La page permettant le flux RSS]]\n\n----\n==== 5 derniers comptes utilisateurs ====\n{{Listusers last=\"5\"}}\n\n==== 5 dernières pages modifiées ====\n{{recentchanges max=\"5\"}}\n----', '', '', 'ekotribu', 'Y', 'page', ''),
(17, 'NomWiki', '2006-09-20 12:18:59', '** Retour : ** [[PagePrincipale Page Principale]]\n----\nUn NomWiki est un nom qui est écrit \"\"CommeCela\"\".\n\nUn NomWiki est transformé automatiquement en lien. Si la page correspondante n''existe pas, un ''?'' est affiché à côté du mot.', '', '', 'ekotribu', 'Y', 'page', ''),
(38, 'AideUn', '2006-09-20 17:37:43', '[[AideWikiNi Retour]]\n\n=====Comment écrire, mettre en page et sauvegarder sur une page ?=====\n\n\"\"\n<center>\n<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" WIDTH=\"508\" HEIGHT=\"375\" CODEBASE=\"http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0\">\n<PARAM NAME=movie VALUE=\"tutoriel_wiki1.swf\">\n<PARAM NAME=play VALUE=true>\n<PARAM NAME=loop VALUE=false>\n<PARAM NAME=quality VALUE=low>\n<EMBED SRC=\"http://ekotribu.org/tutos/tutoriel_wiki1.swf\" WIDTH=508 HEIGHT=375 quality=low loop=false TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\n</EMBED>\n</OBJECT>\n</center>\n\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(40, 'AideDeux', '2006-09-20 17:43:32', '[[AideWikiNi Retour]]\n\n=====Comment créer une nouvelle page dans l''espace projet ?=====\n\n\"\"\n<center>\n<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" WIDTH=\"509\" HEIGHT=\"374\" CODEBASE=\"http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0\">\n<PARAM NAME=movie VALUE=\"tutoriel_wiki2.swf\">\n<PARAM NAME=play VALUE=true>\n<PARAM NAME=loop VALUE=false>\n<PARAM NAME=quality VALUE=low>\n<EMBED SRC=\"http://ekotribu.org/tutos/tutoriel_wiki2.swf\" WIDTH=509 HEIGHT=374 quality=low loop=false TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\n</EMBED>\n</OBJECT>\n</center>\n\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(41, 'AideTrois', '2006-09-20 17:44:11', '[[AideWikiNi Retour]]\n\n=====Comment mettre en ligne un document dans mon projet, illustrer avec une image mes textes ?=====\n\n\"\"\n<center>\n<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" WIDTH=\"509\" HEIGHT=\"374\" CODEBASE=\"http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0\">\n<PARAM NAME=movie VALUE=\"tutoriel_wiki4.swf\">\n<PARAM NAME=play VALUE=true>\n<PARAM NAME=loop VALUE=false>\n<PARAM NAME=quality VALUE=low>\n<EMBED SRC=\"http://ekotribu.org/tutos/tutoriel_wiki4.swf\" WIDTH=509 HEIGHT=374 quality=low loop=false TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\n</EMBED>\n</OBJECT>\n</center>\n\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(43, 'AideQuatre', '2006-09-20 17:45:30', '[[AideWikiNi Retour]]\n\n=====Comment créer un menu ou le modifier dans l''espace de mon projet ?=====\n\n\"\"\n<center>\n<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"WIDTH=\"559\"HEIGHT=\"408\"\nCODEBASE=\"http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0\">\n<PARAM NAME=movie VALUE=\"tutoriel_wiki3.swf\">\n<PARAM NAME=play VALUE=true>\n<PARAM NAME=loop VALUE=false>\n<PARAM NAME=quality VALUE=low>\n<EMBED SRC=\"http://ekotribu.org/tutos/tutoriel_wiki3.swf\" WIDTH=509 HEIGHT=374 quality=low loop=false TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\n</EMBED>\n</OBJECT>\n</center>\n\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(44, 'AideCinq', '2006-09-20 17:47:11', '[[AideWikiNi Retour]]\n\n=====Comment faire des liens vers d''autres sites ou d''autre page dans mon projet ?=====\n\n\"\"\n<center>\n<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" WIDTH=\"559\" HEIGHT=\"408\" CODEBASE=\"http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0\">\n<PARAM NAME=movie VALUE=\"tutoriel_wiki5.swf\">\n<PARAM NAME=play VALUE=true>\n<PARAM NAME=loop VALUE=false>\n<PARAM NAME=quality VALUE=low>\n<EMBED SRC=\"http://ekotribu.org/tutos/tutoriel_wiki5.swf\" WIDTH=559 HEIGHT=408 quality=low loop=false TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\n</EMBED>\n</OBJECT>\n</center>\n\"\"', '', '', 'ekotribu', 'Y', 'page', ''),
(47, 'ParametresUtilisateur', '2006-09-20 17:52:04', '** Retour : ** [[PagePrincipale page principale]]\n----\n** Note : ** L''idéal pour la création d''un nom Wiki est d''accoler son prénom et son nom de cette façon : \"\"\"PrenomNom\"\"\". \n----\n==== Mes paramètres ====\n\n{{UserSettings}}\n\n----', '', '', 'ekotribu', 'Y', 'page', ''),
(50, 'ListeDesActionsWikini', '2006-09-20 17:58:42', 'Wikini propose par défaut les \"Actions\" suivantes.\n\n - \"\"ActionBacklinks\"\" insère la liste des pages faisant référence à la page courante\n - \"\"ActionInclude\"\" : inclusion d''une page au sein d''une autre\n - \"\"ActionListPages\"\" : liste la totalité des pages du site (paramètres possibles)\n - \"\"ActionListUsers\"\" : liste la totalité des pages du site (tri /last).\n - \"\"ActionMyChanges\"\" : donne les dernières pages modifiées par l''utilisateur courant (force son identification)\n - \"\"ActionMyPages\"\" : donne la liste des pages dont l''utilisateur courant est le propriétaire\n - \"\"ActionOrphanedPages\"\" : recherche les pages qui ne sont pas cibles de liens (pages orphelines)\n - \"\"ActionPageIndex\"\" : liste toutes les pages classées par ordre alphabétique et regroupées par lettres.\n - \"\"ActionRecentChanges\"\" : affiche la liste des pages récemment modifiées (voir DerniersChangements )\n - \"\"ActionRecentChangesRSS\"\" : automatise la diffusion pr RSS (voir la page DerniersChangementsRss ) \n - \"\"ActionRecentComments\"\" : donne la liste des pages commentées triàes par date anti-chronologique (cf. ci-dessous) \n - \"\"ActionRecentlyCommented\"\" : affiche une liste (born°e par max= ) des pages ayant été récemment commentées (voir DerniersCommentaires ).\n - \"\"ActionRedirect\"\" : redirection d''une page vers une autre\n - \"\"ActionResetPassword\"\" : rà-initialise le mot de passe de l''utilisateur (utilisé dans ParametresUtilisateur ) \n - \"\"ActionTextSearch\"\" : recherche d''une chaîne de caractères dans l''ensemble des pages de Wikini\n - \"\"ActionTrail\"\" : permet de lier des pages entres elles et de passer de l''une à l''autre avec un petit navigateur style \"précédente/suivante\"\n - \"\"ActionUserSettings\"\" : création de compte et connexion (voir ParametresUtilisateur ).\n - \"\"ActionWantedPages\"\" : liste les pages de Mot Wiki devant être écrites (voir PagesACreer ).\n.', '', '', 'ekotribu', 'Y', 'page', ''),
(51, 'ControlerLAccesAuxPages', '2006-09-20 18:03:17', 'Chaque page possède trois niveaux de contrôle d''accès :\n - lecture de la page\n - écriture/modification de la page\n - commentaire de la page\n\nLes contrôles d''accès ne peuvent être modifiés que par le propriétaire de la page -- l''administrateur technique peut aussi manuellement modifier ces contrôles en travaillant directement sur la base de données.\nLe propriétaire d''une page voit apparaître, dans la page dont il est propriétaire, l''option \"Éditer permissions\" : cette option lui permet de modifier les contrôles d''accès.\nCes contrôles sont matérialisés par des colonnes où le propriétaire va ajouter ou supprimer des informations.\nLe propriétaire peut compléter ces colonnes par les informations suivantes, séparées par des espaces :\n - le nom d''un ou plusieurs utilisateurs : par exemple \"\"CharlesNepote\"\" ou \"\"DavidDelon\"\"\n - le caractère ***** désignant tous les utilisateurs\n - le caractère **+** désignant les utilisateurs enregistrés\n - le caractère **!** signifiant la négation : par exemple !\"\"CharlesNepote\"\" signifie que \"\"CharlesNepote\"\" **ne doit pas** avoir accès à cette page\n\n===== Droits d''accès par défaut =====\nPour toute nouvelle page créée, [[http://www.wikini.net WikiNi]] applique des droits d''accès par défaut. Ces droits d''accès sont configurables via le fichier /wakka.config.php.\nIl faut renseigner les trois variables de configuration suivantes :\n##\n \"default_write_acl\" => \"*\",\n \"default_read_acl\" => \"*\",\n \"default_comment_acl\" => \"*\",\n##\n\nPar exemple, vous pouvez souhaiter que, par défaut, seuls les utilisateurs enregistrés puisse modifier des pages. Vous utiliserez alors :\n##\n \"default_write_acl\" => \"+\",\n \"default_read_acl\" => \"*\",\n \"default_comment_acl\" => \"*\",\n##', '', '', 'ekotribu', 'Y', 'page', ''),
(59, 'AideWikiNi', '2006-09-21 10:52:50', '**=====Mode d''emploi de la rubrique \"Projet\"=====**\n\n==A partir de petites animations, tu vas découvrir comment utiliser ton espace projet. Clique sur la question qui se rapproche de celle que tu te poses :==\n\n - [[AideUn Comment écrire, mettre en page et sauvegarder sur une page ?]]\n - [[AideDeux Comment créer une nouvelle page dans l''espace projet ?]]\n - [[AideTrois Comment mettre en ligne un document dans mon projet, illustrer mes textes avec une image ?]]\n - [[AideQuatre Comment créer un menu dans l''espace de mon projet ?]]\n - [[AideCinq Comment faire des liens vers d''autres sites ou d''autres pages dans mon projet ?]]\n\n=====Et aussi... =====\n\n - [[PageMemo un petit mémo général]]\n\n - ReglesDeFormatage : résumé des syntaxes \"\"WikiNi\"\" permettant la mise en forme du texte.\n\n - ListeDesActionsWikini : liste des actions disponibles dans [[http://www.wikini.net WikiNi]].\n\n - ControlerLAccesAuxPages : explique comment gérer les droits d''accès aux pages de [[http://www.wikini.net WikiNi]].\n\n - [[http://www.wikini.net un site pleins d''infos sur le WikiNi]]\n\n - Pour poser des questions plus spécifiques [[http://ekotribu.org/papyrus.php?site=1&menu=15&wiki=FaQ C''est ici !]]\n\n----', '', '', 'ekotribu', 'Y', 'page', ''),
(61, '". $root_page ."', '2006-09-21 10:53:19', '======Bienvenue sur L''Ekotribu !======\n\n----\n\n=====ICI, C''EST L''ESPACE DE TON PROJET=====\n\nEn tant que participant, tu vas pouvoir **créer tes propres pages** et ton menu pour présenter aux autres participants tes projets mais aussi expliquer, **étape par étape**, tes avancements et tes questionnements. Cet espace, **c''est à toi de le compléter**, autant de fois que tu le souhaites.\n\n\n----\n\n=====Quelques pistes pour personnaliser ton espace :=====\n\n - Double-clique sur la page pour rédiger.\n - Pour trouver les réponses à toutes tes questions, [[http://ekotribu.org/papyrus.php?site=1&menu=15 clique ici !]] \n - Pour apprendre à rédiger, mettre des photos, des liens sur l''espace projet, clique sur l''aide, dans ton menu à gauche\n\n\n----\n\n====Un petit exercice pour s''échauffer ?====\n\n[[http://ekotribu.org/images/Grenouille.jpg image]]\n\nCommence par personnaliser cette page en supprimant tout le texte de bienvenue pour créer ton propre texte sur ton projet. **C''est parti !!**', '', '', 'ekotribu', 'Y', 'page', ''),
(64, 'ReglesDeFormatage', '2006-09-21 12:59:40', '[[AccueiL Retour]]\n\n====== Guide des règles de formatage ======\n\nLes règles de formatage avec Wakka différent làgàrement des autres Wikis. (Voir par exemple [[http://c2.com/cgi/wiki?TextFormattingRules les règles de formatage de WikiWikiWeb]], le premier Wiki connu.)\nTout texte placé entre deux guillemets doubles - \" - est présenté tel que.\n\nVous pouvez effectuer vos propres tests dans le BacASable : c''est un endroit fait pour ça.\n\n=== Règles de base : ===\n \"\"**Texte en gras !** -----\"\"> **Texte en gras !**\n \"\"//Texte en italique.// -----\"\"> //Texte en italique.//\n \"\"Texte __souligné__ ! -----\"\"> Texte __souligné__ !\n \"\"##texte à espacement fixe## -----\"\"> ##texte à espacement fixe##\n \"\"%%code%%\"\"\n \"\"%%(php) PHP code%%\"\"\n\n=== Liens forcés : ===\n \"\"[[http://www.mon-site.org]]\"\"\n \"\"[[http://www.mon-site.org Mon-site]]\"\"\n \"\"[[P2P]]\"\"\n \"\"[[P2P Page sur le P2P]]\"\"\n\n=== Liens dans Wikini ===\n Pour réaliser un lien dans wikini qui apparaisse avec un style normal utilisez cette écriture :\n \"\"[[ReglesDeFormatage Règles de Formatage]]\"\"\n Le lien apparaîtra de cette manière [[ReglesDeFormatage Règles de Formatage]].\n\n=== En-têtes : ===\n \"\"====== En-tête énorme ======\"\" ====== En-tête énorme ======\n \"\"===== En-tête très gros =====\"\" ===== En-tête très gros =====\n \"\"==== En-tête gros ====\"\" ==== En-tête gros ====\n \"\"=== En-tête normal ===\"\" === En-tête normal ===\n \"\"== Petit en-tête ==\"\" == Petit en-tête ==\n\n=== Séparateur horizontal : ===\n \"\"----\"\"\n\n=== Retour de ligne forcé : ===\n \"\"---\"\"\n=== Indentation : ===\nL''indentation de textes se fait avec la touche \"TAB\". Vous pouvez aussi créer des listes à puces ou numérotées :\n \"\"- liste à puce\"\"\n \"\"1) liste numérotée (chiffres arabes)\"\"\n \"\"A) liste numérotée (capitales alphabétiques)\"\"\n \"\"a) liste numérotée (minuscules alphabétiques)\"\"\n \"\"i) liste numérotée (chiffres romains)\"\"\n\n=== Inclure une image ===\n\n - Pour inclure un lien sur une image (sans l''inclure à la page):\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(ne pas indiquer de texte alternatif).\n Ce qui donne : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n\n - Pour inclure une image sans indiquer de texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(laisser 3 espaces blancs avant la fermeture des crochets).\n Ce qui donne quand l''image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n Quand l''image n''est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif]]\n\n - Pour inclure une image en indiquant un texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\"\"\n Ce qui donne quand l''image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\n Quand l''image n''est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif une puce ]]\n\n//Note :// le texte alternatif est affiché à la place de l''image s''il y a une erreur lors de l''affichage de celle-ci.\n\n=== Outils avancés : ===\n\n \"\"{{Backlinks}}\"\" permet de créer un lien vers la page précédente. \n \"\"{{Listusers}}\"\" affiche la liste des utilisateurs du site wikini.\n \"\"{{OrphanedPages}}\"\" affiche les pages orphelines du site wikini.\n \"\"{{ListPages/tree}}\"\" affiche le plan du site wikini.\n \"\"{{pageindex}}\"\" affiche un index des pages du site classées par lettres alphabétiques.\n \"\"{{ListPages}}\"\" affiche un index des pages du site avec le nom de leur propriétaire.\n \"\"{{WantedPages}}\"\" affiche la liste des pages restant à créer. Elles apparaissent dans le site avec un ? à la suite de leur nom.\n \"\"{{RecentChanges}}\"\" affiche la liste des sites faisant référence au site wikini.\n \"\"{{RecentlyCommented}}\"\" affichage de la liste des derniers commentaires.\n \"\"{{TextSearch}}\"\" recherche de texte dans les pages du site.\n\n**Note :** à cause d''un [[http://bugzilla.mozilla.org/show_bug.cgi?id=10547 bogue dans son moteur de rendu]], les listes, utilisant la touche TAB, ne fonctionnent pas (encore) sous Mozilla.\nUne astuce consiste à réaliser une tabulation dans un éditeur de texte puis de la copier. On peut ensuite coller la tabulation dans la zone de saisie de Wikini.\nVous pouvez également indenter du texte en utilisant des caractères espace au lieu de la touche \"TAB\", les exemples ci-dessus restent valables mais attention à ne pas mélanger des \"TAB\" et des espaces dans la même ànumàration.\n\n---', '', '', 'ekotribu', 'Y', 'page', ''),
(66, 'PageMenu', '2006-09-21 14:30:48', '======Menu======\n\n - [[AccueiL Page d''accueil]]\n - [[AideWikiNi Aide]]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"<div class=\"centrage\"><a id=\"rss\" href=\"wakka.php?wiki=DerniersChangementsRSS/xml\"><img src=\"http://ekotribu.org/images/rss.png\" alt=\"Syndication RSS\" /></a></div>\"\"', '', '', 'ekotribu', 'Y', 'page', '');
");
} // end of member function creation_tables
 
/**
*
*
* @param string prefixe Le préfixe des tables à supprimer
* @return void
* @access public
*/
function suppression_tables( $prefixe )
{
$resultat = $this->_db->query("DROP TABLE `".$prefixe."_acls` ,`".$prefixe."_links` ,`".$prefixe."_pages` ,`".
$prefixe."_referrers` ,`".$prefixe."_users`") ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete de suppression <br />'.$resultat->getMessage()) ;
}
} // end of member function suppression_tables
 
 
 
 
 
} // end of gestion_wikini
?>
/branches/v2.0-narmer/client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php
New file
0,0 → 1,238
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_admin_wikini.fonct.php,v 1.5 2006-09-21 14:18:06 florian Exp $
/**
* Application gérant les Wikini associe à Papyrus
*
* Cette application permet de gérer les parametre des wikini associés à l'ensemble d'un papyrus
* TODO : Gestion mise a jour wakka.config.php !!!!!
* TODO : afficher les utilisations par les menus.
* TODO : synchronisation FTP ? .... : creation, suppression, liste (renommer ???)
* TODO : chemin vers le wikini ... (non, calcul en fonction du code alpha) , mais controles ? Pas dans un
* premier temps ...
* TODO : installation des wikini (tables présentes etc, et gestion ... (suppression ...)
* TODO : un wiki par défaut pour chaque papyrus, ce wiki sert de modèle
*
*@package Admin_Wikini
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier de configuration de cette application.*/
require_once PAP_CHEMIN_RACINE.'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
 
//Utilisation de la bibliothèque PEAR NET_URL
 
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm/select.php';
 
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
 
/** Inclusion des fonctions de manipulation du sql.
* Permet la récupération d'un nouvel identifiant d'une table.*/
require_once ADWI_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_HTML_formulaireWikini.class.php' ;
 
 
// Inclusion des fichiers de traduction de l'appli ADME dePapyrus
if (file_exists(ADWI_CHEMIN_LANGUE.'adwi_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
require_once ADWI_CHEMIN_LANGUE.'adwi_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
} else {
/** Inclusion du fichier de traduction par défaut.*/
require_once ADWI_CHEMIN_LANGUE.'adwi_langue_'.ADWI_I18N_DEFAUT.'.inc.php';
}
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
function admin_afficherContenuCorpsHTML() {
return admin_afficherContenuCorps();
}
 
function admin_afficherContenuCorps()
{
/* Gestion de Deux "écrans" et des actions associées : liste des Wikini en base de donnees et ajout-modification
* d'un Wikini
*/
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$url = $GLOBALS['_GEN_commun']['url'] ;
$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
 
isset ($GLOBALS['action']) ? '' : $GLOBALS['action'] = '' ; // On déclare action si elle n'existe pas
 
if (!$auth->getAuth()) {
return 'Identifiez-vous' ;
}
 
// Le lien pour une nouvelle entrée
$res = '<a href="'.$url->getURL().'&amp;action=nouveau">'.ADWI_AJOUTER.'</a>'."\n<br />" ;
 
 
// traitement de la suppression
if (isset ($GLOBALS['action']) && $GLOBALS['action'] == 'supprimer') adwi_supprimer_wikini($GLOBALS['id_wikini'], $db) ;
 
// traitement de l'ajout et de la modification de la ligne selectionnée
 
if (isset ($GLOBALS['action']) || isset ($GLOBALS['id_wikini'])) {
 
$formulaire = new HTML_formulaireWikini('formulaire_wikini', '', str_replace ('&amp;', '&', $url->getURL())) ;
$formulaire->construitFormulaire($url) ;
 
// C'est une demande d'ajout : Affichage du masque de saisie et ajout d'un champs caché avec action=nouveau_v
 
if ($GLOBALS['action'] == 'nouveau') {
$formulaire->addElement ('hidden', 'action', 'nouveau_v') ;
return $formulaire->toHTML() ;
}
 
// C'est une demande de modification : Affichage du masque de saisie et ajout d'un champs caché avec action=modifier_v
 
if (isset ($GLOBALS['id_wikini']) && $GLOBALS['action'] != 'modifier_v' && $GLOBALS['action'] != 'supprimer') {
$formulaire->addElement ('hidden', 'action', 'modifier_v') ;
$formulaire->addElement ('hidden', 'id_wikini', $GLOBALS['id_wikini']) ;
$formulaire->setDefaults(adwi_valeurs_par_defaut($GLOBALS['id_wikini'], $db)) ;
return $formulaire->toHTML() ;
}
 
// Enregistrement de la modification et retour à la liste
 
if ($GLOBALS['action'] == 'modifier_v') {
if ($formulaire->validate()) {
mise_a_jour ($formulaire->getSubmitValues(), $db) ;
}
}
 
// Enregistrement de l'ajout et retour à la liste
 
if ($GLOBALS['action'] == 'nouveau_v') {
if ($formulaire->validate()) {
insertion ($formulaire->getSubmitValues(), $db) ;
}
}
 
}
 
 
// Comportement par défaut
// requete sur la table gen_wikini pour affichage de la liste des Wikini
$requete = "select gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
$liste = new HTML_TableFragmenteur () ;
$liste->construireEntete(array (ADWI_NOM_WIKINI, ADWI_PAGE, ADWI_MODIFIER, ADWI_SUPPRIMER,ADWI_VISITER)) ;
$tableau_wikini = array() ;
while ($ligne = $resultat->fetchRow()) {
$url->addQueryString ('id_wikini', $ligne[0]) ;
array_push ($tableau_wikini, array ($ligne[1]."\n", // Première colonne, le nom de l'application
$ligne[2]."\n", // Deuxieme colonne, la page par defaut
'<a href="'.$url->getURL().'">'.ADWI_MODIFIER.'</a>'."\n",
'<a href="'.$url->getURL().'&amp;action=supprimer" onclick="javascript:return confirm (\''.ADWI_SUPPRIMER.' ?\');">'.ADWI_SUPPRIMER.'</a>'."\n",
'<a href="'.ADWI_CHEMIN_WIKINI.$ligne[1].'">'.ADWI_VISITER.'</a>'."\n"
));
}
$liste->construireListe($tableau_wikini) ;
$res .= $liste->toHTML();
return $res ;
}
 
 
 
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2006/06/02 09:12:16 florian
* ajout constante chemin
*
* Revision 1.3 2006/05/10 16:02:49 ddelon
* Finition multilinguise et schizo flo
*
* Revision 1.2 2006/04/28 12:41:26 florian
* corrections erreurs chemin
*
* Revision 1.1 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.7 2005/10/21 20:55:06 ddelon
* todo wikini
*
* Revision 1.6 2005/09/30 07:48:35 ddelon
* Projet Wikini
*
* Revision 1.5 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/09/06 08:35:36 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.3 2005/09/02 11:29:25 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.2 2005/08/31 17:34:52 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.1 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.4 2005/03/09 10:46:17 jpm
* Changement d'un nom de fichier.
*
* Revision 1.3 2005/03/09 10:40:26 alex
* version initiale
*
* Revision 1.2 2005/02/28 10:32:59 jpm
* Changement de nom de dossier.
*
* Revision 1.1 2004/12/13 18:07:19 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/projet/projetRSS.php
New file
0,0 → 1,77
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projetRSS.php,v 1.2 2005-10-28 07:34:32 florian Exp $
/**
* Générateur de flux RSS à partir du bazar
*
*@package bazar
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/projet.inc.php'; //fichier de configuration de Bazar
include_once 'bibliotheque/projet.fonct.rss.php'; //fichier des fonctions RSS de Bazar
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS DU PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_GET['domaine'])) {
$domaine=$_GET['domaine'];
}
else {
$domaine='';
}
if (isset($_GET['nbitem'])) {
$nbitem=$_GET['nbitem'];
}
else {
$nbitem='';
}
if (isset($_GET['liste'])) {
$liste=$_GET['liste'];
}
else {
$liste='';
}
 
echo html_entity_decode(gen_RSS($domaine, $nbitem, $liste));
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/10/25 13:50:34 alexandre_tb
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/projet/arbre.css
New file
0,0 → 1,18
/*
+----------------------------------------------------------------------------+
| arbre.css |
+----------------------------------------------------------------------------+
| Copyright (c) 2005 Tela Botanica |
+----------------------------------------------------------------------------+
| Feuille de style specifique a l'application projet de Tela Botanica |
+----------------------------------------------------------------------------+
| Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
+----------------------------------------------------------------------------+
*/
 
.lien_nom {
font-weight:bold;
}
.image_lien, .image_lien:hover {
display:block;
background-image:none;}
/branches/v2.0-narmer/client/projet/services/telechargement.php
New file
0,0 → 1,100
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: telechargement.php,v 1.1.2.2 2007-06-04 15:42:49 alexandre_tb Exp $
/**
* Application projet
*
* Service de telechargement recoie un id de document et renvoie le document
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
if (is_object ($this) && $this->_id_document == '') {
return 'aucun fichier demand&eacute;';
} else {
if (!is_object($this) && isset ($_GET['id_document'])) {
$id_document = $_GET['id_document'];
}
}
 
if (is_object ($this)) {
$id_document = $this->_id_document;
}
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
include_once PROJET_CHEMIN_CLASSES.'document.class.php';
 
 
$document = new document ($id_document, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
$projet = new projet ($document->_id_projet);
// Soit le document est public et on le renvoie, soit il est prive
// et on teste les droits
 
if ($document->getVisibilite() == 'prive') {
// On teste le login
if ($GLOBALS['projet_auth']->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$id_utilisateur = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID);
$participant = new participe($GLOBALS['projet_db']) ;
if ($participant->isAdministrateur($id_utilisateur) || $participant->isCoordinateur($id_utilisateur)
|| $participant->isContributeur($id_utilisateur)) {
$ok = true ;
} else {
$ok = false ;
return 'Vous devez participer &agrave; ce projet pour acc&eacuteder &agrave; ce document';
}
}
} else {
$ok = true ;
}
 
// Recherche de l extension
$nom_de_fichier = pathinfo ($projet->getNomRepertoire().'/'.$document->getChemin()) ;
$extension = $nom_de_fichier['extension'];
 
header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
header('Cache-Control: Public, must-revalidate');// HTTP/1.1
header('Pragma: hack');
header ('Content-Type: '.$document->getTypeMime()) ;
header('Content-Length: '.(string) $document->getTaille());
header ('Content-Disposition: attachment; filename="'.$document->getNomLong().'.'.$extension.'"');
header("Content-Transfer-Encoding: binary\n");
 
readfile (PROJET_CHEMIN_FICHIER.$document->getChemin());
 
exit();
 
 
?>
/branches/v2.0-narmer/client/projet/services/ecouteArbreFichier.php
New file
0,0 → 1,170
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ecouteArbreFichier.php,v 1.1.2.3 2007-06-04 15:42:17 alexandre_tb Exp $
/**
* Application projet
*
* Service d ecoute de l arbre du porte document, renvoie les donnees du repertoire demande
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.1.2.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// ATTENTION - le programme suivant doit renvoyer un tableau, meme vide
// sinon l arbre dojo ne fonctionnera pas (ligne 117 $returnArray = array)
 
 
include_once (GEN_CHEMIN_API.'json/JSON.php');
 
$action = $_REQUEST["action"];
$data = $_REQUEST["data"];
$cache = $_REQUEST["dojo.preventCache"];
 
$data = str_replace("\\\"","\"",$data);
 
// instanciation d un json-php
 
$json = new services_JSON();
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
}
 
if ( $action == "getChildren") {
$jsonData = $json->decode($data);
// get the node object
$node = $jsonData->node;
// on recupere le noeud parent
$parent = $node->objectId;
if (isset($_REQUEST['id_projet'])) $id_projet = $_REQUEST['id_projet'];
if (preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) $id_projet = $match[1];
// correspondance entre l objectid de dojo et id_parent de projet_document
if ( $parent == "root" || preg_match ('/projet_([0-9]+)/', $node->objectId, $match)) {
$id_parent = 0 ;
} else {
$id_parent = $node->objectId;
}
$sql = 'select * from projet_documents where pd_pere='.$id_parent ;
if (isset($id_projet)) $sql .= ' and pd_ce_projet='.$id_projet;
$sql .= ' order by pd_nom';
$resultat = $GLOBALS['projet_db']->query($sql);
 
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$nodeArray = array();
$i = 0;
include_once PROJET_CHEMIN_CLASSES.'document.class.php';
if ($GLOBALS['projet_auth']->getAuth() && is_object($this)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($GLOBALS['projet_db']) ;
$id_u = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $GLOBALS['projet_db']) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID), $GLOBALS['projet_db']) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $GLOBALS['projet_db']);
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
} else {
$droits = PROJET_DROIT_AUCUN;
}
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$document = new document($ligne['pd_id'], $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES);
$GLOBALS['url']->addQueryString('id_projet', $id_projet);
$GLOBALS['url']->addQueryString('id_document', $document->getIdDocument());
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'telechargement');
// json attend de l utf8, en lui fournissant des donnees au format htmlentities,
// ca passe
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($document->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On regarde si l utilisateur a les droits pour deplacer
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
}
else $actions = '';
$node = array(
'title'=> iconv('ISO-8859-1', 'UTF-8', $document->getNomLong()),
'widgetId' => 'document_'.$document->getIdDocument(),
'objectId'=> $document->getIdDocument(),
'isFolder'=> $document->isRepertoire(),
'link' => str_replace ('&amp;', '&', $GLOBALS['url']->getURL()),
'childIconSrc' => $document->getCheminIcone(),
'expandIcon' => PROJET_CHEMIN_ICONES.'folder-expanded.gif',
'afterLabel' => ' '.$document->getTailleFormatee().' '.iconv('ISO-8859-1', 'UTF-8',$nom_prenom),
);
// On regarde si l utilisateur a les droits pour deplacer
/*
if ($droits <= PROJET_DROIT_COORDINATEUR ||
$GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$actions = 'MOVE,REMOVE,EDIT' ;
if ($document->isRepertoire()) $actions .= ',ADDCHILD';
$node['actions'] = $actions;
}
else {
$node['actions'] = '';
}*/
$nodeArray[$i] = $node;
$i++;
unset ($document);
}
if (!is_null($nodeArray)) {
header ('Content-type: json');
print $json->encode($nodeArray);
exit();
}
}
 
 
 
 
 
?>
/branches/v2.0-narmer/client/projet/services/serviceDeplacementFichier.php
New file
0,0 → 1,71
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: serviceDeplacementFichier.php,v 1.1 2007-04-19 09:37:50 alexandre_tb Exp $
/**
* Application projet
*
* Service pour deplacer un fichier, recoie l id du fichier a deplacer et l id du repertoire cible
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// effectue le deplacement d un fichier, repond a un appel d arbreDocument.js
 
// On se situe dans la methode run() de projetControleur
 
// L url contient
// id_projet=id_projet&service=serviceDeplacement&enfant=id_du_doc_a_deplacer&parent=id_du_repertoire_cible
 
// $_GET['parent'] peut valoir 'root' auquel cas on remplace par 0, cela signifie
// qu on deplace un fichier vers le repertoire racine du projet
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
 
header ('Content-type:text/json');
if (isset($_GET['enfant'])) {
$document = new document($_GET['enfant'], $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas où l'on vient de déplacer un fichier
if (isset ($_GET['parent'])) {
if ($_GET['parent'] == 'root') $id_cible = 0 ; else $id_cible = $_GET['parent'];
if (!$document -> deplace ($id_cible, $projet->getNomRepertoire())) {
echo 'echec du déplacement' ;
}
exit() ;
}
}
exit();
?>
/branches/v2.0-narmer/client/projet/synchroliste/synchro_listes_conf.php
New file
0,0 → 1,17
<?php
/**
//==================================== CONSTANTES ==================================
* Constantes de l'appli de synchronisation
//==================================================================================
*/
define ("SYN_PROTOCOLE", "mysql") ;
define ("SYN_UTILISATEUR", "") ;
define ("SYN_MOT_DE_PASSE_DB", "") ;
define ("SYN_HOTE", "localhost") ;
define ("SYN_BASE", "") ;
define ("SYN_NOMDOMAINE", "");
define ("SYN_CHEMIN_GESTION_PROJET", "") ;
define ("SYN_CHEMIN_LOG", "") ;
define ("SYN_UTILISATEUR", '') ;
define ('SYN_GROUPE', '') ;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/suppression_abonne.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-unsub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-unsub '.$repertoire.' '.$mail;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/forumRSS.php
New file
0,0 → 1,48
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: forumRSS.php,v 1.1 2005-11-23 11:40:49 alexandre_tb Exp $
/**
* Générateur de flux RSS à partir d'une liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $$
// +------------------------------------------------------------------------------------------------------+
*/
 
include_once 'ezmlm-php-2.0/ezmlm-xml.php' ;
 
// test des variables
 
if (!isset($domaine) || !isset($liste)) {
exit() ;
}
 
$list = new ezmlm_xml() ;
$list->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
header('Content-type: text/xml') ;
$list->show_rss() ;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/ajout_abonne.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-sub '.$repertoire.' '.$mail;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/creation_liste.php
New file
0,0 → 1,16
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ;
 
 
// Transformation de ma chaine $parametres ((de aBud en -a -B -u -D)
$para = '' ;
for ($i = 0; $i < count ($parametres); $i++) {
$para .= '-'.$parametres.' ' ;
}
// On ajoute que la réponse doit repartir à la liste
$para .= ' -3 '.$liste.'@'.$domaine;
echo exec ('ezmlm-make '.$para.' '.$repertoire.' '.$fichier_qmail.' '.$liste.' '.$domaine, $output, $ret) ;
 
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/liste_abonnes.php
New file
0,0 → 1,18
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
//echo $repertoire;
exec ('ezmlm-list '.$repertoire, $output, $ret) ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_liste_abonnes', array('domaine' => $domaine, 'liste' => $liste)) ;
 
foreach ($output as $mail) $xml .= XML_Util::createTag('email', '', $mail) ;
 
$xml .= XML_Util::createEndElement('ezmlm_liste_abonnes') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/ajout_moderateur.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste.'/mod' ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-sub '.$repertoire.' '.$mail ;
?>
/branches/v2.0-narmer/client/projet/synchroliste/vpopmail/suppression_liste.php
New file
0,0 → 1,19
<?php
 
if (!isset ($domaine) || $domaine == '' || !isset($liste) || $liste == '') {
die ('manque paramètre domaine ou liste') ;
}
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-' ;
 
 
echo exec ('rm '.$fichier_qmail.$liste, $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.$liste.'-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.$liste.'-digest-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.$liste.'-digest-return-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.$liste.'-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.$liste.'-return-default', $output2, $ret2) ;
 
echo exec ('rm -rf '.$repertoire, $output, $ret) ;
 
?>
/branches/v2.0-narmer/client/projet/synchroliste/fichier_attache.php
New file
0,0 → 1,86
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier_attache.php,v 1.2 2005-09-27 16:46:06 alexandre_tb Exp $
/**
* Application projet
*
* Fichier pour afficher les pièces jointes
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// A faire
 
include_once '../configuration/projet.config.inc.php' ;
include_once 'Mail/mimeDecode.php' ;
 
 
$num_rep = array_shift ($actionargs) ;
$num_message = array_shift($actionargs) ;
 
$mail = file_get_contents (PROJET_CHEMIN_LISTES.PROJET_DOMAINE_LISTE.'/'.$nom_liste.'/'.'archive/'.$num_rep.'/'.$num_message) ;
$decodeur = new Mail_mimeDecode($mail) ;
$mailDecode = $decodeur->decode(array ('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
 
//var_dump ($mailDecode) ;
function getParts(&$part, $num_part) {
$part = $part->parts[$num_part] ;
return $part ;
}
 
for ($i = 0; $i < count ($actionargs); $i++) {
$part = getParts($mailDecode, $actionargs[$i]) ;
}
 
$content_type = $part->ctype_primary.'/'.$part->ctype_secondary ;
 
// Certain fichiers attaché n'ont pas de ctype_primary et ctype_secondary
if ($content_type == '/') {
$content_type = $part->content_type;
}
 
$nom_du_fichier = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : $part->ctype_parameters['name'] ;
//echo $content_type ;
 
header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
header('Cache-Control: Public');// HTTP/1.1
header ('Content-Type: '.$content_type."\r\n") ;
header("Content-Length: ".strlen($part->body).";\r\n");
header ('Content-Disposition: attachment; filename="'.$nom_du_fichier.'"'."\r\n");
header('Content-Transfer-Encoding: '.$part->content-transfer-encoding);
echo $part->body ;
exit(0) ;
 
?>
/branches/v2.0-narmer/client/projet/synchroliste/synchro_listes.php
New file
0,0 → 1,50
<?php
include_once "DB.php" ;
include_once "synchro_listes_conf.php";
 
// Formation du dsn
$dsn = SYN_PROTOCOLE."://".SYN_UTILISATEUR.":".SYN_MOT_DE_PASSE_DB."@".SYN_HOTE."/".SYN_BASE;
 
// Connection à la base
$db = & DB::connect($dsn) ;
 
 
include_once SYN_CHEMIN_GESTION_PROJET.'/classes/commande_serveur.class.php' ;
$commande_serveur = new commande_serveur(SYN_CHEMIN_GESTION_PROJET.'/script_cron/ezmlm.sh') ;
$commande_serveur->enleverToutesCommandes() ;
unset ($commande_serveur) ;
 
$requete = "select distinct pl_adresse_liste from projet_liste";
$resultat = $db->query ($requete);
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
$nomliste=explode('@',$ligne['pl_adresse_liste']) ;
echo "\nSynchronisation de la liste ".$nomliste[0].":\n";
if (!is_dir(SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE)) {
mkdir(SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE);
}
$commande='/usr/bin/rsync -rptgo --delete --log-format="%o %f %l %t" /home/vpopmail/domains/'
.SYN_NOMDOMAINE.'/'.$nomliste[0].' '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE.' ';
echo exec ($commande, $sortie) ;
$commande = 'chmod 711 '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE.'/'.$nomliste[0] ;
echo" $commande\n";
echo exec($commande, $sortie);
$commande = 'chmod 750 '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE.'/'.$nomliste[0].'/archive/' ;
echo" $commande\n";
echo exec($commande, $sortie);
$commande = 'chmod 755 '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE.'/'.$nomliste[0].'/text/' ;
echo" $commande\n";
echo exec($commande, $sortie);$commande = 'chmod 755 '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/'.SYN_NOMDOMAINE.'/'.$nomliste[0].'/text/info' ;
echo" $commande\n";
echo exec($commande, $sortie);
echo "\n--->Synchronisation terminée!!\n\n";
}
echo "\nMise à jour des droits sur le répertoire\n";
$commande='chown '.SYN_UTILISATEUR.':'.SYN_GROUPE.' '.SYN_CHEMIN_GESTION_PROJET.'/synchroliste/liste/ -R';
 
echo "$commande\n" ;
echo exec($commande, $sortie);
 
?>
/branches/v2.0-narmer/client/projet/synchroliste/liste/vide.txt
--- projet/fichier_attache.php (revision 0)
+++ projet/fichier_attache.php (revision 1976)
@@ -0,0 +1,98 @@
+<?php
+/*vim: set expandtab tabstop=4 shiftwidth=4: */
+// +------------------------------------------------------------------------------------------------------+
+// | PHP version 4.1 |
+// +------------------------------------------------------------------------------------------------------+
+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
+// +------------------------------------------------------------------------------------------------------+
+// | This library is free software; you can redistribute it and/or |
+// | modify it under the terms of the GNU General Public |
+// | License as published by the Free Software Foundation; either |
+// | version 2.1 of the License, or (at your option) any later version. |
+// | |
+// | This library 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 library; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+// +------------------------------------------------------------------------------------------------------+
+// CVS : $Id: fichier_attache.php,v 1.1 2006-04-19 13:51:57 alexandre_tb Exp $
+/**
+* Application projet
+*
+* Fichier pour afficher les pièces jointes
+*
+*@package projet
+//Auteur original :
+*@author Alexandre Granier <alexandre@tela-botanica.org>
+//Autres auteurs :
+*@author Aucun
+*@copyright Tela-Botanica 2000-2004
+*@version $Revision: 1.1 $
+// +------------------------------------------------------------------------------------------------------+
+*/
+
+
+// +------------------------------------------------------------------------------------------------------+
+// | ENTETE du PROGRAMME |
+// +------------------------------------------------------------------------------------------------------+
+
+// A faire
+
+include_once 'configuration/projet.config.inc.php' ;
+include_once ('classes/ezmlmAccessObject.class.php') ;
+include_once 'Mail/mimeDecode.php' ;
+
+
+$num_rep = array_shift ($actionargs) ;
+$num_message = array_shift($actionargs) ;
+
+$xml_parser = &new ezmlmAccessObject('message', PROJET_DOMAINE_LISTE,
+ $nom_liste, $GLOBALS['lang']) ;
+$xml_parser->setIdMessage($num_rep, $num_message) ;
+$xml_parser->load();
+ob_start ();
+$xml_parser->parse() ;
+$mail = ob_get_contents() ;
+ob_end_clean();
+/*
+$mail = file_get_contents (PROJET_CHEMIN_LISTES.PROJET_DOMAINE_LISTE.'/'.$nom_liste.'/'.'archive/'.$num_rep.'/'.$num_message) ;
+*/
+
+$decodeur = new Mail_mimeDecode($mail) ;
+$mailDecode = $decodeur->decode(array ('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
+
+//var_dump ($mailDecode) ;
+function getParts(&$part, $num_part) {
+ $part = $part->parts[$num_part] ;
+ return $part ;
+}
+
+for ($i = 0; $i < count ($actionargs); $i++) {
+ $part = getParts($mailDecode, $actionargs[$i]) ;
+}
+
+$content_type = $part->ctype_primary.'/'.$part->ctype_secondary ;
+
+// Certain fichiers attaché n'ont pas de ctype_primary et ctype_secondary
+if ($content_type == '/') {
+ $content_type = $part->content_type;
+}
+
+$nom_du_fichier = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : $part->ctype_parameters['name'] ;
+//echo $content_type ;
+
+header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
+header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
+header('Cache-Control: Public');// HTTP/1.1
+header ('Content-Type: '.$content_type."\r\n") ;
+header("Content-Length: ".strlen($part->body).";\r\n");
+header ('Content-Disposition: attachment; filename="'.$nom_du_fichier.'"'."\r\n");
+header('Content-Transfer-Encoding: '.$part->content-transfer-encoding);
+echo $part->body ;
+exit(0) ;
+
+?>
\ No newline at end of file
/branches/v2.0-narmer/client/projet/projet.php
New file
0,0 → 1,272
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.php,v 1.14.2.1 2007-05-11 14:02:44 alexandre_tb Exp $
/**
* Application projet
*
* Fichier d'appel pour papyrus
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.14.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
 
// Inclusion des styles selon papyrus
if (function_exists("GEN_stockerStyleExterne")) {
if (file_exists('client/projet/projet.css')) GEN_stockerStyleExterne('projet','client/projet/projet.css') ;
if (file_exists('client/projet/arbre.css')) GEN_stockerStyleExterne('projet_arbre','client/projet/arbre.css') ;
}
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("PROJET_DEFAUT", 1) ;
define ("PROJET_VOIR", 2) ;
define ('PROJET_MENU_AFFICHER_CONTENU_CORPS', 1) ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
if (isset($_REQUEST[PROJET_VARIABLE_ID_PROJET])) {
function afficherContenuNavigation () {
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ID_PROJET, $_REQUEST[PROJET_VARIABLE_ID_PROJET]) ;
if (empty($_REQUEST[PROJET_VARIABLE_ACTION])) {
$_REQUEST[PROJET_VARIABLE_ACTION] = PROJET_ACTION_VOIR_RESUME ;
}
$res = '' ;
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$res .= '<ul class="onglets">';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_RESUME);
$res .= '<li id="projet_resume" class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DESCRIPTION);
$res .= '<li id="projet_description" class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_WIKINI);
$res .= '<li id="projet_wikini" class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
$res .= '<li id="projet_documents" class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
$res .= '<li id="projet_forum" class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li id="projet_participants" class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
$res .= '</ul>';
$GLOBALS['url']->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$res = '' ;
}
return $res ;
}
}
 
function afficherContenuMenu()
{
$sortie = '';
// on fait de meme pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
$controleur = new projetControleur($GLOBALS['projet_db'], $GLOBALS['projet_auth'], $GLOBALS['url']) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
if ($id_projet != '' && projet::projetExiste($GLOBALS['projet_db'], $id_projet)) {
$controleur->setIdProjet($id_projet) ;
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
// Dans le cas de la presentation par arbre, on met les menus
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)){
 
$sortie .= $controleur->menuGeneral() ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
// L'action "Mettre un fichier en ligne"
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
$res = "<ul><li><a href=\"".$controleur->_url->getURL()."\">".PROJET_METTRE_FICHIER."</a></li>\n" ;
 
// L'action creer un repertoire
$controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
$res .= "<li><a href=\"".$controleur->_url->getURL()."\">".PROJET_CREER_REP."</a></li>\n" ;
$res .= '</ul></li>' ;
$sortie .= $res ;
}
// Dans le cas d'un forum simple, on ne met pas les menus
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
return ;
}
return $sortie;
}
 
function afficherContenuCorps() {
 
// On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
$action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
// on fait de même pour id_projet
$id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
 
$service = isset($_REQUEST[PROJET_VARIABLE_SERVICE]) ? $_REQUEST[PROJET_VARIABLE_SERVICE] : '';
// et pour id_repertoire
$id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
 
// et pour id_document
$id_document = isset($_REQUEST['id_document']) ? $_REQUEST['id_document'] : '';
 
// On construit le controleur en lui passant en paramètre l'identifiant de connexion à la BD
// l'objet d'authentification et l'url de la page
$controleur = new projetControleur(&$GLOBALS['projet_db'], &$GLOBALS['projet_auth'], &$GLOBALS['url']) ;
$controleur->setAction ($action) ;
$controleur->setService($service);
// On indique au controleur sur quel projet on travaille
if ($id_projet != "") {
$controleur->setIdProjet($id_projet) ;
 
}
if ($id_repertoire != "") {
$controleur->setIdRepertoire($id_repertoire) ;
}
if ($id_document != "") {
$controleur->setIdDocument($id_document) ;
}
// recuperation des parametres de l'appli
if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
$controleur->setPresentation($GLOBALS['_GEN_commun']['info_application']->presentation) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->projet_type)) {
$controleur->setType($GLOBALS['_GEN_commun']['info_application']->projet_type) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->exclure)) {
$a_exclure = explode (',', $GLOBALS['_GEN_commun']['info_application']->exclure) ;
foreach ($a_exclure as $valeur) $controleur->exclure($valeur) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement_forum) ;
// S'il n'y a pas d'action en mode forum, on affiche l'onglet Forum
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_FORUM) ;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_DOCUMENT) ;
}
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement)) {
$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
}
// Si le parametre prive est passe, les inscriptions sont moderes
// TODO : permettre la demande d'inscription
if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
$controleur->setPrive() ;
}
$res = $controleur->run() ;
 
return $res ;
}
 
/** cma() calcule menu actif
*
*
* @return
*/
 
function cma ($var) {
$class = $_REQUEST[PROJET_VARIABLE_ACTION] == $var ? 'menu_actif' : 'menu_inactif' ;
return $class ;
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.14 2007/04/19 15:34:35 neiluj
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.13 2007/04/19 09:18:46 alexandre_tb
* ajout de la variable $service pour appeler les services (dans la cadre de liaisons asynchrones
*
* Revision 1.12 2006/07/04 09:35:04 alexandre_tb
* Simplification du code et ajout de controle
*
* Revision 1.11 2006/04/28 12:41:28 florian
* corrections erreurs chemin
*
* Revision 1.10 2005/12/01 16:38:32 alexandre_tb
* ajout de l'action telechargement
*
* Revision 1.9 2005/11/25 14:48:44 alexandre_tb
* ajout de la gestion de la présentation tela
*
* Revision 1.8 2005/10/25 13:50:13 alexandre_tb
* Ajout de la gestion des projets privés
*
* Revision 1.7 2005/10/17 16:22:28 alexandre_tb
* rien
*
* Revision 1.6 2005/10/06 14:54:06 alexandre_tb
* ajout de la gestion du paramètre seulement_forum
*
* Revision 1.5 2005/10/04 10:06:32 alexandre_tb
* ajout du parametre seulement_forum
*
* Revision 1.4 2005/09/28 16:29:39 ddelon
* Merge modification projet
*
* Revision 1.3 2005/09/27 16:31:06 alexandre_tb
* ??
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/branches/v2.0-narmer/client/projet/wikini/wakka.basic.css
New file
0,0 → 1,56
body { background-color: #F5F5F5; color: black; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; }
 
a { color: #993333; }
 
body, p, td, li, input, select, textarea { font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 13px; }
h1, h2, h3, h4, h5 { margin: 0px; padding: 0px; }
ul { margin-top: 0px; padding-top: 0px; padding-bottom: 0px; }
ol { margin-top: 0px; padding-top: 0px; padding-bottom: 0px; }
form { margin: 0px; padding: 0px; }
tt { color: Navy; }
 
 
.error { color: #CC3333; font-weight: bold; }
.indent { margin-left: 40px; }
.additions { color: #008800; }
.deletions { color: #880000; }
.add { font-weight: bold; color:#c00; text-decoration: underline; }
.del { font-style: italic; color:#c00; text-decoration: line-through; }
.header { padding: 10px; padding-top: 0px; }
.page { background-color: #FFFFFF; padding: 10px; border: 1px inset; }
.prev_alert { background-color: red; color: white; font-size: 1.7em; font-weight: bold; margin-bottom: 5px; }
.edit { width: 100%; height: 400px; }
.footer { background-color: #DDDDDD;padding: 5px; border: 1px inset }
.code { background: #FFFFFF; border: solid #888888 2px; font-family: 'Courier New', Courier; color: black; font-size: 10pt; width: 100%; overflow: scroll; padding: 3px; }
.revisioninfo { color: #AAAAAA; padding-bottom: 20px; }
 
.commentsheader { background-color: #DDDDDD; padding: 2px 10px; }
.comment { background-color: #EEEEEE; padding: 10px; }
.commentinfo { color: #AAAAAA; }
.commentform { background-color: #EEEEEE; padding: 10px; }
 
.copyright { font-size: 11px; color: #AAAAAA; text-align: right; }
.copyright A { color: #AAAAAA; }
.searchbox { background: #FFFFF8; border: 0px; padding: 0px; margin: 0px; }
.debug { font-size: 11px; color: #888888; }
 
/* CONTRIBUTION MENU GAUCHE */
.page_table {margin: 0px; padding: 0px ; border: none; height: 100%;width: 100%;}
.menu_column {background-color: #FFFFCC; vertical-align: top; width: 150px; border: 1px solid #000000;padding:5px;}
.body_column {vertical-align: top; border: none;padding:5px;}
 
/* CONTRIBUTION ACTION ATTACH */
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
/* - le gestionnaire des uploads */
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
/branches/v2.0-narmer/client/projet/wikini/ACeditor.js
New file
0,0 → 1,124
/*
written by chris wetherell
http://www.massless.org
chris [THE AT SIGN] massless.org
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
if there are any problems, let chris know.
*/
var ACEditor; /* make sure to change the onload handler of the
<body> tag to the form you're using!... */
function mozWrap(txtarea, lft, rgt) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd==1 || selEnd==2) selEnd=selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + lft + s2 + rgt + s3;
}
function IEWrap(lft, rgt) {
strSelection = document.selection.createRange().text;
if (strSelection!="") {
document.selection.createRange().text = lft + strSelection + rgt;
}
}
// Cette fonction permet de faire fonctionner l'insertion de tag image dans un textarea de IE sans sélection initiale,
// à la position du curseur
 
function IEWrap2(txtarea,lft, rgt) {
txtarea.focus();
if (document.selection) {
txtarea.focus();
sel = document.selection.createRange();
sel.text = lft+rgt;
}
}
function wrapSelection(txtarea, lft, rgt) {
if (document.all) {IEWrap(lft, rgt);}
else if (document.getElementById) {mozWrap(txtarea, lft, rgt);}
}
function wrapSelectionBis(txtarea, lft, rgt) {
// pareil que la wrapSelection, avec une différence dans IE
// qui permet à wrapSelectionBis de pouvoir insérer à l'endroit du curseur même sans avoir sélectionné des caractères !!!
// Pour mozilla, c'est bien la fonction Wrap standard qui est appelée, aucun changement
if (document.all) { // document.all est une infamie de IE, on détecte cette horreur !
IEWrap2(txtarea,lft, rgt); // Attention, un parametre de plus que IEWrap
} else if (document.getElementById) {
mozWrap(txtarea, lft, rgt); // là on est chez les gentils
}
}
function wrapSelectionWithLink(txtarea) {
var my_link = prompt("Entrez l'URL: ","http://");
if (my_link != null) {
lft="[[" + my_link + " ";
rgt="]]";
wrapSelection(txtarea, lft, rgt);
}
return;
}
/* Aaaxl modif for ACeditor */
function wrapSelectionWithImage(txtarea) {
nom = document.ACEditor.filename.value;
descript = document.ACEditor.description.value;
align = document.ACEditor.alignment.value;
 
lft= " {{attach file=\"" + nom + "\" desc=\"" + descript + "\" class=\"" + align + "\" }} ";
rgt = "";
wrapSelectionBis(txtarea, lft, rgt);
return;
}
document.onkeypress = function (e) {
if (document.all) {
key=event.keyCode; txtarea=thisForm.body;
if (key == 1) wrapSelectionWithLink(txtarea);
if (key == 2) wrapSelection(txtarea,'**','**');
if (key == 20) wrapSelection(txtarea,'//','//');
}
else if (document.getElementById) {
ctrl=e.ctrlKey; shft=e.shiftKey; chr=e.charCode;
if (ctrl) if (shft) if (chr==65) wrapSelectionWithLink(thisForm.body);
if (ctrl) if (shft) if (chr==66) wrapSelection(thisForm.body,'**','**');
if (ctrl) if (shft) if (chr==84) wrapSelection(thisForm.body,'//','//');
//if (ctrl) if (shft) if (chr==85) wrapSelection(thisForm.body,'__','__');
}
return true;
}
/* end chris w. script */
 
/*
written by meg hourihan
http://www.megnut.com
meg@megnut.com
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
but leave this text in place.
any problems, let meg know.
*/
function mouseover(el) {
el.className = "raise";
}
function mouseout(el) {
el.className = "buttons";
}
function mousedown(el) {
el.className = "press";
}
function mouseup(el) {
el.className = "raise";
}
/* end meg script */
/branches/v2.0-narmer/client/projet/wikini/INSTALL
New file
0,0 → 1,25
Wakka / Wikini Installation
 
 
Not much to it (as long as it works, ahem). Unpack/upload the distribution files
into a directory that can be accessed via the web. Then go to the corresponding URL.
A web-based installer will walk you through the rest.
 
Example:
 
If your website, say, http://www.mysite.com, is mapped to the directory /home/jdoe/www/,
and you place the Wakka distribution files into /home/jdoe/www/wakka/, you should go to
http://www.mysite.com/wakka/.
 
Note that Wakka distributions normally unpack into directories that include the version
in their name; you'll probably want to rename those to just "wakka" -- or, if you're
on a unixoid system, set up a symbolic link.
 
IMPORTANT: for installing or upgrading Wakka, do NOT access any of the files contained
in the setup/ subdirectory. They're used by the web-based installer/updater, but you
should really just access the Wakka directory itself, and it will (or at least should)
work perfectly.
 
Detailed instructions are available at <http://www.wakkawiki.com/WakkaInstallation>.
 
- Hendrik Mans <hendrik@mans.de>
/branches/v2.0-narmer/client/projet/wikini/COPYING
New file
0,0 → 1,340
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
 
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
 
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
 
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
 
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
 
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
 
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
 
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
 
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
 
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
 
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
 
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
 
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
 
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
 
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
 
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
 
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
 
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
 
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
 
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
 
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
 
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
 
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
 
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
 
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
 
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
 
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
 
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
 
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
 
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
 
NO WARRANTY
 
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
 
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
 
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
 
 
Also add information on how to contact you by electronic and paper mail.
 
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
 
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
 
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
 
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
 
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
/branches/v2.0-narmer/client/projet/wikini/bibliotheque/images/vide.txt
/branches/v2.0-narmer/client/projet/wikini/wakka.print.css
New file
0,0 → 1,75
* {margin: 0; padding: 0;}
p, td, li, input, select, textarea{ font-family:Georgia, Helvetica, Verdana, sans-serif;font-size:12px;color:#000;}
body {font-family:Georgia, Helvetica, Verdana, sans-serif;font-size:12px;color:#000;background: transparent;}
h1 {font-size:16px;font-weight:bold;padding:5px;}
h2 {font-size:14px;color:black;font-weight:bold;}
h3 {font-size:12px;color:black;font-weight:bold;}
h4 {font-size:12px;color:black;}
h5 {font-size:12px;color:black;}
hr {border: 1px solid;color:black;margin-top:5px;}
img {display:block;border:0;}
img a {display:block;}
a {color:#669;text-decoration:none;}
.wiki_name { display:none; float: left; padding-left: 60px; margin: 0px 15px 0px 10px; font-size: 150%; font-weight: bold; background-color: transparent; color: black;}
.page_name { display:none; font-size: 150%; background-color: transparent;}
.header { display:none; padding: 10px; padding-top: 5px; padding-left: 75px;}
ul { margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;}
ol { margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; }
form { margin: 0px; padding: 0px; }
tt {color: black; }
.error { display:none;color: #CC3333; font-weight: bold; }
.indent { margin-left: 40px; }
.additions { display:none;color: #008800; }
.deletions { display:none;color: #880000; }
.add { display:none;font-weight: bold; color: #c00; text-decoration: underline; }
.del { display:none;font-style: italic; color: #c00; text-decoration: line-through; }
.page { padding: 10px; margin:10px;border: 0px inset;}
.prev_alert { display:none;background-color: red; color: white; font-size: 1.7em; font-weight: bold; margin-bottom: 5px; }
.edit { width: 100%; height: 400px; }
.footer { display:none;background-color: #DDDDDD; padding: 5px 10px; border: 1px inset; border-top: none; border-top: 1px solid #CCCCCC }
.code { background: #FFFFFF; border: solid #888888 2px; font-family: 'Courier New', Courier; color: black; font-size: 10pt; width: 100%; height: 400px; overflow: scroll; padding: 3px; }
.revisioninfo { color: #AAAAAA; padding-bottom: 20px; }
.commentsheader { display:none;background-color: #DDDDDD; padding: 2px 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC }
.comment { display:none;background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #EEEEEE; }
.commentinfo { display:none;color: #AAAAAA; }
.commentform { background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC }
.copyright { display:none;font-size: 11px; color: #AAAAAA; text-align: right; }
.copyright A { display:none;color: #AAAAAA; }
.searchbox { display:none;background: #FFFFF8; border: 0px; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px; }
.debug { display:none;font-size: 11px; color: #888888; }
.hr_clear { clear: both; visibility: hidden; }
.include_right { float: right; width: 17%; } /* bloc flotant à droite */
.include_left { float: left; width: 17%; } /* bloc flotant à gauche */
.include_solid_border { border: solid; padding: 2px; } /* encadré noir */
.include_gray_background { background-color: #DDDDDD; } /* fond gris */
.include_small_fonts { font-size: 0.8em; } /* petites polices */
.include_big_fonts { font-size: 1.2em; } /* grandes polces */
.include_height10em { height: 10em; overflow: scroll; } /* boite de 10em de hauteur, avec ascenseur */
.include_height15em { height: 15em; overflow: scroll; }
.include_height30em { height: 30em; overflow: scroll; }
.include_height60em { height: 60em; overflow: scroll; }
.trail_table { line-height: 30px;}
.trail_button { color: #993333; }
 
/* CONTRIBUTION MENU GAUCHE */
.page_table {margin: 20px; padding: 0px ; border: none; height: 100%;width: 100%;}
.menu_column { display:none;vertical-align: top; width: 210px; border: 0px; padding:5px; margin-top: 50px; }
.body_column {vertical-align: top; border: none;padding:5px;}
 
/* CONTRIBUTION ACTION ATTACH */
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
 
 
 
/* CONTRIBUTION ACeditor */
.image_left {float: left;} /* bloc flotant à  gauche */
.image_right {float: right;} /* bloc flotant à  droite */
.image_center {text-align:center;} /* bloc centré */
 
 
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/underline.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/underline.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/crlf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/crlf.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listealpha.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listealpha.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t3.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t3.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/php.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t4.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t4.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t5.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t5.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/link.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/link.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listepuce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listepuce.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listenum.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/listenum.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/separator.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/separator.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/strike.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/strike.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/italic.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/italic.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/hr.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/hr.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/code.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/code.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/link.old.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/link.old.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/bold.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/bold.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/image.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/image.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t1.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/wikini/ACEdImages/t1.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/wikini/LICENSE
New file
0,0 → 1,36
Copyright (c) 2002, 2003 Hendrik Mans <hendrik@mans.de>
All rights reserved.
Copyright 2003 Carlo ZOTTMANN
Copyright 2002, 2003, 2004 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002, 2003, 2004 Patrick PAUL
Copyright 2003 Eric DELORD
Copyright 2003, 2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
Copyright 2003 Jérôme DESQUILBET
Copyright 2003 Erus UMBRAE
Copyright 2004 David VANTYGHEM
Copyright 2004 Jean Christophe ANDRE
 
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/branches/v2.0-narmer/client/projet/wikini/wakka.php
New file
0,0 → 1,846
<?php
/* encoding: iso-8859-1
wakka.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 Carlo Zottmann
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NÉPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Éric DELORD
Copyright 2003 Éric FELDSTEIN
Copyright 2004 Jean-Christophe ANDRÉ
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/*
Yes, most of the formatting used in this file is HORRIBLY BAD STYLE. However,
most of the action happens outside of this file, and I really wanted the code
to look as small as what it does. Basically. Oh, I just suck. :)
*/
 
 
 
// do not change this line, you fool. In fact, don't change anything! Ever!
define("WAKKA_VERSION", "0.1.1");
define("WIKINI_VERSION", "0.4.3 + contributions");
// start the compute time
list($g_usec, $g_sec) = explode(" ",microtime());
define ("t_start", (float)$g_usec + (float)$g_sec);
$t_SQL=0;
 
 
 
class Wiki
{
var $dblink;
var $page;
var $tag;
var $parameter = array();
var $queryLog = array();
var $interWiki = array();
var $VERSION;
var $CookiePath = '/';
 
 
// constructor
function Wiki($config)
{
$this->config = $config;
// some host do not allow mysql_pconnect
$this->dblink = @mysql_connect (
$this->config["mysql_host"],
$this->config["mysql_user"],
$this->config["mysql_password"]);
if ($this->dblink)
{
if (!@mysql_select_db($this->config["mysql_database"], $this->dblink))
{
@mysql_close($this->dblink);
$this->dblink = false;
}
}
$this->VERSION = WAKKA_VERSION;
 
//determine le chemin pour le cookie
$a = parse_url($this->GetConfigValue('base_url'));
$this->CookiePath = dirname($a['path']);
if ($this->CookiePath != '/') $this->CookiePath .= '/';
}
 
 
 
// DATABASE
function Query($query)
{
if($this->GetConfigValue("debug")) $start = $this->GetMicroTime();
if (!$result = mysql_query($query, $this->dblink))
{
ob_end_clean();
die("Query failed: ".$query." (".mysql_error().")");
}
if($this->GetConfigValue("debug"))
{
$time = $this->GetMicroTime() - $start;
$this->queryLog[] = array(
"query" => $query,
"time" => $time);
}
return $result;
}
function LoadSingle($query) { if ($data = $this->LoadAll($query)) return $data[0]; }
function LoadAll($query)
{
$data=array();
if ($r = $this->Query($query))
{
while ($row = mysql_fetch_assoc($r)) $data[] = $row;
mysql_free_result($r);
}
return $data;
}
 
 
 
// MISC
function GetMicroTime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); }
function IncludeBuffered($filename, $notfoundText = "", $vars = "", $path = "")
{
if ($path) $dirs = explode(":", $path);
else $dirs = array("");
 
foreach($dirs as $dir)
{
if ($dir) $dir .= "/";
$fullfilename = $dir.$filename;
if (file_exists($fullfilename))
{
if (is_array($vars)) extract($vars);
 
ob_start();
include($fullfilename);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}
if ($notfoundText) return $notfoundText;
else return false;
}
 
 
 
// VARIABLES
function GetPageTag() { return $this->tag; }
function GetPageTime() { return $this->page["time"]; }
function GetMethod() { return $this->method; }
function GetConfigValue($name) { return $this->config[$name]; }
function GetWakkaName() { return $this->GetConfigValue("wakka_name"); }
function GetWakkaVersion() { return $this->VERSION; }
function GetWikiNiVersion() { return WIKINI_VERSION; }
 
 
 
// PAGES
function LoadPage($tag, $time = "", $cache = 1) {
// retrieve from cache
if (!$time && $cache && ($cachedPage = $this->GetCachedPage($tag))) { $page = $cachedPage;}
// load page
if (!isset($page)) $page = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($tag)."' ".($time ? "and time = '".mysql_escape_string($time)."'" : "and latest = 'Y'")." limit 1");
// cache result
if (!$time) $this->CachePage($page);
return $page;
}
function GetCachedPage($tag) {return (isset($this->pageCache[$tag]) ? $this->pageCache[$tag] : ''); }
function CachePage($page) { $this->pageCache[$page["tag"]] = $page; }
function SetPage($page) { $this->page = $page; if ($this->page["tag"]) $this->tag = $this->page["tag"]; }
function LoadPageById($id) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".mysql_escape_string($id)."' limit 1"); }
function LoadRevisions($page) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page)."' order by time desc"); }
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_escape_string($tag)."' order by tag"); }
function LoadRecentlyChanged($limit=50) {
$limit= (int) $limit;
if ($pages = $this->LoadAll("select tag, time, user, owner from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by time desc limit $limit"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
function LoadAllPages() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' order by tag"); }
function FullTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(tag, body) against('".mysql_escape_string($phrase)."')"); }
function LoadWantedPages() { return $this->LoadAll("select distinct ".$this->config["table_prefix"]."links.to_tag as tag,count(".$this->config["table_prefix"]."links.from_tag) as count from ".$this->config["table_prefix"]."links left join ".$this->config["table_prefix"]."pages on ".$this->config["table_prefix"]."links.to_tag = ".$this->config["table_prefix"]."pages.tag where ".$this->config["table_prefix"]."pages.tag is NULL group by tag order by count desc"); }
function LoadOrphanedPages() { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on = '' order by tag"); }
function IsOrphanedPage($tag) { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on ='' and tag='".mysql_escape_string($tag)."'"); }
function DeleteOrphanedPage($tag) {
$this->Query("delete from ".$this->config["table_prefix"]."pages where tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."acls where page_tag='".mysql_escape_string($tag)."' ");
$this->Query("delete from ".$this->config["table_prefix"]."referrers where page_tag='".mysql_escape_string($tag)."' ");
}
function SavePage($tag, $body, $comment_on = "") {
// get current user
$user = $this->GetUserName();
 
//die($tag);
 
// TODO: check write privilege
if ($this->HasAccess("write", $tag))
{
// is page new?
if (!$oldPage = $this->LoadPage($tag))
{
// create default write acl. store empty write ACL for comments.
$this->SaveAcl($tag, "write", ($comment_on ? "" : $this->GetConfigValue("default_write_acl")));
 
// create default read acl
$this->SaveAcl($tag, "read", $this->GetConfigValue("default_read_acl"));
 
// create default comment acl.
$this->SaveAcl($tag, "comment", $this->GetConfigValue("default_comment_acl"));
 
// current user is owner; if user is logged in! otherwise, no owner.
if ($this->GetUser()) $owner = $user;
}
else
{
// aha! page isn't new. keep owner!
$owner = $oldPage["owner"];
}
 
 
// set all other revisions to old
$this->Query("update ".$this->config["table_prefix"]."pages set latest = 'N' where tag = '".mysql_Escape_string($tag)."'");
 
// add new revision
$this->Query("insert into ".$this->config["table_prefix"]."pages set ".
"tag = '".mysql_escape_string($tag)."', ".
($comment_on ? "comment_on = '".mysql_escape_string($comment_on)."', " : "").
"time = now(), ".
"owner = '".mysql_escape_string($owner)."', ".
"user = '".mysql_escape_string($user)."', ".
"latest = 'Y', ".
"body = '".mysql_escape_string(chop($body))."'");
}
}
function PurgePages() {
if ($days = $this->GetConfigValue("pages_purge_time")) {
// Selection of pages which can be deleted
$pages = $this->LoadAll("select distinct tag, time from ".$this->config["table_prefix"]."pages where time < date_sub(now(), interval '".mysql_escape_string($days)."' day) and latest = 'N' order by time asc");
foreach ($pages as $page) {
// Deletion if there are more than 2 versions avalaible (TODO : parameter ?)
$tags=$this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page[tag])."' group by tag having count(*) > 2 order by tag");
foreach ($tags as $tag) {
$this->Query("delete from ".$this->config["table_prefix"]."pages where time = '".mysql_escape_string($page[time])."' and tag = '".mysql_escape_string($tag[tag])."'");
}
}
}
}
 
 
 
// COOKIES
function SetSessionCookie($name, $value) { SetCookie($name, $value, 0, $this->CookiePath); $_COOKIE[$name] = $value; }
function SetPersistentCookie($name, $value, $remember = 0) { SetCookie($name, $value, time() + ($remember ? 90*24*60*60 : 60 * 60), $this->CookiePath); $_COOKIE[$name] = $value; }
function DeleteCookie($name) { SetCookie($name, "", 1, $this->CookiePath); $_COOKIE[$name] = ""; }
function GetCookie($name) { return $_COOKIE[$name]; }
 
 
 
// HTTP/REQUEST/LINK RELATED
function SetMessage($message) { $_SESSION["message"] = $message; }
function GetMessage()
{
if (isset($_SESSION["message"])) $message = $_SESSION["message"];
else $message = "";
$_SESSION["message"] = "";
return $message;
}
function Redirect($url)
{
header("Location: $url");
exit;
}
// returns just PageName[/method].
function MiniHref($method = "", $tag = "")
{
if (!$tag = trim($tag)) $tag = $this->tag;
return $tag.($method ? "/".$method : "");
}
// returns the full url to a page/method.
function Href($method = "", $tag = "", $params = "")
{
$href = $this->config["base_url"].$this->MiniHref($method, $tag);
if ($params)
{
$href .= ($this->config["rewrite_mode"] ? "?" : "&amp;").$params;
} // ajout TEla
return $href;
}
function Link($tag, $method = "", $text = "", $track = 1) {
$tag=htmlspecialchars($tag); //avoid xss
$text=htmlspecialchars($text); //paranoiac again
if (!$text) $text = $tag;
 
// is this an interwiki link?
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $tag, $matches))
{
$tag = $this->GetInterWikiUrl($matches[1], $matches[2]);
return "<a href=\"$tag\">$text (interwiki)</a>";
}
// is this a full link? ie, does it contain non alpha-numeric characters?
// Note : [:alnum:] is equivalent [0-9A-Za-z]
// [^[:alnum:]] means : some caracters other than [0-9A-Za-z]
// For example : "www.adress.com", "mailto:adress@domain.com", "http://www.adress.com"
else if (preg_match("/[^[:alnum:]]/", $tag))
{
// check for email addresses
if (preg_match("/^.+\@.+$/", $tag))
{
$tag = "mailto:".$tag;
}
// check for protocol-less URLs
else if (!preg_match("/:\/\//", $tag))
{
$tag = "http://".$tag; //Very important for xss (avoid javascript:() hacking)
}
// is this an inline image (text!=tag and url ends png,gif,jpeg)
if ($text!=$tag and preg_match("/.(gif|jpeg|png|jpg)$/i",$tag))
{
return "<img src=\"$tag\" alt=\"$text\" />";
}
else
{
return "<a href=\"$tag\">$text</a>";
}
}
else
{
// it's a Wiki link!
if (isset($_SESSION["linktracking"]) && $track) $this->TrackLinkTo($tag);
return ($this->LoadPage($tag) ? "<a href=\"".$this->href($method, $tag)."\">".$text."</a>" : "<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>");
}
}
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1) {
if (!$text) $text = $tag;
$text = htmlentities($text);
if (isset($_SESSION["linktracking"]) && $track)
$this->TrackLinkTo($tag);
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
}
// function PregPageLink($matches) { return $this->Link($matches[1]); }
function IsWikiName($text) { return preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/", $text); }
function TrackLinkTo($tag) { $_SESSION["linktable"][] = $tag; }
function GetLinkTable() { return $_SESSION["linktable"]; }
function ClearLinkTable() { $_SESSION["linktable"] = array(); }
function StartLinkTracking() { $_SESSION["linktracking"] = 1; }
function StopLinkTracking() { $_SESSION["linktracking"] = 0; }
function WriteLinkTable() {
// delete old link table
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag = '".mysql_escape_string($this->GetPageTag())."'");
if ($linktable = $this->GetLinkTable())
{
$from_tag = mysql_escape_string($this->GetPageTag());
foreach ($linktable as $to_tag)
{
$lower_to_tag = strtolower($to_tag);
if (!$written[$lower_to_tag])
{
$this->Query("insert into ".$this->config["table_prefix"]."links set from_tag = '".$from_tag."', to_tag = '".mysql_escape_string($to_tag)."'");
$written[$lower_to_tag] = 1;
}
}
}
}
function Header() { return $this->Action($this->GetConfigValue("header_action"), 1); }
function Footer() { return $this->Action($this->GetConfigValue("footer_action"), 1); }
 
 
 
// FORMS
function FormOpen($method = "", $tag = "", $formMethod = "post") {
/* Debut de la modif ACeditor */
// ACEditor: id=\"ACEditor\" name=\"ACEditor\" ci-dessous le if a été ajouté (initialement, seule la ligne du else existait)
// si l'url se termine par edit (expression régulière edit$), on est en mode édition et dans ce cas on donne les id et name au formulaire
// Sinon surtout pas car ça marche plus dans la mesure ou plusieurs formulaires auraient ces ID et name et dans ce cas
// il semble que le dernier soit considéré, c'est à dire pas le bon :o(
 
if (ereg('edit$', $this->href($method, $tag))) {
$result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
} else {
$result = "<form action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
}
 
/* fin de la modif ACeditor */
if (!$this->config["rewrite_mode"]) $result .= "<input type=\"hidden\" name=\"wiki\" value=\"".$this->MiniHref($method, $tag)."\" />\n";
return $result;
}
function FormClose() {
return "</form>\n";
}
 
 
 
// INTERWIKI STUFF
function ReadInterWikiConfig() {
if ($lines = file("interwiki.conf"))
{
foreach ($lines as $line)
{
if ($line = trim($line))
{
list($wikiName, $wikiUrl) = explode(" ", trim($line));
$this->AddInterWiki($wikiName, $wikiUrl);
}
}
}
}
function AddInterWiki($name, $url) {
$this->interWiki[$name] = $url;
}
function GetInterWikiUrl($name, $tag) {
if (isset($this->interWiki[$name]))
{
return $this->interWiki[$name].$tag;
} else {
return 'http://'.$tag; //avoid xss by putting http:// in front of JavaScript:()
}
}
 
 
 
// REFERRERS
function LogReferrer($tag = "", $referrer = "") {
// fill values
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
if (!$referrer = trim($referrer) AND isset($_SERVER["HTTP_REFERER"])) $referrer = $_SERVER["HTTP_REFERER"];
// check if it's coming from another site
if ($referrer && !preg_match("/^".preg_quote($this->GetConfigValue("base_url"), "/")."/", $referrer))
{
$this->Query("insert into ".$this->config["table_prefix"]."referrers set ".
"page_tag = '".mysql_escape_string($tag)."', ".
"referrer = '".mysql_escape_string($referrer)."', ".
"time = now()");
}
}
function LoadReferrers($tag = "") {
return $this->LoadAll("select referrer, count(referrer) as num from ".$this->config["table_prefix"]."referrers ".($tag = trim($tag) ? "where page_tag = '".mysql_escape_string($tag)."'" : "")." group by referrer order by num desc");
}
function PurgeReferrers() {
if ($days = $this->GetConfigValue("referrers_purge_time")) {
$this->Query("delete from ".$this->config["table_prefix"]."referrers where time < date_sub(now(), interval '".mysql_escape_string($days)."' day)");
}
}
 
 
 
// PLUGINS
function Action($action, $forceLinkTracking = 0)
{
$action = trim($action); $vars=array();
// stupid attributes check
if ((stristr($action, "=\"")) || (stristr($action, "/")))
{
// extract $action and $vars_temp ("raw" attributes)
preg_match("/^([A-Za-z0-9]*)\/?(.*)$/", $action, $matches);
list(, $action, $vars_temp) = $matches;
// match all attributes (key and value)
$this->parameter[$vars_temp]=$vars_temp;
preg_match_all("/([A-Za-z0-9]*)=\"(.*)\"/U", $vars_temp, $matches);
 
// prepare an array for extract() to work with (in $this->IncludeBuffered())
if (is_array($matches))
{
for ($a = 0; $a < count($matches[1]); $a++)
{
$vars[$matches[1][$a]] = $matches[2][$a];
$this->parameter[$matches[1][$a]]=$matches[2][$a];
}
}
}
if (!$forceLinkTracking) $this->StopLinkTracking();
$result = $this->IncludeBuffered(strtolower($action).".php", "<i>Action inconnue \"$action\"</i>", $vars, $this->config["action_path"]);
$this->StartLinkTracking();
if (isset($parameter)) unset($this->parameter[$parameter]);
unset($this->parameter);
return $result;
}
function Method($method) {
if (!$handler = $this->page["handler"]) $handler = "page";
$methodLocation = $handler."/".$method.".php";
return $this->IncludeBuffered($methodLocation, "<i>M&eacute;thode inconnue \"$methodLocation\"</i>", "", $this->config["handler_path"]);
}
function Format($text, $formatter = "wakka") {
return $this->IncludeBuffered("formatters/".$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
}
 
 
 
// USERS
//============================= Lignes modifiées pour Tela Botanica ===================================
function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config["common_table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1"); }
function LoadUsers() { return $this->LoadAll("select * from ".$this->config["common_table_prefix"]."users order by name"); }
//===============================================================================================
function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }
function UserName() { /* deprecated! */ return $this->GetUserName(); }
function GetUser() { return (isset($_SESSION["user"]) ? $_SESSION["user"] : '');}
function SetUser($user, $remember=0) { $_SESSION["user"] = $user; $this->SetPersistentCookie("name", $user["name"], $remember); $this->SetPersistentCookie("password", $user["password"], $remember); $this->SetPersistentCookie("remember", $remember, $remember); }
function LogoutUser() { $_SESSION["user"] = ""; $this->DeleteCookie("name"); $this->DeleteCookie("password"); }
function UserWantsComments() { if (!$user = $this->GetUser()) return false; return ($user["show_comments"] == "Y"); }
function GetParameter($parameter, $default = '') { return (isset($this->parameter[$parameter]) ? $this->parameter[$parameter] : $default); }
 
 
// COMMENTS
function LoadComments($tag) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on = '".mysql_escape_string($tag)."' and latest = 'Y' order by time"); }
function LoadRecentComments() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on != '' and latest = 'Y' order by time desc"); }
function LoadRecentlyCommented($limit = 50) {
// NOTE: this is really stupid. Maybe my SQL-Fu is too weak, but apparently there is no easier way to simply select
// all comment pages sorted by their first revision's (!) time. ugh!
// load ids of the first revisions of latest comments. err, huh?
$pages=array();
$comments=array();
if ($ids = $this->LoadAll("select min(id) as id from ".$this->config["table_prefix"]."pages where comment_on != '' group by tag order by id desc"))
{
// load complete comments
foreach ($ids as $id)
{
$comment = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".$id["id"]."' limit 1");
$num=0;
if (!isset($comments[$comment["comment_on"]])) $comments[$comment["comment_on"]]='';
if (!$comments[$comment["comment_on"]] && $num < $limit)
{
$comments[$comment["comment_on"]] = $comment;
$num++;
}
}
// now load pages
if ($comments)
{
// now using these ids, load the actual pages
foreach ($comments as $comment)
{
$page = $this->LoadPage($comment["comment_on"]);
$page["comment_user"] = $comment["user"];
$page["comment_time"] = $comment["time"];
$page["comment_tag"] = $comment["tag"];
$pages[] = $page;
}
}
}
// load tags of pages
//return $this->LoadAll("select comment_on as tag, max(time) as time, tag as comment_tag, user from ".$this->config["table_prefix"]."pages where comment_on != '' group by comment_on order by time desc");
return $pages;
}
 
 
 
// ACCESS CONTROL
// returns true if logged in user is owner of current page, or page specified in $tag
function UserIsOwner($tag = "") {
// check if user is logged in
if (!$this->GetUser()) return false;
 
// set default tag
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
// check if user is owner
if ($this->GetPageOwner($tag) == $this->GetUserName()) return true;
}
function GetPageOwner($tag = "", $time = "") { if (!$tag = trim($tag)) $tag = $this->GetPageTag(); if ($page = $this->LoadPage($tag, $time)) return $page["owner"]; }
function SetPageOwner($tag, $user) {
// check if user exists
if (!$this->LoadUser($user)) return;
// updated latest revision with new owner
$this->Query("update ".$this->config["table_prefix"]."pages set owner = '".mysql_escape_string($user)."' where tag = '".mysql_escape_string($tag)."' and latest = 'Y' limit 1");
}
function LoadAcl($tag, $privilege, $useDefaults = 1) {
if ((!$acl = $this->LoadSingle("select * from ".$this->config["table_prefix"]."acls where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1")) && $useDefaults)
{
$acl = array("page_tag" => $tag, "privilege" => $privilege, "list" => $this->GetConfigValue("default_".$privilege."_acl"));
}
return $acl;
}
function SaveAcl($tag, $privilege, $list) {
if ($this->LoadAcl($tag, $privilege, 0)) $this->Query("update ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."' where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1");
else $this->Query("insert into ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."', page_tag = '".mysql_escape_string($tag)."', privilege = '".mysql_escape_string($privilege)."'");
}
// returns true if $user (defaults to current user) has access to $privilege on $page_tag (defaults to current page)
function HasAccess($privilege, $tag = "", $user = "") {
// set defaults
if (!$tag = trim($tag)) $tag = $this->GetPageTag();
if (!$user = $this->GetUserName());
// load acl
$acl = $this->LoadAcl($tag, $privilege);
// if current user is owner, return true. owner can do anything!
if ($this->UserIsOwner($tag)) return true;
// fine fine... now go through acl
foreach (explode("\n", $acl["list"]) as $line)
{
$line = trim($line);
 
// check for inversion character "!"
if (preg_match("/^[!](.*)$/", $line, $matches))
{
$negate = 1;
$line = $matches[1];
}
else
{
$negate = 0;
}
 
// if there's still anything left... lines with just a "!" don't count!
if ($line)
{
switch ($line[0])
{
// comments
case "#":
break;
// everyone
case "*":
return !$negate;
// aha! a user entry.
case "+":
if (!$this->LoadUser($user))
{
return $negate;
}
else
{
return !$negate;
}
default:
if ($line == $user)
{
return !$negate;
}
}
}
}
// tough luck.
return false;
}
 
 
 
// MAINTENANCE
function Maintenance() {
// purge referrers
$this->PurgeReferrers();
// purge old page revisions
$this->PurgePages();
}
 
 
 
// THE BIG EVIL NASTY ONE!
function Run($tag, $method = "") {
if(!($this->GetMicroTime()%3)) $this->Maintenance();
 
$this->ReadInterWikiConfig();
 
// do our stuff!
if (!$this->method = trim($method)) $this->method = "show";
if (!$this->tag = trim($tag)) $this->Redirect($this->href("", $this->config["root_page"]));
if ((!$this->GetUser() && isset($_COOKIE["name"])) && ($user = $this->LoadUser($_COOKIE["name"], $_COOKIE["password"]))) $this->SetUser($user, $_COOKIE["remember"]);
$this->SetPage($this->LoadPage($tag, (isset($_REQUEST["time"]) ? $_REQUEST["time"] :'')));
$this->LogReferrer();
 
//correction pour un support plus facile de nouveaux handlers
print($this->Method($this->method));
}
}
 
 
 
// stupid version check
if (!isset($_REQUEST)) die('$_REQUEST[] not found. Wakka requires PHP 4.1.0 or higher!');
 
// workaround for the amazingly annoying magic quotes.
function magicQuotesSuck(&$a)
{
if (is_array($a))
{
foreach ($a as $k => $v)
{
if (is_array($v))
magicQuotesSuck($a[$k]);
else
$a[$k] = stripslashes($v);
}
}
}
set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc())
{
magicQuotesSuck($_POST);
magicQuotesSuck($_GET);
magicQuotesSuck($_COOKIE);
}
 
 
// default configuration values
$wakkaConfig= array();
$wakkaDefaultConfig = array(
'wakka_version' => '',
'wikini_version' => '',
'debug' => 'no',
"mysql_host" => "localhost",
"mysql_database" => "wikini",
"mysql_user" => "wikini",
"mysql_password" => '',
"table_prefix" => "wikini_",
"root_page" => "PagePrincipale",
"wakka_name" => "MonSiteWikiNi",
"base_url" => "http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").$_SERVER["REQUEST_URI"].(preg_match("/".preg_quote("wakka.php")."$/", $_SERVER["REQUEST_URI"]) ? "?wiki=" : ""),
"rewrite_mode" => (preg_match("/".preg_quote("wakka.php")."$/", $_SERVER["REQUEST_URI"]) ? "0" : "1"),
'meta_keywords' => '',
'meta_description' => '',
"action_path" => "actions",
"handler_path" => "handlers",
"header_action" => "header",
"footer_action" => "footer",
"navigation_links" => "DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur",
"referrers_purge_time" => 24,
"pages_purge_time" => 90,
"default_write_acl" => "*",
"default_read_acl" => "*",
"default_comment_acl" => "*",
"menu_page" => "PageMenu",
"preview_before_save" => "0");
 
// load config
if (!$configfile = GetEnv("WAKKA_CONFIG")) $configfile = "wakka.config.php";
if (file_exists($configfile)) include($configfile);
$wakkaConfigLocation = $configfile;
$wakkaConfig = array_merge($wakkaDefaultConfig, $wakkaConfig);
 
// check for locking
if (file_exists("locked")) {
// read password from lockfile
$lines = file("locked");
$lockpw = trim($lines[0]);
// is authentification given?
if (isset($_SERVER["PHP_AUTH_USER"])) {
if (!(($_SERVER["PHP_AUTH_USER"] == "admin") && ($_SERVER["PHP_AUTH_PW"] == $lockpw))) {
$ask = 1;
}
} else {
$ask = 1;
}
if ($ask) {
header("WWW-Authenticate: Basic realm=\"".$wakkaConfig["wakka_name"]." Install/Upgrade Interface\"");
header("HTTP/1.0 401 Unauthorized");
echo "Ce site est en cours de mise &agrave; jour. Veuillez essayer plus tard." ;
exit;
}
}
 
 
// compare versions, start installer if necessary
if ($wakkaConfig["wakka_version"] && (!$wakkaConfig["wikini_version"])) { $wakkaConfig["wikini_version"]=$wakkaConfig["wakka_version"]; }
if (($wakkaConfig["wakka_version"] != WAKKA_VERSION) || ($wakkaConfig["wikini_version"] != WIKINI_VERSION)) {
// start installer
if (!isset($_REQUEST["installAction"]) OR !$installAction = trim($_REQUEST["installAction"])) $installAction = "default";
include("setup/header.php");
if (file_exists("setup/".$installAction.".php")) include("setup/".$installAction.".php"); else echo "<i>Invalid action</i>" ;
include("setup/footer.php");
exit;
}
 
 
// configuration du cookie de session
//determine le chemin pour le cookie
$a = parse_url($wakkaConfig['base_url']);
$CookiePath = dirname($a['path']);
if ($CookiePath != '/') $CookiePath .= '/';
$a = session_get_cookie_params();
session_set_cookie_params($a['lifetime'],$CookiePath);
unset($a);
unset($CookiePath);
 
// start session
session_start();
 
// fetch wakka location
if (!isset($_REQUEST["wiki"])) $_REQUEST["wiki"] = '';
$wiki = $_REQUEST["wiki"];
 
// remove leading slash
$wiki = preg_replace("/^\//", "", $wiki);
 
// split into page/method
if (preg_match("#^(.+?)/([A-Za-z0-9_]*)$#", $wiki, $matches)) list(, $page, $method) = $matches;
else if (preg_match("#^(.*)$#", $wiki, $matches)) list(, $page) = $matches;
 
// create wiki object
$wiki = new Wiki($wakkaConfig);
// check for database access
if (!$wiki->dblink)
{
echo "<p>Pour des raisons ind&eacute;pendantes de notre volont&eacute;, le contenu de ce Wiki est temporairement inaccessible. Veuillez r&eacute;essayer ult&eacute;rieurement, merci de votre compr&eacute;hension.</p>";
exit;
}
 
function compress_output($output)
{
return gzencode($output);
}
 
// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
{
// Start output buffering, and register compress_output() (see
// below)
ob_start ("compress_output");
 
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
}
 
 
// go!
if (!isset($method)) $method='';
 
// Security (quick hack) : Check method syntax
if (!(preg_match('#^[A-Za-z0-9_]*$#',$method))) {
$method='';
}
 
$wiki->Run($page, $method);
?>
/branches/v2.0-narmer/client/projet/wikini/wakka.css
New file
0,0 → 1,108
/*Début modification sytle TELA BOTANICA*/
body
{
background-color: #D7F2D7;
color: black;
background-image: url(bibliotheque/images/telabotanica/logo_tb_pr_wikini.png);
background-repeat: no-repeat;
background-position: top left;
}
 
h1 { margin: 0px; padding: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 1.6em; font-style: normal; background-color: #2B8648; border-style: none; color: #FFFFFF; text-align: center;}
h2 { margin: 0px; padding: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 1.4em; font-style: oblique;}
h3 { margin: 0px; padding: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 1.2em; font-style: normal;}
h4 { margin: 0px; padding: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 1.1em; font-style: oblique;}
h5 { margin: 0px; padding: 0px; font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 1.1em; font-style: normal; font-weight: bold; color : #2B8648;}
 
a { color: #993333; text-decoration: none; font-weight: bold;}
a:hover { text-decoration: underline;}
 
.wiki_name { float: left; padding-left: 60px; margin: 0px 15px 0px 10px; font-size: 150%; font-weight: bold; background-color: transparent; color: black;}
.page_name { font-size: 150%; background-color: transparent;}
.header { padding: 10px; padding-top: 5px; padding-left: 75px;}
/*Fin modification sytle TELA BOTANICA*/
 
body, p, td, li, input, select, textarea { font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.3; }
ul { margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; }
ol { margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; }
form { margin: 0px; padding: 0px; }
tt { color: Navy; }
hr { border: 0px; color: Black; /* Internet Explorer */ background-color: Black; height: 1px; }
 
.error { color: #CC3333; font-weight: bold; }
.indent { margin-left: 40px; }
.additions { color: #008800; }
.deletions { color: #880000; }
.add { font-weight: bold; color: #c00; text-decoration: underline; }
.del { font-style: italic; color: #c00; text-decoration: line-through; }
.page { background-color: #FFFFFF; padding: 10px; border: 1px inset; border-bottom: none; }
.prev_alert { background-color: red; color: white; font-size: 1.7em; font-weight: bold; margin-bottom: 5px; }
.edit { width: 100%; height: 400px; }
.footer { background-color: #DDDDDD; padding: 5px 10px; border: 1px inset; border-top: none; border-top: 1px solid #CCCCCC }
.code { background: #FFFFFF; border: solid #888888 2px; font-family: 'Courier New', Courier; color: black; font-size: 10pt; width: 100%; height: 400px; overflow: scroll; padding: 3px; }
.revisioninfo { color: #AAAAAA; padding-bottom: 20px; }
 
.commentsheader { background-color: #DDDDDD; padding: 2px 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC }
.comment { background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #EEEEEE; }
.commentinfo { color: #AAAAAA; }
.commentform { background-color: #EEEEEE; padding: 10px; border-left: 1px inset; border-right: 1px inset; border-top: 1px solid #CCCCCC }
 
.copyright { font-size: 11px; color: #AAAAAA; text-align: right; }
.copyright A { color: #AAAAAA; }
.searchbox { background: #FFFFF8; border: 0px; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px; }
.debug { font-size: 11px; color: #888888; }
 
.hr_clear { clear: both; visibility: hidden; }
.include_right { float: right; width: 17%; } /* bloc flotant à droite */
.include_left { float: left; width: 17%; } /* bloc flotant à gauche */
.include_solid_border { border: solid; padding: 2px; } /* encadré noir */
.include_gray_background { background-color: #DDDDDD; } /* fond gris */
.include_small_fonts { font-size: 0.8em; } /* petites polices */
.include_big_fonts { font-size: 1.2em; } /* grandes polces */
.include_height10em { height: 10em; overflow: scroll; } /* boite de 10em de hauteur, avec ascenseur */
.include_height15em { height: 15em; overflow: scroll; }
.include_height30em { height: 30em; overflow: scroll; }
.include_height60em { height: 60em; overflow: scroll; }
 
.trail_table { line-height: 30px;}
.trail_button { color: #993333; }
 
/*Spécifique TELA BOTANICA*/
.rouge { color: red; font-weight: bold; }
.jaune { color: #D8D100; font-weight: bold; }
.vert { color: green; font-weight: bold; }
.pair { background-color: #FFF6D5; }
.impair { background-color: #F4FFEF; }
 
/* CONTRIBUTION MENU GAUCHE */
 
 
 
 
.page_table {margin: 0; padding: 0 ; border: none; height: 100%;width: 100%;}
.menu_column {display:none;}
/*.menu_column {background-color: #FFFFCC; vertical-align: top; width: 200px; border: 1px solid #000000; padding:0.2em; margin-top: 50px; }
.menu_column a {font-size: 0.8em;}
.menu_column ul { padding-left: 5px; margin-left: 5px; list-style-type: none;}
.body_column {vertical-align: top; border: none;padding:5px;}*/
 
/* CONTRIBUTION ACTION ATTACH */
/* - les images */
.attach_margin05em { margin: 0.5em;} /* marge de 0.5 em autour de l'image*/
.attach_margin1em { margin: 1em;} /* marge de 1em autour de l'image*/
.attach_left {float: left;} /* bloc flotant à gauche */
.attach_right {float: right;} /* bloc flotant à droite */
.attach_noborder {border-width: 0px;} /* pas de bordure */
.attach_vmiddle {vertical-align: text-bottom;} /* aligenement vertical au milieu */
/* - le gestionnaire des uploads */
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
 
/* CONTRIBUTION ACeditor */
.image_left {float: left;} /* bloc flotant à  gauche */
.image_right {float: right;} /* bloc flotant à  droite */
.image_center {text-align:center;} /* bloc centré */
/branches/v2.0-narmer/client/projet/wikini/formatters/code.php
New file
0,0 → 1,33
 
<pre>
<?php
/*
code.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
echo htmlentities($text)."\n";
?>
</pre>
/branches/v2.0-narmer/client/projet/wikini/formatters/action.php
New file
0,0 → 1,64
<?php
/*
action.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
 
if (!function_exists("wakka2callback"))
{
function wakka2callback($things)
{
$thing = $things[1];
 
global $wiki;
// events
if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
{
if ($matches[1])
return $wiki->Action($matches[1]);
else
return "{{}}";
}
else if (preg_match("/^.*$/s", $thing, $matches))
{
return "";
}
 
// if we reach this point, it must have been an accident.
return $thing;
}
}
 
 
$text = str_replace("\r", "", $text);
$text = trim($text)."\n";
$text = preg_replace_callback(
"/(\{\{.*?\}\}|.*)/msU", "wakka2callback", $text);
 
echo $text ;
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/coloration_delphi.php
New file
0,0 → 1,77
<?php
/*
* $Id: coloration_delphi.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
*
* Souligneur syntaxique Delphi
*
* copyrigth Eric Feldstein 2003 2004 mailto:garfield_fr@tiscali.fr
*
* Licence : la meme que wikini (voir le fichier LICENCE).
* Vous êtes libre d'utiliser et de modifier ce code à condition de laisser le copyright
* d'origine. Vous pouvez bien sur vous ajouter à la liste des auteurs.
*
* Installation : copier le fichier dans le repertoire "formatters" de WikiNi
*/
include_once('formatters/hightlighter.class.inc');
 
$DH = new Hightlighter();
$DH->isCaseSensitiv = false;
 
//************* commentaires *************
$DH->comment = array('({[^$][^}]*})', //commentaires: { ... }
'(\(\*[^$](.*)\*\))' //commentaires: (* ... *)
);
$DH->commentLine = array('(//.*\n)'); //commentaire //
$DH->commentStyle = "color: red; font-style: italic"; //style CSS pour balise SPAN
 
//************* directives de compilation *************
$DH->directive = array('({\\$[^{}]*})', //directive {$....}
'(\(\*\\$(.*)\*\))' //directive (*$....*)
);
$DH->directiveStyle = "color: green"; //style CSS pour balise SPAN
 
//************* chaines de caracteres *************
$DH->string = array("('[^']*')",'(#\d+)'); //chaine = 'xxxxxxxx' ou #23
$DH->stringStyle = "background: yellow";
 
//************* nombres *************
$DH->number[] = '(\b\d+(\.\d*)?([eE][+-]?\d+)?)'; //123 ou 123. ou 123.456 ou 123.E-34 ou 123.e-34 123.45E+34 ou 4e54
$DH->number[] = '(\$[0-9A-Fa-f]+\b)'; //ajout des nombres hexadecimaux : $AF
$DH->numberStyle = 'color: blue';
 
//************* mots clé *************
$DH->keywords['MotCle']['words'] = array('absolute','abstract','and','array','as','asm',
'begin',
'case','class','const','constructor',
'default','destructor','dispinterface','div','do','downto',
'else','end','except','exports','external',
'file','finalization','finally','for','function',
'goto',
'if','implementation','inherited','initialization','inline','interface','is',
'label','library','loop','message',
'mod',
'nil','not',
'object','of','or','out','overload','override',
'packed','private','procedure','program','property','protected','public','published',
'raise','read','record','repeat','resourcestring',
'set','shl','shr','stdcall','string',
'then','threadvar','to','try','type','unit','until',
'use','uses',
'var','virtual','while',
'with','write',
'xor'
);
$DH->keywords['MotCle']['style'] = 'font-weight: bold'; //style CSS pour balise SPAN
 
//************* liste des symboles *************
$DH->symboles = array('#','$','&','(','(.',')','*','+',',','-','.','.)','..',
'/',':',':=',';','<','<=','<>','=','>','>=','@','[',']','^');
$DH->symbolesStyle = '';
 
//************* identifiants *************
$DH->identifier = array('[_A-Za-z]?[_A-Za-z0-9]+');
$DH->identStyle = '';
 
echo "<pre>".$DH->Analyse($text)."</pre>";
unset($DH);
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/wakka.php
New file
0,0 → 1,340
<?php
/*
wakka.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric DELORD
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup!
 
if (!function_exists("wakka2callback"))
{
include("formatters/tableaux.php"); //EF => tableaux
function wakka2callback($things)
{
$thing = $things[1];
$result='';
 
static $oldIndentLevel = 0;
static $oldIndentLength= 0;
static $indentClosers = array();
static $newIndentSpace= array();
static $br = 1;
 
$brf=0;
global $wiki;
// convert HTML thingies
if ($thing == "<")
return "&lt;";
else if ($thing == ">")
return "&gt;";
//EF=> tableaux
else if (preg_match("/^\[\|(.*)\|\]/s", $thing))
{
return parsetable($thing);
} //end tableaux
// bold
else if ($thing == "**")
{
static $bold = 0;
return (++$bold % 2 ? "<b>" : "</b>");
}
// italic
else if ($thing == "//")
{
static $italic = 0;
return (++$italic % 2 ? "<i>" : "</i>");
}
// underlinue
else if ($thing == "__")
{
static $underline = 0;
return (++$underline % 2 ? "<u>" : "</u>");
}
// monospace
else if ($thing == "##")
{
static $monospace = 0;
return (++$monospace % 2 ? "<tt>" : "</tt>");
}
// Deleted
else if ($thing == "@@")
{
static $deleted = 0;
return (++$deleted % 2 ? "<span class=\"del\">" : "</span>");
}
// Inserted
else if ($thing == "££")
{
static $inserted = 0;
return (++$inserted % 2 ? "<span class=\"add\">" : "</span>");
}
// urls
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) {
$url = $matches[1];
if (!isset($matches[2])) $matches[2] = '';
return "<a href=\"$url\">$url</a>".$matches[2];
}
// header level 5
else if ($thing == "==")
{
static $l5 = 0;
$br = 0;
return (++$l5 % 2 ? "<h5>" : "</h5>");
}
// header level 4
else if ($thing == "===")
{
static $l4 = 0;
$br = 0;
return (++$l4 % 2 ? "<h4>" : "</h4>");
}
// header level 3
else if ($thing == "====")
{
static $l3 = 0;
$br = 0;
return (++$l3 % 2 ? "<h3>" : "</h3>");
}
// header level 2
else if ($thing == "=====")
{
static $l2 = 0;
$br = 0;
return (++$l2 % 2 ? "<h2>" : "</h2>");
}
// header level 1
else if ($thing == "======")
{
static $l1 = 0;
$br = 0;
return (++$l1 % 2 ? "<h1>" : "</h1>");
}
// forced line breaks
else if ($thing == "---")
{
return "<br />";
}
// escaped text
else if (preg_match("/^\"\"(.*)\"\"$/s", $thing, $matches))
{
return $matches[1];
}
// code text
else if (preg_match("/^\%\%(.*)\%\%$/s", $thing, $matches))
{
// check if a language has been specified
$code = $matches[1];
$language='';
if (preg_match("/^\((.+?)\)(.*)$/s", $code, $matches))
{
list(, $language, $code) = $matches;
}
//Select formatter for syntaxe hightlighting
if (file_exists("formatters/coloration_".$language.".php")){
$formatter = "coloration_".$language;
}else{
$formatter = "code";
}
 
$output = "<div class=\"code\">";
$output .= $wiki->Format(trim($code), $formatter);
$output .= "</div>";
 
return $output;
}
// raw inclusion from another wiki
// (regexp documentation : see "forced link" below)
else if (preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $thing, $matches))
{
list (,$url,,$text) = $matches;
if (!$text) $text = "404";
if ($url)
{
$url.="/wakka.php?wiki=".$text."/raw";
return $wiki->Format($wiki->Format($url, "raw"),"wakka");
}
else
{
return "";
}
}
// forced links
// \S : any character that is not a whitespace character
// \s : any whitespace character
else if (preg_match("/^\[\[(\S*)\s+(.+)?\]\]$/", $thing, $matches))
{
list (, $url, $text) = $matches;
if ($url)
{
if ($url!=($url=(preg_replace("/@@|££|\[\[/","",$url))))$result="</span>";
if (!$text) $text = $url;
$text=preg_replace("/@@|££|\[\[/","",$text);
return $result.$wiki->Link($url, "", $text);
}
else
{
return "";
}
}
// indented text
else if ((preg_match("/\n(\t+|([ ]{1})+)(-|([0-9,a-z,A-Z]+)\))?/s", $thing, $matches))
|| (preg_match("/^(\t+|([ ]{1})+)(-|([0-9,a-z,A-Z]+)\))?/s", $thing, $matches) && $brf=1))
{
// new line
if ($brf) $br=0;
$result .= ($br ? "<br />\n" : "");
 
// we definitely want no line break in this one.
$br = 0;
 
// find out which indent type we want
if (!isset($matches[3])) $matches[3] = '';
$newIndentType = $matches[3];
if (!$newIndentType) { $opener = "<div class=\"indent\">"; $closer = "</div>"; $br = 1; }
else if ($newIndentType == "-") { $opener = "<ul>\n"; $closer = "</li>\n</ul>"; $li = 1; }
else { $opener = "<ol type=\"".$matches[4]."\">\n"; $closer = "</li>\n</ol>"; $li = 1; }
 
// get new indent level
if (strpos($matches[1],"\t")) $newIndentLevel = strlen($matches[1]);
else
{
$newIndentLevel=$oldIndentLevel;
$newIndentLength = strlen($matches[1]);
if ($newIndentLength>$oldIndentLength)
{
$newIndentLevel++;
$newIndentSpace[$newIndentLength]=$newIndentLevel;
}
else if ($newIndentLength<$oldIndentLength)
$newIndentLevel=$newIndentSpace[$newIndentLength];
}
$op=0;
if ($newIndentLevel > $oldIndentLevel)
{
for ($i = 0; $i < $newIndentLevel - $oldIndentLevel; $i++)
{
$result .= $opener;
$op=1;
array_push($indentClosers, $closer);
}
}
else if ($newIndentLevel < $oldIndentLevel)
{
for ($i = 0; $i < $oldIndentLevel - $newIndentLevel; $i++)
{
$op=1;
$result .= array_pop($indentClosers);
if ($oldIndentLevel && $li) $result .= "</li>";
}
}
 
if (isset($li) && $op) $result .= "<li>";
else if (isset($li))
$result .= "</li>\n<li>";
 
$oldIndentLevel = $newIndentLevel;
$oldIndentLength= $newIndentLength;
 
return $result;
}
// new lines
else if ($thing == "\n")
{
// if we got here, there was no tab in the next line; this means that we can close all open indents.
$c = count($indentClosers);
for ($i = 0; $i < $c; $i++)
{
$result .= array_pop($indentClosers);
$br = 0;
}
$oldIndentLevel = 0;
$oldIndentLength= 0;
$newIndentSpace=array();
 
$result .= ($br ? "<br />\n" : "\n");
$br = 1;
return $result;
}
// events
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches))
{
if ($matches[1])
return $wiki->Action($matches[1]);
else
return "{{}}";
}
// interwiki links!
else if (preg_match("/^[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)$/s", $thing))
 
{
return $wiki->Link($thing);
}
// wiki links!
else if (preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/s", $thing))
{
return $wiki->Link($thing);
}
// separators
else if (preg_match("/-{4,}/", $thing, $matches))
{
// TODO: This could probably be improved for situations where someone puts text on the same line as a separator.
// Which is a stupid thing to do anyway! HAW HAW! Ahem.
$br = 0;
return "<hr />";
}
// if we reach this point, it must have been an accident.
return $thing;
}
}
 
 
$text = str_replace("\r", "", $text);
$text = chop($text)."\n";
$text = preg_replace_callback(
"/(\%\%.*?\%\%|".
"^\[\|.*?\|\]|". //EF => tableaux
"\"\".*?\"\"|".
"\[\[.*?\]\]|".
"\b[a-z]+:\/\/\S+|".
"\*\*|\#\#|@@|££|__|<|>|\/\/|".
"======|=====|====|===|==|".
"-{4,}|---|".
"\n(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"^(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|".
"\{\{.*?\}\}|".
"\b[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)\b|".
"\b([A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*)\b|".
"\n)/ms", "wakka2callback", $text);
 
// we're cutting the last <br />
$text = preg_replace("/<br \/>$/","", trim($text));
echo $text ;
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/coloration_php.php
New file
0,0 → 1,30
<?php
/*
coloration_php.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
highlight_string($text)
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/tableaux.php
New file
0,0 → 1,87
<?php
function parsetable($thing)
{
$tableattr = 'border="1"';
// echo "parsetable debut : \$thing = $thing<br>";
// recuperation des attributs
preg_match("/^\[\|(.*)$/m",$thing,$match);
// echo "parsetable : \$match = ";var_dump($match);echo "<br>";
if ($match[1]){
$tableattr = $match[1];
}
$table = "<table $tableattr >\n";
//suppression de [|xxxx et de |]
$thing = preg_replace("/^\[\|(.*)$/m","",$thing);
$thing = trim(preg_replace("/\|\]/m","",$thing));
// echo "parsetable suppression [| |]: \$thing = $thing<br>";
//recuperation de chaque ligne
$rows = preg_split("/$/m",$thing,-1,PREG_SPLIT_NO_EMPTY);
// echo "parsetable preg_split:";var_dump($rows);echo "<br>";
//analyse de chaque ligne
foreach ($rows as $row){
$table .= parsetablerow($row);
}
$table.= "</table>";
return $table;
}
//parse la definition d'une ligne
function parsetablerow($row)
{
$rowattr = "";
$row = trim($row);
// echo "parsetablerow debut : \$row = $row<br>";
//detection des attributs de ligne => si la ligne ne commence pas par | alors attribut
if (!preg_match("/^\|/",$row,$match)){
preg_match("/^!([^\|]*)!\|/",$row,$match);
$rowattr = $match[1];
// echo "\$rowattr = $rowattr<br>";
$row = trim(preg_replace("/^!([^\|]*)!/","",$row));
}
$result .= " <tr $rowattr>\n";
$row = preg_replace("/^\|/","",$row);
$row = preg_replace("/\|$/","",$row);
// echo "parsetablerow sans attribut : \$row = $row<br>";
//recuperation de chaque cellule
$cells = explode("|",$row); //nb : seule les indices impaire sont significatif
// echo "parsetablerow preg_split \$cells:";var_dump($cells);echo "<br>";
$i=0;
foreach ($cells as $cell){
// if ($i % 2){
// echo "\$cell = $cell<br>";
$result .= parsetablecell($cell);
// }
$i++;
}
$result .= " </tr>\n";
return $result;
}
//parse la definition d'une cellule
function parsetablecell($cell)
{
global $wiki;
$cellattr = "";
if (preg_match("/^!(.*)!/",$cell,$match)){
$cellattr = $match[1];
}
$cell = preg_replace("/^!(.*)!/","",$cell);
//si espace au debut => align=right
//si espace a la fin => align=left
//si espace debut et fin => align=center
if (preg_match("/^\s(.*)/",$cell)){
$align="right";
}
if (preg_match("/^(.*)\s$/",$cell)){
$align="left";
}
if (preg_match("/^\s(.*)\s$/",$cell)){
$align="center";
}
if ($align) $cellattr .= " align=\"$align\"";
// echo "\$this->classname = ".get_class($wiki)."<br>";
return " <td $cellattr>".$wiki->Format($cell)."</td>\n";
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/php.php
New file
0,0 → 1,3
<?php
highlight_string($text)
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/hightlighter.class.inc
New file
0,0 → 1,250
<?php
/*
* $Id: hightlighter.class.inc,v 1.1 2005-09-22 14:02:49 ddelon Exp $
*
* Souligneur générique pour colorier la syntaxe de langage de programmation
*
* copyrigth Eric Feldstein 2004 mailto:garfield_fr@tiscali.fr
*
* Licence : la meme que wikini(voir le fichier LICENCE).
* Vous êtes libre d'utiliser et de modifier ce code à condition de laisser le copyright
* d'origine. Vous pouvez bien sur vous ajouter à la liste des auteurs.
*
* INSTALLATION : copier le fichier dans le repertoire "formatters" de WikiNi
* UTILISATION : importer la classe dans le script de coloration
* ATTRIBUTS DE LA CLASSE :
* - isCaseSensitiv : booleen - indique si la syntaxe est sensible a la casse
* - comment : array - tableau d'expressions regulieres definissant les commentaires multiligne
* ex : array('({[^$][^}]*})', //commentaires: { ... }
* '(\(\*[^$](.*)\*\))' //commentaires: (* ... *)
* );
* - commentLine : array tableau d'expressions regulieres definissant les commentaires monoligne
* ex : array('(//.*\n)'); //commentaire //
* - commentStyle : string - style CSS inline a utiliser pour la coloration(utilisé dans une
* balise <SPAN style="..."></SPAN>)
* - directive : array - tableau d'expression reguliere pour definir les directive de
* compilation
* - directiveStyle : string - style CSS inline a utiliser pour la coloration
* - string : array - tableau d'expression reguliere pour definir les chaine de caracteres
* - stringStyle : string - style CSS inline a utiliser pour la coloration
* - number : array - tableau d'expression reguliere pour definir les nombres
* - numberStyle : string - style CSS inline a utiliser pour la coloration
* - keywords : array - tableau asociatif contenant des tableaux de liste de mots avec leur style. Ex :
* $oHightlighter->keywords['Liste1']['words'] = array('liste1mot1','liste1mot2','liste1mot3');
* $oHightlighter->keywords['Liste1']['style'] = 'color: red';
* $oHightlighter->keywords['Liste2']['words'] = array('liste2mot1','liste2mot2');
* $oHightlighter->keywords['Liste2']['style'] = 'color: yellow';
* chaque tableau keywords['...'] DOIT posseder les 2 clé 'words' et 'style'.
* - symboles : array - tableau conteant la liste des symboles
* - symbolesStyle : string - style CSS inline a utiliser pour la coloration
* - identifier : array - tableau d'expression reguliere pour definir les identifiants
* - identStyle : string - style CSS inline a utiliser pour la coloration
* METHODE PUBLIQUE DE LA CLASSE :
* - Analyse($text) : $text string Chaine a analyser
* renvoie le texte colorié.
*
* NOTES IMPORTANTES
* - Les expressions reguliere doivent être entre parenthèse capturante pour etre utilisé
* dans une fonction de remplacement. Voir le fichier coloration_delphi.php pour un exemple
* - Lorsque un style est defini à vide, l'expression reguliere n'est pas prise en compte dans
* l'analyse.
* - L'option de recherche est msU : multiligne, le . peut être un \n et la recherche
* est 'not greedy' qui inverse la tendance à la gourmandise des expressions régulières.
*/
 
class Hightlighter{
//sensibilite majuscule/minuscule
var $isCaseSensitiv = false;
//commentaires
var $comment = array(); //commentaire multiligne
var $commentLine = array(); //commentaire monoligne
var $commentStyle = '';//'color: red';
//directives de compilation
var $directive = array();
var $directiveStyle = '';//'color: green';
//chaine de caracteres
var $string = array();
var $stringStyle = '';
//nombre
var $number = array();
var $numberStyle = '';
//mots clé
var $keywords = array();
//séparateurs
var $symboles = array();
var $symbolesStyle = '';
//identifiant
var $identifier = array();
var $identStyle = '';
//*******************************************************
// Variable privées
//*******************************************************
var $_patOpt = 'msU'; //option de recherche
var $_pattern = ''; //modele complet
var $_commentPattern = ''; //modele des commentaires
var $_directivePattern = '';//modele des directives
var $_numberPattern = ''; //modele des nombres
var $_stringPattern = ''; //modele des chaine de caracteres
var $_keywordPattern = ''; //modele pour le mots cle
var $_symbolesPattern = ''; //modele pour les symbole
var $_separatorPattern = '';//modele pour les sparateurs
var $_identPattern = ''; //modele pour les identifiants
/********************************************************
Methodes de la classe
*********************************************************/
/**
* Renvoie le pattern pour les commentaires
*/
function _getCommentPattern(){
$a = array_merge($this->commentLine,$this->comment);
return implode('|',$a);
}
/**
* Renvoie le pattern pour les directives de compilation
*/
function _getDirectivePattern(){
return implode('|',$this->directive);
}
/**
* Renvoie le pattern pour les chaine de caracteres
*/
function _getStringPattern(){
return implode('|',$this->string);
}
/**
* Renvoie le pattern pour les nombre
*/
function _getNumberPattern(){
return implode('|',$this->number);
}
/**
* Renvoie le pattern pour les mots clé
*/
function _getKeywordPattern(){
$aResult = array();
foreach($this->keywords as $key=>$keyword){
$aResult = array_merge($aResult, $keyword['words']);
$this->keywords[$key]['pattern'] = '\b'.implode('\b|\b',$keyword['words']).'\b';
}
return '\b'.implode('\b|\b',$aResult).'\b';
}
/**
* Renvoie le pattern pour les symboles
*/
function _getSymbolesPattern(){
$a = array();
foreach($this->symboles as $s){
$a[] = preg_quote($s,'`');
}
return implode('|',$a);
}
/**
* Renvoie le pattern pour les identifiants
*/
function _getIdentifierPattern(){
return implode('|',$this->identifier);
}
/**
* Liste des separateur d'apres la liste des symboles
*/
function _getSeparatorPattern(){
$a = array_unique(preg_split('//', implode('',$this->symboles), -1, PREG_SPLIT_NO_EMPTY));
$pattern = '['.preg_quote(implode('',$a),'`').'\s]+';
return $pattern;
}
/**
* Renvoie le modele a utiliser dans l'expression regulière
*
* @return string Modele de l'expression régulière
*/
function _getPattern(){
$this->_separatorPattern = $this->_getSeparatorPattern();
$this->_symbolesPattern = $this->_getSymbolesPattern();
$this->_commentPattern = $this->_getCommentPattern();
$this->_directivePattern = $this->_getDirectivePattern();
$this->_stringPattern = $this->_getStringPattern();
$this->_numberPattern = $this->_getNumberPattern();
$this->_keywordPattern = $this->_getKeywordPattern();
$this->_identPattern = $this->_getIdentifierPattern();
//construction du modele globale en fonction de l'existance d'un style(optimisation)
if($this->commentStyle){ $a[] = $this->_commentPattern; }
if($this->directiveStyle){ $a[] = $this->_directivePattern; }
if($this->stringStyle){ $a[] = $this->_stringPattern; }
if($this->numberStyle){ $a[] = $this->_numberPattern; }
if(count($this->keywords)>0){ $a[] = $this->_keywordPattern; }
if($this->symbolesStyle){ $a[] = $this->_symbolesPattern; }
if($this->identStyle){ $a[] = $this->_identPattern; }
$this->_pattern = implode('|',$a);
return $this->_pattern;
}
/**
* Fonction de remplacement de chaque élement avec leur style.
*/
function replacecallback($match){
$text = $match[0];
$pcreOpt = $this->_patOpt;
$pcreOpt .= ($this->isCaseSensitiv)?'':'i';
//commentaires
if($this->commentStyle){
if (preg_match('`'.$this->_commentPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->commentStyle\">".$match[0].'</span>';
}
}
//directive de compilation
if ($this->directiveStyle){
if (preg_match('`'.$this->_directivePattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->directiveStyle\">".$match[0].'</span>';
}
}
//chaine de caracteres
if ($this->stringStyle){
if (preg_match('`'.$this->_stringPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->stringStyle\">".$match[0].'</span>';
}
}
//nombres
if ($this->numberStyle){
if (preg_match('`'.$this->_numberPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->numberStyle\">".$match[0].'</span>';
}
}
//mot clé
if (count($this->keywords)>0){
foreach($this->keywords as $key=>$keywords){
if ($keywords['style']){
if(preg_match('`'.$keywords['pattern']."`$pcreOpt",$text,$m)){
return "<span style=\"".$keywords['style']."\">".$match[0].'</span>';
}
}
}
}
//symboles
if ($this->symbolesStyle){
if (preg_match('`'.$this->_symbolesPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->symbolesStyle\">".$match[0].'</span>';
}
}
//identifiants
if ($this->identStyle){
if (preg_match('`'.$this->_identPattern."`$pcreOpt",$text,$m)){
return "<span style=\"$this->identStyle\">".$match[0].'</span>';
}
}
return $match[0];
}
/**
* renvois le code colorié
*
* @param $text string Texte a analyser
* @return string texte colorié
*/
function Analyse($text){
$pattern = '`'.$this->_getPattern()."`$this->_patOpt";
if (!$this->isCaseSensitiv){
$pattern .= 'i';
}
$text = preg_replace_callback($pattern,array($this,'replacecallback'),$text);
return $text;
}
} //class Hightlighter
?>
/branches/v2.0-narmer/client/projet/wikini/formatters/raw.php
New file
0,0 → 1,31
<?php
/*
raw.php
 
Copyright 2002, 2003 David DELON
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
if ($test=$_REQUEST["text"]) {
echo "";
}
else if ($lines = file($text)) {
foreach ($lines as $line) {
// To avoid loop:ignore inclusion of other raw link
if (!(preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $line, $matches)))
echo $line;
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/wakka.config.php
New file
0,0 → 1,35
<?php
// wakka.config.php cr&eacute;&eacute;e Fri Mar 18 11:37:11 2005
// ne changez pas la wikini_version manuellement!
 
$nom_wiki = $_GET['wikini'] ;
//echo $nom_wiki ;
$wakkaConfig = array(
"wakka_version" => "0.1.1",
"wikini_version" => "0.4.3 + contributions",
"debug" => "no",
"mysql_host" => "localhost",
"mysql_database" => "tela_prod_wikini",
"mysql_user" => "telabotap",
"mysql_password" => "ppo50cvb",
"table_prefix" => strtolower($nom_wiki)."_",
"root_page" => "PagePrincipale",
"wakka_name" => $nom_wiki,
"base_url" => "http://www.tela-botanica.org/client/projet/wikini/wakka.php?wikini=$nom_wiki&wiki=",
"rewrite_mode" => "0",
"meta_keywords" => "",
"meta_description" => "",
"action_path" => "actions",
"handler_path" => "handlers",
"header_action" => "header",
"footer_action" => "footer",
"navigation_links" => "[[DerniersChangementsPages Derniers changements ]] :: [[TableauDeBord Tableau de bord ]]\n[[ParametresUtilisateur Paramêtres utilisateur ]]",
"referrers_purge_time" => "24",
"pages_purge_time" => "365",
"default_write_acl" => "*",
"default_read_acl" => "*",
"default_comment_acl" => "*",
"menu_page" => "PageMenu",
"preview_before_save" => "0",
"common_table_prefix" => "interwikini_");
?>
/branches/v2.0-narmer/client/projet/wikini/interwiki.conf
New file
0,0 → 1,91
AbbeNormal http://www.ourpla.net/cgi-bin/pikie.cgi?
Acronym http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=
AcadWiki http://xarch.tu-graz.ac.at/autocad/wiki/
Advogato http://www.advogato.org/
ArtificialLife http://www.alife.org/wiki/
AndStuff http://andstuff.org/
BenefitsWiki http://www.benefitslink.com/cgi-bin/wiki.cgi?
Bible http://bible.gospelcom.net/bible?
BrianLane http://www.brianlane.com/wiki/
BridgesWiki http://c2.com/w2/bridges/
CLiki http://ww.telent.net/cliki/
CmWiki http://www.ourpla.net/cgi-bin/wiki.pl?
ColdWiki http://coldstore.sourceforge.net/wiki/
CreationMatters http://www.ourpla.net/cgi-bin/wiki.pl?
CsWiki http://cs.messiah.edu/~scmoonen/index.php?
DejaNews http://www.deja.com/=dnc/getdoc.xp?AN=
Dictionary http://www.dictionary.com/cgi-bin/dict.pl?term=
DolphinWiki http://www.object-arts.com/wiki/html/Dolphin/
EfnetCppWiki http://www.encrypted.net/~jh/cpp-wiki/moin.cgi/
EfnetPythonWiki http://www.encrypted.net/~jh/python-wiki/moin.cgi/
EfnetXmlWiki http://www.encrypted.net/~jh/xml-wiki/moin.cgi/
EmacsWiki http://www.emacswiki.org/cgi-bin/wiki.pl?
Foldoc http://www.foldoc.org/foldoc/foldoc.cgi?
FoxWiki http://fox.wikis.com/wc.dll?Wiki~
Google http://www.google.com/search?q=
GoogleGroups http://groups.google.com/groups?q=
GreenCheese http://www.greencheese.org/
H2G2 http://www.h2g2.com/Search?searchstring=
HammondWiki http://www.dairiki.org/HammondWiki/index.php?
IAwiki http://www.IAwiki.net/
ICQ http://wwp.icq.com/
IMDB http://us.imdb.com/Title?
JargonFile http://sunir.org/apps/meta.pl?wiki=JargonFile&redirect=
JiniWiki http://www.cdegroot.com/cgi-bin/jini?
JustDoItWiki http://www.just-do.it/
KnowHow http://www2.iro.umontreal.ca/~paquetse/cgi-bin/wiki.cgi?
LegoWiki http://www.object-arts.com/wiki/html/Lego-Robotics/
LiveJournal http://www.livejournal.com/users/
MbTest http://www.usemod.com/cgi-bin/mbtest.pl?
MeatBall http://www.usemod.com/cgi-bin/mb.pl?
MetaWiki http://sunir.org/apps/meta.pl?words=
MoinMoin http://purl.net/wiki/moin/
MuWeb http://www.dunstable.com/scripts/MuWebWeb?
OpenWiki http://openwiki.com/?
OrgPatterns http://www.bell-labs.com/cgi-user/OrgPatterns/OrgPatterns?
PeerCastWiki http://www.peercastwiki.com/
PersonalTelco http://www.personaltelco.net/index.cgi/
PGPKey http://keys.pgp.dk:11371/pks/lookup?op=get&search=
PPR http://c2.com/cgi/wiki?
PhpWiki http://phpwiki.sourceforge.net/phpwiki/index.php?
Pikie http://pikie.darktech.org/cgi/pikie?
PolitizenWiki http://www.politizen.com/wiki.asp?
PyWiki http://www.voght.com/cgi-bin/pywiki?
PythonInfo http://www.python.org/cgi-bin/moinmoin/
Raging http://ragingsearch.altavista.com/cgi-bin/query?q=
RFC http://www.rfc.org.uk/cgi-bin/lookup.cgi?rfc=
RichmondFreeWireless http://www.richmondfreewireless.org/index.php?page=
SeattleWireless http://seattlewireless.net/?
SenseisLibrary http://senseis.xmp.net/?
SourceForge http://sourceforge.net/
SourceMage http://wiki.sourcemage.org/
Squeak http://minnow.cc.gatech.edu/squeak/
SquirrelMail http://squirrelmail.org/wiki/wiki.php?
Stikki http://steaky.dhs.org/tavi/
StrikiWiki http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?
Tavi http://tavi.sourceforge.net/
Thesaurus http://www.thesaurus.com/cgi-bin/search?config=roget&words=
Thinki http://www.thinkware.se/cgi-bin/thinki.cgi/
TWiki http://twiki.sourceforge.net/cgi-bin/view/
UseMod http://www.usemod.com/cgi-bin/wiki.pl?
VisualWorks http://wiki.cs.uiuc.edu/VisualWorks/
Webster http://m-w.com/cgi-bin/dictionary?va=
Why http://clublet.com/c/c/why?
Wiki http://c2.com/cgi/wiki?
WikiFind http://c2.com/cgi/wiki?FindPage&value=
WikiPedia http://www.wikipedia.com/wiki/wiki.phtml?title=
ZWiki http://www.zwiki.org/
ZigZag http://zigzag.adsl.dk/zwiki/
ZooKeeper http://zookeeper.sourceforge.net/index.php?
RussellFreedom http://www.russellfreedom.com/
JTF http://www.justthefaqs.org/?page=
Wiki-Wiki-Wireless http://www.andaluciawireless.net/
WebDevWikiNL http://www.promo-it.nl/WebDevWiki/index.php?page=
IfDef http://ifdef.undef.net/
MACCAWS http://www.maccaws.com/wiki/
AviSynth http://www.avisynth.org/
WakkaWiki http://www.wakkawiki.com/
WikiNi http://www.wikini.net/wakka.php?wiki=
WikkiTikkiTavi http://tavi.sourceforge.net/
WackoWiki http://wiki.oversite.ru/
CraoWiki http://wiki.crao.net/index.php/
/branches/v2.0-narmer/client/projet/wikini/README
New file
0,0 → 1,23
Wakka
 
A Wiki-esque website toolkit by Hendrik Mans.
 
Not much to read here. For some quick installation instructions, please
check out INSTALL.
 
Most of the Wakka documentation is available online only. Please visit
the official Wakka homepage at <http://www.wakkawiki.com>. You'll
find everything else there.
 
- Hendrik Mans <hendrik@mans.de>, 2002-09-04
 
 
Wikini, a fork of Wakka.
 
The original code and derived work is under modified BSD license (see header).
New code is either under modified BSD licence or GPL license (see header of each program).
 
Please visit the official Wikini homepage at <http://www/wikini.net>.
 
- Wikini Team : David Delon, Charles Nepote, Patrick Paul, Eric Feldstein,
Jean-Christophe Andre. 2004-02-17
/branches/v2.0-narmer/client/projet/wikini/index.php
New file
0,0 → 1,30
<?php
/*
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
 
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
header("Location: wakka.php");
exit;
?>
/branches/v2.0-narmer/client/projet/wikini/actions/recentlycommented.php
New file
0,0 → 1,76
<?php
/*
recentlycommented.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Which is the max number of pages to be shown ?
if ($max = $this->GetParameter("max"))
{
if ($max=="last") $max=50; else $last = (int) $max;
}
else
{
$max = 50;
}
 
// Show recently commented pages
if ($pages = $this->LoadRecentlyCommented($max))
{
if ($this->GetParameter("max"))
{
foreach ($pages as $page)
{
// echo entry
echo "(",$page["comment_time"],") <a href=\"",$this->href("", $page["tag"], "show_comments=1"),"#",$page["comment_tag"],"\">",$page["tag"],"</a> . . . . dernier commentaire par ",$this->Format($page["comment_user"]),"<br />\n" ;
}
}
else
{
$curday='';
foreach ($pages as $page)
{
// day header
list($day, $time) = explode(" ", $page["comment_time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$time,") <a href=\"",$this->href("", $page["tag"], "show_comments=1"),"#",$page["comment_tag"],"\">",$page["tag"],"</a> . . . . dernier commentaire par ",$this->Format($page["comment_user"]),"<br />\n" ;
}
}
}
else
{
echo "<i>Aucune page n'a &eacute;t&eacute; comment&eacute;e r&eacute;cemment.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/include.php
New file
0,0 → 1,55
<?php
/*
include.php : Permet d'inclure une page Wiki dans un autre page
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Charles NEPOTE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/* Paramètres :
-- page : nom wiki de la page a inclure (obligatoire)
-- class : nom de la classe de style à inclure (facultatif)
*/
 
 
// récuperation du parametres
$incPageName = $this->GetParameter("page");
// TODO : améliorer le traitement des classes
if ($this->GetParameter("class")) {
$classes='';
$array_classes = explode(" ", $this->GetParameter("class"));
foreach ($array_classes as $c) { $classes = $classes . "include_" . $c . " "; }
}
 
// Affichage de la page ou d'un message d'erreur
if (empty($incPageName)) {
echo $this->Format("//Le paramètre \"page\" est manquant.//");
} else {
if (eregi("^".$incPageName."$",$this->GetPageTag())) {
echo $this->Format("//Impossible à une page de s'inclure dans elle même.//");
} else {
if (!$this->HasAccess("read",$incPageName)){
echo $this->Format("//Lecture de la page inclue $page non autorisée.//");
} else {
$incPage = $this->LoadPage($incPageName);
$output = $this->Format($incPage["body"]);
if ($classes) echo "<div class=\"", $classes,"\">\n", $output, "</div>\n";
else echo $output;
}
}
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/recentcomments.php
New file
0,0 → 1,54
<?php
/*
recentcomments.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($comments = $this->LoadRecentComments())
{
foreach ($comments as $comment)
{
// day header
list($day, $time) = explode(" ", $comment["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$comment["time"],") <a href=\"",$this->href("", $comment["comment_on"], "show_comments=1"),"#",$comment["tag"],"\">",$comment["comment_on"],"</a> . . . . ",$this->Format($comment["user"]),"<br />\n" ;
}
}
else
{
echo "<i>Pas de commentaires r&eacute;cents.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/attachfm.php
New file
0,0 → 1,38
<?php
/*
attachfm.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
 
*/
$url = $this->href('filemanager',$this->GetPageTag());
echo '<a href="'.$url.'"><span class="attachfm"><span>Gestion des fichiers attachés</span></span></a>';
?>
/branches/v2.0-narmer/client/projet/wikini/actions/header.php
New file
0,0 → 1,115
<?php
/* header.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$message = $this->GetMessage();
$user = $this->GetUser();
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 
 
<head>
<title><?php echo $this->GetWakkaName().":".$this->GetPageTag(); ?></title>
<?php if ($this->GetMethod() != 'show')
echo "<meta name=\"robots\" content=\"noindex, nofollow\"/>\n";?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="keywords" content="<?php echo $this->GetConfigValue("meta_keywords") ?>" />
<meta name="description" content="<?php echo $this->GetConfigValue("meta_description") ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="wakka.basic.css" />
<link rel="stylesheet" type="text/css" media="print" href="wakka.print.css" />
<style type="text/css" media="screen"> @import "<?php echo (!$_COOKIE["sitestyle"])?'wakka':$_COOKIE["sitestyle"] ?>.css";</style>
<style type="text/css" media="print"> @import "wakka.print.css";</style>
<script type="text/javascript">
function fKeyDown() {
if (event.keyCode == 9) {
event.returnValue= false;
document.selection.createRange().text = String.fromCharCode(9) } }
</script>
<!-- Début modif ACeditor -->
<style type="text/css">
.buttons { background: #ccc; border: 1px solid #ccc; margin: 1; float:left; }
.raise{ border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; background: #ccc; margin:1; float:left; }
.press { border-top: 1px solid buttonshadow; border-left: 1px solid buttonshadow; border-bottom: 1px solid buttonhighlight; border-right: 1px solid buttonhighlight; background: #ccc; margin:1; float:left; }
/* ci dessous les petits champs */
.ACsearchbox { background: #FFFFF8; border: 0px; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px; font-size: 10px; }
.texteChampsImage {font-size: 10px; }
#toolbar { margin: 0; width: 450px; padding: 0; height:20px; background: #ccc; border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; text-align:left; }
</style>
 
<script type="text/javascript" src="ACeditor.js"></script>
<!-- Fin modif ACeditor -->
</head>
 
 
<body <?php echo (!$user || ($user["doubleclickedit"] == 'Y')) && ($this->GetMethod() == "show") ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "" ?>
<?php
/*Début modif ACeditor*/
echo $message ? "onLoad=\"alert('".$message."');thisForm=document.ACEditor;\" " : "onLoad=\"thisForm=document.ACEditor;\""
/*Fin modif ACeditor*/
?> >
 
 
<div style="display: none;"><a href="<?php echo $this->href() ?>/resetstyle" accesskey="7"></a></div>
 
<h1 class="wiki_name"><?php echo $this->config["wakka_name"] ?></h1>
 
 
<h1 class="page_name">
<a href="<?php echo $this->config["base_url"] ?>RechercheTexte&amp;phrase=<?php echo urlencode($this->GetPageTag()); ?>">
<?php echo $this->GetPageTag(); ?>
</a>
</h1>
 
 
<div class="header">
<?php echo $this->ComposeLinkToPage($this->config["root_page"]); ?> ::
<?php echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "" ?>
Vous &ecirc;tes <?php echo $this->Format($this->GetUserName()); if ($user = $this->GetUser()) echo " (<a href=\"".$this->config["base_url"] ."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n"; ?>
</div>
 
<?
/*Début modif Menu Page*/
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!=""))
{
// Ajout Menu de Navigation
echo '<table class="page_table">';
echo '<tr><td class="menu_column">';
$wikiMenu = $this;
$wikiMenu->tag=$menu_page;
$wikiMenu->SetPage($wikiMenu->LoadPage($wikiMenu->tag));
echo $wikiMenu->Format($wikiMenu->page["body"], "wakka");
echo '</td>';
echo '<td class="body_column">';
}
/*Fin modif Menu Page*/
?>
 
/branches/v2.0-narmer/client/projet/wikini/actions/listpages.php
New file
0,0 → 1,85
<?php
/*
listpages.php
 
Copyright 2002 David DELON
Copyright 2003 Patrick PAUL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
if (!function_exists("TreeView"))
{
function TreeView($node,$level,$indent=0)
{
global $wiki;
if ($level>0) {
$head=split(" :: ",$wiki->GetConfigValue("navigation_links"));
// we don't want page from the header
if (!in_array($node, $head, TRUE))
{
if (($indent>0) && (!($wiki->GetConfigValue("root_page")==$node)) || ($indent==0) )
{
// Ignore users too ...
if (!$wiki->LoadUser($node))
{
if ($indent)
echo (str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$indent)),$wiki->Link($node),"<br/>\n";
$pages = $wiki->LoadAll("select to_tag from ".$wiki->config["table_prefix"]."links where from_tag='".mysql_escape_string($node)."' order by to_tag asc");
 
if (is_array($pages)) {
foreach ($pages as $page)
{
$wiki->CachePage($page);
TreeView($page["to_tag"],$level-1,$indent+1);
}
}
}
}
}
}
}
}
 
if($sortkey = $this->GetParameter("sort")) {
if (($sortkey != "tag") && ($sortkey != "time") && ($sortkey != "owner") && ($sortkey != "user")) $sortkey = "tag";
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by $sortkey asc");
foreach ($pages as $page) {
$this->CachePage($page);
$owner=$page["owner"]?$page["owner"]:"Inconnu";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),". . . . derni&egrave;re modification par " , $this->Format($page["user"]) , "<br/>\n" ;
}
}
// Tree display
else if ($sortkey = $this->GetParameter("tree"))
{
// No rootpage specified, assume root_page
if ($sortkey=="tree") $sortkey=$this->GetConfigValue("root_page");
echo $this->ComposeLinkToPage($sortkey),"<br /><br/>\n" ;
 
// 3 levels displayed, It should be parameter ...
TreeView($sortkey,3);
 
}
// Default Action : sort by tag
else
{
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by tag asc");
foreach ($pages as $page) {
$this->CachePage($page);
$owner=$page["owner"]?$page["owner"]:"Inconnu";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),"<br/>\n" ;
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/listusers.php
New file
0,0 → 1,45
<?php
/*
listusers.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if ($last = $this->GetParameter("last"))
{
if ($last=="last") $last=150; else $last= (int) $last;
if ($last)
{
$last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by signuptime desc limit $last");
foreach($last_users as $user) { echo $this->Format($user["name"])," . . . ",$user["signuptime"],"<br />\n" ; }
}
}
 
else
{
if ($last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by name asc")
)
{
foreach($last_users as $user)
{
echo $this->Format($user["name"])," . . . ",$user["signuptime"],"<br />\n" ;
}
}
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/footer.php
New file
0,0 → 1,105
 
 
<div class="footer">
<?php
/* footer.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003, 2004 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
echo $this->FormOpen("", "RechercheTexte", "get");
echo $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a> ::\n" : "";
echo $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les derni&egrave;res modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : "";
// if this page exists
if ($this->page)
{
// if owner is current user
if ($this->UserIsOwner())
{
echo
"Propri&eacute;taire&nbsp;: vous :: \n",
"<a href=\"",$this->href("acls")."\" title=\"Cliquez pour &eacute;diter les permissions de cette page.\">&Eacute;diter permissions</a> :: \n",
"<a href=\"",$this->href("deletepage")."\">Supprimer</a> :: \n",
"<a href=\"",$this->href("filemanager")."\">Fichiers &amp; images</a> :: \n";//Gestion de l'action ATTACH
}
else
{
if ($owner = $this->GetPageOwner())
{
echo "Propri&eacute;taire : ",$this->Format($owner);
}
else
{
echo "Pas de propri&eacute;taire ";
echo ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : "");
}
echo " :: \n";
}
}
?>
<a href="<?php echo $this->href("referrers") ?>" title="Cliquez pour voir les URLs faisant r&eacute;f&eacute;rence &agrave; cette page.">
R&eacute;f&eacute;rences</a> ::
Recherche : <input name="phrase" size="15" class="searchbox" />
<?php echo $this->FormClose(); ?>
</div>
 
 
<div class="copyright">
<a href="http://validator.w3.org/check/referer">XHTML 1.0 valide ?</a> ::
<a href="http://jigsaw.w3.org/css-validator/check/referer">CSS valide ?</a> ::
-- Fonctionne avec <?php echo $this->Link("WikiNi:PagePrincipale", "", "WikiNi ".$this->GetWikiNiVersion()) . "\n"; ?>
</div>
 
 
<?php
if ($this->GetConfigValue("debug")=="yes")
{
echo "<span class=\"debug\"><b>Query log :</b><br />\n";
$t_SQL=0;
foreach ($this->queryLog as $query)
{
echo $query["query"]." (".round($query["time"],4).")<br />\n";
$t_SQL = $t_SQL + $query["time"];
}
echo "</span>\n";
 
echo "<span class=\"debug\">".round($t_SQL, 4)." s (total SQL time)</span><br />\n";
list($g2_usec, $g2_sec) = explode(" ",microtime());
define ("t_end", (float)$g2_usec + (float)$g2_sec);
echo "<span class=\"debug\"><b>".round(t_end-t_start, 4)." s (total time)</b></span><br />\n";
 
echo "<span class=\"debug\">SQL time represent : ".round((($t_SQL/(t_end-t_start))*100),2)."% of total time</span>\n";
}
?>
 
<?
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!="")) echo '</td></tr></table>';
?>
</body>
</html>
/branches/v2.0-narmer/client/projet/wikini/actions/usersettings.php
New file
0,0 → 1,256
<?php
/*
usersettings.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (!isset($_REQUEST["action"])) $_REQUEST["action"] = '';
if ($_REQUEST["action"] == "logout")
{
$this->LogoutUser();
$this->SetMessage("Vous &ecirc;tes maintenant d&eacute;connect&eacute; !");
$this->Redirect($this->href());
}
else if ($user = $this->GetUser())
{
// is user trying to update?
if ($_REQUEST["action"] == "update")
{
$this->Query("update ".$this->config["table_prefix"]."users set ".
"email = '".mysql_escape_string($_POST["email"])."', ".
"doubleclickedit = '".mysql_escape_string($_POST["doubleclickedit"])."', ".
"show_comments = '".mysql_escape_string($_POST["show_comments"])."', ".
"revisioncount = '".mysql_escape_string($_POST["revisioncount"])."', ".
"changescount = '".mysql_escape_string($_POST["changescount"])."', ".
"motto = '".mysql_escape_string($_POST["motto"])."' ".
"where name = '".$user["name"]."' limit 1");
$this->SetUser($this->LoadUser($user["name"]));
// forward
$this->SetMessage("Param&egrave;tres sauvegard&eacute;s !");
$this->Redirect($this->href());
}
if ($_REQUEST["action"] == "changepass")
{
// check password
$password = $_POST["password"];
if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans les mots de passe.";
else if (strlen($password) < 5) $error = "Mot de passe trop court.";
else if ($user["password"] != md5($_POST["oldpass"])) $error = "Mauvais mot de passe.";
else
{
$this->Query("update ".$this->config["table_prefix"]."users set "."password = md5('".mysql_escape_string($password)."') "."where name = '".$user["name"]."'");
$this->SetMessage("Mot de passe chang&eacute; !");
$user["password"]=md5($password);
$this->SetUser($user);
$this->Redirect($this->href());
}
}
// user is logged in; display config form
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="update" />
<table>
<tr>
<td align="right"></td>
<td>Bonjour, <?php echo $this->Link($user["name"]) ?>&nbsp;!</td>
</tr>
<tr>
<td align="right">Votre adresse de messagerie &eacute;lectronique&nbsp;:</td>
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">&Eacute;dition en double-cliquant&nbsp;:</td>
<td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $user["doubleclickedit"] == "Y" ? "checked=\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Par d&eacute;faut, montrer les commentaires&nbsp;:</td>
<td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $user["show_comments"] == "Y" ? "checked\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Nombre maximum de derniers commentaires&nbsp;:</td>
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Nombre maximum de versions&nbsp;:</td>
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Votre devise&nbsp;:</td>
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Mise &agrave; jour" /> <input type="button" value="D&eacute;connexion" onclick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td>
</tr>
 
<?php
echo $this->FormClose();
 
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="changepass" />
 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("Changement de mot de passe"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre ancien mot de passe&nbsp;:</td>
<td><input type="password" name="oldpass" size="40" /></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe&nbsp;:</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Changer" size="40" /></td>
</tr>
</table>
<?php
echo $this->FormClose();
 
}
else
{
// user is not logged in
// is user trying to log in or register?
if ($_REQUEST["action"] == "login")
{
// if user name already exists, check password
if ($existingUser = $this->LoadUser($_POST["name"]))
{
// check password
if ($existingUser["password"] == md5($_POST["password"]))
{
$this->SetUser($existingUser, $_POST["remember"]);
$this->Redirect($this->href());
}
else
{
$error = "Mauvais mot de passe&nbsp;!";
}
}
// otherwise, create new account
else
{
$name = trim($_POST["name"]);
$email = trim($_POST["email"]);
$password = $_POST["password"];
$confpassword = $_POST["confpassword"];
 
// check if name is WikkiName style
if (!$this->IsWikiName($name)) $error = "Votre nom d'utilisateur doit &ecirc;tre format&eacute; en NomWiki.";
else if (!$email) $error = "Vous devez sp&eacute;cifier une adresse de messagerie &eacute;lectronique.";
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas &agrave; une adresse de messagerie &eacute;lectronique.";
else if ($confpassword != $password) $error = "Les mots de passe n'&eacute;taient pas identiques";
else if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans un mot de passe.";
else if (strlen($password) < 5) $error = "Mot de passe trop court. Un mot de passe doit contenir au minimum 5 caract&egrave;res alphanum&eacute;riques.";
else
{
$this->Query("insert into ".$this->config["table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_escape_string($name)."', ".
"email = '".mysql_escape_string($email)."', ".
"password = md5('".mysql_escape_string($_POST["password"])."')");
 
// log in
$this->SetUser($this->LoadUser($name));
 
// forward
$this->Redirect($this->href());
}
}
}
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="login" />
<table>
<tr>
<td></td>
<td><?php echo $this->Format("Si vous &ecirc;tes d&eacute;j&agrave; enregistr&eacute;, identifiez-vous ici"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre NomWiki&nbsp;:</td>
<td><input name="name" size="40" value="<?php if (isset($name)) echo $name ?>" /></td>
</tr>
<tr>
<td align="right">Mot de passe (5 caract&egrave;res minimum)&nbsp;:</td>
<td>
<input type="password" name="password" size="40" />
<input type="hidden" name="remember" value="0" />
<input type="checkbox" name="remember" value="1" />&nbsp;Se souvenir de moi.
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Identification" size="40" /></td>
</tr>
<tr>
<td></td>
<td width="500"><?php echo $this->Format("Les champs suivants sont &agrave; remplir si vous vous identifiez pour la premi&egrave;re fois (vous cr&eacute;erez ainsi un compte)"); ?></td>
</tr>
<tr>
<td align="right">Confirmation du mot de passe&nbsp;:</td>
<td><input type="password" name="confpassword" size="40" /></td>
</tr>
<tr>
<td align="right">Adresse de messagerie &eacute;lectronique.&nbsp;:</td>
<td><input name="email" size="40" value="<?php if (isset($email)) echo $email ?>" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Nouveau compte" size="40" /></td>
</tr>
</table>
<?php
echo $this->FormClose();
}
?>
 
/branches/v2.0-narmer/client/projet/wikini/actions/redirect.php
New file
0,0 → 1,48
<?php
/*
redirect.php : Permet de faire une redirection vers une autre pages Wiki du site
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 David DELON
Copyright 2004 Jean Christophe ANDRE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/*
Parametres : page : nom wiki de la page vers laquelle ont doit rediriger (obligatoire)
exemple : {{redirect page="BacASable"}}
*/
 
//recuperation du parametres
$redirPageName = $this->GetParameter("page");
 
if (empty($redirPageName)){
echo $this->Format("//Le param&ecirc;tre \"page\" est manquant.//");
}else{
if (eregi("^".$redirPageName."$",$this->GetPageTag())){
echo $this->Format("//Impossible &agrave; une page de se rediriger vers elle m&ecirc;me.//");
}else{
$fromPages = array();
$fromPages = explode(":",$_COOKIE['redirectfrom']);
if (in_array($this->GetPageTag(),$fromPages)){
echo $this->Format("//Redirection circulaire.//");
}else{
$fromPages[] = $this->GetPageTag();
SetCookie('redirectfrom', implode(":",$fromPages), time() + 30, $this->CookiePath);
$this->Redirect($this->Href('', $redirPageName));
}
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/recentchangesrss.php
New file
0,0 → 1,60
<?php
/*
recentchangesrss.php
 
Copyright 2003 David DELON
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
if ($user = $this->GetUser())
{
$max = $user["changescount"];
}
else
{
$max = 50;
}
 
if ($pages = $this->LoadRecentlyChanged($max))
{
if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"];
$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
$output .= "<!-- RSS v0.91 generated by Wikini -->\n";
$output .= "<rdf:RDF\n";
$output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
$output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
$output .= "<channel>\n";
$output .= "<title> Derniers changements sur ". $this->config["wakka_name"] . "</title>\n";
$output .= "<link>".str_replace('&', '&amp;', $this->config["base_url"].$link)."</link>\n";
$output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n";
$output .= "<language>fr</language>\n";
$output .= "</channel>\n";
 
foreach ($pages as $i => $page)
{
list($day, $time) = explode(" ", $page["time"]);
$day= preg_replace("/-/", " ", $day);
list($hh,$mm,$ss) = explode(":", $time);
$output .= "<item>\n";
$output .= "<title>" . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n";
$output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n";
$output .= "<link>".str_replace('&', '&amp;', $this->config["base_url"].$page["tag"])."&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
$output .= "</item>\n";
}
$output .= "</rdf:RDF>\n";
echo $output ;
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/backlinks.php
New file
0,0 → 1,62
<?php
 
/*
backlinks.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if ($this->GetParameter("page"))
{
$page = $this->GetParameter("page");
$title = "Pages ayant un lien vers ".$this->ComposeLinkToPage($page)."&nbsp;: <br />\n";
}
else
{
$page = $this->getPageTag();
$title = "Pages ayant un lien vers la page courante&nbsp;: <br />\n";
}
 
$pages = $this->LoadPagesLinkingTo($page);
 
if ($pages)
{
echo $title;
if (!$exclude = $this->GetParameter("exclude"))
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
else
{
foreach ($pages as $page)
{
// Show link if it isn't an excluded link
if (!preg_match("/".$page["tag"]."(;|$)/", $exclude)) echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
}
else
{
echo "<i>Aucune page n'a de lien vers ", $this->ComposeLinkToPage($page), ".</i>";
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/interwikilist.php
New file
0,0 → 1,30
<?php
/*interwikilist.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$file = implode("", file("interwiki.conf", 1));
echo $this->Format("%%".$file."%%") ;
?>
/branches/v2.0-narmer/client/projet/wikini/actions/wantedpages.php
New file
0,0 → 1,43
<?php
/*
wantedpages.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($pages = $this->LoadWantedPages())
{
foreach ($pages as $page)
{
echo $this->Link($page["tag"])," (<a
ref=\"",$this->href(),"&amp;linking_to=",$page["tag"],"\">",$page["count"],"</a>)<br />\n";
}
}
else
{
echo "<i>Aucune page &agrave; cr&eacute;er.</i>";
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/pageindex.php
New file
0,0 → 1,54
<?php
/*
pageindex.php
Copyright (c) 2003, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($pages = $this->LoadAllPages())
{
foreach ($pages as $page)
{
if (!preg_match("/^Comment/", $page["tag"])) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
 
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
 
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
}
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/attach.php
New file
0,0 → 1,121
<?php
/*
attach.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
* DOCUMENTATION
*******************************************************************************
RESUME
L'action {{attach}} permet de lier un fichier à une page, d'uploader ce fichier
et de downloader ce fichier. Si le fichier est une image, elle est affichée
dans la page. Lorsque le fichier est sur le serveur, il est possible de faire
une mise à jour de celui-ci.
 
PARAMETRES DE L'ACTION
L'action {{attach}} prend les paramètres suivants :
- file ou attachfile: nom du fichier tel qu'il sera sur le serveur. Les
espaces sont remplacé par des "_". (OBLIGATOIRE)
- desc ou attachdesc: description du fichier. C'est le texte qui sera affiché
comme lien vers le fichier ou dans l'attribut alt de la balise <img>. Ce
paramètre est obligatoire pour les images pour être conforme au XHTML.
- delete ou attachdelete: Si ce paramètre est non vide alors le fichier sera
effacé sur le serveur.
- link ou attachlink: URL de lien pour une image sensible. le lien peut être
un nom de page WikiNi, un lien interwiki ou une adresse http
- class: indique le nom de la ou les classes de style à utiliser pour afficher
l'image. les noms des classes sont séparés par un espace.
 
EXEMPLES
- Attacher un fichier archive:
{{attach file="archive.zip"}}
- Attacher un fichier archive avec une description
{{attach file="archive.zip" desc="Code source de l'application"}}
- Supprimer un fichier:
{{attach file="archive.zip" delete="y"}}
- Afficher une image:
{{attach file="image.png" desc="voici une image"}}
- Afficher une image sensible:
{{attach file="image.png" desc="voici une image" link="PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="WikiNi:PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="http://www.wikini.net"}}
- Afficher une image collé sur le bord droit et sans contour:
{{attach file="image.png" desc="voici une image" class="right noborder"}}
 
INSTALLATION
1) Copiez le fichier attach.php dans le répertoire des actions (/actions)
2) Copiez le fichier attach.class.php dans le répertoire des actions (/actions)
3) Copiez le fichier attachfm.php dans le repertoire des actions (/actions)
4) Copiez le fichier filamanager.php dans le répertoire des handlers (/handlers/page)
5) Copiez le fichier upload.php dans le répertoire des handlers (/handlers/page)
6) Copiez le fichier download.php dans le répertoire des handlers (/handlers/page)
7) Créez le répertoire racine des uploads sur le site du wiki. Si le SAFE_MODE
de PHP est activé, vous devez créer vous même ce répertoire et autoriser
l'écriture dans ce répertoire pour l'utilisateur et le groupe.
8) Ouvrez le fichier wakka.config.php et ajoutez la configuration de l'action.
Tous les paramètres de configuration ont une valeur par défaut.
Le configuration par défaut est:
 
$wakkaConfig["attach_config"] = array(
"upload_path" => 'files', //repertoire racine des uploads
"ext_images" => 'gif|jpeg|png|jpg', //extension des fichiers images
"ext_script" => 'php|php3|asp|asx|vb|vbs|js', //extension des script(non utilisé)
"update_symbole" => '*', //symbole pour faire un update du fichier
"max_file_size" => 1024*100, //taille maximum du fichier en octer (100Ko par défaut)
"fmDelete_symbole" => 'Supr', //symbole a afficher pour le lien "supprimer" dans le gestionnaire de fichier
"fmRestore_symbole" => 'Rest', //symbole a afficher pour le lien "restaurer" dans le gestionnaire de fichier
"fmTrash_symbole" => 'Poubelle') //symbole a afficher pour le lien "Poubelle" dans le gestionnaire de fichier
 
9) Ajoutez les classes de style au fichier wakka.css. Exemple de style :
.attach_margin05em { margin: 0.5em;}
.attach_margin1em { margin: 1em;}
.attach_left {float: left;}
.attach_right {float: right;}
.attach_noborder {border-width: 0px;}
.attach_vmiddle {vertical-align: text-bottom;}
 
10)Pour configurer l'aspect du gestionnnaire de fichier utiliser les classes de style .tableFM
tableFMCol1 et tableFMCol2
Exemple :
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
*******************************************************************************/
 
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doAttach();
unset($att);
?>
/branches/v2.0-narmer/client/projet/wikini/actions/resetpassword.php
New file
0,0 → 1,80
<?php
/*
resetpassword.php
 
Copyright 2003 Patrick PAUL
Copyright 2003 David DELON
Copyright 2004 David VANTYGHEM
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
 
if (($user = $this->GetUser()) && ($user["name"]==$this->GetConfigValue("admin")) && $this->GetConfigValue("admin"))
{
 
if (($_REQUEST["action"] == "resetpass"))
{
$this->Query("update ".$this->config["table_prefix"]."users set ".
"password = md5('".mysql_escape_string($_POST["password"])."') ".
"where name = '".mysql_escape_string($_POST["name"])."' limit 1");
$this->SetMessage("Mot de passe r&eacute;initialis&eacute; !");
$this->Redirect($this->href());
}
else
{
$error="";
//$error = "Il est interdit de r&eacute;initialiser le mot de passe de cet utilisateur ! Non mais !";
}
echo $this->FormOpen() ;
$name=$_GET["name"];
?>
<input type="hidden" name="action" value="resetpass">
<table>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("R&eacute;initialisation du mot de passe"); ?></td>
</tr>
<?php
if ($error)
{
echo "<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n" ;
}
?>
<tr>
<td align="right">Login:</td>
<td><input name="name" size="40" value="<?php echo $name ?>"></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe:</td>
<td><input type="password" name="password" size="40"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Reset password" size="40"></td>
</tr>
</table>
<?php
echo $this->FormClose() ;
}
else
{
echo "<i>Vous n'avez pas les permissions n&eacute;cessaires pour ex&eacute;cuter cette action.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/mypages.php
New file
0,0 → 1,78
<?php
 
// actions/mypages.php
// written by Carlo Zottmann
// http://wakkawikki.com/CarloZottmann
/*
mypages.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Jean Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($user = $this->GetUser())
{
echo "<b>Liste des pages dont vous &ecirc;tes le propri&eacute;taire.</b><br /><br />\n" ;
 
$my_pages_count = 0;
 
if ($pages = $this->LoadAllPages())
{
foreach ($pages as $page)
{
if ($this->UserName() == $page["owner"] && !preg_match("/^Comment/", $page["tag"])) {
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
$my_pages_count++;
}
}
if ($my_pages_count == 0)
{
echo "<i>Vous n'&ecirc;tes le propri&eacute;taire d'aucune page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/listuserscommon.php
New file
0,0 → 1,24
<?php
if ($last = $this->GetParameter("last"))
{
if ($last=="last") $last=150; else $last= (int) $last;
if ($last)
{
$last_users = $this->LoadAll("select name, signuptime from ".$this->config["common_table_prefix"]."users order by signuptime desc limit $last");
foreach($last_users as $user) { print($this->Format($user["name"])." . . . ".$user["signuptime"]."<br />\n"); }
}
}
 
else
{
if ($last_users = $this->LoadAll("select name, signuptime from ".$this->config["common_table_prefix"]."users order by name asc")
)
{
foreach($last_users as $user)
{
print($this->Format($user["name"])." . . . ".$user["signuptime"]."<br />\n");
}
}
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/changestyle.php
New file
0,0 → 1,67
<?php
 
// Action changesstyle.php version 0.2 du 16/03/2004
// pour WikiNi 0.4.1rc (=> à la version du 200403xx) et supérieurs
// Par Charles Népote (c) 2004
// Licence GPL
 
 
// Fonctionnement
//
// Cette action regroupe la fonction de changement de style ainsi que l'interface
// de modification du style.
// Une fois le style sélectionné via l'interface, la requête est envoyée sous la forme :
// http://example.org/PageTest&set="NomDeFeuilleDeStyle"
// . si ce nom n'est pas constitué uniquement de caractères alphanumériques,
// une erreur est retournée
// . si ce nom est valide et que la feuille de style existe :
// . on change le cookie utilisateur
// . on redirrige l'utilisateur vers http://example.org/PageTest où
// l'utilisateur peut alors constater le changement de style
 
 
// Usage :
//
// -- {{changestyle link="xxx.css"}}
// donne le lien suivant :
// Feuille de style xxx.css
//
// -- {{changestyle link="xxx.css" title="Ouragan"}}
// donne le lien suivant :
// Ouragan
 
 
// A compléter (peut-être un jour) :
//
// -- {{changestyle}}
// donne un formulaire :
// Entrer l'adresse de la feuille de style désirée : [ ]
//
// -- {{changestyle choice="zzz.css;ttt.css"}}
// [] Feuille de style zzz
// [] Feuille de style ttt
 
 
$set = $_GET["set"];
 
 
if ($this->GetParameter(link))
{
echo "<a href=\"".$this->href()."&set=".$this->GetParameter(link)."\">";
echo (!$this->GetParameter(title))?"Feuille de style ".$this->GetParameter(link):$this->GetParameter(title);
echo "</a>";
}
 
 
// Do it.
if (preg_match("/^[A-Za-z0-9][A-Za-z0-9]+$/", $set))
{
$this->SetPersistentCookie('sitestyle',$set,1);
header("Location: ".$this->href());
}
else if ($set)
{
$this->SetMessage("La feuille de style ".$set." est non valide !");
header("Location: ".$this->href());
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/attach.class.php
New file
0,0 → 1,625
<?php
/*
attach.class.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Classe de gestion de l'action {{attach}}
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
class attach {
var $wiki = ''; //objet wiki courant
var $attachConfig = array(); //configuration de l'action
var $file = ''; //nom du fichier
var $desc = ''; //description du fichier
var $link = ''; //url de lien (image sensible)
var $isPicture = 0; //indique si c'est une image
var $classes = ''; //classe pour afficher une image
var $attachErr = ''; //message d'erreur
var $pageId = 0; //identifiant de la page
var $isSafeMode = false; //indicateur du safe mode de PHP
/**
* Constructeur. Met les valeurs par defaut aux paramètres de configuration
*/
function attach(&$wiki){
$this->wiki = $wiki;
$this->attachConfig = $this->wiki->GetConfigValue("attach_config");
if (empty($this->attachConfig["ext_images"])) $this->attachConfig["ext_images"] = "gif|jpeg|png|jpg";
if (empty($this->attachConfig["ext_script"])) $this->attachConfig["ext_script"] = "php|php3|asp|asx|vb|vbs|js";
if (empty($this->attachConfig['upload_path'])) $this->attachConfig['upload_path'] = 'files';
if (empty($this->attachConfig['update_symbole'])) $this->attachConfig['update_symbole'] = '*';
if (empty($this->attachConfig['max_file_size'])) $this->attachConfig['max_file_size'] = 1024*100; //100ko max
if (empty($this->attachConfig['fmDelete_symbole'])) $this->attachConfig['fmDelete_symbole'] = 'Supr';
if (empty($this->attachConfig['fmRestore_symbole'])) $this->attachConfig['fmRestore_symbole'] = 'Rest';
if (empty($this->attachConfig['fmTrash_symbole'])) $this->attachConfig['fmTrash_symbole'] = 'Poubelle';
$this->isSafeMode = ini_get("safe_mode");
}
/******************************************************************************
* FONCTIONS UTILES
*******************************************************************************/
/**
* Création d'une suite de répertoires récursivement
*/
function mkdir_recursif ($dir) {
if (strlen($dir) == 0) return 0;
if (is_dir($dir)) return 1;
elseif (dirname($dir) == $dir) return 1;
return ($this->mkdir_recursif(dirname($dir)) and mkdir($dir,0755));
}
/**
* Renvois le chemin du script
*/
function GetScriptPath () {
if (preg_match("/.(php)$/i",$_SERVER["PHP_SELF"])){
$a = explode('/',$_SERVER["PHP_SELF"]);
$a[count($a)-1] = '';
$path = implode('/',$a);
}else{
$path = $_SERVER["PHP_SELF"];
}
return !empty($_SERVER["HTTP_HOST"])? 'http://'.$_SERVER["HTTP_HOST"].$path : 'http://'.$_SERVER["SERVER_NAME"].$path ;
}
/**
* Calcul le repertoire d'upload en fonction du safe_mode
*/
function GetUploadPath(){
if ($this->isSafeMode) {
$path = $this->attachConfig['upload_path'];
}else{
$path = $this->attachConfig['upload_path'].'/'.$this->wiki->GetPageTag();
if (! is_dir($path)) $this->mkdir_recursif($path);
}
return $path;
}
/**
* Calcule le nom complet du fichier attaché en fonction du safe_mode, du nom et de la date de
* revision la page courante.
* Le nom du fichier "mon fichier.ext" attache à la page "LaPageWiki"sera :
* mon_fichier_datepage_update.ext
* update : date de derniere mise a jour du fichier
* datepage : date de revision de la page à laquelle le fichier a ete lié/mis a jour
* Si le fichier n'est pas une image un '_' est ajoute : mon_fichier_datepage_update.ext_
* Selon la valeur de safe_mode :
* safe_mode = on : LaPageWiki_mon_fichier_datepage_update.ext_
* safe_mode = off: LaPageWiki/mon_fichier_datepage_update.ext_ avec "LaPageWiki" un sous-repertoire du répertoire upload
*/
function GetFullFilename($newName = false){
$pagedate = $this->convertDate($this->wiki->page['time']);
//decompose le nom du fichier en nom+extension
if (preg_match('`^(.*)\.(.*)$`', str_replace(' ','_',$this->file), $match)){
list(,$file['name'],$file['ext'])=$match;
if(!$this->isPicture()) $file['ext'] .= '_';
}else{
return false;
}
//recuperation du chemin d'upload
$path = $this->GetUploadPath($this->isSafeMode);
//generation du nom ou recherche de fichier ?
if ($newName){
$full_file_name = $file['name'].'_'.$pagedate.'_'.$this->getDate().'.'.$file['ext'];
if($this->isSafeMode){
$full_file_name = $path.'/'.$this->wiki->GetPageTag().'_'.$full_file_name;
}else{
$full_file_name = $path.'/'.$full_file_name;
}
}else{
//recherche du fichier
if($this->isSafeMode){
//TODO Recherche dans le cas ou safe_mode=on
$searchPattern = '`^'.$this->wiki->GetPageTag().'_'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}else{
$searchPattern = '`^'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}
$files = $this->searchFiles($searchPattern,$path);
 
$unedate = 0;
foreach ($files as $file){
//recherche du fichier qui une datepage <= a la date de la page
if($file['datepage']<=$pagedate){
//puis qui a une dateupload la plus grande
if ($file['dateupload']>$unedate){
$theFile = $file;
$unedate = $file['dateupload'];
}
}
}
if (is_array($theFile)){
$full_file_name = $path.'/'.$theFile['realname'];
}
}
return $full_file_name;
}
/**
* Test si le fichier est une image
*/
function isPicture(){
return preg_match("/.(".$this->attachConfig["ext_images"].")$/i",$this->file)==1;
}
/**
* Renvoie la date courante au format utilise par les fichiers
*/
function getDate(){
return date('YmdHis');
}
/**
* convertie une date yyyy-mm-dd hh:mm:ss au format yyyymmddhhmmss
*/
function convertDate($date){
$date = str_replace(' ','', $date);
$date = str_replace(':','', $date);
return str_replace('-','', $date);
}
/**
* Parse une date au format yyyymmddhhmmss et renvoie un tableau assiatif
*/
function parseDate($sDate){
$pattern = '`^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$`';
$res = '';
if (preg_match($pattern, $sDate, $m)){
//list(,$res['year'],$res['month'],$res['day'],$res['hour'],$res['min'],$res['sec'])=$m;
$res = $m[1].'-'.$m[2].'-'.$m[3].' '.$m[4].':'.$m[5].':'.$m[6];
}
return ($res?$res:false);
}
/**
* Decode un nom long de fichier
*/
function decodeLongFilename($filename){
$afile = array();
$afile['realname'] = basename($filename);
$afile['size'] = filesize($filename);
$afile['path'] = dirname($filename);
if(preg_match('`^(.*)_(\d{14})_(\d{14})\.(.*)(trash\d{14})?$`', $afile['realname'], $m)){
$afile['name'] = $m[1];
//suppression du nom de la page si safe_mode=on
if ($this->isSafeMode){
$afile['name'] = preg_replace('`^('.$this->wiki->tag.')_(.*)$`i', '$2', $afile['name']);
}
$afile['datepage'] = $m[2];
$afile['dateupload'] = $m[3];
$afile['trashdate'] = preg_replace('`(.*)trash(\d{14})`', '$2', $m[4]);
//suppression de trashxxxxxxxxxxxxxx eventuel
$afile['ext'] = preg_replace('`^(.*)(trash\d{14})$`', '$1', $m[4]);
$afile['ext'] = rtrim($afile['ext'],'_');
//$afile['ext'] = rtrim($m[4],'_');
}
return $afile;
}
/**
* Renvois un tableau des fichiers correspondant au pattern. Chaque element du tableau est un
* tableau associatif contenant les informations sur le fichier
*/
function searchFiles($filepattern,$start_dir){
$files_matched = array();
$start_dir = rtrim($start_dir,'\/');
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '.')==0 || strcmp($file, '..')==0 || is_dir($file)) continue;
if (preg_match($filepattern, $file)){
$files_matched[] = $this->decodeLongFilename($start_dir.'/'.$file);
}
}
return $files_matched;
}
/******************************************************************************
* FONCTIONS D'ATTACHEMENTS
*******************************************************************************/
/**
* Test les paramètres passé à l'action
*/
function CheckParams(){
//recuperation des parametres necessaire
$this->file = $this->wiki->GetParameter("attachfile");
if (empty($this->file)) $this->file = $this->wiki->GetParameter("file");
$this->desc = $this->wiki->GetParameter("attachdesc");
if (empty($this->desc)) $this->desc = $this->wiki->GetParameter("desc");
$this->link = $this->wiki->GetParameter("attachlink");//url de lien - uniquement si c'est une image
if (empty($this->link)) $this->link = $this->wiki->GetParameter("link");
//test de validité des parametres
if (empty($this->file)){
$this->attachErr = $this->wiki->Format("//action attach : paramètre **file** manquant//---");
}
if ($this->isPicture() && empty($this->desc)){
$this->attachErr .= $this->wiki->Format("//action attach : paramètre **desc** obligatoire pour une image//---");
}
if ($this->wiki->GetParameter("class")) {
$array_classes = explode(" ", $this->wiki->GetParameter("class"));
foreach ($array_classes as $c) { $this->classes = $this->classes . "attach_" . $c . " "; }
$this->classes = trim($this->classes);
}
}
/**
* Affiche le fichier lié comme une image
*/
function showAsImage($fullFilename){
//c'est une image : balise <IMG..../>
$img = "<img src=\"".$this->GetScriptPath().$fullFilename."\" ".
"alt=\"".$this->desc.($this->link?"\nLien vers: $this->link":"")."\" />";
//test si c'est une image sensible
if(!empty($this->link)){
//c'est une image sensible
//test si le lien est un lien interwiki
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $this->link, $matches))
{ //modifie $link pour être un lien vers un autre wiki
$this->link = $this->wiki->GetInterWikiUrl($matches[1], $matches[2]);
}
//calcule du lien
$output = $this->wiki->Format('[['.$this->link." $this->file]]");
$output = eregi_replace(">$this->file<",">$img<",$output);//insertion du tag <img...> dans le lien
}else{
//ce n'est pas une image sensible
$output = $img;
}
$output = ($this->classes?"<span class=\"$this->classes\">$output</span>":$output);
echo $output;
$this->showUpdateLink();
}
/**
* Affiche le fichier lié comme un lien
*/
function showAsLink($fullFilename){
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=$this->file");
echo '<a href="'.$url.'">'.($this->desc?$this->desc:$this->file)."</a>";
$this->showUpdateLink();
}
/**
* Affiche le lien de mise à jour
*/
function showUpdateLink(){
echo " <a href=\"".
$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file").
"\" title='Mise à jour'>".$this->attachConfig['update_symbole']."</a>";
}
/**
* Affiche un liens comme un fichier inexistant
*/
function showFileNotExits(){
echo $this->file."<a href=\"".$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file")."\">?</a>";
}
/**
* Affiche l'attachement
*/
function doAttach(){
$this->CheckParams();
if ($this->attachErr) {
echo $this->attachErr;
return;
}
$fullFilename = $this->GetFullFilename();
//test d'existance du fichier
if((!file_exists($fullFilename))||($fullFilename=='')){
$this->showFileNotExits();
return;
}
//le fichier existe : affichage en fonction du type
if($this->isPicture()){
$this->showAsImage($fullFilename);
}else{
$this->showAsLink($fullFilename);
}
}
/******************************************************************************
* FONTIONS D'UPLOAD DE FICHIERS
*******************************************************************************/
/**
* Traitement des uploads
*/
function doUpload(){
$HasAccessWrite=$this->wiki->HasAccess("write");
if ($HasAccessWrite){
switch ($_SERVER["REQUEST_METHOD"]) {
case 'GET' : $this->showUploadForm(); break;
case 'POST': $this->performUpload(); break;
default : echo $this->wiki->Format("//Methode de requete invalide//---");
}
}else{
echo $this->wiki->Format("//Vous n'avez pas l'accès en écriture à cette page//---");
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
}
/**
* Formulaire d'upload
*/
function showUploadForm(){
echo $this->wiki->Format("====Formulaire d'envois de fichier====\n---");
$this->file = $_GET['file'];
echo $this->wiki->Format("**Envois du fichier $this->file :**\n")
."<form enctype=\"multipart/form-data\" name=\"frmUpload\" method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">\n"
." <input type=\"hidden\" name=\"wiki\" value=\"".$this->wiki->GetPageTag()."/upload\" />\n"
." <input TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$this->attachConfig['max_file_size']."\" />\n"
." <input type=\"hidden\" name=\"file\" value=\"$this->file\" />\n"
." <input type=\"file\" name=\"upFile\" size=\"50\" /><br />\n"
." <input type=\"submit\" value=\"Envoyer\" />\n"
."</form>\n";
}
/**
* Execute l'upload
*/
function performUpload(){
$this->file = $_POST['file'];
 
$destFile = $this->GetFullFilename(true); //nom du fichier destination
//test de la taille du fichier recu
if($_FILES['upFile']['error']==0){
$size = filesize($_FILES['upFile']['tmp_name']);
if ($size > $this->attachConfig['max_file_size']){
$_FILES['upFile']['error']=2;
}
}
switch ($_FILES['upFile']['error']){
case 0:
$srcFile = $_FILES['upFile']['tmp_name'];
if (move_uploaded_file($srcFile,$destFile)){
chmod($destFile,0644);
header("Location: ".$this->wiki->href("",$this->wiki->GetPageTag(),""));
}else{
echo $this->wiki->Format("//Erreur lors du déplacement du fichier temporaire//---");
}
break;
case 1:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de upload_max_filesize, configuré dans le php.ini.//---");
break;
case 2:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de MAX_FILE_SIZE, qui a été spécifiée dans le formulaire HTML.//---");
break;
case 3:
echo $this->wiki->Format("//Le fichier n'a été que partiellement téléchargé.//---");
break;
case 4:
echo $this->wiki->Format("//Aucun fichier n'a été téléchargé.//---");
break;
}
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
/******************************************************************************
* FUNCTIONS DE DOWNLOAD DE FICHIERS
*******************************************************************************/
function doDownload(){
$this->file = $_GET['file'];
$fullFilename = $this->GetUploadPath().'/'.$this->file;
if(!file_exists($fullFilename)){
$fullFilename = $this->GetFullFilename();
$dlFilename = $this->file;
$size = filesize($fullFilename);
}else{
$file = $this->decodeLongFilename($fullFilename);
$size = $file['size'];
$dlFilename =$file['name'].'.'.$file['ext'];
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/force-download");
header('Pragma: public');
header("Pragma: no-cache");// HTTP/1.0
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octet-stream; name="' . $dlFilename . '"'); //This should work for the rest
header('Content-Type: application/octetstream; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Type: application/download; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Disposition: attachment; filename="'.$dlFilename.'"');
header("Content-Description: File Transfer");
header("Content-length: $size".'bytes');
readfile($fullFilename);
}
/******************************************************************************
* FONTIONS DU FILEMANAGER
*******************************************************************************/
function doFileManager(){
$do = $_GET['do']?$_GET['do']:'';
switch ($do){
case 'restore' :
$this->fmRestore();
$this->fmShow(true);
break;
case 'erase' :
$this->fmErase();
$this->fmShow(true);
break;
case 'del' :
$this->fmDelete();
$this->fmShow();
break;
case 'trash' :
$this->fmShow(true); break;
case 'emptytrash' :
$this->fmEmptyTrash(); //pas de break car apres un emptytrash => retour au gestionnaire
default :
$this->fmShow();
}
}
/**
* Affiche la liste des fichiers
*/
function fmShow($trash=false){
$fmTitlePage = $this->wiki->Format("====Gestion des fichiers attachés à la page ".$this->wiki->tag."====\n---");
if($trash){
//Avertissement
$fmTitlePage .= '<div class="prev_alert">Les fichiers effacés sur cette page le sont définitivement</div>';
//Pied du tableau
$url = $this->wiki->Link($this->wiki->tag,'filemanager','Gestion des fichiers');
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n";
$url = $this->wiki->Link($this->wiki->tag,'filemanager&do=emptytrash','Vider la poubelle');
$fmFootTable.= ' <td>'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}else{
//pied du tableau
$url = '<a href="'.$this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=trash').'" title="Poubelle">'.$this->attachConfig['fmTrash_symbole']."</a>";
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}
//entete du tableau
$fmHeadTable = ' <thead>'."\n".
' <tr>'."\n".
' <td>&nbsp;</td>'."\n".
' <td>Nom du fichier</td>'."\n".
' <td>Nom réel du fichier</td>'."\n".
' <td>Taille</td>'."\n".
' <td>Révision de la page</td>'."\n".
' <td>Révison du fichier</td>'."\n";
if($trash){
$fmHeadTable.= ' <td>Suppression</td>'."\n";
}
$fmHeadTable.= ' </tr>'."\n".
' </thead>'."\n";
//corps du tableau
$files = $this->fmGetFiles($trash);
$files = $this->sortByNameRevFile($files);
 
$fmBodyTable = ' <tbody>'."\n";
$i = 0;
foreach ($files as $file){
$i++;
$color= ($i%2?"tableFMCol1":"tableFMCol2");
//lien de suppression
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=erase&file='.$file['realname']);
}else{
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=del&file='.$file['realname']);
}
$dellink = '<a href="'.$url.'" title="Supprimer">'.$this->attachConfig['fmDelete_symbole']."</a>";
//lien de restauration
$restlink = '';
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=restore&file='.$file['realname']);
$restlink = '<a href="'.$url.'" title="Restaurer">'.$this->attachConfig['fmRestore_symbole']."</a>";
}
 
//lien pour downloader le fichier
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=".$file['realname']);
$dlLink = '<a href="'.$url.'">'.$file['name'].'.'.$file['ext']."</a>";
$fmBodyTable .= ' <tr class="'.$color.'">'."\n".
' <td>'.$dellink.' '.$restlink.'</td>'."\n".
' <td>'.$dlLink.'</td>'."\n".
' <td>'.$file['realname'].'</td>'."\n".
' <td>'.$file['size'].'</td>'."\n".
' <td>'.$this->parseDate($file['datepage']).'</td>'."\n".
' <td>'.$this->parseDate($file['dateupload']).'</td>'."\n";
if($trash){
$fmBodyTable.= ' <td>'.$this->parseDate($file['trashdate']).'</td>'."\n";
}
$fmBodyTable .= ' </tr>'."\n";
}
$fmBodyTable .= ' </tbody>'."\n";
//pied de la page
$fmFooterPage = "---\n-----\n[[".$this->wiki->tag." Retour à la page ".$this->wiki->tag."]]\n";
//affichage
echo $fmTitlePage."\n";
echo '<table class="tableFM" border="0" cellspacing="0">'."\n".$fmHeadTable.$fmFootTable.$fmBodyTable.'</table>'."\n";
echo $this->wiki->Format($fmFooterPage);
}
/**
* Renvoie la liste des fichiers
*/
function fmGetFiles($trash=false){
$path = $this->GetUploadPath();
if($this->isSafeMode){
$filePattern = '^'.$this->wiki->GetPageTag().'_.*_\d{14}_\d{14}\..*';
}else{
$filePattern = '^.*_\d{14}_\d{14}\..*';
}
if($trash){
$filePattern .= 'trash\d{14}';
}else{
$filePattern .= '[^(trash\d{14})]';
}
return $this->searchFiles('`'.$filePattern.'$`', $path);
}
/**
* Vide la poubelle
*/
function fmEmptyTrash(){
$files = $this->fmGetFiles(true);
foreach ($files as $file){
$filename = $file['path'].'/'.$file['realname'];
if(file_exists($filename)){
unlink($filename);
}
}
}
/**
* Effacement d'un fichier dans la poubelle
*/
function fmErase(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
unlink($filename);
}
}
/**
* Met le fichier a la poubelle
*/
function fmDelete(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$trash = $filename.'trash'.$this->getDate();
rename($filename, $trash);
}
}
/**
* Restauration d'un fichier mis a la poubelle
*/
function fmRestore(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$restFile = preg_replace('`^(.*\..*)trash\d{14}$`', '$1', $filename);
rename($filename, $restFile);
}
}
/**
* Tri tu tableau liste des fichiers par nom puis par date de revision(upload) du fichier, ordre croissant
*/
function sortByNameRevFile($files){
if (!function_exists('ByNameByRevFile')){
function ByNameByRevFile($f1,$f2){
$f1Name = $f1['name'].'.'.$f1['ext'];
$f2Name = $f2['name'].'.'.$f2['ext'];
$res = strcasecmp($f1Name, $f2Name);
if($res==0){
//si meme nom => compare la revision du fichier
$res = strcasecmp($f1['dateupload'], $f2['dateupload']);
}
return $res;
}
}
usort($files,'ByNameByRevFile');
return $files;
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/usersettingscommon.php
New file
0,0 → 1,231
<?php
if (!function_exists("LoadUser"))
{
function LoadUser($name, $password = 0)
{
global $wiki;
return $wiki->LoadSingle("select * from ".$wiki->config["common_table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1");
}
}
if ($_REQUEST["action"] == "logout")
{
$this->LogoutUser();
$this->SetMessage("Vous êtes maintenant déconnecté !");
$this->Redirect($this->href());
}
else if ($user = $this->GetUser())
{
// is user trying to update?
if ($_REQUEST["action"] == "update")
{
$this->Query("update ".$this->config["common_table_prefix"]."users set ".
"email = '".mysql_escape_string($_POST["email"])."', ".
"doubleclickedit = '".mysql_escape_string($_POST["doubleclickedit"])."', ".
"show_comments = '".mysql_escape_string($_POST["show_comments"])."', ".
"revisioncount = '".mysql_escape_string($_POST["revisioncount"])."', ".
"changescount = '".mysql_escape_string($_POST["changescount"])."', ".
"motto = '".mysql_escape_string($_POST["motto"])."' ".
"where name = '".$user["name"]."' limit 1");
$this->SetUser(LoadUser($user["name"]));
// forward
$this->SetMessage("Paramètres sauvegardés !");
$this->Redirect($this->href());
}
if ($_REQUEST["action"] == "changepass")
{
// check password
$password = $_POST["password"];
if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans les mots de passe.";
else if (strlen($password) < 5) $error = "Password too short.";
else if ($user["password"] != md5($_POST["oldpass"])) $error = "Mauvais mot de passe.";
else
{
$this->Query("update ".$this->config["common_table_prefix"]."users set "."password = md5('".mysql_escape_string($password)."') "."where name = '".$user["name"]."'");
$this->SetMessage("Mot de passe changé !");
$user["password"]=md5($password);
$this->SetUser($user);
$this->Redirect($this->href());
}
}
// user is logged in; display config form
print($this->FormOpen());
?>
<input type="hidden" name="action" value="update" />
<table>
<tr>
<td align="right"></td>
<td>Hello, <?php echo $this->Link($user["name"]) ?>!</td>
</tr>
<tr>
<td align="right">Votre adresse e-mail :</td>
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Edition en Doublecliquant :</td>
<td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $user["doubleclickedit"] == "Y" ? "checked=\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Montrer les commentaires par default :</td>
<td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $user["show_comments"] == "Y" ? "checked\"checked\"" : "" ?> /></td>
</tr>
<tr>
<td align="right">Nombre maximum de derniers commentaires :</td>
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Nombre maximum de versions :</td>
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Votre devise :</td>
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Mise à jour" /> <input type="button" value="Déconnection" onClick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td>
</tr>
 
<?php
print($this->FormClose());
 
print($this->FormOpen());
?>
<input type="hidden" name="action" value="changepass" />
 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("Changement de mot de passe"); ?></td>
</tr>
<?php
if ($error)
{
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n");
}
?>
<tr>
<td align="right">Votre ancien mot de passe :</td>
<td><input type="password" name="oldpass" size="40" /></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe :</td>
<td><input type="password" name="password" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Changer" size="40" /></td>
</tr>
</table>
<?php
print($this->FormClose());
 
}
else
{
// user is not logged in
// is user trying to log in or register?
if ($_REQUEST["action"] == "login")
{
// if user name already exists, check password
if ($existingUser = LoadUser($_POST["name"]))
{
// check password
if ($existingUser["password"] == md5($_POST["password"]))
{
$this->SetUser($existingUser, $_POST["remember"]);
$this->Redirect($this->href());
}
else
{
$error = "Mauvais mot de passe !";
}
}
// otherwise, create new account
else
{
$name = trim($_POST["name"]);
$email = trim($_POST["email"]);
$password = $_POST["password"];
$confpassword = $_POST["confpassword"];
 
// check if name is WikkiName style
if (!$this->IsWikiName($name)) $error = "Votre nom d'utilisateur dois être formaté en NomWiki.";
else if (!$email) $error = "Vous devez spécifier une adresse e-mail.";
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas à une adresse e-mail.";
else if ($confpassword != $password) $error = "Les mots de passe n'étaient pas identiques";
else if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans un mot de passe.";
else if (strlen($password) < 5) $error = "Mot de passe trop court. Un mot de passe doit contenir au minimum 5 caractères alphanumériques.";
else
{
$this->Query("insert into ".$this->config["common_table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_escape_string($name)."', ".
"email = '".mysql_escape_string($email)."', ".
"password = md5('".mysql_escape_string($_POST["password"])."')");
 
// log in
$this->SetUser(LoadUser($name));
 
// forward
$this->Redirect($this->href());
}
}
}
print($this->FormOpen());
?>
<input type="hidden" name="action" value="login" />
<table>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("Si vous êtes déjà enregistré, identifiez-vous ici"); ?></td>
</tr>
<?php
if ($error)
{
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n");
}
?>
<tr>
<td align="right">Votre NomWiki :</td>
<td><input name="name" size="40" value="<?php echo $name ?>" /></td>
</tr>
<tr>
<td align="right">Mot de passe (5 caractères minimum) :</td>
<td><input type="password" name="password" size="40" />
<input type="hidden" name="remember" value="0" /><input type="checkbox" name="remember" value="1" /> <?php echo $this->Format("Se souvenir de moi.") ?> </td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Identification" size="40" /></td>
</tr>
<tr>
<td align="right"></td>
<td width="500"><?php echo $this->Format("Les champs suivants sont à remplir si vous vous identifiez pour la première fois (vous créérez ainsi un compte)"); ?></td>
</tr>
<tr>
<td align="right">Confirmation du mot de passe :</td>
<td><input type="password" name="confpassword" size="40" /></td>
</tr>
<tr>
<td align="right">Adresse e-mail :</td>
<td><input name="email" size="40" value="<?php echo $email ?>" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Nouveau compte" size="40" /></td>
</tr>
</table>
<?php
print($this->FormClose());
}
?>
 
/branches/v2.0-narmer/client/projet/wikini/actions/recentchanges.php
New file
0,0 → 1,76
<?php
 
/*
recentchanges.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Which is the max number of pages to be shown ?
if ($max = $this->GetParameter("max"))
{
if ($max=="last") $max=50; else $last = (int) $max;
}
elseif ($user = $this->GetUser())
{
$max = $user["changescount"];
}
else
{
$max = 50;
}
 
// Show recently changed pages
if ($pages = $this->LoadRecentlyChanged($max))
{
if ($this->GetParameter("max"))
{
foreach ($pages as $i => $page)
{
// echo entry
echo "(",$page["time"],") (",$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($page["user"]),"<br />\n" ;
}
}
else
{
$curday='';
foreach ($pages as $i => $page)
{
// day header
list($day, $time) = explode(" ", $page["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$time,") (",$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($page["user"]),"<br />\n" ;
}
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/textsearch.php
New file
0,0 → 1,106
<?php
/*
textsearch.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
Copyright 2004 Jean Christophe ANDRÉ
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// label à afficher devant la zone de saisie
$label = $this->GetParameter('label', 'Ce que vous souhaitez chercher&nbsp;: ');
// largeur de la zone de saisie
$size = $this->GetParameter('size', '40');
// texte du bouton
$button = $this->GetParameter('button', 'Chercher');
// texte à chercher
$phrase = $this->GetParameter('phrase', false);
// séparateur entre les éléments trouvés
$separator = $this->GetParameter('separator', false);
 
// se souvenir si c'était un paramètre de l'action ou du CGI
$paramPhrase = $phrase;
// récupérer le paramètre du CGI le cas échéant
if (!isset($_REQUEST['phrase'])) $_REQUEST['phrase'] = '';
if (!$phrase) $phrase = $_REQUEST['phrase'];
 
// s'il y a un paramètre d'action "phrase", on affiche uniquement le résultat
// dans le cas contraire, présenter une zone de saisie
if (!$paramPhrase)
{
echo $this->FormOpen('', '', 'get');
if ($label)
{
echo $this->Format($label), ' ';
}
echo '<input name="phrase" size="', htmlspecialchars($size), '" value="', htmlentities($phrase), '" />';
if ($button)
{
echo '&nbsp;<input type="submit" value="', htmlspecialchars($button), '" />';
}
echo "\n", $this->FormClose();
}
 
if ($phrase)
{
if ($results = $this->FullTextSearch($phrase))
{
if ($separator)
{
$separator = htmlspecialchars($separator);
if (!$paramPhrase)
{
echo '<p>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;: ';
}
foreach ($results as $i => $page)
{
if ($i > 0) echo $separator;
echo $this->ComposeLinkToPage($page['tag']);
}
if (!$paramPhrase)
{
echo '</p>', "\n";
}
}
else
{
echo '<p><strong>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;:</strong></p>', "\n",
'<ol>', "\n";
foreach ($results as $i => $page)
{
echo "<li>", $this->ComposeLinkToPage($page["tag"]), "</li>\n";
}
echo "</ol>\n";
}
}
else
{
if (!$paramPhrase)
{
echo "<p>Aucun r&eacute;sultat pour \"", htmlspecialchars($phrase), "\". :-(</p>";
}
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/trail.php
New file
0,0 → 1,102
<?php
 
/*
trail.php : Permet d'afficher des liens "Page Suivante" "Sommaire" "Page Precedente" dans une page
 
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
/*
* Cette action permet de lier des pages entre elle via une page contenant la liste
* ordonnées de ces pages. L'action affiche des liens de navigation permettant de
* passer à la page suivante ou précédente ou de revenir au sommaire.
*
* @param toc string nom de la page contenant la liste ordonnée des pages à liées entre elles
*/
 
/* La page sommaire doit contenir une liste de pages. Le premier mot de chaque élément
de la liste doit être le nom d'une page du wiki, donc un mot wiki ou un lien force
exemple de page sommaire:
 
===Sommaire===
 
IntroductionAuProjet : présentation du projet.
[[AnalyseProjet Analyse]] : analyse des besoins
-BesoinDesUtilisateurs
-ContraintesTechniques
OutilsEtNormes
 
Texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte texte
 
*/
 
//echo $this->Format("===Action Trail===");
$sommaire = $this->GetParameter("toc");
if (!$sommaire) {
echo $this->Format("//Indiquez le nom de la page sommaire, paramètre 'toc'//.");
}else{
//chargement de la page sommaire
$tocPage = $this->LoadPage($sommaire);
//analyse de la page sommaire pour récupérer la liste des pages
//recuperation de la liste
if (preg_match_all("/\n[\t ]+(.*)/",$tocPage["body"],$tocListe)){
//analyse de chaque ligne de la liste pour recupérer la page cible
$currentPageIndex = NULL;
foreach ($tocListe[1] as $line){
//suppression d'un signe de liste eventuel
$line = trim(preg_replace("/^([A-Za-z0-9]+\)|-)/","",$line));
//recuperation du 1er mot
$line = preg_replace("/^(\[\[.*\]\]|[A-Za-z0-9]+)\s*(.*)$/","$1",$line);
//ajout a la liste des pages si le 1er mot est un lien force ou un mot wiki
if (preg_match("/\[\[.*\]\]/",$line,$match)|$this->IsWikiName($line)){
$pages[] = $line;
//regarde si la page ajoute a la liste est la page courante
if (strcasecmp($this->GetPageTag(),$line)==0){
$currentPageIndex = count($pages)-1;
}else { //traite le cas des lien force
if (preg_match("/\[\[(.*:)?".$this->GetPageTag()."(\s.*)?\]\]$/",$line)) {
$currentPageIndex = count($pages)-1;
}
}
 
}
}//foreach
}
//ecriture des liens Page Précedente/sommaire/page suivante
if ($currentPageIndex>0) {
$PrevPage = $pages[$currentPageIndex-1];
$btnPrev = "<span class=\"trail_button\">".$this->Format("&lt;&lt; $PrevPage")."</span>";
}else{
$btnPrev = "&nbsp;";
}
$btnTOC = "<span class=\"trail_button\">".$this->Format($sommaire)."</span>";
if ($currentPageIndex < (count($pages)-1)){
$NextPage = $pages[$currentPageIndex+1];
$btnNext = "<span class=\"trail_button\">".$this->Format("$NextPage &gt;&gt;")."</span>";
}else{
$btnNext = "&nbsp;";
}
echo "<table class=\"trail_table\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35%\">$btnPrev</td>\n";
echo " <td align=\"center\">$btnTOC</td>\n";
echo " <td align=\"right\" width=\"35%\">$btnNext</td>\n";
echo " </tr>\n";
echo "</table>\n";
}
?>
/branches/v2.0-narmer/client/projet/wikini/actions/findpage.php
New file
0,0 → 1,0
The unfinished FindPage action.
/branches/v2.0-narmer/client/projet/wikini/actions/mychanges.php
New file
0,0 → 1,118
<?php
/*
mychanges.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($user = $this->GetUser())
{
$my_edits_count = 0;
 
if (($bydate = $this->GetParameter("bydate")))
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par date de modification.</b><br /><br />\n";
 
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY time ASC, tag ASC"))
{
foreach ($pages as $page)
{
$edited_pages[$page["tag"]] = $page["time"];
}
 
arsort($edited_pages);
 
foreach ($edited_pages as $page["tag"] => $page["time"])
{
// day header
list($day, $time) = explode(" ", $page["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n";
echo "<b>$day:</b><br />\n";
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;($time) (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
 
$my_edits_count++;
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
else
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par ordre alphab&eacute;tique.</b><br /><br />\n";
 
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY tag ASC, time DESC"))
{
foreach ($pages as $page)
{
if ($last_tag != $page["tag"]) {
$last_tag = $page["tag"];
$firstChar = strtoupper($page["tag"][0]);
if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
$firstChar = "#";
}
if ($firstChar != $curChar) {
if ($curChar) echo "<br />\n";
echo "<b>$firstChar</b><br />\n";
$curChar = $firstChar;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$page["time"],") (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
$my_edits_count++;
}
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>";
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/actions/test.php
New file
0,0 → 1,0
I'm a test!
/branches/v2.0-narmer/client/projet/wikini/actions/orphanedpages.php
New file
0,0 → 1,35
<?php
/*
orphanedpages.php
 
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
if ($pages = $this->LoadOrphanedPages())
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n" ;
}
}
else
{
echo "<i>Pas de pages orphelines</i>" ;
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/xml.php
New file
0,0 → 1,39
<?php
/*
xml.php
 
Copyright 2003 David DELON
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
 
header("Content-type: text/xml");
 
if ($HasAccessRead=$this->HasAccess("read"))
{
// TODO : Return an empty xml ?
// TODO : Return an error read (noaccess) xml ?
if ($this->page)
{
// display page
echo $this->Format($this->page["body"], "action") ;
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/slide_show.php
New file
0,0 → 1,233
<?php
/*
Handler "slide_show" pour WikiNi version WikiNi 0.4.1rc et supérieurs.
Développé par Charles Népote.
Version 0.08 du 26/04/2004.
Licence GPL.
 
Par défaut il utilise les classes de style suivantes :
.slide { font-size: 160%; margin: 5%; background-color: #FFFFFF; padding: 30px; border: 1px inset; line-height: 1.5; }
.slide UL, LI { font-size: 100%; }
.slide LI LI { font-size: 90% }
.sl_nav p { text-decoration: none; text-align: right; font-size: 80%; line-height: 0.4; }
.sl_nav A { text-decoration: none; }
.sl_nav a:hover { color: #CF8888 }
.sum { font-size: 8px; }
 
Pour modifier ces styles il faut créer un fichier "slideshow.css" contenant les styles modifiés.
Le fichier "slideshow.css" sera reconnu automatiquement.
 
*/
 
// On teste si le script n'est pas appelé en direct
if (!eregi("wakka.php", $_SERVER['PHP_SELF']))
{
die ("acc&egrave;s direct interdit");
}
 
// On teste si l'utilisateur peut lire la page
if (!$this->HasAccess("read"))
{
return;
}
else
{
// On teste si la page existe
if (!$this->page)
{
return;
}
else
{
/*
Exemple de page :
(1) Présentation xxxxxxxxxxxxxx
===== (2) Titre =====
Diapo 2.
===== (3) Titre =====
Diapo 3.
===== (4) Titre =====
Diapo 4.
===== (5) Titre =====
Diapo 5.
===== (6) Titre =====
Diapo 6.
===== (7) Titre =====
Diapo 7.
Autre exemple :
===== (1) Titre =====
Diapo 1.
===== (2) Titre =====
Diapo 2.
===== (3) Titre =====
Diapo 3.
===== (4) Titre =====
Diapo 4.
===== (5) Titre =====
Diapo 5.
===== (6) Titre =====
Diapo 6.
===== (7) Titre =====
Diapo 7.
*/
 
//
// découpe la page
$body_f = $this->format($this->page["body"]);
$body = preg_split('/(.*<h2>.*<\/h2>)/',$body_f,-1,PREG_SPLIT_DELIM_CAPTURE);
if ($_REQUEST["debug"] == "1") print_r("<div style=\"display: none\">".$body."</div>");
 
// Si la première diapositive commence par un titre de niveau 1
if (preg_match('/^<h2>.*<\/h2>/', $body_f)) $major = "0";
else $major = "1";
$user = $this->GetUser(); // echo $this->GetUser();
 
// On teste toutes les paramètres du handler "slide_show" ; s'il n'y en a pas, c'est le paramètre "slide=1" qui est invoqué par défaut
 
/*
switch ($_REQUEST["method"])
{
case "export":
export();
break;
case "show":
showSlide();
break;
default:
showSlide();
break;
}
*/
 
//if ($_REQUEST["export"]) { return; }
 
if (!$body)
{
return;
}
else
{
// Si on ne précise pas de paramètre, on affiche par défaut la première diapo
if (!$_REQUEST["slide"] or $_REQUEST["slide"] == "1") $slide = "1";
else $slide = $_REQUEST["slide"];
 
// Affiche l'en-tête
echo
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo
"<html>\n\n\n",
"<head>\n",
"<title>", $this->GetWakkaName(), ":", $this->GetPageTag(), "</title>\n",
"<meta name=\"robots\" content=\"noindex, nofollow\" />\n",
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
echo
"<style type=\"text/css\" media=\"all\"> @import \"wakka.css\";</style>\n";
// Teste s'il existe une feuille de style externe, sinon utilise des styles par défaut
if (!file_exists("slideshow.css"))
{
echo "<style type=\"text/css\">\n",
".slide { font-size: 160%; margin: 5%; background-color: #FFFFFF; padding: 30px; border: 1px inset; line-height: 1.5; }\n",
".slide UL, LI { font-size: 100%; }\n",
".slide LI LI { font-size: 90% }\n",
".sl_nav p { text-decoration: none; text-align: right; font-size: 80%; line-height: 0.4; }\n",
".sl_nav A { text-decoration: none; }\n",
".sl_nav a:hover { color: #CF8888 }\n",
".sum { font-size: 8px; }\n",
"</style>\n";
}
else
{
echo "<style type=\"text/css\" media=\"all\"> @import \"slideshow.css\";</style>\n";
}
 
echo
"</head>\n\n\n";
// Affiche le corps de la page
echo
"<body ";
echo (!$user || ($user["doubleclickedit"] == 'Y')) ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "", ">\n";
 
// Affichage du sommaire [à compléter]
/*
if ($_REQUEST["sum"] == "on")
{
echo "<ul class=\"sum\">\n";
if ($major = "1") echo "<li>", $this->format($body[0]), "</li>\n";
foreach ($body as $title_sum)
{
$i = $i + 1;
$type = gettype($i/2);
// Ne retourne que les 50 premiers caractères du titre
$title_sum = substr($title_sum, 0, 50);
if ($type == "integer")
{
echo "<li>",$this->format($title_sum),"</li>\n";
}
}
echo "</ul>\n\n";
}
*/
 
// Affichage du menu de navigation
echo
"<div class=\"sl_nav\">\n",
"<p>";
if ($slide !== "1")
echo
"<a href=\"",$this->href(),"/slide_show&slide=",$_REQUEST['slide']-1,"\"><< précédent</a>",
" :: <a href=\"",$this->href(),"/slide_show&slide=1\">[début]</a>\n";
echo " :: ";
if ($body[($slide)*2-($nb*2)+2] or $slide == "1")
echo "<a href=\"",$this->href(),"/slide_show&slide=",$slide+1,"\">suivant >></a>\n";
echo
"</p>\n";
echo "<p><a href=\"",$this->href(),"/edit\">Éditer </a> :: <a href=\"",$this->href(),"\">[]-></a></p>\n";
echo
"</div>\n\n";
 
echo
"<div class=\"slide\">\n";
// Si c'est la première diapositive
if ($slide == "1" and $major == "1")
{
echo $body[0], "<br /><br />";
}
 
// A partir de la deuxième diapositive
else
{
echo
$body[($slide*2)-($major*2)-1].$body[($slide*2)-($major*2)],"\n";
echo "\n";
}
echo
"</div>\n\n";
 
echo
"</body>\n",
"</html>";
}
}
}
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/resetstyle.php
New file
0,0 → 1,27
<?php
 
// Handler resetstyle.php version 0.2 du 16/03/2004
// pour WikiNi 0.4.1rc (=> à la version du 200403xx) et supérieurs
// Par Charles Népote (c) 2004
// Licence GPL
 
 
// Fonctionnement
//
// Cet handler permet à l'utilisateur de revenir à la feuille de style par défaut du site.
// Techniquement :
 
 
// Usage :
// http://example.org/PageTest/resetstyle
 
 
// A compléter (peut-être un jour) :
//
// -- détecter le fichier par défaut via une variable de configuration
//
 
$this->SetPersistentCookie('sitestyle','wakka',1);
header("Location: ".$this->href());
 
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/referrers_sites.php
New file
0,0 → 1,98
<?php
/*
wakka.php
Copyright (c) 2003, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($global = $_REQUEST["global"])
{
$title = "Domaines faisant r&eacute;f&eacute;rence &agrave; ce wiki (<a href=\"".$this->href("referrers", "", "global=1")."\">voir la liste des pages externes</a>):";
$referrers = $this->LoadReferrers();
}
else
{
$title = "Domaines faisant r&eacute;f&eacute;rence &agrave; ".$this->Link($this->GetPageTag()).
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers")."\">voir la liste des pages externes</a>):";
$referrers = $this->LoadReferrers($this->GetPageTag());
}
 
echo "<b>$title</b><br /><br />\n" ;
if ($referrers)
{
for ($a = 0; $a < count($referrers); $a++)
{
$temp_parse_url = parse_url($referrers[$a]["referrer"]);
$temp_parse_url = ($temp_parse_url["host"] != "") ? strtolower(preg_replace("/^www\./Ui", "", $temp_parse_url["host"])) : "inconnu";
 
if (isset($referrer_sites["$temp_parse_url"]))
{
$referrer_sites["$temp_parse_url"] += $referrers[$a]["num"];
}
else
{
$referrer_sites["$temp_parse_url"] = $referrers[$a]["num"];
}
}
 
array_multisort($referrer_sites, SORT_DESC, SORT_NUMERIC);
reset($referrer_sites);
 
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" ;
foreach ($referrer_sites as $site => $site_count)
{
echo "<tr>" ;
echo "<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">" , $site_count, "</td>" ;
echo "<td valign=\"top\">" , (($site != "unknown") ? "<a href=\"http://$site\">$site</a>" : $site) , "</td>" ;
echo "</tr>\n" ;
}
echo "</table>\n" ;
}
else
{
echo "<i>None</i><br />\n" ;
}
 
if ($global)
{
echo "<br />[<a href=\"",$this->href("referrers_sites"),"\">Voir les domaines faisant r&eacute;f&eacute;rence &agrave; ",$this->GetPageTag()," seulement</a> | <a href=\"",$this->href("referrers"),"\">Voir les r&eacute;f&eacute;rences ",$this->GetPageTag()," seulement</a>]";
}
else
{
echo "<br />[<a href=\"",$this->href("referrers_sites", "", "global=1"),"\">Voir tous les domaines faisant r&eacute;f&eacute;rence </a> | <a href=\"",$this->href("referrers", "", "global=1"),"\">Voir toutes les r&eacute;f&eacute;rences </a>]" ;
}
 
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/diff.orig.php
New file
0,0 → 1,39
<div class="page">
<?php
 
/* NOTE: This is a really cheap way to do it. I think it may be more intelligent to write the two
pages to temporary files and run /usr/bin/diff over them. Then again, maybe not. */
 
// load pages
$pageA = $this->LoadPageById($_REQUEST["a"]);
$pageB = $this->LoadPageById($_REQUEST["b"]);
 
// prepare bodies
$bodyA = explode("\n", $pageA["body"]);
$bodyB = explode("\n", $pageB["body"]);
 
$added = array_diff($bodyA, $bodyB);
$deleted = array_diff($bodyB, $bodyA);
 
$output .= "<b>Comparing <a href=\"".$this->href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> to <a href=\"".$this->href("", "", "time=".urlencode($pageB["time"]))."\">".$pageB["time"]."</a></b><br />\n";
 
if ($added)
{
// remove blank lines
$output .= "<br />\n<b>Additions:</b><br />\n";
$output .= "<div class=\"additions\">".$this->Format(implode("\n", $added))."</div>";
}
 
if ($deleted)
{
$output .= "<br />\n<b>Deletions:</b><br />\n";
$output .= "<div class=\"deletions\">".$this->Format(implode("\n", $deleted))."</div>";
}
 
if (!$added && !$deleted)
{
$output .= "<br />\nNo differences.";
}
print($output);
?>
</div>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/download.php
New file
0,0 → 1,48
<?php
/*
download.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le download des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doDownload();
unset($att);
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/diff.php
New file
0,0 → 1,1003
<?php
/*
diff.php
 
Copyright (C) 1992 Free Software Foundation, Inc. Francois Pinard <pinard@iro.umontreal.ca>.
Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org>
Copyright 2002,2003,2004 David DELON
Copyright 2002 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
 
original diff.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->HasAccess("read"))
{
 
// If asked, call original diff
 
if ($_REQUEST["fastdiff"]) {
/* NOTE: This is a really cheap way to do it. I think it may be more intelligent to write the two pages to temporary files and run /usr/bin/diff over them. Then again, maybe not. */
// load pages
$pageA = $this->LoadPageById($_REQUEST["a"]);
$pageB = $this->LoadPageById($_REQUEST["b"]);
// prepare bodies
$bodyA = explode("\n", $pageA["body"]);
$bodyB = explode("\n", $pageB["body"]);
$added = array_diff($bodyA, $bodyB);
$deleted = array_diff($bodyB, $bodyA);
$output .= "<b>Comparaison de <a href=\"".$this->href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> &agrave; <a href=\"".$this->href("", "", "time=".urlencode($pageB["time"]))."\">".$pageB["time"]."</a></b><br />\n";
if ($added)
{
// remove blank lines
$output .= "<br />\n<b>Ajouts:</b><br />\n";
$output .= "<div class=\"additions\">".$this->Format(implode("\n", $added))."</div>";
}
if ($deleted)
{
$output .= "<br />\n<b>Suppressions:</b><br />\n";
$output .= "<div class=\"deletions\">".$this->Format(implode("\n", $deleted))."</div>";
}
if (!$added && !$deleted)
{
$output .= "<br />\nPas de diff&eacute;rences.";
}
echo $output;
}
else {
// load pages
$pageA = $this->LoadPageById($_REQUEST["b"]);
$pageB = $this->LoadPageById($_REQUEST["a"]);
// extract text from bodies
$textA = $pageA["body"];
$textB = $pageB["body"];
$sideA = new Side($textA);
$sideB = new Side($textB);
$bodyA='';
$sideA->split_file_into_words($bodyA);
$bodyB='';
$sideB->split_file_into_words($bodyB);
// diff on these two file
$diff = new Diff(split("\n",$bodyA),split("\n",$bodyB));
// format output
$fmt = new DiffFormatter();
$sideO = new Side($fmt->format($diff));
$resync_left=0;
$resync_right=0;
$count_total_right=$sideB->getposition() ;
$sideA->init();
$sideB->init();
$output='';
while (1) {
$sideO->skip_line();
if ($sideO->isend()) {
break;
}
if ($sideO->decode_directive_line()) {
$argument=$sideO->getargument();
$letter=$sideO->getdirective();
switch ($letter) {
case 'a':
$resync_left = $argument[0];
$resync_right = $argument[2] - 1;
break;
case 'd':
$resync_left = $argument[0] - 1;
$resync_right = $argument[2];
break;
case 'c':
$resync_left = $argument[0] - 1;
$resync_right = $argument[2] - 1;
break;
}
$sideA->skip_until_ordinal($resync_left);
$sideB->copy_until_ordinal($resync_right,$output);
// deleted word
if (($letter=='d') || ($letter=='c')) {
$sideA->copy_whitespace($output);
$output .="@@";
$sideA->copy_word($output);
$sideA->copy_until_ordinal($argument[1],$output);
$output .="@@";
}
// inserted word
if ($letter == 'a' || $letter == 'c') {
$sideB->copy_whitespace($output);
$output .="££";
$sideB->copy_word($output);
$sideB->copy_until_ordinal($argument[3],$output);
$output .="££";
}
}
}
$sideB->copy_until_ordinal($count_total_right,$output);
$sideB->copy_whitespace($output);
$out=$this->Format($output);
echo $out;
}
 
}
else{
echo "<i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page.</i>" ;
}
// Side : a string for wdiff
class Side {
var $position;
var $cursor;
var $content;
var $character;
var $directive;
var $argument;
var $length;
 
function Side($content) {
$this->content=$content;
$this->position=0;
$this->cursor=0;
$this->directive='';
$this->argument=array();
$this->length=strlen($this->content);
$this->character=substr($this->content,0,1);
}
 
function getposition() {
return $this->position;
}
 
function getcharacter() {
return $this->character;
}
 
function getdirective() {
return $this->directive;
}
 
function getargument() {
return $this->argument;
}
 
function nextchar() {
$this->cursor++;
$this->character=substr($this->content,$this->cursor,1);
}
 
function copy_until_ordinal($ordinal,&$out) {
while ($this->position < $ordinal) {
$this->copy_whitespace($out);
$this->copy_word($out);
}
}
 
function skip_until_ordinal($ordinal) {
while ($this->position < $ordinal) {
$this->skip_whitespace();
$this->skip_word();
}
}
 
function split_file_into_words (&$out) {
while (!$this->isend()) {
$this->skip_whitespace();
if ($this->isend()) {
break;
}
$this->copy_word($out);
$out .="\n";
}
}
function init() {
$this->position=0;
$this->cursor=0;
$this->directive='';
$this->argument=array();
$this->character=substr($this->content,0,1);
}
 
function isspace($char) {
if (ereg('[[:space:]]',$char)) {
return true;
}
else {
return false;
}
}
 
function isdigit($char) {
if (ereg('[[:digit:]]',$char)) {
return true;
}
else {
return false;
}
}
 
function isend() {
if (($this->cursor)>=($this->length)) {
return true;
}
else {
return false;
}
}
 
 
 
function copy_whitespace(&$out) {
while (!$this->isend() && $this->isspace($this->character)) {
$out .=$this->character;
$this->nextchar();
}
}
 
function skip_whitespace() {
while (!$this->isend() && $this->isspace($this->character)) {
$this->nextchar();
}
}
 
function skip_line() {
while (!$this->isend() && !$this->isdigit($this->character)) {
while (!$this->isend() && $this->character!="\n")
$this->nextchar();
if($this->character=="\n")
$this->nextchar();
}
}
 
 
 
function copy_word(&$out) {
while (!$this->isend() && !($this->isspace($this->character))) {
$out.=$this->character;
$this->nextchar();
}
$this->position++;
}
 
function skip_word() {
 
while (!$this->isend() && !($this->isspace($this->character))) {
$this->nextchar();
}
$this->position++;
}
 
 
function decode_directive_line() {
 
$value=0;
$state=0;
$error=0;
 
while (!$error && $state < 4) {
if ($this->isdigit($this->character)) {
$value = 0;
while($this->isdigit($this->character)) {
$value = 10 * $value + $this->character - '0';
$this->nextchar();
}
}
else if ($state != 1 && $state != 3)
$error = 1;
 
/* Assign the proper value. */
 
$this->argument[$state] = $value;
 
/* Skip the following character. */
 
switch ($state) {
case 0:
case 2:
if ($this->character == ',')
$this->nextchar();
break;
 
case 1:
if ($this->character == 'a' || $this->character == 'd' || $this->character == 'c') {
$this->directive = $this->character;
$this->nextchar();
}
else
$error = 1;
break;
 
case 3:
if ($this->character != "\n")
$error = 1;
break;
}
$state++;
}
 
/* Complete reading of the line and return success value. */
 
while ((!$this->isend()) && ($this->character != "\n")) {
$this->nextchar();
}
if ($this->character == "\n")
$this->nextchar();
 
return !$error;
}
 
 
 
}
 
// difflib
//
// A PHP diff engine for phpwiki.
//
// Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org>
// You may copy this code freely under the conditions of the GPL.
//
 
 
// PHP3 does not have assert()
define('USE_ASSERTS', function_exists('assert'));
 
class _DiffOp {
var $type;
var $orig;
var $final;
 
function norig() {
return $this->orig ? sizeof($this->orig) : 0;
}
 
function nfinal() {
return $this->final ? sizeof($this->final) : 0;
}
}
 
class _DiffOp_Copy extends _DiffOp {
var $type = 'copy';
function _DiffOp_Copy ($orig, $final = false) {
if (!is_array($final))
$final = $orig;
$this->orig = $orig;
$this->final = $final;
}
 
}
 
class _DiffOp_Delete extends _DiffOp {
var $type = 'delete';
function _DiffOp_Delete ($lines) {
$this->orig = $lines;
$this->final = false;
}
 
}
 
class _DiffOp_Add extends _DiffOp {
var $type = 'add';
function _DiffOp_Add ($lines) {
$this->final = $lines;
$this->orig = false;
}
 
}
 
class _DiffOp_Change extends _DiffOp {
var $type = 'change';
function _DiffOp_Change ($orig, $final) {
$this->orig = $orig;
$this->final = $final;
}
 
}
/**
* Class used internally by Diff to actually compute the diffs.
*
* The algorithm used here is mostly lifted from the perl module
* Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
* http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
*
* More ideas are taken from:
* http://www.ics.uci.edu/~eppstein/161/960229.html
*
* Some ideas are (and a bit of code) are from from analyze.c, from GNU
* diffutils-2.7, which can be found at:
* ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
*
* Finally, some ideas (subdivision by NCHUNKS > 2, and some optimizations)
* are my own.
*
* @author Geoffrey T. Dairiki
* @access private
*/
class _DiffEngine
{
function diff ($from_lines, $to_lines) {
$n_from = sizeof($from_lines);
$n_to = sizeof($to_lines);
 
$this->xchanged = $this->ychanged = array();
$this->xv = $this->yv = array();
$this->xind = $this->yind = array();
unset($this->seq);
unset($this->in_seq);
unset($this->lcs);
// Skip leading common lines.
for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) {
if ($from_lines[$skip] != $to_lines[$skip])
break;
$this->xchanged[$skip] = $this->ychanged[$skip] = false;
}
// Skip trailing common lines.
$xi = $n_from; $yi = $n_to;
for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {
if ($from_lines[$xi] != $to_lines[$yi])
break;
$this->xchanged[$xi] = $this->ychanged[$yi] = false;
}
// Ignore lines which do not exist in both files.
for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
$xhash[$from_lines[$xi]] = 1;
for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
$line = $to_lines[$yi];
if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
continue;
$yhash[$line] = 1;
$this->yv[] = $line;
$this->yind[] = $yi;
}
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
$line = $from_lines[$xi];
if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
continue;
$this->xv[] = $line;
$this->xind[] = $xi;
}
 
// Find the LCS.
$this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
 
// Merge edits when possible
$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
 
// Compute the edit operations.
$edits = array();
$xi = $yi = 0;
while ($xi < $n_from || $yi < $n_to) {
USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
 
// Skip matching "snake".
$copy = array();
while ( $xi < $n_from && $yi < $n_to
&& !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
$copy[] = $from_lines[$xi++];
++$yi;
}
if ($copy)
$edits[] = new _DiffOp_Copy($copy);
 
// Find deletes & adds.
$delete = array();
while ($xi < $n_from && $this->xchanged[$xi])
$delete[] = $from_lines[$xi++];
 
$add = array();
while ($yi < $n_to && $this->ychanged[$yi])
$add[] = $to_lines[$yi++];
if ($delete && $add)
$edits[] = new _DiffOp_Change($delete, $add);
elseif ($delete)
$edits[] = new _DiffOp_Delete($delete);
elseif ($add)
$edits[] = new _DiffOp_Add($add);
}
return $edits;
}
 
/* Divide the Largest Common Subsequence (LCS) of the sequences
* [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
* sized segments.
*
* Returns (LCS, PTS). LCS is the length of the LCS. PTS is an
* array of NCHUNKS+1 (X, Y) indexes giving the diving points between
* sub sequences. The first sub-sequence is contained in [X0, X1),
* [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note
* that (X0, Y0) == (XOFF, YOFF) and
* (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
*
* This function assumes that the first lines of the specified portions
* of the two files do not match, and likewise that the last lines do not
* match. The caller must trim matching lines from the beginning and end
* of the portions it is going to specify.
*/
function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
$flip = false;
if ($xlim - $xoff > $ylim - $yoff) {
// Things seems faster (I'm not sure I understand why)
// when the shortest sequence in X.
$flip = true;
list ($xoff, $xlim, $yoff, $ylim)
= array( $yoff, $ylim, $xoff, $xlim);
}
 
if ($flip)
for ($i = $ylim - 1; $i >= $yoff; $i--)
$ymatches[$this->xv[$i]][] = $i;
else
for ($i = $ylim - 1; $i >= $yoff; $i--)
$ymatches[$this->yv[$i]][] = $i;
 
$this->lcs = 0;
$this->seq[0]= $yoff - 1;
$this->in_seq = array();
$ymids[0] = array();
$numer = $xlim - $xoff + $nchunks - 1;
$x = $xoff;
for ($chunk = 0; $chunk < $nchunks; $chunk++) {
if ($chunk > 0)
for ($i = 0; $i <= $this->lcs; $i++)
$ymids[$i][$chunk-1] = $this->seq[$i];
 
$x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line]))
continue;
$matches = $ymatches[$line];
reset($matches);
while (list ($junk, $y) = each($matches))
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
break;
}
while (list ($junk, $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
$this->in_seq[$this->seq[$k]] = false;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
}
else if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k-1];
}
}
}
}
 
$seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
$ymid = $ymids[$this->lcs];
for ($n = 0; $n < $nchunks - 1; $n++) {
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
$y1 = $ymid[$n] + 1;
$seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
}
$seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
 
return array($this->lcs, $seps);
}
 
function _lcs_pos ($ypos) {
$end = $this->lcs;
if ($end == 0 || $ypos > $this->seq[$end]) {
$this->seq[++$this->lcs] = $ypos;
$this->in_seq[$ypos] = 1;
return $this->lcs;
}
 
$beg = 1;
while ($beg < $end) {
$mid = (int)(($beg + $end) / 2);
if ( $ypos > $this->seq[$mid] )
$beg = $mid + 1;
else
$end = $mid;
}
 
USE_ASSERTS && assert($ypos != $this->seq[$end]);
 
$this->in_seq[$this->seq[$end]] = false;
$this->seq[$end] = $ypos;
$this->in_seq[$ypos] = 1;
return $end;
}
 
/* Find LCS of two sequences.
*
* The results are recorded in the vectors $this->{x,y}changed[], by
* storing a 1 in the element for each line that is an insertion
* or deletion (ie. is not in the LCS).
*
* The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
*
* Note that XLIM, YLIM are exclusive bounds.
* All line numbers are origin-0 and discarded lines are not counted.
*/
function _compareseq ($xoff, $xlim, $yoff, $ylim) {
// Slide down the bottom initial diagonal.
while ($xoff < $xlim && $yoff < $ylim
&& $this->xv[$xoff] == $this->yv[$yoff]) {
++$xoff;
++$yoff;
}
 
// Slide up the top initial diagonal.
while ($xlim > $xoff && $ylim > $yoff
&& $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
--$xlim;
--$ylim;
}
 
if ($xoff == $xlim || $yoff == $ylim)
$lcs = 0;
else {
// This is ad hoc but seems to work well.
//$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
//$nchunks = max(2,min(8,(int)$nchunks));
$nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
list ($lcs, $seps)
= $this->_diag($xoff,$xlim,$yoff, $ylim,$nchunks);
}
 
if ($lcs == 0) {
// X and Y sequences have no common subsequence:
// mark all changed.
while ($yoff < $ylim)
$this->ychanged[$this->yind[$yoff++]] = 1;
while ($xoff < $xlim)
$this->xchanged[$this->xind[$xoff++]] = 1;
}
else {
// Use the partitions to split this problem into subproblems.
reset($seps);
$pt1 = $seps[0];
while ($pt2 = next($seps)) {
$this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
$pt1 = $pt2;
}
}
}
 
/* Adjust inserts/deletes of identical lines to join changes
* as much as possible.
*
* We do something when a run of changed lines include a
* line at one end and has an excluded, identical line at the other.
* We are free to choose which identical line is included.
* `compareseq' usually chooses the one at the beginning,
* but usually it is cleaner to consider the following identical line
* to be the "change".
*
* This is extracted verbatim from analyze.c (GNU diffutils-2.7).
*/
function _shift_boundaries ($lines, &$changed, $other_changed) {
$i = 0;
$j = 0;
 
USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
$len = sizeof($lines);
$other_len = sizeof($other_changed);
 
while (1) {
/*
* Scan forwards to find beginning of another run of changes.
* Also keep track of the corresponding point in the other file.
*
* Throughout this code, $i and $j are adjusted together so that
* the first $i elements of $changed and the first $j elements
* of $other_changed both contain the same number of zeros
* (unchanged lines).
* Furthermore, $j is always kept so that $j == $other_len or
* $other_changed[$j] == false.
*/
while ($j < $other_len && $other_changed[$j])
$j++;
while ($i < $len && ! $changed[$i]) {
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$i++; $j++;
while ($j < $other_len && $other_changed[$j])
$j++;
}
if ($i == $len)
break;
 
$start = $i;
 
// Find the end of this run of changes.
while (++$i < $len && $changed[$i])
continue;
 
do {
/*
* Record the length of this run of changes, so that
* we can later determine whether the run has grown.
*/
$runlength = $i - $start;
 
/*
* Move the changed region back, so long as the
* previous unchanged line matches the last changed one.
* This merges with previous changed regions.
*/
while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {
$changed[--$start] = 1;
$changed[--$i] = false;
while ($start > 0 && $changed[$start - 1])
$start--;
USE_ASSERTS && assert('$j > 0');
while ($other_changed[--$j])
continue;
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
}
 
/*
* Set CORRESPONDING to the end of the changed run, at the last
* point where it corresponds to a changed run in the other file.
* CORRESPONDING == LEN means no such point has been found.
*/
$corresponding = $j < $other_len ? $i : $len;
 
/*
* Move the changed region forward, so long as the
* first changed line matches the following unchanged one.
* This merges with following changed regions.
* Do this second, so that if there are no merges,
* the changed region is moved forward as far as possible.
*/
while ($i < $len && $lines[$start] == $lines[$i]) {
$changed[$start++] = false;
$changed[$i++] = 1;
while ($i < $len && $changed[$i])
$i++;
 
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$j++;
if ($j < $other_len && $other_changed[$j]) {
$corresponding = $i;
while ($j < $other_len && $other_changed[$j])
$j++;
}
}
} while ($runlength != $i - $start);
 
/*
* If possible, move the fully-merged run of changes
* back to a corresponding run in the other file.
*/
while ($corresponding < $i) {
$changed[--$start] = 1;
$changed[--$i] = 0;
USE_ASSERTS && assert('$j > 0');
while ($other_changed[--$j])
continue;
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
}
}
}
}
 
/**
* Class representing a 'diff' between two sequences of strings.
*/
class Diff
{
var $edits;
 
/**
* Constructor.
* Computes diff between sequences of strings.
*
* @param $from_lines array An array of strings.
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
*/
function Diff($from_lines, $to_lines) {
$eng = new _DiffEngine;
$this->edits = $eng->diff($from_lines, $to_lines);
}
 
}
 
 
/**
* A class to format Diffs
*
* This class formats the diff in classic diff format.
* It is intended that this class be customized via inheritance,
* to obtain fancier outputs.
*/
class DiffFormatter
{
 
/**
* Format a diff.
*
* @param $diff object A Diff object.
* @return string The formatted output.
*/
function format($diff) {
 
$xi = $yi = 1;
$block = false;
$context = array();
 
$this->_start_diff();
 
foreach ($diff->edits as $edit) {
if ($edit->type == 'copy') {
if (is_array($block)) {
if (sizeof($edit->orig) <= 0) {
$block[] = $edit;
}
else{
$this->_block($x0, + $xi - $x0,
$y0, + $yi - $y0,
$block);
$block = false;
}
}
}
else {
if (! is_array($block)) {
$x0 = $xi;
$y0 = $yi;
$block = array();
}
$block[] = $edit;
}
 
if ($edit->orig)
$xi += sizeof($edit->orig);
if ($edit->final)
$yi += sizeof($edit->final);
}
 
if (is_array($block))
$this->_block($x0, $xi - $x0,
$y0, $yi - $y0,
$block);
 
return $this->_end_diff();
}
 
function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
$this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
}
 
function _start_diff() {
ob_start();
}
 
function _end_diff() {
$val = ob_get_contents();
ob_end_clean();
return $val;
}
 
function _block_header($xbeg, $xlen, $ybeg, $ylen) {
if ($xlen > 1)
$xbeg .= "," . ($xbeg + $xlen - 1);
if ($ylen > 1)
$ybeg .= "," . ($ybeg + $ylen - 1);
 
return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
}
function _start_block($header) {
echo $header."\n";
}
 
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/filemanager.php
New file
0,0 → 1,58
<?php
/*
filemanager.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute le gestion des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if($this->UserIsOwner()){
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doFilemanager();
unset($att);
}else{
echo $this->Format("//Seul le propriétaire de cette page peut accéder au gestionnaire des fichiers attaché//");
}
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/addcomment.php
New file
0,0 → 1,71
<?php
/*
addcomment.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
 
if ($this->HasAccess("comment"))
{
// find number
if ($latestComment = $this->LoadSingle("select tag, id from ".$this->config["table_prefix"]."pages where comment_on != '' order by id desc limit 1"))
{
preg_match("/^Comment([0-9]+)$/", $latestComment["tag"], $matches);
$num = $matches[1] + 1;
}
else
{
$num = "1";
}
 
$body = trim($_POST["body"]);
if (!$body)
{
$this->SetMessage("Commentaire vide -- pas de sauvegarde !");
}
else
{
// store new comment
$this->SavePage("Comment".$num, $body, $this->tag);
}
 
// redirect to page
$this->redirect($this->href());
}
else
{
echo"<div class=\"page\"><i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; commenter cette page.</i></div>\n";
}
echo $this->Footer();
 
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/show.php
New file
0,0 → 1,170
<?php
/*
show.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric DELORD
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($HasAccessRead=$this->HasAccess("read"))
{
if (!$this->page)
{
echo "Cette page n'existe pas encore, voulez vous la <a href=\"".$this->href("edit")."\">cr&eacute;er</a> ?" ;
}
else
{
// comment header?
if ($this->page["comment_on"])
{
echo "<div class=\"commentinfo\">Ceci est un commentaire sur ",$this->ComposeLinkToPage($this->page["comment_on"], "", "", 0),", post&eacute; par ",$this->Format($this->page["user"])," &agrave; ",$this->page["time"],"</div>";
}
 
if ($this->page["latest"] == "N")
{
echo "<div class=\"revisioninfo\">Ceci est une version archiv&eacute;e de <a href=\"",$this->href(),"\">",$this->GetPageTag(),"</a> &agrave; ",$this->page["time"],".</div>";
}
 
 
// display page
echo $this->Format($this->page["body"], "wakka");
 
// if this is an old revision, display some buttons
if (($this->page["latest"] == "N") && $this->HasAccess("write"))
{
$latest = $this->LoadPage($this->tag);
?>
<br />
<?php echo $this->FormOpen("edit") ?>
<input type="hidden" name="previous" value="<?php echo $latest["id"] ?>">
<input type="hidden" name="body" value="<?php echo htmlentities($this->page["body"]) ?>">
<input type="submit" value="R&eacute;&eacute;diter cette version archiv&eacute;e">
<?php echo $this->FormClose(); ?>
<?php
}
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page</i>" ;
}
?>
<hr class="hr_clear" />
</div>
 
 
<?php
if ($HasAccessRead)
{
// load comments for this page
$comments = $this->LoadComments($this->tag);
// store comments display in session
$tag = $this->GetPageTag();
if (!isset($_SESSION["show_comments"][$tag]))
$_SESSION["show_comments"][$tag] = ($this->UserWantsComments() ? "1" : "0");
if (isset($_REQUEST["show_comments"])){
switch($_REQUEST["show_comments"])
{
case "0":
$_SESSION["show_comments"][$tag] = 0;
break;
case "1":
$_SESSION["show_comments"][$tag] = 1;
break;
}
}
// display comments!
if ($this->page && $_SESSION["show_comments"][$tag])
{
// display comments header
?>
<div class="commentsheader">
Commentaires [<a href="<?php echo $this->href("", "", "show_comments=0") ?>">Cacher commentaires/formulaire</a>]
</div>
<?php
// display comments themselves
if ($comments)
{
foreach ($comments as $comment)
{
echo "<a name=\"",$comment["tag"],"\"></a>\n" ;
echo "<div class=\"comment\">\n" ;
echo $this->Format($comment["body"]),"\n" ;
echo "<div class=\"commentinfo\">\n-- ",$this->Format($comment["user"])," (".$comment["time"],")\n</div>\n" ;
echo "</div>\n" ;
}
}
// display comment form
echo "<div class=\"commentform\">\n" ;
if ($this->HasAccess("comment"))
{
?>
Ajouter un commentaire &agrave; cette page:<br />
<?php echo $this->FormOpen("addcomment"); ?>
<textarea name="body" rows="6" style="width: 100%"></textarea><br />
<input type="submit" value="Ajouter Commentaire" accesskey="s">
<?php echo $this->FormClose(); ?>
<?php
}
echo "</div>\n" ;
}
else
{
?>
<div class="commentsheader">
<?php
switch (count($comments))
{
case 0:
echo "Il n'y a pas de commentaire sur cette page." ;
break;
case 1:
echo "Il y a un commentaire sur cette page." ;
break;
default:
echo "Il y a ",count($comments)," commentaires sur cette page." ;
}
?>
[<a href="<?php echo $this->href("", "", "show_comments=1") ?>">Afficher commentaires/formulaire</a>]
 
</div>
<?php
}
}
echo $this->Footer();
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/revisions.php
New file
0,0 → 1,86
<?php
/*
revisions.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
// load revisions for this pageif
if ($this->HasAccess("read")) {
 
$output='';
if ($pages = $this->LoadRevisions($this->tag))
{
$output .= $this->FormOpen("diff", "", "post");
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
$output .= "<tr>\n";
$output .= "<td><input type=\"submit\" value=\"Voir Diff&eacute;rences\" /></td>";
$output .= "<td><input type=\"checkbox\" name=\"fastdiff\"/>\n".$this->Format("Affichage simplifi&eacute;")."</td>";
$output .= "</tr>\n";
$output .= "</table>\n";
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
if ($user = $this->GetUser())
{
$max = $user["revisioncount"];
}
else
{
$max = 20;
}
$c = 0;
foreach ($pages as $page)
{
$c++;
if (($c <= $max) || !$max)
{
$output .= "<tr>";
$output .= "<td><input type=\"radio\" name=\"a\" value=\"".$page["id"]."\" ".($c == 1 ? "checked=\"checked\"" : "")." /></td>";
$output .= "<td><input type=\"radio\" name=\"b\" value=\"".$page["id"]."\" ".($c == 2 ? "checked=\"checked\"" : "")." /></td>";
$output .= "<td>&nbsp;<a href=\"".$this->href("show")."&amp;time=".urlencode($page["time"])."\">".$page["time"]."</a></td>";
$output .= "<td>&nbsp;by ".$this->Format($page["user"])."</td>";
$output .= "</tr>\n";
}
}
$output .= "</table>\n".$this->FormClose()."\n";
}
echo $output ;
}
else
{
echo "<i>Vous n'avez pas acc&egrave;s &agrave; cette page.</i>" ;
}
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/acls.php
New file
0,0 → 1,128
<?php
/*
acls.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->UserIsOwner())
{
if ($_POST)
{
// store lists
$this->SaveAcl($this->GetPageTag(), "read", $_POST["read_acl"]);
$this->SaveAcl($this->GetPageTag(), "write", $_POST["write_acl"]);
$this->SaveAcl($this->GetPageTag(), "comment", $_POST["comment_acl"]);
$message = "Droits d\'acc&egrave;s mis &agrave; jour ";//$message = "Access control lists updated";
// change owner?
if ($newowner = $_POST["newowner"])
{
$this->SetPageOwner($this->GetPageTag(), $newowner);
$message .= " et changement du propri&eacute;taire. Nouveau propri&eacute;taire : ".$newowner;//$message .= " and gave ownership to ".$newowner;
}
 
// redirect back to page
$this->SetMessage($message."!");
$this->Redirect($this->Href());
}
else
{
// load acls
$readACL = $this->LoadAcl($this->GetPageTag(), "read");
$writeACL = $this->LoadAcl($this->GetPageTag(), "write");
$commentACL = $this->LoadAcl($this->GetPageTag(), "comment");
 
// show form
?>
<h3>Liste des droits d'acc&egrave;s de la page <?php echo $this->ComposeLinkToPage($this->GetPageTag()) ?></h3><!-- Access Control Lists for-->
<br />
<?php echo $this->FormOpen("acls") ?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="padding-right: 20px">
<b>Droits de lecture :</b><br /><!-- Read ACL:-->
<textarea name="read_acl" rows="4" cols="20"><?php echo $readACL["list"] ?></textarea>
</td>
<td valign="top" style="padding-right: 20px">
<b>Droits d'&eacute;criture :</b><br /><!-- Write ACL:-->
<textarea name="write_acl" rows="4" cols="20"><?php echo $writeACL["list"] ?></textarea>
</td>
<td valign="top" style="padding-right: 20px">
<b>Droits des commentaires :</b><br /><!-- Comments ACL:-->
<textarea name="comment_acl" rows="4" cols="20"><?php echo $commentACL["list"] ?></textarea>
</td>
</tr>
<tr>
<td colspan="3">
<b>Changer le propri&eacute;taire :</b><br /><!-- Set Owner:-->
<select name="newowner">
<option value="">Ne rien modifier</option><!-- Don't change-->
<option value=""></option>
<?php
if ($users = $this->LoadUsers())
{
foreach($users as $user)
{
echo "<option value=\"",htmlentities($user["name"]),"\">",$user["name"],"</option>\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="3">
<br />
<input type="submit" value="Enregistrer" style="width: 120px" accesskey="s" /><!-- Store ACLs-->
<input type="button" value="Annuler" onclick="history.back();" style="width: 120px" /><!-- Cancel -->
</td>
</tr>
</table>
<?php
echo$this->FormClose();
}
}
else
{
echo"<i>Vous n'&ecirc;tes pas le propri&eacute;taire de cette page.</i>";
//echo"<i>You're not the owner of this page.</i>";
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/upload.php
New file
0,0 → 1,55
<?php
/*
upload.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Execute l'upload des fichiers lier par l'action {{attach}}
# Necessite le fichier actions/attach.php pour fonctionner
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
//vérification de sécurité
if (!WIKINI_VERSION) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doUpload();
unset($att);
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/edit.php
New file
0,0 → 1,144
<?php
/*
edit.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($this->HasAccess("write") && $this->HasAccess("read"))
{
$output='';
if ($_POST)
{
// only if saving:
if ($_POST["submit"] == "Sauver")
{
// check for overwriting
if ($this->page)
{
if ($this->page["id"] != $_POST["previous"])
{
$error = "ALERTE : ".
"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
}
}
 
 
// store
if (!$error)
{
$body = str_replace("\r", "", $_POST["body"]);
// test si la nouvelle page est differente de la précédente
if(rtrim($body)==rtrim($this->page["body"])) {
$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
$this->Redirect($this->href());
}
 
// add page (revisions)
$this->SavePage($this->tag, $body);
 
// now we render it internally so we can write the updated link table.
$this->ClearLinkTable();
$this->StartLinkTracking();
$dummy = $this->Header();
$dummy .= $this->Format($body);
$dummy .= $this->Footer();
$this->StopLinkTracking();
$this->WriteLinkTable();
$this->ClearLinkTable();
 
// forward
$this->Redirect($this->href());
}
}
}
 
// fetch fields
if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
if (!$body = $_POST["body"]) $body = $this->page["body"];
 
// preview?
if ($_POST["submit"] == "Aperçu")
{
$output .=
"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
$this->Format($body)."\n\n".
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
"<br />\n".
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose()."\n";
}
else
{
// display form
if ($error)
{
$output .= "<div class=\"error\">$error</div>\n";
}
 
// append a comment?
if ($_REQUEST["appendcomment"])
{
$body = trim($body)."\n\n----\n\n--".$this->UserName()." (".strftime("%c").")";
}
require_once("ACeditor.buttonsBar.php");
$output .=
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
htmlspecialchars($body).
"\n</textarea><br />\n".
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
$this->FormClose();
}
 
echo $output;
}
else
{
echo "<i>Vous n'avez pas acc&egrave;s en &eacute;criture &agrave; cette page !</i>\n";
}
?>
<hr class="hr_clear" />
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/claim.php
New file
0,0 → 1,46
<?php
/*
claim.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
 
// only claim ownership if this page has no owner, and if user is logged in.
if ($this->page && !$this->GetPageOwner() && $this->GetUser())
{
$this->SetPageOwner($this->GetPageTag(), $this->GetUserName());
$this->SetMessage("Vous &ecirc;tes maintenant le propri&eacute;taire de cette page");
}
 
$this->Redirect($this->href());
 
echo $this->Footer();
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/raw.php
New file
0,0 → 1,45
<?php
/*
raw.php
 
Copyright 2002 David DELON
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Charles NEPOTE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
 
if ($this->HasAccess("read"))
{
if (!$this->page)
{
return;
}
else
{
header("Content-type: text/plain");
// display raw page
echo $this->page["body"];
}
}
else
{
return;
}
?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/deletepage.php
New file
0,0 → 1,53
<?php
/*
deletepage.php
 
Copyright 2002 David DELON
Copyright 2003 Eric FELDSTEIN
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as 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
*/
 
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
 
if ($this->UserIsOwner())
{
if ($pages = $this->IsOrphanedPage($this->GetPageTag()))
{
foreach ($pages as $page)
{
$this->DeleteOrphanedPage($this->GetPageTag());
}
}
else
{
echo"<i>Cette page n'est pas orpheline.</i>";
}
 
}
else
{
echo"<i>Vous n'&ecirc;tes pas le propri&eacute;taire de cette page.</i>";
}
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/handlers/page/referrers.php
New file
0,0 → 1,86
<?php
/*
referrers.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
die ("acc&egrave;s direct interdit");
}
echo $this->Header();
?>
<div class="page">
<?php
if ($global = $_REQUEST["global"])
{
$title = "Sites faisant r&eacute;f&eacute;rence &agrave; ce wiki (<a href=\"".$this->href("referrers_sites", "", "global=1")."\">voir la liste des domaines</a>)&nbsp;:";
$referrers = $this->LoadReferrers();
}
else
{
$title = "Pages externes faisant r&eacute;f&eacute;rence &agrave; ".$this->ComposeLinkToPage($this->GetPageTag()).
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers_sites")."\">voir la liste des domaines</a>)&nbsp;:";
$referrers = $this->LoadReferrers($this->GetPageTag());
}
 
echo "<b>$title</b><br /><br />\n" ;
if ($referrers)
{
{
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" ;
foreach ($referrers as $referrer)
{
echo "<tr>" ;
echo "<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">",$referrer["num"],"</td>" ;
echo "<td valign=\"top\"><a href=\"",$referrer["referrer"],"\">",$referrer["referrer"],"</a></td>" ;
echo "</tr>\n" ;
}
echo "</table>\n" ;
}
}
else
{
echo "<i>Aucune <acronym tilte=\"Uniform Resource Locator (adresse web)\">URL</acronym> ne fait r&eacute;f&eacute;rence &agrave; cette page.</i><br />\n" ;
}
 
if ($global)
{
echo "<br />[<a href=\"",$this->href("referrers_sites"),"\">Voir les domaines faisant r&eacute;f&eacute;rence &agrave; ",$this->GetPageTag()," seulement</a> | <a href=\"",$this->href("referrers"),"\">Voir les r&eacute;f&eacute;rences &agrave; ",$this->GetPageTag()," seulement</a>]" ;
}
else
{
 
echo "<br />[<a href=\"",$this->href("referrers_sites", "", "global=1"),"\">Voir tous les domaines faisant r&eacute;f&eacute;rence </a> | <a href=\"",$this->href("referrers", "", "global=1"),"\">Voir toutes les r&eacute;f&eacute;rences </a>]" ;
}
 
 
?>
</div>
<?php echo $this->Footer(); ?>
/branches/v2.0-narmer/client/projet/wikini/setup/footer.php
New file
0,0 → 1,2
</body>
</html>
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionInclude.txt
New file
0,0 → 1,40
L'action ##""{{include page="PagePrincipale"}}""## ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet d'inclure dans une page une autre page du wiki (ici la page PagePrincipale). Cette action possède plusieurs applications :
- elle permet de regrouper plusieurs pages en une seule et donc, par exemple, créer un document à partir de différentes "sections" disséminées dans plusieurs pages
- elle permet de commenter/critiquer une page en lecture seule en l'incluant dans le corps d'une autre page
- elle peut permettre, par exemple, de constituer des blocs d'informations redondantes qui seront répétés (inclus) dans plusieurs autres pages (il peut s'agir d'un menu, d'une signature, d'une mention légale, ou autre)
- encore plus fort ! il semble possible configurer ainsi le menu de navigation de [[http://www.wikini.net WikiNi]] de cette manière ! dans le fichier wakka.config.php, il suffit d'indiquer :
##"navigation_links" => """{{include page=\"MenuDuHaut\"}}""",##
et de créer dans la page ""MenuDuHaut"" ce que l'on souhaite voir apparaître. Cette page peut être protégée en lecture seule pour tout le monde et en écriture pour les administrateurs fonctionnels.
- elle permet une sorte de syndication en incluant des pages d'un autre __""WikiNi""__.
 
==== Paramètres ====
Cette action accepte deux paramètres :
- page : paramètre obligatoire pour désigner la page à inclure (sans lequel l'action ne fonctionne pas). Ce paramètre peut être une page local au [[http://www.wikini.net WikiNi]] ou une page d'un autre [[http://www.wikini.net WikiNi]].
- class : désignant une ou plusieurs classes de style, séparées par des espaces, agissant sur la mise en forme de l'inclusion ; ce paramètre est optionnel.
 
Actuellement, [[http://www.wikini.net WikiNi]] intègre plusieurs classes prédéfinies pour gérer la mise en forme de l'inclusion :
%%
.include_right { float: right; width: 17%; } /* bloc flotant à droite */
.include_left { float: left; width: 17%; } /* bloc flotant à gauche */
.include_solid_border { border: solid; padding: 2px; } /* encadré noir */
.include_gray_background { background-color: #DDDDDD; } /* fond gris */
.include_small_fonts { font-size: 0.8em; } /* petites polices */
.include_big_fonts { font-size: 1.2em; } /* grandes polces */
.include_height10em { height: 10em; overflow: scroll; } /* boite de 10em de hauteur, avec ascenseur */
.include_height15em { height: 15em; overflow: scroll; }
.include_height30em { height: 30em; overflow: scroll; }
.include_height60em { height: 60em; overflow: scroll; }
%%
 
{{include page="ListeDesActionsWikini" class="right height15em small_fonts solid_border gray_background"}}
Ces classes de style peuvent être employées cumulativement. Ainsi, si l'on souhaite obtenir, par exemple, une boite grise avec une bordure et de petits caractères, on employera :
##""{{include page="ListeDesActionsWikini" class="gray_background solid_border small_fonts"}}""##
L'inclusion par défaut, pour le moment, produit une présentation non différenciée par rapport au reste de la page ; il faut **spécifier** un style (comme en HTML classique), pour le voir appliqué. L'utilisation des classes de style doit faire l'objet d'une attention particulière, certains navigateurs ne supportant que peu ou pas les styles CSS.
La boite ci à droite correspond à l'inclusion suivante : ##""{{include page="ListeDesActionsWikini" class="right height15em small_fonts solid_border gray_background"}}""##
 
Une page ne peut-être inclue dans elle-même : cela provoquerait une boucle récursive infinie : un page affichant une page, affichant une page, affichant une page, etc.
De même, les boucles d'inclusion portant sur plus d'une page, sont impossibles. Prenons par exemple : un page ""Page1"" inclus une page ""Page2"" qui inclus une page ""Page3"" qui inclus la page ""Page1"". Lorsque ont demande à afficher la page ""Page1"", on voit le contenu des pages ""Page1"", ""Page2"" et ""Page3"" et le message d'erreur indiquant qu'il est impossible d'inclure une page dans elle même. En effet, la page "active" est ""Page1"" et le test dans l'action ##""{{include}}""## regarde si le nom de la page inclus est le même que celui de la page active ce qui provoque une erreur car l'inclusion d'autres pages ne change pas la page active.
On verra cet exemple concrètement développé dans WikiNi:ActionIncludeExempleDeBouclePage1 et suivantes.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/IndexDesPagesBis.txt
New file
0,0 → 1,0
{{pageindex}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/PagesACreer.txt
New file
0,0 → 1,0
{{WantedPages}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/DerniersCommentaires.txt
New file
0,0 → 1,0
{{RecentlyCommented}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/IndexDesPages.txt
New file
0,0 → 1,0
{{listpages}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/MotWiki.txt
New file
0,0 → 1,0
{{redirect page="NomWiki"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/PagesOrphelines.txt
New file
0,0 → 1,0
{{OrphanedPages}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/DerniersChangements.txt
New file
0,0 → 1,0
{{RecentChanges}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionListPages.txt
New file
0,0 → 1,16
L'action ""{{ListPages}}"" liste la totalité des pages du site.
Pour obtenir la liste des pages du site on pourra voir également l'action [[ActionPageIndex PageIndex]].
 
L'action ""ListPages"" s'utilise avec différents paramètres :
 
- ""{{ListPages}}"" : établi un IndexDesPages, liste de toutes les pages du site dans l'ordre alphabétique de leur nom, avec leur propriétaire (identique à ""{{ListPages/sort}}"" et ""{{ListPages/sort="tag"}}"")
- ""{{ListPages/tree}}"" : établi un PlanDuSite, c'est-à-dire une liste hiérarchique des pages sur trois niveaux à partir de la page d'accueil (cette action ne liste donc pas toutes les pages du site)
- ""{{ListPages/tree="MotWiki"}}"" : établi une liste hiérarchique des pages sur trois niveaux à partir de la page passée en paramètre, ici ""MotWiki"".
- ""{{ListPages/sort}}"" : liste de toutes les pages du site classées par ordre alphabétique (identique à ""{{ListPages}}"" et ""{{ListPages/sort="tag"}}"")
- ""{{ListPages/sort="time"}}"" : liste toutes les pages du site classées par ordre de dernière date de modification
- ""{{ListPages/sort="owner"}}"" : liste de toute les pages du site classées par ordre du nom du propriétaire de la page
- ""{{ListPages/sort="user"}}"" : liste de toutes les pages du site classées par ordre du nom du dernier utilisateur à l'avoir modifiée
- ""{{ListPages/sort="tag"}}"" : liste de toutes les pages du site classées par ordre alphabétique (identique à ""{{ListPages}}"" et ""{{ListPages/sort}}"")
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionListUsers.txt
New file
0,0 → 1,20
==== Liste des comptes utilisateurs ====
 
Cette fonction permet de lister les comptes utilisateurs créés.
La fonction est loin d'être indispensable, mais elle permet, par exemple, de connaître les nouveaux utilisateurs qui se sont inscrits pour des raisons pratiques (paramétrage) mais qui n'ont pas encore renseigné leur page personnelle. Autre exemple, on peut observer le nombre de nouveaux inscrits suite à une promotion du site, etc.
Par défaut, cette fonction donne la liste des comptes par ordre alphabétique. Cette fonction accepte en outre le paramètre "last" permettant le tri des comptes par odre inverse de date de création. Ce dernier paramètre accepte lui-même, de surcroit, un chiffre en paramètre permettant de réduire le nombre comptes affichés. La syntaxe d'utilisation de cette "action" est donnée ci-dessous.
 
""{{Listusers/last}}"" : donne la liste des derniers comptes utilisateurs
{{listusers/last}}
 
""{{Listusers/last="3"}}""
{{listusers/last="3"}}
 
""{{Listusers/last="50"}}""
{{listusers/last="50"}}
 
""{{Listusers}}"" : donne la liste des comptes utilisateurs par ordre alphabétique
{{listusers}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionUserSettings.txt
New file
0,0 → 1,10
L'action ""{{UserSettings}}"" permet aux utilisateurs d'effectuer les actions suivantes :
- création d'un nouveau compte
- authentification
- réglage des paramètres utilisateur
- changement de mot-de-passe
 
On peut la voir en action dans les ParametresUtilisateur.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/BacASable.txt
New file
0,0 → 1,0
Faites vos test sur [[http://www.wikini.net WikiNi]] sur cette page
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ParametresUtilisateur.txt
New file
0,0 → 1,0
{{UserSettings}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionBacklinks.txt
New file
0,0 → 1,24
Action permettant d'insérer la liste de toutes les pages faisant référence à la page courante. Dans cette présente page, ""{{backlinks}}"" donne ceci :
 
{{BackLinks}}
 
Sur la page personnelle d'un utilisateur, cette action affichera aussi les pages dont il est le propriétaire ou le dernier modificateur.
 
===== Paramètres =====
 
==== Paramètre "page" ====
Le paramètre "page" ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet de spécifier une page différente de la page courante.
Par exemple ##""{{backlinks page="PagePrincipale"}}""##
Ce paramètre peut être utile, par exemple :
- pour améliorer le TableauDeBordDeCeWiki : il suffit d'ajouter la liste des pages liées à la page ""AFaire"" pour connaître les pages qui doivent faire l'objet d'un travail
- pour consolider des données sur une seule page : par exemple la liste des pages liées aux pages ""EstUnHomme"" et ""EstUneFemme""
- autres ?
 
==== Paramètre "exclude" ====
Le paramètre "exclude" ([[http://www.wikini.net WikiNi]] >= 0.4.1) permet de spécifier des pages à exclure de la liste des pages qui ont pourtant un lien vers la page de référence.
Il est en effet parfois génant d'afficher la totalité des pages faisant référence à une page. Par exemple, la page ""AFaire"" liste la page ""CharlesNepoteVeilleSurInternet"" alors que, non seulement cette information n'a pas d'intérêt mais elle pollue en outre la lecture de cette page. Autre exemple, une page ""MamiFeres"" a intérêt par exemple à lister ""CheVal"" et ""ElePhant"" mais pas nécessairement ""AniMaux"" qui est une catégorie supérieure. Je suggère donc la création d'un paramètre exclude destiné à exclure certaines pages : par exemple :
##""{{backlinks exclude="AniMaux"}}""##
Le paramètre "exclude" peut contenir plusieurs noms de page séparés par des ";", par exemple : ##""{{backlinks exclude="AniMaux; PagePrincipale"}}""##
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionRedirect.txt
New file
0,0 → 1,23
L'action ##""{{redirect page="PagePrincipale"}}""## permet d'être redirigé vers une autre page lorsqu'une page est demandée (ici vers la PagePrincipale). Cela permet de faire des "alias" de page, plusieurs noms différents pour une même page.
 
**Synthèse des cas** où cette action peut être utile :
- dans le cas où certains termes sont d'orthographe variable, comme par exemple Persistance of Vision - qui devient ""PoV"", ""POV"", ""PovRay"", ""POV-Ray""... et certains Wiki voient donc deux pages apparaitre pour la même chose, avec du contenu trop élaboré pour être facilement reconciliable en une seule page.
- en cas de renommage d'une page (en fait le déplacement d'une page vers une autre page), l'ancien nom peut rediriger vers le nouveau nom ; ceci peut être particulièrement utile dans le cas où de très nombreuses pages pointe sur la page originelle, évitant ainsi de changer les liens dans chaque page
- redirection d'une page au nom wiki disgracieux vers une page au nom wiki plus lisible ; exemples : ""SpIp"" => Spip, ""DelPhine"" => Delphine, etc.
 
Une différence notable entre une inclusion et une redirection : lors d'une inclusion, le contenu de la page incluant une autre page peut être modifé, donc utiliser l'inclusion pour faire des alias de page ne me parait pas très sûr car il risque d'apparaitre des divergences de contenu si c'est la page incluant une autre page qui est modifée. Par contre, une redirection __impose__ qu'une seule page est éditable et la cohérence de contenu est donc correcte.
 
===== Paramètres =====
 
Cette action accepte un seul paramètre :
- page : paramètre obligatoire pour désigner la page vers laquelle la page est redirigée.
 
===== Modification d'une page contenant l'action ##redirect## =====
Il faut entrer manuellement dans la barre d'adresse du navigateur l'adresse de la page + le "handler" désiré ; par exemple :
Pour la modifier :
- http://domaine/wakka.php?wiki=NomDeLaPage/edit
Pour la supprimer :
- http://domaine/wakka.php?wiki=NomDeLaPage/deletepage
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionWantedPages.txt
New file
0,0 → 1,5
L'action ""{{WantedPages}}"" liste tous les MotWiki du site qui n'ont pas vu la création d'une page.
Cette page est visible en action sur les PagesACreer.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/TableauDeBordDeCeWiki.txt
New file
0,0 → 1,14
Ce tableau de bord regroupe toutes les pages utiles à l'analyse et à l'animation de ce site.
- DerniersChangements et DerniersCommentaires
- PlanDuSite à partir de la racine
- IndexDesPages, IndexDesPagesBis
- PagesOrphelines
- PagesACreer
 
----
==== 8 derniers comptes utilisateurs ====
{{Listusers last="8"}}
==== 8 dernières pages modifiées ====
{{recentchanges max="8"}}
==== 5 dernières pages commentées ====
{{RecentlyCommented max="5"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/RechercheTexte.txt
New file
0,0 → 1,0
{{TextSearch}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionPageIndex.txt
New file
0,0 → 1,7
L'action ""{{PageIndex}}"" liste toutes les pages classées par ordre alphabétique et regroupées par lettre. On peut la voir en action sur l'IndexDesPagesBis.
Pour obtenir la liste des pages du site on pourra voir également l'action [[ActionListPages ListPages]].
 
Cette action ne prend aucun paramètre.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionRecentChanges.txt
New file
0,0 → 1,10
L'action ""{{RecentChanges}}"" affiche la liste des pages récement modifiées. Elle est illustrée dans la page DerniersChangements.
 
==== Paramètres ====
Cette action prend en compte le paramètre "max", permettant à un utilisateur de spécifier le nombre de pages affichées.
Par exemple ""{{recentchanges max="3"}}"" donne :
 
{{recentchanges max="3"}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ListeDesActionsWikini.txt
New file
0,0 → 1,22
Wikini propose par défaut les "actions" suivantes.
 
- ActionBacklinks
- ActionFindpage
- ActionInclude : inclusion d'une page au sein d'une autre
- ActionListPages
- ActionListUsers
- ActionMyChanges
- ActionMyPages
- ActionOrphanedPages : recherche les pages qui n'ont pas de liens vers elle (par orpheline )
- ActionPageIndex
- ActionRecentChanges
- ActionRecentChangesRSS
- ActionRecentComments
- ActionRecentlyCommented
- ActionRedirect : redirection d'une page vers une autre
- ActionTextSearch : recherche d'une chaine de caractères dans l'ensemble des page de [[http://www.wikini.net WikiNi]]
- ActionTrail : permet de lier des pages entres elles et de passer de l'une à l'autre avec un petit navigateur style "précédente/suivante"
- ActionUserSettings
- ActionWantedPages : liste les pages devant être écrites.
 
 
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionTextSearch.txt
New file
0,0 → 1,12
L'action ##""{{TextSearch}}""## permet de lister les pages contenant un ou plusieurs mots entré(s) par l'utilisateur.
On peut la voir en action sur la page RechercheTexte.
 
Cette action utilise la fonction d'indexation en texte intégral de ""MySQL"" et hérite de ses qualités et défauts :
- la recherche est quasi instantanée
- la recherche est limitée à des mots de 4 lettres au minimim
- la recherche n'accepte pas de caractères génériques (ou caractères joker : ".*?", etc.)
- la recherche n'est pas lématisée : la recherche de "protocole" ne trouvera pas "protocoles" ; la recherche de "lascif" ne trouvera pas "lascive"
- la recherche n'est pas effectuée sur une partie de MotWiki : la recherche de "text" ne donnera pas ActionTextSearch pour résultat
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/PlanDuSite.txt
New file
0,0 → 1,0
{{listpages/tree}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionTrail.txt
New file
0,0 → 1,38
L'action ##""{{trail toc="NomDePage"}}""## permet de lier des pages entres elles grace à une page de sommaire. Cette action affiche un navigateur du type "précedente/suivante" en indiquant le nom des pages précende et suivante.
 
====Paramètre====
Le paramètre ##toc## permet d'indiquer le nom de la page contenant le liste des pages liées.
 
====Configuration====
L'aspet des liens du navigateur est définis par deux classe CSS présente dans wakka.css :
##
.trail_table { line-height: 30px;}
.trail_button { color: #993333; }
##
 
====Ecriture d'une page "toc"====
Cette page peut contenir n'importe quel texte. Les règles qui permettent de définir la liste des pages liées sont :
- Le nom de la page appartient à une liste (numéroté, à bulle ou sans signe)
- Le nom de la page est le **1er** mot de chaque élément de la liste
- Les liens ##""[[NomPageWikiNi Nom d'une page WikiNi]]""## sont acceptés et doivent être le **1er mot** de chaque éléments de la liste.
 
Un exemple de page sommaire :
-----
 
====Sommaire====
 
Texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte.
 
- Page1 : texte texte texte texte texte texte texte texte texte texte texte
- Page2 : texte texte texte texte texte texte texte texte texte texte texte texte texte
- [[Page3 Vers la page 3]] : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
- Page31 : texte texte texte texte texte texte texte texte texte texte texte
- Page32 : texte texte texte texte texte texte texte texte texte texte texte
- Page4 : texte texte texte texte texte texte texte texte texte texte texte
 
texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte.
- Page5 : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
- Page6 : texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
-----
{{trail toc="ListeDesActionsWikiNi"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/AideWikiNi.txt
New file
0,0 → 1,5
=====Les pages d'aide sur [[http://www.wikini.net WikiNi]]=====
 
- ReglesDeFormatage : résumé des syntaxes ""WikNi"" permettant la mise en forme du texte.
- ListeDesActionsWikini : liste des actions disponible dans [[http://www.wikini.net WikiNi]].
- ControlerLAccesAuxPages : explique comment gérer les droits d'accès aux page de [[http://www.wikini.net WikiNi]].
/branches/v2.0-narmer/client/projet/wikini/setup/doc/NomWiki.txt
New file
0,0 → 1,3
Un NomWiki est un nom qui est écrit ""CommeCela"".
 
Un NomWiki est transformé automatiquement en lien. Si la page correspondante n'existe pas, un '?' est affiché à côté du mot.
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionOrphanedPages.txt
New file
0,0 → 1,11
L'action ""{{OrphanedPages}}"" liste toutes les pages orphelines, c'est-à-dire toutes les pages n'étant reliées à aucune autre page.
Cette action est utilisée ici dans la page : PagesOrphelines.
 
Elle peut servir :
- à localiser les pages qui ont besoin d'être reliées à d'autres pages
- à localiser les pages rendues inutiles et que l'on peut alors effacer
 
Cette page ne comporte aucun paramètre.
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/_root_page.txt
New file
0,0 → 1,3
Bienvenue ! Cliquez sur le lien "Editer cette page" au bas de la page pour démarrer.
 
Pages utiles: PagesOrphelines, PagesACreer, RechercheTexte, ReglesDeFormatage, AideWikiNi, TableauDeBordDeCeWiki.
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ActionRecentlyCommented.txt
New file
0,0 → 1,10
L'action ""{{RecentlyCommented}}"" permet d'afficher la liste des pages ayant été récement commentées. Cette action est visible sur la page DerniersCommentaires.
 
==== Paramètres ====
Cette action accepte un seul paramètre, le paramètre "max" permettant de spécifier le nombre maximum de pages récemment commentées à afficher.
Par exemple ""{{RecentlyCommented max="3"}}"" va donner le résultat suivant :
 
{{RecentlyCommented max="3"}}
 
----
{{trail toc="ListeDesActionsWikini"}}
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ControlerLAccesAuxPages.txt
New file
0,0 → 1,29
Chaque page possède trois niveaux de contrôle d'accès :
- lecture de la page
- écriture/modification de la page
- commentaire de la page
 
Les contrôles d'accès ne peuvent être modifiés que par le propriétaire de la page -- l'administrateur technique peut aussi manuellement modifier ces contrôles en travaillant directement sur la base de données.
Le propriétaire d'une page voit apparaître, dans la page dont il est propriétaire, l'option "Éditer permissions" : cette option lui permet de modifier les contrôles d'accès.
Ces contrôles sont matérialisés par des colonnes où le propriétaire va ajouter ou supprimer des informations.
Le propriétaire peut compléter ces colonnes par les informations suivantes, séparées par des espaces :
- le nom d'un ou plusieurs utilisateurs : par exemple ""CharlesNepote"" ou ""DavidDelon""
- le caractère ***** désignant tous les utilisateurs
- le caractère **+** désignant les utilisateurs enregistrés
- le caractère **!** signifiant la négation : par exemple !""CharlesNepote"" signifie que ""CharlesNepote"" **ne doit pas** avoir accès à cette page
 
===== Droits d'accès par défaut =====
Pour toute nouvelle page créée, [[http://www.wikini.net WikiNi]] applique des droits d'accès par défaut. Ces droits d'accès sont configurables via le fichier /wakka.config.php.
Il faut renseigner les trois variables de configuration suivantes :
##
"default_write_acl" => "*",
"default_read_acl" => "*",
"default_comment_acl" => "*",
##
 
Par exemple, vous pouvez souhaiter que, par défaut, seuls les utilisateurs enregistrés puisse modifier des pages. Vous utiliserez alors :
##
"default_write_acl" => "+",
"default_read_acl" => "*",
"default_comment_acl" => "*",
##
/branches/v2.0-narmer/client/projet/wikini/setup/doc/ReglesDeFormatage.txt
New file
0,0 → 1,61
==== Guide des règles de formatage ====
 
Les règles de formatage avec Wakka diffèrent légèrement des autres Wikis. (Voir par exemple [[http://c2.com/cgi/wiki?TextFormattingRules les règles de formatage de WikiWikiWeb]], le premier Wiki connu.)
Tout texte placé entre deux guillemets doubles - " - est présenté tel que.
 
Vous pouvez effectuer vos propres test dans le BacASable : c'est un endroit fait pour ça.
 
Règles de base :
""**Texte en gras !** ---""> **Texte en gras !**
""//Texte en italique.// ---""> //Texte en italique.//
""Texte __souligné__ ! ---""> Texte __souligné__ !
""Texte @@barré@@ ! ---""> Texte @@barré@@ !
""##texte à espacement fixe## ---""> ##texte à espacement fixe##
""%%code%%""
""%%(php) PHP code%%""
""%%(delphi) code delphi/pascal%%""
 
Empêcher le formatage du texte :
Pour empêcher que Wikini n'interprète les balises de formatage de texte qu'il reconnait, encadrer le texte par une paire de guillemets doubles. ""Par __exemple__, ce **texte** @@contient@@ des %%balises%% reconnue par Wikini qui ne sont //pas// interprétée car il est encadré par une paire de **guillemets double** comme __vous__ pouvez vous en apercevoir :)""
Deux autres utilisations :
- écrire directement du HTML dans le wikini - par exemple pour les tableaux... ;-) - vu que ce qui est renvoyé est tout de même interprété par le moteur de rendu de Mozilla
- afficher des logs / des scripts shell en ajoutant les tag <pre> et </pre> qui seront interprétés pour afficher le texte tel quel par le navigateur (sous réserve qu'il n'y ait pas de double guillemet dedans). Cela permet d'avoir le contenu in extenso plutôt que dans une boîte de code qui est de taille fixe (contrairement à la fonctionnalité de phpBB2 avec les tags [code] et [/code])
 
Liens forcés :
""[[http://www.mon-site.org]]""
""[[http://www.mon-site.org Mon-site]]""
""[[P2P]]""
""[[P2P Page sur le P2P]]""
 
En-têtes :
""====== En-tête énorme ======"" ====== En-tête énorme ======
""===== En-tête très gros ====="" ===== En-tête très gros =====
""==== En-tête gros ===="" ==== En-tête gros ====
""=== En-tête normal ==="" === En-tête normal ===
""== Petit en-tête =="" == Petit en-tête ==
 
Séparateur horizontal : il suffit de taper au moins 4 "-", au dela de 4 tirets c'est le meme effet
Exemple : ""----""
-------
 
 
Retour de ligne forcé :
""---""
 
L'indentation de textes se fait avec la touche "TAB". Vous pouvez aussi créer des listes à puces ou numérotées :
""- liste à puce""
""1) liste numérotée (chiffres arabes)""
""A) liste numérotée (capitales alphabétiques)""
""a) liste numérotée (minuscules alphabétiques)""
""i) liste numérotée (chiffres romains)""
 
Vous pouvez également indenter du texte en utilisant des caractères espace au lieu de la touche "TAB", les exemples ci dessus restent valables mais attention à ne pas mélanger des "TAB" et des espaces dans la même énumération.
 
""- liste à puce""
""1) liste numérotée (chiffres arabes)""
""A) liste numérotée (capitales alphabétiques)""
""a) liste numérotée (minuscules alphabétiques)""
""i) liste numérotée (chiffres romains)""
 
Note : à cause d'un [[http://bugzilla.mozilla.org/show_bug.cgi?id=10547 bogue dans son moteur de rendu]], les listes, utilisant la touche TAB, ne fonctionnent pas (encore) sous Mozilla.
 
/branches/v2.0-narmer/client/projet/wikini/setup/writeconfig.php
New file
0,0 → 1,77
<?php
/*
writeconfig.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// fetch config
$config = $config2 = unserialize($_POST["config"]);
 
// merge existing configuration with new one
$config = array_merge($wakkaConfig, $config);
 
// set version to current version, yay!
$config["wikini_version"] = WIKINI_VERSION;
$config["wakka_version"] = WAKKA_VERSION;
 
// convert config array into PHP code
$configCode = "<?php\n// wakka.config.php cr&eacute;&eacute;e ".strftime("%c")."\n// ne changez pas la wikini_version manuellement!\n\n\$wakkaConfig = array(\n";
foreach ($config as $k => $v)
{
$entries[] = "\t\"".$k."\" => \"".$v."\"";
}
$configCode .= implode(",\n", $entries).");\n?>";
 
// try to write configuration file
echo "<b>Cr&eacute;ation du fichier de configuration en cours...</b><br>\n";
test("&Eacute;criture du fichier de configuration <tt>".$wakkaConfigLocation."</tt>...", $fp = @fopen($wakkaConfigLocation, "w"), "", 0);
 
if ($fp)
{
fwrite($fp, $configCode);
// write
fclose($fp);
echo "<p>Voila c'est termin&eacute; ! Vous pouvez <a href=\"",$config["base_url"],"\">retourner sur votre site WikiNi</a>. Il est conseill&eacute; de retirer l'acc&egrave;s en &eacute;criture au fichier <tt>wakka.config.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>";
}
else
{
// complain
echo"<p><span class=\"failed\">AVERTISSEMENT:</span> Le
fichier de configuration <tt>",$wakkaConfigLocation,"</tt> n'a pu &ecirc;tre
cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits d'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer au moyen d'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier <tt>wakka.config.php</tt> directement dans le r&eacute;pertoire de WikiNi. Une fois que vous aurez fait cela, votre site WikiNi devrait fonctionner correctement.</p>\n";
?>
<form action="<?php echo myLocation() ?>?installAction=writeconfig" method="POST">
<input type="hidden" name="config" value="<?php echo htmlentities(serialize($config2)) ?>">
<input type="submit" value="Essayer &agrave; nouveau">
</form>
<?php
echo"<div style=\"background-color: #EEEEEE; padding: 10px 10px;\">\n<xmp>",$configCode,"</xmp>\n</div>\n";
}
 
?>
/branches/v2.0-narmer/client/projet/wikini/setup/default.php
New file
0,0 → 1,90
<form action="<?php echo myLocation() ?>?installAction=install" method="POST">
<table>
 
<tr><td></td><td><b>Installation de WikiNi</b></td></tr>
 
<?php
/*
default.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (($wakkaConfig["wakka_version"]) || ($wakkaConfig["wikini_version"]))
{
if ($wakkaConfig["wikini_version"]) {
$config=$wakkaConfig["wikini_version"];
}
else {
$config=$wakkaConfig["wakka_version"];
}
echo "<tr><td></td><td>Votre syst&egrave;me WikiNi existant a &eacute;t&eacute; reconnu comme &eacute;tant la version ",$config,". Vous &ecirc;tes sur le point de <b>mettre &agrave; jour</b> WikiNi pour la version ",WIKINI_VERSION,". Veuillez revoir vos informations de configuration ci-dessous.</td></tr>\n";
}
else
{
echo "<tr><td></td><td>Vous &ecirc;tes sur le point d'installer WikiNi ",WIKINI_VERSION,". Veuillez configurer votre WikiNi en utilisant le formulaire suivant.</td></tr>\n";
}
?>
 
<tr><td></td><td><br>NOTE: Ce programme d'installation va essayer de modifier les options de configurations dans le fichier <tt>wakka.config.php</tt>, situ&eacute; dans votre r&eacute;pertoire WikiNi. Pour que cela fonctionne, veuillez vous assurez que votre serveur a les droits d'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas faire &ccedil;a vous devrez modifier ce fichier manuellement (ce programme d'installation vous dira comment).</td></tr>
 
<tr><td></td><td><br><b>Configuration de la base de donn&eacute;es</b></td></tr>
<tr><td></td><td>La machine sur laquelle se trouve votre serveur MySQL. En g&eacute;n&eacute;ral c'est "localhost" (ie, la m&ecirc;me machine que celle o&ugrave; se trouve les pages de WikiNi.).</td></tr>
<tr><td align="right" nowrap>Machine MySQL :</td><td><input type="text" size="50" name="config[mysql_host]" value="<?php echo $wakkaConfig["mysql_host"] ?>"></td></tr>
<tr><td></td><td>La base de donn&eacute;es MySQL &agrave; utiliser pour WikiNi. Cette base de donn&eacute;es doit d&eacute;j&agrave; exister avant de pouvoir continuer.</td></tr>
<tr><td align="right" nowrap>Base de donn&eacute;es MySQL :</td><td><input type="text" size="50" name="config[mysql_database]" value="<?php echo $wakkaConfig["mysql_database"] ?>"></td></tr>
<tr><td></td><td>Nom et mot de passe de l'utilisateur MySQL qui sera utilis&eacute; pour se connecter &agrave; votre base de donn&eacute;es.</td></tr>
<tr><td align="right" nowrap>Non de l'utilisateur MySQL :</td><td><input type="text" size="50" name="config[mysql_user]" value="<?php echo $wakkaConfig["mysql_user"] ?>"></td></tr>
<tr><td align="right" nowrap>Mot de passe MySQL :</td><td><input type="password" size="50" name="config[mysql_password]" value=""></td></tr>
<tr><td></td><td>Pr&eacute;fixe &agrave; utiliser pour toutes les tables utilis&eacute;es par WikiNi. Ceci vous permet d'utiliser plusieurs WikiNi sur une m&ecirc;me base de donnn&eacute;es en donnant diff&eacute;rents pr&eacute;fixes aux tables.</td></tr>
<tr><td align="right" nowrap>Prefixe des tables :</td><td><input type="text" size="50" name="config[table_prefix]" value="<?php echo $wakkaConfig["table_prefix"] ?>"></td></tr>
 
<tr><td></td><td><br><b>Configuration de votre site WikiNi</b></td></tr>
 
<tr><td></td><td>Le nom de votre site WikiNi. Ceci est g&eacute;n&eacute;ralement un NomWiki et EstSousCetteForme.</td></tr>
<tr><td align="right" nowrap>Le nom de votre WikiNi :</td><td><input type="text" size="50" name="config[wakka_name]" value="<?php echo $wakkaConfig["wakka_name"] ?>"></td></tr>
 
<tr><td></td><td>La page d'accueil de votre WikiNi. Ceci doit &ecirc;tre un NomWiki.</td></tr>
<tr><td align="right" nowrap>Home page:</td><td><input type="text" size="50" name="config[root_page]" value="<?php echo $wakkaConfig["root_page"] ?>"></td></tr>
 
<tr><td></td><td>META Mots clefs/Description qui seront ins&eacute;r&eacute;s dans les codes HTML.</td></tr>
<tr><td align="right" nowrap>Mots clefs :</td><td><input type="text" size="50" name="config[meta_keywords]" value="<?php echo $wakkaConfig["meta_keywords"] ?>"></td></tr>
<tr><td align="right" nowrap>Description :</td><td><input type="text" size="50" name="config[meta_description]" value="<?php echo $wakkaConfig["meta_description"] ?>"></td></tr>
 
<tr><td></td><td><br><b>Configuration de l'URL de votre WikiNi</b><?php echo $wakkaConfig["wikini_version"] ? "" : "<br>Ceci est une nouvelle installation. Le programme d'installation va essayer de trouver les valeurs appropri&eacute;es. Changez-les uniquement si vous savez ce que vous faites." ?></td></tr>
 
<tr><td></td><td>L'URL de base de votre site WikiNi. Les noms des pages seront directement rajout&eacute;s &agrave; cet URL. Supprimez la partie "?wiki=" uniquement si vous utilisez la redirection (voir ci apr&egrave;s).</td></tr>
<tr><td align="right" nowrap>URL de base :</td><td><input type="text" size="50" name="config[base_url]" value="<?php echo $wakkaConfig["base_url"] ?>"></td></tr>
 
<tr><td></td><td>Le mode "redirection automatique" doit &ecirc;tre s&eacute;lectionn&eacute; uniquement si vous utilisez WikiNi avec la redirection d'URL (si vous ne savez pas ce qu'est la redirection d'URL n'activez pas cette option).</td></tr>
<tr><td align="right" nowrap>Mode "redirection" :</td><td><input type="hidden" name="config[rewrite_mode]" value="0"><input type="checkbox" name="config[rewrite_mode]" value="1" <?php echo $wakkaConfig["rewrite_mode"] ? "checked" : "" ?>> Activation</td></tr>
 
<tr><td></td><td><br><b>Options suppl&eacute;mentaires</b></td></tr>
 
<tr><td></td><td><input type="hidden" name="config[preview_before_save]" value="0"><input type="checkbox" name="config[preview_before_save]" value="1" <?php echo $wakkaConfig["preview_before_save"] ? "checked" : "" ?>> Imposer de faire un aper&ccedil;u avant de pouvoir sauver une page.</td></tr>
<tr><td></td><td><input type="submit" value="Continuer"></td></tr>
</table>
</form>
/branches/v2.0-narmer/client/projet/wikini/setup/install.php
New file
0,0 → 1,175
<?php
/*
install.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric FELDSTEIN
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// fetch configuration
$config = $_POST["config"];
 
// test configuration
echo "<b>Test de la configuration</b><br>\n";
test("Test connexion MySQL ...", $dblink = @mysql_connect($config["mysql_host"], $config["mysql_user"], $config["mysql_password"]));
test("Recherche base de donn&eacute;es ...", @mysql_select_db($config["mysql_database"], $dblink), "La base de donn&eacute;es que vous avez choisie n'existe pas, vous devez la cr&eacute;er avant d'installer WikiNi !");
echo "<br>\n" ;
 
// do installation stuff
if (!$version = trim($wakkaConfig["wikini_version"])) $version = "0";
switch ($version)
{
// new installation
case "0":
echo "<b>Installation</b><br>\n";
test("Creation table page...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."pages (".
"id int(10) unsigned NOT NULL auto_increment,".
"tag varchar(50) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"body text NOT NULL,".
"body_r text NOT NULL,".
"owner varchar(50) NOT NULL default '',".
"user varchar(50) NOT NULL default '',".
"latest enum('Y','N') NOT NULL default 'N',".
"handler varchar(30) NOT NULL default 'page',".
"comment_on varchar(50) NOT NULL default '',".
"PRIMARY KEY (id),".
"FULLTEXT KEY tag (tag,body),".
"KEY idx_tag (tag),".
"KEY idx_time (time),".
"KEY idx_latest (latest),".
"KEY idx_comment_on (comment_on)".
") TYPE=MyISAM;", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table ACL ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."acls (".
"page_tag varchar(50) NOT NULL default '',".
"privilege varchar(20) NOT NULL default '',".
"list text NOT NULL,".
"PRIMARY KEY (page_tag,privilege)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table link ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."links (".
"from_tag char(50) NOT NULL default '',".
"to_tag char(50) NOT NULL default '',".
"UNIQUE KEY from_tag (from_tag,to_tag),".
"KEY idx_from (from_tag),".
"KEY idx_to (to_tag)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table referrer ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."referrers (".
"page_tag char(50) NOT NULL default '',".
"referrer char(150) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"KEY idx_page_tag (page_tag),".
"KEY idx_time (time)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
test("Creation table user ...",
@mysql_query(
"CREATE TABLE ".$config["table_prefix"]."users (".
"name varchar(80) NOT NULL default '',".
"password varchar(32) NOT NULL default '',".
"email varchar(50) NOT NULL default '',".
"motto text NOT NULL,".
"revisioncount int(10) unsigned NOT NULL default '20',".
"changescount int(10) unsigned NOT NULL default '50',".
"doubleclickedit enum('Y','N') NOT NULL default 'Y',".
"signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
"show_comments enum('Y','N') NOT NULL default 'N',".
"PRIMARY KEY (name),".
"KEY idx_name (name),".
"KEY idx_signuptime (signuptime)".
") TYPE=MyISAM", $dblink), "D&eacute;j&agrave; cr&eacute;&eacute;e ?", 0);
//insertion des pages de documentation et des pages standards
$d = dir("setup/doc/");
while ($doc = $d->read()){
if ($doc != "." && $doc != ".." && !is_dir($doc)){
$pagecontent = implode ('', file("setup/doc/$doc"));
if ($doc=='_root_page.txt'){
$pagename = $config["root_page"];
}else{
$pagename = substr($doc,0,strpos($doc,'.txt'));
}
 
$sql = "Select tag from ".$config["table_prefix"]."pages where tag='$pagename'";
// Insert documentation page if not present (a previous failed installation ?)
if (($r=@mysql_query($sql, $dblink)) && (mysql_num_rows($r)==0)) {
$sql = "Insert into ".$config["table_prefix"]."pages ".
"set tag = '$pagename', ".
"body = '".mysql_escape_string($pagecontent)."', ".
"user = 'WikiNiInstaller', ".
"time = now(), ".
"latest = 'Y'";
 
test("Insertion de la page $pagename ...", @mysql_query($sql, $dblink),"?",0);
 
// update table_links
$wiki = new Wiki($config);
$wiki->SetPage($wiki->LoadPage($pagename,"",0));
$wiki->ClearLinkTable();
$wiki->StartLinkTracking();
$wiki->TrackLinkTo($pagename);
$dummy = $wiki->Header();
$dummy .= $wiki->Format($pagecontent);
$dummy .= $wiki->Footer();
$wiki->StopLinkTracking();
$wiki->WriteLinkTable();
$wiki->ClearLinkTable();
}
else
{
test("Insertion de la page $pagename ...", 0 ,"Existe d&eacute;j&agrave;.",0);
}
 
}
}
break;
// The funny upgrading stuff. Make sure these are in order! //
case "0.1":
echo "<b>En cours de mise &agrave; jour de WikiNi 0.1</b><br>\n";
test("Just very slightly altering the pages table...",
@mysql_query("alter table ".$config["table_prefix"]."pages add body_r text not null default '' after body", $dblink), "Already done? Hmm!", 0);
test("Claiming all your base...", 1);
}
 
?>
 
<p>
A l'&eacute;tape suivante, le programme d'installation va essayer
d'&eacute;crire le fichier de configuration <tt><?php echo $wakkaConfigLocation ?></tt>.
Assurez vous que le serveur web a bien le droit d'&eacute;crire dans ce fichier, sinon vous devrez le modifier manuellement. </p>
 
<form action="<?php echo myLocation(); ?>?installAction=writeconfig" method="POST">
<input type="hidden" name="config" value="<?php echo htmlentities(serialize($config)) ?>">
<input type="submit" value="Continuer">
</form>
/branches/v2.0-narmer/client/projet/wikini/setup/header.php
New file
0,0 → 1,65
<?php
/*
header.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// stuff
function test($text, $condition, $errorText = "", $stopOnError = 1) {
echo "$text " ;
if ($condition)
{
echo "<span class=\"ok\">OK</span><br>\n" ;
}
else
{
echo "<span class=\"failed\">ECHEC</span>" ;
if ($errorText) echo ": ",$errorText ;
echo "<br>\n" ;
if ($stopOnError) exit;
}
}
 
function myLocation()
{
list($url, ) = explode("?", $_SERVER["REQUEST_URI"]);
return $url;
}
 
?>
<html>
<head>
<title>Installation de WikiNi</title>
<style>
P, BODY, TD, LI, INPUT, SELECT, TEXTAREA { font-family: Verdana; font-size: 13px; }
INPUT { color: #880000; }
.ok { color: #008800; font-weight: bold; }
.failed { color: #880000; font-weight: bold; }
A { color: #0000FF; }
</style>
</head>
 
<body>
/branches/v2.0-narmer/client/projet/wikini/ACeditor.buttonsBar.php
New file
0,0 → 1,43
<?php
$ACbuttonsBar = "
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'**','**');\" src=\"ACEdImages/bold.gif\" title=\"Passe le texte sélectionné en gras ( Ctrl-Maj-b )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'//','//');\" src=\"ACEdImages/italic.gif\" title=\"Passe le texte sélectionné en italique ( Ctrl-Maj-t )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'__','__');\" src=\"ACEdImages/underline.gif\" title=\"Souligne le texte sélectionné ( Ctrl-Maj-u )\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'@@','@@');\" src=\"ACEdImages/strike.gif\" title=\"Barre le texte sélectionné\">
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'======','======\\n');\" src=\"ACEdImages/t1.gif\" title=\" En-tête énorme\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'=====','=====\\n');\" src=\"ACEdImages/t2.gif\" title=\" En-tête très gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'====','====\\n');\" src=\"ACEdImages/t3.gif\" title=\" En-tête gros\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'===','===\\n');\" src=\"ACEdImages/t4.gif\" title=\" En-tête normal\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'==','==');\" src=\"ACEdImages/t5.gif\" title=\" Petit en-tête\">
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithLink(thisForm.body);\" src=\"ACEdImages/link.gif\" title=\"Ajoute un lien au texte sélectionné\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t-&nbsp;','');\" src=\"ACEdImages/listepuce.gif\" title=\"Liste\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\t1)&nbsp;','');\" src=\"ACEdImages/listenum.gif\" title=\"Liste numérique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'\\ta)&nbsp;','');\" src=\"ACEdImages/listealpha.gif\" title=\"Liste alphabéthique\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n---','');\" src=\"ACEdImages/crlf.gif\" title=\"Insère un retour chariot\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionBis(thisForm.body,'\\n------','');\" src=\"ACEdImages/hr.gif\" title=\"Insère une ligne horizontale\">
 
 
<img class=\"buttons\" src=\"ACEdImages/separator.gif\" >
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%','%%');\" src=\"ACEdImages/code.gif\" title=\"Code\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelection(thisForm.body,'%%(php)','%%');\" src=\"ACEdImages/php.gif\" title=\"Code PHP\">
</div>
<div id=\"toolbar\">
<img class=\"buttons\" onmouseover=\"mouseover(this);\" onmouseout=\"mouseout(this);\" onmousedown=\"mousedown(this);\" onmouseup=\"mouseup(this);\" onclick=\"wrapSelectionWithImage(thisForm.body);\" src=\"ACEdImages/image.gif\" title=\"insère un tag image \">
 
<span class=\"texteChampsImage\">
&nbsp;&nbsp;Fichier&nbsp;<input type=\"text\" name=\"filename\" class=\"ACsearchbox\" size=\"10\">&nbsp;&nbsp;Description&nbsp;<input type=\"text\" name=\"description\" class=\"ACsearchbox\" size=\"10\">
&nbsp;&nbsp;Alignement&nbsp;<select id=\"alignment\" class=\"ACsearchbox\">
<option value=\"left\">Gauche</option>
<option value=\"center\">Centré</option>
<option value=\"right\">Droite</option>
</select>
</span>
</div>";
?>
/branches/v2.0-narmer/client/projet/wikini/files/vide.txt
--- projet/projet.css (revision 0)
+++ projet/projet.css (revision 1976)
@@ -0,0 +1,12 @@
+/*
+ +----------------------------------------------------------------------------+
+ | projets.css |
+ +----------------------------------------------------------------------------+
+ | Copyright (c) 2004 Tela Botanica |
+ +----------------------------------------------------------------------------+
+ | Feuille de style specifique a l'application projet de Tela Botanica |
+ +----------------------------------------------------------------------------+
+ | Auteur : Tamara LE BOURG <tamara@tela-botanica.org> |
+ | Alexandre Granier <alexandre@tela-botanica.org> |
+ +----------------------------------------------------------------------------+
+*/
/branches/v2.0-narmer/client/projet/fichiers/vide.txt
--- projet/classes/HTML_formulaireListeExterne.class.php (revision 0)
+++ projet/classes/HTML_formulaireListeExterne.class.php (revision 1976)
@@ -0,0 +1,116 @@
+<?php
+/*vim: set expandtab tabstop=4 shiftwidth=4: */
+// +------------------------------------------------------------------------------------------------------+
+// | PHP version 4.1 |
+// +------------------------------------------------------------------------------------------------------+
+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
+// +------------------------------------------------------------------------------------------------------+
+// | This library is free software; you can redistribute it and/or |
+// | modify it under the terms of the GNU General Public |
+// | License as published by the Free Software Foundation; either |
+// | version 2.1 of the License, or (at your option) any later version. |
+// | |
+// | This library 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 library; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+// +------------------------------------------------------------------------------------------------------+
+// CVS : $Id: HTML_formulaireListeExterne.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
+/**
+* Application projet
+*
+* La classe controleur projet
+*
+*@package projet
+//Auteur original :
+*@author Alexandre Granier <alexandre@tela-botanica.org>
+//Autres auteurs :
+*@author Aucun
+*@copyright Tela-Botanica 2000-2004
+*@version $Revision: 1.2 $
+// +------------------------------------------------------------------------------------------------------+
+*/
+
+// +------------------------------------------------------------------------------------------------------+
+// | ENTETE du PROGRAMME |
+// +------------------------------------------------------------------------------------------------------+
+
+/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
+
+require_once 'HTML/QuickForm.php' ;
+require_once 'HTML/QuickForm/checkbox.php' ;
+
+// +------------------------------------------------------------------------------------------------------+
+// | LISTE des constantes |
+// +------------------------------------------------------------------------------------------------------+
+
+
+/**
+ * class HTML_formulaireListe
+ * Cette classe représente un formulaire pour saisir un projet ou le modifier.
+ */
+class HTML_formulaireListeExterne extends HTML_QuickForm
+{
+ /**
+ * Constructeur
+ *
+ * @param string formName Le nom du formulaire.
+ * @param string method Soit get soit post, voir le protocole HTTP
+ * @param string action L'action du formulaire.
+ * @param string target La cible du formulaire.
+ * @param Array attributes Des attributs supplémentaires pour la balise <form>
+ * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
+ * @return void
+ * @access public
+ */
+ function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
+ {
+ HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
+ } // end of member function HTML_formulaireListe
+
+ /**
+ * Renvoie le code HTML du formulaire.
+ *
+ * @return string
+ * @access public
+ */
+ function toHTML( )
+ {
+ $res = HTML_QuickForm::toHTML() ;
+ return $res ;
+ } // end of member function toHTML
+
+ /**
+ * Ajoute les champs nécessaire au formulaire.
+ *
+ * @return void
+ * @access public
+ */
+ function construitFormulaire($tableau_liste_externe)
+ {
+ foreach ($tableau_liste_externe as $cle => $valeur) {
+ $this->addElement ('checkbox', 'liste_'.$cle, '', $valeur) ;
+ }
+
+ $this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
+ $url_annuler = new Net_URL($this->getAttribute('action')) ;
+ $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
+ $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
+ preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
+ // qui remplacent deux fois les & par des &amp;
+ // ce qui fait échouer le lien
+ $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
+ $this->addGroup($buttons, null, null, '&nbsp;');
+ } // end of member function _construitFormulaire
+
+} // end of HTML_formulaireListe
+
+
+
+
+
+?>
\ No newline at end of file
/branches/v2.0-narmer/client/projet/classes/HTML_listeParticipants.class.php
New file
0,0 → 1,202
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeParticipants.class.php,v 1.3.4.1 2007-05-11 13:47:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeParticipants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3.4.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
 
/**
* class HTML_listeParticipants
*
*/
class HTML_listeParticipants extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Le mode, par défaut 0 => normal 1 => modification En mode modification, une
* colonne de plus pour désinscrire un utilisateur
* @access private
*/
var $_mode;
/**
* L'url vers la page affichant la liste
* @access private
*/
var $_url;
 
/**
*
*
* @return void
* @access public
*/
function HTML_listeParticipants( $utilise_pager)
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
} // end of member function HTML_listeParticipants
 
/**
*
*
* @param Array elements Tableau des éléments de l'entête. Des labels.
* @return void
* @access public
*/
function construitEntete( $elements )
{
if ($this->_mode == 1) {
array_push ($elements, PROJET_SUPPRIMER) ;
}
$this->addRow ($elements, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array elements Tableau à deux dimension contenant les éléments à afficher.
* @return void
* @access public
*/
function construitListe( $elements, $tableau_statut = '', &$projet )
{
for ($i = 0; $i < count ($elements) ; $i++) {
// L'identifiant de l'utilisateur est le premier élément du tableau
$id_utilisateur = array_shift ($elements[$i]) ;
// L'identifiant du statut est le dernier
$id_statut = (int) array_pop ($elements[$i]) ;
// En mode modif on ajoute la colonne supprimer
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$this->_url->addQueryString('statut', 4) ;
array_push ($elements[$i], '', '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'
.PROJET_SUPPRIMER.'</a>');
$this->_url->removeQueryString('statut') ;
}
// La colonne avec l inscription a la liste de discussion
$this->addRow ($elements[$i]) ;
// mise à jour du champs mail en l'entourant par la balise mailto
/// $i+1 pour sauter la ligne de titre,
if (strlen ($elements[$i][2]) > 10) {
$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;
}
$this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
// Mise à jour de la cellule contenant le statut
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 4, $select) ;
}
if ($id_statut == 1 && $this->_mode != 1) {
$this->setCellContents($i + 1, 4, PROJET_CHEF) ;
$this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
}
if ($this->_mode != 1 && $id_statut != 1) {
$this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
}
$this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
$this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
}
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
* Renvoie le code HTML de la table.
*
* @return string
* @access public
*/
function toHTML( )
{
// Application de style
$this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
// s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
if ($this->getRowCount() == 1) {
return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
}
$res = HTML_Table::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Fixe la valeur de l'URL
*
* @param Net_URL url Un pointeur vers un objet Net_URL
* @return void
* @access public
*/
function setURL( &$url )
{
$this->_url = $url ;
} // end of member function setURL
 
} // end of HTML_listeParticipants
?>
/branches/v2.0-narmer/client/projet/classes/HTML_listeDocuments.class.php
New file
0,0 → 1,383
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeDocuments.class.php,v 1.8.2.1 2007-05-11 13:54:54 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
/**
* class HTML_listeDocuments
*
*/
class HTML_listeDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du repertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
* le style d affichage
* @access private
*/
var $_mode_affichage ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function HTML_listeDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
$this->_mode_affichage = 'standart';
} // end of member function HTML_listeDocuments
 
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '', $id_projet = '' )
{
$this->HTML_listeDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
}
 
/**
*
*
* @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
{
if ($this->_mode_affichage == 'standart') {
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Premiere condition : est-ce que le fichier a pour pere le repertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un repertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
$this->_url->addQueryString('service', 'telechargement');
$lien = $this->_url->getURL() ;
$this->_url->removeQueryString('service');
}
// pour eviter des effets de bords, on enleve id_repertoire de l'url
// dans le cas d'un repertoire, pour les fichiers on le laisse pour
// qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insere le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
$taille = $tableau_document[$i]->getTailleFormatee();
// Recuperation de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau a donner en parametre a HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->_url->removeQueryString('id_document');
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} else {
}
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
}
 
/**
*
*
* @param string le mode, valeur possible standart ou ajax
* @return void
* @access public
*/
function setModeAffichage( $mode )
{
$this->_mode_affichage = $mode ;
}
 
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
}
 
/**
* Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
* repertoires.
*
* @return string
* @access public
*/
function toHTML($id_projet = '', $droits)
{
if ($this->_mode_affichage == 'standart') {
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i++) {
$chemin_navig .= "&gt;&nbsp;" ;
$doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
$nom = $doc->getNomLong() ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
} else {
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $this->_url->getURL();
// Le noeud racine
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
} else {
$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
}
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la legende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
}
 
 
/**
* Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
}
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est a dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
$couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
/branches/v2.0-narmer/client/projet/classes/HTML_listeProjet.class.php
New file
0,0 → 1,197
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_listeProjet.class.php,v 1.7 2006-09-15 12:35:54 alexandre_tb Exp $
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
/**
* class HTML_listeProjet
*
*/
class HTML_listeProjet extends HTML_Liste
{
/*** Attributes: ***/
/**
* 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
* d'un utilisateur.
* @access private
*/
var $_mode;
/**
* Un objet PEAR::Net_URL
* @access private
*/
var $_url;
 
/**
*
*
* @param bool utilise_pager Indique si les résultats sont divisés en page.
* @return void
* @access public
*/
function HTML_listeProjet( $utilise_pager = false )
{
HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre', 'summary' => PROJET_LISTE)) ;
} // end of member function HTML_listeProjet
 
/**
*
*
* @return void
* @access public
*/
function __construct($utilise_pager = false)
{
$this->HTML_listeProjet($utilise_pager);
} // end of member function __cosntruct
 
/**
*
*
* @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
* @return void
* @access public
*/
function construitEntete( $label_entete )
{
$this->addRow ($label_entete, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type
* 0 =>'label', 'label2',
* 1 => ...
* @return void
* @access public
*/
function construitListe( $label_liste, $tableau_statut = '' )
{
for ($i = 0; $i < count ($label_liste) ; $i++) {
if ($this->_mode == 1) {
$id_projet = array_shift ($label_liste[$i]) ;
$id_statut = array_pop ($label_liste[$i]) ;
}
$resume = array_shift ($label_liste[$i]) ;
$this->addRow ($label_liste[$i]) ;
if ($this->_mode == 1 && $id_statut < 3) {
$this->_url->addQueryString ('identifiant_projet', $id_projet) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
if (is_int($id_statut)) {
//$this->setCellContents($i+1, 2, $select) ;
$this->setCellContents($this->getRowCount() - 1, 2, $select) ;
} else {
$this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
}
}
// On affiche le résumé dans la deuxième ligne
if (PROJET_LISTE_RESUME) {
$this->addRow (array ($resume), array('colspan' => $this->getColCount()));
}
}
$this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
*
*
* @param Net_URL url Un objet PEAR::Net_URL
* @return void
* @access public
*/
function setURL(& $url )
{
$this->_url = $url ;
} // end of member function setURL
/**
* Alternates the row attributes starting at $start
* @param int $start Row index of row in which alternating begins
* @param mixed $attributes1 Associative array or string of table row attributes
* @param mixed $attributes2 Associative array or string of table row attributes
* @param bool $inTR false if attributes are to be applied in TD tags
* true if attributes are to be applied in TR tag
* @access public
*/
function altRowAttributes($start, $attributes1, $attributes2, $inTR = false)
{
for ($row = $start ; $row < $this->_rows ; $row++) {
$attributes = ( ($row+$start)%2 == 0 ) ? $attributes1 : $attributes2;
$this->updateRowAttributes($row, $attributes, $inTR);
if (PROJET_LISTE_RESUME) {
$row++;
$this->updateRowAttributes($row, $attributes, $inTR);
$start++;
}
}
} // end func altRowAttributes
 
} // end of HTML_listeProjet
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireDocument.class.php
New file
0,0 → 1,146
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireDocument.class.php,v 1.4 2007-02-13 15:11:39 jp_milcent Exp $
/**
* Application projet
*
* La classe HTML_formulaireDocument
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
/**
* class HTML_formulaireDocument
*
*/
class HTML_formulaireDocument extends HTML_QuickForm
{
/** Le type d'un document, par défaut 'fichier'
*
* @access private
*/
var $_type = 'fichier';
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire
* @param string method Méthode post ou get
* @param string action L'action du formulaire.
* @param int target La cible.
* @param Array attributes Les attributs HTML en plus.
* @param bool trackSubmit ??
* @return void
* @access public
*/
function HTML_formulaireDocument( $formName, $method = "post", $action, $target = "_self", $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireDocument
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire($action = PROJET_NOUVEAU_FICHIER)
{
$this->addElement ('text', 'document_nom', PROJET_FICHIER_NOM_DOCUMENT, array ('size' => 40)) ;
$this->addRule ('document_nom', PROJET_FICHIER_ALERTE, 'required', '', 'client') ;
$this->addElement ('html', '<tr><td colspan="2">'.PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION.'</td></tr>') ;
$this->addElement ('textarea', 'document_description', PROJET_FICHIER_DESCRIPTION, array('cols'=>40, 'rows'=>10)) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = &HTML_QuickForm::createElement('radio', 'document_visibilite', 'public', PROJET_FICHIER_PUBLIC, 'public') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'document_visibilite', 'prive', PROJET_FICHIER_PRIVEE, 'prive');
$this->addGroup($radio, null, PROJET_FICHIERS_VISIBILITE, '&nbsp;');
// Le champs fichier si le type du document est un fichier
if ($this->_type == 'fichier' && $action == PROJET_NOUVEAU_FICHIER) {
$GLOBALS['fichier'] = $this->addElement ('file', 'fichier', PROJET_FICHIER_LE_FICHIER) ;
$this->setMaxFileSize(PROJET_UPLOAD_MAX_FILE_SIZE) ;
$this->addRule ('fichier', PROJET_FICHIER_ALERTE_PAS_DE_FICHIER, 'required', '', 'client') ;
}
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
$this->applyFilter('document_nom', 'addslashes') ;
$this->applyFilter('document_description', 'addslashes') ;
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
} // end of member function construitFormulaire
 
/**
* Permet de spécifier le type de formulaire à montrer
*
* @param string type Le type d'un document, 'fichier' ou 'repertoire'
* @return void
* @access public
*/
function setType( $type )
{
if ($type != 'fichier' && $type != 'repertoire') trigger_error ('type invalide', E_USER_ERROR) ;
$this->_type = $type ;
} // end of member function setType
 
/**
*
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
} // end of HTML_formulaireDocument
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireCreationWikini.class.php
New file
0,0 → 1,108
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireCreationWikini.class.php,v 1.2 2005-09-27 16:39:47 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireCreationWikini
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireCreationWikini
*
*/
class HTML_formulaireCreationWikini extends HTML_QuickForm
{
 
/*** Attributes: ***/
 
/**
* Constructeur
*
* @return void
* @access public
*/
function HTML_formulaireCreationWikini($formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false)
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireCreationWikini
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire( )
{
$this->addElement ('html', '<p>'.PROJET_WIKINI_NOM_EXPLICATION.'</p>') ;
$this->addElement ('text', 'nom_wikini', PROJET_WIKINI_CHOISIR_NOM) ;
$this->addRule ('nom_wikini', PROJET_NOM_WIKINI_REQUIS, 'required', '', 'client') ;
$this->addRule ('nom_wikini', PROJET_WIKINI_NOM_INVALIDE, 'regex', '/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/', 'client') ;
/*
$this->addElement ('text', 'prefixe_wikini', PROJET_PREFIXE_WIKINI) ;
$this->addRule ('prefixe_wikini', PROJET_PREFIXE_WIKINI_REQUIS, 'required', '', 'client');
*/
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
} // end of HTML_formulaireCreationWikini
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireListe.class.php
New file
0,0 → 1,123
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireListe.class.php,v 1.2 2005-09-27 16:40:39 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireListe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireListe
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireListe extends HTML_QuickForm
{
 
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireListe
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire()
{
$this->addElement ('text', 'nom_liste', PROJET_NOM_DE_LA_LISTE, array('size' => '20')) ;
$this->addRule ('nom_liste', PROJET_NOM_DE_LA_LISTE_REQUIRED, 'required', '', 'client') ;
$this->applyFilter('nom_liste', 'strtolower') ;
$this->addElement ('text', 'domaine_liste', PROJET_DOMAINE_DE_LA_LISTE, array('size' => '20')) ;
$this->addRule ('domaine_liste', PROJET_DOMAINE_LISTE_REQUIRED, 'required', '', 'client') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 1, PROJET_OUI, 1) ;
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 0, PROJET_NON, 0);
$this->addGroup($radio, null, PROJET_FORUMS_VISIBILITE, '&nbsp;');
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
 
} // end of HTML_formulaireListe
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireMail.class.php
New file
0,0 → 1,117
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireMail.class.php,v 1.3 2006-07-05 09:44:11 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireMail
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireMail
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireMail extends HTML_QuickForm
{
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire()
{
$this->addElement ('text', 'mail_titre', PROJET_MAIL_TITRE, array ('size' => 60, 'id' => 'titre_mail')) ;
$this->addRule ('mail_titre', PROJET_MAIL_TITRE_REQUIS, 'required', '', 'client') ;
$this->addElement ('textarea', 'mail_corps', PROJET_MAIL_CORPS, array('cols'=>80, 'rows'=>30, 'id' => 'corps_mail')) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
} // end of member function _construitFormulaire
 
 
 
} // end of HTML_formulaireProjet
?>
/branches/v2.0-narmer/client/projet/classes/ezmlmAccessObject.class.php
New file
0,0 → 1,335
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est regi par la licence CeCILL soumise au droit francais et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusee par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilite au code source et des droits de copie,
// de modification et de redistribution accordes par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitee. Pour les memes raisons,
// seule une responsabilite restreinte pese sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concedants successifs.
 
// A cet egard l'attention de l'utilisateur est attiree sur les risques
// associes au chargement, a l'utilisation, a la modification et/ou au
// developpement et a la reproduction du logiciel par l'utilisateur etant
// donne sa specificite de logiciel libre, qui peut le rendre complexe a
// manipuler et qui le reserve donc a des developpeurs et des professionnels
// avertis possedant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invites a charger et tester l'adequation du
// logiciel a leurs besoins dans des conditions permettant d'assurer la
// securite de leurs systemes et ou de leurs donnees et, plus generalement,
// a l'utiliser et l'exploiter dans les memes conditions de securite.
 
// Le fait que vous puissiez acceder a cet en-tete signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepte les
// termes.
// ----
// CVS : $Id: ezmlmAccessObject.class.php,v 1.4.2.1 2007-05-11 13:44:59 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe ezmlmAccessObject
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.4.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** Etend XML_Parser_Simple */
require_once 'XML/Parser/Simple.php' ;
 
/**
* Les codes erreurs
*/
define ('EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE', 206) ;
/**
* classe ezmlmAccessObject parse les fichiers XML
* issue de ezmlm
*
* @category XML
* @package projet
* @author alex
*/
class ezmlmAccessObject extends XML_Parser_Simple {
/**
* Le domaine de la liste
*/
var $domaine ;
/**
* Le nom de la liste
*/
var $liste ;
/**
* Les actions valides
*/
var $actions_supportees = array ('calendrier_messages',
'message',
'derniers_messages',
'messages_auteur',
'messages_mois',
'messages_thread',
'supprimer',
'liste_abonnes');
/**
* l'action selectionnee
*/
var $action ;
/**
* La langue 'fr-FR'
*/
var $langue ;
/**
* L'url de base
*/
var $url ;
/**
* L'identifiant du repertoire
*/
var $identifiant_repertoire ;
/**
* Identifiant message
*/
var $identifiant_message;
 
/**
* L'identifiant du repertoire
*/
var $_numeroRepertoireSuivant ;
/**
* L'identifiant du repertoire
*/
var $hash_auteur ;
/**
* Le mois a afficher
*/
var $mois ;
var $_numeraRepertoirePrecedent;
/**
* Identifiant message
*/
var $_numeroFichierSuivant;
var $_numeroFichierPrecedent;
var $chemin_fichier_xml;
/**
* Creation de l'objet d'acces
*
*/
function ezmlmAccessObject ($action, $domaine, $liste, $langue = 'fr', $url = '') {
$this->XML_Parser_Simple(null, 'func') ;
$this->action = $action ;
$this->domaine = $domaine ;
$this->liste = $liste ;
$this->langue = $langue ;
$this->url = $url ;
}
/**
* Gestion des balises
*
* Cette méthode spàcifie les balises reconnus par ezmlmAccessObject
* Elle remplace la méthode handleElement de XML_Parser_Simple
*
* @access public
* @param string nom de l'élément (Voir la doc de PHP)
* @param array attributes
* @param
* @link http://fr.php.net/manual/fr/ref.xml.php manuel
*/
function handleElement_ezmlm_message ($name, $attribs, $data) {
echo $data ;
}
function handleElement_message_suivant ($name, $attribs, $data) {
$this->_numeroRepertoireSuivant = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierSuivant = $attribs['NUMERO'] ;
}
function handleElement_message_precedent ($name, $attribs, $data) {
$this->_numeroRepertoirePrecedent = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierPrecedent = $attribs['NUMERO'] ;
}
function handleElement_ezmlm_calendrier_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_derniers_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_auteur ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_mois ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_thread ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_liste_abonnes ($name, $attribs, $data) { echo $data ; }
/**
* Choix de l'action
*
* Liste des actions :
* 'calendrier_messages'
*
* @access public
* @param string une action qui doit etre supporté
*/
function setAction($action) {
// verification de l'action
if (!in_array($action, $this->actions_supportees)) {
return raiseError(EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE) ;
}
$this->action = $action ;
// Libere les ressources (XML_Parser::free)
$this->free();
// On vide l url
//$this->url = '';
$this->chemin_fichier_xml = '';
// Charge la nouvelle action
$this->load() ;
}
/**
* Charge une action
*
* cad affecte un fichier xml au parser
*
* @access public
*/
function load() {
$this->chemin_fichier_xml = PROJET_SERVEUR_VPOPMAIL.'/'.$this->action.'.php?domaine='.
$this->domaine.'&liste='.$this->liste.'&langue='.
$this->langue ;
if ($this->url != '') $this->chemin_fichier_xml.= '&url='.urlencode($this->url) ;
if (isset ($this->identifiant_repertoire))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_repertoire ;
if (isset ($this->identifiant_message))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_message ;
if (isset ($this->hash_auteur))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->hash_auteur ;
if (isset ($this->mois))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->mois ;
$this->setInputFile($this->chemin_fichier_xml) ;
}
/**
* Precise un message a extraire
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param integer le numero du repertoire
* @param integer le numero du message
*
*/
function setIdMessage ($identifiant_repertoire, $identifiant_message) {
$this->identifiant_repertoire = $identifiant_repertoire ;
$this->identifiant_message = $identifiant_message ;
}
/**
* Precise un auteur
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param string le hash d'un auteur
*
*/
function setHashAuteur ($hash_auteur) {
$this->hash_auteur = $hash_auteur;
}
/**
* Precise un mois
*
* On indique le numero de repertoire ezmlm et le numéro du message
* @param string le hash d'un auteur
*
*/
function setMois ($mois) {
$this->mois = $mois;
}
/**
* Renvoi le numero du repertoire suivant
*
*
*/
function getNumeroRepertoireSuivant() { return $this->_numeroRepertoireSuivant; }
function getNumeroFichierSuivant () { return $this->_numeroFichierSuivant ; }
function getNumeroRepertoirePrecedent() { return $this->_numeroRepertoirePrecedent; }
function getNumeroFichierPrecedent () { return $this->_numeroFichierPrecedent ; }
function parse()
{
if (substr(phpversion(), 0, 1) == '5') {
//try {
$xml = new SimpleXMLElement($this->chemin_fichier_xml, null, true);
switch ($this->action) {
case 'calendrier_messages' :echo utf8_decode($xml);
echo utf8_decode($xml->ezmlm_calendrier_messages);
break;
case 'message':
echo utf8_decode ($xml);
$this->_numeroRepertoirePrecedent = $xml->message_precedent['numero_repertoire'];
$this->_numeroRepertoireSuivant = $xml->message_suivant['numero_repertoire'];
$this->_numeroFichierSuivant = $xml->message_suivant['numero'];
$this->_numeroFichierPrecedent = $xml->message_precedent['numero'];
break;
default :
echo utf8_decode($xml);
}
$error = 'Erreur dans l\'acc&egrave;s au fichier:<br />'.$this->chemin_fichier_xml.'<br />';
$error = '';
// throw new Exception($error);
//}
//catch (Exception $e) {
// echo $e->getMessage(). "<br />";
//}
} else {
return parent::parse();
}
}
}
 
?>
/branches/v2.0-narmer/client/projet/classes/commande_serveur.class.php
New file
0,0 → 1,107
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: commande_serveur.class.php,v 1.2 2005-09-27 16:37:40 alexandre_tb Exp $
/**
* Application projet
*
* La classe commande_serveur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class commande_serveur
* Cette classe permet d'accéder au fichier ezmlm.sh afin de lui ajouter des
* commandes qui seront effectués périodiquement par le serveur.
*/
class commande_serveur
{
 
/*** Attributes: ***/
 
/**
* Pointeur vers le fichier des commandes
* @access private
*/
var $_fichier;
 
/**
*
*
* @return void
* @access public
*/
function commande_serveur($fichier)
{
$this->_fichier = fopen ($fichier,'a+') ;
if (!$this->_fichier) {
return 'Impossible d\'ouvrir le fichier de commande' ;
}
} // end of member function commande_serveur
 
/**
*
*
* @param string commande La commande, une chaine à ajouter à la fin du fichier ezmlm.sh
* @return bool
* @access public
*/
function ajouterCommande( $commande )
{
fwrite ($this->_fichier, "\n".$commande) ;
} // end of member function ajouterCommande
/**
* Destructeur
*
* @return void
* @access public
*/
function _commande_serveur($fichier)
{
fclose ($this->_fichier) ;
} // end of member function commande_serveur
 
/**
*
*
* @return
*/
function enleverToutesCommandes () {
ftruncate ($this->_fichier, 12) ;
}
} // end of commande_serveur
?>
/branches/v2.0-narmer/client/projet/classes/projetTemplate.class.php
New file
0,0 → 1,67
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetTemplate.class.php,v 1.2 2006-12-18 17:21:58 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
class projetTemplate extends PEAR {
 
 
var $_db ;
function projetTemplate(&$objetDB) {
$this->_db = $objetDB ;
}
function getTemplate ($id_template, $lang='fr-FR', $argument = 0) {
$requete = 'select pt_template from projet_template where pt_id_template='.$id_template.
' and pt_i18n like "'.$lang.'%"' ;
if ($argument != 0) $requete .= ' and pt_argument='.$argument ;
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) return $this->raiseError ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
if ($resultat->numRows() == 0) return $this->raiseError ('Aucun template avec l\'identifiant: '.$id_template.
', la langue: '.$lang. ' et l argument '.$argument) ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pt_template ;
}
}
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireInscriptionProjet.class.php
New file
0,0 → 1,114
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireInscriptionProjet.class.php,v 1.2 2005-09-27 16:40:23 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireInscriptionProjet
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'HTML/QuickForm/radio.php';
 
/**
* class HTML_formulaireInscriptionProjet
*
*/
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
{
/*** Attributes: ***/
 
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireInscriptionProjet( $formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireInscriptionProjet
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire(& $projet )
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
''."\n" ;
$modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n" ;
$squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n");
$squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
$squelette->setElementTemplate( '{element}</li></ul>', 'valider');
$squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
if ($projet->avoirListe()) {
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
// Indisponible pour le moment
//$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
}
$this->addElement ('hidden', 'id_projet', $projet->getId()) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
 
} // end of HTML_formulaireInscriptionProjet
?>
/branches/v2.0-narmer/client/projet/classes/inscription_liste.class.php
New file
0,0 → 1,236
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription_liste.class.php,v 1.5 2006-04-19 13:50:49 alexandre_tb Exp $
/**
* Application projet
*
* La classe inscription_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class isncription_liste
*
*/
class inscription_liste
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste
* @access private
*/
var $_id_liste;
/**
* Identifiant de l'utilisateur
* @access private
*/
var $_id_utilisateur;
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
* Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
* @access private
*/
var $_type_inscription;
 
/**
* Constructeur
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function inscription_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function inscription_liste
 
/**
* Renvoie un tableau avec la liste des inscrit à une liste.
*
* @param int id_liste L'identifiant de la liste
* @return Array
* @access public
*/
function getInscritsListe( $id_liste )
{
} // end of member function getInscritsListe
 
/**
*
*
* @param annire utilisateur
* @param liste_discussion id_liste
* @param int type_inscription
* @return void
* @access public
*/
function inscrireUtilisateur( &$utilisateur, &$liste, $type_inscription )
{
$requete = 'update projet_inscription_liste set '.
'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if ($this->_db->affectedRows() == 0) {
$requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$utilisateur->getInfo('identifiant').
', pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
// Ajout dans la liste des commandes au serveur
// On inscrit le créateur de la liste
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
} // end of member function inscrireUtilisateur
 
/**
*
*
* @param int id_utilisateur
* @param int id_liste
* @return void
* @access public
*/
function desinscrireUtilisateur( &$utilisateur, &$liste )
{
$requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$utilisateur->getInfo('identifiant').' and pil_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
} // end of member function desinscrireUtilisateur
 
/**
*
*
* @param int id_liste
* @param int id_utilisateur
* @param int type_inscription
* @return void
* @access public
*/
function modifierTypeInscription( $liste, $utilisateur, $type_inscription )
{
 
// envoie d'une demande d'inscription par email à la liste
//include_once 'Mail.php' ;
switch ($type_inscription) {
case 0 :
 
// Ajout du modérateur en tant qu'utilisateur
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
break ;
case 1 :
break ;
case 2 :
 
// Ajout d'un utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
break ;
}
} // end of member function modifierTypeInscription
 
/**
* Renvoie la liste des statuts d'un utilisateur
*
* @param int id_utilisateur
* @return Array
* @access public
*/
function getStatutsInscrit( $id_utilisateur )
{
$requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur ;
$resultat = $this->_db->query ($requete) ;echo $requete;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
}
return $tableau_resultat ;
 
} // end of member function getStatutsInscrit
 
/**
* Renvoie le statut d'un inscrit à une liste
*
* @param int id_liste
* @param int id_utilisateur
* @return int
* @access public
*/
function getStatutInscrit( $id_liste, &$auth )
{
// Récupération de la liste des listes !!
$requete = 'select pl_nom_liste, pl_domaine from projet_liste where pl_id_liste='.$id_liste ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$xml = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/liste_abonnes.php?domaine='.
$ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
$tableau_mail = array() ;
$tableau_ligne = explode ('<email>', $xml) ;
foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
array_shift($tableau_mail) ;
if (in_array($auth->getUsername(), $tableau_mail)) {
return 2; // Inscrit est le statut 2
}
return 0 ;
} // end of member function getStatutInscrit
} // end of isncription_liste
?>
/branches/v2.0-narmer/client/projet/classes/annuaire.class.php
New file
0,0 → 1,150
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.class.php,v 1.5 2006-07-04 09:25:38 alexandre_tb Exp $
/**
* Application annuaire
*
* La classe annuaire
*
*@package annuaire
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
/**
* class annuaire
*
*/
class annuaire extends PEAR
{
 
/*** Attributes: ***/
 
/**
*
* @access private
*/
var $_db;
/**
*
* @access private
*/
var $_id_utilisateur;
/**
* Tableau contenant les noms des champs
* @access private
*/
var $_champs_base;
 
/**
*
*
* @param int objetDB Une ressource PEAR::DB
* @param Array param un tableau indiquant les noms des champs dans la base. 'nom' => 'CHAMPS_NOM',
'prenom' => .. 'date_inscription' => .. 'identifiant' => ... 'ville' => ...
'pays' => ...
* @return void
* @access public
*/
function annuaire( &$objetDB, $param )
{
$this->_db = $objetDB ;
$this->_champs_base = $param ;
} // end of member function annuaire
 
/**
* Spécifie l'identifiant d'un utilisateur ou plusieurs utilisateurs
*
* @param mixed id_utilisateur L'identifiant d'un utilisateur
* @return void
* @access public
*/
function setId( $id_utilisateur )
{
$this->_id_utilisateur = $id_utilisateur ;
} // end of member function setId
 
/**
* Renvoie l'info de l'utilisateur courant. Sans paramètre, renvoie un tableau avec
* tous les champs.
*
* @param string parametre Un paramètre de l'objet : - 'nom', 'prenom' ....
* @return void
* @access public
*/
function getInfo( $parametre )
{
$requete = 'select '.$this->_champs_base[$parametre].
' from '.$this->_champs_base['table'].
' where '.$this->_champs_base['identifiant'].'='.$this->_id_utilisateur ;
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) {
echo $requete.' erreur '.$resultat->getMessage() ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC) ;
return $ligne[$this->_champs_base[$parametre]] ;
} // end of member function getInfo
 
/**
* Renvoie la liste de tous el inscris ou celle dont le champs passé en paramètre
* ressemble à la valeur souhaité. Ex : $maliste->getListe (array('nom' => '%toto'))
* ; renvoie la liste des adhérents dont le nom commence par toto.
*
* @param Array param Un tableau du type 'nom' => 'chaine'
* @return void
* @access public
*/
function getListe( $param )
{
} // end of member function getListe
 
/**
* Renvoie la liste des inscrits dont le nom commence par lettre
*
* @param char lettre La lettre
* @return void
* @access public
*/
function getListeAlphabetique( $lettre )
{
} // end of member function getListeAlphabetique
 
 
 
 
 
} // end of annuaire
?>
/branches/v2.0-narmer/client/projet/classes/projet.class.php
New file
0,0 → 1,931
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.class.php,v 1.8.2.2 2007-06-25 10:07:05 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php' ;
/* Permet la récupération d'un nouvel identifiant d'une table.*/
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
include_once 'Mail.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
 
/**
* class projet
*
*/
class projet
{
 
/** Aggregations: */
 
/**
* Le tableau d'objet document associés au projet
*
*/
var $_documents_associes = array();
 
var $_listes_associes = array();
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du projet.
* @access private
*/
var $_id_projet;
 
/**
* Le titre du projet, tel que dans la base de donnée.
* @access private
*/
var $_titre;
/**
* La description du projet, tel que dans la base.
* @access private
*/
var $_description;
/**
* L'URL d'un site sur le projet. Facultatif.
* @access private
*/
var $_espace_internet;
/**
* Le nom du wikini associé au projet, avec la syntaxe wikini. Vide par défaut.
* @access private
*/
var $_nom_wikini;
/**
* Date de création du projet. A priori ne varie pas dans le temps.
* @access private
*/
var $_date_creation;
/**
* Le chemin relatif vers le répertoire contenant les wikinis.
* @access private
*/
var $_chemin_wikini;
/**
* Une connexion vers la base de donnée.
* @access private
*/
var $_db;
 
/**
* Contient le nom du répertoire du projet tel que sur le disque.
* @access private
*/
var $_nom_repertoire;
 
/**
* Le chemin jusqu'au répertoire où seront stockés les fichiers.
* @access private
*/
var $_chemin_repertoire;
 
/**
* Vaut vrai si le projet est un projet racine et s'il est le seul.
* @access private
*/
var $_est_racine;
/**
* Le résumé du projet
* @access private
*/
var $_resume;
/**
* Contient le numéro du type du projet
* @access private
*/
var $_type;
 
/**
* Indique si l'inscription au projet est moderes
* @access private
*/
var $_isModere;
 
/**
* Indique si le projet a des documents
* @access private
*/
var $_avoirDocument;
/**
*
* PHP5
* @return projet
* @access public
*/
function __construct( &$dbObject, $id_projet = "")
{
$this->projet($dbObject, $id_projet);
 
} // end of member function __construct
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur. Cela lui permet de faire une
* première requête pour les infos de bases comme le titre, le description etc.
* @return projet
* @access public
*/
function projet( &$dbObject, $id_projet = "")
{
$this->_db = $dbObject ;
if ($id_projet != "") {
$requete = "select * from projet where p_id=$id_projet" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
 
// Affectations dans les propriétés
$this->_id_projet = $ligne->p_id ;
$this->_titre = $ligne->p_titre ;
$this->_description = $ligne->p_description ;
$this->_espace_internet = $ligne->p_espace_internet ;
$this->_date_creation = $ligne->p_date_creation ;
$this->_nom_wikini = $ligne->p_wikini ;
$this->_resume = $ligne->p_resume;
$this->_type = $ligne->p_type ;
// On récupère le nom du répertoire
$this->_nom_repertoire = $ligne->p_nom_repertoire ;
$this->_isModere = $ligne->p_modere;
$this->_avoirDocument = $ligne->p_avoir_document;
// on regarde si on a à faire au projet racine
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'select ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$this->_est_racine = true ;
} else {
$this->_est_racine = false ;
}
}
}
} // end of member function projet
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur.
* @return bool
* @access public
*/
function projetExiste( &$dbObject, $id_projet)
{
if ($id_projet != "") {
$requete = "select * from projet where p_id=$id_projet" ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
return true ;
}
}
} // end of member function projet
 
/**
*
*
* @param int id_projet
* @return string
* @access public
*/
function getTitre( $id_projet = "" )
{
return $this->_titre ;
} // end of member function getTitre
 
/**
*
*
* @return string
* @access public
*/
function getResume( )
{
return $this->_resume ;
} // end of member function getResume
 
/**
* Renvoie l'identifiant du projet courant.
*
* @return int
* @access public
*/
function getId( )
{
return $this->_id_projet ;
} // end of member function getId
 
/**
*
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description;
} // end of member function getDescription
 
/**
*
*
* @return string
* @access public
*/
function getEspaceInternet( )
{
return $this->_espace_internet;
} // end of member function getEspaceInternet
 
/**
* Charge dans l'objet projet, les listes de discussion
* ['nom_liste']
* ['domaine']
* ['adresse']
*
* @return boolean true en cas de succès
* @access public
*/
function getListesAssociees( )
{
// On rajoute un test pour éviter l'appel SQL si il a déjà été fait une fois
if (count($this->_listes_associes) > 0) return ;
$requete = "select pl_id_liste from projet_lien_liste where pl_id_projet=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$retour = array() ;
if ($resultat->numRows()) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_listes_associes[] = new liste_discussion($ligne->pl_id_liste, $this->_db) ;
 
}
} // end of member function getListesAssociees
 
/**
* Renvoie vrai si le projet a au moins une liste
*
* @return bool
* @access public
*/
function avoirListe( )
{
$this->getListesAssociees() ;
if (count($this->_listes_associes)) {
return true ;
}
return false ;
}
 
/**
* Renvoie vrai si le projet a au moins un document, fichier ou repertoire
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @return bool
* @access public
*/
function avoirDocument( )
{
return $this->_avoirDocument;
}
 
/**
* Permet de fixer la colonne p_avoir_document à 1
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @param bool
* @return mixed true si la requete fonctionne
* @access public
*/
function setAvoirDocument($bool)
{
$val = 0 ;
if ($bool) $val = 1;
$requete = 'update projet set p_avoir_document='.$val.' where p_id='.$this->_id_projet;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return true;
}
 
/**
* Renvoie la liste des documents associes sous forme d'un tableau, avec les
* informations afférentes. 0 => "nom (cliquable)"
"Taille"
"Date
* de creation" "Prorietaire" "Visibilite" "Action
* (cliquable)"
*
* @param visibilite visibilite Si visibilite est prive, tous les fichiers sont renvoyes ainsi qu'une entree
* pour indiquer la visibilite du document.
* @return Array
* @access public
*/
function getListesDocuments( $chemin, $chemin_icones = "icones/", $id_repertoire = '' )
{
// On realise une requete sur projet_documents avec une jointure sur l'annuaire
// et sur gen_type_de_fichier pour envoyer un resultat complet.
// On exclue les fichiers racines cad pd_pere is null
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet ;
if ($id_repertoire != '') $requete .= ' and pd_pere='.$id_repertoire;
if ($id_repertoire == 0) $requete .= ' and pd_pere=0';
$requete .= ' order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
// Un compteur
$i = 0 ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, &$this->_db, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
}
 
 
/**
* Renvoie un tableau avec tous les repertoires d'un projet, imbrique. ['rep1'],
* ['rep2'] => array (['rep21'], ['rep22']), etc .
*
* @return Array
* @access public
*/
function getListeRepertoireHierarchisee( )
{
// On ne prend que les repertoires
$requete = "select pd_id, pd_pere, pd_nom from projet_documents where pd_ce_projet=".$this->_id_projet.' and pd_ce_type=0 order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
/*
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
}
*/
$tableau = array();
$tab = array();
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau, array ('id' => $ligne->pd_id,
'id_pere' => $ligne->pd_pere,
'fils' => array(),
'label' => $ligne->pd_nom));
 
}
// la $tableau reste un tableau de valeur a plat
$i = 0;
foreach ($tableau as $noeud) {
// On teste si le noeud est racine si oui on l ajoute a l arbre sinon on ne l ajoute pas
if ($noeud['id_pere'] == 0) {
$tab[$i] = $noeud;
$this->construireArbre($tab[$i], $tableau) ;
}
$i++;
}
return $tab;
} // end of member function getListeRepertoireHierarchisee
 
function construireArbre(&$noeud, $tableau) {
$j = 0;
foreach ($tableau as $element) {
// pour chaque element on teste
if ($element['id_pere'] == $noeud['id']) {
$noeud['fils'][$j]= $element ;
$this->construireArbre($noeud['fils'][$j],$tableau);
}
$j++;
}
}
 
/**
* Renvoie un tableau comprenant tous les objets projet de la base.
*
* @return Array
* @static
* @access public
*/
function getTousLesProjets(&$objetDB, $exclu = '')
{
$sql = '';
if (isset ($this->_projet_exclu) && count($this->_projet_exclu)) {
$sql = 'where p_id not in (';
foreach ($this->_projet_exclu as $valeur) {
$sql .= $valeur.',' ;
}
$sql[count($sql)-1] = ')';
}
$requete = 'select p_id from projet '.$sql.' order by p_titre' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un tableau comprenant les objets projet de la base du type $type.
*
* @return Array
* @static
* @access public
*/
function getProjetDuType($type, &$objetDB)
{
$requete = "select p_id from projet where p_type=$type order by p_titre" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un le projet racine.
*
* @return projet
* @static
* @access public
*/
function getProjetRacine(&$objetDB)
{
$requete = "select p_id from projet where p_id not in (select ph_id_projet_fils from projet_hierarchie)" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return new projet($objetDB, $ligne->p_id) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Desctructeur de la classe. Libère la mémoire, ferme les connexions et fichiers.
*
* @return void
* @access public
*/
function __destruct( )
{
 
} // end of member function __destruct
 
/**
* Supprime le projet courrant. Il s'ensuit une suppression en cascade de tous les
* éléments liés.
*
* @return void
* @access public
*/
function supprimer( )
{
 
} // end of member function supprimer
 
/**
* Permet d'enregistrer une ligne dans la table concernée.
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* du formulaire.
* @return int
* @access public
*/
function enregistrerSQL( $tableau_de_valeur )
{
$nom_repertoire = projet::genereNomRepertoire($tableau_de_valeur['projet_titre'], $this->_db) ;
if (!$this->_creationRepertoire ($nom_repertoire)) {
echo 'Impossible de crée un répertoire'.$nom_repertoire ;
return false ;
}
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet', 'p_id') ;
$requete = 'insert into projet set p_id='.$id ;
if (!isset($tableau_de_valeur['projet_wikini'])) {
$tableau_de_valeur['projet_wikini']='';
}
$requete .= ', p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'", p_date_creation=NOW()'.
', p_wikini="'.$tableau_de_valeur['projet_wikini'].'", p_nom_repertoire="'.$nom_repertoire.'", p_resume="'.$tableau_de_valeur['projet_resume'].
'", p_type='.$tableau_de_valeur['projet_type'].', p_modere="'.$tableau_de_valeur['projet_moderation'].'"' ;
$resultat = $this->_db->query ($requete) ;
 
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
// On affecte à l'objet projet son identifiant
$this->_id_projet = $id ;
 
//insertion dans projet_hierarchie
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
', ph_id_projet_fils='.$id ;
$resultat = $this->_db->query ($requete) ;
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Permet de mettre à jour une ligne dans la table concernée.
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* du formulaire.
* @return int
* @access public
*/
function majSQL( $tableau_de_valeur )
{
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$requete = 'update projet set ';
$requete .= 'p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'"'.
', p_resume="'.$tableau_de_valeur['projet_resume'].'", p_type='.$tableau_de_valeur['projet_type'].
', p_modere='.$tableau_de_valeur['projet_moderation'].
' where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
if (PROJET_UTILISE_HIERARCHIE) {
// suppression dans projet_hierarchie
 
$requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
 
//insertion dans projet_hierarchie
 
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
', ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Met à jour dans la base de donnée le champs p_nom_wikini
*
* @param int nom_wikini Le nouveau nom wikini
* @return bool
* @access public
*/
function majNomWikini( $nom_wikini )
{
$requete = 'update projet set p_wikini="'.$nom_wikini.'" where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function majNomWikini
 
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$msg = '' ;
// Supression du répertoire du projet
if (!$this->_suppression_repertoire()) {
$msg = 'La suppression du répertoire n\'a pas fonctionn°' ;
}
// A ajouter la suppression des documents associés
 
// La suppression des évènements associés
 
// Le projet lui-même
$requete = "delete from projet where p_id=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
 
if (PROJET_UTILISE_HIERARCHIE) {
$requete = "delete from projet_hierarchie where ph_id_projet_fils=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
$requete = "delete from projet_statut_utilisateurs where psu_id_projet=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
return $msg ;
} // end of member function suppressionSQL
 
/**
* Supprime le répertoire associé au projet (le répertoire doit être vide).
*
* @return void
* @access private
*/
function _suppression_repertoire( )
{
return rmdir ($this->_chemin_repertoire.$this->_nom_repertoire) ;
} // end of member function _suppression_repertoire
 
/**
* Permet de créer le répertoire associé au projet.
*
* @param string nom_repertoire Le nom du répertoire à créer.
* @return boolean
* @access private
*/
function _creationRepertoire( $nom_repertoire )
{
return mkdir ($this->_chemin_repertoire.$nom_repertoire) ;
} // end of member function _creationRepertoire
 
/**
* Permet d'indiquer où seront stockés les fichiers.
*
* @param string cheminRepertoire Le chemin jusqu'au répertoire où seront stockés les fichiers.
* @return void
* @access public
*/
function setCheminRepertoire( $cheminRepertoire )
{
$this->_chemin_repertoire = $cheminRepertoire ;
} // end of member function setCheminRepertoire
 
/**
* Génère un nom de répertoire à partir de la première lettre de la chaine passé en
* paramètre et de l'identifiant du dernier projet.
*
* @param string chaine Une chaine à partir de laquelle sera générer le nom du répertoire.
* @param DB objetDB un objet PEAR::DB
* @return string
* @static
* @access public
*/
function genereNomRepertoire( $chaine, &$objetDB )
{
$requete = "select p_id from projet order by p_id desc limit 0,1" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() > 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= $ligne->p_id + 1 ;
}
else {
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= 1 ;
}
return $nom ;
 
} // end of member function genereNomRepertoire
 
/**
* Permet de récupérer le nom du répertoire d'un projet.
*
* @return string
* @access public
*/
function getNomRepertoire( )
{
return $this->_nom_repertoire ;
} // end of member function getNomRepertoire
 
/**
* Ajoute une liste à un projet
* Effectue une insertion dans projet_lien_liste
*
* @param liste_discussion liste Une instance de la classe liste_discussion
* @return void
* @access public
*/
function ajouterListe( &$liste )
{
$requete = "insert into projet_lien_liste set pl_id_liste=".$liste->getId().
', pl_id_projet='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
} // end of member function ajouterListe
 
/**
* Supprime la liste de discussion associée au projet
*
* @return void
* @access public
*/
function supprimerListe(&$liste)
{
$requete = 'delete from projet_lien_liste where pl_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$requete = 'delete from projet_liste where pl_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
} // end of member function supprimerListe
 
 
/**
* Renvoie vrai si le projet est racine.
*
* @return bool
* @access public
*/
function isRacine( )
{
return $this->_est_racine ;
} // end of member function isRacine
 
/**
* Renvoie le nombre d'inscrits au projet. Effectue une requete dans la table
* projet_statut_utilisateurs
*
* @return int
* @access public
*/
function getNombreInscrits( )
{
$requete = 'select count(psu_id_utilisateur) as nbre from projet_statut_utilisateurs where psu_id_projet='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->nbre ;
} // end of member function getNombreInscrits
 
 
/**
* Renvoie un tableau contenant les identifiants des fils du projet courant.
*
* @return Array
* @access public
*/
function getHierarchie( )
{
$requete = 'select ph_id_projet_fils from projet_hierarchie where ph_id_projet_pere='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->ph_id_projet_fils) ;
}
return $tableau_resultat ;
} // end of member function getHierarchie
 
/**
* Renvoie l'identifiant du pere du projet courrant.
*
* @return int
* @access public
*/
function getIdPere()
{
$requete = 'select ph_id_projet_pere from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->ph_id_projet_pere ;
} // end of member function getIdPere()
 
/**
* Renvoie le nom Wiki du wikini associé au projet.
*
* @return string
* @access public
*/
function getWikini( )
{
return $this->_nom_wikini ;
} // end of member function getWikini
 
/**
* Renvoie le type du projet, ou zéro si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getType( )
{
return $this->_type ;
} // end of member function getType
 
/**
* Renvoie 1 si les inscriptions au projet sont modérées.
*
* @return int
* @access public
*/
function isModere( )
{
return $this->_isModere ;
} // end of member function getType
 
 
 
/**
* initAttributes sets all projet attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->chemin_wikini = "projet/wikini/";
}
 
 
} // end of projet
?>
/branches/v2.0-narmer/client/projet/classes/index.php
New file
0,0 → 1,19
<?php
// An even simpler version of the index page than version 1. All the actual work of
// determining what needs to be included and what needs to be run is now in the main class.
// Also, 'register_globals' doesn't need to be 'on' anymore.
 
require_once("ezmlm.php");
 
$ezmlm = new ezmlm_php();
 
$action = ($_POST['action'] ? $_POST['action'] : ($_GET['action'] ? $_GET['action'] : "list_info"));
$actionargs = ($_POST['actionargs'] ? $_POST['actionargs'] : ($_GET['actionargs'] ? $_GET['actionargs'] : ""));
 
$ezmlm->set_action($action);
$ezmlm->set_actionargs($actionargs);
$ezmlm->run();
 
unset($ezmlm);
 
?>
/branches/v2.0-narmer/client/projet/classes/projet_type.class.php
New file
0,0 → 1,107
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet_type.class.php,v 1.2 2005-10-14 08:55:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet_type
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_type
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesTypes(& $objetDB )
{
$requete = 'select * from projet_type' ;
return $objetDB->getAssoc ($requete) ;
} // end of member function getTousLesTypes
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_type( & $objetDB )
{
$this->_db = $objetDB ;
} // end of member function projet_type
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_type from projet_type where pt_id_type='.$id_type ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
} // end of member function projet_type
 
 
 
 
} // end of projet_type
?>
/branches/v2.0-narmer/client/projet/classes/HTML_Liste.class.php
New file
0,0 → 1,77
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_Liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_Liste, classe de base pour toutes les listes du module projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'HTML/Table.php' ;
 
/**
* class HTML_Liste
*
*/
class HTML_Liste extends HTML_Table
{
/*** Attributes: ***/
 
/**
*
* @access protected
*/
var $pager;
/**
*
* @access private
*/
var $_utilise_pager;
 
 
/**
*
*
* @param bool utilise_pager Si l'on souhaite que les résultats soient divisés en page, on passe true.
* @return HTML_Liste
* @access public
*/
function HTML_Liste( $utilise_pager = false, $attributes = '')
{
HTML_Table::HTML_Table($attributes) ;
$this->_utilise_pager = $utilise_pager ;
} // end of member function HTML_Liste
 
} // end of HTML_Liste
?>
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireCouperColler.class.php
New file
0,0 → 1,134
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireCouperColler.class.php,v 1.2.6.1 2007-05-11 13:46:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireCouperColler
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2.6.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'HTML/QuickForm.php' ;
 
/**
* class HTML_formulaireCouperColler
*
*/
class HTML_formulaireCouperColler extends HTML_QuickForm
{
/**
*
*
* @return void
* @access public
*/
function construitFormulaire($tableau_repertoire)
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}><ul>'."\n".'{content}'."\n".'</ul></form>'."\n");
$squelette->setElementTemplate( '<li style="list-style-type: none;">'."\n".'{element}'."\n".'</li>'."\n");
$this->addElement('radio', 'projet_repertoire', '', PROJET_RACINE, 0) ;
if (count ($tableau_repertoire)) {
$this->addElement('html', '<ul>') ;
foreach ($tableau_repertoire as $valeur) {
if ($valeur['id_pere'] ==0) {
$this->addElement ('radio', 'projet_repertoire', '', $valeur['label'], $valeur['id']) ;
if (count ($valeur['fils'])) $this->construireArbreRadio ($valeur['fils']);
}
}
$this->addElement('html', '</ul>') ;
}
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', '',
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER
); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
function construireArbreRadio(&$noeud) {
foreach ($noeud as $val) {
$this->addElement('html', '<ul>') ;
$this->construitLigneRepertoire($val) ;
if (count($val['fils'])) $this->construireArbreRadio ($val['fils']) ;
$this->addElement('html', '</ul>') ;
}
}
/**
*
*
*
*
*/
function construitLigneRepertoire($noeud) {
$this->addElement('html', '<ul>') ;
$this->addElement('radio', 'projet_repertoire', '', $noeud['label'], $noeud['id']) ;
$this->addElement('html', '</ul>') ;
}
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireCouperColler($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireCouperColler
 
/**
*
*
* @return string
* @access public
*/
function toHTML($nom_de_fichier)
{
$res = '<h2>'.PROJET_CHANGER_REPERTOIRE.'</h2>'."\n" ;
$res .= PROJET_FICHIER_A_DEPLACER . $nom_de_fichier;
$res .= '<h2>'.PROJET_CHOISISSEZ_REPERTOIRE.'</h2>' ;
$res .= HTML_QuickForm::toHTML() ;
return $res ;
}
}
?>
/branches/v2.0-narmer/client/projet/classes/fichier.class.php
New file
0,0 → 1,293
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier.class.php,v 1.6.2.1 2007-05-11 13:45:09 alexandre_tb Exp $
/**
* Application projet
*
* La classe fichier
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class fichier
* Cette classe représente un fichier au sens physique du terme. Elle fonctionne
* pour les système UNIX. A faire : adaptation selon les système. L'objectif est de
* gérer correctement l'upload de fichier.
*/
class fichier
{
/*** Attributes: ***/
/**
* Le nom du fichier, avec son extension.
* @access private
*/
var $_nom;
/**
* Le chemin UNIX ou Windows pour accéder au fichier sur le serveur (par ex;
* /var/www/fichier.txt
* @access private
*/
var $_chemin;
/**
* Cet attribut contient une valeur du type 755, indiquant les droits afférent à un
* fichier selon le système UNIX (propriétaire, groupe, autres)
* @access private
*/
var $_droits_unix;
/**
* Le type indique si le fichier est un répertoire, un lien ou un fichier.
* @access private
*/
var $_type = 'fichier';
/**
* l'identifiant du type mime.
* @access private
*/
var $_type_mime;
/**
* Le chemin vers le fichier, en partant du répertoire de travail.
* @access private
*/
var $_prefixe_chemin;
 
/**
*
*
* @return void
* @access public
*/
function fichier( $chemin, &$objetDB)
{
$this->_chemin = $chemin ;
// On analyse l'extension pour découvrir le type mime
$partie_chemin = pathinfo ($this->_chemin) ;
if (is_object($objetDB) && isset($partie_chemin['extension'])) {
$this->_type_mime = type_fichier_mime::factory ($partie_chemin['extension'], $objetDB) ;
}
// calcul du type
if (is_dir ($this->_chemin)) $this->_type = 'repertoire' ;
} // end of member function fichier
 
/**
* Le constructeur de la classe.
*
* @param string chemin Le chemin du fichier sur le serveur.
* @return fichier
* @access public
*/
function __construct( $chemin, &$objetDB)
{
$this->fichier($chemin, $objetDB);
} // end of member function __construct
 
/**
*
*
* @return void
* @access public
*/
function suppression()
{
if ($this->_type == 'repertoire') rmdir ($this->_chemin) ;
if ($this->_type == 'fichier') unlink ($this->_chemin) ;
} // end of member function suppression
 
/**
* Réalise l'upload d'un fichier vers chemin_destination.
*
* @param string chemin_destination Il s'agit du chemin UNIX de destination du fichier. Le script doit avoir les
* droits en écriture sur le répertoire.
* @global mixed une référence vers un objet HTML_QuickForm_File
* @return void
* @access public
*/
function upload( $chemin_destination )
{
if (move_uploaded_file($_FILES['fichier']['tmp_name'], $chemin_destination)) {
return true ;
} else {
return false ;
}
} // end of member function upload
 
/**
* Déplace un fichier, renvoie vrai en cas de succès.
*
* @param string origine L'emplacement de départ du fichier.
* @param string destination Le répertoire d'arrivé.
* @return bool
* @access public
*/
function deplace( $origine, $destination )
{
if (rename ($origine, $destination )) return true ;
return false ;
} // end of member function deplace
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime du document.
* @return type_fichier_mime
* @access public
*/
function getTypeMime( )
{
return $this->_type_mime;
} // end of member function getTypeMime
 
/**
* Renvoie vrai si le document est un répertoire.
*
* @return bool
* @access public
*/
function isRepertoire( )
{ $isRep = is_dir ($this->_chemin) ;
return $isRep ;
} // end of member function isRepertoire
 
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime.
* @return void
* @access public
*/
function setTypeMime( $id_type_mime )
{
$this->_type_mime = $id_type_mime ;
} // end of member function set TypeMime
 
 
/**
* Renvoie la taille du fichier en octet. Nécessite un accès au disque.
*
* @return int
* @access public
*/
function getTaille( )
{
if ($this->isRepertoire()) {
return $this->_tailleRepertoire($this->_chemin) ;
}
return @filesize ($this->_chemin) ;
} // end of member function getTaille
 
/**
* Renovie le nom du fichier, sur le disque.
*
* @return string
* @access public
*/
function getNom( )
{
} // end of member function getNom
 
/**
* Renvoie le chemin du fichier.
*
* @return string
* @access public
*/
function getChemin( )
{
return $this->_chemin ;
} // end of member function getChemin
 
/**
* Permet de calculer la taille en octet du repertoire courrant
*
* @return int
* @access protected
*/
function _tailleRepertoire($rep)
{
$taille = 0 ;
$liste_fichier = scandir ($rep) ;
foreach ($liste_fichier as $key => $value) {
if (is_dir ($rep."/".$value) && $value != ".." && $value != ".") {
$taille += $this->_tailleRepertoire ($rep.$value."/") ;
} else {
if ($value != '..' && $value != '.') $taille += @filesize ($rep.$value) ;
}
}
return $taille ;
} // end of member function _tailleRepertoire
 
 
/**
* initAttributes sets all fichier attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_type = 'fichier';
}
 
 
} // end of fichier
 
if(!function_exists("scandir"))
{
function scandir($dirstr)
{
// php.net/scandir (PHP5)
$files = array();
$fh = opendir($dirstr);
while (false !== ($filename = readdir($fh)))
{
array_push($files, $filename);
}
closedir($fh);
return $files;
}
}
?>
/branches/v2.0-narmer/client/projet/classes/liste_externe.class.php
New file
0,0 → 1,162
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_externe.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe liste_externe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class liste_externe
*
*/
class liste_externe
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste, dans la table agora et dans la table
* projet_lien_liste_externe
* @access private
*/
var $_id_liste;
/**
*
* @access private
*/
var $_db;
/**
* Constructeur
*
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function liste_externe(&$objetDB )
{
$this->_db = $objetDB ;
} // end of member function liste_externe
 
/**
* Renvoie un tableau avec en clé l'identifiant d'une liste et en valeur le nom de
* la liste.
*
* @return Array
* @access public
*/
function getListeNom( )
{
$requete = 'select AGO_A_ID, AGO_A_NOMGRPLG from agora' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tableau_resultat[$ligne['AGO_A_ID']] = $ligne['AGO_A_NOMGRPLG'] ;
}
return $tableau_resultat ;
} // end of member function getListeNom
 
/**
* Renvoie un tableau avec les identifiants des listes associées au projet passé en
* paramètre.
*
* @param int id_projet L'identifiant du projet
* @return Array
* @access public
*/
function getListesAssociees( $id_projet )
{
$requete = 'select plle_id_liste from projet_lien_liste_externe where plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->plle_id_liste) ;
}
return $tableau_resultat ;
} // end of member function getListesAssociees
 
/**
* enregistrerSQL
*
* @return
*/
function enregistrerSQL ($valeur, $id_projet) {
// on commence par supprimer
$requete = 'delete from projet_lien_liste_externe where plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
// puis on réinsère
foreach ($valeur as $cle => $val) {
if (!preg_match ('/liste_/', $cle)) continue ;
$id_liste = preg_replace ('/liste_/', '', $cle) ;
$requete = 'insert into projet_lien_liste_externe set plle_id_liste='.$id_liste.', plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
}
 
/**
* Renvoie un tableau avec les infos sur la liste, voir les noms des champs de la
* table agora pour une description plus détaillé.
*
* @param int id_liste L'identifiant de la liste
* @return void
* @access public
*/
function getInfoListe( $id_liste )
{
$requete = 'select * from agora where AGO_A_ID='.$id_liste ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne ;
} // end of member function getInfoListe
 
} // end of liste_externe
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/MSGTEMPLATE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/MSGTEMPLATE
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php
New file
0,0 → 1,364
<?php
// $Id: ezmlm-msgdisplay.php,v 1.4.2.1 2007-05-11 13:40:32 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
class ezmlm_msgdisplay extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
var $_auth ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
var $msgfile;
function display($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$this->msgfile = $msgfile ;
$message = file_get_contents($msgfile) ;
// En cours de codage
// La fonction display retourne tout simplement le source du mail
// Il n'y a plus d'analyse à ce niveau
return $message;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print $this->parse_entete_mail($mailDecode) ;
$this->parse_template($mailDecode, $a2, $a1);
print $this->message_rendu;
//print '</div>' ;
}
/**
* Renvoie les infos des messages suivants
*
*
*/
function getInfoSuivant() {
$relfile = preg_replace('!' . $this->listdir . '!', '', $this->msgfile);
$nom_repertoire = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile);
$nom_fichier = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile);
$repertoire_suivant = $nom_repertoire;
// a partir du nom du fichier
// et du nom du repertoire, on reconstitue
// le numero du message stocke dans le fichier d index
// le message 12 du repertoire 2 a le numero 112
if ($nom_repertoire == '0') {
$numero_message = $nom_fichier;
} else {
$numero_message = $nom_repertoire.$nom_fichier ;
}
// On ouvre le fichier d index
$fichier_index = fopen ($this->listdir.'/archive/'.$nom_repertoire.'/index', 'r');
$compteur_ligne = 1;
if (preg_match ('/0([1-9][0-9]*)/', $nom_fichier, $match)) {
$nom_fichier = $match[1];
$prefixe = '0' ;
} else {
$prefixe = '' ;
}
$prefixe = $this->prefixe_nom_message($nom_fichier);
//echo $numero_message;
// on cherche la ligne avec le numero du message
while (!feof($fichier_index)) {
$temp = fgets($fichier_index,4096);
list($num, $hash, $sujet) = split (':', $temp) ;
if ($num == $numero_message) {
$ligne_message_precedent = $compteur_ligne -2;
$temp = fgets($fichier_index, 4096);
$temp = fgets($fichier_index, 4096);
list ($fichier_suivant,$hash, $sujet) = split(':', $temp);
// Au cas ou est au dernier message du fichier d index
// il faut ouvrir le suivant
if (feof($fichier_index)) {
$repertoire_suivant++;
if (file_exists($this->listdir.'/archive/'.$repertoire_suivant.'/index')) {
$fichier_index_suivant = fopen($this->listdir.'/archive/'.$repertoire_suivant.'/index', 'r');
// on recupere le numero du premier message
list($fichier_suivant, $hash, $sujet) = split (':', fgets($fichier_index_suivant), 4096);
fclose ($fichier_index_suivant);
}
}
// Si le numero est > 100, il faut decouper et ne retenir
// que les dizaines et unites
if ($fichier_suivant >= 100) {
$decimal = (string) $fichier_suivant;
$numero = substr($decimal, -2) ;
$fichier_suivant = $numero ;
} else {
if ($fichier_suivant <= 9)$fichier_suivant = '0'.$fichier_suivant;
}
break;
}
// On avance d une ligne, la 2e ligne contient date hash auteur
$temp2 = fgets($fichier_index, 4096);
$compteur_ligne += 2;
}
// On utilise $ligne_message_precedent pour recupere le num du message precedent
// Si $ligne_precedent est negatif soit c le premier message de la liste
// soit il faut ouvrir le repertoire precedent
if ($ligne_message_precedent > 0) {
$compteur = 1;
rewind($fichier_index);
while (!feof($fichier_index)) {
$temp = fgets($fichier_index, 4096);
if ($ligne_message_precedent == $compteur) {
list ($fichier_precedent, $hash, $sujet) = split (':', $temp) ;
}
$compteur++;
}
// Le nom du repertoire precedent est le meme que le repertoire courant
$repertoire_precedent = $nom_repertoire ;
// Si $ligne_message_precedent est negatif, alors il faut ouvrir
// le fichier index du repertoire precedent
// si le nom du repertoire est 0, alors il n y a pas de repertoire precedent
// et donc pas de message precedent
} else {
if ($nom_repertoire != '0') {
$repertoire_precedent = $nom_repertoire -1 ;
// on ouvre le fichier d index et on extraie le numero
// du dernier message
$fichier_index_precedent = fopen ($this->listdir.'/archive/'.$repertoire_precedent.'/index', 'r') ;
while (!feof($fichier_index_precedent)) {
$temp = fgets($fichier_index_precedent,4096);
$ligne = split (':', $temp) ;
if ($ligne[0] != '') $fichier_precedent = $ligne[0];
$temp = fgets($fichier_index_precedent,4096);
}
fclose ($fichier_index_precedent);
// on se situe dans le repertoire 0 donc pas de message precedent
} else {
$fichier_precedent = null;
$repertoire_precedent = null;
}
}
if ($fichier_precedent > 100) {
$decimal = (string) $fichier_precedent;
$numero = substr($decimal, -2) ;
$fichier_precedent = $numero ;
} else {
if ($fichier_precedent < 10 )$fichier_precedent = '0'.$fichier_precedent;
}
fclose ($fichier_index);
//if ($fichier_precedent != null && $fichier_precedent < 10) $fichier_precedent = '0'.$fichier_precedent;
return array ('fichier_suivant' => $fichier_suivant,
'repertoire_suivant' => $repertoire_suivant,
'fichier_precedent' => $fichier_precedent,
'repertoire_precedent' => $repertoire_precedent);
}
/**
* analyse l'entete d'un mail pour en extraire les entête
* to, from, subject, date
* met à jour la variable $this->msgtmpl
*
*/
function parse_entete_mail (&$mailDecode) {
$startpos = strpos(strtolower($this->msgtmpl_entete), '<ezmlm-headers>');
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>');
$headers = substr($this->msgtmpl_entete,$startpos + 15,($endpos - $startpos - 15));
$headers_replace = '' ;
for ($i = 0; $i < count($this->showheaders); $i++) {
$val = $this->showheaders[$i];
$headers_replace .= $headers;
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>');
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19);
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value');
$headers_replace = $this->decode_iso ($headers_replace) ;
switch ($val) {
case 'date':
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20);
break;
case 'from':
if ($mailDecode->headers[strtolower($val)] == '') $from = $mailDecode->headers['return-path'] ;
else $from = $mailDecode->headers['from'];
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($from)), $hvpos, 20);
//$headers_replace = htmlspecialchars($headers_replace);
break;
default:
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($mailDecode->headers[strtolower($val)])), $hvpos, 20);
}
}
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos));
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == '8bit') {
$corps .= $this->_cte_8bit($mailDecode->parts[$i]->body);
}
break;
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname.
'&actionargs[]='.$numero_mois.
'&actionargs[]='.$numero_mail;
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='.
$numero_mois.'&actionargs[]='.
$numero_mail.'&actionargs[]='.$i.'">'.
'<img src="'.$mimeType->getCheminIcone().'" alt="'.$mailDecode->ctype_parameters['name'].'" />&nbsp;' ;
$corps .= $mailDecode->ctype_parameters['name'].'</a><br />' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body,TRUE), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . utf8_decode($this->cleanup_body($mailDecode->body,TRUE)) . '</pre>', $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . $this->cleanup_body($mailDecode->body,TRUE) . '</pre>', $this->msgtmpl);
}
}
}
}
 
function ezmlm_msgdisplay() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<pre>
<ezmlm-body>
</pre>
';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/makehash.tar.gz
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/makehash.tar.gz
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-repondre.php
New file
0,0 → 1,187
<?php
// $Id: ezmlm-repondre.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
 
class ezmlm_repondre extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
function repondre($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$message = file_get_contents($msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print '<br />'."\n";
$this->parse_template($mailDecode, $a2, $a1);
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post', str_replace('&amp;', '&', $this->forcehref).'&action=repondre&'.
'actionargs[]='.$a1.'&actionargs[]='.$a2.'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $this->message_rendu) ;
$this->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $this->message_rendu,
'mail_titre' => 'Re : '.$this->decode_iso ($mailDecode->headers['subject']))) ;
 
print $formulaireReponse->toHTML() ;
 
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '';
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
//for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
/*$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;*/
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', utf8_decode($this->cleanup_body($mailDecode->body)) , $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
}
}
}
}
 
function ezmlm_repondre() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<ezmlm-body>';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-langue-fr.php
New file
0,0 → 1,5
<?php
 
define ('FIL_DE_DISCUSSION', 'Fil de discussion') ;
 
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/calendrier_messages.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->listmessages()) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php
New file
0,0 → 1,36
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->show_recentmsgs()) {
if (!$info) {
ob_end_clean() ;
echo 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
exit();
}
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/ajout_abonne.php
New file
0,0 → 1,6
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/creation_liste.php
New file
0,0 → 1,20
<?php
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ;
 
 
// Transformation de ma chaine $parametres ((de aBud en -a -B -u -D)
$para = '' ;
for ($i = 0; $i < count ($parametres); $i++) {
$para .= '-'.$parametres.' ' ;
}
 
 
echo exec ('ezmlm-make '.$para.' '.$repertoire.' '.$fichier_qmail.' '.$liste.' '.$domaine, $output, $ret) ;
echo "\n" ;
 
echo exec ('ezmlm-reply-to '.$domaine.' '.$liste) ;
echo "\n" ;
 
 
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/message.php
New file
0,0 → 1,50
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$message = new ezmlm_msgdisplay();
if (!$message) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$message->forcehref = $url;
$message->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$message->listname = $liste;
$message->listdomain = $domaine ;
$id_rep = $actionargs[0] ;
$num_message = $actionargs[1] ;
if ($id_rep =='' || $num_message == '') exit();
 
 
$html = $message->display ($id_rep.'/'.$num_message) ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
if (!$html) {
$xml .= XML_Util::createStartElement ('erreur') ;
$xml .= 'Le message n\'existe pas';
$xml .= XML_Util::createEndElement('erreur') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
 
 
 
$xml .= XML_Util::createStartElement ('ezmlm_message', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= "\n".'<![CDATA[ '.$html.']]>';
$info_suivant = $message->getInfoSuivant() ;
$xml .= XML_Util::createStartElement ('message_suivant', array ('numero' => $info_suivant['fichier_suivant'],
'numero_repertoire' => $info_suivant['repertoire_suivant'])) ;
$xml .= XML_Util::createEndElement('message_suivant') ;
 
$xml .= XML_Util::createStartElement ('message_precedent', array ('numero' => $info_suivant['fichier_precedent'],
'numero_repertoire' => $info_suivant['repertoire_precedent'])) ;
$xml .= XML_Util::createEndElement('message_precedent') ;
$xml .= XML_Util::createEndElement('ezmlm_message') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/.htaccess
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/.htaccess
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/liste_abonnes.php
New file
0,0 → 1,75
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_abonnes.php,v 1.2.2.1 2007-05-11 09:45:35 alexandre_tb Exp $
/**
* Application projet
*
* Le service liste abonne
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/* Le service attend 2 parametres
* domaine string le nom de domaine de la liste
* liste string le nom de la liste
* renvoie string une chaine xml avec la liste des mails des inscrits
*
* <ezmlm_liste_abonnes domaine="dom" liste="list">
* <email>toto@tsdd...</email>
* <email>qsdf@fdsq ..</email>
* ...
* </ezmlm_liste_abonnes>
*/
 
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
// Les 2 parametres doivent etres present
 
if (!isset($_GET['domaine']) || !isset($_GET['liste'])) {
$xml .= XML_Util::createTag('erreur', 'Vous devez sp&eacute;cifier un domaine et une liste');
} else {
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
exec ('ezmlm-list '.$repertoire, $output, $ret) ;
$xml .= XML_Util::createStartElement ('ezmlm_liste_abonnes', array('domaine' => $domaine, 'liste' => $liste)) ;
foreach ($output as $mail) $xml .= XML_Util::createTag('email', '', $mail) ;
$xml .= XML_Util::createEndElement('ezmlm_liste_abonnes') ;
}
 
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/supprimer.php
New file
0,0 → 1,15
<?php
/**
* Supprime un message d'une liste
* Entrée domaine, liste, numero_repertoire, numero_message
*/
 
$repertoire_liste = '/home/vpopmail/domains/'.$domaine.'/'.$liste;
$message_a_supprimer = $repertoire_liste.'/archive/'.$actionargs[0].'/'.$actionargs[1] ;
 
if (file_exists ($message_a_supprimer)) {
echo $message_a_supprimer;
exec ('rm '.$message_a_supprimer) ;
exec ('ezmlm-archive -c '.$repertoire_liste);
exec ('ezmlm-idx '.$repertoire_liste);
}
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/ajout_moderateur.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste.'/mod' ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-sub '.$repertoire.' '.$mail ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/suppression_liste.php
New file
0,0 → 1,20
<?php
 
if (!isset ($domaine) || $domaine == '' || !isset($liste) || $liste == '') {
die ('manque paramètre domaine ou liste') ;
}
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ;
 
 
echo exec ('rm '.$fichier_qmail, $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-digest-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-digest-return-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-return-default', $output2, $ret2) ;
echo 'rm '.$fichier_qmail ;
echo exec ('rm -rf '.$repertoire, $output, $ret) ;
echo 'rm -rf '.$repertoire ;
 
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_auteur.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_author();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->display($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_auteur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue )) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_auteur') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/suppression_abonne.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-unsub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-unsub '.$repertoire.' '.$mail;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->show_month($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
$info->tempdir = '/home/vpopmail/www/tmp' ;
ob_start() ;
if (!$info->load($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_thread', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_thread') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-errors.def
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-errors.def
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/README
New file
0,0 → 1,131
ezmlm-php 2.0
Nov 13, 2002
http://www.unixpimps.org/software/ezmlm-php
 
ezmlm-php is a group of files written in php that allow you to fetch messages
from a ezmlm mailing list archive via a web page. It is fully customizable so
it can fit into an existing layout design very well, it is also self contained
so that you can run it with no existing site setup.
 
The new version has been rewritten from the ground up to exclude all external
dependancies (except one which comes with the source, see makehash later on)
and now implements RFC2045 MIME parsing in pure PHP.
The system is now also object based to allow greater flexibility within the
code itself, it also makes the code much more managable and readable.
 
 
INSTALLATION
~~~~~~~~~~~~
*NOTE*
The installation of ezmlm-php now requires access to a compiler to build the
included makehash program. See the MAKEHASH section at the end.
 
1. Unpack the tarball and copy the files to your webroot in the directory you
want the list to be accessed from. For example using /home/www/mailinglist
 
gzip -d ezmlm-php-2.0.tar.gz
tar xvf ezmlm-php.2.0.tar
cd /home/www/mailinglist
cp ~/ezmlm-php-2.0/*.php .
cp ~/ezmlm-php-2.0/*.def .
 
2. Build the included makehash program.
 
cd ~/ezmlm-php-2.0
gzip -d makehash.tar.gz
tar xvf makehash.tar
cd makehash
make
 
If you do not have compiler access check the binaries directory in the
makehash.tar file as there are some common binaries there. If you build
makehash on a new platform please feel free to submit the binary for
inclusion.
 
3. Move the resulting binary to your webroot.
 
4. Edit ezmlm.php and change the user configurable options. Search for
USER-CONFIG to find where to edit. See CONFIGURATION below.
 
5. Access www.yoursite.com/mailinglist to test the installation.
 
 
CONFIGURATION
~~~~~~~~~~~~~
This section will explain each variable. If you used the last version most
of these are the exact same.
 
Name Meaning
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
listdir This variable should be pointed at the root of the ezmlm
archive. For instance /usr/home/lists/ragga-jungle
 
listname The name of the list (everything before the @)
 
listdomain The domain name of the list
 
tempdir Where to store the cache files. /var/tmp should be fine
for most installations. /tmp is another choice.
 
sendheaders If set to TRUE then ezmlm will generate the nessesary
page headers. If set to FALSE your header file needs to
generate them. See 'includebefore'
 
sendbody If set to TRUE then ezmlm will generate the <body></body>
tags.
 
sendfooters If set to TRUE then ezmlm will generate the tage needed
to finish the document. If set to FALSE your footer file
needs to generate them. See 'includeafter'
 
includebefore This is a file that will be included before ezmlm-php
generates any output. You can have ezmlm-php generate
the nessesary headers (sendheaders = TRUE) and still
include a file of your own. The file is included by the
include_once function.
 
includeafter This is the exact same as includebefore except the file
is included after ezmlm-php has sent all of it's data.
 
href This is a string to prepend to the path whenever an
<a href= tag is generated. This option was added to fix
the problem of using a <base href= tag.
 
prefertype This is the mime type that you wish to send if the
current message is a multipart message. If this type isn't
found it defaults to the first part.
Some examples are: text/html, text/plain, etc...
 
showheaders This is an array of the headers to show. You can add or
remove any valid RFC822 header you wish to this array.
Some examples: X-Mailer, Message-ID
(This is case-insensitive)
 
msgtemplate This is a file to use as the message template, if blank
the internal one is used. See the file MSGTEMPLATE for
more information as it is to much to describe here.
 
tablescolours This is an array of colour hex triplets for use when a
table is generated. For each row that is generated the
next colour is used, just use a single element if you
don't want alternating colours.
(Yes there is a U in colours, the software was written
in Canada ;)
 
thread_subjlen This is an integer that tells the software how many
characters to allow the subjects when displayed in
threads or on the info page. This is useful if you
want to limit subjects to a certain length so that no
line wrapping occurs.
 
 
MAKEHASH
~~~~~~~~
So what is this little binary you need to build? Simply put it is a small
little C program to generate the nessesary ezmlm-idx hashes for cross
referencing authors. In the last version this was done by recursivley doing
a grep on the /authors directory which isn't very efficient when the list
subscriber base grows above 1000 or so. This program computes the hash by
using the same algorithim the software does and speeds things up a lot.
 
-FIN-
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/index.php
New file
0,0 → 1,19
<?php
// An even simpler version of the index page than version 1. All the actual work of
// determining what needs to be included and what needs to be run is now in the main class.
// Also, 'register_globals' doesn't need to be 'on' anymore.
 
require_once("ezmlm.php");
 
$ezmlm = new ezmlm_php();
 
$action = ($_POST['action'] ? $_POST['action'] : ($_GET['action'] ? $_GET['action'] : "list_info"));
$actionargs = ($_POST['actionargs'] ? $_POST['actionargs'] : ($_GET['actionargs'] ? $_GET['actionargs'] : ""));
 
$ezmlm->set_action($action);
$ezmlm->set_actionargs($actionargs);
$ezmlm->run();
 
unset($ezmlm);
 
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-listinfo.php
New file
0,0 → 1,189
<?php
// $Id: ezmlm-listinfo.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-listinfo.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays general list info in the format of a welcome page.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_listinfo extends ezmlm_php {
 
function ezmlm_listinfo () {
return is_dir($this->listdir.'/archive/0') ;
}
function display() {
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le répertoire 0
echo $this->listdir.'/archive/0' ;
return false ;
}
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
//$this->show_info_file();
$threads = new ezmlm_threads();
$threads->listdir = $this->listdir ;
$threads->listname = $this->listname ;
$threads->forcehref = $this->forcehref ; /// ajout alex
$threads->listmessages() ;
$this->show_recentmsgs();
return true ;
}
 
function show_info_file() {
if (@is_file($this->listdir . "/text/info")) {
$infofile = @file($this->listdir . "/text/info");
while (list($line_num, $line) = each($infofile)) {
print nl2br($line);
}
}
}
 
 
function show_recentmsgs($title = "Messages ràcents") {
if (!is_dir($this->listdir.'/archive/0')) return false;
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$recent = $parser->recent_msgs();
// le tableau recent est de la forme
// $recent[numero_message][1] sujet
// $recent[numero_message][2] date en anglais => (22 May 2006)
// $recent[numero_message][3] le hash de l auteur
// $recent[numero_message][4] auteur
$class = array ('ligne_paire', 'ligne_impaire') ;
while (list($key,$val) = each($recent)) {
print '<tr class="'.$class[$ctc].'">'."\n";
//print '<td>'.$val->nummessage.'</td>' ;
// $key contient le numero du message tel que dans les fichiers d index par ex 216
// on retrouve le nom du repertoire et le nom du fichier
$decimal = (string) $key;
if ($key >= 100) {
$fichier_message = substr($decimal, -2) ;
$repertoire_message = substr ($decimal, 0,count ($decimal) -2) ;
} else {
if ($key < 10) {
$fichier_message = '0'.$key;
} else {
$fichier_message = $decimal;
}
$repertoire_message = '0';
}
print '<td>'.$key.'</td>' ;
print '<td>';
 
$from = $val[4];
 
print $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
print "</td>\n";
print '<td><b>';
$actionargs = preg_split("/\//", $val->msgfile);
print $this->makelink("action=show_msg&actionargs[]=" . $repertoire_message .
"&actionargs[]=" . $fichier_message ,$this->decode_iso($val[1]));
 
print "</b></td>\n";
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
print '<td>'.$val[2].'</td>'."\n";
print "</tr>\n";
 
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
print '</table>'."\n";
return true;
}
function show_month ($month) {
// Le nom du fichier est annéemois ex 200501 pour janvier 2005
// on ouvre chaque fichier en lecture
$fd = file_get_contents($this->listdir . '/archive/threads/' . $month, 'r');
$fichier = explode ("\n", $fd) ;
// on récupère la première ligne
$premiere_ligne = $fichier[0] ;
$derniere_ligne = $fichier[count($fichier)-2];
preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
$numero_premier_mail = $match[0] ;
preg_match ('/[0-9]+/', $derniere_ligne, $match1) ;
$numero_dernier_mail = $match1[0] ;
// On cherche le répertoire du premier mail
$repertoire_premier_mail = (int) ($numero_premier_mail / 100) ;
// petite verification de coherence
if ($numero_premier_mail > $numero_dernier_mail) {
$temp = $numero_premier_mail;
$numero_premier_mail = $numero_dernier_mail ;
$numero_dernier_mail = $temp;
}
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$class = array ('ligne_paire', 'ligne_impaire') ;
for ($i = $numero_premier_mail, $compteur = $numero_premier_mail ; $compteur <= $numero_dernier_mail; $i++, $compteur++) {
if ($i > 99) {
$multiplicateur = (int) ($i / 100) ;
// pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100
$i = $i - $multiplicateur * 100 ;
}
if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) {
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
$mailDecode = $mimeDecode->decode() ;
if ($i == 99) {
$repertoire_premier_mail++;
$i = -1;
}
print '<tr class="'.$class[$ctc].'">'."\n";
print '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
$hash = $this->makehash($mailDecode->headers['from']);
print $this->makelink("action=show_author_msgs&actionargs[]=".
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
print "</td>\n";
print '<td><b>';
$actionargs[0] = $repertoire_premier_mail ;
$actionargs[1] = $num_message ;
if (count ($actionargs) > 1) {
print $this->makelink("action=show_msg&actionargs[]=".
$actionargs[(count($actionargs) - 2)] .
"&actionargs[]=".
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
}
print "</b></td>\n";
print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
print "</tr>\n";
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
}
print '</table>'."\n";
return true;
}
}
 
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-threads.php
New file
0,0 → 1,351
<?php
// $Id: ezmlm-threads.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Builds, maintains & displays thread caches
// These cache files live in $ezmlm->tmpdir and are serialized
// php objects that can be unserialized and displayed easily
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.php');
 
// CLASS: ezmlm_threads will build, maintain & display thread files (even if a thread is only 1 msg)
class ezmlm_threads extends ezmlm_php {
 
// load: this is the main function that should be called.
// it first checks to see if the cache files are stale, if they are it calls build
// other wise it loads them and calls display
function load($month) {
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum";
} else {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum";
}
$md5 = '' ;
if (!is_file($checksum)) {
$this->build($month);
} else {
$fd = fopen($checksum,"r");
while (!preg_match('/^md5:/', $md5)) { $md5 = fgets($fd,4096); }
fclose($fd);
$md5 = rtrim(preg_replace('/^md5:/', '', $md5), "\n");
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
$this->build($month);
}
}
$this->display($month);
}
 
// display: this loads each cache file sequentially and displays the messages in them
// there is no checking of checksum's done here so load() is the preferred method to
// view the threads
function display($month) {
$seq = 0;
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month;
} else {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month;
}
// Le lien par date et par thread
echo '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
// remplacé par le tableau globals $mois dans ezmlm.php
print '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1)] .', ' . substr($month,0,4) . '</h2>'."\n";
print '<table class="table_cadre">'."\n";
print '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
print '<tr><td colspan="3"><hr /></td></tr>'."\n";
$ctc = 0;
 
if (is_file($cache)) {
include($cache);
}
print '<tr><td colspan="3"></td></tr>'."\n";
print '</table>'."\n";
}
 
 
function thread_to_html($thread) {
$html = '';
$lastdepth = -1;
$ctc = 0 ;
$thread_curr = $thread;
$class = array ('ligne_paire', 'ligne_impaire') ;
while ($thread_curr != NULL) {
preg_match ('!/archive/([0-9]*)/([0-9]*)!', $thread_curr->file, $match) ;
if (!isset($GLOBALS['fichiers_analyses'][$match[1]][$match[2]])) {
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
//$msg = new ezmlm_parser();
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
} else {
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
}
$actionargs = preg_split("/\//", $thread_curr->file);
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
$html .= $this->makelink('action=show_author_msgs&amp;actionargs[]='.
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= '</td>'."\n";
$html .= '<td><b>';
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ?
for ($i = 0; $i < $thread_curr->depth; $i++) {
$html .= "&nbsp;&nbsp;";
}
if (($this->thread_subjlen > 0) and (strlen($this->decode_iso($mailDecode->headers['subject'])) > $this->thread_subjlen)) {
$subject = substr($this->decode_iso($mailDecode->headers['subject']), 0, ($this->thread_subjlen - 3 - ($thread_curr->depth * 2)));
$subject = $subject . "...";
} else {
$subject = $this->decode_iso($mailDecode->headers['subject']);
}
 
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$html .= $this->makelink("action=show_msg&amp;actionargs[]=" . $actionargs[2] . "&amp;actionargs[]=" . $actionargs[3], $subject);
$html .= "</b></td>\n";
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == count($this->tablecolours)) { $ctc = 0; }
 
$lastdepth = $thread_curr->depth;
$thread_curr = $thread_curr->next;
}
 
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
return $html;
}
 
// build: takes one argument in the format YYYYMM and builds the thread cache file
// for that month if the ezmlm thread file exists. The resulting cache file is then
// stored in $this->tmpdir;
function build($month) {
if (!is_file($this->listdir . "/archive/threads/" . $month)) { return FALSE; }
 
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month,"w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month,"w+");
}
fclose($fd2);
$i=0;
// ouverture du fichier thread de ezmlm
// Ils sont classés mois par mois
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
while (!feof($fd1)) {
$line = fgets($fd1,4096);
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
// valid ezmlm thread file entry
// On place dans $subjectfile le chemin vers le fichier sujet
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
 
$thread_head = NULL;
$thread_curr = NULL;
$thread_temp = NULL;
$thread_depth = 1;
 
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
// on ouvre le fichier sujet
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet
// sur les autres lignes :
// num_message:annéemois:hash_auteur nom_auteur
$fd2 = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r");
while (!feof($fd2)) {
$line2 = fgets($fd2,4096);
if (preg_match('/^[0-9]/',$line2)) {
$msgnum = preg_replace('/^([0-9]*):.*/', '\\1', $line2);
$msgfile = $msgnum % 100;
$msgdir = (int)($msgnum / 100);
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
// On stocke le fichier analysée pour réutilisation ultàrieure
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
$thread_depth = 1;
 
if ($thread_head == NULL) {
$thread_head = new ezmlm_thread(0,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
} else {
$thread_curr = new ezmlm_thread($depth,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
if ($inreply != '') { $thread_curr->inreply = $inreply; }
if ($references != '') { $thread_curr->references = $references; }
$thread_head->append($thread_curr);
}
}
}
fclose($fd2);
 
// so now after all that mess $thread_head contains a full thread tree
// first build the depth of each message based on 'in-reply-to' and 'references'
unset($thread_temp);
$thread_temp = NULL;
$thread_curr =& $thread_head->next;
while (get_class($thread_curr) == 'ezmlm_thread') {
unset($thread_temp);
$thread_temp = NULL;
 
if ($thread_curr->inreply != '') { $thread_temp =& $thread_head->find_msgid($thread_curr->inreply); }
if ($thread_temp == NULL) {
if ($thread_curr->references != '') {
$refs = preg_split('/ /', $thread_curr->references);
$refs = array_pop($refs);
$thread_temp =& $thread_head->find_msgid($refs);
}
}
if ($thread_temp == NULL) {
// we couldn't find anything... set depth to 1, the default
$thread_curr->depth = 1;
} else {
// we found a reference, set it to it's depth + 1
$thread_curr->depth = $thread_temp->depth + 1;
}
$thread_curr =& $thread_curr->next;
}
 
// now write it to a temp file named MONTH-SEQ where seq is cronologic sequence order of the thread.
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
@mkdir($this->tempdir . "/ezmlm-php-" . $this->listname, 0755);
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month, "a");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
fputs($fd2,$this->thread_to_html($thread_head));
fclose($fd2);
}
}
 
// finally store our checksum
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum","w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum","w+");
}
fputs($fd2,"md5:" . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . "\n");
fclose($fd2);
fclose($fd1);
 
return TRUE;
}
 
// listmessages: prints out a nice little calendar and displays the message
// totals for each month. The link jumps to the thread listing.
// On lit le répertoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// Présentés comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont rangés par leur numéro
function listmessages() {
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
 
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
$compteur = 0 ;
while (!feof($fichier_index)) {
// On ignore la premiere ligne
$temp = fgets($fichier_index, 4096);
// dans la seconde on recupere la date
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
$threadcount[$threadyear][$threadmonth]++;
}
}
fclose ($fichier_index);
}
}
// La partie qui suit, simple, crée la table avec le nombre de message échangé chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<td>'.$valeur.'</td>' ;
$res .=" </tr>\n";
 
while (list($key,$val) = each($threadcount)) {
$res .= " <tr>\n";
$res .= " <td>$key</td>";
for ($i = 1; $i <= 12; $i++) {
if (isset($threadcount[$key][$i]) && $threadcount[$key][$i] > 0) {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\" valign=\"middle\">";
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$key.($i < 10 ? '0'.$i:$i),$threadcount[$key][$i]);
$res .= "</td>";
} else {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\"></td>";
}
}
$res .= "</tr>\n";
}
$res .= "</table>\n";
echo $res ;
}
}
 
// CLASS: ezmlm-thread is a quick little class to allow us to define
// a structure of the current thread in a single-linked list.
// it's a little messy since php doesn't support pointers like C does
// so we have to use references and a head object to append to the list.
class ezmlm_thread {
var $next;
var $depth;
var $file;
var $msgid;
var $inreply;
var $references;
function append($thread) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
$thread_curr =& $thread_curr->next;
}
$thread_curr->next = $thread;
}
function &find_msgid($msgid) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
if (trim($thread_curr->msgid) == trim($msgid)) { return $thread_curr; }
$thread_curr =& $thread_curr->next;
}
return NULL;
}
function ezmlm_thread($depth,$file,$msgid) {
$this->depth = $depth;
$this->file = $file;
$this->msgid = $msgid;
$this->next = NULL;
}
}
?>
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-parser.php
New file
0,0 → 1,409
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* classe ezmlm_parser pour lire les fichiers d index de ezmlm-idx
*
*@package projet
//Auteur original : ?? recupere dans ezmlm-php
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
// CLASS: ezmlm-parser
class ezmlm_parser extends ezmlm_php {
var $headers; // the full untouched headers of the message
var $body; // the full untouched (but decoded) body (this is not $this->parts[0]->body)
var $parts; // all the parts, if it is a multipart message. each part is an ezmlm_parser object...
 
// Here's the most accessed headers, everything else can be
// accessed from the $this->headers array.
var $to; // To:
var $from; // From:
var $date; // Date:
var $subject; // Subject:
var $replyto; // Reply-To:
var $contenttype; // Content-Type:
 
var $multipart; // TRUE if the message is a multipart message
 
var $msgfile; // if parsed from a file, this is the filename...
 
// functions
 
/**
* recent_msgs renvoie les derniers messages de la liste de discussion
* ezmlm
*
* (
* [0] => Array
* (
* [1] => sujet
* [2] => date en anglais
* [3] => le hash de l auteur
* [4] => l auteur
* )
* [1] => ...
* )
* @param int le nombre de message a renvoye
* @return array un tableau contenant les messages
* @access public
*/
function recent_msgs($show = 20, $month = "") {
$repertoire_archive = opendir($this->listdir . "/archive/");
 
$repertoire_message = array() ;
$dernier_repertoire = 0 ;
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item;
}
}
$tableau_message = array() ;
$compteur_message = 0 ;
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ;
while (!feof($fichier_index)) {
// Recuperation du numero de message, du hash du sujet et du sujet
$temp = fgets($fichier_index, 4096);
preg_match('/([0-9]+): ([a-z]+) (.*)/', $temp, $match) ;
// dans la seconde on recupere la date, hash auteur et auteur
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([^;]+);([^ ]*) (.*)/', $temp, $match_deuxieme_ligne) ;
if ($match[1] != '') {
$tableau_message[$match[1]] = array ($match[2], $match[3],
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3],
$match_deuxieme_ligne[5],
$match_deuxieme_ligne[6]);
}
}
fclose ($fichier_index);
// on renverse le tableau pour afficher les derniers messages en premier
$tableau_message = array_reverse($tableau_message, true);
// On compte le nombre de message, s il est inferieur $show et que l on est
// pas dans le premier index, on ouvre le fichier precedent et recupere
// le n dernier message
if (count ($tableau_message) < $show && $dernier_repertoire != '0') {
$avant_dernier_repertoire = $dernier_repertoire - 1 ;
// On utilise file_get_contents pour renverser le fichier
$fichier_index = array_reverse(
explode ("\n",
preg_replace ('/\n$/', '',
file_get_contents ($this->listdir.'/archive/'.$avant_dernier_repertoire.'/index')) ), true) ;
reset ($fichier_index);
//var_dump ($fichier_index);
for ($i = count ($tableau_message); $i <= $show; $i++) {
// Recuperation du numero de message, du hash du sujet et du sujet
// dans la seconde on recupere la date, hash auteur et auteur
 
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([^;]+);([^ ]*) (.*)/',
current ($fichier_index), $match_deuxieme_ligne) ;
preg_match('/([0-9]+): ([a-z]+) (.*)/', next($fichier_index), $match) ;
next ($fichier_index);
if ($match[1] != '') {
$tableau_message[$match[1]] = array ($match[2], $match[3],
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3],
$match_deuxieme_ligne[5],
$match_deuxieme_ligne[6]);
}
}
} else {
// Si le nombre de message est > $show on limite le tableau de retour
$tableau_message = array_slice($tableau_message, 0, $show, true);
}
return $tableau_message ;
}
 
 
// parse_file - opens a file and feeds the data to parse, file can be relative to the listdir
function parse_file($file,$simple = FALSE) {
if (!is_file($file)) {
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; }
else if (is_file($this->listdir . "/archive/" . $file)) { $file = $this->listdir . "/archive/" . $file; }
else { return FALSE; }
}
 
$this->msgfile = $file;
$data = '' ;
$fd = fopen($file, "r");
while (!feof($fd)) { $data .= fgets($fd,4096); }
fclose($fd);
return $this->parse($data,$simple);
}
 
// parse_file_headers - ouvre un fichier et analyse les entête
function parse_file_headers($file,$simple = FALSE) {
if (!is_file($file)) {
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; }
else if (is_file($this->listdir . "/archive/" . $file)) { $file = $this->listdir . "/archive/" . $file; }
else { return FALSE; }
}
 
$this->msgfile = $file;
$data = file_get_contents ($file) ;
$message = file_get_contents($file) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
return $mailDecode ;
}
 
// this does all of the work (well it calls two functions that do all the work :)
// all the decoding a part breaking follows RFC2045 (http://www.faqs.org/rfcs/rfc2045.html)
function parse($data,$simple = FALSE) {
if (($this->_get_headers($data,$simple)) && $this->_get_body($data,$simple)) { return TRUE; }
return FALSE;
}
 
// all of these are internal functions, you shouldn't call them directly...
 
// _ct_parse: parse Content-Type headers -> $ct[0] = Full header, $ct[1] = Content-Type, $ct[2] ... $ct[n] = AP's
function _ct_parse() {
$instr = $this->headers['content-type'];
preg_replace('/\(.*\)/','',$instr); // strip rfc822 comments
if (preg_match('/: /', $instr)) {
$ct = preg_split('/:/',trim($instr),2);
$ct = preg_split('/;/',trim($ct[1]));
} else {
$ct = preg_split('/;/',trim($instr));
}
if (isset($ct[1])) $attrs = preg_split('/[\s\n]/',$ct[1]);
$i = 2;
$ct[1] = $ct[0];
$ct[0] = $this->headers['content-type'];
if (isset($attrs) && is_array($attrs)) {
while (list($key, $val) = each($attrs)) {
if ($val == '') continue;
$ap = preg_split('/=/',$val,2);
if (preg_match('/^"/',$ap[1])) { $ap[1] = substr($ap[1],1,strlen($ap[1])-2); }
$ct[$i] = $ap;
$i++;
}
}
// are we a multipart message?
if (preg_match('/^multipart/i', $ct[1])) { $this->multipart = TRUE; }
 
return $ct;
}
 
// _get_headers: pulls the headers out of the data and builds the $this->headers array
function _get_headers($data,$simple = FALSE) {
$lines = preg_split('/\n/', $data);
while (list($key, $val) = each($lines)) {
$val = trim($val);
if ($val == "") break;
if (preg_match('/^From[^:].*$/', $val)) continue; /* strips out any From lines added by the MTA */
 
$hdr = preg_split('/: /', $val, 2);
if (count($hdr) == 1) {
// this is a continuation of the last header (like a recieved from line)
$this->headers[$last] .= $val;
} else {
$this->headers[strtolower($hdr[0])] = $hdr[1];
//echo htmlspecialchars($this->headers['from'])."<br />" ;
$last = strtolower($hdr[0]);
}
}
// ajout alex
// pour supprimer le problème des ISO...
// a déplacer ailleur, et appelé avant affichage
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/', $this->headers['subject'], $nombre)) {
$reg_exp = $nombre[0] ;
} else {
$reg_exp = 'ISO-8859-15?' ;
}
if (preg_match ('/UTF/i', $this->headers['subject'])) $reg_exp = 'UTF-8' ;
preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $this->headers['subject'], $match, PREG_PATTERN_ORDER) ;
for ($i = 0; $i < count ($match[0]); $i++ ) {
if ($match[1][$i] == 'Q') {
$decode = quoted_printable_decode ($match[2][$i]) ;
} elseif ($match[1][$i] == 'B') {
$decode = base64_decode ($match[2][$i]) ;
}
$decode = preg_replace ("/_/", " ", $decode) ;
if ($reg_exp == 'UTF-8') {
$decode = utf8_decode ($decode) ;
}
$this->headers['subject'] = str_replace ($match[0][$i], $decode, $this->headers['subject']) ;
}
// sanity anyone?
if (!$this->headers['content-type']) { $this->headers['content-type'] = "text/plain; charset=us-ascii"; }
if (!$simple) { $this->headers['content-type'] = $this->_ct_parse(); }
 
return TRUE;
}
 
// _get_body: pulls the body out of the data and fills $this->body, decoding the data if nessesary.
function _get_body($data,$simple = FALSE) {
$lines = preg_split('/\n/', $data);
$doneheaders = FALSE;
$data = "";
while (list($key,$val) = each($lines)) {
//echo htmlspecialchars($val)."<br>";
if (($val == '') and (!$doneheaders)) {
$doneheaders = TRUE;
continue;
} else if ($doneheaders) {
$data .= $val . "\n";
}
}
 
// now here comes the fun part... decoding.
switch($this->headers['content-transfer-encoding']) {
case 'binary':
$this->body = $this->_cte_8bit($this->_cte_qp($this->_cte_binary($data)),$simple);
break;
 
case 'base64':
$this->body = $this->_cte_8bit($this->_cte_qp($this->_cte_base64($data)),$simple);
break;
 
case 'quoted-printable':
$this->body = $this->_cte_8bit($this->_cte_qp($data),$simple);
break;
 
case '8bit':
$this->body = $this->_cte_8bit($data,$simple);
break;
 
case '7bit': // 7bit doesn't need to be decoded
default: // And the fall through as well...
$this->body = $data;
break;
}
//echo $this->headers['content-type'][2][1];
if (isset($this->headers['content-type'][2][1]) && $this->headers['content-type'][2][1] == 'UTF-8') {
//$this->body = utf8_decode ($this->body) ;
//echo quoted_printable_decode(utf8_decode ($this->body)) ;
}
if ($simple) { return TRUE; }
 
// if we are a multipart message then break up the parts and decode, set the appropriate variables.
// here comes the best part about making ezmlm-php OOP. since each part is just really a little message
// in itself each part becomes a new parser object and all the wheels turn again... :)
if ($this->multipart) {
$boundary = '';
for ($i = 2; $i <= count($this->headers['content-type']); $i++) {
if (preg_match('/boundary/i', $this->headers['content-type'][$i][0])) {
$boundary = $this->headers['content-type'][$i][1];
}
}
if ($boundary != '') {
$this->_get_parts($this->body,$boundary);
} else {
// whoopps... something's not right here. we were told that the message is supposed
// to be a multipart message, yet the boundary wasn't set in the content type.
// mark the message as non multipart and add a message to the top of the body.
$this->multipart = FALSE;
$this->body = "PARSER ERROR:\nWHILE PARSING THIS MESSAGE AS A MULTIPART MESSAGE AS DEFINED IN RFC2045 THE BOUNDARY IDENTIFIER WAS NOT FOUND!\nTHIS MESSAGE WILL NOT DISPLAY CORRECTLY!\n\n" . $this->body;
}
}
 
return TRUE;
}
 
// _get_parts: breaks up $data into parts based on $boundary following the rfc specs
// detailed in section 5 of RFC2046 (http://www.faqs.org/rfcs/rfc2046.html)
// After the parts are broken up they are then turned into parser objects and the
// resulting array of parts is set to $this->parts;
function _get_parts($data,$boundary) {
$inpart = -1;
$lines = preg_split('/\n/', $data);
// La première partie contient l'avertissement pour les client mail ne supportant pas
// multipart, elle est stocké dans parts[-1]
while(list($key,$val) = each($lines)) {
if ($val == "--" . $boundary) { $inpart++; continue; } // start of a part
else if ($val == "--" . $boundary . "--") { break; } // the end of the last part
else { $parts[$inpart] .= $val . "\n"; }
}
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la première partie
$part[$i] = new ezmlm_parser();
$part[$i]->parse($parts[$i]);
$this->parts[$i] = $part[$i];
//echo $this->parts[$i]."<br>" ;
}
}
 
// _cte_8bit: decode a content transfer encoding of 8bit
// NOTE: this function is a little bit special. Since the end result will be displayed in
// a web browser _cte_8bit decodes ASCII characters > 127 (the US-ASCII table) into the
// html ordinal equivilant, it also ensures that the messages content-type is changed
// to include text/html if it changes anything...
function _cte_8bit($data,$simple = FALSE) {
if ($simple) { return $data; }
$changed = FALSE;
$chars = preg_split('//',$data);
while (list($key,$val) = each($chars)) {
if (ord($val) > 127) { $out .= '&#' . ord($val) . ';'; $changed = TRUE; }
else { $out .= $val; }
}
if ($changed) { $this->headers['content-type'][1] = 'text/html'; }
return $out;
}
 
// _cte_binary: decode a content transfer encoding of binary
function _cte_binary($data) { return $data; }
 
// _cte_base64: decode a content transfer encoding of base64
function _cte_base64($data) { return base64_decode($data); }
 
// _cte_qp: decode a content transfer encoding of quoted_printable
function _cte_qp($data) {
// For the time being we'll use PHP's function, it seems to work well enough.
return quoted_printable_decode($data);
}
}
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/TODO
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/TODO
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm-author.php
New file
0,0 → 1,72
<?php
// $Id: ezmlm-author.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-author.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays all messages by a given author
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_author extends ezmlm_php {
function display($authorhash) {
$file = "/archive/authors/" . substr($authorhash,0,2) . "/" . substr($authorhash,2,18);
//echo $file ;
if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; }
// Le fichier author comprend
// première ligne hash_auteur nom_auteur
// num_mess:annéemois:hash_sujet sujet
$fd = @fopen($this->listdir . $file, "r");
$i = 0 ;
$class = array ('ligne_impaire', 'ligne_paire') ;
while (!feof($fd)) {
$buf = fgets($fd,4096);
if (preg_match('/^' . $authorhash . '/', $buf)) {
// this should ALWAYS be the first line in the file
$author = preg_replace('/^' . $authorhash . ' /', '', $buf);
print '<h3>'.$author.'</h3>' ;
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$tableopened = TRUE;
} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) {
// si la ligne est valide
// on récupère le numéro du message pour en extraire le nom du fichier
$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf);
$msgdir = (int)((int)$msgfile / 100);
$msgfile = (int)$msgfile % 100;
 
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
 
if (!is_file($this->listdir . "/archive/" . $msgdir . "/" . $msgfile)) {
print "<!-- " . $this->listdir . "/archive/" . $msgdir . "/" . $msgfile . " -->\n";
$this->error(EZMLM_INCONSISTANCY);
fclose($fd);
return;
}
 
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile);
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
$subject = $mailDecode->headers['subject'];
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$date = preg_replace ('/CEST/', '', $mailDecode->headers['date']);
print '<tr class="'.$class[$i].'">'."\n";
if ($mailDecode->headers['from'] == '') $from = $mailDecode->headers['return-path'] ; else $from = $mailDecode->headers['from'];
$hash = $this->makehash($from);
print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($from,false)));
print '</td>';
print "<td><b>" . $this->makelink("action=show_msg&actionargs[]=" . $msgdir . "&actionargs[]=" . $msgfile, $this->decode_iso($subject)) . "</b></td>";
print "<td>" . $this->date_francaise($mailDecode->headers['date']) . "</td>\n";
print "</tr>\n";
$i++;
if ($i == 2) $i = 0 ;
unset ($mailDecode) ;
}
}
if ($tableopened) { print "</table>\n"; }
}
}
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/ezmlm.php
New file
0,0 → 1,327
<?php
// $Id: ezmlm.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm.php - ezmlm-php v2.0
// --------------------------------------------------------------
// As the site that ezmlm-php was developed for grew, and grew
// the old system used had to be bandaid fixed more, and more
// because the site started moving to an object oriented design
// for all the backend systems and ezmlm wasn't playing nice
// with the new design. So, ezmlm was redesigned too, and here
// it is.
//
// It may look a little more confusing if you're not used to
// working with objects but it actually is much more effiecient
// and organized in it's new incarnation.
// Simply edit the variables in the ezmlm-php constructor below
// just like you would with the old ezmlm-php-config.php file,
// if you're unsure howto do this check out the file CONFIG,
// then check the USAGE file for how you should include and use
// the new classes if you are integrating ezmlm-php into your
// site.
// (SEARCH FOR: USER-CONFIG to find where to edit.)
// --------------------------------------------------------------
 
require_once("ezmlm-errors.def");
require_once("ezmlm-parser.php");
require_once("ezmlm-threads.php");
require_once("ezmlm-listinfo.php");
require_once("ezmlm-msgdisplay.php");
require_once("ezmlm-repondre.php");
require_once("ezmlm-author.php");
 
$GLOBALS['mois'] = array ('Jan', 'Fév', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Dèc') ;
 
// CLASS: ezmlm_php
// the base class, contains common functions and the config
class ezmlm_php {
var $listdir; // the root directory of the list
var $listname; // the list address upto the @
var $listdomain; // the domain for the list
 
var $tempdir; // a directory in which the webserver can write cache files
 
var $sendheaders; // send generic page headers
var $sendbody; // send generic body definitions
var $sendfooters; // send generic page footers
var $includebefore; // a file to include before the content
var $includeafter; // a file to include after the content
 
var $href; // what to add before the '?param=value' in links
 
var $prefertype; // what mime type do you prefer?
var $showheaders; // what headers should we show?
 
var $msgtemplate; // the template for displaying messages (see the file TEMPLATE)
 
var $tablecolours; // what are the colours for the table rows?
 
var $thread_subjlen; // the maximum length of subjects in the thread view (0 = no limit)
 
var $forcehref; // force the base of makelink();
 
// --------- END USER CONFIGURATION ---------
 
// Internal variables
var $action = '';
var $actionargs;
 
function ezmlm_php() {
// USER-CONFIG section
// these variables act the same way ezmlm-php-config.php did in the first release
// simply edit these variables to match your setup
$this->listdir = "";
$this->listname = "";
$this->listdomain = "";
$this->tempdir = "";
 
$this->sendheaders = TRUE;
$this->sendbody = TRUE;
$this->sendfooters = TRUE;
$this->includebefore = "";
$this->includeafter = "";
 
$this->href = "";
 
$this->prefertype = "text/html";
$this->showheaders = array(
"to",
"from",
"subject",
"date"
);
$this->header_en_francais = array ('to' => 'A',
'from' => 'De',
'subject' => 'Sujet',
'date' => 'Date') ;
 
$this->msgtemplate = "<pre><ezmlm-body></pre>"; // if blank it will use the internal one
 
$this->tablecolours = array(
// delete the next line if you don't want alternating colours
"#eeeeee",
"#ffffff"
);
 
$this->thread_subjlen = 55;
 
// --- STOP EDITING HERE ---
// some sanity checking
if ((!is_dir($this->listdir . "/archive")) or
(!is_dir($this->listdir . "/archive/authors")) or
(!is_dir($this->listdir . "/archive/threads")) or
(!is_dir($this->listdir . "/archive/subjects"))) {
return false ;
/*$this->error(EZMLM_INVALID_DIR,TRUE);*/
}
}
 
function set_action($action) {
if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
$this->action = $action;
}
function set_actionargs($actionargs) {
if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
$this->actionargs = $actionargs;
}
 
function run() {
if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
 
if ($this->sendheaders) { $this->sendheaders(); }
if ($this->sendbody) { $this->sendbody(); }
if ($this->includebefore != '') { @include_once($this->includebefore); }
 
switch ($this->action) {
case "list_info":
$info = new ezmlm_listinfo();
$info->display();
break;
case "show_msg":
if (count($this->actionargs) < 2) {
$this->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$show_msg = new ezmlm_msgdisplay();
$show_msg->display($this->actionargs[0] . "/" . $this->actionargs[1]);
break;
case "show_threads":
$threads = new ezmlm_threads();
$threads->load($this->actionargs[0]);
break;
case "show_author_msgs":
$author = new ezmlm_author();
$author->display($this->actionargs[0]);
break;
}
 
if ($this->includeafter != '') { @include_once($this->includeafter); }
if ($this->sendfooters) { $this->sendfooters(); }
}
 
function sendheaders() {
print "<html><head>\n";
print "<style type=\"text/css\">\n";
print "<!--\n";
print ".heading { font-family: helvetica; font-size: 16px; line-height: 18px; font-weight: bold; }\n";
print "//-->\n";
print "</style>\n";
print "</head>\n";
}
 
function sendbody() {
print "<body>\n";
}
 
function sendfooters() {
print "</body>\n";
print "</html>\n";
}
 
// begin common functions
 
// makehash - generates an author hash using the included makehash program
function makehash($str) {
$str = preg_replace ('/>/', '', $str) ;
$handle = popen ('/usr/local/lib/safe_mode/makehash \''.$str.'\'', 'r') ;
$hash = fread ($handle, 256) ;
pclose ($handle) ;
return $hash;
}
 
// makelink - writes the <a href=".."> tag
function makelink($params,$text) {
if ($this->forcehref != "") {
$basehref = $this->forcehref;
} else {
$basehref = preg_replace('/^(.*)\?.*/', '\\1', $_SERVER['REQUEST_URI']);
}
$link = '<a href="'. $basehref . '&amp;' . $params . '">' . $text . '</a>';
return $link;
}
 
// md5_of_file - provides wrapper function that emulates md5_file for PHP < 4.2.0
function md5_of_file($file) {
if (function_exists("md5_file")) { // php >= 4.2.0
return md5_file($file);
} else {
if (is_file($file)) {
$fd = fopen($file, "rb");
$filecontents = fread($fd, filesize($file));
fclose ($fd);
return md5($filecontents);
} else {
return FALSE;
}
}
}
 
// protect_email - protects email address turns user@domain.com into user@d...
function protect_email($str,$short = FALSE) {
if (preg_match("/[a-zA-Z0-9\-\.]\@[a-zA-Z0-9\-\.]*\./", $str)) {
$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
$outstr = preg_replace("/\</", '&lt;', $outstr);
$outstr = preg_replace("/\>/", '&gt;', $outstr);
} else {
$outstr = $str;
}
 
if ($short) {
$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
$outstr = preg_replace("/[\"']/", '', $outstr);
}
return trim($outstr);
}
 
// cleanup_body: sortta like protect_email, just for message bodies
function cleanup_body($str) {
$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
return $outstr;
}
 
function error($def, $critical = FALSE) {
global $ezmlm_error;
 
print "\n\n";
print "<table width=600 border=1 cellpadding=3 cellspacing=0>\n";
print "<tr bgcolor=\"#cccccc\"><td><b>EZMLM-PHP Error: " . $ezmlm_error[$def]['title'] . "</td></tr>\n";
print "<tr bgcolor=\"#aaaaaa\"><td>" . $ezmlm_error[$def]['body'] . "</td></tr>\n";
print "</table>\n\n";
 
if ($critical) { die; }
}
/**
* Parse une chaime et supprime les problème d'encodage de type ISO-4 ...
*
* @return string
*/
function decode_iso ($chaine) {
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
$reg_exp = $nombre[0] ;
$chaine = str_replace(' ', '', $chaine);
} else {
$reg_exp = 'ISO-8859-15?' ;
}
if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER) ;
for ($i = 0; $i < count ($match[0]); $i++ ) {
if (strtoupper($match[1][$i]) == 'Q') {
$decode = quoted_printable_decode ($match[2][$i]) ;
} elseif ($match[1][$i] == 'B') {
$decode = base64_decode ($match[2][$i]) ;
}
$decode = preg_replace ("/_/", " ", $decode) ;
if ($reg_exp == 'UTF-8') {
$decode = utf8_decode ($decode) ;
}
$chaine = str_replace ($match[0][$i], $decode, $chaine) ;
}
return $chaine ;
}
/**
*
*
* @return
*/
function date_francaise ($date_mail) {
$date_mail = preg_replace ('/CEST/', '', $date_mail) ;
$numero_mois = date('m ', strtotime($date_mail)) - 1 ;
$date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
$date .= date(' Y ', strtotime($date_mail)) ; // l'année
if (date('a', strtotime($date_mail)) == 'pm') {
$date .= (int) date('g', strtotime($date_mail)) + 12 ; // Les heures
} else {
$date .= date('g', strtotime($date_mail)) ;
}
$date .= date(':i', strtotime($date_mail)) ; // Les minutes
return $date ;
}
/**
* Cette fonction renvoie le prefixe, cad 0 ou rien
* d un nom de message, ex : pour 09, on renvoie 0
* pour 12 on renvoie rien
*/
function prefixe_nom_message($nom) {
if (preg_match ('/0([1-9][0-9]*)/', $nom, $match)) {
$nom_fichier = $match[1];
return '0' ;
} else {
return '' ;
}
}
}
 
//
// --- END OF CLASS DEFINITION ---
//
 
// FIN
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/makehash
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/classes/ezmlm-php-2.0/makehash
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/classes/HTML_formulaireProjet.class.php
New file
0,0 → 1,149
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: HTML_formulaireProjet.class.php,v 1.6 2006-07-04 09:26:46 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireProjet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireProjet
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireProjet extends HTML_QuickForm
{
 
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire(&$tableau_projet, $tableau_type = '')
{
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255)) ;
$this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ;
if ($tableau_type != '') {
$select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"10")) ;
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION, array('class'=>"projet_resume", 'rows'=>"20")) ;
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet')) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = &HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1');
$this->addGroup($radio, null, PROJET_INSCRIPTION, '&nbsp;');
$label_projet = array() ;
$id_projet = array() ;
foreach ($tableau_projet as $projet) {
$label_projet[] = $projet->getTitre() ;
$id_projet[] = $projet->getId() ;
}
if (PROJET_UTILISE_HIERARCHIE) {
$select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ;
 
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
 
 
 
} // end of HTML_formulaireProjet
?>
/branches/v2.0-narmer/client/projet/classes/document.class.php
New file
0,0 → 1,658
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: document.class.php,v 1.7.2.1 2007-05-11 13:44:22 alexandre_tb Exp $
/**
* Application projet
*
* La classe document
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'fichier.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class document
* Représente un document associé à un projet. C'est à dire un fichier
* téléchargeable disposant en plus d'une visibilité, d'un nom long, d'une
* description et d'une url.
*/
class document extends fichier
{
/*** Attributes: ***/
 
/**
* Description qui apparaitra à l'écran.
* @access private
*/
var $_description;
/**
* Date de dernière mise à jour des attributs du fichier.
* @access private
*/
var $_date_mise_a_jour;
/**
* Soit public, soit privé.
* @access private
*/
var $_visibilite;
/**
* Le nom du fichier tel qu'il apparaitra à l'écran.
* @access private
*/
var $_nom_long;
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du document dans la table projet_document.
* @access private
*/
var $_id;
 
/**
*
* @access private
*/
var $_chemin_icone;
/**
* L'identifiant du père, peut être à NULL
* @access private
*/
var $_id_pere;
/**
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
* @access private
*/
var $_id_proprietaire;
/**
* L'identifiant du projet auquel appartient le document. Peut être à NULL.
* @access private
*/
var $_id_projet;
 
/**
* Le chemin du fichier, depuis le répertoire du projet
*
*/
var $_pd_lien ;
var $nom_fichier ;
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB un objet PEAR:DB
* @return void
* @access public
*/
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
{
$this->_db = $objetDB ;
$this->_chemin_icone = $chemin_icones ;
if ($id_document != "") {
$requete = "select * from projet_documents where pd_id=".$id_document ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows()>0) {
$this->nom_fichier = $ligne->pd_lien;
$this->_id_projet = $ligne->pd_ce_projet;
$this->_id = $ligne->pd_id ;
fichier::fichier($chemin.$this->getChemin(), $this->_db) ;
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
$this->_nom_long = $ligne->pd_nom ;
$this->_visibilite = $ligne->pd_visibilite ;
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
$this->_description = $ligne->pd_description ;
$this->_pd_lien = $ligne->pd_lien;
if ($this->_isRacine($ligne->pd_pere)) {
$this->_id_pere = 0 ;
} else {
$this->_id_pere = $ligne->pd_pere ;
}
}
}
} // end of member function document
 
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB Un objet PEAR:DB
* @return document
* @access public
*/
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
{
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
} // end of member function __construct
 
 
/**
* Renvoie le nom long du fichier.
*
* @return string
* @access public
*/
function getNomLong( )
{
return $this->_nom_long ;
} // end of member function getNomLong
 
/**
* Renvoie la visibilité du document, soit "public" soit "prive"
*
* @return visibilite
* @access public
*/
function getVisibilite( )
{
return $this->_visibilite ;
} // end of member function getVisibilite
 
/**
* Renvoie la description du document, sous forme de chaine.
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description ;
} // end of member function getDescription
 
/**
* Renvoie la date de création ou de mise à jour du fichier.
*
* @return date
* @access public
*/
function getDateMiseAJour( )
{
return $this->_date_mise_a_jour ;
} // end of member function getDateMiseAJour
 
/**
* Renvoie l'identifiant d'un document.
*
* @return int
* @access public
*/
function getIdDocument( )
{
return $this->_id ;
} // end of member function getIdDocument
 
/**
* Renvoie le chemin de l'icone du fichier. Fait un appel à type_fichier_mime.
*
* @return string
* @access public
*/
function getCheminIcone()
{
if ($this->isRepertoire()) {
return $this->_chemin_icone."repertoire.gif" ;
} else {
if (is_object ($this->_type_mime)) return $this->_type_mime->getCheminIcone() ;
}
} // end of member function getCheminIcone
 
/**
* Permet de récupérer le nom du répertoire racine associé à un projet.
*
* @param int id_projet L'identifiant du projet dont on veux récupérer le répertoire racine.
* @param DB objetDB Un objet PEAR:DB
* @return string
* @static
* @access public
*/
function getNomRepertoireProjet( $id_projet , &$objetDB)
{
// Dans la table projet_documents, pour les répertoires racines, pd_pere = null
$requete = "select pd_nom from projet_documents where pd_ce_projet=$id_projet and pd_pere is null" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pd_nom ;
} // end of member function getNomRepertoireProjet
 
 
/**
* Renvoie true si le document passé en paramètre est le répertoire racine.
*
* @param int id_document L'identifiant du document dont on veut savoir si c'est la racine.
* @return bool
* @access public
*/
function _isRacine( $id_document )
{
if ($id_document) {
$requete = "select pd_pere from projet_documents where pd_id=".$id_document ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows() >0) {
if ($ligne->pd_pere == null){
return true ;
}
}
}
return false ;
} // end of member function _isRacine
 
/**
* Renvoie le chemin d'un fichier ou d'un répertoire. Contrairement à la classe
* mère, cette méthode renvoie une URL projet et non pas un fichier.
*
* @return string
* @access public
*/
function getChemin($prefixe = '')
{
$chemin_repertoire_entre_racine_et_fichier = '';
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($this->_db, $this->_id_projet);
// l arborescence des repertoires
$tableau_navigation = $this->getPath($this->_id) ;
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
for ($i = 0; $i < count ($tableau_navigation); $i++) {
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
}
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
}
 
 
/**
* Renvoie pour le repertoire ou le fichier courant, les identifiants et les noms de tous les
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
* vaut "".
*
* @param int id_repertoire L'identifiant d'un répertoire.
* @return Array
* @access public
*/
function getCheminIdRepertoire( $id_doc, &$objetDB )
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0) {
if ($ligne->pd_pere == 0) {
return ; //array ($ligne->pd_pere);
}
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
}
return array_reverse($chemin_rep_id_nom);
}
function getPath( $id_doc)
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$id_doc ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0) {
if ($ligne->pd_pere == 0) {
return;
}
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
}
return $chemin_rep_id_nom;
}
/**
* Calcule le chemin vers le fichier ou le répertoire uploadé
* renvoie un chaine de la forme dir1/dir2/fichier.ext
* En prenant comme racine le répertoire du projet, exclu.
* @return string Le chemin
*/
 
function calculeCheminUploaded ($radical) {
 
if (isset($_FILES['fichier']['name'])) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
}
 
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$doc_pere = new document ($this->_id_pere, $this->_db);
return $doc_pere->getChemin();
$tableau_navigation = $this->getPath($this->_id_pere) ;
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
} else {
// Si l'on est à la racine du projet, le chemin vide
return $radical ;
}
return $chemin ;
}
 
/**
* Enregistre une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur, $chemin) {
// On teste si on a affaire à un répertoire ou un fichier
if (isset ($_FILES['fichier']['name'])) {
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
// On prend le dernier élément du tableau, si c'est un tableau
if (is_array($tableau_nom)) {
$extension = array_pop($tableau_nom) ;
$type = type_fichier_mime::factory($extension, $this->_db) ;
$id_extension = $type->getIdType() ;
} else {
$id_extension = 12 ;
}
$pd_lien = $chemin ;
} else { // Le cas ou on a affaire à un répertoire
$id_extension = 0 ;
// Le nom du répertoire est son identifiant avec un slash à la fin
$pd_lien = $chemin."/" ;
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
}
//$pd_lien .= SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
$pd_lien = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
 
$requete = "insert into projet_documents set pd_id=".$id ;
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
", pd_pere=\"$this->_id_pere\", pd_ce_type=\"$id_extension\", pd_lien=\"$pd_lien\"" ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
return $pd_lien;
}
 
function genereNouveauNom ($radical, $ancien_nom, $id) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $ancien_nom) ;
$nouveau_nom = $radical."_".$id.".".$extension ;
return $nouveau_nom;
}
 
/**
* Met à jour une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function majSQL ($valeur) {
$requete = "update projet_documents set pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW()".
" where pd_id=".$this->_id;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return ;
}
 
/** Supprime les donnéexs du document dans la table projet_documents
*
*
* @return true en cas de succès
*/
function suppressionSQL () {
$requete = 'delete from projet_documents where pd_id='.$this->_id ;
$resultat = $this->_db->query ($requete) ;
if ($this->_db->affectedRows()) return true ;
return false ;
}
/**
* Déplace un document au sein d'un même projet
*
* @param int repertoire_destination L'identifiant du répertoire destination.
* @return bool
* @access public
*/
function deplace( $repertoire_destination, $repertoire_projet )
{
 
// On récupère les informations du répertoire cible
if ($repertoire_destination != 0) {
$repertoire_cible = new document ($repertoire_destination, $this->_db) ;
$chemin_rep_cible = $repertoire_cible->getChemin();
} else {
// Si le repertoire destination est la racine cad id =0
// on cree un document qui aura pour chemin le repertoire du projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($this->_db, $this->_id_projet);
$chemin_rep_cible = $projet->getNomRepertoire().'/';
}
$nom_fichier = $this->_pd_lien ;
$requete = 'update projet_documents set pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
return false ;
}
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier) ;
} // end of member function deplace
 
 
/**
* Pour modifier l'identifiant du projet auquel appartient un document.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
} // end of member function setIdProjet
 
/**
* Permet de modifier l'identifiant du propietaire d'un projet.
*
* @param int id_proprietaire L'identifiant du proprietaire d'un document.
* @return void
* @access public
*/
function setIdProprietaire( $id_proprietaire )
{
$this->_id_proprietaire = $id_proprietaire ;
} // end of member function setIdProprietaire
 
/**
* Permet de modifier l'identifiant du répertoire d'un document.
*
* @param int id_repertoire L'identifiant du repertoire d'un document.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_pere = $id_repertoire;
} // end of member function setIdRepertoire
 
/**
* initAttributes sets all document attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_visibilite = "public";
}
 
/**
* Renvoie les derniers documents de l'ensemble des projets.
*
* @param int nombre Le nombre de document à renvoyer
* @return Array
* @static
* @access public
*/
function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
{
// on recherche les documents, hors repertoire
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$id_projet.' ';
if (!$visible) $requete .= ' and pd_visibilite="public" ';
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_document = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
} // end of member function getDocumentsRecents
 
/**
* Renvoie les documents du projet passe en parametre sous forme d arbre d objet document
*
* @param int l identifiant du projet
* @return Array
* @static
* @access public
*/
function getArbreDocument($id_projet, $objetDB = '') {
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$id_projet;
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return $resultat;
}
/**
* Renvoie la taille du document formatee avec une unite adapte
*
* @return string La taille formate
* @access public
*/
function getTailleFormatee($precision = 1) {
$taille = $this->getTaille();
if ($taille > 1000000) {
$diviseur = 1000000;
$unite = 'Mo';
} else {
$diviseur = 1000 ;
$unite = 'Ko';
}
return round ($taille / $diviseur, $precision).'&nbsp;'.$unite;
}
/**
* Renvoie une liste de document, enfant du document courant
* qui doit etre un repertoire bien sur
*
* @return mixed un tableau de document
* @access public
*/
function getDocumentsEnfant() {
}
} // end of document
 
 
?>
/branches/v2.0-narmer/client/projet/classes/projetControleur.class.php
New file
0,0 → 1,1828
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetControleur.class.php,v 1.36.2.2 2007-06-04 15:40:39 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.36.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if (isset ($GLOBALS['lang'])) {
/** le fichier de langue, par defaut PROJET_LANGUE_DEFAUT */
include_once 'client/projet/langues/pro_langue_'.$GLOBALS['lang'].'.inc.php' ;
} else {
include_once 'client/projet/langues/pro_langue_'.PROJET_LANGUE_DEFAUT.'.inc.php' ;
}
 
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
require_once GEN_CHEMIN_API.'html/HTML_TableFragmenteur.php' ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("PROJET_ACTION_COUPER", 3) ;
define ("PROJET_ACTION_MODIFIER", 4) ;
define ("PROJET_SUPPRESSION_FICHIER", 5) ;
define ("PROJET_NOUVEAU", 6) ;
define ("PROJET_NOUVEAU_V", 7) ;
define ('PROJET_MODIFIER_DESCRIPTION', 19) ;
define ('PROJET_MODIFIER_DESCRIPTION_V', 20) ;
define ("PROJET_NOUVEAU_FICHIER", 8) ;
define ("PROJET_NOUVEAU_FICHIER_V", 9) ;
define ("PROJET_NOUVEAU_REPERTOIRE", 11) ;
define ("PROJET_NOUVEAU_REPERTOIRE_V", 12) ;
define ("PROJET_SUPPRESSION_PROJET", 10) ;
define ("PROJET_ENVOYER_UN_MAIL", 13) ;
define ("PROJET_ENVOYER_UN_MAIL_V", 14) ;
define ("PROJET_ACTION_MODIFIER_V", 15) ;
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
define ('PROJET_ACTION_CREER_WIKI', 22) ;
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
define ('PROJET_ACTION_DESINSCRIPTION_PROJET', 26) ;
define ('PROJET_ACTION_INSCRIPTION_LISTE', 27) ;
define ('PROJET_ACTION_DESINSCRIPTION_LISTE', 28) ;
define ('PROJET_ACTION_REFERENCER_LISTE', 29) ;
define ('PROJET_ACTION_REFERENCER_LISTE_V', 30) ;
define ('PROJET_ACTION_COLLER', 32) ;
define ('PROJET_ACTION_ASSOCIER_WIKI', 36) ;
define ('PROJET_ACTION_ASSOCIER_WIKI_V', 37) ;
 
define ('PROJET_ACTION_VOIR_RESUME', 'resume') ;
define ('PROJET_ACTION_VOIR_DESCRIPTION', 'description') ;
define ('PROJET_ACTION_VOIR_DOCUMENT', 'documents') ;
define ('PROJET_ACTION_VOIR_FORUM', 'forums') ;
define ('PROJET_ACTION_VOIR_PARTICIPANT', 'participants') ;
define ('PROJET_ACTION_VOIR_WIKINI', 'wikini') ;
/**
* Code erreur pour l'interface projetControleur qui trouveront leur message
* correspondant via la fonction projetControleur::messageErreur()
*/
define ("PROJETCONTROLEUR_ACTION_INVALIDE", -1) ;
define ("PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE", -2) ;
define ("PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE", -3) ;
define ("PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE", -4) ;
 
/**
* Constantes pour definir les droits
*
*/
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
define ('PROJET_DROIT_COORDINATEUR', 2) ;
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
define ('PROJET_DROIT_AUCUN', 16) ;
define ('PROJET_DROIT_EN_ATTENTE', 32);
/**
* class projetControleur
* Cette classe sert a lancer les diverses applications du module projet, en
* fonction des parametre de l'URL GET ou POST. La methode principale est run()
*/
class projetControleur
{
/*** Attributes: ***/
 
/**
* Contient l'action du controleur, qui correspond a une action du module projet.
* @access private
*/
var $_action;
/**
* Une connexion a une base de donnee DB.
* @access private
*/
var $_db;
 
/**
* Un objet PEAR:Auth
* @access private
*/
var $_auth;
 
/**
*
* @access private
*/
var $_url;
 
/**
* L'identifiant du projet sur lequel on travaille. Dans l'action par defaut, cet
* attribut n'a pas de valeur.
* @access private
*/
var $_id_projet;
 
/**
* L'identifiant du repertoire que l'on est en train d'observer. Il sera passé en
* parametre a la classe HTML_listeDocuments.
* @access private
*/
var $_id_repertoire;
 
/**
* L'identifiant du fichier que l'on est en train de modifier / supprimer.
* @access private
*/
var $_id_document;
 
/**
* La presentation de la liste des projets, par defaut vide, signifie en liste.
* Valeurs possibles: arbre
* @access private
*/
var $_presentation;
 
/**
* Le type du projets, par defaut 0, signifie en pas de type particumier.
* Valeurs possibles: 0, 1, 2, 3 ...
* @access private
*/
 
var $_type ;
/**
* Le tableau des projets a ne pas afficher, ni dans l'arbre, ni dans les listes
* @access private
*/
var $_projet_exclu = array();
 
/**
* parametre indiquant le type d'inscription possible
* @access private
*/
var $_prive = 0 ;
 
/**
* parametre pour gere l appel a un service en rapport avec ajax
* @access private
*/
var $_service ;
/**
* Methode principale de la classe. Elle permet d'appeler les methodes du modules
* projet en fonction de l'action.
*
* @return string
* @access public
*/
 
 
function run( )
{
// On teste en premier la presence d un appel vers un service
if ($this->_service != '') {
if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
}
}
if ($this->_action == '') {
return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
}
 
// Si il n'y a pas d'action mais un projet, on transmet par defaut l'action PROJET_VOIR
if ($this->_id_projet != "" && $this->_action == PROJET_DEFAUT) {
$this->_action = PROJET_ACTION_VOIR_RESUME ;
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
}
if ($this->_id_document != "") {
$this->_url->addQueryString (PROJET_VARIABLE_ID_DOCUMENT, $this->_id_document) ;
}
if ($this->_id_repertoire != '') {
$this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
}
$retour = '' ;
if (!defined('PROJET_MENU_AFFICHER_CONTENU_CORPS')) $retour = $this->menuGeneral() ;
 
switch ($this->_action) {
case PROJET_DEFAUT :
$retour .= $this->mesProjets() ;
break ;
case PROJET_VOIR :
$retour .= $this->accueilProjet();
break ;
case PROJET_NOUVEAU :
$retour .= $this->formulaireProjet(PROJET_NOUVEAU_V) ;
break ;
case PROJET_NOUVEAU_V :
$retour .= $this->nouveauProjetValidation().$this->mesProjets() ;
break ;
case PROJET_NOUVEAU_FICHIER :
$retour .= $this->formulaireFichier(PROJET_NOUVEAU_FICHIER) ;
break ;
case PROJET_ACTION_MODIFIER :
$retour .= $this->formulaireFichier (PROJET_ACTION_MODIFIER) ;
break ;
case PROJET_ACTION_MODIFIER_V :
$retour .= $this->modifierFichier () ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_NOUVEAU_FICHIER_V :
$retour .= $this->nouveauFichierValidation() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_ACTION_COUPER :
$retour .= $this->fichierCouper() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_SUPPRESSION_PROJET :
$retour .= $this->suppressionProjet().$this->mesProjets() ;
break ;
case PROJET_NOUVEAU_REPERTOIRE :
$retour .= $this->nouveauRepertoire() ;
break ;
case PROJET_NOUVEAU_REPERTOIRE_V :
$retour .= $this->nouveauRepertoireValidation() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_SUPPRESSION_FICHIER :
$retour .=$this->suppressionFichier() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_ENVOYER_UN_MAIL :
$retour .= $this->envoyerUnMailFormulaire() ;
break ;
case PROJET_ENVOYER_UN_MAIL_V :
$retour .= $this->envoyerUnMailValidation() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
break ;
case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
break ;
case PROJET_MODIFIER_DESCRIPTION_V : $retour .= $this->modifierProjet() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_S_INSCRIRE : $retour .= $this->inscriptionProjet() ;
 
break ;
case PROJET_ACTION_DESINSCRIPTION_PROJET : $retour .= $this->desinscriptionProjet() ;
break ;
case PROJET_ACTION_CREER_WIKI : $retour .= $this->formulaireWiki() ;
break ;
case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_ASSOCIER_WIKI : $retour .= $this->associerWiki() ;
break ;
case PROJET_ACTION_ASSOCIER_WIKI_V : $retour .= $this->associationWiki() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_DESINSCRIPTION_LISTE : $retour .= $this->desinscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
break ;
case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
 
}
if (!is_int($this->_action)) {
if (file_exists(PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php')) {
include_once PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php' ;
}
}
return $retour ;
} // end of member function run
 
/**
* Permet de fixer la valeur de l'action pour l'objet projetControleur. Cette action
* provient generalement de $_POST['action'] ou $_GET['action']
*
* @param int action L'action à passer provient de l'URL.
* @return void
* @access public
*/
function setAction( $action )
{
$this->_action = $action ;
} // end of member function setAction
 
/**
* Permet de fixer la valeur de du service pour l'objet projetControleur. Ce service
* provient généralement de $_POST['service'] ou $_GET['service']
*
* @param int service Le service à appeler provient de l'URL.
* @return void
* @access public
*/
function setService( $service )
{
$this->_service = $service ;
} // end of member function setAction
 
 
/**
* Constructeur.
*
* @return void
* @access public
*/
function projetControleur(&$dbObjet, &$authObjet, $urlObjet = "")
{
$this->_db = $dbObjet ;
$this->_auth = $authObjet ;
$this->_id_repertoire = 0 ;
$this->_type = '' ;
if (is_object ($urlObjet)) {
$this->_url = $urlObjet ;
}
} // end of member function projetControleur
 
/**
* Renvoie la liste des projets auquel participe la personne loguée, avec son
* statut et un lien vers l'action pour gérer le projet.
*
* @return string
* @access public
*/
function mesProjets( )
{
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$participant = new participe ($this->_db) ;
 
// Les entetes des tableaux
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
 
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ; // --------------
return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
}
 
/**
* Renvoie le menu general de l'application projet. Avec differents liens selon le
* statut de l'utilisateur.
*
* @return string
* @access public
*/
function menuGeneral( )
{
$res = '' ;
$auth = $this->_auth->getAuth() ;
if (!$auth) return ;
$res .= '<div class="menu_projet">'."\n";
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
if ($participant->isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID))) {
$isAdm = 1; $isCoord = 1 ; $isContri = 1 ;
$label_statut = PROJET_ADMINISTRATEUR;
} else {
$isAdm = 0 ; $isCoord = 0 ; $isContri = 0 ;
}
 
// Les menus specifiques aux projets
if ($this->_id_projet != '') {
if (!$isCoord) {
$isCoord = $participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($isCoord) {
$label_statut = PROJET_CHEF ;
$isContri = true ;
}
}
if (!$isContri && !$isAdm) {
$isContri = $participant->isContributeur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($isContri) {
$label_statut = PROJET_VOUS_PARTICIPEZ ;
} else {
$label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
}
}
if ($participant->isEnAttente($this->_auth->getAuthData(PROJET_CHAMPS_ID),$this->_id_projet,$this->_db)) {
$isEnAttente = true ;
$label_statut = PROJET_EN_ATTENTE ;
} else {
$isEnAttente = false ;
}
}
 
if ($isContri || $isAdm) {
$res .= '<h2>' ;
if ($isAdm) $res .= PROJET_VOUS_ETES.' ' ;
$res .= $label_statut.'</h2>'."\n" ;
 
} else {
if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
}
if ($this->_id_projet != '') {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
// Participant
if (!$isEnAttente) {
$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
$res .= '<ul id="projet_groupe_niv2_con">' ;
}
if ($isCoord || $isContri) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
} else {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
if (!$isEnAttente) $res .= '<li class="projet_niv2"><a href="'.
$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
}
// L'action gerer les utilisateurs
if ($isCoord || $isAdm) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
}
$res .= '</ul></li>' ;
//document
if ($isContri || $isCoord || $isAdm) {
// On ajoute l id d un repertoire s il existe
if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
$res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
// L'action "Mettre un fichier en ligne"
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
// L'action creer un repertoire
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
$res .= '</ul></li>' ;
$this->_url->removeQueryString('id_repertoire');
// Forum
$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
$res .= '<ul id="projet_groupe_niv2_for">' ;
if ($projet->avoirListe()) {
// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
//$projet->getListesAssociees();
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
foreach ($projet->_listes_associes as $info_liste) {
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_RECEVOIR_MESSAGES ;
} else {
// L'action envoyer un mail
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a></li>'."\n" ;
$action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
$label_inscription = PROJET_NE_PAS_RECEVOIR_MESSAGES ;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">';
$res .= $label_inscription.'</a></li> ';
}
if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
$texte_liste = PROJET_SUPPRIMER_LISTE ;
$onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
}
} else {
if ($isAdm || $isCoord) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
$texte_liste = PROJET_CREER_LISTE ;
$onclic = '' ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
}
}
if ($isAdm) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
}
$res .= '</ul></li>' ;
}
// Gestion projet
if ($isCoord || $isAdm) {
$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
$res .= '<ul id="projet_group_niv2_ges">' ;
// L'action modifier les propriétés du projet
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
// L'action supprimer le projet
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
.PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
}
$res .= '</ul></li>' ;
}
// Wikini
if ($isAdm || $isCoord) {
$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
// L'action choisir un wikini
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_ASSOCIER_WIKI) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_ASSOCIER_WIKI."</a></li>\n" ;
$res .= '</ul></li>' ;
}
} else {
if ($isAdm) {
$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
$res .= '<ul>' ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$res .= '</ul></li>' ;
}
}
$res .= '</ul>' ;
$res .= "</div>\n" ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
return $res ;
} // end of member function menuGeneral
 
/**
* Renvoie le formulaire de cretion d'un projet.
*
* @return string
* @access public
*/
function formulaireProjet($action)
{
if (!$this->_auth->getAuth()) {
return PROJET_TEXTE_NON_IDENTIFIE;
}
if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
$tableau_type = '' ;
if (PROJET_UTILISE_TYPE) {
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
$tableau_type = projet_type::getTousLesTypes($this->_db) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type) ;
if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
$projet = new projet($this->_db, $this->_id_projet) ;
$valeurs_par_defaut = array ( 'projet_titre' => $projet->getTitre(),
'projet_description' => $projet->getDescription(),
'projet_asso' => $projet->getIdPere(),
'projet_wikini' => $projet->getWikini(),
'projet_resume' => $projet->getResume(),
'projet_espace_internet' => $projet->getEspaceInternet(),
'projet_type'=> $projet->getType(),
'projet_moderation' => $projet->isModere()
) ;
$formulaire_projet->setDefaults($valeurs_par_defaut) ;
} else {
$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;
}
$res = PROJET_PROPOSER_PROJET ;
return $res . $formulaire_projet->toHTML() ;
} else {
return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
}
} // end of member function nouveauProjet
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return string
* @access public
*/
function nouveauProjetValidation( )
{
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
 
$projet = new projet ($this->_db) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
return 'erreur' ;
}
// On inscrit le déposant du projet en tant que coordinateur
if (PROJET_UTILISATEURS_COORD) {
// Si le projet n'a pas de liste, on inscrit directement
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
}
} else {
return $formulaire_projet->toHTML() ;
}
}
 
/**
* Valide le formulaire et appelle la fonction de mise à jour.
*
* @return void
* @access public
*/
function modifierProjet( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
$projet->majSQL($formulaire_projet->getSubmitValues()) ;
} else {
return $formulaire_projet->toHTML() ;
}
unset ($projet) ;
}
 
/**
* Renvoie le formulaire d'upload d'un fichier.
*
* @return void
* @access public
*/
function formulaireFichier($action)
{
$res = '<h1>'.PROJET_FICHIER_MISE_EN_LIGNE.'</h1>'."\n" ;
if (isset($_SESSION['formulaire_document'])) {
unset ($_SESSION['formulaire_document']) ;
}
$action_future = $action == PROJET_NOUVEAU_FICHIER ? PROJET_NOUVEAU_FICHIER_V : PROJET_ACTION_MODIFIER_V ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $action_future) ;
if ($this->_id_repertoire != '') $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire($action) ;
if ($action == PROJET_ACTION_MODIFIER) {
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
// On affecte dans un tableau les valeurs de chaque champs du formulaire avec le nom de chaque element de formulaire
// voir HTML_formulaireDocument
$valeurs_par_defaut = array ('document_nom' => $document->getNomLong(),
'document_description' => $document->getDescription(),
'document_visibilite' => $document->getVisibilite()) ;
 
// On rajoute un champs cache avec l'identifiant du document
$formulaire_document->addElement ('hidden', 'id_document', $this->_id_document) ;
$formulaire_document->setDefaults($valeurs_par_defaut) ;
} else {
$formulaire_document->setDefaults (array ('document_visibilite'=> 'public')) ;
}
return $res.$formulaire_document->toHTML() ;
 
} // end of member function nouveauFichier
 
/**
* Presente un formulaire pour deplacer un fichier
*
*
*/
function fichierCouper() {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$res = '<h1>'.PROJET_PROJET.' : '.$projet->getTitre().'</h1>' ;
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas ou l'on vient de deplacer un fichier
 
if (isset ($_POST['projet_repertoire'])) {
if (!$document -> deplace ($_POST['projet_repertoire'], $projet->getNomRepertoire())) {
return 'echec du d&eacute;placement' ;
}
return ;
}
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireCouperColler.class.php' ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_COUPER) ;
$HTML_formulaireCouperColler = new HTML_formulaireCouperColler('formulaire_couper_coller', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireCouperColler -> construitFormulaire($projet->getListeRepertoireHierarchisee()) ;
$tab = $projet->getListeRepertoireHierarchisee();
//$res .= '<pre>'.print_r ($tab, true).'</pre>';
return $res .$HTML_formulaireCouperColler->toHTML('<img src="'.PROJET_CHEMIN_ICONES.$document->getCheminIcone().'" /> '.$document->getNomLong());
}
/**
* Supprime un fichier.
*
* @return void
* @access public
*/
function suppressionFichier( )
{
if ($this->_id_document == "") {
return $this->messageErreur(PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
$document->suppression() ;
$document->suppressionSQL() ;
// On verifie s il reste des documents associes au projet et si non on met
// a jour projet.p_avoir_document
if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false);
return ;
 
} // end of member function nouveauFichier
 
/**
* Renvoie le formulaire de creation d'un repertoire.
*
* @return void
* @access public
*/
function nouveauRepertoire( )
{
$res = '<h1>'.PROJET_REP_CREER.'</h1>'."\n" ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
$formulaire_repertoire->setDefaults (array ('document_visibilite'=> 'public')) ;
return $res.$formulaire_repertoire->toHTML() ;
 
}
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function nouveauFichierValidation( )
{
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
if (isset($_SESSION['formulaire_document']) && $_SESSION['formulaire_document'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
}
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire() ;
if ($formulaire_document->validate()) {
// Creation d'un objet document vide
$document = new document ("", $this->_db) ;
// avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numero de repertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
//$GLOBALS['log'] .= '<br>this->_id_repertoire: '.$this->_id_repertoire.'<br>';
$chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
return 'Echec de l\'upload<br />'.
'Fichier source : '. $_FILES['fichier']['name'];
'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
}
 
 
//$document->enregistrerSQL($formulaire_document->getSubmitValues(), $projet->getNomRepertoire().'/'.$chemin_upload) ;
$retour = $document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
// On ajoute une information de session
$_SESSION['formulaire_document'] = 'valide';
} else {
return $formulaire_document->toHTML() ;
}
return $retour;
unset ($projet) ;
} // end of member function nouveauFichierValidation
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function modifierFichier( )
{
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire(PROJET_ACTION_MODIFIER_V) ;
if ($formulaire_document->validate()) {
// Creation d'un objet document vide
$document = new document ($this->_id_document, $this->_db) ;
// On passe aussi le numero de répertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
$document->majSQL($formulaire_document->getSubmitValues()) ;
} else {
return $formulaire_document->toHTML() ;
}
unset ($projet) ;
} // end of member function nouveauFichierValidation
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function nouveauRepertoireValidation( )
{
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
if ($formulaire_repertoire->validate()) {
// Creation d'un objet
$document = new document ("", $this->_db) ;
// avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numero de repertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
$chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
$nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
 
// La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
$GLOBALS['log'] .= '<br />chemin_upload:'.$chemin_upload.'<br />';
$GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire)) {
 
$document->suppressionSQL() ;
return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire;
}
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
} else {
return $formulaire_repertoire->toHTML() ;
}
}
 
 
/**
* Permet de specifier au controleur sur quel projet l'on travaille.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
 
} // end of member function setIdProjet
 
/**
* Renvoie la page d'accueil d'un projet.
*
* @return string
* @access public
*/
function accueilProjet( )
{
$res = '' ;
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// recuperation de la liste des documents associés
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
 
// création de la vue liste de document, on nettoie l'url
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire) ;
 
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
 
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
 
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
 
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
 
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
}
// si chef de projet ou si propriétaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($statut > 0 || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits) ;
 
$wiki_res = '' ;
// Les wikinis associés au projet
if ($projet->getWikini()) {
$wiki_res .= '<div><a href="'.PROJET_URL_WIKINI.'wakka.php?wiki=PagePrincipale&wikini='.$projet->getWikini().'">'.PROJET_URL_WIKINI.'</a>' ;
if ($this->_auth->getAuth() && $isCoord) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_WIKI) ;
$wiki_res .= ' <a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_WIKINI_SUPPRIMER.' ?\')">'.PROJET_WIKINI_SUPPRIMER.'</a>' ;
}
$wiki_res .= '</div>' ;
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
}
// On charge les listes de discussion du projet
// Pour le moment seul ezmlm est supportée
 
$projet->getListesAssociees();
$sortie_liste = '' ;
 
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
 
$liste = new ezmlm_php() ;
// Paramétrage de la liste
 
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
 
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
 
ob_start() ;
print '<span class="heading">Liste <strong>' . $info_liste->getAdresseEnvoi() ;
print "</strong></span><br />\n";
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth) == '') {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_S_INSCRIRE ;
} else {
$action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
$label_inscription = PROJET_SE_DESINSCRIRE ;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
print '<a href="'.$this->_url->getURL().'">';
print $label_inscription.'</a><br /> ';
}
print "\n<hr noshade><br />\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
switch ($liste->action) {
case "show_msg":
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$show_msg = new ezmlm_msgdisplay();
$show_msg->listdir = $liste->listdir ;
$show_msg->forcehref = $this->_url->getURL();
// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
break;
 
case "list_info":
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $this->_url->getURL();
$info->listdir = $liste->listdir ;
$info->listname = $info_liste->getNom();
$info->listdomain = $info_liste->getDomaine() ;
 
if (!$info->display()) {
echo 'Pas de message dans cette liste' ;
}
break;
case "show_threads":
$threads = new ezmlm_threads();
$threads->forcehref = $this->_url->getURL() ;
$threads->listdir = $liste->listdir ;
$threads->listname = $info_liste->getNom() ;
$threads->listdomain = $info_liste->getDomaine() ;
$threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
$threads->load($liste->actionargs[0]);
break;
case "show_author_msgs" :
$author = new ezmlm_author();
$author->listdir = $liste->listdir ;
$author->listname = $info_liste->getNom() ;
$author->listdomain = $info_liste->getDomaine() ;
$author->forcehref = $this->_url->getURL() ;
$author->display($liste->actionargs[0]);
break ;
}
$sortie_liste = ob_get_contents() ;
ob_end_clean() ;
}
} else {
$sortie_liste = '<div>'.PROJET_PAS_DE_LISTE.'</div>'."\n" ;
}
 
$res .= "<h1>".$projet->getTitre()."</h1>" ;
$res .= '<div>'.$projet->getDescription().'</div>'."\n" ;
$res .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
$res .= $wiki_res ;
$res .= '<h2>'.PROJET_FICHIERS_ASSOCIES.'</h2>'."\n" ;
$res .= $vue_liste_document->toHTML() ;
$res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
$res .= $sortie_liste ;
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
$res .= '<h2>'.PROJET_LISTES_EXTERNES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
$res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
$res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
$res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
$res .= '<br />'."\n" ;
}
}
return $res ;
} // end of member function accueilProjet
 
/**
* Permet de specifier quel repertoire, dans la vue de document afficher. Il sera
* passe en parametre a la classe HTML_listeDocuments.
*
* @param int id_repertoire L'identifiant du repertoire a afficher.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_repertoire = $id_repertoire ;
}
 
/**
* Supprime un projet et tout ce qui va avec.
*
* @return void
* @access public
*/
function suppressionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) $projet->supprimerListe($projet->_listes_associes[0]) ;
$msg = $projet->suppressionSQL() ;
unset ($this->_id_projet) ; unset($_GET['id_projet']);
return $msg ;
}
 
/**
* Permet d'indiquer au controleur sur quel document on travaille.
*
* @param int id_document
* @return void
* @access public
*/
function setIdDocument( $id_document )
{
$this->_id_document = $id_document ;
}
 
 
/**
* Renvoie le formulaire d'envoie de mail
*
* @return void
* @access public
*/
function envoyerUnMailFormulaire( )
{
if (!$this->_auth->getAuth()) {
return PROJET_LISTE_PROJET;
}
if (isset($_SESSION['formulaire_mail'])) {
unset ($_SESSION['formulaire_mail']) ;
}
$res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
return $res.$formulaire_mail->toHTML() ;
}
 
/**
* Envoie le mail
*
* @return void
* @access public
*/
function envoyerUnMailValidation( )
{
// Verifications
if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
}
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
if ($formulaire_mail->validate()) {
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$info_liste = $projet->getListesAssociees() ;
$valeurs_mail = $formulaire_mail->getSubmitValues() ;
// Pour envoyer le mail on utilise la classe Mail de PEAR
// on a besoin du mail de l'inscrit
 
$entetes['From'] = $this->_auth->getUserName();
$entetes['To'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
$entetes['Subject'] = $valeurs_mail['mail_titre'] ;
$entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
$entetes['Message-ID'] = md5(time()).'@'.$projet->_listes_associes[0]->getNom().'.'.$projet->_listes_associes[0]->getDomaine() ;
$entetes['reply-to'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
$entetes['Content-Type'] = 'text/plain' ;
// Traitement de la reference s'il s'agit d'une reponse
if (isset ($_POST['messageid'])) {
$entetes['In-Reply-To'] = $_POST['messageid'] ;
}
$objet_mail =& Mail::factory('smtp');
$objet_mail->send($entetes['To'], $entetes, $valeurs_mail['mail_corps']);
$_SESSION['formulaire_mail'] = 'valide';
return ;
} else {
return $formulaire_mail->toHTML() ;
}
} // end of member function envoyerUnMailValidation
 
/**
* Renvoie le formulaire de création d'une liste.
*
* @param int action Indique le type d'action, PROJET_ACTION_NOUVELLE_LISTE
* @return string
* @access public
*/
function formulaireListe( $action )
{
$res = '<h1>'.PROJET_CREATION_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
$formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
$formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
return $res.$formulaire_liste->toHTML() ;
}
 
/**
* Transmet au serveur la demande de création d'une nouvelle liste.
*
* @return void
* @access public
*/
function nouvelleListeValidation( )
{
// Verifications
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
if ($formulaire_liste->validate()) {
// creation de l'objet liste_discussion
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php';
$liste = new liste_discussion('', $this->_db) ;
 
// On vérifie que le nom de la liste soit unique
if (liste_discussion::verifieDoubleListe($formulaire_liste->getSubmitValue('nom_liste').'@'.
$formulaire_liste->getSubmitValue('domaine_liste'), $this->_db)) {
// On rajoute la liste dans la base
$liste->enregistrerSQL($formulaire_liste->getSubmitValues()) ;
 
// On la relie au projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->ajouterListe($liste) ;
 
// Creation de la liste
$resultat_creation = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/creation_liste.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&parametres=aBiud') ;
 
// Ajout du moderateur
$resultat_ajout_moderateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_moderateur.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
// Ajout du moderateur en tant qu'utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
 
} else {
return PROJET_MESSAGE_LISTE_DOUBLE.$formulaire_liste->toHTML() ;
}
return $resultat_creation.$resultat_ajout_moderateur.$resultat_ajout_utilisateur;
 
} else {
return $formulaire_liste->toHTML() ;
}
} // end of member function nouvelleListeValidation
 
/**
* Supprime la liste de discussion associée au projet
*
* @return void
* @access public
*/
function supprimerListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
 
$resultat_suppression = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/suppression_liste.php?domaine='.
$projet->_listes_associes[0]->getDomaine().'&liste='.$projet->_listes_associes[0]->getNom()) ;
$projet->supprimerListe($projet->_listes_associes[0]) ;
return $resultat_suppression;
} // end of member function supprimerListe
 
 
/**
*
*
* @param string presentation Pour affecter une présentation au projet
* @return void
* @access public
*/
function setPresentation( $presentation )
{
$this->_presentation = $presentation ;
} // end of member function setPresentation
 
/**
*
*
* @param string type Pour affecter un type au projet
* @return void
* @access public
*/
function setType( $type)
{
$this->_type = $type ;
} // end of member function setPresentation
 
 
/**
* Fonction affichant les participants à un projet
*
* @return string
* @access public
*/
function voirParticipants( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$titre = '<h1>'.$projet->getTitre().'</h1>'."\n" ;
$titre .= '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise à jour de statut
if (isset($_POST['statut'])) {
// $_GET['id_utilisateur'] et $_GET['statut'] proviennent du formulaire voir HTML_listeParticipants
$participants->setStatut($_POST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
}
 
// Ce qui suit doit être amàliorà pour sortir la requête sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$participants->setStatut(3, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
$HTML_listeParticipants = new HTML_listeParticipants(true) ;
if ($statut < 2) $HTML_listeParticipants->setModeModification() ;
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$HTML_listeParticipants->setURL($this->_url) ;
// Construction de l'entete
$entete = array (PROJET_NOM, PROJET_PRENOM) ;
 
if ($this->_auth->getAuth()) {
array_push ($entete, PROJET_MAIL) ;
} else {
$droits = PROJET_DROIT_AUCUN ;
}
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
array_push ($entete, PROJET_DATE_INSCRIPTION) ;
$HTML_listeParticipants->construitEntete($entete) ;
 
$HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM_COORD, $this->_db)) ;
 
$res = $HTML_listeParticipants->toHTML() ;
 
if ($statut < 2) {
$res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form>'."\n" ;
}
} else {
$res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
}
return $titre.$res ;
 
} // end of member function voirParticipants
 
/**
* Inscrit un utilisateur a un projet avec le statut observateur
*
* @return void
* @access public
*/
function inscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireInscriptionProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// Si le projet n'a pas de liste, on inscrit directement
if (isset ($this->_id_projet)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
 
if (!$projet->avoirListe()) {
if ($projet->isModere()) {
$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
} else {
$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
}
return $this->mesProjets() ;
}
}
if (isset($_POST['valider_inscription_projet'])) {
if (isset($_POST['radio_inscription_liste'])) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
if (!$projet->isModere()) {
$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->inscrireUtilisateur( $utilisateur,
$projet->_listes_associes[0],
$_POST['radio_inscription_liste']) ;
} else {
$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
$entetes['From'] = $this->_auth->getUserName();
$entetes['To'] = '';
$entetes['Subject'] = PROJET_DEMANDE_INSCRIPTION ;
$entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
$entetes['Message-ID'] = md5(time()) ;
$entetes['reply-to'] = '' ;
$entetes['Content-Type'] = 'text/plain' ;
$objet_mail =& Mail::factory('smtp');
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le gabarit du mail est dans un template
// template 1
$requete = 'select pt_template from projet_template where pt_id_template=1'.
' and pt_i18n like "%'.PROJET_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($this->_db->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('nom', $utilisateur->getInfo( 'nom')) ;
$tpl->setVariable('prenom', $utilisateur->getInfo( 'prenom')) ;
$tpl->setVariable('nom_projet', $projet->getTitre()) ;
$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
foreach ($tableau_coordinateur as $coordinateur) {
$entetes['To'] .= $coordinateur[3]; // Le champs 3 est le mail
}
$objet_mail->send($entetes['To'], $entetes, $tpl->get());
}
}
 
if ($this->_presentation != 'arbre') {
return '<h1>'.$projet->getTitre().'</h1>'.
str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
return PROJET_LAIUS_INSCRIPTION_MODERE;
}
$res = '<h1>'.PROJET_INSCRIPTION_PROJET.' : '.$projet->getTitre().'</h1>'."\n" ;
if ($projet->avoirListe()) $res .= '<h2>'.PROJET_MESSAGE_LISTE.'</h2>'."\n" ;
//$participant = new participe($this->_db) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
$HTML_formulaireInscriptionProjet = new HTML_formulaireInscriptionProjet('inscription_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireInscriptionProjet->construitFormulaire($projet) ;
$HTML_formulaireInscriptionProjet->setDefaults(array('radio_inscription_liste' => 2)) ;
return $res.$HTML_formulaireInscriptionProjet->toHTML() ;
} // end of member function inscriptionProjet
 
/**
* Inscrit l'utilisateur loggue a la liste dont le parametre est en post.
*
* @return void
* @access public
*/
function inscriptionListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->inscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], 2) ; // 2 est la statut inscription normale
} // end of member function inscriptionListe
 
/**
* Inscrit l'utilisateur logué à la liste dont le paraître est en post.
*
* @return void
* @access public
*/
function desinscriptionListe( )
{
if (isset($_GET['inscription_liste']) || $this->_action = PROJET_ACTION_DESINSCRIPTION_LISTE) {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
'mail' => PROJET_CHAMPS_MAIL,
'table' => PROJET_ANNUAIRE)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->desinscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], $_GET['inscription_liste']) ;
}
} // end of member function inscriptionListe
/**
* desinscrit un utilisateur à un projet
*
* @return void
* @access public
*/
function desinscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
 
// Le statut 4 désinscrit l'utilisateur, dans la méthode setStatut
$participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
if ($this->_presentation != 'arbre') {
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
} // end of member function inscriptionProjet
 
/**
* Renvoie le formulaire de création d'un wiki
*
* @return void
* @access public
*/
function formulaireWiki( )
{
 
require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
 
 
$url = &$GLOBALS['_GEN_commun']['url'] ;
$url->addQueryString ('act', PROJET_ACTION_CREER_WIKI) ;
$url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$res =admin_afficherContenuCorps();
$res .= '<br /><a href="'.$this->_url->getURL().'">'.PROJET_RETOUR_RESUME.'</a>';
return $res;
 
} // end of member function formulaireWiki
 
 
function associerWiki( )
{
$res = '<h1>'.PROJET_ASSOCIER_WIKI.'</h1>'."\n" ;
 
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$res='';
 
// Comportement par défaut
// requete sur la table gen_wikini pour affichage de la liste des Wikini
$requete = "select gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
 
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
 
 
$liste = new HTML_TableFragmenteur () ;
$liste->construireEntete(array (PROJET_NOM_WIKINI,PROJET_PAGE_WIKINI, PROJET_SELECTIONNER_WIKINI)) ;
 
$tableau_wikini = array() ;
 
while ($ligne = $resultat->fetchRow()) {
$this->_url->addQueryString ('id_wikini', $ligne[0]) ;
array_push ($tableau_wikini, array ($ligne[1]."\n", // première colonne, le nom de l'application
$ligne[2]."\n", // Deuxieme colonne, la page par defaut
'<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
));
}
$liste->construireListe($tableau_wikini) ;
$res .= $liste->toHTML();
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
return $res ;
 
 
 
} // end of member function formulaireWiki
 
 
/**
* Associe un wiki au projet courant
*
* @return void
* @access public
*/
 
function associationWiki( ) {
 
 
if (isset($_GET['id_wikini'])) {
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$requete = "select gewi_code_alpha_wikini from gen_wikini where gewi_id_wikini = ".$_GET['id_wikini'] ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
 
$ligne = $resultat->fetchRow();
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet($this->_db, $this->_id_projet) ;
$projet->majNomWikini($ligne[0]);
}
 
}
 
/**
* Supprime le wiki du projet courant
*
* @return void
* @access public
*/
function supprimerWiki( )
{
include_once PROJET_CHEMIN_CLASSES.'gestion_wikini.class.php' ;
// On crée une nouvelle connexion avec les paramètres spécifiques aux wikinis
$connexion_bd = DB::connect('mysql://'.PROJET_UTILISATEUR_WIKINI.':'.PROJET_MDP_WIKINI.'@'.PROJET_HOTE_WIKINI.'/'.PROJET_DB_WIKINI) ;
$gerantWiki = new gestion_wikini($connexion_bd) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$gerantWiki->suppression_tables(strtolower($projet->getWikini())) ;
$projet->majNomWikini('') ;
} // end of member function supprimerWiki
 
/**
* Permet de lier une ou plusieurs listes de la table agora à un projet.
*
* @return string
* @access public
*/
function referencerListeExterne( )
{
$requete = 'show tables like \'agora\'' ;
$resultat = $this->_db->query ($requete);
if ($resultat->numRows() == 0) {
return 'Cette fonctionnalité n\'est pas active' ;
}
$res = '<h1>'.PROJET_REFERENCER_LISTE.'</h1>' ;
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$liste_externe = new liste_externe($this->_db) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE_V) ;
$HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
$liste_assoc = $liste_externe->getListesAssociees($this->_id_projet) ;
$default = array() ;
foreach ($liste_assoc as $val) $default['liste_'.$val] = 1 ;
 
$HTML_formulaireListeExterne->setDefaults($default) ;
return $res.$HTML_formulaireListeExterne->toHTML() ;
} // end of member function referencerListeExterne
 
/**
* Réalise les mises à jours dans la table projet_lien_liste_externe
*
* @return void
* @access public
*/
function referencerListeExterneValidation( )
{
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$liste_externe = new liste_externe($this->_db) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
$HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
 
$liste_externe->enregistrerSQL($HTML_formulaireListeExterne->getSubmitValues(), $this->_id_projet) ;
} // end of member function referencerListeExterneValidation
 
/**
* permet d'exclure un projet de l'affichage
*
* @return void
* @access public
*/
function exclure($id_projet)
{
array_push ($this->_projet_exclu, $id_projet) ;
} // end of member function exclure
 
/**
* permet d'exclure un projet de l'affichage
*
* @return void
* @access public
*/
function setPrive()
{
$this->_prive = 1 ;
} // end of member function exclure
 
 
 
/**
* Renvoie un message d'erreur, en fonction du code de l'erreur.
*
* @param int valeur Le code du message d'erreur.
* @return string
* @access public
*/
function messageErreur( $valeur )
{
$messageErreur = array (
PROJETCONTROLEUR_ACTION_INVALIDE => "Action non valide",
PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE => "Impossible de supprimer le r&eacute;pertoire",
PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
) ;
return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
} // end of member function messageErreur
 
 
 
 
} // end of projetControleur
?>
/branches/v2.0-narmer/client/projet/classes/participe.class.php
New file
0,0 → 1,363
<?php
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participe.class.php,v 1.4 2007-04-19 09:30:28 alexandre_tb Exp $
/**
* Application projet
*
* La classe partiicpe assure la jointure entre projet et Auth
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class participe
*
*/
class participe
{
/*** Attributes: ***/
 
/**
* Date d'inscription au projet de l'utilisateur.
* @access private
*/
var $_date_inscription;
/**
* Statut de l'utilisateur, un entier.
* @access private
*/
var $_statut;
/**
* Connexion à la base de donnée.
* @access private
*/
var $_db;
 
/**
* Constructeur. Nécessite un objet DB valide connecté à la base contenant les
* tables projets.
*
* @param DB objetDB Un objet PEAR:DB valide.
* @return void
* @access public
*/
function participe( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function participe
 
/**
* Renvoie la liste des inscrit à un projet avec leur statut.
*
* @return Array
* @access public
*/
function getInscrits($id_projet, $droits )
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$id_projet.' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInscrits
 
/**
* Renvoie un tableau contenant la liste des identifiants des projets et des statuts
* d'un inscrit. 0 => ['psu_id_utilisateur'] ['psu_id_statut'] 1 => ...
*
* @param int id_utilisateur Un identifiant d'utilisateur pour le champs
* projet_statut_utilisateurs:psu_id_utilisateur
* @return Array
* @access public
*/
function getIdProjetsStatuts( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
" where psu_id_utilisateur=".$id_utilisateur ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getIdProjetsStatuts
 
 
/**
* Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
* différents projets d'un utilisateur. 0 => ['p_titre'] Le titre du projet
* ['ps_label'] Le statut de l'utilisateur 1 => .... (autant que de
* projets)
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @return Array
* @access public
*/
function getInformationsUtilisateurs( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
" where psu_id_utilisateur=".$id_utilisateur.
" and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow()) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInformationsUtilisateurs
 
 
/**
* Renvoie le statut du projet passé en paramètre.
*
* @param int id_utilisateur
* @param int id_projet
* @param int dbObject
* @return int
* @static
* @access public
*/
function getStatutSurProjetCourant( $id_utilisateur, $id_projet, &$dbObject )
{
$requete = 'select psu_id_statut from projet_statut_utilisateurs'.
' where psu_id_utilisateur="'.$id_utilisateur.'" and psu_id_projet ='.$id_projet ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if (!$resultat->numRows()) {
return 4 ; // Le statut ne participe pas
}
return $ligne->psu_id_statut ;
} // end of member function getStatutSurProjetCourant
 
/**
* Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
* est administrateur de l'application projet.
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @access public
*/
function isAdministrateur( $id_utilisateur, $objetDB = "" )
{
// La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
// pour indiquer un administrateur
$requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=$id_utilisateur".
" and psu_id_projet=0" ;
if (is_object ($objetDB)) {
$resultat = $objetDB->query ($requete) ;
} else {
$resultat = $this->_db->query ($requete) ;
}
if ($resultat->numRows () != 0) {
return true;
}
return false ;
} // end of member function isAdministrateur
 
/**
* Met à jour le statut d'un utilisateur sur un projet
*
* @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
* @param int id_utilisateur Identifiant de l'utilisateur
* @param int id_projet Identifiant du projet
* @return bool
* @access public
*/
function setStatut( $id_statut, $id_utilisateur, $id_projet )
{
$requete = 'update projet_statut_utilisateurs set psu_id_statut='.$id_statut.
' where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$id_projet;
if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
$requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$id_statut.
', psu_id_utilisateur='.$id_utilisateur.',psu_id_projet='.$id_projet.
', psu_date_inscription=NOW()';
}
if ($id_statut == 4) { // Si le statut est ne participe pas, on supprime l'inscrit
$requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$id_projet ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function setStatut
 
/**
* Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
*
* @param int id_utilisateur L'identifiant d'un utilisateur
* @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
* @return bool
* @static
* @access public
*/
function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
{
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) ;
if ($statut == 1) {
return true;
}
return false ;
} // end of member function isCoordinateur
 
/**
* Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
* participe pas.
*
* @param int id_utilisateur L'identifiant de l'utilisateur.
* @return Array
* @access public
*/
function getProjetsNonParticipant( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = 'select p_id from projet'.
' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur="'.$id_utilisateur.'")' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getProjetsNonParticipant
 
/**
* Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isObservateur( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isContributeur( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isEnAttente( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie les infos sur les coordinateurs d'un projet
*
* @param int id_projet L'identifiant du projet
* @return array Un tableau contenant les infos concernants les coordinateurs du projet
* @access public
*/
function getCoordinateurs($id_projet)
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$id_projet.' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getCoordinateurs
} // end of participe
?>
/branches/v2.0-narmer/client/projet/classes/type_fichier_mime.class.php
New file
0,0 → 1,187
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: type_fichier_mime.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe type_fichier_mime
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class type_fichier_mime
*
*/
class type_fichier_mime
{
/*** Attributes: ***/
 
/**
* Le nom du type en français (ex Image jpg)
* @access private
*/
var $_nom;
/**
* L'extension du fichier (ex: png)
* @access private
*/
var $_extension;
/**
* Le nom du fichier de l'icône représentant ce fichier.
* @access private
*/
var $_icone;
/**
* Le type mime.
* @access private
*/
var $_type_mime;
/**
*
* @access private
*/
var $_description;
/**
* Le chemin UNIX ou Windows vers le dossier des icônes. Il ne commence pas par un
* slash et termine par slash.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du type dans la table gen_type_de_fichier
* @access private
*/
var $_id_type;
 
/**
* Renvoie le chemin vers les icônes.
*
* @return string
* @access public
*/
function getCheminIcone( )
{
return $this->_chemin_icone.$this->_icone ; ;
} // end of member function getCheminIcone
 
/**
*
*
* @param string chemin Le chemin vers l'icône.
* @return void
* @access public
*/
function setCheminIcone( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcone
 
/**
*
*
* @param DB objetDB un objet PEAR:DB
* @param int id_type
* @return void
* @access public
*/
function type_fichier_mime( &$objetDB, $id_type = '', $chemin_icones = "icones/" )
{
$this->_db = $objetDB ;
$requete = 'select * from gen_type_de_fichier where ' ;
if (is_numeric ($id_type)) {
$requete .= 'gtf_id_type='.$id_type ;
} else {
$requete .= 'gtf_type_mime="'.$id_type.'"' ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_chemin_icone = $chemin_icones ;
$this->_icone = $ligne->gtf_type_icone ;
$this->_id_type = $ligne->gtf_id_type ;
} // end of member function type_fichier_mime
 
/**
* Tente de renvoyer un objet type_fichier_mime à partir de l'extension passé en
* paramètre. S'il elle n'y arrive pas, elle renvoie 'inconnue'.
*
* @param string extension On passe un extension en paramètre, pour déterminer le type mime.
* @param DB objetDB un objet PEAR:DB
* @return type_fichier_mime
* @static
* @access public
*/
function factory( $extension, &$objetDB )
{
$requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return new type_fichier_mime ($objetDB, $ligne->gtf_id_type) ;
} else {
// si il n'y a pas de résultat, on renvoie inconnue
return new type_fichier_mime ($objetDB, 12) ;
}
} // end of member function factory
 
/**
* Renvoie l'identifiant du type Mime de la table gen_type_de_fichier
*
* @return int
* @access public
*/
function getIdType( )
{
return $this->_id_type;
} // end of member function getIdType
 
 
} // end of type_fichier_mime
?>
/branches/v2.0-narmer/client/projet/classes/gestion_wikini.class.php
New file
0,0 → 1,182
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: gestion_wikini.class.php,v 1.2 2005-09-27 16:38:54 alexandre_tb Exp $
/**
* Application projet
*
* La classe gestion_wikini
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class gestion_wikini
*
*/
class gestion_wikini
{
 
/*** Attributes: ***/
 
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur
*
* @param DB objetDB Une référence vers un objet PEAR:DB
* @return void
* @access public
*/
function gestion_wikini( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function gestion_wikini
 
/**
*
*
* @param string prefixe Le préfixe des tables.
* @return void
* @access public
*/
function creation_tables( $prefixe )
{
// Connection à la base de donnée de wikini
$prefixe .= '_' ;
$this->_db->query(
"CREATE TABLE ".$prefixe."pages (".
"id int(10) unsigned NOT NULL auto_increment,".
"tag varchar(50) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"body text NOT NULL,".
"body_r text NOT NULL,".
"owner varchar(50) NOT NULL default '',".
"user varchar(50) NOT NULL default '',".
"latest enum('Y','N') NOT NULL default 'N',".
"handler varchar(30) NOT NULL default 'page',".
"comment_on varchar(50) NOT NULL default '',".
"PRIMARY KEY (id),".
"FULLTEXT KEY tag (tag,body),".
"KEY idx_tag (tag),".
"KEY idx_time (time),".
"KEY idx_latest (latest),".
"KEY idx_comment_on (comment_on)".
") TYPE=MyISAM;");
$this->_db->query(
"CREATE TABLE ".$prefixe."acls (".
"page_tag varchar(50) NOT NULL default '',".
"privilege varchar(20) NOT NULL default '',".
"list text NOT NULL,".
"PRIMARY KEY (page_tag,privilege)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."links (".
"from_tag char(50) NOT NULL default '',".
"to_tag char(50) NOT NULL default '',".
"UNIQUE KEY from_tag (from_tag,to_tag),".
"KEY idx_from (from_tag),".
"KEY idx_to (to_tag)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."referrers (".
"page_tag char(50) NOT NULL default '',".
"referrer char(150) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"KEY idx_page_tag (page_tag),".
"KEY idx_time (time)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."users (".
"name varchar(80) NOT NULL default '',".
"password varchar(32) NOT NULL default '',".
"email varchar(50) NOT NULL default '',".
"motto text NOT NULL,".
"revisioncount int(10) unsigned NOT NULL default '20',".
"changescount int(10) unsigned NOT NULL default '50',".
"doubleclickedit enum('Y','N') NOT NULL default 'Y',".
"signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
"show_comments enum('Y','N') NOT NULL default 'N',".
"PRIMARY KEY (name),".
"KEY idx_name (name),".
"KEY idx_signuptime (signuptime)".
") TYPE=MyISAM");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagePrincipale', body = '".mysql_escape_string("====== Bienvenue ! sur le Wikini de ce groupe de travail ======\nEnfin, vous pourrez cliquer sur le lien \"Editer cette page\" au bas de la page pour rédiger.\n\n----\n\n\n\n\n\n\n----\n===== Pages utiles =====\n -[[TableauDeBord Tableau de bord de ce Wikini]]\n -[[ReglesDeFormatage Règles de formatage]]\n -[[BacASable Bac à sable]]")."', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DerniersChangementsPages', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentChanges}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DernierChangementCommentaires', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentlyCommented}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ParametresUtilisateur', body = '** Retour : ** [[PagePrincipale page principale]]\n----\n** Note : ** L\'idéal pour la création d\'un nom Wiki est d\'accoler son prénom et son nom de cette façon : \"PrenomNom\". \n----\n==== Mes paramètres ====\n\n{{UserSettingsCommon}}\n\n----\n==== Voir ma participation à ce Wikini ====\n\n [[MesPagesModifier Voir les pages que j\'ai modifiées ]]\n\n [[MesPagesCreer Voir les pages que j\'ai créées ]]', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagesACreer', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages à créer : ===\n\n{{WantedPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagesOrphelines', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages orphelines ===\n\n{{OrphanedPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'RechercheTexte', body = '** Retour : ** [[PagePrincipale Page principale]] > [[TableauDeBord Tableau de bord]]\n----\n{{TextSearch}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ReglesDeFormatage', body = '** Retour : ** [[PagePrincipale Page principale]]\n----\n====== Guide des règles de formatage ======\n\nLes règles de formatage avec Wakka diffèrent légèrement des autres Wikis. (Voir par exemple [[http://c2.com/cgi/wiki?TextFormattingRules les règles de formatage de WikiWikiWeb]], le premier Wiki connu.)\nTout texte placé entre deux guillemets doubles - \" - est présenté tel que.\n\nVous pouvez effectuer vos propres tests dans le BacASable : c\'est un endroit fait pour ça.\n\n=== Règles de base : ===\n \"\"**Texte en gras !** -----\"\"> **Texte en gras !**\n \"\"//Texte en italique.// -----\"\"> //Texte en italique.//\n \"\"Texte __souligné__ ! -----\"\"> Texte __souligné__ !\n \"\"##texte à espacement fixe## -----\"\"> ##texte à espacement fixe##\n \"\"%%code%%\"\"\n \"\"%%(php) PHP code%%\"\"\n\n=== Liens forcés : ===\n \"\"[[http://www.mon-site.org]]\"\"\n \"\"[[http://www.mon-site.org Mon-site]]\"\"\n \"\"[[P2P]]\"\"\n \"\"[[P2P Page sur le P2P]]\"\"\n\n=== Liens dans Wikini ===\n Pour réaliser un lien dans wikini qui apparaisse avec un style normal utilisez cette écriture :\n \"\"[[ReglesDeFormatage Règles de Formatage]]\"\"\n Le lien apparaîtra de cette manière [[ReglesDeFormatage Règles de Formatage]].\n\n=== En-têtes : ===\n \"\"====== En-tête énorme ======\"\" ====== En-tête énorme ======\n \"\"===== En-tête très gros =====\"\" ===== En-tête très gros =====\n \"\"==== En-tête gros ====\"\" ==== En-tête gros ====\n \"\"=== En-tête normal ===\"\" === En-tête normal ===\n \"\"== Petit en-tête ==\"\" == Petit en-tête ==\n\n=== Séparateur horizontal : ===\n \"\"----\"\"\n\n=== Retour de ligne forcé : ===\n \"\"---\"\"\n=== Indentation : ===\nL\'indentation de textes se fait avec la touche \"TAB\". Vous pouvez aussi créer des listes à puces ou numérotées :\n \"\"- liste à puce\"\"\n \"\"1) liste numérotée (chiffres arabes)\"\"\n \"\"A) liste numérotée (capitales alphabétiques)\"\"\n \"\"a) liste numérotée (minuscules alphabétiques)\"\"\n \"\"i) liste numérotée (chiffres romains)\"\"\n\n=== Inclure une image ===\n\n - Pour inclure un lien sur une image (sans l\'inclure à la page):\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(ne pas indiquer de texte alternatif).\n Ce qui donne : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n\n - Pour inclure une image sans indiquer de texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(laisser 3 espaces blancs avant la fermeture des crochets).\n Ce qui donne quand l\'image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n Quand l\'image n\'est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif]]\n\n - Pour inclure une image en indiquant un texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\"\"\n Ce qui donne quand l\'image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\n Quand l\'image n\'est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif une puce ]]\n\n//Note :// le texte alternatif est affiché à la place de l\'image s\'il y a une erreur lors de l\'affichage de celle-ci.\n\n=== Outils avancés : ===\n\n \"\"{{Backlinks}}\"\" permet de créer un lien vers la page précédente. \n \"\"{{Listusers}}\"\" affiche la liste des utilisateurs du site wikini.\n \"\"{{OrphanedPages}}\"\" affiche les pages orphelines du site wikini.\n \"\"{{ListPages/tree}}\"\" affiche le plan du site wikini.\n \"\"{{pageindex}}\"\" affiche un index des pages du site classées par lettres alphabétiques.\n \"\"{{ListPages}}\"\" affiche un index des pages du site avec le nom de leur propriétaire.\n \"\"{{WantedPages}}\"\" affiche la liste des pages restant à créer. Elles apparaissent dans le site avec un ? à la suite de leur nom.\n \"\"{{RecentChanges}}\"\" affiche la liste des sites faisant référence au site wikini.\n \"\"{{RecentlyCommented}}\"\" affichage de la liste des derniers commentaires.\n \"\"{{TextSearch}}\"\" recherche de texte dans les pages du site.\n\n**Note :** à cause d\'un [[http://bugzilla.mozilla.org/show_bug.cgi?id=10547 bogue dans son moteur de rendu]], les listes, utilisant la touche TAB, ne fonctionnent pas (encore) sous Mozilla.\nUne astuce consiste à réaliser une tabulation dans un éditeur de texte puis de la copier. On peut ensuite coller la tabulation dans la zone de saisie de Wikini.\nVous pouvez également indenter du texte en utilisant des caractères espace au lieu de la touche \"TAB\", les exemples ci-dessus restent valables mais attention à ne pas mélanger des \"TAB\" et des espaces dans la même énumération.\n\n---', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeUtilisateurs', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du premier au dernier.\n\n{{Listuserscommon}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeUtilisateursInverse', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du dernier au premier.\n\n{{Listuserscommon/last}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PlanDuSite', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Plan du site : ===\n\n{{ListPages/tree}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'IndexDesPages', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages : ===\n\n{{ListPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'IndexDesPagesAlphabet', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages par ordre alphabétique : ===\n\n{{pageindex}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DerniersChangementsRSS', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\nCette page renvoie au fils RSS des derniers changement. Pour savoir comment l\'utiliser voir la page \"\"<a href=\"http://www.wikini.net/wakka.php?wiki=WikiniEtLesFluxRSS\" target=\"_blank\" title=\"Wikini et les flux RSS\">Wikini et les flux RSS</a>\"\".\n\n\"\"<!--\n\n{{recentchangesrss/link=\"DerniersChangements\"}}\n\n-->\"\"', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeInterWiki', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des distributions wiki : ===\n\n{{interwikilist}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'BacASable', body = '** Retour : ** [[PagePrincipale Page pincipale]]\n----\nUtilisez cette page pour faire vos tests !', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'MesPagesModifier', body = '**Retour : ** [[ParametresUtilisateur mes paramètres ]]\n----\n{{mychanges}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'TableauDeBord', body = '** Retour : ** [[PagePrincipale Page Principale]]\n----\n===== Tableau de bord =====\n\n - Listes des utilisateurs : [[ListeUtilisateurs par ordre de création ]] ou [[ListeUtilisateursInverse par ordre inverse de création ]].\n\n - [[DerniersChangementsPages Dernières modifications sur les pages]]\n - [[DernierChangementCommentaires Dernières modifications sur les commentaires]]\n\n\n - [[PagesOrphelines Pages orphelines]]\n - [[PagesACreer Pages à créer]]\n\n - [[RechercheTexte Recherche texte]]\n\n - [[PlanDuSite Plan du site]]\n - [[IndexDesPages Index des pages avec noms des propriétaires]]\n - [[IndexDesPagesAlphabet Index des pages par classement alphabétique]]\n\n - [[DerniersChangementsRSS La page permettant le flux RSS]]\n\n - [[ListeInterWiki Liste des wiki existants ]]\n----\n==== 5 derniers comptes utilisateurs ====\n{{Listuserscommon last=\"5\"}}\n\n==== 5 dernières pages modifiées ====\n{{recentchanges max=\"5\"}}\n----', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'MesPagesCreer', body = '**Retour : ** [[ParametresUtilisateur mes paramètres ]]\n----\n{{mypages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'NomWiki', body = '** Retour : ** [[PagePrincipale Page Principale]]\n----\nUn NomWiki est un nom qui est écrit \"\"CommeCela\"\".\n\nUn NomWiki est transformé automatiquement en lien. Si la page correspondante n\'existe pas, un \'?\' est affiché à côté du mot.', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
} // end of member function creation_tables
 
/**
*
*
* @param string prefixe Le préfixe des tables à supprimer
* @return void
* @access public
*/
function suppression_tables( $prefixe )
{
$resultat = $this->_db->query("DROP TABLE ".$prefixe."_acls ,".$prefixe."_links ,".$prefixe."_pages ,".
$prefixe."_referrers ,".$prefixe."_users") ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
} // end of member function suppression_tables
 
 
 
 
 
} // end of gestion_wikini
?>
/branches/v2.0-narmer/client/projet/classes/liste_discussion.class.php
New file
0,0 → 1,291
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste_discussion.class.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* La classe liste_discussion
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
/**
* class liste_discussion
*
*/
class liste_discussion
{
 
/*** Attributes: ***/
 
/**
* Le nom de la liste, sans le domaine.
* @access private
*/
var $_nom;
/**
*
* @access private
*/
var $_adresse;
/**
* Le domaine de la liste
* @access private
*/
var $_domaine;
/**
*
* @access private
*/
var $_adresse_inscription;
/**
*
* @access private
*/
var $_adresse_desinscription;
/**
*
* @access private
*/
var $_adresse_aide;
/**
* Une connexion PEAR::DB
* @access private
*/
var $_db;
/**
* L'identifiant de la liste.
* @access private
*/
var $_id;
/**
*
* @access private
*/
var $_adresse_inscription_resume;
/**
* Indique la portée, publique ou privé de la liste
* @access private
*/
var $_portee;
/**
* Le constructeur
*
* @param int id_liste L'identifiant de la liste souhaité
* @param DB objetDB Un objet PEAR:DB
* @return void
* @access public
*/
function liste_discussion( $id_liste, & $objetDB )
{
$this->_db = $objetDB ;
if ($id_liste != '') {
$this->_id = $id_liste ;
$requete_liste = 'select * from projet_liste where pl_id_liste='.$this->_id ;
$resultat_liste = $this->_db->query ($requete_liste) ;
if (DB::isError ($resultat_liste)) {
die ("Echec de la requete : $requete_liste<br />".$resultat_liste->getMessage()) ;
}
$ligne_liste = $resultat_liste->fetchRow(DB_FETCHMODE_OBJECT) ;
$this->_adresse = $ligne_liste->pl_adresse_liste ;
$this->_domaine = $ligne_liste->pl_domaine ;
$this->_nom = $ligne_liste->pl_nom_liste ;
$this->_adresse_inscription = $ligne_liste->pl_adresse_inscription ;
$this->_adresse_inscription_resume = $ligne_liste->pl_nom_liste.'-digest-subscribe@'.$this->_domaine ;
$this->_portee = $ligne_liste->pl_visibilite ;
}
} // end of member function liste_discussion
 
 
/**
* Renvoie le domaine de la liste
*
* @return string
* @access public
*/
function getDomaine( )
{
return $this->_domaine ;
} // end of member function getDomaine
 
/**
* Renvoie le nom de la liste
*
* @return string
* @access public
*/
function getNom( )
{
return $this->_nom ;
} // end of member function getNom
 
/**
* Renvoie l'identifiant de la liste
*
* @return integer
* @access public
*/
function getId( )
{
return $this->_id ;
} // end of member function getNom
 
 
 
/**
* Enregistre une ligne dans la table projet_liste
* Le tableau de valeur doit contenir les éléments suivants 'nom_liste','','domaine_liste'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur) {
$id = SQL_obtenirNouveauId($this->_db, 'projet_liste', 'pl_id_liste') ;
 
$requete = "insert into projet_liste set pl_id_liste=".$id ;
$requete .= ", pl_nom_liste=\"".$valeur['nom_liste']."\", pl_domaine=\"".$valeur['domaine_liste']."\"".
", pl_adresse_liste=\"".$valeur['nom_liste'].'@'.$valeur['domaine_liste'].'", pl_adresse_inscription="'.
$valeur['nom_liste']."-subscribe@".$valeur['domaine_liste'].'",pl_adresse_desinscription="'.
$valeur['nom_liste']."-unsubscribe@".$valeur['domaine_liste'].'", pl_adresse_aide="'.
$valeur['nom_liste']."-help@".$valeur['domaine_liste'].'", pl_visibilite="'.$valeur['liste_visibilite'].'"' ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
$this->_domaine = $valeur['domaine_liste'] ;
$this->_nom = $valeur['nom_liste'] ;
return $id;
}
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$requete = "delete from projet_liste where pl_id_liste=".$this->_id ;
$resultat = $this->_db->query ($requete) ;
 
return true ;
} // end of member function suppressionSQL
 
/**
* Vérifie si une liste existe déjà dans la table projet_liste.
*
* @param string adresse_liste L'adresse de la liste à tester
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @static
* @access public
*/
function verifieDoubleListe( $adresse_liste, &$objetDB )
{
$requete = 'select pl_id_liste from projet_liste where pl_adresse_liste="'.$adresse_liste.'"' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows()) {
return false;
}
return true ;
} // end of member function verifieDoubleListe
 
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseEnvoi( )
{
return $this->_adresse ;
} // end of member function getAdresseEnvoi
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseInscription( )
{
return $this->_adresse_inscription ;
} // end of member function getAdresseEnvoi
 
/**
*
*
* @return string
* @access public
*/
function getAdresseResume( )
{
return $this->_adresse_inscription_resume ;
} // end of member function getAdresseResume
 
 
/**
*
*
* @return string
* @access public
*/
function isPublic( )
{
return $this->_portee ;
} // end of member function getAdresseResume
 
 
 
 
 
 
 
} // end of liste_discussion
?>
/branches/v2.0-narmer/client/projet/classes/statut.class.php
New file
0,0 → 1,138
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: statut.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
define ('PROJET_STATUT_TOUS', 1) ;
define ('PROJET_STATUT_SAUF_ADM', 2) ;
define ('PROJET_STATUT_SAUF_ADM_COORD', 3) ;
 
/**
* class statut
*
*/
class statut
{
 
/** Aggregations: */
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du statut
* @access private
*/
var $_id_statut;
/**
* Le label du statut, dans la table.
* @access private
*/
var $_label;
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur.
*
* @param int id_statut L'identifiant du statut créé.
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function statut( $id_statut, &$objetDB )
{
$requete = "select * from projet_statut where ps_id_statut=$id_statut" ;
$resultat = $objetDB->query ($requete) ;
if (PEAR::isError ($resultat)) {
die ($resultat->getMessage()."<br />".$requete."<br />") ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_db = $objetDB ;
$this->_id_statut = $ligne->pd_id_statut ;
$this->_label = $ligne->ps_statut_nom;
} // end of member function statut
 
/**
* Renvoie le label du statut.
*
* @return string
* @access public
*/
function getLabel( )
{
return $this->_label ;
} // end of member function getLabel
/**
*
*
* @param int type_statut Indique quels statuts l'on désire voir retourner PROJET_STATUT_TOUS
* PROJET_STATUT_SAUF_ADM PROJET_STATUT_SAUF_ADM_COORD
* @return Array
* @static
* @access public
*/
function getTousLesStatuts( $type_statut = PROJET_STATUT_TOUS, &$objetDB)
{
$requete = 'select * from projet_statut' ;
if ($type_statut == PROJET_STATUT_SAUF_ADM) {
$requete .= ' where ps_id_statut <> 0' ;
}
if ($type_statut == PROJET_STATUT_SAUF_ADM_COORD) {
$requete .= ' where ps_id_statut > 1' ;
}
$resultat = $objetDB->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->ps_id_statut] = $ligne->ps_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
 
 
 
 
} // end of statut
?>
/branches/v2.0-narmer/client/projet/classes/statut_liste.class.php
New file
0,0 → 1,100
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: statut_liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/**
* class statut_liste
*
*/
class statut_liste
{
/*** Attributes: ***/
 
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
*
* @access private
*/
var $_id_statut;
/**
*
* @access private
*/
var $_label;
 
/**
*
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function statut_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function statut_liste
 
/**
* Renvoie un tableu avec tous les status d'inscription à une liste 0 => 'Pas
* d'email' 1 => ' ...
*
* @return Array
* @access public
*/
function getTousLesStatuts( )
{
$requete = 'select * from projet_liste_statut' ;
$resultat = $this->_db->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pls_id_statut] = $ligne->pls_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
} // end of statut_liste
?>
/branches/v2.0-narmer/client/projet/projet.desinscription.inc.php
New file
0,0 → 1,70
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.desinscription.inc.php,v 1.2 2006-04-19 13:52:54 alexandre_tb Exp $
/**
* Inscription
*
* Le fichier de désinscription de projet, appelé par l'inscription
* en cas de désinscription d'un utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// On récupère id_utilisateur, l'identifiant de la personne qui se désinscrit
// On se trouve dans la fonction afficherContenuCorps de inscription.php
 
 
 
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
 
// On boucle sur chaque projet et on désinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// Le statut 4 désinscrit l'utilisateur, dans la méthode setStatut
$participant->setStatut(4, $id_utilisateur, $projet->getId()) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($id_utilisateur) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($GLOBALS['ins_db']) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
 
 
?>
/branches/v2.0-narmer/client/projet/langues/pro_langue_en.inc.php
New file
0,0 → 1,150
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_en.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2004 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_en.inc.php,v 1.3 2005-09-28 16:29:39 ddelon Exp $
*/
 
 
// ========== Partie concernant la description su projet =================================
define ("PROJET_ALERTE_TITRE", "The title field must be filled in") ;
define ("PROJET_DECONNEXION", "Sign off") ;
define ("PROJET_ADMINISTRATION", "Administration") ;
define ("PROJET_ADMINISTRATEUR", "Administrator") ;
define ("PROJET_NOUVEAU_PROJET", "New project") ;
define ("PROJET_DESTRUCTION_PROJET", "Cancel a project") ;
define ("PROJET_GESTION_UTILISATEUR", "Users administration") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "New user") ;
define ("PROJET_MOD_UTILISATEUR", "User modification") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Delete a user") ;
define ("PROJET_GERER", "Administrate") ;
define ("PROJET_GERER_FICHIER", "Files administration") ;
define ("PROJET_VOIR_PROJET", "To see the project") ;
define ("PROJET_VOIR_FICHIER", "See files") ;
define ("PROJET_PRENOM", "First name") ;
define ("PROJET_MAIL", "E-mail") ;
define ("PROJET_LABEL_PAYS", "Country") ;
define ("PROJET_DATE_INSCRIPTION", "Registration date") ;
define ("PROJET_STATUT", "Status") ;
define ("PROJET_CHEF", "Coordinator") ;
define ("PROJET_PAS_D_INSCRIT", "No registered user") ;
define ("PROJET_PARTICIPER", "Projects you are participating in") ;
define ("PROJET_VOUS_PARTICIPEZ", "you are participating in") ;
define ("PROJET_TOUS", "all projects.") ;
define ("PROJET_PROJETS", "projects") ;
define ("PROJET_VOTRE_STATUT", "Your status") ;
define ("PROJET_ACTION", "Action") ;
define ("PROJET_DESTRUCTION_LAIUS", "The cancellation of a project implies the end of all the rights of its".
"users, as well as the links with other projects.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Cancellation done") ;
define ("PROJET_GESTION_PROJET", "Project administration") ;
define ("PROJET_EN_TANT_QUE", "As") ;
define ("PROJET_INTERVENIR", "You can take part in the following items") ;
define ("PROJET_PROPRIETES", "Project ownership") ;
define ("PROJET_SELECTIONNER", "Select a target directory") ;
define ("PROJET_PB_COPIE", "A problem has been encountered while copying") ;
define ("PROJET_RETABLISSEMENT", "Restoration of the data base") ;
define ("PROJET_RETBLISSEMENT_EFFECTUE", "Restoration done. You can try again.") ;
define ("PROJET_METTRE_FICHIER", "Publish a file on line") ;
define ("PROJET_CREER_REP", "Create a directory") ;
define ("PROJET_FICHIERS_ASSOCIES", "Files associated to this project") ;
define ("PROJET_FICHIERS_NOM", "Name") ;
define ("PROJET_FICHIERS_CREE_LE", "Created on the") ;
define ("PROJET_FICHIERS_PAR", "By") ;
define ("PROJET_FICHIERS_TAILLE", "Size") ;
define ("PROJET_RACINE", "Usenet hierarchy") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibility") ;
define ("PROJET_FICHIERS_ACTION", "Action") ;
define ("PROJET_LEGENDE", "Legend") ;
define ("PROJET_LEGENDE_DEPLACE", "Move a file") ;
define ("PROJET_LEGENDE_MODIFIE", "Modify the informations of a document") ;
define ("PROJET_LEGENDE_SUPPR", "Delete a file") ;
 
define ("PROJET_EMAIL", "E-mail") ;
define ("PROJET_MOT_DE_PASSE", "Password") ;
define ("PROJET_TEXTE_PERDU", "If you forgot your password, enter your e-mail address in the Login ".
"field below and click on Validate");
 
 
// ========== Partie concernant l'upload de fichier =================================
 
define ("PROJET_DOCUMENT_DU_PROJET", "Project document") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Publish a file online, step 1") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Name of the document") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Enter an explicit name since it will correspond to the text giving ".
"access to the file with a click.") ;
define ("PROJET_FICHIER_DESCRIPTION", "Description") ;
define ("PROJET_FICHIER_PUBLIC", "All type of users") ;
define ("PROJET_FICHIER_PRIVEE", "Project only") ;
define ("PROJET_FICHIER_LE_FICHIER", "The file") ;
define ("PROJET_FICHIER_CONTINUER", "Continue") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE_2", "Publish a file online, step 2") ;
define ("PROJET_FICHIER_LABEL", "Label") ;
define ("PROJET_FICHIER_TYPE", "Type") ;
define ("PROJET_FICHIER_TRANSFERT_T", "File transfer done...") ;
define ("PROJET_FICHIER_VALIDER", "Validate") ;
define ("PROJET_FICHIER_MODIFIER", "MODIFY-") ;
define ("PROJET_FICHIER_COLLER", "PASTE") ;
define ("", "CANCEL") ;
 
// Directory creation
define ("PROJET_REP", "Project directory") ;
define ("PROJET_REP_CREER", "Creation of a new directory") ;
define ("PROJET_REP_MODIFIER", "Modification of a directory") ;
define ("PROJET_REP_SUPPRIMER", "Are you sure you want to delete this directory.") ;
 
// ========== Partie concernant les wikini ===========================================
 
define ('PROJET_ASSOCIER_WIKI', 'Associer un wikini') ;
define ("PROJET_WIKINI_POSSEDE", "This project has a wiki site") ;
define ("PROJET_WIKINI_ALLER", "Go on the wiki site") ;
define ("PROJET_WIKINI_SUPPRIMER", "Supress wiki ") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Choose a name for the wiki") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "The name has to be in wiki format, this means without accents, without ".
"spaces and with at least two capital letters. ex MyProject.") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "This is not a valid wiki name") ;
define ("PROJET_WIKINI_NOM_EXISTE", "This wiki name already exists!") ;
define ("PROJET_LISTE_PARTICIPANT", "Participants list") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "As project manager you are allowed to modify the status of the ".
"participants or unsubscribe them if necessary.<br /> ".
"Attention! this action can have some consequences...<br /> ".
"As project manager, you cannot modify your own status. If you wish to ".
"leave this function, ask the system administrator. &nbsp;&nbsp; ");
define ("PROJET_DESINSCRIRE_SUR", "Are you sure you want to unsubscribe?") ;
 
// ========== Labels pour projet_liste ===========================================
 
define ("PROJET_LISTE", "Projects list") ;
define ("PROJET_NOMBRE_EN_COURS", "Number of projects in progress") ;
 
// ========== Labels pour projet_inscription ===========================================
define ("PROJET_PROJET", "Project") ;
define ("PROJET_VOTRE_STATUT", "Your status") ;
define ("BAZ_EST_INSCRIT_COMME", "is registered as") ;
define ("BAZ_PAS_INSCRIT", "is not registered for this project") ;
define ("BAZ_JE_SOUHAITE", "I want to be a member of the project's team") ;
define ("BAZ_INSCRIT_CONTRIBUTEUR", "I want to be an active member in this project") ;
define ("BAZ_INSCRIT_OBSERVATEUR", "I want to be an observer in this project") ;
define ("BAZ_LAIUS_CONTRIBUTEUR", "Active members work in collaboration with the project manager and with members of the team. They appear as co-author of resulting achievements.") ;
define ("BAZ_LAIUS_OBSERVATEUR", "If you do not have the opportunity or skills to be an active member, you can still register as an observer in order to bring your own personal remarks throughout the steps of the project. However you will not be considered as co-author.") ;
define ("BAZ_INSCRIT_SUPPRIMER", "I don't want to be part of the project team") ;
define ("BAZ_LAIUS_DESINSCRIPTION", "You do not wish to be part of the project team. You can still register in the future.") ;
define ("BAZ_VALIDER", "Update changes") ;
define ("BAZ_ANNULER", "Cancel") ;
define ("BAZ_RETOUR_LISTE", "Back to project list") ;
 
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire à un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_1", "La personne avec le mail suivant :\n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_2", "\nsouhaite s'inscrire au projet : \n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez modérer cette inscription.") ;
define ("BAZ_DEMANDE_INSCRIPTION_PRISE_EN_COMPTE", "Votre demande d'inscription a &eacute;t;&eacute; transmise aux coordinateurs du projet") ;
?>
 
/branches/v2.0-narmer/client/projet/langues/pro_langue_pt.inc.php
New file
0,0 → 1,150
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_en.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2004 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_pt.inc.php,v 1.3 2005-09-28 16:29:39 ddelon Exp $
*/
 
 
// ========== Partie concernant la description su projet =================================
define ("PROJET_ALERTE_TITRE", "The title field must be filled in") ;
define ("PROJET_DECONNEXION", "Sign off") ;
define ("PROJET_ADMINISTRATION", "Administration") ;
define ("PROJET_ADMINISTRATEUR", "Administrator") ;
define ("PROJET_NOUVEAU_PROJET", "New project") ;
define ("PROJET_DESTRUCTION_PROJET", "Cancel a project") ;
define ("PROJET_GESTION_UTILISATEUR", "Users administration") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "New user") ;
define ("PROJET_MOD_UTILISATEUR", "User modification") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Delete a user") ;
define ("PROJET_GERER", "Administrate") ;
define ("PROJET_GERER_FICHIER", "Files administration") ;
define ("PROJET_VOIR_PROJET", "To see the project") ;
define ("PROJET_VOIR_FICHIER", "See files") ;
define ("PROJET_PRENOM", "First name") ;
define ("PROJET_MAIL", "E-mail") ;
define ("PROJET_LABEL_PAYS", "Country") ;
define ("PROJET_DATE_INSCRIPTION", "Registration date") ;
define ("PROJET_STATUT", "Status") ;
define ("PROJET_CHEF", "Coordinator") ;
define ("PROJET_PAS_D_INSCRIT", "No registered user") ;
define ("PROJET_PARTICIPER", "Projects you are participating in") ;
define ("PROJET_VOUS_PARTICIPEZ", "you are participating in") ;
define ("PROJET_TOUS", "all projects.") ;
define ("PROJET_PROJETS", "projects") ;
define ("PROJET_VOTRE_STATUT", "Your status") ;
define ("PROJET_ACTION", "Action") ;
define ("PROJET_DESTRUCTION_LAIUS", "The cancellation of a project implies the end of all the rights of its".
"users, as well as the links with other projects.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Cancellation done") ;
define ("PROJET_GESTION_PROJET", "Project administration") ;
define ("PROJET_EN_TANT_QUE", "As") ;
define ("PROJET_INTERVENIR", "You can take part in the following items") ;
define ("PROJET_PROPRIETES", "Project ownership") ;
define ("PROJET_SELECTIONNER", "Select a target directory") ;
define ("PROJET_PB_COPIE", "A problem has been encountered while copying") ;
define ("PROJET_RETABLISSEMENT", "Restoration of the data base") ;
define ("PROJET_RETBLISSEMENT_EFFECTUE", "Restoration done. You can try again.") ;
define ("PROJET_METTRE_FICHIER", "Publish a file on line") ;
define ("PROJET_CREER_REP", "Create a directory") ;
define ("PROJET_FICHIERS_ASSOCIES", "Files associated to this project") ;
define ("PROJET_FICHIERS_NOM", "Name") ;
define ("PROJET_FICHIERS_CREE_LE", "Created on the") ;
define ("PROJET_FICHIERS_PAR", "By") ;
define ("PROJET_FICHIERS_TAILLE", "Size") ;
define ("PROJET_RACINE", "Usenet hierarchy") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibility") ;
define ("PROJET_FICHIERS_ACTION", "Action") ;
define ("PROJET_LEGENDE", "Legend") ;
define ("PROJET_LEGENDE_DEPLACE", "Move a file") ;
define ("PROJET_LEGENDE_MODIFIE", "Modify the informations of a document") ;
define ("PROJET_LEGENDE_SUPPR", "Delete a file") ;
 
define ("PROJET_EMAIL", "E-mail") ;
define ("PROJET_MOT_DE_PASSE", "Password") ;
define ("PROJET_TEXTE_PERDU", "If you forgot your password, enter your e-mail address in the Login ".
"field below and click on Validate");
 
 
// ========== Partie concernant l'upload de fichier =================================
 
define ("PROJET_DOCUMENT_DU_PROJET", "Project document") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Publish a file online, step 1") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Name of the document") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Enter an explicit name since it will correspond to the text giving ".
"access to the file with a click.") ;
define ("PROJET_FICHIER_DESCRIPTION", "Description") ;
define ("PROJET_FICHIER_PUBLIC", "All type of users") ;
define ("PROJET_FICHIER_PRIVEE", "Project only") ;
define ("PROJET_FICHIER_LE_FICHIER", "The file") ;
define ("PROJET_FICHIER_CONTINUER", "Continue") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE_2", "Publish a file online, step 2") ;
define ("PROJET_FICHIER_LABEL", "Label") ;
define ("PROJET_FICHIER_TYPE", "Type") ;
define ("PROJET_FICHIER_TRANSFERT_T", "File transfer done...") ;
define ("PROJET_FICHIER_VALIDER", "Validate") ;
define ("PROJET_FICHIER_MODIFIER", "MODIFY-") ;
define ("PROJET_FICHIER_COLLER", "PASTE") ;
define ("", "CANCEL") ;
 
// Directory creation
define ("PROJET_REP", "Project directory") ;
define ("PROJET_REP_CREER", "Creation of a new directory") ;
define ("PROJET_REP_MODIFIER", "Modification of a directory") ;
define ("PROJET_REP_SUPPRIMER", "Are you sure you want to delete this directory.") ;
 
// ========== Partie concernant les wikini ===========================================
 
define ('PROJET_ASSOCIER_WIKI', 'Associer un wikini');
define ("PROJET_WIKINI_POSSEDE", "This project has a wiki site") ;
define ("PROJET_WIKINI_ALLER", "Go on the wiki site") ;
define ("PROJET_WIKINI_SUPPRIMER", "Supress wiki ") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Choose a name for the wiki") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "The name has to be in wiki format, this means without accents, without ".
"spaces and with at least two capital letters. ex MyProject.") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "This is not a valid wiki name") ;
define ("PROJET_WIKINI_NOM_EXISTE", "This wiki name already exists!") ;
define ("PROJET_LISTE_PARTICIPANT", "Participants list") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "As project manager you are allowed to modify the status of the ".
"participants or unsubscribe them if necessary.<br /> ".
"Attention! this action can have some consequences...<br /> ".
"As project manager, you cannot modify your own status. If you wish to ".
"leave this function, ask the system administrator. &nbsp;&nbsp; ");
define ("PROJET_DESINSCRIRE_SUR", "Are you sure you want to unsubscribe?") ;
 
// ========== Labels pour projet_liste ===========================================
 
define ("PROJET_LISTE", "Projects list") ;
define ("PROJET_NOMBRE_EN_COURS", "Number of projects in progress") ;
 
// ========== Labels pour projet_inscription ===========================================
define ("PROJET_PROJET", "Project") ;
define ("PROJET_VOTRE_STATUT", "Your status") ;
define ("BAZ_EST_INSCRIT_COMME", "is registered as") ;
define ("BAZ_PAS_INSCRIT", "is not registered for this project") ;
define ("BAZ_JE_SOUHAITE", "I want to be a member of the project's team") ;
define ("BAZ_INSCRIT_CONTRIBUTEUR", "I want to be an active member in this project") ;
define ("BAZ_INSCRIT_OBSERVATEUR", "I want to be an observer in this project") ;
define ("BAZ_LAIUS_CONTRIBUTEUR", "Active members work in collaboration with the project manager and with members of the team. They appear as co-author of resulting achievements.") ;
define ("BAZ_LAIUS_OBSERVATEUR", "If you do not have the opportunity or skills to be an active member, you can still register as an observer in order to bring your own personal remarks throughout the steps of the project. However you will not be considered as co-author.") ;
define ("BAZ_INSCRIT_SUPPRIMER", "I don't want to be part of the project team") ;
define ("BAZ_LAIUS_DESINSCRIPTION", "You do not wish to be part of the project team. You can still register in the future.") ;
define ("BAZ_VALIDER", "Update changes") ;
define ("BAZ_ANNULER", "Cancel") ;
define ("BAZ_RETOUR_LISTE", "Back to project list") ;
 
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire à un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_1", "La personne avec le mail suivant :\n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_2", "\nsouhaite s'inscrire au projet : \n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez modérer cette inscription.") ;
define ("BAZ_DEMANDE_INSCRIPTION_PRISE_EN_COMPTE", "Votre demande d'inscription a &eacute;t;&eacute; transmise aux coordinateurs du projet") ;
?>
 
/branches/v2.0-narmer/client/projet/langues/pro_langue_es.inc.php
New file
0,0 → 1,128
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_fr.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_es.inc.php,v 1.3 2005-09-28 16:29:39 ddelon Exp $
*/
 
 
// ========== Partie concernant la description su projet =================================
 
define ("PROJET_ALERTE_TITRE", "pacio titulo no debe estar vacio") ;
define ("PROJET_DECONNEXION", "Desconectar") ;
define ("PROJET_ADMINISTRATION", "Aqministracion") ;
define ("PROJET_ADMINISTRATEUR", "Administrador") ;
define ("PROJET_NOUVEAU_PROJET", "Nuevo proyecto") ;
define ("PROJET_DESTRUCTION_PROJET", "Anulacion de un proyecto") ;
define ("PROJET_GESTION_UTILISATEUR", "Administracion de los usuarios") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "Nuevo utilizador") ;
define ("PROJET_MOD_UTILISATEUR", "Cancelacion de un usuario") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Administrar los ficheros") ;
define ("PROJET_GERER", "Administrar") ;
define ("PROJET_VOIR_PROJET", "Ver el proyecto") ;
define ("PROJET_GERER_FICHIERS", "Administrar los ficheros") ;
define ("PROJET_VOIR_FICHIER", "Ver los ficheros") ;
define ("PROJET_PRENOM", "Nombre") ;
define ("PROJET_MAIL", "Correo ") ;
define ("PROJET_LABEL_PAYS", "Pais") ;
define ("PROJET_DATE_INSCRIPTION", "Fecha de inscripcion") ;
define ("PROJET_STATUT", "Estatu") ;
define ("PROJET_CHEF", "Coordinador") ;
define ("PROJET_PAS_D_INSCRIT", "Ningun inscritoLos ") ;
define ("PROJET_PARTICIPER", "proyectos en los cuales Usted participa") ;
define ("PROJET_VOUS_PARTICIPEZ", "Ustad participa en") ;
define ("PROJET_TOUS", "todos los proyectos.") ;
define ("PROJET_DESTRUCTION_LAIUS", "La Anulacion de un proyecto implica la suprecionde todos los derechos de los usuarios de este proyecto, asi como los lazos que los otros proyectos tienen con el.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Anulacion efectuada") ;
define ("PROJET_GESTION_PROJET", "Administracion del proyecto") ;
define ("PROJET_EN_TANT_QUE", "Mientras tanto ") ;
define ("PROJET_INTERVENIR", "Usted puede intervenir en los items siguientes") ;
define ("PROJET_PROPRIETES", "Propiedades de un proyecto") ;
define ("PROJET_ACTION", "Accion") ;
define ("PROJET_FICHIERS_ASSOCIES", "Los ficheros asociados al proyecto") ;
define ("PROJET_FICHIERS_NOM", "Nombre") ;
define ("PROJET_FICHIERS_CREE_LE", "Creado el") ;
define ("PROJET_FICHIERS_PAR", "Por") ;
define ("PROJET_FICHIERS_TAILLE", "Tamaño") ;
define ("PROJET_RACINE", "Raiz") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibilidad") ;
define ("PROJET_METTRE_FICHIER", "Hacer un nuevo fichero") ;
define ("PROJET_CREER_REP", "Hacer un nuevo agenda") ;
define ("PROJET_FICHIERS_ACTION", "Accion") ;
define ("PROJET_LEGENDE", "Explicacion") ;
define ("PROJET_LEGENDE_DEPLACE", "Mover un fichero") ;
define ("PROJET_LEGENDE_MODIFIE", "Modificar las informaciones de un documento") ;
define ("PROJET_LEGENDE_SUPPR", "Cancelar un fichero") ;
define ("PROJET_EMAIL", "Correo electronico") ;
define ("PROJET_MOT_DE_PASSE", "Contraseña") ;
define ("PROJET_TEXTE_PERDU", "Si ha perdido su contraseña, indique su correo electronico en el espaciologin y haga clic en Ingresar") ;
 
//================ Partie concernant l'upload de fichier=======================================
define ("PROJET_DOCUMENT_DU_PROJET", "Documento del proyecto") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Puesta en linea de un fichero etapa 2") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Sello") ;
define ("PROJET_FICHIER_DESCRIPTION", "Descripci&oacute;n") ;
define ("PROJET_FICHIER_PUBLIC", "para todos") ;
define ("PROJET_FICHIER_PRIVEE", "solo el proyecto") ;
define ("PROJET_FICHIER_TYPE", "Tipo") ;
define ("PROJET_FICHIER_TRANSFERT_T", "Transferencia terminada") ;
define ("PROJET_FICHIER_VALIDER", "Ingresar") ;
define ("PROJET_FICHIER_MODIFIER", "Modificar") ;
define ("PROJET_FICHIER_COLLER", "PEGARCANCELAR") ;
define ("PROJET_FICHIER_LE_FICHIER", "El fichero") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Saisissez un nom explicite, il correspond ".
"au texte sur lequel il faudra cliquer pour acc&eacute;der au fichier.") ;
define ("PROJET_FICHIER_CONTINUER", "Continuer") ;
// Creacion de la agenda
 
define ("PROJET_REP", "Hacer de nuevo la agenda del proyecto") ;
define ("PROJET_REP_CREER", "Hacer un nuevo agenda") ;
define ("PROJET_REP_MODIFIER", "Modificacion de una agenda ") ;
define ("PROJET_REP_SUPPRIMER", "esta seguro de cancelar la agenda") ;
 
//======= Parte concerniente a los wikis========================================
define ('PROJET_ASSOCIER_WIKI', 'Associer un wikini') ;
define ("PROJET_WIKINI_POSSEDE", "Este proyecto posee un espacio wiki") ;
define ("PROJET_WIKINI_ALLER", "Ir al wiki") ;
define ("PROJET_WIKINI_SUPPRIMER", "Cancelar el wiki") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Escoja un nombre para el wiki") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "El nombre debe estar en formato wiki, es decir, sin acentos, sin espacios ycon al menos dos mayusculas. Ej MiProyecto") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "Este no es nombre wiki valido") ;
define ("PROJET_WIKINI_NOM_EXISTE", "Ya existe un wiki con ese nombre!") ;
define ("PROJET_LISTE_PARTICIPANT", "Lista de los particpantes") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "Usted es jefe del proyecto. Puede a ese titulo, modificar el estatu de los participantes o desincribirlos en caso de un problema. Cuidado con las consecuencias que esto puede tener...<br />Como jefe del proyecto, Usted no puede modificar su estatu. Si Usted deseaabandonar esta funcion, hay que hacer la solicitud al administrador delsistema &nbsp;&nbsp;") ;
 
//==================== labels pour projet_liste=======================================================
define ("PROJET_LISTE", "Lista de Proyectos") ;
define ("PROJET_NOMBRE_EN_COURS", "Numéro de proyectos en curso.") ;
 
// ========== Labels pour projet_inscription ===========================================
define ("PROJET_PROJET", "Proyecto") ;
define ("PROJET_VOTRE_STATUT", "Votre statut par rapport au projet") ;
define ("BAZ_EST_INSCRIT_COMME", "est inscrit comme") ;
define ("BAZ_PAS_INSCRIT", "n'est pas inscrit &agrave; ce projet") ;
define ("BAZ_JE_SOUHAITE", "Je souhaite m'inscrire &agrave; ce projet ou modifier mon inscription") ;
define ("BAZ_INSCRIT_CONTRIBUTEUR", "Je m'inscris comme contributeur au projet") ;
define ("BAZ_INSCRIT_OBSERVATEUR", "Je m'inscris comme observateur au projet") ;
define ("BAZ_LAIUS_CONTRIBUTEUR", "Les acteurs d'un projet collaborent activement &agrave; sa r&eacute;alisation en relation avec le chef du projet et l'ensemble des autres membres du projet. Ils ont droit &agrave; citation comme co-auteur des travaux r&eacute;alis&eacute;s.") ;
define ("BAZ_LAIUS_OBSERVATEUR", "Si vous manquez de disponibilit&eacute; ou que vos comp&eacute;tences ne vous permettent pas de travailler activement au projet, vous pouvez cependant suivre son &eacute;volution et apporter vos critiques constructives en vous inscrivant comme observateur. Vous ne pourrez pas, normalement, pr&eacute;tendre &agrave; &ecirc;tre cit&eacute; comme co-auteur du projet") ;
define ("BAZ_INSCRIT_SUPPRIMER", "Je supprime mon inscription") ;
define ("BAZ_LAIUS_DESINSCRIPTION", "Vous ne souhaitez plus, momentan&eacute;ment ou d&eacute;finitivement, participer &agrave; ce projet. Vous pourrez vous r&eacute;inscrire ult&eacute;rieurement.") ;
define ("BAZ_VALIDER", "Valider modification") ;
define ("BAZ_ANNULER", "Annuler") ;
define ("BAZ_RETOUR_LISTE", "Retourner &agrave; la liste des projets") ;
 
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_SUJET", "I-Jumelage : une personne souhaite s'inscrire à un projet ") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_1", "La personne avec le mail suivant :\n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_2", "\nsouhaite s'inscrire au projet : \n") ;
define ("BAZ_MAIL_DEMANDE_INSCRIPTION_CORPS_3", "\nEn tant que coordinateur, vous devez modérer cette inscription.") ;
define ("BAZ_DEMANDE_INSCRIPTION_PRISE_EN_COMPTE", "Votre demande d'inscription a &eacute;t;&eacute; transmise aux coordinateurs du projet") ;
?>
/branches/v2.0-narmer/client/projet/langues/pro_langue_fr.inc.php
New file
0,0 → 1,278
<?php
/* +-----------------------------------------------------------------------+
* |pro_langue_fr.inc.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2003 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Module projet, permet la création de projet, avec une gestion de la |
* | propriétés des documents... |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: pro_langue_fr.inc.php,v 1.15.2.1 2007-05-11 13:56:49 alexandre_tb Exp $
*/
 
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php')) {
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.local.php' ;
}
 
// LA liste des projet
 
define ('PROJET_TEXTE_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à vos projets ou pour vous inscrire aux projet') ;
define ('PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE', 'Vous n\'êtes pas identifié. Identifiez-vous pour accéder à la liste des participants') ;
 
// ========== Partie concernant la description su projet =================================
 
define ('PROJET_PROJET', 'Projet') ;
define ('PROJET_PAS_DE_PROJET', 'Il n\'y a aucun projet pour le moment.');
define ("PROJET_ALERTE_TITRE", "Le champs titre ne doit pas &ecirc;tre vide") ;
define ("PROJET_TITRE", "Titre") ;
if (!defined ('PROJET_RESUME')) {
define ('PROJET_RESUME', 'Résumé') ;
}
define ('PROJET_SYNTHESE', 'Synthèse') ;
define ("PROJET_DECONNEXION", "D&eacute;connexion") ;
define ("PROJET_ADMINISTRATION", "Administration") ;
define ("PROJET_ADMINISTRATEUR", 'administrateur') ;
define ("PROJET_NOUVEAU_PROJET", "Nouveau projet") ;
define ('PROJET_ACCUEIL', 'Description du projet') ;
define ('PROJET_PERE', 'Projet père') ;
define ('PROJET_MODIFIER_PROPRIETES', 'Modifier le projet') ;
define ("PROJET_DESTRUCTION_PROJET", "Destruction d'un projet") ;
define ("PROJET_GESTION_UTILISATEUR", "Gérer les participants") ;
define ("PROJET_NOUVEAU_UTILISATEUR", "Nouveau participant") ;
define ('PROJET_NOUVEAU_UTILISATEUR_LAIUS', 'Pour ajouter un participant, inscrivez son adresse mail ci-contre et cliquer sur '.PROJET_NOUVEAU_UTILISATEUR) ;
define ("PROJET_MOD_UTILISATEUR", "Modification d'un utilisateur") ;
define ("PROJET_DESTRUCTION_UTILISATEUR", "Suppression d'un utilisateur") ;
define ("PROJET_VOIR_PROJET", "Voir le projet") ;
define ('PROJET_S_INSCRIRE', 'S\'inscrire') ;
define ('PROJET_SE_DESINSCRIRE_LISTE', 'Se désinscrire') ;
define ('PROJET_SE_DESINSCRIRE_CONFIRMATION', 'Etes vous sûr de vouloir vous désinscrire ?') ;
define ("PROJET_GERER", "G&eacute;rer") ;
define ("PROJET_GERER_FICHIER", "G&eacute;rer fichiers") ;
define ("PROJET_VOIR_FICHIER", "Voir fichiers") ;
define ('PROJET_NOM', 'Nom') ;
define ("PROJET_PRENOM", "Pr&eacute;nom") ;
define ("PROJET_MAIL", "E mail") ;
define ('PROJET_DETAIL_PROJET', 'Détail du projet') ;
define ("PROJET_LABEL_PAYS", "Pays") ;
define ("PROJET_DATE_INSCRIPTION", "Date d'inscription") ;
define ("PROJET_STATUT", "Statut") ;
define ('PROJET_VOUS_ETES', 'Vous êtes ') ;
define ("PROJET_CHEF" ,"Coordonnateur") ;
define ('PROJET_CONTRIBUTEUR', 'Participants') ;
define ('PROJET_NON_INSCRIT', 'non inscrit') ;
define ("PROJET_PAS_D_INSCRIT", "Il n' y a pas d'inscrit à ce projet") ;
define ("PROJET_PARTICIPER", "Les projets auxquels vous participez") ;
define ("PROJET_VOUS_PARTICIPEZ", "Vous participez &agrave; ce projet") ;
define ("PROJET_TOUS", "tous les projets.") ;
define ("PROJET_PROJETS", "projets") ;
define ('PROJET_TYPE', 'Type du projet') ;
define ("PROJET_VOTRE_STATUT", "Votre statut") ;
define ("PROJET_ACTION", "Action") ;
define ('PROJET_SUPPRIMER', 'supprimer') ;
define ('PROJET_SUPPRIMER_LE_PROJET', 'Supprimer le projet') ;
define ('PROJET_SUPPRIMER_PROJET_CONFIRMATION', 'Supprimer le projet ?') ;
define ("PROJET_DESTRUCTION_LAIUS", "La destruction d'un projet implique la suppression de tous les droits ".
"de tous les utilisateurs de ce projet, ainsi que les liens que les autres projets ont ".
"avec lui.") ;
define ("PROJET_DESTRUCTION_EFFECTUEE", "Destruction effectu&eacute;e") ;
define ("PROJET_GESTION_PROJET", "Gestion du projet") ;
define ("PROJET_EN_TANT_QUE", "En tant que") ;
define ("PROJET_INTERVENIR", "vous pouvez intervenir sur les items suivants") ;
define ("PROJET_PROPRIETES", "Propri&eacute;t&eacute;s du projet") ;
define ("PROJET_SELECTIONNER", "S&eacute;lectionner un r&eacute;pertoire cible pour") ;
define ("PROJET_PB_COPIE", "Probl&eagrave;me lors de la copie") ;
define ("PROJET_RETABLISSEMENT", "R&eacute;tablissement de la base de donnée...") ;
define ("PROJET_RETBLISSEMENT_EFFECTUE", "R&eacute;tablissement effectu&eacute;. Vous pouvez r&eacute;essayer.") ;
define ("PROJET_METTRE_FICHIER", "Mettre un fichier en ligne") ;
define ("PROJET_CREER_REP", "Cr&eacute;er un r&eacute;pertoire") ;
define ("PROJET_FICHIERS_ASSOCIES", "Les fichiers associ&eacute;s au projet") ;
define ('PROJET_PAS_DE_DOCUMENTS', 'Pas de documents associés à ce projet') ;
define ("PROJET_FICHIERS_NOM", "Nom") ;
define ("PROJET_FICHIERS_CREE_LE", "Cr&eacute;&eacute; le") ;
define ("PROJET_FICHIERS_PAR", "Par") ;
define ("PROJET_FICHIERS_TAILLE", "Taille") ;
define ("PROJET_RACINE", "Racine") ;
define ("PROJET_FICHIERS_VISIBILITE", "Visibilit&eacute;");
define ("PROJET_FICHIERS_ACTION", "Action") ;
define ("PROJET_LEGENDE", "L&eacute;gende") ;
define ("PROJET_LEGENDE_DEPLACE", "D&eacute;place un fichier");
define ("PROJET_LEGENDE_MODIFIE", "Modifie les informations d'un document") ;
define ("PROJET_LEGENDE_SUPPR", "Supprime un fichier");
define ("PROJET_CHAMPS_REQUIS", "D&eacute;signe les champs obligatoires") ;
define ("PROJET_EMAIL", "e-mail") ;
define ("PROJET_MOT_DE_PASSE", "Mot de passe") ;
define ("PROJET_TEXTE_PERDU", "Si vous avez perdu votre mot de passe, indiquer ".
"votre adresse email dans le champs login ci-dessus et cliquez sur \"Valider\"") ;
define ("PROJET_DESCRIPTION", "Description") ;
define ("PROJET_ESPACE_INTERNET", "Espace internet") ;
define ('PROJET_PAS_DE_SITE', 'Pas d\'espace internet externe') ;
define ("PROJET_DESTRUCTION_ALERTE", "Etes-vous sûr de vouloir supprimer ce projet ?") ;
define ("PROJET_MENU_GENERAL", "Menu G&eacute;n&eacute;ral") ;
define ('PROJET_MENU_COORD', 'Menu du coordinateur') ;
define ('PROJET_MENU_CONTRI', 'Menu du Contributeur') ;
define ('PROJET_MENU_OBS', 'Menu de l\'observateur') ;
 
define ('PROJET_CREER_LISTE', 'Créer un forum de discussion') ;
define ('PROJET_LISTE_DE_DISCUSSION', 'Forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE', 'Supprimer le forum de discussion') ;
define ('PROJET_SUPPRIMER_LISTE_CONFIRMATION', 'Supprimer le forum ?') ;
define ('PROJET_NOM_DE_LA_LISTE', 'Nom du forum') ;
define ('PROJET_NOM_DE_LA_LISTE_REQUIRED', 'Le nom du forum est requis') ;
define ('PROJET_DOMAINE_DE_LA_LISTE', 'Domaine du forum') ;
define ('PROJET_DOMAINE_LISTE_REQUIRED', 'Le domaine est requis') ;
define ('PROJET_MESSAGE_LISTE_DOUBLE', 'Un forum de ce nom la existe déjà') ;
define ('PROJET_PAS_DE_LISTE', 'Pas de forum') ;
define ('PROJET_FORUM', 'Forum') ;
if (!defined ('PROJET_PROPOSER_PROJET')) {
define ('PROJET_PROPOSER_PROJET', '<h1>Proposer un projet</h1><p>');
}
define ('PROJET_RETOUR_RESUME', 'Retour au résumé');
 
define ('PROJET_MODERE', 'Inscription modérée');
define ('PROJET_NON_MODERE', 'Inscription non modérée');
define ('PROJET_INSCRIPTION', 'Inscription') ;
define ('PROJET_DEMANDE_INSCRIPTION', 'Demande d\'inscription au projet');
define ('PROJET_EN_ATTENTE', 'en attente de validation');
 
define ('PROJET_LAIUS_INSCRIPTION_MODERE', 'Votre demande d\'inscription au projet "nom_du_projet" a &eacute;t&eacute; enregistr&eacute;e et
est propos&eacute;e pour acceptation au coordonnateur du projet"<br /><br />
Un accus&eacute; r&eacute;ception vous sera envoy&eacute; à votre courriel d\'inscription
confirmant l\'acception de votre inscription.<br /><br />
Vous pourrez alors acc&eacute;der à toutes les fonctions du projet "nom_du_projet"');
 
// ========== Partie concernant l'upload de fichier =================================
 
define ("PROJET_DOCUMENT_DU_PROJET", "Documents du projet") ;
define ('PROJET_FICHIERS_RECENTS', 'Les derniers documents du projet') ;
define ("PROJET_FICHIER_MISE_EN_LIGNE", "Mise en ligne d'un fichier") ;
define ("PROJET_FICHIER_NOM_DOCUMENT", "Nom du document") ;
define ("PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION", "Saisissez un nom explicite, il correspond ".
"au texte sur lequel il faudra cliquer pour acc&eacute;der au fichier.") ;
define ("PROJET_FICHIER_ALERTE", "Vous devez saisir un nom pour le document") ;
define ("PROJET_FICHIER_DESCRIPTION", "Description") ;
define ("PROJET_FICHIER_PUBLIC", "Tout public") ;
define ("PROJET_FICHIER_PRIVEE", "Projet seulement") ;
define ("PROJET_FICHIER_LE_FICHIER", "Le fichier") ;
define ("PROJET_FICHIER_ALERTE_PAS_DE_FICHIER", "Vous devez sélectionner un fichier") ;
define ("PROJET_FICHIER_CONTINUER", "Continuer") ;
define ("PROJET_FICHIER_MISE_EN_LIGNE_2", "Mise en ligne d'un fichier &eacute;tape 2") ;
define ("PROJET_FICHIER_LABEL", "Label") ;
define ("PROJET_FICHIER_TYPE", "Type") ;
define ("PROJET_FICHIER_TRANSFERT_T", "Transfert termin&eacute;...");
define ("PROJET_FICHIER_VALIDER", "Valider") ;
define ("PROJET_FICHIER_MODIFIER", "Modifier") ;
define ("PROJET_FICHIER_COLLER", "COLLER") ;
define ("PROJET_FICHIER_COUPER", "Déplacer") ;
define ("PROJET_FICHIER_ANNULER", "Annuler") ;
define ("PROJET_FICHIER_SUPPRIMER", "Supprimer") ;
define ('PROJET_CHOISISSEZ_REPERTOIRE', 'Choisissez un répertoire pour ce fichier') ;
define ('PROJET_CHANGER_REPERTOIRE', 'CHANGER UN FICHIER DE REPERTOIRE') ;
define ('PROJET_FICHIER_A_DEPLACER', 'Fichier à déplacer : ') ;
define ('PROJET_DOCUMENT', 'Documents') ;
define ('PROJET_AFFICHAGE_ARBORESCENT', 'Affichage arborescent');
define ('PROJET_AFFICHAGE_CLASSIQUE', 'Affichage classique');
// Création de répertoire
define ("PROJET_REP", "R&eacute;pertoire du projet") ;
define ("PROJET_REP_CREER", "Cr&eacute;ation d'un nouveau r&eacute;pertoire") ;
define ("PROJET_REP_MODIFIER", "Modification d'un r&eacute;pertoire") ;
define ("PROJET_REP_SUPPRIMER", "&ecirc;tes-vous s&ucirc;r de vouloir supprimer le r&eacute;pertoire") ;
 
// ========== Partie concernant les wikini ===========================================
 
define ('PROJET_CREER_WIKI', 'Gestion Wikinis') ;
define ('PROJET_ASSOCIER_WIKI', 'Associer un Wikini');
if (!defined ('PROJET_WIKI_ASSOCIE')) {
define ('PROJET_WIKI_ASSOCIE', 'Espace de rédaction collaborative') ;
}
define ("PROJET_WIKINI_POSSEDE", "Ce projet poss&egrave;de un espace wikini") ;
define ("PROJET_WIKINI_ALLER", "Aller sur le wikini") ;
define ("PROJET_WIKINI_SUPPRIMER", "Supprimer le wikini") ;
define ("PROJET_WIKINI_CHOISIR_NOM", "Choisissez un nom pour le wikini") ;
define ("PROJET_WIKINI_NOM_EXPLICATION", "Le nom doit &ecirc;tre au format wikini, c'est &agrave; dire sans accents, sans espaces et avec au moins deux majuscule. ex MonProjet") ;
define ("PROJET_WIKINI_NOM_INVALIDE", "Ce n'est pas un nom wiki valide") ;
define ("PROJET_WIKINI_NOM_EXISTE", "Il existe d&eacute;j&agrave; un wikini de ce nom la !!") ;
define ("PROJET_WIKINI_PAS", "Pas de Wikini pour ce projet.") ;
define ('PROJET_NOM_WIKINI_REQUIS', 'Le nom Wikini est requis') ;
define ('PROJET_PREFIXE_WIKINI', 'Préfixe wikini') ;
define ('PROJET_PREFIXE_WIKINI_REQUIS', 'Le préfixe est requis') ;
if (!defined('PROJET_WIKINI')) {
define ('PROJET_WIKINI', 'Wikini') ;
}
define ("PROJET_NOM_WIKINI", "Nom Wikini") ;
define ("PROJET_PAGE_WIKINI", "Page de démarrage") ;
define ("PROJET_CHOISIR_WIKINI", "Choisir") ;
define ("PROJET_SELECTIONNER_WIKINI", "Selection") ;
 
 
define ("PROJET_LISTE_PARTICIPANT", "Liste des participants") ;
define ("PROJET_LISTE_PARTICIPANT_LAIUS", "Vous &ecirc;tes chef du projet. Vous pouvez &agrave; ce titre, modifier le statut ".
"des participants ou les d&eacute;sinscrire en cas de probl&egrave;me.<br />".
"ttention aux cons&eacute;quences que cela peut avoir...<br />".
"En tant que chef de projet, vous ne pouvez pas modifier votre statut. Si vous souhaitez abandonner ".
"cette fonction, il faut en faire la demande &agrave; l'administrateur du syst&egrave;me&nbsp;&nbsp;") ;
define ("PROJET_DESINSCRIRE_SUR", "&ecirc;tes-vous s&ucirc;r de vouloir d&eacute;sinscrire") ;
define ('PROJET_MAIL_ABSENT', 'L\'email que vous avez saisi n\'est pas dans l\'annuaire') ;
define ('PROJET_ALLER_SUR_WIKINI', 'Entrer dans la page') ;
 
// ========== Labels pour projet_liste ===========================================
 
define ("PROJET_LISTE", "Liste des projets") ;
define ('PROJET_TOUS_LES_PROJETS', 'Les autres projets du réseau') ;
define ("PROJET_NOMBRE_EN_COURS" ,"Nombre de projets en cours") ;
define ('PROJET_INSCRIT_AUCUN_PROJET', 'Vous n\'êtes inscrit à aucun projet<br />
- <a href="http://testv4.tela-botanica.org/papyrus.php?menu=158">Qu\'est-ce qu\'un projet ?</a><br />
Le réseau Tela Botanica est organisé autour de projets, discussions ou
échanges liés à  la botanique. Vous pouvez y participer en vous
inscrivant.') ;
define ('PROJET_CREATION_LISTE', 'Création d\'un forum de discussion') ;
define ('PROJET_LISTES_EXTERNES_ASSOCIEES', 'Forum associé du projet') ;
define ('PROJET_REFERENCER_LISTE', 'Référencer un forum externe') ;
 
// ========== Labels pour projet_inscription ===========================================
 
define ("PROJET_VOTRE_STATUT_AU_PROJET", "Votre statut par rapport au projet") ;
define ('PROJET_INSCRIPTION_LISTE_NORMAL', 'Je reçois les messages du forum') ;
define ('PROJET_INSCRIPTION_LISTE_RESUME', 'Je m\'inscrit à la version résumé du forum') ;
define ('PROJET_INSCRIPTION_PAS_DE_MAIL', 'Je ne souhaite pas recevoir de messages de ce forum') ;
define ('PROJET_INSCRIPTION_PROJET', 'Inscription au projet') ;
define ('PROJET_S_INSCRIRE_AU_PROJET', 'S\'inscrire au projet') ;
define ('PROJET_MESSAGE_LISTE', 'Messages du forum') ;
define ('PROJET_ADRESSE_ECRIRE', 'Adresse pour écrire au forum') ;
define ('PROJET_TOUS_LES_MESSAGES', 'Tous les messages') ;
define ('PROJET_DERNIERS_MESSAGES', 'Derniers messages du forum du projet') ;
define ('PROJET_DERNIER_MESSAGE', 'Dernier message') ;
define ('PROJET_MESSAGE_DU_MOIS', 'Messages du mois ') ;
define ('PROJET_RECEVOIR_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR_MESSAGES', 'Ne plus recevoir de messages') ;
define ('PROJET_MESSAGES_DE', 'Messages de ') ;
define ('PROJET_FILE_DE_DISCUSSION', 'fil de discussion') ;
define ('PROJET_VOUS_N_ETES_PAS_INSCRIT', 'Vous n\'êtes pas inscrit à ce projet') ;
define ('PROJET_VOUS_ETES_PARTICIPANT', 'Vous êtes participant à ce projet') ;
define ('PROJET_SE_DESINSCRIRE', 'Se désinscrire du projet') ;
 
 
// ======================= Labels pour l'envoie d'email ==================================
define ("PROJET_MAIL_TITRE", "Titre") ;
define ("PROJET_MAIL_TITRE_REQUIS", "Vous devez indiquer au moins un titre") ;
define ("PROJET_MAIL_CORPS", "Corps") ;
define ("PROJET_ECRIRE_LISTE", "Ecrire au forum") ;
define ('PROJET_LISTES_ASSOCIEES', 'Forum associé au projet') ;
 
define ('PROJET_RECEVOIR_LES_MESSAGES', 'Recevoir les messages') ;
define ('PROJET_NE_PAS_RECEVOIR', 'Pas de messages') ;
define ('PROJET_RECEVOIR_DES_RESUMES', 'Recevoir des résumés') ;
define ('PROJET_VOUS_ETES_INSCRIT', 'Vous êtes inscrit à ce forum.') ;
define ('PROJET_LISTE_PRIVE', 'Vous devez inscrit pour être');
// Label pour l'affichage des messages dans le forum
define ('PROJET_PRECEDENT', 'précédent') ;
define ('PROJET_SUIVANT', 'suivant') ;
define ('PROJET_REPONDRE', 'répondre') ;
define ('PROJET_REDIGER_REPONSE', 'Rédiger votre réponse') ;
define ('PROJET_FORUMS_VISIBILITE', 'Forum public') ;
define ('PROJET_OUI', 'oui') ;
define ('PROJET_NON', 'non') ;
define ('PROJET_MESSAGE_LISTE_PRIVEE', 'Cette liste est privée, vous devez être inscrit au projet pour y accéder') ;
?>
/branches/v2.0-narmer/client/projet/tmp/vide.txt
--- projet/actions/resume.php (revision 0)
+++ projet/actions/resume.php (revision 1976)
@@ -0,0 +1,230 @@
+<?php
+/*vim: set expandtab tabstop=4 shiftwidth=4: */
+// +------------------------------------------------------------------------------------------------------+
+// | PHP version 4.1 |
+// +------------------------------------------------------------------------------------------------------+
+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
+// +------------------------------------------------------------------------------------------------------+
+// | This library is free software; you can redistribute it and/or |
+// | modify it under the terms of the GNU General Public |
+// | License as published by the Free Software Foundation; either |
+// | version 2.1 of the License, or (at your option) any later version. |
+// | |
+// | This library 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 library; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+// +------------------------------------------------------------------------------------------------------+
+// CVS : $Id: resume.php,v 1.12 2007-04-19 15:34:35 neiluj Exp $
+/**
+* Application projet
+*
+* Action resume
+*
+*@package projet
+//Auteur original :
+*@author Alexandre Granier <alexandre@tela-botanica.org>
+//Autres auteurs :
+*@author Aucun
+*@copyright Tela-Botanica 2000-2005
+*@version $Revision: 1.12 $
+// +------------------------------------------------------------------------------------------------------+
+*/
+
+// +------------------------------------------------------------------------------------------------------+
+// | ENTETE du PROGRAMME |
+// +------------------------------------------------------------------------------------------------------+
+
+// RAPPEL IMPORTANT
+// On se situe dans la méthode run() de la classe projetControleur
+//
+
+$retour = '';
+
+// création de l'objet projet courant
+include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
+include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
+$projet = new projet ($this->_db, $this->_id_projet) ;
+
+// récupération de la liste des documents associés
+$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
+ PROJET_CHEMIN_ICONES, $this->_id_projet) ;
+
+// création de la vue liste de document, on nettoie l'url
+//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
+include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
+include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
+$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;
+
+// réglage de paramètres de la vue
+$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
+$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
+
+
+// vérification des droits de l'utilisateur
+$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
+
+if ($this->_auth->getAuth()) {
+ $droits = PROJET_DROIT_AUCUN;
+ $participant = new participe($this->_db) ;
+ $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
+ $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
+ $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
+ if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
+ if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
+ $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
+ if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
+ if ($isAdm) $isCoord = true ;
+
+ $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
+ // si participant, on ajoute le champs visibilite
+
+ if ($statut !='' || $isAdm) {
+ array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
+ $visible = true ;
+ } else {
+ $visible = false ;
+ }
+ // récupération de la liste des documents associés
+ $liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
+ PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
+
+
+ // si chef de projet ou si propriétaire d'au moins 1 document
+ $proprietaire_un_document = false ;
+
+ foreach ($liste_documents as $document) {
+ if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
+ $proprietaire_un_document = true ;
+ $droits = PROJET_DROIT_PROPRIETAIRE ;
+ }
+ }
+ if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
+ array_push ($entete_liste, PROJET_ACTION) ;
+ }
+} else {
+ $droits = PROJET_DROIT_AUCUN ;
+ // récupération de la liste des documents associés
+ $liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
+ PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
+
+}
+if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
+
+$vue_liste_document->construitEntete($entete_liste) ;
+$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;
+
+$wiki_res = '' ;
+// Les wikinis associés au projet
+if ($projet->getWikini()) {
+ $url = $GLOBALS['_GEN_commun']['url'] ;
+
+ $this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
+ $link=$this->_url->getURL();
+
+ $wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$projet->getWikini().')' ;
+ $wiki_res .= '</div>' ;
+} else {
+ $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
+}
+// On charge les listes de discussion du projet
+// Pour le moment seul ezmlm est supportée
+
+$projet->getListesAssociees();
+$sortie_liste = '' ;
+
+$liste_ext_res = '' ;
+if ($projet->avoirListe()) {
+ ob_start() ;
+ include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
+ foreach ($projet->_listes_associes as $info_liste) {
+ $liste = new ezmlm_php() ;
+ // Paramétrage de la liste
+
+ $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
+
+ $liste->listname = $info_liste->getNom() ;
+ $liste->listdomain = $info_liste->getDomaine();
+
+ if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
+ $liste->set_action($GLOBALS['action']) ;
+ $liste->set_actionargs($GLOBALS['actionargs']) ;
+ } else {
+ $liste->set_action('list_info') ;
+ }
+ $liste->sendheaders = false;
+ $liste->sendbody = false;
+ $liste->sendfooters = false;
+ $liste->forcehref = $this->_url->getURL() ;
+
+
+
+ if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
+ $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
+ switch ($liste->action) {
+ case "list_info":
+ $this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
+ $xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
+ $info_liste->getNom(), $GLOBALS['lang'],
+ $this->_url->getURL()) ;
+
+ $xml_parser->reset() ;
+ $xml_parser->setAction ('derniers_messages');
+ $xml_parser->load();
+ ob_start ();
+ $xml_parser->parse() ;
+ $derniers_messages = ob_get_contents() ;
+ ob_end_clean();
+ echo $derniers_messages ;
+ break;
+ }
+ } else {
+ print PROJET_MESSAGE_LISTE_PRIVEE;
+ }
+ $sortie_liste = ob_get_contents() ;
+ ob_end_clean() ;
+ }
+}
+
+// Site internet associé
+$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
+if ($projet->getEspaceInternet() != '') {
+ $sortie_web .= '<a href="'.$projet->getEspaceInternet().'" target="_blank">'.$projet->getEspaceInternet().'</a>'."\n" ;
+} else {
+ $sortie_web .= PROJET_PAS_DE_SITE ;
+}
+
+include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
+$listes_ext = new liste_externe ($this->_db) ;
+$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
+
+if (count ($tableau_liste) != 0) {
+ $liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
+ for ($i = 0; $i < count ($tableau_liste); $i++) {
+ $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
+ //$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
+ //$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
+ $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
+ //$liste_ext_res .= '<br />'."\n" ;
+ }
+}
+
+$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
+$retour .= '<h2>'.PROJET_RESUME.'</h2>'."\n" ;
+$retour .= '<div>'.$projet->getResume().'</div>'."\n" ;
+$retour .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
+$retour .= $wiki_res ;
+$retour .= $sortie_web ;
+$retour .= '<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
+$retour .= $liste_ext_res.$sortie_liste ;
+$retour .= '<h2>'.PROJET_FICHIERS_RECENTS.'</h2>'."\n" ;
+$retour .= $vue_liste_document->toHTML() ;
+//$retour .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
+//$retour .= $sortie_liste ;
+
+
+?>
\ No newline at end of file
/branches/v2.0-narmer/client/projet/actions/documents.php
New file
0,0 → 1,149
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: documents.php,v 1.7.2.2 2007-10-02 09:23:07 alexandre_tb Exp $
/**
* Application projet
*
* Action documents
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.7.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
if (!isset($retour)) $retour = '';
 
// creation de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// recuperation de la liste des documents associes
// en filtrant sur le repertoire courant pour limiter le nombre de resultat
if ($this->_id_repertoire != "") {
$id_repertoire = $this->_id_repertoire;
} else {
$id_repertoire = 0 ;
}
 
 
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES, $id_repertoire) ;
 
// creation de la vue liste de document, on nettoie l'url
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
 
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
 
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire, $this->_auth, $projet->getId()) ;
 
// reglage de parametres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
$tableau_navigation = document::getPath($this->_id_repertoire, $this->_db) ;
//$retour .= $GLOBALS['log'];
$tableau_navigation = array_merge(is_array ($tableau_navigation) ? array_reverse($tableau_navigation) : array(), array($id_repertoire));
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
 
// verification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
if ($isAdm) $isCoord = true ;
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
}
// si chef de projet ou si proprietaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($statut > 0 || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
 
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
 
$retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
// Les liens pour l affichage classique ou arborescent (avec dojo)
$this->_url->addQueryString('affichage', 'ajax');
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
$this->_url->addQueryString('affichage', 'standart');
$retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
$this->_url->removeQueryString('affichage');
 
 
$retour .= '<noscript>';
$vue_liste_document->setModeAffichage('standart');
$retour .= $vue_liste_document->toHTML('', '') ;
$retour .= '</noscript>';
 
if (!isset ($_SESSION['mode_affichage'])) {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'standart';
} else {
if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
}
$vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
 
$retour .= $vue_liste_document->toHTML($projet->getId(), $droits);
//$retour .= $GLOBALS['log'];
 
?>
/branches/v2.0-narmer/client/projet/actions/participants.php
New file
0,0 → 1,130
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: participants.php,v 1.6.2.1 2007-05-11 13:39:47 alexandre_tb Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.6.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
 
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
 
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise a jour de statut
if (isset($_REQUEST['statut'])) {
$participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($_GET['id_utilisateur']) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
}
 
// Ce qui suit doit etre ameliore pour sortir la requete sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
// Le statut 2 est le statut participant
$participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 3) $droits = PROJET_DROIT_EN_ATTENTE;
if ($statut == 4) $droits = PROJET_DROIT_AUCUN ;
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
$HTML_listeParticipants = new HTML_listeParticipants(true) ;
if ($droits <= PROJET_DROIT_COORDINATEUR) $HTML_listeParticipants->setModeModification() ;
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$HTML_listeParticipants->setURL($this->_url) ;
// Construction de l'entete
$entete = array (PROJET_NOM, PROJET_PRENOM, PROJET_MAIL, PROJET_DATE_INSCRIPTION, PROJET_STATUT) ;
if ($projet->avoirListe()) array_push ($entete, PROJET_LISTE_DE_DISCUSSION);
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits);
 
$HTML_listeParticipants->construitEntete($entete) ;
include_once PROJET_CHEMIN_CLASSES.'statut.class.php' ;
if ($projet->avoirListe()) {
$ezmlm = new ezmlmAccessObject('liste_abonnes', $projet->_liste_associes[0]->getDomaine(),
$projet->_listes_associes[0]->getNom());
}
$HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db), $projet) ;
$res = $HTML_listeParticipants->toHTML() ;
if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
$res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form>'."\n" ;
}
} else {
$res .= '<p>'.PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE.'</p>'."\n" ;
}
$retour .= $titre.$res ;
 
 
?>
/branches/v2.0-narmer/client/projet/actions/description.php
New file
0,0 → 1,57
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: description.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* Action description
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
 
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
$retour .= '<h2>'.PROJET_RESUME.'</h2>'."\n" ;
$retour .= '<div>'.$projet->getResume().'</div>'."\n" ;
$retour .= '<h2>'.PROJET_DESCRIPTION.'</h2>' ;
$retour .= '<div>'.$projet->getDescription().'</div>'."\n" ;
 
 
?>
/branches/v2.0-narmer/client/projet/actions/wikini.php
New file
0,0 → 1,94
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: wikini.php,v 1.16.2.1 2007-05-08 17:53:22 ddelon Exp $
/**
* Application projet
*
* Action participants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.16.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
 
 
 
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$wiki_res = '' ;
$wiki_res.= '<h2>'.PROJET_PROJET.' : '.$projet->getTitre()."</h2>" ;
// Les wikinis associés au projet
if ($wiki=$projet->getWikini()) {
if ($projet->isModere()) {
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
if ($participant->getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $projet->getId(), $this->_db) < 3) {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'" target="_blank">'.PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] =afficherPageMenuWikini();
$retour .= $wiki_res ;
} else {
$retour .= PROJET_VOUS_N_ETES_PAS_INSCRIT;
}
} else {
$retour .= PROJET_TEXTE_NON_IDENTIFIE;
}
} else {
$wiki_res .= '<a href="http://'.$GLOBALS['_GEN_commun']['url']->host.'/'.
PROJET_CHEMIN_WIKINI.$projet->getWikini().'" target="_blank" id="aller_sur_wikini">'.
PROJET_WIKINI_ALLER.'</a>';
$GLOBALS['_GEN_commun']['info_application']->wikini = $wiki;
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ACTION,'wikini');
$GLOBALS['_GEN_commun']['url']->addQueryString(PROJET_VARIABLE_ID_PROJET,$this->_id_projet);
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
$wiki_res.= afficherPageWikini();
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_MENU'] =afficherPageMenuWikini();
$retour .= $wiki_res ;
}
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
$retour .= $wiki_res ;
}
 
 
?>
/branches/v2.0-narmer/client/projet/actions/forums.php
New file
0,0 → 1,330
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: forums.php,v 1.11.2.1 2007-05-11 13:39:03 alexandre_tb Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.11.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once (PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php') ;
include_once (PROJET_CHEMIN_CLASSES.'inscription_liste.class.php') ;
include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
// RAPPEL IMPORTANT
// On se situe dans la méthode run() de la classe projetControleur
//
 
 
// création de l'objet projet courant
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$liste_ext_res = '' ;
$sortie_liste = '' ;
$inscription_laius ='' ;
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet);
if ($projet->avoirListe()) {
foreach ($projet->_listes_associes as $info_liste) {
ob_start() ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
if ($this->_auth->getAuth()) {
$participant = new participe($this->_db) ;
$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
if ($isAdm) $isCoord = true ;
} else {
$droits = PROJET_DROIT_AUCUN;
}
// gestion de l'inscription désinscription à la liste
// TODO : la gestion de linscription au résumé
$inscription_liste = new inscription_liste($this->_db) ;
$statut = $inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth ) ;
if ($this->_auth->getAuth() && isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
if ($statut == 2) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
} else {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
}
}
if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
$liste = new ezmlm_php() ;
// Paramétrage de la liste
$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
$liste->listname = $info_liste->getNom() ;
$liste->listdomain = $info_liste->getDomaine();
if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
$liste->set_action($GLOBALS['action']) ;
$liste->set_actionargs($GLOBALS['actionargs']) ;
} else {
$liste->set_action('list_info') ;
}
$liste->sendheaders = false;
$liste->sendbody = false;
$liste->sendfooters = false;
$liste->forcehref = $this->_url->getURL() ;
print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;
print "</a><br />\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL);
if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum))
print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);
$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
$info_liste->getNom(), $GLOBALS['lang'],
$this->_url->getURL()) ;
$xml_parser->load();
$resultat = $xml_parser->parse() ;
$xml_parser->reset();
//$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
// On teste si l'on vient d'une reponse a un email, si oui
// on modifie $liste->action pour renvoyer le message auquelon vient de repondre
if (isset($_POST['messageid'])) {
$liste->action = 'show_msg' ;
}
switch ($liste->action) {
case "show_msg":
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$mail = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($mail) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true',
'include_bodies' => 'true')) ;
$message = new ezmlm_msgdisplay() ;
$message->listname = $info_liste->getNom();
$this->_url->addQueryString ('action', 'show_msg');
if ($xml_parser->getNumeroFichierPrecedent() != '') {
print '[<a href="' . $this->_url->getURL(). '&amp;actionargs[]='.
$xml_parser->getNumeroRepertoirePrecedent().'&amp;actionargs[]='.
$xml_parser->getNumeroFichierPrecedent().
'">'.PROJET_PRECEDENT.'</a>]';
} else {
print '['.PROJET_PRECEDENT.']' ;
}
if ($xml_parser->getNumeroFichierSuivant() != '') {
print '[<a href="' .$this->_url->getURL().'&amp;actionargs[]='.$xml_parser->getNumeroRepertoireSuivant()
.'&amp;actionargs[]='.$xml_parser->getNumeroFichierSuivant().'">'.PROJET_SUIVANT. '</a>]';
} else {
print '['.PROJET_SUIVANT.']' ;
}
$this->_url->addQueryString ('action', 'repondre');
print '[<a href="'.$this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1].'">'.PROJET_REPONDRE.'</a>]';
if ($isCoord) {
$this->_url->addQueryString ('action', 'supprimer');
print '[<a href="'.$this->_url->getURL().'&amp;actionargs[]='.$liste->actionargs[0].
'&amp;actionargs[]='.$liste->actionargs[1].'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\');">'.
PROJET_SUPPRIMER.'</a>]';
}
print '<div class="message">' ;
print $message->parse_entete_mail($mailDecode) ;
$message->parse_template($mailDecode, $liste->actionargs[1], $liste->actionargs[0]);
print $message->message_rendu;
print '</div>' ;
break;
case "list_info":
print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
echo $derniers_messages ;
break;
case "show_threads":
$xml_parser->reset() ;
$xml_parser->setAction ('messages_thread');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_thread = ob_get_contents() ;
ob_end_clean();
echo $messages_thread ;
break;
case "show_author_msgs" :
$xml_parser->reset() ;
$xml_parser->setAction ('messages_auteur');
$xml_parser->setHashAuteur($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_auteur = ob_get_contents() ;
ob_end_clean();
echo $messages_auteur ;
break;
case 'show_month' :
echo '[ '.$liste->makelink(PROJET_VARIABLE_ACTION.'=forums&amp;action=show_threads&amp;actionargs[]='.
$liste->actionargs[0], 'par fil de discussion').' ]' ;
$xml_parser->reset() ;
$xml_parser->setAction ('messages_mois');
$xml_parser->setMois($liste->actionargs[0]);
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$messages_mois = ob_get_contents() ;
ob_end_clean();
echo $messages_mois ;
break;
case 'repondre' :
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$xml_parser->setAction ('message');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$message = ob_get_contents() ;
ob_end_clean();
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
if (isset($_SESSION['formulaire_mail'])) {
unset ($_SESSION['formulaire_mail']) ;
}
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post',
str_replace('&amp;', '&', $this->_url->getURL()).
'&action='.PROJET_ENVOYER_UN_MAIL_V.
'&actionargs[]='.$liste->actionargs[0].
'&actionargs[]='.$liste->actionargs[1].
'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$repondre = new ezmlm_repondre();
$repondre->listdir = $liste->listdir ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
$repondre->forcehref = $this->_url->getURL();
$repondre->listname = $info_liste->getNom() ;
// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
$repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
$repondre->parse_template($mailDecode, $liste->actionargs[0], $liste->actionargs[1]);
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $repondre->message_rendu) ;
$repondre->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $repondre->message_rendu,
'mail_titre' => 'Re : '.$repondre->decode_iso ($mailDecode->headers['subject']))) ;
print $formulaireReponse->toHTML() ;
 
break;
case 'supprimer' :
$xml_parser->reset() ;
$xml_parser->setAction ('supprimer');
$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;
$xml_parser->load();
print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
$xml_parser->reset() ;
$xml_parser->setAction ('derniers_messages');
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$derniers_messages = ob_get_contents() ;
ob_end_clean();
echo $derniers_messages ;
break;
}
} else {
print PROJET_MESSAGE_LISTE_PRIVEE ;
}
$sortie_liste = ob_get_contents() ;
ob_end_clean() ;
}
}
 
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
 
if (count ($tableau_liste) != 0) {
//$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
$liste_ext_res .= '<br />'."\n" ;
}
}
 
$retour .= '<h1>' ;
if (!isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) $retour .= PROJET_PROJET.' : ';
$retour .= $projet->getTitre()."</h1>" ;
$retour .= $inscription_laius ;
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
 
$retour .= $sortie_liste ;
$retour .= $liste_ext_res ;
?>
/branches/v2.0-narmer/client/projet/images/feuille.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/feuille.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/tronc.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/tronc.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/valider.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/valider.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/vide.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/vide.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/arbre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/arbre.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/feuille_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/feuille_droite.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/fleche_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/fleche_droite.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/puce.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/puce.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/feuille_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/feuille_gauche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/haut.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/haut.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/racine.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/racine.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/fleche_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/fleche_gauche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/barre_blanche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/barre_blanche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/feuille2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/feuille2.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/branche_droite.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/branche_droite.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/images/branche_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/images/branche_gauche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/configuration/projet.config.inc.php
New file
0,0 → 1,184
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.config.inc.php,v 1.10 2007-04-19 09:19:52 alexandre_tb Exp $
/**
* Application projet, fichier de configuration
*
* Fichier de configuration
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.10 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/**
//==================================== LES URLS ==================================
* Constantes liées à l'utilisation des url
//==================================================================================
*/
 
// Définition du lien vers "voir le projet"
define ("PROJET_LIEN_VOIR", "") ;
 
 
 
/**
//==================================== LES CHEMINS =================================
* Constantes définissant les chemins d'accé au différents fichiers inclus dans les
* applications.
//==================================================================================
*/
define ('PROJET_CHEMIN_APPLI','client/projet/');//le chemin vers l'application courante
define ('PROJET_CHEMIN_API_ARBRE', 'api/arbre/') ;
 
/** Chemin vers la bibliothèque API.*/
define ('PROJET_CHEMIN_BIBLIOTHEQUE_API', GEN_CHEMIN_API);
define ('PROJET_CHEMIN_ICONES', PROJET_CHEMIN_APPLI."icones/") ;
define ('PROJET_CHEMIN_CLASSES', PROJET_CHEMIN_APPLI.'classes/');//le chemin vers les fichiers propre à GSITE
define ('PROJET_CHEMIN_FONCTIONS', PROJET_CHEMIN_APPLI.'fonctions/') ;
define ('PROJET_CHEMIN_LIBRAIRIE','bibliotheque/');//le chemin de la librairie de fichier php
define ('PROJET_CHEMIN_FICHIER', "client/projet/fichiers/") ; // Chemin ou seront créer les dossiers
 
// Chemin vers les classes pour lire les listes de discussion
define ('PROJET_CHEMIN_CLASSES_LISTES', PROJET_CHEMIN_CLASSES."ezmlm-php-2.0/") ;
 
// Langue pas defaut
define ('PROJET_LANGUE_DEFAUT', "fr") ;
 
// Gestion de l'authentification
$GLOBALS['projet_auth'] = $GLOBALS['_GEN_commun']['pear_auth'];
 
// Un objet PEAR:DB connecté
$GLOBALS['projet_db'] = $GLOBALS['_GEN_commun']['pear_db'];
 
$GLOBALS['url'] =& $GLOBALS['_GEN_commun']['url'] ;
 
// La langue
if (!isset ($GLOBALS['lang'])) $GLOBALS['lang'] = PROJET_LANGUE_DEFAUT ;
/**
//==================================== CONSTANTES ==================================
* Constantes des noms de tables et de champs dans l'annuaire
//==================================================================================
*/
 
define ("PROJET_ANNUAIRE", "annuaire") ; // Nom de la table d'annuaire
define ("PROJET_CHAMPS_NOM", "a_nom") ; // Nom du champs nom
define ("PROJET_CHAMPS_MAIL", "a_mail") ; // Nom du champs mail
define ("PROJET_CHAMPS_PRENOM", "a_prenom") ; // Nom du champs prénom
define ("PROJET_CHAMPS_ID", "a_id") ;
 
/**
//==================================== CONSTANTES ==================================
* Constantes des chemins associés aux wikinis
//==================================================================================
*/
 
define ("PROJET_CHEMIN_WIKINI", "wikini/") ;
define ("PROJET_HOTE_WIKINI", "localhost") ;
define ("PROJET_UTILISATEUR_WIKINI", "") ;
define ("PROJET_MDP_WIKINI", "") ;
define ("PROJET_DB_WIKINI", "") ;
define ("PROJET_URL_WIKINI", "") ; // L'url vers le wikini
 
/**
//==================================== CONSTANTES ==================================
* Constantes des emails des administrateurs
//==================================================================================
*/
define ("PROJET_MAIL_ADMINISTRATEUR", "") ;
 
 
define ("PROJET_VARIABLE_ID_PROJET", "id_projet") ;
define ("PROJET_VARIABLE_ACTION", "act") ;
define ("PROJET_VARIABLE_ID_REPERTOIRE", "id_repertoire") ;
define ("PROJET_VARIABLE_ID_DOCUMENT", "id_document") ;
define ('PROJET_VARIABLE_SERVICE', 'service');
 
 
 
/**
//==================================== CONSTANTES ==================================
* Constantes pour les listes de discussion
//==================================================================================
*/
 
define ('PROJET_CHEMIN_LISTES', '') ;
define ('PROJET_DOMAINE_LISTE', '') ;
define ('PROJET_CHEMIN_ATELIERS', 'http://domaine.ext/papyrus.php?site=<>&menu=<>&id_projet=<>') ;
define ('PROJET_SERVEUR_VPOPMAIL', 'http://vpopmail.domaine.ext') ;
 
 
/**
//==================================== CONSTANTES ==================================
* Constantes pour des options
//==================================================================================
*/
define ('PROJET_UTILISE_TYPE', false) ;
define ('PROJET_UTILISE_HIERARCHIE', false) ;
define ('PROJET_LISTE_RESUME',true);
 
// Mettre à true si les utilisateurs peuvent déposer des projets
define ('PROJET_UTILISATEURS_COORD', false) ;
// Taille maximume des fichiers pouvant être uploadé : modifier aussi dans php.ini les variables :post_max_size et upload_max_filesize
define ('PROJET_UPLOAD_MAX_FILE_SIZE', 4*1024*1024) ;// 4 Mo
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.9 2007/02/13 15:11:39 jp_milcent
* Ajout d'une constante pour l'upload de fichier.
*
* Revision 1.8 2006/07/04 09:30:56 alexandre_tb
* Ajout d'une variable global lang pour éviter les warning dans certains cas
*
* Revision 1.7 2006/06/26 11:48:50 alexandre_tb
* typographie
*
* Revision 1.6 2006/03/02 09:24:36 mathilde
* remplacement des noms de tables de l'annuaire
*
* Revision 1.5 2006/02/15 16:33:42 alexandre_tb
* ajout de la constante PROJET_UTILISATEUR_COORD
*
* Revision 1.4 2006/01/26 14:06:07 florian
* ajout des constantes d'accès à vpopmail.
*
* Revision 1.3 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.2 2005/10/20 10:28:25 ddelon
* Wikini complet dans l'intégrateur Wikini
*
* Revision 1.1 2005/09/27 12:50:28 ddelon
* Projet configuration
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/branches/v2.0-narmer/client/projet/documentation/projet_v0.25.sql
New file
0,0 → 1,2
# Mise a jour performance
ALTER TABLE `projet` ADD `p_avoir_document` TINYINT UNSIGNED DEFAULT '0' NOT NULL ;
/branches/v2.0-narmer/client/projet/documentation/installation.txt
New file
0,0 → 1,33
Installation du module projet.
 
1. Uploader tous les fichiers de client/projet vers le serveur distant
2. Editer configuration/projet.config.inc.php, mettre des valeurs adéquates
3. Effectuer les requetes du fichier documentation/projet.sql
4. Ajouter un administrateur dans la table projet_statut_utilisateurs avec comme
statut 0
5. Déployer l'application dans un menu de papyrus, mettre en argument presentation=arbre
afin de pouvoir créer un premier projet
6. S'identifier avec le compte administrateur
7. Aller sur l'appli projet et créer le premier projet
8. éventuellement enlever le paramètre presentation
 
## Les paramètres
presentation=(arbre,liste) Note lorsqu'on choisit liste, les menus apparaissent par défaut
c'est une liste qui apparait mais sans les menus (cad seulement un point d'accès aux projets
exclure=(un nombre) n'affichera pas le projet dont le numéro est indiqué,
sert à créer des projets qui n'apparaissent pas mais sont accessible via une url
on peut indiquer plusieur numéro en les séparant par des virgules
projet_type=(un_type) permet de filtrer les projets selon leur type
seulement_forum=(nombre) n'affiche que le projet nombre et uniquement la page forum
utilise lorsqu'on veut un simple forum
seulement=(identifiant projet) n'affichera qu'un seul projet
prive=(0/1) si nombre = 1 alors les utilisateurs ne peuvent pas s'inscrire seul,
il faut l'intervention du coordonateur ou plus.
telechargement=1 Affiche un porte-document juste pour télécharger les fichier, à utiliser conjointement
avec "seulement"
## NOTE
dans la présentation par arbre, il faut veiller à avoir une cime, cad un projet qui n'a pas de père
 
 
Installation de la synchronisation
/branches/v2.0-narmer/client/projet/documentation/projet_v0.24.sql
New file
0,0 → 1,177
INSERT INTO `gen_application` ( `gap_id_application` , `gap_nom` , `gap_description` , `gap_chemin` , `gap_bool_applette` )
VALUES (
'18', 'Projets', 'Application de gestion de projets', 'client/projet/projet.php', '0'
);
 
CREATE TABLE `projet` (
`p_id` int(10) unsigned NOT NULL default '0',
`p_titre` varchar(255) NOT NULL default '',
`p_resume` varchar(255) NOT NULL default '',
`p_description` text,
`p_espace_internet` varchar(255) default NULL,
`p_wikini` varchar(255) NOT NULL default '',
`p_date_creation` date NOT NULL default '0000-00-00',
`p_nom_repertoire` varchar(255) NOT NULL default '',
`p_type` smallint(5) unsigned NOT NULL default '0',
`p_modere` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`p_id`)
);
 
 
 
CREATE TABLE `projet_documents` (
`pd_id` int(10) unsigned NOT NULL default '0',
`pd_ce_projet` int(10) unsigned NOT NULL default '0',
`pd_ce_utilisateur` int(11) default '0',
`pd_ce_type` int(11) NOT NULL default '0',
`pd_nom` varchar(255) default NULL,
`pd_lien` varchar(255) default NULL,
`pd_pere` int(10) unsigned NOT NULL default '0',
`pd_permissions` smallint(5) unsigned default NULL,
`pd_date_de_mise_a_jour` date default NULL,
`pd_description` text,
`pd_visibilite` varchar(64) NOT NULL default '',
PRIMARY KEY (`pd_id`)
);
 
 
CREATE TABLE `projet_evenement` (
`pe_id` int(10) unsigned NOT NULL auto_increment,
`pe_ce_utilisateur` int(11) NOT NULL default '0',
`pe_ce_projet` int(10) unsigned NOT NULL default '0',
`pe_date_debut` date default NULL,
`pe_titre` varchar(255) default NULL,
`pe_description` text,
`pe_date_fin` date default NULL,
PRIMARY KEY (`pe_id`)
);
 
CREATE TABLE `projet_hierarchie` (
`ph_id_projet_pere` int(10) unsigned NOT NULL default '0',
`ph_id_projet_fils` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`ph_id_projet_pere`,`ph_id_projet_fils`)
);
 
 
CREATE TABLE `projet_inscription_liste` (
`pil_id_liste` int(10) unsigned NOT NULL default '0',
`pil_id_utilisateur` int(10) unsigned NOT NULL default '0',
`pil_id_statut` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`pil_id_liste`,`pil_id_utilisateur`)
);
 
 
CREATE TABLE `projet_lien_liste` (
`pl_id_liste` int(10) unsigned NOT NULL default '0',
`pl_id_projet` int(10) unsigned NOT NULL default '0'
);
 
 
CREATE TABLE `projet_lien_liste_externe` (
`plle_id_projet` int(10) unsigned NOT NULL default '0',
`plle_id_liste` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`plle_id_projet`,`plle_id_liste`)
);
 
CREATE TABLE `projet_liste` (
`pl_id_liste` int(10) unsigned NOT NULL auto_increment,
`pl_nom_liste` varchar(255) NOT NULL default '',
`pl_domaine` varchar(255) NOT NULL default '',
`pl_adresse_liste` varchar(255) default NULL,
`pl_adresse_inscription` varchar(255) default NULL,
`pl_adresse_desinscription` varchar(255) default NULL,
`pl_adresse_aide` varchar(255) default NULL,
`pl_visibilite` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`pl_id_liste`)
);
 
 
CREATE TABLE `projet_liste_statut` (
`pls_id_statut` tinyint(3) unsigned NOT NULL default '0',
`pls_statut_nom` varchar(255) NOT NULL default '',
PRIMARY KEY (`pls_id_statut`)
);
 
INSERT INTO `projet_liste_statut` VALUES (0, 'Pas d''email');
INSERT INTO `projet_liste_statut` VALUES (2, 'Email');
CREATE TABLE `projet_statut` (
`ps_id_statut` int(10) unsigned NOT NULL default '0',
`ps_statut_nom` varchar(255) NOT NULL default '',
PRIMARY KEY (`ps_id_statut`)
);
 
INSERT INTO `projet_statut` VALUES (0, 'Administrateur');
INSERT INTO `projet_statut` VALUES (1, 'Coordonateur');
INSERT INTO `projet_statut` VALUES (2, 'Participant');
CREATE TABLE `projet_statut_utilisateurs` (
`psu_id_statut` int(10) unsigned NOT NULL default '0',
`psu_id_utilisateur` int(11) NOT NULL default '0',
`psu_id_projet` int(10) unsigned NOT NULL default '0',
`psu_date_inscription` date default '0000-00-00',
PRIMARY KEY (`psu_id_statut`,`psu_id_utilisateur`,`psu_id_projet`)
);
-- La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
-- pour indiquer un administrateur
 
INSERT INTO `projet_statut_utilisateurs` ( `psu_id_statut` , `psu_id_utilisateur` , `psu_id_projet` , `psu_date_inscription` )
VALUES (
'0', '1', '0', '0000-00-00'
);
 
 
 
CREATE TABLE `gen_type_de_fichier` (
`gtf_id_type` int(11) NOT NULL default '0',
`gtf_nom` varchar(255) NOT NULL default '',
`gtf_extension` varchar(255) NOT NULL default '',
`gtf_type_icone` varchar(255) NOT NULL default 'default.gif',
`gtf_type_mime` varchar(255) NOT NULL default '',
`gtf_description` varchar(255) default NULL,
PRIMARY KEY (`gtf_id_type`)
) ;
 
--
-- Contenu de la table `gen_type_de_fichier`
--
 
INSERT INTO `gen_type_de_fichier` VALUES (1, 'Fichier Document', 'doc', 'docdoc.gif', 'application/msword', '');
INSERT INTO `gen_type_de_fichier` VALUES (2, 'Fichier Texte', 'txt', 'doctxt.gif', 'text/plain', '');
INSERT INTO `gen_type_de_fichier` VALUES (3, 'Fichier Texte Enrichi', 'rtf', 'docdoc.gif', 'text/rtf', '');
INSERT INTO `gen_type_de_fichier` VALUES (4, 'Fichier Compressà', 'zip', 'doczip.gif', 'application/zip', '');
INSERT INTO `gen_type_de_fichier` VALUES (5, 'Document PDF', 'pdf', 'pdf.gif', 'application/pdf', '');
INSERT INTO `gen_type_de_fichier` VALUES (6, 'Page Web', 'htm', 'web.gif', 'text/html', 'htm, html');
INSERT INTO `gen_type_de_fichier` VALUES (7, 'Feuille de Calcul Excel', 'xls', 'docxls.gif', 'application/vnd.ms-excel', '');
INSERT INTO `gen_type_de_fichier` VALUES (8, 'Présentation Power Point', 'ppt', 'docppt.gif', 'application/vnd.ms-powerpoint', '');
INSERT INTO `gen_type_de_fichier` VALUES (9, 'Image JPG', 'jpg', 'docimg.gif', 'image/jpg', 'jpg, jpeg');
INSERT INTO `gen_type_de_fichier` VALUES (10, 'Image GIF', 'gif', 'docimg.gif', 'image/gif', '');
INSERT INTO `gen_type_de_fichier` VALUES (11, 'Image PNG', 'png', 'docimg.gif', 'image/png', '');
INSERT INTO `gen_type_de_fichier` VALUES (12, 'Inconnu', '', 'default.gif', '', '');
INSERT INTO `gen_type_de_fichier` VALUES (13, 'Fichier PHP', 'php', 'php.gif', '', '');
INSERT INTO `gen_type_de_fichier` VALUES (14, 'Fichier Photoshop', 'psd', 'docpsd.gif', 'image/psd', 'psd');
INSERT INTO `gen_type_de_fichier` VALUES (15, 'Présentation OpenOffice Impress', 'sxi', 'docppt.gif', 'application/vnd.sun.xml.impress', 'sxi');
INSERT INTO `gen_type_de_fichier` VALUES (16, 'Image JPG', 'jpg', 'docimg.gif', 'image/jpeg', 'jpg, jpeg');
INSERT INTO `gen_type_de_fichier` VALUES (17, 'Image JPG', 'jpg', 'docimg.gif', 'image/pjpeg', 'jpg, jpeg');
CREATE TABLE `projet_type` (
`pt_id_type` tinyint(3) unsigned NOT NULL default '0',
`pt_label_type` varchar(255) NOT NULL default '',
PRIMARY KEY (`pt_id_type`)
) ;
 
CREATE TABLE `projet_template` (
`pt_id_template` smallint(5) unsigned NOT NULL default '0',
`pt_i18n` varchar(5) NOT NULL default '',
`pt_template` text NOT NULL,
PRIMARY KEY (`pt_id_template`)
);
 
#
# Contenu de la table `projet_template`
#
 
INSERT INTO `projet_template` VALUES (1, 'fr-FR', 'L\'utilisateur {nom} {prenom} souhaite être inscrit au projet {nom_projet} dont vous êtes modérateur.\r\nCliquez sur le lien suivant pour modérer son inscription.\r\n{lien}\r\n');
 
 
/branches/v2.0-narmer/client/projet/presentation/arbre.php
New file
0,0 → 1,97
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: arbre.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* Fichier de présentation de la liste des projets par arbre
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// ON est dans la méthode mesProjets() de la classe projetControleur
 
$titre = '<h1>Arbre des Projets</h1>'."\n" ;
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
// initialisation de variables
$intensite_feuille = '' ; $longueur_branche = '' ;
$arbre = new arbre() ;
// recherche du projet principal
 
$cime='';
 
foreach ($projetListe as $projet) {
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$lien_feuille = $this->_url->getURL() ;
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
 
if ($projet->isRacine()) {
$cime = $arbre->cime($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(), $lien_feuille, '') ;
} else {
 
$arbre->addBranche($projet->getTitre(), $this->_url->getURL(), $projet->getNombreInscrits(),
$lien_feuille, $lien_feuille, $intensite_feuille, $longueur_branche) ;
}
}
return $titre.'<table id="arbre">'.$cime.$arbre->affBranche().$arbre->affRacine().'</table>';
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2.2.1 2007/04/11 14:26:00 alexandre_tb
* ajout d'un include de projet.class.php et participe.class.php pour limiter le nombre de fichier inclu par projetControleur.class.php
*
* Revision 1.2 2006/03/02 16:07:17 alexandre_tb
* ajout d'un id pour l'arbre
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/branches/v2.0-narmer/client/projet/presentation/liste.php
New file
0,0 → 1,255
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: liste.php,v 1.6.2.1 2007-05-11 13:57:20 alexandre_tb Exp $
/**
* Application projet
*
* Fichier de présentation de la liste des projets
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6.2.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
} else {
// Un tableau de tous les projets dans $projetListe
$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php' ;
// On vérifie si l'utilisateur participe a des projets
//echo PROJET_CHEMIN_APPLI.'langues/pro_langue_'.$GLOBALS['lang'].'.local.inc.php';
// Entete de la liste, qu'on recupere dans un template
 
if (PROJET_UTILISE_TYPE && $this->_type != "") {
include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php' ;
include_once 'HTML/Template/IT.php';
$template = new projetTemplate ($this->_db) ;
$chaine = $template->getTemplate(2, $GLOBALS['lang'], $this->_type);
if (projetTemplate::isError ($chaine)) return $chaine->getMessage() ;
$tpl = new HTML_Template_IT() ;
$tpl -> setTemplate($chaine);
}
 
if ($auth){
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$utilisateur_liste = new inscription_liste($this->_db) ;
// On teste ici s'il y a une mise a jour de statut
if (isset($_POST['statut'])) {
// $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$projet = new projet ($this->_db, $_GET['identifiant_projet']) ;
$projet->getListesAssociees() ;
$utilisateur_liste->modifierTypeInscription($projet->_listes_associes[0],$annuaire, $_POST['statut']) ;
}
if (count($participant->getIdProjetsStatuts($id_u))) {
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetListe = new HTML_listeProjet(true) ;
$entete_liste = array($auth ? PROJET_VOUS_PARTICIPEZ : PROJET_LISTE) ;
if ($auth) array_push ($entete_liste, PROJET_SE_DESINSCRIRE, PROJET_LISTE_DE_DISCUSSION) ;
 
 
$tableau_resultat = array () ;
 
$HTML_projetListe->construitEntete ($entete_liste) ;
 
// On construit $tableau_resultat avec une ligne par projet contenant un tableau (titre, statut_nom, id_statut, id_projet)
include_once PROJET_CHEMIN_CLASSES.'statut_liste.class.php' ;
$statut_liste = new statut_liste($this->_db) ;
$tableau_statut = $statut_liste->getTousLesStatuts() ;
 
$statut = '' ;
$i = 0 ;
$HTML_projetListe->setModeModification() ;
$HTML_projetListe->setURL($this->_url) ;
foreach ($projetListe as $projet) {
if (participe::getStatutSurProjetCourant($id_u, $projet->getId(), $this->_db) == 4) continue ;
if ($auth) {
if ($projet->avoirListe()) {
$projet->getListesAssociees() ;
$statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
//if ($statut == '') $statut = 0 ;
}
}
 
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_tableau = array ($projet->getId(), $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
) ;
if ($auth) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
if ($projet->avoirListe()) {
array_push ($ligne_tableau, $statut) ;
} else {
array_push($ligne_tableau, '') ;
}
array_push ($tableau_resultat, $ligne_tableau) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
$statut = '' ;
}
$HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
 
 
if ($HTML_projetListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_PARTICIPER.'</p>';
$res .= $HTML_projetListe->toHTML() ;
}
} else {
$res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
}
}
 
// Un texte pour ceux qui ne sont pas identifiés
if (!$auth) {
$res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
}
 
// Maintenant la liste des projets ou l'utilisateur ne participe pas.
// Et si pas loggue tous les projets
if ($auth) {
$projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
// Si certain projet sont à exclure, on les exclu
$projet_a_exclure = array() ;
if (count($this->_projet_exclu)) {
arsort($this->_projet_exclu) ;
foreach ($this->_projet_exclu as $valeur) {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getId() == $valeur) array_push ($projet_a_exclure, $i);}
}
}
if (PROJET_UTILISE_TYPE && $this->_type != '') {
for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
if ($projetNonParticipantListe[$i]->getType() != $this->_type) array_push ($projet_a_exclure, $i) ;
}
}
 
foreach ($projet_a_exclure as $valeur) {
unset ($projetNonParticipantListe[$valeur]) ;
}
 
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
array_push ($entete_liste, PROJET_S_INSCRIRE) ;
 
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
 
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ($projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>' // le nom du projet
) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
} else {
$projetNonParticipantListe = & $projetListe ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array (PROJET_LISTE) ;
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
foreach ($projetNonParticipantListe as $projet) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
$ligne_projet = array ( $projet->getResume(),
'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>', // le nom du projet
) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
$res .= $HTML_projetNonParticipantListe->toHTML() ;
}
}
// Nettoyage de l'url
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$tpl->setVariable('liste_projet', $res) ;
$res = $tpl->get();
}
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
return $titre.$res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2007/04/19 15:34:35 neiluj
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.5 2006/12/19 09:48:50 alexandre_tb
* amélioration du retour erreur lors de l appel au template
*
* Revision 1.4 2006/12/18 17:24:09 alexandre_tb
* inclusion du fichier de langue en utilisant la globale 'lang'
*
* Revision 1.3 2006/09/18 09:56:28 alexandre_tb
* utilisation d'un template pour l'entête de la liste des projets
*
* Revision 1.2 2005/11/28 16:25:23 alexandre_tb
* nettoyage URL en sortie de programme
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/branches/v2.0-narmer/client/projet/presentation/tela.php
New file
0,0 → 1,179
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: tela.php,v 1.6 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* Fichier de présentation de la liste des projets pour Tela Botanica
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
define ('PROJET_LISTE_RESUME', false) ;
 
if (PROJET_UTILISE_TYPE && $this->_type != '') {
$projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
} else {
// Un tableau de tous les projets dans $projetListe
//$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
}
 
 
// requete pour recuperer la liste des projets
$requete = 'select p_id, p_titre, p_wikini, pl_id_liste, plle_id_liste, p_avoir_document from'.
' projet left join projet_lien_liste on p_id=pl_id_projet'.
' left join projet_lien_liste_externe on p_id=plle_id_projet'.
' group by p_id order by p_titre' ;
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$res = '<h1>Liste des projets et forums de Tela Botanica</h1>'."\n" ;
// Ajout du cartouche résumant la création d'un projet.
$res .= '<div class="notes">
<h4>Cràez votre projet...</h4>
<p class="last"> Toute personne inscrite au réseau Tela Botanica peut demander à créer un forum de discussion ou monter un projet collaboratif. <br />
<a href="http://www.tela-botanica.org/page:creez_votre_projet">Voir la démarche en détail</a></p>
</div>';
// On inclue un fichier local
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
// On vérifie si l'utilisateur participe à des projets
 
$projetNonParticipantListe = & $projetListe ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeProjet.class.php' ;
$HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
$entete_liste = array ('Titre des projets et des forums', 'Forums', 'Wiki','RSS', 'Documents', 'Participants',) ;
$HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
 
$liste_projet = array() ;
// La liste
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
// Recherche du forum
if ($ligne->pl_id_liste != null) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
$forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica"/></a>';
} else {
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$listes_ext = new liste_externe ($this->_db) ;
if ($ligne->plle_id_liste != null) {
$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
'"><img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/></a>';
} else {
$forum = '-';
}
}
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_res = '<a href="'.$link.'">voir</a>' ;
$this->_url->removeQueryString ('act');
} else {
$wiki_res = '-' ;
}
$titre= '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
if ($ligne->p_avoir_document != 0) {
$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
} else {
$document = '-' ;
}
if ($ligne->p_wikini) {
$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
$link=$this->_url->getURL();
$wiki_rss = '<a href="'.$link.'&wiki=DerniersChangementsRSS/xml'.'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
$this->_url->removeQueryString ('act');
} else {
$wiki_rss = '-' ;
}
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant) ;
 
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
}
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$HTML_projetNonParticipantListe->construitListe($liste_projet) ;
if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
///$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
$res .= $HTML_projetNonParticipantListe->toHTML() ;
}
 
// Nettoyage de l'url
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
return $res ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5.2.1 2007/04/11 14:24:39 alexandre_tb
* amélioration des performances par l'appel d'une requete directe
*
* Revision 1.5 2006/10/30 11:26:11 jp_milcent
* Modification du cartouche concernant la création d'un projet sur Tela.
*
* Revision 1.4 2006/01/09 21:55:19 ddelon
* flux rss dans liste des projets
*
* Revision 1.3 2005/12/07 11:02:35 jp_milcent
* Ajout d'attribut alt aux images.
*
* Revision 1.2 2005/11/28 11:15:22 alexandre_tb
* nettoyage URL en sortie de programme
*
* Revision 1.1 2005/11/25 14:47:51 alexandre_tb
* version initiale
*
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
 
?>
/branches/v2.0-narmer/client/projet/js/telechargement.js
New file
0,0 → 1,76
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: telechargement.js,v 1.1.2.2 2007-06-04 15:41:47 alexandre_tb Exp $
/**
* Application projet
*
* La service de telechargement
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2007
*@version $Revision: 1.1.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
var dojoConfig = {
isDebug: true
};
 
dojo.require("dojo.widget.Tree");
dojo.require("dojo.widget.TreeNode");
dojo.require("dojo.widget.TreeSelector");
dojo.require("dojo.widget.TreeLoadingController");
dojo.require("dojo.event.*");
 
 
function treeSelectFired() {
 
// une reference vers treeSelector et vers le noeud selectionne
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
var treeNode = treeSelector.selectedNode;
 
// le noeud est il un repertoire
var isFolder = treeNode['isFolder'];
 
// Si non on dirige vers le document
if ( !isFolder) {
var link = treeNode['link'];
document.location.href =link;
} else {
var repertoire = dojo.widget.manager.getWidgetById('treeController');
repertoire.expand(treeNode);
}
}
 
function init() {
// une reference vers treeSelector
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
 
// on connecte le select event a la fonction treeSelectFired() -->
dojo.event.connect(treeSelector,'select','treeSelectFired');
// On ouvre le noeud racine
var rootNode = dojo.widget.manager.getWidgetById('rootNode');
rootNode.expand();
}
 
dojo.addOnLoad(init);
/branches/v2.0-narmer/client/projet/js/arbreDocument.js
New file
0,0 → 1,65
var dojoConfig = {
isDebug: true
};
dojo.require("dojo.lang.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Tree");
dojo.require("dojo.widget.TreeNode");
dojo.require("dojo.widget.TreeSelector");
dojo.require("dojo.widget.TreeLoadingController");
dojo.require("dojo.event.*");
dojo.require("dojo.io.*");
 
function treeSelectFired() {
 
// une reference vers treeSelector et vers le noeud selectionne
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
var treeNode = treeSelector.selectedNode;
 
// le noeud est il un repertoire
var isFolder = treeNode['isFolder'];
 
// Si non on dirige vers le document
if ( !isFolder) {
var link = treeNode['link'];
document.location.href= link;
} else {
var repertoire = dojo.widget.manager.getWidgetById('treeController');
repertoire.expand(treeNode);
}
}
 
function init() {
// une reference vers treeSelector
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
 
// on connecte le select event a la fonction treeSelectFired()
dojo.event.connect(treeSelector,'select','treeSelectFired');
var rootNode = dojo.widget.manager.getWidgetById('rootNode');
var loadingController = dojo.widget.manager.getWidgetById('treeController');
// L appel ci-dessous permet de charger les donnees du noeud racine
loadingController.loadRemote(rootNode);
// On ouvre le noeud racine
rootNode.expand();
//ajout d'un listener a la suppression d'un noeud
dojo.event.topic.subscribe("nodeRemoved", ioDeplaceFichier) ;
}
 
// envoie une requete asynchrone pour deplacer un fichier
 
function ioDeplaceFichier (message) {
var url = window.location.href ;
var arguments = {
url : url + "&service=serviceDeplacementFichier&enfant=" + message.child.objectId + "&parent=" + message.newParent.objectId,
mimetype: "text/json",
error : function (type, errObj) { alert ('erreur'); },
load : function (type, data, evt) {}
};
//var treeLoadingController = dojo.widget.manager.getWidgetById('treeController');
dojo.io.bind (arguments) ;
}
dojo.addOnLoad(init);
/branches/v2.0-narmer/client/projet/bibliotheque/images/logo_tb_pr_wikini.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/bibliotheque/images/logo_tb_pr_wikini.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/bibliotheque/images/tela.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/bibliotheque/images/tela.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/bibliotheque/images/tela.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/bibliotheque/images/tela.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/bibliotheque/projet.fonct.rss.php
New file
0,0 → 1,108
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.fonct.rss.php,v 1.2 2007-03-28 08:51:22 neiluj Exp $
/**
* Générateur de flux RSS à partir de l'application projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $$
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS DU PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/** gen_RSS() - générer un fichier de flux RSS par type liste
*
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
* @param integer L'état de validation de l'annonce (laisser 1 pour les annonces validées, 0 pour les non-validées)
* @param string La requête SQL personnalisée
*
* @return string Le code du flux RSS
*/
function gen_RSS($domaine='', $nbitem='', $liste='') {
// En-tête du flux RSS version 2.0
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n";
$xml .= '<description>'.BAZ_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
'<copyright>Copyright 2005 '.BAZ_RSS_NOMSITE.'</copyright>'."\n";
// Ajout de la date actuelle de publication (suivant la DTD RSS)
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
// En-tête suite et fin
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.BAZ_RSS_CATEGORIE.'</category>'."\n".
'<managingEditor>'.BAZ_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.BAZ_RSS_WEBMASTER.'</webMaster>'."\n";
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.BAZ_RSS_NOMSITE.'</title>'."\n".'<url>'.BAZ_RSS_LOGOSITE.'</url>'."\n".
'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
if ($resultat->numRows()>0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= '<item>'."\n";
$xml .= '<title>'.$ligne['bf_titre'].'</title>'."\n";
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= '<link>'.str_replace ('&', '&amp;', $lien->getURL()).'</link>'."\n";
$xml .= '<description>'."\n".'<![CDATA['.baz_voir_fiche(0,$ligne['bf_id_fiche']).']]>'."\n".'</description>'."\n";
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($ligne['bf_date_debut_validite_fiche'])).'</pubDate>'."\n";
$xml .= '</item>'."\n";
}
}
else {//pas d'annonces
$xml .= '<item>'."\n";
$xml .= '<title>'.BAZ_PAS_D_ANNONCES.'</title>'."\n";
$xml .= '<link></link>'."\n";
$xml .= '<description>'.BAZ_PAS_D_ANNONCES.'</description>'."\n";
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
$xml .= '</item>'."\n";
}
$xml .= '</channel>'."\n".'</rss>'."\n";
return $xml;
}
 
 
/** baz_liste() Formate la liste de toutes les annonces actuelles
*
* @return string le code HTML à afficher
*/
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/10/25 13:50:54 alexandre_tb
* version initiale
*
 
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/projet/projet_derniers_telechargements.php
New file
0,0 → 1,205
<?php
 
/* +-----------------------------------------------------------------------+
* |projet_derniers_telechargement.php |
* +-----------------------------------------------------------------------+
* | Copyright (c) 2001 - 2005 Tela Botanica |
* +-----------------------------------------------------------------------+
* | Affiche les derniers fichiers uploader dans le module projet |
* +-----------------------------------------------------------------------+
* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
* +-----------------------------------------------------------------------+
 
* $Id: projet_derniers_telechargements.php,v 1.4.2.2 2007-06-04 15:43:28 alexandre_tb Exp $
*/
 
// Cette application affiche les derniers documents uploades dans le module projet
// ainsi que tous les documents du module
 
// ===========================================================
// Configuration
// ===========================================================
 
 
// Le nombre a afficher
define ("PROJET_TELECHARGEMENT_NOMBRE", 8) ;
 
//==================== Les labels =======================================
define ("PROJET_TELECHARGEMENT_TITRE", "Page de t&eacute;l&eacute;chargements rapides") ;
define ("PROJET_TELECHARGEMENT_DERNIERS", "Derniers documents mis en ligne") ;
define ("PROJET_TELECHARGEMENT_TOUS", "Tous les documents, par projet") ;
 
//=============bibliotheques PEAR ===================================
include_once 'HTML/Table.php' ;
 
// ========== Bibliotheque Projet ====================================
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.inc.php' ;
 
 
function afficherContenuCorps() {
global $id_projet, $repcourant, $baseURL, $projet ;
if (isset($_GET['service'])) {
if ($_GET['service'] == 'ecouteArbreFichier') {
include_once PROJET_CHEMIN_APPLI.'/services/ecouteArbreFichier.php';
}
if ($_GET['service'] == 'telechargement') {
include_once PROJET_CHEMIN_APPLI.'/services/telechargement.php';
}
}
// a remplacer par un div pour genesia
$res = "<h1>".PROJET_TELECHARGEMENT_TITRE."</h1>\n" ;
$res .= "<h2>".PROJET_TELECHARGEMENT_DERNIERS."</h2>\n" ;
$liste_documents = document::getDocumentsRecents( $nombre = 10, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER,PROJET_CHEMIN_ICONES) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($GLOBALS['url'], false, '', $GLOBALS['projet_auth']) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $GLOBALS['projet_db']) ;
$res .= $vue_liste_document->toHTML('', PROJET_DROIT_AUCUN) ;
$res .= "<h2>".PROJET_TELECHARGEMENT_TOUS."</h2>\n" ;
 
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$i = 0 ;
// Requete sur les projets
$requete = "SELECT p_titre, p_id FROM projet ORDER BY p_titre" ;
$resultat = $GLOBALS['projet_db']->query ($requete) or die ("Echec <br />".mysql_error()."<br />$requete") ;
$noeudProjet = '' ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$titre = $ligne->p_titre ;
$i++ ;
$noeudProjet .= '<div dojoType="TreeNode" title="'.$ligne->p_titre.'" widgetId="projet_'.
$ligne->p_id.'" objectId="projet_'.$ligne->p_id.'" isFolder="true"></div>'."\n";
}
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', PROJET_CHEMIN_APPLI.'js/telechargement.js');
//$res .= '<p>' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $GLOBALS['url']->getURL();
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" widgetId="bandTree" controller="treeController">
<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true">'."\n".
$noeudProjet.'</div></div>';
//$res .= '</p>';
return $res ;
}
 
/** fonction projet_fichiers() - Remplie un noeud avec les fichiers et repertoires
*
* Le noeud est passe en reference. Ainsi, cette fonction ne retourne rien mais modifie le tableau des
* noeuds passe en reference.
*
* return void
*/
 
function projet_fichiers ($noeud, $id_rep, $pere = 0)
{
//Recuperation de l'identifiant du repertoire courant
//La fonction est appele recursivement quand $pere ne vaut pas null
//$id_rep prend donc la valeur de $pere transmise par l'appel precedent de la fonction.
// Les noms des fichiers graphiques
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
//Requête pour récupérer les noms des répertoires contenus dans le répertoire courant ($id_rep)
$queryRep = ' SELECT projet_documents.*'.
' FROM projet_documents'.
' WHERE projet_documents.pd_pere = '.$pere.
' AND projet_documents.pd_visibilite = "public" and pd_ce_projet='.$id_rep.' and pd_ce_type=0'.
' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultRep = $GLOBALS['projet_db']->query($queryRep) ;
if (DB::isError ($resultRep)) {
die ('Echec de la requete : '.$queryRep.'<br />'.$resultRep->getMessage()) ;
}
//Stockage des informations sur les répertoires contenu dans le répertoire courant pour affichage dans un arbre.
//Et appel récursif de la fonction pour examiner le contenu de chaque répertoire du répertoire courant.
if ( $resultRep->numRows() != 0 ) {
while ( $ligneRep = $resultRep->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Stockage des informations sur le répertoire courant
$noeud1_1 = &$noeud->addItem(new HTML_TreeNode(
array(
'text' => trim ($ligneRep->pd_nom),
'link' => "", 'icon' => $icon,
'expandedIcon' => $expandedIcon ) ) );
//Appel récursif de fonction courante
projet_fichiers (&$noeud1_1, $id_rep, $ligneRep->pd_id) ;
}
}
// Requête pour récupérer les fichiers du répertoire courant ($id_rep) et leurs informations
$requete_fichiers = 'SELECT projet_documents.*, gen_type_de_fichier.gtf_type_icone'.
' FROM projet_documents, gen_type_de_fichier'.
' WHERE projet_documents.pd_ce_type= gen_type_de_fichier.gtf_id_type'.
' AND projet_documents.pd_visibilite= "public" ' ;
if ($pere == 0) {
$requete_fichiers .= ' AND projet_documents.pd_ce_projet= '.$id_rep.' and pd_pere=0 and pd_ce_type <> 0' ;
} else {
$requete_fichiers .= ' AND projet_documents.pd_pere= '.$pere.' and pd_ce_type<>0' ;
}
$requete_fichiers .= ' ORDER BY projet_documents.pd_nom ASC' ;
 
$resultat_fichiers = $GLOBALS['projet_db']->query($requete_fichiers) ;
if (DB::isError ($resultat_fichiers)) {
die ('Echec de la requete : '.$requete_fichiers.'<br />'.$resultat_fichiers->getMessage()) ;
}
//Stockage des informations sur les fichiers du répertoires courant pour affichage dans un arbre
if ( $resultat_fichiers->numRows() != 0 ) {
while ( $ligne_fichiers = $resultat_fichiers->fetchRow(DB_FETCHMODE_OBJECT) ) {
//Ajout de slash devant les caractères spéciaux et suppression des caractères invisibles en début et fin des noms de fichier.
$lien = trim( $ligne_fichiers->pd_nom );
$noeud_1_2 = &$noeud->addItem (new HTML_TreeNode (
array (
"text" => $lien,
"link" => PROJET_CHEMIN_FICHIER.$ligne_fichiers->pd_lien,
'icon' => $ligne_fichiers->gtf_type_icone,
"linkTarget" => "_blank" ))) ;
}
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4.2.1 2007-05-11 13:59:27 alexandre_tb
* adaptation a ecouteArbreFichier qui est maintenant appele par papyrus.php
*
* Revision 1.4 2007/04/19 09:17:35 alexandre_tb
* utilisation de dojo pour afficher l arbre des derniers documents
*
* Revision 1.3 2005/10/06 08:23:48 alexandre_tb
* Ajout de commentaires
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
 
?>
/branches/v2.0-narmer/client/projet/icones/webadd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/webadd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/nav-end.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/nav-end.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbfasc-ind.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbfasc-ind.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/doczip.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/doczip.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/validate.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/validate.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/cut.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/cut.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/unlock.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/unlock.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/print.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/print.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbadd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbadd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/square.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/square.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/dn.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/dn.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/minus16.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/minus16.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/more.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/more.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/idea.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/idea.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/addcross.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/addcross.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/menu.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/menu.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bblast.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bblast.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/prog.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/prog.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/pdf.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/pdf.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/copy.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/copy.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/trash.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/trash.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/hasunreadmsg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/hasunreadmsg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/cancel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/cancel.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/ico-perio.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/ico-perio.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/php.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/php.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/texte.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/texte.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/plus16.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/plus16.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/docdoc.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/docdoc.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/down-arrow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/down-arrow.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbmodif.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbmodif.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/ico-disk.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/ico-disk.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/docimg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/docimg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/right-arrow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/right-arrow.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/openclose-plus.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/openclose-plus.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/switch-off.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/switch-off.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/switch-on.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/switch-on.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/docpsd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/docpsd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/nav-start.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/nav-start.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bomb.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bomb.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/hasnomsg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/hasnomsg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/sgbd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/sgbd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/openclose-minus.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/openclose-minus.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/multimed.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/multimed.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/left-arrow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/left-arrow.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/up.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/up.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/lock.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/lock.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/add.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/add.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/openclose-plus-trait.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/openclose-plus-trait.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/ico-livre.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/ico-livre.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/newflech.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/newflech.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/trait-fin.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/trait-fin.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/ico-cd.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/ico-cd.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/son.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/son.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/newmsg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/newmsg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/openclose-minus-trait.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/openclose-minus-trait.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/less.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/less.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/down.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/down.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/up-arrow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/up-arrow.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/logoff.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/logoff.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/paste.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/paste.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/modif.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/modif.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/repertoire.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/repertoire.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/mail.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/mail.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbreturn.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbreturn.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/trait.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/trait.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/moins.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/moins.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/docppt.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/docppt.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/upper.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/upper.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/docxls.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/docxls.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/ideared.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/ideared.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/modif.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/modif.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/Tela.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/Tela.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/nav-next.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/nav-next.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/opendir.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/opendir.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/folder-expanded.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/folder-expanded.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/replymsg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/replymsg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/doctxt.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/doctxt.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/doc.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/doc.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbdel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbdel.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/img.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/img.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/see.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/see.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/web.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/web.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/hasmsg.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/hasmsg.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/bbnext.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/bbnext.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/default.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/default.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/icones/nav-last.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/projet/icones/nav-last.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/projet/arbre_des_forumsV3.php
New file
0,0 → 1,187
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: arbre_des_forumsV3.php,v 1.1 2005-09-22 14:02:48 ddelon Exp $
/**
* Application arbre des forums
*
* Fichier d'appel pour papyrus
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
include_once 'configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_API_ARBRE.'arbre.class.php' ;
 
// Inclusion des styles selon papyrus
if (function_exists("GEN_stockerStyleExterne")) {
GEN_stockerStyleExterne('projet','client/projet/arbre.css') ;
}
 
 
function afficherContenuNavigation()
{
$sortie = '';
if (isset($_GET['forum']) || isset($GLOBALS['_GEN_commun']['info_application']->aide)) {
if (!isset($_GET['forum'])) {
$_GET['forum'] = '[exemple]' ;
$_GET['aide'] = 1 ;
}
$sortie .= '<ul class="menu_classique_n3">';
if (isset($_GET['aide'])) {
$style_aide = 'menu_actif' ;
$style_info = 'menu_inactif' ;
} else {
$style_aide = 'menu_inactif' ;
$style_info = 'menu_actif' ;
}
$GLOBALS['url']->addQueryString('forum', $_GET['forum']);
$sortie .= '<li class="'.$style_info.'"><a href="'.$GLOBALS['url']->getURL().'">Infos</a></li>';
$GLOBALS['url']->addQueryString('aide', 1);
$sortie .= '<li class="'.$style_aide.'"><a href="'.$GLOBALS['url']->getURL().'">Aide</a></li>';
$sortie .= '</ul>';
}
return $sortie;
}
 
 
function afficherContenuCorps () {
if (isset ($_GET['forum']) && !isset($_GET['aide']) /*&& isset($GLOBALS['_GEN_commun']['info_application']->aide)*/) {
include_once PROJET_CHEMIN_APPLI.'forums-lst.php' ;
return putFrame() ;
}
if (isset ($_GET['aide']) ||isset($GLOBALS['_GEN_commun']['info_application']->aide)) {
if (!isset($_GET['forum'])) $_GET['forum'] = '[exemple]' ;
if (!isset($_GET['aide'])) $_GET['aide'] = 1 ;
include_once PROJET_CHEMIN_APPLI.'forums-hlp.php' ;
return putFrame() ;
}
// Récupération des arguments de papyrus
$thema = $GLOBALS['_GEN_commun']['info_appli']->theme ;
 
global $num_sem; // le numero de la semaine
 
// requete sur le sommet de l'arbre
$requete = "SELECT NB_ABONNES,NUM_SEM FROM agora_stats WHERE FORUM=\"tela-botanicae\" ORDER BY NUM_SEM DESC" ;
$resultat =$GLOBALS['projet_db']->query($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
 
// le numero de la semaine
if (empty($num_sem)) $num_sem = $ligne->NUM_SEM ;
 
// requete sur le sommet de l'arbre avec le bon numero de semaine
$resultat_sommet = $GLOBALS['projet_db']->query("SELECT NB_ABONNES,NB_MESSAGES FROM agora_stats WHERE FORUM=\"tela-botanicae\" AND NUM_SEM=\"$num_sem\"");
$ligne_sommet = $resultat_sommet->fetchRow(DB_FETCHMODE_OBJECT) ;
$nb_total_mess = $ligne_sommet->NB_MESSAGES;
$nb_total_abon = $ligne_sommet->NB_ABONNES;
 
$requete_donnee_sommet = "SELECT AGO_A_LIEN_PUCE,AGO_A_LIEN_FEUILLE,AGO_A_LIEN_BRANCHE FROM agora WHERE AGO_A_NOMGRP=\"tela-botanicae\"" ;
$resultat_donnee_sommet = $GLOBALS['projet_db']->query($requete_donnee_sommet) or die ("Echec de la requ&ecirc;te sur les forums2");
$ligne_donnee_sommet = $resultat_donnee_sommet->fetchRow(DB_FETCHMODE_OBJECT) ;
 
// creation de l'arbre
$arbreforum = new arbre("Botanique générale",$ligne_donnee_sommet->AGO_A_LIEN_BRANCHE,$nb_total_abon, $ligne_donnee_sommet->AGO_A_LIEN_FEUILLE,
"http://fr.groups.yahoo.com/group/tela-botanicae/messages") ;
 
$res = "<h1>L'arbre des forums de Tela Botanica</h1>\n" ;
$res .= '<table width="600" cellspacing="5" cellpadding="0" border="0" summary="">' ;
$GLOBALS['url']->addQueryString ('forum', 'tela-botanicae') ;
$ligne_donnee_sommet->AGO_A_LIEN_BRANCHE = $GLOBALS['url']->getURL() ;
$res .= $arbreforum->cime("Botanique générale",$ligne_donnee_sommet->AGO_A_LIEN_BRANCHE,$nb_total_abon,
$ligne_donnee_sommet->AGO_A_LIEN_FEUILLE,
"http://fr.groups.yahoo.com/group/tela-botanicae/messages") ;
// requete sur les branches
// d'abord les nom des groupes
$requete_branche = "SELECT agora.AGO_A_NOMGRP FROM agora" ;
if (!empty($thema)) $requete_branche.= ",agora_join" ;
$requete_branche .= " WHERE agora.AGO_A_NOMGRP<>\"tela-botanicae\" AND agora.AGO_A_VISIBLE=1 and AGO_A_GRP_TB=0" ; // On ne garde que les projets hors Tela
if (!empty($thema)) $requete_branche .= " AND agora.AGO_A_ID=agora_join.AGO_J_IDFORUM and AGO_J_IDCATEG=\"$thema\"" ;
$requete_branche .= " ORDER BY AGO_A_ALIAS ASC" ;
 
$resultat_branche = $GLOBALS['projet_db']->query($requete_branche) ;
//tableau stockant la différence du nbre de messages entre la semaine en cours dans la page et la semaine précédente
$diff_message = array();
while ($ligne_branche = $resultat_branche->fetchRow(DB_FETCHMODE_OBJECT)) {
$query_nb_message_1 = "SELECT NB_MESSAGES FROM agora_stats WHERE FORUM=\"$ligne_branche->AGO_A_NOMGRP\" AND NUM_SEM=\"$num_sem\"";
$result_nb_message_1 = mysql_query($query_nb_message_1) or die ("Echec sur la requ&ecirc;te _nb_message_1") ;
$row_nb_message_1 = mysql_fetch_object($result_nb_message_1) ;
$query_nb_message_2 = "SELECT NB_MESSAGES FROM agora_stats WHERE FORUM=\"$ligne_branche->AGO_A_NOMGRP\" AND NUM_SEM= ".($num_sem -1)."";
$result_nb_message_2 = mysql_query($query_nb_message_2) or die ("Echec sur la requ&ecirc;te _nb_message_2") ;
$row_nb_message_2 = mysql_fetch_object($result_nb_message_2) ;
$diff_message[$row_message->AGO_A_NOMGRP] = $row_nb_message_1->NB_MESSAGES - $row_nb_message_2->NB_MESSAGES;
}
$result1 = mysql_query($requete_branche) or die ("Echec de la requ&ecirc;te sur les forums");
while ($row1 = mysql_fetch_object($result1)) {
// pour chaque groupe, le nbre de messages et le nbre d'abonnes
$query2 = "SELECT NB_MESSAGES,NB_ABONNES FROM agora_stats WHERE FORUM=\"$row1->AGO_A_NOMGRP\" AND NUM_SEM=\"$num_sem\"" ;
$result2 = mysql_query($query2) or die ("Echec de la requ&ecirc;te sur agora_stats");
$row2 = mysql_fetch_object($result2) ;
// et le reste des informations pour chaque groupe
$query3 = "SELECT AGO_A_ALIAS,AGO_A_LIEN_BRANCHE,AGO_A_LIEN_FEUILLE,AGO_A_LIEN_PUCE,AGO_A_COULEUR,AGO_A_TAILLE_B,AGO_A_NOMGRP FROM agora WHERE AGO_A_NOMGRP=\"$row1->AGO_A_NOMGRP\"";
$result3 = mysql_query($query3) or die ("Echec sur la requ&ecirc;te 3") ;
$row3 = mysql_fetch_object($result3) ;
$lien_feuille = "http://fr.groups.yahoo.com/group/$row1->AGO_A_NOMGRP/messages" ;
$lien_nombre = "http://fr.groups.yahoo.com/group/$row1->AGO_A_NOMGRP/members" ;
// On cherche à obtenir une valeur entre 0 et 100 pour déterminer la couleur de la feuille de l'arbre
$maxi_message = max($diff_message);
if ($maxi_message == 0){$maxi_message = 0.01;}
$calcul_couleur = ($diff_message[$row1->AGO_A_NOMGRP])/$maxi_message*100;
//Fin. La valeur de la couleur pour le groupe en cours est stocké dans $calcul_couleur
if ($row2->NB_ABONNES != 0) {//pour ne pas afficher les branches n'existant pas encore à la semaine donnée
$GLOBALS['url']->addQueryString('forum', $row3->AGO_A_NOMGRP) ;
$row3->AGO_A_LIEN_BRANCHE = $GLOBALS['url']->getURL() ;
$arbreforum->addBranche($row3->AGO_A_ALIAS,$row3->AGO_A_LIEN_BRANCHE,$row2->NB_ABONNES,$lien_nombre,$lien_feuille,$calcul_couleur,$row3->AGO_A_TAILLE_B);
// info pour le cartouche
$nb_total_mess += $row2->NB_MESSAGES;
$nb_total_abon += $row2->NB_ABONNES;
}
}
 
$res .= $arbreforum->affBranche() ;
$res .= $arbreforum->affRacine() ;
$res .= '</table>' ;
include_once PROJET_CHEMIN_APPLI.'cartouche.php' ;
return $res ;
}
 
 
//-- End of source ------------------------------------------------------------
?>
/branches/v2.0-narmer/client/gallerie/configuration/gall_config.inc.php
New file
0,0 → 1,91
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of papyrus_bp. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: gall_config.inc.php,v 1.1 2006-12-07 17:29:20 jp_milcent Exp $
/**
* papyrus_bp - gall_config.inc.php
*
* Description :
*
*@package papyrus_bp
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 1999-2006
*@version $Revision: 1.1 $ $Date: 2006-12-07 17:29:20 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$GLOBALS['_GALLERIE_'] = array();
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Constante stockant la valeur de la langue par défaut pour l'applette GALL.*/
define('GALL_I18N_DEFAUT', GEN_I18N_ID_DEFAUT);
 
// Chemin des fichiers à inclure.
/** Chemin vers la bibliothèque PEAR.*/
define('GALL_CHEMIN_BIBLIOTHEQUE_PEAR', PAP_CHEMIN_API_PEAR);
 
// Chemin vers les dossiers de l'applette
/** Chemin vers l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_APPLETTE', GEN_CHEMIN_CLIENT.'gallerie'.GEN_SEP);
/** Chemin vers les fichiers de traduction de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_LANGUE', GALL_CHEMIN_APPLETTE.'langues'.GEN_SEP);
/** Chemin vers les fichiers de la bibliotheque de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_BIBLIO', GALL_CHEMIN_APPLETTE.'bibliotheque'.GEN_SEP);
/** Chemin vers le dossier de Présenation.*/
define('GALL_CHEMIN_PRESENTATION', GALL_CHEMIN_APPLETTE.'presentation'.GEN_SEP);
/** Chemin vers les fichiers squelettes de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_SCRIPTS', GALL_CHEMIN_PRESENTATION.'scripts'.GEN_SEP);
/** Chemin vers les fichiers squelettes de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_STYLES', GALL_CHEMIN_PRESENTATION.'styles'.GEN_SEP);
/** Chemin vers les fichiers squelettes de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_IMAGES', GALL_CHEMIN_PRESENTATION.'images'.GEN_SEP);
/** Chemin vers les fichiers squelettes de l'applette Gallerie de Papyrus.*/
define('GALL_CHEMIN_SQUELETTE', GALL_CHEMIN_PRESENTATION.'squelettes'.GEN_SEP);
 
// Configuration du rendu
/** Nom du fichier de squelette à utiliser pour la liste des pages.*/
define('GALL_SQUELETTE_LISTE', 'gall_liste.tpl.html');
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/12/07 16:25:23 jp_milcent
* Ajout de la gestion de messages d'erreur.
* Ajout de la gestion des squelettes.
*
* Revision 1.1 2006/12/07 15:39:47 jp_milcent
* Ajout de l'applette Gallerie.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/gallerie/gallerie.php
New file
0,0 → 1,163
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of papyrus_bp. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar 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 Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: gallerie.php,v 1.2 2006-12-08 16:00:11 jp_milcent Exp $
/**
* papyrus_bp - gallerie.php
*
* Le code provient de "Simple Image Gallery" (in content items) Plugin for Joomla 1.0.x - Version 1.0
* License: http://www.gnu.org/copyleft/gpl.html
* Authors: Fotis Evangelou - George Chouliaras
* Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr
* ***Last update: December 5th, 2006***
*
*@package papyrus_bp
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 1999-2006
*@version $Revision: 1.2 $ $Date: 2006-12-08 16:00:11 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherGallerie';
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Gg]allerie(?:\s*(?:(dossier="[^"]+")|(largeur="[^"]+")|(hauteur="[^"]+")|(qualite="[^"]+")|))+\s*\}\}';
 
/** Inclusion du fichier de configuration de cette application.*/
require_once GEN_CHEMIN_CLIENT.'gallerie'.GEN_SEP.'configuration'.GEN_SEP.'gall_config.inc.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Fonction afficherCategorie() - Retourne la liste des pages d'une catégorie.
*
* Cette fonction retourne la liste des pages appartenant à une catégorie donnée.
*
* @param array contient les arguments de la fonction.
* @param array tableau global de Papyrus.
* @return string HTML la liste des listes de menus.
*/
function afficherGallerie($tab_applette_arguments, $_GEN_commun)
{
// Initialisation des variables
$sortie = '';
$GLOBALS['_GALLERIE_']['erreur'] = '';
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des arguments
$tab_arguments = $tab_applette_arguments;
unset($tab_arguments[0]);
foreach($tab_arguments as $argument) {
$tab_parametres = explode('=', trim($argument));
$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
}
 
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des erreurs de paramètrage
if (!isset($options['dossier'])) {
$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le paramètre 'dossier' est obligatoire !";
}
if (!isset($options['largeur'])) {
$options['largeur'] = 160;
}
if (!isset($options['hauteur'])) {
$options['hauteur'] = 160;
}
if (!isset($options['qualite'])) {
$options['qualite'] = 70;
}
 
//+----------------------------------------------------------------------------------------------------------------+
// Récupération des données
$noimage = 0;
$GLOBALS['_GALLERIE_']['dossier'] = PAP_CHEMIN_RACINE.$options['dossier'];
if (is_dir($GLOBALS['_GALLERIE_']['dossier'])) {
if ($dh = opendir($GLOBALS['_GALLERIE_']['dossier'])) {
while (($f = readdir($dh)) !== false) {
if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
$noimage++;
$images[] = array('filename' => $f);
array_multisort($images, SORT_ASC, SORT_REGULAR);
}
}
closedir($dh);
}
} else {
$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALLERIE_']['dossier'];
}
if($noimage) {
$GLOBALS['_GALLERIE_']['css']['chemin'] = GALL_CHEMIN_STYLES;
$GLOBALS['_GALLERIE_']['css']['largeur'] = $options['largeur']+10;
$GLOBALS['_GALLERIE_']['script']['chemin'] = GALL_CHEMIN_SCRIPTS;
$GLOBALS['_GALLERIE_']['images'] = array();
foreach($images as $image) {
if ($image['filename'] != '') {
$aso_img['fichier_nom'] = $image['filename'];
$aso_img['url_img'] = $options['dossier'].'/'.$image['filename'];
$aso_img['url_img_mini'] = preg_replace('/papyrus\.php$/', '', PAP_URL).GALL_CHEMIN_SCRIPTS.'showthumb.php?img='.urlencode(PAP_CHEMIN_RACINE.$options['dossier'].'/'.$image['filename']).'&amp;width='.$options['largeur'].'&amp;height='.$options['hauteur'].'&amp;quality='.$options['qualite'];
$GLOBALS['_GALLERIE_']['images'][] = $aso_img;
}
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des squelettes
// Extrait les variables et les ajoutes à l'espace de noms local
extract($GLOBALS['_GALLERIE_']);
// Démarre le buffer
ob_start();
// Inclusion du fichier
include(GALL_CHEMIN_SQUELETTE.GALL_SQUELETTE_LISTE);
// Récupérer le contenu du buffer
$sortie = ob_get_contents();
// Arrête et détruit le buffer
ob_end_clean();
 
//+----------------------------------------------------------------------------------------------------------------+
// Sortie
return $sortie;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2006/12/07 17:29:20 jp_milcent
* Ajout de l'applette Gallerie dans Client car elle n'a pas un rapport direct avec Papyrus.
*
* Revision 1.2 2006/12/07 16:25:23 jp_milcent
* Ajout de la gestion de messages d'erreur.
* Ajout de la gestion des squelettes.
*
* Revision 1.1 2006/12/07 15:39:47 jp_milcent
* Ajout de l'applette Gallerie.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/gallerie/presentation/squelettes/gall_liste.tpl.html
New file
0,0 → 1,25
<!-- GALLERIE - DEBUT -->
<?php if ($erreur) : ?>
 
<p class="pap_erreur"><?=$erreur;?></p>
 
<?php else : ?>
<!-- Source : provient de "Simple Image Gallery" (in content items) Plugin for Joomla 1.0.x - Version 1.0. -->
<link href="<?=$css['chemin'];?>sig.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.sig_thumb {width:<?=$css['largeur'];?>px;} /* add to the width the total image padding and borders you set in the css file */
</style>
<script type="text/javascript" src="<?=$script['chemin'];?>mootools.js"></script>
<script type="text/javascript" src="<?=$script['chemin'];?>slimbox.js"></script>
<div class="sig">
<?php foreach ($images as $image) : ?>
<div class="sig_thumb">
<a href="<?=$image['url_img'];?>" rel="lightbox" title="<?=$image['fichier_nom'];?>">
<img src="<?=$image['url_img_mini'];?>" alt="<?=$image['fichier_nom'];?>"/>
</a>
</div>
<?php endforeach; ?>
<div class="sig_clr">&nbsp;</div>
</div>
<?php endif; ?>
<!-- GALLERIE - FIN -->
/branches/v2.0-narmer/client/gallerie/presentation/styles/closelabel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/closelabel.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/styles/shadow.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/shadow.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/styles/sig.css
New file
0,0 → 1,73
/* ---Generic--- */
.sig {clear:both;margin:16px 4px;padding:0px;width:100%;} /* 'width:100%;' forces the container to use the full available width for the gallery! Delete it if it's causing issues in your template. */
.sig_clr {clear:both;}
 
/* ---Image Shadows--- */
.sig_thumb {
float:left;
margin:0px 10px 10px 10px;
padding:0px;
background:url(shadowAlpha.png) no-repeat bottom right !important;
background:url(shadow.gif) no-repeat bottom right;}
.sig_thumb img {
display:block;
position:relative;
background:#FFF;
border:1px solid #ccc;
margin:-5px 5px 5px -5px;
padding:4px;}
 
/* ---Slimbox--- */
#lbOverlay {
position:absolute;
left:0;
width:100%;
background-color:#000;
cursor:pointer;}
#lbCenter, #lbBottom {
position:absolute;
left:50%;
overflow:hidden;
background-color:#fff;}
.lbLoading {
background:#fff url(loading.gif) no-repeat center;}
#lbImage {
border:10px solid #fff;}
#lbPrevLink, #lbNextLink {
display:block;
position:absolute;
top:0;
width:50%;
outline:none;}
#lbPrevLink {
left:0;}
#lbPrevLink:hover {
background:transparent url(prevlabel.gif) no-repeat 0% 15%;}
#lbNextLink {
right:0;}
#lbNextLink:hover {
background:transparent url(nextlabel.gif) no-repeat 100% 15%;}
#lbBottom {
font-family:Verdana, Helvetica, sans-serif;
font-size:10px;
color:#666;
line-height:1.4em;
text-align:left;
border:10px solid #fff;
border-top-style:none;}
#lbCloseLink {
display:block;
float:right;
width:66px;
height:22px;
background:transparent url(closelabel.gif) no-repeat center;
margin:5px 0;}
#lbCaption, #lbNumber {
margin-right:71px;}
#lbCaption {
font-weight:bold;}
#lbOverlay,#lbCenter,#lbBottom,#lbPrevLink,#lbNextLink {
z-index:999;}
/* JW fix for Slimbox */
 
/* --- END --- */
/branches/v2.0-narmer/client/gallerie/presentation/styles/shadowAlpha.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/shadowAlpha.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/styles/prevlabel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/prevlabel.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/styles/loading.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/loading.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/styles/nextlabel.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v2.0-narmer/client/gallerie/presentation/styles/nextlabel.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v2.0-narmer/client/gallerie/presentation/scripts/mootools.js
New file
0,0 → 1,2
//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
eval(function(A,G){return A.replace(/(\w+)/g,function(a,b){return G[parseInt(b,36)]})}("0 1=2(3){0 4=2(){5 (0 6 7 8){9 (8[6]) 8[6].a=8;}\n9 (b[c] !=\n\'d\'\n&&8.e) f 8.e.g(8,b);};4.h=8.h;4.i=8.i;4.j=3;f 4;};1.k=2(){};1.l=2(3){f m 1(3);};1.j={h:2(3){0 n=m 8(\n\'d\'\n);5 (0 o 7 3){0 p=n[o];0 q=3[o];9 (p&&p !=q) q=p.r(q)||q;n[o]=q;}\nf m 1(n);},i:2(3){5 (0 o 7 3) 8.j[o]=3[o];}};s.h=2(){0 t=b;9 (t[u]) t=[t[c],t[u]];v t=[8,t[c]];5 (0 o 7 t[u]) t[c][o]=t[u][o];f t[c];};s.w=2(){5 (0 x=c;x<b.y;x++) b[x].h=1.j.i;};m s.w(z,10,11,12);z.h({r:2(q){0 p=8;f 2(){8.13=p;f q.g(8,b);};}});;z.h({14:2(t,15){0 16=8;9 ($17(t) !=\n\'18\'\n) t=[t];f 2(){f 16.g(15||16.a||16,t);};},15:2(15){0 16=8;f 2(){f 16.g(15,b);};},19:2(15){0 16=8;f 2(1a){16.1b(15,1a||1c.1a);f 1d;};},1e:2(1f,15){f 1g(8.15(15||8.a||8),1f);},1h:2(1f,15){f 1i(8.15(15||8.a||8),1f);}});2 $1j(1k){1l(1k);1m(1k);f 1n;};2 $17(1o){9 (!1o) f 1d;0 17=1d;9 (1o 1p z) 17=\n\'2\'\n;v 9 (1o.1q){9 (1o.1r==1s&&!\n/\\1t/.1u(1o.1v)) 17=\n\'1w\'\n;v 9 (1o.1r==u) 17=\n\'1x\'\n;}\nv 9 (1o 1p 10) 17=\n\'18\'\n;v 9 (1y 1o==\n\'1z\'\n) 17=\n\'1z\'\n;v 9 (1y 1o==\n\'20\'\n) 17=\n\'20\'\n;v 9 (1y 1o==\n\'21\'\n&&22(1o)) 17=\n\'21\'\n;f 17;};0 23=m 1({24:2(16){8.25=8.25||[];8.25.26(16);f 8;},27:2(){9 (8.25&&8.25.y) 8.25.28(c,u)[c].1e(29,8);},2a:2(){8.25=[];}});;9 (!10.j.2b){10.j.2b=2(16,15){5(0 x=c;x<8.y;x++) 16.1b(15,8[x],x);};}\n10.h({2c:10.j.2b,2d:2(){0 2e=[];5 (0 x=c;x<8.y;x++) 2e.26(8[x]);f 2e;},2f:2(2g){5 (0 x=c;x<8.y;x++){9 (8[x]==2g) 8.28(x,u);}\nf 8;},1u:2(2g){5 (0 x=c;x<8.y;x++){9 (8[x]==2g) f 2h;};f 1d;},h:2(2e){5 (0 x=c;x<2e.y;x++) 8.26(2e[x]);f 8;},2i:2(2j){0 2e=[];5 (0 x=c;x<8.y;x++) 2e[2j[x]]=8[x];f 2e;}});2 $2k(18){f 10.j.2d.1b(18);};;11.h({1u:2(2l,2m){f 8.2n(m 2o(2l,2m));},2p:2(){f 2q(8);},2r:2(){f 8.2s(\n/-\\2t/2u,2(2n){f 2n.2v(2n.y-u).2w();});},2x:2(){f 8.2y().2s(\n/\\2z[30-31]/32,2(2n){f 2n.2w();});},33:2(){f 8.2s(\n/^\\34*|\\34*$/32,\n\'\'\n);},35:2(){f 8.2s(\n/\\34\\34/32,\n\' \'\n).33();},36:2(18){0 37=8.1u(\n\'([\\\\38]{u,1s})\'\n,\n\'32\'\n);9 (37[1s]==c) f\n\'39\'\n;0 3a=[];5 (0 x=c;x<1s;x++){0 3b=(37[x]-c).3c(3d);3a.26(3b.y==u?\n\'c\'\n+3b:3b);}\n0 3e=\n\'#\'\n+3a.3f(\n\'\'\n);9 (18) f 3a;v f 3e;},3g:2(18){0 3a=8.1u(\n\'^[#]{c,u}([\\\\3h]{u,3i})([\\\\3h]{u,3i})([\\\\3h]{u,3i})$\'\n);0 37=[];5 (0 x=u;x<3a.y;x++){9 (3a[x].y==u) 3a[x]+=3a[x];37.26(2q(3a[x],3d));}\n0 3j=\n\'37(\'\n+37.3f(\n\',\'\n)+\n\')\'\n;9 (18) f 37;v f 3j;}});12.h({2p:2(){f 8;}});;0 3k=m 1({e:2(3l){9 ($17(3l)==\n\'20\'\n) 3l=3m.3n(3l);f $(3l);},3o:2(3l,3p){3l=$(3l)||m 3k(3l);3q(3p){3r\n\"3s\"\n:$(3l.3t).3u(8,3l);3v;3r\n\"3w\"\n:{9 (!3l.3x()) $(3l.3t).3y(8);v $(3l.3t).3u(8,3l.3x());} 3v;3r\n\"3z\"\n:3l.3y(8);3v;}\nf 8;},40:2(3l){f 8.3o(3l,\n\'3s\'\n);},41:2(3l){f 8.3o(3l,\n\'3w\'\n);},42:2(3l){f 8.3o(3l,\n\'3z\'\n);},43:2(3l){8.3y($(3l)||m 3k(3l));f 8;},2f:2(){8.3t.44(8);},45:2(46){f $(8.47(46||2h));},48:2(3l){0 3l=$(3l)||m 3k(3l);8.3t.49(3l,8);f 3l;},4a:2(4b){9 (8.4c()==\n\'4d\'\n&&1c.4e) 8.4f.4g=4b;v 8.3y(3m.4h(4b));f 8;},4i:2(4j){f !!8.4j.1u(\n\"\\\\2z\"\n+4j+\n\"\\\\2z\"\n);},4k:2(4j){9 (!8.4i(4j)) 8.4j=(8.4j+\n\' \'\n+4j.33()).35();f 8;},4l:2(4j){9 (8.4i(4j)) 8.4j=8.4j.2s(4j.33(),\n\'\'\n).35();f 8;},4m:2(4j){9 (8.4i(4j)) f 8.4l(4j);v f 8.4k(4j);},4n:2(o,4o){9 (o==\n\'4p\'\n) 8.4q(4r(4o));v 8.4d[o.2r()]=4o;f 8;},4s:2(4t){9 ($17(4t)==\n\'1z\'\n){5 (0 o 7 4t) 8.4n(o,4t[o]);} v 9 ($17(4t)==\n\'20\'\n){9 (1c.4e) 8.4g=4t;v 8.4u(\n\'4d\'\n,4t);}\nf 8;},4q:2(4p){9 (4p==c){9(8.4d.4v !=\n\"4w\"\n) 8.4d.4v=\n\"4w\"\n;} v {9(8.4d.4v !=\n\"4x\"\n) 8.4d.4v=\n\"4x\"\n;}\n9 (1c.4e) 8.4d.4y=\n\"4z(4p=\"\n+4p*50+\n\")\"\n;8.4d.4p=4p;f 8;},51:2(o){0 52=o.2r();0 4d=8.4d[52]||1d;9 (!4d){9 (3m.53) 4d=3m.53.54(8,1n).55(o);v 9 (8.56) 4d=8.56[52];}\n9 (4d&&[\n\'57\'\n,\n\'58\'\n,\n\'59\'\n].1u(52)&&4d.1u(\n\'37\'\n)) 4d=4d.36();f 4d;},5a:2(5b,16){8[5b+16]=16.15(8);9 (8.5c) 8.5c(5b,16,1d);v 8.5d(\n\'5e\'\n+5b,8[5b+16]);0 3l=8;9 (8 !=1c) 5f.5g.26(2(){3l.5h(5b,16);3l[5b+16]=1n;});f 8;},5h:2(5b,16){9 (8.5i) 8.5i(5b,16,1d);v 8.5j(\n\'5e\'\n+5b,8[5b+16]);f 8;},5k:2(5l){0 3l=8[5l+\n\'5m\'\n];5n ($17(3l)==\n\'1w\'\n) 3l=3l[5l+\n\'5m\'\n];f $(3l);},5o:2(){f 8.5k(\n\'p\'\n);},3x:2(){f 8.5k(\n\'5p\'\n);},5q:2(){0 3l=8.5r;5n ($17(3l)==\n\'1w\'\n) 3l=3l.5s;f $(3l);},5t:2(){0 3l=8.5u;5n ($17(3l)==\n\'1w\'\n)\n3l=3l.5v;f $(3l);},5w:2(o,4o){0 3l=1d;3q(o){3r\n\'5x\'\n:8.4j=4o;3v;3r\n\'4d\'\n:8.4s(4o);3v;3r\n\'5y\'\n:9 (1c.4e&&8.4c()==\n\'5z\'\n){3l=$(3m.3n(\n\'<5z 5y=\"\'\n+4o+\n\'\" />\'\n));$2k(8.60).2c(2(61){9 (61.5y !=\n\'5y\'\n) 3l.5w(61.5y,61.4o);});9 (8.3t) 8.48(3l);};62:8.4u(o,4o);}\nf 3l||8;},63:2(4t){5 (0 o 7 4t) 8.5w(o,4t[o]);f 8;},64:2(65){8.66=65;f 8;},67:2(o){f 8.68(o);},4c:2(){f 8.69.2y();},6a:2(5l){5l=5l.2x();0 3l=8;0 6b=c;6c {6b+=3l[\n\'6b\'\n+5l]||c;3l=3l.6d;} 5n (3l);f 6b;},6e:2(){f 8.6a(\n\'6f\'\n);},6g:2(){f 8.6a(\n\'6h\'\n);},6i:2(){0 4o=1d;3q(8.4c()){3r\n\'6j\'\n:4o=8.6k(\n\'6l\'\n)[8.6m].4o;3v;3r\n\'5z\'\n:9 ((8.6n&&[\n\'6o\'\n,\n\'6p\'\n].1u(8.17))||([\n\'4w\'\n,\n\'4b\'\n,\n\'6q\'\n].1u(8.17)))\n4o=8.4o;3v;3r\n\'6r\'\n:4o=8.4o;}\nf 4o;}});m s.w(3k);3k.h({6s:3k.j.4i,6t:3k.j.4k,6u:3k.j.4l,6v:3k.j.4m});2 $3k(3l,6w,t){9 ($17(t) !=\n\'18\'\n) t=[t];f 3k.j[6w].g(3l,t);};2 $(3l){9 ($17(3l)==\n\'20\'\n) 3l=3m.6x(3l);9 ($17(3l)==\n\'1x\'\n){9 (!3l.h){5f.6y.26(3l);3l.h=s.h;3l.h(3k.j);}\nf 3l;} v f 1d;};1c.5a=3m.5a=3k.j.5a;1c.5h=3m.5h=3k.j.5h;0 5f={6y:[],5g:[],6z:[],70:2(){5f.5g.2c(2(16){16();});1c.5h(\n\'70\'\n,1c.71);5f.6y.2c(2(3l){5(0 6 7 3k.j){1c[6]=1n;3m[6]=1n;3l[6]=1n;}\n3l.h=1n;});}};1c.71=5f.70;1c.5a(\n\'70\'\n,1c.71);;0 72=73={};72.74=m 1({75:2(76){8.76=s.h({77:1.k,78:1.k,79:72.7a.7b,7c:7d,7e:\n\'7f\'\n,7g:2h,7h:7i},76||{});},7j:2(){0 7k=m 7l().7m();9 (7k<8.7k+8.76.7c){8.7n=7k-8.7k;8.7o();} v {8.76.78.14(8.1x,8).1e(29);8.7p();8.27();8.7q=8.7r;}\n8.7s();},7t:2(7r){8.7q=7r;8.7s();f 8;},7o:2(){8.7q=8.7u(8.7v,8.7r);},7u:2(7v,7r){f 8.76.79(8.7n,7v,(7r-7v),8.76.7c);},7w:2(7v,7r){9 (!8.76.7g) 8.7p();9 (8.1k) f;8.76.77.14(8.1x,8).1e(29);8.7v=7v;8.7r=7r;8.7k=m 7l().7m();8.1k=8.7j.1h(7x.7y(7z/8.76.7h),8);f 8;},7p:2(){8.1k=$1j(8.1k);f 8;},4n:2(1x,o,4o){1x.4n(o,4o+8.76.7e);}});72.74.i(m 23);72.80=72.74.h({e:2(3l,o,76){8.1x=$(3l);8.75(76);8.o=o.2r();},81:2(){f 8.7t(c);},82:2(83){f 8.7w(8.7q||c,83);},7s:2(){8.4n(8.1x,8.o,8.7q);}});72.84=72.74.h({e:2(3l,76){8.1x=$(3l);8.75(76);8.7q={};},7o:2(){5 (0 6 7 8.7v) 8.7q[6]=8.7u(8.7v[6],8.7r[6]);},7w:2(85){9 (8.1k&&8.76.7g) f;0 7v={};0 7r={};5 (0 6 7 85){7v[6]=85[6][c];7r[6]=85[6][u];}\nf 8.13(7v,7r);},7s:2(){5 (0 6 7 8.7q) 8.4n(8.1x,6,8.7q[6]);}});3k.h({86:2(o,76){f m 72.80(8,o,76);},87:2(76){f m 72.84(8,76);}});72.7a={88:2(89,2z,8a,38){f 8a*89/38+2z;},7b:2(89,2z,8a,38){f-8a\n/3i * (7x.8b(7x.8c*89/38)-u)+2z;}};;0 8d={8e:2(){9 (1c.4e) 3m.8f(\n\"8g\"\n,1d,2h);},h:s.h,8h:2(){f 1c.8i||3m.8j.8k||c;},8l:2(){f 1c.8m||3m.8j.8n||c;},8o:2(){f 3m.8j.8p;},8q:2(){f 3m.8j.8r;},8s:2(){f 3m.8j.8t||1c.8u||c;},8v:2(){f 3m.8j.8w||1c.8x||c;},8y:2(8z){0 90=3m.91;9 (90&&3m.92&&!3m.93&&!94.95){9 (90.1u(\n/96|97/)) f 8z();v f 8d.8y.14(8z).1e(50);} v 9 (90&&1c.4e){0 98=$(\n\'99\'\n);9 (!98) 3m.9a(\n\"<98 9b=\'99\' 9c=\'2h\' 9d=\'://\'></98>\"\n);$(\n\'99\'\n).5a(\n\'9e\'\n,2(){9 (8.91==\n\'97\'\n) 8z();});f;} v {0 9f=2(){9 (b.9g.9h) f;b.9g.9h=2h;8z();};1c.5a(\n\"9i\"\n,9f);3m.5a(\n\"9j\"\n,9f);}}};","var,Class,function,properties,klass,for,p,in,this,if,_proto_,arguments,0,noinit,initialize,return,apply,extend,implement,prototype,empty,create,new,pr0t0typ3,property,previous,current,parentize,Object,args,1,else,Native,i,length,Function,Array,String,Number,parent,pass,bind,fn,type,array,bindAsEventListener,event,call,window,false,delay,ms,setTimeout,periodical,setInterval,clear,timer,clearTimeout,clearInterval,null,obj,instanceof,nodeName,nodeType,3,S,test,nodeValue,textnode,element,typeof,object,string,number,isFinite,Chain,chain,chains,push,callChain,splice,10,clearChain,forEach,each,copy,newArray,remove,item,true,associate,keys,A,regex,params,match,RegExp,toInt,parseInt,camelCase,replace,D,gi,charAt,toUpperCase,capitalize,toLowerCase,b,a,z,g,trim,s,clean,rgbToHex,rgb,d,transparent,hex,bit,toString,16,hexText,join,hexToRgb,w,2,rgbText,Element,el,document,createElement,inject,where,switch,case,before,parentNode,insertBefore,break,after,getNext,appendChild,inside,injectBefore,injectAfter,injectInside,adopt,removeChild,clone,contents,cloneNode,replaceWith,replaceChild,appendText,text,getTag,style,ActiveXObject,styleSheet,cssText,createTextNode,hasClass,className,addClass,removeClass,toggleClass,setStyle,value,opacity,setOpacity,parseFloat,setStyles,source,setAttribute,visibility,hidden,visible,filter,alpha,100,getStyle,proPerty,defaultView,getComputedStyle,getPropertyValue,currentStyle,color,backgroundColor,borderColor,addEvent,action,addEventListener,attachEvent,on,Unload,functions,removeEvent,removeEventListener,detachEvent,getBrother,what,Sibling,while,getPrevious,next,getFirst,firstChild,nextSibling,getLast,lastChild,previousSibling,setProperty,class,name,input,attributes,attribute,default,setProperties,setHTML,html,innerHTML,getProperty,getAttribute,tagName,getOffset,offset,do,offsetParent,getTop,top,getLeft,left,getValue,select,getElementsByTagName,option,selectedIndex,checked,checkbox,radio,password,textarea,hasClassName,addClassName,removeClassName,toggleClassName,method,getElementById,elements,vars,unload,removeFunction,Fx,fx,Base,setOptions,options,onStart,onComplete,transition,Transitions,sineInOut,duration,500,unit,px,wait,fps,50,step,time,Date,getTime,cTime,setNow,clearTimer,now,to,increase,set,compute,from,custom,Math,round,1000,Style,hide,goTo,val,Styles,objFromTo,effect,effects,linear,t,c,cos,PI,Window,disableImageCache,execCommand,BackgroundImageCache,getWidth,innerWidth,documentElement,clientWidth,getHeight,innerHeight,clientHeight,getScrollHeight,scrollHeight,getScrollWidth,scrollWidth,getScrollTop,scrollTop,pageYOffset,getScrollLeft,scrollLeft,pageXOffset,onDomReady,init,state,readyState,childNodes,all,navigator,taintEnabled,loaded,complete,script,_ie_ready_,write,id,defer,src,readystatechange,myInit,callee,done,load,DOMContentLoaded".split(",")));
/branches/v2.0-narmer/client/gallerie/presentation/scripts/showthumb.php
New file
0,0 → 1,52
<?php
if($_GET['img'] == "")
exit;
$_image_ = urldecode( $_GET['img'] );
 
$_width_min_ = intval($_GET['width']);
$_height_min_ = intval($_GET['height']);
$_quality_ = intval($_GET['quality']);
 
$new_w = $_width_min_;
$imagedata = getimagesize($_image_);
 
if(!$imagedata[0])
exit();
 
$new_h = (int)($imagedata[1]*($new_w/$imagedata[0]));
 
if(($_height_min_) AND ($new_h > $_height_min_)) {
$new_h = $_height_min_;
$new_w = (int)($imagedata[0]*($new_h/$imagedata[1]));
}
 
if(strtolower(substr($_image_,-3)) == "jpg") {
header("Content-type: image/jpg");
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromJpeg($_image_);
$dst_img = imagecreatetruecolor($new_w, $new_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
$img = Imagejpeg($dst_img, '', $_quality_);
}
 
if(substr($_GET['img'],-3) == "gif") {
header("Content-type: image/gif");
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromGif($_image_);
ImagePaletteCopy($dst_img,$src_img);
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
$img = Imagegif($dst_img,'', $_quality_);
}
 
if(substr($_GET['img'],-3) == "png") {
header("Content-type: image/png");
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromPng($_image_);
ImagePaletteCopy($dst_img,$src_img);
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
$img = Imagepng($dst_img,'', $_quality_);
}
 
?>
/branches/v2.0-narmer/client/gallerie/presentation/scripts/slimbox.js
New file
0,0 → 1,186
/*
Slimbox v1.22 - The ultimate lightweight Lightbox clone
by Christophe Beyls (http://www.digitalia.be) - MIT-style license.
Inspired by the original Lightbox v2 by Lokesh Dhakar.
*/
 
var Lightbox = {
 
init: function(options) {
this.options = Object.extend({
resizeDuration: 400, // Duration of height and width resizing (ms)
initialWidth: 250, // Initial width of the box (px)
initialHeight: 250, // Initial height of the box (px)
animateCaption: true // Enable/Disable caption animation
}, options || {});
this.anchors = [];
$A(document.getElementsByTagName('a')).each(function(el){
if(el.rel && el.href && el.rel.test('^lightbox', 'i')) {
el.onclick = this.click.pass(el, this);
this.anchors.push(el);
}
}, this);
this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);
this.eventPosition = this.position.bind(this);
this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body);
this.center = new Element('div').setProperty('id', 'lbCenter').setStyles({width: this.options.initialWidth+'px', height: this.options.initialHeight+'px', marginLeft: '-'+(this.options.initialWidth/2)+'px', display: 'none'}).injectInside(document.body);
this.image = new Element('div').setProperty('id', 'lbImage').injectInside(this.center);
this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.image);
this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);
this.prevLink.onclick = this.previous.bind(this);
this.nextLink.onclick = this.next.bind(this);
this.bottom = new Element('div').setProperty('id', 'lbBottom').setStyle('display', 'none').injectInside(document.body);
new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);
this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.bottom);
this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom);
new Element('div').setStyle('clear', 'both').injectInside(this.bottom);
var nextEffect = this.nextEffect.bind(this);
this.fx = {
overlay: this.overlay.effect('opacity', { duration: 500 }).hide(),
resize: this.center.effects({ duration: this.options.resizeDuration, onComplete: nextEffect }),
image: this.image.effect('opacity', { duration: 500, onComplete: nextEffect }),
bottom: this.bottom.effects({ duration: 400, onComplete: nextEffect })
};
this.preloadPrev = new Image();
this.preloadNext = new Image();
},
 
click: function(link) {
if(link.rel.length == 8)
return this.show(link.href, link.title);
var j, imageNum, images = [];
this.anchors.each(function(el){
if(el.rel == link.rel) {
for(j = 0; j < images.length; j++)
if(images[j][0] == el.href) break;
if(j == images.length) {
images.push([el.href, el.title]);
if(el.href == link.href) imageNum = j;
}
}
}, this);
return this.open(images, imageNum);
},
 
show: function(url, title) {
return this.open([[url, title]], 0);
},
 
open: function(images, imageNum) {
this.images = images;
this.position();
this.setup(true);
this.top = Window.getScrollTop() + (Window.getHeight() / 15);
this.center.setStyles({top: this.top+'px', display: ''});
this.fx.overlay.goTo(0.8);
return this.changeImage(imageNum);
},
 
position: function() {
this.overlay.setStyles({top: Window.getScrollTop()+'px', height: Window.getHeight()+'px'});
},
 
setup: function(open) {
var elements = $A(document.getElementsByTagName('object'));
elements.extend(document.getElementsByTagName(window.ActiveXObject ? 'select' : 'embed'));
elements.each(function(el){ el.style.visibility = open ? 'hidden' : ''; });
var fn = open ? 'addEvent' : 'removeEvent';
window[fn]('scroll', this.eventPosition)[fn]('resize', this.eventPosition);
document[fn]('keydown', this.eventKeyDown);
this.step = 0;
},
 
keyboardListener: function(event) {
switch(event.keyCode) {
case 27: case 88: case 67: this.close(); break;
case 37: case 80: this.previous(); break;
case 39: case 78: this.next();
}
},
 
previous: function() {
return this.changeImage(this.activeImage-1);
},
 
next: function() {
return this.changeImage(this.activeImage+1);
},
 
changeImage: function(imageNum) {
if(this.step || (imageNum < 0) || (imageNum >= this.images.length)) return false;
this.step = 1;
this.activeImage = imageNum;
this.prevLink.style.display = this.nextLink.style.display = 'none';
this.bottom.setStyles({opacity: '0', height: '0px', display: 'none'});
this.fx.image.hide();
this.center.className = 'lbLoading';
this.preload = new Image();
this.preload.onload = this.nextEffect.bind(this);
this.preload.src = this.images[imageNum][0];
return false;
},
 
nextEffect: function() {
switch(this.step++) {
case 1:
this.center.className = '';
this.image.setStyles({backgroundImage: 'url('+this.images[this.activeImage][0]+')', width: this.preload.width+'px'});
this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';
this.caption.setHTML(this.images[this.activeImage][1] || '');
this.number.setHTML((this.images.length == 1) ? '' : 'Image '+(this.activeImage+1)+' of '+this.images.length);
if(this.activeImage != 0) this.preloadPrev.src = this.images[this.activeImage - 1][0];
if(this.activeImage != (this.images.length - 1)) this.preloadNext.src = this.images[this.activeImage + 1][0];
if(this.center.clientHeight != this.image.offsetHeight) {
this.fx.resize.custom({height: [this.center.clientHeight, this.image.offsetHeight]});
break;
}
this.step++;
case 2:
if(this.center.clientWidth != this.image.offsetWidth) {
this.fx.resize.custom({width: [this.center.clientWidth, this.image.offsetWidth], marginLeft: [-this.center.clientWidth/2, -this.image.offsetWidth/2]});
break;
}
this.step++;
case 3:
this.bottom.setStyles({top: (this.top + this.center.clientHeight)+'px', width: this.image.style.width, marginLeft: this.center.style.marginLeft, display: ''});
this.fx.image.custom(0, 1);
break;
case 4:
if(this.options.animateCaption) {
this.fx.bottom.custom({opacity: [0, 1], height: [0, this.bottom.scrollHeight]});
break;
}
this.bottom.setStyles({opacity: '1', height: this.bottom.scrollHeight+'px'});
case 5:
if(this.activeImage != 0) this.prevLink.style.display = '';
if(this.activeImage != (this.images.length - 1)) this.nextLink.style.display = '';
this.step = 0;
}
},
 
close: function() {
if(this.step < 0) return;
this.step = -1;
if(this.preload) {
this.preload.onload = Class.empty;
this.preload = null;
}
for(var f in this.fx) this.fx[f].clearTimer();
this.center.style.display = this.bottom.style.display = 'none';
this.fx.overlay.chain(this.setup.pass(false, this)).goTo(0);
return false;
}
};
 
Window.onDomReady(Lightbox.init.bind(Lightbox));
/branches/v2.0-narmer/client/questionnaire/questionnaire.php
New file
0,0 → 1,148
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: questionnaire.php,v 1.1 2007-04-19 14:51:10 florian Exp $
/**
* Contact
*
* Un module d'envoi de mails a une personne de l'annuaire, choisie par une liste déroulante
*
*@package inscription
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
*
*@copyright Réseau Ecole et Nature 2005
*@version $Revision: 1.1 $ $Date: 2007-04-19 14:51:10 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_RACINE.'api/formulaire/formulaire.class.inc.php' ;
//appel du fichier de constantes des langues
include_once PAP_CHEMIN_RACINE.'client/questionnaire/langues/questionnaire.langue.'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php' ;
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function afficherContenuCorps() {
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans le menu
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['menu'] ;
$resultat = $GLOBALS['_GEN_commun']['pear_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$arguments = explode('||', $ligne->gm_application_arguments) ;
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i], 2) ;
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '') ;
}
}
}
}
// On recupere le template du questionnaire
$requete = 'SELECT bti_nom, bti_template FROM pap_formulaires WHERE bti_id='.$info_application->num_questionnaire.' AND bti_i18n LIKE "'.$GLOBALS['_GEN_commun']['i18n'].'%"' ;
$resultat = $GLOBALS['_GEN_commun']['pear_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$nom_questionnaire=$ligne->bti_nom ;
$template=$ligne->bti_template ;
}
$url = preg_replace ('/&amp;/', '&', $GLOBALS['_GEN_commun']['url']->getURL()) ;
$form = new PAP_donnees ;
$res='<h1>'.$nom_questionnaire.'</h1>'."\n" ;
// cas du formulaire deja rempli : on envoie le mail
if (isset($_POST['envoi']) && !isset($_SESSION['formulaire_deja_envoye']) ) {
$_SESSION['formulaire_deja_envoye'] = 1 ;
$headers = 'From: '.QUESTIONNAIRE.' <'.$info_application->mail_questionnaire.'>'."\n" ;
$headers .= 'X-Mailler: Florian'."\n" ;
$corps='' ;
$tableau = $form->afficher_donnees($info_application->num_questionnaire) ;
//var_dump($_POST);
for ($i=0; $i<count($tableau); $i++) {
if (isset($_POST[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='formulaire_texte' || $tableau[$i]['type']=='formulaire_textelong' ) ) {
$val=$tableau[$i]['nom_bdd'] ;
if ($_POST[$val] != '' and $_POST[$val] != FORM_CHOISIR and $_POST[$val] != FORM_NON_PRECISE) {
$corps .= $tableau[$i]['label'].' : '.$_POST[$val]."\n"."\n" ;
}
}
elseif ( $tableau[$i]['type']=='formulaire_liste' ) {
$requete = 'SELECT plv_label FROM pap_liste_valeurs WHERE plv_valeur='.$_POST['liste'.$tableau[$i]['nom_bdd'].$tableau[$i]['id_source']].' AND plv_ce_liste='.$tableau[$i]['nom_bdd'].' AND plv_ce_i18n LIKE "'.$GLOBALS['_GEN_commun']['i18n'].'%"' ;
$resultat = $GLOBALS['_GEN_commun']['pear_db']->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$val=$ligne->plv_label ;
}
else $val='';
if ($val != '' and $val != FORM_CHOISIR and $val != FORM_NON_PRECISE) {
$corps .= $tableau[$i]['label'].' : '.$val."\n"."\n" ;
}
}
elseif ( $tableau[$i]['type']=='formulaire_listedatedeb' || $tableau[$i]['type']=='formulaire_listedatefin' ) {
$val=$tableau[$i]['nom_bdd'] ;
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
if ($_POST[$val] != '') {
$corps .= $tableau[$i]['label'].' : '.strftime('%d.%m.%Y',strtotime($_POST[$val]))."\n"."\n" ;
}
}
}
}
mail($info_application->mail_questionnaire, QUESTIONNAIRE_REPONSE_AU.' : '.$nom_questionnaire, html_entity_decode($corps), $headers) ; // Envoi du mail
$res .= $info_application->texte_questionnaire_envoye;
return $res;
// Cas ou l'on affiche le questionnaire
} else {
unset ($_SESSION['formulaire_deja_envoye']) ;
$res .= $form->afficher_formulaire('formulaire_questionnaire', $url , $template ) ;
}
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2006/04/28 11:35:37 florian
* ajout constantes chemin
*
* Revision 1.2 2006/01/19 10:24:37 florian
* champs obligatoires pour le formulaire de saisie
*
* Revision 1.1 2005/09/22 13:28:50 florian
* Application de contact, pour envoyer des mails. Reste a faire: configuration pour choisir les destinataires dans l'annuaire.
*
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/questionnaire/langues/questionnaire.langue.fr.inc.php
New file
0,0 → 1,73
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: questionnaire.langue.fr.inc.php,v 1.1 2007-04-19 14:51:10 florian Exp $
/**
* Fichier de traduction en français de l'application contact
*
*@package contact
//Auteur original :
*@author Florian SCHMITT <florian@ecole-et-nature.org>
//Autres auteurs :
*@author Aucun
*@copyright Ecole et Nature 2005
*@version $Revision: 1.1 $ $Date: 2007-04-19 14:51:10 $
// +------------------------------------------------------------------------------------------------------+
*/
define ('QUESTIONNAIRE', 'Questionnaire') ;
define ('QUESTIONNAIRE_REPONSE_AU', 'Réponse au questionnaire') ;
define ('QUESTIONNAIRE_CONFIG', 'Configuration du questionnaire') ;
define ('QUESTIONNAIRE_ENVOYER', 'Envoyer') ;
define ('QUESTIONNAIRE_CHOIX', 'Choix du questionnaire') ;
define ('QUESTIONNAIRE_MAIL', 'Adresse de messagerie pour la r&eacute;ponse au formulaire') ;
define ('QUESTIONNAIRE_ANNULER', 'Annuler') ;
define ('QUESTIONNAIRE_ENREGISTRER_ET_QUITTER', 'Enregistrer et quitter') ;
define ('QUESTIONNAIRE_TEXTE_MESSAGE_ENVOYE', 'Texte apparaissant une fois le questionnaire rempli et envoy&eacute;');
 
define ('CON_VOTRE_MESSAGE', 'Votre message');
define ('CON_A_ETE_ENVOYE', 'a bien été envoyé.');
 
define ('CON_EMAIL_REQUIS','veuillez saisir votre adresse mail pour que l\'on puisse vous répondre');
define ('CON_EMAIL_INCORRECT','adresse mail incorrecte (elle doit etre de la forme nom@domaine.ext)');
define ('CON_DESTINATAIRE', 'Destinataire : ') ;
define ('CON_SUJET', 'Sujet : ') ;
define ('CON_SUJET_REQUIS', 'veuillez saisir un sujet pour le message');
define ('CON_MESSAGE', 'Message : ') ;
define ('CON_MESSAGE_REQUIS', 'veuillez saisir le message');
 
define ('CON_ENVOYER_NOUS_MAIL', 'Envoyez-nous un message électronique (courriel):');
define ('CON_CHAMPS_REQUIS','champs obligatoires');
define ('CON_ERREUR_SAISIE','Erreur de saisie des champs:');
define ('CON_VEUILLEZ_CORRIGER','Veuillez corriger, SVP.');
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2006/01/19 10:24:37 florian
* champs obligatoires pour le formulaire de saisie
*
* Revision 1.1 2005/09/22 13:28:50 florian
* Application de contact, pour envoyer des mails. Reste a faire: configuration pour choisir les destinataires dans l'annuaire.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v2.0-narmer/client/questionnaire/questionnaire.admin.php
New file
0,0 → 1,166
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2006 Outils Reseaux (info@outils-reseaux.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: questionnaire.admin.php,v 1.1 2007-04-19 14:51:10 florian Exp $
/**
*
*@package Questionnaire
//Auteur original :
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Outils Reseaux 2006
*@version $Revision: 1.1 $ $Date: 2007-04-19 14:51:10 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php' ;
//appel du fichier de constantes des langues
include_once 'langues/questionnaire.langue.'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
 
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSE |
// +------------------------------------------------------------------------------------------------------+
 
class Questionnaire_Admin {
var $objet_pear_auth;
var $objet_pear_db;
var $objet_pear_url;
var $sortie_xhtml;
/** Fonction redigerContenu() - Affiche le formulaire de r?action
*
*
* @return string Le HTML
*/
function afficherContenuCorps()
{
//-------------------------------------------------------------------------------------------------------------------
// Initialisation des attributs
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
$this->objet_pear_db = $GLOBALS['_GEN_commun']['pear_db'];
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
$this->sortie_xhtml = '<h1>'.QUESTIONNAIRE_CONFIG.'</h1>'."\n";
//-------------------------------------------------------------------------------------------------------------------
// Gestion des boutons de l'interface
if (isset($_POST['afficheur_annuler'])) {
return false;
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
$requete = 'UPDATE gen_menu SET gm_application_arguments="num_questionnaire='.$_POST['num_questionnaire'].
'||mail_questionnaire='.$_POST['mail_questionnaire'].'||texte_questionnaire_envoye='.$_POST['texte_questionnaire_envoye'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return false;
}
//--------------------------------------------------------------------------------------------------------------
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans le menu
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
$resultat = $this->objet_pear_db->query($requete) ;
//echo $requete;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$valeurs_par_defaut = array();
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$arguments = explode('||', $ligne->gm_application_arguments);
for ($i = 0; $i < count($arguments); $i++) {
$attr = explode('=', $arguments[$i], 2);
if ($attr[0] != '') {
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
}
}
}
//valeurs par defaut enregistrees dans la table
if (isset($info_application)) {
$valeurs_par_defaut['num_questionnaire']=$info_application->num_questionnaire;
$valeurs_par_defaut['mail_questionnaire']=$info_application->mail_questionnaire;
$valeurs_par_defaut['texte_questionnaire_envoye']=$info_application->texte_questionnaire_envoye;
}
} else {
//valeurs par defaut pour afficher une carto des structures
$valeurs_par_defaut['num_questionnaire']='';
$valeurs_par_defaut['mail_questionnaire']='';
$valeurs_par_defaut['texte_questionnaire_envoye']='';
}
//--------------------------------------------------------------------------------------------------------------
// Gestion du questionnaire
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
$form =& new HTML_QuickForm('form_param_questionnaire', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
$squelette =& $form->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<p>'."\n".
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
' : </label>'."\n".'{element}'."\n".
'</p>'."\n" );
// on récupère tous les questionnaires
$requete = 'SELECT bti_id, bti_nom FROM pap_formulaires WHERE bti_groupe="questionnaire" AND bti_i18n LIKE "'.$GLOBALS['_GEN_commun']['i18n'].'%"' ;
$resultat = $this->objet_pear_db->query($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$select[$ligne->bti_id]=$ligne->bti_nom;
}
}
$option=array('style'=>'width: 200px;');
$select= new HTML_QuickForm_select('num_questionnaire', QUESTIONNAIRE_CHOIX, $select, $option);
$select->setSize(1);
$select->setMultiple(0);
$form->addElement($select) ;
$formtexte= new HTML_QuickForm_textarea('texte_questionnaire_envoye', QUESTIONNAIRE_TEXTE_MESSAGE_ENVOYE, array('style'=>'white-space: normal;'));
$formtexte->setCols(40);
$formtexte->setRows(10);
$form->addElement($formtexte) ;
$form->applyFilter('texte_questionnaire_envoye', 'addslashes') ;
$form->addElement('text', 'mail_questionnaire', QUESTIONNAIRE_MAIL);
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
$form->addElement('html', $liste_bouton_debut);
$form->addElement('submit', 'afficheur_enregistrer_quitter', QUESTIONNAIRE_ENREGISTRER_ET_QUITTER);
$form->addElement('submit', 'afficheur_annuler', QUESTIONNAIRE_ANNULER);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$form->setDefaults($valeurs_par_defaut);
$this->sortie_xhtml .= $form->toHTML()."\n";
return $this->sortie_xhtml;
}
 
}// Fin de la classe
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
?>