From c283362d05840b9e7aeba16c015bd8d0fbb0f91f Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Sun, 21 Feb 2016 19:21:29 +0000 Subject: [PATCH] Rename all the datas to data git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2512 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authentication.php | 4 ++-- authldap.php | 20 +++++++++--------- authsession.php | 9 +++++++- authzgroups.php | 38 ++++++++++++++++----------------- cachefile.php | 48 +++++++++++++++++++++--------------------- cacheoutput.php | 10 ++++----- dblayerauthzgroups.php | 4 ++-- output.php | 4 ++-- outputcsv.php | 4 ++-- outputhtml.php | 2 +- outputjson.php | 4 ++-- outputtxt.php | 6 +++--- outputxml.php | 4 ++-- renderer.php | 2 +- routeSQL.php | 18 ++++++++-------- 15 files changed, 92 insertions(+), 85 deletions(-) diff --git a/authentication.php b/authentication.php index 8172cba..d3df444 100644 --- a/authentication.php +++ b/authentication.php @@ -150,7 +150,7 @@ class authentication // Login OK : save in SESSION and go to main page trigger_error ("Logging in for '$authparams->email'", E_USER_NOTICE); $session = new authsession (); - $session-> savedatas ($authparams->email, $authparams->password, + $session-> savedata ($authparams->email, $authparams->password, $res["lastname"], $res["firstname"]); if ($url === "") $this->route->redirect ("/", ""); @@ -212,7 +212,7 @@ class authentication /** Do the real authentication process on all the providers defined in the 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, an exception if noting is found */ private function verifAuth ($email, $password) diff --git a/authldap.php b/authldap.php index dbcbf6f..36eb9bd 100644 --- a/authldap.php +++ b/authldap.php @@ -22,7 +22,7 @@ class authldap extends auth public $ldapfilter = "(mail=%s)"; /** Field used to identify a user */ 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)"; /** The opened LDAP connection identifier */ @@ -83,13 +83,13 @@ class authldap extends auth $this->ldapfiltersearch); if ($search === FALSE) 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 (); - if (isset ($datas[0])) + if (isset ($data[0])) { - $res = array ("lastname"=>$datas[0]["sn"][0], - "firstname"=>$datas[0]["givenname"][0], - "email"=>$datas[0]["mail"][0]); + $res = array ("lastname"=>$data[0]["sn"][0], + "firstname"=>$data[0]["givenname"][0], + "email"=>$data[0]["mail"][0]); } return $res; @@ -129,22 +129,22 @@ class authldap extends auth if ($search === FALSE) throw new Exception ("Unable to search the users in LDAP", 500); $info = ldap_get_entries ($this->ldapconn, $search); - $datas = array (); + $data = array (); foreach ($info as $key=>$vals) { if ($key === "count") continue; if (isset ($vals["sn"][0]) && isset ($vals["givenname"][0]) && isset ($vals["mail"])) { - $datas[$key] = array ("lastname"=>$vals["sn"][0], + $data[$key] = array ("lastname"=>$vals["sn"][0], "firstname"=>$vals["givenname"][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 */ diff --git a/authsession.php b/authsession.php index b17c440..4faef56 100644 --- a/authsession.php +++ b/authsession.php @@ -69,8 +69,15 @@ class authsession extends auth 405); } - /** Save the datas in session */ + /** Save the data in session + @deprecated 0.23 */ 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"]["firstname"] = $firstname; diff --git a/authzgroups.php b/authzgroups.php index fa061be..6452e61 100644 --- a/authzgroups.php +++ b/authzgroups.php @@ -314,7 +314,7 @@ class authzgroups $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 () { if ($this->dbObject == null) @@ -457,11 +457,11 @@ class authzgroups return $this->dbObject->titles; } - /** Check if the provided datas are compilant with the object specification - @return array The errors found in the datas */ - public function objectVerify ($datas, $idobject=false) + /** Check if the provided data are compilant with the object specification + @return array The errors found in the data */ + 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; } - /** Check if the provided datas are compilant with the group specification - @return array The errors found in the datas */ - public function groupVerify ($datas, $idgroup=false) + /** Check if the provided data are compilant with the group specification + @return array The errors found in the data */ + 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, $comment="") { - $datas = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser); - if (count ($datas) === 0) + $data = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser); + if (count ($data) === 0) throw new Exception (dgettext ("domframework", "IDUser in IDGroup not found"), 404); $this->rightCache = null; @@ -737,11 +737,11 @@ class authzgroups return $this->dbGroupMember->titles; } - /** Check if the provided datas are compilant with the group specification - @return array The errors found in the datas */ - public function groupmembersVerify ($datas, $idgroupmember=false) + /** Check if the provided data are compilant with the group specification + @return array The errors found in the data */ + 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"); } - /** Check if the provided datas are compilant with the group specification - @return array The errors found in the datas */ - public function rightVerify ($datas, $idright=false) + /** Check if the provided data are compilant with the group specification + @return array The errors found in the data */ + public function rightVerify ($data, $idright=false) { - return $this->dbRight->verify ($datas, $idright); + return $this->dbRight->verify ($data, $idright); } } diff --git a/cachefile.php b/cachefile.php index 9b81b5a..26cea79 100644 --- a/cachefile.php +++ b/cachefile.php @@ -27,40 +27,40 @@ class cachefile $res = false; if (file_exists ($fileCache)) { - $datas = file_get_contents ($fileCache); - $datas = unserialize ($datas); - if (($datas["createTime"] + $datas["ttl"]) >= time ()) + $data = file_get_contents ($fileCache); + $data = unserialize ($data); + if (($data["createTime"] + $data["ttl"]) >= time ()) { - $res = $datas["data"]; + $res = $data["data"]; } } if ($res === false) { - $datas = array ("ttl"=>24*60*60, - "createTime"=>time(), - "data"=>"CACHE-Garbage"); - file_put_contents ($fileCache, serialize ($datas)); + $data = array ("ttl"=>24*60*60, + "createTime"=>time(), + "data"=>"CACHE-Garbage"); + file_put_contents ($fileCache, serialize ($data)); chmod ($fileCache, 0666); $files = glob ($this->directory."/*", GLOB_NOSORT); foreach ($files as $fileCache) { - $datas = file_get_contents ($fileCache); - if ($datas === false) + $data = file_get_contents ($fileCache); + if ($data === false) { unlink ($fileCache); continue; } - $datas = unserialize ($datas); - if (! isset ($datas["ttl"]) || ! isset ($datas["data"]) || - ! isset ($datas["createTime"])) + $data = unserialize ($data); + if (! isset ($data["ttl"]) || ! isset ($data["data"]) || + ! isset ($data["createTime"])) { unlink ($fileCache); continue; } - if (($datas["createTime"] + $datas["ttl"]) <= time ()) + if (($data["createTime"] + $data["ttl"]) <= time ()) { unlink ($fileCache); } @@ -129,10 +129,10 @@ class cachefile $this->garbage (); $fileCache = $this->directory."/".sha1 ($id); touch ($fileCache.".lock"); - $datas = array ("ttl"=>$ttl, + $data = array ("ttl"=>$ttl, "createTime"=>time(), "data"=>$data); - file_put_contents ($fileCache, serialize ($datas)); + file_put_contents ($fileCache, serialize ($data)); unlink ($fileCache.".lock"); chmod ($fileCache, 0666); return true; @@ -174,31 +174,31 @@ class cachefile 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 if (file_exists ($fileCache.".lock")) unlink ($fileCache.".lock"); - $datas = file_get_contents ($fileCache); - if ($datas === false) + $data = file_get_contents ($fileCache); + if ($data === false) { unlink ($fileCache); return false; } - $datas = unserialize ($datas); - if (! isset ($datas["ttl"]) || ! isset ($datas["data"]) || - ! isset ($datas["createTime"])) + $data = unserialize ($data); + if (! isset ($data["ttl"]) || ! isset ($data["data"]) || + ! isset ($data["createTime"])) { unlink ($fileCache); return false; } - if (($datas["createTime"] + $datas["ttl"]) >= time ()) + if (($data["createTime"] + $data["ttl"]) >= time ()) { if (file_exists ($fileCache.".lock")) unlink ($fileCache.".lock"); - return $datas["data"]; + return $data["data"]; } return false; diff --git a/cacheoutput.php b/cacheoutput.php index f5e3aee..04b64f3 100644 --- a/cacheoutput.php +++ b/cacheoutput.php @@ -49,20 +49,20 @@ class cacheoutput ob_start (); $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 () { // Force the path because it return to / in the destructor chdir ($this->cacheCWD); if ($this->saving === true) { - // Do the saving of the datas - $datas = array ("content"=>ob_get_contents (), + // Do the saving of the data + $data = array ("content"=>ob_get_contents (), "headers"=>headers_list ()); - $this->cache->write ($this->id, $datas, $this->ttl); + $this->cache->write ($this->id, $data, $this->ttl); } } } diff --git a/dblayerauthzgroups.php b/dblayerauthzgroups.php index d686d89..7cc7b0b 100644 --- a/dblayerauthzgroups.php +++ b/dblayerauthzgroups.php @@ -106,7 +106,7 @@ class dblayerauthzgroups extends dblayer This hook is run before inserting a new data in the database, after the verification @param array the data to insert in the database - @return the modified datas */ + @return the modified data */ public function hookpreinsert ($data) { if ($this->module === null) @@ -171,7 +171,7 @@ class dblayerauthzgroups extends dblayer /** Hook preupdate This hook is run before updating a data in the database, after the verification - @return the modified datas */ + @return the modified data */ public function hookpreupdate ($updatekey, $data) { if ($this->module === null) diff --git a/output.php b/output.php index e5c0eb6..ee7f25e 100644 --- a/output.php +++ b/output.php @@ -3,10 +3,10 @@ @package domframework @author Dominique Fournier */ -/** Class used to display datas */ +/** Class used to display data */ class output { - /** Class used to display datas + /** Class used to display data @param mixed $data The data to be displayed */ public function out ($data) { diff --git a/outputcsv.php b/outputcsv.php index 80c8059..f376ff4 100644 --- a/outputcsv.php +++ b/outputcsv.php @@ -4,7 +4,7 @@ @author Dominique Fournier */ require_once ("output.php"); -/** Display in CSV the datas provided */ +/** Display in CSV the data provided */ class outputcsv extends output { /** 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); } - /** Display in CSV the datas provided + /** Display in CSV the data provided @param mixed $data The data to be displayed */ public function out ($data) { diff --git a/outputhtml.php b/outputhtml.php index 0f58bc3..20a51ee 100644 --- a/outputhtml.php +++ b/outputhtml.php @@ -4,7 +4,7 @@ @author Dominique Fournier */ 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 { /** Data is printed by viewClass->viewmethod, in the middle of $layout diff --git a/outputjson.php b/outputjson.php index c0c768a..6b629f7 100644 --- a/outputjson.php +++ b/outputjson.php @@ -4,7 +4,7 @@ @author Dominique Fournier */ require_once ("output.php"); -/** Display in JSOn the datas provided */ +/** Display in JSOn the data provided */ class outputjson extends output { /** 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); } - /** Display in JSOn the datas provided + /** Display in JSOn the data provided @param mixed $data The data to be displayed */ public function out ($data) { diff --git a/outputtxt.php b/outputtxt.php index 866e132..fbd0392 100644 --- a/outputtxt.php +++ b/outputtxt.php @@ -4,13 +4,13 @@ @author Dominique Fournier */ require_once ("output.php"); -/** Display in Text the datas provided */ +/** Display in Text the data provided */ class outputtxt extends output { /** Display an array on table format (TRUE) or tree format (FALSE) */ public $table = TRUE; - /** Display in Text the datas provided + /** Display in Text the data provided @param mixed $data The data to be displayed */ public function out ($data) { @@ -100,7 +100,7 @@ class outputtxt extends output echo " |\n"; echo "$border"; - // Display datas + // Display data foreach ($data as $line) { echo "| "; diff --git a/outputxml.php b/outputxml.php index cd57d70..d5d8691 100644 --- a/outputxml.php +++ b/outputxml.php @@ -4,10 +4,10 @@ @author Dominique Fournier */ require_once ("output.php"); -/** Display in XML the datas provided */ +/** Display in XML the data provided */ class outputxml extends output { - /** Display in XML the datas provided + /** Display in XML the data provided @param mixed $data The data to be displayed */ public function out ($data) { diff --git a/renderer.php b/renderer.php index be42848..03ec7da 100644 --- a/renderer.php +++ b/renderer.php @@ -3,7 +3,7 @@ @package domframework @author Dominique Fournier */ -/** 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 { /** The result in construction */ diff --git a/routeSQL.php b/routeSQL.php index 6ed514a..8d20f74 100644 --- a/routeSQL.php +++ b/routeSQL.php @@ -10,7 +10,7 @@ require_once ("domframework/renderer.php"); error_reporting (E_ALL); /** 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 { /** Activate the debug */ @@ -1133,8 +1133,8 @@ $content .= "\n"; } $field = new formfield ("submit", dgettext("domframework", - "Save the datas")); - $field->defaults = dgettext("domframework","Save the datas"); + "Save the data")); + $field->defaults = dgettext("domframework","Save the data"); $field->type = "submit"; $fields[] = $field; unset ($field); @@ -1145,7 +1145,7 @@ $content .= "\n"; $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->editright ($this->authHTML["email"], $chain) !== @@ -1379,8 +1379,8 @@ $content .= "\n"; if ($readonly === false && $this->readwriteAllowed === true) { $field = new formfield ("submit", dgettext("domframework", - "Save the datas")); - $field->defaults = dgettext("domframework","Save the datas"); + "Save the data")); + $field->defaults = dgettext("domframework","Save the data"); $field->type = "submit"; $fields[] = $field; unset ($field); @@ -1482,7 +1482,7 @@ $content .= "\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 */ public function accessright ($auth, $id=null) { @@ -1500,7 +1500,7 @@ $content .= "\n"; 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 */ public function editright ($auth, $id=null) { @@ -1534,7 +1534,7 @@ $content .= "\n"; 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 Return FALSE in the other cases */ public function keyexists ($id)