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
This commit is contained in:
2014-08-01 07:11:14 +00:00
parent e823248ff7
commit 9fef934b71
29 changed files with 87 additions and 78 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase
$this->assertEquals ("DATA_TO_STORE", $res); $this->assertEquals ("DATA_TO_STORE", $res);
} }
public function testDel1 () public function testDel1 ()
{ {
$c = new cachefile (); $c = new cachefile ();
$res = $c->delete ("id"); $res = $c->delete ("id");
+7 -4
View File
@@ -185,7 +185,7 @@ class test_markdown extends PHPUnit_Framework_TestCase
</ul>"); </ul>");
$md = new markdown (); $md = new markdown ();
printf ($md->html ("* line1 printf ($md->html ("* line1
end end
* line2 * line2
end")); end"));
} }
@@ -244,21 +244,24 @@ base</code></pre>");
// Links // Links
public function testLinkHTTP1 () public function testLinkHTTP1 ()
{ {
$this->expectOutputString("<p><a href='http://example.com'>http://example.com</a></p>"); $this->expectOutputString(
"<p><a href='http://example.com'>http://example.com</a></p>");
$md = new markdown (); $md = new markdown ();
printf ($md->html ("<http://example.com>")); printf ($md->html ("<http://example.com>"));
} }
public function testLinkHTTP2 () public function testLinkHTTP2 ()
{ {
$this->expectOutputString("<p><a href='https://example.com'>https://example.com</a></p>"); $this->expectOutputString(
"<p><a href='https://example.com'>https://example.com</a></p>");
$md = new markdown (); $md = new markdown ();
printf ($md->html ("<https://example.com>")); printf ($md->html ("<https://example.com>"));
} }
public function testLinkHTTP3 () public function testLinkHTTP3 ()
{ {
$this->expectOutputString("<p><a href='mailto://test@example.com'>test@example.com</a></p>"); $this->expectOutputString(
"<p><a href='mailto://test@example.com'>test@example.com</a></p>");
$md = new markdown (); $md = new markdown ();
printf ($md->html ("<test@example.com>")); printf ($md->html ("<test@example.com>"));
} }
+1 -1
View File
@@ -12,7 +12,7 @@ class test_outputjson extends PHPUnit_Framework_TestCase
$this->expectOutputString("\"\""); $this->expectOutputString("\"\"");
$output = new outputjson (); $output = new outputjson ();
$output->out (""); $output->out ("");
} }
/** Entry string */ /** Entry string */
public function testoutputjson2 () public function testoutputjson2 ()
+2 -2
View File
@@ -79,7 +79,7 @@ class authldap extends auth
{ {
if ($this->ldapdnuser === NULL) if ($this->ldapdnuser === NULL)
throw new Exception ("No user authenticated !", 401); throw new Exception ("No user authenticated !", 401);
$search = ldap_search ($this->ldapconn, $this->ldapdnuser, $search = ldap_search ($this->ldapconn, $this->ldapdnuser,
$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);
@@ -120,7 +120,7 @@ class authldap extends auth
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], $datas[$key] = array ("lastname"=>$vals["sn"][0],
+1 -1
View File
@@ -188,7 +188,7 @@ class authorizationdb extends authorization
"ownerid"=>$ownerid, "ownerid"=>$ownerid,
"groupid"=>$groupid, "groupid"=>$groupid,
"modbits"=>$modbits)); "modbits"=>$modbits));
return TRUE; return TRUE;
} }
/** Remove the informations about an object and all its sub-objects /** Remove the informations about an object and all its sub-objects
+1 -1
View File
@@ -22,7 +22,7 @@ class authparams
if (!isset ($_SESSION["auth"]["email"]) || if (!isset ($_SESSION["auth"]["email"]) ||
!isset ($_SESSION["auth"]["password"])) !isset ($_SESSION["auth"]["password"]))
throw new Exception ("No previous email in session", 401); 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"]); "password"=>$_SESSION["auth"]["email"]);
} }
+3 -3
View File
@@ -5,15 +5,15 @@
require_once ("auth.php"); require_once ("auth.php");
/** User authentication against SYMPA server /** 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 username (a email adress)
- a password - 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 - a Sympa SOAP server WSDL
- the part of list which should be test : subscriber, owner, editor - 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 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. must be open between the Web server and the Sympa server.
POC : POC :
$auth = new authsympa (); $auth = new authsympa ();
$auth->wsdl = "https://lists.domain.tld/sympa/wsdl"; $auth->wsdl = "https://lists.domain.tld/sympa/wsdl";
$auth->list = "listtest@lists.domain.tld"; $auth->list = "listtest@lists.domain.tld";
+1 -1
View File
@@ -84,7 +84,7 @@ class cachefile
chmod ($this->directory, 0777); chmod ($this->directory, 0777);
} }
if (! is_writable ($this->directory)) 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); $this->directory), 500);
if (! is_readable ($this->directory)) if (! is_readable ($this->directory))
throw new Exception (sprintf (_("Cache directory %s is not readable"), throw new Exception (sprintf (_("Cache directory %s is not readable"),
+1 -1
View File
@@ -18,7 +18,7 @@ class cacheoutput
/** Current path at start due to lack of information in __destruct*/ /** Current path at start due to lack of information in __destruct*/
private $cacheCWD = null; private $cacheCWD = null;
/** /**
@param string $id The cache identifier @param string $id The cache identifier
@param integer|null $ttl The cache Time to Leave in seconds (60s by @param integer|null $ttl The cache Time to Leave in seconds (60s by
default) default)
+6 -6
View File
@@ -6,7 +6,7 @@
/** Allow to interract with controllers and models from the CLI */ /** Allow to interract with controllers and models from the CLI */
class cli class cli
{ {
/** Run in CLI mode with parameters /** Run in CLI mode with parameters
Example of cli code : Example of cli code :
#!/usr/bin/php5 #!/usr/bin/php5
<?php <?php
@@ -29,11 +29,13 @@ class cli
echo " $launcher -listmethods <class> : \n"; echo " $launcher -listmethods <class> : \n";
echo " display the methods available the controller class\n"; echo " display the methods available the controller class\n";
echo " $launcher -expert -listmethods <class> :\n"; echo " $launcher -expert -listmethods <class> :\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 <class> : \n"; echo " $launcher -listmethodsdetails <class> : \n";
echo " display the methods available the controller class\n"; echo " display the methods available the controller class\n";
echo " $launcher -expert -listmethodsdetails <class> :\n"; echo " $launcher -expert -listmethodsdetails <class> :\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 <class> <method> [args]\n"; echo " $launcher <class> <method> [args]\n";
echo " execute the method with the provided args\n"; echo " execute the method with the provided args\n";
echo " $launcher -expert <class> <method> [args]\n"; echo " $launcher -expert <class> <method> [args]\n";
@@ -66,7 +68,6 @@ class cli
// Lists the classes available in controllers and models if expert mode // Lists the classes available in controllers and models if expert mode
echo "List of classes available :\n"; echo "List of classes available :\n";
echo " ".implode ("\n ", $classes)."\n"; echo " ".implode ("\n ", $classes)."\n";
echo "Usage : ".$launcher; echo "Usage : ".$launcher;
if ($EXPERT) echo " -expert"; if ($EXPERT) echo " -expert";
echo " -listmethods <class>\n"; echo " -listmethods <class>\n";
@@ -131,7 +132,7 @@ class cli
else else
echo ">"; echo ">";
} }
if ($argv[0] === "-listmethodsdetails") if ($argv[0] === "-listmethodsdetails")
{ {
echo "\n"; echo "\n";
@@ -166,7 +167,6 @@ class cli
$found = TRUE; $found = TRUE;
break; break;
} }
} }
if ($found === FALSE) if ($found === FALSE)
+3 -4
View File
@@ -3,10 +3,10 @@
@package domframework @package domframework
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
/** 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 file
It is based on the module configuration defaults It is based on the module configuration defaults
POC : POC :
$config = new config(); $config = new config();
$config->default = array ("param"=>"default", $config->default = array ("param"=>"default",
"param2"=>array (1,2,3), "param2"=>array (1,2,3),
@@ -32,7 +32,6 @@ class config
public function params () public function params ()
{ {
return print_r ($this->default, TRUE); return print_r ($this->default, TRUE);
} }
/** Get the value of the provided parameter recorded in .php file /** Get the value of the provided parameter recorded in .php file
@@ -44,7 +43,7 @@ class config
throw new Exception ("Unknown parameter '$param'"); throw new Exception ("Unknown parameter '$param'");
if (!file_exists ($this->confFile)) if (!file_exists ($this->confFile))
{ {
if (@file_put_contents ($this->confFile, if (@file_put_contents ($this->confFile,
"<?php\r\n\$conf = array ();\r\n") "<?php\r\n\$conf = array ();\r\n")
=== FALSE) === FALSE)
throw new Exception (sprintf ( throw new Exception (sprintf (
+12 -12
View File
@@ -24,7 +24,7 @@ To use it, extends in your code this class, and define the attributes :
the dbLayer abstraction don't supports primary key on multiples columns the dbLayer abstraction don't supports primary key on multiples columns
- protected $unique = array ("column", array ("column1", "column2");) - protected $unique = array ("column", array ("column1", "column2");)
Optionnaly, you can add the Optionnaly, you can add the
- protected $debug = TRUE : enable the debug on screen (NOT FOR PROD !!) - protected $debug = TRUE : enable the debug on screen (NOT FOR PROD !!)
*/ */
@@ -444,7 +444,7 @@ class dblayer extends PDO
return $res; return $res;
} }
/** Update the key tuple with the provided datas /** Update the key tuple with the provided datas
Return the number of rows modified Return the number of rows modified
@param string|integer $updatekey The key applied on primary key to be @param string|integer $updatekey The key applied on primary key to be
updated updated
@@ -557,7 +557,7 @@ class dblayer extends PDO
} }
else else
{ {
// One column in unique // One column in unique
if (!array_key_exists ($columns, $datasOK)) continue; if (!array_key_exists ($columns, $datasOK)) continue;
$select = array (); $select = array ();
if ($columns === $this->primary) if ($columns === $this->primary)
@@ -690,7 +690,7 @@ class dblayer extends PDO
} }
/** Create the table defined by the differents fields. /** 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"; $table = "dns zones";
$fields = array ( $fields = array (
"id"=>array ("integer", "not null", "autoincrement"), "id"=>array ("integer", "not null", "autoincrement"),
@@ -755,7 +755,7 @@ class dblayer extends PDO
if ($this->primary === $field) if ($this->primary === $field)
$sql .= " PRIMARY KEY"; $sql .= " PRIMARY KEY";
// Others parameters for field // 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 // present
sort ($params); sort ($params);
foreach ($params as $p) foreach ($params as $p)
@@ -842,7 +842,7 @@ class dblayer extends PDO
if ($this->primary === $field) if ($this->primary === $field)
$sql .= " PRIMARY KEY"; $sql .= " PRIMARY KEY";
// Others parameters for field // 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 // present
sort ($params); sort ($params);
foreach ($params as $p) foreach ($params as $p)
@@ -876,7 +876,6 @@ class dblayer extends PDO
$i = 0; $i = 0;
foreach ($this->foreign as $field=>$k) foreach ($this->foreign as $field=>$k)
{ {
$sql .= ",\n FOREIGN KEY(`$field`) REFERENCES `".$k[0]."`(`". $sql .= ",\n FOREIGN KEY(`$field`) REFERENCES `".$k[0]."`(`".
$k[1]."`)"; $k[1]."`)";
if (isset ($k[2])) if (isset ($k[2]))
@@ -936,7 +935,7 @@ class dblayer extends PDO
if ($this->primary === $field) if ($this->primary === $field)
$sql .= " PRIMARY KEY"; $sql .= " PRIMARY KEY";
// Others parameters for field // 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 // present
sort ($params); sort ($params);
foreach ($params as $p) foreach ($params as $p)
@@ -988,7 +987,7 @@ class dblayer extends PDO
echo "$sql\n"; echo "$sql\n";
return $this->db->exec($sql); return $this->db->exec($sql);
} }
/** This function permit to send a SQL request to the database to do a SELECT /** This function permit to send a SQL request to the database to do a SELECT
Return the an array with the datas */ Return the an array with the datas */
public function directRead ($sql) public function directRead ($sql)
@@ -1007,7 +1006,7 @@ error_reporting (E_ALL);
require_once ("domframework/dbLayer.php"); require_once ("domframework/dbLayer.php");
class zone extends dbLayer 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, // CREATE TABLE `dns_zones` (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
// zone VARCHAR(255) NOT NULL, // zone VARCHAR(255) NOT NULL,
// viewname VARCHAR(255), // viewname VARCHAR(255),
@@ -1015,7 +1014,7 @@ class zone extends dbLayer
// comment VARCHAR(1024), // comment VARCHAR(1024),
// opendate DATETIME NOT NULL, // opendate DATETIME NOT NULL,
// closedate DATETIME, // closedate DATETIME,
// UNIQUE (zone,viewname)); // UNIQUE (zone,viewname));
protected $table = "dns_zones"; protected $table = "dns_zones";
protected $fields = array ( protected $fields = array (
"id"=>array ("integer", "not null", "autoincrement"), "id"=>array ("integer", "not null", "autoincrement"),
@@ -1032,7 +1031,8 @@ class zone extends dbLayer
ini_set ("date.timezone", "Europe/Paris"); ini_set ("date.timezone", "Europe/Paris");
$zone = new zone ("sqlite:datas/database.db"); $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 ()); //print_r ($zone->read ());
$zone->update (2040, array ("zone"=>"testZone2")); $zone->update (2040, array ("zone"=>"testZone2"));
print_r ($zone->delete ($last)); print_r ($zone->delete ($last));
+1 -1
View File
@@ -39,7 +39,7 @@ domframework (0.4-1) testing; urgency=low
domframework (0.3-1) testing; urgency=low domframework (0.3-1) testing; urgency=low
* dbLayer : Create a operationnal list table for sqlite/mysql/pgsql * dbLayer : Create a operationnal list table for sqlite/mysql/pgsql
* authorization model * authorization model
-- Dominique Fournier <dominique@fournier38.fr> Fri, 20 Jun 2014 15:18:47 +0100 -- Dominique Fournier <dominique@fournier38.fr> Fri, 20 Jun 2014 15:18:47 +0100
domframework (0.2-1) testing; urgency=low domframework (0.2-1) testing; urgency=low
-1
View File
@@ -12,4 +12,3 @@ Recommends: php5-cli
Description: PHP Framework with basic functionnalities Description: PHP Framework with basic functionnalities
The DomFramework allow the developpers to create easily some PHP applications. The DomFramework allow the developpers to create easily some PHP applications.
Provide authentication, abstraction to databases, and much more ! Provide authentication, abstraction to databases, and much more !
+2 -2
View File
@@ -12,7 +12,7 @@
clean: clean:
dh_testdir dh_testdir
dh_testroot dh_testroot
dh_clean dh_clean
install: build install: build
dh_testdir dh_testdir
@@ -26,7 +26,7 @@ install: build
binary: build install binary: build install
dh_testdir dh_testdir
dh_testroot dh_testroot
dh_installchangelogs dh_installchangelogs
# dh_installdocs # dh_installdocs
# dh_installexamples # dh_installexamples
# dh_install # dh_install
+1 -1
View File
@@ -6,7 +6,7 @@
# Compulsory line, this is a version 3 file # Compulsory line, this is a version 3 file
version=3 version=3
# Uncomment to examine a Webpage # Uncomment to examine a Webpage
# <Webpage URL> <string match> # <Webpage URL> <string match>
#http://www.example.com/downloads.php #PACKAGE#-(.*)\.tar\.gz #http://www.example.com/downloads.php #PACKAGE#-(.*)\.tar\.gz
+11 -5
View File
@@ -103,7 +103,12 @@ Add the debug on routing with
to help to see the matches. to help to see the matches.
We can use some variables to be passed to the called function : 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 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 : 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) application (see the MODULAR APPLICATION chapter)
The Ending slash can be a problem and can be removed by using : 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}/", $route->get ("{string}/",
function ($string) function ($string)
{ {
@@ -191,7 +197,7 @@ To use it :
// Display the form // Display the form
echo $f->printHTML ("post", $values, $errors); 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 - name : name of the field in the HTML page
- label : label written to the describe the field - label : label written to the describe the field
- [titles] : text written in radio/checkboxes - [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 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 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 It check the foreign keys before doing insertions/updates, look at unique
constrains. It can create table with the different syntax of the engines. constrains. It can create table with the different syntax of the engines.
Define your table like this : Define your table like this :
@@ -239,7 +245,7 @@ Define your table like this :
public $unique = array ("id"); public $unique = array ("id");
/** The foreign keys of the table */ /** The foreign keys of the table */
public $foreign = array ("zoneid"=>array ("dns_zones", "id", public $foreign = array ("zoneid"=>array ("dns_zones", "id",
"ON UPDATE CASCADE ON DELETE CASCADE")); "ON UPDATE CASCADE ON DELETE CASCADE"));
/** SQL Debug */ /** SQL Debug */
public $debug = FALSE; public $debug = FALSE;
/** Translation */ /** Translation */
+5 -5
View File
@@ -143,8 +143,8 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
$ret[$field->name] = $message; $ret[$field->name] = $message;
$field->error = $message; $field->error = $message;
break; break;
} }
} }
} }
if ($this->debug) if ($this->debug)
{ {
@@ -395,7 +395,7 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
$res .= " <option value='"; $res .= " <option value='";
$res .= htmlspecialchars ($key, ENT_QUOTES)."'"; $res .= htmlspecialchars ($key, ENT_QUOTES)."'";
if (isset ($values[$field->name]) && if (isset ($values[$field->name]) &&
is_string ($values[$field->name]) && is_string ($values[$field->name]) &&
$values[$field->name] == $key) $values[$field->name] == $key)
$res .= " selected='selected'"; $res .= " selected='selected'";
elseif (isset ($values[$field->name]) && elseif (isset ($values[$field->name]) &&
@@ -408,7 +408,7 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
} }
$res .= " </select>\n"; $res .= " </select>\n";
if (isset ($errors[$field->name])) if (isset ($errors[$field->name]))
$res .= " <span class='help-block'>".$errors[$field->name][1]. $res .= " <span class='help-block'>".$errors[$field->name][1].
"</span>\n"; "</span>\n";
} }
@@ -495,7 +495,7 @@ die ("FORM/VERIFY : UNUSED and dirty\n");
return $res; return $res;
} }
/** Check the token from the user /** Check the token from the user
@param string $tokenFromUser The value form the user's token */ @param string $tokenFromUser The value form the user's token */
public function checkToken ($tokenFromUser) public function checkToken ($tokenFromUser)
{ {
+2 -2
View File
@@ -8,7 +8,7 @@
class http class http
{ {
/** Choose the best choice from user choices. /** Choose the best choice from user choices.
Can be used for languages (HTTP_ACCEPT_LANGUAGE), type of pages Can be used for languages (HTTP_ACCEPT_LANGUAGE), type of pages
(HTTP_ACCEPT)... (HTTP_ACCEPT)...
Ex. fr, en-gb;q=0.8, en;q=0.7 Ex. fr, en-gb;q=0.8, en;q=0.7
Ex. text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8 Ex. text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8
@@ -65,7 +65,7 @@ class http
@param integer $code The HTTP code to translate in text */ @param integer $code The HTTP code to translate in text */
function codetext ($code) function codetext ($code)
{ {
switch ($code) switch ($code)
{ {
case 100: $text = 'Continue'; break; case 100: $text = 'Continue'; break;
case 101: $text = 'Switching Protocols'; break; case 101: $text = 'Switching Protocols'; break;
+2 -2
View File
@@ -26,7 +26,7 @@ class logger
public $timezone = "UTC"; public $timezone = "UTC";
/** Minimum log level in the logs */ /** Minimum log level in the logs */
public $loglevelmin = LOG_NOTICE; public $loglevelmin = LOG_NOTICE;
/** In Syslog mode, the facility to use /** In Syslog mode, the facility to use
See http://fr2.php.net/manual/en/function.openlog.php for $syslogFacility */ See http://fr2.php.net/manual/en/function.openlog.php for $syslogFacility */
public $syslogFacility = LOG_USER; public $syslogFacility = LOG_USER;
/** In Syslog, prefix the log by the text */ /** In Syslog, prefix the log by the text */
@@ -48,7 +48,7 @@ class logger
LOG_WARNING => "WARNING", LOG_WARNING => "WARNING",
LOG_NOTICE => "NOTICE", LOG_NOTICE => "NOTICE",
LOG_INFO => "INFO", LOG_INFO => "INFO",
LOG_DEBUG => "DEBUG"); LOG_DEBUG => "DEBUG");
/** Store a new message log in the log manager defined by $logtype /** Store a new message log in the log manager defined by $logtype
@param string $message Message to log @param string $message Message to log
+5 -3
View File
@@ -265,7 +265,8 @@ class markdown
// Remove last \n to put closing tag at the end of line // Remove last \n to put closing tag at the end of line
//$res = substr ($res, 0, -1); //$res = substr ($res, 0, -1);
$oldType = array_pop ($typeStack); $oldType = array_pop ($typeStack);
$this->debugMKD (str_repeat (" ", end ($indentStack))."</$oldType>"); $this->debugMKD (str_repeat (" ", end ($indentStack)).
"</$oldType>");
$res .= str_repeat (" ", end ($indentStack))."</$oldType>"; $res .= str_repeat (" ", end ($indentStack))."</$oldType>";
array_pop ($indentStack); array_pop ($indentStack);
array_pop ($htmlStack); array_pop ($htmlStack);
@@ -317,7 +318,8 @@ class markdown
{ {
$this->debugMKD ("DEB2 : CODE : Close older HTML"); $this->debugMKD ("DEB2 : CODE : Close older HTML");
$oldType = array_pop ($typeStack); $oldType = array_pop ($typeStack);
$this->debugMKD (str_repeat (" ", end ($indentStack))."</$oldType>"); $this->debugMKD (str_repeat (" ", end ($indentStack)).
"</$oldType>");
$res .= str_repeat (" ", end ($indentStack))."</$oldType>"; $res .= str_repeat (" ", end ($indentStack))."</$oldType>";
array_pop ($indentStack); array_pop ($indentStack);
array_pop ($htmlStack); array_pop ($htmlStack);
@@ -356,7 +358,7 @@ class markdown
array_pop ($htmlStack); array_pop ($htmlStack);
} }
// If code, there is no emphasis, email, and other conversions // If code, there is no emphasis, email, and other conversions
if ($type !== "code") if ($type !== "code")
{ {
$timetmp = microtime (TRUE); $timetmp = microtime (TRUE);
+1 -1
View File
@@ -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 datas 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)
{ {
+3 -3
View File
@@ -9,8 +9,8 @@ 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
title is put in the title of the HTML page title is put in the title of the HTML page
$replacement modify the result (it can do title too : $replacement modify the result (it can do title too :
array ("{title}"=>"title to display") array ("{title}"=>"title to display")
@param mixed $data Data to display on the page @param mixed $data Data to display on the page
@param string|null $title Title to put on head of page @param string|null $title Title to put on head of page
@param string|null $viewClass Class in views to use to display @param string|null $viewClass Class in views to use to display
@@ -43,7 +43,7 @@ class outputhtml extends output
$layoutPage = file_get_contents ("views/$layout.html"); $layoutPage = file_get_contents ("views/$layout.html");
$resView = str_replace ("{content}", $resView, $layoutPage); $resView = str_replace ("{content}", $resView, $layoutPage);
} }
// Do the title replacement in the replacement structure // Do the title replacement in the replacement structure
if (! isset ($replacement["{title}"])) if (! isset ($replacement["{title}"]))
$replacement["{title}"] = $title; $replacement["{title}"] = $title;
+1 -1
View File
@@ -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 datas 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)
{ {
+2 -2
View File
@@ -11,7 +11,7 @@ class renderer
/** The output type */ /** The output type */
public $output = NULL; public $output = NULL;
/** Title by default : space to be compatible with HTML5 */ /** Title by default : space to be compatible with HTML5 */
public $title = " "; public $title = " ";
/** Filename of class containing the presentation layer */ /** Filename of class containing the presentation layer */
public $viewClass = FALSE; public $viewClass = FALSE;
/** Method apply to class object to display the $result */ /** Method apply to class object to display the $result */
@@ -22,7 +22,7 @@ class renderer
public $replacement = array(); public $replacement = array();
/** Array to variable definition */ /** Array to variable definition */
public $variable = array (); public $variable = array ();
/** Display the $this->result result in the output model defined by /** Display the $this->result result in the output model defined by
$this->output */ $this->output */
public function run () public function run ()
+1 -1
View File
@@ -26,7 +26,7 @@ class rest
$type = $http->bestChoice ($_SERVER["HTTP_ACCEPT"], $this->allowedtypes, $type = $http->bestChoice ($_SERVER["HTTP_ACCEPT"], $this->allowedtypes,
$type); $type);
} }
require_once ("domframework/output$type.php"); require_once ("domframework/output$type.php");
$constr = "output$type"; $constr = "output$type";
$method = "out"; $method = "out";
+9 -9
View File
@@ -15,21 +15,21 @@ class route
public $method = ""; public $method = "";
/** The module name */ /** The module name */
public $module = NULL; public $module = NULL;
/** The debug mode : /** The debug mode :
0:NoDebug, 1:routing, 2:more debug (developpement)*/ 0:NoDebug, 1:routing, 2:more debug (developpement)*/
public $debug=0; public $debug=0;
//public $defaultOutput = "html"; // Default renderer : html //public $defaultOutput = "html"; // Default renderer : html
/** Return the baseURL of the site /** Return the baseURL of the site
Always finish with a slash Always finish with a slash
@param string|null $module The module name (if thereis one) */ @param string|null $module The module name (if thereis one) */
function baseURL ($module = FALSE) function baseURL ($module = FALSE)
{ {
if ($this->module === NULL) if ($this->module === NULL)
$this->module = $module; $this->module = $module;
if ($this->baseURL !== "") if ($this->baseURL !== "")
return $this->baseURL; return $this->baseURL;
if (!isset ($_SERVER["SERVER_PORT"])) if (!isset ($_SERVER["SERVER_PORT"]))
$_SERVER["SERVER_PORT"] = "80"; $_SERVER["SERVER_PORT"] = "80";
$port = ":".$_SERVER["SERVER_PORT"]; $port = ":".$_SERVER["SERVER_PORT"];
@@ -132,7 +132,7 @@ class route
if (substr ($destURL, 0, strlen ($baseURL)) !== $baseURL) if (substr ($destURL, 0, strlen ($baseURL)) !== $baseURL)
throw new Exception ("Can't redirect outside this site (Base $baseURL)", throw new Exception ("Can't redirect outside this site (Base $baseURL)",
405); 405);
if ($this->debug) if ($this->debug)
{ {
echo "<pre>\n"; echo "<pre>\n";
@@ -183,7 +183,7 @@ class route
ob_flush (); ob_flush ();
flush (); flush ();
} }
$class = $action[0]; $class = $action[0];
$method = $action[1]; $method = $action[1];
$params = array_slice ($action, 2); $params = array_slice ($action, 2);
@@ -298,7 +298,7 @@ class route
$rc = @include_once ("controllers/controller_$class.php"); $rc = @include_once ("controllers/controller_$class.php");
// For loading framework classes // For loading framework classes
if ($rc === FALSE) @include_once ("$class.php"); if ($rc === FALSE) @include_once ("$class.php");
try try
{ {
$reflection = new ReflectionMethod ($class, $method); $reflection = new ReflectionMethod ($class, $method);
@@ -364,13 +364,13 @@ class route
catch (Exception $e) catch (Exception $e)
{ {
} }
//echo "passConstruct=";print_r ($passConstruct); //echo "passConstruct=";print_r ($passConstruct);
// Check if the method need parameters // Check if the method need parameters
$reflection = new ReflectionMethod ($class, $method); $reflection = new ReflectionMethod ($class, $method);
$passMethod = array(); $passMethod = array();
//echo "getParameters=";var_dump ($reflection->getParameters()); //echo "getParameters=";var_dump ($reflection->getParameters());
foreach($reflection->getParameters() as $key=>$param) foreach($reflection->getParameters() as $key=>$param)
{ {
if (isset ($matches[$param->getName ()])) if (isset ($matches[$param->getName ()]))
$passMethod[] = $matches[$param->getName ()]; $passMethod[] = $matches[$param->getName ()];
@@ -426,7 +426,7 @@ class route
Throw an exception in case of error */ Throw an exception in case of error */
public function method () public function method ()
{ {
if (isset ($_POST["_METHOD"]) && if (isset ($_POST["_METHOD"]) &&
($_POST["_METHOD"] === "GET" || ($_POST["_METHOD"] === "GET" ||
$_POST["_METHOD"] === "POST" || $_POST["_METHOD"] === "POST" ||
$_POST["_METHOD"] === "PUT" || $_POST["_METHOD"] === "PUT" ||
-1
View File
@@ -128,6 +128,5 @@ class verify
if (strspn ($val, "0123456789") !== strlen ($val)) if (strspn ($val, "0123456789") !== strlen ($val))
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
} }
+2 -1
View File
@@ -5,7 +5,8 @@
/** This is the version of DomFramework. /** This is the version of DomFramework.
It can be used to test if the framework is uptodate for the application with : It can be used to test if the framework is uptodate for the application
with :
require ("domframework/version.php"); require ("domframework/version.php");
if (!defined ("DOMFRAMEWORK_VERSION") || if (!defined ("DOMFRAMEWORK_VERSION") ||
version_compare (DOMFRAMEWORK_VERSION, "0.6") < 0) version_compare (DOMFRAMEWORK_VERSION, "0.6") < 0)