diff --git a/authentication.php b/authentication.php index e3a8cd4..e82a625 100644 --- a/authentication.php +++ b/authentication.php @@ -23,33 +23,39 @@ class authentication /** Number of authentication maximum by minute */ public $ratelimitAuth = 3; + /** Directory to store the ratelimit files */ public $ratelimitDir = "/tmp"; /** The rest authentication methods. Can be http, session, post. - Attention : session case = CSRF ! */ + * Attention : session case = CSRF ! + */ public $restMethods = array ("http"); + /** The html authentication methods. Can be http, session, post * The "post" is already used when using verifAuthLoginPage method (usually * only in authentication page) */ public $htmlMethods = array ("session"); + /** The authentication methods. Can be ldap, sympa...*/ public $authMethods = array (); + /** The authentication servers configuration - array ("authXXXX"=>array ( - array ("ldapserver"=>"ldaps://annuaire.grenoble.cnrs.fr", - "ldapport"=>636, - "ldaptimeout"=>5, - "ldapauth"=>"uid=annuaire,ou=people,dc=grenoble,dc=cnrs,dc=fr", - "ldappwd"=>";authANNUAIRE2013", - "ldapbase"=>"", - "ldapfilter"=>"(mail=%s)", - "ldapfield"=>"mail", - "ldapfiltersearch"=>"(objectClass=inetOrgPerson)" - ), - ), - );*/ + * array ("authXXXX"=>array ( + * array ("ldapserver"=>"ldaps://annuaire.grenoble.cnrs.fr", + * "ldapport"=>636, + * "ldaptimeout"=>5, + * "ldapauth"=>"uid=annuaire,ou=people,dc=grenoble,dc=cnrs,dc=fr", + * "ldappwd"=>";authANNUAIRE2013", + * "ldapbase"=>"", + * "ldapfilter"=>"(mail=%s)", + * "ldapfield"=>"mail", + * "ldapfiltersearch"=>"(objectClass=inetOrgPerson)" + * ), + * ), + * ); + */ public $authServers = array (); /** The application Name displayed on authentication page */ @@ -58,6 +64,9 @@ class authentication /** The class and method to use to log the errors */ public $loggingFunc; + /** The constructor + * @param object $route The route object + */ public function __construct ($route) { $this->route = $route; @@ -69,7 +78,8 @@ class authentication return $this->email; }*/ - /** Disconnect the user */ + /** Disconnect the user + */ public function logout () { if ($this->debug) echo "
LOGOUT\n";
@@ -88,7 +98,10 @@ class authentication
$this->route->redirect ("/authentication", "");
}
- /** Display the login page */
+ /** Display the login page
+ * @param string|null $url The url to be redirected after a valid
+ * authentication
+ */
public function pageHTML ($url = "")
{
// If the user is already connected, redirect to the main page of the site
@@ -108,7 +121,10 @@ class authentication
$alreadyAuth);
}
- /** Check the authentication page */
+ /** Check the authentication page
+ * @param string|null $url The url to be redirected after a valid
+ * authentication
+ */
public function verifAuthLoginPage ($url = "")
{
// rate-limit the connections
@@ -176,7 +192,8 @@ class authentication
$this->route->redirect ("/$url", "");
}
- /** Check all the REST API */
+ /** Check all the REST API
+ */
public function verifAuthREST ()
{
if ($this->debug)
@@ -201,7 +218,8 @@ class authentication
return $res;
}
- /** Check all the others pages of the site */
+ /** Check all the others pages of the site
+ */
public function verifAuthHTML ()
{
if ($this->debug)
@@ -234,10 +252,13 @@ class authentication
}
/** Do the real authentication process on all the providers defined in the
- properties of the class.
- @return an array containing the user data if the authentication is
- correct,
- an exception if noting is found */
+ * properties of the class.
+ * @param string $email The email to check
+ * @param string $password The password to check
+ * @return an array containing the user data if the authentication is
+ * correct,
+ * an exception if noting is found
+ */
private function verifAuth ($email, $password)
{
if ($this->debug)
@@ -350,6 +371,8 @@ class authentication
/** The default method to display the error messages.
* Do not display the debug messages, and write the errors on screen
+ * @param integer $priority The priority of the message
+ * @param string $message The message to log
*/
private function logging ($priority, $message)
{
diff --git a/authhtpasswd.php b/authhtpasswd.php
index 3c31ceb..06f7129 100644
--- a/authhtpasswd.php
+++ b/authhtpasswd.php
@@ -15,6 +15,7 @@ class authhtpasswd extends auth
/** The details to return if the user is authenticated */
private $details = null;
+ /** There is no real connection to htpasswd */
public function connect ()
{
if (! file_exists ($this->htpasswdFile))
diff --git a/authparams.php b/authparams.php
index bb744cf..cffd133 100644
--- a/authparams.php
+++ b/authparams.php
@@ -6,12 +6,16 @@
/** Takes the email and the password of the user */
class authparams
{
+ /** The email of the user when provided */
public $email = null;
+ /** The password of the user when provided */
public $password = null;
/** Parse the different authentication processes to found the email/password
- of the user.
- If non is found, return "anonymous", "anonymous" */
+ * of the user.
+ * If non is found, return "anonymous", "anonymous"
+ * @param array|null $authprocesses The authentication process to use
+ */
public function __construct ($authprocesses=array("session","post"))
{
if (php_sapi_name () === "cli")
diff --git a/authsession.php b/authsession.php
index 3fee0c5..6786fc3 100644
--- a/authsession.php
+++ b/authsession.php
@@ -21,8 +21,9 @@ class authsession extends auth
}
/** Try to authenticate the email/password of the user
- @param string $email Email to authenticate
- @param string $password Password to authenticate */
+ * @param string $email Email to authenticate
+ * @param string $password Password to authenticate
+ */
public function authentication ($email, $password)
{
if (!isset ($_SESSION["domframework"]["auth"]["email"]) ||
@@ -47,9 +48,10 @@ class authsession extends auth
}
/** Method to change the password : unavailable in SESSION auth
- @param string $oldpassword The old password (to check if the user have the
- rights to change the password)
- @param string $newpassword The new password to be recorded */
+ * @param string $oldpassword The old password (to check if the user have the
+ * rights to change the password)
+ * @param string $newpassword The new password to be recorded
+ */
public function changepassword ($oldpassword, $newpassword)
{
throw new Exception (dgettext("domframework",
@@ -58,10 +60,11 @@ class authsession extends auth
}
/** Method to overwrite the password (without oldpassword check)
- Must be reserved to the administrators. For the users, use changepassword
- method
- @param string $email the user identifier to select
- @param string $newpassword The new password to be recorded */
+ * Must be reserved to the administrators. For the users, use changepassword
+ * method
+ * @param string $email the user identifier to select
+ * @param string $newpassword The new password to be recorded
+ */
public function overwritepassword ($email, $newpassword)
{
throw new exception (dgettext("domframework",
@@ -70,13 +73,22 @@ class authsession extends auth
}
/** Save the data in session
- @deprecated 0.23 */
+ * @param string $email The email to store in the session
+ * @param string $password The password to store in the session
+ * @param string $lastname The lastname to store in the session
+ * @param string $firstname The firstname to store in the session
+ * @deprecated 0.23 */
public function savedatas ($email, $password, $lastname, $firstname)
{
return $this->savedata ($email, $password, $lastname, $firstname);
}
- /** Save the data in session */
+ /** Save the data in session
+ * @param string $email The email to store in the session
+ * @param string $password The password to store in the session
+ * @param string $lastname The lastname to store in the session
+ * @param string $firstname The firstname to store in the session
+ */
public function savedata ($email, $password, $lastname, $firstname)
{
$_SESSION["domframework"]["auth"]["lastname"] = $lastname;
diff --git a/authshibboleth.php b/authshibboleth.php
index b34276b..fa51781 100644
--- a/authshibboleth.php
+++ b/authshibboleth.php
@@ -6,13 +6,19 @@
/** User authentication against Shibboleth */
class authshibboleth extends auth
{
- /** The parameters returned by Shibboleth server */
+ /** The Lastname parameter returned by Shibboleth server */
public $lastnameParam = "sn";
+ /** The Firstname parameter returned by Shibboleth server */
public $firstnameParam = "givenName";
+ /** The mail parameter returned by Shibboleth server */
public $mailParam = "mail";
+ /** The others parameters returned by Shibboleth server */
public $otherFields = array ("ou", "o");
+ /** The optional URL use to authenticate the users */
public $urlAuthentificated = "";
+ /** The optional URL to disconnect the users */
public $urlLogout = "";
+ /** The optional URL to change the user password */
public $urlPasswd = "";
/** No connection to shibboleth */
diff --git a/language.php b/language.php
index 2f72c3b..3be4b5b 100644
--- a/language.php
+++ b/language.php
@@ -129,6 +129,8 @@ class language
}
/** Return the language recorded in the Cookie. Check if this language is
+ * @param string $cookieName The cookie name
+ * @param string|null $repLocale The directory use to store the locale files
* allowed
* @return string The language allowed or FALSE
*/
@@ -156,6 +158,7 @@ class language
/** Return an array with all the languages available in the $repLocale dir
* The languages are in the format 'en_US' without the codeset.
+ * @param string|null $repLocale The directory use to store the locale files
* Return FALSE if there is an error
*/
function languageTraductionsList ($repLocale = "./locale")
@@ -357,8 +360,10 @@ class language
}
/** Return the language subtag for the language
- http://www.iana.org/assignments/language-subtag-registry/
- language-subtag-registry*/
+ * http://www.iana.org/assignments/language-subtag-registry/
+ * language-subtag-registry
+ * @param string $languageCode The language code to convert
+ */
public function languageSubTag ($languageCode)
{
return str_replace ("_", "-", $languageCode);
diff --git a/logger.php b/logger.php
index 2abbfd1..02a5e3b 100644
--- a/logger.php
+++ b/logger.php
@@ -62,6 +62,12 @@ class logger
set_error_handler (array (&$this, "errorHandler"));
}
+ /** The error handler to log
+ * @param integer $errno The error number to use
+ * @param string $errstr The error message to save
+ * @param string $errfile The file which generate the error
+ * @param integer $errline The line where the error is generated
+ */
public function errorHandler ($errno, $errstr, $errfile, $errline)
{
if (!(error_reporting() & $errno))
diff --git a/routeSQL.php b/routeSQL.php
index b8f1993..ed16262 100644
--- a/routeSQL.php
+++ b/routeSQL.php
@@ -92,7 +92,17 @@ class routeSQL
/** The Datas are protected in read-only */
private $readwriteAllowed = true;
- /** Connect to the database */
+ /** Connect to the database
+ * @param string $model_file The model file containing the database
+ * description
+ * @param string $model_class The model class included in the model file
+ * @param string $url_prefix The prefix to be used in the URL. Should be the
+ * end of $model_file
+ * @param string $dsn The DSN to connect to the database
+ * @param string $username The username to connect to the database
+ * @param string $password The password to connect to the database
+ * @param array|null $driver_options The PDO driver options
+ */
public function __construct ($model_file, $model_class, $url_prefix, $dsn,
$username = null, $password = null, $driver_options = null)
{
@@ -156,9 +166,14 @@ class routeSQL
}
/** Display a paginator
- $nbentries is the total number of elements
- num is the number of elements displayed by page
- page is the page to display */
+ * $nbentries is the total number of elements
+ * num is the number of elements displayed by page
+ * page is the page to display
+ * @param integer $nbentries The number of entries to display
+ * @param integer $page The page number to display
+ * @param integer $num ???
+ * @param string $search The search query
+ */
private function paginatorArea ($nbentries, $page, $num, $search)
{
// The maximum of links available in the paginator
@@ -217,7 +232,12 @@ $content .= "\n";
}
/** Display the actions buttons outside of the table (actually, juste the
- 'Add new entry' button */
+ * 'Add new entry' button
+ * @param integer $nbentries The number of entries
+ * @param integer $page The page number
+ * @param integer $num ???
+ * @param string $search The search query
+ */
private function addNewArea ($nbentries, $page, $num, $search)
{
$content = "";
@@ -232,7 +252,12 @@ $content .= "\n";
return $content;
}
- /** Display the select list to choose the number of displayed entries */
+ /** Display the select list to choose the number of displayed entries
+ * @param integer $nbentries The number of entries
+ * @param integer $page The page number
+ * @param integer $num ???
+ * @param string $search The search query
+ */
private function numberEntryByDisplayArea ($nbentries, $page, $num, $search)
{
$route = new route ();
@@ -256,7 +281,12 @@ $content .= "\n";
return $content;
}
- /** Display the search area */
+ /** Display the search area
+ * @param integer $nbentries The number of entries
+ * @param integer $page The page number
+ * @param integer $num ???
+ * @param string $search The search query
+ */
private function searchArea ($nbentries, $page, $num, $search)
{
$route = new route ();
@@ -272,7 +302,12 @@ $content .= "\n";
return $content;
}
- /** Display the information */
+ /** Display the information
+ * @param integer $nbentries The number of entries
+ * @param integer $page The page number
+ * @param integer $num ???
+ * @param string $search The search query
+ */
private function informationArea ($nbentries, $page, $num, $search)
{
$content = "";
@@ -580,7 +615,7 @@ $content .= "\n";
$this->url_prefix = $this->chained->url_prefix."/{chain}/".
$this->url_prefix;
}
- /** Add HTML routes */
+ /** Add HTML routes */
$route = new route ();
$route->debug = $this->debug;;
$route->allowSlashes=false;
@@ -1757,7 +1792,10 @@ $content .= "\n";
}
/** Authorization : Return TRUE if the user right allow to see the data
- Return FALSE else */
+ * Return FALSE else
+ * @param array $auth The auth to authenticate
+ * @param integer|null $id The id to examine
+ */
public function accessright ($auth, $id=null)
{
// echo "accessright=".var_export ($id, TRUE)." for ".
@@ -1775,7 +1813,10 @@ $content .= "\n";
}
/** Authorization : Return TRUE if the user right allow to edit the data
- Return FALSE else */
+ * Return FALSE else
+ * @param array $auth The auth to authenticate
+ * @param integer|null $id The id to examine
+ */
public function editright ($auth, $id=null)
{
// echo "editright=".var_export ($id, TRUE)." for ".
@@ -1792,7 +1833,10 @@ $content .= "\n";
}
/** Authorization : Return TRUE if the $id is in READONLY for the user or
- FALSE if the user have the RW rights */
+ * FALSE if the user have the RW rights
+ * @param array $auth The auth to authenticate
+ * @param integer|null $id The id to examine
+ */
public function readonly ($auth, $id=null)
{
// echo "readonly=".var_export ($id, TRUE)." for ".
@@ -1809,8 +1853,10 @@ $content .= "\n";
}
/** Return the data of the row if the $id exists in the primary key of the
- table
- Return FALSE in the other cases */
+ * table
+ * Return FALSE in the other cases
+ * @param integer $id The id to examine
+ */
public function keyexists ($id)
{
$data = $this->objectDB->read (array (array ($this->objectDB->primary,
@@ -1820,7 +1866,9 @@ $content .= "\n";
return FALSE;
}
- /** Display the data in HTML with the view class/method if they are defined */
+ /** Display the data in HTML with the view class/method if they are defined
+ * @param array $data The data to display
+ */
private function rendererhtml ($data)
{
require_once ("domframework/outputhtml.php");
@@ -1849,6 +1897,11 @@ $content .= "\n";
exit;
}
+ /** Return the result converted by JSON/XML, defined in REST
+ * @param string $extension The display method
+ * @param array $data The data to return
+ * @param integer $getCode The HTTP code to return (200 OK by default)
+ */
private function renderrest ($extension, $data, $getCode=200)
{
require_once ("domframework/output$extension.php");