Rename all the datas to data

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2512 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-02-21 19:21:29 +00:00
parent 82f6f96c2e
commit c283362d05
15 changed files with 92 additions and 85 deletions

View File

@@ -150,7 +150,7 @@ class authentication
// Login OK : save in SESSION and go to main page // Login OK : save in SESSION and go to main page
trigger_error ("Logging in for '$authparams->email'", E_USER_NOTICE); trigger_error ("Logging in for '$authparams->email'", E_USER_NOTICE);
$session = new authsession (); $session = new authsession ();
$session-> savedatas ($authparams->email, $authparams->password, $session-> savedata ($authparams->email, $authparams->password,
$res["lastname"], $res["firstname"]); $res["lastname"], $res["firstname"]);
if ($url === "") if ($url === "")
$this->route->redirect ("/", ""); $this->route->redirect ("/", "");
@@ -212,7 +212,7 @@ class authentication
/** Do the real authentication process on all the providers defined in the /** Do the real authentication process on all the providers defined in the
properties of the class. properties of the class.
@return an array containing the user datas if the authentication is @return an array containing the user data if the authentication is
correct, correct,
an exception if noting is found */ an exception if noting is found */
private function verifAuth ($email, $password) private function verifAuth ($email, $password)

View File

@@ -22,7 +22,7 @@ class authldap extends auth
public $ldapfilter = "(mail=%s)"; public $ldapfilter = "(mail=%s)";
/** Field used to identify a user */ /** Field used to identify a user */
public $ldapfield = "mail"; public $ldapfield = "mail";
/** Filter used to find the available datas of an authenticated user */ /** Filter used to find the available data of an authenticated user */
public $ldapfiltersearch = "(objectClass=inetOrgPerson)"; public $ldapfiltersearch = "(objectClass=inetOrgPerson)";
/** The opened LDAP connection identifier */ /** The opened LDAP connection identifier */
@@ -83,13 +83,13 @@ class authldap extends auth
$this->ldapfiltersearch); $this->ldapfiltersearch);
if ($search === FALSE) if ($search === FALSE)
throw new Exception ("Can not found the details for user", 401); throw new Exception ("Can not found the details for user", 401);
$datas = ldap_get_entries ($this->ldapconn, $search); $data = ldap_get_entries ($this->ldapconn, $search);
$res = array (); $res = array ();
if (isset ($datas[0])) if (isset ($data[0]))
{ {
$res = array ("lastname"=>$datas[0]["sn"][0], $res = array ("lastname"=>$data[0]["sn"][0],
"firstname"=>$datas[0]["givenname"][0], "firstname"=>$data[0]["givenname"][0],
"email"=>$datas[0]["mail"][0]); "email"=>$data[0]["mail"][0]);
} }
return $res; return $res;
@@ -129,22 +129,22 @@ class authldap extends auth
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);
$datas = array (); $data = array ();
foreach ($info as $key=>$vals) foreach ($info as $key=>$vals)
{ {
if ($key === "count") continue; if ($key === "count") continue;
if (isset ($vals["sn"][0]) && isset ($vals["givenname"][0]) && if (isset ($vals["sn"][0]) && isset ($vals["givenname"][0]) &&
isset ($vals["mail"])) isset ($vals["mail"]))
{ {
$datas[$key] = array ("lastname"=>$vals["sn"][0], $data[$key] = array ("lastname"=>$vals["sn"][0],
"firstname"=>$vals["givenname"][0], "firstname"=>$vals["givenname"][0],
"email"=>$vals["mail"][0]); "email"=>$vals["mail"][0]);
} }
unset ($datas[$key]["mail"]["count"]); unset ($data[$key]["mail"]["count"]);
} }
return $datas; return $data;
} }
/** Close the LDAP connection when closing the object or PHP */ /** Close the LDAP connection when closing the object or PHP */

View File

@@ -69,8 +69,15 @@ class authsession extends auth
405); 405);
} }
/** Save the datas in session */ /** Save the data in session
@deprecated 0.23 */
public function savedatas ($email, $password, $lastname, $firstname) public function savedatas ($email, $password, $lastname, $firstname)
{
return $this->savedata ($email, $password, $lastname, $firstname);
}
/** Save the data in session */
public function savedata ($email, $password, $lastname, $firstname)
{ {
$_SESSION["domframework"]["auth"]["lastname"] = $lastname; $_SESSION["domframework"]["auth"]["lastname"] = $lastname;
$_SESSION["domframework"]["auth"]["firstname"] = $firstname; $_SESSION["domframework"]["auth"]["firstname"] = $firstname;

View File

@@ -314,7 +314,7 @@ class authzgroups
$this->dbObject->disconnect (); $this->dbObject->disconnect ();
} }
/** Create the tables in the database to store the datas */ /** Create the tables in the database to store the data */
public function createTables () public function createTables ()
{ {
if ($this->dbObject == null) if ($this->dbObject == null)
@@ -457,11 +457,11 @@ class authzgroups
return $this->dbObject->titles; return $this->dbObject->titles;
} }
/** Check if the provided datas are compilant with the object specification /** Check if the provided data are compilant with the object specification
@return array The errors found in the datas */ @return array The errors found in the data */
public function objectVerify ($datas, $idobject=false) public function objectVerify ($data, $idobject=false)
{ {
return $this->dbObject->verify ($datas, $idobject); return $this->dbObject->verify ($data, $idobject);
} }
//////////////// ////////////////
@@ -564,11 +564,11 @@ class authzgroups
return $this->dbGroup->titles; return $this->dbGroup->titles;
} }
/** Check if the provided datas are compilant with the group specification /** Check if the provided data are compilant with the group specification
@return array The errors found in the datas */ @return array The errors found in the data */
public function groupVerify ($datas, $idgroup=false) public function groupVerify ($data, $idgroup=false)
{ {
return $this->dbGroup->verify ($datas, $idgroup); return $this->dbGroup->verify ($data, $idgroup);
} }
////////////////////// //////////////////////
@@ -646,8 +646,8 @@ class authzgroups
public function groupmemberUpdateByID ($module, $idgroup, $iduser, $user, public function groupmemberUpdateByID ($module, $idgroup, $iduser, $user,
$comment="") $comment="")
{ {
$datas = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser); $data = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser);
if (count ($datas) === 0) if (count ($data) === 0)
throw new Exception (dgettext ("domframework", throw new Exception (dgettext ("domframework",
"IDUser in IDGroup not found"), 404); "IDUser in IDGroup not found"), 404);
$this->rightCache = null; $this->rightCache = null;
@@ -737,11 +737,11 @@ class authzgroups
return $this->dbGroupMember->titles; return $this->dbGroupMember->titles;
} }
/** Check if the provided datas are compilant with the group specification /** Check if the provided data are compilant with the group specification
@return array The errors found in the datas */ @return array The errors found in the data */
public function groupmembersVerify ($datas, $idgroupmember=false) public function groupmembersVerify ($data, $idgroupmember=false)
{ {
return $this->dbGroupMember->verify ($datas, $idgroupmember); return $this->dbGroupMember->verify ($data, $idgroupmember);
} }
//////////////// ////////////////
@@ -986,10 +986,10 @@ class authzgroups
return array ("1"=>"RO", "2"=>"RW"); return array ("1"=>"RO", "2"=>"RW");
} }
/** Check if the provided datas are compilant with the group specification /** Check if the provided data are compilant with the group specification
@return array The errors found in the datas */ @return array The errors found in the data */
public function rightVerify ($datas, $idright=false) public function rightVerify ($data, $idright=false)
{ {
return $this->dbRight->verify ($datas, $idright); return $this->dbRight->verify ($data, $idright);
} }
} }

View File

@@ -27,40 +27,40 @@ class cachefile
$res = false; $res = false;
if (file_exists ($fileCache)) if (file_exists ($fileCache))
{ {
$datas = file_get_contents ($fileCache); $data = file_get_contents ($fileCache);
$datas = unserialize ($datas); $data = unserialize ($data);
if (($datas["createTime"] + $datas["ttl"]) >= time ()) if (($data["createTime"] + $data["ttl"]) >= time ())
{ {
$res = $datas["data"]; $res = $data["data"];
} }
} }
if ($res === false) if ($res === false)
{ {
$datas = array ("ttl"=>24*60*60, $data = array ("ttl"=>24*60*60,
"createTime"=>time(), "createTime"=>time(),
"data"=>"CACHE-Garbage"); "data"=>"CACHE-Garbage");
file_put_contents ($fileCache, serialize ($datas)); file_put_contents ($fileCache, serialize ($data));
chmod ($fileCache, 0666); chmod ($fileCache, 0666);
$files = glob ($this->directory."/*", GLOB_NOSORT); $files = glob ($this->directory."/*", GLOB_NOSORT);
foreach ($files as $fileCache) foreach ($files as $fileCache)
{ {
$datas = file_get_contents ($fileCache); $data = file_get_contents ($fileCache);
if ($datas === false) if ($data === false)
{ {
unlink ($fileCache); unlink ($fileCache);
continue; continue;
} }
$datas = unserialize ($datas); $data = unserialize ($data);
if (! isset ($datas["ttl"]) || ! isset ($datas["data"]) || if (! isset ($data["ttl"]) || ! isset ($data["data"]) ||
! isset ($datas["createTime"])) ! isset ($data["createTime"]))
{ {
unlink ($fileCache); unlink ($fileCache);
continue; continue;
} }
if (($datas["createTime"] + $datas["ttl"]) <= time ()) if (($data["createTime"] + $data["ttl"]) <= time ())
{ {
unlink ($fileCache); unlink ($fileCache);
} }
@@ -129,10 +129,10 @@ class cachefile
$this->garbage (); $this->garbage ();
$fileCache = $this->directory."/".sha1 ($id); $fileCache = $this->directory."/".sha1 ($id);
touch ($fileCache.".lock"); touch ($fileCache.".lock");
$datas = array ("ttl"=>$ttl, $data = array ("ttl"=>$ttl,
"createTime"=>time(), "createTime"=>time(),
"data"=>$data); "data"=>$data);
file_put_contents ($fileCache, serialize ($datas)); file_put_contents ($fileCache, serialize ($data));
unlink ($fileCache.".lock"); unlink ($fileCache.".lock");
chmod ($fileCache, 0666); chmod ($fileCache, 0666);
return true; return true;
@@ -174,31 +174,31 @@ class cachefile
usleep (100000); usleep (100000);
} }
// The lock is pending 10s (stale) : removing it to read the datas quicker // The lock is pending 10s (stale) : removing it to read the data quicker
// next time // next time
if (file_exists ($fileCache.".lock")) if (file_exists ($fileCache.".lock"))
unlink ($fileCache.".lock"); unlink ($fileCache.".lock");
$datas = file_get_contents ($fileCache); $data = file_get_contents ($fileCache);
if ($datas === false) if ($data === false)
{ {
unlink ($fileCache); unlink ($fileCache);
return false; return false;
} }
$datas = unserialize ($datas); $data = unserialize ($data);
if (! isset ($datas["ttl"]) || ! isset ($datas["data"]) || if (! isset ($data["ttl"]) || ! isset ($data["data"]) ||
! isset ($datas["createTime"])) ! isset ($data["createTime"]))
{ {
unlink ($fileCache); unlink ($fileCache);
return false; return false;
} }
if (($datas["createTime"] + $datas["ttl"]) >= time ()) if (($data["createTime"] + $data["ttl"]) >= time ())
{ {
if (file_exists ($fileCache.".lock")) if (file_exists ($fileCache.".lock"))
unlink ($fileCache.".lock"); unlink ($fileCache.".lock");
return $datas["data"]; return $data["data"];
} }
return false; return false;

View File

@@ -49,20 +49,20 @@ class cacheoutput
ob_start (); ob_start ();
$this->saving = true; $this->saving = true;
// The datas are sent automatically // The data are sent automatically
} }
/** End of saving the datas in cache */ /** End of saving the data in cache */
public function __destruct () public function __destruct ()
{ {
// Force the path because it return to / in the destructor // Force the path because it return to / in the destructor
chdir ($this->cacheCWD); chdir ($this->cacheCWD);
if ($this->saving === true) if ($this->saving === true)
{ {
// Do the saving of the datas // Do the saving of the data
$datas = array ("content"=>ob_get_contents (), $data = array ("content"=>ob_get_contents (),
"headers"=>headers_list ()); "headers"=>headers_list ());
$this->cache->write ($this->id, $datas, $this->ttl); $this->cache->write ($this->id, $data, $this->ttl);
} }
} }
} }

View File

@@ -106,7 +106,7 @@ class dblayerauthzgroups extends dblayer
This hook is run before inserting a new data in the database, after the This hook is run before inserting a new data in the database, after the
verification verification
@param array the data to insert in the database @param array the data to insert in the database
@return the modified datas */ @return the modified data */
public function hookpreinsert ($data) public function hookpreinsert ($data)
{ {
if ($this->module === null) if ($this->module === null)
@@ -171,7 +171,7 @@ class dblayerauthzgroups extends dblayer
/** Hook preupdate /** Hook preupdate
This hook is run before updating a data in the database, after the This hook is run before updating a data in the database, after the
verification verification
@return the modified datas */ @return the modified data */
public function hookpreupdate ($updatekey, $data) public function hookpreupdate ($updatekey, $data)
{ {
if ($this->module === null) if ($this->module === null)

View File

@@ -3,10 +3,10 @@
@package domframework @package domframework
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
/** Class used to display datas */ /** Class used to display data */
class output class output
{ {
/** Class used to display datas /** Class used to display data
@param mixed $data The data to be displayed */ @param mixed $data The data to be displayed */
public function out ($data) public function out ($data)
{ {

View File

@@ -4,7 +4,7 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
require_once ("output.php"); require_once ("output.php");
/** Display in CSV the datas provided */ /** Display in CSV the data provided */
class outputcsv extends output class outputcsv extends output
{ {
/** Don't allow to output in CSV if the functions are not available in PHP */ /** Don't allow to output in CSV if the functions are not available in PHP */
@@ -14,7 +14,7 @@ class outputcsv extends output
throw new Exception ("CSV support not available in PHP !", 500); throw new Exception ("CSV support not available in PHP !", 500);
} }
/** Display in CSV the datas provided /** Display in CSV the data provided
@param mixed $data The data to be displayed */ @param mixed $data The data to be displayed */
public function out ($data) public function out ($data)
{ {

View File

@@ -4,7 +4,7 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
require_once ("output.php"); require_once ("output.php");
/** Display in HTML the datas provided, with the layout support */ /** Display in HTML the data provided, with the layout support */
class outputhtml extends output class outputhtml extends output
{ {
/** Data is printed by viewClass->viewmethod, in the middle of $layout /** Data is printed by viewClass->viewmethod, in the middle of $layout

View File

@@ -4,7 +4,7 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
require_once ("output.php"); require_once ("output.php");
/** Display in JSOn the datas provided */ /** Display in JSOn the data provided */
class outputjson extends output class outputjson extends output
{ {
/** Don't allow to output in JSON if the functions are not available in PHP */ /** Don't allow to output in JSON if the functions are not available in PHP */
@@ -15,7 +15,7 @@ class outputjson extends output
"install php5-json", 500); "install php5-json", 500);
} }
/** Display in JSOn the datas provided /** Display in JSOn the data provided
@param mixed $data The data to be displayed */ @param mixed $data The data to be displayed */
public function out ($data) public function out ($data)
{ {

View File

@@ -4,13 +4,13 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
require_once ("output.php"); require_once ("output.php");
/** Display in Text the datas provided */ /** Display in Text the data provided */
class outputtxt extends output class outputtxt extends output
{ {
/** Display an array on table format (TRUE) or tree format (FALSE) */ /** Display an array on table format (TRUE) or tree format (FALSE) */
public $table = TRUE; public $table = TRUE;
/** Display in Text the datas provided /** Display in Text the data provided
@param mixed $data The data to be displayed */ @param mixed $data The data to be displayed */
public function out ($data) public function out ($data)
{ {
@@ -100,7 +100,7 @@ class outputtxt extends output
echo " |\n"; echo " |\n";
echo "$border"; echo "$border";
// Display datas // Display data
foreach ($data as $line) foreach ($data as $line)
{ {
echo "| "; echo "| ";

View File

@@ -4,10 +4,10 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
require_once ("output.php"); require_once ("output.php");
/** Display in XML the datas provided */ /** Display in XML the data provided */
class outputxml extends output class outputxml extends output
{ {
/** Display in XML the datas provided /** Display in XML the data provided
@param mixed $data The data to be displayed */ @param mixed $data The data to be displayed */
public function out ($data) public function out ($data)
{ {

View File

@@ -3,7 +3,7 @@
@package domframework @package domframework
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
/** Display the datas in HTML with a FLASH method to display the errors */ /** Display the data in HTML with a FLASH method to display the errors */
class renderer class renderer
{ {
/** The result in construction */ /** The result in construction */

View File

@@ -10,7 +10,7 @@ require_once ("domframework/renderer.php");
error_reporting (E_ALL); error_reporting (E_ALL);
/** Automatic Routing for SQL database /** Automatic Routing for SQL database
Allow to do CRUD on datas with only one line in index.php */ Allow to do CRUD on data with only one line in index.php */
class routeSQL class routeSQL
{ {
/** Activate the debug */ /** Activate the debug */
@@ -1133,8 +1133,8 @@ $content .= "</li>\n";
} }
$field = new formfield ("submit", dgettext("domframework", $field = new formfield ("submit", dgettext("domframework",
"Save the datas")); "Save the data"));
$field->defaults = dgettext("domframework","Save the datas"); $field->defaults = dgettext("domframework","Save the data");
$field->type = "submit"; $field->type = "submit";
$fields[] = $field; $fields[] = $field;
unset ($field); unset ($field);
@@ -1145,7 +1145,7 @@ $content .= "</li>\n";
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route) $route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
{ {
// Add a new entry : effective save of the datas // Add a new entry : effective save of the data
if ($this->chained !== null) if ($this->chained !== null)
{ {
if ($this->chained->editright ($this->authHTML["email"], $chain) !== if ($this->chained->editright ($this->authHTML["email"], $chain) !==
@@ -1379,8 +1379,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 datas")); "Save the data"));
$field->defaults = dgettext("domframework","Save the datas"); $field->defaults = dgettext("domframework","Save the data");
$field->type = "submit"; $field->type = "submit";
$fields[] = $field; $fields[] = $field;
unset ($field); unset ($field);
@@ -1482,7 +1482,7 @@ $content .= "</li>\n";
}); });
} }
/** Authorization : Return TRUE if the user right allow to see the datas /** Authorization : Return TRUE if the user right allow to see the data
Return FALSE else */ Return FALSE else */
public function accessright ($auth, $id=null) public function accessright ($auth, $id=null)
{ {
@@ -1500,7 +1500,7 @@ $content .= "</li>\n";
return TRUE; return TRUE;
} }
/** Authorization : Return TRUE if the user right allow to edit the datas /** Authorization : Return TRUE if the user right allow to edit the data
Return FALSE else */ Return FALSE else */
public function editright ($auth, $id=null) public function editright ($auth, $id=null)
{ {
@@ -1534,7 +1534,7 @@ $content .= "</li>\n";
return FALSE; return FALSE;
} }
/** Return the datas of the row if the $id exists in the primary key of the /** Return the data of the row if the $id exists in the primary key of the
table table
Return FALSE in the other cases */ Return FALSE in the other cases */
public function keyexists ($id) public function keyexists ($id)