From 9fef934b711d21684deab2b9dd8ca10383422f33 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 1 Aug 2014 07:11:14 +0000 Subject: [PATCH] Cosmetics : remove spaces at the end of lines and correct lines with more than 80 chars git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1643 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- Tests/cachefileTest.php | 2 +- Tests/markdownTest.php | 11 +++++++---- Tests/outputjsonTest.php | 2 +- authldap.php | 4 ++-- authorizationdb.php | 2 +- authparams.php | 2 +- authsympa.php | 6 +++--- cachefile.php | 2 +- cacheoutput.php | 2 +- cli.php | 12 ++++++------ config.php | 7 +++---- dblayer.php | 24 ++++++++++++------------ debian/changelog | 2 +- debian/control | 1 - debian/rules | 4 ++-- debian/watch | 2 +- docs/USAGE | 16 +++++++++++----- form.php | 10 +++++----- http.php | 4 ++-- logger.php | 4 ++-- markdown.php | 8 +++++--- outputcsv.php | 2 +- outputhtml.php | 6 +++--- outputjson.php | 2 +- renderer.php | 4 ++-- rest.php | 2 +- route.php | 18 +++++++++--------- verify.php | 1 - version.php | 3 ++- 29 files changed, 87 insertions(+), 78 deletions(-) diff --git a/Tests/cachefileTest.php b/Tests/cachefileTest.php index c1a23f2..effc234 100644 --- a/Tests/cachefileTest.php +++ b/Tests/cachefileTest.php @@ -73,7 +73,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase $this->assertEquals ("DATA_TO_STORE", $res); } - public function testDel1 () + public function testDel1 () { $c = new cachefile (); $res = $c->delete ("id"); diff --git a/Tests/markdownTest.php b/Tests/markdownTest.php index c26a461..8b46b7a 100644 --- a/Tests/markdownTest.php +++ b/Tests/markdownTest.php @@ -185,7 +185,7 @@ class test_markdown extends PHPUnit_Framework_TestCase "); $md = new markdown (); printf ($md->html ("* line1 -end +end * line2 end")); } @@ -244,21 +244,24 @@ base"); // Links public function testLinkHTTP1 () { - $this->expectOutputString("

http://example.com

"); + $this->expectOutputString( + "

http://example.com

"); $md = new markdown (); printf ($md->html ("")); } public function testLinkHTTP2 () { - $this->expectOutputString("

https://example.com

"); + $this->expectOutputString( + "

https://example.com

"); $md = new markdown (); printf ($md->html ("")); } public function testLinkHTTP3 () { - $this->expectOutputString("

test@example.com

"); + $this->expectOutputString( + "

test@example.com

"); $md = new markdown (); printf ($md->html ("")); } diff --git a/Tests/outputjsonTest.php b/Tests/outputjsonTest.php index bfca76f..ee79c3b 100644 --- a/Tests/outputjsonTest.php +++ b/Tests/outputjsonTest.php @@ -12,7 +12,7 @@ class test_outputjson extends PHPUnit_Framework_TestCase $this->expectOutputString("\"\""); $output = new outputjson (); $output->out (""); - } + } /** Entry string */ public function testoutputjson2 () diff --git a/authldap.php b/authldap.php index ec6cde1..bc3ac03 100644 --- a/authldap.php +++ b/authldap.php @@ -79,7 +79,7 @@ class authldap extends auth { if ($this->ldapdnuser === NULL) throw new Exception ("No user authenticated !", 401); - $search = ldap_search ($this->ldapconn, $this->ldapdnuser, + $search = ldap_search ($this->ldapconn, $this->ldapdnuser, $this->ldapfiltersearch); if ($search === FALSE) throw new Exception ("Can not found the details for user", 401); @@ -120,7 +120,7 @@ class authldap extends auth foreach ($info as $key=>$vals) { 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"])) { $datas[$key] = array ("lastname"=>$vals["sn"][0], diff --git a/authorizationdb.php b/authorizationdb.php index 770fb3c..2b46052 100644 --- a/authorizationdb.php +++ b/authorizationdb.php @@ -188,7 +188,7 @@ class authorizationdb extends authorization "ownerid"=>$ownerid, "groupid"=>$groupid, "modbits"=>$modbits)); - return TRUE; + return TRUE; } /** Remove the informations about an object and all its sub-objects diff --git a/authparams.php b/authparams.php index 53624ce..c20b56f 100644 --- a/authparams.php +++ b/authparams.php @@ -22,7 +22,7 @@ class authparams if (!isset ($_SESSION["auth"]["email"]) || !isset ($_SESSION["auth"]["password"])) throw new Exception ("No previous email in session", 401); - return array ("email"=>$_SESSION["auth"]["email"], + return array ("email"=>$_SESSION["auth"]["email"], "password"=>$_SESSION["auth"]["email"]); } diff --git a/authsympa.php b/authsympa.php index 21bb9a1..8caab2f 100644 --- a/authsympa.php +++ b/authsympa.php @@ -5,15 +5,15 @@ require_once ("auth.php"); /** User authentication against SYMPA server - Sympa is a mailling list server. It can handle authentication with + Sympa is a mailling list server. It can handle authentication with - a username (a email adress) - a password - - a list to check if the user is recorded in + - a list to check if the user is recorded in - a Sympa SOAP server WSDL - the part of list which should be test : subscriber, owner, editor It use the SOAP protocol. So the PHP SOAP library is needed and the network must be open between the Web server and the Sympa server. -POC : +POC : $auth = new authsympa (); $auth->wsdl = "https://lists.domain.tld/sympa/wsdl"; $auth->list = "listtest@lists.domain.tld"; diff --git a/cachefile.php b/cachefile.php index 66a6436..225f901 100644 --- a/cachefile.php +++ b/cachefile.php @@ -84,7 +84,7 @@ class cachefile chmod ($this->directory, 0777); } if (! is_writable ($this->directory)) - throw new Exception (sprintf (_("Cache directory %s is not writable"), + throw new Exception (sprintf (_("Cache directory %s is not writable"), $this->directory), 500); if (! is_readable ($this->directory)) throw new Exception (sprintf (_("Cache directory %s is not readable"), diff --git a/cacheoutput.php b/cacheoutput.php index d58b9a6..30f42a4 100644 --- a/cacheoutput.php +++ b/cacheoutput.php @@ -18,7 +18,7 @@ class cacheoutput /** Current path at start due to lack of information in __destruct*/ private $cacheCWD = null; - /** + /** @param string $id The cache identifier @param integer|null $ttl The cache Time to Leave in seconds (60s by default) diff --git a/cli.php b/cli.php index 5de5316..dec119b 100644 --- a/cli.php +++ b/cli.php @@ -6,7 +6,7 @@ /** Allow to interract with controllers and models from the CLI */ class cli { - /** Run in CLI mode with parameters + /** Run in CLI mode with parameters Example of cli code : #!/usr/bin/php5 : \n"; echo " display the methods available the controller class\n"; echo " $launcher -expert -listmethods :\n"; - echo " display the methods available the model or controller class\n"; + echo " display the methods available the model or controller class". + "\n"; echo " $launcher -listmethodsdetails : \n"; echo " display the methods available the controller class\n"; echo " $launcher -expert -listmethodsdetails :\n"; - echo " display the methods available the model or controller class\n"; + echo " display the methods available the model or controller class". + "\n"; echo " $launcher [args]\n"; echo " execute the method with the provided args\n"; echo " $launcher -expert [args]\n"; @@ -66,7 +68,6 @@ class cli // Lists the classes available in controllers and models if expert mode echo "List of classes available :\n"; echo " ".implode ("\n ", $classes)."\n"; - echo "Usage : ".$launcher; if ($EXPERT) echo " -expert"; echo " -listmethods \n"; @@ -131,7 +132,7 @@ class cli else echo ">"; } - + if ($argv[0] === "-listmethodsdetails") { echo "\n"; @@ -166,7 +167,6 @@ class cli $found = TRUE; break; } - } if ($found === FALSE) diff --git a/config.php b/config.php index 08befd5..f58b491 100644 --- a/config.php +++ b/config.php @@ -3,10 +3,10 @@ @package domframework @author Dominique Fournier */ -/** Manage the configurations of the module done by administrator in a config +/** Manage the configurations of the module done by administrator in a config file It is based on the module configuration defaults - POC : + POC : $config = new config(); $config->default = array ("param"=>"default", "param2"=>array (1,2,3), @@ -32,7 +32,6 @@ class config public function params () { return print_r ($this->default, TRUE); - } /** Get the value of the provided parameter recorded in .php file @@ -44,7 +43,7 @@ class config throw new Exception ("Unknown parameter '$param'"); if (!file_exists ($this->confFile)) { - if (@file_put_contents ($this->confFile, + if (@file_put_contents ($this->confFile, "primary) @@ -690,7 +690,7 @@ class dblayer extends PDO } /** Create the table defined by the differents fields. - Define the SQL syntax based on SQL engines + Define the SQL syntax based on SQL engines $table = "dns zones"; $fields = array ( "id"=>array ("integer", "not null", "autoincrement"), @@ -755,7 +755,7 @@ class dblayer extends PDO if ($this->primary === $field) $sql .= " PRIMARY KEY"; // Others parameters for field - // Sort to put the autoincrement field in front of params, if it is + // Sort to put the autoincrement field in front of params, if it is // present sort ($params); foreach ($params as $p) @@ -842,7 +842,7 @@ class dblayer extends PDO if ($this->primary === $field) $sql .= " PRIMARY KEY"; // Others parameters for field - // Sort to put the autoincrement field in front of params, if it is + // Sort to put the autoincrement field in front of params, if it is // present sort ($params); foreach ($params as $p) @@ -876,7 +876,6 @@ class dblayer extends PDO $i = 0; foreach ($this->foreign as $field=>$k) { - $sql .= ",\n FOREIGN KEY(`$field`) REFERENCES `".$k[0]."`(`". $k[1]."`)"; if (isset ($k[2])) @@ -936,7 +935,7 @@ class dblayer extends PDO if ($this->primary === $field) $sql .= " PRIMARY KEY"; // Others parameters for field - // Sort to put the autoincrement field in front of params, if it is + // Sort to put the autoincrement field in front of params, if it is // present sort ($params); foreach ($params as $p) @@ -988,7 +987,7 @@ class dblayer extends PDO echo "$sql\n"; return $this->db->exec($sql); } - + /** This function permit to send a SQL request to the database to do a SELECT Return the an array with the datas */ public function directRead ($sql) @@ -1007,7 +1006,7 @@ error_reporting (E_ALL); require_once ("domframework/dbLayer.php"); class zone extends dbLayer { - // The database must be initialized with + // The database must be initialized with // CREATE TABLE `dns_zones` (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, // zone VARCHAR(255) NOT NULL, // viewname VARCHAR(255), @@ -1015,7 +1014,7 @@ class zone extends dbLayer // comment VARCHAR(1024), // opendate DATETIME NOT NULL, // closedate DATETIME, - // UNIQUE (zone,viewname)); + // UNIQUE (zone,viewname)); protected $table = "dns_zones"; protected $fields = array ( "id"=>array ("integer", "not null", "autoincrement"), @@ -1032,7 +1031,8 @@ class zone extends dbLayer ini_set ("date.timezone", "Europe/Paris"); $zone = new zone ("sqlite:datas/database.db"); -$last = $zone->create (array ("zone"=>"testZone", "opendate"=>date("Y-m-d H:i:s"))); +$last = $zone->create (array ("zone"=>"testZone", + "opendate"=>date("Y-m-d H:i:s"))); //print_r ($zone->read ()); $zone->update (2040, array ("zone"=>"testZone2")); print_r ($zone->delete ($last)); diff --git a/debian/changelog b/debian/changelog index dcceee3..a88b328 100644 --- a/debian/changelog +++ b/debian/changelog @@ -39,7 +39,7 @@ domframework (0.4-1) testing; urgency=low domframework (0.3-1) testing; urgency=low * dbLayer : Create a operationnal list table for sqlite/mysql/pgsql - * authorization model + * authorization model -- Dominique Fournier Fri, 20 Jun 2014 15:18:47 +0100 domframework (0.2-1) testing; urgency=low diff --git a/debian/control b/debian/control index 56398f2..8bf24fd 100644 --- a/debian/control +++ b/debian/control @@ -12,4 +12,3 @@ Recommends: php5-cli Description: PHP Framework with basic functionnalities The DomFramework allow the developpers to create easily some PHP applications. Provide authentication, abstraction to databases, and much more ! - diff --git a/debian/rules b/debian/rules index 31d4b64..ab27b0c 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ clean: dh_testdir dh_testroot - dh_clean + dh_clean install: build dh_testdir @@ -26,7 +26,7 @@ install: build binary: build install dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs # dh_installdocs # dh_installexamples # dh_install diff --git a/debian/watch b/debian/watch index dd8d5f6..d141575 100644 --- a/debian/watch +++ b/debian/watch @@ -6,7 +6,7 @@ # Compulsory line, this is a version 3 file version=3 -# Uncomment to examine a Webpage +# Uncomment to examine a Webpage # #http://www.example.com/downloads.php #PACKAGE#-(.*)\.tar\.gz diff --git a/docs/USAGE b/docs/USAGE index 43c0cdb..be9c6b2 100644 --- a/docs/USAGE +++ b/docs/USAGE @@ -103,7 +103,12 @@ Add the debug on routing with to help to see the matches. We can use some variables to be passed to the called function : - $route->get ("home3/{plo}/{str}", function ($str, $plo) {echo "$str $plo";}); + $route->get ("home3/{plo}/{str}", + function ($str, $plo) + { + echo "$str $plo"; + } + ); There is a special action named "redirect" in the "route" class. It provide the capability to re-route the Web browser to another page. Put in action : @@ -113,7 +118,8 @@ new page named "nextPage/". The FALSE will be change in case of modular application (see the MODULAR APPLICATION chapter) The Ending slash can be a problem and can be removed by using : - // If there is a no catch route ending with slash, try to reroute without slash + // If there is a no catch route ending with slash, try to reroute without + // slash $route->get ("{string}/", function ($string) { @@ -191,7 +197,7 @@ To use it : // Display the form echo $f->printHTML ("post", $values, $errors); -The fields are defined by : +The fields are defined by : - name : name of the field in the HTML page - label : label written to the describe the field - [titles] : text written in radio/checkboxes @@ -213,7 +219,7 @@ In case of error, an exception is raised. ------------------------ A database abstraction permits to forget if the database engine is MySQL, SQLite or PostgreSQL. It can read, insert, update easily from arrays, but display the -tables without having to think about the backend. +tables without having to think about the backend. It check the foreign keys before doing insertions/updates, look at unique constrains. It can create table with the different syntax of the engines. Define your table like this : @@ -239,7 +245,7 @@ Define your table like this : public $unique = array ("id"); /** The foreign keys of the table */ public $foreign = array ("zoneid"=>array ("dns_zones", "id", - "ON UPDATE CASCADE ON DELETE CASCADE")); + "ON UPDATE CASCADE ON DELETE CASCADE")); /** SQL Debug */ public $debug = FALSE; /** Translation */ diff --git a/form.php b/form.php index 5127a75..15c426b 100644 --- a/form.php +++ b/form.php @@ -143,8 +143,8 @@ die ("FORM/VERIFY : UNUSED and dirty\n"); $ret[$field->name] = $message; $field->error = $message; break; - } - } + } + } } if ($this->debug) { @@ -395,7 +395,7 @@ die ("FORM/VERIFY : UNUSED and dirty\n"); $res .= "