Subversion Repositories Applications.papyrus

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1372 → Rev 1976

/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_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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/mysqli/2005102700.php
--- bibliotheque/phorum/include/db/upgrade/mysqli/2005120400.php (revision 0)
+++ bibliotheque/phorum/include/db/upgrade/mysqli/2005120400.php (revision 1976)
@@ -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/config.php
New file
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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_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_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_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_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/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/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/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/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/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/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/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/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/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/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/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_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/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/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_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_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/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/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_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/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/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_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/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/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/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/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/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/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.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/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/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_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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 ----------------------------------------------------------------------------------------+
*/
?>