Remove all the too long lines
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3266 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
8
auth.php
8
auth.php
@@ -100,13 +100,9 @@ class auth
|
||||
$res .= " <input type='text' class='form-control' name='email' ";
|
||||
$res .= "placeholder='".dgettext("domframework",
|
||||
"Email address")."' required autofocus/>\n";
|
||||
$res .= " <input type='password' class='form-control' name='password' ";
|
||||
$res .= "placeholder='".dgettext("domframework",
|
||||
$res .= " <input type='password' class='form-control' name='password'";
|
||||
$res .= " placeholder='".dgettext("domframework",
|
||||
"Password")."' required/>\n";
|
||||
// $res .= " <label class='checkbox'>";
|
||||
// $res .= "<input type='checkbox' name='remember-me'/>".dgettext("domframework",
|
||||
// "Remember me");
|
||||
// $res .= "</label>\n";
|
||||
$res .= " <input type='submit' value='".dgettext("domframework",
|
||||
"Sign in")."'/>\n";
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class authsympa extends auth
|
||||
$this->authkey = $this->client->login ($email, $password);
|
||||
if ($this->authkey === null)
|
||||
throw new Exception (dgettext("domframework",
|
||||
"Can't connect with provided email/password to sympa"),
|
||||
"Can't connect with provided email/password to sympa"),
|
||||
401);
|
||||
$rc = $this->client->authenticateAndRun ($email, $this->authkey,
|
||||
'amI', array ($this->list, $this->function, $email));
|
||||
|
||||
10
dblayer.php
10
dblayer.php
@@ -837,8 +837,9 @@ class dblayer
|
||||
{
|
||||
if ($s[1] === null)
|
||||
continue;
|
||||
if ($this->debug) echo "DEBUG BIND : ".$s[0]."(".md5 ($s[0].$s[1]).")->".
|
||||
var_export ($s[1], TRUE)."\n";
|
||||
if ($this->debug)
|
||||
echo "DEBUG BIND : ".$s[0]."(".md5 ($s[0].$s[1]).")->".
|
||||
var_export ($s[1], TRUE)."\n";
|
||||
$st->bindValue (":".md5 ($s[0].$s[1]), $s[1]);
|
||||
}
|
||||
}
|
||||
@@ -846,8 +847,9 @@ class dblayer
|
||||
{
|
||||
foreach ($foreignSelect as $s)
|
||||
{
|
||||
if ($this->debug) echo "DEBUG BIND : ".$s[0]."(".md5 ($s[0].$s[1]).")->".
|
||||
var_export ($s[1], TRUE)."\n";
|
||||
if ($this->debug)
|
||||
echo "DEBUG BIND : ".$s[0]."(".md5 ($s[0].$s[1]).")->".
|
||||
var_export ($s[1], TRUE)."\n";
|
||||
$st->bindValue (":".md5 ($s[0].$s[1]), $s[1]);
|
||||
}
|
||||
}
|
||||
|
||||
3
imap.php
3
imap.php
@@ -224,7 +224,8 @@ class imap
|
||||
//////////////////////
|
||||
/// LIST MAILS ///
|
||||
//////////////////////
|
||||
/** Return an array of mailHeaders order by $field and by order ASC or DESC */
|
||||
/** Return an array of mailHeaders order by $field and by order ASC or DESC
|
||||
*/
|
||||
public function imapSortMail ($mailHeaders, $field, $orderAsc = TRUE)
|
||||
{
|
||||
if ($this->mailbox === null)
|
||||
|
||||
@@ -10,7 +10,8 @@ class ipaddresses
|
||||
public function validIPAddress ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$rc = $this->validIPv4Address ($ip);
|
||||
if ($rc === TRUE)
|
||||
return TRUE;
|
||||
@@ -22,7 +23,8 @@ class ipaddresses
|
||||
public function validIPv4Address ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv4 address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv4 address"),
|
||||
500);
|
||||
$rc = filter_var ($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
||||
if ($rc ===FALSE)
|
||||
return FALSE;
|
||||
@@ -33,22 +35,24 @@ class ipaddresses
|
||||
public function validIPv6Address ($ip)
|
||||
{
|
||||
if (!is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
$rc = filter_var ($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||
if ($rc ===FALSE)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Return the IPv6 uncompressed (all the fields exists). They are not filled by
|
||||
zeros
|
||||
/** Return the IPv6 uncompressed (all the fields exists). They are not filled
|
||||
by zeros
|
||||
If the provided IP is IPv4, there is no change applied
|
||||
Return False if the parameter is invalid
|
||||
Based on http://www.weberdev.com/get_example.php3?ExampleID=3921 */
|
||||
public function uncompressIPv6 ($ip)
|
||||
{
|
||||
if (! is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
500);
|
||||
if (strstr ($ip,"::"))
|
||||
{
|
||||
$e = explode (":", $ip);
|
||||
@@ -84,9 +88,11 @@ class ipaddresses
|
||||
public function groupIPv6 ($ipv6)
|
||||
{
|
||||
if (! is_string ($ipv6) || $ipv6 === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
if (substr_count ($ipv6, ".") !== 31)
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IPv6 address"),
|
||||
500);
|
||||
$ipv6 = str_replace (".", "", $ipv6);
|
||||
$new = "";
|
||||
for ($i = 0 ; $i < 32 ; $i++)
|
||||
@@ -101,11 +107,13 @@ class ipaddresses
|
||||
}
|
||||
|
||||
/* Return the IP adddress with filling the fields with the missing zeros.
|
||||
Valid only on IPv6 (but don't change anything if the provided address is IPv4) */
|
||||
Valid only on IPv6 (but don't change anything if the provided address is
|
||||
IPv4) */
|
||||
public function completeAddressWithZero ($ip)
|
||||
{
|
||||
if (! is_string ($ip) || $ip === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$ip = $this->uncompressIPv6 ($ip);
|
||||
if (substr_count ($ip, ":") === 7)
|
||||
{
|
||||
@@ -192,7 +200,8 @@ class ipaddresses
|
||||
function reverseIPAddress ($ipReverse)
|
||||
{
|
||||
if (!is_string ($ipReverse) || $ipReverse === "")
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"), 500);
|
||||
throw new \Exception (dgettext("domframework", "Invalid IP address"),
|
||||
500);
|
||||
$ipReverse = $this->completeAddressWithZero ($ipReverse);
|
||||
if (substr_count ($ipReverse, ":") === 7 && strlen ($ipReverse) == 39)
|
||||
{
|
||||
|
||||
3
mail.php
3
mail.php
@@ -893,7 +893,8 @@ class mail
|
||||
continue;
|
||||
if ($inline === true && substr ($disposition, 0, 6) === "inline")
|
||||
$res[] = $sectionID;
|
||||
elseif ($inline === false && substr ($disposition, 0, 10) === "attachment")
|
||||
elseif ($inline === false &&
|
||||
substr ($disposition, 0, 10) === "attachment")
|
||||
$res[] = $sectionID;
|
||||
}
|
||||
return $res;
|
||||
|
||||
@@ -135,7 +135,8 @@ class renderer
|
||||
break;
|
||||
}
|
||||
$dataflash .= " alert-dismissable'>\n";
|
||||
$dataflash .= "<button type='button' class='close' data-dismiss='alert'";
|
||||
$dataflash .= "<button type='button' class='close' ".
|
||||
"data-dismiss='alert'";
|
||||
$dataflash .= " aria-hidden='true'>×</button>\n";
|
||||
$dataflash .= "<strong>$alert</strong> ".$flash[1]."\n";
|
||||
$dataflash .= "</div>\n";
|
||||
|
||||
506
routeSQL.php
506
routeSQL.php
@@ -296,10 +296,10 @@ $content .= "</li>\n";
|
||||
/** Create the routes for REST pages and the associated actions */
|
||||
public function routesREST ()
|
||||
{
|
||||
$route = new route ();
|
||||
$route = new route ();
|
||||
$route->debug = $this->debug;;
|
||||
$route->allowSlashes=false;
|
||||
$route->get ("rest/".$this->url_prefix."(\.{extension})?".
|
||||
$route->get ("rest/".$this->url_prefix."(\.{extension})?".
|
||||
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
|
||||
function ($extension, $p1, $v1, $p2, $v2, $p3, $v3, $chain=null)
|
||||
{
|
||||
@@ -340,7 +340,7 @@ $content .= "</li>\n";
|
||||
throw new Exception (dgettext("domframework","Extension not allowed"),
|
||||
403);
|
||||
$search = rawurldecode ($search);
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
$titles = $this->objectDB->titles ();
|
||||
unset ($titles[$this->chainedForeign]);
|
||||
$foreignSelect = null;
|
||||
@@ -580,21 +580,21 @@ $content .= "</li>\n";
|
||||
$this->url_prefix = $this->chained->url_prefix."/{chain}/".
|
||||
$this->url_prefix;
|
||||
}
|
||||
/** Add HTML routes */
|
||||
$route = new route ();
|
||||
/** Add HTML routes */
|
||||
$route = new route ();
|
||||
$route->debug = $this->debug;;
|
||||
$route->allowSlashes=false;
|
||||
$route->get ($this->url_prefix."/", function ($chain=null) use ($route)
|
||||
$route->get ($this->url_prefix."/", function ($chain=null) use ($route)
|
||||
{
|
||||
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix),
|
||||
"");
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix.
|
||||
$route->get ($this->url_prefix.
|
||||
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
|
||||
function ($p1, $v1, $p2, $v2, $p3, $v3, $chain=null) use ($route)
|
||||
{
|
||||
// List all the objects of the table
|
||||
{
|
||||
// List all the objects of the table
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
if ($this->chained->accessright ($this->authHTML["email"], $chain) !==
|
||||
@@ -660,7 +660,7 @@ $content .= "</li>\n";
|
||||
//echo "NUM=$num\n";
|
||||
//echo "SEARCH=$search\n";
|
||||
//$route->debug=$this->debug;
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
$csrf = new csrf ();
|
||||
$token = $csrf->createToken ();
|
||||
$titles = $this->objectDB->titles ();
|
||||
@@ -762,44 +762,174 @@ $content .= "</li>\n";
|
||||
if ($this->enableInternalCSS === true)
|
||||
{
|
||||
$content .= "<style type='text/css' scoped='scoped'>\n";
|
||||
$content .= ".routeSQL { width:95%; margin-left:auto; margin-right:auto; }\n";
|
||||
$content .= ".routeSQL a { text-decoration:none; }\n";
|
||||
$content .= ".routeSQL .topBar { display: block; overflow: auto; }\n";
|
||||
$content .= ".routeSQL .topBar .topleft { display: inline; float:left; }\n";
|
||||
$content .= ".routeSQL .topBar .topright { display: inline; float:right; }\n";
|
||||
$content .= ".routeSQL .bottomBar { display: block; overflow: auto; }\n";
|
||||
$content .= ".routeSQL .bottomBar .bottomleft { display: inline; float:left; }\n";
|
||||
$content .= ".routeSQL .bottomBar .bottomright { display: inline; float:right; }\n";
|
||||
$content .= ".routeSQL .actionExtern { border:1px solid #ddd; border-radius:5px; padding:0px; margin:3px; float:left; }\n";
|
||||
$content .= ".routeSQL .actionExtern a { display: block; padding : 9px; }\n";
|
||||
$content .= ".routeSQL .numberEntryByDisplayArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
|
||||
$content .= ".routeSQL .searchArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
|
||||
$content .= ".routeSQL .searchArea form { margin:-1px; }\n";
|
||||
$content .= ".routeSQL .numberEntryByDisplayArea form { margin:-3px; }\n";
|
||||
$content .= ".routeSQL .informationArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
|
||||
$content .= ".routeSQL div.paginatorArea { float:left; }\n";
|
||||
$content .= ".routeSQL div.paginatorArea>ul>li>a { display: block; }\n";
|
||||
$content .= ".routeSQL ul.paginatorArea { list-style-type:none; margin: 0px; padding:0px; border:1px solid #ddd; border-radius:5px; }\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected { background-color: #04d; padding:0px;}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected:first-child { border-top-left-radius: 5px; border-bottom-left-radius: 5px;}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected:last-child { border-top-right-radius: 5px; border-bottom-right-radius: 5px;}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected a { padding : 10px;color:white; font-weight:bold; }\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li a { padding : 10px }\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li { display: inline-block; }\n";
|
||||
$content .= ".routeSQL table { width:100%;overflow:auto; border-collapse:collapse; }\n";
|
||||
$content .= ".routeSQL table tr { border-top:1px solid #ccc;}\n";
|
||||
$content .= ".routeSQL table th { border-bottom:3px solid #ccc; border-top:1px solid #fff; padding:9px 5px 9px 1px; }\n";
|
||||
$content .= ".routeSQL table td { empty-cells:true; padding:9px 5px 9px 1px; }\n";
|
||||
$content .= ".routeSQL table .noentry { text-align:center; color:#c00; font-weight:bolder; }\n";
|
||||
$content .= ".routeSQL table .action { text-align:left; padding-left: 8px; }\n";
|
||||
$content .= ".routeSQL table .action .edit { color:#222; font-weight:bolder;}\n";
|
||||
$content .= ".routeSQL table .action .delete { color:#c00; font-weight:bolder; }\n";
|
||||
$content .= ".routeSQL table .odd { background-color:#f9f9f9; }\n";
|
||||
$content .= ".routeSQL .alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
|
||||
$content .= ".routeSQL .alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
|
||||
$content .= ".routeSQL .alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
|
||||
$content .= ".routeSQL .alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
|
||||
$content .= ".routeSQL .alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
|
||||
$content .= ".routeSQL {
|
||||
width:95%;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}\n";
|
||||
$content .= ".routeSQL a {
|
||||
text-decoration:none;
|
||||
}\n";
|
||||
$content .= ".routeSQL .topBar {
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}\n";
|
||||
$content .= ".routeSQL .topBar .topleft {
|
||||
display: inline;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL .topBar .topright {
|
||||
display: inline;
|
||||
float:right;
|
||||
}\n";
|
||||
$content .= ".routeSQL .bottomBar {
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}\n";
|
||||
$content .= ".routeSQL .bottomBar .bottomleft {
|
||||
display: inline;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL .bottomBar .bottomright {
|
||||
display: inline;
|
||||
float:right;
|
||||
}\n";
|
||||
$content .= ".routeSQL .actionExtern {
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
padding:0px;
|
||||
margin:3px;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL .actionExtern a {
|
||||
display: block;
|
||||
padding : 9px;
|
||||
}\n";
|
||||
$content .= ".routeSQL .numberEntryByDisplayArea {
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
padding:10px;
|
||||
margin:3px;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL .searchArea {
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
padding:10px;
|
||||
margin:3px;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL .searchArea form {
|
||||
margin:-1px;
|
||||
}\n";
|
||||
$content .= ".routeSQL .numberEntryByDisplayArea form {
|
||||
margin:-3px;
|
||||
}\n";
|
||||
$content .= ".routeSQL .informationArea {
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
padding:10px;
|
||||
margin:3px;
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL div.paginatorArea {
|
||||
float:left;
|
||||
}\n";
|
||||
$content .= ".routeSQL div.paginatorArea>ul>li>a {
|
||||
display: block;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea {
|
||||
list-style-type:none;
|
||||
margin: 0px;
|
||||
padding:0px;
|
||||
border:1px solid #ddd;
|
||||
border-radius:5px;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected {
|
||||
background-color: #04d;
|
||||
padding:0px;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected:first-child {
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected:last-child {
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li.selected a {
|
||||
padding : 10px;
|
||||
color:white;
|
||||
font-weight:bold;
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li a {
|
||||
padding : 10px
|
||||
}\n";
|
||||
$content .= ".routeSQL ul.paginatorArea li {
|
||||
display: inline-block;
|
||||
}\n";
|
||||
$content .= ".routeSQL table {
|
||||
width:100%;
|
||||
overflow:auto;
|
||||
border-collapse:collapse;
|
||||
}\n";
|
||||
$content .= ".routeSQL table tr {
|
||||
border-top:1px solid #ccc;
|
||||
}\n";
|
||||
$content .= ".routeSQL table th {
|
||||
border-bottom:3px solid #ccc;
|
||||
border-top:1px solid #fff;
|
||||
padding:9px 5px 9px 1px;
|
||||
}\n";
|
||||
$content .= ".routeSQL table td {
|
||||
empty-cells:true;
|
||||
padding:9px 5px 9px 1px;
|
||||
}\n";
|
||||
$content .= ".routeSQL table .noentry {
|
||||
text-align:center;
|
||||
color:#c00;
|
||||
font-weight:bolder;
|
||||
}\n";
|
||||
$content .= ".routeSQL table .action {
|
||||
text-align:left;
|
||||
padding-left: 8px;
|
||||
}\n";
|
||||
$content .= ".routeSQL table .action .edit {
|
||||
color:#222;
|
||||
font-weight:bolder;
|
||||
}\n";
|
||||
$content .= ".routeSQL table .action .delete {
|
||||
color:#c00;
|
||||
font-weight:bolder;
|
||||
}\n";
|
||||
$content .= ".routeSQL table .odd {
|
||||
background-color:#f9f9f9;
|
||||
}\n";
|
||||
$content .= ".routeSQL .alert {
|
||||
border-radius: 4px ;
|
||||
border-width: 1px;
|
||||
padding:10px;
|
||||
}\n";
|
||||
$content .= ".routeSQL .alert-success {
|
||||
border-color: #d6e9c6;
|
||||
background-color: #dff0d8;
|
||||
color: #3c763d
|
||||
}\n";
|
||||
$content .= ".routeSQL .alert-info {
|
||||
border-color: #bce8f1;
|
||||
background-color: #d9edf7;
|
||||
color: #31708f;
|
||||
}\n";
|
||||
$content .= ".routeSQL .alert-warning {
|
||||
border-color: #faebcc;
|
||||
background-color: #fcf8e3;
|
||||
color: #8a6d3b;
|
||||
}\n";
|
||||
$content .= ".routeSQL .alert-danger {
|
||||
border-color: #ebccd1;
|
||||
background-color: #f2dede;
|
||||
color: #a94442;
|
||||
}\n";
|
||||
$content .= "</style>\n";
|
||||
}
|
||||
$content .= "<div class='routeSQL'>\n";
|
||||
@@ -920,12 +1050,12 @@ $content .= "</li>\n";
|
||||
$content .= " </div>\n"; // End of bottomBar
|
||||
$content .= "</div>\n";
|
||||
$this->rendererhtml ($content);
|
||||
});
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/{id}/delete/{token}",
|
||||
$route->get ($this->url_prefix."/{id}/delete/{token}",
|
||||
function ($id, $token, $chain=null)
|
||||
{
|
||||
// Delete an existing object if the token is valid
|
||||
{
|
||||
// Delete an existing object if the token is valid
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
if ($this->chained->editright ($this->authHTML["email"], $chain) !==
|
||||
@@ -961,7 +1091,7 @@ $content .= "</li>\n";
|
||||
if ($this->readonly ($this->authHTML["email"], $id) === TRUE)
|
||||
throw new Exception (dgettext("domframework","Access forbidden"), 403);
|
||||
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
$csrf = new csrf ();
|
||||
$renderer = new renderer ();
|
||||
$route = new route ();
|
||||
@@ -982,10 +1112,10 @@ $content .= "</li>\n";
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/add", function ($chain=null)
|
||||
{
|
||||
$route->get ($this->url_prefix."/add", function ($chain=null)
|
||||
{
|
||||
// Add a new entry : form to be filled by the user
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -1022,7 +1152,7 @@ $content .= "</li>\n";
|
||||
if ($this->readonly ($this->authHTML["email"]) === TRUE)
|
||||
throw new Exception (dgettext("domframework","Access forbidden"), 403);
|
||||
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
|
||||
// Get the non mandatory foreign keys and display them instead of the
|
||||
// unusable id
|
||||
@@ -1076,29 +1206,101 @@ $content .= "</li>\n";
|
||||
{
|
||||
// CSS is in edit an id too !
|
||||
$content .= "<style type='text/css' scoped='scoped'>\n";
|
||||
$content .= "#form .col-sm-2 { float:left; width: 16.66666667%; padding-left:15px;padding-right:15px;};\n";
|
||||
$content .= "#form .col-sm-10 {float:left; width: 83.33333333%; }\n";
|
||||
$content .= "#form .col-sm-12 { width: 100%; }\n";
|
||||
$content .= "#form input[type='submit'] { width:93%; margin-left:auto;margin-right:auto}\n";
|
||||
$content .= "#form .btn-primary { color: #fff; background-color: #428bca; border-color: #357ebd; }\n";
|
||||
|
||||
|
||||
$content .= ".help-block { margin-left:16.7%;display: block; color:#a94442;} \n";
|
||||
$content .= "#form input[type='text'] { background-color:#fff;}\n";
|
||||
$content .= "#form .has-error label { color:#a94442; }\n";
|
||||
$content .= "#form .has-error .form-control { border-color:#a94442; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; }\n";
|
||||
$content .= ".form-group { margin-bottom: 15px; }\n";
|
||||
$content .= ".form-horizontal .control-label { text-align: right; }\n";
|
||||
$content .= "label { display: inline-block; font-weight: 700; }\n";
|
||||
$content .= ".form-control { display: block; border-radius: 4px;padding-top: 6px; padding-right: 12px; padding-bottom: 6px; padding-left: 12px; width: 80%; }\n";
|
||||
$content .= "* { box-sizing: border-box;}\n";
|
||||
$content .= "button, input, optgroup, select, textarea { margin:0px 0px 0px 0px; }\n";
|
||||
$content .= "#form .form-control[disabled], #form .form-control[readonly], #form fieldset[disabled] .form-control { cursor: not-allowed; background-color: #eee; opacity: 1; }\n";
|
||||
$content .= ".alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
|
||||
$content .= ".alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
|
||||
$content .= ".alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
|
||||
$content .= ".alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
|
||||
$content .= ".alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
|
||||
$content .= "#form .col-sm-2 {
|
||||
float:left;
|
||||
width: 16.66666667%;
|
||||
padding-left:15px;
|
||||
padding-right:15px;
|
||||
};\n";
|
||||
$content .= "#form .col-sm-10 {
|
||||
float:left;
|
||||
width: 83.33333333%;
|
||||
}\n";
|
||||
$content .= "#form .col-sm-12 {
|
||||
width: 100%;
|
||||
}\n";
|
||||
$content .= "#form input[type='submit'] {
|
||||
width:93%;
|
||||
margin-left:auto;
|
||||
margin-right:auto
|
||||
}\n";
|
||||
$content .= "#form .btn-primary {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
}\n";
|
||||
$content .= ".help-block {
|
||||
margin-left:16.7%;
|
||||
display: block;
|
||||
color:#a94442;
|
||||
} \n";
|
||||
$content .= "#form input[type='text'] {
|
||||
background-color:#fff;
|
||||
}\n";
|
||||
$content .= "#form .has-error label {
|
||||
color:#a94442;
|
||||
}\n";
|
||||
$content .= "#form .has-error .form-control {
|
||||
border-color:#a94442;
|
||||
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
|
||||
}\n";
|
||||
$content .= ".form-group {
|
||||
margin-bottom: 15px;
|
||||
}\n";
|
||||
$content .= ".form-horizontal .control-label {
|
||||
text-align: right;
|
||||
}\n";
|
||||
$content .= "label {
|
||||
display: inline-block;
|
||||
font-weight: 700;
|
||||
}\n";
|
||||
$content .= ".form-control {
|
||||
display: block;
|
||||
border-radius: 4px;
|
||||
padding-top: 6px;
|
||||
padding-right: 12px;
|
||||
padding-bottom: 6px;
|
||||
padding-left: 12px;
|
||||
width: 80%;
|
||||
}\n";
|
||||
$content .= "* {
|
||||
box-sizing: border-box;
|
||||
}\n";
|
||||
$content .= "button, input, optgroup, select, textarea {
|
||||
margin:0px 0px 0px 0px;
|
||||
}\n";
|
||||
$content .= "#form .form-control[disabled],
|
||||
#form .form-control[readonly],
|
||||
#form fieldset[disabled] .form-control {
|
||||
cursor: not-allowed;
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}\n";
|
||||
$content .= ".alert {
|
||||
border-radius: 4px ;
|
||||
border-width: 1px;
|
||||
padding:10px;
|
||||
}\n";
|
||||
$content .= ".alert-success {
|
||||
border-color: #d6e9c6;
|
||||
background-color: #dff0d8;
|
||||
color: #3c763d
|
||||
}\n";
|
||||
$content .= ".alert-info {
|
||||
border-color: #bce8f1;
|
||||
background-color: #d9edf7;
|
||||
color: #31708f;
|
||||
}\n";
|
||||
$content .= ".alert-warning {
|
||||
border-color: #faebcc;
|
||||
background-color: #fcf8e3;
|
||||
color: #8a6d3b;
|
||||
}\n";
|
||||
$content .= ".alert-danger {
|
||||
border-color: #ebccd1;
|
||||
background-color: #f2dede;
|
||||
color: #a94442;
|
||||
}\n";
|
||||
$content .= "</style>\n";
|
||||
// CSS is in edit an id too !
|
||||
}
|
||||
@@ -1141,10 +1343,10 @@ $content .= "</li>\n";
|
||||
$f->fields ($fields);
|
||||
$content .= $f->printHTML ("post", $values, $errors);
|
||||
$this->rendererhtml ($content);
|
||||
});
|
||||
});
|
||||
|
||||
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
|
||||
{
|
||||
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
|
||||
{
|
||||
// Add a new entry : effective save of the data
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -1181,7 +1383,7 @@ $content .= "</li>\n";
|
||||
if ($this->readonly ($this->authHTML["email"]) === TRUE)
|
||||
throw new Exception (dgettext("domframework","Access forbidden"), 403);
|
||||
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
$f = new form ();
|
||||
$values = $f->values ();
|
||||
$errorsChain = array ();
|
||||
@@ -1223,10 +1425,10 @@ $content .= "</li>\n";
|
||||
$route->redirect ("/".str_replace("{chain}", $chain, $this->url_prefix).
|
||||
"/add", "");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
{
|
||||
$route->get ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
{
|
||||
// List the details of one existing object
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -1261,7 +1463,7 @@ $content .= "</li>\n";
|
||||
$id);
|
||||
$readonly = $this->readonly ($this->authHTML["email"], $id);
|
||||
|
||||
$this->connect();
|
||||
$this->connect();
|
||||
// Get the non mandatory foreign keys and display them instead of the
|
||||
// unusable id
|
||||
$foreignData = array ();
|
||||
@@ -1318,29 +1520,101 @@ $content .= "</li>\n";
|
||||
{
|
||||
// CSS is in add too !
|
||||
$content .= "<style type='text/css' scoped='scoped'>\n";
|
||||
$content .= "#form .col-sm-2 { float:left; width: 16.66666667%; padding-left:15px;padding-right:15px;};\n";
|
||||
$content .= "#form .col-sm-10 {float:left; width: 83.33333333%; }\n";
|
||||
$content .= "#form .col-sm-12 { width: 100%; }\n";
|
||||
$content .= "#form input[type='submit'] { width:93%; margin-left:auto;margin-right:auto}\n";
|
||||
$content .= "#form .btn-primary { color: #fff; background-color: #428bca; border-color: #357ebd; }\n";
|
||||
|
||||
|
||||
$content .= ".help-block { margin-left:16.7%;display: block; color:#a94442;} \n";
|
||||
$content .= "#form input[type='text'] { background-color:#fff;}\n";
|
||||
$content .= "#form .has-error label { color:#a94442; }\n";
|
||||
$content .= "#form .has-error .form-control { border-color:#a94442; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; }\n";
|
||||
$content .= ".form-group { margin-bottom: 15px; }\n";
|
||||
$content .= ".form-horizontal .control-label { text-align: right; }\n";
|
||||
$content .= "label { display: inline-block; font-weight: 700; }\n";
|
||||
$content .= ".form-control { display: block; border-radius: 4px;padding-top: 6px; padding-right: 12px; padding-bottom: 6px; padding-left: 12px; width: 80%; }\n";
|
||||
$content .= "* { box-sizing: border-box;}\n";
|
||||
$content .= "button, input, optgroup, select, textarea { margin:0px 0px 0px 0px; }\n";
|
||||
$content .= "#form .form-control[disabled], #form .form-control[readonly], #form fieldset[disabled] .form-control { cursor: not-allowed; background-color: #eee; opacity: 1; }\n";
|
||||
$content .= ".alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
|
||||
$content .= ".alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
|
||||
$content .= ".alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
|
||||
$content .= ".alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
|
||||
$content .= ".alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
|
||||
$content .= "#form .col-sm-2 {
|
||||
float:left;
|
||||
width: 16.66666667%;
|
||||
padding-left:15px;
|
||||
padding-right:15px;
|
||||
};\n";
|
||||
$content .= "#form .col-sm-10 {
|
||||
float:left;
|
||||
width: 83.33333333%;
|
||||
}\n";
|
||||
$content .= "#form .col-sm-12 {
|
||||
width: 100%;
|
||||
}\n";
|
||||
$content .= "#form input[type='submit'] {
|
||||
width:93%;
|
||||
margin-left:auto;
|
||||
margin-right:auto
|
||||
}\n";
|
||||
$content .= "#form .btn-primary {
|
||||
color: #fff;
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
}\n";
|
||||
$content .= ".help-block {
|
||||
margin-left:16.7%;
|
||||
display: block;
|
||||
color:#a94442;
|
||||
} \n";
|
||||
$content .= "#form input[type='text'] {
|
||||
background-color:#fff;
|
||||
}\n";
|
||||
$content .= "#form .has-error label {
|
||||
color:#a94442;
|
||||
}\n";
|
||||
$content .= "#form .has-error .form-control {
|
||||
border-color:#a94442;
|
||||
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
|
||||
}\n";
|
||||
$content .= ".form-group {
|
||||
margin-bottom: 15px;
|
||||
}\n";
|
||||
$content .= ".form-horizontal .control-label {
|
||||
text-align: right;
|
||||
}\n";
|
||||
$content .= "label {
|
||||
display: inline-block;
|
||||
font-weight: 700;
|
||||
}\n";
|
||||
$content .= ".form-control {
|
||||
display: block;
|
||||
border-radius: 4px;
|
||||
padding-top: 6px;
|
||||
padding-right: 12px;
|
||||
padding-bottom: 6px;
|
||||
padding-left: 12px;
|
||||
width: 80%;
|
||||
}\n";
|
||||
$content .= "* {
|
||||
box-sizing: border-box;
|
||||
}\n";
|
||||
$content .= "button, input, optgroup, select, textarea {
|
||||
margin:0px 0px 0px 0px;
|
||||
}\n";
|
||||
$content .= "#form .form-control[disabled],
|
||||
#form .form-control[readonly],
|
||||
#form fieldset[disabled] .form-control {
|
||||
cursor: not-allowed;
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}\n";
|
||||
$content .= ".alert {
|
||||
border-radius: 4px ;
|
||||
border-width: 1px;
|
||||
padding:10px;
|
||||
}\n";
|
||||
$content .= ".alert-success {
|
||||
border-color: #d6e9c6;
|
||||
background-color: #dff0d8;
|
||||
color: #3c763d
|
||||
}\n";
|
||||
$content .= ".alert-info {
|
||||
border-color: #bce8f1;
|
||||
background-color: #d9edf7;
|
||||
color: #31708f;
|
||||
}\n";
|
||||
$content .= ".alert-warning {
|
||||
border-color: #faebcc;
|
||||
background-color: #fcf8e3;
|
||||
color: #8a6d3b;
|
||||
}\n";
|
||||
$content .= ".alert-danger {
|
||||
border-color: #ebccd1;
|
||||
background-color: #f2dede;
|
||||
color: #a94442;
|
||||
}\n";
|
||||
$content .= "</style>\n";
|
||||
// CSS is in add too !
|
||||
}
|
||||
@@ -1388,12 +1662,12 @@ $content .= "</li>\n";
|
||||
$f->fields ($fields);
|
||||
$content .= $f->printHTML ("post", $values, $errors);
|
||||
$this->rendererhtml ($content);
|
||||
});
|
||||
});
|
||||
|
||||
$route->post ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
$route->post ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
use ($route)
|
||||
{
|
||||
// Save the details of one existing object
|
||||
{
|
||||
// Save the details of one existing object
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
if ($this->chained->editright ($this->authHTML["email"], $chain) !==
|
||||
@@ -1479,7 +1753,7 @@ $content .= "</li>\n";
|
||||
$_SESSION["domframework"]["routeSQL"]["values"] = $values;
|
||||
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix).
|
||||
"/$id", "");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** Authorization : Return TRUE if the user right allow to see the data
|
||||
|
||||
@@ -5,17 +5,20 @@ require_once ("domframework/markdown.php");
|
||||
|
||||
if (! isset ($argv[1]))
|
||||
{
|
||||
file_put_contents ("php://stderr", "No file to convert in markdown provided\n");
|
||||
file_put_contents ("php://stderr",
|
||||
"No file to convert in markdown provided\n");
|
||||
exit (1);
|
||||
}
|
||||
if (! file_exists ($argv[1]))
|
||||
{
|
||||
file_put_contents ("php://stderr", "The file to convert in markdown doesn't exists\n");
|
||||
file_put_contents ("php://stderr",
|
||||
"The file to convert in markdown doesn't exists\n");
|
||||
exit (2);
|
||||
}
|
||||
if (! is_readable ($argv[1]))
|
||||
{
|
||||
file_put_contents ("php://stderr", "The file to convert in markdown is not readable\n");
|
||||
file_put_contents ("php://stderr",
|
||||
"The file to convert in markdown is not readable\n");
|
||||
exit (3);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user