Skip to content

Commit

Permalink
add setget setcookie
Browse files Browse the repository at this point in the history
  • Loading branch information
pbd-kn committed Dec 13, 2021
1 parent 5b90083 commit 1fc9b50
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ Contao is an Open Source PHP Content Management System for people who want a
professional website that is easy to maintain. Visit the [project website][1]
for more information.

inputvar stellt inserttags zum lesen von GET POST und SESSION Varibale zur Verfuegung
und zum setzten von Postvariablen

{{get::var[::opt]}}
{{post::var[::opt]}}
{{posthtml::var[::opt]}}
{{postraw::var[::opt]}}
{{cookie::cookie[::opt]}}
{{session::var[::opt]}}
{{setpost::var::value}
inputvar stellt inserttags zum lesen und schreiben von GET POST und SESSION Varibale zur Verfuegung

{{get::var[::opt]}} // variable aus _GET
{{post::var[::opt]}} // variable aus _POST
{{posthtml::var[::opt]}} // variable aus _POST (belaesst erlaubte HTML-Tags im Wert)
{{postraw::var[::opt]}} // variable aus _POST (ohne grosse Sicherheitsueberpruefung -> UNSICHER!)
{{cookie::cookie[::opt]}} // variable aus _COOKIE
{{session::var[::opt]}} // variable aus _SESSION
{{setpost::var::value} // setzt variable in _POST
{{setget::var::value} // setzt variable in _GET
{{setcookie::var::value} // setzt variable in _COOKIE

Gueltige FunktionsOptions

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pbd-kn/contao-inputvar-bundle",
"type": "contao-bundle",
"description": "get Input Variables",
"description": "get/set Input Variables",
"homepage": "https://contao.org",
"license": "LGPL-3.0-or-later",
"authors": [
Expand Down
19 changes: 18 additions & 1 deletion src/Resources/contao/Modules/InputVar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,31 @@ public function replaceInputVars($strTag)
$this->import('Contao\Input');
$varValue = $this->Input->post($arrTag[1]);
break;
case 'setpost:'
case 'setpost':
//$_POST Variable setzen
if ('' === arrTag[2]) return false;
$this->import('Contao\Input');
$this->Input->setPost($arrTag[1],$arrTag[2]);
$arrTag[2]=""; // damit nicht aus versehen mit opt ausgewertet
$varValue = "";
break;
case 'setget':
//$_GET Variable setzen
if ('' === arrTag[2]) return false;
$this->import('Contao\Input');
$this->Input->setGet($arrTag[1],$arrTag[2]);
$arrTag[2]=""; // damit nicht aus versehen mit opt ausgewertet
$varValue = "";
break;

case 'setcookie':
//$_COOKIE Variable setzen
if ('' === arrTag[2]) return false;
$this->import('Contao\Input');
$this->Input->cookie($arrTag[1],$arrTag[2]);
$arrTag[2]=""; // damit nicht aus versehen mit opt ausgewertet
$varValue = "";
break;
case 'postHtml':
$this->import('Contao\Input');
$varValue = $this->Input->postHtml($arrTag[1]);
Expand Down

0 comments on commit 1fc9b50

Please sign in to comment.