domci : commas should be followed by space

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5281 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-05-23 14:55:18 +00:00
parent 17168aaaef
commit f423229f94
20 changed files with 159 additions and 167 deletions

View File

@@ -53,16 +53,16 @@ class authentication
public $jwtServerKey = null;
/** The authentication servers configuration
* array ("authXXXX"=>array (
* array ("ldapserver"=>"ldaps://annuaire.grenoble.cnrs.fr",
* "ldapport"=>636,
* "ldaptimeout"=>5,
* "ldapauth"=>"uid=annuaire,ou=people,dc=grenoble,dc=cnrs,dc=fr",
* "ldappwd"=>";authANNUAIRE2013",
* "ldapbase"=>"",
* "ldapfilter"=>"(mail=%s)",
* "ldapfield"=>"mail",
* "ldapfiltersearch"=>"(objectClass=inetOrgPerson)"
* array ("authXXXX" => array (
* array ("ldapserver" => "ldaps://server.domain.fr",
* "ldapport" => 636,
* "ldaptimeout" => 5,
* "ldapauth" => "uid=XXX,dc=domain,dc=fr",
* "ldappwd" => "XXX",
* "ldapbase" => "",
* "ldapfilter" => "(mail=%s)",
* "ldapfield" => "mail",
* "ldapfiltersearch" => "(objectClass=inetOrgPerson)"
* ),
* ),
* );

View File

@@ -126,9 +126,9 @@ class authldap extends auth
{
if ($this->ldapconn === NULL)
throw new \Exception ("No established LDAP connection", 500);
$search = ldap_search ($this->ldapconn,$this->ldapbase,
$search = ldap_search ($this->ldapconn, $this->ldapbase,
$this->ldapfiltersearch,
array ("mail","sn","givenname"));
array ("mail", "sn", "givenname"));
if ($search === FALSE)
throw new \Exception ("Unable to search the users in LDAP", 500);
$info = ldap_get_entries ($this->ldapconn, $search);

View File

@@ -96,7 +96,7 @@ class authorizationdb extends authorization
$groupid = intval ($search["groupid"]);
$modbits = octdec ($search["modbits"]);
if ($this->authiduser === 0)
return array ("READ","WRITE","EXECUTE");
return array ("READ", "WRITE", "EXECUTE");
$res = array ();
if ($this->authiduser === $ownerid)

View File

@@ -17,7 +17,7 @@ class authparams
* If non is found, return "anonymous", "anonymous"
* @param array|null $authprocesses The authentication process to use
*/
public function __construct ($authprocesses=array("session","post"))
public function __construct ($authprocesses = array ("session", "post"))
{
if (php_sapi_name () === "cli")
{

View File

@@ -49,7 +49,7 @@ class authsql extends auth
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
$this->driver_options);
if ($this->table === null)
throw new Exception (dgettext ("domframework","No SQL table defined"),
throw new Exception (dgettext ("domframework", "No SQL table defined"),
500);
if ($this->fieldIdentifier === null)
throw new Exception (dgettext ("domframework",
@@ -68,7 +68,7 @@ class authsql extends auth
$this->fieldsInfo);
$fields = array_flip ($fields);
foreach ($fields as $key=>$val)
$fields[$key] = array ("varchar","255");
$fields[$key] = array ("varchar", "255");
$this->db->table = $this->table;
$this->db->fields = $fields;
$this->db->primary = $this->fieldIdentifier;
@@ -139,11 +139,11 @@ class authsql extends auth
throw new Exception (dgettext ("domframework",
"Bad old password provided"), 401);
$cost = 11;
$salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22);
$salt=str_replace("+",".",$salt);
$param='$'.implode('$',array(
$salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22);
$salt = str_replace ("+", ".", $salt);
$param = '$'.implode('$', array(
"2y", //select the most secure version of blowfish (>=PHP 5.3.7)
str_pad($cost,2,"0",STR_PAD_LEFT), //add the cost in two digits
str_pad ($cost, 2, "0", STR_PAD_LEFT), //add the cost in two digits
$salt //add the salt
));
//now do the actual hashing
@@ -173,11 +173,11 @@ class authsql extends auth
"Unable to find the user : '%s'"),
$email), 401);
$cost = 11;
$salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22);
$salt=str_replace("+",".",$salt);
$param='$'.implode('$',array(
$salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22);
$salt = str_replace ("+", ".", $salt);
$param = '$'. implode ('$', array (
"2y", //select the most secure version of blowfish (>=PHP 5.3.7)
str_pad($cost,2,"0",STR_PAD_LEFT), //add the cost in two digits
str_pad ($cost, 2, "0", STR_PAD_LEFT), //add the cost in two digits
$salt //add the salt
));
//now do the actual hashing

View File

@@ -169,8 +169,8 @@ class authzgroups
$object = "/$object";
$rc = $this->allow ($module, $user, "$object");
if ($this->debug)
trigger_error ("authzgroups : accessRight ('$module','$user','$object')".
"=$rc", E_USER_NOTICE);
trigger_error ("authzgroups : accessRight ('$module', '$user', ".
"'$object')=$rc", E_USER_NOTICE);
if ($rc !== "NO")
return TRUE;
if ($user === "anonymous")
@@ -204,8 +204,8 @@ class authzgroups
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
trigger_error ("authzgroups : accessWrite ('$module','$user','$object')".
"=$rc", E_USER_NOTICE);
trigger_error ("authzgroups : accessWrite ('$module', '$user', ".
"'$object')=$rc", E_USER_NOTICE);
if ($rc === "RW")
return TRUE;
if ($user === "anonymous")
@@ -241,7 +241,7 @@ class authzgroups
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
trigger_error ("authzgroups : accessReadOnly ('$module','$user',".
trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ".
"'$object')" ."=$rc", E_USER_NOTICE);
if ($rc === "RO")
return TRUE;
@@ -270,40 +270,34 @@ class authzgroups
$this->dbObject->table = "authzobject";
$this->dbObject->prefix = $this->tableprefix;
$this->dbObject->fields = array (
"idobject"=>array ("integer", "not null", "autoincrement"),
"module"=> array ("varchar", "255", "not null"),
"object"=> array ("varchar", "255", "not null"),
"comment"=> array ("varchar", "255"));
"idobject" => array ("integer", "not null", "autoincrement"),
"module" => array ("varchar", "255", "not null"),
"object" => array ("varchar", "255", "not null"),
"comment" => array ("varchar", "255"));
$this->dbObject->primary = "idobject";
$this->dbObject->unique = array ("idobject", array ("object", "module"));
$this->dbObject->titles = array ("idobject"=>dgettext ("domframework",
"idobject"),
"module"=>dgettext ("domframework",
"Module"),
"object"=>dgettext ("domframework",
"Object"),
"comment"=>dgettext ("domframework",
"Comment"));
$this->dbObject->titles = array (
"idobject" => dgettext ("domframework", "idobject"),
"module" => dgettext ("domframework", "Module"),
"object" => dgettext ("domframework", "Object"),
"comment" => dgettext ("domframework", "Comment"));
$this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
$this->dbGroup->debug = $this->debug;
$this->dbGroup->table = "authzgroup";
$this->dbGroup->prefix = $this->tableprefix;
$this->dbGroup->fields = array (
"idgroup"=>array ("integer", "not null", "autoincrement"),
"module"=> array ("varchar", "255", "not null"),
"group"=> array ("varchar", "255", "not null"),
"comment"=>array ("varchar", "255"));
"idgroup" => array ("integer", "not null", "autoincrement"),
"module" => array ("varchar", "255", "not null"),
"group" => array ("varchar", "255", "not null"),
"comment" => array ("varchar", "255"));
$this->dbGroup->primary = "idgroup";
$this->dbGroup->unique = array ("idgroup", array ("module","group"));
$this->dbGroup->titles = array ("idgroup"=>dgettext ("domframework",
"idgroup"),
"module"=>dgettext ("domframework",
"Module"),
"group"=>dgettext ("domframework",
"Group"),
"comment"=>dgettext ("domframework",
"Comment"));
$this->dbGroup->unique = array ("idgroup", array ("module", "group"));
$this->dbGroup->titles = array (
"idgroup" => dgettext ("domframework", "idgroup"),
"module" => dgettext ("domframework", "Module"),
"group" => dgettext ("domframework", "Group"),
"comment" => dgettext ("domframework", "Comment"));
$this->dbGroupMember = new dblayer ($dsn, $username, $password,
$driver_options);
@@ -311,15 +305,15 @@ class authzgroups
$this->dbGroupMember->table = "authzgroupmember";
$this->dbGroupMember->prefix = $this->tableprefix;
$this->dbGroupMember->fields = array (
"idgroupmember"=>array ("integer", "not null", "autoincrement"),
"user"=> array ("varchar", "255", "not null"),
"idgroup"=> array ("integer", "not null"),
"comment"=> array ("varchar", "255"));
"idgroupmember" => array ("integer", "not null", "autoincrement"),
"user" => array ("varchar", "255", "not null"),
"idgroup" => array ("integer", "not null"),
"comment" => array ("varchar", "255"));
$this->dbGroupMember->primary = "idgroupmember";
$this->dbGroupMember->unique = array ("idgroupmember",
array ("user","idgroup"));
array ("user", "idgroup"));
$this->dbGroupMember->foreign = array (
"idgroup"=>array ("authzgroup", "idgroup",
"idgroup" => array ("authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE"));
$this->dbGroupMember->titles = array (
"idgroupmember"=> dgettext ("domframework", "idgroupmember"),
@@ -335,22 +329,22 @@ class authzgroups
"idright"=> array ("integer", "not null", "autoincrement"),
"idgroup"=> array ("integer", "not null"),
"idobject"=>array ("integer", "not null"),
"right"=> array ("varchar", "2", "not null"), // RO,RW
"right"=> array ("varchar", "2", "not null"), // RO, RW
"comment"=> array ("varchar", "255"));
$this->dbRight->primary = "idright";
$this->dbRight->unique = array ("idright", array ("idgroup","idobject"));
$this->dbRight->unique = array ("idright", array ("idgroup", "idobject"));
$this->dbRight->foreign = array (
"idgroup"=> array ("authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE"),
"idobject"=>array ("authzobject", "idobject",
"ON UPDATE CASCADE ON DELETE CASCADE"),
"idgroup" => array ("authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE"),
"idobject" => array ("authzobject", "idobject",
"ON UPDATE CASCADE ON DELETE CASCADE"),
);
$this->dbRight->titles = array (
"idright"=>dgettext ("domframework", "idright"),
"idgroup"=>dgettext ("domframework", "idgroup"),
"idobject"=>dgettext ("domframework", "idobject"),
"right"=>dgettext ("domframework", "Right"),
"comment"=>dgettext ("domframework", "Comment"));
"idright" => dgettext ("domframework", "idright"),
"idgroup" => dgettext ("domframework", "idgroup"),
"idobject" => dgettext ("domframework", "idobject"),
"right" => dgettext ("domframework", "Right"),
"comment" => dgettext ("domframework", "Comment"));
return TRUE;
}
@@ -505,7 +499,8 @@ class authzgroups
$select[] = array ("module", $module);
if ($object !== null)
$select[] = array ("object", $object);
return $this->dbObject->read ($select, null, array(array("object","ASC")));
return $this->dbObject->read ($select, null,
array (array ("object", "ASC")));
}
/** Return an array with all the available objects in the module, or only
@@ -517,7 +512,7 @@ class authzgroups
{
if ($this->dbObject == null)
throw new Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
"DB for Object is not connected"), 500);
$select[] = array ("module", $module);
if ($idobject !== null)
$select[] = array ("idobject", $idobject);
@@ -725,11 +720,11 @@ class authzgroups
throw new Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$groupsMembers = $this->dbGroupMember->read (array (
array ("user",$user),
array ("idgroup",$groups[0]["idgroup"])));
array ("user", $user),
array ("idgroup", $groups[0]["idgroup"])));
if (! isset ($groupsMembers[0]["idgroupmember"]))
throw new Exception (dgettext ("domframework",
"Wanted GroupMember not found"), 404);
"Wanted GroupMember not found"), 404);
$this->rightCache = null;
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
}
@@ -743,15 +738,14 @@ class authzgroups
{
if ($this->dbGroupMember == null)
throw new Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
"DB for GroupMember is not connected"), 500);
$groups = $this->groupReadByID ($module, $idgroup);
if (! isset ($groups[0]["idgroup"]))
throw new Exception (dgettext ("domframework",
"Wanted group not found"), 404);
"Wanted group not found"), 404);
$groupsMembers = $this->dbGroupMember->read (array (
array ("idgroupmember",$idgroupmember),
array ("idgroup",$idgroup)));
array ("idgroupmember", $idgroupmember),
array ("idgroup", $idgroup)));
if (! isset ($groupsMembers[0]["idgroupmember"]))
throw new Exception (dgettext ("domframework",
"Wanted GroupMember not found"), 404);
@@ -1118,8 +1112,8 @@ class authzgroups
if (! isset ($objects[0]["idobject"]))
throw new Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$select[] = array ("idgroup",$groups[0]["idgroup"]);
$select[] = array ("idobject",$objects[0]["idobject"]);
$select[] = array ("idgroup", $groups[0]["idgroup"]);
$select[] = array ("idobject", $objects[0]["idobject"]);
return $this->dbRight->read ($select);
}

View File

@@ -191,8 +191,8 @@ class authzgroupsoo
$object = "/$object";
$rc = $this->allow ($module, $user, "$object");
if ($this->debug)
trigger_error ("authzgroups : accessRight ('$module','$user','$object')".
"=$rc", E_USER_NOTICE);
trigger_error ("authzgroups : accessRight ('$module', '$user', ".
"'$object')=$rc", E_USER_NOTICE);
if ($rc !== "NO")
return TRUE;
if ($user === "anonymous")
@@ -226,8 +226,8 @@ class authzgroupsoo
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
trigger_error ("authzgroups : accessWrite ('$module','$user','$object')".
"=$rc", E_USER_NOTICE);
trigger_error ("authzgroups : accessWrite ('$module', '$user', ".
"'$object')=$rc", E_USER_NOTICE);
if ($rc === "RW")
return TRUE;
if ($user === "anonymous")
@@ -263,7 +263,7 @@ class authzgroupsoo
$object = "/$object";
$rc = $this->allow ($module, $user, $object);
if ($this->debug)
trigger_error ("authzgroups : accessReadOnly ('$module','$user',".
trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ".
"'$object')" ."=$rc", E_USER_NOTICE);
if ($rc === "RO")
return TRUE;
@@ -316,7 +316,7 @@ class authzgroupsoo
"group" => array ("varchar(255)", "not null"),
"comment" => array ("varchar(255)")));
$this->dbGroup->primary ("idgroup");
$this->dbGroup->unique (array ("idgroup", array ("module","group")));
$this->dbGroup->unique (array ("idgroup", array ("module", "group")));
$this->dbGroup->titles (array (
"idgroup" => dgettext ("domframework", "idgroup"),
"module" => dgettext ("domframework", "Module"),
@@ -335,7 +335,7 @@ class authzgroupsoo
"comment" => array ("varchar(255)")));
$this->dbGroupMember->primary ("idgroupmember");
$this->dbGroupMember->unique (array ("idgroupmember",
array ("user","idgroup")));
array ("user", "idgroup")));
$this->dbGroupMember->foreign (array (
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE")));
@@ -355,10 +355,10 @@ class authzgroupsoo
"idright" => array ("integer", "not null", "autoincrement"),
"idgroup" => array ("integer", "not null"),
"idobject" => array ("integer", "not null"),
"right" => array ("varchar(2)", "not null"), // NO, RO,RW
"right" => array ("varchar(2)", "not null"), // NO, RO, RW
"comment" => array ("varchar(255)")));
$this->dbRight->primary ("idright");
$this->dbRight->unique (array ("idright", array ("idgroup","idobject")));
$this->dbRight->unique (array ("idright", array ("idgroup", "idobject")));
$this->dbRight->foreign (array (
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE"),
@@ -584,7 +584,7 @@ class authzgroupsoo
$this->dbObject->whereAdd ("object", "=", $object);
return $this->dbObject->select ()
->whereAdd ("module", "=", $module)
->orderAdd ("object","ASC")
->orderAdd ("object", "ASC")
->execute ();
}

View File

@@ -451,7 +451,7 @@ class config
$foundDefault = $text;
if ($id === T_DOC_COMMENT)
{
// Look at @param, @description,@type, @values, @default
// Look at @param, @description, @type, @values, @default
if ($debug) echo "DOC_COMMENT : $text\n";
// Append the not completed lines
$text = trim (substr ($text, 3, -2));
@@ -467,7 +467,7 @@ class config
$tmp = explode (" ", $line);
$key = reset ($tmp);
$key = substr ($key, 1);
$data[$key] = trim (implode (" ",array_slice ($tmp, 1)));
$data[$key] = trim (implode (" ", array_slice ($tmp, 1)));
}
if (isset ($data["group"]))
$group = $data["group"];

View File

@@ -329,7 +329,7 @@ class dblayeroo
* );
* $primary = "id";
* $unique = array ("id", array ("zo ne", "vie wname"));
* $foreign = array ("zone"=>"table.field",...);
* $foreign = array ("zone"=>"table.field", ...);
*/
public function createTable ()
/* {{{ */
@@ -625,7 +625,7 @@ class dblayeroo
{
$sql .= ",\n UNIQUE (\"";
if (is_array ($u))
$sql .=implode ("\",\"", $u);
$sql .= implode ("\",\"", $u);
else
$sql .= $u;
$sql .="\")";
@@ -3224,7 +3224,7 @@ class dblayeroo
$sql = $this->createRequest ();
$this->debugLog ("Entering prepareRequest (XXX, ",false,")");
$st = $this->prepareRequest ($sql, false);
$this->debugLog ("'",$this->getDisplayQuery (),"'");
$this->debugLog ("'", $this->getDisplayQuery (), "'");
$startTime = microtime (true);
$st->execute ();
switch ($this->command)

View File

@@ -638,7 +638,7 @@ class file
$this->checkPathRW ($tmpdirname);
if ($recursive === false)
return @rmdir ($tmpdirname);
$files = array_diff (scandir ($tmpdirname), array('.','..'));
$files = array_diff (scandir ($tmpdirname), array(".", ".."));
foreach ($files as $file)
{
if (is_dir ("$tmpdirname/$file"))

View File

@@ -949,7 +949,7 @@ class Httpclient
}
elseif ($val !== null && $name === "")
{
// Only the first value will be stored as cookie (name,val) pair
// Only the first value will be stored as cookie (name, val) pair
// echo "KEY=$key => $val\n";
$name = $key;
$value = $val;

View File

@@ -140,7 +140,7 @@ class imap
throw new \Exception ("IMAP server not connected", 500);
if (! in_array ($folder, $this->foldersList ()))
throw new \Exception ("Folder not found", 404);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
$rc = @imap_reopen (self::$instance[$this->mailbox],
$this->mailbox.$folderUTF7);
if ($rc === true)
@@ -168,7 +168,7 @@ class imap
throw new \Exception ("IMAP server not connected", 500);
if ( in_array ($folder, $this->foldersList ()))
throw new \Exception ("Folder already exists", 406);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
return imap_createmailbox (self::$instance[$this->mailbox],
$this->mailbox.$folderUTF7);
}
@@ -182,7 +182,7 @@ class imap
throw new \Exception ("IMAP server not connected", 500);
if (! in_array ($folder, $this->foldersList ()))
throw new \Exception ("Folder not found", 404);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
return imap_deletemailbox (self::$instance[$this->mailbox],
$this->mailbox.$folderUTF7);
}
@@ -217,7 +217,7 @@ class imap
{
if ($this->mailbox === null)
throw new \Exception ("IMAP server not connected", 500);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
return imap_subscribe (self::$instance[$this->mailbox],
$this->mailbox.$folder);
}
@@ -230,7 +230,7 @@ class imap
{
if ($this->mailbox === null)
throw new \Exception ("IMAP server not connected", 500);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
return imap_unsubscribe (self::$instance[$this->mailbox],
$this->mailbox.$folder);
}
@@ -413,7 +413,7 @@ class imap
$this->changeFolder ($this->curDir);
if (is_array ($msgno))
$msgno = implode (",", $msgno);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
$rc = imap_mail_move (self::$instance[$this->mailbox], $msgno, $folderUTF7);
if ($rc !== TRUE)
{
@@ -436,7 +436,7 @@ class imap
$this->changeFolder ($this->curDir);
if (is_array ($msgno))
$msgno = implode (",", $msgno);
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8");
$rc = imap_mail_copy (self::$instance[$this->mailbox], $msgno, $folderUTF7);
if ($rc !== TRUE)
{
@@ -719,7 +719,7 @@ class imap
{
if ($this->mailbox === null)
throw new \Exception ("IMAP server not connected", 500);
$folderUTF7 = mb_convert_encoding ($this->curDir, "UTF7-IMAP","UTF-8");
$folderUTF7 = mb_convert_encoding ($this->curDir, "UTF7-IMAP", "UTF-8");
$rc = imap_append (self::$instance[$this->mailbox],
$this->mailbox.$folderUTF7,
$content);

View File

@@ -179,7 +179,7 @@ class ipaddresses
foreach ($ipArr as $key=>$val)
{
// echo "VAL=".var_export ($val, true).
// ", cleanLoop=".var_export ($cleanLoop,true);
// ", cleanLoop=".var_export ($cleanLoop, true);
if ($val !== "0")
{
// echo " => In NOT zero\n";
@@ -232,7 +232,7 @@ class ipaddresses
$this->validIPAddress ($ip) === false)
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
500);
if (strstr ($ip,"::"))
if (strstr ($ip, "::"))
{
$e = explode (":", $ip);
// Case where :: is in start

View File

@@ -45,7 +45,7 @@ class language
// Suppression des poids (l'ordre est donne dans la pile)
if ( ($pos = strpos ($value, ";")) !== FALSE)
{
$arrAccept[$key] = substr ($value,0,$pos);
$arrAccept[$key] = substr ($value, 0, $pos);
}
// Si la language proposee est du style en-us, convertit en en-US

View File

@@ -10,7 +10,7 @@ class markdown
public $debug = false;
/** The list of the HTML elements used by block */
private $blockid = array ("<h1>","<h2>","<h3>","<h4>","<h5>","<h6>",
private $blockid = array ("<h1>", "<h2>", "<h3>", "<h4>", "<h5>", "<h6>",
"<hr/>");
/** Convert the markdown text to html

View File

@@ -55,11 +55,9 @@ class outputhtml extends output
if (isset ($resView["title"]))
$title = $resView["title"];
if (! isset ($resView["content"]))
throw new \Exception (sprintf (
dgettext ("domframework",
"No data provided from view %s::%s"),
$viewClass,$viewMethod),
500);
throw new \Exception (sprintf ( dgettext ("domframework",
"No data provided from view %s::%s"), $viewClass, $viewMethod),
500);
}
}

View File

@@ -53,7 +53,7 @@ class outputxml extends output
else
{
$key = is_numeric($key) ? "item$key" : $key;
$xml->addChild("$key","$value");
$xml->addChild("$key", "$value");
}
}
}

View File

@@ -25,7 +25,7 @@ class route
/** Allow slashes in the url when matching the regex */
public $allowSlashes = true;
/** Provide the the class catch errors in routing.
* Must be provided in an array(class,method); */
* Must be provided in an array(class, method); */
public $errors = null;
/** Preroute used in modules */
public $preroute = "";
@@ -260,10 +260,9 @@ class route
// Allow to redirect from POST to GET, but not GET to GET (can loop)
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
$this->error (new \Exception ("Redirect to myself", 400));
if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL,"/"))
if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL, "/"))
$this->error (new \Exception (
"Can't redirect outside this site (Base $baseURL)",
405));
"Can't redirect outside this site (Base $baseURL)", 405));
if ($this->debug)
{

View File

@@ -59,7 +59,7 @@ class routeSQL
/** Chain multiple routeSQL. Wait for the foreign key */
public $chainedForeign = null;
/** Allow one or multiple links by entry in the list
The array must be of the form array ("linkname"=>,"icon"=>)
The array must be of the form array ("linkname"=>, "icon"=>)
icon is optional and the linkname is used if it is not provided */
public $internalLinks = array ();
/** The renderer class to use for HTML pages */
@@ -146,13 +146,13 @@ class routeSQL
switch ($flash[0])
{
case 4: $dataflash .= "alert-danger";
$alert = dgettext ("domframework","Error!");break;
$alert = dgettext ("domframework", "Error!");break;
case 3: $dataflash .= "alert-warning";
$alert = dgettext ("domframework","Warning!");break;
$alert = dgettext ("domframework", "Warning!");break;
case 2: $dataflash .= "alert-info";
$alert = dgettext ("domframework","Info:");break;
$alert = dgettext ("domframework", "Info:");break;
case 1: $dataflash .= "alert-success";
$alert = dgettext ("domframework","Success:");break;
$alert = dgettext ("domframework", "Success:");break;
}
$dataflash .= " alert-dismissable'>\n";
$dataflash .= "<strong>$alert</strong> ".$flash[1]."\n";
@@ -246,7 +246,7 @@ $content .= "</li>\n";
$route = new route ();
$content .= " <div class='actionExtern'>\n";
$content .= " <a href='".$route->baseURL().$this->url_prefix."/add'>"
.dgettext ("domframework","Add new entry")."</a>\n";
.dgettext ("domframework", "Add new entry")."</a>\n";
$content .= " </div>\n";
}
return $content;
@@ -266,7 +266,7 @@ $content .= "</li>\n";
$content .= " <form method='get' action='".$route->baseURL().
$this->url_prefix."'>\n";
$content .= " <select name='num' onchange='this.form.submit()' >\n";
$list = array (10,20,50,100,200,500,1000);
$list = array (10, 20, 50, 100, 200, 500, 1000);
foreach ($list as $element)
{
$content .= " <option ";
@@ -275,7 +275,7 @@ $content .= "</li>\n";
$content .= ">$element</option>\n";
}
$content .= " </select>\n";
$content .= " ".dgettext ("domframework","elements")."\n";
$content .= " ".dgettext ("domframework", "elements")."\n";
$content .= " </form>\n";
$content .= " </div>\n";
return $content;
@@ -294,7 +294,7 @@ $content .= "</li>\n";
$content .= " <div class='searchArea'>\n";
$content .= " <form method='get' action='".$route->baseURL().
$this->url_prefix."'>\n";
$content .= " ".dgettext ("domframework","Search:");
$content .= " ".dgettext ("domframework", "Search:");
$content .= " <input type='text' name='search' value='".
htmlentities ($search, ENT_QUOTES)."'/>\n";
$content .= " </form>\n";
@@ -372,8 +372,8 @@ $content .= "</li>\n";
if (!isset ($extension) || $extension === null || $extension === "")
$extension = reset ($this->extensionsAllowed);
if (!in_array ($extension, $this->extensionsAllowed))
throw new \Exception (dgettext ("domframework","Extension not allowed"),
403);
throw new \Exception (dgettext ("domframework",
"Extension not allowed"), 403);
$search = rawurldecode ($search);
$this->connect();
$titles = $this->objectDB->titles ();
@@ -424,9 +424,9 @@ $content .= "</li>\n";
{
if ($this->authREST["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedvalues are the information associated to the $chain
@@ -1017,7 +1017,7 @@ $content .= "</li>\n";
if ($this->readwriteAllowed && $this->displayActions)
$countTitles++;
$content .= " <tr><td colspan='$countTitles' class='noentry'>";
$content .= dgettext ("domframework","No entry available");
$content .= dgettext ("domframework", "No entry available");
$content .= "</td></tr>\n";
}
else
@@ -1110,7 +1110,7 @@ $content .= "</li>\n";
if ($this->authHTML["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
@@ -1173,9 +1173,9 @@ $content .= "</li>\n";
{
if ($this->authHTML["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
@@ -1387,8 +1387,8 @@ $content .= "</li>\n";
}
$field = new formfield ("submit", dgettext ("domframework",
"Save the data"));
$field->defaults = dgettext ("domframework","Save the data");
"Save the data"));
$field->defaults = dgettext ("domframework", "Save the data");
$field->type = "submit";
$fields[] = $field;
unset ($field);
@@ -1407,9 +1407,9 @@ $content .= "</li>\n";
{
if ($this->authHTML["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedvalues are the information associated to the $chain
@@ -1492,9 +1492,9 @@ $content .= "</li>\n";
{
if ($this->authHTML["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedvalues are the information associated to the $chain
@@ -1710,8 +1710,8 @@ $content .= "</li>\n";
if ($readonly === false && $this->readwriteAllowed === true)
{
$field = new formfield ("submit", dgettext ("domframework",
"Save the data"));
$field->defaults = dgettext ("domframework","Save the data");
"Save the data"));
$field->defaults = dgettext ("domframework", "Save the data");
$field->type = "submit";
$fields[] = $field;
unset ($field);
@@ -1732,9 +1732,9 @@ $content .= "</li>\n";
{
if ($this->authHTML["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedvalues are the information associated to the $chain
@@ -1781,7 +1781,7 @@ $content .= "</li>\n";
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
array ("error", dgettext ("domframework",
"Can not change the external key"));
"Can not change the external key"));
if ($this->chainedForeign !== null)
$values[$this->chainedForeign] = $chain;
$errors = $this->objectDB->verify ($values, $id);
@@ -1791,7 +1791,8 @@ $content .= "</li>\n";
{
$this->objectDB->update ($id, $values);
$renderer = new renderer ();
$renderer->flash ("SUCCESS", dgettext ("domframework","Update done"));
$renderer->flash ("SUCCESS", dgettext ("domframework",
"Update done"));
$route->redirect ("/".
str_replace ("{chain}", $chain, $this->url_prefix),
"");

View File

@@ -57,23 +57,23 @@ class userssql extends users
public function connect ()
{
if ($this->table === null)
throw new Exception (dgettext ("domframework","No SQL table defined"),
500);
throw new Exception (dgettext ("domframework", "No SQL table defined"),
500);
if ($this->fieldEmail === null)
throw new Exception (dgettext ("domframework",
"No fieldIdentifier defined"), 500);
"No fieldIdentifier defined"), 500);
if ($this->fieldPassword === null)
throw new Exception (dgettext ("domframework",
"No fieldPassword defined"), 500);
"No fieldPassword defined"), 500);
if ($this->fieldLastname === null)
throw new Exception (dgettext ("domframework",
"No fieldLastname defined"), 500);
"No fieldLastname defined"), 500);
if ($this->fieldFirstname === null)
throw new Exception (dgettext ("domframework",
"No fieldFirstname defined"), 500);
"No fieldFirstname defined"), 500);
if ($this->fieldLastchange === null)
throw new Exception (dgettext ("domframework",
"No fieldLastchange defined"), 500);
"No fieldLastchange defined"), 500);
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
$this->driver_options);
$this->db->table = $this->table;
@@ -178,7 +178,7 @@ class userssql extends users
$this->checkPassword ($newpassword);
if ($this->checkValidPassword ($email, $oldpassword) !== true)
throw new Exception (dgettext ("domframework",
"Bad old password provided"), 401);
"Bad old password provided"), 401);
$cryptedPassword = $this->cryptPasswd ($newpassword);
return $this->db->update ($email,
array ($this->fieldPassword=>$cryptedPassword,
@@ -201,7 +201,7 @@ class userssql extends users
array ($this->fieldPassword));
if (count ($data) === 0)
throw new Exception (dgettext ("domframework",
"No information found for this email"), 404);
"No information found for this email"), 404);
$cryptedPassword = $this->cryptPasswd ($newpassword);
return $this->db->update ($email,
array ($this->fieldPassword=>$cryptedPassword,
@@ -223,10 +223,10 @@ class userssql extends users
array ($this->fieldPassword));
if (count ($data) === 0)
throw new Exception (dgettext ("domframework",
"No information found for this email"), 404);
"No information found for this email"), 404);
if (! isset ($data[0][$this->fieldPassword]))
throw new Exception (dgettext ("domframework",
"No password available for this email"), 404);
"No password available for this email"), 404);
$cryptedPassword = $data[0][$this->fieldPassword];
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)
return false;