/tags/Racine_livraison_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; |
} |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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"> 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%"> |
/tags/Racine_livraison_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\"> </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> • <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."; |
} |
} |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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."; |
} |
?> |
/tags/Racine_livraison_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); |
} |
?> |
/tags/Racine_livraison_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); |
} |
?> |
/tags/Racine_livraison_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); |
} |
?> |
/tags/Racine_livraison_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; |
} |
?> |
/tags/Racine_livraison_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); |
} |
?> |
/tags/Racine_livraison_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\"> </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> • <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."; |
} |
?> |
/tags/Racine_livraison_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; |
} |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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\" /> <input type=\"submit\" name=\"confirm\" value=\"No\" /></form>"; |
} |
?> |
<div class="PhorumInfoMessage"><?php echo $msg; ?></div> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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"; |
} |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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(); |
} |
?> |
/tags/Racine_livraison_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\"> </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> • <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."; |
} |
} |
?> |
/tags/Racine_livraison_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"; |
} |
?> |
/tags/Racine_livraison_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"); |
?> |
/tags/Racine_livraison_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> |
/tags/Racine_livraison_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( " File Types (eg. gif;jpg)", $frm->text_box( "file_types", $PHORUM["file_types"], 30 ) ); |
$row=$frm->addrow( " Max File Size (KB)", $frm->text_box( "max_file_size", $PHORUM["max_file_size"], 30 ) ); |
$row=$frm->addrow( " File Space Quota (KB)", $frm->text_box( "file_space_quota", $PHORUM["file_space_quota"], 30 ) ); |
$row=$frm->addrow( " Allow Off Site Links", $frm->select_tag( "file_offsite", array( "No", "Yes" ), $PHORUM["file_offsite"] ) ); |
$frm->addhelp($row, " 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( " 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( " 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( " 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, " 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(); |
?> |
/tags/Racine_livraison_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) . " • <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.=" "; |
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'])) : " ")."</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"])." <a href=\"#forums\">Edit Forum Permissions</a> <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")." ". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply")." ". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics")." ". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit Their Posts")."<br />". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach Files")."<br />". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages")." ". |
$frm->checkbox("new_forum_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")." "; |
$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))." ". |
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", ($perms & PHORUM_USER_ALLOW_REPLY))." ". |
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics", ($perms & PHORUM_USER_ALLOW_NEW_TOPIC))." ". |
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit Their Posts", ($perms & PHORUM_USER_ALLOW_EDIT))."<br />". |
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach 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))." ". |
$frm->checkbox("forum_permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users", ($perms & PHORUM_USER_ALLOW_MODERATE_USERS))." ". |
$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."; |
} |
} |
?> |
/tags/Racine_livraison_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)." ". |
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $pub_perms & PHORUM_USER_ALLOW_REPLY, $disabled_form_input)." ". |
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics", $pub_perms & PHORUM_USER_ALLOW_NEW_TOPIC, $disabled_form_input)."<br />". |
$frm->checkbox("pub_perms[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach 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)." ". |
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $reg_perms & PHORUM_USER_ALLOW_REPLY, $disabled_form_input)." ". |
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics", $reg_perms & PHORUM_USER_ALLOW_NEW_TOPIC, $disabled_form_input)."<br />". |
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit Their Posts", $reg_perms & PHORUM_USER_ALLOW_EDIT, $disabled_form_input)." ". |
$frm->checkbox("reg_perms[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach 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(); |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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"; |
} |
} |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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(); |
?> |
/tags/Racine_livraison_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 = " " ) |
{ |
$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('"', """, $data[0]); |
$text = str_replace('"', '"', $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 = " ", $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> $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> $caption</nobr>"; |
return $data; |
} |
// $list and $checklist are both associative and should have the same indicies |
function checkbox_list( $prefix, $list, $separator = " ", $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; |
} |
} |
?> |
/tags/Racine_livraison_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); |
} |
?> |
/tags/Racine_livraison_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")." ". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply")." ". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics")." ". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit Their Posts")."<br />". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach Files")."<br />". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages")." ". |
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")." "; |
$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)." ". |
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_REPLY."]", 1, "Reply", $perms & PHORUM_USER_ALLOW_REPLY)." ". |
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_NEW_TOPIC."]", 1, "Create New Topics", $perms & PHORUM_USER_ALLOW_NEW_TOPIC)." ". |
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit Their Posts", $perms & PHORUM_USER_ALLOW_EDIT)."<br />". |
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach 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)." ". |
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users", $perms & PHORUM_USER_ALLOW_MODERATE_USERS)." ". |
$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"; |
} |
/tags/Racine_livraison_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"; |
?> |
/tags/Racine_livraison_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> • <a href=\"$_SERVER[PHP_SELF]?module=editfolder&forum_id=$forum_id\">Edit</a> • <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> • <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> • <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 <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> |
/tags/Racine_livraison_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>"; |
} |
?> |