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:
@@ -53,16 +53,16 @@ class authentication
|
|||||||
public $jwtServerKey = null;
|
public $jwtServerKey = null;
|
||||||
|
|
||||||
/** The authentication servers configuration
|
/** The authentication servers configuration
|
||||||
* array ("authXXXX"=>array (
|
* array ("authXXXX" => array (
|
||||||
* array ("ldapserver"=>"ldaps://annuaire.grenoble.cnrs.fr",
|
* array ("ldapserver" => "ldaps://server.domain.fr",
|
||||||
* "ldapport"=>636,
|
* "ldapport" => 636,
|
||||||
* "ldaptimeout"=>5,
|
* "ldaptimeout" => 5,
|
||||||
* "ldapauth"=>"uid=annuaire,ou=people,dc=grenoble,dc=cnrs,dc=fr",
|
* "ldapauth" => "uid=XXX,dc=domain,dc=fr",
|
||||||
* "ldappwd"=>";authANNUAIRE2013",
|
* "ldappwd" => "XXX",
|
||||||
* "ldapbase"=>"",
|
* "ldapbase" => "",
|
||||||
* "ldapfilter"=>"(mail=%s)",
|
* "ldapfilter" => "(mail=%s)",
|
||||||
* "ldapfield"=>"mail",
|
* "ldapfield" => "mail",
|
||||||
* "ldapfiltersearch"=>"(objectClass=inetOrgPerson)"
|
* "ldapfiltersearch" => "(objectClass=inetOrgPerson)"
|
||||||
* ),
|
* ),
|
||||||
* ),
|
* ),
|
||||||
* );
|
* );
|
||||||
|
|||||||
@@ -126,9 +126,9 @@ class authldap extends auth
|
|||||||
{
|
{
|
||||||
if ($this->ldapconn === NULL)
|
if ($this->ldapconn === NULL)
|
||||||
throw new \Exception ("No established LDAP connection", 500);
|
throw new \Exception ("No established LDAP connection", 500);
|
||||||
$search = ldap_search ($this->ldapconn,$this->ldapbase,
|
$search = ldap_search ($this->ldapconn, $this->ldapbase,
|
||||||
$this->ldapfiltersearch,
|
$this->ldapfiltersearch,
|
||||||
array ("mail","sn","givenname"));
|
array ("mail", "sn", "givenname"));
|
||||||
if ($search === FALSE)
|
if ($search === FALSE)
|
||||||
throw new \Exception ("Unable to search the users in LDAP", 500);
|
throw new \Exception ("Unable to search the users in LDAP", 500);
|
||||||
$info = ldap_get_entries ($this->ldapconn, $search);
|
$info = ldap_get_entries ($this->ldapconn, $search);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class authorizationdb extends authorization
|
|||||||
$groupid = intval ($search["groupid"]);
|
$groupid = intval ($search["groupid"]);
|
||||||
$modbits = octdec ($search["modbits"]);
|
$modbits = octdec ($search["modbits"]);
|
||||||
if ($this->authiduser === 0)
|
if ($this->authiduser === 0)
|
||||||
return array ("READ","WRITE","EXECUTE");
|
return array ("READ", "WRITE", "EXECUTE");
|
||||||
|
|
||||||
$res = array ();
|
$res = array ();
|
||||||
if ($this->authiduser === $ownerid)
|
if ($this->authiduser === $ownerid)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class authparams
|
|||||||
* If non is found, return "anonymous", "anonymous"
|
* If non is found, return "anonymous", "anonymous"
|
||||||
* @param array|null $authprocesses The authentication process to use
|
* @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")
|
if (php_sapi_name () === "cli")
|
||||||
{
|
{
|
||||||
|
|||||||
20
authsql.php
20
authsql.php
@@ -49,7 +49,7 @@ class authsql extends auth
|
|||||||
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
|
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
|
||||||
$this->driver_options);
|
$this->driver_options);
|
||||||
if ($this->table === null)
|
if ($this->table === null)
|
||||||
throw new Exception (dgettext ("domframework","No SQL table defined"),
|
throw new Exception (dgettext ("domframework", "No SQL table defined"),
|
||||||
500);
|
500);
|
||||||
if ($this->fieldIdentifier === null)
|
if ($this->fieldIdentifier === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
@@ -68,7 +68,7 @@ class authsql extends auth
|
|||||||
$this->fieldsInfo);
|
$this->fieldsInfo);
|
||||||
$fields = array_flip ($fields);
|
$fields = array_flip ($fields);
|
||||||
foreach ($fields as $key=>$val)
|
foreach ($fields as $key=>$val)
|
||||||
$fields[$key] = array ("varchar","255");
|
$fields[$key] = array ("varchar", "255");
|
||||||
$this->db->table = $this->table;
|
$this->db->table = $this->table;
|
||||||
$this->db->fields = $fields;
|
$this->db->fields = $fields;
|
||||||
$this->db->primary = $this->fieldIdentifier;
|
$this->db->primary = $this->fieldIdentifier;
|
||||||
@@ -139,11 +139,11 @@ class authsql extends auth
|
|||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Bad old password provided"), 401);
|
"Bad old password provided"), 401);
|
||||||
$cost = 11;
|
$cost = 11;
|
||||||
$salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22);
|
$salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22);
|
||||||
$salt=str_replace("+",".",$salt);
|
$salt = str_replace ("+", ".", $salt);
|
||||||
$param='$'.implode('$',array(
|
$param = '$'.implode('$', array(
|
||||||
"2y", //select the most secure version of blowfish (>=PHP 5.3.7)
|
"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
|
$salt //add the salt
|
||||||
));
|
));
|
||||||
//now do the actual hashing
|
//now do the actual hashing
|
||||||
@@ -173,11 +173,11 @@ class authsql extends auth
|
|||||||
"Unable to find the user : '%s'"),
|
"Unable to find the user : '%s'"),
|
||||||
$email), 401);
|
$email), 401);
|
||||||
$cost = 11;
|
$cost = 11;
|
||||||
$salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22);
|
$salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22);
|
||||||
$salt=str_replace("+",".",$salt);
|
$salt = str_replace ("+", ".", $salt);
|
||||||
$param='$'.implode('$',array(
|
$param = '$'. implode ('$', array (
|
||||||
"2y", //select the most secure version of blowfish (>=PHP 5.3.7)
|
"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
|
$salt //add the salt
|
||||||
));
|
));
|
||||||
//now do the actual hashing
|
//now do the actual hashing
|
||||||
|
|||||||
112
authzgroups.php
112
authzgroups.php
@@ -169,8 +169,8 @@ class authzgroups
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, "$object");
|
$rc = $this->allow ($module, $user, "$object");
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessRight ('$module','$user','$object')".
|
trigger_error ("authzgroups : accessRight ('$module', '$user', ".
|
||||||
"=$rc", E_USER_NOTICE);
|
"'$object')=$rc", E_USER_NOTICE);
|
||||||
if ($rc !== "NO")
|
if ($rc !== "NO")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if ($user === "anonymous")
|
if ($user === "anonymous")
|
||||||
@@ -204,8 +204,8 @@ class authzgroups
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, $object);
|
$rc = $this->allow ($module, $user, $object);
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessWrite ('$module','$user','$object')".
|
trigger_error ("authzgroups : accessWrite ('$module', '$user', ".
|
||||||
"=$rc", E_USER_NOTICE);
|
"'$object')=$rc", E_USER_NOTICE);
|
||||||
if ($rc === "RW")
|
if ($rc === "RW")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if ($user === "anonymous")
|
if ($user === "anonymous")
|
||||||
@@ -241,7 +241,7 @@ class authzgroups
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, $object);
|
$rc = $this->allow ($module, $user, $object);
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessReadOnly ('$module','$user',".
|
trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ".
|
||||||
"'$object')" ."=$rc", E_USER_NOTICE);
|
"'$object')" ."=$rc", E_USER_NOTICE);
|
||||||
if ($rc === "RO")
|
if ($rc === "RO")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -270,40 +270,34 @@ class authzgroups
|
|||||||
$this->dbObject->table = "authzobject";
|
$this->dbObject->table = "authzobject";
|
||||||
$this->dbObject->prefix = $this->tableprefix;
|
$this->dbObject->prefix = $this->tableprefix;
|
||||||
$this->dbObject->fields = array (
|
$this->dbObject->fields = array (
|
||||||
"idobject"=>array ("integer", "not null", "autoincrement"),
|
"idobject" => array ("integer", "not null", "autoincrement"),
|
||||||
"module"=> array ("varchar", "255", "not null"),
|
"module" => array ("varchar", "255", "not null"),
|
||||||
"object"=> array ("varchar", "255", "not null"),
|
"object" => array ("varchar", "255", "not null"),
|
||||||
"comment"=> array ("varchar", "255"));
|
"comment" => array ("varchar", "255"));
|
||||||
$this->dbObject->primary = "idobject";
|
$this->dbObject->primary = "idobject";
|
||||||
$this->dbObject->unique = array ("idobject", array ("object", "module"));
|
$this->dbObject->unique = array ("idobject", array ("object", "module"));
|
||||||
$this->dbObject->titles = array ("idobject"=>dgettext ("domframework",
|
$this->dbObject->titles = array (
|
||||||
"idobject"),
|
"idobject" => dgettext ("domframework", "idobject"),
|
||||||
"module"=>dgettext ("domframework",
|
"module" => dgettext ("domframework", "Module"),
|
||||||
"Module"),
|
"object" => dgettext ("domframework", "Object"),
|
||||||
"object"=>dgettext ("domframework",
|
"comment" => dgettext ("domframework", "Comment"));
|
||||||
"Object"),
|
|
||||||
"comment"=>dgettext ("domframework",
|
|
||||||
"Comment"));
|
|
||||||
|
|
||||||
$this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
|
$this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
|
||||||
$this->dbGroup->debug = $this->debug;
|
$this->dbGroup->debug = $this->debug;
|
||||||
$this->dbGroup->table = "authzgroup";
|
$this->dbGroup->table = "authzgroup";
|
||||||
$this->dbGroup->prefix = $this->tableprefix;
|
$this->dbGroup->prefix = $this->tableprefix;
|
||||||
$this->dbGroup->fields = array (
|
$this->dbGroup->fields = array (
|
||||||
"idgroup"=>array ("integer", "not null", "autoincrement"),
|
"idgroup" => array ("integer", "not null", "autoincrement"),
|
||||||
"module"=> array ("varchar", "255", "not null"),
|
"module" => array ("varchar", "255", "not null"),
|
||||||
"group"=> array ("varchar", "255", "not null"),
|
"group" => array ("varchar", "255", "not null"),
|
||||||
"comment"=>array ("varchar", "255"));
|
"comment" => array ("varchar", "255"));
|
||||||
$this->dbGroup->primary = "idgroup";
|
$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",
|
$this->dbGroup->titles = array (
|
||||||
"idgroup"),
|
"idgroup" => dgettext ("domframework", "idgroup"),
|
||||||
"module"=>dgettext ("domframework",
|
"module" => dgettext ("domframework", "Module"),
|
||||||
"Module"),
|
"group" => dgettext ("domframework", "Group"),
|
||||||
"group"=>dgettext ("domframework",
|
"comment" => dgettext ("domframework", "Comment"));
|
||||||
"Group"),
|
|
||||||
"comment"=>dgettext ("domframework",
|
|
||||||
"Comment"));
|
|
||||||
|
|
||||||
$this->dbGroupMember = new dblayer ($dsn, $username, $password,
|
$this->dbGroupMember = new dblayer ($dsn, $username, $password,
|
||||||
$driver_options);
|
$driver_options);
|
||||||
@@ -311,15 +305,15 @@ class authzgroups
|
|||||||
$this->dbGroupMember->table = "authzgroupmember";
|
$this->dbGroupMember->table = "authzgroupmember";
|
||||||
$this->dbGroupMember->prefix = $this->tableprefix;
|
$this->dbGroupMember->prefix = $this->tableprefix;
|
||||||
$this->dbGroupMember->fields = array (
|
$this->dbGroupMember->fields = array (
|
||||||
"idgroupmember"=>array ("integer", "not null", "autoincrement"),
|
"idgroupmember" => array ("integer", "not null", "autoincrement"),
|
||||||
"user"=> array ("varchar", "255", "not null"),
|
"user" => array ("varchar", "255", "not null"),
|
||||||
"idgroup"=> array ("integer", "not null"),
|
"idgroup" => array ("integer", "not null"),
|
||||||
"comment"=> array ("varchar", "255"));
|
"comment" => array ("varchar", "255"));
|
||||||
$this->dbGroupMember->primary = "idgroupmember";
|
$this->dbGroupMember->primary = "idgroupmember";
|
||||||
$this->dbGroupMember->unique = array ("idgroupmember",
|
$this->dbGroupMember->unique = array ("idgroupmember",
|
||||||
array ("user","idgroup"));
|
array ("user", "idgroup"));
|
||||||
$this->dbGroupMember->foreign = array (
|
$this->dbGroupMember->foreign = array (
|
||||||
"idgroup"=>array ("authzgroup", "idgroup",
|
"idgroup" => array ("authzgroup", "idgroup",
|
||||||
"ON UPDATE CASCADE ON DELETE CASCADE"));
|
"ON UPDATE CASCADE ON DELETE CASCADE"));
|
||||||
$this->dbGroupMember->titles = array (
|
$this->dbGroupMember->titles = array (
|
||||||
"idgroupmember"=> dgettext ("domframework", "idgroupmember"),
|
"idgroupmember"=> dgettext ("domframework", "idgroupmember"),
|
||||||
@@ -335,22 +329,22 @@ class authzgroups
|
|||||||
"idright"=> array ("integer", "not null", "autoincrement"),
|
"idright"=> array ("integer", "not null", "autoincrement"),
|
||||||
"idgroup"=> array ("integer", "not null"),
|
"idgroup"=> array ("integer", "not null"),
|
||||||
"idobject"=>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"));
|
"comment"=> array ("varchar", "255"));
|
||||||
$this->dbRight->primary = "idright";
|
$this->dbRight->primary = "idright";
|
||||||
$this->dbRight->unique = array ("idright", array ("idgroup","idobject"));
|
$this->dbRight->unique = array ("idright", array ("idgroup", "idobject"));
|
||||||
$this->dbRight->foreign = array (
|
$this->dbRight->foreign = array (
|
||||||
"idgroup"=> array ("authzgroup", "idgroup",
|
"idgroup" => array ("authzgroup", "idgroup",
|
||||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||||
"idobject"=>array ("authzobject", "idobject",
|
"idobject" => array ("authzobject", "idobject",
|
||||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||||
);
|
);
|
||||||
$this->dbRight->titles = array (
|
$this->dbRight->titles = array (
|
||||||
"idright"=>dgettext ("domframework", "idright"),
|
"idright" => dgettext ("domframework", "idright"),
|
||||||
"idgroup"=>dgettext ("domframework", "idgroup"),
|
"idgroup" => dgettext ("domframework", "idgroup"),
|
||||||
"idobject"=>dgettext ("domframework", "idobject"),
|
"idobject" => dgettext ("domframework", "idobject"),
|
||||||
"right"=>dgettext ("domframework", "Right"),
|
"right" => dgettext ("domframework", "Right"),
|
||||||
"comment"=>dgettext ("domframework", "Comment"));
|
"comment" => dgettext ("domframework", "Comment"));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +499,8 @@ class authzgroups
|
|||||||
$select[] = array ("module", $module);
|
$select[] = array ("module", $module);
|
||||||
if ($object !== null)
|
if ($object !== null)
|
||||||
$select[] = array ("object", $object);
|
$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
|
/** Return an array with all the available objects in the module, or only
|
||||||
@@ -517,7 +512,7 @@ class authzgroups
|
|||||||
{
|
{
|
||||||
if ($this->dbObject == null)
|
if ($this->dbObject == null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"DB for Object is not connected"), 500);
|
"DB for Object is not connected"), 500);
|
||||||
$select[] = array ("module", $module);
|
$select[] = array ("module", $module);
|
||||||
if ($idobject !== null)
|
if ($idobject !== null)
|
||||||
$select[] = array ("idobject", $idobject);
|
$select[] = array ("idobject", $idobject);
|
||||||
@@ -725,11 +720,11 @@ class authzgroups
|
|||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Wanted group not found"), 404);
|
"Wanted group not found"), 404);
|
||||||
$groupsMembers = $this->dbGroupMember->read (array (
|
$groupsMembers = $this->dbGroupMember->read (array (
|
||||||
array ("user",$user),
|
array ("user", $user),
|
||||||
array ("idgroup",$groups[0]["idgroup"])));
|
array ("idgroup", $groups[0]["idgroup"])));
|
||||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Wanted GroupMember not found"), 404);
|
"Wanted GroupMember not found"), 404);
|
||||||
$this->rightCache = null;
|
$this->rightCache = null;
|
||||||
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
|
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
|
||||||
}
|
}
|
||||||
@@ -743,15 +738,14 @@ class authzgroups
|
|||||||
{
|
{
|
||||||
if ($this->dbGroupMember == null)
|
if ($this->dbGroupMember == null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"DB for GroupMember is not connected"),
|
"DB for GroupMember is not connected"), 500);
|
||||||
500);
|
|
||||||
$groups = $this->groupReadByID ($module, $idgroup);
|
$groups = $this->groupReadByID ($module, $idgroup);
|
||||||
if (! isset ($groups[0]["idgroup"]))
|
if (! isset ($groups[0]["idgroup"]))
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Wanted group not found"), 404);
|
"Wanted group not found"), 404);
|
||||||
$groupsMembers = $this->dbGroupMember->read (array (
|
$groupsMembers = $this->dbGroupMember->read (array (
|
||||||
array ("idgroupmember",$idgroupmember),
|
array ("idgroupmember", $idgroupmember),
|
||||||
array ("idgroup",$idgroup)));
|
array ("idgroup", $idgroup)));
|
||||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Wanted GroupMember not found"), 404);
|
"Wanted GroupMember not found"), 404);
|
||||||
@@ -1118,8 +1112,8 @@ class authzgroups
|
|||||||
if (! isset ($objects[0]["idobject"]))
|
if (! isset ($objects[0]["idobject"]))
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Wanted object not found"), 404);
|
"Wanted object not found"), 404);
|
||||||
$select[] = array ("idgroup",$groups[0]["idgroup"]);
|
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||||
$select[] = array ("idobject",$objects[0]["idobject"]);
|
$select[] = array ("idobject", $objects[0]["idobject"]);
|
||||||
return $this->dbRight->read ($select);
|
return $this->dbRight->read ($select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,8 +191,8 @@ class authzgroupsoo
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, "$object");
|
$rc = $this->allow ($module, $user, "$object");
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessRight ('$module','$user','$object')".
|
trigger_error ("authzgroups : accessRight ('$module', '$user', ".
|
||||||
"=$rc", E_USER_NOTICE);
|
"'$object')=$rc", E_USER_NOTICE);
|
||||||
if ($rc !== "NO")
|
if ($rc !== "NO")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if ($user === "anonymous")
|
if ($user === "anonymous")
|
||||||
@@ -226,8 +226,8 @@ class authzgroupsoo
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, $object);
|
$rc = $this->allow ($module, $user, $object);
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessWrite ('$module','$user','$object')".
|
trigger_error ("authzgroups : accessWrite ('$module', '$user', ".
|
||||||
"=$rc", E_USER_NOTICE);
|
"'$object')=$rc", E_USER_NOTICE);
|
||||||
if ($rc === "RW")
|
if ($rc === "RW")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if ($user === "anonymous")
|
if ($user === "anonymous")
|
||||||
@@ -263,7 +263,7 @@ class authzgroupsoo
|
|||||||
$object = "/$object";
|
$object = "/$object";
|
||||||
$rc = $this->allow ($module, $user, $object);
|
$rc = $this->allow ($module, $user, $object);
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
trigger_error ("authzgroups : accessReadOnly ('$module','$user',".
|
trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ".
|
||||||
"'$object')" ."=$rc", E_USER_NOTICE);
|
"'$object')" ."=$rc", E_USER_NOTICE);
|
||||||
if ($rc === "RO")
|
if ($rc === "RO")
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -316,7 +316,7 @@ class authzgroupsoo
|
|||||||
"group" => array ("varchar(255)", "not null"),
|
"group" => array ("varchar(255)", "not null"),
|
||||||
"comment" => array ("varchar(255)")));
|
"comment" => array ("varchar(255)")));
|
||||||
$this->dbGroup->primary ("idgroup");
|
$this->dbGroup->primary ("idgroup");
|
||||||
$this->dbGroup->unique (array ("idgroup", array ("module","group")));
|
$this->dbGroup->unique (array ("idgroup", array ("module", "group")));
|
||||||
$this->dbGroup->titles (array (
|
$this->dbGroup->titles (array (
|
||||||
"idgroup" => dgettext ("domframework", "idgroup"),
|
"idgroup" => dgettext ("domframework", "idgroup"),
|
||||||
"module" => dgettext ("domframework", "Module"),
|
"module" => dgettext ("domframework", "Module"),
|
||||||
@@ -335,7 +335,7 @@ class authzgroupsoo
|
|||||||
"comment" => array ("varchar(255)")));
|
"comment" => array ("varchar(255)")));
|
||||||
$this->dbGroupMember->primary ("idgroupmember");
|
$this->dbGroupMember->primary ("idgroupmember");
|
||||||
$this->dbGroupMember->unique (array ("idgroupmember",
|
$this->dbGroupMember->unique (array ("idgroupmember",
|
||||||
array ("user","idgroup")));
|
array ("user", "idgroup")));
|
||||||
$this->dbGroupMember->foreign (array (
|
$this->dbGroupMember->foreign (array (
|
||||||
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
|
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
|
||||||
"ON UPDATE CASCADE ON DELETE CASCADE")));
|
"ON UPDATE CASCADE ON DELETE CASCADE")));
|
||||||
@@ -355,10 +355,10 @@ class authzgroupsoo
|
|||||||
"idright" => array ("integer", "not null", "autoincrement"),
|
"idright" => array ("integer", "not null", "autoincrement"),
|
||||||
"idgroup" => array ("integer", "not null"),
|
"idgroup" => array ("integer", "not null"),
|
||||||
"idobject" => 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)")));
|
"comment" => array ("varchar(255)")));
|
||||||
$this->dbRight->primary ("idright");
|
$this->dbRight->primary ("idright");
|
||||||
$this->dbRight->unique (array ("idright", array ("idgroup","idobject")));
|
$this->dbRight->unique (array ("idright", array ("idgroup", "idobject")));
|
||||||
$this->dbRight->foreign (array (
|
$this->dbRight->foreign (array (
|
||||||
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
|
"idgroup" => array ($this->tableprefix."authzgroup", "idgroup",
|
||||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||||
@@ -584,7 +584,7 @@ class authzgroupsoo
|
|||||||
$this->dbObject->whereAdd ("object", "=", $object);
|
$this->dbObject->whereAdd ("object", "=", $object);
|
||||||
return $this->dbObject->select ()
|
return $this->dbObject->select ()
|
||||||
->whereAdd ("module", "=", $module)
|
->whereAdd ("module", "=", $module)
|
||||||
->orderAdd ("object","ASC")
|
->orderAdd ("object", "ASC")
|
||||||
->execute ();
|
->execute ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ class config
|
|||||||
$foundDefault = $text;
|
$foundDefault = $text;
|
||||||
if ($id === T_DOC_COMMENT)
|
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";
|
if ($debug) echo "DOC_COMMENT : $text\n";
|
||||||
// Append the not completed lines
|
// Append the not completed lines
|
||||||
$text = trim (substr ($text, 3, -2));
|
$text = trim (substr ($text, 3, -2));
|
||||||
@@ -467,7 +467,7 @@ class config
|
|||||||
$tmp = explode (" ", $line);
|
$tmp = explode (" ", $line);
|
||||||
$key = reset ($tmp);
|
$key = reset ($tmp);
|
||||||
$key = substr ($key, 1);
|
$key = substr ($key, 1);
|
||||||
$data[$key] = trim (implode (" ",array_slice ($tmp, 1)));
|
$data[$key] = trim (implode (" ", array_slice ($tmp, 1)));
|
||||||
}
|
}
|
||||||
if (isset ($data["group"]))
|
if (isset ($data["group"]))
|
||||||
$group = $data["group"];
|
$group = $data["group"];
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ class dblayeroo
|
|||||||
* );
|
* );
|
||||||
* $primary = "id";
|
* $primary = "id";
|
||||||
* $unique = array ("id", array ("zo ne", "vie wname"));
|
* $unique = array ("id", array ("zo ne", "vie wname"));
|
||||||
* $foreign = array ("zone"=>"table.field",...);
|
* $foreign = array ("zone"=>"table.field", ...);
|
||||||
*/
|
*/
|
||||||
public function createTable ()
|
public function createTable ()
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
@@ -625,7 +625,7 @@ class dblayeroo
|
|||||||
{
|
{
|
||||||
$sql .= ",\n UNIQUE (\"";
|
$sql .= ",\n UNIQUE (\"";
|
||||||
if (is_array ($u))
|
if (is_array ($u))
|
||||||
$sql .=implode ("\",\"", $u);
|
$sql .= implode ("\",\"", $u);
|
||||||
else
|
else
|
||||||
$sql .= $u;
|
$sql .= $u;
|
||||||
$sql .="\")";
|
$sql .="\")";
|
||||||
@@ -3224,7 +3224,7 @@ class dblayeroo
|
|||||||
$sql = $this->createRequest ();
|
$sql = $this->createRequest ();
|
||||||
$this->debugLog ("Entering prepareRequest (XXX, ",false,")");
|
$this->debugLog ("Entering prepareRequest (XXX, ",false,")");
|
||||||
$st = $this->prepareRequest ($sql, false);
|
$st = $this->prepareRequest ($sql, false);
|
||||||
$this->debugLog ("'",$this->getDisplayQuery (),"'");
|
$this->debugLog ("'", $this->getDisplayQuery (), "'");
|
||||||
$startTime = microtime (true);
|
$startTime = microtime (true);
|
||||||
$st->execute ();
|
$st->execute ();
|
||||||
switch ($this->command)
|
switch ($this->command)
|
||||||
|
|||||||
2
file.php
2
file.php
@@ -638,7 +638,7 @@ class file
|
|||||||
$this->checkPathRW ($tmpdirname);
|
$this->checkPathRW ($tmpdirname);
|
||||||
if ($recursive === false)
|
if ($recursive === false)
|
||||||
return @rmdir ($tmpdirname);
|
return @rmdir ($tmpdirname);
|
||||||
$files = array_diff (scandir ($tmpdirname), array('.','..'));
|
$files = array_diff (scandir ($tmpdirname), array(".", ".."));
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if (is_dir ("$tmpdirname/$file"))
|
if (is_dir ("$tmpdirname/$file"))
|
||||||
|
|||||||
@@ -949,7 +949,7 @@ class Httpclient
|
|||||||
}
|
}
|
||||||
elseif ($val !== null && $name === "")
|
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";
|
// echo "KEY=$key => $val\n";
|
||||||
$name = $key;
|
$name = $key;
|
||||||
$value = $val;
|
$value = $val;
|
||||||
|
|||||||
16
imap.php
16
imap.php
@@ -140,7 +140,7 @@ class imap
|
|||||||
throw new \Exception ("IMAP server not connected", 500);
|
throw new \Exception ("IMAP server not connected", 500);
|
||||||
if (! in_array ($folder, $this->foldersList ()))
|
if (! in_array ($folder, $this->foldersList ()))
|
||||||
throw new \Exception ("Folder not found", 404);
|
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],
|
$rc = @imap_reopen (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folderUTF7);
|
$this->mailbox.$folderUTF7);
|
||||||
if ($rc === true)
|
if ($rc === true)
|
||||||
@@ -168,7 +168,7 @@ class imap
|
|||||||
throw new \Exception ("IMAP server not connected", 500);
|
throw new \Exception ("IMAP server not connected", 500);
|
||||||
if ( in_array ($folder, $this->foldersList ()))
|
if ( in_array ($folder, $this->foldersList ()))
|
||||||
throw new \Exception ("Folder already exists", 406);
|
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],
|
return imap_createmailbox (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folderUTF7);
|
$this->mailbox.$folderUTF7);
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ class imap
|
|||||||
throw new \Exception ("IMAP server not connected", 500);
|
throw new \Exception ("IMAP server not connected", 500);
|
||||||
if (! in_array ($folder, $this->foldersList ()))
|
if (! in_array ($folder, $this->foldersList ()))
|
||||||
throw new \Exception ("Folder not found", 404);
|
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],
|
return imap_deletemailbox (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folderUTF7);
|
$this->mailbox.$folderUTF7);
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ class imap
|
|||||||
{
|
{
|
||||||
if ($this->mailbox === null)
|
if ($this->mailbox === null)
|
||||||
throw new \Exception ("IMAP server not connected", 500);
|
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],
|
return imap_subscribe (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folder);
|
$this->mailbox.$folder);
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ class imap
|
|||||||
{
|
{
|
||||||
if ($this->mailbox === null)
|
if ($this->mailbox === null)
|
||||||
throw new \Exception ("IMAP server not connected", 500);
|
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],
|
return imap_unsubscribe (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folder);
|
$this->mailbox.$folder);
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ class imap
|
|||||||
$this->changeFolder ($this->curDir);
|
$this->changeFolder ($this->curDir);
|
||||||
if (is_array ($msgno))
|
if (is_array ($msgno))
|
||||||
$msgno = implode (",", $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);
|
$rc = imap_mail_move (self::$instance[$this->mailbox], $msgno, $folderUTF7);
|
||||||
if ($rc !== TRUE)
|
if ($rc !== TRUE)
|
||||||
{
|
{
|
||||||
@@ -436,7 +436,7 @@ class imap
|
|||||||
$this->changeFolder ($this->curDir);
|
$this->changeFolder ($this->curDir);
|
||||||
if (is_array ($msgno))
|
if (is_array ($msgno))
|
||||||
$msgno = implode (",", $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);
|
$rc = imap_mail_copy (self::$instance[$this->mailbox], $msgno, $folderUTF7);
|
||||||
if ($rc !== TRUE)
|
if ($rc !== TRUE)
|
||||||
{
|
{
|
||||||
@@ -719,7 +719,7 @@ class imap
|
|||||||
{
|
{
|
||||||
if ($this->mailbox === null)
|
if ($this->mailbox === null)
|
||||||
throw new \Exception ("IMAP server not connected", 500);
|
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],
|
$rc = imap_append (self::$instance[$this->mailbox],
|
||||||
$this->mailbox.$folderUTF7,
|
$this->mailbox.$folderUTF7,
|
||||||
$content);
|
$content);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class ipaddresses
|
|||||||
foreach ($ipArr as $key=>$val)
|
foreach ($ipArr as $key=>$val)
|
||||||
{
|
{
|
||||||
// echo "VAL=".var_export ($val, true).
|
// echo "VAL=".var_export ($val, true).
|
||||||
// ", cleanLoop=".var_export ($cleanLoop,true);
|
// ", cleanLoop=".var_export ($cleanLoop, true);
|
||||||
if ($val !== "0")
|
if ($val !== "0")
|
||||||
{
|
{
|
||||||
// echo " => In NOT zero\n";
|
// echo " => In NOT zero\n";
|
||||||
@@ -232,7 +232,7 @@ class ipaddresses
|
|||||||
$this->validIPAddress ($ip) === false)
|
$this->validIPAddress ($ip) === false)
|
||||||
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
|
||||||
500);
|
500);
|
||||||
if (strstr ($ip,"::"))
|
if (strstr ($ip, "::"))
|
||||||
{
|
{
|
||||||
$e = explode (":", $ip);
|
$e = explode (":", $ip);
|
||||||
// Case where :: is in start
|
// Case where :: is in start
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class language
|
|||||||
// Suppression des poids (l'ordre est donne dans la pile)
|
// Suppression des poids (l'ordre est donne dans la pile)
|
||||||
if ( ($pos = strpos ($value, ";")) !== FALSE)
|
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
|
// Si la language proposee est du style en-us, convertit en en-US
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class markdown
|
|||||||
public $debug = false;
|
public $debug = false;
|
||||||
|
|
||||||
/** The list of the HTML elements used by block */
|
/** 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/>");
|
"<hr/>");
|
||||||
|
|
||||||
/** Convert the markdown text to html
|
/** Convert the markdown text to html
|
||||||
|
|||||||
@@ -55,11 +55,9 @@ class outputhtml extends output
|
|||||||
if (isset ($resView["title"]))
|
if (isset ($resView["title"]))
|
||||||
$title = $resView["title"];
|
$title = $resView["title"];
|
||||||
if (! isset ($resView["content"]))
|
if (! isset ($resView["content"]))
|
||||||
throw new \Exception (sprintf (
|
throw new \Exception (sprintf ( dgettext ("domframework",
|
||||||
dgettext ("domframework",
|
"No data provided from view %s::%s"), $viewClass, $viewMethod),
|
||||||
"No data provided from view %s::%s"),
|
500);
|
||||||
$viewClass,$viewMethod),
|
|
||||||
500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class outputxml extends output
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$key = is_numeric($key) ? "item$key" : $key;
|
$key = is_numeric($key) ? "item$key" : $key;
|
||||||
$xml->addChild("$key","$value");
|
$xml->addChild("$key", "$value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class route
|
|||||||
/** Allow slashes in the url when matching the regex */
|
/** Allow slashes in the url when matching the regex */
|
||||||
public $allowSlashes = true;
|
public $allowSlashes = true;
|
||||||
/** Provide the the class catch errors in routing.
|
/** 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;
|
public $errors = null;
|
||||||
/** Preroute used in modules */
|
/** Preroute used in modules */
|
||||||
public $preroute = "";
|
public $preroute = "";
|
||||||
@@ -260,10 +260,9 @@ class route
|
|||||||
// Allow to redirect from POST to GET, but not GET to GET (can loop)
|
// Allow to redirect from POST to GET, but not GET to GET (can loop)
|
||||||
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
|
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
|
||||||
$this->error (new \Exception ("Redirect to myself", 400));
|
$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 (
|
$this->error (new \Exception (
|
||||||
"Can't redirect outside this site (Base $baseURL)",
|
"Can't redirect outside this site (Base $baseURL)", 405));
|
||||||
405));
|
|
||||||
|
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
{
|
{
|
||||||
|
|||||||
69
routeSQL.php
69
routeSQL.php
@@ -59,7 +59,7 @@ class routeSQL
|
|||||||
/** Chain multiple routeSQL. Wait for the foreign key */
|
/** Chain multiple routeSQL. Wait for the foreign key */
|
||||||
public $chainedForeign = null;
|
public $chainedForeign = null;
|
||||||
/** Allow one or multiple links by entry in the list
|
/** 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 */
|
icon is optional and the linkname is used if it is not provided */
|
||||||
public $internalLinks = array ();
|
public $internalLinks = array ();
|
||||||
/** The renderer class to use for HTML pages */
|
/** The renderer class to use for HTML pages */
|
||||||
@@ -146,13 +146,13 @@ class routeSQL
|
|||||||
switch ($flash[0])
|
switch ($flash[0])
|
||||||
{
|
{
|
||||||
case 4: $dataflash .= "alert-danger";
|
case 4: $dataflash .= "alert-danger";
|
||||||
$alert = dgettext ("domframework","Error!");break;
|
$alert = dgettext ("domframework", "Error!");break;
|
||||||
case 3: $dataflash .= "alert-warning";
|
case 3: $dataflash .= "alert-warning";
|
||||||
$alert = dgettext ("domframework","Warning!");break;
|
$alert = dgettext ("domframework", "Warning!");break;
|
||||||
case 2: $dataflash .= "alert-info";
|
case 2: $dataflash .= "alert-info";
|
||||||
$alert = dgettext ("domframework","Info:");break;
|
$alert = dgettext ("domframework", "Info:");break;
|
||||||
case 1: $dataflash .= "alert-success";
|
case 1: $dataflash .= "alert-success";
|
||||||
$alert = dgettext ("domframework","Success:");break;
|
$alert = dgettext ("domframework", "Success:");break;
|
||||||
}
|
}
|
||||||
$dataflash .= " alert-dismissable'>\n";
|
$dataflash .= " alert-dismissable'>\n";
|
||||||
$dataflash .= "<strong>$alert</strong> ".$flash[1]."\n";
|
$dataflash .= "<strong>$alert</strong> ".$flash[1]."\n";
|
||||||
@@ -246,7 +246,7 @@ $content .= "</li>\n";
|
|||||||
$route = new route ();
|
$route = new route ();
|
||||||
$content .= " <div class='actionExtern'>\n";
|
$content .= " <div class='actionExtern'>\n";
|
||||||
$content .= " <a href='".$route->baseURL().$this->url_prefix."/add'>"
|
$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";
|
$content .= " </div>\n";
|
||||||
}
|
}
|
||||||
return $content;
|
return $content;
|
||||||
@@ -266,7 +266,7 @@ $content .= "</li>\n";
|
|||||||
$content .= " <form method='get' action='".$route->baseURL().
|
$content .= " <form method='get' action='".$route->baseURL().
|
||||||
$this->url_prefix."'>\n";
|
$this->url_prefix."'>\n";
|
||||||
$content .= " <select name='num' onchange='this.form.submit()' >\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)
|
foreach ($list as $element)
|
||||||
{
|
{
|
||||||
$content .= " <option ";
|
$content .= " <option ";
|
||||||
@@ -275,7 +275,7 @@ $content .= "</li>\n";
|
|||||||
$content .= ">$element</option>\n";
|
$content .= ">$element</option>\n";
|
||||||
}
|
}
|
||||||
$content .= " </select>\n";
|
$content .= " </select>\n";
|
||||||
$content .= " ".dgettext ("domframework","elements")."\n";
|
$content .= " ".dgettext ("domframework", "elements")."\n";
|
||||||
$content .= " </form>\n";
|
$content .= " </form>\n";
|
||||||
$content .= " </div>\n";
|
$content .= " </div>\n";
|
||||||
return $content;
|
return $content;
|
||||||
@@ -294,7 +294,7 @@ $content .= "</li>\n";
|
|||||||
$content .= " <div class='searchArea'>\n";
|
$content .= " <div class='searchArea'>\n";
|
||||||
$content .= " <form method='get' action='".$route->baseURL().
|
$content .= " <form method='get' action='".$route->baseURL().
|
||||||
$this->url_prefix."'>\n";
|
$this->url_prefix."'>\n";
|
||||||
$content .= " ".dgettext ("domframework","Search:");
|
$content .= " ".dgettext ("domframework", "Search:");
|
||||||
$content .= " <input type='text' name='search' value='".
|
$content .= " <input type='text' name='search' value='".
|
||||||
htmlentities ($search, ENT_QUOTES)."'/>\n";
|
htmlentities ($search, ENT_QUOTES)."'/>\n";
|
||||||
$content .= " </form>\n";
|
$content .= " </form>\n";
|
||||||
@@ -372,8 +372,8 @@ $content .= "</li>\n";
|
|||||||
if (!isset ($extension) || $extension === null || $extension === "")
|
if (!isset ($extension) || $extension === null || $extension === "")
|
||||||
$extension = reset ($this->extensionsAllowed);
|
$extension = reset ($this->extensionsAllowed);
|
||||||
if (!in_array ($extension, $this->extensionsAllowed))
|
if (!in_array ($extension, $this->extensionsAllowed))
|
||||||
throw new \Exception (dgettext ("domframework","Extension not allowed"),
|
throw new \Exception (dgettext ("domframework",
|
||||||
403);
|
"Extension not allowed"), 403);
|
||||||
$search = rawurldecode ($search);
|
$search = rawurldecode ($search);
|
||||||
$this->connect();
|
$this->connect();
|
||||||
$titles = $this->objectDB->titles ();
|
$titles = $this->objectDB->titles ();
|
||||||
@@ -424,9 +424,9 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
if ($this->authREST["email"] === "anonymous")
|
if ($this->authREST["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
// $chainedvalues are the information associated to the $chain
|
// $chainedvalues are the information associated to the $chain
|
||||||
@@ -1017,7 +1017,7 @@ $content .= "</li>\n";
|
|||||||
if ($this->readwriteAllowed && $this->displayActions)
|
if ($this->readwriteAllowed && $this->displayActions)
|
||||||
$countTitles++;
|
$countTitles++;
|
||||||
$content .= " <tr><td colspan='$countTitles' class='noentry'>";
|
$content .= " <tr><td colspan='$countTitles' class='noentry'>";
|
||||||
$content .= dgettext ("domframework","No entry available");
|
$content .= dgettext ("domframework", "No entry available");
|
||||||
$content .= "</td></tr>\n";
|
$content .= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1110,7 +1110,7 @@ $content .= "</li>\n";
|
|||||||
if ($this->authHTML["email"] === "anonymous")
|
if ($this->authHTML["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
@@ -1173,9 +1173,9 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
if ($this->authHTML["email"] === "anonymous")
|
if ($this->authHTML["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
// $chainedValues are the information associated to the $chain
|
// $chainedValues are the information associated to the $chain
|
||||||
@@ -1387,8 +1387,8 @@ $content .= "</li>\n";
|
|||||||
}
|
}
|
||||||
|
|
||||||
$field = new formfield ("submit", dgettext ("domframework",
|
$field = new formfield ("submit", dgettext ("domframework",
|
||||||
"Save the data"));
|
"Save the data"));
|
||||||
$field->defaults = dgettext ("domframework","Save the data");
|
$field->defaults = dgettext ("domframework", "Save the data");
|
||||||
$field->type = "submit";
|
$field->type = "submit";
|
||||||
$fields[] = $field;
|
$fields[] = $field;
|
||||||
unset ($field);
|
unset ($field);
|
||||||
@@ -1407,9 +1407,9 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
if ($this->authHTML["email"] === "anonymous")
|
if ($this->authHTML["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
// $chainedvalues are the information associated to the $chain
|
// $chainedvalues are the information associated to the $chain
|
||||||
@@ -1492,9 +1492,9 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
if ($this->authHTML["email"] === "anonymous")
|
if ($this->authHTML["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
// $chainedvalues are the information associated to the $chain
|
// $chainedvalues are the information associated to the $chain
|
||||||
@@ -1710,8 +1710,8 @@ $content .= "</li>\n";
|
|||||||
if ($readonly === false && $this->readwriteAllowed === true)
|
if ($readonly === false && $this->readwriteAllowed === true)
|
||||||
{
|
{
|
||||||
$field = new formfield ("submit", dgettext ("domframework",
|
$field = new formfield ("submit", dgettext ("domframework",
|
||||||
"Save the data"));
|
"Save the data"));
|
||||||
$field->defaults = dgettext ("domframework","Save the data");
|
$field->defaults = dgettext ("domframework", "Save the data");
|
||||||
$field->type = "submit";
|
$field->type = "submit";
|
||||||
$fields[] = $field;
|
$fields[] = $field;
|
||||||
unset ($field);
|
unset ($field);
|
||||||
@@ -1732,9 +1732,9 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
if ($this->authHTML["email"] === "anonymous")
|
if ($this->authHTML["email"] === "anonymous")
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Anonymous not allowed"), 401);
|
"Anonymous not allowed"), 401);
|
||||||
throw new \Exception (dgettext ("domframework","Access forbidden"),
|
throw new \Exception (dgettext ("domframework", "Access forbidden"),
|
||||||
403);
|
403);
|
||||||
}
|
}
|
||||||
$this->chained->connect();
|
$this->chained->connect();
|
||||||
// $chainedvalues are the information associated to the $chain
|
// $chainedvalues are the information associated to the $chain
|
||||||
@@ -1781,7 +1781,7 @@ $content .= "</li>\n";
|
|||||||
$values[$this->chainedForeign] !== $chain)
|
$values[$this->chainedForeign] !== $chain)
|
||||||
$errorsChain[$this->chainedForeign] =
|
$errorsChain[$this->chainedForeign] =
|
||||||
array ("error", dgettext ("domframework",
|
array ("error", dgettext ("domframework",
|
||||||
"Can not change the external key"));
|
"Can not change the external key"));
|
||||||
if ($this->chainedForeign !== null)
|
if ($this->chainedForeign !== null)
|
||||||
$values[$this->chainedForeign] = $chain;
|
$values[$this->chainedForeign] = $chain;
|
||||||
$errors = $this->objectDB->verify ($values, $id);
|
$errors = $this->objectDB->verify ($values, $id);
|
||||||
@@ -1791,7 +1791,8 @@ $content .= "</li>\n";
|
|||||||
{
|
{
|
||||||
$this->objectDB->update ($id, $values);
|
$this->objectDB->update ($id, $values);
|
||||||
$renderer = new renderer ();
|
$renderer = new renderer ();
|
||||||
$renderer->flash ("SUCCESS", dgettext ("domframework","Update done"));
|
$renderer->flash ("SUCCESS", dgettext ("domframework",
|
||||||
|
"Update done"));
|
||||||
$route->redirect ("/".
|
$route->redirect ("/".
|
||||||
str_replace ("{chain}", $chain, $this->url_prefix),
|
str_replace ("{chain}", $chain, $this->url_prefix),
|
||||||
"");
|
"");
|
||||||
|
|||||||
22
userssql.php
22
userssql.php
@@ -57,23 +57,23 @@ class userssql extends users
|
|||||||
public function connect ()
|
public function connect ()
|
||||||
{
|
{
|
||||||
if ($this->table === null)
|
if ($this->table === null)
|
||||||
throw new Exception (dgettext ("domframework","No SQL table defined"),
|
throw new Exception (dgettext ("domframework", "No SQL table defined"),
|
||||||
500);
|
500);
|
||||||
if ($this->fieldEmail === null)
|
if ($this->fieldEmail === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No fieldIdentifier defined"), 500);
|
"No fieldIdentifier defined"), 500);
|
||||||
if ($this->fieldPassword === null)
|
if ($this->fieldPassword === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No fieldPassword defined"), 500);
|
"No fieldPassword defined"), 500);
|
||||||
if ($this->fieldLastname === null)
|
if ($this->fieldLastname === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No fieldLastname defined"), 500);
|
"No fieldLastname defined"), 500);
|
||||||
if ($this->fieldFirstname === null)
|
if ($this->fieldFirstname === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No fieldFirstname defined"), 500);
|
"No fieldFirstname defined"), 500);
|
||||||
if ($this->fieldLastchange === null)
|
if ($this->fieldLastchange === null)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No fieldLastchange defined"), 500);
|
"No fieldLastchange defined"), 500);
|
||||||
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
|
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
|
||||||
$this->driver_options);
|
$this->driver_options);
|
||||||
$this->db->table = $this->table;
|
$this->db->table = $this->table;
|
||||||
@@ -178,7 +178,7 @@ class userssql extends users
|
|||||||
$this->checkPassword ($newpassword);
|
$this->checkPassword ($newpassword);
|
||||||
if ($this->checkValidPassword ($email, $oldpassword) !== true)
|
if ($this->checkValidPassword ($email, $oldpassword) !== true)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"Bad old password provided"), 401);
|
"Bad old password provided"), 401);
|
||||||
$cryptedPassword = $this->cryptPasswd ($newpassword);
|
$cryptedPassword = $this->cryptPasswd ($newpassword);
|
||||||
return $this->db->update ($email,
|
return $this->db->update ($email,
|
||||||
array ($this->fieldPassword=>$cryptedPassword,
|
array ($this->fieldPassword=>$cryptedPassword,
|
||||||
@@ -201,7 +201,7 @@ class userssql extends users
|
|||||||
array ($this->fieldPassword));
|
array ($this->fieldPassword));
|
||||||
if (count ($data) === 0)
|
if (count ($data) === 0)
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No information found for this email"), 404);
|
"No information found for this email"), 404);
|
||||||
$cryptedPassword = $this->cryptPasswd ($newpassword);
|
$cryptedPassword = $this->cryptPasswd ($newpassword);
|
||||||
return $this->db->update ($email,
|
return $this->db->update ($email,
|
||||||
array ($this->fieldPassword=>$cryptedPassword,
|
array ($this->fieldPassword=>$cryptedPassword,
|
||||||
@@ -223,10 +223,10 @@ class userssql extends users
|
|||||||
array ($this->fieldPassword));
|
array ($this->fieldPassword));
|
||||||
if (count ($data) === 0)
|
if (count ($data) === 0)
|
||||||
throw new Exception (dgettext ("domframework",
|
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]))
|
if (! isset ($data[0][$this->fieldPassword]))
|
||||||
throw new Exception (dgettext ("domframework",
|
throw new Exception (dgettext ("domframework",
|
||||||
"No password available for this email"), 404);
|
"No password available for this email"), 404);
|
||||||
$cryptedPassword = $data[0][$this->fieldPassword];
|
$cryptedPassword = $data[0][$this->fieldPassword];
|
||||||
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)
|
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user