diff --git a/authentication.php b/authentication.php index e3608ae..75f3bb9 100644 --- a/authentication.php +++ b/authentication.php @@ -53,16 +53,16 @@ class authentication public $jwtServerKey = null; /** The authentication servers configuration - * array ("authXXXX"=>array ( - * array ("ldapserver"=>"ldaps://annuaire.grenoble.cnrs.fr", - * "ldapport"=>636, - * "ldaptimeout"=>5, - * "ldapauth"=>"uid=annuaire,ou=people,dc=grenoble,dc=cnrs,dc=fr", - * "ldappwd"=>";authANNUAIRE2013", - * "ldapbase"=>"", - * "ldapfilter"=>"(mail=%s)", - * "ldapfield"=>"mail", - * "ldapfiltersearch"=>"(objectClass=inetOrgPerson)" + * array ("authXXXX" => array ( + * array ("ldapserver" => "ldaps://server.domain.fr", + * "ldapport" => 636, + * "ldaptimeout" => 5, + * "ldapauth" => "uid=XXX,dc=domain,dc=fr", + * "ldappwd" => "XXX", + * "ldapbase" => "", + * "ldapfilter" => "(mail=%s)", + * "ldapfield" => "mail", + * "ldapfiltersearch" => "(objectClass=inetOrgPerson)" * ), * ), * ); diff --git a/authldap.php b/authldap.php index 3c1008f..51ac2eb 100644 --- a/authldap.php +++ b/authldap.php @@ -126,9 +126,9 @@ class authldap extends auth { if ($this->ldapconn === NULL) throw new \Exception ("No established LDAP connection", 500); - $search = ldap_search ($this->ldapconn,$this->ldapbase, + $search = ldap_search ($this->ldapconn, $this->ldapbase, $this->ldapfiltersearch, - array ("mail","sn","givenname")); + array ("mail", "sn", "givenname")); if ($search === FALSE) throw new \Exception ("Unable to search the users in LDAP", 500); $info = ldap_get_entries ($this->ldapconn, $search); diff --git a/authorizationdb.php b/authorizationdb.php index 8fcf2a7..0045255 100644 --- a/authorizationdb.php +++ b/authorizationdb.php @@ -96,7 +96,7 @@ class authorizationdb extends authorization $groupid = intval ($search["groupid"]); $modbits = octdec ($search["modbits"]); if ($this->authiduser === 0) - return array ("READ","WRITE","EXECUTE"); + return array ("READ", "WRITE", "EXECUTE"); $res = array (); if ($this->authiduser === $ownerid) diff --git a/authparams.php b/authparams.php index 480b549..620fc27 100644 --- a/authparams.php +++ b/authparams.php @@ -17,7 +17,7 @@ class authparams * If non is found, return "anonymous", "anonymous" * @param array|null $authprocesses The authentication process to use */ - public function __construct ($authprocesses=array("session","post")) + public function __construct ($authprocesses = array ("session", "post")) { if (php_sapi_name () === "cli") { diff --git a/authsql.php b/authsql.php index b6b427f..58a8a5c 100644 --- a/authsql.php +++ b/authsql.php @@ -49,7 +49,7 @@ class authsql extends auth $this->db = new dblayer ($this->dsn, $this->username, $this->password, $this->driver_options); if ($this->table === null) - throw new Exception (dgettext ("domframework","No SQL table defined"), + throw new Exception (dgettext ("domframework", "No SQL table defined"), 500); if ($this->fieldIdentifier === null) throw new Exception (dgettext ("domframework", @@ -68,7 +68,7 @@ class authsql extends auth $this->fieldsInfo); $fields = array_flip ($fields); foreach ($fields as $key=>$val) - $fields[$key] = array ("varchar","255"); + $fields[$key] = array ("varchar", "255"); $this->db->table = $this->table; $this->db->fields = $fields; $this->db->primary = $this->fieldIdentifier; @@ -139,11 +139,11 @@ class authsql extends auth throw new Exception (dgettext ("domframework", "Bad old password provided"), 401); $cost = 11; - $salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22); - $salt=str_replace("+",".",$salt); - $param='$'.implode('$',array( + $salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22); + $salt = str_replace ("+", ".", $salt); + $param = '$'.implode('$', array( "2y", //select the most secure version of blowfish (>=PHP 5.3.7) - str_pad($cost,2,"0",STR_PAD_LEFT), //add the cost in two digits + str_pad ($cost, 2, "0", STR_PAD_LEFT), //add the cost in two digits $salt //add the salt )); //now do the actual hashing @@ -173,11 +173,11 @@ class authsql extends auth "Unable to find the user : '%s'"), $email), 401); $cost = 11; - $salt=substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22); - $salt=str_replace("+",".",$salt); - $param='$'.implode('$',array( + $salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22); + $salt = str_replace ("+", ".", $salt); + $param = '$'. implode ('$', array ( "2y", //select the most secure version of blowfish (>=PHP 5.3.7) - str_pad($cost,2,"0",STR_PAD_LEFT), //add the cost in two digits + str_pad ($cost, 2, "0", STR_PAD_LEFT), //add the cost in two digits $salt //add the salt )); //now do the actual hashing diff --git a/authzgroups.php b/authzgroups.php index ea730be..0e2289a 100644 --- a/authzgroups.php +++ b/authzgroups.php @@ -169,8 +169,8 @@ class authzgroups $object = "/$object"; $rc = $this->allow ($module, $user, "$object"); if ($this->debug) - trigger_error ("authzgroups : accessRight ('$module','$user','$object')". - "=$rc", E_USER_NOTICE); + trigger_error ("authzgroups : accessRight ('$module', '$user', ". + "'$object')=$rc", E_USER_NOTICE); if ($rc !== "NO") return TRUE; if ($user === "anonymous") @@ -204,8 +204,8 @@ class authzgroups $object = "/$object"; $rc = $this->allow ($module, $user, $object); if ($this->debug) - trigger_error ("authzgroups : accessWrite ('$module','$user','$object')". - "=$rc", E_USER_NOTICE); + trigger_error ("authzgroups : accessWrite ('$module', '$user', ". + "'$object')=$rc", E_USER_NOTICE); if ($rc === "RW") return TRUE; if ($user === "anonymous") @@ -241,7 +241,7 @@ class authzgroups $object = "/$object"; $rc = $this->allow ($module, $user, $object); if ($this->debug) - trigger_error ("authzgroups : accessReadOnly ('$module','$user',". + trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ". "'$object')" ."=$rc", E_USER_NOTICE); if ($rc === "RO") return TRUE; @@ -270,40 +270,34 @@ class authzgroups $this->dbObject->table = "authzobject"; $this->dbObject->prefix = $this->tableprefix; $this->dbObject->fields = array ( - "idobject"=>array ("integer", "not null", "autoincrement"), - "module"=> array ("varchar", "255", "not null"), - "object"=> array ("varchar", "255", "not null"), - "comment"=> array ("varchar", "255")); + "idobject" => array ("integer", "not null", "autoincrement"), + "module" => array ("varchar", "255", "not null"), + "object" => array ("varchar", "255", "not null"), + "comment" => array ("varchar", "255")); $this->dbObject->primary = "idobject"; $this->dbObject->unique = array ("idobject", array ("object", "module")); - $this->dbObject->titles = array ("idobject"=>dgettext ("domframework", - "idobject"), - "module"=>dgettext ("domframework", - "Module"), - "object"=>dgettext ("domframework", - "Object"), - "comment"=>dgettext ("domframework", - "Comment")); + $this->dbObject->titles = array ( + "idobject" => dgettext ("domframework", "idobject"), + "module" => dgettext ("domframework", "Module"), + "object" => dgettext ("domframework", "Object"), + "comment" => dgettext ("domframework", "Comment")); $this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options); $this->dbGroup->debug = $this->debug; $this->dbGroup->table = "authzgroup"; $this->dbGroup->prefix = $this->tableprefix; $this->dbGroup->fields = array ( - "idgroup"=>array ("integer", "not null", "autoincrement"), - "module"=> array ("varchar", "255", "not null"), - "group"=> array ("varchar", "255", "not null"), - "comment"=>array ("varchar", "255")); + "idgroup" => array ("integer", "not null", "autoincrement"), + "module" => array ("varchar", "255", "not null"), + "group" => array ("varchar", "255", "not null"), + "comment" => array ("varchar", "255")); $this->dbGroup->primary = "idgroup"; - $this->dbGroup->unique = array ("idgroup", array ("module","group")); - $this->dbGroup->titles = array ("idgroup"=>dgettext ("domframework", - "idgroup"), - "module"=>dgettext ("domframework", - "Module"), - "group"=>dgettext ("domframework", - "Group"), - "comment"=>dgettext ("domframework", - "Comment")); + $this->dbGroup->unique = array ("idgroup", array ("module", "group")); + $this->dbGroup->titles = array ( + "idgroup" => dgettext ("domframework", "idgroup"), + "module" => dgettext ("domframework", "Module"), + "group" => dgettext ("domframework", "Group"), + "comment" => dgettext ("domframework", "Comment")); $this->dbGroupMember = new dblayer ($dsn, $username, $password, $driver_options); @@ -311,15 +305,15 @@ class authzgroups $this->dbGroupMember->table = "authzgroupmember"; $this->dbGroupMember->prefix = $this->tableprefix; $this->dbGroupMember->fields = array ( - "idgroupmember"=>array ("integer", "not null", "autoincrement"), - "user"=> array ("varchar", "255", "not null"), - "idgroup"=> array ("integer", "not null"), - "comment"=> array ("varchar", "255")); + "idgroupmember" => array ("integer", "not null", "autoincrement"), + "user" => array ("varchar", "255", "not null"), + "idgroup" => array ("integer", "not null"), + "comment" => array ("varchar", "255")); $this->dbGroupMember->primary = "idgroupmember"; $this->dbGroupMember->unique = array ("idgroupmember", - array ("user","idgroup")); + array ("user", "idgroup")); $this->dbGroupMember->foreign = array ( - "idgroup"=>array ("authzgroup", "idgroup", + "idgroup" => array ("authzgroup", "idgroup", "ON UPDATE CASCADE ON DELETE CASCADE")); $this->dbGroupMember->titles = array ( "idgroupmember"=> dgettext ("domframework", "idgroupmember"), @@ -335,22 +329,22 @@ class authzgroups "idright"=> array ("integer", "not null", "autoincrement"), "idgroup"=> array ("integer", "not null"), "idobject"=>array ("integer", "not null"), - "right"=> array ("varchar", "2", "not null"), // RO,RW + "right"=> array ("varchar", "2", "not null"), // RO, RW "comment"=> array ("varchar", "255")); $this->dbRight->primary = "idright"; - $this->dbRight->unique = array ("idright", array ("idgroup","idobject")); + $this->dbRight->unique = array ("idright", array ("idgroup", "idobject")); $this->dbRight->foreign = array ( - "idgroup"=> array ("authzgroup", "idgroup", - "ON UPDATE CASCADE ON DELETE CASCADE"), - "idobject"=>array ("authzobject", "idobject", - "ON UPDATE CASCADE ON DELETE CASCADE"), + "idgroup" => array ("authzgroup", "idgroup", + "ON UPDATE CASCADE ON DELETE CASCADE"), + "idobject" => array ("authzobject", "idobject", + "ON UPDATE CASCADE ON DELETE CASCADE"), ); $this->dbRight->titles = array ( - "idright"=>dgettext ("domframework", "idright"), - "idgroup"=>dgettext ("domframework", "idgroup"), - "idobject"=>dgettext ("domframework", "idobject"), - "right"=>dgettext ("domframework", "Right"), - "comment"=>dgettext ("domframework", "Comment")); + "idright" => dgettext ("domframework", "idright"), + "idgroup" => dgettext ("domframework", "idgroup"), + "idobject" => dgettext ("domframework", "idobject"), + "right" => dgettext ("domframework", "Right"), + "comment" => dgettext ("domframework", "Comment")); return TRUE; } @@ -505,7 +499,8 @@ class authzgroups $select[] = array ("module", $module); if ($object !== null) $select[] = array ("object", $object); - return $this->dbObject->read ($select, null, array(array("object","ASC"))); + return $this->dbObject->read ($select, null, + array (array ("object", "ASC"))); } /** Return an array with all the available objects in the module, or only @@ -517,7 +512,7 @@ class authzgroups { if ($this->dbObject == null) throw new Exception (dgettext ("domframework", - "DB for Object is not connected"), 500); + "DB for Object is not connected"), 500); $select[] = array ("module", $module); if ($idobject !== null) $select[] = array ("idobject", $idobject); @@ -725,11 +720,11 @@ class authzgroups throw new Exception (dgettext ("domframework", "Wanted group not found"), 404); $groupsMembers = $this->dbGroupMember->read (array ( - array ("user",$user), - array ("idgroup",$groups[0]["idgroup"]))); + array ("user", $user), + array ("idgroup", $groups[0]["idgroup"]))); if (! isset ($groupsMembers[0]["idgroupmember"])) throw new Exception (dgettext ("domframework", - "Wanted GroupMember not found"), 404); + "Wanted GroupMember not found"), 404); $this->rightCache = null; return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]); } @@ -743,15 +738,14 @@ class authzgroups { if ($this->dbGroupMember == null) throw new Exception (dgettext ("domframework", - "DB for GroupMember is not connected"), - 500); + "DB for GroupMember is not connected"), 500); $groups = $this->groupReadByID ($module, $idgroup); if (! isset ($groups[0]["idgroup"])) throw new Exception (dgettext ("domframework", - "Wanted group not found"), 404); + "Wanted group not found"), 404); $groupsMembers = $this->dbGroupMember->read (array ( - array ("idgroupmember",$idgroupmember), - array ("idgroup",$idgroup))); + array ("idgroupmember", $idgroupmember), + array ("idgroup", $idgroup))); if (! isset ($groupsMembers[0]["idgroupmember"])) throw new Exception (dgettext ("domframework", "Wanted GroupMember not found"), 404); @@ -1118,8 +1112,8 @@ class authzgroups if (! isset ($objects[0]["idobject"])) throw new Exception (dgettext ("domframework", "Wanted object not found"), 404); - $select[] = array ("idgroup",$groups[0]["idgroup"]); - $select[] = array ("idobject",$objects[0]["idobject"]); + $select[] = array ("idgroup", $groups[0]["idgroup"]); + $select[] = array ("idobject", $objects[0]["idobject"]); return $this->dbRight->read ($select); } diff --git a/authzgroupsoo.php b/authzgroupsoo.php index 15dc20f..04450a4 100644 --- a/authzgroupsoo.php +++ b/authzgroupsoo.php @@ -191,8 +191,8 @@ class authzgroupsoo $object = "/$object"; $rc = $this->allow ($module, $user, "$object"); if ($this->debug) - trigger_error ("authzgroups : accessRight ('$module','$user','$object')". - "=$rc", E_USER_NOTICE); + trigger_error ("authzgroups : accessRight ('$module', '$user', ". + "'$object')=$rc", E_USER_NOTICE); if ($rc !== "NO") return TRUE; if ($user === "anonymous") @@ -226,8 +226,8 @@ class authzgroupsoo $object = "/$object"; $rc = $this->allow ($module, $user, $object); if ($this->debug) - trigger_error ("authzgroups : accessWrite ('$module','$user','$object')". - "=$rc", E_USER_NOTICE); + trigger_error ("authzgroups : accessWrite ('$module', '$user', ". + "'$object')=$rc", E_USER_NOTICE); if ($rc === "RW") return TRUE; if ($user === "anonymous") @@ -263,7 +263,7 @@ class authzgroupsoo $object = "/$object"; $rc = $this->allow ($module, $user, $object); if ($this->debug) - trigger_error ("authzgroups : accessReadOnly ('$module','$user',". + trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ". "'$object')" ."=$rc", E_USER_NOTICE); if ($rc === "RO") return TRUE; @@ -316,7 +316,7 @@ class authzgroupsoo "group" => array ("varchar(255)", "not null"), "comment" => array ("varchar(255)"))); $this->dbGroup->primary ("idgroup"); - $this->dbGroup->unique (array ("idgroup", array ("module","group"))); + $this->dbGroup->unique (array ("idgroup", array ("module", "group"))); $this->dbGroup->titles (array ( "idgroup" => dgettext ("domframework", "idgroup"), "module" => dgettext ("domframework", "Module"), @@ -335,7 +335,7 @@ class authzgroupsoo "comment" => array ("varchar(255)"))); $this->dbGroupMember->primary ("idgroupmember"); $this->dbGroupMember->unique (array ("idgroupmember", - array ("user","idgroup"))); + array ("user", "idgroup"))); $this->dbGroupMember->foreign (array ( "idgroup" => array ($this->tableprefix."authzgroup", "idgroup", "ON UPDATE CASCADE ON DELETE CASCADE"))); @@ -355,10 +355,10 @@ class authzgroupsoo "idright" => array ("integer", "not null", "autoincrement"), "idgroup" => array ("integer", "not null"), "idobject" => array ("integer", "not null"), - "right" => array ("varchar(2)", "not null"), // NO, RO,RW + "right" => array ("varchar(2)", "not null"), // NO, RO, RW "comment" => array ("varchar(255)"))); $this->dbRight->primary ("idright"); - $this->dbRight->unique (array ("idright", array ("idgroup","idobject"))); + $this->dbRight->unique (array ("idright", array ("idgroup", "idobject"))); $this->dbRight->foreign (array ( "idgroup" => array ($this->tableprefix."authzgroup", "idgroup", "ON UPDATE CASCADE ON DELETE CASCADE"), @@ -584,7 +584,7 @@ class authzgroupsoo $this->dbObject->whereAdd ("object", "=", $object); return $this->dbObject->select () ->whereAdd ("module", "=", $module) - ->orderAdd ("object","ASC") + ->orderAdd ("object", "ASC") ->execute (); } diff --git a/config.php b/config.php index a629e86..df9f744 100644 --- a/config.php +++ b/config.php @@ -451,7 +451,7 @@ class config $foundDefault = $text; if ($id === T_DOC_COMMENT) { - // Look at @param, @description,@type, @values, @default + // Look at @param, @description, @type, @values, @default if ($debug) echo "DOC_COMMENT : $text\n"; // Append the not completed lines $text = trim (substr ($text, 3, -2)); @@ -467,7 +467,7 @@ class config $tmp = explode (" ", $line); $key = reset ($tmp); $key = substr ($key, 1); - $data[$key] = trim (implode (" ",array_slice ($tmp, 1))); + $data[$key] = trim (implode (" ", array_slice ($tmp, 1))); } if (isset ($data["group"])) $group = $data["group"]; diff --git a/dblayeroo.php b/dblayeroo.php index 9bb63f5..5fc88c9 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -329,7 +329,7 @@ class dblayeroo * ); * $primary = "id"; * $unique = array ("id", array ("zo ne", "vie wname")); - * $foreign = array ("zone"=>"table.field",...); + * $foreign = array ("zone"=>"table.field", ...); */ public function createTable () /* {{{ */ @@ -625,7 +625,7 @@ class dblayeroo { $sql .= ",\n UNIQUE (\""; if (is_array ($u)) - $sql .=implode ("\",\"", $u); + $sql .= implode ("\",\"", $u); else $sql .= $u; $sql .="\")"; @@ -3224,7 +3224,7 @@ class dblayeroo $sql = $this->createRequest (); $this->debugLog ("Entering prepareRequest (XXX, ",false,")"); $st = $this->prepareRequest ($sql, false); - $this->debugLog ("'",$this->getDisplayQuery (),"'"); + $this->debugLog ("'", $this->getDisplayQuery (), "'"); $startTime = microtime (true); $st->execute (); switch ($this->command) diff --git a/file.php b/file.php index 642bc3a..c107eb0 100644 --- a/file.php +++ b/file.php @@ -638,7 +638,7 @@ class file $this->checkPathRW ($tmpdirname); if ($recursive === false) return @rmdir ($tmpdirname); - $files = array_diff (scandir ($tmpdirname), array('.','..')); + $files = array_diff (scandir ($tmpdirname), array(".", "..")); foreach ($files as $file) { if (is_dir ("$tmpdirname/$file")) diff --git a/httpclient.php b/httpclient.php index d61f376..4a4a2be 100644 --- a/httpclient.php +++ b/httpclient.php @@ -949,7 +949,7 @@ class Httpclient } elseif ($val !== null && $name === "") { - // Only the first value will be stored as cookie (name,val) pair + // Only the first value will be stored as cookie (name, val) pair // echo "KEY=$key => $val\n"; $name = $key; $value = $val; diff --git a/imap.php b/imap.php index 2cd5aec..d94b333 100644 --- a/imap.php +++ b/imap.php @@ -140,7 +140,7 @@ class imap throw new \Exception ("IMAP server not connected", 500); if (! in_array ($folder, $this->foldersList ())) throw new \Exception ("Folder not found", 404); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); $rc = @imap_reopen (self::$instance[$this->mailbox], $this->mailbox.$folderUTF7); if ($rc === true) @@ -168,7 +168,7 @@ class imap throw new \Exception ("IMAP server not connected", 500); if ( in_array ($folder, $this->foldersList ())) throw new \Exception ("Folder already exists", 406); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); return imap_createmailbox (self::$instance[$this->mailbox], $this->mailbox.$folderUTF7); } @@ -182,7 +182,7 @@ class imap throw new \Exception ("IMAP server not connected", 500); if (! in_array ($folder, $this->foldersList ())) throw new \Exception ("Folder not found", 404); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); return imap_deletemailbox (self::$instance[$this->mailbox], $this->mailbox.$folderUTF7); } @@ -217,7 +217,7 @@ class imap { if ($this->mailbox === null) throw new \Exception ("IMAP server not connected", 500); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); return imap_subscribe (self::$instance[$this->mailbox], $this->mailbox.$folder); } @@ -230,7 +230,7 @@ class imap { if ($this->mailbox === null) throw new \Exception ("IMAP server not connected", 500); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); return imap_unsubscribe (self::$instance[$this->mailbox], $this->mailbox.$folder); } @@ -413,7 +413,7 @@ class imap $this->changeFolder ($this->curDir); if (is_array ($msgno)) $msgno = implode (",", $msgno); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); $rc = imap_mail_move (self::$instance[$this->mailbox], $msgno, $folderUTF7); if ($rc !== TRUE) { @@ -436,7 +436,7 @@ class imap $this->changeFolder ($this->curDir); if (is_array ($msgno)) $msgno = implode (",", $msgno); - $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($folder, "UTF7-IMAP", "UTF-8"); $rc = imap_mail_copy (self::$instance[$this->mailbox], $msgno, $folderUTF7); if ($rc !== TRUE) { @@ -719,7 +719,7 @@ class imap { if ($this->mailbox === null) throw new \Exception ("IMAP server not connected", 500); - $folderUTF7 = mb_convert_encoding ($this->curDir, "UTF7-IMAP","UTF-8"); + $folderUTF7 = mb_convert_encoding ($this->curDir, "UTF7-IMAP", "UTF-8"); $rc = imap_append (self::$instance[$this->mailbox], $this->mailbox.$folderUTF7, $content); diff --git a/ipaddresses.php b/ipaddresses.php index 8fb8ef7..5210fae 100644 --- a/ipaddresses.php +++ b/ipaddresses.php @@ -179,7 +179,7 @@ class ipaddresses foreach ($ipArr as $key=>$val) { // echo "VAL=".var_export ($val, true). - // ", cleanLoop=".var_export ($cleanLoop,true); + // ", cleanLoop=".var_export ($cleanLoop, true); if ($val !== "0") { // echo " => In NOT zero\n"; @@ -232,7 +232,7 @@ class ipaddresses $this->validIPAddress ($ip) === false) throw new \Exception (dgettext ("domframework", "Invalid IP address"), 500); - if (strstr ($ip,"::")) + if (strstr ($ip, "::")) { $e = explode (":", $ip); // Case where :: is in start diff --git a/language.php b/language.php index fdfabe2..bf4ef2f 100644 --- a/language.php +++ b/language.php @@ -45,7 +45,7 @@ class language // Suppression des poids (l'ordre est donne dans la pile) if ( ($pos = strpos ($value, ";")) !== FALSE) { - $arrAccept[$key] = substr ($value,0,$pos); + $arrAccept[$key] = substr ($value, 0, $pos); } // Si la language proposee est du style en-us, convertit en en-US diff --git a/markdown.php b/markdown.php index a4a47f2..afb8b05 100644 --- a/markdown.php +++ b/markdown.php @@ -10,7 +10,7 @@ class markdown public $debug = false; /** The list of the HTML elements used by block */ - private $blockid = array ("

","

","

","

","

","
", + private $blockid = array ("

", "

", "

", "

", "

", "
", "
"); /** Convert the markdown text to html diff --git a/outputhtml.php b/outputhtml.php index e29ae82..18a8465 100644 --- a/outputhtml.php +++ b/outputhtml.php @@ -55,11 +55,9 @@ class outputhtml extends output if (isset ($resView["title"])) $title = $resView["title"]; if (! isset ($resView["content"])) - throw new \Exception (sprintf ( - dgettext ("domframework", - "No data provided from view %s::%s"), - $viewClass,$viewMethod), - 500); + throw new \Exception (sprintf ( dgettext ("domframework", + "No data provided from view %s::%s"), $viewClass, $viewMethod), + 500); } } diff --git a/outputxml.php b/outputxml.php index 095594a..b228c70 100644 --- a/outputxml.php +++ b/outputxml.php @@ -53,7 +53,7 @@ class outputxml extends output else { $key = is_numeric($key) ? "item$key" : $key; - $xml->addChild("$key","$value"); + $xml->addChild("$key", "$value"); } } } diff --git a/route.php b/route.php index 1746c49..a6a8062 100644 --- a/route.php +++ b/route.php @@ -25,7 +25,7 @@ class route /** Allow slashes in the url when matching the regex */ public $allowSlashes = true; /** Provide the the class catch errors in routing. - * Must be provided in an array(class,method); */ + * Must be provided in an array(class, method); */ public $errors = null; /** Preroute used in modules */ public $preroute = ""; @@ -260,10 +260,9 @@ class route // Allow to redirect from POST to GET, but not GET to GET (can loop) if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET") $this->error (new \Exception ("Redirect to myself", 400)); - if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL,"/")) + if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL, "/")) $this->error (new \Exception ( - "Can't redirect outside this site (Base $baseURL)", - 405)); + "Can't redirect outside this site (Base $baseURL)", 405)); if ($this->debug) { diff --git a/routeSQL.php b/routeSQL.php index 887434d..606d37a 100644 --- a/routeSQL.php +++ b/routeSQL.php @@ -59,7 +59,7 @@ class routeSQL /** Chain multiple routeSQL. Wait for the foreign key */ public $chainedForeign = null; /** Allow one or multiple links by entry in the list - The array must be of the form array ("linkname"=>,"icon"=>) + The array must be of the form array ("linkname"=>, "icon"=>) icon is optional and the linkname is used if it is not provided */ public $internalLinks = array (); /** The renderer class to use for HTML pages */ @@ -146,13 +146,13 @@ class routeSQL switch ($flash[0]) { case 4: $dataflash .= "alert-danger"; - $alert = dgettext ("domframework","Error!");break; + $alert = dgettext ("domframework", "Error!");break; case 3: $dataflash .= "alert-warning"; - $alert = dgettext ("domframework","Warning!");break; + $alert = dgettext ("domframework", "Warning!");break; case 2: $dataflash .= "alert-info"; - $alert = dgettext ("domframework","Info:");break; + $alert = dgettext ("domframework", "Info:");break; case 1: $dataflash .= "alert-success"; - $alert = dgettext ("domframework","Success:");break; + $alert = dgettext ("domframework", "Success:");break; } $dataflash .= " alert-dismissable'>\n"; $dataflash .= "$alert ".$flash[1]."\n"; @@ -246,7 +246,7 @@ $content .= "\n"; $route = new route (); $content .= "
\n"; $content .= " " - .dgettext ("domframework","Add new entry")."\n"; + .dgettext ("domframework", "Add new entry")."\n"; $content .= "
\n"; } return $content; @@ -266,7 +266,7 @@ $content .= "\n"; $content .= "
\n"; $content .= " \n"; $content .= "
\n"; @@ -372,8 +372,8 @@ $content .= "\n"; if (!isset ($extension) || $extension === null || $extension === "") $extension = reset ($this->extensionsAllowed); if (!in_array ($extension, $this->extensionsAllowed)) - throw new \Exception (dgettext ("domframework","Extension not allowed"), - 403); + throw new \Exception (dgettext ("domframework", + "Extension not allowed"), 403); $search = rawurldecode ($search); $this->connect(); $titles = $this->objectDB->titles (); @@ -424,9 +424,9 @@ $content .= "\n"; { if ($this->authREST["email"] === "anonymous") throw new \Exception (dgettext ("domframework", - "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), - 403); + "Anonymous not allowed"), 401); + throw new \Exception (dgettext ("domframework", "Access forbidden"), + 403); } $this->chained->connect(); // $chainedvalues are the information associated to the $chain @@ -1017,7 +1017,7 @@ $content .= "\n"; if ($this->readwriteAllowed && $this->displayActions) $countTitles++; $content .= " "; - $content .= dgettext ("domframework","No entry available"); + $content .= dgettext ("domframework", "No entry available"); $content .= "\n"; } else @@ -1110,7 +1110,7 @@ $content .= "\n"; if ($this->authHTML["email"] === "anonymous") throw new \Exception (dgettext ("domframework", "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), + throw new \Exception (dgettext ("domframework", "Access forbidden"), 403); } $this->chained->connect(); @@ -1173,9 +1173,9 @@ $content .= "\n"; { if ($this->authHTML["email"] === "anonymous") throw new \Exception (dgettext ("domframework", - "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), - 403); + "Anonymous not allowed"), 401); + throw new \Exception (dgettext ("domframework", "Access forbidden"), + 403); } $this->chained->connect(); // $chainedValues are the information associated to the $chain @@ -1387,8 +1387,8 @@ $content .= "\n"; } $field = new formfield ("submit", dgettext ("domframework", - "Save the data")); - $field->defaults = dgettext ("domframework","Save the data"); + "Save the data")); + $field->defaults = dgettext ("domframework", "Save the data"); $field->type = "submit"; $fields[] = $field; unset ($field); @@ -1407,9 +1407,9 @@ $content .= "\n"; { if ($this->authHTML["email"] === "anonymous") throw new \Exception (dgettext ("domframework", - "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), - 403); + "Anonymous not allowed"), 401); + throw new \Exception (dgettext ("domframework", "Access forbidden"), + 403); } $this->chained->connect(); // $chainedvalues are the information associated to the $chain @@ -1492,9 +1492,9 @@ $content .= "\n"; { if ($this->authHTML["email"] === "anonymous") throw new \Exception (dgettext ("domframework", - "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), - 403); + "Anonymous not allowed"), 401); + throw new \Exception (dgettext ("domframework", "Access forbidden"), + 403); } $this->chained->connect(); // $chainedvalues are the information associated to the $chain @@ -1710,8 +1710,8 @@ $content .= "\n"; if ($readonly === false && $this->readwriteAllowed === true) { $field = new formfield ("submit", dgettext ("domframework", - "Save the data")); - $field->defaults = dgettext ("domframework","Save the data"); + "Save the data")); + $field->defaults = dgettext ("domframework", "Save the data"); $field->type = "submit"; $fields[] = $field; unset ($field); @@ -1732,9 +1732,9 @@ $content .= "\n"; { if ($this->authHTML["email"] === "anonymous") throw new \Exception (dgettext ("domframework", - "Anonymous not allowed"), 401); - throw new \Exception (dgettext ("domframework","Access forbidden"), - 403); + "Anonymous not allowed"), 401); + throw new \Exception (dgettext ("domframework", "Access forbidden"), + 403); } $this->chained->connect(); // $chainedvalues are the information associated to the $chain @@ -1781,7 +1781,7 @@ $content .= "\n"; $values[$this->chainedForeign] !== $chain) $errorsChain[$this->chainedForeign] = array ("error", dgettext ("domframework", - "Can not change the external key")); + "Can not change the external key")); if ($this->chainedForeign !== null) $values[$this->chainedForeign] = $chain; $errors = $this->objectDB->verify ($values, $id); @@ -1791,7 +1791,8 @@ $content .= "\n"; { $this->objectDB->update ($id, $values); $renderer = new renderer (); - $renderer->flash ("SUCCESS", dgettext ("domframework","Update done")); + $renderer->flash ("SUCCESS", dgettext ("domframework", + "Update done")); $route->redirect ("/". str_replace ("{chain}", $chain, $this->url_prefix), ""); diff --git a/userssql.php b/userssql.php index 7cd8055..1932c07 100644 --- a/userssql.php +++ b/userssql.php @@ -57,23 +57,23 @@ class userssql extends users public function connect () { if ($this->table === null) - throw new Exception (dgettext ("domframework","No SQL table defined"), - 500); + throw new Exception (dgettext ("domframework", "No SQL table defined"), + 500); if ($this->fieldEmail === null) throw new Exception (dgettext ("domframework", - "No fieldIdentifier defined"), 500); + "No fieldIdentifier defined"), 500); if ($this->fieldPassword === null) throw new Exception (dgettext ("domframework", - "No fieldPassword defined"), 500); + "No fieldPassword defined"), 500); if ($this->fieldLastname === null) throw new Exception (dgettext ("domframework", - "No fieldLastname defined"), 500); + "No fieldLastname defined"), 500); if ($this->fieldFirstname === null) throw new Exception (dgettext ("domframework", - "No fieldFirstname defined"), 500); + "No fieldFirstname defined"), 500); if ($this->fieldLastchange === null) throw new Exception (dgettext ("domframework", - "No fieldLastchange defined"), 500); + "No fieldLastchange defined"), 500); $this->db = new dblayer ($this->dsn, $this->username, $this->password, $this->driver_options); $this->db->table = $this->table; @@ -178,7 +178,7 @@ class userssql extends users $this->checkPassword ($newpassword); if ($this->checkValidPassword ($email, $oldpassword) !== true) throw new Exception (dgettext ("domframework", - "Bad old password provided"), 401); + "Bad old password provided"), 401); $cryptedPassword = $this->cryptPasswd ($newpassword); return $this->db->update ($email, array ($this->fieldPassword=>$cryptedPassword, @@ -201,7 +201,7 @@ class userssql extends users array ($this->fieldPassword)); if (count ($data) === 0) throw new Exception (dgettext ("domframework", - "No information found for this email"), 404); + "No information found for this email"), 404); $cryptedPassword = $this->cryptPasswd ($newpassword); return $this->db->update ($email, array ($this->fieldPassword=>$cryptedPassword, @@ -223,10 +223,10 @@ class userssql extends users array ($this->fieldPassword)); if (count ($data) === 0) throw new Exception (dgettext ("domframework", - "No information found for this email"), 404); + "No information found for this email"), 404); if (! isset ($data[0][$this->fieldPassword])) throw new Exception (dgettext ("domframework", - "No password available for this email"), 404); + "No password available for this email"), 404); $cryptedPassword = $data[0][$this->fieldPassword]; if (crypt ($password, $cryptedPassword) !== $cryptedPassword) return false;