revert des commit [1944], [1939], [1933], [1925] : nouveau bureau.
On recommencera mais en patchant la branche /franck-desktop
This commit is contained in:
parent
e2272fb4e3
commit
3b749e368d
|
@ -66,17 +66,12 @@ if (ini_get("safe_mode")) {
|
|||
exit();
|
||||
}
|
||||
|
||||
$error = "";
|
||||
|
||||
/* PHPLIB inclusions : */
|
||||
$root="/var/alternc/bureau/";
|
||||
/* Server Domain Name */
|
||||
$host=getenv("HTTP_HOST");
|
||||
|
||||
/* Custom PHP debugger */
|
||||
require_once($root."class/error_handler.php");
|
||||
$queryCount = 0;
|
||||
|
||||
/* Global variables (AlternC configuration) */
|
||||
require_once($root."class/local.php");
|
||||
|
||||
|
@ -84,8 +79,6 @@ require_once($root."class/db_mysql.php");
|
|||
require_once($root."class/functions.php");
|
||||
require_once($root."class/variables.php");
|
||||
|
||||
$tempsDebut = microtimeFloat();
|
||||
|
||||
// Redirection si appel à https://(!fqdn)/
|
||||
if ($_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
|
||||
header("Location: https://$L_FQDN/");
|
||||
|
@ -150,14 +143,7 @@ $err=new m_err();
|
|||
|
||||
/* Check the User identity (if required) */
|
||||
if (!defined('NOCHECK')) {
|
||||
$fields = array (
|
||||
"username" => array ("request", "string", ""),
|
||||
"password" => array ("request", "string", ""),
|
||||
"restrictip" => array ("request", "integer", 0),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
if (!$mem->checkid($username,$password,$restrictip)) {
|
||||
if (!$mem->checkid()) {
|
||||
$error=$err->errstr();
|
||||
include("index.php");
|
||||
exit();
|
||||
|
|
|
@ -395,105 +395,5 @@ function duration_list($name, $selected=0) {
|
|||
return $res;
|
||||
}
|
||||
|
||||
/* ---------------------- */
|
||||
/** Fonctions necessaires au nouveau bureau */
|
||||
|
||||
function getFields($fields, $requestOnly = false)
|
||||
{
|
||||
$vars = array();
|
||||
$methodType = array ("get", "post", "request", "files");
|
||||
|
||||
foreach ($fields AS $name => $options)
|
||||
{
|
||||
if (in_array($options[0], $methodType) === false)
|
||||
die ("Illegal method type used for field " . $name . " : " . $options[0]);
|
||||
|
||||
if ($requestOnly === true)
|
||||
$method = "_REQUEST";
|
||||
else
|
||||
$method = "_" . strtoupper($options[0]);
|
||||
|
||||
switch ($options[1])
|
||||
{
|
||||
case "integer":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? intval($GLOBALS[$method][$name]) : $options[2]);
|
||||
break;
|
||||
|
||||
case "float":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_numeric($GLOBALS[$method][$name]) ? floatval($GLOBALS[$method][$name]) : $options[2]);
|
||||
break;
|
||||
|
||||
case "string":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) ? trim($GLOBALS[$method][$name]) : $options[2]);
|
||||
break;
|
||||
|
||||
case "array":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) && is_array($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
|
||||
break;
|
||||
|
||||
case "boolean":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
|
||||
break;
|
||||
|
||||
case "file":
|
||||
|
||||
$vars[$name] = (isset($GLOBALS[$method][$name]) ? $GLOBALS[$method][$name] : $options[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
die ("Illegal method type used for field " . $name . " : " . $options[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Insert into $GLOBALS
|
||||
foreach ($vars AS $var => $value)
|
||||
$GLOBALS[$var] = $value;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
function printVar($array)
|
||||
{
|
||||
echo "<pre style=\"border: 1px solid black; text-align: left; font-size: 9px\">\n";
|
||||
print_r($array);
|
||||
echo "</pre>\n";
|
||||
}
|
||||
|
||||
function startBox($boxClass)
|
||||
{
|
||||
echo "<table class=\"" . $boxClass . "\">";
|
||||
echo "<tr>";
|
||||
echo "<td class=\"boxTopLeft\"></td>";
|
||||
echo "<td class=\"boxTop\"></td>";
|
||||
echo "<td class=\"boxTopRight\"></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
echo "<td class=\"boxLeft\"></td>";
|
||||
echo "<td class=\"boxContent\">";
|
||||
}
|
||||
|
||||
function endBox()
|
||||
{
|
||||
echo "</td>";
|
||||
echo "<td class=\"boxRight\"></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
echo "<td class=\"boxBottomLeft\"></td>";
|
||||
echo "<td class=\"boxBottom\"></td>";
|
||||
echo "<td class=\"boxBottomRight\"></td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
function microtimeFloat()
|
||||
{
|
||||
return array_sum(explode(" ", microtime()));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -125,28 +125,8 @@ class m_admin {
|
|||
$db->next_record();
|
||||
return ($db->f("cnt")==1);
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/** Retourne la liste des lettres pour lesquelles un utilisateur a
|
||||
* des membres
|
||||
* Retourne un tableau indexé où se trouvent les lettres
|
||||
* @return array Tableau de lettres ou FALSE si erreur
|
||||
*/
|
||||
function get_letters() {
|
||||
global $err,$mem,$cuid,$db;
|
||||
$err->log("admin","get_letters");
|
||||
if ($mem->user["uid"]==2000)
|
||||
$db->query("SELECT LEFT(login,1) as letter FROM membres GROUP BY letter ORDER BY letter;");
|
||||
else
|
||||
$db->query("SELECT LEFT(login,1) as letter FROM membres WHERE creator='$cuid' GROUP BY letter ORDER BY letter;");
|
||||
$res=array();
|
||||
while($db->next_record()) {
|
||||
$res[]=$db->f("letter");
|
||||
}
|
||||
Return $res;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* Returns the list of the hosted accounts
|
||||
* Retourne la liste des membres hébergés
|
||||
|
@ -166,7 +146,7 @@ class m_admin {
|
|||
* produite.
|
||||
*
|
||||
*/
|
||||
function get_list($all=0, $letter="") {
|
||||
function get_list($all=0) {
|
||||
// PATCHBEN pour ne voir que les comptes que l'on a créé (sauf admin)
|
||||
global $err,$mem,$cuid;
|
||||
$err->log("admin","get_list");
|
||||
|
@ -175,14 +155,10 @@ class m_admin {
|
|||
return false;
|
||||
}
|
||||
$db=new DB_System();
|
||||
$letterQuery = "";
|
||||
$db->query("SELECT uid FROM membres ORDER BY login;");
|
||||
if ($letter)
|
||||
$letterQuery = "&& login LIKE '" . $letter . "%'";
|
||||
if ($mem->user["uid"]==2000 || $all) {
|
||||
$db->query("SELECT uid FROM membres WHERE 1" . $letterQuery . " ORDER BY login;");
|
||||
if ($mem->user[uid]==2000 || $all) {
|
||||
$db->query("SELECT uid FROM membres ORDER BY login;");
|
||||
} else {
|
||||
$db->query("SELECT uid FROM membres WHERE creator='".$cuid. "'" . $letterQuery." ORDER BY login;");
|
||||
$db->query("SELECT uid FROM membres WHERE creator='".$cuid."' ORDER BY login;");
|
||||
}
|
||||
if ($db->num_rows()) {
|
||||
while ($db->next_record()) {
|
||||
|
@ -209,7 +185,7 @@ class m_admin {
|
|||
}
|
||||
$db->query("SELECT creator FROM membres WHERE uid='$uid';");
|
||||
$db->next_record();
|
||||
if ($db->Record["creator"]!=$cuid) {
|
||||
if ($db->Record[creator]!=$cuid) {
|
||||
$err->raise("admin",1);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -161,8 +161,8 @@ class m_mem {
|
|||
* @global string $username/password le login/pass de l'utilisateur
|
||||
* @return TRUE si la session est correcte, FALSE sinon.
|
||||
*/
|
||||
function checkid($username, $password, $restrictip) {
|
||||
global $db,$err,$session,$cuid;
|
||||
function checkid() {
|
||||
global $db,$err,$session,$username,$password,$cuid,$restrictip;
|
||||
if ($username && $password) {
|
||||
return $this->login($username,$password,$restrictip);
|
||||
}
|
||||
|
|
|
@ -120,17 +120,10 @@ class m_quota {
|
|||
* @param string ressource to get quota of
|
||||
* @Return the quota used and total for this ressource (or for all ressource if unspecified)
|
||||
*/
|
||||
function getquota($ressource="",$force= false) {
|
||||
function getquota($ressource="") {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("quota","getquota",$ressource);
|
||||
$this->qlist(); // Generate the quota list.
|
||||
if ($force == false && $this->quotas) {
|
||||
if ($ressource) {
|
||||
return $this->quotas[$ressource];
|
||||
} else {
|
||||
return $this->quotas;
|
||||
}
|
||||
}
|
||||
$db->query("select * from quotas where uid='$cuid';");
|
||||
if ($db->num_rows()==0) {
|
||||
return array("t"=>0, "u"=>0);
|
||||
|
|
Loading…
Reference in New Issue